com.jme3.audio.Environment Java Examples

The following examples show how to use com.jme3.audio.Environment. 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: TestReverb.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public void simpleInitApp() {
  audioSource = new AudioNode(assetManager, "Sound/Effects/Bang.wav",
          AudioData.DataType.Buffer);

  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};
  audioRenderer.setEnvironment(new Environment(eax));
  Environment env = Environment.Cavern;
  audioRenderer.setEnvironment(env);
}
 
Example #2
Source File: TestAmbient.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@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 #3
Source File: LwjglAudioRenderer.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void setEnvironment(Environment env){
    checkDead();
    synchronized (threadLock){
        while (!threadLock.get()){
            try {
                threadLock.wait();
            } catch (InterruptedException ex) {
            }
        }
        if (audioDisabled || !supportEfx)
            return;
        
        EFX10.alEffectf(reverbFx, EFX10.AL_REVERB_DENSITY,             env.getDensity());
        EFX10.alEffectf(reverbFx, EFX10.AL_REVERB_DIFFUSION,           env.getDiffusion());
        EFX10.alEffectf(reverbFx, EFX10.AL_REVERB_GAIN,                env.getGain());
        EFX10.alEffectf(reverbFx, EFX10.AL_REVERB_GAINHF,              env.getGainHf());
        EFX10.alEffectf(reverbFx, EFX10.AL_REVERB_DECAY_TIME,          env.getDecayTime());
        EFX10.alEffectf(reverbFx, EFX10.AL_REVERB_DECAY_HFRATIO,       env.getDecayHFRatio());
        EFX10.alEffectf(reverbFx, EFX10.AL_REVERB_REFLECTIONS_GAIN,    env.getReflectGain());
        EFX10.alEffectf(reverbFx, EFX10.AL_REVERB_REFLECTIONS_DELAY,   env.getReflectDelay());
        EFX10.alEffectf(reverbFx, EFX10.AL_REVERB_LATE_REVERB_GAIN,    env.getLateReverbGain());
        EFX10.alEffectf(reverbFx, EFX10.AL_REVERB_LATE_REVERB_DELAY,   env.getLateReverbDelay());
        EFX10.alEffectf(reverbFx, EFX10.AL_REVERB_AIR_ABSORPTION_GAINHF, env.getAirAbsorbGainHf());
        EFX10.alEffectf(reverbFx, EFX10.AL_REVERB_ROOM_ROLLOFF_FACTOR, env.getRoomRolloffFactor());

        // attach effect to slot
        EFX10.alAuxiliaryEffectSloti(reverbFxSlot, EFX10.AL_EFFECTSLOT_EFFECT, reverbFx);
    }
}
 
Example #4
Source File: TestReverb.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
public void simpleInitApp() {
  audioSource = new AudioNode(assetManager, "Sound/Effects/Bang.wav");

  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};
  audioRenderer.setEnvironment(new Environment(eax));
  Environment env = Environment.Cavern;
  audioRenderer.setEnvironment(env);
}
 
Example #5
Source File: TestAmbient.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@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 #6
Source File: TestDoppler.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@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 #7
Source File: AndroidAudioRenderer.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Override
public void setEnvironment(Environment env) {
    // TODO Auto-generated method stub
}