hydrogen 1.2.3
JackAudioDriver Class Reference

JACK (Jack Audio Connection Kit) server driver. More...

#include <JackAudioDriver.h>

Inheritance diagram for JackAudioDriver:
Object< JackAudioDriver > AudioOutput Base Object< AudioOutput > Base

Public Types

enum class  Timebase { Master = 1 , Slave = 0 , None = -1 }
 Whether Hydrogen or another program is Jack timebase master. More...
 

Public Member Functions

 JackAudioDriver (JackProcessCallback m_processCallback)
 Constructor of the JACK server driver.
 
 ~JackAudioDriver ()
 Destructor of the JACK server driver.
 
void clearPerTrackAudioBuffers (uint32_t nFrames)
 Resets the buffers contained in m_pTrackOutputPortsL and m_pTrackOutputPortsR.
 
virtual int connect () override
 Connects to output ports via the JACK server.
 
void deactivate ()
 Deactivates the JACK client of Hydrogen and disconnects all ports belonging to it.
 
virtual void disconnect () override
 Disconnects the JACK client of the Hydrogen from the JACK server.
 
virtual unsigned getBufferSize () override
 
bool getConnectDefaults ()
 
float getMasterBpm () const
 
virtual float * getOut_L () override
 Get content in the left stereo output port.
 
virtual float * getOut_R () override
 Get content in the right stereo output port.
 
virtual unsigned getSampleRate () override
 
Timebase getTimebaseState () const
 
float * getTrackOut_L (std::shared_ptr< Instrument > instr, std::shared_ptr< InstrumentComponent > pCompo)
 Convenience function looking up the track number of a component of an instrument using in m_trackMap using their IDs Instrument::__id and InstrumentComponent::__related_drumkit_componentID.
 
float * getTrackOut_L (unsigned nTrack)
 Get content of left output port of a specific track.
 
float * getTrackOut_R (std::shared_ptr< Instrument > instr, std::shared_ptr< InstrumentComponent > pCompo)
 Convenience function looking up the track number of a component of an instrument using in m_trackMap using their IDs Instrument::__id and InstrumentComponent::__related_drumkit_componentID.
 
float * getTrackOut_R (unsigned nTrack)
 Get content of right output port of a specific track.
 
virtual int getXRuns () const override
 Get the number of XRuns that occurred since the audio driver has started.
 
virtual int init (unsigned bufferSize) override
 Initializes the JACK audio driver.
 
void initTimebaseMaster ()
 Registers Hydrogen as JACK timebase master.
 
void locateTransport (long long nFrame)
 Re-positions the transport position to nFrame.
 
void makeTrackOutputs (std::shared_ptr< Song > pSong)
 Creates per component output ports for each instrument.
 
void releaseTimebaseMaster ()
 Release Hydrogen from the JACK timebase master responsibilities.
 
void relocateUsingBBT ()
 Uses the bar-beat-tick information to relocate the transport position.
 
void setConnectDefaults (bool flag)
 
void startTransport ()
 Tells the JACK server to start transport.
 
void stopTransport ()
 Tells the JACK server to stop transport.
 
void updateTransportPosition ()
 The function queries the transport position and additional information from the JACK server, writes them to m_JackTransportPos and in m_JackTransportState, and updates the AudioEngine in case of a mismatch.
 
- Public Member Functions inherited from Object< JackAudioDriver >
 Object ()
 
 Object (const Object< JackAudioDriver > &other)
 
- Public Member Functions inherited from Base
 Base ()
 
 Base (const Base &other)
 
virtual const char * class_name () const
 
void Print (bool bShort=true) const
 Prints content of toQString() via DEBUGLOG.
 
virtual QString toQString (const QString &sPrefix="", bool bShort=true) const
 Formatted string version for debugging purposes.
 
- Public Member Functions inherited from AudioOutput
 AudioOutput ()=default
 
virtual ~AudioOutput ()
 
virtual int getLatency ()
 Approximate audio latency (in frames) A reasonable approximation is the buffer time on most audio systems.
 
- Public Member Functions inherited from Object< AudioOutput >
 Object ()
 
 Object (const Object< AudioOutput > &other)
 

Static Public Member Functions

static bool checkSupport ()
 Attempts to call several JACK executables in order to check for existing JACK support.
 
