hydrogen 1.1.1
OscServer Class Reference

OSC Server implementation. More...

#include <OscServer.h>

Inheritance diagram for OscServer:
Object

Public Member Functions

 ~OscServer ()
 Destructor freeing all addresses in m_pClientRegistry and setting __instance to nullptr. More...
 
bool init ()
 Registers all handler functions. More...
 
bool start ()
 Starts the OSC server and makes it available to handle commands. More...
 
bool stop ()
 Stops the OSC server and makes it unavailable. More...
 
void handleAction (Action *pAction)
 Function called by H2Core::CoreActionController::initExternalControlInterfaces() to inform all clients about the current state of Hydrogen using OSC messages send by Hydrogen itself. More...
 
- Public Member Functions inherited from Object
 ~Object ()
 destructor More...
 
 Object (const Object &obj)
 copy constructor More...
 
 Object (const char *class_name)
 constructor More...
 
const char * class_name () const
 return the class name More...
 
virtual QString toQString (const QString &sPrefix, bool bShort=true) const
 Formatted string version for debugging purposes. More...
 
void Print (bool bShort=true) const
 Prints content of toQString() via DEBUGLOG. More...
 

Static Public Member Functions

static void create_instance (H2Core::Preferences *pPreferences)
 If __instance equals nullptr, a new OscServer singleton will be created by calling the OscServer() constructor and stored in __instance. More...
 
static OscServerget_instance ()
 Returns a pointer to the current OscServer singleton stored in __instance. More...
 
static QString qPrettyPrint (lo_type type, void *data)
 Converts a data data of type type into a printable QString. More...
 
static void PLAY_Handler (lo_arg **argv, int i)
 Creates an Action of type PLAY and passes its references to MidiActionManager::handleAction(). More...
 
static void PLAY_STOP_TOGGLE_Handler (lo_arg **argv, int i)
 Creates an Action of type PLAY/STOP_TOGGLE and passes its references to MidiActionManager::handleAction(). More...
 
static void PLAY_PAUSE_TOGGLE_Handler (lo_arg **argv, int i)
 Creates an Action of type PLAY/PAUSE_TOGGLE and passes its references to MidiActionManager::handleAction(). More...
 
static void STOP_Handler (lo_arg **argv, int i)
 Creates an Action of type STOP and passes its references to MidiActionManager::handleAction(). More...
 
static void PAUSE_Handler (lo_arg **argv, int i)
 Creates an Action of type PAUSE and passes its references to MidiActionManager::handleAction(). More...
 
static void RECORD_READY_Handler (lo_arg **argv, int i)
 Creates an Action of type RECORD_READY and passes its references to MidiActionManager::handleAction(). More...
 
static void RECORD_STROBE_TOGGLE_Handler (lo_arg **argv, int i)
 Creates an Action of type RECORD/STROBE_TOGGLE and passes its references to MidiActionManager::handleAction(). More...
 
static void RECORD_STROBE_Handler (lo_arg **argv, int i)
 Creates an Action of type RECORD_STROBE and passes its references to MidiActionManager::handleAction(). More...
 
static void RECORD_EXIT_Handler (lo_arg **argv, int i)
 Creates an Action of type EXIT and passes its references to MidiActionManager::handleAction(). More...
 
static void MUTE_Handler (lo_arg **argv, int i)
 Creates an Action of type MUTE and passes its references to MidiActionManager::handleAction(). More...
 
static void UNMUTE_Handler (lo_arg **argv, int i)
 Creates an Action of type UNMUTE and passes its references to MidiActionManager::handleAction(). More...
 
static void MUTE_TOGGLE_Handler (lo_arg **argv, int i)
 Creates an Action of type MUTE_TOGGLE and passes its references to MidiActionManager::handleAction(). More...
 
static void NEXT_BAR_Handler (lo_arg **argv, int i)
 Creates an Action of type >>_NEXT_BAR and passes its references to MidiActionManager::handleAction(). More...
 
static void PREVIOUS_BAR_Handler (lo_arg **argv, int i)
 Creates an Action of type <<_PREVIOUS_BAR and passes its references to MidiActionManager::handleAction(). More...
 
static void BPM_INCR_Handler (lo_arg **argv, int i)
 Creates an Action of type BPM_INCR and passes its references to MidiActionManager::handleAction(). More...
 
static void BPM_DECR_Handler (lo_arg **argv, int i)
 Creates an Action of type BPM_DECR and passes its references to MidiActionManager::handleAction(). More...
 
static void MASTER_VOLUME_RELATIVE_Handler (lo_arg **argv, int i)
 Creates an Action of type MASTER_VOLUME_RELATIVE and passes its references to MidiActionManager::handleAction(). More...
 
static void MASTER_VOLUME_ABSOLUTE_Handler (lo_arg **argv, int i)
 Calls H2Core::CoreActionController::setMasterVolume() with the first argument in argv. More...
 
