namespace VideoCaptureServices
{
void Initialize();
void Finalize();
void CaptureSingleFrame();
}
namespace AudioCaptureServices
{
void Initialize(unsigned in_uSampleRate, unsigned in_uChannels);
void Finalize();
void CaptureInterleavedSamples(float* in_pfSamples, unsigned in_uSampleCount);
}
class GameInterface
{
public:
virtual void UpdateCallback(float deltaTime
) = 0;
};
class Game : public GameInterface
{
private:
bool m_bIsOfflineRendering{ false };
{
const unsigned uSampleCount =
static_cast<unsigned>(in_CaptureBuffer.
uValidFrames) * in_CaptureBuffer.
NumChannels();
if (!uSampleCount)
return;
AudioCaptureServices::CaptureInterleavedSamples(in_CaptureBuffer.
GetInterleavedData(), uSampleCount);
}
public:
)
{
const bool bWasOfflineRendering{ m_bIsOfflineRendering };
m_bIsOfflineRendering = bIsOfflineRendering;
if (m_bIsOfflineRendering == bWasOfflineRendering)
return;
if (m_bIsOfflineRendering)
{
VideoCaptureServices::Initialize();
AudioCaptureServices::Initialize(uSampleRate, channelConfig.uNumChannels);
}
else
{
AudioCaptureServices::Finalize();
VideoCaptureServices::Finalize();
}
}
void UpdateCallback(float deltaTime) override
{
if (m_bIsOfflineRendering)
if (m_bIsOfflineRendering)
VideoCaptureServices::CaptureSingleFrame();
}
};