Add a new play method that allows specification of a position for the sound source.
git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@723 ed5b42cb-e716-0410-a449-f6a68f950b19
This commit is contained in:
@@ -259,13 +259,27 @@ public class OpenALSoundPlayer extends SoundPlayer
|
|||||||
|
|
||||||
public void play (String pkgPath, String key, float pan, final float gain)
|
public void play (String pkgPath, String key, float pan, final float gain)
|
||||||
{
|
{
|
||||||
|
play(null, pkgPath, key, gain, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean play (SoundType type, String pkgPath, String key, final float gain,
|
||||||
|
final float[] pos)
|
||||||
|
{
|
||||||
|
if (type != null && !shouldPlay(type)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
getSoundQueue().postRunnable(new SoundGrabber(pkgPath, key) {
|
getSoundQueue().postRunnable(new SoundGrabber(pkgPath, key) {
|
||||||
@Override
|
@Override
|
||||||
protected void soundLoaded () {
|
protected void soundLoaded () {
|
||||||
sound.setGain(gain);
|
sound.setGain(gain);
|
||||||
|
if (pos != null) {
|
||||||
|
sound.setPosition(pos[0], pos[1], pos[2]);
|
||||||
|
}
|
||||||
sound.play(true);
|
sound.play(true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user