static void STRIP_VOLUME_RELATIVE_Handler (QString param1, QString param2)
 Creates an Action of type STRIP_VOLUME_RELATIVE and passes its references to MidiActionManager::handleAction(). More...
 
static void STRIP_VOLUME_ABSOLUTE_Handler (int param1, float param2)
 Calls H2Core::CoreActionController::setStripVolume() with both param1 and param2. More...
 
static void SELECT_NEXT_PATTERN_Handler (lo_arg **argv, int i)
 Creates an Action of type SELECT_NEXT_PATTERN and passes its references to MidiActionManager::handleAction(). More...
 
static void SELECT_AND_PLAY_PATTERN_Handler (lo_arg **argv, int i)
 Creates an Action of type SELECT_AND_PLAY_PATTERN and passes its references to MidiActionManager::handleAction(). More...
 
static void PAN_RELATIVE_Handler (QString param1, QString param2)
 Creates an Action of type PAN_RELATIVE and passes its references to MidiActionManager::handleAction(). More...
 
static void PAN_ABSOLUTE_Handler (QString param1, QString param2)
 Creates an Action of type PAN_ABSOLTUE and passes its references to MidiActionManager::handleAction(). More...
 
static void FILTER_CUTOFF_LEVEL_ABSOLUTE_Handler (QString param1, QString param2)
 Creates an Action of type FILTER_CUTOFF_LEVEL_ABSOLUTE and passes its references to MidiActionManager::handleAction(). More...
 
static void BEATCOUNTER_Handler (lo_arg **argv, int i)
 Creates an Action of type BEATCOUNTER and passes its references to MidiActionManager::handleAction(). More...
 
static void TAP_TEMPO_Handler (lo_arg **argv, int i)
 Creates an Action of type TAP_TEMPO and passes its references to MidiActionManager::handleAction(). More...
 
static void PLAYLIST_SONG_Handler (lo_arg **argv, int i)
 Creates an Action of type PLAYLIST_SONG and passes its references to MidiActionManager::handleAction(). More...
 
static void PLAYLIST_NEXT_SONG_Handler (lo_arg **argv, int i)
 Creates an Action of type PLAYLIST_NEXT_SONG and passes its references to MidiActionManager::handleAction(). More...
 
static void PLAYLIST_PREV_SONG_Handler (lo_arg **argv, int i)
 Creates an Action of type PLAYLIST_PREV_SONG and passes its references to MidiActionManager::handleAction(). More...
 
static void TOGGLE_METRONOME_Handler (lo_arg **argv, int i)
 Creates an Action of type TOGGLE_METRONOME and passes its references to MidiActionManager::handleAction(). More...
 
static void SELECT_INSTRUMENT_Handler (lo_arg **argv, int i)
 Creates an Action of type SELECT_INSTRUMENT and passes its references to MidiActionManager::handleAction(). More...
 
static void UNDO_ACTION_Handler (lo_arg **argv, int i)
 Creates an Action of type UNDO_ACTION and passes its references to MidiActionManager::handleAction(). More...
 
static void REDO_ACTION_Handler (lo_arg **argv, int argc)
 Creates an Action of type REDO_ACTION and passes its references to MidiActionManager::handleAction(). More...
 
static void NEW_SONG_Handler (lo_arg **argv, int argc)
 Triggers CoreActionController::newSong(). More...
 
static void OPEN_SONG_Handler (lo_arg **argv, int argc)
 Triggers CoreActionController::openSong(). More...
 
static void SAVE_SONG_Handler (lo_arg **argv, int argc)
 Triggers CoreActionController::saveSong(). More...
 
static void SAVE_SONG_AS_Handler (lo_arg **argv, int argc)
 Triggers CoreActionController::saveSongAs(). More...
 
static void SAVE_PREFERENCES_Handler (lo_arg **argv, int argc)
 Triggers CoreActionController::savePreferences(). More...
 
static void QUIT_Handler (lo_arg **argv, int argc)
 Triggers CoreActionController::quit(). More...
 
static void TIMELINE_ACTIVATION_Handler (lo_arg **argv, int argc)
 Triggers CoreActionController::activateTimeline(). More...
 
static void TIMELINE_ADD_MARKER_Handler (lo_arg **argv, int argc)
 Triggers CoreActionController::addTempoMarker(). More...
 
static void TIMELINE_DELETE_MARKER_Handler (lo_arg **argv, int argc)
 Triggers CoreActionController::deleteTempoMarker(). More...
 
static void JACK_TRANSPORT_ACTIVATION_Handler (lo_arg **argv, int argc)
 Triggers CoreActionController::activatedJackTransport(). More...
 
static void JACK_TIMEBASE_MASTER_ACTIVATION_Handler (lo_arg **argv, int argc)
 Triggers CoreActionController::activateJackTimebaseMaster(). More...
 
