changeset 117:850570c7af31

2009-09-11 Omair Majid <omajid@redhat.com> * src/java/org/classpath/icedtea/pulseaudio/PulseAudioTargetDataLine.java Removed streamPointer - it is declared in parent class. (start): New function. Manually fires START event for a TargetDataLine. (stop): New function. Manually fires STOP event for TargetDataLine.
author Omair Majid <omajid@redhat.com>
date Thu, 11 Sep 2008 15:06:49 -0400
parents 29f7e9dc42dd
children 3f2e4077fcbb
files src/java/org/classpath/icedtea/pulseaudio/PulseAudioTargetDataLine.java
diffstat 1 files changed, 24 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/java/org/classpath/icedtea/pulseaudio/PulseAudioTargetDataLine.java	Thu Sep 11 14:40:42 2008 -0400
+++ b/src/java/org/classpath/icedtea/pulseaudio/PulseAudioTargetDataLine.java	Thu Sep 11 15:06:49 2008 -0400
@@ -38,6 +38,8 @@
 package org.classpath.icedtea.pulseaudio;
 
 import javax.sound.sampled.AudioFormat;
+import javax.sound.sampled.AudioSystem;
+import javax.sound.sampled.LineEvent;
 import javax.sound.sampled.LineUnavailableException;
 import javax.sound.sampled.TargetDataLine;
 
@@ -46,9 +48,6 @@
 
 	private long currentFramePosition = 0;
 
-	@SuppressWarnings("unused")
-	private byte[] streamPointer;
-
 	public PulseAudioTargetDataLine(EventLoop eventLoop, AudioFormat[] formats,
 			AudioFormat defaultFormat) {
 		supportedFormats = formats;
@@ -168,4 +167,26 @@
 		return (long) (currentFramePosition / currentFormat.getFrameRate());
 	}
 
+	/*
+	 * A TargetData starts when we ask it to and continues playing until we ask
+	 * it to stop. there are no buffer underruns/overflows or anything so we
+	 * will just fire the LineEvents manually
+	 */
+
+	@Override
+	public void start() {
+		super.start();
+
+		fireLineEvent(new LineEvent(this, LineEvent.Type.START,
+				AudioSystem.NOT_SPECIFIED));
+	}
+
+	@Override
+	public void stop() {
+		super.stop();
+
+		fireLineEvent(new LineEvent(this, LineEvent.Type.STOP,
+				AudioSystem.NOT_SPECIFIED));
+	}
+
 }
\ No newline at end of file