void CApp::WMessage(int player) { PlayMusic("GoodTheme.mp3", false); HWND hWnd = FindWindow(NULL, "SDL_app"); switch ( player ) { case 1: { PlayMusic("WinBattle.mp3", true); if((MessageBox(hWnd, "Player 1 win! Reset?", "Result", MB_YESNO)) == IDYES) Reset(); else Running = false; break; } case 2: { PlayMusic("WinBattle.mp3", true); if((MessageBox(hWnd, "Player 2 win! Reset?", "Result", MB_YESNO)) == IDYES) Reset(); else Running = false; break; } case 3: { PlayMusic("LoseCastle.mp3", false); if((MessageBox(hWnd, "Sorry, but there is no winner! Reset?", "Result", MB_YESNO)) == IDYES) Reset(); else Running = false; break; } } return; }
void CGeneral::PlayBGMusic(int num, int volume) { m_iCurMusic = num; if (g_fNoMusic) { return; } if (num < 0 || num > 5) { PlayMusic(NULL); // stop playing any music } PlayMusic(m_musBG[num], -1, volume); }
/** ** Show the title screens */ void ShowTitleScreens() { if (!TitleScreens || !CliMapName.empty()) { return; } SetVideoSync(); for (int i = 0; TitleScreens[i]; ++i) { if ((Editor.Running && !TitleScreens[i]->Editor) || (!Editor.Running && TitleScreens[i]->Editor)) { continue; } if (!TitleScreens[i]->Music.empty()) { if (TitleScreens[i]->Music == "none" || PlayMusic(TitleScreens[i]->Music) == -1) { StopMusic(); } } if (!TitleScreens[i]->File.empty() && PlayMovie(TitleScreens[i]->File)) { TitleScreens[i]->ShowTitleImage(); } Video.ClearScreen(); } Invalidate(); }
int PlayMusicRandom() { if (is_no_sound) return -1; music_number = Random()%number_of_musics; PlayMusic(music_number); return music_number; }
void Start_STATE_GAME_OVER() { set_bkg_data(0, 81, tilesgameover); InitScroll(gameoverWidth, gameoverHeight, gameover, 0, 2); SHOW_BKG; PlayMusic(gameover_mod_Data, 3, 0); }
bool ALSound::PlayPauseMusic(const std::string &filename, bool repeat) { if (m_previousMusic.fadeTime > 0.0f) { if(m_currentMusic) { OldMusic old; old.music = m_currentMusic; old.fadeTime = 2.0f; old.currentTime = 0.0f; m_oldMusic.push_back(old); m_currentMusic = nullptr; } } else { if (m_currentMusic) { m_previousMusic.music = m_currentMusic; m_previousMusic.fadeTime = 2.0f; m_previousMusic.currentTime = 0.0f; m_currentMusic = nullptr; } } return PlayMusic(filename, repeat); }
void SoundHubObject::ToggleMusic() { if( Mix_PlayingMusic() ) StopMusic(); else PlayMusic( "", true ); }
void Game::init(RenderWindow* window) { SEGame::init(window); //fonts m_font[Font_Terminator] = new sf::Font(); if (!m_font[Font_Terminator]->loadFromFile(makePath("Fonts/terminator_real_nfi.ttf"))) { // error //TODO: font loader } m_font[Font_Arial] = new sf::Font(); if (!m_font[Font_Arial]->loadFromFile(makePath("Fonts/arial.ttf"))) { // error //TODO: font loader } //Sounds LoadSFX(); //Music LOGGER_WRITE(Logger::DEBUG, "Loading Musics"); m_Music_Activated = true; m_music_fader = 0; m_asking_music_fade_out = false; PlayMusic(Music_Main); }
void AlienTalkSegue (COUNT wait_track) { // this skips any talk segues that follow an aborted one if ((GLOBAL (CurrentActivity) & CHECK_ABORT) || TalkingFinished) return; if (!pCurInputState->Initialized) { InitSpeechGraphics (); SetColorMap (GetColorMapAddress (CommData.AlienColorMap)); SetContext (AnimContext); DrawAlienFrame (NULL, 0, TRUE); UpdateSpeechGraphics (); CommIntroTransition (); pCurInputState->Initialized = TRUE; PlayMusic (CommData.AlienSong, TRUE, 1); SetMusicVolume (BACKGROUND_VOL); InitCommAnimations (); LastActivity &= ~CHECK_LOAD; } TalkingFinished = TalkSegue (wait_track); if (TalkingFinished && !VolasPackPresent) FadeMusic (FOREGROUND_VOL, ONE_SECOND); }
void Menu::Render() { if (!GetIsAvaible())return; PlayMusic(Scene::m_Sound->GetPointerToMusic("ambient")); if (System::CheckPosition(m_MenuInfo["NEW_GAME"])) DrawFont(GetFont("pacman"), m_MenuInfo["NEW_GAME"].x, m_MenuInfo["NEW_GAME"].y, "New Game", Font::shaded, color1, color2, 0.0, SDL_FLIP_NONE, true); else DrawFont(GetFont("pacman"), m_MenuInfo["NEW_GAME"].x, m_MenuInfo["NEW_GAME"].y, "New Game", Font::blended, color1, color2, 0.0, SDL_FLIP_NONE, true); if (System::CheckPosition(m_MenuInfo["CONTINUE"])) { DrawFont(GetFont("pacman"), m_MenuInfo["CONTINUE"].x, m_MenuInfo["CONTINUE"].y, "Continue", Font::shaded, color1, color2, 0.0, SDL_FLIP_NONE, true); if (m_Mouse->operator[]("left")) Switch(nextScene); } else DrawFont(GetFont("pacman"), m_MenuInfo["CONTINUE"].x, m_MenuInfo["CONTINUE"].y, "Continue", Font::blended, color1, color2, 0.0, SDL_FLIP_NONE, true); if (System::CheckPosition(m_MenuInfo["QUIT"])) { DrawFont(GetFont("pacman"), m_MenuInfo["QUIT"].x, m_MenuInfo["QUIT"].y, "Quit", Font::shaded, color1, color2, 0.0, SDL_FLIP_NONE, true); if (m_Mouse->operator[]("left")) *Scene::m_Running = false; } else DrawFont(GetFont("pacman"), m_MenuInfo["QUIT"].x, m_MenuInfo["QUIT"].y, "Quit", Font::blended, color1, color2, 0.0, SDL_FLIP_NONE, true); }
void CRussiaRectView::OnMusic5() { // TODO: Add your command handler code here if(m_bMusic = true) mciSendString("close bkMusic",NULL,0,NULL); m_bMusic = true; m_sMusicName = "music5_lextd.mid"; PlayMusic(m_sMusicName); }
void CGeneral::PlayWinMusic(int volume) { if (g_fNoMusic) { return; } PlayMusic(m_musWin, 1, volume); }
void JukeBox::NextMusic() { if (!IsPlayingMusic()) return; else if (!IsPlayingMusicSample()) PlayMusic(playing_pl->first); else EndMusic(); // next music but before, we stop the current one. }
// Tries to load a external mid file... :) void CVARDEFS_FunctionPlayMidi(void* var) { if(CONSOLE_GetArgc() < 1) { return; } PlayMusic(CONSOLE_GetArgv(0)); // Gets the first parameter and tries to load it in ( Doesn't crash if invalided ) }
void CSoundPlayer::MenuMusic() { DEBUG0("CSoundPlayer::MenuMusic()\n"); if (!iInitialized) return; StopMusic(); LoadMusic("music/menu.ogg"); PlayMusic(-1); }
void Start_STATE_MENU() { SetPalette(BG_PALETTE, 0, 8, bgPALMenu, bank_STATE_MENU); InitScrollTilesColor(0, 102, splashtiles, 2); InitScroll(splashmapWidth, splashmapHeight, splashmap, 0, 0, 2); SHOW_BKG; level = 0; PlayMusic(start_mod_Data, 2, 1); }
int main(void) { Blox_Speaker_Init(); PlayMusic(); while (1) { } }
void CGeneral::PlayEndRoundMusic(int volume) { m_iCurMusic = 8; if (g_fNoMusic) { return; } PlayMusic(m_musEndRound, -1, volume); }
void CGeneral::BonusGame() { int i, j, k; char dat[] = {0xe9, 0x85, 0x8d, 0x00, 0xe7, 0x89, 0x8c, 0x00, 0xe5, 0x87, 0xba, 0x00, 0xe8, 0xa1, 0x80, 0x00, 0xe5, 0xa5, 0x96, 0xe5, 0x8a, 0xb1, 0xe6, 0xb8, 0xb8, 0xe6, 0x88, 0x8f, 0x00}; SDL_BlitSurface(m_imgBonusGame, NULL, gpScreen, NULL); UpdateScreen(); PlayMusic(m_musBGame, 0); UTIL_Delay(6000); bool locked = false; if (SDL_MUSTLOCK(gpScreen)) { SDL_LockSurface(gpScreen); locked = true; } for (i = 0; i < 640; i++) { for (j = 0; j < 480; j++) { unsigned char r, g, b; k = 0; UTIL_GetPixel(gpScreen, i, j, &r, &g, &b); k += r; k += g; k += b; k /= 3; UTIL_PutPixel(gpScreen, i, j, k, k, k); } } if (locked) { SDL_UnlockSurface(gpScreen); } for (i = 0; i < 4; i++) { DrawUTF8Text(&dat[i * 4], 150 + i * 100, 100, 2, 255, 255, 0); UpdateScreen(); PlaySound(SND_SOUND1); UTIL_Delay(1300); } DrawUTF8Text(&dat[i * 4], 175, 200, 2, 0, 255, 255); PlaySound(SND_DISCARD2); UpdateScreen(); UTIL_Delay(2500); ScreenFade(); }
void playmusic(char *fn) { if (MusicToggle == 0) { return; } if (MusicDevice == NumSoundCards) { return; } // the SDL_mixer version does more or less this same thing. --ryan. PlayMusic(fn); }
/** Ends the Current PlayList Execution */ void MUSImporter::End() { if (Playing) { if (playlist.size() == 0) return; if (playlist[PLpos].PLEnd[0] != 0) { if (stricmp( playlist[PLpos].PLEnd, "end" ) != 0) PlayMusic( playlist[PLpos].PLEnd ); } PLnext = -1; } }
StateManager::StateManager(sf::RenderWindow* rw, GameState* start) { if (!music.openFromFile(resourcePath() + "Midiman.ogg")) exit(EXIT_FAILURE); PlayMusic(); window = rw; running = true; prev = NULL; current = start; current->Init(this); }
void cAudio :: ToggleMusic( void ) { bMusic = !bMusic; if( !bMusic ) { HaltMusic(); } else { Init(); if( !pLevel->valid_music ) { PlayMusic( MUSIC_DIR "/game/mainmenu.ogg", -1, 1, 2000 ); } else { PlayMusic( pLevel->musicfile, -1, 1, 2000 ); } } }
void CMover::PlayCombatMusic() { //gmpbigsun: 전투음악 on off #if __VER >= 15 // __IMPROVE_SYSTEM_VER15 if( g_Option.m_bBattleBGM == FALSE ) return; #else // __IMPROVE_SYSTEM_VER15 #if __VER >= 9 return; #endif // #endif // __IMPROVE_SYSTEM_VER15 if( GetWorld()->GetID() == WI_WORLD_GUILDWAR ) return; if( GetWorld()->GetID() == WI_DUNGEON_MUSCLE || GetWorld()->GetID() == WI_DUNGEON_KRRR || GetWorld()->GetID() == WI_DUNGEON_BEAR ) return; if( GetWorld()->m_bIsIndoor == FALSE ) { FLOAT x = GetPos().x; FLOAT z = GetPos().z; CRect rectSaintmorning( 7535, 1846, 9283, 3134 ); if( rectSaintmorning.PtInRect( CPoint( (int)( x ), (int)( z ) ) ) ) PlayMusic( BGM_BA_SAINTMORNING ); else if( x < 4609 ) PlayMusic( BGM_BA_DARKON ); else if( x < 6309 ) PlayMusic( BGM_BA_CRISIS ); else if( x < 8138 ) PlayMusic( BGM_BA_FLARIS ); else PlayMusic( BGM_BA_SAINTMORNING ); } }
//////////////////////////////////////////////////////////// /// Entry point of application /// /// \return Application exit code /// //////////////////////////////////////////////////////////// int main() { // Play a sound PlaySound(); // Play a music PlayMusic(); // Wait until the user presses 'enter' key std::cout << "Press enter to exit..." << std::endl; std::cin.ignore(10000, '\n'); return EXIT_SUCCESS; }
/*************************************************** エントリ ***************************************************/ int main (void) { // ゲームパックウェイト&キャッシュ *((vu16 *) 0x04000204) = 0x4317; // BG初期化 init_bg (); // スプライト初期化 init_sprite (); // キー初期化 init_key (); // サウンド初期化 DirectSoundInitialize (); // キャラクタ初期化 init_sprite_chr (); // ハイスコア初期化 init_hiscore (); // ゲーム初期化 init_game (); // タイトル init_title (); // 割り込み初期化 irqInit (); // サウンド用ハンドラ MUSIC / SE irqSet (IRQ_TIMER0, IRQ_Music); irqSet (IRQ_TIMER1, IRQ_Sound); irqEnable (IRQ_VBLANK | IRQ_TIMER0 | IRQ_TIMER1); // タイトル PlayMusic (MUSIC_TITLE, PLAY_LOOP_ON); // メインループ while (1) { // キー入力 scanKeys (); // ゲーム本体 game (); // 割り込み待ち VBlankIntrWait (); } }
void SoundHubObject::SetMusic( const SoundID& mus, bool switchNow ) { if( m_Music.Has( mus ) ) { mp_Song = m_Music[mus]; if( switchNow ) PlayMusic(); } else { mp_Song = nullptr; if( switchNow ) Mix_HaltMusic(); } }
void CSoundPlayer::GameMusic( const char* aSoundtrackDir, int aSongNumber ) { DEBUG0("CSoundPlayer::GameMusic()\n"); if (!iInitialized) return; StopMusic(); char *fname=GetSongFilename( aSoundtrackDir, aSongNumber ); if (fname) LoadMusic(fname); free(fname); PlayMusic(-1); }
void AudioManager::PlayMusic( const tstring& path, const tstring& name, uint8 channel, int32 loopTimes ) { Logger::GetInstance()->Log(mSoundService != nullptr, _T("Sound Service is invalid."), STARENGINE_LOG_TAG); if(mMusicList.find(name) == mMusicList.end()) { LoadMusic(path, name, channel); } return PlayMusic(name, loopTimes); }
// Initialise the surface graphics, and start the planet music. // Called from the GenerateFunctions.generateOribital() function // (when orbit is entered; either from IP, or from loading a saved game) // and when "starmap" is selected from orbit and then cancelled; // also after in-orbit comm and after defeating planet guards in combat. // SurfDefFrame contains surface definition images when a planet comes // with its own bitmap (currently only for Earth) void LoadPlanet (FRAME SurfDefFrame) { bool WaitMode = !(LastActivity & CHECK_LOAD); PLANET_DESC *pPlanetDesc; #ifdef DEBUG if (disableInteractivity) return; #endif assert (pSolarSysState->InOrbit && !pSolarSysState->TopoFrame); CreatePlanetContext (); if (WaitMode) { LockMutex (GraphicsLock); DrawOrbitalDisplay (DRAW_ORBITAL_WAIT); UnlockMutex (GraphicsLock); } StopMusic (); pPlanetDesc = pSolarSysState->pOrbitalDesc; GeneratePlanetSurface (pPlanetDesc, SurfDefFrame); SetPlanetMusic (pPlanetDesc->data_index & ~PLANET_SHIELDED); GeneratePlanetSide (); if (!PLRPlaying ((MUSIC_REF)~0)) PlayMusic (LanderMusic, TRUE, 1); if (WaitMode) { ZoomInPlanetSphere (); LockMutex (GraphicsLock); DrawOrbitalDisplay (DRAW_ORBITAL_UPDATE); UnlockMutex (GraphicsLock); } else { LockMutex (GraphicsLock); DrawOrbitalDisplay (DRAW_ORBITAL_FULL); UnlockMutex (GraphicsLock); } }