mirror of https://github.com/mgba-emu/mgba.git
GB: Add mAVStream
This commit is contained in:
parent
bd085ad372
commit
de065be15c
|
@ -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) {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue