|
hydrogen 1.2.3
|
A note plays an associated instrument with a velocity left and right pan. More...
#include <Note.h>
Public Types | |
| enum | Key { C =KEY_MIN , Cs , D , Ef , E , F , Fs , G , Af , A , Bf , B } |
| possible keys More... | |
| enum | Octave { P8Z =-3 , P8Y =-2 , P8X =-1 , P8 =OCTAVE_DEFAULT , P8A =1 , P8B =2 , P8C =3 } |
| possible octaves More... | |
Public Member Functions | |
| Note (Note *pOther, std::shared_ptr< Instrument > pInstrument=nullptr) | |
| copy constructor with an optional parameter | |
| Note (std::shared_ptr< Instrument > pInstrument, int nPosition=0, float fVelocity=0.8, float fPan=0.0, int nLength=-1, float fPitch=0.0) | |
| constructor | |
| ~Note () | |
| destructor | |
| void | compute_lr_values (float *val_l, float *val_r) |
| compute left and right output based on filters | |
| void | computeNoteStart () |
| Calculates the m_nNoteStart in frames corresponding to the __position in ticks and storing the used tick size in m_fUsedTickSize. | |
| bool | filter_sustain () const |
| Filter output is sustaining note. | |
| std::shared_ptr< ADSR > | get_adsr () const |
| get the ADSR of the note | |
| float | get_bpfb_l () const |
| __bpfb_l accessor | |
| float | get_bpfb_r () const |
| __bpfb_r accessor | |
| float | get_cut_off () const |
| __cut_off accessor | |
| int | get_humanize_delay () const |
| __humanize_delay accessor | |
| std::shared_ptr< Instrument > | get_instrument () |
| __instrument accessor | |
| int | get_instrument_id () const |
| __instrument_id accessor | |
| bool | get_just_recorded () const |
| __just_recorded accessor | |
| Key | get_key () |
| __key accessor | |
| std::shared_ptr< SelectedLayerInfo > | get_layer_selected (int CompoID) |
| std::map< int, std::shared_ptr< SelectedLayerInfo > > | get_layers_selected () const |
| float | get_lead_lag () const |
| __lead_lag accessor | |
| int | get_length () const |
| __length accessor | |
| float | get_lpfb_l () const |
| __lpfb_l accessor | |
| float | get_lpfb_r () const |
| __lpfb_r accessor | |
| int | get_midi_key () const |
| return scaled key for midi output, !!! DO NOT CHECK IF INSTRUMENT IS SET !!! | |
| int | get_midi_msg () const |
| __midi_msg accessor | |
| int | get_midi_velocity () const |
| midi velocity accessor | |
| bool | get_note_off () const |
| __note_off accessor | |
| float | get_notekey_pitch () const |
| note key pitch accessor | |
| Octave | get_octave () |
| __octave accessor | |
| int | get_pattern_idx () const |
| __pattern_idx accessor | |
| float | get_pitch () const |
| __pitch accessor | |
| int | get_position () const |
| __position accessor | |
| float | get_probability () const |
| float | get_resonance () const |
| __resonance accessor | |
| int | get_specific_compo_id () const |
| __specific_compo_id accessor | |
| float | get_total_pitch () const |
| float | get_velocity () const |
| __velocity accessor | |
| long long | getNoteStart () const |
| float | getPan () const |
| get pan of the note. | |
| float | getPanWithRangeFrom0To1 () const |
| get pan of the note, scaling and translating the range from [-1;1] to [0;1] | |
| std::shared_ptr< Sample > | getSample (int nComponentID, int nSelectedLayer=-1) |
| Returns the sample associated with the note for a specific InstrumentComponent nComponentID. | |
| float | getUsedTickSize () const |
| bool | has_instrument () const |
| return true if __instrument is set | |
| void | humanize () |
| Add random contributions to __pitch, __humanize_delay, and __velocity. | |
| bool | isPartiallyRendered () const |
| QString | key_to_string () |
| return a string representation of key-octave | |
| void | map_instrument (std::shared_ptr< InstrumentList > instruments) |
| find the corresponding instrument and point to it, or an empty instrument | |
| bool | match (const Note *pNote) const |
| Return true if two notes match in instrument, key and octave. | |
| bool | match (const std::shared_ptr< Note > pNote) const |
| bool | match (std::shared_ptr< Instrument > instrument, Key key, Octave octave) const |
| return true if instrument, key and octave matches with internal | |
| void | save_to (XMLNode *node) |
| void | set_humanize_delay (int value) |
| __humanize_delay setter | |
| void | set_instrument_id (int value) |
| __instrument_id setter | |
| void | set_just_recorded (bool value) |
| __just_recorded setter | |
| void | set_key_octave (const QString &str) |
| parse str and set __key and __octave | |
| void | set_key_octave (Key key, Octave octave) |
| set __key and __octave only if within acceptable range | |
| void | set_lead_lag (float value) |
| __lead_lag setter | |
| void | set_length (int value) |
| __length setter | |
| void | set_midi_info (Key key, Octave octave, int msg) |
| set __key, __octave and __midi_msg only if within acceptable range | |
| void | set_note_off (bool value) |
| __note_off setter | |
| void | set_pattern_idx (int value) |
| __pattern_idx setter | |
| void | set_pitch (float value) |
| __pitch setter | |
| void | set_position (int value) |
| __position setter | |
| void | set_probability (float value) |
| void | set_specific_compo_id (int value) |
| __specific_compo_id setter | |
| void | set_velocity (float value) |
| __velocity setter | |
| void | setPan (float val) |
| set pan of the note. | |
| void | setPanWithRangeFrom0To1 (float fVal) |
| set pan of the note, assuming the input range in [0;1] | |
| void | swing () |
| Add swing contribution to __humanize_delay. | |
| QString | toQString (const QString &sPrefix="", bool bShort=true) const override |
| Formatted string version for debugging purposes. | |
Public Member Functions inherited from Object< Note > | |
| Object () | |
| Object (const Object< Note > &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 QString | KeyToQString (Key key) |
| static Note * | load_from (XMLNode *node, std::shared_ptr< InstrumentList > instruments, bool bSilent=false) |
| load a note from an XMLNode | |
| static int | octaveKeyToPitch (Octave octave, Key key) |
| static double | pitchToFrequency (double fPitch) |
| Convert a logarithmic pitch-space value in semitones to a frequency-domain value. | |
| static Key | pitchToKey (int nPitch) |
| static Octave | pitchToOctave (int nPitch) |
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 | |
| std::shared_ptr< ADSR > | __adsr |
| attack decay sustain release | |
| float | __bpfb_l |
| left band pass filter buffer | |
| float | __bpfb_r |
| right band pass filter buffer | |
| float | __cut_off |
| filter cutoff [0;1] | |
| int | __humanize_delay |
| frequency [0;1] | |
| std::shared_ptr< Instrument > | __instrument |
| the instrument to be played by this note | |
| int | __instrument_id |
| the id of the instrument played by this note | |
| bool | __just_recorded |
| used in record+delete | |
| Key | __key |
| the key, [0;11]==[C;B] | |
| std::map< int, std::shared_ptr< SelectedLayerInfo > > | __layers_selected |
| float | __lead_lag |
| lead or lag offset of the note | |
| int | __length |
| left to right, as requested by Sampler PanLaws | |
| float | __lpfb_l |
| left low pass filter buffer | |
| float | __lpfb_r |
| right low pass filter buffer | |
| int | __midi_msg |
| TODO. | |
| bool | __note_off |
| note type on|off | |
| Octave | __octave |
| the octave [-3;3] | |
| int | __pattern_idx |
| index of the pattern holding this note for undo actions | |
| float | __pitch |
| the frequency of the note | |
| int | __position |
| note position in | |
| float | __probability |
| note probability | |
| float | __resonance |
| filter resonant | |
| int | __specific_compo_id |
| play a specific component, -1 if playing all | |
| float | __velocity |
| ticks inside the pattern | |
| float | m_fPan |
| pan of the note, [-1;1] from | |
| float | m_fUsedTickSize |
| TransportPosition::m_fTickSize used to calculate m_nNoteStart. | |
| long long | m_nNoteStart |
| from __key an __octave | |
Static Private Attributes | |
| static const char * | __key_str [] = { "C", "Cs", "D", "Ef", "E", "F", "Fs", "G", "Af", "A", "Bf", "B" } |
| used to build QString | |
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< Note > | |
| ~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 |
A note plays an associated instrument with a velocity left and right pan.
| enum Key |
| enum Octave |
| Note | ( | std::shared_ptr< Instrument > | pInstrument, |
| int | nPosition = 0, | ||
| float | fVelocity = 0.8, | ||
| float | fPan = 0.0, | ||
| int | nLength = -1, | ||
| float | fPitch = 0.0 ) |
constructor
| pInstrument | the instrument played by this note |
| nPosition | the position of the note within the pattern |
| fVelocity | it's velocity |
| fFan | pan |
| nLength | Length of the note in frames. If set to -1, the length of the H2Core::Sample used during playback will be used instead. |
| fPitch | it's pitch |
| Note | ( | Note * | pOther, |
| std::shared_ptr< Instrument > | pInstrument = nullptr ) |
|
inline |
| void computeNoteStart | ( | ) |
Calculates the m_nNoteStart in frames corresponding to the __position in ticks and storing the used tick size in m_fUsedTickSize.
Whenever the tempo changes and the #Timeline is not enabled, the m_nNoteStart gets invalidated and this function needs to be rerun.
|
inline |
|
inline |
|
inline |
__humanize_delay accessor
|
inline |
__instrument accessor
|
inline |
__instrument_id accessor
|
inline |
__just_recorded accessor
|
inline |
|
inline |
|
inline |
__lead_lag accessor
|
inline |
|
inline |
__midi_msg accessor
|
inline |
midi velocity accessor
|
inline |
__note_off accessor
|
inline |
note key pitch accessor
|
inline |
|
inline |
__pattern_idx accessor
|
inline |
__position accessor
|
inline |
__resonance accessor
|
inline |
__specific_compo_id accessor
| float get_total_pitch | ( | ) | const |
|
inline |
__velocity accessor
|
inline |
|
inline |
| std::shared_ptr< Sample > getSample | ( | int | nComponentID, |
| int | nSelectedLayer = -1 ) |
Returns the sample associated with the note for a specific InstrumentComponent nComponentID.
A sample of the InstrumentComponent is a possible candidate if the note velocity falls within the start and end velocity of an InstrumentLayer. In case multiple samples are possible the function will either pick the provided nSelectedLayer or - for nSelectedLayer == -1 - the selection algorithm stored in __instrument to determined a layer.
The function stores the selected layer in __layers_selected and will reuse this parameter in every following call while disregarding the provided nSelectedLayer.
|
inline |
return true if __instrument is set
| void humanize | ( | ) |
Add random contributions to __pitch, __humanize_delay, and __velocity.
| bool isPartiallyRendered | ( | ) | const |
| QString key_to_string | ( | ) |
|
static |
| void map_instrument | ( | std::shared_ptr< InstrumentList > | instruments | ) |
|
inline |
|
inline |
|
inline |
return true if instrument, key and octave matches with internal
| instrument | the instrument to match with __instrument |
| key | the key to match with __key |
| octave | the octave to match with __octave |
|
inlinestatic |
| void set_humanize_delay | ( | int | value | ) |
|
inline |
|
inline |
| void set_key_octave | ( | const QString & | str | ) |
| void set_lead_lag | ( | float | value | ) |
|
inline |
set __key, __octave and __midi_msg only if within acceptable range
| key | the key to set |
| octave | the octave to be set |
| msg |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
| void set_velocity | ( | float | value | ) |
| void setPan | ( | float | val | ) |
|
inline |
| void swing | ( | ) |
Add swing contribution to __humanize_delay.
As the value applied is deterministic, it will not be handled in humanice() but separately.
|
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.
|
private |
|
private |
frequency [0;1]
Offset of the note start in frames.
It includes contributions of the onset humanization, the lead lag factor, and the swing. For some of these a random value will be drawn but once stored in this variable, the delay is fixed and will not change anymore.
It is incorporated in the m_nNoteStart.
|
private |
|
private |
|
staticprivate |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
TransportPosition::m_fTickSize used to calculate m_nNoteStart.
If m_nNoteStart was calculated in the presence of an active #Timeline, it will be set to -1.
Used to check whether the note start has to be rescaled because of a change in speed (which occurs less often and is faster than recalculating m_nNoteStart everywhere it is required.)
This member is only used by the #AudioEngine and #Sampler during processing and not written to disk.