|
Krotos Modules 3
|
Generates sounds by decimating and reconstructing audio samples. More...
#include <GranularOscillator.h>
Public Types | |
| enum | GranularParam { Start = 0 , StartRand , Size , SizeRand , Rate , RateRand , Width , WidthRand , Pan , PanRand , Detune , DetuneMod , DetuneRand , Level , SamplerLevel , GranularLevel , VehicleLevel , LevelMod , LevelRand , Quench , Robin , SALoop , AutoRate , Autoplay , Shape , GrainLim , Tracking , Cycles , PhaseLock , PhaseSync , Normalise , MuteUp , MuteDown , Smoothing , MovementSensitivity , SizeST , DivST , SprayST , MixST , SizeDY , DivDY , SprayDY , MixDY , Mute , Solo , NUM_PARAMS } |
Public Member Functions | |
| GranularOscillator () | |
| ~GranularOscillator () override | |
| void | setSampleRate (double sampleRate) override |
| Sets the sample rate which the granular oscillator uses to calculate its output. | |
| double | getSampleRate () override |
| Returns the sample rate which which you set with the setSampleRate method. | |
| void | setFrequency (float frequency) override |
| Sets the target frequency which you want the oscillator to output. | |
| float | getFrequency () override |
| Gets the target frequency which you set with the setFrequency method. | |
| void | setPhaseOffset (float) override |
| void | reset () override |
| void | setPhase (double) override |
| double | getPhase () override |
| int | getNumActiveGrains () override |
| Returns the number of grains currently active for this instance of the oscillator. | |
| StereoSample | getNextStereoSample (size_t sampleIndex) override |
| Updates the granular engine and returns the next audio value. | |
| void | setGranularParameter (size_t paramIndex, const float *newValue) |
| Updates the granular engine and returns the next audio value. | |
| void | setGranularParameters (std::vector< const float * > &newParams) |
| Sets multiple internal parameter to new values. | |
| void | setSampleData (SampleEngine *sampleEngine) |
| Sets the oscillator's internal reference to the SampleEngine structure it is to use. | |
| void | startNote (int midiNote, float velocity, int voiceIndex) |
| Starts the oscillator playing, usually called by key down event. | |
| const float | getVelocity () |
| Returns the value of the velocity as a float in [0...1]. | |
| void | stopNote () |
| Signals the oscillator to begin key up behaviour, usually called by key up event The oscillator may continue playing if it is generating a tail. | |
| void | clearNote () |
| Signals the oscillator to stop immediately, and return any grains to pool. | |
Public Member Functions inherited from krotos::Oscillator | |
| virtual | ~Oscillator ()=default |
Private Member Functions | |
| void | setGranularOscillatorType (GranularPlaybackMode newType) |
| void | flushGranular () |
| float | cube (float val) |
| void | setTaggingType (bool isOn) |
| void | setTrackingEnable (bool isOn) |
| void | setLoopEnableFlag () |
| void | killNANs (StereoSample &sample) |
| Grain * | launchGrain (float paramSize, float paramStart, float paramSpray, Grain::Flavour flavour, float gain=-1.f) |
| double | calculatePlayheadPosition (double startPosition, float halfSpray, float referenceGrainsize) |
| StereoSample | getNextStereoGranularSamplePhaseLocked () |
| StereoSample | getNextStereoGranular () |
| StereoSample | getNextStereoSampler () |
| void | generateGrainsGranular (StereoSample &sampleAccumulator) |
| void | generateGrainsSampler (StereoSample &sampleAccumulator) |
| void | setGrainData (Grain *playingGrain) |
| void | generateNewFluxFactor () |
Generates sounds by decimating and reconstructing audio samples.
Enumerates the parameters which are used to control generation of grains
| krotos::GranularOscillator::GranularOscillator | ( | ) |
GranularOscillator Constructor
|
inlineoverride |
GranularOscillator Destructor
|
private |
| void krotos::GranularOscillator::clearNote | ( | ) |
Signals the oscillator to stop immediately, and return any grains to pool.
|
inlineprivate |
|
private |
|
private |
Accumulates audio from all the playing grains
|
private |
|
private |
|
inlineoverridevirtual |
Gets the target frequency which you set with the setFrequency method.
Implements krotos::Oscillator.
|
private |
Returns the next stereo sample for Granular mode
|
inlineprivate |
|
inlineoverridevirtual |
Updates the granular engine and returns the next audio value.
Implements krotos::Oscillator.
|
private |
Returns the next stereo sample for Sampler mode
|
inlineoverridevirtual |
Returns the number of grains currently active for this instance of the oscillator.
Reimplemented from krotos::Oscillator.
|
inlineoverridevirtual |
Implements krotos::Oscillator.
|
inlineoverridevirtual |
Returns the sample rate which which you set with the setSampleRate method.
Implements krotos::Oscillator.
| const float krotos::GranularOscillator::getVelocity | ( | ) |
Returns the value of the velocity as a float in [0...1].
|
inlineprivate |
|
private |
|
inlineoverridevirtual |
Resets the phase offset for PWM to 0
Implements krotos::Oscillator.
|
inlineoverridevirtual |
Sets the target frequency which you want the oscillator to output.
| frequency | Frequency in Hz |
Implements krotos::Oscillator.
|
private |
|
inlineprivate |
| void krotos::GranularOscillator::setGranularParameter | ( | size_t | paramIndex, |
| const float * | newValue ) |
Updates the granular engine and returns the next audio value.
Sets an internal parameter to a new value
| paramIndex | The index of the parameter (enum GranularParam) |
| newValue | The new value to set the parameter with |
|
inline |
Sets multiple internal parameter to new values.
| newParams | A vector containing new parameters, must be ordered as in enum GranularParam |
|
inlineprivate |
Read the loop parameter and set the flag
|
inlineoverridevirtual |
Implements krotos::Oscillator.
|
inlineoverridevirtual |
The following overridden methods are interface methods which are not used in the granular oscillator at present
Implements krotos::Oscillator.
| void krotos::GranularOscillator::setSampleData | ( | SampleEngine * | sampleEngine | ) |
Sets the oscillator's internal reference to the SampleEngine structure it is to use.
| sampleEngine | Pointer to an instance of SampleEngine |
|
inlineoverridevirtual |
Sets the sample rate which the granular oscillator uses to calculate its output.
The following overridden methods implement the Oscillator interface
| sampleRate | Sample rate in Hz |
Implements krotos::Oscillator.
|
inlineprivate |
|
inlineprivate |
| void krotos::GranularOscillator::startNote | ( | int | midiNote, |
| float | velocity, | ||
| int | voiceIndex ) |
Starts the oscillator playing, usually called by key down event.
| velocity | Value of velocity in [0...1] |
| void krotos::GranularOscillator::stopNote | ( | ) |
Signals the oscillator to begin key up behaviour, usually called by key up event The oscillator may continue playing if it is generating a tail.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |