07th-mod / ponscripter-fork

Fork of the Ponscripter visual novel engine to take advantage of SDL2 and improve Steam integration
GNU General Public License v2.0
15 stars 4 forks source link

[bug] No any audio on gnome #21

Closed tobiichi3227 closed 4 months ago

tobiichi3227 commented 4 months ago

SDL2 Version: 2.30.3-1 SDL2 Mixer Version: 2.8.0-1 Ponscripter Version: 4.0.0

I was playing nacrissu2 (aur package) on gnome wayland. After my test, it seems occur on gnome mutter. I fix it by using below patch. But i have no idea how this can fix problem. If developers are free to solve this problem, thanks!!!

diff --git a/src/PonscripterLabel_sound.cpp b/src/PonscripterLabel_sound.cpp
index 540cf4e..e5025cb 100644
--- a/src/PonscripterLabel_sound.cpp
+++ b/src/PonscripterLabel_sound.cpp
@@ -279,7 +279,7 @@ int PonscripterLabel::playWave(Mix_Chunk* chunk, int format, bool loop_flag,
 {
     if (!chunk) return -1;

-    Mix_Pause(channel);
+    Mix_Pause(channel + 1);
     if (wave_sample[channel]) Mix_FreeChunk(wave_sample[channel]);

     wave_sample[channel] = chunk;
@@ -292,7 +292,7 @@ int PonscripterLabel::playWave(Mix_Chunk* chunk, int format, bool loop_flag,
         Mix_Volume(channel, !volume_on_flag? 0 : se_volume * 128 / 100);

     if (!(format & SOUND_PRELOAD))
-        Mix_PlayChannel(channel, wave_sample[channel], loop_flag ? -1 : 0);
+        Mix_PlayChannel(channel + 1, wave_sample[channel], loop_flag ? -1 : 0);

     return 0;
 }
-- 
2.45.1
tobiichi3227 commented 4 months ago

Oh, I find my how it happened. Because volume_on_flag in envdata is 0.