2018-11-15 23:31:39 +00:00
|
|
|
/*****************************************************************************\
|
|
|
|
Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
|
|
|
|
This file is licensed under the Snes9x License.
|
|
|
|
For further information, consult the LICENSE file in the root directory.
|
|
|
|
\*****************************************************************************/
|
2010-09-25 15:46:12 +00:00
|
|
|
|
|
|
|
// CDirectSound.h: interface for the CDirectSound class.
|
|
|
|
//
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#if !defined(DIRECTSOUND_H_INCLUDED)
|
|
|
|
#define DIRECTSOUND_H_INCLUDED
|
|
|
|
|
|
|
|
#include <windows.h>
|
|
|
|
#include "IS9xSoundOutput.h"
|
|
|
|
|
|
|
|
#if _MSC_VER >= 1000
|
|
|
|
#pragma once
|
|
|
|
#endif // _MSC_VER >= 1000
|
|
|
|
|
|
|
|
class CDirectSound : public IS9xSoundOutput
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
LPDIRECTSOUND lpDS;
|
|
|
|
LPDIRECTSOUNDBUFFER lpDSB; // the buffer used for mixing
|
|
|
|
LPDIRECTSOUNDBUFFER lpDSBPrimary;
|
|
|
|
|
|
|
|
int blockCount; // number of blocks in the buffer
|
|
|
|
int blockSize; // bytes in one block
|
2010-10-04 15:33:42 +00:00
|
|
|
int blockSamples; // samples in one block
|
2010-09-25 15:46:12 +00:00
|
|
|
int bufferSize; // bytes in the whole buffer
|
2010-10-04 15:33:42 +00:00
|
|
|
int blockTime; // ms in one block
|
2010-09-25 15:46:12 +00:00
|
|
|
|
|
|
|
DWORD last_block; // the last block that was mixed
|
|
|
|
|
|
|
|
bool initDone; // has init been called successfully?
|
2010-09-25 15:52:32 +00:00
|
|
|
DWORD hTimer; // mixing timer
|
2010-09-25 15:46:12 +00:00
|
|
|
|
|
|
|
bool InitDirectSound ();
|
|
|
|
void DeInitDirectSound();
|
|
|
|
|
|
|
|
bool InitSoundBuffer();
|
|
|
|
void DeInitSoundBuffer();
|
|
|
|
|
2010-09-25 15:52:32 +00:00
|
|
|
static VOID CALLBACK SoundTimerCallback(UINT uTimerID, UINT uMsg, DWORD_PTR dwUser, DWORD_PTR dw1, DWORD_PTR dw2);
|
2010-09-25 15:46:12 +00:00
|
|
|
|
|
|
|
void ProcessSound();
|
|
|
|
void MixSound();
|
|
|
|
|
|
|
|
public:
|
|
|
|
CDirectSound();
|
|
|
|
~CDirectSound();
|
|
|
|
|
|
|
|
// Inherited from IS9xSoundOutput
|
|
|
|
bool InitSoundOutput(void) { return InitDirectSound(); }
|
|
|
|
void DeInitSoundOutput(void) { DeInitDirectSound(); }
|
|
|
|
bool SetupSound(void);
|
2017-11-24 23:10:44 +00:00
|
|
|
void SetVolume(double volume);
|
2010-09-25 15:46:12 +00:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
extern CDirectSound DirectSound;
|
|
|
|
|
|
|
|
#endif // !defined(DIRECTSOUND_H_INCLUDED)
|