net.sf.jack4j
Class JackClient

java.lang.Object
  extended by net.sf.jack4j.JackClient
Direct Known Subclasses:
AbstractJackClient, JackTransportClient

public abstract class JackClient
extends java.lang.Object

Client of Jack daemon.

The Java callback methods defined in this class (such as process(int), xRunCallback() etc.) will only work if both default native JackThreadInit callback and the default native callback for the event are set. For example, the process(int) method is called only if you call setDefaultThreadInitCallback() and setDefaultProcessCallback() before activating the client.

See setAllDefaultCallbacks() if you want to set all native callbacks at once.

Most methods correspond to functions defined in Jack library, except for localPort(String) and friends, that work with the internal Java structure.

Author:
repa

Constructor Summary
JackClient(java.lang.String clientName, boolean useExactName, boolean canStartServer, java.lang.String serverName)
          Creates new, inactive Jack client.
 
Method Summary
 void activate()
          Activates the client.
 JackLocalPort addAudioPort(java.lang.String portName, java.util.Collection<JackPortFlag> flags)
          Registers new port of standard audio type.
 JackLocalMidiPort addMidiPort(java.lang.String portName, java.util.Collection<JackPortFlag> flags)
          Registers new port of standard MIDI type.
 JackLocalPort addPort(java.lang.String portName, java.util.Collection<JackPortFlag> flags, java.lang.String portType, int bufferSize)
          Registers new port.
abstract  int bufferSizeCallback(int newBufferSize)
          Called when Jack buffer size changes.
abstract  void clientRegistrationCallback(java.lang.String clientName, boolean registered)
          Called when another Jack client is registered/unregistered.
 void close()
          Closes the client.
 boolean connect(java.lang.String sourcePortName, java.lang.String destinationPortName)
          Establish a connection between two ports.
 float cpuLoad()
          Returns current CPU load.
 void deactivate()
          Deactivates the client.
 void disconnect(java.lang.String sourcePortName, java.lang.String destinationPortName)
          Remove a connection between two ports.
protected  void finalize()
           
 int framesSinceCycleStart()
          Returns time in frames since Jack server began the current process cycle.
 long framesToTime(int frameTime)
          Converts time in microseconds to frame time.
 int frameTime()
          Returns current frame time (running counter).
abstract  void freewheelCallback(boolean onoff)
          Called when Jack enters or leaves "freewheel" mode.
 java.lang.String[] getAllPortConnections(JackPort port)
          Returns full port names of to which the specified port is connected.
 int getBufferSize()
          Returns buffer size.
 long getCallbackStruct()
          Returns the pointer to C structure that can be used by native Jack callbacks.
 long getClientHandle()
          Returns the pointer to C jack_client_t structure, represented as long.
 java.lang.String getClientName()
          Returns real client name (which may be different than the one specified in constructor).
 JackClientThread getClientThread()
          Returns the object that allows operations on client thread.
 java.lang.String[] getPorts(java.lang.String portNamePattern, java.lang.String typeNamePattern, java.util.EnumSet<JackPortFlag> flagSet)
          Returns names of ports that fulfill given criteria.
 java.lang.String[] getPorts(java.lang.String portNamePattern, java.lang.String typeNamePattern, long flags)
          Returns names of ports that fulfill given criteria.
 int getSampleRate()
          Returns current sample rate.
 Statistics getStatistics()
          Returns the Statistics object associated with this client.
 int getTotalPortLatency(JackPort port)
          Returns port total latency.
