|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.jack4j.JackClient net.sf.jack4j.JackTransportClient
public abstract class JackTransportClient
JackClient with additional transport-related methods.
Constructor Summary | |
---|---|
JackTransportClient(java.lang.String clientName,
boolean useExactName,
boolean canStartServer,
java.lang.String serverName)
|
Method Summary | |
---|---|
int |
getCurrentTransportFrame()
Return an estimate of the current transport frame, including any time elapsed since the last transport positional update. |
void |
locateTransport(int frame)
Reposition the transport to a new frame number. |
JackTransportState |
queryTransport(TransportPosition position)
Queries current state and position of Jack transport. |
void |
releaseTimebase()
Releases this client from timebase master responsibility. |
void |
repositionTransport(TransportPosition position)
Request a new transport position. |
void |
setDefaultSyncCallback()
Declares this client as a slow-sync client, using default callback. |
boolean |
setDefaultTimebaseCallback(boolean conditional)
Registers this client as timebase master for the Jack, using default callback. |
void |
setSyncCallback(long pointer,
long arg)
Declares this client as a slow-sync client, using default callback. |
void |
setSyncTimeout(long microseconds)
Set the timeout value for slow-sync clients. |
boolean |
setTimebaseCallback(boolean conditional,
long pointer,
long arg)
Registers this client as timebase master for the Jack. |
void |
startTransport()
Starts the Jack transport. |
void |
stopTransport()
Stops the Jack transport. |
abstract boolean |
syncCallback(JackTransportState state,
TransportPosition position)
Synchronization callback for slow-sync clients. |
abstract void |
timebaseCallback(JackTransportState state,
int nframes,
TransportPosition pos,
boolean newPos)
Callback that provides extended position information to Jack transport. |
void |
unsetSyncCallback()
Declares that the client is not slow-sync anymore, and unregisters native sync callback. |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public JackTransportClient(java.lang.String clientName, boolean useExactName, boolean canStartServer, java.lang.String serverName) throws JackException
JackException
Method Detail |
---|
public void startTransport()
public void stopTransport()
public JackTransportState queryTransport(TransportPosition position)
If the position
parameter is not null, the given structure
will be updated with the current positional information.
public int getCurrentTransportFrame()
public void locateTransport(int frame) throws JackException
May be May be called at any time by any client. The new position takes
effect in two process cycles. If there are slow-sync clients and the
transport is already rolling, it will enter the
JackTransportState.STARTING
state and begin invoking their
synchronization callbacks until ready. This function is realtime-safe.
JackException
public void repositionTransport(TransportPosition position) throws JackException
May be May be called at any time by any client. The new position takes
effect in two process cycles. If there are slow-sync clients and the
transport is already rolling, it will enter the
JackTransportState.STARTING
state and begin invoking their
synchronization callbacks until ready. This function is realtime-safe.
JackException
public void setSyncTimeout(long microseconds) throws JackException
JackException
public void setDefaultSyncCallback() throws JackException
Setting up a sync callback declares this client as a slow-sync client, one that cannot respond immediately to transport position changes.
After the default callback is set, the method
syncCallback(JackTransportState, TransportPosition)
will be
invoked accordingly to Jack synchronization rules (see the description of
syncCallback
method).
JackException
public void setSyncCallback(long pointer, long arg) throws JackException
Setting up a sync callback declares this client as a slow-sync client, one that cannot respond immediately to transport position changes.
The pointer
must be a native JackSyncCallback
pointer, represented as long
.
pointer
- the pointer to native functionarg
- the value passed as void* arg
parameter to the
callback
JackException
setDefaultSyncCallback()
public void unsetSyncCallback() throws JackException
After this method is called, the
syncCallback(JackTransportState, TransportPosition)
method won't
be called anymore.
JackException
public boolean setTimebaseCallback(boolean conditional, long pointer, long arg) throws JackException
The timebase master registers a callback that updates extended position information such as beats or timecode whenever necessary. Without this extended information, there is no need for this function.
There is never more than one master at a time. When a new client takes over, the former timebase callback is no longer called. Taking over the timebase may be done conditionally, so it fails if there was a master already.
conditional
- if true, the request is made conditionally, ie. if there
already is a timebase master, the method does nothingpointer
- the pointer to native functionarg
- the value passed as void* arg
parameter to the
callback
JackException
setDefaultTimebaseCallback(boolean)
public boolean setDefaultTimebaseCallback(boolean conditional) throws JackException
The timebase master registers a callback that updates extended position information such as beats or timecode whenever necessary. Without this extended information, there is no need for this function.
There is never more than one master at a time. When a new client takes over, the former timebase callback is no longer called. Taking over the timebase may be done conditionally, so it fails if there was a master already.
The default timebase callback invokes the method
timebaseCallback(JackTransportState, int, TransportPosition, boolean)
of this client.
conditional
- if true, the request is made conditionally, ie. if there
already is a timebase master, the method does nothing
JackException
public void releaseTimebase() throws JackException
After this call, this Jack client is not timebase master anymore. The
transport state keeps rolling if it was started, but no extended
positional information will be available. The
timebaseCallback(JackTransportState, int, TransportPosition, boolean)
will not be invoked anymore.
JackException
setDefaultTimebaseCallback(boolean)
public abstract boolean syncCallback(JackTransportState state, TransportPosition position)
The method is never invoked until the
setDefaultSyncCallback()
is called.
After the default slow-sync callback is set up, this method will be
called during the next process cycle (if the client is active), or after
the call to JackClient.activate()
(if the client was previously
inactive).
Then, the method is called again whenever the transport starts, and whenever some client requests new transport position.
The method must return boolean value that indicates whether the client is ready to roll.
The position
structure is only valid during the call.
If you need the positional information outside the callback, you can
create a clone with TransportPosition.clone()
.
state
- current transport stateposition
- new transport position
public abstract void timebaseCallback(JackTransportState state, int nframes, TransportPosition pos, boolean newPos)
This method is never invoked unless the
setDefaultTimebaseCallback(boolean)
was successfully called.
This method is called immediately after proces
callback in
the same thread whenever the transport is rolling, or when any client has
requested a new position in the previous cycle. The first cycle after the
(default) native timebase callback was registered is also treated as a
new position, or the first cycle after JackClient.activate()
if the client
had been inactive.
The method is responsible for setting extended position information into
pos
structure. The actual transport position can not be
set using frame
field of that structure; use
locateTransport(int)
instead. The position
structure is only valid during the call. If you need the positional
information outside the callback, you can create a clone with
TransportPosition.clone()
.
state
- current transport statenframes
- period lengthpos
- position structure for the next cycle; if newPos is
false, the structure already contains extended positional
information from current cyclenewPos
- if true, new position was requested; in such case, pos
structure doesn't contain valid extended information
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |