50 typedef std::multimap <int, Note*>
notes_t;
63 std::set<Pattern*>::iterator
begin();
64 std::set<Pattern*>::iterator
end();
74 Pattern(
const QString& name=
"Pattern",
const QString& info=
"",
const QString& category=
"not_categorized",
int length=
MAX_NOTES,
int denominator=4 );
85 static Pattern*
load_file(
const QString& pattern_path, std::shared_ptr<InstrumentList> instruments );
105 bool save_file(
const QString& drumkit_name,
const QString& author,
const License& license,
const QString& pattern_path,
bool overwrite=
false )
const;
108 void set_name(
const QString& name );
114 void set_info(
const QString& info );
147 Note*
find_note(
int idx_a,
int idx_b, std::shared_ptr<Instrument> instrument,
bool strict=
true )
const;
169 bool references( std::shared_ptr<Instrument> instr );
175 void purge_instrument( std::shared_ptr<Instrument> instr,
bool bRequiredLock =
true );
228 void save_to(
XMLNode* node,
const std::shared_ptr<Instrument> instrumentOnly =
nullptr )
const;
237 QString
toQString(
const QString& sPrefix =
"",
bool bShort =
true )
const override;
264 static bool loadDoc(
const QString& sPatternPath, std::shared_ptr<InstrumentList> pInstrumentList,
XMLDoc* pDoc,
bool bSilent =
false );
268#define FOREACH_NOTE_CST_IT_BEGIN_END(_notes,_it) \
269 for( Pattern::notes_cst_it_t _it=(_notes)->begin(); (_it)!=(_notes)->end(); (_it)++ )
272#define FOREACH_NOTE_CST_IT_BOUND_END(_notes,_it,_bound) \
273 for( Pattern::notes_cst_it_t _it=(_notes)->lower_bound((_bound)); (_it)!=(_notes)->end() && (_it)->first == (_bound); (_it)++ )
276#define FOREACH_NOTE_IT_BEGIN_END(_notes,_it) \
277 for( Pattern::notes_it_t _it=(_notes)->begin(); (_it)!=(_notes)->end(); (_it)++ )
280#define FOREACH_NOTE_IT_BOUND_END(_notes,_it,_bound) \
281 for( Pattern::notes_it_t _it=(_notes)->lower_bound((_bound)); (_it)!=(_notes)->end() && (_it)->first == (_bound); (_it)++ )
285#define FOREACH_NOTE_CST_IT_BEGIN_LENGTH(_notes,_it,_pattern) \
286 for( Pattern::notes_cst_it_t _it=(_notes)->begin(); (_it)!=(_notes)->end() && (_it)->first < (_pattern)->get_length(); (_it)++ )
290#define FOREACH_NOTE_CST_IT_BOUND_LENGTH(_notes,_it,_bound,_pattern) \
291 for( Pattern::notes_cst_it_t _it=(_notes)->lower_bound((_bound)); (_it)!=(_notes)->end() && (_it)->first == (_bound) && (_it)->first < (_pattern)->get_length(); (_it)++ )
295#define FOREACH_NOTE_IT_BEGIN_LENGTH(_notes,_it,_pattern) \
296 for( Pattern::notes_it_t _it=(_notes)->begin(); (_it)!=(_notes)->end() && (_it)->first < (_pattern)->get_length(); (_it)++ )
300#define FOREACH_NOTE_IT_BOUND_LENGTH(_notes,_it,_bound,_pattern) \
301 for( Pattern::notes_it_t _it=(_notes)->lower_bound((_bound)); (_it)!=(_notes)->end() && (_it)->first == (_bound) && (_it)->first < (_pattern)->get_length(); (_it)++ )
Wrapper class to help Hydrogen deal with the license information specified in a drumkit.
A note plays an associated instrument with a velocity left and right pan.
int get_position() const
__position accessor
PatternList is a collection of patterns.
Pattern class is a Note container.
QString __name
the name of thepattern
bool save_file(const QString &drumkit_name, const QString &author, const License &license, const QString &pattern_path, bool overwrite=false) const
save a pattern into an xml file
const QString & get_info() const
get the category of the pattern
void set_name(const QString &name)
get the name of the pattern
std::set< Pattern * > virtual_patterns_t
note set iterator type;
const QString & get_name() const
set the category of the pattern
const virtual_patterns_t * get_flattened_virtual_patterns() const
bool virtual_patterns_empty() const
clear __virtual_patterns
void virtual_patterns_add(Pattern *pattern)
add a pattern to __virtual_patterns
const QString & get_category() const
set the length of the pattern
void set_to_old()
mark all notes as old
void flattened_virtual_patterns_clear()
void set_denominator(int denominator)
get the denominator of the pattern
QString __info
a description of the pattern
void set_info(const QString &info)
get the info of the pattern
void purge_instrument(std::shared_ptr< Instrument > instr, bool bRequiredLock=true)
delete the notes referencing the given instrument The function is thread safe (it locks the audio dat...
bool references(std::shared_ptr< Instrument > instr)
check if this pattern contains a note referencing the given instrument
virtual_patterns_t __virtual_patterns
a list of patterns directly referenced by this one
Pattern(const QString &name="Pattern", const QString &info="", const QString &category="not_categorized", int length=MAX_NOTES, int denominator=4)
constructor
void virtual_patterns_del(Pattern *pattern)
remove a pattern from virtual_pattern set, flattened virtual patterns have to be rebuilt
notes_t __notes
a multimap (hash with possible multiple values for one key) of note
const virtual_patterns_t * get_virtual_patterns() const
get the flattened virtual pattern set
static Pattern * load_from(XMLNode *node, std::shared_ptr< InstrumentList > instruments, bool bSilent=false)
load a pattern from an XMLNode
virtual_patterns_t::iterator virtual_patterns_it_t
note set const iterator type;
void flattened_virtual_patterns_compute()
compute virtual_pattern_transitive_closure_set based on virtual_pattern_transitive_closure_set virtua...
void remove_note(Note *note)
removes a given note from __notes, it's not deleted
int __length
Determines the accessible range or notes within the pattern.
notes_t::iterator notes_it_t
multimap note const iterator type
int get_length() const
set the denominator of the pattern
void virtual_patterns_clear()
std::set< Pattern * >::iterator begin()
allow iteration of all contained virtual patterns.
const notes_t * get_notes() const
get the virtual pattern set
void set_category(const QString &category)
set the info of the pattern
notes_t::const_iterator notes_cst_it_t
note set type;
std::multimap< int, Note * > notes_t
< multimap note type
static Pattern * load_file(const QString &pattern_path, std::shared_ptr< InstrumentList > instruments)
load a pattern from a file
void removeFlattenedVirtualPatterns(PatternList *pPatternList)
Add content of __flattened_virtual_patterns into pPatternList.
QString toQString(const QString &sPrefix="", bool bShort=true) const override
Formatted string version for debugging purposes.
int get_denominator() const
get the note multimap
Note * find_note(int idx_a, int idx_b, std::shared_ptr< Instrument > instrument, bool strict=true) const
search for a note at a given index within __notes which correspond to the given arguments
virtual_patterns_t::const_iterator virtual_patterns_cst_it_t
void save_to(XMLNode *node, const std::shared_ptr< Instrument > instrumentOnly=nullptr) const
save the pattern within the given XMLNode
virtual_patterns_t __flattened_virtual_patterns
the complete list of virtual patterns
QString __category
the category of the pattern
bool isVirtual() const
Whether the pattern holds at least one virtual pattern.
int longestVirtualPatternLength() const
void insert_note(Note *note)
insert a new note within __notes
std::set< Pattern * >::iterator end()
int __denominator
the meter denominator of the pattern used in meter (eg 4/4)
void addFlattenedVirtualPatterns(PatternList *pPatternList)
Add content of __flattened_virtual_patterns into pPatternList.
void set_length(int length)
get the length of the pattern
static bool loadDoc(const QString &sPatternPath, std::shared_ptr< InstrumentList > pInstrumentList, XMLDoc *pDoc, bool bSilent=false)
Loads the pattern stored in sPatternPath into pDoc and takes care of all the error handling.
XMLDoc is a subclass of QDomDocument with read and write methods.
XMLNode is a subclass of QDomNode with read and write values methods.
#define MAX_NOTES
Maximum number of notes.