static void SONG_MODE_ACTIVATION_Handler (lo_arg **argv, int argc)
 Triggers CoreActionController::activateSongMode(). More...
 
static void LOOP_MODE_ACTIVATION_Handler (lo_arg **argv, int argc)
 Triggers CoreActionController::activateLoopMode(). More...
 
static void RELOCATE_Handler (lo_arg **argv, int argc)
 Triggers CoreActionController::relocateToPattern(). More...
 
static int generic_handler (const char *path, const char *types, lo_arg **argv, int argc, void *data, void *user_data)
 Catches any incoming messages and display them. More...
 
- Static Public Member Functions inherited from Object
static void set_count (bool flag)
 enable/disable class instances counting More...
 
static bool count_active ()
 return true if class instances counting is enabled More...
 
static unsigned objects_count ()
 return the number of objects More...
 
static void write_objects_map_to (std::ostream &out)
 output the full objects map to a given ostream More...
 
static void write_objects_map_to_cerr ()
 output objects map to stderr More...
 
static int bootstrap (Logger *logger, bool count=false)
 must be called before any Object instantiation ! More...
 
static Loggerlogger ()
 return the logger instance More...
 

Static Public Attributes

static OscServer__instance = nullptr
 Object holding the current OscServer singleton. More...
 
- Static Public Attributes inherited from Object
static QString sPrintIndention = " "
 String used to format the debugging string output of some core classes. More...
 

Private Member Functions

 OscServer (H2Core::Preferences *pPreferences)
 Private constructor creating a new OSC server thread using the port H2Core::Preferences::m_nOscServerPort and assigning the object to m_pServerThread. More...
 
void broadcastMessage (const char *msgText, lo_message message)
 Helper function which sends a message with msgText to all connected clients. More...
 

Private Attributes

H2Core::Preferencesm_pPreferences
 Pointer to the H2Core::Preferences singleton. More...
 
bool m_bInitialized
 Used to determine whether the callback methods were already added to m_pServerThread. More...
 
lo::ServerThread * m_pServerThread
 Object containing the actual thread with an OSC server running in. More...
 
std::list< lo_address > m_pClientRegistry
 List of all OSC clients known to Hydrogen. More...
 

Additional Inherited Members

- Static Protected Attributes inherited from Object
static Logger__logger = nullptr
 logger instance pointer More...
 

Detailed Description

OSC Server implementation.

Open Sound Control (OSC) is a protocol for communication among programs, computers, and hardware, like synthesizers or multimedia devices, via networking protocols such as UDP or TCP. It can be thought of as a replacement for the MIDI protocol with rich benefits, like supporting symbolic and high-resolution numerical argument data, providing an URL-style naming scheme in combination with a pattern matching language, and allowing to bundle messages for a better handling of timing and simultaneous processing.

The OscServer class provides an implementation of an OSC server running in a separate thread and handling all incoming and outgoing OSC messages send to or from Hydrogen. Its naming scheme starts with the prefix /Hydrogen/ followed by the name of one of the handler functions implemented as members of this class without the _Handler() prefix. Sending an OSC message to the path /Hydrogen/PAUSE will thus trigger the PAUSE_Handler() to pause the playback. You can play with these features using the command line program oscsend on UNIX-based systems.

Internally, the OscServer is implemented as a singleton and will be created using create_instance() and queried using get_instance(). Using start() all handler functions will be registered to their corresponding paths and the OSC server thread will start to listen for incoming messages. But this will only happen if H2Core::Preferences::m_bOscServerEnabled is set to true. In addition, Hydrogen will send OSC messages about its current state to all clients each time its state changes if H2Core::Preferences::m_bOscFeedbackEnabled is set to true. H2Core::Preferences::m_nOscServerPort contains the port number the OSC server will be started at.

Please note that the way generic_handler() is implemented, the additional registration of commands without argument to require a float input, and the usage of float arguments instead of int are all because of the limitations of TouchOSC.

Author
Sebastian Moors

Constructor & Destructor Documentation

◆ ~OscServer()

~OscServer ( )

Destructor freeing all addresses in m_pClientRegistry and setting __instance to nullptr.

◆ OscServer()

OscServer ( H2Core::Preferences pPreferences)
private

Private constructor creating a new OSC server thread using the port H2Core::Preferences::m_nOscServerPort and assigning the object to m_pServerThread.

Parameters
pPreferencesPointer to the H2Core::Preferences singleton. Although it could be accessed internally using H2Core::Preferences::get_instance(), this is an appetizer for internal changes happening after the 1.0 release.

Member Function Documentation

◆ BEATCOUNTER_Handler()

void BEATCOUNTER_Handler ( lo_arg **  argv,
int  i 
)
static

Creates an Action of type BEATCOUNTER and passes its references to MidiActionManager::handleAction().

