diff options
| author | Sonic Dreamcaster <alejandro.asenjo88@gmail.com> | 2024-11-15 19:32:24 -0300 |
|---|---|---|
| committer | Sonic Dreamcaster <alejandro.asenjo88@gmail.com> | 2024-11-15 19:32:24 -0300 |
| commit | b47b01409dcd4c925f4d56b8312de611abb87118 (patch) | |
| tree | 5e2ba6738e08cd4e31d0b0fd28e377a06fbf5971 /src/port/Engine.cpp | |
| parent | d589fc46064354d8ba8e155bfa8af2707310b17b (diff) | |
reverbs are causing distortion
Diffstat (limited to 'src/port/Engine.cpp')
| -rw-r--r-- | src/port/Engine.cpp | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/src/port/Engine.cpp b/src/port/Engine.cpp index 3342717c..cb01a048 100644 --- a/src/port/Engine.cpp +++ b/src/port/Engine.cpp @@ -25,7 +25,7 @@ #include <BlobFactory.h> #include <VertexFactory.h> #include "audio/GameAudio.h" -//#include "sf64audio_provisional.h" +// #include "sf64audio_provisional.h" #include <Fast3D/gfx_pc.h> #include <Fast3D/gfx_rendering_api.h> @@ -35,7 +35,7 @@ namespace fs = std::filesystem; -//extern "C" AudioBufferParameters gAudioBufferParams; +// extern "C" AudioBufferParameters gAudioBufferParams; #include <utility> @@ -72,7 +72,7 @@ GameEngine::GameEngine() { } this->context = - Ship::Context::CreateInstance("Starship", "ship", "starship.cfg.json", OTRFiles, {}, 3, { 44100, 1024, 2480 }); + Ship::Context::CreateInstance("Starship", "ship", "starship.cfg.json", OTRFiles, {}, 3, { 44100, 1024*2, 2480*2 }); auto loader = context->GetResourceManager()->GetResourceLoader(); loader->RegisterResourceFactory(std::make_shared<SF64::ResourceFactoryBinaryAnimV0>(), RESOURCE_FORMAT_BINARY, @@ -158,12 +158,16 @@ void GameEngine::StartFrame() const { #define SAMPLES_LOW 720 #define NUM_AUDIO_CHANNELS 2 -extern "C" s32 audBuffer = 0; +extern "C" u16 audBuffer = 0; #include <sf64audio_provisional.h> extern "C" volatile s32 gAudioTaskCountQ; int frames = 0; extern "C" int countermin = 0; + +extern "C" unsigned short samples_high = SAMPLES_HIGH; +extern "C" unsigned short samples_low = SAMPLES_LOW; + void GameEngine::HandleAudioThread() { #ifdef PIPE_DEBUG std::ofstream outfile("audio.bin", std::ios::binary | std::ios::app); @@ -179,13 +183,15 @@ void GameEngine::HandleAudioThread() { } } - //gVIsPerFrame = 2; + // gVIsPerFrame = 2; #define AUDIO_FRAMES_PER_UPDATE (gVIsPerFrame > 0 ? gVIsPerFrame : 1) std::unique_lock<std::mutex> Lock(audio.mutex); int samples_left = AudioPlayerBuffered(); - u32 num_audio_samples = samples_left < AudioPlayerGetDesiredBuffered() ? SAMPLES_HIGH : SAMPLES_LOW; + u32 num_audio_samples = samples_left < AudioPlayerGetDesiredBuffered() + ? (((samples_high ) ) ) + : (((samples_low)) ); frames++; @@ -199,8 +205,9 @@ void GameEngine::HandleAudioThread() { num_audio_samples); } #ifdef PIPE_DEBUG - if(outfile.is_open()){ - outfile.write(reinterpret_cast<char*>(audio_buffer), num_audio_samples * (sizeof(int16_t) * NUM_AUDIO_CHANNELS * AUDIO_FRAMES_PER_UPDATE)); + if (outfile.is_open()) { + outfile.write(reinterpret_cast<char*>(audio_buffer), + num_audio_samples * (sizeof(int16_t) * NUM_AUDIO_CHANNELS * AUDIO_FRAMES_PER_UPDATE)); } #endif AudioPlayerPlayFrame((u8*) audio_buffer, |
