deargui-vpl/ref/virtools/Samples/Managers/DX7 Sound Manager/DxSoundManager.h

138 lines
4.6 KiB
C++

// DXSoundManager.cpp : Defines the entry point for the DLL application.
//
#ifndef DXSoundManager_H
//{secret}
#define DXSoundManager_H "$Id:$"
#include "DXSoundManager.h"
#pragma warning(disable:4786)
/*************************************************
Name: DXSoundManager
Summary: Manages sounds.
TODO :manage the materials properties of sounds obstacles, for occlusion and reflections...
what's the best methos to choose and partitionnate the polygons to throw to the geom engine ????
Remarks:
Sound management is done by the SoundManager which process
sounds to play and updates the listener (player ) position and settings.
Sound management is done using DirectSound but can be disabled at
startup by specify CK_CONFIG_DISABLEDSOUND in the initialization flags of CKInit.
The unique instance of this class may be retrieved through the global function CKGetSoundManager()
{Group:Managers classes}
See also: CKGetSoundManager,CKInit
*************************************************/
class DXSoundManager : public CKSoundManager{
friend class CKWaveSound;
////////////////////////////////////////////////////////
// Public Part ////
////////////////////////////////////////////////////////
public :
// Get the caps of the sound manager
virtual CK_SOUNDMANAGER_CAPS GetCaps() = NULL;
// Creation
virtual void* CreateSource(CK_WAVESOUND_TYPE flags,CKWaveFormat* wf,CKDWORD bytes,BOOL streamed)=NULL;
virtual void* DuplicateSource(void* source)=NULL;
virtual void ReleaseSource(void* source)=NULL;
// Control
virtual void Play(CKWaveSound*,void* source,CKBOOL loop)=NULL;
virtual void Pause(CKWaveSound*,void* source)=NULL;
virtual void SetPlayPosition(void* source,int pos)=NULL;
virtual int GetPlayPosition(void* source)=NULL;
virtual CKBOOL IsPlaying(void* source)=NULL;
// PCM Buffer Informations
virtual CKERROR SetWaveFormat(void* source,CKWaveFormat& wf)=NULL;
virtual CKERROR GetWaveFormat(void* source,CKWaveFormat& wf)=NULL;
virtual int GetWaveSize(void* source)=NULL;
// Buffer access
virtual CKERROR Lock(void* source,CKDWORD dwWriteCursor,CKDWORD dwNumBytes,void **pvAudioPtr1,CKDWORD *dwAudioBytes1,void **pvAudioPtr2,CKDWORD *dwAudioBytes2,CK_WAVESOUND_LOCKMODE dwFlags)=NULL;
virtual CKERROR Unlock(void* source,void *pvAudioPtr1,CKDWORD dwNumBytes1,void *pvAudioPtr2,CKDWORD dwAudioBytes2)=NULL;
// 2D/3D Members Functions
virtual void SetType(void* source,CK_WAVESOUND_TYPE type)=NULL;
virtual CK_WAVESOUND_TYPE GetType(void* source)=NULL;
//----------------------------------------------------------
// 2D/3D Settings
void UpdateSettings(void* source,CK_SOUNDMANAGER_CAPS settingsoptions,CKWaveSoundSettings& settings,CKBOOL set = TRUE)=NULL;
//----------------------------------------------------------
// 3D Settings
void Update3DSettings(void* source,CK_SOUNDMANAGER_CAPS settingsoptions,CKWaveSound3DSettings& settings,CKBOOL set = TRUE)=NULL;
//-----------------------------------------------------
// Listener settings
virtual void UpdateListenerSettings(CK_SOUNDMANAGER_CAPS settingsoptions,CKListenerSettings& settings,CKBOOL set = TRUE)=NULL;
// Initialization
virtual CKERROR OnCKInit()=NULL;
virtual CKERROR OnCKEnd()=NULL;
// Pause Resume
virtual CKERROR OnCKReset()=NULL;
virtual CKERROR OnCKPause();
virtual CKERROR OnCKPlay();
virtual CKERROR PostClearAll();
virtual CKERROR PostProcess() =NULL;
//{secret}
virtual CKDWORD GetValidFunctionsMask() { return CKSoundManager::GetValidFunctionsMask() |
CKMANAGER_FUNC_OnCKPlay|
CKMANAGER_FUNC_PostClearAll|
CKMANAGER_FUNC_OnCKInit|
CKMANAGER_FUNC_OnCKEnd|
CKMANAGER_FUNC_OnCKReset|
CKMANAGER_FUNC_OnCKPause|
CKMANAGER_FUNC_PostProcess|
CKMANAGER_FUNC_OnSequenceToBeDeleted|
CKMANAGER_FUNC_PreLaunchScene;
}
// Virtuals from Base Manager
virtual CKERROR PreLaunchScene(CKScene* OldScene,CKScene* NewScene);
virtual CKERROR SequenceToBeDeleted(CK_ID *objids,int count);
virtual CKBOOL IsInitialized() = NULL;
////////////////////////////////////////////////////////
//// Private Part ////
////////////////////////////////////////////////////////
//{secret}
DXSoundManager(CKContext *Context);
//{secret}
~DXSoundManager();
protected :
// List of sound to resume
XObjectArray m_SoundsPlaying;
DWORD m_Mixing_Location;
XString m_Variable_Manager_Str;
CKBOOL m_Use_Mute_after_Max_in_LOCSOFTWARE;
};
long FloatToDb(float f);
float DbToFloat(long d);
long FloatPanningToDb(float Panning);
float DbPanningToFloat(long d);
#endif