Parameters
argvUnused pointer to a vector of arguments passed by the OSC message.
iUnused number of arguments passed by the OSC message.

◆ BPM_DECR_Handler()

void BPM_DECR_Handler ( lo_arg **  argv,
int  i 
)
static

Creates an Action of type BPM_DECR and passes its references to MidiActionManager::handleAction().

The first argument in argv will be used to set Action::parameter1.

Parameters
argvPointer to a vector of arguments passed by the OSC message.
iUnused number of arguments passed by the OSC message.

◆ BPM_INCR_Handler()

void BPM_INCR_Handler ( lo_arg **  argv,
int  i 
)
static

Creates an Action of type BPM_INCR and passes its references to MidiActionManager::handleAction().

The first argument in argv will be used to set Action::parameter1.

Parameters
argvPointer to a vector of arguments passed by the OSC message.
iUnused number of arguments passed by the OSC message.

◆ broadcastMessage()

void broadcastMessage ( const char *  msgText,
lo_message  message 
)
private

Helper function which sends a message with msgText to all connected clients.

◆ create_instance()

void create_instance ( H2Core::Preferences pPreferences)
static

If __instance equals nullptr, a new OscServer singleton will be created by calling the OscServer() constructor and stored in __instance.

It is called in H2Core::Hydrogen::create_instance().

Parameters
pPreferencesPointer to the H2Core::Preferences singleton. Although it could be accessed internally using H2Core::Preferences::get_instance(), this is an appetizer for internal changes happening after the 1.0 release.

◆ FILTER_CUTOFF_LEVEL_ABSOLUTE_Handler()

void FILTER_CUTOFF_LEVEL_ABSOLUTE_Handler ( QString  param1,
QString  param2 
)
static

Creates an Action of type FILTER_CUTOFF_LEVEL_ABSOLUTE and passes its references to MidiActionManager::handleAction().

Parameters
param1Sets Action::parameter1 of the newly created Action.
param2Sets Action::parameter2 of the newly created Action.

◆ generic_handler()

int generic_handler ( const char *  path,
const char *  types,
lo_arg **  argv,
int  argc,
void *  data,
void *  user_data 
)
static

Catches any incoming messages and display them.

It is also responsible for catching OSC messages at the following paths and invoking the corresponding functions (if only a single argument is present.)

  • /Hydrogen/STRIP_VOLUME_ABSOLUTE/[x]
  • /Hydrogen/PAN_ABSOLUTE/[x]
  • /Hydrogen/PAN_RELATIVE/[x]
  • /Hydrogen/FILTER_CUTOFF_LEVEL_ABSOLUTE/[x]
  • /Hydrogen/STRIP_MUTE_TOGGLE/[x]
  • /Hydrogen/STRIP_SOLO_TOGGLE/[x]

[x] Digit specifying a particular instrument.

Parameters
pathThe OSC path to register the method to. If NULL is passed the method will match all paths.
typesThe typespec the method accepts. In Hydrogen handler functions are registered to listen for floats.
argvPointer to a vector of arguments passed by the OSC message.
argcNumber of arguments passed by the OSC message.
dataUnused.
user_dataUnused.
Returns
1 - means that the message has not been fully handled and the server should try other methods

◆ get_instance()

static OscServer * get_instance ( )
inlinestatic

Returns a pointer to the current OscServer singleton stored in __instance.

◆ handleAction()

void handleAction ( Action pAction)

Function called by H2Core::CoreActionController::initExternalControlInterfaces() to inform all clients about the current state of Hydrogen using OSC messages send by Hydrogen itself.

The following feedback functions will be used to describe the aforementioned state:

[*] Function will be called for all Instruments in H2Core::Song::__instrument_list.

The constructed messages will contain the Action::parameter2 of pAction as float types (or Action::parameter1 for the actions TOGGLE_METRONOME and MUTE_TOGGLE) and will be associated with one of the following paths:

  • /Hydrogen/MASTER_VOLUME_ABSOLUTE
  • /Hydrogen/TOGGLE_METRONOME
  • /Hydrogen/MUTE_TOGGLE
  • /Hydrogen/STRIP_VOLUME_ABSOLUTE/[x]
  • /Hydrogen/STRIP_VOLUME_RELATIVE/[x]
  • /Hydrogen/PAN_ABSOLUTE/[x]
  • /Hydrogen/STRIP_MUTE_TOGGLE/[x]
  • /Hydrogen/STRIP_SOLO_TOGGLE/[x]

[x] The last part of the URI is determined by Action::parameter1 and specifies an individual strip.

Only called if H2Core::Preferences::m_bOscServerEnabled is true.

Parameters
pActionAction to be sent to all registered clients.

◆ init()

bool init ( )

Registers all handler functions.

The path the handlers will be registered at always starts with /Hydrogen/ followed by the name of the handler function without the suffix _Handler. PLAY_Handler() will thus be registered to /Hydrogen/PLAY.

