mirror of https://github.com/mgba-emu/mgba.git
Core: Add functions to get native sample rates
This commit is contained in:
parent
73a39dea65
commit
7b2edbd1bd
|
@ -78,6 +78,7 @@ struct mCore {
|
|||
void (*getPixels)(struct mCore*, const void** buffer, size_t* stride);
|
||||
void (*putPixels)(struct mCore*, const void* buffer, size_t stride);
|
||||
|
||||
unsigned (*audioSampleRate)(const struct mCore*);
|
||||
struct blip_t* (*getAudioChannel)(struct mCore*, int ch);
|
||||
void (*setAudioBufferSize)(struct mCore*, size_t samples);
|
||||
size_t (*getAudioBufferSize)(struct mCore*);
|
||||
|
|
|
@ -445,6 +445,11 @@ static void _GBCoreSetAudioBufferSize(struct mCore* core, size_t samples) {
|
|||
GBAudioResizeBuffer(&gb->audio, samples);
|
||||
}
|
||||
|
||||
static unsigned _GBCoreAudioSampleRate(const struct mCore* core) {
|
||||
UNUSED(core);
|
||||
return 131072;
|
||||
}
|
||||
|
||||
static size_t _GBCoreGetAudioBufferSize(struct mCore* core) {
|
||||
struct GB* gb = core->board;
|
||||
return gb->audio.samples;
|
||||
|
@ -1302,6 +1307,7 @@ struct mCore* GBCoreCreate(void) {
|
|||
core->setVideoGLTex = _GBCoreSetVideoGLTex;
|
||||
core->getPixels = _GBCoreGetPixels;
|
||||
core->putPixels = _GBCorePutPixels;
|
||||
core->audioSampleRate = _GBCoreAudioSampleRate;
|
||||
core->getAudioChannel = _GBCoreGetAudioChannel;
|
||||
core->setAudioBufferSize = _GBCoreSetAudioBufferSize;
|
||||
core->getAudioBufferSize = _GBCoreGetAudioBufferSize;
|
||||
|
|
|
@ -559,6 +559,11 @@ static void _GBACorePutPixels(struct mCore* core, const void* buffer, size_t str
|
|||
gba->video.renderer->putPixels(gba->video.renderer, stride, buffer);
|
||||
}
|
||||
|
||||
static unsigned _GBACoreAudioSampleRate(const struct mCore* core) {
|
||||
UNUSED(core);
|
||||
return 65536;
|
||||
}
|
||||
|
||||
static struct blip_t* _GBACoreGetAudioChannel(struct mCore* core, int ch) {
|
||||
struct GBA* gba = core->board;
|
||||
switch (ch) {
|
||||
|
@ -1515,6 +1520,7 @@ struct mCore* GBACoreCreate(void) {
|
|||
core->setVideoGLTex = _GBACoreSetVideoGLTex;
|
||||
core->getPixels = _GBACoreGetPixels;
|
||||
core->putPixels = _GBACorePutPixels;
|
||||
core->audioSampleRate = _GBACoreAudioSampleRate;
|
||||
core->getAudioChannel = _GBACoreGetAudioChannel;
|
||||
core->setAudioBufferSize = _GBACoreSetAudioBufferSize;
|
||||
core->getAudioBufferSize = _GBACoreGetAudioBufferSize;
|
||||
|
|
Loading…
Reference in New Issue