From 8cdbfb676ea31c6719e6f6e8ae7a44e060a5987f Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Sun, 25 Aug 2013 02:47:49 +0200 Subject: GLMediaPlayer/AudioSink: Add set[Audio]Volume(float v)/get[Audio]Volume() allowing to change the audio volume. --- .../com/jogamp/opengl/util/av/AudioSink.java | 22 +++++++++++++++++++-- .../com/jogamp/opengl/util/av/GLMediaPlayer.java | 23 ++++++++++++++++++++-- 2 files changed, 41 insertions(+), 4 deletions(-) (limited to 'src/jogl/classes/com/jogamp') 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. *

- * Play speed is set to normal, i.e. 1.0f - * if abs(1.0f - rate) < 0.01f to simplify test. + * To simplify test, play speed is normalized, i.e. + *

*

* @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]. + *

+ * To simplify test, volume is normalized, i.e. + *

+ *

+ * @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. *

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,15 +350,34 @@ public interface GLMediaPlayer extends TextureSequence { /** * Sets the playback speed. *

- * Play speed is set to normal, i.e. 1.0f - * if abs(1.0f - rate) < 0.01f to simplify test. + * To simplify test, play speed is normalized, i.e. + *

*

* @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]. + *

+ * To simplify test, volume is normalized, i.e. + *

+ *

+ * @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(); + /** * Lifecycle: {@link State#Paused} -> {@link State#Playing} */ -- cgit v1.2.3