GB: Add mAVStream

This commit is contained in:
Jeffrey Pfau 2016-02-14 22:50:08 -08:00
parent bd085ad372
commit de065be15c
3 changed files with 13 additions and 2 deletions

View File

@ -5,6 +5,7 @@
* 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 @@ void _sample(struct GBAudio* audio, int32_t cycles) {
}
}
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) {

View File

@ -115,7 +115,8 @@ static size_t _GBCoreGetAudioBufferSize(struct mCore* core) {
}
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) {

View File

@ -41,6 +41,7 @@ enum GBIRQVector {
};
struct mCoreSync;
struct mAVStream;
struct GB {
struct mCPUComponent d;
@ -61,6 +62,8 @@ struct GB {
struct VFile* romVf;
struct VFile* sramVf;
struct mAVStream* stream;
int32_t eiPending;
};