de.gulden.framework.jjack

Class JJackSystem

public class JJackSystem extends Object implements JJackConstants

JJack system class. This purely static class is the bridge between the native JACK client and the Java classes implementing JJackAudioProcessor.

Version: 0.3

Author: Jens Gulden

Field Summary
static JJackAudioProcessorclient
static StringclientName
static booleanDEBUG
Flag for debug mode.
static StringDEFAULT_AUTOCONNECT
Default auto-connect mode.
static StringDEFAULT_CLIENT_NAME
Default name of the native JACK client to register.
static StringDEFAULT_PORTS
Default ports count.
static StringDEFAULT_VERBOSE
Default verbose mode.
static longinfPointer
Pointer to native handle-structure.
static JJackExceptioninitError
static booleaninitialized
static Objectlock
static intportsInput
static booleanportsInputAutoconnect
static intportsOutput
static booleanportsOutputAutoconnect
static StringPROPERTY_CLIENT_NAME
Name of the system property specifying the name of the native JACK client to register.
static StringPROPERTY_PORTS
Name of the system property specifying how many ports to allocate.
static StringPROPERTY_VERBOSE
Name of the system property specifying whether JJack should give more verbose output.
static booleanrunning
static StringSUFFIX_AUTOCONNECT
Suffix of the system property specifying whether ports should be auto-connected to physical JACK ports.
static StringSUFFIX_INPUT
Additional suffix of the system property specifying how many input ports to allocate.
static StringSUFFIX_OUTPUT
Suffix of the system property specifying how many output ports to allocate.
static booleanverbose
static StringVERSION
JJack version number.
Constructor Summary
JJackSystem()
Private constructor for getting an instance of Runnable.
Method Summary
static intcalculateSampleCount(int milliseconds)
Calculates number of samples used for a single channel in the given amount of milliseconds.
static intcountPorts(int inout)
Returns the number of ports available either for input or output mode.
static StringgetInfo()
Returns a short information text about the JJack system and its current status.
static StringgetJackClientName()
Returns the name of the native JACK client that has been regstered by the JJack system.
static JJackAudioProcessorgetProcessor()
Returns the audio processor which is responsible for signal processing.
static intgetSampleRate()
Returns the sample rate used by the JACK daemon.
static voidinit()
Initialized the JJack system.
static voidinit1()
static booleanisInitialized()
static voidlog(Object src, String msg)
Logs a message from the specified source object, if verbose mode is enabled.
static voidmain(String[] args)
Wrapper main()-method, invokes the main()-method of the class specified as arg[0].
static voidnativeDestroy()
Native client shutdown.
static voidnativeInit()
Native initialization.
static voidnativeStart()
Native client start.
static voidprocess(JJackAudioProcessor p, JJackAudioEvent e)
Process an audio event by a given audio processor.
static voidprocessBytes(ByteBuffer[] in, ByteBuffer[] out)
This method is the actual bridge from JACK to Java.
static voidsetProcessor(JJackAudioProcessor cl)
Sets the audio processor which is responsible for signal processing.
static voidshutdown()
static voidstart()
Start background processing on the Java side.
static voidstop()
Stops background processing on the Java side.
static voidusage()
Output usage description, then exit with error code.
static booleanverbose()
Returns whether the JJack sytem runs in verbose mode.

Field Detail

client

private static JJackAudioProcessor client

clientName

private static String clientName

DEBUG

public static final boolean DEBUG
Flag for debug mode.

DEFAULT_AUTOCONNECT

private static final String DEFAULT_AUTOCONNECT
Default auto-connect mode.

DEFAULT_CLIENT_NAME

private static final String DEFAULT_CLIENT_NAME
Default name of the native JACK client to register.

DEFAULT_PORTS

private static final String DEFAULT_PORTS
Default ports count.

DEFAULT_VERBOSE

private static final String DEFAULT_VERBOSE
Default verbose mode.

infPointer

private static long infPointer
Pointer to native handle-structure. Yes, this carries a real physical memory address. See the native implementation of libjjack.so in file libjjack.c.