abstract  int graphOrderCallback()
          Called whenever the processing graph is reordered.
 JackInternalClient internalClientByName(java.lang.String clientName)
          Returns an object that represents internal client with specified name.
 boolean isActive()
          Returns true if the client was activated
 boolean isMine(JackPort port)
          Returns true if the specified port is owned by this client.
 boolean isOpen()
          Returns true if the client is still open.
 boolean isProcessMethodSynchronized()
          Returns a value indicating whether the native process callback will obtain a lock on JackClient structure before calling process(int) method.
 boolean isRealtime()
          Returns true if the server runs in real-time mode.
 boolean isShutdown()
          Returns true if the Jack client thread was shut down.
 int lastFrameTime()
          Returns frame time after the last processing of the graph.
 JackInternalClient loadInternalClient(java.lang.String clientName, boolean useExactName, java.lang.String sharedObjectName, java.lang.String initValue)
          Loads internal client.
 JackLocalPort localPort(java.lang.String name)
          Returns port registered under given (short) name, or null if such port doesn't exist.
 java.util.Set<java.lang.String> localPortNames()
          Returns unmodifiable set of (short) names of ports registered by this client.
 JackPort portById(long id)
          Returns (local or foreign) port with given ID, or null if it doesn't exist.
 JackPort portByName(java.lang.String name)
          Returns (local or foreign) port with given name, or null if it doesn't exist.
abstract  void portConnectCallback(long portAId, long portBId, boolean connected)
          CURRENTLY NOT WORKING.
abstract  void portRegistrationCallback(long portId, boolean registered)
          Called when Jack port is registered/unregistered.
abstract  int process(int bufferSize)
          Called during each process cycle.
 void recomputeTotalLatencies()
          Recomputes port latencies.
 void recomputeTotalPortLatency(JackPort port)
          Recomputes port latency.
 void removePort(java.lang.String portName)
          Unregisters given port.
 void requestPortMonitorByName(java.lang.String portName, boolean on)
          If the port can be monitored, sets monitoring on or off.
abstract  int sampleRateCallback(int newSampleRate)
          Called when Jack sample rate changes.
 void setAllDefaultCallbacks()
          Sets all available default native callbacks.
 void setBufferSize(int bufferSize)
          Sets buffer size used by Jack server.
 void setBufferSizeCallback(long pointer, long arg)
          Sets custom JackBufferSizeCallback for this client.
 void setClientRegistrationCallback(long pointer, long arg)
          Sets custom JackClientRegistrationCallback for this client.
 void setDefaultBufferSizeCallback()
          Sets the default native JackBufferSizeCallback for this client.
 void setDefaultClientRegistrationCallback()
          Sets the default native JackClientRegistrationCallback for this client.
 void setDefaultFreewheelCallback()
          Sets the default native JackFreewheelCallback for this client.
 void setDefaultGraphOrderCallback()
          Sets the default native JackGraphOrderCallback for this client.
 void setDefaultPortConnectCallback()
          Sets the default native JackPortConnectCallback for this client.
 void setDefaultPortRegistrationCallback()
          Sets the default native JackPortRegistrationCallback for this client.
 void setDefaultProcessCallback()
          Sets the default native JackProcessCallback for this client.
 void setDefaultSampleRateCallback()
          Sets the default native JackSampleRateCallback for this client.
 void setDefaultShutdownCallback()
          Sets the default "on shutdown" callback for this client.
 void setDefaultThreadInitCallback()
          Sets the default native JackThreadInitCallback for this client.
 void setDefaultXRunCallback()
          Sets the default native JackXRunCallback for this client.
 void setFreewheel(boolean onoff)
          Starts or stops Jack "freewheel" mode.
 void setFreewheelCallback(long pointer, long arg)
          Sets custom JackFreewheelCallback for this client.
 void setGraphOrderCallback(long pointer, long arg)
          Sets custom JackGraphOrderCallback for this client.
 void setPortConnectCallback(long pointer, long arg)
          Sets custom JackPortConnectCallback for this client.
 void setPortRegistrationCallback(long pointer, long arg)
          Sets custom JackPortRegistrationCallback for this client.
 void setProcessCallback(long pointer, long arg)
          Sets custom JackProcessCallback for this client.
 boolean setProcessMethodSynchronized(boolean synchronize)
          Sets a flag indicating whether the native process callback will obtain a lock on JackClient structure before calling process(int) method.
 void setSampleRateCallback(long pointer, long arg)
          Sets custom JackSampleRateCallback for this client.
 void setShutdownCallback(long pointer, long arg)
          Sets custom "on shutdown" callback for this client.
 void setThreadInitCallback(long pointer, long arg)
          Sets custom JackThreadInitCallback for this client.
 void setXRunCallback(long pointer, long arg)
          Sets custom JackXRunCallback for this client.