static int jackDriverBufferSize (jack_nframes_t nframes, void *arg)
 Callback function for the JACK audio server to set the buffer size jackServerBufferSize.
 
static int jackDriverSampleRate (jack_nframes_t nframes, void *param)
 Callback function for the JACK audio server to set the sample rate jackServerSampleRate.
 
static int jackXRunCallback (void *arg)
 Report an XRun event to the GUI.
 
- Static Public Member Functions inherited from Base
static const char * _class_name ()
 return the class name
 
static QString base_clock (const QString &sMsg)
 Measures the current time and stores it in __last_clock.
 
static QString base_clock_in (const QString &sMsg)
 
static int bootstrap (Logger *logger, bool count=false)
 must be called before any Object instantiation !
 
static bool count_active ()
 
static int getAliveObjectCount ()
 
static object_map_t getObjectMap ()
 
static Loggerlogger ()
 return the logger instance
 
static int objects_count ()
 
static void printObjectMapDiff (object_map_t map)
 Creates the difference between a snapshot of the object map and its current state and prints it to std::cout.
 
static void set_count (bool flag)
 enable/disable class instances counting
 
static void write_objects_map_to (std::ostream &out, object_map_t *map=nullptr)
 output the full objects map to a given ostream
 
static void write_objects_map_to_cerr ()
 output objects map to stderr
 
- Static Public Member Functions inherited from AudioOutput
static QStringList getDevices ()
 

Data Fields

jack_client_t * m_pClient
 Object holding the external client session with the JACK server.
 

Static Public Attributes

static jack_nframes_t jackServerBufferSize = 0
 Buffer size of the JACK audio server.
 
static unsigned long jackServerSampleRate = 0
 Sample rate of the JACK audio server.
 
static int jackServerXRuns = 0
 Number of XRuns since the driver started.
 
static JackAudioDriverpJackDriverInstance = nullptr
 Instance of the JackAudioDriver.
 
- Static Public Attributes inherited from Base
static QString sPrintIndention = " "
 String used to format the debugging string output of some core classes.
 

Private Member Functions

bool compareAdjacentBBT () const
 Compares the BBT information stored in m_JackTransportPos and m_previousJackTransportPos with respect to the tempo and the transport position in bars, beats, and ticks.
 
void printState () const
 Show debugging information.
 
void setTrackOutput (int n, std::shared_ptr< Instrument > instr, std::shared_ptr< InstrumentComponent > pCompo, std::shared_ptr< Song > pSong)
 Renames the n 'th port of JACK client and creates it if it's not already present.
 

Static Private Member Functions

static QString checkExecutable (const QString &sExecutable, const QString &sOption)
 Calls sExecutable in a subprocess using the sOption CLI option and reports the results.
 
static void jackDriverShutdown (void *arg)
 Callback function for the JACK audio server to shutting down the JACK driver.
 
static void JackTimebaseCallback (jack_transport_state_t state, jack_nframes_t nFrames, jack_position_t *pJackPosition, int new_pos, void *arg)
 Callback function for the JACK server to supply additional timebase information.
 
static void printJackTransportPos (const jack_position_t *pPos)
 

Private Attributes

bool m_bConnectDefaults
 Specifies whether the default left and right (master) audio JACK ports will be automatically connected to the system's sink when registering the JACK client in connect().
 
jack_position_t m_JackTransportPos
 Current transport position obtained using jack_transport_query() (jack/transport.h).
 
jack_transport_state_t m_JackTransportState
 Current transport state returned by jack_transport_query() (jack/transport.h).
 
int m_nTimebaseTracking
 Whether Hydrogen or another program is Jack timebase master.
 
int m_nTrackPortCount
 Total number of output ports currently in use.
 
jack_port_t * m_pOutputPort1
 Left source port.
 
jack_port_t * m_pOutputPort2
 Right source port.
 
jack_position_t m_previousJackTransportPos
 Used for detecting changes in the BBT transport information with external timebase master application, which do not propagate these changes on time.
 
JackProcessCallback m_processCallback
 Main process callback.
 
jack_port_t * m_pTrackOutputPortsL [MAX_INSTRUMENTS]
 Vector of all left audio output ports currently used by the local JACK client.
 
jack_port_t * m_pTrackOutputPortsR [MAX_INSTRUMENTS]
 Vector of all right audio output ports currently used by the local JACK client.
 
