void SoundTerminate(SoundDevice *device, const bool waitForSoundsComplete) { if (!device->isInitialised) { return; } debug(D_NORMAL, "shutting down sound\n"); if (waitForSoundsComplete) { Uint32 waitStart = SDL_GetTicks(); while (Mix_Playing(-1) > 0 && SDL_GetTicks() - waitStart < 1000); } MusicStop(device); while (Mix_Init(0)) { Mix_Quit(); } Mix_CloseAudio(); SoundClear(&device->sounds); CArrayTerminate(&device->sounds); SoundClear(&device->customSounds); CArrayTerminate(&device->customSounds); }
void MusicPlayGame( SoundDevice *device, const char *missionPath, const char *music) { // Play a tune // Start by trying to play a mission specific song, // otherwise pick one from the general collection... MusicStop(device); bool played = false; if (music != NULL && strlen(music) != 0) { char buf[CDOGS_PATH_MAX]; // First, try to play music from the same directory // This may be a new-style directory campaign GetDataFilePath(buf, missionPath); strcat(buf, "/"); strcat(buf, music); played = MusicPlay(device, buf); if (!played) { char buf2[CDOGS_PATH_MAX]; GetDataFilePath(buf2, missionPath); PathGetDirname(buf, buf2); strcat(buf, music); played = MusicPlay(device, buf); } } if (!played && gGameSongs != NULL) { MusicPlay(device, gGameSongs->path); ShiftSongs(&gGameSongs); } }
void WINAPI ModuleExit(void) { HBITMAP hCurrentBitmap; MusicStop(); if (timer_id != 0) { KillTimer(NULL, timer_id); timer_id = 0; } if (hTitleDC != NULL) { hCurrentBitmap = (HBITMAP) SelectObject(hTitleDC, hOldTitleBitmap); DeleteObject(hCurrentBitmap); DeleteDC(hTitleDC); } if (hwndDialButton != NULL) DestroyWindow(hwndDialButton); hwndDialButton = NULL; InvalidateRect(cinfo->hMain, NULL, TRUE); PostMessage(cinfo->hMain, BK_MODULEUNLOAD, 0, MODULE_OFFLINE_ID); }
void MusicPlayMenu(SoundDevice *device) { MusicStop(device); if (gMenuSongs) { MusicPlay(device, gMenuSongs->path); ShiftSongs(&gMenuSongs); } }
AudioManager::~AudioManager() { MusicStop(); if( m_Initialized ) { m_ThreadContinue = false; m_UpdateThread->join(); delete m_UpdateThread; delete[] m_Buffer; alcMakeContextCurrent( NULL ); alcDestroyContext( m_ALContext ); alcCloseDevice( m_ALDevice ); LOG_TRIVIAL( "AudioManager destroyed." ); } }
void PlayClass::MusicPlay(const char* filepath){ MusicStop(); ltmusic->MusicPlay(CLTCommon::AnsiToWideChar((char*)filepath)); }