abstract  void threadInitCallback()
          Called once, when Jack server initializes client thread.
 int threadWait(int status)
          Calls jack_thread_wait.
 long time()
          Returns current time in microseconds.
 int timeToFrames(long microseconds)
          Converts time in microseconds to frame time.
abstract  int xRunCallback()
          Called when Jack XRUN occurs.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JackClient

public JackClient(java.lang.String clientName,
                  boolean useExactName,
                  boolean canStartServer,
                  java.lang.String serverName)
           throws JackException
Creates new, inactive Jack client.

Parameters:
clientName - desired client name
useExactName - if true, server won't modify the client name and exception is thrown if client with that name already exists
canStartServer - if true, the server will be started unless it's already running
serverName - if not null, connects to specified server; otherwise, connects to default server
Throws:
JackException - if communication with the server fails
Method Detail

finalize

protected void finalize()
                 throws java.lang.Throwable
Overrides:
finalize in class java.lang.Object
Throws:
java.lang.Throwable
See Also:
Object.finalize()

isProcessMethodSynchronized

public boolean isProcessMethodSynchronized()
Returns a value indicating whether the native process callback will obtain a lock on JackClient structure before calling process(int) method.


setProcessMethodSynchronized

public boolean setProcessMethodSynchronized(boolean synchronize)
Sets a flag indicating whether the native process callback will obtain a lock on JackClient structure before calling process(int) method.

If the flag is set, the process method behaves as a synchronized method.


getClientHandle

public long getClientHandle()
Returns the pointer to C jack_client_t structure, represented as long.


getCallbackStruct

public long getCallbackStruct()
Returns the pointer to C structure that can be used by native Jack callbacks.

The pointer is represented as long value.


setDefaultShutdownCallback

public void setDefaultShutdownCallback()
                                throws JackException
Sets the default "on shutdown" callback for this client.

Throws:
JackException

setShutdownCallback

public void setShutdownCallback(long pointer,
                                long arg)
                         throws JackException
Sets custom "on shutdown" callback for this client.

The pointer must be a native void(*)(void *arg) pointer, represented as long.

Parameters:
pointer - the pointer to native function
arg - the value passed as void* arg parameter to the callback
Throws:
JackException
See Also:
setDefaultShutdownCallback()

setDefaultProcessCallback

public void setDefaultProcessCallback()
                               throws JackException
Sets the default native JackProcessCallback for this client.

Throws:
JackException

setProcessCallback

public void setProcessCallback(long pointer,
                               long arg)
                        throws JackException
Sets custom JackProcessCallback for this client.

The pointer must be a native JackProcessCallback pointer, represented as long.

Parameters:
pointer - the pointer to native function
arg - the value passed as void* arg parameter to the callback
Throws:
JackException
See Also:
setDefaultProcessCallback()

setDefaultThreadInitCallback

public void setDefaultThreadInitCallback()
                                  throws JackException
Sets the default native JackThreadInitCallback for this client.

This callback must be set, otherwise the other callbacks will not work correctly!

Throws:
JackException

setThreadInitCallback

public void setThreadInitCallback(long pointer,
                                  long arg)
                           throws JackException
Sets custom JackThreadInitCallback for this client.

The pointer must be a native JackThreadInitCallback pointer, represented as long.

Parameters:
pointer - the pointer to native function
arg - the value passed as void* arg parameter to the callback
Throws:
JackException
See Also:
setDefaultThreadInitCallback()

setDefaultFreewheelCallback

public void setDefaultFreewheelCallback()
                                 throws JackException
Sets the default native JackFreewheelCallback for this client.

Throws:
JackException

setFreewheelCallback

public void setFreewheelCallback(long pointer,
                                 long arg)
                          throws JackException
Sets custom JackFreewheelCallback for this client.

The pointer must be a native JackFreewheelCallback pointer, represented as long.

Parameters:
pointer - the pointer to native function
arg - the value passed as void* arg parameter to the callback
Throws:
JackException
See Also:
setDefaultFreewheelCallback()

setDefaultBufferSizeCallback

public void setDefaultBufferSizeCallback()
                                  throws JackException
Sets the default native JackBufferSizeCallback for this client.

Throws:
JackException

