2006-02-25 20:50:29 +00:00
|
|
|
#pragma once
|
|
|
|
|
2009-10-07 21:38:42 +00:00
|
|
|
#define MAX_SAMPLES (16*1024)
|
|
|
|
|
2006-02-25 20:50:29 +00:00
|
|
|
#define SAFE_RELEASE(p) { if(p) { (p)->Release(); (p)=NULL; } }
|
|
|
|
|
2021-03-23 22:01:41 +00:00
|
|
|
struct VOICE
|
2006-02-25 20:50:29 +00:00
|
|
|
{
|
|
|
|
LPDIRECTSOUNDBUFFER lpDSBvoice;
|
|
|
|
LPDIRECTSOUNDNOTIFY lpDSNotify;
|
|
|
|
bool bActive; // Playback is active
|
|
|
|
bool bMute;
|
|
|
|
LONG nVolume; // Current volume (as used by DirectSound)
|
|
|
|
LONG nFadeVolume; // Current fade volume (as used by DirectSound)
|
|
|
|
DWORD dwUserVolume; // Volume from slider on Property Sheet (0=Max)
|
|
|
|
bool bIsSpeaker;
|
|
|
|
bool bRecentlyActive; // (Speaker only) false after 0.2s of speaker inactivity
|
2021-03-23 22:01:41 +00:00
|
|
|
std::string name;
|
2006-02-25 20:50:29 +00:00
|
|
|
|
2021-03-23 22:01:41 +00:00
|
|
|
VOICE(void)
|
|
|
|
{
|
|
|
|
lpDSBvoice = NULL;
|
|
|
|
lpDSNotify = NULL;
|
|
|
|
bActive = false;
|
|
|
|
bMute = false;
|
|
|
|
nVolume = 0;
|
|
|
|
nFadeVolume = 0;
|
|
|
|
dwUserVolume = 0;
|
|
|
|
bIsSpeaker = false;
|
|
|
|
bRecentlyActive = false;
|
|
|
|
name = "";
|
|
|
|
}
|
2023-01-28 18:15:28 +00:00
|
|
|
|
|
|
|
~VOICE(void);
|
2021-03-23 22:01:41 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
typedef VOICE* PVOICE;
|
2006-02-25 20:50:29 +00:00
|
|
|
|
2021-05-16 19:03:59 +00:00
|
|
|
HRESULT DSGetLock(LPDIRECTSOUNDBUFFER pVoice, DWORD dwOffset, DWORD dwBytes,
|
2006-02-25 20:50:29 +00:00
|
|
|
SHORT** ppDSLockedBuffer0, DWORD* pdwDSLockedBufferSize0,
|
|
|
|
SHORT** ppDSLockedBuffer1, DWORD* pdwDSLockedBufferSize1);
|
|
|
|
|
2021-03-23 22:01:41 +00:00
|
|
|
HRESULT DSGetSoundBuffer(VOICE* pVoice, DWORD dwFlags, DWORD dwBufferSize, DWORD nSampleRate, int nChannels, const char* pszDevName);
|
2006-02-25 20:50:29 +00:00
|
|
|
void DSReleaseSoundBuffer(VOICE* pVoice);
|
|
|
|
|
2021-03-23 22:01:41 +00:00
|
|
|
bool DSVoiceStop(PVOICE Voice);
|
|
|
|
bool DSZeroVoiceBuffer(PVOICE Voice, DWORD dwBufferSize);
|
|
|
|
bool DSZeroVoiceWritableBuffer(PVOICE Voice, DWORD dwBufferSize);
|
2006-02-25 20:50:29 +00:00
|
|
|
|
|
|
|
enum eFADE {FADE_NONE, FADE_IN, FADE_OUT};
|
|
|
|
void SoundCore_SetFade(eFADE FadeType);
|
|
|
|
bool SoundCore_GetTimerState();
|
2009-04-20 21:53:20 +00:00
|
|
|
void SoundCore_TweakVolumes();
|
2006-02-25 20:50:29 +00:00
|
|
|
|
2009-10-07 21:38:42 +00:00
|
|
|
int SoundCore_GetErrorInc();
|
|
|
|
void SoundCore_SetErrorInc(const int nErrorInc);
|
|
|
|
int SoundCore_GetErrorMax();
|
|
|
|
void SoundCore_SetErrorMax(const int nErrorMax);
|
|
|
|
|
2006-02-25 20:50:29 +00:00
|
|
|
bool DSInit();
|
|
|
|
void DSUninit();
|
|
|
|
|
|
|
|
LONG NewVolume(DWORD dwVolume, DWORD dwVolumeMax);
|
|
|
|
|
|
|
|
void SysClk_WaitTimer();
|
2007-03-26 21:27:29 +00:00
|
|
|
bool SysClk_InitTimer();
|
2006-02-25 20:50:29 +00:00
|
|
|
void SysClk_UninitTimer();
|
|
|
|
void SysClk_StartTimerUsec(DWORD dwUsecPeriod);
|
|
|
|
void SysClk_StopTimer();
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
extern bool g_bDSAvailable;
|