/hg/icedtea7: R902: PulseAudioClip getMicrosecondsLength() retur...

omajid at icedtea.classpath.org omajid at icedtea.classpath.org
Thu Jun 28 16:55:50 PDT 2012


changeset 748c609a6a14 in /hg/icedtea7
details: http://icedtea.classpath.org/hg/icedtea7?cmd=changeset;node=748c609a6a14
author: Omair Majid <omajid at redhat.com>
date: Thu Jun 28 19:54:43 2012 -0400

	R902: 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 at 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.


diffstat:

 ChangeLog                                                                          |  11 ++++++++++
 NEWS                                                                               |   1 +
 pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioClip.java           |   6 ++--
 pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioPlaybackLine.java   |   2 +
 pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioSourceDataLine.java |   2 +-
 5 files changed, 18 insertions(+), 4 deletions(-)

diffs (83 lines):

diff -r dfdf72956eee -r 748c609a6a14 ChangeLog
--- a/ChangeLog	Thu Jun 28 19:45:23 2012 -0400
+++ b/ChangeLog	Thu Jun 28 19:54:43 2012 -0400
@@ -1,3 +1,14 @@
+2012-06-28  Omair Majid  <omajid at 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.
+
 2012-06-28  Omair Majid  <omajid at redhat.com>
 
 	* pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioSourceDataLine.java
diff -r dfdf72956eee -r 748c609a6a14 NEWS
--- a/NEWS	Thu Jun 28 19:45:23 2012 -0400
+++ b/NEWS	Thu Jun 28 19:54:43 2012 -0400
@@ -13,6 +13,7 @@
 New in release 2.3 (2012-XX-XX):
 
 * Bug fixes
+  - PR902: PulseAudioClip getMicrosecondsLength() returns length in milliseconds, not microseconds
   - PR986: IcedTea7 fails to build with IcedTea6 CACAO due to low max heap size
   - PR1050: Stream objects not garbage collected
 
diff -r dfdf72956eee -r 748c609a6a14 pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioClip.java
--- a/pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioClip.java	Thu Jun 28 19:45:23 2012 -0400
+++ b/pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioClip.java	Thu Jun 28 19:54:43 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) {
diff -r dfdf72956eee -r 748c609a6a14 pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioPlaybackLine.java
--- a/pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioPlaybackLine.java	Thu Jun 28 19:45:23 2012 -0400
+++ b/pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioPlaybackLine.java	Thu Jun 28 19:54:43 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)
      * 
diff -r dfdf72956eee -r 748c609a6a14 pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioSourceDataLine.java
--- a/pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioSourceDataLine.java	Thu Jun 28 19:45:23 2012 -0400
+++ b/pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioSourceDataLine.java	Thu Jun 28 19:54:43 2012 -0400
@@ -259,7 +259,7 @@
 
         float frameRate = currentFormat.getFrameRate();
         float time = framesSinceOpen / frameRate; // seconds
-        long microseconds = (long) (time * 1000);
+        long microseconds = (long) (time * SECONDS_TO_MICROSECONDS);
         return microseconds;
     }
 



More information about the distro-pkg-dev mailing list