net.sf.jack4j
Class JackLocalPort

java.lang.Object
  extended by net.sf.jack4j.JackPort
      extended by net.sf.jack4j.JackLocalPort
Direct Known Subclasses:
JackLocalMidiPort

public class JackLocalPort
extends JackPort

Port registered by JackClient.

Author:
repa

Method Summary
 int connected()
          Returns number of connections to or from port.
 boolean connectedTo(java.lang.String portName)
          Returns true if the port is directly connected to port with specified name.
 long getBufferPointer(int bufferSize)
          Returns pointer to the memory area associated with the specified port.
 java.nio.ByteBuffer getByteBuffer(int bufferSize)
          Returns ByteBuffer that contains the memory area associated with the specified port.
 JackClient getClient()
          Returns the client that owns this port.
 java.lang.String[] getConnections()
          Returns full port names of to which this port is connected.
 java.lang.String[] getPortAliases()
          Returns all aliases set for this port.
 void setPortAlias(java.lang.String alias)
          Sets port alias.
 void setPortName(java.lang.String portName)
          Sets short name of this port.
 void tie(JackLocalPort sourcePort)
          Ties this (output) port to given input port.
 void unsetPortAlias(java.lang.String alias)
          Removes port alias.
 void untie()
          Undoes the effect of tie(JackLocalPort).
 
Methods inherited from class net.sf.jack4j.JackPort
ensureMonitor, getLatency, getPortFlags, getPortFlagSet, getPortHandle, getPortName, getPortShortName, getPortType, isInput, isMonitorable, isOutput, isPhysical, isTerminal, monitoringInput, requestMonitor, setLatency
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getClient

public JackClient getClient()
Returns the client that owns this port.


setPortName

public void setPortName(java.lang.String portName)
                 throws JackException
Sets short name of this port.

Throws:
JackException

setPortAlias

public void setPortAlias(java.lang.String alias)
                  throws JackException
Sets port alias.

The port can have at most 2 aliases.

Throws:
JackException

unsetPortAlias

public void unsetPortAlias(java.lang.String alias)
                    throws JackException
Removes port alias.

Throws:
JackException

getPortAliases

public java.lang.String[] getPortAliases()
                                  throws JackException
Returns all aliases set for this port.

Throws:
JackException

connected

public int connected()
              throws JackException
Returns number of connections to or from port.

Throws:
JackException

connectedTo

public boolean connectedTo(java.lang.String portName)
                    throws JackException
Returns true if the port is directly connected to port with specified name.

Throws:
JackException

getConnections

public java.lang.String[] getConnections()
                                  throws JackException
Returns full port names of to which this port is connected.

If the port is not connected, returns null.

Throws:
JackException

getBufferPointer

public long getBufferPointer(int bufferSize)
                      throws JackException
Returns pointer to the memory area associated with the specified port.

The pointer is not very useful in Java, but can be used for some JNI calls.

This method can only be called during JackClient.process(int) callback, and only by the thread that invoked the callback. The returned value is valid only during that callback.

Parameters:
bufferSize - the value passed in bufferSize parameter to JackClient.process(int)
Returns:
native pointer, converted to long @
Throws:
JackException

getByteBuffer

public java.nio.ByteBuffer getByteBuffer(int bufferSize)
                                  throws JackException
Returns ByteBuffer that contains the memory area associated with the specified port.

This method can only be called during JackClient.process(int) callback, and only by the thread that invoked the callback. The returned value is valid only during that callback.

The caller is responsible for calling Buffer.clear() on the returned value before the buffer is used. Otherwise, the buffer position, limit, and mark may be set to random value. The buffer capacity is always set to the buffer size multiplied by Float.SIZE / 8.

Parameters:
bufferSize - the value passed in bufferSize parameter to JackClient.process(int)
Returns:
port buffer, wrapped into ByteBuffer object
Throws:
JackException

tie

public void tie(JackLocalPort sourcePort)
         throws JackException
Ties this (output) port to given input port.

The sourcePort must be owned by the same client as this port, and it must be an input port.

This port must be an output port.

Throws:
JackException

untie

public void untie()
           throws JackException
Undoes the effect of tie(JackLocalPort).

Throws:
JackException


Copyright © 2008 Ondrej Par. All Rights Reserved.