Java Code Examples for com.badlogic.gdx.audio.Sound#stop()

The following examples show how to use com.badlogic.gdx.audio.Sound#stop() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GdxSoundDriver.java    From beatoraja with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void stop(Sound id) {
	if (soundthread) {
		mixer.stop(id, 0);
	} else {
		synchronized (lock) {
			id.stop();			
		}			
	}
}
 
Example 2
Source File: NinjaRabbitAudioProcessor.java    From ninja-rabbit with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void update(final Entity character) {
	if (character.isInState(NinjaRabbitState.JUMP) && character.getBody().getLinearVelocity().y > 0) {
		if (jumpTimeout <= 0) {
			Sound jumpFx = assets.get(Assets.JUMP_FX);
			jumpFx.stop(jumpFxId);
			jumpFxId = jumpFx.play();
			jumpTimeout = MAX_JUMP_TIMEOUT;
		} else {
			jumpTimeout -= Gdx.graphics.getDeltaTime();
		}
	} else {
		jumpTimeout = 0;
	}
}
 
Example 3
Source File: AudioManager.java    From Norii with Apache License 2.0 4 votes vote down vote up
@Override
public void onNotify(AudioCommand command, AudioTypeEvent event) {
    switch(command){
        case MUSIC_LOAD:
            Utility.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:
            Utility.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;
        case MUSIC_PAUSE:
        	Music musicToPause = queuedMusic.get(event.getValue());
            if( musicToPause != null ){
            	musicToPause.pause();;
            }
            break;
        case MUSIC_RESUME:
        	Music musicToResume = queuedMusic.get(event.getValue());
            if( musicToResume != null ){
            	musicToResume.play();;
            }
            break;
        default:
            break;
    }
}