Java Code Examples for com.jme3.audio.AudioNode#setPositional()
The following examples show how to use
com.jme3.audio.AudioNode#setPositional() .
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: HelloAudio.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 6 votes |
/** We create two audio nodes. */ private void initAudio() { /* gun shot sound is to be triggered by a mouse click. */ audio_gun = new AudioNode(assetManager, "Sound/Effects/Gun.wav", DataType.Buffer); audio_gun.setPositional(false); audio_gun.setLooping(false); audio_gun.setVolume(2); rootNode.attachChild(audio_gun); /* nature sound - keeps playing in a loop. */ audio_nature = new AudioNode(assetManager, "Sound/Environment/Ocean Waves.ogg", DataType.Stream); audio_nature.setLooping(true); // activate continuous playing audio_nature.setPositional(true); audio_nature.setVolume(3); rootNode.attachChild(audio_nature); audio_nature.play(); // play continuously! }
Example 2
Source File: SoundPerformer.java From OpenRTS with MIT License | 6 votes |
@Override public void perform(Actor a) { SoundActor actor = (SoundActor)a; AudioNode audio = actorDrawer.getAudioNode(actor.soundPath); audio.setPositional(actor.positional); if(actor.positional) audio.setLocalTranslation(TranslateUtil.toVector3f(actor.getParentModelActor().getPos())); audio.setLooping(actor.looping); audio.setVolume((float)(actor.volume)); audio.setRefDistance(4); audio.setReverbEnabled(false); audio.playInstance(); a.stopActing(); }
Example 3
Source File: HelloAudio.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 6 votes |
/** We create two audio nodes. */ private void initAudio() { /* gun shot sound is to be triggered by a mouse click. */ audio_gun = new AudioNode(assetManager, "Sound/Effects/Gun.wav", false); audio_gun.setLooping(false); audio_gun.setVolume(2); rootNode.attachChild(audio_gun); /* nature sound - keeps playing in a loop. */ audio_nature = new AudioNode(assetManager, "Sound/Environment/Nature.ogg", true); audio_nature.setLooping(true); // activate continuous playing audio_nature.setPositional(true); audio_nature.setLocalTranslation(Vector3f.ZERO.clone()); audio_nature.setVolume(3); rootNode.attachChild(audio_nature); audio_nature.play(); // play continuously! }
Example 4
Source File: AudioViewer3DPart.java From jmonkeybuilder with Apache License 2.0 | 5 votes |
/** * Load the audio data. * * @param audioData the audio data. * @param audioKey the audio key. */ @JmeThread private void loadImpl(@NotNull final AudioData audioData, @NotNull final AudioKey audioKey) { removeAudioNode(); setAudioData(audioData); setAudioKey(audioKey); final Node stateNode = getStateNode(); final AudioNode audioNode = new AudioNode(audioData, audioKey); audioNode.setPositional(false); stateNode.attachChild(audioNode); setAudioNode(audioNode); }
Example 5
Source File: TestAmbient.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Override public void simpleInitApp() { float[] eax = new float[]{15, 38.0f, 0.300f, -1000, -3300, 0, 1.49f, 0.54f, 1.00f, -2560, 0.162f, 0.00f, 0.00f, 0.00f, -229, 0.088f, 0.00f, 0.00f, 0.00f, 0.125f, 1.000f, 0.250f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.00f, 0x3f}; Environment env = new Environment(eax); audioRenderer.setEnvironment(env); waves = new AudioNode(assetManager, "Sound/Environment/Ocean Waves.ogg", DataType.Buffer); waves.setPositional(true); waves.setLocalTranslation(new Vector3f(0, 0,0)); waves.setMaxDistance(100); waves.setRefDistance(5); nature = new AudioNode(assetManager, "Sound/Environment/Nature.ogg", DataType.Stream); nature.setPositional(false); nature.setVolume(3); waves.playInstance(); nature.play(); // just a blue box to mark the spot Box box1 = new Box(.5f, .5f, .5f); Geometry player = new Geometry("Player", box1); Material mat1 = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); mat1.setColor("Color", ColorRGBA.Blue); player.setMaterial(mat1); rootNode.attachChild(player); }
Example 6
Source File: TestMusicStreaming.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Override public void simpleInitApp(){ assetManager.registerLocator("https://web.archive.org/web/20170625151521if_/http://www.vorbis.com/music/", UrlLocator.class); AudioNode audioSource = new AudioNode(assetManager, "Lumme-Badloop.ogg", AudioData.DataType.Stream); audioSource.setPositional(false); audioSource.setReverbEnabled(false); audioSource.play(); }
Example 7
Source File: SoundEvent.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Override public void initEvent(Application app, Cinematic cinematic) { super.initEvent(app, cinematic); audioNode = new AudioNode(app.getAssetManager(), path, stream); audioNode.setPositional(false); setLoopMode(loopMode); }
Example 8
Source File: TestAmbient.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
@Override public void simpleInitApp() { /* footsteps = new AudioNode(audioRenderer, assetManager, "Sound/Effects/Foot steps.ogg", true); footsteps.setPositional(true); footsteps.setLocalTranslation(new Vector3f(4, -1, 30)); footsteps.setMaxDistance(5); footsteps.setRefDistance(1); footsteps.setLooping(true); beep = new AudioNode(audioRenderer, assetManager, "Sound/Effects/Beep.ogg", true); beep.setVolume(3); beep.setLooping(true); audioRenderer.playSourceInstance(footsteps); audioRenderer.playSource(beep); */ waves = new AudioNode(assetManager, "Sound/Environment/Ocean Waves.ogg", true); waves.setPositional(true); nature = new AudioNode(assetManager, "Sound/Environment/Nature.ogg", true); waves.setLocalTranslation(new Vector3f(4, -1, 30)); waves.setMaxDistance(5); waves.setRefDistance(1); nature.setVolume(3); audioRenderer.playSourceInstance(waves); audioRenderer.playSource(nature); }
Example 9
Source File: TestAmbient.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
@Override public void simpleInitApp() { float[] eax = new float[]{15, 38.0f, 0.300f, -1000, -3300, 0, 1.49f, 0.54f, 1.00f, -2560, 0.162f, 0.00f, 0.00f, 0.00f, -229, 0.088f, 0.00f, 0.00f, 0.00f, 0.125f, 1.000f, 0.250f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.00f, 0x3f}; Environment env = new Environment(eax); audioRenderer.setEnvironment(env); waves = new AudioNode(assetManager, "Sound/Environment/Ocean Waves.ogg", false); waves.setPositional(true); waves.setLocalTranslation(new Vector3f(0, 0,0)); waves.setMaxDistance(100); waves.setRefDistance(5); nature = new AudioNode(assetManager, "Sound/Environment/Nature.ogg", true); nature.setVolume(3); waves.playInstance(); nature.play(); // just a blue box to mark the spot Box box1 = new Box(Vector3f.ZERO, .5f, .5f, .5f); Geometry player = new Geometry("Player", box1); Material mat1 = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); mat1.setColor("Color", ColorRGBA.Blue); player.setMaterial(mat1); rootNode.attachChild(player); }
Example 10
Source File: TestDoppler.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
@Override public void simpleInitApp(){ audioRenderer.setEnvironment(Environment.Dungeon); AL10.alDistanceModel(AL11.AL_EXPONENT_DISTANCE); ufo = new AudioNode(assetManager, "Sound/Effects/Beep.ogg", false); ufo.setPositional(true); ufo.setLooping(true); ufo.setReverbEnabled(true); ufo.setRefDistance(100000000); ufo.setMaxDistance(100000000); ufo.play(); }
Example 11
Source File: SoundDeviceJme.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Override public SoundHandle loadSound(SoundSystem soundSystem, String filename) { AudioNode an = new AudioNode(assetManager, filename, AudioData.DataType.Buffer); an.setPositional(false); return new SoundHandleJme(ar, an); }
Example 12
Source File: SoundDeviceJme.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 4 votes |
public SoundHandle loadSound(SoundSystem soundSystem, String filename) { AudioNode an = new AudioNode(assetManager, filename, false); an.setPositional(false); return new SoundHandleJme(ar, an); }