|
hydrogen 1.2.3
|
InstrumentLayer is part of an instrument
each layer has it's own :
gain which is the ration between the input sample and the output signal,
pitch which allows you to play the sample at a faster or lower frequency,
start velocity and end velocity which allows you to chose between a layer or another within an instrument by changing the velocity of the played note.
More...
#include <InstrumentLayer.h>
Public Member Functions | |
| InstrumentLayer (std::shared_ptr< InstrumentLayer > other) | |
| copy constructor, will be initialized with an empty sample | |
| InstrumentLayer (std::shared_ptr< InstrumentLayer > other, std::shared_ptr< Sample > sample) | |
| copy constructor | |
| InstrumentLayer (std::shared_ptr< Sample > sample) | |
| constructor | |
| ~InstrumentLayer () | |
| destructor | |
| float | get_end_velocity () const |
| get the end velocity of the layer | |
| float | get_gain () const |
| get the gain of the layer | |
| float | get_pitch () const |
| get the pitch of the layer | |
| std::shared_ptr< Sample > | get_sample () const |
| get the sample of the layer | |
| float | get_start_velocity () const |
| get the start velocity of the layer | |
| void | load_sample (float fBpm=120) |
| Calls the H2Core::Sample::load() member function of __sample. | |
| void | save_to (XMLNode *node, bool bFull=false) |
| save the instrument layer within the given XMLNode | |
| void | set_end_velocity (float end) |
| set the end velocity of the layer | |
| void | set_gain (float gain) |
| set the gain of the layer | |
| void | set_pitch (float pitch) |
| set the pitch of the layer | |
| void | set_sample (std::shared_ptr< Sample > sample) |
| set the sample of the layer | |
| void | set_start_velocity (float start) |
| set the start ivelocity of the layer | |
| QString | toQString (const QString &sPrefix="", bool bShort=true) const override |
| Formatted string version for debugging purposes. | |
| void | unload_sample () |
Public Member Functions inherited from Object< InstrumentLayer > | |
| Object () | |
| Object (const Object< InstrumentLayer > &other) | |
Public Member Functions inherited from Base | |
| Base () | |
| Base (const Base &other) | |
| virtual const char * | class_name () const |
| void | Print (bool bShort=true) const |
| Prints content of toQString() via DEBUGLOG. | |
Static Public Member Functions | |
| static std::shared_ptr< InstrumentLayer > | load_from (XMLNode *pNode, const QString &sDrumkitPath, const License &drumkitLicense=License(), bool bSilent=false) |
| load an instrument layer from an XMLNode | |
Static Public Member Functions inherited from Base | |
| static const char * | _class_name () |
| return the class name | |
| static QString | base_clock (const QString &sMsg) |
| Measures the current time and stores it in __last_clock. | |
| static QString | base_clock_in (const QString &sMsg) |
| static int | bootstrap (Logger *logger, bool count=false) |
| must be called before any Object instantiation ! | |
| static bool | count_active () |
| static int | getAliveObjectCount () |
| static object_map_t | getObjectMap () |
| static Logger * | logger () |
| return the logger instance | |
| static int | objects_count () |
| static void | printObjectMapDiff (object_map_t map) |
| Creates the difference between a snapshot of the object map and its current state and prints it to std::cout. | |
| static void | set_count (bool flag) |
| enable/disable class instances counting | |
| static void | write_objects_map_to (std::ostream &out, object_map_t *map=nullptr) |
| output the full objects map to a given ostream | |
| static void | write_objects_map_to_cerr () |
| output objects map to stderr | |
Private Attributes | |
| float | __end_velocity |
| the end velocity of the sample, 1.0 by default | |
| float | __gain |
| ratio between the input sample and the output signal, 1.0 by default | |
| float | __pitch |
| the frequency of the sample, 0.0 by default which means output pitch is the same as input pitch | |
| std::shared_ptr< Sample > | __sample |
| the underlaying sample | |
| float | __start_velocity |
| the start velocity of the sample, 0.0 by default | |
Additional Inherited Members | |
Static Public Attributes inherited from Base | |
| static QString | sPrintIndention = " " |
| String used to format the debugging string output of some core classes. | |
Protected Member Functions inherited from Object< InstrumentLayer > | |
| ~Object () | |
Protected Member Functions inherited from Base | |
| ~Base () | |
Static Protected Member Functions inherited from Base | |
| static void | registerClass (const char *name, const atomic_obj_cpt_t *counters) |
Static Protected Attributes inherited from Base | |
| static bool | __count = false |
| should we count class instances | |
| static timeval | __last_clock = { 0, 0 } |
| static Logger * | __logger = nullptr |
InstrumentLayer is part of an instrument
each layer has it's own :
gain which is the ration between the input sample and the output signal,
pitch which allows you to play the sample at a faster or lower frequency,
start velocity and end velocity which allows you to chose between a layer or another within an instrument by changing the velocity of the played note.
so the only layer of an instrument should start at 0.0 and end at 1.0.
Definition at line 45 of file InstrumentLayer.h.
| InstrumentLayer | ( | std::shared_ptr< Sample > | sample | ) |
| InstrumentLayer | ( | std::shared_ptr< InstrumentLayer > | other | ) |
copy constructor, will be initialized with an empty sample
| other | the instrument layer to copy from |
Definition at line 45 of file InstrumentLayer.cpp.
| InstrumentLayer | ( | std::shared_ptr< InstrumentLayer > | other, |
| std::shared_ptr< Sample > | sample ) |
copy constructor
| other | the instrument layer to copy from |
| sample | the sample to use |
Definition at line 54 of file InstrumentLayer.cpp.
| ~InstrumentLayer | ( | ) |
destructor
Definition at line 63 of file InstrumentLayer.cpp.
|
inline |
get the end velocity of the layer
Definition at line 176 of file InstrumentLayer.h.
|
inline |
get the gain of the layer
Definition at line 146 of file InstrumentLayer.h.
|
inline |
get the pitch of the layer
Definition at line 156 of file InstrumentLayer.h.
|
inline |
get the sample of the layer
Definition at line 181 of file InstrumentLayer.h.
|
inline |
get the start velocity of the layer
Definition at line 166 of file InstrumentLayer.h.
|
static |
load an instrument layer from an XMLNode
| pNode | the XMLDode to read from |
| sDrumkitPath | the directory holding the drumkit data |
| drumkitLicense | License assigned to all #Sample contain in the loaded InstrumentLayer. |
| bSilent | if set to true, all log messages except of errors and warnings are suppressed. |
Definition at line 86 of file InstrumentLayer.cpp.
| void load_sample | ( | float | fBpm = 120 | ) |
Calls the H2Core::Sample::load() member function of __sample.
Definition at line 72 of file InstrumentLayer.cpp.
| void save_to | ( | XMLNode * | node, |
| bool | bFull = false ) |
save the instrument layer within the given XMLNode
| node | the XMLNode to feed |
| bFull | Whether to write all parameters of the contained #Sample as well. This will be done when storing an #Instrument as part of a #Song but not when storing as part of a #Drumkit. |
Definition at line 202 of file InstrumentLayer.cpp.
|
inline |
set the end velocity of the layer
Definition at line 171 of file InstrumentLayer.h.
|
inline |
set the gain of the layer
Definition at line 141 of file InstrumentLayer.h.
|
inline |
set the pitch of the layer
Definition at line 151 of file InstrumentLayer.h.
| void set_sample | ( | std::shared_ptr< Sample > | sample | ) |
set the sample of the layer
Definition at line 67 of file InstrumentLayer.cpp.
|
inline |
set the start ivelocity of the layer
Definition at line 161 of file InstrumentLayer.h.
|
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 Base.
Definition at line 273 of file InstrumentLayer.cpp.
| void unload_sample | ( | ) |
Definition at line 79 of file InstrumentLayer.cpp.
|
private |
the end velocity of the sample, 1.0 by default
Definition at line 135 of file InstrumentLayer.h.
|
private |
ratio between the input sample and the output signal, 1.0 by default
Definition at line 132 of file InstrumentLayer.h.
|
private |
the frequency of the sample, 0.0 by default which means output pitch is the same as input pitch
Definition at line 133 of file InstrumentLayer.h.
|
private |
the underlaying sample
Definition at line 136 of file InstrumentLayer.h.
|
private |
the start velocity of the sample, 0.0 by default
Definition at line 134 of file InstrumentLayer.h.