|
hydrogen 1.1.1
|
Pattern class is a Note container. More...
#include <Pattern.h>
Public Types | |
| typedef std::multimap< int, Note * > | notes_t |
| < multimap note type More... | |
| typedef notes_t::iterator | notes_it_t |
| multimap note const iterator type More... | |
| typedef notes_t::const_iterator | notes_cst_it_t |
| note set type; More... | |
| typedef std::set< Pattern * > | virtual_patterns_t |
| note set iterator type; More... | |
| typedef virtual_patterns_t::iterator | virtual_patterns_it_t |
| note set const iterator type; More... | |
| typedef virtual_patterns_t::const_iterator | virtual_patterns_cst_it_t |
Public Member Functions | |
| Pattern (const QString &name="Pattern", const QString &info="", const QString &category="not_categorized", int length=MAX_NOTES, int denominator=4) | |
| constructor More... | |
| Pattern (Pattern *other) | |
| copy constructor More... | |
| ~Pattern () | |
| destructor More... | |
| bool | save_file (const QString &drumkit_name, const QString &author, const QString &license, const QString &pattern_path, bool overwrite=false) const |
| save a pattern into an xml file More... | |
| void | set_name (const QString &name) |
| get the name of the pattern More... | |
| const QString & | get_name () const |
| set the category of the pattern More... | |
| void | set_category (const QString &category) |
| set the info of the pattern More... | |
| void | set_info (const QString &info) |
| get the info of the pattern More... | |
| const QString & | get_info () const |
| get the category of the pattern More... | |
| const QString & | get_category () const |
| set the length of the pattern More... | |
| void | set_length (int length) |
| get the length of the pattern More... | |
| int | get_length () const |
| set the denominator of the pattern More... | |
| void | set_denominator (int denominator) |
| get the denominator of the pattern More... | |
| int | get_denominator () const |
| get the note multimap More... | |
| const notes_t * | get_notes () const |
| get the virtual pattern set More... | |
| const virtual_patterns_t * | get_virtual_patterns () const |
| get the flattened virtual pattern set More... | |
| const virtual_patterns_t * | get_flattened_virtual_patterns () const |
| void | insert_note (Note *note) |
| insert a new note within __notes More... | |
| Note * | find_note (int idx_a, int idx_b, Instrument *instrument, bool strict=true) const |
| search for a note at a given index within __notes which correspond to the given arguments More... | |
| Note * | find_note (int idx_a, int idx_b, Instrument *instrument, Note::Key key, Note::Octave octave, bool strict=true) const |
| search for a note at a given index within __notes which correspond to the given arguments More... | |
| void | remove_note (Note *note) |
| removes a given note from __notes, it's not deleted More... | |
| bool | references (Instrument *instr) |
| check if this pattern contains a note referencing the given instrument More... | |
| void | purge_instrument (Instrument *instr) |
| delete the notes referencing the given instrument The function is thread safe (it locks the audio data while deleting notes) More... | |
| void | set_to_old () |
| mark all notes as old More... | |
| bool | virtual_patterns_empty () const |
| clear __virtual_patterns More... | |
| void | virtual_patterns_clear () |
| void | virtual_patterns_add (Pattern *pattern) |
| add a pattern to __virtual_patterns More... | |
| void | virtual_patterns_del (Pattern *pattern) |
| remove a pattern from virtual_pattern set, flattened virtual patterns have to be rebuilt More... | |
| void | flattened_virtual_patterns_clear () |
| void | flattened_virtual_patterns_compute () |
| compute virtual_pattern_transitive_closure_set based on virtual_pattern_transitive_closure_set virtual_pattern_transitive_closure_set must have been cleared before which is the case is called from PatternList::compute_flattened_virtual_patterns More... | |
| void | extand_with_flattened_virtual_patterns (PatternList *patterns) |
| add content of __flatteened_virtual_patterns into patterns More... | |
| void | save_to (XMLNode *node, const Instrument *instrumentOnly=nullptr) const |
| save the pattern within the given XMLNode More... | |
| QString | toQString (const QString &sPrefix, bool bShort=true) const override |
| Formatted string version for debugging purposes. More... | |
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 Pattern * | load_file (const QString &pattern_path, InstrumentList *instruments) |
| load a pattern from a file 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 Logger * | logger () |
| return the logger instance More... | |
Static Private Member Functions | |
| static Pattern * | load_from (XMLNode *node, InstrumentList *instruments) |
| load a pattern from an XMLNode More... | |
Private Attributes | |
| int | __length |
| the length of the pattern More... | |
| int | __denominator |
| the meter denominator of the pattern used in meter (eg 4/4) More... | |
| QString | __name |
| the name of thepattern More... | |
| QString | __category |
| the category of the pattern More... | |
| QString | __info |
| a description of the pattern More... | |
| notes_t | __notes |
| a multimap (hash with possible multiple values for one key) of note More... | |
| virtual_patterns_t | __virtual_patterns |
| a list of patterns directly referenced by this one More... | |
| virtual_patterns_t | __flattened_virtual_patterns |
| the complete list of virtual patterns More... | |
Additional Inherited Members | |
Static Public Attributes inherited from Object | |
| static QString | sPrintIndention = " " |
| String used to format the debugging string output of some core classes. More... | |
Static Protected Attributes inherited from Object | |
| static Logger * | __logger = nullptr |
| logger instance pointer More... | |
| typedef notes_t::const_iterator notes_cst_it_t |
note set type;
| typedef notes_t::iterator notes_it_t |
multimap note const iterator type
| typedef virtual_patterns_t::const_iterator virtual_patterns_cst_it_t |
| typedef virtual_patterns_t::iterator virtual_patterns_it_t |
note set const iterator type;
| typedef std::set<Pattern*> virtual_patterns_t |
note set iterator type;
| Pattern | ( | const QString & | name = "Pattern", |
| const QString & | info = "", |
||
| const QString & | category = "not_categorized", |
||
| int | length = MAX_NOTES, |
||
| int | denominator = 4 |
||
| ) |
constructor
| name | the name of the pattern |
| info | Initialized with an empty string. |
| category | the category of the pattern |
| length | the length of the pattern |
| denominator | the denominator for meter representation (eg 4/4) |
| ~Pattern | ( | ) |
destructor
| void extand_with_flattened_virtual_patterns | ( | PatternList * | patterns | ) |
add content of __flatteened_virtual_patterns into patterns
| patterns | the pattern list to feed |
| Note * find_note | ( | int | idx_a, |
| int | idx_b, | ||
| Instrument * | instrument, | ||
| bool | strict = true |
||
| ) | const |
search for a note at a given index within __notes which correspond to the given arguments
| idx_a | the first __notes index to search in |
| idx_b | the second __notes index to search in, will be omitted if is -1 |
| instrument | the instrument the note should be playing |
| strict | if set to false, will search for a note around the given idx |
| Note * find_note | ( | int | idx_a, |
| int | idx_b, | ||
| Instrument * | instrument, | ||
| Note::Key | key, | ||
| Note::Octave | octave, | ||
| bool | strict = true |
||
| ) | const |
search for a note at a given index within __notes which correspond to the given arguments
| idx_a | the first __notes index to search in |
| idx_b | the second __notes index to search in, will be omitted if is -1 |
| instrument | the instrument the note should be playing |
| key | the key that should be set to the note |
| octave | the octave that should be set to the note |
| strict | if set to false, will search for a note around the given idx |
|
inline |
| void flattened_virtual_patterns_compute | ( | ) |
compute virtual_pattern_transitive_closure_set based on virtual_pattern_transitive_closure_set virtual_pattern_transitive_closure_set must have been cleared before which is the case is called from PatternList::compute_flattened_virtual_patterns
|
inline |
set the length of the pattern
|
inline |
get the note multimap
|
inline |
|
inline |
get the category of the pattern
|
inline |
set the denominator of the pattern
|
inline |
set the category of the pattern
|
inline |
get the virtual pattern set
|
inline |
get the flattened virtual pattern set
|
inline |
insert a new note within __notes
| note | the note to be inserted |
|
static |
load a pattern from a file
| pattern_path | the path to the file to load the pattern from |
| instruments | the current instrument list to search instrument into |
|
staticprivate |
| void purge_instrument | ( | Instrument * | instr | ) |
delete the notes referencing the given instrument The function is thread safe (it locks the audio data while deleting notes)
| instr | the instrument |
| bool references | ( | Instrument * | instr | ) |
check if this pattern contains a note referencing the given instrument
| instr | the instrument |
| void remove_note | ( | Note * | note | ) |
removes a given note from __notes, it's not deleted
| note | the note to be removed |
| bool save_file | ( | const QString & | drumkit_name, |
| const QString & | author, | ||
| const QString & | license, | ||
| const QString & | pattern_path, | ||
| bool | overwrite = false |
||
| ) | const |
save a pattern into an xml file
| drumkit_name | the name of the drumkit it is supposed to play with |
| author | the name of the author |
| license | the license that applies to it |
| pattern_path | the path to save the pattern into |
| overwrite | allows to write over existing pattern file |
| void save_to | ( | XMLNode * | node, |
| const Instrument * | instrumentOnly = nullptr |
||
| ) | const |
|
inline |
set the info of the pattern
|
inline |
get the denominator of the pattern
|
inline |
get the info of the pattern
|
inline |
get the length of the pattern
|
inline |
get the name of the pattern
| void set_to_old | ( | ) |
mark all notes as old
return true if __virtual_patterns is empty
|
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 Object.
|
inline |
add a pattern to __virtual_patterns
| pattern | the pattern to add |
|
inline |
|
inline |
remove a pattern from virtual_pattern set, flattened virtual patterns have to be rebuilt
clear flattened_virtual_patterns
|
inline |
clear __virtual_patterns
|
private |
the category of the pattern
|
private |
the meter denominator of the pattern used in meter (eg 4/4)
|
private |
the complete list of virtual patterns
|
private |
a description of the pattern
|
private |
the length of the pattern
|
private |
the name of thepattern
|
private |
a multimap (hash with possible multiple values for one key) of note
|
private |
a list of patterns directly referenced by this one