lugre_sound.h

Go to the documentation of this file.
00001 /*
00002 http://www.opensource.org/licenses/mit-license.php  (MIT-License)
00003 
00004 Copyright (c) 2007 Lugre-Team
00005 
00006 Permission is hereby granted, free of charge, to any person obtaining a copy
00007 of this software and associated documentation files (the "Software"), to deal
00008 in the Software without restriction, including without limitation the rights
00009 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
00010 copies of the Software, and to permit persons to whom the Software is
00011 furnished to do so, subject to the following conditions:
00012 
00013 The above copyright notice and this permission notice shall be included in
00014 all copies or substantial portions of the Software.
00015 
00016 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00017 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00018 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
00019 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
00020 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
00021 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
00022 THE SOFTWARE.
00023 */
00024 #ifndef LUGRE_SOUND_H
00025 #define LUGRE_SOUND_H
00026 
00027 #include "lugre_smartptr.h"
00028 
00029 class lua_State;
00030 
00031 namespace Lugre {
00032 
00034 class cSoundSource : public cSmartPointable {
00035 protected:
00036     cSoundSource(){};
00037 public:
00038     virtual ~cSoundSource(){};
00039 
00041     virtual const bool Play() = 0;
00043     virtual const bool IsPlaying() = 0;
00045     virtual const bool IsPaused() = 0;
00047     virtual void Stop() = 0;
00049     virtual void Pause() = 0;
00050 
00052     virtual void SetVolume(const float volume) = 0;
00053     virtual const float GetVolume() = 0;
00054 
00056     virtual void SetMinMaxDistance(const float min, const float max) = 0;
00057     virtual void GetMinMaxDistance(float &min, float &max) = 0;
00058 
00059     
00061 
00063     virtual bool Is3D() = 0;
00064     
00066     virtual void SetPosition(const float x, const float y, const float z) = 0;
00068     virtual void SetVelocity(const float x, const float y, const float z) = 0;
00069 
00071     virtual void GetPosition(float &x, float &y, float &z) = 0;
00073     virtual void GetVelocity(float &x, float &y, float &z) = 0;
00074 
00075     // lua binding
00076     static void     LuaRegister     (lua_State *L);
00077 };
00078 
00079 class cSoundSystem : public cSmartPointable {
00080 protected:
00081     cSoundSystem(){};
00082 public:
00083     virtual ~cSoundSystem(){};
00084 
00086     virtual void SetListenerPosition(const float x, const float y, const float z) = 0;  
00088     virtual void SetListenerVelocity(const float x, const float y, const float z) = 0;
00090     virtual void GetListenerPosition(float &x, float &y, float &z) = 0;
00092     virtual void GetListenerVelocity(float &x, float &y, float &z) = 0;
00093 
00095     virtual void SetVolume(const float volume) = 0;
00096     virtual const float GetVolume() = 0;
00097 
00100     virtual void SetDistanceFactor(const float s) = 0;
00101     virtual const float GetDistanceFactor() = 0;
00102 
00104     virtual cSoundSource *CreateSoundSource(const char *filename) = 0;
00106     virtual cSoundSource *CreateSoundSource(const char *buffer, const int size, const int channels, const int bitrate, const int frequency) = 0;
00107 
00109     virtual cSoundSource *CreateSoundSource3D(const float x, const float y, const float z, const char *filename) = 0;
00111     virtual cSoundSource *CreateSoundSource3D(const float x, const float y, const float z, const char *buffer, const int size, const int channels, const int bitrate, const int frequency) = 0;
00112     
00114     virtual void Step() = 0;
00115 
00116     // lua binding
00117     static void     LuaRegister     (lua_State *L);
00118 };
00119 
00123 cSoundSystem *CreateSoundSystem(const char *name, const int frequency);
00124 
00125 };
00126 
00127 #endif

Generated on Wed May 23 06:00:13 2012 for cpp by  doxygen 1.5.6