fix nasty bug on writing to RSP PC. Mario Kart 64 boots now

This commit is contained in:
CocoSimone
2022-10-10 23:35:14 +02:00
parent db4e2caf85
commit 0ac6f07054
19 changed files with 385 additions and 214 deletions

View File

@@ -3,7 +3,7 @@
#include <util.hpp>
namespace n64 {
#define AUDIO_SAMPLE_RATE 48000
#define AUDIO_SAMPLE_RATE 44100
#define SYSTEM_SAMPLE_FORMAT AUDIO_F32SYS
#define SYSTEM_SAMPLE_SIZE 4
#define BYTES_PER_HALF_SECOND ((AUDIO_SAMPLE_RATE / 2) * SYSTEM_SAMPLE_SIZE)
@@ -65,11 +65,13 @@ void InitAudio() {
}
}
void PushSample(float left, float volumeL, float volumeR, float right) {
float samples[2]{ left * volumeL, right * volumeR };
void PushSample(float left, float volumeL, float right, float volumeR) {
float adjustedL = left * volumeL;
float adjustedR = right * volumeR;
float samples[2]{ adjustedL, adjustedR };
int availableBytes = SDL_AudioStreamAvailable(audioStream);
if(availableBytes < BYTES_PER_HALF_SECOND) {
if(availableBytes <= BYTES_PER_HALF_SECOND) {
SDL_AudioStreamPut(audioStream, samples, 2 * sizeof(float));
}
}