Main Page Modules Namespace List Class Hierarchy Alphabetical List Compound List File List Namespace Members Compound Members File Members Related Pages

# DirectSound.hpp

Go to the documentation of this file.

    00001 ///////////////////////////////////////////////////////////////////////////////
    00002 /// @file DirectSound.hpp
    00003 ///
    00004 /// @brief Destiny Sound System DirectSound interface
    00005 ///
    00006 /// @author paradoxnj
    00007 ///
    00008 /// This file is the intellectual property of Novus Delta, LLC.. Usage of the
    00009 /// contents of this file is subject to the Destiny3D Member License which
    00010 /// can be found at http://www.destiny3d.com.  Any other usage is prohibited.
    00011 ///
    00012 /// This file is distributed "AS IS" without warranty of any kind.  Novus
    00013 /// Delta, LLC. does not guarantee the fitness of the contents of this file
    00014 /// for any particular purpose.
    00015 ///
    00016 /// Copyright (C) 2001-2003 Novus Delta, LLC. All Rights Reserved.
    00017 ///
    00018 /// <hr>
    00019 ///                                 Change History
    00020 /// <hr>
    00021 ///
    00022 /// @date Jan 2002
    00023 /// @author paradoxnj
    00024 /// @remarks Creation
    00025 ///
    00026 ///////////////////////////////////////////////////////////////////////////////
    00027
    00028 #ifndef DIRECTSOUND_H
    00029 #define DIRECTSOUND_H
    00030
    00031 //#include <windows.h>
    00032 #include <dsound.h>
    00033
    00034 #include "deSound_priv.hpp"
    00035 #include "Channels.hpp"
    00036
    00037 class IdeSoundSystem_DS : public IdeSoundSystem, public deRefCountBase
    00038 {
    00039 public:
    00040     IdeSoundSystem_DS();
    00041     virtual ~IdeSoundSystem_DS();
    00042
    00043 public:
    00044     IDirectSound8               *m_pDS;
    00045     IDirectSoundBuffer          *m_pPrimaryBuffer;
    00046     IDirectSound3DListener      *m_pListener;
    00047
    00048     WAVEFORMATEX                m_Format;
    00049     int                         m_RefCount;
    00050
    00051 public:
    00052     void                        *GetInterface(int interface_id);
    00053
    00054     deBoolean                   Initialize(HWND hWnd);
    00055     void                        Destroy();
    00056
    00057     IdeSoundBuffer              *CreateSoundBuffer(IdeSoundData *sndData);
    00058
    00059     float                       GetRollOffFactor();
    00060     float                       GetDopplerFactor();
    00061     float                       GetDistanceFactor();
    00062
    00063     void                        SetRollOffFactor(float factor);
    00064     void                        SetDopplerFactor(float factor);
    00065     void                        SetDistanceFactor(float factor);
    00066
    00067     deBoolean                   GetListenerPosition(float *x, float *y, float *z);
    00068     deBoolean                   GetListenerPosition(deVec3d *pos);
    00069
    00070     deBoolean                   GetListenerVelocity(float *x, float *y, float *z);
    00071     deBoolean                   GetListenerVelocity(deVec3d *vel);
    00072
    00073     deBoolean                   GetListenerOrientation(float *Fx, float *Fy, float *Fz, float *Tx, float *Ty, float *Tz);
    00074     deBoolean                   GetListenerOrientation(deVec3d *Front, deVec3d *Top);
    00075
    00076     void                        SetListenerPosition(float x, float y, float z);
    00077     void                        SetListenerPosition(deVec3d pos);
    00078
    00079     void                        SetListenerVelocity(float x, float y, float z);
    00080     void                        SetListenerVelocity(deVec3d vel);
    00081
    00082     void                        SetListenerOrientation(float Fx, float Fy, float Fz, float Tx, float Ty, float Tz);
    00083     void                        SetListenerOrientation(deVec3d Front, deVec3d Top);
    00084 };
    00085
    00086 class IdeSoundBuffer_DS : public IdeSoundBuffer, public deRefCountBase
    00087 {
    00088 public:
    00089     IdeSoundBuffer_DS();
    00090     IdeSoundBuffer_DS(IdeSoundSystem *ss, IdeSoundData *data);
    00091     virtual ~IdeSoundBuffer_DS();
    00092
    00093 public:
    00094     IDirectSoundBuffer          *m_pBuffer;
    00095     IDirectSound3DBuffer        *m_p3DBuffer;
    00096     WAVEFORMATEX                m_Format;
    00097     DSBUFFERDESC                m_Desc;
    00098
    00099     deSoundCfg                  m_Cfg;
    00100
    00101     IdeSoundSystem_DS           *m_pSS;
    00102     int                         m_RefCount;
    00103
    00104     IdeSoundData                *m_pData;
    00105
    00106     DWORD                       m_BufferSize;
    00107     int                         m_CurrWritePos;
    00108     DWORD                       m_DataPosition;
    00109     DWORD                       m_SecureDistance;
    00110     u32                         m_LastPlayPos;
    00111     u32                         m_BufferLoops;
    00112
    00113     deBoolean                   m_Loop;
    00114
    00115 public:
    00116     deBoolean                   Initialize(IdeSoundSystem *ss, IdeSoundData *data);
    00117     deBoolean                   Destroy();
    00118
    00119     IdeResourceBase             *MakeCopy();
    00120     void                        *GetInterface(int interface_id);
    00121
    00122     void                        GetConfig(deSoundCfg &Cfg);
    00123     void                        SetConfig(deSoundCfg Cfg);
    00124
    00125     deBoolean                   SetVolume(long vol);
    00126     deBoolean                   SetPan(long pan);
    00127     deBoolean                   SetFrequency(long freq);
    00128
    00129     long                        GetVolume();
    00130     long                        GetPan();
    00131     long                        GetFrequency();
    00132
    00133     deBoolean                   ApplySettings();
    00134
    00135     deBoolean                   Play(deBoolean loop = deFALSE);
    00136     deBoolean                   Update();
    00137     deBoolean                   Stop(deBoolean rewind = deTRUE);
    00138     deBoolean                   IsPlaying();
    00139     deBoolean                   Rewind();
    00140 };
    00141
    00142 #endif
    00143