Most handler will be registered for both types "" and "f" (floats). But the following handlers will be registered for floats only:

In case of the session managing handlers the following ones only work with no argument present

The generic_handler() will be registered to match all paths and types.

In addition, a lambda function will be registered to match all types and paths too. If the client has not sent any message to Hydrogen yet, it will take care of its registration to m_pClientRegistry using the address of the received OSC message. More importantly, it also will call H2Core::CoreActionController::initExternalControlInterfaces(), which, apart from MIDI related stuff, use handleAction() to push the current state of Hydrogen to the registered OSC clients. This will happen each time the state of Hydrogen does change.

Returns
true on success.

◆ JACK_TIMEBASE_MASTER_ACTIVATION_Handler()

void JACK_TIMEBASE_MASTER_ACTIVATION_Handler ( lo_arg **  argv,
int  argc 
)
static

Triggers CoreActionController::activateJackTimebaseMaster().

Parameters
argvThe "i" field does contain the value supplied by the user. If it is 0, the Jack timebase master will be deactivated. Else, it will be activated instead.
argcUnused number of arguments passed by the OSC message.

◆ JACK_TRANSPORT_ACTIVATION_Handler()

void JACK_TRANSPORT_ACTIVATION_Handler ( lo_arg **  argv,
int  argc 
)
static

Triggers CoreActionController::activatedJackTransport().

Parameters
argvThe "i" field does contain the value supplied by the user. If it is 0, the Jack transport will be deactivated. Else, it will be activated instead.
argcUnused number of arguments passed by the OSC message.

◆ LOOP_MODE_ACTIVATION_Handler()

void LOOP_MODE_ACTIVATION_Handler ( lo_arg **  argv,
int  argc 
)
static

Triggers CoreActionController::activateLoopMode().

Parameters
argvThe "i" field does contain the value supplied by the user. If it is 0, loop mode will be deactivated. Else, it will be activated instead.
argcUnused number of arguments passed by the OSC message.

◆ MASTER_VOLUME_ABSOLUTE_Handler()

void MASTER_VOLUME_ABSOLUTE_Handler ( lo_arg **  argv,
int  i 
)
static

Calls H2Core::CoreActionController::setMasterVolume() with the first argument in argv.

Parameters
argvPointer to a vector of arguments passed by the OSC message.
iUnused number of arguments passed by the OSC message.

◆ MASTER_VOLUME_RELATIVE_Handler()

void MASTER_VOLUME_RELATIVE_Handler ( lo_arg **  argv,
int  i 
)
static

Creates an Action of type MASTER_VOLUME_RELATIVE and passes its references to MidiActionManager::handleAction().

The first argument in argv will be used to set Action::parameter2.

Parameters
argvPointer to a vector of arguments passed by the OSC message.
iUnused number of arguments passed by the OSC message.

◆ MUTE_Handler()

void MUTE_Handler ( lo_arg **  argv,
int  i 
)
static

Creates an Action of type MUTE and passes its references to MidiActionManager::handleAction().

Parameters
argvUnused pointer to a vector of arguments passed by the OSC message.
iUnused number of arguments passed by the OSC message.

◆ MUTE_TOGGLE_Handler()

void MUTE_TOGGLE_Handler ( lo_arg **  argv,
int  i 
)
static

Creates an Action of type MUTE_TOGGLE and passes its references to MidiActionManager::handleAction().

Parameters
argvUnused pointer to a vector of arguments passed by the OSC message.
iUnused number of arguments passed by the OSC message.

◆ NEW_SONG_Handler()

void NEW_SONG_Handler ( lo_arg **  argv,
int  argc 
)
static

Triggers CoreActionController::newSong().

The handler expects the user to provide an absolute path to a .h2song file. If another file already exists with the same name, it will be overwritten.

Parameters
argvUnused pointer to a vector of arguments passed by the OSC message.
argcNumber of arguments passed by the OSC message.

◆ NEXT_BAR_Handler()

void NEXT_BAR_Handler ( lo_arg **  argv,
int  i 
)
static

Creates an Action of type >>_NEXT_BAR and passes its references to MidiActionManager::handleAction().

Parameters
argvUnused pointer to a vector of arguments passed by the OSC message.
iUnused number of arguments passed by the OSC message.

◆ OPEN_SONG_Handler()

void OPEN_SONG_Handler ( lo_arg **  argv,
int  argc 
)
static

Triggers CoreActionController::openSong().

The handler expects the user to provide an absolute path to a .h2song file.

Parameters
argvUnused pointer to a vector of arguments passed by the OSC message.
argcNumber of arguments passed by the OSC message.

◆ PAN_ABSOLUTE_Handler()

void PAN_ABSOLUTE_Handler ( QString  param1,
QString  param2 
)
static

Creates an Action of type PAN_ABSOLTUE and passes its references to MidiActionManager::handleAction().

