all repos — mgba @ de065be15c1308aca3827a5c5953ede501c3b50a

mGBA Game Boy Advance Emulator

GB: Add mAVStream
Jeffrey Pfau jeffrey@endrift.com
Sun, 14 Feb 2016 22:50:08 -0800
commit

de065be15c1308aca3827a5c5953ede501c3b50a

parent

bd085ad3726cce0a406641ed280a06e302dfc686

3 files changed, 13 insertions(+), 2 deletions(-)

jump to
M src/gb/audio.csrc/gb/audio.c

@@ -5,6 +5,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this

* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "audio.h" +#include "core/interface.h" #include "core/sync.h" #include "gb/gb.h" #include "gb/io.h"

@@ -671,9 +672,15 @@ audio->clock -= CLOCKS_PER_BLIP_FRAME;

} } produced = blip_samples_avail(audio->left); + if (audio->p->stream && audio->p->stream->postAudioFrame) { + audio->p->stream->postAudioFrame(audio->p->stream, sampleLeft, sampleRight); + } bool wait = produced >= audio->samples; mCoreSyncProduceAudio(audio->p->sync, wait); - // TODO: Put AVStream back + + if (wait && audio->p->stream && audio->p->stream->postAudioBuffer) { + audio->p->stream->postAudioBuffer(audio->p->stream, audio->left, audio->right); + } } void _writeDuty(struct GBAudioEnvelope* envelope, uint8_t value) {
M src/gb/core.csrc/gb/core.c

@@ -115,7 +115,8 @@ return gb->audio.samples;

} static void _GBCoreSetAVStream(struct mCore* core, struct mAVStream* stream) { - // TODO + struct GB* gb = core->board; + gb->stream = stream; } static bool _GBCoreLoadROM(struct mCore* core, struct VFile* vf) {
M src/gb/gb.hsrc/gb/gb.h

@@ -41,6 +41,7 @@ GB_VECTOR_KEYPAD = 0x60,

}; struct mCoreSync; +struct mAVStream; struct GB { struct mCPUComponent d;

@@ -60,6 +61,8 @@ size_t yankedRomSize;

uint32_t romCrc32; struct VFile* romVf; struct VFile* sramVf; + + struct mAVStream* stream; int32_t eiPending; };