Mercurial > hg > pulseaudio
changeset 139:438aa072a80d
2008-09-23 Omair Majid <omajid@redhat.com>
* src/java/org/classpath/icedtea/pulseaudio/PulseAudioClip.java
Merged changes.
author | Omair Majid <omajid@redhat.com> |
---|---|
date | Tue, 23 Sep 2008 17:23:27 -0400 |
parents | 2d384ad19c3e (current diff) 6409aaedc201 (diff) |
children | e29a9eb84a4e |
files | src/java/org/classpath/icedtea/pulseaudio/PulseAudioClip.java |
diffstat | 4 files changed, 50 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/README Tue Sep 23 17:01:26 2008 -0400 +++ b/README Tue Sep 23 17:23:27 2008 -0400 @@ -19,6 +19,10 @@ Where does it come from? All of the code was written by the authors -The sound files (new.wav and logout.wav) were taken from +The sound files new.wav and logout.wav were taken from http://websvn.kde.org/branches/KDE/4.0/kdeartwork/sounds/ (and renamed). They are licensed by the copyright holders as GPLv2. + +The sound file error.wav is part of gnome-audio +http://ftp.gnome.org/pub/gnome/sources/gnome-audio/2.22/gnome-audio-2.22.2.tar.bz2 +It is licensed under the LGPL by the copyright holders.
--- a/src/java/org/classpath/icedtea/pulseaudio/PulseAudioClip.java Tue Sep 23 17:01:26 2008 -0400 +++ b/src/java/org/classpath/icedtea/pulseaudio/PulseAudioClip.java Tue Sep 23 17:23:27 2008 -0400 @@ -81,7 +81,7 @@ @Override public void run() { - while (loopsLeft >= 0) { + while (true) { writeFrames(currentFrame, endFrame + 1); if (Thread.interrupted()) { // Thread.currentThread().interrupt();
--- a/unittests/org/classpath/icedtea/pulseaudio/PulseAudioClipTest.java Tue Sep 23 17:01:26 2008 -0400 +++ b/unittests/org/classpath/icedtea/pulseaudio/PulseAudioClipTest.java Tue Sep 23 17:23:27 2008 -0400 @@ -138,6 +138,50 @@ 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,