• Main Page
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

src/audio/header/OpenAL.h

Go to the documentation of this file.
00001 #pragma once
00002 
00003 #ifdef _DEBUG
00004 #       define LOG(text) printf("%s", text)
00005 #       define LOGLN(text) printf("%s\n", text)
00006 #else
00007 #       define LOG(text)
00008 #       define LOGLN(text)
00009 #endif
00010 
00011 #pragma comment(lib,"OpenAL32.lib")
00012 #include <al.h>
00013 #include <alc.h>
00014 
00015 #define NAMESPACE AL
00016 #define STARTNAMESPACE namespace AL{
00017 #define ENDNAMESPACE }
00018 
00019 #include <util.h>
00020 #include <module.h>
00021 #include "../include/audio.h"
00022 #include "OpenAL_types.h"
00023 
00024 STARTNAMESPACE
00025 
00026 class OpenAL :
00027         public IAudio {
00028 public:
00029         OpenAL();
00030         ~OpenAL();
00031 
00032         bool init(void);
00033         void uninit();
00034 
00035 	::pBuffer createBuffer(const wchar* file, FILEFORMAT format);
00036 	::pSound createSound(::pBuffer buffer, bool dynamic,
00037                 float3* position, float3* velocity, float3* direction,
00038                 float distance, float coneAngle, bool loop, float volume);
00039 	::pMusic createMusic(const wchar* file, bool loop, float volume, FILEFORMAT format);
00040 
00041         void free(::pBuffer& buffer);
00042         void free(::pSound& sound);
00043         void free(::pMusic& musik);
00044 
00045         void listener(float3 position, float3 velocity, float3 direction);
00046         void options(float doppler, float speedofsound);
00047 
00048         void update(void);
00049 
00050         bool supports(FILEFORMAT fileformat, bool forSound = true);
00051 
00052 private:
00053         FILEFORMAT getFormatByExt(const wchar* ext);
00054 
00055         float3 defaultPos;
00056         float3 defaultVel;
00057         Orientation defaultOri;
00058         ALCdevice* m_device;
00059         ALCcontext* m_context;
00060         SListener m_listener;
00061         ArrayList<Sound*> m_soundlist;
00062         ArrayList<Music*> m_musiclist;
00063 };
00064 
00065 ENDNAMESPACE

Generated on Fri Jun 18 2010 17:48:39 for Cannonball by  doxygen 1.7.0