本文整理汇总了C++中Mix_PlayingMusic函数的典型用法代码示例。如果您正苦于以下问题:C++ Mix_PlayingMusic函数的具体用法?C++ Mix_PlayingMusic怎么用?C++ Mix_PlayingMusic使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Mix_PlayingMusic函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: IsPlayWave
int IsPlayWave( int no )
{
switch ( s_iYGSSoundType[no] )
{
case YGS_SOUNDTYPE_WAV:
/* なぜかここを実行すると落ちる… */
return Mix_Playing(no);
break;
case YGS_SOUNDTYPE_MUS:
return Mix_PlayingMusic();
break;
}
return 0;
}
开发者ID:tiehuis,项目名称:HeborisC7EX,代码行数:15,代码来源:ygs2kfunc.cpp
示例2: jhi_play_music
void jhi_play_music(JHI_Music *music, int loop)
{
if (Mix_PausedMusic() == 1)
{
Mix_ResumeMusic();
}
else if(Mix_PlayingMusic() == 0) {
if(Mix_PlayMusic(music->mix_music, loop) == -1 )
{
printf("Error while playing music.\n");
}
}
}
开发者ID:joaogf,项目名称:libjhi-sdl,代码行数:15,代码来源:jhi_sound.c
示例3: update_audio
/*!
Updates audio status. Must be called at every frame.
\return none
\author jfpatry
\date Created: 2000-08-14
\date Modified: 2000-09-02
*/
void
update_audio()
{
int volume;
check_assertion( initialized_, "audio module not initialized" );
if ( ! is_audio_open() ) {
return;
}
if ( getparam_music_enabled() == False ) {
Mix_HaltMusic();
}
/* Set sounds volume level */
volume = getparam_sound_volume();
if ( volume < 0 ) {
volume = 0;
}
if ( volume > 128 ) {
volume = 128;
}
setparam_sound_volume( volume );
Mix_Volume( -1, volume ); /* channel of -1 sets volume for all channels */
/* Set music volume level */
volume = getparam_music_volume();
if ( volume < 0 ) {
volume = 0;
}
if ( volume > 128 ) {
volume = 128;
}
setparam_music_volume( volume );
Mix_VolumeMusic( volume );
/* Update music status */
if ( current_music_name_ != NULL && !Mix_PlayingMusic() ) {
set_music_playing_status( current_music_name_, False );
current_music_name_ = NULL;
current_music_data_ = NULL;
}
}
开发者ID:LeifAndersen,项目名称:TuxRider,代码行数:56,代码来源:audio.c
示例4: getMusicVol
void Audio::musicMute(bool bMute)
{
if (bMute) //turn mute on
{
_musicVolSave = getMusicVol();
setMusicVol(0, false);
if (Mix_PlayingMusic() && !Mix_Paused(-1))
Mix_PauseMusic();
}
else //unmute
{
setMusicVol(_musicVolSave, false);
Mix_ResumeMusic();
}
_opt._bMusic = !bMute;
}
开发者ID:PurplePup,项目名称:Reword,代码行数:16,代码来源:audio.cpp
示例5:
// Might want to add a feature to add if we want repeat or not
void D2DMusic::play()
{
if (Mix_PlayingMusic() == 0){
Mix_PlayMusic(m_music, -1);
}
else {
if (Mix_PausedMusic() == 1){
Mix_ResumeMusic();
}
else {
Mix_PauseMusic();
}
}
}
开发者ID:Incenium,项目名称:simple-platformer,代码行数:17,代码来源:D2DMusic.cpp
示例6: gameover
//----------------------------------------------------------------------------------------------------------------------
void Game::gameover()
{
// set playing flag to false and swap music
m_playing=false;
if(Mix_PlayingMusic()==1)
{
Mix_HaltMusic();
}
Mix_PlayMusic(m_menu, -1);
// reset key counters and world
m_level=0;
m_world->m_score=0;
m_world->resetWorld();
// set menu clear color
glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
}
开发者ID:ryanchanwo,项目名称:Kinobird,代码行数:17,代码来源:Game.cpp
示例7: printf
void platform_support::play_music(unsigned idx)
{
printf("play music\n");
if (idx >= max_images || !m_specific->m_music[idx])
{
return;
}
printf("play music\n");
if (Mix_PlayingMusic())
{
Mix_HaltMusic();
}
printf("play music\n");
Mix_PlayMusic(m_specific->m_music[idx], -1);
printf("play music\n");
}
开发者ID:przemekr,项目名称:my_slide,代码行数:16,代码来源:agg_platform_support.cpp
示例8: Mix_VolumeMusic
void platform_support::play_music(unsigned idx, unsigned vol)
{
if (idx >= max_images || !m_specific->m_music[idx])
{
return;
}
Mix_VolumeMusic(vol);
if (Mix_PlayingMusic())
{
Mix_HaltMusic();
}
if (vol)
{
Mix_PlayMusic(m_specific->m_music[idx], -1);
}
}
开发者ID:przemekr,项目名称:my_slide,代码行数:16,代码来源:agg_platform_support.cpp
示例9: CleanUp
void CleanUp(void)
{
if( Mix_PlayingMusic() ) {
Mix_FadeOutMusic(1500);
SDL_Delay(1500);
}
if ( music ) {
Mix_FreeMusic(music);
music = NULL;
}
if ( audio_open ) {
Mix_CloseAudio();
audio_open = 0;
}
SDL_Quit();
}
开发者ID:Jay-Jay-OPL,项目名称:ps2sdk-ports,代码行数:16,代码来源:playmus.c
示例10: switch_pause_resume
// Pauses music if playing, resume if pausing, return false if play() not called
bool AudioHandler::switch_pause_resume()
{
if (!Mix_PlayingMusic())
{
return false;
}
if (Mix_PausedMusic())
{
Mix_ResumeMusic();
}
else
{
Mix_PauseMusic();
}
return true;
}
开发者ID:pgtruong,项目名称:Puzzle-Engine,代码行数:17,代码来源:AudioHandler.cpp
示例11: jhi_replay_music
void jhi_replay_music(JHI_Music *music, int loop)
{
if (Mix_PausedMusic() == 1)
{
Mix_ResumeMusic();
}
if (Mix_PlayingMusic() != 0)
{
jhi_stop_music();
}
jhi_free_music(music);
jhi_load_music(music, music->filename);
jhi_play_music(music, loop);
}
开发者ID:joaogf,项目名称:libjhi-sdl,代码行数:17,代码来源:jhi_sound.c
示例12: I_QrySongPlaying
bool I_QrySongPlaying (int handle)
{
if(!music_initialized)
return false;
#ifdef OSX
Boolean result;
MusicPlayerIsPlaying(player, &result);
return result;
#else
return Mix_PlayingMusic() ? true : false;
#endif
}
开发者ID:JohnnyonFlame,项目名称:odamex,代码行数:17,代码来源:i_music.cpp
示例13: stop_music
void AudioController::play_music(int track,int loopnum) {
stop_music(); //Stop music first.
if (track<=0) track=1;
if (track>NUM_TRACKS) track=NUM_TRACKS;
if( Mix_PlayingMusic() == 0 ) {
if (Mix_PlayMusic( music[track-1], loopnum ) == -1) {
//Fail somehow
};
}
//Play one of the MIDI tracks.
//Specify which one in the documentation.
//Only one music should be playable at a time.
//Also it should automatically loop to a starting point.
//All the songs that need to loop to a specific point will have
// a midi cue at that point named "loopStart" when they're done.
}
开发者ID:yonghwan,项目名称:ShootingGame,代码行数:17,代码来源:AudioController.cpp
示例14: InitMenuBG
void InitMenuBG(S_scene_menu* sc,E_camera* camera){
G_menuBG* menuBG = &sc->menuBG;
menuBG->active = 1;
InitT(&menuBG->transform,0,0,1,1);
InitT(&menuBG->sprite.srce,0,0,512,512);
InitT(&menuBG->sprite.dest,0,0,512,512);
menuBG->sprite.texture = LoadTexture(camera,"./src/resources/BG.png");
SetRectSprite(&menuBG->sprite,&menuBG->transform);
menuBG->BGMusic = Mix_LoadMUS( "./src/resources/JourneyTitle.mp3" );
if( Mix_PlayingMusic() == 0 )
{
//Play the music
Mix_PlayMusic( menuBG->BGMusic, -1 );
}
}
开发者ID:Rxelux,项目名称:SDLProject,代码行数:17,代码来源:menuBG.c
示例15: main
int main( int argc, char* args[] ) {
bool quit = false;
imageManager = new ImageManager;
soundManager = new SoundManager;
timeManager = new TimeManager;
//Kill the program if it didn't init successfully.
if( !init_sdl() ) {
return -1;
}
// Load the images
splash = imageManager->load_image( "splash.jpg" );
background = imageManager->load_image( "background.jpg" );
imageManager->draw_to_surface( splash, screen );
// Start the Timer.
timeManager->start();
while( quit == false ) {
while( SDL_PollEvent( &event ) ) {
if( event.type == SDL_QUIT ) {
quit = true;
}
if( Mix_PlayingMusic() == 0 ) {
//Play the music
soundManager->play_music( "titlemusic.wav" );
}
}
if ( SDL_Flip( screen ) == -1 ) {
return 1;
}
draw_relevent_surface();
timeManager->check_fps();
}
// Apply the message to the screen
//apply_surface( 180, 140, message, screen );
clean_up();
return 0;
}
开发者ID:jojojames,项目名称:SDL-CPlusPlus,代码行数:46,代码来源:main.cpp
示例16: Mix_ResumeMusic
void music_muter::handle_window_event(const SDL_Event& event)
{
if (preferences::stop_music_in_background() && preferences::music_on())
{
if (event.window.event == SDL_WINDOWEVENT_FOCUS_GAINED)
{
Mix_ResumeMusic();
}
else if (event.window.event == SDL_WINDOWEVENT_FOCUS_LOST)
{
if (Mix_PlayingMusic())
{
Mix_PauseMusic();
}
}
}
}
开发者ID:aquileia,项目名称:wesnoth,代码行数:17,代码来源:sound.cpp
示例17: music_play
void music_play()
{
//If there is no music playing
if( Mix_PlayingMusic() == 0 )
{
music_choose_track(playlist[current_track_num]);
LOG("Track %d is playing: %s\n", current_track_num, playlist[current_track_num]);
if(current_track_num++ == playlist_length)
{
current_track_num = 0;
}
Mix_PlayMusic( music, 1 );
}
}
开发者ID:Gaxx42,项目名称:Purgatory,代码行数:17,代码来源:music_player.cpp
示例18: addGoal
//*************************************************************************************************
void Game::initGame()
{
m_board.m_direction = RIGHT;
m_board.m_length = 3;
int startPos = START_POS;
for (int i = 0; i < m_board.m_length ; ++i)
{
m_board.m_x[i] = startPos - i;
m_board.m_y[i] = startPos;
}
m_score = 0;
addGoal();
if (!Mix_PlayingMusic())
Mix_PlayMusic(m_music, -1);
}
开发者ID:dinushan,项目名称:game-sim-and-compiler,代码行数:18,代码来源:Game.cpp
示例19: if
void cMusicSDL2::Play(int _repeat, int fade){
if(music != NULL){
if(Mix_PlayingMusic() > 0){ //Music is already playing
if(isPaused){
Mix_ResumeMusic();
isPaused = false;
return;
}else if(Mix_FadingMusic() == MIX_FADING_OUT){
Mix_HaltMusic();
}else{
return;
}
}
if(Mix_FadeInMusic(music, _repeat, fade) < 0){
StormPrintLog(STORM_LOG_ERROR, "cMusicSDL2", "Error %s", Mix_GetError());
}
}
}
开发者ID:master312,项目名称:quantum-kidney,代码行数:18,代码来源:cMusicSDL2.cpp
示例20: getConfig
void
Sound::enableMusic(bool enabled)
{
if(getConfig()->musicEnabled == enabled)
return;
getConfig()->musicEnabled = enabled;
if(!audioOpen)
return;
if(enabled) {
playMusic(musicFile);
} else {
if(Mix_PlayingMusic()) {
Mix_FadeOutMusic(1000);
}
}
}
开发者ID:BackupTheBerlios,项目名称:lincity-ng-svn,代码行数:18,代码来源:Sound.cpp
注:本文中的Mix_PlayingMusic函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论