Mercurial > hg > icedtea12
changeset 2621:ae07c41dc3c2
PR902: PulseAudioClip getMicrosecondsLength() returns length in milliseconds, not microseconds
Define a (correct) constant for converting from seconds to microsecond and use
it everywhere.
2012-06-28 Omair Majid <omajid@redhat.com>
* pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioClip.java
(getMicrosecondLength, getMicrosecondPosition)
(setMicrosecondPosition): Use correct factor to convert seconds to
microseconds.
* pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioSourceDataLine.java
(getMicrosecondPosition): Likewise.
* pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioPlaybackLine.java:
Define SECONDS_TO_MICROSECONDS.
author | Omair Majid <omajid@redhat.com> |
---|---|
date | Thu, 28 Jun 2012 20:14:46 -0400 |
parents | 1364a03b0f2b |
children | cc35d8ed9124 |
files | ChangeLog pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioClip.java pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioPlaybackLine.java pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioSourceDataLine.java |
diffstat | 4 files changed, 17 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Wed Mar 02 05:23:53 2016 +0000 +++ b/ChangeLog Thu Jun 28 20:14:46 2012 -0400 @@ -1,3 +1,14 @@ +2012-06-28 Omair Majid <omajid@redhat.com> + + * pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioClip.java + (getMicrosecondLength, getMicrosecondPosition) + (setMicrosecondPosition): Use correct factor to convert seconds to + microseconds. + * pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioSourceDataLine.java + (getMicrosecondPosition): Likewise. + * pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioPlaybackLine.java: + Define SECONDS_TO_MICROSECONDS. + 2011-06-16 Denis Lila <dlila@redhat.com> * Makefile.am: Add ContextEvent to the list of pulse audio classes that
--- a/pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioClip.java Wed Mar 02 05:23:53 2016 +0000 +++ b/pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioClip.java Thu Jun 28 20:14:46 2012 -0400 @@ -343,7 +343,7 @@ return AudioSystem.NOT_SPECIFIED; } synchronized (clipLock) { - return (long) (frameCount / currentFormat.getFrameRate() * 1000); + return (long) (frameCount / currentFormat.getFrameRate() * SECONDS_TO_MICROSECONDS); } } @@ -354,7 +354,7 @@ } synchronized (clipLock) { - return (long) (framesSinceOpen / currentFormat.getFrameRate() * 1000); + return (long) (framesSinceOpen / currentFormat.getFrameRate() * SECONDS_TO_MICROSECONDS); } } @@ -503,7 +503,7 @@ throw new IllegalStateException("Line not open"); } - float frameIndex = microseconds * currentFormat.getFrameRate() / 1000; + float frameIndex = microseconds * currentFormat.getFrameRate() / SECONDS_TO_MICROSECONDS; /* make frameIndex positive */ while (frameIndex < 0) {
--- a/pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioPlaybackLine.java Wed Mar 02 05:23:53 2016 +0000 +++ b/pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioPlaybackLine.java Thu Jun 28 20:14:46 2012 -0400 @@ -42,6 +42,8 @@ */ interface PulseAudioPlaybackLine { + static final int SECONDS_TO_MICROSECONDS = 1000000; + /** * Set the volume of the Line (ie, sink input, source, or sink) *
--- a/pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioSourceDataLine.java Wed Mar 02 05:23:53 2016 +0000 +++ b/pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioSourceDataLine.java Thu Jun 28 20:14:46 2012 -0400 @@ -254,7 +254,7 @@ float frameRate = currentFormat.getFrameRate(); float time = framesSinceOpen / frameRate; // seconds - long microseconds = (long) (time * 1000); + long microseconds = (long) (time * SECONDS_TO_MICROSECONDS); return microseconds; }