本文整理匯總了Java中com.badlogic.gdx.audio.Music.setPan方法的典型用法代碼示例。如果您正苦於以下問題:Java Music.setPan方法的具體用法?Java Music.setPan怎麽用?Java Music.setPan使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.badlogic.gdx.audio.Music
的用法示例。
在下文中一共展示了Music.setPan方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: updateSound
import com.badlogic.gdx.audio.Music; //導入方法依賴的package包/類
public void updateSound(Vector2 position, Music sound) {
position = new Vector2(position.x * Vars.PPM, position.y * Vars.PPM);
float dx = cam.position.x - position.x;
float dy = cam.position.y - cam.yOff - position.y;
float distance = (float) Math.sqrt(dx * dx + dy * dy);
float pan;
float s = 21400, a = .3183f, f = 5;
float volume = (float) (Math.exp(-1 * (distance * distance) / (2 * s)) / // Gaussian
// curve
(Math.sqrt((a * Math.PI) / (Game.soundVolume * Game.soundVolume))));
if (Math.abs(dx) > f)
pan = (float) -(2 / (1 + Math.exp(-(dx - f * dx / Math.abs(dx)) / 3.5)) - 1); // Logaritmic
// curve
else
pan = 0;
sound.setPan(pan, volume);
}
示例2: 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();
}
示例3: 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 );
}
示例4: updateMusic
import com.badlogic.gdx.audio.Music; //導入方法依賴的package包/類
protected void updateMusic(Music music) {
music.setPan(pan, volume);
}