setBufferSizeCallback

public void setBufferSizeCallback(long pointer,
                                  long arg)
                           throws JackException
Sets custom JackBufferSizeCallback for this client.

The pointer must be a native JackBufferSizeCallback pointer, represented as long.

Parameters:
pointer - the pointer to native function
arg - the value passed as void* arg parameter to the callback
Throws:
JackException
See Also:
setDefaultBufferSizeCallback()

setDefaultSampleRateCallback

public void setDefaultSampleRateCallback()
                                  throws JackException
Sets the default native JackSampleRateCallback for this client.

Throws:
JackException

setSampleRateCallback

public void setSampleRateCallback(long pointer,
                                  long arg)
                           throws JackException
Sets custom JackSampleRateCallback for this client.

The pointer must be a native JackSampleRateCallback pointer, represented as long.

Parameters:
pointer - the pointer to native function
arg - the value passed as void* arg parameter to the callback
Throws:
JackException
See Also:
setDefaultSampleRateCallback()

setDefaultClientRegistrationCallback

public void setDefaultClientRegistrationCallback()
                                          throws JackException
Sets the default native JackClientRegistrationCallback for this client.

Throws:
JackException

setClientRegistrationCallback

public void setClientRegistrationCallback(long pointer,
                                          long arg)
                                   throws JackException
Sets custom JackClientRegistrationCallback for this client.

The pointer must be a native JackClientRegistrationCallback pointer, represented as long.

Parameters:
pointer - the pointer to native function
arg - the value passed as void* arg parameter to the callback
Throws:
JackException
See Also:
setDefaultClientRegistrationCallback()

setDefaultPortRegistrationCallback

public void setDefaultPortRegistrationCallback()
                                        throws JackException
Sets the default native JackPortRegistrationCallback for this client.

Throws:
JackException

setPortRegistrationCallback

public void setPortRegistrationCallback(long pointer,
                                        long arg)
                                 throws JackException
Sets custom JackPortRegistrationCallback for this client.

The pointer must be a native JackPortRegistrationCallback pointer, represented as long.

Parameters:
pointer - the pointer to native function
arg - the value passed as void* arg parameter to the callback
Throws:
JackException
See Also:
setDefaultPortRegistrationCallback()

setDefaultPortConnectCallback

public void setDefaultPortConnectCallback()
                                   throws JackException
Sets the default native JackPortConnectCallback for this client.

Throws:
JackException

setPortConnectCallback

public void setPortConnectCallback(long pointer,
                                   long arg)
                            throws JackException
Sets custom JackPortConnectCallback for this client.

The pointer must be a native JackPortConnectCallback pointer, represented as long.

Parameters:
pointer - the pointer to native function
arg - the value passed as void* arg parameter to the callback
Throws:
JackException
See Also:
setDefaultPortConnectCallback()

setDefaultGraphOrderCallback

public void setDefaultGraphOrderCallback()
                                  throws JackException
Sets the default native JackGraphOrderCallback for this client.

Throws:
JackException

setGraphOrderCallback

public void setGraphOrderCallback(long pointer,
                                  long arg)
                           throws JackException
Sets custom JackGraphOrderCallback for this client.

The pointer must be a native JackGraphOrderCallback pointer, represented as long.

Parameters:
pointer - the pointer to native function
arg - the value passed as void* arg parameter to the callback
Throws:
JackException
See Also:
setDefaultGraphOrderCallback()

setDefaultXRunCallback

public void setDefaultXRunCallback()
                            throws JackException
Sets the default native JackXRunCallback for this client.

Throws:
JackException

setXRunCallback

public void setXRunCallback(long pointer,
                            long arg)
                     throws JackException
Sets custom JackXRunCallback for this client.

The pointer must be a native JackXRunCallback pointer, represented as long.

Parameters:
pointer - the pointer to native function
arg - the value passed as void* arg parameter to the callback
Throws:
JackException
See Also:
setDefaultXRunCallback()

setAllDefaultCallbacks

public void setAllDefaultCallbacks()
                            throws JackException
Sets all available default native callbacks.

The Java callback methods (such as process(int)) will only work if the default native callback is set for thread initialization and for the corresponding event. It's recommended to call this method to set all those native callbacks at once.

