当前位置: 首页>>代码示例>>Java>>正文


Java Music.stop方法代码示例

本文整理汇总了Java中com.badlogic.gdx.audio.Music.stop方法的典型用法代码示例。如果您正苦于以下问题:Java Music.stop方法的具体用法?Java Music.stop怎么用?Java Music.stop使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.badlogic.gdx.audio.Music的用法示例。


在下文中一共展示了Music.stop方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: playNext

import com.badlogic.gdx.audio.Music; //导入方法依赖的package包/类
public void playNext(){
    System.out.println("next sound");

    Music old = currentMusic;

    if(nextMusic == null){
        nextMusic = currentMusic;
    }
    if(nextMusic == currentMusic)
        return;

    currentMusic=nextMusic;
    currentMusic.setVolume(vol);
    currentMusic.play();
    currentMusic.setVolume(vol);

    old.stop();
    old = null;

}
 
开发者ID:GGJG2016,项目名称:EvilBunnyGod,代码行数:21,代码来源:AudioManager.java

示例2: stopMusicBeautifully

import com.badlogic.gdx.audio.Music; //导入方法依赖的package包/类
public void stopMusicBeautifully(String name, Stage stage) {
    final Music music = musics.get(name);
    if (music == null) {
        Logger.error("there is no music for " + name);
        return;
    }
    final float initialVolume = music.getVolume();
    Action action = new TemporalAction(2f, Interpolation.linear) {
        @Override protected void update(float percent) {
            music.setVolume(initialVolume - percent * initialVolume);
        }

        @Override protected void end() {
            music.stop();
            playingMusics.remove(music);
            disabledMusics.remove(music);
        }
    };
    stage.addAction(action);
    replaceAction(music, action);
}
 
开发者ID:ratrecommends,项目名称:dice-heroes,代码行数:22,代码来源:SoundManager.java

示例3: 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

示例4: stop

import com.badlogic.gdx.audio.Music; //导入方法依赖的package包/类
public void stop() {
	if (backgroundMusic) {
		Music musicAsset = RapidAsset.INSTANCE.getMusic(music.getResourcePath());
		musicAsset.stop();
	} else {
		Sound soundAsset = RapidAsset.INSTANCE.getSound(sound.getResourcePath());
		if (loop) {
			soundAsset.stop();

		} else {
			soundAsset.play();
		}
	}
}
 
开发者ID:Radomiej,项目名称:JavityEngine,代码行数:15,代码来源:SoundPlayer.java

示例5: onDisable

import com.badlogic.gdx.audio.Music; //导入方法依赖的package包/类
@Override
public void onDisable() {
	if (backgroundMusic) {
		Music musicAsset = RapidAsset.INSTANCE.getMusic(music.getResourcePath());
		musicAsset.stop();
		return;
	}

	Sound soundAsset = RapidAsset.INSTANCE.getSound(sound.getResourcePath());
	for (long id : soundIds) {
		soundAsset.stop(id);
	}
}
 
开发者ID:Radomiej,项目名称:JavityEngine,代码行数:14,代码来源:SoundPlayer.java

示例6: stopMusic

import com.badlogic.gdx.audio.Music; //导入方法依赖的package包/类
public void stopMusic(String name) {
    Music music = musics.get(name);
    if (music == null) {
        Logger.error("there is no music for " + name);
        return;
    }
    music.stop();
    playingMusics.remove(music);
    disabledMusics.remove(music);
}
 
开发者ID:ratrecommends,项目名称:dice-heroes,代码行数:11,代码来源:SoundManager.java

示例7: update

