mirror of
https://github.com/elasota/Aerofoil.git
synced 2025-09-23 23:00:42 +00:00
More work. Audio driver works enough to play music now.
This commit is contained in:
49
GpD3D/GpPLGlueAudioChannel.cpp
Normal file
49
GpD3D/GpPLGlueAudioChannel.cpp
Normal file
@@ -0,0 +1,49 @@
|
||||
#include "GpPLGlueAudioChannel.h"
|
||||
#include "ClientAudioChannelContext.h"
|
||||
#include "IGpAudioChannel.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <new>
|
||||
|
||||
void GpPLGlueAudioChannel::SetClientAudioChannelContext(PortabilityLayer::ClientAudioChannelContext *context)
|
||||
{
|
||||
m_clientContext = context;
|
||||
m_audioChannel->SetAudioChannelContext(this);
|
||||
}
|
||||
|
||||
void GpPLGlueAudioChannel::PostBuffer(const void *buffer, size_t bufferSize)
|
||||
{
|
||||
m_audioChannel->PostBuffer(buffer, bufferSize);
|
||||
}
|
||||
|
||||
void GpPLGlueAudioChannel::Destroy()
|
||||
{
|
||||
this->~GpPLGlueAudioChannel();
|
||||
free(this);
|
||||
}
|
||||
|
||||
void GpPLGlueAudioChannel::NotifyBufferFinished()
|
||||
{
|
||||
if (m_clientContext)
|
||||
m_clientContext->NotifyBufferFinished();
|
||||
}
|
||||
|
||||
GpPLGlueAudioChannel *GpPLGlueAudioChannel::Create(IGpAudioChannel *audioChannel)
|
||||
{
|
||||
void *storage = malloc(sizeof(GpPLGlueAudioChannel));
|
||||
if (!storage)
|
||||
return nullptr;
|
||||
|
||||
return new (storage) GpPLGlueAudioChannel(audioChannel);
|
||||
}
|
||||
|
||||
GpPLGlueAudioChannel::GpPLGlueAudioChannel(IGpAudioChannel *audioChannel)
|
||||
: m_audioChannel(audioChannel)
|
||||
, m_clientContext(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
GpPLGlueAudioChannel::~GpPLGlueAudioChannel()
|
||||
{
|
||||
m_audioChannel->Destroy();
|
||||
}
|
Reference in New Issue
Block a user