This method currently doesn't set the JackPortConnectCallback, because using that callback causes buggy behavior of Jackd 0.109.2.

Throws:
JackException

isOpen

public boolean isOpen()
Returns true if the client is still open.


getClientName

public java.lang.String getClientName()
                               throws JackException
Returns real client name (which may be different than the one specified in constructor).

Throws:
JackException

close

public void close()
           throws JackException
Closes the client.

The client is completely unusable after this call.

Throws:
JackException

isRealtime

public boolean isRealtime()
                   throws JackException
Returns true if the server runs in real-time mode.

Throws:
JackException

isActive

public boolean isActive()
Returns true if the client was activated


activate

public void activate()
              throws JackException
Activates the client.

Throws:
JackException

deactivate

public void deactivate()
                throws JackException
Deactivates the client.

Throws:
JackException

isShutdown

public boolean isShutdown()
Returns true if the Jack client thread was shut down.

This method only works if the correct "on shutdown" callback was set, preferably using setDefaultShutdownCallback().


threadWait

public int threadWait(int status)
               throws JackException
Calls jack_thread_wait.

Throws:
JackException

setFreewheel

public void setFreewheel(boolean onoff)
                  throws JackException
Starts or stops Jack "freewheel" mode.

Throws:
JackException

setBufferSize

public void setBufferSize(int bufferSize)
                   throws JackException
Sets buffer size used by Jack server.

This can cause audio gap.

Throws:
java.lang.IllegalArgumentException - if the bufferSize is not a power of two
JackException - if jack_set_buffer_size fails

getBufferSize

public int getBufferSize()
                  throws JackException
Returns buffer size.

Should only be used before activate(). If you want to monitor buffer size changes, see bufferSizeCallback(int).

Throws:
JackException

getSampleRate

public int getSampleRate()
                  throws JackException
Returns current sample rate.

Throws:
JackException

addPort

public JackLocalPort addPort(java.lang.String portName,
                             java.util.Collection<JackPortFlag> flags,
                             java.lang.String portType,
                             int bufferSize)
                      throws JackException
Registers new port.

Tip: you can to use EnumSet as flags parameter.

Parameters:
portName - short name of the new port
flags - set of port flags
portType - port type, currently only built-ins JackConstants.JACK_DEFAULT_AUDIO_TYPE() and JackConstants.JACK_DEFAULT_MIDI_TYPE() are allowed
bufferSize - must be non-zero for non-standard portType, otherwise is ignored
Throws:
JackException - if port registration fails

addAudioPort

public JackLocalPort addAudioPort(java.lang.String portName,
                                  java.util.Collection<JackPortFlag> flags)
                           throws JackException
Registers new port of standard audio type.

Calls addPort(String, Collection, String, int) with portType set to JackConstants.JACK_DEFAULT_AUDIO_TYPE() and bufferSize set to 0.

Throws:
JackException

addMidiPort

public JackLocalMidiPort addMidiPort(java.lang.String portName,
                                     java.util.Collection<JackPortFlag> flags)
                              throws JackException
Registers new port of standard MIDI type.

Calls addPort(String, Collection, String, int) with portType set to JackConstants.JACK_DEFAULT_MIDI_TYPE() and bufferSize set to 0.

Throws:
JackException

localPortNames

public java.util.Set<java.lang.String> localPortNames()
Returns unmodifiable set of (short) names of ports registered by this client.

The returned set will reflect changes (adding/removing ports), but cannot be modified with Set methods.


localPort

public JackLocalPort localPort(java.lang.String name)
Returns port registered under given (short) name, or null if such port doesn't exist.

Note that this method ignores aliases given to the ports.


removePort

public void removePort(java.lang.String portName)
                throws JackException
Unregisters given port.

The corresponding JackPort instance will be unusable after this call.

Throws:
java.lang.IllegalArgumentException - if port with given name doesn't exist
JackException - if the port couldn't be unregistered

portByName

public JackPort portByName(java.lang.String name)
                    throws JackException
Returns (local or foreign) port with given name, or null if it doesn't exist.

