| 1 | #cxx . . $ `<file>/src/sound.cpp`/include <stdio.h> |
| 2 | #include <SDL.h> |
| 3 | #include <SDL/SDL_mixer.h> |
| 4 | #include "sound.h"cxx . . $ `<file>/src/sound.h`/ |
| 5 | |
| 6 | Mix_Music *my_musiccxx . . $ my_music. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 7 | int play_soundscxx . . $ play_sounds. = FALSEcxx . . $ `src/sound.h:8:9`!; |
| 8 | |
| 9 | int Init_Audiocxx . . $ Init_Audio(7864480464b09eea).(int allow_sounds) |
| 10 | { |
| 11 | my_musiccxx . . $ my_music. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 12 | int audio_rate = 22050; |
| 13 | Uint16cxx . . $ Uint16# audio_format = AUDIO_S16cxx . . $ `<external>/17835154366534373553/SDL_audio.h:57:9`!; /* 16-bit stereo */ |
| 14 | int audio_channels = 2; |
| 15 | int audio_buffers = 4096; |
| 16 | |
| 17 | if (allow_sounds) |
| 18 | Mix_OpenAudio(audio_rate, audio_format, audio_channels, audio_buffers); |
| 19 | |
| 20 | play_soundscxx . . $ play_sounds. = allow_sounds; |
| 21 | |
| 22 | return TRUEcxx . . $ `src/sound.h:5:9`!; |
| 23 | } |
| 24 | |
| 25 | |
| 26 | void Sound_Donecxx . . $ Sound_Done(49f6e7a06ebc5aa8).() |
| 27 | { |
| 28 | if (my_musiccxx . . $ my_music.) |
| 29 | { |
| 30 | Mix_HaltMusic(); |
| 31 | Mix_FreeMusic(my_musiccxx . . $ my_music.); |
| 32 | my_musiccxx . . $ my_music. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 33 | } |
| 34 | } |
| 35 | |
| 36 | |
| 37 | |
| 38 | int Play_Soundcxx . . $ Play_Sound(1ef8e6ec083aabb9).(char *sound_file) |
| 39 | { |
| 40 | // maybe sound if disabled? |
| 41 | if (! play_soundscxx . . $ play_sounds.) |
| 42 | return FALSEcxx . . $ `src/sound.h:8:9`!; |
| 43 | |
| 44 | // something else is playing |
| 45 | if (my_musiccxx . . $ my_music.) |
| 46 | return FALSEcxx . . $ `src/sound.h:8:9`!; |
| 47 | |
| 48 | // bad pointer? |
| 49 | if (! sound_file) |
| 50 | return FALSEcxx . . $ `src/sound.h:8:9`!; |
| 51 | |
| 52 | my_musiccxx . . $ my_music. = Mix_LoadMUS(sound_file); |
| 53 | if (my_musiccxx . . $ my_music.) |
| 54 | { |
| 55 | Mix_PlayMusic(my_musiccxx . . $ my_music., 0); |
| 56 | Mix_HookMusicFinished(Sound_Donecxx . . $ Sound_Done(49f6e7a06ebc5aa8).); |
| 57 | return TRUEcxx . . $ `src/sound.h:5:9`!; |
| 58 | } |
| 59 | return FALSEcxx . . $ `src/sound.h:8:9`!; |
| 60 | } |
| 61 | |
| 62 | |
| 63 | |
| 64 | void Clean_Up_Audiocxx . . $ Clean_Up_Audio(49f6e7a06ebc5aa8).() |
| 65 | { |
| 66 | // sound was disabled, nothing to clean |
| 67 | if (! play_soundscxx . . $ play_sounds.) |
| 68 | return; |
| 69 | |
| 70 | Mix_HaltMusic(); |
| 71 | if (my_musiccxx . . $ my_music.) |
| 72 | Mix_FreeMusic(my_musiccxx . . $ my_music.); |
| 73 | my_musiccxx . . $ my_music. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 74 | Mix_CloseAudio(); |
| 75 | } |
| 76 |