changeset 111:6fa7b2b70780

2008-09-08 Omair Majid <omajid@redhat.com> * src/java/org/classpath/icedtea/pulseaudio/PulseAudioClip.java (writeFrames): Removed outdated comments * src/java/org/classpath/icedtea/pulseaudio/PulseAudioMixer.java (close): Removed comment. Throws an IllegalStateException when called on a closed Mixer. * src/java/org/classpath/icedtea/pulseaudio/PulseAudioTargetDataLine.java (flush): Changed the comment from a TODO to a FIXME * src/java/org/classpath/icedtea/pulseaudio/StreamBufferAttributes.java Changed MAX_VALUE to a saner value. * unittests/org/classpath/icedtea/pulseaudio/PulseAudioMixerTest.java (testClosingAgain): Now expects the exception to be thrown. * unittests/org/classpath/icedtea/pulseaudio/PulseSourceDataLineTest.java (tearDown): Fixed method to only close the mixer if it isnt alreay closed.
author Omair Majid <omajid@redhat.com>
date Mon, 08 Sep 2008 14:15:34 -0400
parents 239695497634
children 95fa206a3e1d
files src/java/org/classpath/icedtea/pulseaudio/PulseAudioClip.java src/java/org/classpath/icedtea/pulseaudio/PulseAudioMixer.java src/java/org/classpath/icedtea/pulseaudio/PulseAudioTargetDataLine.java src/java/org/classpath/icedtea/pulseaudio/StreamBufferAttributes.java unittests/org/classpath/icedtea/pulseaudio/PulseAudioMixerTest.java unittests/org/classpath/icedtea/pulseaudio/PulseSourceDataLineTest.java
diffstat 6 files changed, 10 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/src/java/org/classpath/icedtea/pulseaudio/PulseAudioClip.java	Mon Sep 08 11:09:02 2008 -0400
+++ b/src/java/org/classpath/icedtea/pulseaudio/PulseAudioClip.java	Mon Sep 08 14:15:34 2008 -0400
@@ -134,8 +134,7 @@
 						try {
 							eventLoop.threadLock.wait();
 						} catch (InterruptedException e) {
-							// FIXME what to do when this happens?
-							// e.printStackTrace();
+							// clean up and return
 							Thread.currentThread().interrupt();
 							stream.removeWriteListener(writeListener);
 							return;
--- a/src/java/org/classpath/icedtea/pulseaudio/PulseAudioMixer.java	Mon Sep 08 11:09:02 2008 -0400
+++ b/src/java/org/classpath/icedtea/pulseaudio/PulseAudioMixer.java	Mon Sep 08 14:15:34 2008 -0400
@@ -430,7 +430,7 @@
 	synchronized public void close() {
 
 		if (!this.isOpen) {
-			return; // TODO do we throw an exception too?
+			throw new IllegalStateException("Mixer is not open; cant close");
 		}
 
 		eventLoopThread.interrupt();
--- a/src/java/org/classpath/icedtea/pulseaudio/PulseAudioTargetDataLine.java	Mon Sep 08 11:09:02 2008 -0400
+++ b/src/java/org/classpath/icedtea/pulseaudio/PulseAudioTargetDataLine.java	Mon Sep 08 14:15:34 2008 -0400
@@ -147,7 +147,7 @@
 
 	@Override
 	public void flush() {
-		// TODO Auto-generated method stub
+		// FIXME how to flush a target data line
 	}
 
 	public int available() {
--- a/src/java/org/classpath/icedtea/pulseaudio/StreamBufferAttributes.java	Mon Sep 08 11:09:02 2008 -0400
+++ b/src/java/org/classpath/icedtea/pulseaudio/StreamBufferAttributes.java	Mon Sep 08 14:15:34 2008 -0400
@@ -41,9 +41,9 @@
 
 	public static final int SANE_DEFAULT = 50000;
 
-	// FIXME need to set these to proper values
+	// set these to proper values
 	// integer.max_value will crash the program!
-	public static final int MAX_VALUE = Integer.MAX_VALUE;
+	public static final int MAX_VALUE = 1000000;
 	public static final int MIN_VALUE = 0;
 
 	private int maxLength;
--- a/unittests/org/classpath/icedtea/pulseaudio/PulseAudioMixerTest.java	Mon Sep 08 11:09:02 2008 -0400
+++ b/unittests/org/classpath/icedtea/pulseaudio/PulseAudioMixerTest.java	Mon Sep 08 14:15:34 2008 -0400
@@ -250,9 +250,9 @@
 		selectedMixer.open();
 	}
 
-	@Test
+	@Test(expected = IllegalStateException.class)
 	public void testClosingAgain() throws LineUnavailableException,
-			UnsupportedOperationException {
+			IllegalStateException {
 		selectedMixer.close();
 		selectedMixer.close();
 	}
--- a/unittests/org/classpath/icedtea/pulseaudio/PulseSourceDataLineTest.java	Mon Sep 08 11:09:02 2008 -0400
+++ b/unittests/org/classpath/icedtea/pulseaudio/PulseSourceDataLineTest.java	Mon Sep 08 14:15:34 2008 -0400
@@ -576,8 +576,9 @@
 
 	@After
 	public void tearDown() throws Exception {
-
-		mixer.close();
+		if (mixer.isOpen()) {
+			mixer.close();
+		}
 	}
 
 }