gvGetCustomPlaybackAudio

GameSpy SDK

gvGetCustomPlaybackAudio

Retrieves any audio data that is ready to be played through a custom playback device.

GVBool gvGetCustomPlaybackAudio(
GVDevice device,
GVSample * audio,
int numSamples );
RoutineRequired HeaderDistribution
gvGetCustomPlaybackAudio<gv.h>SDKZIP

Return Value

GVTrue if the audio buffer was filled, GVFalse otherwise.

Parameters

device
[in] The custom playback device from which to retrieve audio.
audio
[out] Buffer to fill with audio samples to be played by the custom device.
numSamples
[in] Size of the audio buffer in samples. Must be a multiple of the current samplesPerFrame.

Remarks

numSamples must be a multiple of the samples per frame for the current codec (which you can check using gvGetCodecInfo). This is because GV mixes audio a frame at a time.
This function should be called at the same rate at which the custom playback device is actually playing audio. In other words, the physicial device should be pulling data with this function when it needs it - the data is not being pushed to the physical device. This is because the SDK compensates for differences in audio clock rates, and calling it at the correct rate will ensure a consistent rate of playback.
The GV_SAMPLES_PER_SECOND and GV_BITE_PER_SAMPLE defines can be used to determine the sample rate and bitrate of the audio.

Section Reference: Gamespy Voice SDK

See Also: gvNewCustomDevice