net.sf.jack4j
Class AbstractJackTransportClient

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

public abstract class AbstractJackTransportClient
extends JackTransportClient

Convenient implementation of JackTransportClient that correctly defines all callbacks.

Inherited classes still have to call JackClient.setDefaultThreadInitCallback() and other necessary setDefaultXXXCallback methods to ensure that the callbacks are actually called.

Author:
repa

Constructor Summary
AbstractJackTransportClient(java.lang.String clientName, boolean useExactName, boolean canStartServer, java.lang.String serverName)
          Simply calls inherited constructor.
 
Method Summary
 int bufferSizeCallback(int newBufferSize)
          This implementation only returns 0.
 void clientRegistrationCallback(java.lang.String clientName, boolean registered)
          This implementation does nothing.
 void freewheelCallback(boolean onoff)
          This implementation does nothing.
 int graphOrderCallback()
          This implementation only returns 0.
 void portConnectCallback(long portAId, long portBId, boolean connected)
          This implementation does nothing.
 void portRegistrationCallback(long portId, boolean registered)
          This implementation does nothing.
 int process(int bufferSize)
          This implementation only returns 0.
 int sampleRateCallback(int newSampleRate)
          This implementation only returns 0.
 boolean syncCallback(JackTransportState state, TransportPosition position)
          Always returns true.
 void threadInitCallback()
          This implementation does nothing.
 void timebaseCallback(JackTransportState state, int nframes, TransportPosition pos, boolean newPos)
          Does nothing.
 int xRunCallback()
          This implementation only returns 0.
 
Methods inherited from class net.sf.jack4j.JackTransportClient
getCurrentTransportFrame, locateTransport, queryTransport, releaseTimebase, repositionTransport, setDefaultSyncCallback, setDefaultTimebaseCallback, setSyncCallback, setSyncTimeout, setTimebaseCallback, startTransport, stopTransport, unsetSyncCallback
 
Methods inherited from class net.sf.jack4j.JackClient
activate, addAudioPort, addMidiPort, addPort, close, connect, cpuLoad, deactivate, disconnect, finalize, framesSinceCycleStart, framesToTime, frameTime, getAllPortConnections, getBufferSize, getCallbackStruct, getClientHandle, getClientName, getClientThread, getPorts, getPorts, getSampleRate, getStatistics, getTotalPortLatency, internalClientByName, isActive, isMine, isOpen, isProcessMethodSynchronized, isRealtime, isShutdown, lastFrameTime, loadInternalClient, localPort, localPortNames, portById, portByName, recomputeTotalLatencies, recomputeTotalPortLatency, removePort, requestPortMonitorByName, setAllDefaultCallbacks, setBufferSize, setBufferSizeCallback, setClientRegistrationCallback, setDefaultBufferSizeCallback, setDefaultClientRegistrationCallback, setDefaultFreewheelCallback, setDefaultGraphOrderCallback, setDefaultPortConnectCallback, setDefaultPortRegistrationCallback, setDefaultProcessCallback, setDefaultSampleRateCallback, setDefaultShutdownCallback, setDefaultThreadInitCallback, setDefaultXRunCallback, setFreewheel, setFreewheelCallback, setGraphOrderCallback, setPortConnectCallback, setPortRegistrationCallback, setProcessCallback, setProcessMethodSynchronized, setSampleRateCallback, setShutdownCallback, setThreadInitCallback, setXRunCallback, threadWait, time, timeToFrames
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractJackTransportClient

public AbstractJackTransportClient(java.lang.String clientName,
                                   boolean useExactName,
                                   boolean canStartServer,
                                   java.lang.String serverName)
                            throws JackException
Simply calls inherited constructor.

Throws:
JackException
See Also:
JackClient.JackClient(String, boolean, boolean, String)
Method Detail

syncCallback

public boolean syncCallback(JackTransportState state,
                            TransportPosition position)
Always returns true.

Specified by:
syncCallback in class JackTransportClient
Parameters:
state - current transport state
position - new transport position
Returns:
true if the client is ready, false otherwise.

timebaseCallback

public void timebaseCallback(JackTransportState state,
                             int nframes,
                             TransportPosition pos,
                             boolean newPos)
Does nothing.

Specified by:
timebaseCallback in class JackTransportClient
Parameters:
state - current transport state
nframes - period length
pos - position structure for the next cycle; if newPos is false, the structure already contains extended positional information from current cycle
newPos - if true, new position was requested; in such case, pos structure doesn't contain valid extended information

bufferSizeCallback

public int bufferSizeCallback(int newBufferSize)
                       throws java.lang.Exception
This implementation only returns 0.

Specified by:
bufferSizeCallback in class JackClient
Throws:
java.lang.Exception
See Also:
JackClient.bufferSizeCallback(int)

clientRegistrationCallback

public void clientRegistrationCallback(java.lang.String clientName,
                                       boolean registered)
                                throws java.lang.Exception
This implementation does nothing.

Specified by:
clientRegistrationCallback in class JackClient
Parameters:
clientName - name of the other client
registered - true if the client is registered, false if it's unregistered
Throws:
java.lang.Exception
See Also:
JackClient.clientRegistrationCallback(java.lang.String, boolean)

freewheelCallback

public void freewheelCallback(boolean onoff)
                       throws java.lang.Exception
This implementation does nothing.

Specified by:
freewheelCallback in class JackClient
Throws:
java.lang.Exception
See Also:
JackClient.freewheelCallback(boolean)

graphOrderCallback

public int graphOrderCallback()
                       throws java.lang.Exception
This implementation only returns 0.

Specified by:
graphOrderCallback in class JackClient
Throws:
java.lang.Exception
See Also:
JackClient.graphOrderCallback()

portConnectCallback

public void portConnectCallback(long portAId,
                                long portBId,
                                boolean connected)
                         throws java.lang.Exception
This implementation does nothing.

Specified by:
portConnectCallback in class JackClient
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:
JackClient.portConnectCallback(long, long, boolean)

portRegistrationCallback

public void portRegistrationCallback(long portId,
                                     boolean registered)
                              throws java.lang.Exception
This implementation does nothing.

Specified by:
portRegistrationCallback in class JackClient
Parameters:
portId - unique port ID (see JackClient.portById(long))
registered - true if the port is registered, false if it's unregistered
Throws:
java.lang.Exception
See Also:
JackClient.portRegistrationCallback(long, boolean)

process

public int process(int bufferSize)
            throws java.lang.Exception
This implementation only returns 0.

Specified by:
process in class JackClient
Throws:
java.lang.Exception
See Also:
JackClient.process(int)

sampleRateCallback

public int sampleRateCallback(int newSampleRate)
                       throws java.lang.Exception
This implementation only returns 0.

Specified by:
sampleRateCallback in class JackClient
Throws:
java.lang.Exception
See Also:
JackClient.sampleRateCallback(int)

threadInitCallback

public void threadInitCallback()
                        throws java.lang.Exception
This implementation does nothing.

Specified by:
threadInitCallback in class JackClient
Throws:
java.lang.Exception
See Also:
JackClient.threadInitCallback()

xRunCallback

public int xRunCallback()
                 throws java.lang.Exception
This implementation only returns 0.

Specified by:
xRunCallback in class JackClient
Throws:
java.lang.Exception
See Also:
JackClient.xRunCallback()


Copyright © 2008 Ondrej Par. All Rights Reserved.