hydrogen 1.2.3
OscServer Class Reference

OSC Server implementation. More...

#include <OscServer.h>

Inheritance diagram for OscServer:
Object< OscServer > Base

Public Member Functions

 ~OscServer ()
 Destructor freeing all addresses in m_pClientRegistry and setting __instance to nullptr.
 
void handleAction (std::shared_ptr< 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.
 
bool init ()
 Registers all handler functions.
 
bool start ()
 Starts the OSC server and makes it available to handle commands.
 
bool stop ()
 Stops the OSC server and makes it unavailable.
 
- Public Member Functions inherited from Object< OscServer >
 Object ()
 
 Object (const Object< OscServer > &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.
 

Static Public Member Functions

static void BEATCOUNTER_Handler (lo_arg **argv, int i)
 Creates an Action of type BEATCOUNTER and passes its references to MidiActionManager::handleAction().
 
static void BPM_DECR_Handler (lo_arg **argv, int i)
 Creates an Action of type BPM_DECR and passes its references to MidiActionManager::handleAction().
 
static void BPM_Handler (lo_arg **argv, int i)
 Creates sets the current tempo of Hydrogen to the provided value (first argument in argv).
 
static void BPM_INCR_Handler (lo_arg **argv, int i)
 Creates an Action of type BPM_INCR and passes its references to MidiActionManager::handleAction().
 
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.
 
static void EXTRACT_DRUMKIT_Handler (lo_arg **argv, int argc)
 Triggers CoreActionController::extractDrumkit().
 
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().
 
static int generic_handler (const char *path, const char *types, lo_arg **argv, int argc, lo_message data, void *user_data)
 Catches any incoming messages and display them.
 
static OscServerget_instance ()
 Returns a pointer to the current OscServer singleton stored in __instance.
 
static int incomingMessageLogging (const char *path, const char *types, lo_arg **argv, int argc, lo_message data, void *user_data)
 
static void JACK_TIMEBASE_MASTER_ACTIVATION_Handler (lo_arg **argv, int argc)
 Triggers CoreActionController::activateJackTimebaseMaster().
 
static void JACK_TRANSPORT_ACTIVATION_Handler (lo_arg **argv, int argc)
 Triggers CoreActionController::activatedJackTransport().
 
static void LOAD_DRUMKIT_Handler (lo_arg **argv, int argc)
 Triggers CoreActionController::setDrumkit().
 
static void LOOP_MODE_ACTIVATION_Handler (lo_arg **argv, int argc)
 Triggers CoreActionController::activateLoopMode().
 
static void MASTER_VOLUME_ABSOLUTE_Handler (lo_arg **argv, int i)
 Calls H2Core::CoreActionController::setMasterVolume() with the first argument in argv.
 
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().
 
static void MUTE_Handler (lo_arg **argv, int i)
 Creates an Action of type MUTE and passes its references to MidiActionManager::handleAction().
 
static void MUTE_TOGGLE_Handler (lo_arg **argv, int i)
 Creates an Action of type MUTE_TOGGLE and passes its references to MidiActionManager::handleAction().
 
static void NEW_PATTERN_Handler (lo_arg **argv, int argc)
 Triggers CoreActionController::newSong().
 
static void NEW_SONG_Handler (lo_arg **argv, int argc)
 Triggers CoreActionController::newSong().
 
static void NEXT_BAR_Handler (lo_arg **argv, int i)
 Creates an Action of type >>_NEXT_BAR and passes its references to MidiActionManager::handleAction().
 
static void OPEN_PATTERN_Handler (lo_arg **argv, int argc)
 Triggers CoreActionController::openPattern().
 
static void OPEN_SONG_Handler (lo_arg **argv, int argc)
 Triggers CoreActionController::openSong().
 
static void PAUSE_Handler (lo_arg **argv, int i)
 Creates an Action of type PAUSE and passes its references to MidiActionManager::handleAction().
 
static void PLAY_Handler (lo_arg **argv, int i)
 Creates an Action of type PLAY and passes its references to MidiActionManager::handleAction().
 
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().
 
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().
 
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().
 
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().
 
static void PLAYLIST_SONG_Handler (lo_arg **argv, int i)
 Creates an Action of type PLAYLIST_SONG and passes its references to MidiActionManager::handleAction().
 
static void PREVIOUS_BAR_Handler (lo_arg **argv, int i)
 Creates an Action of type <<_PREVIOUS_BAR and passes its references to MidiActionManager::handleAction().
 
static QString qPrettyPrint (lo_type type, void *data)
 Converts a data data of type type into a printable QString.
 
static void QUIT_Handler (lo_arg **argv, int argc)
 Triggers CoreActionController::quit().
 
static void RECORD_EXIT_Handler (lo_arg **argv, int i)
 Creates an Action of type EXIT and passes its references to MidiActionManager::handleAction().
 
static void RECORD_READY_Handler (lo_arg **argv, int i)
 Creates an Action of type RECORD_READY and passes its references to MidiActionManager::handleAction().
 
static void RECORD_STROBE_Handler (lo_arg **argv, int i)
 Creates an Action of type RECORD_STROBE and passes its references to MidiActionManager::handleAction().
 
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().
 
static void REDO_ACTION_Handler (lo_arg **argv, int argc)
 Creates an Action of type REDO_ACTION and passes its references to MidiActionManager::handleAction().
 
static void RELOCATE_Handler (lo_arg **argv, int argc)
 
static void REMOVE_PATTERN_Handler (lo_arg **argv, int argc)
 Triggers CoreActionController::removePattern().
 
static void SAVE_PREFERENCES_Handler (lo_arg **argv, int argc)
 Triggers CoreActionController::savePreferences().
 
static void SAVE_SONG_AS_Handler (lo_arg **argv, int argc)
 Triggers CoreActionController::saveSongAs().
 
static void SAVE_SONG_Handler (lo_arg **argv, int argc)
 Triggers CoreActionController::saveSong().
 
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().
 
static void SELECT_INSTRUMENT_Handler (lo_arg **argv, int i)
 Creates an Action of type SELECT_INSTRUMENT and passes its references to MidiActionManager::handleAction().
 
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().
 
static void SELECT_ONLY_NEXT_PATTERN_Handler (lo_arg **argv, int i)
 Creates an Action of type SELECT_ONLY_NEXT_PATTERN and passes its references to MidiActionManager::handleAction().
 
static void SONG_EDITOR_TOGGLE_GRID_CELL_Handler (lo_arg **argv, int argc)
 Triggers CoreActionController::songEditorToggleGridCell().
 
static void SONG_MODE_ACTIVATION_Handler (lo_arg **argv, int argc)
 Triggers CoreActionController::activateSongMode().
 
static void STOP_Handler (lo_arg **argv, int i)
 Creates an Action of type STOP and passes its references to MidiActionManager::handleAction().
 
static void STRIP_VOLUME_ABSOLUTE_Handler (int param1, float param2)
 Calls H2Core::CoreActionController::setStripVolume() with both param1 and param2.
 
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().
 
static void TAP_TEMPO_Handler (lo_arg **argv, int i)
 Creates an Action of type TAP_TEMPO and passes its references to MidiActionManager::handleAction().
 
static void TIMELINE_ACTIVATION_Handler (lo_arg **argv, int argc)
 Triggers CoreActionController::activateTimeline().
 
static void TIMELINE_ADD_MARKER_Handler (lo_arg **argv, int argc)
 Triggers CoreActionController::addTempoMarker().
 
static void TIMELINE_DELETE_MARKER_Handler (lo_arg **argv, int argc)
 Triggers CoreActionController::deleteTempoMarker().
 
static void TOGGLE_METRONOME_Handler (lo_arg **argv, int i)
 Creates an Action of type TOGGLE_METRONOME and passes its references to MidiActionManager::handleAction().
 
static void UNDO_ACTION_Handler (lo_arg **argv, int i)
 Creates an Action of type UNDO_ACTION and passes its references to MidiActionManager::handleAction().
 
static void UNMUTE_Handler (lo_arg **argv, int i)
 Creates an Action of type UNMUTE and passes its references to MidiActionManager::handleAction().
 
static void UPGRADE_DRUMKIT_Handler (lo_arg **argv, int argc)
 Triggers CoreActionController::upgradeDrumkit().
 
static void VALIDATE_DRUMKIT_Handler (lo_arg **argv, int argc)
 Triggers CoreActionController::validateDrumkit().
 
- 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 Attributes

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

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.
 
void broadcastMessage (const char *msgText, lo_message message)
 Helper function which sends a message with msgText to all connected clients.
 

Private Attributes

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

Additional Inherited Members

- Protected Member Functions inherited from Object< OscServer >
 ~Object ()
 
- Protected Member Functions inherited from Base
 ~Base ()
 
- 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

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

Definition at line 89 of file OscServer.h.

Constructor & Destructor Documentation

◆ ~OscServer()

~OscServer ( )

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

Definition at line 390 of file OscServer.cpp.

◆ 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.

Definition at line 352 of file OscServer.cpp.

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.

Definition at line 684 of file OscServer.cpp.

◆ 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.

Definition at line 584 of file OscServer.cpp.

◆ BPM_Handler()

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

Creates sets the current tempo of Hydrogen to the provided value (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.

Definition at line 551 of file OscServer.cpp.

◆ 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.

Definition at line 572 of file OscServer.cpp.

◆ broadcastMessage()

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

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

Definition at line 1078 of file OscServer.cpp.

◆ 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.

Definition at line 401 of file OscServer.cpp.

◆ EXTRACT_DRUMKIT_Handler()

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

Triggers CoreActionController::extractDrumkit().

The handler expects the user to provide as first argument the absolute path to a compressed drumkit ( *.h2drumkit). The second argument is optional and contains the absolute path to a directory where the kit will be extracted to. If the second path is missing, the drumkit will be installed in the user's drumkit data folder.

Definition at line 1053 of file OscServer.cpp.

◆ 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.

Definition at line 672 of file OscServer.cpp.

◆ generic_handler()

int generic_handler ( const char * path,
const char * types,
lo_arg ** argv,
int argc,
lo_message 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_ABSOLUTE_SYM/[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

Definition at line 168 of file OscServer.cpp.

◆ get_instance()

static OscServer * get_instance ( )
inlinestatic

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

Definition at line 123 of file OscServer.h.

◆ handleAction()

void handleAction ( std::shared_ptr< 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/PAN_ABSOLUTE_SYM/[x]
  • /Hydrogen/PAN_RELATIVE/[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.

Definition at line 1096 of file OscServer.cpp.

◆ incomingMessageLogging()

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

Definition at line 149 of file OscServer.cpp.

◆ 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.

Definition at line 1216 of file OscServer.cpp.

◆ JACK_TIMEBASE_MASTER_ACTIVATION_Handler()

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

Triggers CoreActionController::activateJackTimebaseMaster().

Parameters
argvThe "f" 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.

Definition at line 899 of file OscServer.cpp.

◆ JACK_TRANSPORT_ACTIVATION_Handler()

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

Triggers CoreActionController::activatedJackTransport().

Parameters
argvThe "f" 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.

Definition at line 882 of file OscServer.cpp.

◆ LOAD_DRUMKIT_Handler()

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

Triggers CoreActionController::setDrumkit().

The handler expects the user to provide the drumkit name. (row the pattern resides in within the SongEditor). The second argument, whether or not superfluous instrument should be removed even if there is a pattern in which they contain notes, is optional. The default choice will be true.

Definition at line 1007 of file OscServer.cpp.

◆ LOOP_MODE_ACTIVATION_Handler()

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

Triggers CoreActionController::activateLoopMode().

Parameters
argvThe "f" 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.

Definition at line 931 of file OscServer.cpp.

◆ 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.

Definition at line 596 of file OscServer.cpp.

◆ 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.

Definition at line 606 of file OscServer.cpp.

◆ 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.

Definition at line 501 of file OscServer.cpp.

◆ 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.

Definition at line 521 of file OscServer.cpp.

◆ NEW_PATTERN_Handler()

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

Triggers CoreActionController::newSong().

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

Parameters
argvThe "s" field does contain the name for the new pattern.
argcNumber of arguments passed by the OSC message.

Definition at line 958 of file OscServer.cpp.

◆ 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
argvThe "s" field does contain the absolute path.
argcNumber of arguments passed by the OSC message.

Definition at line 781 of file OscServer.cpp.

◆ 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.

Definition at line 531 of file OscServer.cpp.

◆ OPEN_PATTERN_Handler()

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

Triggers CoreActionController::openPattern().

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

Parameters
argvThe "s" field does contain the absolute path.
argcNumber of arguments passed by the OSC message.

Definition at line 970 of file OscServer.cpp.

◆ 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 for a .h2song file.

Parameters
argvThe "s" field does contain the absolute path.
argcNumber of arguments passed by the OSC message.

Definition at line 788 of file OscServer.cpp.

◆ 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.

Definition at line 451 of file OscServer.cpp.

◆ 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.

Definition at line 411 of file OscServer.cpp.

◆ 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.

Definition at line 431 of file OscServer.cpp.

◆ 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.

Definition at line 421 of file OscServer.cpp.

◆ 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.

Definition at line 716 of file OscServer.cpp.

◆ 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.

Definition at line 726 of file OscServer.cpp.

◆ 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.

Definition at line 704 of file OscServer.cpp.

◆ 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.

Definition at line 541 of file OscServer.cpp.

◆ 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.

Definition at line 48 of file OscServer.cpp.

◆ 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.

Definition at line 831 of file OscServer.cpp.

◆ 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.

Definition at line 491 of file OscServer.cpp.

◆ 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.

Definition at line 461 of file OscServer.cpp.

◆ 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.

Definition at line 481 of file OscServer.cpp.

◆ 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.

Definition at line 471 of file OscServer.cpp.

◆ 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.

Definition at line 768 of file OscServer.cpp.

◆ RELOCATE_Handler()

void RELOCATE_Handler ( lo_arg ** argv,
int argc )
static
Parameters
argvThe "f" field does contain the desired position / number of the pattern group (starting with 0).
argcUnused number of arguments passed by the OSC message.

Definition at line 947 of file OscServer.cpp.

◆ REMOVE_PATTERN_Handler()

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

Triggers CoreActionController::removePattern().

The handler expects the user to provide the pattern number (row the pattern resides in within the SongEditor).

Parameters
argvThe "f" field does contain the pattern number (caution: it starts at 0).
argcNumber of arguments passed by the OSC message.

Definition at line 982 of file OscServer.cpp.

◆ 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.

Definition at line 819 of file OscServer.cpp.

◆ 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
argvThe "s" field does contain the absolute path.
argcNumber of arguments passed by the OSC message.

Definition at line 807 of file OscServer.cpp.

◆ 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.

Definition at line 795 of file OscServer.cpp.

◆ 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.

Definition at line 661 of file OscServer.cpp.

◆ 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.

Definition at line 746 of file OscServer.cpp.

◆ 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.

Definition at line 639 of file OscServer.cpp.

◆ SELECT_ONLY_NEXT_PATTERN_Handler()

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

Creates an Action of type SELECT_ONLY_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.

Definition at line 650 of file OscServer.cpp.

◆ SONG_EDITOR_TOGGLE_GRID_CELL_Handler()

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

Triggers CoreActionController::songEditorToggleGridCell().

The handler expects the user to provide the pattern number (row the pattern resides in within the SongEditor).

Parameters
argvThe first two "f" fields do contain the column and row number of the particular grid cell.
argcNumber of arguments passed by the OSC message.

Definition at line 994 of file OscServer.cpp.

◆ SONG_MODE_ACTIVATION_Handler()

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

Triggers CoreActionController::activateSongMode().

Parameters
argvThe "f" 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.

Definition at line 915 of file OscServer.cpp.

◆ 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

Definition at line 1367 of file OscServer.cpp.

◆ stop()

bool stop ( )

Stops the OSC server and makes it unavailable.

Returns
true on success

Definition at line 1393 of file OscServer.cpp.

◆ 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.

Definition at line 441 of file OscServer.cpp.

◆ 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().

Definition at line 617 of file OscServer.cpp.

◆ 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.

Definition at line 627 of file OscServer.cpp.

◆ 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.

Definition at line 694 of file OscServer.cpp.

◆ TIMELINE_ACTIVATION_Handler()

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

Triggers CoreActionController::activateTimeline().

Parameters
argvThe "f" 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.

Definition at line 840 of file OscServer.cpp.

◆ TIMELINE_ADD_MARKER_Handler()

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

Triggers CoreActionController::addTempoMarker().

Parameters
argvThe first field "f" 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.

Definition at line 857 of file OscServer.cpp.

◆ TIMELINE_DELETE_MARKER_Handler()

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

Triggers CoreActionController::deleteTempoMarker().

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

Definition at line 870 of file OscServer.cpp.

◆ 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.

Definition at line 736 of file OscServer.cpp.

◆ 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.

Definition at line 758 of file OscServer.cpp.

◆ 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.

Definition at line 511 of file OscServer.cpp.

◆ UPGRADE_DRUMKIT_Handler()

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

Triggers CoreActionController::upgradeDrumkit().

The handler expects the user to provide as first argument the absolute path to a folder containing a drumkit, the absolute path to a drumkit file (drumkit.xml) itself, or an absolute path to a compressed drumkit ( *.h2drumkit). The second argument is optional and contains the absolute path to a directory where the upgraded kit will be stored. If the second path is missing, the drumkit will be upgraded in place and a backup file will be created in order to not overwrite the existing state. If a compressed drumkit is provided as first argument, the upgraded drumkit will be compressed as well.

Definition at line 1026 of file OscServer.cpp.

◆ VALIDATE_DRUMKIT_Handler()

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

Triggers CoreActionController::validateDrumkit().

The handler expects the user to provide the absolute path to a folder containing a drumkit, the absolute path to a drumkit file (drumkit.xml) itself, or an absolute path to a compressed drumkit ( *.h2drumkit). The second argument is optional and contains the absolute path to a directory where the upgraded kit will be stored.

Definition at line 1040 of file OscServer.cpp.

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().

Definition at line 98 of file OscServer.h.

◆ m_bInitialized

bool m_bInitialized
private

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

Definition at line 864 of file OscServer.h.

◆ 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.

Definition at line 883 of file OscServer.h.

◆ 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.

Definition at line 859 of file OscServer.h.

◆ 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().

Definition at line 872 of file OscServer.h.