import com.badlogic.gdx.audio.Music; //导入方法依赖的package包/类
public void update(Application APP, Player player, Music gameMusic, float delta)
{
    for (int i = 0; i < currentEnemies.size; i++)
    {
        bulletLoop:
        for (int j = 0; j < currentBullets.size; j++)
        {
            // IF ENEMY COLLIDES WITH BULLET
            if (Intersector.overlapConvexPolygons(currentEnemies.get(i).getBounds(), currentBullets.get(j).getBounds()))
            {
                // DAMAGE THE ENEMY
                currentEnemies.get(i).renderHit = true;
                currentEnemies.get(i).playSquishSound();
                currentEnemies.get(i).setHitTexture();
                currentEnemies.get(i).reduceHealth(Bullet.getWeapon().getDamage());

                // KNOCKBACK ENEMY
                currentEnemies.get(i).knockback(Bullet.getWeapon().getKnockbackPower());
                currentEnemies.get(i).applyVelocityToPosition(delta);

                // REMOVE THE HIT BULLET
                currentBullets.get(j).isUsed = false;
                currentBullets.get(j).isOutOfScreen = false;
                currentBullets.removeIndex(j);
                break bulletLoop;
            }
        }

        // IF ENEMY COLLIDES WITH PLAYER
        if (Intersector.overlapConvexPolygons(currentEnemies.get(i).getBounds(), player.getBounds()))
        {
            Input.touchDown = false;
            APP.setScreen(deadScreen);
            gameMusic.stop();
        }
    }
}
 
开发者ID:NahroTo,项目名称:Fruit-Destroyer,代码行数:38,代码来源:CollisionHandler.java

示例8: 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

示例9: 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

示例10: stop

import com.badlogic.gdx.audio.Music; //导入方法依赖的package包/类
@Override
public void stop(int fadeOutMillis) {
    // TODO Implement fade out time

    Music music = musicRef.get();
    if (music != null) {
        music.stop();
        paused = false;
    }
}
 
开发者ID:anonl,项目名称:nvlist,代码行数:11,代码来源:NativeAudio.java

示例11: 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

示例12: stopSongs

import com.badlogic.gdx.audio.Music; //导入方法依赖的package包/类
/**
 * Stops all songs.
 */
public void stopSongs() {
    for (Music music: songs.values()) {
        music.stop();
    }
}
 
开发者ID:gradualgames,项目名称:ggvm,代码行数:9,代码来源:SoundtrackManager.java

示例13: onNotify

import com.badlogic.gdx.audio.Music; //导入方法依赖的package包/类
@Override
public void onNotify(AudioCommand command, AudioTypeEvent event) {
    switch(command){
        case MUSIC_LOAD:
            Assets.loadMusicAsset(event.getValue());
            break;
        case MUSIC_PLAY_ONCE:
            playMusic(false, event.getValue());
            break;
        case MUSIC_PLAY_LOOP:
            playMusic(true, event.getValue());
            break;
        case MUSIC_STOP:
            Music music = _queuedMusic.get(event.getValue());
            if( music != null ){
                music.stop();
            }
            break;
        case MUSIC_STOP_ALL:
            for( Music musicStop: _queuedMusic.values() ){
                musicStop.stop();
            }
            break;
        case SOUND_LOAD:
            Assets.loadSoundAsset(event.getValue());
            break;
        case SOUND_PLAY_LOOP:
            playSound(true, event.getValue());
            break;
        case SOUND_PLAY_ONCE:
            playSound(false, event.getValue());
            break;
        case SOUND_STOP:
            Sound sound = _queuedSounds.get(event.getValue());
            if( sound != null ){
                sound.stop();
            }
            break;
        default:
            break;
    }
}
 
开发者ID:Mignet,项目名称:Inspiration,代码行数:43,代码来源:AudioManager.java

示例14: stopIntroMusic

import com.badlogic.gdx.audio.Music; //导入方法依赖的package包/类
public void stopIntroMusic() {
	Music music = assetManager.get("sounds/intro.ogg", Music.class);
	music.stop();
}
 
开发者ID:igorcrevar,项目名称:GoingUnder,代码行数:5,代码来源:GameManager.java


注:本文中的com.badlogic.gdx.audio.Music.stop方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。