Parameters
param1Sets Action::parameter1 of the newly created Action.
param2Sets Action::parameter2 of the newly created Action.

◆ PAN_RELATIVE_Handler()

void PAN_RELATIVE_Handler ( QString  param1,
QString  param2 
)
static

Creates an Action of type PAN_RELATIVE and passes its references to MidiActionManager::handleAction().

Parameters
param1Sets Action::parameter1 of the newly created Action.
param2Sets Action::parameter2 of the newly created Action.

◆ PAUSE_Handler()

void PAUSE_Handler ( lo_arg **  argv,
int  i 
)
static

Creates an Action of type PAUSE and passes its references to MidiActionManager::handleAction().

Parameters
argvUnused pointer to a vector of arguments passed by the OSC message.
iUnused number of arguments passed by the OSC message.

◆ PLAY_Handler()

void PLAY_Handler ( lo_arg **  argv,
int  i 
)
static

Creates an Action of type PLAY and passes its references to MidiActionManager::handleAction().

Parameters
argvUnused pointer to a vector of arguments passed by the OSC message.
iUnused number of arguments passed by the OSC message.

◆ PLAY_PAUSE_TOGGLE_Handler()

void PLAY_PAUSE_TOGGLE_Handler ( lo_arg **  argv,
int  i 
)
static

Creates an Action of type PLAY/PAUSE_TOGGLE and passes its references to MidiActionManager::handleAction().

Parameters
argvUnused pointer to a vector of arguments passed by the OSC message.
iUnused number of arguments passed by the OSC message.

◆ PLAY_STOP_TOGGLE_Handler()

void PLAY_STOP_TOGGLE_Handler ( lo_arg **  argv,
int  i 
)
static

Creates an Action of type PLAY/STOP_TOGGLE and passes its references to MidiActionManager::handleAction().

Parameters
argvUnused pointer to a vector of arguments passed by the OSC message.
iUnused number of arguments passed by the OSC message.

◆ PLAYLIST_NEXT_SONG_Handler()

void PLAYLIST_NEXT_SONG_Handler ( lo_arg **  argv,
int  i 
)
static

Creates an Action of type PLAYLIST_NEXT_SONG and passes its references to MidiActionManager::handleAction().

Parameters
argvUnused pointer to a vector of arguments passed by the OSC message.
iUnused number of arguments passed by the OSC message.

◆ PLAYLIST_PREV_SONG_Handler()

void PLAYLIST_PREV_SONG_Handler ( lo_arg **  argv,
int  i 
)
static

Creates an Action of type PLAYLIST_PREV_SONG and passes its references to MidiActionManager::handleAction().

Parameters
argvUnused pointer to a vector of arguments passed by the OSC message.
iUnused number of arguments passed by the OSC message.

◆ PLAYLIST_SONG_Handler()

void PLAYLIST_SONG_Handler ( lo_arg **  argv,
int  i 
)
static

Creates an Action of type PLAYLIST_SONG and passes its references to MidiActionManager::handleAction().

The first argument in argv will be used to set Action::parameter1.

Parameters
argvPointer to a vector of arguments passed by the OSC message.
iUnused number of arguments passed by the OSC message.

◆ PREVIOUS_BAR_Handler()

void PREVIOUS_BAR_Handler ( lo_arg **  argv,
int  i 
)
static

Creates an Action of type <<_PREVIOUS_BAR and passes its references to MidiActionManager::handleAction().

Parameters
argvUnused pointer to a vector of arguments passed by the OSC message.
iUnused number of arguments passed by the OSC message.

◆ qPrettyPrint()

QString qPrettyPrint ( lo_type  type,
void *  data 
)
static

Converts a data data of type type into a printable QString.

Apart from the basic OSC types LO_INT32, LO_FLOAT, and LO_STRING the following extended OSC types are supported:

  • LO_INT64
  • LO_TIMETAG
  • LO_DOUBLE
  • LO_SYMBOL
  • LO_CHAR
  • LO_TRUE
  • LO_FALSE
  • LO_NIL
  • LO_INFINITUM

LO_BLOB and LO_MIDI are, however, NOT supported.

Parameters
typeLiblo class data will be cast to.
dataData to be converted to string.
Returns
QString representation of data.

◆ QUIT_Handler()

void QUIT_Handler ( lo_arg **  argv,
int  argc 
)
static

Triggers CoreActionController::quit().

Parameters
argvUnused pointer to a vector of arguments passed by the OSC message.
argcUnused number of arguments passed by the OSC message.

◆ RECORD_EXIT_Handler()

void RECORD_EXIT_Handler ( lo_arg **  argv,
int  i 
)
static

Creates an Action of type EXIT and passes its references to MidiActionManager::handleAction().

Parameters
argvUnused pointer to a vector of arguments passed by the OSC message.
iUnused number of arguments passed by the OSC message.

◆ RECORD_READY_Handler()

void RECORD_READY_Handler ( lo_arg **  argv,
int  i 
)
static

Creates an Action of type RECORD_READY and passes its references to MidiActionManager::handleAction().

Parameters
argvUnused pointer to a vector of arguments passed by the OSC message.
iUnused number of arguments passed by the OSC message.

◆ RECORD_STROBE_Handler()

void RECORD_STROBE_Handler ( lo_arg **  argv,
int  i 
)
static

Creates an Action of type RECORD_STROBE and passes its references to MidiActionManager::handleAction().

Parameters
argvUnused pointer to a vector of arguments passed by the OSC message.
iUnused number of arguments passed by the OSC message.

◆ RECORD_STROBE_TOGGLE_Handler()

void RECORD_STROBE_TOGGLE_Handler ( lo_arg **  argv,
int  i 
)
static

Creates an Action of type RECORD/STROBE_TOGGLE and passes its references to MidiActionManager::handleAction().

Parameters
argvUnused pointer to a vector of arguments passed by the OSC message.
iUnused number of arguments passed by the OSC message.

◆ REDO_ACTION_Handler()

void REDO_ACTION_Handler ( lo_arg **  argv,
int  argc 
)
static

Creates an Action of type REDO_ACTION and passes its references to MidiActionManager::handleAction().

Parameters
argvUnused pointer to a vector of arguments passed by the OSC message.
argcNumber of arguments passed by the OSC message.

◆ RELOCATE_Handler()

void RELOCATE_Handler ( lo_arg **  argv,
int  argc 
)
static

Triggers CoreActionController::relocateToPattern().

Parameters
argvThe "i" field does contain the desired position / number of the pattern group (starting with 0).
argcUnused number of arguments passed by the OSC message.

◆ SAVE_PREFERENCES_Handler()

void SAVE_PREFERENCES_Handler ( lo_arg **  argv,
int  argc 
)
static

Triggers CoreActionController::savePreferences().

Parameters
argvUnused pointer to a vector of arguments passed by the OSC message.
argcUnused number of arguments passed by the OSC message.

◆ SAVE_SONG_AS_Handler()

void SAVE_SONG_AS_Handler ( lo_arg **  argv,
int  argc 
)
static

Triggers CoreActionController::saveSongAs().

The handler expects the user to provide an absolute path to a .h2song file. If another file already exists with the same name, it will be overwritten.

Parameters
argvUnused pointer to a vector of arguments passed by the OSC message.
argcNumber of arguments passed by the OSC message.

◆ SAVE_SONG_Handler()

void SAVE_SONG_Handler ( lo_arg **  argv,
int  argc 
)
static

Triggers CoreActionController::saveSong().

Parameters
argvUnused pointer to a vector of arguments passed by the OSC message.
argcUnused number of arguments passed by the OSC message.

◆ SELECT_AND_PLAY_PATTERN_Handler()

void SELECT_AND_PLAY_PATTERN_Handler ( lo_arg **  argv,
int  i 
)
static

Creates an Action of type SELECT_AND_PLAY_PATTERN and passes its references to MidiActionManager::handleAction().

The first argument in argv will be used to set Action::parameter1.

Parameters
argvPointer to a vector of arguments passed by the OSC message.
iUnused number of arguments passed by the OSC message.

◆ SELECT_INSTRUMENT_Handler()

void SELECT_INSTRUMENT_Handler ( lo_arg **  argv,
int  i 
)
static

Creates an Action of type SELECT_INSTRUMENT and passes its references to MidiActionManager::handleAction().

The first argument in argv will be used to set Action::parameter2.

Parameters
argvPointer to a vector of arguments passed by the OSC message.
iUnused number of arguments passed by the OSC message.

◆ SELECT_NEXT_PATTERN_Handler()

void SELECT_NEXT_PATTERN_Handler ( lo_arg **  argv,
int  i 
)
static

Creates an Action of type SELECT_NEXT_PATTERN and passes its references to MidiActionManager::handleAction().

The first argument in argv will be used to set Action::parameter1.

Parameters
argvPointer to a vector of arguments passed by the OSC message.
iUnused number of arguments passed by the OSC message.

◆ SONG_MODE_ACTIVATION_Handler()

void SONG_MODE_ACTIVATION_Handler ( lo_arg **  argv,
int  argc 
)
static

Triggers CoreActionController::activateSongMode().

Parameters
argvThe "i" field does contain the value supplied by the user. If it is 0, Pattern mode of the playback will be activated. Else, Song mode will be activated instead.
argcUnused number of arguments passed by the OSC message.

◆ start()

bool start ( )

Starts the OSC server and makes it available to handle commands.

If the server was not properly initialized, this function will do so.

Returns
true on success

◆ stop()

bool stop ( )

Stops the OSC server and makes it unavailable.

Returns
true on success

