changeset in /hg/pulseaudio: 2008-09-23 Omair Majid <omajid at redh...
Omair Majid
omajid at redhat.com
Tue Sep 23 14:23:38 PDT 2008
changeset 09bfaae2203b in /hg/pulseaudio
details: http://icedtea.classpath.org/hg/pulseaudio?cmd=changeset;node=09bfaae2203b
description:
2008-09-23 Omair Majid <omajid at redhat.com>
* src/java/org/classpath/icedtea/pulseaudio/PulseAudioClip.java
(ClipThread.run): The while loop doesnt end now if loop is less
0. Makes it work with LOOP_CONTINUOUSLY (-1).
* unittests/org/classpath/icedtea/pulseaudio/PulseAudioClipTest.java
(testLoopContinuously): New function. Tests that loop(LOOP_CONTINUOUSLY)
works.
diffstat:
2 files changed, 45 insertions(+), 1 deletion(-)
src/java/org/classpath/icedtea/pulseaudio/PulseAudioClip.java | 2
unittests/org/classpath/icedtea/pulseaudio/PulseAudioClipTest.java | 44 ++++++++++
diffs (66 lines):
diff -r c46f6e0e7959 -r 09bfaae2203b src/java/org/classpath/icedtea/pulseaudio/PulseAudioClip.java
--- a/src/java/org/classpath/icedtea/pulseaudio/PulseAudioClip.java Tue Sep 23 15:02:55 2008 -0400
+++ b/src/java/org/classpath/icedtea/pulseaudio/PulseAudioClip.java Tue Sep 23 17:07:56 2008 -0400
@@ -81,7 +81,7 @@ public class PulseAudioClip extends Puls
@Override
public void run() {
- while (loopsLeft >= 0) {
+ while (true) {
writeFrames(currentFrame, endFrame + 1);
if (Thread.interrupted()) {
// Thread.currentThread().interrupt();
diff -r c46f6e0e7959 -r 09bfaae2203b unittests/org/classpath/icedtea/pulseaudio/PulseAudioClipTest.java
--- a/unittests/org/classpath/icedtea/pulseaudio/PulseAudioClipTest.java Tue Sep 23 15:02:55 2008 -0400
+++ b/unittests/org/classpath/icedtea/pulseaudio/PulseAudioClipTest.java Tue Sep 23 17:07:56 2008 -0400
@@ -138,6 +138,50 @@ public class PulseAudioClipTest {
clip.close();
}
+
+
+ @Test
+ public void testLoopContinuously() throws LineUnavailableException,
+ IOException, UnsupportedAudioFileException, InterruptedException {
+ System.out
+ .println("This tests loop(LOOP_CONTINUOUSLY) on the Clip");
+ final Clip clip = (Clip) mixer.getLine(new Line.Info(Clip.class));
+ File soundFile = new File("testsounds/error.wav");
+ AudioInputStream audioInputStream = AudioSystem
+ .getAudioInputStream(soundFile);
+ clip.open(audioInputStream);
+
+ clip.setLoopPoints((int) (clip.getFrameLength() / 4), (int) (clip
+ .getFrameLength() / 2));
+ clip.loop(Clip.LOOP_CONTINUOUSLY);
+
+ Runnable blocker = new Runnable() {
+
+ @Override
+ public void run() {
+ clip.drain();
+ }
+
+ };
+
+ Thread th = new Thread(blocker);
+ th.start();
+ th.join(10000);
+
+ if (!th.isAlive()) {
+ clip.close();
+ Assert.fail("LOOP_CONTINUOUSLY doesnt seem to work");
+ }
+
+ clip.stop();
+ th.join(500);
+ if ( th.isAlive()) {
+ clip.close();
+ Assert.fail("stopping LOOP_CONTINUOSLY failed");
+ }
+
+ clip.close();
+ }
@Test
public void testIsActiveAndIsOpen() throws LineUnavailableException,
More information about the distro-pkg-dev
mailing list