本文整理汇总了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);
}