31#if defined(H2CORE_HAVE_OSC) || _DOXYGEN_
50 QString formattedString;
66 h2_pcast32 val32 = {0};
67 h2_pcast64 val64 = {0};
70 size = lo_arg_size(type, data);
71 if (size == 4 || type == LO_BLOB) {
72 val32.nl = *(int32_t *)data;
73 }
else if (size == 8) {
74 val64.nl = *(int64_t *)data;
77 formattedString = QString(
"Unhandled size: %1").arg(size);
79 return formattedString;
84 formattedString = QString(
"%1").arg(val32.i);
88 formattedString = QString(
"%1").arg(val32.f);
92 formattedString = QString(
"%1").arg( (
char *) data );
97 formattedString = QString(
"BLOB");
101 formattedString = QString(
"%1").arg(val64.i);
105 formattedString = QString(
"%1").arg(val64.f);
109 formattedString = QString(
"%1").arg( (
char *) data );
113 formattedString = QString(
"%1").arg( QLatin1Char((
char) val32.c ));
118 formattedString = QString(
"MIDI");
122 formattedString = QString(
"#T");
126 formattedString = QString(
"#F");
130 formattedString = QString(
"#NIL");
134 formattedString = QString(
"#INF");
139 formattedString = QString(
"Unhandled type:").arg(type);
143 return formattedString;
156 QString sSummary = QString(
"Incoming OSC Message for path [%1]" ).arg( path );
157 for (
int ii = 0; ii < argc; ii++) {
158 QString formattedArgument =
qPrettyPrint( (lo_type)types[ii], argv[ii] );
159 sSummary.append( QString(
", arg. %1: [%2, %3]" )
160 .arg( ii ).arg( types[ ii ] ).arg( formattedArgument ) );
176 auto pController = pHydrogen->getCoreActionController();
177 auto pSong = pHydrogen->getSong();
179 if ( pSong ==
nullptr ) {
184 bool bMessageProcessed =
false;
186 int nNumberOfStrips = pSong->getInstrumentList()->size();
189 QString oscPath( path );
190 QRegExp rxStripVol(
"/Hydrogen/STRIP_VOLUME_ABSOLUTE/(\\d+)" );
191 int pos = rxStripVol.indexIn( oscPath );
194 int nStrip = rxStripVol.cap(1).toInt() -1;
195 if ( nStrip > -1 && nStrip < nNumberOfStrips ) {
197 bMessageProcessed =
true;
200 ERRORLOG( QString(
"Provided strip number [%1] out of bound [%2,%3]" )
201 .arg( nStrip + 1 ).arg( 1 )
202 .arg( nNumberOfStrips ) );
207 QRegExp rxStripVolRel(
"/Hydrogen/STRIP_VOLUME_RELATIVE/(\\d+)" );
208 pos = rxStripVolRel.indexIn( oscPath );
211 int nStrip = rxStripVolRel.cap(1).toInt() - 1;
212 if ( nStrip > -1 && nStrip < nNumberOfStrips ) {
214 QString::number( argv[0]->f,
'f', 0 ) );
215 bMessageProcessed =
true;
218 ERRORLOG( QString(
"Provided strip number [%1] out of bound [%2,%3]" )
219 .arg( nStrip + 1 ).arg( 1 )
220 .arg( nNumberOfStrips ) );
225 QRegExp rxStripPanAbs(
"/Hydrogen/PAN_ABSOLUTE/(\\d+)" );
226 pos = rxStripPanAbs.indexIn( oscPath );
229 int nStrip = rxStripPanAbs.cap(1).toInt() - 1;
230 if ( nStrip > -1 && nStrip < nNumberOfStrips ) {
231 INFOLOG( QString(
"processing message as changing pan of strip [%1] in absolute numbers" )
233 pController->setStripPan( nStrip, argv[0]->f,
false );
234 bMessageProcessed =
true;
237 ERRORLOG( QString(
"Provided strip number [%1] out of bound [%2,%3]" )
238 .arg( nStrip + 1 ).arg( 1 )
239 .arg( nNumberOfStrips ) );
244 QRegExp rxStripPanAbsSym(
"/Hydrogen/PAN_ABSOLUTE_SYM/(\\d+)" );
245 pos = rxStripPanAbsSym.indexIn( oscPath );
248 int nStrip = rxStripPanAbsSym.cap(1).toInt() - 1;
249 if ( nStrip > -1 && nStrip < nNumberOfStrips ) {
250 INFOLOG( QString(
"processing message as changing pan of strip [%1] in symmetric, absolute numbers" )
252 pController->setStripPanSym( nStrip, argv[0]->f,
false );
253 bMessageProcessed =
true;
256 ERRORLOG( QString(
"Provided strip number [%1] out of bound [%2,%3]" )
257 .arg( nStrip + 1 ).arg( 1 )
258 .arg( nNumberOfStrips ) );
263 QRegExp rxStripPanRel(
"/Hydrogen/PAN_RELATIVE/(\\d+)" );
264 pos = rxStripPanRel.indexIn( oscPath );
267 int nStrip = rxStripPanRel.cap(1).toInt() - 1;
268 if ( nStrip > -1 && nStrip < nNumberOfStrips ) {
269 INFOLOG( QString(
"processing message as changing pan of strip [%1] in relative numbers" )
271 std::shared_ptr<Action> pAction = std::make_shared<Action>(
"PAN_RELATIVE");
272 pAction->setParameter1( QString::number( nStrip ) );
273 pAction->setValue( QString::number( argv[0]->f,
'f', 0 ) );
275 bMessageProcessed =
true;
278 ERRORLOG( QString(
"Provided strip number [%1] out of bound [%2,%3]" )
279 .arg( nStrip + 1 ).arg( 1 )
280 .arg( nNumberOfStrips ) );
285 QRegExp rxStripFilterCutoffAbs(
"/Hydrogen/FILTER_CUTOFF_LEVEL_ABSOLUTE/(\\d+)" );
286 pos = rxStripFilterCutoffAbs.indexIn( oscPath );
289 int nStrip = rxStripFilterCutoffAbs.cap(1).toInt() - 1;
290 if ( nStrip > -1 && nStrip < nNumberOfStrips ) {
292 QString::number( argv[0]->f,
'f', 0 ) );
293 bMessageProcessed =
true;
296 ERRORLOG( QString(
"Provided strip number [%1] out of bound [%2,%3]" )
297 .arg( nStrip + 1 ).arg( 1 )
298 .arg( nNumberOfStrips ) );
303 QRegExp rxStripMute(
"/Hydrogen/STRIP_MUTE_TOGGLE/(\\d+)" );
304 pos = rxStripMute.indexIn( oscPath );
307 int nStrip = rxStripMute.cap(1).toInt() - 1;
308 if ( nStrip > -1 && nStrip < nNumberOfStrips ) {
309 INFOLOG( QString(
"processing message as toggling mute of strip [%1]" )
311 pController->toggleStripIsMuted( nStrip );
312 bMessageProcessed =
true;
315 ERRORLOG( QString(
"Provided strip number [%1] out of bound [%2,%3]" )
316 .arg( nStrip + 1 ).arg( 1 )
317 .arg( nNumberOfStrips ) );
322 QRegExp rxStripSolo(
"/Hydrogen/STRIP_SOLO_TOGGLE/(\\d+)" );
323 pos = rxStripSolo.indexIn( oscPath );
326 int nStrip = rxStripSolo.cap(1).toInt() - 1;
327 if ( nStrip > -1 && nStrip < nNumberOfStrips ) {
328 INFOLOG( QString(
"processing message as toggling solo of strip [%1]" )
330 pController->toggleStripIsSoloed( nStrip );
331 bMessageProcessed =
true;
334 ERRORLOG( QString(
"Provided strip number [%1] out of bound [%2,%3]" )
335 .arg( nStrip + 1 ).arg( 1 )
336 .arg( nNumberOfStrips ) );
341 if ( ! bMessageProcessed ) {
342 ERRORLOG(
"No matching handler found" );
375 ERRORLOG( QString(
"Could not start OSC server on port %1, using port %2 instead.").arg(port).arg(tmpPort));
381 INFOLOG( QString(
"OSC server running on port %1" ).arg( port ) );
393 lo_address_free( *it );
413 INFOLOG(
"processing message" );
414 std::shared_ptr<Action> pAction = std::make_shared<Action>(
"PLAY");
423 INFOLOG(
"processing message" );
424 std::shared_ptr<Action> pAction = std::make_shared<Action>(
"PLAY/STOP_TOGGLE");
433 INFOLOG(
"processing message" );
434 std::shared_ptr<Action> pAction = std::make_shared<Action>(
"PLAY/PAUSE_TOGGLE");
443 INFOLOG(
"processing message" );
444 std::shared_ptr<Action> pAction = std::make_shared<Action>(
"STOP");
453 INFOLOG(
"processing message" );
454 std::shared_ptr<Action> pAction = std::make_shared<Action>(
"PAUSE");
463 INFOLOG(
"processing message" );
464 std::shared_ptr<Action> pAction = std::make_shared<Action>(
"RECORD_READY");
473 INFOLOG(
"processing message" );
474 std::shared_ptr<Action> pAction = std::make_shared<Action>(
"RECORD/STROBE_TOGGLE");
483 INFOLOG(
"processing message" );
484 std::shared_ptr<Action> pAction = std::make_shared<Action>(
"RECORD_STROBE");
493 INFOLOG(
"processing message" );
494 std::shared_ptr<Action> pAction = std::make_shared<Action>(
"RECORD_EXIT");
503 INFOLOG(
"processing message" );
504 std::shared_ptr<Action> pAction = std::make_shared<Action>(
"MUTE");
513 INFOLOG(
"processing message" );
514 std::shared_ptr<Action> pAction = std::make_shared<Action>(
"UNMUTE");
523 INFOLOG(
"processing message" );
524 std::shared_ptr<Action> pAction = std::make_shared<Action>(
"MUTE_TOGGLE");
533 INFOLOG(
"processing message" );
534 std::shared_ptr<Action> pAction = std::make_shared<Action>(
">>_NEXT_BAR");
543 INFOLOG(
"processing message" );
544 std::shared_ptr<Action> pAction = std::make_shared<Action>(
"<<_PREVIOUS_BAR");
553 INFOLOG(
"processing message" );
555 auto pAudioEngine = pHydrogen->getAudioEngine();
557 float fNewBpm = argv[0]->f;
558 fNewBpm = std::clamp( fNewBpm,
static_cast<float>(
MIN_BPM),
562 pAudioEngine->setNextBpm( fNewBpm );
563 pAudioEngine->unlock();
565 pHydrogen->getSong()->setBpm( fNewBpm );
567 pHydrogen->setIsModified(
true );
574 INFOLOG(
"processing message" );
575 std::shared_ptr<Action> pAction = std::make_shared<Action>(
"BPM_INCR");
578 pAction->setParameter1( QString::number( argv[0]->f,
'f', 0 ));
586 INFOLOG(
"processing message" );
587 std::shared_ptr<Action> pAction = std::make_shared<Action>(
"BPM_DECR");
590 pAction->setParameter1( QString::number( argv[0]->f,
'f', 0 ));
598 INFOLOG(
"processing message" );
608 INFOLOG(
"processing message" );
609 std::shared_ptr<Action> pAction = std::make_shared<Action>(
"MASTER_VOLUME_RELATIVE");
610 pAction->setValue( QString::number( argv[0]->f,
'f', 0 ));
619 INFOLOG(
"processing message" );
629 INFOLOG(
"processing message" );
630 std::shared_ptr<Action> pAction = std::make_shared<Action>(
"STRIP_VOLUME_RELATIVE");
631 pAction->setParameter1( param1 );
632 pAction->setValue( param2 );
641 INFOLOG(
"processing message" );
642 std::shared_ptr<Action> pAction = std::make_shared<Action>(
"SELECT_NEXT_PATTERN");
643 pAction->setParameter1( QString::number( argv[0]->f,
'f', 0 ) );
652 INFOLOG(
"processing message" );
653 std::shared_ptr<Action> pAction = std::make_shared<Action>(
"SELECT_ONLY_NEXT_PATTERN");
654 pAction->setParameter1( QString::number( argv[0]->f,
'f', 0 ) );
663 INFOLOG(
"processing message" );
664 std::shared_ptr<Action> pAction = std::make_shared<Action>(
"SELECT_AND_PLAY_PATTERN");
665 pAction->setParameter1( QString::number( argv[0]->f,
'f', 0 ) );
674 INFOLOG(
"processing message" );
675 std::shared_ptr<Action> pAction = std::make_shared<Action>(
"FILTER_CUTOFF_LEVEL_ABSOLUTE");
676 pAction->setParameter1( param1 );
677 pAction->setValue( param2 );
686 INFOLOG(
"processing message" );
687 std::shared_ptr<Action> pAction = std::make_shared<Action>(
"BEATCOUNTER");
696 INFOLOG(
"processing message" );
697 std::shared_ptr<Action> pAction = std::make_shared<Action>(
"TAP_TEMPO");
706 INFOLOG(
"processing message" );
707 std::shared_ptr<Action> pAction = std::make_shared<Action>(
"PLAYLIST_SONG");
708 pAction->setParameter1( QString::number( argv[0]->f,
'f', 0 ) );
718 INFOLOG(
"processing message" );
719 std::shared_ptr<Action> pAction = std::make_shared<Action>(
"PLAYLIST_NEXT_SONG");
728 INFOLOG(
"processing message" );
729 std::shared_ptr<Action> pAction = std::make_shared<Action>(
"PLAYLIST_PREV_SONG");
738 INFOLOG(
"processing message" );
739 std::shared_ptr<Action> pAction = std::make_shared<Action>(
"TOGGLE_METRONOME");
748 INFOLOG(
"processing message" );
749 std::shared_ptr<Action> pAction = std::make_shared<Action>(
"SELECT_INSTRUMENT");
750 pAction->setValue( QString::number( argv[0]->f,
'f', 0 ) );
760 INFOLOG(
"processing message" );
761 std::shared_ptr<Action> pAction = std::make_shared<Action>(
"UNDO_ACTION");
770 INFOLOG(
"processing message" );
771 std::shared_ptr<Action> pAction = std::make_shared<Action>(
"REDO_ACTION");
782 INFOLOG(
"processing message" );
784 auto pController = pHydrogen->getCoreActionController();
785 pController->newSong( QString::fromUtf8( &argv[0]->s ) );
789 INFOLOG(
"processing message" );
791 auto pController = pHydrogen->getCoreActionController();
792 pController->openSong( QString::fromUtf8( &argv[0]->s ) );
796 INFOLOG(
"processing message" );
798 if ( pHydrogen->getSong() ==
nullptr ) {
803 auto pController = pHydrogen->getCoreActionController();
804 pController->saveSong();
808 INFOLOG(
"processing message" );
810 if ( pHydrogen->getSong() ==
nullptr ) {
815 auto pController = pHydrogen->getCoreActionController();
816 pController->saveSongAs( QString::fromUtf8( &argv[0]->s ) );
820 INFOLOG(
"processing message" );
822 if ( pHydrogen->getSong() ==
nullptr ) {
827 auto pController = pHydrogen->getCoreActionController();
828 pController->savePreferences();
832 INFOLOG(
"processing message" );
834 auto pController = pHydrogen->getCoreActionController();
841 INFOLOG(
"processing message" );
843 if ( pHydrogen->getSong() ==
nullptr ) {
848 auto pController = pHydrogen->getCoreActionController();
850 if ( argv[0]->f != 0 ) {
851 pController->activateTimeline(
true );
853 pController->activateTimeline(
false );
858 INFOLOG(
"processing message" );
860 if ( pHydrogen->getSong() ==
nullptr ) {
865 auto pController = pHydrogen->getCoreActionController();
866 pController->addTempoMarker(
static_cast<int>(std::round( argv[0]->f )),
871 INFOLOG(
"processing message" );
873 if ( pHydrogen->getSong() ==
nullptr ) {
878 auto pController = pHydrogen->getCoreActionController();
879 pController->deleteTempoMarker(
static_cast<int>( std::round( argv[0]->f ) ) );
883 INFOLOG(
"processing message" );
885 if ( pHydrogen->getSong() ==
nullptr ) {
890 auto pController = pHydrogen->getCoreActionController();
892 if ( argv[0]->f != 0 ) {
893 pController->activateJackTransport(
true );
895 pController->activateJackTransport(
false );
900 INFOLOG(
"processing message" );
902 if ( pHydrogen->getSong() ==
nullptr ) {
907 auto pController = pHydrogen->getCoreActionController();
908 if ( argv[0]->f != 0 ) {
909 pController->activateJackTimebaseMaster(
true );
911 pController->activateJackTimebaseMaster(
false );
916 INFOLOG(
"processing message" );
918 if ( pHydrogen->getSong() ==
nullptr ) {
923 auto pController = pHydrogen->getCoreActionController();
924 if ( argv[0]->f != 0 ) {
925 pController->activateSongMode(
true );
927 pController->activateSongMode(
false );
932 INFOLOG(
"processing message" );
934 if ( pHydrogen->getSong() ==
nullptr ) {
939 auto pController = pHydrogen->getCoreActionController();
940 if ( argv[0]->f != 0 ) {
941 pController->activateLoopMode(
true );
943 pController->activateLoopMode(
false );
948 INFOLOG(
"processing message" );
950 if ( pHydrogen->getSong() ==
nullptr ) {
955 pHydrogen->getCoreActionController()->locateToColumn(
static_cast<int>(std::round( argv[0]->f ) ) );
959 INFOLOG(
"processing message" );
961 if ( pHydrogen->getSong() ==
nullptr ) {
966 auto pController = pHydrogen->getCoreActionController();
967 pController->newPattern( QString::fromUtf8( &argv[0]->s ) );
971 INFOLOG(
"processing message" );
973 if ( pHydrogen->getSong() ==
nullptr ) {
978 auto pController = pHydrogen->getCoreActionController();
979 pController->openPattern( QString::fromUtf8( &argv[0]->s ) );
983 INFOLOG(
"processing message" );
985 if ( pHydrogen->getSong() ==
nullptr ) {
990 auto pController = pHydrogen->getCoreActionController();
991 pController->removePattern(
static_cast<int>(std::round( argv[0]->f )) );
995 INFOLOG(
"processing message" );
997 if ( pHydrogen->getSong() ==
nullptr ) {
1002 auto pController = pHydrogen->getCoreActionController();
1003 pController->toggleGridCell(
static_cast<int>(std::round( argv[0]->f )),
1004 static_cast<int>(std::round( argv[1]->f )) );
1008 INFOLOG(
"processing message" );
1010 if ( pHydrogen->getSong() ==
nullptr ) {
1015 auto pController = pHydrogen->getCoreActionController();
1017 bool bConditionalLoad =
true;
1019 bConditionalLoad = argv[1]->f == 0 ? false :
true;
1022 pController->setDrumkit( QString::fromUtf8( &argv[0]->s ),
1027 INFOLOG(
"processing message" );
1031 QString sNewPath =
"";
1033 sNewPath = QString::fromUtf8( &argv[1]->s );
1036 pController->upgradeDrumkit( QString::fromUtf8( &argv[0]->s ),
1041 INFOLOG(
"processing message" );
1043 bool bValidateLegacyKits =
false;
1045 bValidateLegacyKits = argv[1]->f == 0 ? false :
true;
1050 bValidateLegacyKits );
1054 INFOLOG(
"processing message" );
1058 QString sTargetDir =
"";
1060 sTargetDir = QString::fromUtf8( &argv[1]->s );
1063 pController->extractDrumkit( QString::fromUtf8( &argv[0]->s ), sTargetDir );
1071 bool portEqual = ( strcmp( lo_address_get_port( first ), lo_address_get_port( second ) ) == 0);
1072 bool hostEqual = ( strcmp( lo_address_get_hostname( first ), lo_address_get_hostname( second ) ) == 0);
1073 bool protoEqual = ( lo_address_get_protocol( first ) == lo_address_get_protocol( second ) );
1075 return portEqual && hostEqual && protoEqual;
1081 INFOLOG( QString(
"Outgoing OSC broadcast message %1" ).arg( msgText ));
1084 for (i = 0; i < lo_message_get_argc( message ); i++) {
1085 QString formattedArgument =
qPrettyPrint( (lo_type)lo_message_get_types(message)[i], lo_message_get_argv(message)[i] );
1086 INFOLOG(QString(
"Argument %1: %2 %3").arg(i).arg(lo_message_get_types(message)[i]).arg(formattedArgument));
1089 lo_send_message(clientAddress, msgText, message);
1104 if( pAction->getType() ==
"MASTER_VOLUME_ABSOLUTE"){
1106 float fValue = pAction->getValue().toFloat(&ok);
1108 lo_message reply = lo_message_new();
1109 lo_message_add_float( reply, fValue );
1113 lo_message_free( reply );
1116 if( pAction->getType() ==
"STRIP_VOLUME_ABSOLUTE"){
1118 float fValue = pAction->getValue().toFloat(&ok);
1120 lo_message reply = lo_message_new();
1121 lo_message_add_float( reply, fValue );
1123 QByteArray ba = QString(
"/Hydrogen/STRIP_VOLUME_ABSOLUTE/%1").arg(pAction->getParameter1()).toLatin1();
1124 const char *c_str2 = ba.data();
1128 lo_message_free( reply );
1131 if( pAction->getType() ==
"TOGGLE_METRONOME"){
1133 float param1 = pAction->getParameter1().toFloat(&ok);
1135 lo_message reply = lo_message_new();
1136 lo_message_add_float(reply, param1);
1140 lo_message_free( reply );
1143 if( pAction->getType() ==
"MUTE_TOGGLE"){
1145 float param1 = pAction->getParameter1().toFloat(&ok);
1147 lo_message reply = lo_message_new();
1148 lo_message_add_float(reply, param1);
1152 lo_message_free( reply );
1155 if( pAction->getType() ==
"STRIP_MUTE_TOGGLE"){
1157 float fValue = pAction->getValue().toFloat(&ok);
1159 lo_message reply = lo_message_new();
1160 lo_message_add_float( reply, fValue );
1162 QByteArray ba = QString(
"/Hydrogen/STRIP_MUTE_TOGGLE/%1").arg(pAction->getParameter1()).toLatin1();
1163 const char *c_str2 = ba.data();
1167 lo_message_free( reply );
1170 if( pAction->getType() ==
"STRIP_SOLO_TOGGLE"){
1172 float fValue = pAction->getValue().toFloat(&ok);
1174 lo_message reply = lo_message_new();
1175 lo_message_add_float( reply, fValue );
1177 QByteArray ba = QString(
"/Hydrogen/STRIP_SOLO_TOGGLE/%1").arg(pAction->getParameter1()).toLatin1();
1178 const char *c_str2 = ba.data();
1182 lo_message_free( reply );
1185 if( pAction->getType() ==
"PAN_ABSOLUTE"){
1187 float fValue = pAction->getValue().toFloat(&ok);
1189 lo_message reply = lo_message_new();
1190 lo_message_add_float( reply, fValue );
1192 QByteArray ba = QString(
"/Hydrogen/PAN_ABSOLUTE/%1").arg(pAction->getParameter1()).toLatin1();
1193 const char *c_str2 = ba.data();
1197 lo_message_free( reply );
1200 if( pAction->getType() ==
"PAN_ABSOLUTE_SYM"){
1202 float fValue = pAction->getValue().toFloat(&ok);
1204 lo_message reply = lo_message_new();
1205 lo_message_add_float( reply, fValue );
1207 QByteArray ba = QString(
"/Hydrogen/PAN_ABSOLUTE_SYM/%1").arg(pAction->getParameter1()).toLatin1();
1208 const char *c_str2 = ba.data();
1212 lo_message_free( reply );
1219 ERRORLOG(
"Failed to initialize OSC server. No valid server thread.");
1229 lo_address address = lo_message_get_source(msg);
1231 bool AddressRegistered =
false;
1234 AddressRegistered =
true;
1239 if( ! AddressRegistered ){
1240 lo_address newAddress =
1241 lo_address_new_with_proto( lo_address_get_protocol( address ),
1242 lo_address_get_hostname( address ),
1243 lo_address_get_port( address ) );
1245 INFOLOG( QString(
"New OSC client registered. Hostname: %1, port: %2, protocol: %3" )
1246 .arg( lo_address_get_hostname( address ) )
1247 .arg( lo_address_get_port( address ) )
1248 .arg( lo_address_get_protocol( address ) ) );
1369 ERRORLOG(
"Failed to start OSC server. No valid server thread.");
1388 INFOLOG(QString(
"Osc server started. Listening on port %1").arg( nOscPortUsed ));
1395 ERRORLOG(
"Failed to stop OSC server. No valid server thread.");
1400 INFOLOG(QString(
"Osc server stopped" ));
#define RIGHT_HERE
Macro intended to be used for the logging of the locking of the H2Core::AudioEngine.
bool IsLoAddressEqual(lo_address first, lo_address second)
bool setStripVolume(int nStrip, float fVolumeValue, bool bSelectStrip)
bool validateDrumkit(const QString &sDrumkitPath, bool bCheckLegacyVersions=false)
Checks whether the provided drumkit in sDrumkitPath can be found, can be loaded, and does comply with...
bool setMasterVolume(float masterVolumeValue)
bool initExternalControlInterfaces()
static EventQueue * get_instance()
Returns a pointer to the current EventQueue singleton stored in __instance.
void push_event(const EventType type, const int nValue)
Queues the next event into the EventQueue.
static Hydrogen * get_instance()
Returns the current Hydrogen instance __instance.
@ OSC_CANNOT_CONNECT_TO_PORT
Unable to start the OSC server with the given port number.
CoreActionController * getCoreActionController() const
Manager for User Preferences File (singleton)
static Preferences * get_instance()
Returns a pointer to the current Preferences singleton stored in __instance.
bool getOscServerEnabled()
bool getOscFeedbackEnabled()
int m_nOscTemporaryPort
In case m_nOscServerPort is already occupied by another client, the alternative - random - port numbe...
The MidiActionManager cares for the execution of MidiActions.
bool handleAction(std::shared_ptr< Action > action)
The handleAction method is the heart of the MidiActionManager class.
static MidiActionManager * get_instance()
Returns a pointer to the current MidiActionManager singleton stored in __instance.
OSC Server implementation.
static void UPGRADE_DRUMKIT_Handler(lo_arg **argv, int argc)
Triggers CoreActionController::upgradeDrumkit().
bool m_bInitialized
Used to determine whether the callback methods were already added to m_pServerThread.
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 RECORD_READY_Handler(lo_arg **argv, int i)
Creates an Action of type RECORD_READY and passes its references to MidiActionManager::handleAction()...
static void EXTRACT_DRUMKIT_Handler(lo_arg **argv, int argc)
Triggers CoreActionController::extractDrumkit().
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::handleAc...
static void PLAYLIST_SONG_Handler(lo_arg **argv, int i)
Creates an Action of type PLAYLIST_SONG and passes its references to MidiActionManager::handleAction(...
~OscServer()
Destructor freeing all addresses in m_pClientRegistry and setting __instance to nullptr.
static void REMOVE_PATTERN_Handler(lo_arg **argv, int argc)
Triggers CoreActionController::removePattern().
std::list< lo_address > m_pClientRegistry
List of all OSC clients known to Hydrogen.
static void BEATCOUNTER_Handler(lo_arg **argv, int i)
Creates an Action of type BEATCOUNTER and passes its references to MidiActionManager::handleAction().
static void SONG_MODE_ACTIVATION_Handler(lo_arg **argv, int argc)
Triggers CoreActionController::activateSongMode().
static int incomingMessageLogging(const char *path, const char *types, lo_arg **argv, int argc, lo_message data, void *user_data)
static void LOOP_MODE_ACTIVATION_Handler(lo_arg **argv, int argc)
Triggers CoreActionController::activateLoopMode().
static void TIMELINE_ACTIVATION_Handler(lo_arg **argv, int argc)
Triggers CoreActionController::activateTimeline().
static void PLAY_Handler(lo_arg **argv, int i)
Creates an Action of type PLAY and passes its references to MidiActionManager::handleAction().
H2Core::Preferences * m_pPreferences
Pointer to the H2Core::Preferences singleton.
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 VALIDATE_DRUMKIT_Handler(lo_arg **argv, int argc)
Triggers CoreActionController::validateDrumkit().
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 TIMELINE_DELETE_MARKER_Handler(lo_arg **argv, int argc)
Triggers CoreActionController::deleteTempoMarker().
OscServer(H2Core::Preferences *pPreferences)
Private constructor creating a new OSC server thread using the port H2Core::Preferences::m_nOscServer...
static void MASTER_VOLUME_ABSOLUTE_Handler(lo_arg **argv, int i)
Calls H2Core::CoreActionController::setMasterVolume() with the first argument in argv.
static void RELOCATE_Handler(lo_arg **argv, int argc)
static void JACK_TIMEBASE_MASTER_ACTIVATION_Handler(lo_arg **argv, int argc)
Triggers CoreActionController::activateJackTimebaseMaster().
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 MUTE_Handler(lo_arg **argv, int i)
Creates an Action of type MUTE and passes its references to MidiActionManager::handleAction().
static void TOGGLE_METRONOME_Handler(lo_arg **argv, int i)
Creates an Action of type TOGGLE_METRONOME and passes its references to MidiActionManager::handleActi...
static void NEW_PATTERN_Handler(lo_arg **argv, int argc)
Triggers CoreActionController::newSong().
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::handleActi...
static QString qPrettyPrint(lo_type type, void *data)
Converts a data data of type type into a printable QString.
bool stop()
Stops the OSC server and makes it unavailable.
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::han...
static void JACK_TRANSPORT_ACTIVATION_Handler(lo_arg **argv, int argc)
Triggers CoreActionController::activatedJackTransport().
static void SAVE_SONG_Handler(lo_arg **argv, int argc)
Triggers CoreActionController::saveSong().
static void SAVE_PREFERENCES_Handler(lo_arg **argv, int argc)
Triggers CoreActionController::savePreferences().
static void LOAD_DRUMKIT_Handler(lo_arg **argv, int argc)
Triggers CoreActionController::setDrumkit().
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::handleAct...
static void STRIP_VOLUME_RELATIVE_Handler(QString param1, QString param2)
Creates an Action of type STRIP_VOLUME_RELATIVE and passes its references to MidiActionManager::handl...
lo::ServerThread * m_pServerThread
Object containing the actual thread with an OSC server running in.
static void UNMUTE_Handler(lo_arg **argv, int i)
Creates an Action of type UNMUTE 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::ha...
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 OPEN_PATTERN_Handler(lo_arg **argv, int argc)
Triggers CoreActionController::openPattern().
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::handleA...
static void SELECT_INSTRUMENT_Handler(lo_arg **argv, int i)
Creates an Action of type SELECT_INSTRUMENT and passes its references to MidiActionManager::handleAct...
static void OPEN_SONG_Handler(lo_arg **argv, int argc)
Triggers CoreActionController::openSong().
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 RECORD_STROBE_TOGGLE_Handler(lo_arg **argv, int i)
Creates an Action of type RECORD/STROBE_TOGGLE and passes its references to MidiActionManager::handle...
static void NEW_SONG_Handler(lo_arg **argv, int argc)
Triggers CoreActionController::newSong().
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...
static void PAUSE_Handler(lo_arg **argv, int i)
Creates an Action of type PAUSE and passes its references to MidiActionManager::handleAction().
static void TIMELINE_ADD_MARKER_Handler(lo_arg **argv, int argc)
Triggers CoreActionController::addTempoMarker().
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::hand...
static void STOP_Handler(lo_arg **argv, int i)
Creates an Action of type STOP and passes its references to MidiActionManager::handleAction().
bool start()
Starts the OSC server and makes it available to handle commands.
static void STRIP_VOLUME_ABSOLUTE_Handler(int param1, float param2)
Calls H2Core::CoreActionController::setStripVolume() with both param1 and param2.
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.
void handleAction(std::shared_ptr< Action > pAction)
Function called by H2Core::CoreActionController::initExternalControlInterfaces() to inform all client...
static OscServer * __instance
Object holding the current OscServer singleton.
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 NEXT_BAR_Handler(lo_arg **argv, int i)
Creates an Action of type >>_NEXT_BAR and passes its references to MidiActionManager::handleAction().
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 SONG_EDITOR_TOGGLE_GRID_CELL_Handler(lo_arg **argv, int argc)
Triggers CoreActionController::songEditorToggleGridCell().
static void create_instance(H2Core::Preferences *pPreferences)
If __instance equals nullptr, a new OscServer singleton will be created by calling the OscServer() co...
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 PREVIOUS_BAR_Handler(lo_arg **argv, int i)
Creates an Action of type <<_PREVIOUS_BAR and passes its references to MidiActionManager::handleActio...
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::handleAc...
bool init()
Registers all handler functions.
static void SAVE_SONG_AS_Handler(lo_arg **argv, int argc)
Triggers CoreActionController::saveSongAs().
void broadcastMessage(const char *msgText, lo_message message)
Helper function which sends a message with msgText to all connected clients.