mirror of
https://github.com/elasota/Aerofoil.git
synced 2025-09-23 23:00:42 +00:00
55 lines
1.2 KiB
C++
55 lines
1.2 KiB
C++
#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::Stop()
|
|
{
|
|
m_audioChannel->Stop();
|
|
}
|
|
|
|
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();
|
|
}
|