/** * Set the directional audio node cone outer angle. * Does nothing if the audio node is not directional. * * @param outerAngle The cone outer angle. */ public void setOuterAngle(float outerAngle) { this.outerAngle = outerAngle; if (channel >= 0) getRenderer().updateSourceParam(this, AudioParam.OuterAngle); }
/** * Set the looping mode for the audio node. The default is false. * * @param loop True if the audio should keep looping after it is done playing. */ public void setLooping(boolean loop) { this.loop = loop; if (channel >= 0) getRenderer().updateSourceParam(this, AudioParam.Looping); }
/** * Set the direction of this audio node. * Does nothing if the audio node is not directional. * * @param direction * @see AudioNode#setDirectional(boolean) */ public void setDirection(Vector3f direction) { this.direction = direction; if (channel >= 0) getRenderer().updateSourceParam(this, AudioParam.Direction); }
/** * Set the directional audio node cone inner angle. * Does nothing if the audio node is not directional. * * @param innerAngle The cone inner angle. */ public void setInnerAngle(float innerAngle) { this.innerAngle = innerAngle; if (channel >= 0) getRenderer().updateSourceParam(this, AudioParam.InnerAngle); }
/** * Set the reverb filter for this audio node. * <br/> * The reverb filter will influence the reverberations * of the audio node playing. This only has an effect if * reverb is enabled. * * @param reverbFilter The reverb filter to set. * @see AudioNode#setDryFilter(com.jme3.audio.Filter) */ public void setReverbFilter(Filter reverbFilter) { this.reverbFilter = reverbFilter; if (channel >= 0) getRenderer().updateSourceParam(this, AudioParam.ReverbFilter); }
/** * Set the pitch of the audio, also the speed of playback. * The value must be between 0.5 and 2.0. * * @param pitch The pitch to set. * @throws IllegalArgumentException If pitch is not between 0.5 and 2.0. */ public void setPitch(float pitch) { if (pitch < 0.5f || pitch > 2.0f) { throw new IllegalArgumentException("Pitch must be between 0.5 and 2.0"); } this.pitch = pitch; if (channel >= 0) getRenderer().updateSourceParam(this, AudioParam.Pitch); }
/** * Set the audio node as positional. * The position, velocity, and distance parameters affect positional * audio nodes. Set to false if the audio node should play in "headspace". * * @param positional True if the audio node should be positional, otherwise * false if it should be headspace. */ public void setPositional(boolean positional) { this.positional = positional; if (channel >= 0) { getRenderer().updateSourceParam(this, AudioParam.IsPositional); } }
/** * Set to true to enable reverberation effects for this audio node. * Does nothing if the audio node is not positional. * <br/> * When enabled, the audio environment set with * {@link AudioRenderer#setEnvironment(com.jme3.audio.Environment) } * will apply a reverb effect to the audio playing from this audio node. * * @param reverbEnabled True to enable reverb. */ public void setReverbEnabled(boolean reverbEnabled) { this.reverbEnabled = reverbEnabled; if (channel >= 0) { getRenderer().updateSourceParam(this, AudioParam.ReverbEnabled); } }
/** * Set the audio node to be directional. * Does nothing if the audio node is not positional. * <br/> * After setting directional, you should call * {@link AudioNode#setDirection(com.jme3.math.Vector3f) } * to set the audio node's direction. * * @param directional If the audio node is directional */ public void setDirectional(boolean directional) { this.directional = directional; if (channel >= 0) getRenderer().updateSourceParam(this, AudioParam.IsDirectional); }
/** * Set the volume of this audio node. * * The volume is specified as gain. 1.0 is the default. * * @param volume The volume to set. * @throws IllegalArgumentException If volume is negative */ public void setVolume(float volume) { if (volume < 0f) { throw new IllegalArgumentException("Volume cannot be negative"); } this.volume = volume; if (channel >= 0) getRenderer().updateSourceParam(this, AudioParam.Volume); }
/** * Set the dry filter to use for this audio node. * * When {@link AudioNode#setReverbEnabled(boolean) reverb} is used, * the dry filter will only influence the "dry" portion of the audio, * e.g. not the reverberated parts of the AudioNode playing. * * See the relevant documentation for the {@link Filter} to determine the * effect. * * @param dryFilter The filter to set, or null to disable dry filter. */ public void setDryFilter(Filter dryFilter) { this.dryFilter = dryFilter; if (channel >= 0) getRenderer().updateSourceParam(this, AudioParam.DryFilter); }
/** * Set the reference playing distance for the audio node. * Does nothing if the audio node is not positional. * <br/> * The reference playing distance is the distance at which the * audio node will be exactly half of its volume. * * @param refDistance The reference playing distance. * @throws IllegalArgumentException If refDistance is negative */ public void setRefDistance(float refDistance) { if (refDistance < 0) { throw new IllegalArgumentException("Reference distance cannot be negative"); } this.refDistance = refDistance; if (channel >= 0) getRenderer().updateSourceParam(this, AudioParam.RefDistance); }
/** * Set the maximum distance for the attenuation of the audio node. * Does nothing if the audio node is not positional. * <br/> * The maximum distance is the distance beyond which the audio * node will no longer be attenuated. Normal attenuation is logarithmic * from refDistance (it reduces by half when the distance doubles). * Max distance sets where this fall-off stops and the sound will never * get any quieter than at that distance. If you want a sound to fall-off * very quickly then set ref distance very short and leave this distance * very long. * * @param maxDistance The maximum playing distance. * @throws IllegalArgumentException If maxDistance is negative */ public void setMaxDistance(float maxDistance) { if (maxDistance < 0) { throw new IllegalArgumentException("Max distance cannot be negative"); } this.maxDistance = maxDistance; if (channel >= 0) getRenderer().updateSourceParam(this, AudioParam.MaxDistance); }
/** * Set the velocity of the audio node. The velocity is expected * to be in meters. Does nothing if the audio node is not positional. * * @param velocity The velocity to set. * @see AudioNode#setPositional(boolean) */ public void setVelocity(Vector3f velocity) { this.velocity.set(velocity); if (channel >= 0) getRenderer().updateSourceParam(this, AudioParam.Velocity); }
@Override public void updateGeometricState() { super.updateGeometricState(); if (channel < 0 || this.getParent() == null) return; Vector3f currentWorldTranslation = worldTransform.getTranslation(); if (!previousWorldTranslation.equals(currentWorldTranslation)) { getRenderer().updateSourceParam(this, AudioParam.Position); if (velocityFromTranslation && !Float.isNaN(previousWorldTranslation.x)) { velocity.set(currentWorldTranslation).subtractLocal(previousWorldTranslation).multLocal(1f / lastTpf); getRenderer().updateSourceParam(this, AudioParam.Velocity); } previousWorldTranslation.set(currentWorldTranslation); } }
@Override public void updateSourceParam(AudioSource as, AudioParam ap) { audioRenderer.updateSourceParam(as, ap); }
/** * Set the direction of this audio node. * Does nothing if the audio node is not directional. * * @param direction * @see AudioNode#setDirectional(boolean) */ public void setDirection(Vector3f direction) { this.direction = direction; if (channel >= 0) getRenderer().updateSourceParam(this, AudioParam.Direction); }
/** * Set the directional audio node cone inner angle. * Does nothing if the audio node is not directional. * * @param innerAngle The cone inner angle. */ public void setInnerAngle(float innerAngle) { this.innerAngle = innerAngle; if (channel >= 0) getRenderer().updateSourceParam(this, AudioParam.InnerAngle); }
/** * Set the directional audio node cone outer angle. * Does nothing if the audio node is not directional. * * @param outerAngle The cone outer angle. */ public void setOuterAngle(float outerAngle) { this.outerAngle = outerAngle; if (channel >= 0) getRenderer().updateSourceParam(this, AudioParam.OuterAngle); }
/** * Set the looping mode for the audio node. The default is false. * * @param loop True if the audio should keep looping after it is done playing. */ public void setLooping(boolean loop) { this.loop = loop; if (channel >= 0) getRenderer().updateSourceParam(this, AudioParam.Looping); }