コード例 #1
0
ファイル: sounds.c プロジェクト: NSYXin/cdogs-sdl
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);
}
コード例 #2
0
ファイル: music.c プロジェクト: ChunHungLiu/cdogs-sdl
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);
	}
}
コード例 #3
0
ファイル: intro.c プロジェクト: GarOfMeridian/Meridian59_103
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);
}
コード例 #4
0
ファイル: music.c プロジェクト: ChunHungLiu/cdogs-sdl
void MusicPlayMenu(SoundDevice *device)
{
	MusicStop(device);
	if (gMenuSongs)
	{
		MusicPlay(device, gMenuSongs->path);
		ShiftSongs(&gMenuSongs);
	}
}
コード例 #5
0
ファイル: AudioManager.cpp プロジェクト: sasukeuni/q-gears
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." );
    }
}
コード例 #6
0
ファイル: PlayClass.cpp プロジェクト: ltframe/LTPlayer
void PlayClass::MusicPlay(const char* filepath){
 
	MusicStop();
	ltmusic->MusicPlay(CLTCommon::AnsiToWideChar((char*)filepath));
}