GBA: Add postAudioBuffer callback

This commit is contained in:
Jeffrey Pfau 2015-03-12 00:45:08 -07:00
parent f8933f23c4
commit b6e274c3d4
4 changed files with 10 additions and 2 deletions

View File

@ -822,10 +822,15 @@ static void _sample(struct GBAAudio* audio) {
}
produced = blip_samples_avail(audio->left);
#endif
if (audio->p->stream) {
if (audio->p->stream && audio->p->stream->postAudioFrame) {
audio->p->stream->postAudioFrame(audio->p->stream, sampleLeft, sampleRight);
}
GBASyncProduceAudio(audio->p->sync, produced >= audio->samples);
bool wait = produced >= audio->samples;
GBASyncProduceAudio(audio->p->sync, wait);
if (wait && audio->p->stream && audio->p->stream->postAudioBuffer) {
audio->p->stream->postAudioBuffer(audio->p->stream, audio);
}
}
void GBAAudioSerialize(const struct GBAAudio* audio, struct GBASerializedState* state) {

View File

@ -99,6 +99,7 @@ typedef void (*GBALogHandler)(struct GBAThread*, enum GBALogLevel, const char* f
struct GBAAVStream {
void (*postVideoFrame)(struct GBAAVStream*, struct GBAVideoRenderer* renderer);
void (*postAudioFrame)(struct GBAAVStream*, int16_t left, int16_t right);
void (*postAudioBuffer)(struct GBAAVStream*, struct GBAAudio*);
};
struct GBATimer {

View File

@ -33,6 +33,7 @@ void FFmpegEncoderInit(struct FFmpegEncoder* encoder) {
encoder->d.postVideoFrame = _ffmpegPostVideoFrame;
encoder->d.postAudioFrame = _ffmpegPostAudioFrame;
encoder->d.postAudioBuffer = 0;
encoder->audioCodec = 0;
encoder->videoCodec = 0;

View File

@ -15,6 +15,7 @@ void ImageMagickGIFEncoderInit(struct ImageMagickGIFEncoder* encoder) {
encoder->d.postVideoFrame = _magickPostVideoFrame;
encoder->d.postAudioFrame = _magickPostAudioFrame;
encoder->d.postAudioBuffer = 0;
encoder->frameskip = 2;
}