public void enter(GameContainer gc, StateBasedGame sbg) throws SlickException { // The listener is reset AlUtils.resetAlListener(); // the orientation is changed AlUtils.setAlListenerOrientation(0.0f, 0.0f, -1.0f, -1.0f, 0.0f, 0.0f); // we set sound context AL10.alDistanceModel(AL11.AL_EXPONENT_DISTANCE); AL10.alDopplerFactor(0.8f); // We play the two sounds since we enter sonG.loop(1f, 1f, 0f, 0f, 0f); sonD.loop(1f, 1f, 0f, 0f, 0f); AL10.alSourcef(sonG.getIndex(), AL10.AL_ROLLOFF_FACTOR, 1.5f); AL10.alSourcef(sonD.getIndex(), AL10.AL_ROLLOFF_FACTOR, 1.5f); // We play the beginning explanation sound enterSound.play(); }
@Override public void leave(GameContainer gc, StateBasedGame sbg) throws SlickException { reset(); AlUtils.stopAllSounds(); AlUtils.resetAlListener(); }