Initial re-upload of spice2x-24-08-24
This commit is contained in:
57
hooks/audio/backends/wasapi/dummy_audio_render_client.cpp
Normal file
57
hooks/audio/backends/wasapi/dummy_audio_render_client.cpp
Normal file
@@ -0,0 +1,57 @@
|
||||
#include "dummy_audio_render_client.h"
|
||||
|
||||
#include "dummy_audio_client.h"
|
||||
#include "wasapi_private.h"
|
||||
|
||||
const char CLASS_NAME[] = "DummyIAudioRenderClient";
|
||||
|
||||
HRESULT STDMETHODCALLTYPE DummyIAudioRenderClient::QueryInterface(REFIID riid, void **ppvObj) {
|
||||
if (ppvObj == nullptr) {
|
||||
return E_POINTER;
|
||||
}
|
||||
|
||||
if (riid == IID_DummyIAudioRenderClient ||
|
||||
riid == IID_IAudioRenderClient)
|
||||
{
|
||||
this->AddRef();
|
||||
*ppvObj = this;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
ULONG STDMETHODCALLTYPE DummyIAudioRenderClient::AddRef() {
|
||||
return ++this->ref_cnt;
|
||||
}
|
||||
ULONG STDMETHODCALLTYPE DummyIAudioRenderClient::Release() {
|
||||
ULONG refs = --this->ref_cnt;
|
||||
|
||||
if (refs == 0) {
|
||||
delete this;
|
||||
}
|
||||
|
||||
return refs;
|
||||
}
|
||||
|
||||
// IAudioRenderClient
|
||||
HRESULT STDMETHODCALLTYPE DummyIAudioRenderClient::GetBuffer(UINT32 NumFramesRequested, BYTE **ppData) {
|
||||
static std::once_flag printed;
|
||||
std::call_once(printed, []() {
|
||||
log_misc("audio::wasapi", "DummyIAudioRenderClient::GetBuffer");
|
||||
});
|
||||
|
||||
CHECK_RESULT(this->client->backend->on_get_buffer(
|
||||
NumFramesRequested,
|
||||
ppData));
|
||||
}
|
||||
HRESULT STDMETHODCALLTYPE DummyIAudioRenderClient::ReleaseBuffer(UINT32 NumFramesWritten, DWORD dwFlags) {
|
||||
static std::once_flag printed;
|
||||
std::call_once(printed, []() {
|
||||
log_misc("audio::wasapi", "DummyIAudioRenderClient::ReleaseBuffer");
|
||||
});
|
||||
|
||||
CHECK_RESULT(this->client->backend->on_release_buffer(
|
||||
NumFramesWritten,
|
||||
dwFlags));
|
||||
}
|
||||
Reference in New Issue
Block a user