From dbd0236203f3d969575e62097f42a2a86e2a36ae Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Fri, 6 Oct 2023 12:21:08 +0200 Subject: AudioSink: Rename getQueued{Time->Duration}(), add updateQueue() --- src/java/com/jogamp/common/av/AudioSink.java | 16 ++++++++++++++-- src/java/jogamp/common/av/JavaSoundAudioSink.java | 5 ++++- src/java/jogamp/common/av/NullAudioSink.java | 5 ++++- 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/src/java/com/jogamp/common/av/AudioSink.java b/src/java/com/jogamp/common/av/AudioSink.java index f3ed5a8..6f36e6f 100644 --- a/src/java/com/jogamp/common/av/AudioSink.java +++ b/src/java/com/jogamp/common/av/AudioSink.java @@ -392,12 +392,12 @@ public interface AudioSink { *

* @see #init(AudioFormat, float, int) */ - public float getQueuedTime(); + public float getQueuedDuration(); /** * Returns average frame duration last assessed @ {@link #enqueueData(int, ByteBuffer, int)} when queue was full. *
-     *   avgFrameDuration = {@link #getQueuedTime()} / {@link #getQueuedFrameCount()}
+     *   avgFrameDuration = {@link #getQueuedDuration()} / {@link #getQueuedFrameCount()}
      * 
*/ public float getAvgFrameDuration(); @@ -446,4 +446,16 @@ public interface AudioSink { * @see #init(AudioFormat, float, int) */ public AudioFrame enqueueData(int pts, ByteBuffer bytes, int byteCount); + + /** + * Update queue beyond {@link #enqueueData(int, ByteBuffer, int)} including audio PTS. + *

+ * Useful in case implementation only updates the buffer passively via {@link #enqueueData(int, ByteBuffer, int) enqueueing data} + * to add new data to the queue and not on a event basis. + *

+ * @return the updated current audio PTS + * @see #getPTS() + * @see #enqueueData(int, ByteBuffer, int) + */ + public int updateQueue(); } diff --git a/src/java/jogamp/common/av/JavaSoundAudioSink.java b/src/java/jogamp/common/av/JavaSoundAudioSink.java index 94ad236..556ada4 100644 --- a/src/java/jogamp/common/av/JavaSoundAudioSink.java +++ b/src/java/jogamp/common/av/JavaSoundAudioSink.java @@ -305,7 +305,7 @@ public final class JavaSoundAudioSink implements AudioSink { } @Override - public float getQueuedTime() { + public float getQueuedDuration() { return chosenFormat.getBytesDuration( getQueuedByteCount() ); } @@ -317,6 +317,9 @@ public final class JavaSoundAudioSink implements AudioSink { @Override public final int getPTS() { return 0; } // FIXME + @Override + public final int updateQueue() { return 0; } // FIXME + @Override public int getLastBufferedPTS() { return 0; } // FIXME diff --git a/src/java/jogamp/common/av/NullAudioSink.java b/src/java/jogamp/common/av/NullAudioSink.java index 0626ca8..d38c040 100644 --- a/src/java/jogamp/common/av/NullAudioSink.java +++ b/src/java/jogamp/common/av/NullAudioSink.java @@ -174,7 +174,7 @@ public final class NullAudioSink implements AudioSink { public int getQueuedByteCount() { return 0; } @Override - public float getQueuedTime() { return 0f; } + public float getQueuedDuration() { return 0f; } @Override public float getAvgFrameDuration() { return 0f; } @@ -182,6 +182,9 @@ public final class NullAudioSink implements AudioSink { @Override public final int getPTS() { return playingPTS; } + @Override + public final int updateQueue() { return playingPTS; } + @Override public int getLastBufferedPTS() { return 0; } -- cgit v1.2.3