moved call to audio_game_loop_tick() to the audio thread

This commit is contained in:
KingOfSpadesJFK 2023-10-17 18:45:27 -07:00
parent 9b07b766be
commit 1154914e9a
2 changed files with 5 additions and 2 deletions

View File

@ -591,7 +591,7 @@ void game_loop_one_iteration(void) {
osContStartReadData(&gSIEventMesgQueue);
}
audio_game_loop_tick();
// audio_game_loop_tick();
config_gfx_pool();
read_controller_inputs();
levelCommandAddr = level_script_execute(levelCommandAddr);

View File

@ -65,6 +65,7 @@ bool audio_thread_running = false;
extern void gfx_run(Gfx *commands);
extern void thread5_game_loop(void *arg);
extern void audio_game_loop_tick(void);
extern void create_next_audio_buffer(s16 *samples, u32 num_samples);
void game_loop_one_iteration(void);
void* audio_thread();
@ -101,7 +102,7 @@ void produce_one_frame(void) {
}
// Seperate the audio thread from the main thread so that your ears won't bleed at a low framerate
// FIXME: Chance of a segfault when teleporting to a new level
// FIXME: Low but comman chance of a segfault when teleporting to a new level
void* audio_thread() {
const long framerateNano = 33333333L; // 33.333333 ms = 30 fps; run this thread 30 times a second like the original game
int napResult = 0;
@ -114,6 +115,8 @@ void* audio_thread() {
set_sequence_player_volume(SEQ_PLAYER_SFX, (f32)configSfxVolume / 127.0f * master_mod);
set_sequence_player_volume(SEQ_PLAYER_ENV, (f32)configEnvVolume / 127.0f * master_mod);
audio_game_loop_tick();
int samples_left = audio_api->buffered();
u32 num_audio_samples = samples_left < audio_api->get_desired_buffered() ? SAMPLES_HIGH : SAMPLES_LOW;
// printf("Audio samples: %d %u\n", samples_left, num_audio_samples);