changeset 102:cf375df7c7b7

added sourcePort
author iivan@town.yyz.redhat.com
date Thu, 28 Aug 2008 16:16:38 -0400
parents f489a16be6f1
children e99d53a7bcfa
files src/java/org/classpath/icedtea/pulseaudio/PulseAudioSourcePort.java
diffstat 1 files changed, 92 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java/org/classpath/icedtea/pulseaudio/PulseAudioSourcePort.java	Thu Aug 28 16:16:38 2008 -0400
@@ -0,0 +1,92 @@
+package org.classpath.icedtea.pulseaudio;
+
+import javax.sound.sampled.Control;
+import javax.sound.sampled.LineListener;
+import javax.sound.sampled.LineUnavailableException;
+import javax.sound.sampled.Port;
+import javax.sound.sampled.Control.Type;
+
+public class PulseAudioSourcePort implements Port {
+	
+	private String name;
+	private long contextPointer;
+	private EventLoop eventLoop;
+	
+	public PulseAudioSourcePort(String name, EventLoop eventLoop) {
+		this.name = name;
+		this.contextPointer = eventLoop.getContextPointer();
+		this.eventLoop = eventLoop;
+		System.out.println("Opened Source Port" + name);
+	}
+
+	@Override
+	public void addLineListener(LineListener listener) {
+		// TODO Auto-generated method stub
+	}
+
+	@Override
+	public void close() {
+		Operation operation;
+
+		synchronized (eventLoop.threadLock) {
+			operation = new Operation(nativeClose());
+		}
+
+		operation.waitForCompletion();
+		operation.releaseReference();
+		
+	}
+	
+	private native int nativeClose();
+
+	@Override
+	public Control getControl(Type control) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public Control[] getControls() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public javax.sound.sampled.Line.Info getLineInfo() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public boolean isControlSupported(Type control) {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+	@Override
+	public boolean isOpen() {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+	@Override
+	public void open() throws LineUnavailableException {
+		Operation operation;
+
+		synchronized (eventLoop.threadLock) {
+			operation = new Operation(nativeOpen());
+		}
+
+		operation.waitForCompletion();
+		operation.releaseReference();
+	}
+	
+	private native int nativeOpen();
+
+	@Override
+	public void removeLineListener(LineListener listener) {
+		// TODO Auto-generated method stub
+		
+	}
+
+}