QString m_sOutputPortName1
 Destination of the left source port m_pOutputPort1, for which a connection will be established in connect().
 
QString m_sOutputPortName2
 Destination of the right source port m_pOutputPort2, for which a connection will be established in connect().
 
Timebase m_timebaseState
 More user-friendly version of m_nTimebaseTracking.
 
int m_trackMap [MAX_INSTRUMENTS][MAX_COMPONENTS]
 Matrix containing the track number of each component of all instruments.
 

Additional Inherited Members

- Protected Member Functions inherited from Object< JackAudioDriver >
 ~Object ()
 
- Protected Member Functions inherited from Base
 ~Base ()
 
- Protected Member Functions inherited from Object< AudioOutput >
 ~Object ()
 
- Static Protected Member Functions inherited from Base
static void registerClass (const char *name, const atomic_obj_cpt_t *counters)
 
- Static Protected Attributes inherited from Base
static bool __count = false
 should we count class instances
 
static timeval __last_clock = { 0, 0 }
 
static Logger__logger = nullptr
 

Detailed Description

JACK (Jack Audio Connection Kit) server driver.

Transport Control:

Each JACK client can start and stop the transport or relocate the current transport position. The request will take place in cycles. During the first the status of the transport changes to JackTransportStarting to inform all clients a change is about to happen. During the second the status is again JackTransportRolling and the transport position is updated according to the request.

Also note that Hydrogen overwrites its local TransportPosition only with the transport position of the JACK server if there is a mismatch due to a relocation triggered by another JACK client. During normal transport the current position TransportPosition::m_nFrames will be always the same as the one of JACK during a cycle and incremented by the buffer size in audioEngine_process() at the very end of the cycle. The same happens for the transport information of the JACK server but in parallel.

Timebase Master:

The timebase master is responsible for providing additional transport information to the JACK server apart from the transport position in frames, like current beat, bar, tick, tick size, speed etc. Of all these information Hydrogen does only use the provided tempo (and overrides all internal ones). Therefore, unlike many other application, it does not respond to changes in measure (since these would have to be mapped to the length of the current pattern). Every client can be registered as timebase master by supplying a callback (for Hydrogen this would be JackTimebaseCallback()) but there can be at most one timebase master at a time. Having none at all is perfectly fine too. Apart from this additional responsibility, the registered client has no other rights compared to others.

After the status of the JACK transport has changed from JackTransportStarting to JackTransportRolling, the timebase master needs an additional cycle to update its information.

Definition at line 94 of file JackAudioDriver.h.

Member Enumeration Documentation

◆ Timebase

enum class Timebase
strong

Whether Hydrogen or another program is Jack timebase master.

Enumerator
Master 

Hydrogen itself is timebase master.

Slave 

An external program is timebase master and Hydrogen will disregard all tempo markers on the Timeline and, instead, only use the BPM provided by JACK.

None 

Only normal clients registered.

Definition at line 101 of file JackAudioDriver.h.

Constructor & Destructor Documentation

◆ JackAudioDriver()

JackAudioDriver ( JackProcessCallback m_processCallback)

Constructor of the JACK server driver.

Parameters
m_processCallbackFunction that is called by the AudioEngine during every processing cycle.

Definition at line 99 of file JackAudioDriver.cpp.

◆ ~JackAudioDriver()

Destructor of the JACK server driver.

Calling disconnect().

Definition at line 127 of file JackAudioDriver.cpp.

Member Function Documentation

◆ checkExecutable()

QString checkExecutable ( const QString & sExecutable,
const QString & sOption )
staticprivate

Calls sExecutable in a subprocess using the sOption CLI option and reports the results.

Returns
An empty string indicates, that the call exited with a code other than zero.

Definition at line 1247 of file JackAudioDriver.cpp.

◆ checkSupport()

bool checkSupport ( )
static

Attempts to call several JACK executables in order to check for existing JACK support.

In an earlier version I tried checking the presence of the libjack.so shared library. But this one comes preinstalled with most Linux distribution regardless of JACK itself is present or not.

Returns
Whether or not JACK support appears to be functional.

Definition at line 1209 of file JackAudioDriver.cpp.

◆ clearPerTrackAudioBuffers()

void clearPerTrackAudioBuffers ( uint32_t nFrames)

Resets the buffers contained in m_pTrackOutputPortsL and m_pTrackOutputPortsR.

Parameters
nFramesSize of the buffers used in the audio process callback function.

Definition at line 255 of file JackAudioDriver.cpp.

◆ compareAdjacentBBT()

bool compareAdjacentBBT ( ) const
private

Compares the BBT information stored in m_JackTransportPos and m_previousJackTransportPos with respect to the tempo and the transport position in bars, beats, and ticks.

Returns
true If m_JackTransportPos is expected to follow m_previousJackTransportPos.

Definition at line 408 of file JackAudioDriver.cpp.

◆ connect()

int connect ( )
overridevirtual

Connects to output ports via the JACK server.

  • Returns

0 : on success.

  • 1 : The activation of the JACK client using did fail.
  • 2 : The connections to m_sOutputPortName1 and m_sOutputPortName2 could not be established and the there were either no JACK ports holding the JackPortIsInput flag found or no connection to them could be established.

Implements AudioOutput.

Definition at line 132 of file JackAudioDriver.cpp.

◆ deactivate()

void deactivate ( )

Deactivates the JACK client of Hydrogen and disconnects all ports belonging to it.

Definition at line 233 of file JackAudioDriver.cpp.

◆ disconnect()

void disconnect ( )
overridevirtual

Disconnects the JACK client of the Hydrogen from the JACK server.

Implements AudioOutput.

Definition at line 213 of file JackAudioDriver.cpp.

◆ getBufferSize()

unsigned getBufferSize ( )
overridevirtual
Returns
Global variable jackServerBufferSize.

Implements AudioOutput.

Definition at line 245 of file JackAudioDriver.cpp.

◆ getConnectDefaults()

bool getConnectDefaults ( )
inline
Returns
m_bConnectDefaults

Definition at line 180 of file JackAudioDriver.h.

◆ getMasterBpm()

float getMasterBpm ( ) const
Returns
the BPM reported by the timebase master or NAN if there is no external timebase master.

Definition at line 1162 of file JackAudioDriver.cpp.

◆ getOut_L()

float * getOut_L ( )
overridevirtual

Get content in the left stereo output port.

Returns
Pointer to buffer content of type jack_default_audio_sample_t* (jack/types.h)

Implements AudioOutput.

Definition at line 602 of file JackAudioDriver.cpp.

◆ getOut_R()

float * getOut_R ( )
overridevirtual

Get content in the right stereo output port.

Returns
Pointer to buffer content of type jack_default_audio_sample_t* (jack/types.h)

Implements AudioOutput.

Definition at line 616 of file JackAudioDriver.cpp.

◆ getSampleRate()

unsigned getSampleRate ( )
overridevirtual
Returns
Global variable jackServerSampleRate.

Implements AudioOutput.

Definition at line 250 of file JackAudioDriver.cpp.

◆ getTimebaseState()

JackAudioDriver::Timebase getTimebaseState ( ) const
Returns
m_timebaseState

Definition at line 1156 of file JackAudioDriver.cpp.

◆ getTrackOut_L() [1/2]

float * getTrackOut_L ( std::shared_ptr< Instrument > instr,
std::shared_ptr< InstrumentComponent > pCompo )

Convenience function looking up the track number of a component of an instrument using in m_trackMap using their IDs Instrument::__id and InstrumentComponent::__related_drumkit_componentID.

Using the track number it then calls getTrackOut_L( unsigned ) and returns its result.

Parameters
instrPointer to an Instrument
pCompoPointer to one of the instrument's components.
Returns
Pointer to buffer content of type jack_default_audio_sample_t* (jack/types.h)

Definition at line 650 of file JackAudioDriver.cpp.

◆ getTrackOut_L() [2/2]

float * getTrackOut_L ( unsigned nTrack)

Get content of left output port of a specific track.

Parameters
nTrackTrack number. Must not be bigger than m_nTrackPortCount.
Returns
Pointer to buffer content of type jack_default_audio_sample_t* (jack/types.h)

Definition at line 622 of file JackAudioDriver.cpp.

◆ getTrackOut_R() [1/2]

float * getTrackOut_R ( std::shared_ptr< Instrument > instr,
std::shared_ptr< InstrumentComponent > pCompo )

Convenience function looking up the track number of a component of an instrument using in m_trackMap using their IDs Instrument::__id and InstrumentComponent::__related_drumkit_componentID.

Using the track number it then calls getTrackOut_R( unsigned ) and returns its result.

