hydrogen 1.2.3
MidiActionManager Class Reference

The MidiActionManager cares for the execution of MidiActions. More...

#include <MidiAction.h>

Inheritance diagram for MidiActionManager:
Object< MidiActionManager > Base

Public Member Functions

 MidiActionManager ()
 
 ~MidiActionManager ()
 
QStringList getActionList ()
 
int getParameterNumber (const QString &sActionType) const
 
bool handleAction (std::shared_ptr< Action > action)
 The handleAction method is the heart of the MidiActionManager class.
 
bool handleActions (std::vector< std::shared_ptr< Action > > actions)
 Handles multiple actions at once and calls handleAction() on them.
 
- Public Member Functions inherited from Object< MidiActionManager >
 Object ()
 
 Object (const Object< MidiActionManager > &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 create_instance ()
 If __instance equals 0, a new MidiActionManager singleton will be created and stored in it.
 
static MidiActionManagerget_instance ()
 Returns a pointer to the current MidiActionManager singleton stored in __instance.
 
- 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
 

Private Types

typedef bool(MidiActionManager::* action_f) (std::shared_ptr< Action >, H2Core::Hydrogen *)
 

Private Member Functions

bool beatcounter (std::shared_ptr< Action >, H2Core::Hydrogen *)
 
bool bpm_cc_relative (std::shared_ptr< Action >, H2Core::Hydrogen *)
 
bool bpm_decrease (std::shared_ptr< Action >, H2Core::Hydrogen *)
 
bool bpm_fine_cc_relative (std::shared_ptr< Action >, H2Core::Hydrogen *)
 
bool bpm_increase (std::shared_ptr< Action >, H2Core::Hydrogen *)
 
bool effect_level_absolute (std::shared_ptr< Action >, H2Core::Hydrogen *)
 
bool effect_level_relative (std::shared_ptr< Action >, H2Core::Hydrogen *)
 
bool filter_cutoff_level_absolute (std::shared_ptr< Action >, H2Core::Hydrogen *)
 
bool gain_level_absolute (std::shared_ptr< Action >, H2Core::Hydrogen *)
 
bool master_volume_absolute (std::shared_ptr< Action >, H2Core::Hydrogen *)
 
bool master_volume_relative (std::shared_ptr< Action >, H2Core::Hydrogen *)
 
bool mute (std::shared_ptr< Action >, H2Core::Hydrogen *)
 
bool mute_toggle (std::shared_ptr< Action >, H2Core::Hydrogen *)
 
bool next_bar (std::shared_ptr< Action >, H2Core::Hydrogen *)
 
bool nextPatternSelection (int nPatternNumber)
 
bool onlyNextPatternSelection (int nPatternNumber)
 
bool pan_absolute (std::shared_ptr< Action >, H2Core::Hydrogen *)
 
bool pan_absolute_sym (std::shared_ptr< Action >, H2Core::Hydrogen *)
 
bool pan_relative (std::shared_ptr< Action >, H2Core::Hydrogen *)
 
bool pause (std::shared_ptr< Action >, H2Core::Hydrogen *)
 
bool pitch_level_absolute (std::shared_ptr< Action >, H2Core::Hydrogen *)
 
bool play (std::shared_ptr< Action >, H2Core::Hydrogen *)
 
bool play_stop_pause_toggle (std::shared_ptr< Action >, H2Core::Hydrogen *)
 
bool playlist_next_song (std::shared_ptr< Action >, H2Core::Hydrogen *)
 
bool playlist_previous_song (std::shared_ptr< Action >, H2Core::Hydrogen *)
 
bool playlist_song (std::shared_ptr< Action >, H2Core::Hydrogen *)
 
bool previous_bar (std::shared_ptr< Action >, H2Core::Hydrogen *)
 
bool record_exit (std::shared_ptr< Action >, H2Core::Hydrogen *)
 
bool record_ready (std::shared_ptr< Action >, H2Core::Hydrogen *)
 
bool record_strobe (std::shared_ptr< Action >, H2Core::Hydrogen *)
 
bool record_strobe_toggle (std::shared_ptr< Action >, H2Core::Hydrogen *)
 
bool redo_action (std::shared_ptr< Action >, H2Core::Hydrogen *)
 
bool select_and_play_pattern (std::shared_ptr< Action >, H2Core::Hydrogen *)
 
bool select_instrument (std::shared_ptr< Action >, H2Core::Hydrogen *)
 
bool select_next_pattern (std::shared_ptr< Action >, H2Core::Hydrogen *)
 
bool select_next_pattern_cc_absolute (std::shared_ptr< Action >, H2Core::Hydrogen *)
 
bool select_next_pattern_relative (std::shared_ptr< Action >, H2Core::Hydrogen *)
 
bool select_only_next_pattern (std::shared_ptr< Action >, H2Core::Hydrogen *)
 
bool select_only_next_pattern_cc_absolute (std::shared_ptr< Action >, H2Core::Hydrogen *)
 
bool setSong (int nSongNumber, H2Core::Hydrogen *pHydrogen)
 
bool stop (std::shared_ptr< Action >, H2Core::Hydrogen *)
 
bool strip_mute_toggle (std::shared_ptr< Action >, H2Core::Hydrogen *)
 
bool strip_solo_toggle (std::shared_ptr< Action >, H2Core::Hydrogen *)
 
bool strip_volume_absolute (std::shared_ptr< Action >, H2Core::Hydrogen *)
 
bool strip_volume_relative (std::shared_ptr< Action >, H2Core::Hydrogen *)
 
bool tap_tempo (std::shared_ptr< Action >, H2Core::Hydrogen *)
 
bool toggle_metronome (std::shared_ptr< Action >, H2Core::Hydrogen *)
 
bool undo_action (std::shared_ptr< Action >, H2Core::Hydrogen *)
 
bool unmute (std::shared_ptr< Action >, H2Core::Hydrogen *)
 

Private Attributes

QStringList m_actionList
 Holds the names of all Action identifiers which Hydrogen is able to interpret.
 
std::map< QString, std::pair< action_f, int > > m_actionMap
 Holds all Action identifiers which Hydrogen is able to interpret.
 
int m_nLastBpmChangeCCParameter
 

Static Private Attributes

static MidiActionManager__instance = nullptr
 Object holding the current MidiActionManager singleton.
 

Additional Inherited Members

- Static Public Attributes inherited from Base
static QString sPrintIndention = " "
 String used to format the debugging string output of some core classes.
 
- Protected Member Functions inherited from Object< MidiActionManager >
 ~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

The MidiActionManager cares for the execution of MidiActions.

The MidiActionManager handles the execution of midi actions. The class includes the names and implementations of all possible actions.

Author
Sebastian Moors

Definition at line 141 of file MidiAction.h.

Member Typedef Documentation

◆ action_f

typedef bool(MidiActionManager::* action_f) (std::shared_ptr< Action >, H2Core::Hydrogen *)
private

Definition at line 159 of file MidiAction.h.

Constructor & Destructor Documentation

◆ MidiActionManager()

Definition at line 139 of file MidiAction.cpp.

◆ ~MidiActionManager()

Definition at line 204 of file MidiAction.cpp.

Member Function Documentation

◆ beatcounter()

bool beatcounter ( std::shared_ptr< Action > ,
H2Core::Hydrogen * pHydrogen )
private

Definition at line 356 of file MidiAction.cpp.

◆ bpm_cc_relative()

bool bpm_cc_relative ( std::shared_ptr< Action > pAction,
H2Core::Hydrogen * pHydrogen )
private

Definition at line 931 of file MidiAction.cpp.

◆ bpm_decrease()

bool bpm_decrease ( std::shared_ptr< Action > pAction,
H2Core::Hydrogen * pHydrogen )
private

Definition at line 1054 of file MidiAction.cpp.

◆ bpm_fine_cc_relative()

bool bpm_fine_cc_relative ( std::shared_ptr< Action > pAction,
H2Core::Hydrogen * pHydrogen )
private

Definition at line 983 of file MidiAction.cpp.

◆ bpm_increase()

bool bpm_increase ( std::shared_ptr< Action > pAction,
H2Core::Hydrogen * pHydrogen )
private

Definition at line 1029 of file MidiAction.cpp.

◆ create_instance()

void create_instance ( )
static

If __instance equals 0, a new MidiActionManager singleton will be created and stored in it.

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

Definition at line 209 of file MidiAction.cpp.

◆ effect_level_absolute()

bool effect_level_absolute ( std::shared_ptr< Action > pAction,
H2Core::Hydrogen * pHydrogen )
private

Definition at line 503 of file MidiAction.cpp.

◆ effect_level_relative()

bool effect_level_relative ( std::shared_ptr< Action > pAction,
H2Core::Hydrogen * pHydrogen )
private

Definition at line 538 of file MidiAction.cpp.

◆ filter_cutoff_level_absolute()

bool filter_cutoff_level_absolute ( std::shared_ptr< Action > pAction,
H2Core::Hydrogen * pHydrogen )
private

Definition at line 892 of file MidiAction.cpp.

◆ gain_level_absolute()

bool gain_level_absolute ( std::shared_ptr< Action > pAction,
H2Core::Hydrogen * pHydrogen )
private

Definition at line 798 of file MidiAction.cpp.

◆ get_instance()

static MidiActionManager * get_instance ( )
inlinestatic

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

Definition at line 252 of file MidiAction.h.

◆ getActionList()

QStringList getActionList ( )
inline

Definition at line 254 of file MidiAction.h.

◆ getParameterNumber()

int getParameterNumber ( const QString & sActionType) const
Returns
-1 in case the couldn't be found.

Definition at line 1231 of file MidiAction.cpp.

◆ handleAction()

bool handleAction ( std::shared_ptr< Action > action)

The handleAction method is the heart of the MidiActionManager class.

It executes the operations that are needed to carry the desired action.

Returns
true - if action was handled successfully.

Definition at line 1257 of file MidiAction.cpp.

◆ handleActions()

bool handleActions ( std::vector< std::shared_ptr< Action > > actions)

Handles multiple actions at once and calls handleAction() on them.

Returns
true - if at least one Action was handled successfully. Calling functions should treat the event resulting in actions as consumed.

Definition at line 1242 of file MidiAction.cpp.

◆ master_volume_absolute()

bool master_volume_absolute ( std::shared_ptr< Action > pAction,
H2Core::Hydrogen * pHydrogen )
private

Definition at line 576 of file MidiAction.cpp.

◆ master_volume_relative()

bool master_volume_relative ( std::shared_ptr< Action > pAction,
H2Core::Hydrogen * pHydrogen )
private

Definition at line 598 of file MidiAction.cpp.

◆ mute()

bool mute ( std::shared_ptr< Action > ,
H2Core::Hydrogen * pHydrogen )
private

Definition at line 280 of file MidiAction.cpp.

◆ mute_toggle()

bool mute_toggle ( std::shared_ptr< Action > ,
H2Core::Hydrogen * pHydrogen )
private

Definition at line 300 of file MidiAction.cpp.

◆ next_bar()

bool next_bar ( std::shared_ptr< Action > ,
H2Core::Hydrogen * pHydrogen )
private

Definition at line 1079 of file MidiAction.cpp.

◆ nextPatternSelection()

bool nextPatternSelection ( int nPatternNumber)
private

Definition at line 394 of file MidiAction.cpp.

◆ onlyNextPatternSelection()

bool onlyNextPatternSelection ( int nPatternNumber)
private

Definition at line 431 of file MidiAction.cpp.

◆ pan_absolute()

bool pan_absolute ( std::shared_ptr< Action > pAction,
H2Core::Hydrogen * pHydrogen )
private

Definition at line 699 of file MidiAction.cpp.

◆ pan_absolute_sym()

bool pan_absolute_sym ( std::shared_ptr< Action > pAction,
H2Core::Hydrogen * pHydrogen )
private

Definition at line 730 of file MidiAction.cpp.

◆ pan_relative()

bool pan_relative ( std::shared_ptr< Action > pAction,
H2Core::Hydrogen * pHydrogen )
private

Definition at line 762 of file MidiAction.cpp.

◆ pause()

bool pause ( std::shared_ptr< Action > ,
H2Core::Hydrogen * pHydrogen )
private

Definition at line 228 of file MidiAction.cpp.

◆ pitch_level_absolute()

bool pitch_level_absolute ( std::shared_ptr< Action > pAction,
H2Core::Hydrogen * pHydrogen )
private

Definition at line 845 of file MidiAction.cpp.

◆ play()

bool play ( std::shared_ptr< Action > pAction,
H2Core::Hydrogen * pHydrogen )
private

Definition at line 215 of file MidiAction.cpp.

◆ play_stop_pause_toggle()

bool play_stop_pause_toggle ( std::shared_ptr< Action > pAction,
H2Core::Hydrogen * pHydrogen )
private

Definition at line 250 of file MidiAction.cpp.

◆ playlist_next_song()

bool playlist_next_song ( std::shared_ptr< Action > pAction,
H2Core::Hydrogen * pHydrogen )
private

Definition at line 1136 of file MidiAction.cpp.

◆ playlist_previous_song()

bool playlist_previous_song ( std::shared_ptr< Action > pAction,
H2Core::Hydrogen * pHydrogen )
private

Definition at line 1141 of file MidiAction.cpp.

◆ playlist_song()

bool playlist_song ( std::shared_ptr< Action > pAction,
H2Core::Hydrogen * pHydrogen )
private

Definition at line 1130 of file MidiAction.cpp.

◆ previous_bar()

bool previous_bar ( std::shared_ptr< Action > ,
H2Core::Hydrogen * pHydrogen )
private

Definition at line 1094 of file MidiAction.cpp.

◆ record_exit()

bool record_exit ( std::shared_ptr< Action > ,
H2Core::Hydrogen * pHydrogen )
private

Definition at line 1193 of file MidiAction.cpp.

◆ record_ready()

bool record_ready ( std::shared_ptr< Action > pAction,
H2Core::Hydrogen * pHydrogen )
private

Definition at line 1146 of file MidiAction.cpp.

◆ record_strobe()

bool record_strobe ( std::shared_ptr< Action > ,
H2Core::Hydrogen * pHydrogen )
private

Definition at line 1180 of file MidiAction.cpp.

◆ record_strobe_toggle()

bool record_strobe_toggle ( std::shared_ptr< Action > ,
H2Core::Hydrogen * pHydrogen )
private

Definition at line 1164 of file MidiAction.cpp.

◆ redo_action()

bool redo_action ( std::shared_ptr< Action > ,
H2Core::Hydrogen *  )
private

Definition at line 1226 of file MidiAction.cpp.

◆ select_and_play_pattern()

bool select_and_play_pattern ( std::shared_ptr< Action > pAction,
H2Core::Hydrogen * pHydrogen )
private

Definition at line 463 of file MidiAction.cpp.

◆ select_instrument()

bool select_instrument ( std::shared_ptr< Action > pAction,
H2Core::Hydrogen * pHydrogen )
private

Definition at line 481 of file MidiAction.cpp.

◆ select_next_pattern()

bool select_next_pattern ( std::shared_ptr< Action > pAction,
H2Core::Hydrogen * pHydrogen )
private

Definition at line 377 of file MidiAction.cpp.

◆ select_next_pattern_cc_absolute()

bool select_next_pattern_cc_absolute ( std::shared_ptr< Action > pAction,
H2Core::Hydrogen * pHydrogen )
private

Definition at line 389 of file MidiAction.cpp.

◆ select_next_pattern_relative()

bool select_next_pattern_relative ( std::shared_ptr< Action > pAction,
H2Core::Hydrogen * pHydrogen )
private

Definition at line 383 of file MidiAction.cpp.

◆ select_only_next_pattern()

bool select_only_next_pattern ( std::shared_ptr< Action > pAction,
H2Core::Hydrogen * pHydrogen )
private

Definition at line 421 of file MidiAction.cpp.

◆ select_only_next_pattern_cc_absolute()

bool select_only_next_pattern_cc_absolute ( std::shared_ptr< Action > pAction,
H2Core::Hydrogen * pHydrogen )
private

Definition at line 426 of file MidiAction.cpp.

◆ setSong()

bool setSong ( int nSongNumber,
H2Core::Hydrogen * pHydrogen )
private

Definition at line 1106 of file MidiAction.cpp.

◆ stop()

bool stop ( std::shared_ptr< Action > ,
H2Core::Hydrogen * pHydrogen )
private

Definition at line 239 of file MidiAction.cpp.

◆ strip_mute_toggle()

bool strip_mute_toggle ( std::shared_ptr< Action > pAction,
H2Core::Hydrogen * pHydrogen )
private

Definition at line 310 of file MidiAction.cpp.

◆ strip_solo_toggle()

bool strip_solo_toggle ( std::shared_ptr< Action > pAction,
H2Core::Hydrogen * pHydrogen )
private

Definition at line 333 of file MidiAction.cpp.

◆ strip_volume_absolute()

bool strip_volume_absolute ( std::shared_ptr< Action > pAction,
H2Core::Hydrogen * pHydrogen )
private

Definition at line 624 of file MidiAction.cpp.

◆ strip_volume_relative()

bool strip_volume_relative ( std::shared_ptr< Action > pAction,
H2Core::Hydrogen * pHydrogen )
private

Definition at line 658 of file MidiAction.cpp.

◆ tap_tempo()

bool tap_tempo ( std::shared_ptr< Action > ,
H2Core::Hydrogen * pHydrogen )
private

Definition at line 366 of file MidiAction.cpp.

◆ toggle_metronome()

bool toggle_metronome ( std::shared_ptr< Action > ,
H2Core::Hydrogen * pHydrogen )
private

Definition at line 1206 of file MidiAction.cpp.

◆ undo_action()

bool undo_action ( std::shared_ptr< Action > ,
H2Core::Hydrogen *  )
private

Definition at line 1221 of file MidiAction.cpp.

◆ unmute()

bool unmute ( std::shared_ptr< Action > ,
H2Core::Hydrogen * pHydrogen )
private

Definition at line 290 of file MidiAction.cpp.

Field Documentation

◆ __instance

MidiActionManager * __instance = nullptr
staticprivate

Object holding the current MidiActionManager singleton.

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

Definition at line 151 of file MidiAction.h.

◆ m_actionList

QStringList m_actionList
private

Holds the names of all Action identifiers which Hydrogen is able to interpret.

Definition at line 157 of file MidiAction.h.

◆ m_actionMap

std::map<QString, std::pair<action_f,int> > m_actionMap
private

Holds all Action identifiers which Hydrogen is able to interpret.


It holds a pair consisting of a pointer to member function performing the desired action and an integer specifying how many additional Action parameters are required to do so.

Definition at line 168 of file MidiAction.h.

◆ m_nLastBpmChangeCCParameter

int m_nLastBpmChangeCCParameter
private

Definition at line 216 of file MidiAction.h.