Note that the returned instance is not of type JackLocalPort, even if the port belongs to this client. See localPort(String) method if you want to get JackLocalPort instance.

Parameters:
name - in the form 'client_name:form_name'
Throws:
JackException

portById

public JackPort portById(long id)
                  throws JackException
Returns (local or foreign) port with given ID, or null if it doesn't exist.

It seems that the only place where this method is currently usable are some of the callbacks, namely portRegistrationCallback(long, boolean) and portConnectCallback(long, long, boolean).

Note that the returned instance is not of type JackLocalPort, even if the port belongs to this client. See localPort(String) method if you want to get JackLocalPort instance.

Parameters:
id - unique ID of the port
Throws:
JackException

getPorts

public java.lang.String[] getPorts(java.lang.String portNamePattern,
                                   java.lang.String typeNamePattern,
                                   java.util.EnumSet<JackPortFlag> flagSet)
Returns names of ports that fulfill given criteria.

Parameters:
portNamePattern - regex used to select ports by name; this parameter is ignored if it's null or empty string
typeNamePattern - regex used to select ports by type; this parameter is ignored if it's null or empty string
flagSet - required port flags; this parameter is ignored if it's null
Returns:
array of port names

getPorts

public java.lang.String[] getPorts(java.lang.String portNamePattern,
                                   java.lang.String typeNamePattern,
                                   long flags)
Returns names of ports that fulfill given criteria.

Parameters:
portNamePattern - regex used to select ports by name; this parameter is ignored if it's null or empty string
typeNamePattern - regex used to select ports by type; this parameter is ignored if it's null or empty string
flags - required port flags; this parameter is ignored if it's zero
Returns:
array of port names

connect

public boolean connect(java.lang.String sourcePortName,
                       java.lang.String destinationPortName)
                throws JackException
Establish a connection between two ports.

The port types must be identical, the source port must be an output port, and the destination port must be an input port.

The ports need not to belong to this client.

Parameters:
sourcePortName - long name of source port
destinationPortName - long name of destination port
Returns:
true if the connection was added, false if it already existed
Throws:
JackException - if the connection can't be established

disconnect

public void disconnect(java.lang.String sourcePortName,
                       java.lang.String destinationPortName)
                throws JackException
Remove a connection between two ports.

The port types must be identical, the source port must be an output port, and the destination port must be an input port.

The ports need not to belong to this client.

Parameters:
sourcePortName - long name of source port
destinationPortName - long name of destination port
Throws:
JackException - if the connection can't be established

getAllPortConnections

public java.lang.String[] getAllPortConnections(JackPort port)
                                         throws JackException
Returns full port names of to which the specified port is connected. This differs from JackLocalPort.getConnections() in two important respects:

Throws:
JackException

isMine

public boolean isMine(JackPort port)
               throws JackException
Returns true if the specified port is owned by this client.

Throws:
JackException

recomputeTotalLatencies

public void recomputeTotalLatencies()
                             throws JackException
Recomputes port latencies.

Throws:
JackException

recomputeTotalPortLatency

public void recomputeTotalPortLatency(JackPort port)
                               throws JackException
Recomputes port latency.

Throws:
JackException

getTotalPortLatency

public int getTotalPortLatency(JackPort port)
                        throws JackException
Returns port total latency.

Throws:
JackException

requestPortMonitorByName

public void requestPortMonitorByName(java.lang.String portName,
                                     boolean on)
                              throws JackException
If the port can be monitored, sets monitoring on or off.

Throws:
JackException

framesSinceCycleStart

public int framesSinceCycleStart()
Returns time in frames since Jack server began the current process cycle.


frameTime

public int frameTime()
Returns current frame time (running counter).


lastFrameTime

public int lastFrameTime()
Returns frame time after the last processing of the graph.

This method should only be called from process(int) callback.


timeToFrames

public int timeToFrames(long microseconds)
Converts time in microseconds to frame time.


framesToTime

public long framesToTime(int frameTime)
Converts time in microseconds to frame time.


time

public long time()
Returns current time in microseconds.


cpuLoad

public float cpuLoad()
Returns current CPU load.


getStatistics

public Statistics getStatistics()
Returns the Statistics object associated with this client.


getClientThread

