mirror of https://github.com/mgba-emu/mgba.git
GBA: Add postAudioBuffer callback
This commit is contained in:
parent
f8933f23c4
commit
b6e274c3d4
|
@ -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) {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -15,6 +15,7 @@ void ImageMagickGIFEncoderInit(struct ImageMagickGIFEncoder* encoder) {
|
|||
|
||||
encoder->d.postVideoFrame = _magickPostVideoFrame;
|
||||
encoder->d.postAudioFrame = _magickPostAudioFrame;
|
||||
encoder->d.postAudioBuffer = 0;
|
||||
|
||||
encoder->frameskip = 2;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue