hydrogen 1.1.1
MidiMap Class Reference

The MidiMap maps MidiActions to MidiEvents. More...

#include <MidiMap.h>

Inheritance diagram for MidiMap:
Object

Public Types

typedef std::map< QString, Action * > map_t
 

Public Member Functions

 ~MidiMap ()
 
void reset ()
 Reinitializes the object. More...
 
void registerMMCEvent (QString, Action *)
 Sets up the relation between a mmc event and an action. More...
 
void registerNoteEvent (int, Action *)
 Sets up the relation between a note event and an action. More...
 
void registerCCEvent (int, Action *)
 Sets up the relation between a cc event and an action. More...
 
void registerPCEvent (Action *)
 Sets up the relation between a program change and an action. More...
 
map_t getMMCMap ()
 
ActiongetMMCAction (QString)
 Returns the mmc action which was linked to the given event. More...
 
ActiongetNoteAction (int note)
 Returns the note action which was linked to the given event. More...
 
ActiongetCCAction (int parameter)
 Returns the cc action which was linked to the given event. More...
 
ActiongetPCAction ()
 Returns the pc action which was linked to the given event. More...
 
int findCCValueByActionParam1 (QString actionType, QString param1) const
 
int findCCValueByActionType (QString actionType) const
 
void setupNoteArray ()
 
- Public Member Functions inherited from Object
 ~Object ()
 destructor More...
 
 Object (const Object &obj)
 copy constructor More...
 
 Object (const char *class_name)
 constructor More...
 
const char * class_name () const
 return the class name More...
 
virtual QString toQString (const QString &sPrefix, bool bShort=true) const
 Formatted string version for debugging purposes. More...
 
void Print (bool bShort=true) const
 Prints content of toQString() via DEBUGLOG. More...
 

Static Public Member Functions

static void create_instance ()
 If __instance equals 0, a new MidiMap singleton will be created and stored in it. More...
 
static void reset_instance ()
 Convenience function calling reset() on the current MidiMap __instance. More...
 
static MidiMapget_instance ()
 Returns a pointer to the current MidiMap singleton stored in __instance. More...
 
- Static Public Member Functions inherited from Object
static void set_count (bool flag)
 enable/disable class instances counting More...
 
static bool count_active ()
 return true if class instances counting is enabled More...
 
static unsigned objects_count ()
 return the number of objects More...
 
static void write_objects_map_to (std::ostream &out)
 output the full objects map to a given ostream More...
 
static void write_objects_map_to_cerr ()
 output objects map to stderr More...
 
static int bootstrap (Logger *logger, bool count=false)
 must be called before any Object instantiation ! More...
 
static Loggerlogger ()
 return the logger instance More...
 

Static Public Attributes

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

Private Member Functions

 MidiMap ()
 

Private Attributes

Action__note_array [128]
 
Action__cc_array [128]
 
Action__pc_action
 
map_t mmcMap
 
QMutex __mutex
 

Additional Inherited Members

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

Detailed Description

The MidiMap maps MidiActions to MidiEvents.

The MidiMap stores the mapping between midi events and midi actions. Each event relates to at most 1 midi action. Several events can relate to the same action. Midi events are note, mmc or cc messages.

Author
Sebastian Moors

Member Typedef Documentation

◆ map_t

typedef std::map< QString, Action* > map_t

Constructor & Destructor Documentation

◆ ~MidiMap()

~MidiMap ( )

◆ MidiMap()

MidiMap ( )
private

Member Function Documentation

◆ create_instance()

void create_instance ( )
static

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

It is called in Hydrogen::create_instance().

◆ findCCValueByActionParam1()

int findCCValueByActionParam1 ( QString  actionType,
QString  param1 
) const

◆ findCCValueByActionType()

int findCCValueByActionType ( QString  actionType) const

◆ get_instance()

static MidiMap * get_instance ( )
inlinestatic

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

◆ getCCAction()

Action * getCCAction ( int  parameter)

Returns the cc action which was linked to the given event.

◆ getMMCAction()

Action * getMMCAction ( QString  eventString)

Returns the mmc action which was linked to the given event.

◆ getMMCMap()

std::map< QString, Action * > getMMCMap ( )

◆ getNoteAction()

Action * getNoteAction ( int  note)

Returns the note action which was linked to the given event.

◆ getPCAction()

Action * getPCAction ( )

Returns the pc action which was linked to the given event.

◆ registerCCEvent()

void registerCCEvent ( int  parameter,
Action pAction 
)

Sets up the relation between a cc event and an action.

◆ registerMMCEvent()

void registerMMCEvent ( QString  eventString,
Action pAction 
)

Sets up the relation between a mmc event and an action.

◆ registerNoteEvent()

void registerNoteEvent ( int  note,
Action pAction 
)

Sets up the relation between a note event and an action.

◆ registerPCEvent()

void registerPCEvent ( Action pAction)

Sets up the relation between a program change and an action.

◆ reset()

void reset ( )

Reinitializes the object.

Clears the complete midi map and releases the memory of the contained actions.

◆ reset_instance()

void reset_instance ( )
static

Convenience function calling reset() on the current MidiMap __instance.

◆ setupNoteArray()

void setupNoteArray ( )

Field Documentation

◆ __cc_array

Action* __cc_array[128]
private

◆ __instance

MidiMap * __instance = nullptr
static

Object holding the current MidiMap singleton.

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

◆ __mutex

QMutex __mutex
private

◆ __note_array

Action* __note_array[128]
private

◆ __pc_action

Action* __pc_action
private

◆ mmcMap

map_t mmcMap
private