Changed some calculations on audio

This commit is contained in:
KiritoDv
2024-11-14 23:08:26 -06:00
parent f07a9b6c81
commit b5ad9cc836
2 changed files with 6 additions and 7 deletions
+2 -2
View File
@@ -16,8 +16,8 @@
#define ROUND_DOWN_16(v) ((v) & ~0xf)
//#define DMEM_BUF_SIZE (0x1000 - 0x0330 - 0x10 - 0x40)
#define DMEM_BUF_SIZE (0x1000 - 0x450 - 0x40)
// #define DMEM_BUF_SIZE 0xC90
//#define DMEM_BUF_SIZE (0x1000 - 0x450 - 0x40)
#define DMEM_BUF_SIZE 0xC90
#define BUF_U8(a) (rspa.buf.as_u8 + ((a)-0x450))
#define BUF_S16(a) (rspa.buf.as_s16 + ((a)-0x450) / sizeof(int16_t))
+4 -5
View File
@@ -68,7 +68,7 @@ GameEngine::GameEngine() {
}
this->context =
Ship::Context::CreateInstance("Starship", "ship", "starship.cfg.json", OTRFiles, {}, 3, { 32000, 1024, 2480 });
Ship::Context::CreateInstance("Starship", "ship", "starship.cfg.json", OTRFiles, {}, 3, { 32000, 512, 1240 });
auto loader = context->GetResourceManager()->GetResourceLoader();
loader->RegisterResourceFactory(std::make_shared<SF64::ResourceFactoryBinaryAnimV0>(), RESOURCE_FORMAT_BINARY,
@@ -149,8 +149,8 @@ void GameEngine::StartFrame() const {
this->context->GetWindow()->StartFrame();
}
#define SAMPLES_HIGH 752
#define SAMPLES_LOW 720
#define SAMPLES_HIGH 560
#define SAMPLES_LOW 528
#define NUM_AUDIO_CHANNELS 2
#define SAMPLES_PER_FRAME (SAMPLES_HIGH * NUM_AUDIO_CHANNELS * 3)
@@ -179,10 +179,9 @@ void GameEngine::HandleAudioThread() {
//#define AUDIO_FRAMES_PER_UPDATE (gVIsPerFrame > 0 ? gVIsPerFrame : 1)
#define AUDIO_FRAMES_PER_UPDATE 2
std::unique_lock<std::mutex> Lock(audio.mutex);
int samples_left = AudioPlayerBuffered();
u32 num_audio_samples = samples_left < AudioPlayerGetDesiredBuffered() ? 560 : 528;
u32 num_audio_samples = samples_left < AudioPlayerGetDesiredBuffered() ? SAMPLES_HIGH : SAMPLES_LOW;
frames++;