initError

private static JJackException initError

initialized

private static boolean initialized

lock

private static Object lock

portsInput

private static int portsInput

portsInputAutoconnect

private static boolean portsInputAutoconnect

portsOutput

private static int portsOutput

portsOutputAutoconnect

private static boolean portsOutputAutoconnect

PROPERTY_CLIENT_NAME

private static final String PROPERTY_CLIENT_NAME
Name of the system property specifying the name of the native JACK client to register.

PROPERTY_PORTS

private static final String PROPERTY_PORTS
Name of the system property specifying how many ports to allocate.

PROPERTY_VERBOSE

private static final String PROPERTY_VERBOSE
Name of the system property specifying whether JJack should give more verbose output.

running

private static boolean running

SUFFIX_AUTOCONNECT

private static final String SUFFIX_AUTOCONNECT
Suffix of the system property specifying whether ports should be auto-connected to physical JACK ports.

SUFFIX_INPUT

private static final String SUFFIX_INPUT
Additional suffix of the system property specifying how many input ports to allocate.

SUFFIX_OUTPUT

private static final String SUFFIX_OUTPUT
Suffix of the system property specifying how many output ports to allocate.

verbose

private static boolean verbose

VERSION

public static final String VERSION
JJack version number.

Constructor Detail

JJackSystem

private JJackSystem()
Private constructor for getting an instance of Runnable.

Method Detail

calculateSampleCount

public static int calculateSampleCount(int milliseconds)
Calculates number of samples used for a single channel in the given amount of milliseconds. The current system sample rate is being taken into account.

Returns: number of sample values

countPorts

public static int countPorts(int inout)
Returns the number of ports available either for input or output mode.

Parameters: inout either constant INPUT or OUTPUT

Returns: the number of ports

getInfo

public static String getInfo()
Returns a short information text about the JJack system and its current status.

Returns: information text

getJackClientName

public static String getJackClientName()
Returns the name of the native JACK client that has been regstered by the JJack system.

Returns: the client name

getProcessor

public static JJackAudioProcessor getProcessor()
Returns the audio processor which is responsible for signal processing.

Returns: the audio processor

getSampleRate

public static int getSampleRate()
Returns the sample rate used by the JACK daemon.

Returns: the sample rate

init

private static void init()
Initialized the JJack system.

init1

static void init1()

isInitialized

public static boolean isInitialized()

log

public static void log(Object src, String msg)
Logs a message from the specified source object, if verbose mode is enabled.

Parameters: src the source object, usually the originator of the log message msg the message text

main

public static void main(String[] args)
Wrapper main()-method, invokes the main()-method of the class specified as arg[0]. By this time, the Jack connection has already been established by the static initializer.

Parameters: args command line parameters

Throws: Throwable if an unhandled exception occurs inside the wrapped application, or a JJackException if initializing the Jack client was not successful.

nativeDestroy

private static void nativeDestroy()
Native client shutdown.

nativeInit

private static void nativeInit()
Native initialization.

nativeStart

private static void nativeStart()
Native client start.

process

public static void process(JJackAudioProcessor p, JJackAudioEvent e)
Process an audio event by a given audio processor.

Parameters: p the audio processor that is to process the event e the audio event

processBytes

private static void processBytes(ByteBuffer[] in, ByteBuffer[] out)
This method is the actual bridge from JACK to Java. It is directly called from native code, and only from there.

Parameters: in the direct memory access input buffer out the direct memory access output buffer

setProcessor

public static void setProcessor(JJackAudioProcessor cl)
Sets the audio processor which is responsible for signal processing. The process()-method of this audio processor will then regularly be called.

shutdown

public static void shutdown()

start

private static void start()
Start background processing on the Java side.

Throws: JJackException if an error occurs

stop

private static void stop()
Stops background processing on the Java side. (Not implemented.)

usage

private static void usage()
Output usage description, then exit with error code.

verbose

public static boolean verbose()
Returns whether the JJack sytem runs in verbose mode.

Returns: true if verbose mode