From 82cd4176a3bb6abc319775433067a620dbbc4fc6 Mon Sep 17 00:00:00 2001 From: Agent X <44549182+AgentXLP@users.noreply.github.com> Date: Wed, 12 Jun 2024 17:05:41 -0400 Subject: [PATCH] Fix the new Miniaudio audio_stream_set_position --- src/pc/lua/utils/smlua_audio_utils.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/pc/lua/utils/smlua_audio_utils.c b/src/pc/lua/utils/smlua_audio_utils.c index f16e360d..192d0383 100644 --- a/src/pc/lua/utils/smlua_audio_utils.c +++ b/src/pc/lua/utils/smlua_audio_utils.c @@ -316,9 +316,7 @@ void audio_stream_set_position(struct ModAudio* audio, f32 pos) { if (!audio_sanity_check(audio, true, "setpos")) { return; } - u64 length; - ma_sound_get_length_in_pcm_frames(&audio->sound, &length); - ma_sound_seek_to_pcm_frame(&audio->sound, (u64)(length * pos)); + ma_sound_seek_to_pcm_frame(&audio->sound, pos * ma_engine_get_sample_rate(&gModAudioEngine)); } bool audio_stream_get_looping(struct ModAudio* audio) {