|
hydrogen 1.2.6
|
InstrumentList is a collection of instruments used within a song, a drumkit, ... More...
#include <InstrumentList.h>
Data Structures | |
| struct | Content |
Public Member Functions | |
| InstrumentList () | |
| constructor | |
| InstrumentList (std::shared_ptr< InstrumentList > other) | |
| copy constructor | |
| ~InstrumentList () | |
| destructor | |
| void | add (std::shared_ptr< Instrument > instrument) |
| add an instrument to the list | |
| std::vector< std::shared_ptr< Instrument > >::iterator | begin () |
| Iteration. | |
| std::shared_ptr< Instrument > | del (int idx) |
| remove the instrument at a given index, does not delete it | |
| std::shared_ptr< Instrument > | del (std::shared_ptr< Instrument > instrument) |
| remove an instrument from the list, does not delete it | |
| std::vector< std::shared_ptr< Instrument > >::iterator | end () |
| std::shared_ptr< Instrument > | find (const int i) |
| find an instrument within the instruments | |
| std::shared_ptr< Instrument > | find (const QString &name) |
| find an instrument within the instruments | |
| std::shared_ptr< Instrument > | findMidiNote (const int note) |
| find an instrument which play the given midi note | |
| void | fix_issue_307 () |
| Fix GitHub issue #307, so called "Hi Bongo fiasco". | |
| std::shared_ptr< Instrument > | get (int idx) const |
| get an instrument from the list | |
| bool | has_all_midi_notes_same () const |
| Check if all instruments have assigned the same MIDI out note. | |
| int | index (std::shared_ptr< Instrument > instrument) |
| get the index of an instrument within the instruments | |
| void | insert (int idx, std::shared_ptr< Instrument > instrument) |
| insert an instrument into the list | |
| bool | is_valid_index (int idx) const |
| check if there is a idx is a valid index for this list without throwing an error messaage | |
| bool | isAnyInstrumentSoloed () |
| Check if any instrument in the list is solo'd. | |
| void | load_samples (float fBpm=120) |
| Calls the Instrument::load_samples() member function of all Instruments in __instruments. | |
| void | move (int idx_a, int idx_b) |
| move an instrument from a position to another | |
| bool | operator!= (std::shared_ptr< InstrumentList > pOther) const |
| void | operator<< (std::shared_ptr< Instrument > instrument) |
| add an instrument to the list | |
| bool | operator== (std::shared_ptr< InstrumentList > pOther) const |
| Superficial comparison check. | |
| std::shared_ptr< Instrument > | operator[] (int idx) |
| get an instrument from the list | |
| void | save_to (XMLNode *node, int component_id, bool bRecentVersion=true, bool bFull=false) |
| save the instrument list within the given XMLNode | |
| void | set_default_midi_out_notes () |
| Set each instrument consecuteve MIDI out notes, starting from 36. | |
| int | size () const |
| returns the numbers of instruments | |
| std::vector< std::shared_ptr< Content > > | summarizeContent (const std::shared_ptr< std::vector< std::shared_ptr< DrumkitComponent > > > pDrumkitComponents) const |
| Returns vector of lists containing instrument name, component name, file name, the license of all associated samples. | |
| void | swap (int idx_a, int idx_b) |
| swap the instruments of two different indexes | |
| QString | toQString (const QString &sPrefix="", bool bShort=true) const override |
| Formatted string version for debugging purposes. | |
| void | unload_samples () |
| Calls the Instrument::unload_samples() member function of all Instruments in __instruments. | |
Public Member Functions inherited from Object< InstrumentList > | |
| Object () | |
| Object (const Object< InstrumentList > &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. | |
Static Public Member Functions | |
| static std::shared_ptr< InstrumentList > | load_from (XMLNode *node, const QString &sDrumkitPath, const QString &sDrumkitName, const License &license=License(), bool *pLegacyFormatEncountered=nullptr, bool bSilent=false) |
| load an instrument list from an XMLNode | |
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 Logger * | logger () |
| 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 | |
| std::vector< std::shared_ptr< Instrument > > | __instruments |
| the list of instruments | |
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< InstrumentList > | |
| ~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 |
InstrumentList is a collection of instruments used within a song, a drumkit, ...
Definition at line 42 of file InstrumentList.h.
| InstrumentList | ( | ) |
constructor
Definition at line 39 of file InstrumentList.cpp.
| ~InstrumentList | ( | ) |
destructor
Definition at line 52 of file InstrumentList.cpp.
| InstrumentList | ( | std::shared_ptr< InstrumentList > | other | ) |
| void add | ( | std::shared_ptr< Instrument > | instrument | ) |
add an instrument to the list
| instrument | a pointer to the instrument to add |
Definition at line 165 of file InstrumentList.cpp.
| std::vector< std::shared_ptr< Instrument > >::iterator begin | ( | ) |
Iteration.
Definition at line 386 of file InstrumentList.cpp.
| std::shared_ptr< Instrument > del | ( | int | idx | ) |
remove the instrument at a given index, does not delete it
| idx | the index |
Definition at line 246 of file InstrumentList.cpp.
| std::shared_ptr< Instrument > del | ( | std::shared_ptr< Instrument > | instrument | ) |
remove an instrument from the list, does not delete it
| instrument | the instrument to be removed |
Definition at line 254 of file InstrumentList.cpp.
| std::vector< std::shared_ptr< Instrument > >::iterator end | ( | ) |
Definition at line 390 of file InstrumentList.cpp.
| std::shared_ptr< Instrument > find | ( | const int | i | ) |
find an instrument within the instruments
| i | the id of the instrument to find |
Definition at line 222 of file InstrumentList.cpp.
| std::shared_ptr< Instrument > find | ( | const QString & | name | ) |
find an instrument within the instruments
| name | the name of the instrument to find |
Definition at line 230 of file InstrumentList.cpp.
| std::shared_ptr< Instrument > findMidiNote | ( | const int | note | ) |
find an instrument which play the given midi note
| note | the Midi note of the instrument to find |
Definition at line 238 of file InstrumentList.cpp.
| void fix_issue_307 | ( | ) |
Fix GitHub issue #307, so called "Hi Bongo fiasco".
Check whether the same MIDI note is assignedto every instrument - that condition makes MIDI export unusable. When so, assign each instrument consecutive MIDI note starting from 36.
Definition at line 333 of file InstrumentList.cpp.
| std::shared_ptr< Instrument > get | ( | int | idx | ) | const |
get an instrument from the list
| idx | the index to get the instrument from |
Definition at line 204 of file InstrumentList.cpp.
| bool has_all_midi_notes_same | ( | ) | const |
Check if all instruments have assigned the same MIDI out note.
Definition at line 341 of file InstrumentList.cpp.
| int index | ( | std::shared_ptr< Instrument > | instrument | ) |
get the index of an instrument within the instruments
| instrument | a pointer to the instrument to find |
Definition at line 214 of file InstrumentList.cpp.
| void insert | ( | int | idx, |
| std::shared_ptr< Instrument > | instrument ) |
insert an instrument into the list
| idx | the index to insert the instrument at |
| instrument | a pointer to the instrument to add |
Definition at line 174 of file InstrumentList.cpp.
| bool is_valid_index | ( | int | idx | ) | const |
check if there is a idx is a valid index for this list without throwing an error messaage
| idx | the index of the instrument |
Definition at line 193 of file InstrumentList.cpp.
| bool isAnyInstrumentSoloed | ( | ) |
Check if any instrument in the list is solo'd.
Definition at line 417 of file InstrumentList.cpp.
|
static |
load an instrument list from an XMLNode
| node | the XMLDode to read from |
| sDrumkitPath | the directory holding the Drumkit |
| sDrumkitName | name of the Drumkit found in sDrumkitPath |
| license | License assigned to all Samples that will be loaded. If empty, the license will be read from dk_path. |
| pLegacyFormatEncountered | will be set to true is any of the XML elements requires legacy format support and left untouched otherwise. |
| bSilent | if set to true, all log messages except of errors and warnings are suppressed. |
Definition at line 70 of file InstrumentList.cpp.
| void load_samples | ( | float | fBpm = 120 | ) |
Calls the Instrument::load_samples() member function of all Instruments in __instruments.
Definition at line 56 of file InstrumentList.cpp.
| void move | ( | int | idx_a, |
| int | idx_b ) |
move an instrument from a position to another
| idx_a | the start index |
| idx_b | the finish index |
Definition at line 276 of file InstrumentList.cpp.
| bool operator!= | ( | std::shared_ptr< InstrumentList > | pOther | ) | const |
Definition at line 151 of file InstrumentList.cpp.
| void operator<< | ( | std::shared_ptr< Instrument > | instrument | ) |
add an instrument to the list
| instrument | a pointer to the instrument to add |
Definition at line 128 of file InstrumentList.cpp.
| bool operator== | ( | std::shared_ptr< InstrumentList > | pOther | ) | const |
Superficial comparison check.
If it succeeds, both objects are identical. If it fails, however, they are not guarantued to be not identical.
Definition at line 137 of file InstrumentList.cpp.
| std::shared_ptr< Instrument > operator[] | ( | int | idx | ) |
get an instrument from the list
| idx | the index to get the instrument from |
Definition at line 183 of file InstrumentList.cpp.
| void save_to | ( | XMLNode * | node, |
| int | component_id, | ||
| bool | bRecentVersion = true, | ||
| bool | bFull = false ) |
save the instrument list within the given XMLNode
| node | the XMLNode to feed |
| component_id | Identifier of the corresponding component. |
| bRecentVersion | Whether the drumkit format should be supported by Hydrogen 0.9.7 or higher (whether it should be composed of DrumkitComponents). |
| bFull | Whether to write all parameters of the contained Sample as well. This will be done when storing an Instrument as part of a Song but not when storing as part of a Drumkit. |
Definition at line 116 of file InstrumentList.cpp.
| void set_default_midi_out_notes | ( | ) |
Set each instrument consecuteve MIDI out notes, starting from 36.
Definition at line 355 of file InstrumentList.cpp.
|
inline |
returns the numbers of instruments
Definition at line 264 of file InstrumentList.h.
| std::vector< std::shared_ptr< InstrumentList::Content > > summarizeContent | ( | const std::shared_ptr< std::vector< std::shared_ptr< DrumkitComponent > > > | pDrumkitComponents | ) | const |
Returns vector of lists containing instrument name, component name, file name, the license of all associated samples.
Definition at line 287 of file InstrumentList.cpp.
| void swap | ( | int | idx_a, |
| int | idx_b ) |
swap the instruments of two different indexes
| idx_a | the first index |
| idx_b | the second index |
Definition at line 265 of file InstrumentList.cpp.
|
overridevirtual |
Formatted string version for debugging purposes.
| sPrefix | String prefix which will be added in front of every new line |
| bShort | Instead of the whole content of all classes stored as members just a single unique identifier will be displayed without line breaks. |
Reimplemented from Base.
Definition at line 362 of file InstrumentList.cpp.
| void unload_samples | ( | ) |
Calls the Instrument::unload_samples() member function of all Instruments in __instruments.
Definition at line 63 of file InstrumentList.cpp.
|
private |
the list of instruments
Definition at line 259 of file InstrumentList.h.