Index: Core/Util.cpp =================================================================== --- Core/Util.cpp (wersja 7991) +++ Core/Util.cpp (kopia robocza) @@ -785,14 +785,33 @@ String CurrentSoundTheme = "freedesktop"; +static String FindPlayer() +{ + static String player; + if (player.IsEmpty()) { + const char *players[] = { "play", "ogg123", "gst123" }; + for (int i = 0; i < __countof(players); i++) { + String out; + if (Sys("which " + String(players[i]), out) == 0 && !out.IsEmpty()) { + player = players[i]; + break; + } + } + } + return player; +} + static void LinuxBeep(const char *name) { - String fn = "/usr/share/sounds/" + CurrentSoundTheme + "/stereo/dialog-" + name; - system("play -q " + fn + (FileExists(fn + ".ogg") ? ".ogg" : - FileExists(fn + ".oga") ? ".oga" : - FileExists(fn + ".wav") ? ".wav" : - ".*") - + " >/dev/null 2>/dev/null&"); + String player = FindPlayer(); + if (!player.IsEmpty()) { + String fn = "/usr/share/sounds/" + CurrentSoundTheme + "/stereo/dialog-" + name; + system(player + " -q " + fn + (FileExists(fn + ".ogg") ? ".ogg" : + FileExists(fn + ".oga") ? ".oga" : + FileExists(fn + ".wav") ? ".wav" : + ".*") + + " >/dev/null 2>/dev/null&"); + } } #endif