de.gulden.framework.jjack

Class JJackAudioEvent

public class JJackAudioEvent extends EventObject

Event class to propagate audio data from one audio processor to another.

Version: 0.3

Author: Jens Gulden

Nested Class Summary
protected classJJackAudioEvent.ChannelImpl
Inner class implementing interface JJackAudioChannel.
protected classJJackAudioEvent.PortImpl
Inner class implementing interface JJackAudioPort.
Field Summary
protected FloatBuffer[]inputBuffer
Input buffers of this event.
protected intmonoInputPort
Number of input port to use for mono processors.
protected intmonoOutputPort
Number of output port to use for mono processors.
protected FloatBuffer[]outputBuffer
Output buffers of this event.
Stackstack
Backup stack for output buffers during processing.
protected longtimestamp
UNIX timestamp of event occurrence
Constructor Summary
JJackAudioEvent(long timestamp, Object client, FloatBuffer[] inputBuffer, FloatBuffer[] outputBuffer)
Constructor.
Method Summary
intcountChannels()
Returns the number of channels that have both an input and an output channel.
intcountInputPorts()
Returns the number of channels with an input port.
intcountOutputPorts()
Returns the number of channels with an output port.
CollectiongetChannels()
Returns all channels.
FloatBuffergetInput()
Returns the mono input buffer.
FloatBuffergetInput(int chan)
Returns the input buffer of the specified channel.
FloatBuffer[]getInputs()
Returns all input buffers.
intgetMonoInputPort()
Returns the index number of the input port used for mono access.
intgetMonoOutputPort()
Returns the index number of the output port used for mono access.
FloatBuffergetOutput()
Returns the mono output buffer.
FloatBuffergetOutput(int chan)
Returns the output buffer of the specified channel.
FloatBuffer[]getOutputs()
Returns all output buffers.
longgetTimestamp()
Returns the UNIX timestamp marking the time of event occurrence.
voidsetInput(FloatBuffer buf)
Sets the mono input buffer.
voidsetInput(int chan, FloatBuffer buf)
Sets the input buffer of the specified channel.
voidsetMonoInputPort(int port)
Sets the index number of the input port used for mono access.
voidsetMonoOutputPort(int port)
Sets the index number of the output port used for mono access.
voidsetOutput(FloatBuffer buf)
Sets the mono output buffer.
voidsetOutput(int chan, FloatBuffer buf)
Sets the output buffer of the specified channel.

Field Detail

inputBuffer

protected FloatBuffer[] inputBuffer
Input buffers of this event.

monoInputPort

protected int monoInputPort
Number of input port to use for mono processors.

monoOutputPort

protected int monoOutputPort
Number of output port to use for mono processors.

outputBuffer

protected FloatBuffer[] outputBuffer
Output buffers of this event.

stack

Stack stack
Backup stack for output buffers during processing. Package-private, accessed by JJackMonitor only.

timestamp

protected long timestamp
UNIX timestamp of event occurrence

Constructor Detail

JJackAudioEvent

public JJackAudioEvent(long timestamp, Object client, FloatBuffer[] inputBuffer, FloatBuffer[] outputBuffer)
Constructor. Creates a new JJackAudioEvent instance with the given parameters.

Parameters: timestamp UNIX timestamp of event occurrence client source client issuing the event inputBuffer array of input buffers to deliver with this event outputBuffer array of output buffers to deliver with this event

Method Detail

countChannels

public int countChannels()
Returns the number of channels that have both an input and an output channel. Usually, the number of input and output channels are equal, in that case countInputPorts() == countOutputPorts() == countChannels(). If the number of input and output ports differ, the minimum of both determines the number of channels.

Returns: number of channels

countInputPorts

public int countInputPorts()
Returns the number of channels with an input port.

Returns: number of channels with an input port

countOutputPorts

public int countOutputPorts()
Returns the number of channels with an output port.

Returns: number of channels with an output port

getChannels

public Collection getChannels()
Returns all channels. The number of elements in the Collection returned is equals to countChannels().

Returns: Collection of JJackAudioChannel

See Also: countChannels

getInput

public FloatBuffer getInput()
Returns the mono input buffer.

Returns: input buffer of the mono input port.

See Also: getMonoInputPort

getInput

public FloatBuffer getInput(int chan)
Returns the input buffer of the specified channel.

Parameters: chan channel number

Returns: input buffer

getInputs

public FloatBuffer[] getInputs()
Returns all input buffers.

Returns: array of all input buffers

getMonoInputPort

public int getMonoInputPort()
Returns the index number of the input port used for mono access.

Returns: input port index number

getMonoOutputPort

public int getMonoOutputPort()
Returns the index number of the output port used for mono access.

Returns: output port index number

getOutput

public FloatBuffer getOutput()
Returns the mono output buffer.

Returns: output buffer of the mono output port.

See Also: getMonoOutputPort

getOutput

public FloatBuffer getOutput(int chan)
Returns the output buffer of the specified channel.

Parameters: chan channel number

Returns: output buffer

getOutputs

public FloatBuffer[] getOutputs()
Returns all output buffers.

Returns: array of all output buffers

getTimestamp

public long getTimestamp()
Returns the UNIX timestamp marking the time of event occurrence.

Returns: the UNIX timestamp value

setInput

public void setInput(FloatBuffer buf)
Sets the mono input buffer.

Parameters: buf input buffer

See Also: JJackAudioEvent

setInput

public void setInput(int chan, FloatBuffer buf)
Sets the input buffer of the specified channel.

Parameters: chan channel number buf input buffer

setMonoInputPort

public void setMonoInputPort(int port)
Sets the index number of the input port used for mono access.

setMonoOutputPort

public void setMonoOutputPort(int port)
Sets the index number of the output port used for mono access.

setOutput

public void setOutput(FloatBuffer buf)
Sets the mono output buffer.

Parameters: buf output buffer

See Also: JJackAudioEvent

setOutput

public void setOutput(int chan, FloatBuffer buf)
Sets the output buffer of the specified channel.

Parameters: chan channel number buf output buffer