diff options
author | Sven Gothel <[email protected]> | 2013-08-25 02:47:49 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2013-08-25 02:47:49 +0200 |
commit | 8cdbfb676ea31c6719e6f6e8ae7a44e060a5987f (patch) | |
tree | 1808877f76e87d4c67d0ff23657b39af823c072b /src/jogl/classes/com/jogamp/opengl/util | |
parent | 517371b2c200783890e2f6a173748cf65d3c8c91 (diff) |
GLMediaPlayer/AudioSink: Add set[Audio]Volume(float v)/get[Audio]Volume() allowing to change the audio volume.
Diffstat (limited to 'src/jogl/classes/com/jogamp/opengl/util')
-rw-r--r-- | src/jogl/classes/com/jogamp/opengl/util/av/AudioSink.java | 22 | ||||
-rw-r--r-- | src/jogl/classes/com/jogamp/opengl/util/av/GLMediaPlayer.java | 23 |
2 files changed, 41 insertions, 4 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/util/av/AudioSink.java b/src/jogl/classes/com/jogamp/opengl/util/av/AudioSink.java index 2b8da8af9..7f477a57d 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/av/AudioSink.java +++ b/src/jogl/classes/com/jogamp/opengl/util/av/AudioSink.java @@ -201,13 +201,31 @@ public interface AudioSink { /** * Sets the playback speed. * <p> - * Play speed is set to <i>normal</i>, i.e. <code>1.0f</code> - * if <code> abs(1.0f - rate) < 0.01f</code> to simplify test. + * To simplify test, play speed is <i>normalized</i>, i.e. + * <ul> + * <li><code>1.0f</code>: if <code> Math.abs(1.0f - rate) < 0.01f </code></li> + * </ul> * </p> * @return true if successful, otherwise false, i.e. due to unsupported value range of implementation. */ public boolean setPlaySpeed(float s); + /** Returns the volume. */ + public float getVolume(); + + /** + * Sets the volume [0f..1f]. + * <p> + * To simplify test, volume is <i>normalized</i>, i.e. + * <ul> + * <li><code>0.0f</code>: if <code> Math.abs(v) < 0.01f </code></li> + * <li><code>1.0f</code>: if <code> Math.abs(1.0f - v) < 0.01f </code></li> + * </ul> + * </p> + * @return true if successful, otherwise false, i.e. due to unsupported value range of implementation. + */ + public boolean setVolume(float v); + /** * Returns the preferred {@link AudioDataFormat} by this sink. * <p> diff --git a/src/jogl/classes/com/jogamp/opengl/util/av/GLMediaPlayer.java b/src/jogl/classes/com/jogamp/opengl/util/av/GLMediaPlayer.java index 02fbd721c..6235bdeb0 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/av/GLMediaPlayer.java +++ b/src/jogl/classes/com/jogamp/opengl/util/av/GLMediaPlayer.java @@ -350,16 +350,35 @@ public interface GLMediaPlayer extends TextureSequence { /** * Sets the playback speed. * <p> - * Play speed is set to <i>normal</i>, i.e. <code>1.0f</code> - * if <code> abs(1.0f - rate) < 0.01f</code> to simplify test. + * To simplify test, play speed is <i>normalized</i>, i.e. + * <ul> + * <li><code>1.0f</code>: if <code> Math.abs(1.0f - rate) < 0.01f </code></li> + * </ul> * </p> * @return true if successful, otherwise false, i.e. due to unsupported value range of implementation. */ public boolean setPlaySpeed(float rate); + /** Returns the playback speed. */ public float getPlaySpeed(); /** + * Sets the audio volume, [0f..1f]. + * <p> + * To simplify test, volume is <i>normalized</i>, i.e. + * <ul> + * <li><code>0.0f</code>: if <code> Math.abs(v) < 0.01f </code></li> + * <li><code>1.0f</code>: if <code> Math.abs(1.0f - v) < 0.01f </code></li> + * </ul> + * </p> + * @return true if successful, otherwise false, i.e. due to unsupported value range of implementation. + */ + public boolean setAudioVolume(float v); + + /** Returns the audio volume. */ + public float getAudioVolume(); + + /** * <a href="#lifecycle">Lifecycle</a>: {@link State#Paused} -> {@link State#Playing} */ public State play(); |