Parameters
instrPointer to an Instrument
pCompoPointer to one of the instrument's components.
Returns
Pointer to buffer content of type jack_default_audio_sample_t* (jack/types.h)

Definition at line 655 of file JackAudioDriver.cpp.

◆ getTrackOut_R() [2/2]

float * getTrackOut_R ( unsigned nTrack)

Get content of right output port of a specific track.

Parameters
nTrackTrack number. Must not be bigger than m_nTrackPortCount.
Returns
Pointer to buffer content of type jack_default_audio_sample_t* (jack/types.h)

Definition at line 636 of file JackAudioDriver.cpp.

◆ getXRuns()

int getXRuns ( ) const
overridevirtual

Get the number of XRuns that occurred since the audio driver has started.

Reimplemented from AudioOutput.

Definition at line 1172 of file JackAudioDriver.cpp.

◆ init()

int init ( unsigned bufferSize)
overridevirtual

Initializes the JACK audio driver.

Parameters
bufferSizeUnused and only present to assure compatibility with the JACK API.
Returns
  • 0 : on success.
  • -1 : if the pointer m_pClient obtained via jack_client_open() (jack/jack.h) is 0.
  • 4 : unable to register the "out_L" and/or "out_R" output ports for the JACK client using jack_port_register() (jack/jack.h).

Implements AudioOutput.

Definition at line 677 of file JackAudioDriver.cpp.

◆ initTimebaseMaster()

void initTimebaseMaster ( )

Registers Hydrogen as JACK timebase master.

Definition at line 992 of file JackAudioDriver.cpp.

◆ jackDriverBufferSize()

int jackDriverBufferSize ( jack_nframes_t nframes,
void * arg )
static

Callback function for the JACK audio server to set the buffer size jackServerBufferSize.

Parameters
nframesNew buffer size.
argNot used
Returns
0 on success

Definition at line 71 of file JackAudioDriver.cpp.

◆ jackDriverSampleRate()

int jackDriverSampleRate ( jack_nframes_t nframes,
void * param )
static

Callback function for the JACK audio server to set the sample rate jackServerSampleRate.

Parameters
nframesNew sample rate.
paramObject inheriting from the #Logger class.
Returns
0 on success

Definition at line 58 of file JackAudioDriver.cpp.

◆ jackDriverShutdown()

void jackDriverShutdown ( void * arg)
staticprivate

Callback function for the JACK audio server to shutting down the JACK driver.

Parameters
argUnused.

Definition at line 80 of file JackAudioDriver.cpp.

◆ JackTimebaseCallback()

void JackTimebaseCallback ( jack_transport_state_t state,
jack_nframes_t nFrames,
jack_position_t * pJackPosition,
int new_pos,
void * arg )
staticprivate

Callback function for the JACK server to supply additional timebase information.

The function it will be called after the audioEngine_process() function and only if the m_JackTransportState is JackTransportRolling.

What is the BBT information?

There is no formal definition in the JACK API but the way it is interpreted by Hydrogen is the following:

bar: Number of patterns passed since the beginning of the song. beat: Number of quarters passed since the beginning of the pattern. tick: Number of ticks passed since the last beat (with respect to the current frame).

A tick is an internal measure representing the smallest resolution of the transport position in terms of the patterns. It consist of pAudioEngine->getTickSize() frames, which changes depending on the current tempo.

Parameters
stateUnused.
nFramesUnused.
pJackPositionCurrent transport position.
new_posUnused.
argPointer to a JackAudioDriver instance.

Definition at line 1078 of file JackAudioDriver.cpp.

◆ jackXRunCallback()

int jackXRunCallback ( void * arg)
static

Report an XRun event to the GUI.

Definition at line 87 of file JackAudioDriver.cpp.

◆ locateTransport()

void locateTransport ( long long nFrame)

Re-positions the transport position to nFrame.

The new position takes effect in two process cycles during which JACK's state will be in JackTransportStarting and the transport won't be rolling.

Parameters
nFrameRequested new transport position.

Definition at line 978 of file JackAudioDriver.cpp.

◆ makeTrackOutputs()

void makeTrackOutputs ( std::shared_ptr< Song > pSong)

Creates per component output ports for each instrument.

Definition at line 872 of file JackAudioDriver.cpp.

◆ printJackTransportPos()

