hydrogen 1.2.6
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 logBacktrace () const
 Print the current stack at point into the debug log.
 
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 clear_pattern (std::shared_ptr< Action >, H2Core::Hydrogen *)
 
bool clear_selected_instrument (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 instrument_pitch (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
 
static bool bLogColors = true
 

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 140 of file MidiAction.cpp.

◆ ~MidiActionManager()

Definition at line 211 of file MidiAction.cpp.

Member Function Documentation

◆ beatcounter()

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

Definition at line 363 of file MidiAction.cpp.

◆ bpm_cc_relative()

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

Definition at line 957 of file MidiAction.cpp.

◆ bpm_decrease()

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

Definition at line 1080 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 1009 of file MidiAction.cpp.

◆ bpm_increase()

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

Definition at line 1055 of file MidiAction.cpp.

◆ clear_pattern()

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

Definition at line 1285 of file MidiAction.cpp.

◆ clear_selected_instrument()

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

Definition at line 1268 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 216 of file MidiAction.cpp.

◆ effect_level_absolute()

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

Definition at line 510 of file MidiAction.cpp.

◆ effect_level_relative()

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

Definition at line 545 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 918 of file MidiAction.cpp.

◆ gain_level_absolute()

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

Definition at line 805 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 255 of file MidiAction.h.

◆ getActionList()

QStringList getActionList ( )
inline

Definition at line 257 of file MidiAction.h.

◆ getParameterNumber()

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

Definition at line 1257 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 1325 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 1310 of file MidiAction.cpp.

◆ instrument_pitch()

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

Definition at line 901 of file MidiAction.cpp.

◆ master_volume_absolute()

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

Definition at line 583 of file MidiAction.cpp.

◆ master_volume_relative()

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

Definition at line 605 of file MidiAction.cpp.

◆ mute()

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

Definition at line 287 of file MidiAction.cpp.

◆ mute_toggle()

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

Definition at line 307 of file MidiAction.cpp.

◆ next_bar()

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

Definition at line 1105 of file MidiAction.cpp.

◆ nextPatternSelection()

bool nextPatternSelection ( int nPatternNumber)
private

Definition at line 401 of file MidiAction.cpp.

◆ onlyNextPatternSelection()

bool onlyNextPatternSelection ( int nPatternNumber)
private

Definition at line 438 of file MidiAction.cpp.

◆ pan_absolute()

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

Definition at line 706 of file MidiAction.cpp.

◆ pan_absolute_sym()

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

Definition at line 737 of file MidiAction.cpp.

◆ pan_relative()

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

Definition at line 769 of file MidiAction.cpp.

◆ pause()

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

Definition at line 235 of file MidiAction.cpp.

◆ pitch_level_absolute()

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

Definition at line 852 of file MidiAction.cpp.

◆ play()

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

Definition at line 222 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 257 of file MidiAction.cpp.

◆ playlist_next_song()

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

Definition at line 1162 of file MidiAction.cpp.

◆ playlist_previous_song()

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

Definition at line 1167 of file MidiAction.cpp.

◆ playlist_song()

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

Definition at line 1156 of file MidiAction.cpp.

◆ previous_bar()

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

Definition at line 1120 of file MidiAction.cpp.

◆ record_exit()

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

Definition at line 1219 of file MidiAction.cpp.

◆ record_ready()

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

Definition at line 1172 of file MidiAction.cpp.

◆ record_strobe()

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

Definition at line 1206 of file MidiAction.cpp.

◆ record_strobe_toggle()

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

Definition at line 1190 of file MidiAction.cpp.

◆ redo_action()

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

Definition at line 1252 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 470 of file MidiAction.cpp.

◆ select_instrument()

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

Definition at line 488 of file MidiAction.cpp.

◆ select_next_pattern()

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

Definition at line 384 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 396 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 390 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 428 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 433 of file MidiAction.cpp.

◆ setSong()

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

Definition at line 1132 of file MidiAction.cpp.

◆ stop()

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

Definition at line 246 of file MidiAction.cpp.

◆ strip_mute_toggle()

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

Definition at line 317 of file MidiAction.cpp.

◆ strip_solo_toggle()

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

Definition at line 340 of file MidiAction.cpp.

◆ strip_volume_absolute()

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

Definition at line 631 of file MidiAction.cpp.

◆ strip_volume_relative()

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

Definition at line 665 of file MidiAction.cpp.

◆ tap_tempo()

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

Definition at line 373 of file MidiAction.cpp.

◆ toggle_metronome()

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

Definition at line 1232 of file MidiAction.cpp.

◆ undo_action()

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

Definition at line 1247 of file MidiAction.cpp.

◆ unmute()

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

Definition at line 297 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 219 of file MidiAction.h.