mirror of https://github.com/mgba-emu/mgba.git
Core: Rename GBAStereoSample to mStereoSample
This commit is contained in:
parent
a0613e27ab
commit
33b3d33da2
|
@ -194,6 +194,11 @@ struct mAVStream {
|
|||
void (*postAudioBuffer)(struct mAVStream*, struct blip_t* left, struct blip_t* right);
|
||||
};
|
||||
|
||||
struct mStereoSample {
|
||||
int16_t left;
|
||||
int16_t right;
|
||||
};
|
||||
|
||||
struct mKeyCallback {
|
||||
uint16_t (*readKeys)(struct mKeyCallback*);
|
||||
bool requireOpposingDirections;
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
CXX_GUARD_START
|
||||
|
||||
#include <mgba/core/cpu.h>
|
||||
#include <mgba/core/interface.h>
|
||||
#include <mgba/core/log.h>
|
||||
#include <mgba/internal/gb/audio.h>
|
||||
#include <mgba-util/circle-buffer.h>
|
||||
|
@ -94,11 +95,6 @@ struct GBAAudio {
|
|||
struct mTimingEvent sampleEvent;
|
||||
};
|
||||
|
||||
struct GBAStereoSample {
|
||||
int16_t left;
|
||||
int16_t right;
|
||||
};
|
||||
|
||||
struct GBAMP2kADSR {
|
||||
uint8_t attack;
|
||||
uint8_t decay;
|
||||
|
@ -278,7 +274,7 @@ struct GBAAudioMixer {
|
|||
double tempo;
|
||||
double frame;
|
||||
|
||||
struct GBAStereoSample last;
|
||||
struct mStereoSample last;
|
||||
};
|
||||
|
||||
void GBAAudioInit(struct GBAAudio* audio, size_t samples);
|
||||
|
|
|
@ -125,7 +125,7 @@ static void _stepSample(struct GBAAudioMixer* mixer, struct GBAMP2kTrack* track)
|
|||
for (nSample = 0; nSample < updates; ++nSample) {
|
||||
int8_t sample = memory->load8(cpu, sampleBase + sampleI, 0);
|
||||
|
||||
struct GBAStereoSample stereo = {
|
||||
struct mStereoSample stereo = {
|
||||
(sample * track->channel->leftVolume * track->channel->envelopeV) >> 9,
|
||||
(sample * track->channel->rightVolume * track->channel->envelopeV) >> 9
|
||||
};
|
||||
|
@ -277,7 +277,7 @@ void _mp2kStep(struct GBAAudioMixer* mixer) {
|
|||
uint32_t interval = mixer->p->sampleInterval / OVERSAMPLE;
|
||||
int i;
|
||||
for (i = 0; i < OVERSAMPLE; ++i) {
|
||||
struct GBAStereoSample sample = {0};
|
||||
struct mStereoSample sample = {0};
|
||||
size_t track;
|
||||
for (track = 0; track < MP2K_MAX_SOUND_CHANNELS; ++track) {
|
||||
if (!mixer->activeTracks[track].channel->status) {
|
||||
|
|
|
@ -88,7 +88,7 @@ static vita2d_texture* backdrop = 0;
|
|||
#define PSP2_AUDIO_BUFFER_SIZE (PSP2_SAMPLES * 16)
|
||||
|
||||
static struct mPSP2AudioContext {
|
||||
struct GBAStereoSample buffer[PSP2_AUDIO_BUFFER_SIZE];
|
||||
struct mStereoSample buffer[PSP2_AUDIO_BUFFER_SIZE];
|
||||
size_t writeOffset;
|
||||
size_t readOffset;
|
||||
size_t samples;
|
||||
|
@ -255,7 +255,7 @@ static void _postAudioBuffer(struct mAVStream* stream, blip_t* left, blip_t* rig
|
|||
}
|
||||
ConditionWait(&audioContext.cond, &audioContext.mutex);
|
||||
}
|
||||
struct GBAStereoSample* samples = &audioContext.buffer[audioContext.writeOffset];
|
||||
struct mStereoSample* samples = &audioContext.buffer[audioContext.writeOffset];
|
||||
blip_read_samples(left, &samples[0].left, PSP2_SAMPLES, true);
|
||||
blip_read_samples(right, &samples[0].right, PSP2_SAMPLES, true);
|
||||
audioContext.samples += PSP2_SAMPLES;
|
||||
|
|
|
@ -45,17 +45,17 @@ qint64 AudioDevice::readData(char* data, qint64 maxSize) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
maxSize /= sizeof(GBAStereoSample);
|
||||
maxSize /= sizeof(mStereoSample);
|
||||
mCoreSyncLockAudio(&m_context->impl->sync);
|
||||
int available = std::min<qint64>({
|
||||
blip_samples_avail(m_context->core->getAudioChannel(m_context->core, 0)),
|
||||
maxSize,
|
||||
std::numeric_limits<int>::max()
|
||||
});
|
||||
blip_read_samples(m_context->core->getAudioChannel(m_context->core, 0), &reinterpret_cast<GBAStereoSample*>(data)->left, available, true);
|
||||
blip_read_samples(m_context->core->getAudioChannel(m_context->core, 1), &reinterpret_cast<GBAStereoSample*>(data)->right, available, true);
|
||||
blip_read_samples(m_context->core->getAudioChannel(m_context->core, 0), &reinterpret_cast<mStereoSample*>(data)->left, available, true);
|
||||
blip_read_samples(m_context->core->getAudioChannel(m_context->core, 1), &reinterpret_cast<mStereoSample*>(data)->right, available, true);
|
||||
mCoreSyncConsumeAudio(&m_context->impl->sync);
|
||||
return available * sizeof(GBAStereoSample);
|
||||
return available * sizeof(mStereoSample);
|
||||
}
|
||||
|
||||
qint64 AudioDevice::writeData(const char*, qint64) {
|
||||
|
|
|
@ -115,7 +115,7 @@ static float gyroZ = 0;
|
|||
static float tiltX = 0;
|
||||
static float tiltY = 0;
|
||||
|
||||
static struct GBAStereoSample audioBuffer[N_BUFFERS][BUFFER_SIZE / 4] __attribute__((__aligned__(0x1000)));
|
||||
static struct mStereoSample audioBuffer[N_BUFFERS][BUFFER_SIZE / 4] __attribute__((__aligned__(0x1000)));
|
||||
|
||||
static enum ScreenMode {
|
||||
SM_PA,
|
||||
|
@ -584,7 +584,7 @@ static void _postAudioBuffer(struct mAVStream* stream, blip_t* left, blip_t* rig
|
|||
blip_clear(right);
|
||||
return;
|
||||
}
|
||||
struct GBAStereoSample* samples = audioBuffer[audioBufferActive];
|
||||
struct mStereoSample* samples = audioBuffer[audioBufferActive];
|
||||
blip_read_samples(left, &samples[0].left, SAMPLES, true);
|
||||
blip_read_samples(right, &samples[0].right, SAMPLES, true);
|
||||
audoutAppendAudioOutBuffer(&audoutBuffer[audioBufferActive]);
|
||||
|
|
|
@ -141,7 +141,7 @@ static void* framebuffer[2] = { 0, 0 };
|
|||
static int whichFb = 0;
|
||||
|
||||
static struct AudioBuffer {
|
||||
struct GBAStereoSample samples[SAMPLES] __attribute__((__aligned__(32)));
|
||||
struct mStereoSample samples[SAMPLES] __attribute__((__aligned__(32)));
|
||||
volatile size_t size;
|
||||
} audioBuffer[BUFFERS] = {0};
|
||||
static volatile int currentAudioBuffer = 0;
|
||||
|
@ -685,8 +685,8 @@ static void _audioDMA(void) {
|
|||
if (buffer->size != SAMPLES) {
|
||||
return;
|
||||
}
|
||||
DCFlushRange(buffer->samples, SAMPLES * sizeof(struct GBAStereoSample));
|
||||
AUDIO_InitDMA((u32) buffer->samples, SAMPLES * sizeof(struct GBAStereoSample));
|
||||
DCFlushRange(buffer->samples, SAMPLES * sizeof(struct mStereoSample));
|
||||
AUDIO_InitDMA((u32) buffer->samples, SAMPLES * sizeof(struct mStereoSample));
|
||||
buffer->size = 0;
|
||||
currentAudioBuffer = (currentAudioBuffer + 1) % BUFFERS;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue