2019-02-12 00:45:45 +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.
|
|
|
|
\*****************************************************************************/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <windows.h>
|
|
|
|
#include "IS9xSoundOutput.h"
|
|
|
|
#include <mmsystem.h>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
class CWaveOut : public IS9xSoundOutput
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
void BeginPlayback(void);
|
|
|
|
void StopPlayback(void);
|
|
|
|
void ProcessSound(void);
|
2019-02-12 16:56:01 +00:00
|
|
|
int GetAvailableBytes();
|
2019-02-12 18:32:47 +00:00
|
|
|
void RecoverFromUnderrun();
|
2019-02-12 00:45:45 +00:00
|
|
|
|
|
|
|
HWAVEOUT hWaveOut;
|
|
|
|
bool initDone;
|
|
|
|
|
|
|
|
volatile LONG bufferCount;
|
|
|
|
UINT32 sumBufferSize;
|
|
|
|
UINT32 singleBufferSamples;
|
|
|
|
UINT32 singleBufferBytes;
|
|
|
|
const UINT32 blockCount = 8;
|
|
|
|
UINT32 writeOffset;
|
|
|
|
UINT32 partialOffset;
|
|
|
|
std::vector<WAVEHDR> waveHeaders;
|
|
|
|
|
|
|
|
public:
|
|
|
|
CWaveOut(void);
|
|
|
|
~CWaveOut(void);
|
|
|
|
|
|
|
|
// Inherited from IS9xSoundOutput
|
|
|
|
bool InitSoundOutput(void);
|
|
|
|
void DeInitSoundOutput(void);
|
|
|
|
bool SetupSound(void);
|
|
|
|
void SetVolume(double volume);
|
2019-02-12 18:41:44 +00:00
|
|
|
std::vector<std::wstring> GetDeviceList();
|
|
|
|
int FindDeviceIndex(TCHAR *audio_device);
|
2022-02-14 00:05:57 +00:00
|
|
|
|
|
|
|
static void CALLBACK WaveCallback(HWAVEOUT hWave, UINT uMsg, DWORD_PTR dwUser, DWORD_PTR dw1, DWORD_PTR dw2);
|
2019-02-12 18:41:44 +00:00
|
|
|
};
|