mirror of
https://github.com/AppleWin/AppleWin.git
synced 2026-03-15 20:16:30 +00:00
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.
26 lines
977 B
C++
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;
|
|
};
|