◆ STOP_Handler()

void STOP_Handler ( lo_arg **  argv,
int  i 
)
static

Creates an Action of type STOP and passes its references to MidiActionManager::handleAction().

Parameters
argvUnused pointer to a vector of arguments passed by the OSC message.
iUnused number of arguments passed by the OSC message.

◆ STRIP_VOLUME_ABSOLUTE_Handler()

void STRIP_VOLUME_ABSOLUTE_Handler ( int  param1,
float  param2 
)
static

Calls H2Core::CoreActionController::setStripVolume() with both param1 and param2.

Parameters
param1Passed as first argument to H2Core::CoreActionController::setStripVolume().
param2Passed as second argument to H2Core::CoreActionController::setStripVolume().

◆ STRIP_VOLUME_RELATIVE_Handler()

void STRIP_VOLUME_RELATIVE_Handler ( QString  param1,
QString  param2 
)
static

Creates an Action of type STRIP_VOLUME_RELATIVE and passes its references to MidiActionManager::handleAction().

Parameters
param1Sets Action::parameter1 of the newly created Action.
param2Sets Action::parameter2 of the newly created Action.

◆ TAP_TEMPO_Handler()

void TAP_TEMPO_Handler ( lo_arg **  argv,
int  i 
)
static

Creates an Action of type TAP_TEMPO and passes its references to MidiActionManager::handleAction().

Parameters
argvUnused pointer to a vector of arguments passed by the OSC message.
iUnused number of arguments passed by the OSC message.

◆ TIMELINE_ACTIVATION_Handler()

void TIMELINE_ACTIVATION_Handler ( lo_arg **  argv,
int  argc 
)
static

Triggers CoreActionController::activateTimeline().

Parameters
argvThe "i" field does contain the value supplied by the user. If it is 0, the Timeline will be deactivated. Else, it will be activated instead.
argcUnused number of arguments passed by the OSC message.

◆ TIMELINE_ADD_MARKER_Handler()

void TIMELINE_ADD_MARKER_Handler ( lo_arg **  argv,
int  argc 
)
static

Triggers CoreActionController::addTempoMarker().

Parameters
argvThe first field "i" does contain the bar at which to place the new Timeline::TempoMarker while the second one "f" specifies its tempo in bpm.
argcUnused number of arguments passed by the OSC message.

◆ TIMELINE_DELETE_MARKER_Handler()

void TIMELINE_DELETE_MARKER_Handler ( lo_arg **  argv,
int  argc 
)
static

Triggers CoreActionController::deleteTempoMarker().

Parameters
argvThe first field "i" does contain the bar at which to delete a Timeline::TempoMarker.
argcUnused number of arguments passed by the OSC message.

◆ TOGGLE_METRONOME_Handler()

void TOGGLE_METRONOME_Handler ( lo_arg **  argv,
int  i 
)
static

Creates an Action of type TOGGLE_METRONOME and passes its references to MidiActionManager::handleAction().

Parameters
argvUnused pointer to a vector of arguments passed by the OSC message.
iUnused number of arguments passed by the OSC message.

◆ UNDO_ACTION_Handler()

void UNDO_ACTION_Handler ( lo_arg **  argv,
int  i 
)
static

Creates an Action of type UNDO_ACTION and passes its references to MidiActionManager::handleAction().

Parameters
argvUnused pointer to a vector of arguments passed by the OSC message.
iUnused number of arguments passed by the OSC message.

◆ UNMUTE_Handler()

void UNMUTE_Handler ( lo_arg **  argv,
int  i 
)
static

Creates an Action of type UNMUTE and passes its references to MidiActionManager::handleAction().

Parameters
argvUnused pointer to a vector of arguments passed by the OSC message.
iUnused number of arguments passed by the OSC message.

Field Documentation

◆ __instance

OscServer * __instance = nullptr
static

Object holding the current OscServer singleton.

It is initialized with nullptr, set with create_instance(), and accessed with get_instance().

◆ m_bInitialized

bool m_bInitialized
private

Used to determine whether the callback methods were already added to m_pServerThread.

◆ m_pClientRegistry

std::list<lo_address> m_pClientRegistry
private

List of all OSC clients known to Hydrogen.

Whenever an OSC client sends a message to the started OSC server of Hydrogen, a lambda handler registered in start() will check whether the address of this client is already present in m_pClientRegistry. If this is not the case it will be added to it and the current state Hydrogen will be propagated to all registered clients.

◆ m_pPreferences

H2Core::Preferences* m_pPreferences
private

Pointer to the H2Core::Preferences singleton.

Although it could be accessed internally using H2Core::Preferences::get_instance(), this is an appetizer for internal changes happening after the 1.0 release.

◆ m_pServerThread

lo::ServerThread* m_pServerThread
private

Object containing the actual thread with an OSC server running in.

It is created in OscServer() and both assigned handlers and started in start().