public JackClientThread getClientThread()
Returns the object that allows operations on client thread.

Returns null if the thread wasn't created yet.

The setDefaultThreadInitCallback() must be used, otherwise this method always returns null.


loadInternalClient

public JackInternalClient loadInternalClient(java.lang.String clientName,
                                             boolean useExactName,
                                             java.lang.String sharedObjectName,
                                             java.lang.String initValue)
                                      throws JackException
Loads internal client.

Parameters:
clientName - name of internal client
useExactName - if set to true, request that the client have exact clientName; otherwise, Jack server may generate unique name
sharedObjectName - if not null, specifies name of shared library; otherwise, clientName is used
initValue - if not null, this string will be passed to internal client's jack_initialize function
Throws:
JackException

internalClientByName

public JackInternalClient internalClientByName(java.lang.String clientName)
                                        throws JackException
Returns an object that represents internal client with specified name.

Throws:
JackException - if the client doesn't exist or if other error occurred

process

public abstract int process(int bufferSize)
                     throws java.lang.Exception
Called during each process cycle.

Must return zero on success, non-zero on error. If this method throws an exception, status -1 is returned to the server.

Normally, this method is not called as synchronized; see setProcessMethodSynchronized(boolean).

Throws:
java.lang.Exception

threadInitCallback

public abstract void threadInitCallback()
                                 throws java.lang.Exception
Called once, when Jack server initializes client thread.

Exceptions thrown by this callback are ignored.

Throws:
java.lang.Exception

freewheelCallback

public abstract void freewheelCallback(boolean onoff)
                                throws java.lang.Exception
Called when Jack enters or leaves "freewheel" mode.

Exceptions thrown by this callback are ignored.

Throws:
java.lang.Exception

bufferSizeCallback

public abstract int bufferSizeCallback(int newBufferSize)
                                throws java.lang.Exception
Called when Jack buffer size changes.

Must return zero on success, non-zero on error. If this method throws an exception, status -1 is returned to the server.

Throws:
java.lang.Exception

sampleRateCallback

public abstract int sampleRateCallback(int newSampleRate)
                                throws java.lang.Exception
Called when Jack sample rate changes.

Must return zero on success, non-zero on error. If this method throws an exception, status -1 is returned to the server.

Throws:
java.lang.Exception

clientRegistrationCallback

public abstract void clientRegistrationCallback(java.lang.String clientName,
                                                boolean registered)
                                         throws java.lang.Exception
Called when another Jack client is registered/unregistered.

Exceptions thrown by this callback are ignored.

Parameters:
clientName - name of the other client
registered - true if the client is registered, false if it's unregistered
Throws:
java.lang.Exception

portRegistrationCallback

public abstract void portRegistrationCallback(long portId,
                                              boolean registered)
                                       throws java.lang.Exception
Called when Jack port is registered/unregistered.

Exceptions thrown by this callback are ignored.

Parameters:
portId - unique port ID (see portById(long))
registered - true if the port is registered, false if it's unregistered
Throws:
java.lang.Exception

portConnectCallback

public abstract void portConnectCallback(long portAId,
                                         long portBId,
                                         boolean connected)
                                  throws java.lang.Exception
CURRENTLY NOT WORKING. Called when two ports are connected or disconnected.

Exceptions thrown by this callback are ignored.

The Jack API documentation doesn't specify which port is source and which is destination.

Parameters:
portAId - unique ID of one of two ports connected or disconnected
portBId - unique ID of one of two ports connected or disconnected
connected - true if the connection is established, false if it's removed
Throws:
java.lang.Exception
See Also:
portById(long)

graphOrderCallback

public abstract int graphOrderCallback()
                                throws java.lang.Exception
Called whenever the processing graph is reordered.

Must return zero on success, non-zero on error. If this method throws an exception, status -1 is returned to the server.

Throws:
java.lang.Exception

xRunCallback

public abstract int xRunCallback()
                          throws java.lang.Exception
Called when Jack XRUN occurs.

Must return zero on success, non-zero on error. If this method throws an exception, status -1 is returned to the server.

Throws:
java.lang.Exception


Copyright © 2008 Ondrej Par. All Rights Reserved.