80 __adsr = std::make_shared<ADSR>();
91 for (
int i=0; i<
MAX_FX; i++ ) {
94 __components =
new std::vector<std::shared_ptr<InstrumentComponent>>();
132 for (
int i=0; i<
MAX_FX; i++ ) {
136 __components =
new std::vector<std::shared_ptr<InstrumentComponent>>();
137 for (
auto& pComponent : *other->get_components() ) {
138 __components->push_back( std::make_shared<InstrumentComponent>( pComponent ) );
149 auto pInstrument = std::make_shared<Instrument>();
150 pInstrument->load_from( drumkit_path, instrument_name );
157 if ( pDrumkit ==
nullptr ) {
158 ERRORLOG(
"Invalid drumkit supplied" );
166 for (
const auto& pSrcComponent : *pInstrument->get_components() ) {
167 auto pMyComponent = std::make_shared<InstrumentComponent>( pSrcComponent->get_drumkit_componentID() );
168 pMyComponent->set_gain( pSrcComponent->get_gain() );
173 auto src_layer = pSrcComponent->get_layer( i );
174 auto my_layer = pMyComponent->get_layer( i );
176 if( src_layer ==
nullptr ) {
177 pMyComponent->set_layer(
nullptr, i );
180 std::shared_ptr<Sample> pSample =
nullptr;
183 if ( src_layer->get_sample() !=
nullptr ) {
184 QString sSamplePath = pDrumkit->get_path() +
"/" + src_layer->get_sample()->get_filename();
188 if ( pSample ==
nullptr ) {
189 _ERRORLOG( QString(
"Error loading sample %1. Creating a new empty layer." )
190 .arg( sSamplePath ) );
192 pMyComponent->set_layer(
nullptr, i );
196 pSample->setLicense( pDrumkit->get_license() );
197 pMyComponent->set_layer( std::make_shared<InstrumentLayer>( src_layer, pSample ), i );
204 this->
set_id( pInstrument->get_id() );
205 this->
set_name( pInstrument->get_name() );
208 this->
set_gain( pInstrument->get_gain() );
209 this->
set_volume( pInstrument->get_volume() );
210 this->
setPan( pInstrument->getPan() );
211 this->
set_adsr( std::make_shared<ADSR>( *( pInstrument->get_adsr() ) ) );
224 this->
set_muted( pInstrument->is_muted() );
230 for (
int ii = 0; ii <
MAX_FX; ++ii ) {
231 this->
set_fx_level( pInstrument->get_fx_level( ii ), ii );
237 std::shared_ptr<Drumkit> pDrumkit;
241 if ( pHydrogen !=
nullptr ) {
242 pDrumkit = pHydrogen->getSoundLibraryDatabase()->getDrumkit( sDrumkitPath );
246 if ( pDrumkit ==
nullptr ) {
247 ERRORLOG( QString(
"Unable to load instrument: corresponding drumkit [%1] could not be loaded" )
248 .arg( sDrumkitPath ) );
252 auto pInstrument = pDrumkit->get_instruments()->find( sInstrumentName );
253 if ( pInstrument !=
nullptr ) {
257 ERRORLOG( QString(
"Unable to load instrument: instrument [%1] could not be found in drumkit [%2]" )
258 .arg( sInstrumentName ).arg( sDrumkitPath ) );
263 const QString& sDrumkitPath,
264 const QString& sDrumkitName,
266 bool* pLegacyFormatEncountered,
272 int nId = pNode->
read_int(
"id", -2,
false,
false, bSilent );
274 if ( pLegacyFormatEncountered !=
nullptr ) {
275 *pLegacyFormatEncountered =
true;
281 std::make_shared<Instrument>(
283 pNode->
read_string(
"name",
"",
false,
false, bSilent ),
284 std::make_shared<ADSR>( pNode->
read_int(
"Attack", 0,
true,
false, bSilent ),
285 pNode->
read_int(
"Decay", 0,
true,
false, bSilent ),
286 pNode->
read_float(
"Sustain", 1.0f,
true,
false, bSilent ),
287 pNode->
read_int(
"Release", 1000,
true,
false, bSilent ) ) );
289 QString sInstrumentDrumkitPath, sInstrumentDrumkitName;
290 if ( sDrumkitPath.isEmpty() || sDrumkitName.isEmpty() ) {
293 sInstrumentDrumkitName = pNode->
read_string(
"drumkit",
"",
false,
296 if ( ! pNode->firstChildElement(
"drumkitPath" ).isNull() ) {
298 sInstrumentDrumkitPath = pNode->
read_string(
"drumkitPath",
"",
299 false,
false, bSilent );
301#ifdef H2CORE_HAVE_APPIMAGE
302 sInstrumentDrumkitPath =
314 WARNINGLOG( QString(
"Couldn't find drumkit at [%1]. Searching for [%2] instead." )
315 .arg( sInstrumentDrumkitPath )
316 .arg( sInstrumentDrumkitName ) );
317 sInstrumentDrumkitPath =
"";
321 if ( sInstrumentDrumkitPath.isEmpty() ) {
322 if ( ! pNode->firstChildElement(
"drumkitLookup" ).isNull() ) {
333 false,
false, bSilent ) );
335 sInstrumentDrumkitPath =
339 if ( sInstrumentDrumkitPath.isEmpty() &&
352 sInstrumentDrumkitPath =
357 if ( sInstrumentDrumkitPath.isEmpty() ) {
358 ERRORLOG( QString(
"Drumkit [%1] could neither found at system nor at user level." )
359 .arg( sInstrumentDrumkitName ) );
361 else if ( ! bSilent ) {
362 WARNINGLOG( QString(
"Drumkit [%1] could not found using lookup type [%2]. Falling back to [%3] found using stacked search" )
363 .arg( sInstrumentDrumkitName )
364 .arg(
static_cast<int>(lookup) )
365 .arg( sInstrumentDrumkitPath ) );
369 if ( pLegacyFormatEncountered !=
nullptr ) {
370 *pLegacyFormatEncountered =
true;
373 else if ( ! pNode->firstChildElement(
"drumkit" ).isNull() ) {
378 sInstrumentDrumkitPath =
383 if ( pLegacyFormatEncountered !=
nullptr ) {
384 *pLegacyFormatEncountered =
true;
390 sInstrumentDrumkitPath =
"";
392 if ( pLegacyFormatEncountered !=
nullptr ) {
393 *pLegacyFormatEncountered =
true;
399 sInstrumentDrumkitPath = sDrumkitPath;
400 sInstrumentDrumkitName = sDrumkitName;
403 pInstrument->set_drumkit_path( sInstrumentDrumkitPath );
404 pInstrument->__drumkit_name = sInstrumentDrumkitName;
406 pInstrument->set_volume( pNode->
read_float(
"volume", 1.0f,
407 true,
true, bSilent ) );
408 pInstrument->set_muted( pNode->
read_bool(
"isMuted",
false,
409 true,
true, bSilent ) );
410 pInstrument->set_soloed( pNode->
read_bool(
"isSoloed",
false,
411 true,
false,
true ) );
412 bool bFound, bFound2;
413 float fPan = pNode->
read_float(
"pan", 0.f, &bFound,
418 float fPanL = pNode->
read_float(
"pan_L", 1.f, &bFound,
419 true,
true, bSilent );
420 float fPanR = pNode->
read_float(
"pan_R", 1.f, &bFound2,
421 true,
true, bSilent );
422 if ( bFound ==
true && bFound2 ==
true ) {
426 pInstrument->setPan( fPan );
428 pInstrument->set_apply_velocity( pNode->
read_bool(
"applyVelocity",
true,
429 false,
true, bSilent ) );
430 pInstrument->set_filter_active( pNode->
read_bool(
"filterActive",
true,
431 false,
true, bSilent ) );
432 pInstrument->set_filter_cutoff( pNode->
read_float(
"filterCutoff", 1.0f,
433 true,
false, bSilent ) );
434 pInstrument->set_filter_resonance( pNode->
read_float(
"filterResonance", 0.0f,
435 true,
false, bSilent ) );
436 pInstrument->set_pitch_offset( pNode->
read_float(
"pitchOffset", 0.0f,
437 true,
false,
true ) );
438 pInstrument->set_random_pitch_factor( pNode->
read_float(
"randomPitchFactor", 0.0f,
439 true,
false, bSilent ) );
440 pInstrument->set_gain( pNode->
read_float(
"gain", 1.0f,
441 true,
false, bSilent ) );
442 pInstrument->set_mute_group( pNode->
read_int(
"muteGroup", -1,
443 true,
false, bSilent ) );
444 pInstrument->set_midi_out_channel( pNode->
read_int(
"midiOutChannel", -1,
445 true,
false, bSilent ) );
446 pInstrument->set_midi_out_note( pNode->
read_int(
"midiOutNote", pInstrument->__midi_out_note,
447 true,
false, bSilent ) );
448 pInstrument->set_stop_notes( pNode->
read_bool(
"isStopNote",
true,
449 false,
true, bSilent ) );
454 QString sRead_sample_select_algo = pNode->
read_string(
"sampleSelectionAlgo",
"VELOCITY",
456 if ( sRead_sample_select_algo.compare(
"VELOCITY") == 0 ) {
457 pInstrument->set_sample_selection_alg(
VELOCITY );
459 else if ( sRead_sample_select_algo.compare(
"ROUND_ROBIN") == 0 ) {
460 pInstrument->set_sample_selection_alg(
ROUND_ROBIN );
462 else if ( sRead_sample_select_algo.compare(
"RANDOM") == 0 ) {
463 pInstrument->set_sample_selection_alg(
RANDOM );
466 pInstrument->set_hihat_grp( pNode->
read_int(
"isHihat", -1,
467 true,
true, bSilent ) );
468 pInstrument->set_lower_cc( pNode->
read_int(
"lower_cc", 0,
469 true,
true, bSilent ) );
470 pInstrument->set_higher_cc( pNode->
read_int(
"higher_cc", 127,
471 true,
true, bSilent ) );
473 for (
int i=0; i<
MAX_FX; i++ ) {
474 pInstrument->set_fx_level( pNode->
read_float( QString(
"FX%1Level" ).arg( i+1 ), 0.0,
475 true,
true, bSilent ), i );
489 if ( pSoundLibraryDatabase !=
nullptr ) {
495 auto pDrumkit = pSoundLibraryDatabase->getDrumkit(
496 pInstrument->get_drumkit_path(),
false );
497 if ( pDrumkit ==
nullptr ) {
502 instrumentLicense = pDrumkit->get_license();
506 instrumentLicense = license;
509 if ( ! pNode->firstChildElement(
"instrumentComponent" ).isNull() ) {
511 XMLNode componentNode = pNode->firstChildElement(
"instrumentComponent" );
512 while ( ! componentNode.isNull() ) {
513 pInstrument->get_components()->
515 pInstrument->get_drumkit_path(),
516 instrumentLicense, bSilent ) );
517 componentNode = componentNode.nextSiblingElement(
"instrumentComponent" );
523 instrumentLicense, bSilent );
524 if ( pCompo ==
nullptr ) {
525 ERRORLOG( QString(
"Unable to load component for instrument [%1]. Aborting." )
526 .arg( pInstrument->get_name() ) );
530 pInstrument->get_components()->push_back( pCompo );
532 if ( pLegacyFormatEncountered !=
nullptr ) {
533 *pLegacyFormatEncountered =
true;
540 if ( pInstrument->get_components()->size() == 0 ) {
541 pInstrument->get_components()->push_back(
542 std::make_shared<InstrumentComponent>( 0 ) );
546 bool bSampleFound =
false;
547 for (
const auto& pComponent : *pInstrument->get_components() ) {
548 if ( pComponent ==
nullptr ) {
549 ERRORLOG(
"Invalid component. Something went wrong loading the instrument" );
550 pInstrument->set_muted(
true );
551 pInstrument->set_missing_samples(
true );
555 for (
const auto& pLayer : *pComponent ) {
556 if ( pLayer ==
nullptr ) {
562 if ( pLayer->get_sample() !=
nullptr ) {
563 if ( ! bSampleFound ) {
567 pInstrument->set_missing_samples(
true );
572 if ( ! bSampleFound ) {
573 pInstrument->set_muted(
true );
583 auto pLayer = pComponent->get_layer( i );
584 if ( pLayer !=
nullptr ) {
585 pLayer->load_sample( fBpm );
595 auto pLayer = pComponent->get_layer( i );
597 pLayer->unload_sample();
650 InstrumentNode.
write_string(
"sampleSelectionAlgo",
"VELOCITY" );
653 InstrumentNode.
write_string(
"sampleSelectionAlgo",
"RANDOM" );
656 InstrumentNode.
write_string(
"sampleSelectionAlgo",
"ROUND_ROBIN" );
664 for (
int i=0; i<
MAX_FX; i++ ) {
669 if ( pComponent !=
nullptr &&
670 ( component_id == -1 ||
671 pComponent->get_drumkit_componentID() == component_id ) ) {
672 pComponent->save_to( &InstrumentNode, component_id, bRecentVersion, bFull );
684 if ( fValue < fPitchMin || fValue >
fPitchMax ) {
685 WARNINGLOG( QString(
"Provided pitch out of bound [%1;%2]. Rounding to nearest allowed value." )
694 if( pComponent->get_drumkit_componentID() == DrumkitComponentID ) {
709 if ( pComponent !=
nullptr ) {
710 for (
const auto& pLayer : *pComponent ) {
711 if ( pLayer !=
nullptr ) {
712 if ( pLayer->get_sample() !=
nullptr ) {
727 sOutput = QString(
"%1[Instrument]\n" ).arg( sPrefix )
728 .append( QString(
"%1%2id: %3\n" ).arg( sPrefix ).arg( s ).arg(
__id ) )
729 .append( QString(
"%1%2name: %3\n" ).arg( sPrefix ).arg( s ).arg(
__name ) )
730 .append( QString(
"%1%2drumkit_path: %3\n" ).arg( sPrefix ).arg( s ).arg(
__drumkit_path ) )
731 .append( QString(
"%1%2drumkit_name: %3\n" ).arg( sPrefix ).arg( s ).arg(
__drumkit_name ) )
732 .append( QString(
"%1%2gain: %3\n" ).arg( sPrefix ).arg( s ).arg(
__gain ) )
733 .append( QString(
"%1%2volume: %3\n" ).arg( sPrefix ).arg( s ).arg(
__volume ) )
734 .append( QString(
"%1%2pan: %3\n" ).arg( sPrefix ).arg( s ).arg(
m_fPan ) )
735 .append( QString(
"%1%2peak_l: %3\n" ).arg( sPrefix ).arg( s ).arg(
__peak_l ) )
736 .append( QString(
"%1%2peak_r: %3\n" ).arg( sPrefix ).arg( s ).arg(
__peak_r ) )
737 .append( QString(
"%1" ).arg(
__adsr->toQString( sPrefix + s, bShort ) ) )
738 .append( QString(
"%1%2filter_active: %3\n" ).arg( sPrefix ).arg( s ).arg(
__filter_active ) )
739 .append( QString(
"%1%2filter_cutoff: %3\n" ).arg( sPrefix ).arg( s ).arg(
__filter_cutoff ) )
740 .append( QString(
"%1%2filter_resonance: %3\n" ).arg( sPrefix ).arg( s ).arg(
__filter_resonance ) )
741 .append( QString(
"%1%2random_pitch_factor: %3\n" ).arg( sPrefix ).arg( s ).arg(
__random_pitch_factor ) )
742 .append( QString(
"%1%2pitch_offset: %3\n" ).arg( sPrefix ).arg( s ).arg(
__pitch_offset ) )
743 .append( QString(
"%1%2midi_out_note: %3\n" ).arg( sPrefix ).arg( s ).arg(
__midi_out_note ) )
744 .append( QString(
"%1%2midi_out_channel: %3\n" ).arg( sPrefix ).arg( s ).arg(
__midi_out_channel ) )
745 .append( QString(
"%1%2stop_notes: %3\n" ).arg( sPrefix ).arg( s ).arg(
__stop_notes ) )
746 .append( QString(
"%1%2sample_selection_alg: %3\n" ).arg( sPrefix ).arg( s ).arg(
__sample_selection_alg ) )
747 .append( QString(
"%1%2active: %3\n" ).arg( sPrefix ).arg( s ).arg(
__active ) )
748 .append( QString(
"%1%2soloed: %3\n" ).arg( sPrefix ).arg( s ).arg(
__soloed ) )
749 .append( QString(
"%1%2muted: %3\n" ).arg( sPrefix ).arg( s ).arg(
__muted ) )
750 .append( QString(
"%1%2mute_group: %3\n" ).arg( sPrefix ).arg( s ).arg(
__mute_group ) )
751 .append( QString(
"%1%2queued: %3\n" ).arg( sPrefix ).arg( s ).arg(
__queued ) ) ;
752 sOutput.append( QString(
"%1%2fx_level: [ " ).arg( sPrefix ).arg( s ) );
754 sOutput.append( QString(
"%1 " ).arg( ff ) );
756 sOutput.append( QString(
"]\n" ) )
757 .append( QString(
"%1%2hihat_grp: %3\n" ).arg( sPrefix ).arg( s ).arg(
__hihat_grp ) )
758 .append( QString(
"%1%2lower_cc: %3\n" ).arg( sPrefix ).arg( s ).arg(
__lower_cc ) )
759 .append( QString(
"%1%2higher_cc: %3\n" ).arg( sPrefix ).arg( s ).arg(
__higher_cc ) )
762 .append( QString(
"%1%2apply_velocity: %3\n" ).arg( sPrefix ).arg( s ).arg(
__apply_velocity ) )
764 .append( QString(
"%1%2m_bHasMissingSamples: %3\n" ).arg( sPrefix ).arg( s ).arg(
m_bHasMissingSamples ) )
765 .append( QString(
"%1%2components:\n" ).arg( sPrefix ).arg( s ) );
767 if ( cc !=
nullptr ) {
768 sOutput.append( QString(
"%1" ).arg( cc->toQString( sPrefix + s + s, bShort ) ) );
773 sOutput = QString(
"[Instrument]" )
774 .append( QString(
" id: %1" ).arg(
__id ) )
775 .append( QString(
", name: %1" ).arg(
__name ) )
778 .append( QString(
", gain: %1" ).arg(
__gain ) )
779 .append( QString(
", volume: %1" ).arg(
__volume ) )
780 .append( QString(
", pan: %1" ).arg(
m_fPan ) )
781 .append( QString(
", peak_l: %1" ).arg(
__peak_l ) )
782 .append( QString(
", peak_r: %1" ).arg(
__peak_r ) )
783 .append( QString(
", [%1" ).arg(
__adsr->toQString( sPrefix + s, bShort ).replace(
"\n",
"]" ) ) )
791 .append( QString(
", stop_notes: %1" ).arg(
__stop_notes ) )
793 .append( QString(
", active: %1" ).arg(
__active ) )
794 .append( QString(
", soloed: %1" ).arg(
__soloed ) )
795 .append( QString(
", muted: %1" ).arg(
__muted ) )
796 .append( QString(
", mute_group: %1" ).arg(
__mute_group ) )
797 .append( QString(
", queued: %1" ).arg(
__queued ) ) ;
798 sOutput.append( QString(
", fx_level: [ " ) );
800 sOutput.append( QString(
"%1 " ).arg( ff ) );
802 sOutput.append( QString(
"]" ) )
803 .append( QString(
", hihat_grp: %1" ).arg(
__hihat_grp ) )
804 .append( QString(
", lower_cc: %1" ).arg(
__lower_cc ) )
805 .append( QString(
", higher_cc: %1" ).arg(
__higher_cc ) )
811 .append( QString(
", components: [" ) );
813 if ( cc !=
nullptr ) {
814 sOutput.append( QString(
" %1" ).arg( cc->get_drumkit_componentID() ) );
817 sOutput.append(
" ]\n");
Attack Decay Sustain Release envelope.
static QString sPrintIndention
String used to format the debugging string output of some core classes.
static License loadLicenseFrom(const QString &sDrumkitDir, bool bSilent=false)
Loads the license information of a drumkit contained in directory sDrumkitDir.
static QString ensure_session_compatibility(const QString &sPath)
If Hydrogen is under session management, we support for paths relative to the session folder.
static bool drumkit_valid(const QString &dk_path)
returns true if the path contains a usable drumkit
static QString rerouteDrumkitPath(const QString &sDrumkitPath)
Reroutes stored drumkit paths pointing to a temporary AppImage system data folder to the current AppI...
Lookup
Whenever a drumkit is loaded by name a collision between a user and a system drumkit carrying the sam...
@ stacked
First, looks in the system drumkits and, afterwards, in the user drumkits.
static QString drumkit_path_search(const QString &dk_name, Lookup lookup=Lookup::stacked, bool bSilent=false)
Returns the path to a H2Core::Drumkit folder.
static Hydrogen * get_instance()
Returns the current Hydrogen instance __instance.
SoundLibraryDatabase * getSoundLibraryDatabase() const
static std::shared_ptr< InstrumentComponent > load_from(XMLNode *pNode, const QString &sDrumkitPath, const License &drumkitLicense=License(), bool bSilent=false)
static int getMaxLayers()
bool has_missing_samples() const
QString __name
Name of the Instrument.
float __peak_r
right current peak value
float get_filter_resonance() const
get the filter resonance of the instrument
float __pitch_offset
instrument main pitch offset
float get_filter_cutoff() const
get the filter cutoff of the instrument
int get_mute_group() const
get the mute group of the instrument
void set_name(const QString &name)
get the name of the instrument
int __hihat_grp
the instrument is part of a hihat
float get_peak_r() const
get the right peak of the instrument
void set_pitch_offset(float val)
set the pitch offset of the instrument
bool __active
is the instrument active?
const QString & get_name() const
set the id of the instrument
void set_drumkit_name(const QString &sName)
get the name of the related drumkits
bool __is_preview_instrument
is the instrument an hydrogen preview instrument?
float get_pitch_offset() const
get the pitch offset of the instrument
bool get_apply_velocity() const
void set_sample_selection_alg(SampleSelectionAlgo selected_algo)
bool is_stop_notes() const
get the stop notes of the instrument
static constexpr float fPitchMin
Minimum support pitch value.
bool __is_metronome_instrument
is the instrument an metronome instrument?
static std::shared_ptr< Instrument > load_instrument(const QString &drumkit_path, const QString &instrument_name)
creates a new Instrument, loads samples from a given instrument within a given drumkit
void set_fx_level(float level, int index)
set the fx level of the instrument
bool __stop_notes
will the note automatically generate a note off after being on
void set_filter_resonance(float val)
set the filter resonance of the instrument
float m_fPan
pan of the instrument, [-1;1] from left to right, as requested by Sampler PanLaws
bool __soloed
is the instrument in solo mode?
int __midi_out_channel
midi out channel
float __random_pitch_factor
Factor to scale the random contribution when humanizing pitch between 0 and AudioEngine::fHumanizePit...
void set_drumkit_path(const QString &sPath)
get the path of the related drumkits
int __mute_group
mute group of the instrument
int __id
Identifier of an instrument, which should be unique.
void set_soloed(bool soloed)
set the soloed status of the instrument
void set_adsr(std::shared_ptr< ADSR > adsr)
set the ADSR of the instrument
int get_higher_cc() const
set the path of the related drumkit
void set_volume(float volume)
set the volume of the instrument
float __filter_resonance
filter resonant frequency (0..1)
float __filter_cutoff
filter cutoff (0..1)
void set_random_pitch_factor(float val)
set the random pitch factor of the instrument
QString __drumkit_name
Name of the Drumkit found at __drumkit_path.
float __fx_level[MAX_FX]
Ladspa FX level array.
void set_filter_active(bool active)
activate the filter of the instrument
SampleSelectionAlgo __sample_selection_alg
how Hydrogen will chose the sample to use
void load_samples(float fBpm=120)
Calls the InstrumentLayer::load_sample() member function of all layers of each component of the Instr...
bool __muted
is the instrument muted?
int get_hihat_grp() const
bool is_muted() const
get muted status of the instrument
bool __filter_active
is filter active?
bool is_queued() const
get the queued status of the instrument
float __gain
gain of the instrument
QString __drumkit_path
Path of the Drumkit this Instrument belongs to.
std::shared_ptr< InstrumentComponent > get_component(int DrumkitComponentID)
static constexpr float fPitchMax
Maximum support pitch value.
void set_midi_out_channel(int channel)
set the midi out channel of the instrument
void set_apply_velocity(bool apply_velocity)
bool m_bHasMissingSamples
does the instrument have missing sample files?
bool is_soloed() const
get the soloed status of the instrument
int get_midi_out_note() const
get the midi out note of the instrument
void set_stop_notes(bool stopnotes)
set the stop notes status of the instrument
void set_gain(float gain)
set gain of the instrument
void set_midi_out_note(int note)
set the midi out note of the instrument
int __higher_cc
higher cc level
void set_hihat_grp(int hihat_grp)
void set_id(const int id)
get the id of the instrument
float get_peak_l() const
get the left peak of the instrument
float __peak_l
left current peak value
float get_random_pitch_factor() const
get the random pitch factor of the instrument
void setPan(float val)
set pan of the instrument
void set_mute_group(int group)
set the mute group of the instrument
QString toQString(const QString &sPrefix="", bool bShort=true) const override
Formatted string version for debugging purposes.
std::shared_ptr< ADSR > get_adsr() const
get the ADSR of the instrument
bool __current_instr_for_export
is the instrument currently being exported?
void set_active(bool active)
set the active status of the instrument
int __lower_cc
lower cc level
std::vector< std::shared_ptr< InstrumentComponent > > * __components
InstrumentLayer array.
std::shared_ptr< ADSR > __adsr
attack delay sustain release instance
void set_filter_cutoff(float val)
set the filter cutoff of the instrument
void unload_samples()
Calls the InstrumentLayer::unload_sample() member function of all layers of each component of the Ins...
float __volume
volume of the instrument
Instrument(const int id=EMPTY_INSTR_ID, const QString &name="Empty Instrument", std::shared_ptr< ADSR > adsr=nullptr)
constructor
void load_from(const QString &drumkit_path, const QString &instrument_name)
loads instrument from a given instrument within a given drumkit into a live Instrument object.
bool is_filter_active() const
get the status of the filter of the instrument
int __queued
count the number of notes queued within Sampler::__playing_notes_queue or std::priority_queue m_songN...
void set_missing_samples(bool bHasMissingSamples)
void set_higher_cc(int message)
void save_to(XMLNode *node, int component_id, bool bRecentVersion=true, bool bFull=false)
save the instrument within the given XMLNode
bool __apply_velocity
change the sample gain based on velocity
SampleSelectionAlgo sample_selection_alg() const
void set_lower_cc(int message)
std::vector< std::shared_ptr< InstrumentComponent > > * get_components()
int get_id() const
Returns __id.
bool is_active() const
get the active status of the instrument
float getPan() const
get pan of the instrument
QString get_drumkit_path() const
set the name of the related drumkit
int get_midi_out_channel() const
get the midi out channel of the instrument
void set_muted(bool muted)
set muted status of the instrument
int __midi_out_note
midi out note
float get_volume() const
get the volume of the instrument
bool hasSamples() const
Whether the instrument contains at least one non-missing sample.
static std::shared_ptr< InstrumentComponent > loadInstrumentComponent(XMLNode *pNode, const QString &sDrumkitPath, const License &drumkitLicense, bool bSilent=false)
Backward compatibility code to load an InstrumentComponent from an Instrument which itself did not co...
Wrapper class to help Hydrogen deal with the license information specified in a drumkit.
static std::shared_ptr< Sample > load(const QString &filepath, const License &license=License())
static float getRatioPan(float fPan_L, float fPan_R)
This function is used to load old version files (v<=1.1).
XMLNode is a subclass of QDomNode with read and write values methods.
int read_int(const QString &node, int default_value, bool inexistent_ok=true, bool empty_ok=true, bool bSilent=false)
reads an integer stored into a child node
bool read_bool(const QString &node, bool default_value, bool inexistent_ok=true, bool empty_ok=true, bool bSilent=false)
reads a boolean stored into a child node
QString read_string(const QString &node, const QString &default_value, bool inexistent_ok=true, bool empty_ok=true, bool bSilent=false)
reads a string stored into a child node
float read_float(const QString &node, float default_value, bool inexistent_ok=true, bool empty_ok=true, bool bSilent=false)
reads a float stored into a child node
void write_float(const QString &node, const float value)
write a float into a child node
XMLNode createNode(const QString &name)
create a new XMLNode that has to be appended into de XMLDoc
void write_string(const QString &node, const QString &value)
write a string into a child node
void write_bool(const QString &node, const bool value)
write a boolean into a child node
void write_int(const QString &node, const int value)
write an integer into a child node
#define MAX_FX
Maximum number of effects.
#define MIDI_OUT_NOTE_MIN
#define MIDI_OUT_NOTE_MAX