Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "sound.h"
- static Mix_Music *bgm = NULL;
- static Mix_Chunk *seBep = NULL;
- static Mix_Chunk *seBeep = NULL;
- static Mix_Chunk *seBeeep = NULL;
- static Mix_Chunk *seBeeeep = NULL;
- static Mix_Chunk *seBeeeeep = NULL;
- static Mix_Chunk *seBeeeeeep = NULL;
- static Mix_Chunk *seBeeeeeeep = NULL;
- static Mix_Chunk *seBeeeeeeeep = NULL;
- static Mix_Chunk *seRoundBegin = NULL;
- static Mix_Chunk *seCrash = NULL;
- static Mix_Chunk *seSpeed = NULL;
- static Mix_Chunk *seFreeze = NULL;
- static Mix_Chunk *seConfusion = NULL;
- static Mix_Chunk *seSharpturn = NULL;
- static Mix_Chunk *seTimestep = NULL;
- static Mix_Chunk *seMole = NULL;
- static Mix_Chunk *seWarp = NULL;
- static Mix_Chunk *seGhost = NULL;
- static Mix_Chunk *seDisable = NULL;
- static Mix_Chunk *seSwitch = NULL;
- static Mix_Chunk *sounds[N_SOUNDS];
- /**
- * Initializes the mixer and loads sound files.
- *
- * @return -1 on failiure, 0 else.
- */
- int initSound(void)
- {
- if (Mix_OpenAudio(MIX_DEFAULT_FREQUENCY * 2, MIX_DEFAULT_FORMAT,
- 2, 512) == -1 )
- {
- return -1;
- }
- if ((bgm = Mix_LoadMUS("data/sound/theme1.ogg")) == NULL) {
- fileNotFound("data/sound/theme1.ogg");
- return -1;
- }
- if (loadSound(seBep, "bep", SOUND_BEP) == -1)
- return -1;
- if (loadSound(seBeep, "beep", SOUND_BEEP) == -1)
- return -1;
- if (loadSound(seBeeep, "beeep", SOUND_BEEEP) == -1)
- return -1;
- if (loadSound(seBeeeep, "beeeep", SOUND_BEEEEP) == -1)
- return -1;
- if (loadSound(seBeeeeep, "beeeeep", SOUND_BEEEEEP) == -1)
- return -1;
- if (loadSound(seBeeeeeep, "beeeeeep", SOUND_BEEEEEEP) == -1)
- return -1;
- if (loadSound(seBeeeeeeep, "beeeeeeep", SOUND_BEEEEEEEP) == -1)
- return -1;
- if (loadSound(seBeeeeeeeep, "beeeeeeeep", SOUND_BEEEEEEEEP) == -1)
- return -1;
- if (loadSound(seRoundBegin, "round_begin", SOUND_ROUND_BEGIN) == -1)
- return -1;
- if (loadSound(seCrash, "crash", SOUND_CRASH) == -1)
- return -1;
- if (loadSound(seSpeed, "speed", SOUND_SPEED) == -1)
- return -1;
- if (loadSound(seFreeze, "freeze", SOUND_FREEZE) == -1)
- return -1;
- if (loadSound(seConfusion, "confusion", SOUND_CONFUSION) == -1)
- return -1;
- if (loadSound(seSharpturn, "sharpturn", SOUND_SHARPTURN) == -1)
- return -1;
- if (loadSound(seTimestep, "timestep", SOUND_TIMESTEP) == -1)
- return -1;
- if (loadSound(seMole, "mole", SOUND_MOLE) == -1)
- return -1;
- if (loadSound(seWarp, "warp", SOUND_WARP) == -1)
- return -1;
- if (loadSound(seGhost, "ghost", SOUND_GHOST) == -1)
- return -1;
- if (loadSound(seDisable, "ghost", SOUND_DISABLE) == -1)
- return -1;
- if (loadSound(seSwitch, "switch", SOUND_SWITCH) == -1)
- return -1;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement