當前位置: 首頁>>代碼示例>>Java>>正文


Java Music.isPlaying方法代碼示例

本文整理匯總了Java中com.badlogic.gdx.audio.Music.isPlaying方法的典型用法代碼示例。如果您正苦於以下問題:Java Music.isPlaying方法的具體用法?Java Music.isPlaying怎麽用?Java Music.isPlaying使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.badlogic.gdx.audio.Music的用法示例。


在下文中一共展示了Music.isPlaying方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: RandomMusicPlaylist

import com.badlogic.gdx.audio.Music; //導入方法依賴的package包/類
public RandomMusicPlaylist(float volume, AssetsHandler assetsHndlr){
	_assetsHndlr = assetsHndlr;
	_musics = new ArrayList<Music>();
	_volume = volume;
	for(String name : _GAME_MUSIC_NAMES)
		_musics.add((Music)_assetsHndlr.get(name));
	
	_musicListener = new OnCompletionListener() {
		@Override
		public void onCompletion(Music music) {
			if(music.isPlaying())
				music.stop();
		
			PlayRandomMusic();	
		}
	};
}
 
開發者ID:mitsuhirato,項目名稱:TheEndlessCastle,代碼行數:18,代碼來源:RandomMusicPlaylist.java

示例2: playMusic

import com.badlogic.gdx.audio.Music; //導入方法依賴的package包/類
public void playMusic(String musicName, boolean isLooping) {
    Music music = assetManager.get(musicPath + musicName);
    music.setVolume(0.6f);
    if (currentMusic.equals(musicName)) {
        music.setLooping(isLooping);
        if (!music.isPlaying()) {
            music.play();
        }
        return;
    }

    stopMusic();
    music.setLooping(isLooping);
    music.play();
    currentMusic = musicName;
}
 
開發者ID:yichen0831,項目名稱:Bomberman_libGdx,代碼行數:17,代碼來源:GameManager.java

示例3: playMusic

import com.badlogic.gdx.audio.Music; //導入方法依賴的package包/類
@Override
public final void playMusic( int soundId, boolean looping, float volume, float pan ) {
    Music sound = music.get( soundId );
    if ( sound == null || sound.isPlaying() ) {
        return;
    }
    
    sound.setPan( pan, volume );
    sound.setLooping( looping );
    
    sound.play();
}
 
開發者ID:Inari-Soft,項目名稱:inari-firefly-libGDX,代碼行數:13,代碼來源:GdxAudioImpl.java

示例4: changeMusic

import com.badlogic.gdx.audio.Music; //導入方法依賴的package包/類
@Override
public final void changeMusic( int soundId, float volume, float pan ) {
    Music sound = music.get( soundId );
    if ( sound == null || sound.isPlaying() ) {
        return;
    }
    
    sound.setPan( pan, volume );
}
 
開發者ID:Inari-Soft,項目名稱:inari-firefly-libGDX,代碼行數:10,代碼來源:GdxAudioImpl.java

示例5: stopMusic

import com.badlogic.gdx.audio.Music; //導入方法依賴的package包/類
@Override
public final void stopMusic( int soundId ) {
    Music sound = music.get( soundId );
    if ( sound == null || !sound.isPlaying() ) {
        return;
    }
    
    sound.stop();
}
 
開發者ID:Inari-Soft,項目名稱:inari-firefly-libGDX,代碼行數:10,代碼來源:GdxAudioImpl.java

示例6: disposeOf

import com.badlogic.gdx.audio.Music; //導入方法依賴的package包/類
private void disposeOf(Music mus) {
    if(mus == null)
        return;;

    if(mus.isPlaying())
        mus.stop();

    mus.dispose();
}
 
開發者ID:kbz,項目名稱:SSTrain,代碼行數:10,代碼來源:Crossfader.java

示例7: stopMusic

import com.badlogic.gdx.audio.Music; //導入方法依賴的package包/類
public void stopMusic() {
    if (currentMusic.isEmpty()) {
        return;
    }
    Music music = assetManager.get(musicPath + currentMusic, Music.class);
    if (music.isPlaying()) {
        music.stop();
    }
}
 
開發者ID:yichen0831,項目名稱:Bomberman_libGdx,代碼行數:10,代碼來源:GameManager.java

示例8: pauseMusic

import com.badlogic.gdx.audio.Music; //導入方法依賴的package包/類
public void pauseMusic() {
    if (currentMusic.isEmpty()) {
        return;
    }

    Music music = assetManager.get(musicPath + currentMusic, Music.class);
    if (music.isPlaying()) {
        music.pause();
    }
}
 
開發者ID:yichen0831,項目名稱:Bomberman_libGdx,代碼行數:11,代碼來源:GameManager.java

示例9: isPlaying

import com.badlogic.gdx.audio.Music; //導入方法依賴的package包/類
@Override
public boolean isPlaying() {
    Music music = musicRef.get();
    return music != null && music.isPlaying();
}
 
開發者ID:anonl,項目名稱:nvlist,代碼行數:6,代碼來源:NativeAudio.java


注:本文中的com.badlogic.gdx.audio.Music.isPlaying方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。