void printJackTransportPos ( const jack_position_t * pPos)
staticprivate

Definition at line 1191 of file JackAudioDriver.cpp.

◆ printState()

void printState ( ) const
private

Show debugging information.

Definition at line 1176 of file JackAudioDriver.cpp.

◆ releaseTimebaseMaster()

void releaseTimebaseMaster ( )

Release Hydrogen from the JACK timebase master responsibilities.

This causes the JackTimebaseCallback() callback function to not be called by the JACK server anymore.

Definition at line 1051 of file JackAudioDriver.cpp.

◆ relocateUsingBBT()

void relocateUsingBBT ( )

Uses the bar-beat-tick information to relocate the transport position.

This type of operation is triggered whenever the transport position gets relocated or the tempo is changed using Jack in the presence of an external timebase master.

Definition at line 274 of file JackAudioDriver.cpp.

◆ setConnectDefaults()

void setConnectDefaults ( bool flag)
inline
Parameters
flagSets m_bConnectDefaults

Definition at line 176 of file JackAudioDriver.h.

◆ setTrackOutput()

void setTrackOutput ( int n,
std::shared_ptr< Instrument > instr,
std::shared_ptr< InstrumentComponent > pCompo,
std::shared_ptr< Song > pSong )
private

Renames the n 'th port of JACK client and creates it if it's not already present.

If the track number n is bigger than the number of ports currently in usage m_nTrackPortCount, n + 1 - m_nTrackPortCount new stereo ports will be created using jack_port_register() (jack/jack.h) and m_nTrackPortCount updated to n + 1.

Afterwards, the n 'th port is renamed to a concatenation of "Track_", DrumkitComponent::__name, "_", n + 1, "_", Instrument::__name, and "_L", or "_R" using either jack_port_rename() (if HAVE_JACK_PORT_RENAME is defined) or jack_port_set_name() (both jack/jack.h). The former renaming function triggers a PortRename notifications to clients that have registered a port rename handler.

Parameters
nTrack number for which a port should be renamed (and created).
instrPointer to the corresponding Instrument.
pCompoPointer to the corresponding InstrumentComponent.
pSongPointer to the corresponding Song.

Definition at line 918 of file JackAudioDriver.cpp.

◆ startTransport()

void startTransport ( )

Tells the JACK server to start transport.

Definition at line 960 of file JackAudioDriver.cpp.

◆ stopTransport()

void stopTransport ( )

Tells the JACK server to stop transport.

Definition at line 969 of file JackAudioDriver.cpp.

◆ updateTransportPosition()

void updateTransportPosition ( )

The function queries the transport position and additional information from the JACK server, writes them to m_JackTransportPos and in m_JackTransportState, and updates the AudioEngine in case of a mismatch.

Definition at line 490 of file JackAudioDriver.cpp.

Field Documentation

◆ jackServerBufferSize

jack_nframes_t jackServerBufferSize = 0
static

Buffer size of the JACK audio server.

Definition at line 316 of file JackAudioDriver.h.

◆ jackServerSampleRate

unsigned long jackServerSampleRate = 0
static

Sample rate of the JACK audio server.

Definition at line 312 of file JackAudioDriver.h.

◆ jackServerXRuns

int jackServerXRuns = 0
static

Number of XRuns since the driver started.

Definition at line 322 of file JackAudioDriver.h.

◆ m_bConnectDefaults

bool m_bConnectDefaults
private

Specifies whether the default left and right (master) audio JACK ports will be automatically connected to the system's sink when registering the JACK client in connect().

Definition at line 557 of file JackAudioDriver.h.

◆ m_JackTransportPos

jack_position_t m_JackTransportPos
private

Current transport position obtained using jack_transport_query() (jack/transport.h).

It corresponds to the first frame of the current cycle.

The valid member of m_JackTransportPos will show which fields contain valid data. Thus, if it is set to JackPositionBBT, bar, beat, and tick information are provided by the current timebase master in addition to the transport information in frames. It is of class jack_position_bits_t (jack/types.h) and is an enumerator with five different options:

  • JackPositionBBT = 0x10 : Bar, Beat, Tick
  • JackPositionTimecode = 0x20 : External timecode
  • JackBBTFrameOffset = 0x40 : Frame offset of BBT information
  • JackAudioVideoRatio = 0x80 : audio frames per video frame
  • JackVideoFrameOffset = 0x100 : frame offset of first video frame

