Files
AppleWin/source/SoundBuffer.h
Jamiras a2b03483ee Add SoundBuffer interface (PR #1352)
This replaces the LPDIRECTSOUNDBUFFER pointer with a pure virtual class and an implementation that wraps the LPDIRECTSOUNDBUFFER, allowing other sound implementations without having to simulate the exact alignment of a DIRECTSOUNDBUFFER object.

Additionally, moves the DSInit and DSUninit calls out of the SoundCore.cpp file (into a new DXSoundBuffer.cpp (for Windows)), allowing them to be appropriately reimplemented in a non-DirectSound environment.
2024-12-30 12:42:26 +00:00

26 lines
977 B
C++

#pragma once
class SoundBuffer
{
public:
virtual ~SoundBuffer() = default;
virtual HRESULT Init(DWORD dwFlags, DWORD dwBufferSize, DWORD nSampleRate, int nChannels, LPCSTR pDevName) = 0;
virtual HRESULT Release() = 0;
virtual HRESULT SetCurrentPosition(DWORD dwNewPosition) = 0;
virtual HRESULT GetCurrentPosition(LPDWORD lpdwCurrentPlayCursor, LPDWORD lpdwCurrentWriteCursor) = 0;
virtual HRESULT Lock(DWORD dwWriteCursor, DWORD dwWriteBytes, LPVOID* lplpvAudioPtr1, DWORD* lpdwAudioBytes1, LPVOID* lplpvAudioPtr2, DWORD* lpdwAudioBytes2, DWORD dwFlags) = 0;
virtual HRESULT Unlock(LPVOID lpvAudioPtr1, DWORD dwAudioBytes1, LPVOID lpvAudioPtr2, DWORD dwAudioBytes2) = 0;
virtual HRESULT Stop() = 0;
virtual HRESULT Play(DWORD dwReserved1, DWORD dwReserved2, DWORD dwFlags) = 0;
virtual HRESULT SetVolume(LONG lVolume) = 0;
virtual HRESULT GetVolume(LONG* lplVolume) = 0;
virtual HRESULT GetStatus(LPDWORD lpdwStatus) = 0;
virtual HRESULT Restore() = 0;
};