hydrogen 1.2.3
SelectedLayerInfo Struct Reference

Auxiliary variables storing the rendering state of a H2Core::Note within the H2Core::Sampler. More...

#include <Note.h>

Data Fields

float fSamplePosition
 Stores the frame till which the H2Core::Sample of the selected H2Core::InstrumentLayer using nSelectedLayer was already rendered.
 
int nNoteLength
 Frame / fSamplePosition at which rendering of the current note is considered done.
 
int nSelectedLayer
 Selected layer during rendering in the H2Core::Sampler.
 

Detailed Description

Auxiliary variables storing the rendering state of a H2Core::Note within the H2Core::Sampler.

Definition at line 63 of file Note.h.

Field Documentation

◆ fSamplePosition

float fSamplePosition

Stores the frame till which the H2Core::Sample of the selected H2Core::InstrumentLayer using nSelectedLayer was already rendered.

If several cycles of Sampler::renderNote() are required, this variable corresponds to the starting point of each cycle.

It is given in float instead of int/long - what one might expect when talking about frames - since it also serves as the fraction of the H2Core::Sample already processed in case it has to be resampled.

Definition at line 79 of file Note.h.

◆ nNoteLength

int nNoteLength

Frame / fSamplePosition at which rendering of the current note is considered done.

For regular notes this is the number of frames of the H2Core::Sample corresponding to nSelectedLayer.

If, however, the user specifies the length of a note things are more complex. The length is specified in the GUI in ticks and this variable is the corresponding value in frames. Now, whenever manually adjusting the tempo or adding/deleting a tempo marker the length of the note in frames differs for the new speed. In case rendering did already started, it is important to not rescale the whole length of the note but just the fraction between fSamplePosition and the former nNoteLength.

Definition at line 94 of file Note.h.

◆ nSelectedLayer

int nSelectedLayer

Selected layer during rendering in the H2Core::Sampler.

If set to -1 (during creation), Sampler::renderNote() will determine which layer to use and overrides this variable with the corresponding value.

Definition at line 69 of file Note.h.