Definition at line 545 of file JackAudioDriver.h.

◆ m_JackTransportState

jack_transport_state_t m_JackTransportState
private

Current transport state returned by jack_transport_query() (jack/transport.h).


It is valid for the entire cycle and can have five different values:

  • JackTransportStopped = 0 : Transport is halted
  • JackTransportRolling = 1 : Transport is playing
  • JackTransportLooping = 2 : For OLD_TRANSPORT, now ignored
  • JackTransportStarting = 3 : Waiting for sync ready
  • JackTransportNetStarting = 4 : Waiting for sync ready on the network

The actual number of states depends on your JACK version. The listing above was done for version 1.9.12.

Definition at line 522 of file JackAudioDriver.h.

◆ m_nTimebaseTracking

int m_nTimebaseTracking
private

Whether Hydrogen or another program is Jack timebase master.

While Hydrogen can unregister as timebase master on its own, it can not be observed directly whether another application has taken over as timebase master. When the JACK server is releasing Hydrogen in the later case, it won't advertise this fact but simply won't call the JackTimebaseCallback() anymore. But since this will be called in every cycle after updateTransportPosition(), we can use this variable to determine if Hydrogen is still timebase master.

As Hydrogen registered as timebase master using initTimebaseMaster() it will be initialized with 1, decremented in updateTransportPosition(), and reset to 1 in JackTimebaseCallback(). Whenever it is zero in updateTransportPosition(), m_nTimebaseTracking will be updated accordingly.

Definition at line 584 of file JackAudioDriver.h.

◆ m_nTrackPortCount

int m_nTrackPortCount
private

Total number of output ports currently in use.

Definition at line 493 of file JackAudioDriver.h.

◆ m_pClient

jack_client_t* m_pClient

Object holding the external client session with the JACK server.

Definition at line 116 of file JackAudioDriver.h.

◆ m_pOutputPort1

jack_port_t* m_pOutputPort1
private

Left source port.

Definition at line 465 of file JackAudioDriver.h.

◆ m_pOutputPort2

jack_port_t* m_pOutputPort2
private

Right source port.

Definition at line 469 of file JackAudioDriver.h.

◆ m_previousJackTransportPos

jack_position_t m_previousJackTransportPos
private

Used for detecting changes in the BBT transport information with external timebase master application, which do not propagate these changes on time.

Definition at line 550 of file JackAudioDriver.h.

◆ m_processCallback

JackProcessCallback m_processCallback
private

Main process callback.

Definition at line 461 of file JackAudioDriver.h.

◆ m_pTrackOutputPortsL

jack_port_t* m_pTrackOutputPortsL[MAX_INSTRUMENTS]
private

Vector of all left audio output ports currently used by the local JACK client.

Definition at line 498 of file JackAudioDriver.h.

◆ m_pTrackOutputPortsR

jack_port_t* m_pTrackOutputPortsR[MAX_INSTRUMENTS]
private

Vector of all right audio output ports currently used by the local JACK client.

Definition at line 503 of file JackAudioDriver.h.

◆ m_sOutputPortName1

QString m_sOutputPortName1
private

Destination of the left source port m_pOutputPort1, for which a connection will be established in connect().

Definition at line 474 of file JackAudioDriver.h.

◆ m_sOutputPortName2

QString m_sOutputPortName2
private

Destination of the right source port m_pOutputPort2, for which a connection will be established in connect().

Definition at line 479 of file JackAudioDriver.h.

◆ m_timebaseState

Timebase m_timebaseState
private

More user-friendly version of m_nTimebaseTracking.

Definition at line 589 of file JackAudioDriver.h.

◆ m_trackMap

int m_trackMap[MAX_INSTRUMENTS][MAX_COMPONENTS]
private

Matrix containing the track number of each component of all instruments.

Its rows represent the instruments and its columns their components. m_trackMap[2][1]=6 thus therefore mean the output of the second component of the third instrument is assigned the seventh output port. Since its total size is defined by MAX_INSTRUMENTS and MAX_COMPONENTS, most of its entries will be zero.

Definition at line 489 of file JackAudioDriver.h.

◆ pJackDriverInstance

JackAudioDriver * pJackDriverInstance = nullptr
static

Instance of the JackAudioDriver.

Definition at line 320 of file JackAudioDriver.h.