changeset 176:5108fc37a890

2008-10-08 Omair Majid <omajid@redhat.com> * src/java/org/classpath/icedtea/pulseaudio/EventLoop.java Removed unused import to get rid of compiler warning. * src/java/org/classpath/icedtea/pulseaudio/Operation.java Likewise. * src/java/org/classpath/icedtea/pulseaudio/PulseAudioClip.java (ClipThread.run): Do a sanity check before abusing the value of LOOP_CONTINUOUSLY. (loop): Check the value of the argument. * src/java/org/classpath/icedtea/pulseaudio/PulseAudioSourceDataLine.java Removed unused import to get rid of compiler warning. (write): Removed a FIXME, as it is now implemented. * src/java/org/classpath/icedtea/pulseaudio/PulseAudioSourcePort.java Removed unused import to get rid of compiler warning. * src/java/org/classpath/icedtea/pulseaudio/PulseAudioTargetPort.java Likewise. * src/java/org/classpath/icedtea/pulseaudio/Stream.java Likewise.
author Omair Majid <omajid@redhat.com>
date Wed, 08 Oct 2008 16:06:00 -0400
parents 66bcf656c0fb
children ea894778a6d0
files src/java/org/classpath/icedtea/pulseaudio/EventLoop.java src/java/org/classpath/icedtea/pulseaudio/Operation.java src/java/org/classpath/icedtea/pulseaudio/PulseAudioClip.java src/java/org/classpath/icedtea/pulseaudio/PulseAudioSourceDataLine.java src/java/org/classpath/icedtea/pulseaudio/PulseAudioSourcePort.java src/java/org/classpath/icedtea/pulseaudio/PulseAudioTargetPort.java src/java/org/classpath/icedtea/pulseaudio/Stream.java
diffstat 7 files changed, 17 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/src/java/org/classpath/icedtea/pulseaudio/EventLoop.java	Wed Oct 08 15:27:58 2008 -0400
+++ b/src/java/org/classpath/icedtea/pulseaudio/EventLoop.java	Wed Oct 08 16:06:00 2008 -0400
@@ -37,7 +37,6 @@
 
 package org.classpath.icedtea.pulseaudio;
 
-import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.concurrent.Semaphore;
--- a/src/java/org/classpath/icedtea/pulseaudio/Operation.java	Wed Oct 08 15:27:58 2008 -0400
+++ b/src/java/org/classpath/icedtea/pulseaudio/Operation.java	Wed Oct 08 16:06:00 2008 -0400
@@ -37,7 +37,6 @@
 
 package org.classpath.icedtea.pulseaudio;
 
-import java.io.IOException;
 
 /*
  * Encapsulates a pa_operation object
--- a/src/java/org/classpath/icedtea/pulseaudio/PulseAudioClip.java	Wed Oct 08 15:27:58 2008 -0400
+++ b/src/java/org/classpath/icedtea/pulseaudio/PulseAudioClip.java	Wed Oct 08 16:06:00 2008 -0400
@@ -78,6 +78,17 @@
 		@Override
 		public void run() {
 
+			/*
+			 * The while loop below only works with LOOP_CONTINUOUSLY because we
+			 * abuse the fact that loopsLeft's initial value is -1
+			 * (=LOOP_CONTINUOUSLY) and it keeps on going lower without hitting
+			 * 0. So do a sanity check
+			 */
+			if (Clip.LOOP_CONTINUOUSLY != -1) {
+				throw new UnsupportedOperationException(
+						"LOOP_CONTINUOUSLY has changed; things are going to break");
+			}
+
 			while (true) {
 				writeFrames(currentFrame, endFrame + 1);
 				if (Thread.interrupted()) {
@@ -345,8 +356,10 @@
 			throw new IllegalStateException("Line not open");
 		}
 
-		System.out.println("Loop " + count + " called");
-
+		if ( count < 0 && count != LOOP_CONTINUOUSLY) {
+			throw new IllegalArgumentException("invalid value for count:" + count);
+		}
+		
 		if (clipThread.isAlive() && count != 0) {
 			// Do nothing; behavior not specified by the Java API
 			return;
--- a/src/java/org/classpath/icedtea/pulseaudio/PulseAudioSourceDataLine.java	Wed Oct 08 15:27:58 2008 -0400
+++ b/src/java/org/classpath/icedtea/pulseaudio/PulseAudioSourceDataLine.java	Wed Oct 08 16:06:00 2008 -0400
@@ -44,8 +44,6 @@
 import javax.sound.sampled.LineUnavailableException;
 import javax.sound.sampled.SourceDataLine;
 
-import org.classpath.icedtea.pulseaudio.Operation.State;
-
 public class PulseAudioSourceDataLine extends PulseAudioDataLine implements
 		SourceDataLine, PulseAudioPlaybackLine {
 
@@ -136,7 +134,7 @@
 		synchronized (this) {
 			writeInterrupted = false;
 		}
-		
+
 		if (!isOpen) {
 			throw new IllegalStateException("must call open() before write()");
 		}
@@ -216,10 +214,6 @@
 
 		// all the data should have been played by now
 		assert (sizeWritten == length);
-		/*
-		 * FIXME when the stream is flushed() etc, instead of returning length
-		 * this should unblock and return the the size of data written so far
-		 */
 
 		if (interrupted) {
 			Thread.currentThread().interrupt();
@@ -317,7 +311,7 @@
 		if (!isOpen) {
 			throw new IllegalStateException("not open so cant close");
 		}
-		
+
 		writeInterrupted = true;
 
 		PulseAudioMixer parent = PulseAudioMixer.getInstance();
--- a/src/java/org/classpath/icedtea/pulseaudio/PulseAudioSourcePort.java	Wed Oct 08 15:27:58 2008 -0400
+++ b/src/java/org/classpath/icedtea/pulseaudio/PulseAudioSourcePort.java	Wed Oct 08 16:06:00 2008 -0400
@@ -37,8 +37,6 @@
 
 package org.classpath.icedtea.pulseaudio;
 
-import java.io.IOException;
-
 import javax.sound.sampled.Port;
 
 public class PulseAudioSourcePort extends PulseAudioPort {
--- a/src/java/org/classpath/icedtea/pulseaudio/PulseAudioTargetPort.java	Wed Oct 08 15:27:58 2008 -0400
+++ b/src/java/org/classpath/icedtea/pulseaudio/PulseAudioTargetPort.java	Wed Oct 08 16:06:00 2008 -0400
@@ -37,8 +37,6 @@
 
 package org.classpath.icedtea.pulseaudio;
 
-import java.io.IOException;
-
 import javax.sound.sampled.Port;
 
 public class PulseAudioTargetPort extends PulseAudioPort {
--- a/src/java/org/classpath/icedtea/pulseaudio/Stream.java	Wed Oct 08 15:27:58 2008 -0400
+++ b/src/java/org/classpath/icedtea/pulseaudio/Stream.java	Wed Oct 08 16:06:00 2008 -0400
@@ -37,7 +37,6 @@
 
 package org.classpath.icedtea.pulseaudio;
 
-import java.io.IOException;
 import java.util.LinkedList;
 import java.util.List;