hydrogen 1.2.3
InstrumentComponent Class Reference

#include <InstrumentComponent.h>

Inheritance diagram for InstrumentComponent:
Object< InstrumentComponent > Base

Public Member Functions

 InstrumentComponent (int related_drumkit_componentID)
 
 InstrumentComponent (std::shared_ptr< InstrumentComponent > other)
 
 ~InstrumentComponent ()
 
std::vector< std::shared_ptr< InstrumentLayer > >::iterator begin ()
 Iteration.
 
std::vector< std::shared_ptr< InstrumentLayer > >::iterator end ()
 
int get_drumkit_componentID ()
 Returns the component ID of the drumkit.
 
float get_gain () const
 
std::shared_ptr< InstrumentLayerget_layer (int idx)
 
std::shared_ptr< InstrumentLayeroperator[] (int ix)
 
void save_to (XMLNode *node, int component_id, bool bRecentVersion=true, bool bFull=false)
 
void set_drumkit_componentID (int related_drumkit_componentID)
 Sets the component ID __related_drumkit_componentID.
 
void set_gain (float gain)
 
void set_layer (std::shared_ptr< InstrumentLayer > layer, int idx)
 
QString toQString (const QString &sPrefix="", bool bShort=true) const override
 Formatted string version for debugging purposes.
 
- Public Member Functions inherited from Object< InstrumentComponent >
 Object ()
 
 Object (const Object< InstrumentComponent > &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.
 

Static Public Member Functions

static int getMaxLayers ()
 
static std::shared_ptr< InstrumentComponentload_from (XMLNode *pNode, const QString &sDrumkitPath, const License &drumkitLicense=License(), bool bSilent=false)
 
static void setMaxLayers (int layers)
 
- 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 Attributes

float __gain
 
std::vector< std::shared_ptr< InstrumentLayer > > __layers
 
int __related_drumkit_componentID
 Component ID of the drumkit.
 

Static Private Attributes

static int m_nMaxLayers
 Maximum number of layers to be used in the Instrument editor.
 

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< InstrumentComponent >
 ~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

Definition at line 43 of file InstrumentComponent.h.

Constructor & Destructor Documentation

◆ InstrumentComponent() [1/2]

InstrumentComponent ( int related_drumkit_componentID)

Definition at line 46 of file InstrumentComponent.cpp.

◆ InstrumentComponent() [2/2]

InstrumentComponent ( std::shared_ptr< InstrumentComponent > other)

Definition at line 56 of file InstrumentComponent.cpp.

◆ ~InstrumentComponent()

Definition at line 71 of file InstrumentComponent.cpp.

Member Function Documentation

◆ begin()

std::vector< std::shared_ptr< InstrumentLayer > >::iterator begin ( )

Iteration.

Definition at line 181 of file InstrumentComponent.cpp.

◆ end()

std::vector< std::shared_ptr< InstrumentLayer > >::iterator end ( )

Definition at line 185 of file InstrumentComponent.cpp.

◆ get_drumkit_componentID()

int get_drumkit_componentID ( )
inline

Returns the component ID of the drumkit.

Returns
__related_drumkit_componentID

Definition at line 113 of file InstrumentComponent.h.

◆ get_gain()

float get_gain ( ) const
inline

Definition at line 123 of file InstrumentComponent.h.

◆ get_layer()

std::shared_ptr< InstrumentLayer > get_layer ( int idx)
inline

Definition at line 134 of file InstrumentComponent.h.

◆ getMaxLayers()

int getMaxLayers ( )
static
Returns
m_nMaxLayers.

Definition at line 89 of file InstrumentComponent.cpp.

◆ load_from()

std::shared_ptr< InstrumentComponent > load_from ( XMLNode * pNode,
const QString & sDrumkitPath,
const License & drumkitLicense = License(),
bool bSilent = false )
static

Definition at line 94 of file InstrumentComponent.cpp.

◆ operator[]()

std::shared_ptr< InstrumentLayer > operator[] ( int ix)
inline

Definition at line 128 of file InstrumentComponent.h.

◆ save_to()

void save_to ( XMLNode * node,
int component_id,
bool bRecentVersion = true,
bool bFull = false )

Definition at line 126 of file InstrumentComponent.cpp.

◆ set_drumkit_componentID()

void set_drumkit_componentID ( int related_drumkit_componentID)
inline

Sets the component ID __related_drumkit_componentID.

Parameters
related_drumkit_componentIDNew value for the component ID

Definition at line 107 of file InstrumentComponent.h.

◆ set_gain()

void set_gain ( float gain)
inline

Definition at line 118 of file InstrumentComponent.h.

◆ set_layer()

void set_layer ( std::shared_ptr< InstrumentLayer > layer,
int idx )

Definition at line 78 of file InstrumentComponent.cpp.

◆ setMaxLayers()

void setMaxLayers ( int layers)
static
Parameters
layersSets m_nMaxLayers.

Definition at line 84 of file InstrumentComponent.cpp.

◆ toQString()

QString toQString ( const QString & sPrefix = "",
bool bShort = true ) const
overridevirtual

Formatted string version for debugging purposes.

Parameters
sPrefixString prefix which will be added in front of every new line
bShortInstead of the whole content of all classes stored as members just a single unique identifier will be displayed without line breaks.
Returns
String presentation of current object.

Reimplemented from Base.

Definition at line 146 of file InstrumentComponent.cpp.

Field Documentation

◆ __gain

float __gain
private

Definition at line 91 of file InstrumentComponent.h.

◆ __layers

std::vector<std::shared_ptr<InstrumentLayer> > __layers
private

Definition at line 101 of file InstrumentComponent.h.

◆ __related_drumkit_componentID

int __related_drumkit_componentID
private

Component ID of the drumkit.

It is set by set_drumkit_componentID() and accessed via get_drumkit_componentID().

Definition at line 90 of file InstrumentComponent.h.

◆ m_nMaxLayers

int m_nMaxLayers
staticprivate

Maximum number of layers to be used in the Instrument editor.

It is set by setMaxLayers(), queried by getMaxLayers(), and inferred from Preferences::m_nMaxLayers. Default value assigned in Preferences::Preferences(): 16.

Definition at line 100 of file InstrumentComponent.h.