54 , __filter_active( false )
55 , __filter_cutoff( 1.0 )
56 , __filter_resonance( 0.0 )
57 , __pitch_offset( 0.0 )
58 , __random_pitch_factor( 0.0 )
59 , __midi_out_note( 36 + id )
60 , __midi_out_channel( -1 )
61 , __stop_notes( false )
62 , __sample_selection_alg( VELOCITY )
71 , __components( nullptr )
72 , __is_preview_instrument(false)
73 , __is_metronome_instrument(false)
74 , __apply_velocity( true )
75 , __current_instr_for_export(false)
76 , m_bHasMissingSamples( false )
79 __adsr = std::make_shared<ADSR>();
90 for (
int i=0; i<
MAX_FX; i++ ) {
93 __components =
new std::vector<std::shared_ptr<InstrumentComponent>>();
97 : __id( other->get_id() )
98 , __name( other->get_name() )
99 , __gain( other->__gain )
100 , __volume( other->get_volume() )
101 , m_fPan( other->getPan() )
102 , __peak_l( other->get_peak_l() )
103 , __peak_r( other->get_peak_r() )
104 , __adsr( std::make_shared<
ADSR>( *( other->get_adsr() ) ) )
105 , __filter_active( other->is_filter_active() )
106 , __filter_cutoff( other->get_filter_cutoff() )
107 , __filter_resonance( other->get_filter_resonance() )
108 , __pitch_offset( other->get_pitch_offset() )
109 , __random_pitch_factor( other->get_random_pitch_factor() )
110 , __midi_out_note( other->get_midi_out_note() )
111 , __midi_out_channel( other->get_midi_out_channel() )
112 , __stop_notes( other->is_stop_notes() )
113 , __sample_selection_alg( other->sample_selection_alg() )
114 , __active( other->is_active() )
115 , __soloed( other->is_soloed() )
116 , __muted( other->is_muted() )
117 , __mute_group( other->get_mute_group() )
118 , __queued( other->is_queued() )
119 , __hihat_grp( other->get_hihat_grp() )
120 , __lower_cc( other->get_lower_cc() )
121 , __higher_cc( other->get_higher_cc() )
122 , __components( nullptr )
123 , __is_preview_instrument(false)
124 , __is_metronome_instrument(false)
125 , __apply_velocity( other->get_apply_velocity() )
126 , __current_instr_for_export(false)
127 , m_bHasMissingSamples(other->has_missing_samples())
128 , __drumkit_path( other->get_drumkit_path() )
129 , __drumkit_name( other->__drumkit_name )
131 for (
int i=0; i<
MAX_FX; i++ ) {
135 __components =
new std::vector<std::shared_ptr<InstrumentComponent>>();
136 for (
auto& pComponent : *other->get_components() ) {
137 __components->push_back( std::make_shared<InstrumentComponent>( pComponent ) );
148 auto pInstrument = std::make_shared<Instrument>();
149 pInstrument->load_from( drumkit_path, instrument_name );
156 if ( pDrumkit ==
nullptr ) {
157 ERRORLOG(
"Invalid drumkit supplied" );
165 for (
const auto& pSrcComponent : *pInstrument->get_components() ) {
166 auto pMyComponent = std::make_shared<InstrumentComponent>( pSrcComponent->get_drumkit_componentID() );
167 pMyComponent->set_gain( pSrcComponent->get_gain() );
172 auto src_layer = pSrcComponent->get_layer( i );
173 auto my_layer = pMyComponent->get_layer( i );
175 if( src_layer ==
nullptr ) {
176 pMyComponent->set_layer(
nullptr, i );
179 std::shared_ptr<Sample> pSample =
nullptr;
182 if ( src_layer->get_sample() != nullptr ) {
183 QString sSamplePath = pDrumkit->get_path() +
"/" + src_layer->get_sample()->get_filename();
187 if ( pSample ==
nullptr ) {
188 _ERRORLOG( QString(
"Error loading sample %1. Creating a new empty layer." )
189 .arg( sSamplePath ) );
191 pMyComponent->set_layer(
nullptr, i );
195 pSample->setLicense( pDrumkit->get_license() );
196 pMyComponent->set_layer( std::make_shared<InstrumentLayer>( src_layer, pSample ), i );
203 this->
set_id( pInstrument->get_id() );
204 this->
set_name( pInstrument->get_name() );
207 this->
set_gain( pInstrument->get_gain() );
208 this->
set_volume( pInstrument->get_volume() );
209 this->
setPan( pInstrument->getPan() );
210 this->
set_adsr( std::make_shared<ADSR>( *( pInstrument->get_adsr() ) ) );
223 this->
set_muted( pInstrument->is_muted() );
229 for (
int ii = 0; ii <
MAX_FX; ++ii ) {
230 this->
set_fx_level( pInstrument->get_fx_level( ii ), ii );
236 std::shared_ptr<Drumkit> pDrumkit;
240 if ( pHydrogen !=
nullptr ) {
241 pDrumkit = pHydrogen->getSoundLibraryDatabase()->getDrumkit( sDrumkitPath );
245 if ( pDrumkit ==
nullptr ) {
246 ERRORLOG( QString(
"Unable to load instrument: corresponding drumkit [%1] could not be loaded" )
247 .arg( sDrumkitPath ) );
251 auto pInstrument = pDrumkit->get_instruments()->find( sInstrumentName );
252 if ( pInstrument !=
nullptr ) {
256 ERRORLOG( QString(
"Unable to load instrument: instrument [%1] could not be found in drumkit [%2]" )
257 .arg( sInstrumentName ).arg( sDrumkitPath ) );
266 int nId = pNode->
read_int(
"id", -2,
false,
false, bSilent );
272 std::make_shared<Instrument>(
274 pNode->
read_string(
"name",
"",
false,
false, bSilent ),
275 std::make_shared<ADSR>( pNode->
read_int(
"Attack", 0,
true,
false, bSilent ),
276 pNode->
read_int(
"Decay", 0,
true,
false, bSilent ),
277 pNode->
read_float(
"Sustain", 1.0f,
true,
false, bSilent ),
278 pNode->
read_int(
"Release", 1000,
true,
false, bSilent ) ) );
280 QString sInstrumentDrumkitPath, sInstrumentDrumkitName;
281 if ( sDrumkitPath.isEmpty() || sDrumkitName.isEmpty() ) {
284 sInstrumentDrumkitName = pNode->
read_string(
"drumkit",
"",
false,
287 if ( ! pNode->firstChildElement(
"drumkitPath" ).isNull() ) {
289 sInstrumentDrumkitPath = pNode->
read_string(
"drumkitPath",
"",
290 false,
false, bSilent );
292#ifdef H2CORE_HAVE_APPIMAGE
293 sInstrumentDrumkitPath =
305 WARNINGLOG( QString(
"Couldn't find drumkit at [%1]. Searching for [%2] instead." )
306 .arg( sInstrumentDrumkitPath )
307 .arg( sInstrumentDrumkitName ) );
308 sInstrumentDrumkitPath =
"";
312 if ( sInstrumentDrumkitPath.isEmpty() ) {
313 if ( ! pNode->firstChildElement(
"drumkitLookup" ).isNull() ) {
324 false,
false, bSilent ) );
326 sInstrumentDrumkitPath =
330 if ( sInstrumentDrumkitPath.isEmpty() &&
343 sInstrumentDrumkitPath =
348 if ( sInstrumentDrumkitPath.isEmpty() ) {
349 ERRORLOG( QString(
"Drumkit [%1] could neither found at system nor at user level." )
350 .arg( sInstrumentDrumkitName ) );
352 else if ( ! bSilent ) {
353 WARNINGLOG( QString(
"Drumkit [%1] could not found using lookup type [%2]. Falling back to [%3] found using stacked search" )
354 .arg( sInstrumentDrumkitName )
355 .arg(
static_cast<int>(lookup) )
356 .arg( sInstrumentDrumkitPath ) );
360 else if ( ! pNode->firstChildElement(
"drumkit" ).isNull() ) {
365 sInstrumentDrumkitPath =
373 sInstrumentDrumkitPath =
"";
378 sInstrumentDrumkitPath = sDrumkitPath;
379 sInstrumentDrumkitName = sDrumkitName;
382 pInstrument->set_drumkit_path( sInstrumentDrumkitPath );
383 pInstrument->__drumkit_name = sInstrumentDrumkitName;
385 pInstrument->set_volume( pNode->
read_float(
"volume", 1.0f,
386 true,
true, bSilent ) );
387 pInstrument->set_muted( pNode->
read_bool(
"isMuted",
false,
388 true,
true, bSilent ) );
389 pInstrument->set_soloed( pNode->
read_bool(
"isSoloed",
false,
390 true,
false,
true ) );
391 bool bFound, bFound2;
392 float fPan = pNode->
read_float(
"pan", 0.f, &bFound,
397 float fPanL = pNode->
read_float(
"pan_L", 1.f, &bFound,
398 true,
true, bSilent );
399 float fPanR = pNode->
read_float(
"pan_R", 1.f, &bFound2,
400 true,
true, bSilent );
401 if ( bFound ==
true && bFound2 ==
true ) {
405 pInstrument->setPan( fPan );
407 pInstrument->set_apply_velocity( pNode->
read_bool(
"applyVelocity",
true,
408 false,
true, bSilent ) );
409 pInstrument->set_filter_active( pNode->
read_bool(
"filterActive",
true,
410 false,
true, bSilent ) );
411 pInstrument->set_filter_cutoff( pNode->
read_float(
"filterCutoff", 1.0f,
412 true,
false, bSilent ) );
413 pInstrument->set_filter_resonance( pNode->
read_float(
"filterResonance", 0.0f,
414 true,
false, bSilent ) );
415 pInstrument->set_pitch_offset( pNode->
read_float(
"pitchOffset", 0.0f,
416 true,
false,
true ) );
417 pInstrument->set_random_pitch_factor( pNode->
read_float(
"randomPitchFactor", 0.0f,
418 true,
false, bSilent ) );
419 pInstrument->set_gain( pNode->
read_float(
"gain", 1.0f,
420 true,
false, bSilent ) );
421 pInstrument->set_mute_group( pNode->
read_int(
"muteGroup", -1,
422 true,
false, bSilent ) );
423 pInstrument->set_midi_out_channel( pNode->
read_int(
"midiOutChannel", -1,
424 true,
false, bSilent ) );
425 pInstrument->set_midi_out_note( pNode->
read_int(
"midiOutNote", pInstrument->__midi_out_note,
426 true,
false, bSilent ) );
427 pInstrument->set_stop_notes( pNode->
read_bool(
"isStopNote",
true,
428 false,
true, bSilent ) );
430 QString sRead_sample_select_algo = pNode->
read_string(
"sampleSelectionAlgo",
"VELOCITY",
431 true,
true, bSilent );
432 if ( sRead_sample_select_algo.compare(
"VELOCITY") == 0 ) {
433 pInstrument->set_sample_selection_alg(
VELOCITY );
435 else if ( sRead_sample_select_algo.compare(
"ROUND_ROBIN") == 0 ) {
436 pInstrument->set_sample_selection_alg(
ROUND_ROBIN );
438 else if ( sRead_sample_select_algo.compare(
"RANDOM") == 0 ) {
439 pInstrument->set_sample_selection_alg(
RANDOM );
442 pInstrument->set_hihat_grp( pNode->
read_int(
"isHihat", -1,
443 true,
true, bSilent ) );
444 pInstrument->set_lower_cc( pNode->
read_int(
"lower_cc", 0,
445 true,
true, bSilent ) );
446 pInstrument->set_higher_cc( pNode->
read_int(
"higher_cc", 127,
447 true,
true, bSilent ) );
449 for (
int i=0; i<
MAX_FX; i++ ) {
450 pInstrument->set_fx_level( pNode->
read_float( QString(
"FX%1Level" ).arg( i+1 ), 0.0,
451 true,
true, bSilent ), i );
465 if ( pSoundLibraryDatabase !=
nullptr ) {
471 auto pDrumkit = pSoundLibraryDatabase->
getDrumkit(
472 pInstrument->get_drumkit_path(),
false );
473 if ( pDrumkit ==
nullptr ) {
478 instrumentLicense = pDrumkit->get_license();
482 instrumentLicense = license;
485 if ( ! pNode->firstChildElement(
"instrumentComponent" ).isNull() ) {
487 XMLNode componentNode = pNode->firstChildElement(
"instrumentComponent" );
488 while ( ! componentNode.isNull() ) {
489 pInstrument->get_components()->
491 pInstrument->get_drumkit_path(),
492 instrumentLicense, bSilent ) );
493 componentNode = componentNode.nextSiblingElement(
"instrumentComponent" );
499 instrumentLicense, bSilent );
500 if ( pCompo ==
nullptr ) {
501 ERRORLOG( QString(
"Unable to load component for instrument [%1]. Aborting." )
502 .arg( pInstrument->get_name() ) );
506 pInstrument->get_components()->push_back( pCompo );
512 if ( pInstrument->get_components()->size() == 0 ) {
513 pInstrument->get_components()->push_back(
514 std::make_shared<InstrumentComponent>( 0 ) );
518 bool bSampleFound =
false;
519 for (
const auto& pComponent : *pInstrument->get_components() ) {
520 if ( pComponent ==
nullptr ) {
521 ERRORLOG(
"Invalid component. Something went wrong loading the instrument" );
522 pInstrument->set_muted(
true );
523 pInstrument->set_missing_samples(
true );
527 for (
const auto& pLayer : *pComponent ) {
528 if ( pLayer ==
nullptr ) {
534 if ( pLayer->get_sample() != nullptr ) {
535 if ( ! bSampleFound ) {
539 pInstrument->set_missing_samples(
true );
544 if ( ! bSampleFound ) {
545 pInstrument->set_muted(
true );
555 auto pLayer = pComponent->get_layer( i );
556 if ( pLayer !=
nullptr ) {
557 pLayer->load_sample( fBpm );
567 auto pLayer = pComponent->get_layer( i );
569 pLayer->unload_sample();
622 InstrumentNode.
write_string(
"sampleSelectionAlgo",
"VELOCITY" );
625 InstrumentNode.
write_string(
"sampleSelectionAlgo",
"RANDOM" );
628 InstrumentNode.
write_string(
"sampleSelectionAlgo",
"ROUND_ROBIN" );
636 for (
int i=0; i<
MAX_FX; i++ ) {
641 if( component_id == -1 ||
642 pComponent->get_drumkit_componentID() == component_id ) {
643 pComponent->save_to( &InstrumentNode, component_id, bRecentVersion, bFull );
656 if( pComponent->get_drumkit_componentID() == DrumkitComponentID ) {
671 if ( pComponent !=
nullptr ) {
672 for (
const auto& pLayer : *pComponent ) {
673 if ( pLayer !=
nullptr ) {
674 if ( pLayer->get_sample() != nullptr ) {
689 sOutput = QString(
"%1[Instrument]\n" ).arg( sPrefix )
690 .append( QString(
"%1%2id: %3\n" ).arg( sPrefix ).arg( s ).arg(
__id ) )
691 .append( QString(
"%1%2name: %3\n" ).arg( sPrefix ).arg( s ).arg(
__name ) )
692 .append( QString(
"%1%2drumkit_path: %3\n" ).arg( sPrefix ).arg( s ).arg(
__drumkit_path ) )
693 .append( QString(
"%1%2drumkit_name: %3\n" ).arg( sPrefix ).arg( s ).arg(
__drumkit_name ) )
694 .append( QString(
"%1%2gain: %3\n" ).arg( sPrefix ).arg( s ).arg(
__gain ) )
695 .append( QString(
"%1%2volume: %3\n" ).arg( sPrefix ).arg( s ).arg(
__volume ) )
696 .append( QString(
"%1%2pan: %3\n" ).arg( sPrefix ).arg( s ).arg(
m_fPan ) )
697 .append( QString(
"%1%2peak_l: %3\n" ).arg( sPrefix ).arg( s ).arg(
__peak_l ) )
698 .append( QString(
"%1%2peak_r: %3\n" ).arg( sPrefix ).arg( s ).arg(
__peak_r ) )
699 .append( QString(
"%1" ).arg(
__adsr->toQString( sPrefix + s, bShort ) ) )
700 .append( QString(
"%1%2filter_active: %3\n" ).arg( sPrefix ).arg( s ).arg(
__filter_active ) )
701 .append( QString(
"%1%2filter_cutoff: %3\n" ).arg( sPrefix ).arg( s ).arg(
__filter_cutoff ) )
702 .append( QString(
"%1%2filter_resonance: %3\n" ).arg( sPrefix ).arg( s ).arg(
__filter_resonance ) )
703 .append( QString(
"%1%2random_pitch_factor: %3\n" ).arg( sPrefix ).arg( s ).arg(
__random_pitch_factor ) )
704 .append( QString(
"%1%2pitch_offset: %3\n" ).arg( sPrefix ).arg( s ).arg(
__pitch_offset ) )
705 .append( QString(
"%1%2midi_out_note: %3\n" ).arg( sPrefix ).arg( s ).arg(
__midi_out_note ) )
706 .append( QString(
"%1%2midi_out_channel: %3\n" ).arg( sPrefix ).arg( s ).arg(
__midi_out_channel ) )
707 .append( QString(
"%1%2stop_notes: %3\n" ).arg( sPrefix ).arg( s ).arg(
__stop_notes ) )
708 .append( QString(
"%1%2sample_selection_alg: %3\n" ).arg( sPrefix ).arg( s ).arg(
__sample_selection_alg ) )
709 .append( QString(
"%1%2active: %3\n" ).arg( sPrefix ).arg( s ).arg(
__active ) )
710 .append( QString(
"%1%2soloed: %3\n" ).arg( sPrefix ).arg( s ).arg(
__soloed ) )
711 .append( QString(
"%1%2muted: %3\n" ).arg( sPrefix ).arg( s ).arg(
__muted ) )
712 .append( QString(
"%1%2mute_group: %3\n" ).arg( sPrefix ).arg( s ).arg(
__mute_group ) )
713 .append( QString(
"%1%2queued: %3\n" ).arg( sPrefix ).arg( s ).arg(
__queued ) ) ;
714 sOutput.append( QString(
"%1%2fx_level: [ " ).arg( sPrefix ).arg( s ) );
716 sOutput.append( QString(
"%1 " ).arg( ff ) );
718 sOutput.append( QString(
"]\n" ) )
719 .append( QString(
"%1%2hihat_grp: %3\n" ).arg( sPrefix ).arg( s ).arg(
__hihat_grp ) )
720 .append( QString(
"%1%2lower_cc: %3\n" ).arg( sPrefix ).arg( s ).arg(
__lower_cc ) )
721 .append( QString(
"%1%2higher_cc: %3\n" ).arg( sPrefix ).arg( s ).arg(
__higher_cc ) )
724 .append( QString(
"%1%2apply_velocity: %3\n" ).arg( sPrefix ).arg( s ).arg(
__apply_velocity ) )
726 .append( QString(
"%1%2m_bHasMissingSamples: %3\n" ).arg( sPrefix ).arg( s ).arg(
m_bHasMissingSamples ) )
727 .append( QString(
"%1%2components:\n" ).arg( sPrefix ).arg( s ) );
729 if ( cc !=
nullptr ) {
730 sOutput.append( QString(
"%1" ).arg( cc->toQString( sPrefix + s + s, bShort ) ) );
735 sOutput = QString(
"[Instrument]" )
736 .append( QString(
" id: %1" ).arg(
__id ) )
737 .append( QString(
", name: %1" ).arg(
__name ) )
740 .append( QString(
", gain: %1" ).arg(
__gain ) )
741 .append( QString(
", volume: %1" ).arg(
__volume ) )
742 .append( QString(
", pan: %1" ).arg(
m_fPan ) )
743 .append( QString(
", peak_l: %1" ).arg(
__peak_l ) )
744 .append( QString(
", peak_r: %1" ).arg(
__peak_r ) )
745 .append( QString(
", [%1" ).arg(
__adsr->toQString( sPrefix + s, bShort ).replace(
"\n",
"]" ) ) )
753 .append( QString(
", stop_notes: %1" ).arg(
__stop_notes ) )
755 .append( QString(
", active: %1" ).arg(
__active ) )
756 .append( QString(
", soloed: %1" ).arg(
__soloed ) )
757 .append( QString(
", muted: %1" ).arg(
__muted ) )
758 .append( QString(
", mute_group: %1" ).arg(
__mute_group ) )
759 .append( QString(
", queued: %1" ).arg(
__queued ) ) ;
760 sOutput.append( QString(
", fx_level: [ " ) );
762 sOutput.append( QString(
"%1 " ).arg( ff ) );
764 sOutput.append( QString(
"]" ) )
765 .append( QString(
", hihat_grp: %1" ).arg(
__hihat_grp ) )
766 .append( QString(
", lower_cc: %1" ).arg(
__lower_cc ) )
767 .append( QString(
", higher_cc: %1" ).arg(
__higher_cc ) )
773 .append( QString(
", components: [" ) );
775 if ( cc !=
nullptr ) {
776 sOutput.append( QString(
" %1" ).arg( cc->get_drumkit_componentID() ) );
779 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()
QString __name
Name of the Instrument.
float __peak_r
right current peak value
float __pitch_offset
instrument main pitch offset
void set_name(const QString &name)
get the name of the instrument
int __hihat_grp
the instrument is part of a hihat
void set_pitch_offset(float val)
set the pitch offset of the instrument
bool __active
is the instrument active?
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?
void set_sample_selection_alg(SampleSelectionAlgo selected_algo)
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
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?
bool __filter_active
is filter active?
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)
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?
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 __peak_l
left current peak value
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.
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.
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
void set_lower_cc(int message)
std::vector< std::shared_ptr< InstrumentComponent > > * get_components()
float getPan() const
get pan of the instrument
QString get_drumkit_path() const
set the name of the related drumkit
void set_muted(bool muted)
set muted status of the instrument
int __midi_out_note
midi out note
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 ...
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).
std::shared_ptr< Drumkit > getDrumkit(const QString &sDrumkitPath, bool bLoad=true)
Retrieve a drumkit from the database.
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