void MusicSetPlaying(SoundDevice *device, int isPlaying) { if (isPlaying) { MusicResume(device); } else { MusicPause(device); } }
void SoundReconfigure(SoundDevice *s) { s->isInitialised = false; if (Mix_AllocateChannels(s->channels) != s->channels) { printf("Couldn't allocate channels!\n"); return; } Mix_Volume(-1, ConfigGetInt(&gConfig, "Sound.SoundVolume")); Mix_VolumeMusic(ConfigGetInt(&gConfig, "Sound.MusicVolume")); if (ConfigGetInt(&gConfig, "Sound.MusicVolume") > 0) { MusicResume(s); } else { MusicPause(s); } s->isInitialised = true; }
static bool MusicPlay(SoundDevice *device, const char *path) { if (!device->isInitialised) { return true; } debug(D_NORMAL, "Attempting to play song: %s\n", path); if (path == NULL || strlen(path) == 0) { LOG(LM_SOUND, LL_WARN, "Attempting to play song with empty name"); return false; } device->music = Mix_LoadMUS(path); if (device->music == NULL) { strcpy(device->musicErrorMessage, SDL_GetError()); device->musicStatus = MUSIC_NOLOAD; return false; } debug(D_NORMAL, "Playing song: %s\n", path); Mix_PlayMusic(device->music, -1); device->musicStatus = MUSIC_PLAYING; if (ConfigGetInt(&gConfig, "Sound.MusicVolume") == 0) { MusicPause(device); } device->musicErrorMessage[0] = '\0'; return true; }