23#ifndef H2C_INSTRUMENT_LIST_H
24#define H2C_INSTRUMENT_LIST_H
55 const QString& sComponentName,
56 const QString& sSampleName,
57 const QString& sFullSamplePath,
66 QString
toQString(
const QString& sPrefix =
"",
bool bShort =
true )
const;
85 void operator<<( std::shared_ptr<Instrument> instrument );
90 std::shared_ptr<Instrument>
operator[](
int idx );
96 bool operator==( std::shared_ptr<InstrumentList> pOther )
const;
97 bool operator!=( std::shared_ptr<InstrumentList> pOther )
const;
102 void add( std::shared_ptr<Instrument> instrument );
108 void insert(
int idx, std::shared_ptr<Instrument> instrument );
120 std::shared_ptr<Instrument>
get(
int idx )
const;
126 std::shared_ptr<Instrument>
del(
int idx );
132 std::shared_ptr<Instrument>
del( std::shared_ptr<Instrument> instrument );
138 int index( std::shared_ptr<Instrument> instrument );
144 std::shared_ptr<Instrument>
find(
const int i );
150 std::shared_ptr<Instrument>
find(
const QString& name );
156 std::shared_ptr<Instrument>
findMidiNote(
const int note );
162 void swap(
int idx_a,
int idx_b );
168 void move(
int idx_a,
int idx_b );
191 void save_to(
XMLNode* node,
int component_id,
bool bRecentVersion =
true,
bool bFull =
false );
207 static std::shared_ptr<InstrumentList>
load_from(
209 const QString& sDrumkitPath,
210 const QString& sDrumkitName,
212 bool* pLegacyFormatEncountered =
nullptr,
213 bool bSilent =
false );
218 std::vector<std::shared_ptr<Content>>
summarizeContent(
const std::shared_ptr<std::vector<std::shared_ptr<DrumkitComponent>>> pDrumkitComponents )
const;
249 QString
toQString(
const QString& sPrefix =
"",
bool bShort =
true )
const override;
252 std::vector<std::shared_ptr<Instrument>>::iterator
begin();
253 std::vector<std::shared_ptr<Instrument>>::iterator
end();
InstrumentList()
constructor
void insert(int idx, std::shared_ptr< Instrument > instrument)
insert an instrument into the list
int index(std::shared_ptr< Instrument > instrument)
get the index of an instrument within the instruments
void add(std::shared_ptr< Instrument > instrument)
add an instrument to the list
std::vector< std::shared_ptr< Instrument > >::iterator end()
std::shared_ptr< Instrument > operator[](int idx)
get an instrument from the list
~InstrumentList()
destructor
bool has_all_midi_notes_same() const
Check if all instruments have assigned the same MIDI out note.
std::shared_ptr< Instrument > findMidiNote(const int note)
find an instrument which play the given midi note
void move(int idx_a, int idx_b)
move an instrument from a position to another
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
void load_samples(float fBpm=120)
Calls the Instrument::load_samples() member function of all Instruments in __instruments.
std::shared_ptr< Instrument > find(const int i)
find an instrument within the instruments
std::shared_ptr< Instrument > get(int idx) const
get an instrument from the list
void fix_issue_307()
Fix GitHub issue #307, so called "Hi Bongo fiasco".
std::vector< std::shared_ptr< Instrument > >::iterator begin()
Iteration.
void operator<<(std::shared_ptr< Instrument > instrument)
add an instrument to the list
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.
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 ass...
std::shared_ptr< Instrument > del(int idx)
remove the instrument at a given index, does not delete it
void set_default_midi_out_notes()
Set each instrument consecuteve MIDI out notes, starting from 36.
bool isAnyInstrumentSoloed()
Check if any instrument in the list is solo'd.
void unload_samples()
Calls the Instrument::unload_samples() member function of all Instruments in __instruments.
bool operator==(std::shared_ptr< InstrumentList > pOther) const
Superficial comparison check.
std::vector< std::shared_ptr< Instrument > > __instruments
the list of instruments
void save_to(XMLNode *node, int component_id, bool bRecentVersion=true, bool bFull=false)
save the instrument list within the given XMLNode
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
int size() const
returns the numbers of instruments
bool operator!=(std::shared_ptr< InstrumentList > pOther) const
Wrapper class to help Hydrogen deal with the license information specified in a drumkit.
XMLNode is a subclass of QDomNode with read and write values methods.
QString toQString(const QString &sPrefix="", bool bShort=true) const
QString m_sInstrumentName
QString m_sFullSamplePath
Content(const QString &sInstrumentName, const QString &sComponentName, const QString &sSampleName, const QString &sFullSamplePath, const License &license)