|
Krotos Modules 3
|
#include <SampleEngine.h>
Public Member Functions | |
| void | newBlockStart () |
| void | calculatePolyphonyCount () |
| bool | isPlaying () |
| returns true if any grains are active | |
| bool | shouldUpdateDisplay () |
| returns true if the sample engine requires the grain display to be redrawn | |
| void | triggerDisplayUpdate () |
| send a trigger signal for the grain display to redraw | |
| bool | hasDisplayUpdated () const |
| Grain * | allocateGrain () |
| void | setGrainLimit (int newLimit) |
| void | freeGrain (Grain *grain) |
| Grain * | getGrainArray () |
| void | flushGrains () |
| void | setPuckPosition (Point< float > position) |
| Point< float > | getPuckPosition () |
| void | requestAnalysis () |
| void | setGranularOscillatorTypeIndicator (GranularPlaybackMode newType) |
| GranularPlaybackMode | getGranularOscillatorTypeIndicator () |
| void | setGranularOscillatorMIDIMode (MIDIMode newMode) |
| MIDIMode | getGranularOscillatorMIDIMode () |
| float | getIndicator1 () |
| void | setIndicator1 (float newVal) |
| float | getIndicator2 () |
| void | setIndicator2 (float newVal) |
| float | getIndicatorRPM () |
| void | setIndicatorRPM (float newVal) |
| void | clearAudioSegments () |
| void | addAudioSegment (AudioSegment &seg) |
| int | getNumAudioSegments () |
| StringArray | getAudioSegmentNames () const |
| Returns a StringArray of audio segment names loaded in the engine. | |
| const Array< AudioSegment > & | getAudioSegments () const |
| Returns the audio segment array loaded in the sample engine.(read-only) | |
| Range< float > | getPlayingWaveformZoomRange () |
| int | getAudioSelectionStartPosition (int segmentIndex) |
| Returns the start of the selected section of an audio segment. | |
| int | getAudioSelectionLengthInSamples (int segmentIndex) |
| Returns the length of the selected section of an audio segment. | |
| int | getAudioSegmentStartPosition (int segmentIndex) |
| Returns the start of an audio segment. | |
| int | getAudioSegmentLengthInSamples (int segmentIndex) |
| Returns the length of an audio segment. | |
| void | setAudioSelectionRangeRelative (int segmentIndex, Range< int > range) |
| Sets the selection range of an audio segment relative to the segment. | |
| void | setAudioSelectionStartPositionAbsolute (int segmentIndex, int startPosition) |
| Sets the absolute start of an audio segment selection relative to the audio buffer start. | |
| void | setAudioSelectionLength (int segmentIndex, int length) |
| Sets the length of an audio segment selection. | |
| std::vector< Range< int > > | getSelectionRanges () |
| Returns an array of segment selection ranges. | |
| void | setSelectionRanges (const std::vector< Range< int > > &selectionRanges) |
| Sets the selection ranges of the audio segments. | |
| void | setSegmentMuted (int segmentIndex, bool isMuted) |
| 'Mutes' an audio segment in the sampler. In effect, this just means the sample is skipped in the round robin selection logic. | |
| Value & | getSoloValue (int index) |
| Returns a reference to the 'solo' Value of an audio segment. You can use Value::referTo to have the segment share the same Value as that from external state / UI to keep it up to date. The solo Value is used to ensure a soloed segment cannot be unmuted. Setting this Value to true won't solo the segment, it's just a flag to prevent unmuting. To Solo a sample, you'll need to implement this from a UI controller. | |
| juce::String | getGetLoadedFilePathsAsCSV () |
| int | getAudioSegmentSampleRate (int segmentIndex) |
| float | getAudioSegmentNormalisationFactor (int segmentIndex) |
| void | setNextSegmentIndex (int index) |
| Sets the next segment index to be picked. | |
| void | prepareNextSegmentIndex (bool sequential=true) |
| Calculate the next segment to be played back. | |
| String | getNextCuedSegmentName () const |
| Returns the next cued segment name TODO: Update this to return actual cued segment. as right now it just returns the just played segment name, since the SampleEngine decides the robin index during playback. | |
| const int | getNextSegmentIndex () const |
| Returns the index of the next segment to be played. | |
| const int | getCurrentSegmentIndex () const |
| Returns the index of the next segment to be played. | |
| const int | getLastSegmentIndex () const |
| Returns the index of the previous segment that was played. | |
| void | removeSegment (int segmentIndex) |
| Remove a segment from the sample engine. | |
Public Member Functions inherited from krotos::KrotosAudioBufferDSP | |
| KrotosAudioBufferDSP () | |
| ~KrotosAudioBufferDSP () | |
| void | exitSignalSent () override |
| void | generalScheme () |
| void | writeSpectrogramToFile (const std::vector< std::vector< float > > &spectrogram, const juce::String filename) |
| void | writeFeatureToFile (const std::vector< float > &feature, const std::string &filename) |
| float | crossCorrelate (const float *referencePointer, const float *candidatePointer, const int testSize) |
| crossCorrelate - Perform a cross-correlation function | |
| float | autoCorrelateCentred (int centerIndex, int testSize) |
| autoCorrelateCentred - Autocorrelate both sides of supplied index | |
| int | calcFreeGrain (int centerIndex, int previousGrainSize, GrainRange range) |
| calcFreeGrain - find the next grain size | |
| void | setPhaseAnalysisCoefficients (AnalysisCoefficientsPhase coeff) |
| int | size () |
| float * | data () |
| AnalysisCoefficients & | getAnalysisCoefficients () |
| void | analyse () |
| analyse Analyses the audio waveform stored in the buffer according to the selected scheme This method needs to be non-blocking so it doesn't hold up the message thread. If there is already an analysis in progress, this method will ask the thread to exit then restart it | |
| void | analysePhase () |
| void | setDefaultPhaseAnalysisCoefficients () |
| void | invalidate () |
| void | validate () |
| bool | analysisResultsAreValid () |
| void | triggerDisplayCacheRegeneration () |
| bool | shouldRegenerateDisplayCache () |
| bool | scanForGrainsFreeMarker (std::vector< int > &returnGrains, const int audioIndexStart, const int useableIndexEnd, const int startGrainSize) |
| bool | scanBackwardsForGrainsFreeMarker (std::vector< int > &returnGrains, const int audioIndexStart, const int useableIndexEnd, const int startGrainSize) |
| void | buildDescriptors (std::vector< AudioDescriptor > &descriptors, const std::vector< int > &grainsList, const int startGrainAudioIndex, bool goingBackwards) |
| void | setAnalysisWavRange (float start, float end) |
| setAnalysisWavRange - define a subset of the audio range for analysis | |
| void | setAnalysisGrainSizeRange () |
| Set the frequency range we want to analyse for. | |
| std::vector< AudioDescriptor > & | getGrainDescriptionByTime () |
| std::vector< AudioDescriptor > & | getGrainDescriptionByZ () |
| std::size_t | getNearestNeighbour2D (float x, float y) |
| std::vector< std::size_t > | getNearestNeighbour2D (float x, float y, std::size_t k) |
| std::vector< std::size_t > | getNearestNeighbour2D (float x, float y, float search_radius) |
| std::size_t | getNearestNeighbour3D (float x, float y, float z) |
| std::vector< std::size_t > | getNearestNeighbour3D (float x, float y, float z, std::size_t k) |
| std::vector< std::size_t > | getNearestNeighbour3D (float x, float y, float z, float search_radius) |
| void | setTrackingValue (float newValue) |
| void | setTrackingCycles (float newValue) |
| AudioDescriptor & | audioIndexToDescriptor (int audioIndex) |
| AudioDescriptor & | audioPercentToDescriptor (float audioPercent) |
| AudioDescriptor & | audioFrequencyToDescriptor (float frequency) |
| void | clampGrainDescriptionByTimeIndex (size_t &index) |
| StereoSample | getSampleFromGrainPhase (double grainPhase) |
| double | getFrequencyFromGrainPhase (double grainPhase) |
| ProgressTracker & | getProgressTracker () |
| Get a reference to this buffer's ProgressTracker. | |
| SegmentationMethod | getSegmentationMethod () const |
| FeatureExtrMethod | getFeatureExtractionMethod () |
| AnalysisScheme | getAnalysisScheme () |
| void | setSegmentationMethod (SegmentationMethod segmentation) |
| void | setFeatureExtrMethod (FeatureExtrMethod featureExtraction) |
| void | setAnalysisScheme (AnalysisScheme scheme) |
Public Member Functions inherited from krotos::KrotosAudioBuffer | |
| KrotosAudioBuffer () | |
| KrotosAudioBuffer (int channels, int size) | |
| KrotosAudioBuffer (const AudioBuffer< float > &buffer) | |
| Creates a krotos buffer from a juce buffer. | |
| KrotosAudioBuffer (const AudioBuffer< float > &buffer, int numOfChannels) | |
| Creates a krotos buffer from a juce buffer but with a new number of channels, this constructor tries to be as efficient as possible by not reallocating or clearing the extra space. | |
| ~KrotosAudioBuffer () | |
| float | getPeak (int channel) const |
| float | getRMS (int channel) const |
| void | setSize (int newNumChannels, int numSamples, bool keepExistingContent=true, bool clearExtraSpace=true, bool avoidReallocating=true) |
| void | setSize (KrotosAudioBuffer &prototypeBuffer) |
| void | copyFrom (int destChannel, const float *source, int numSamples) |
| void | copyFrom (KrotosAudioBuffer &sourceBuffer) |
| void | addFrom (int destChannel, const float *source, int numSamples) |
| void | addFrom (KrotosAudioBuffer &srcBuffer) |
| void | processWetDry (KrotosAudioBuffer &wetBuffer, SmoothedFloat &wetDryValue) |
| void | processGain (SmoothedFloat &gainFactor) |
| void | processGain (float gainFactor) |
| void | processPan (SmoothedFloat &panValue) |
| bool | processClamp (float clampValue) |
| void | fillWithNoise () |
| void | processMute (MuteStateMachine &state) |
| void | setDataValid (bool state) |
| bool | isDataValid () const |
| void | setSampleRate (float sampleRate) |
| float | getSampleRate (void) |
| void | setSourceSampleRate (float sampleRate) |
| float | getSourceSampleRate (void) |
| float | getNativeNoteFrequency (void) |
| void | setInterpolationType (InterpolationType newInterpolationType) |
| StereoSample | makeRamp (StereoSample startValue, int samples) |
| Create a ramp in the buffer. | |
| StereoSample | getLastSample () |
| Get the last stereo sample from the audio buffer. | |
| StereoSample | getInterpolatedSample (double index) |
| Get a stereo sample from the audio buffer. | |
| float | getInterpolatedSampleMono (float playHead) |
| KrotosAudioBuffer | getMonoBuffer () |
| void | reverse (int channel, int startSample, int numSamples) |
| void | reverse (int startSample, int numSamples) |
| juce::AudioBuffer< float > & | getJuceAudioBuffer () |
| void | equalPowerCrossFadeFrom (const KrotosAudioBuffer &previousBuffer) |
| float | findAbsMax () |
| void | normaliseTo (float scale) |
Static Public Attributes | |
| static const int | MAX_NUM_GRAINS {200} |
Private Member Functions | |
| void | setAudioSelectionRangeAbsolute (int segmentIndex, Range< int > range) |
| Sets the absolute selection range of an audio segment relative to the audio buffer start. | |
| void | setAudioSegmentStartPosition (int segmentIndex, int startPosition) |
| Sets the start of an audio segment relative to the audio buffer start. | |
| void | setAudioSegmentLength (int segmentIndex, int length) |
| Sets the length an audio segment. | |
| void | setAudioSegmentRange (int segmentIndex, Range< int > range) |
| Sets the start and end of an audio segment relative to the audio buffer start. | |
| Range< int > | getAudioSegmentRange (int segmentIndex) |
| Returns the start and end positions of an audio segment as a Range. | |
| float | getAudioSegmentStartPositionPercent (int segmentIndex) |
| Returns the start position of an audio segment as a fraction of the audio buffer length. | |
| float | getAudioSegmentEndPositionPercent (int segmentIndex) |
| Returns the end position of an audio segment as a fraction of the audio buffer length. | |
| float | getAudioSelectionStartPositionPercent (int segmentIndex) |
| Returns the start position of an audio segment selection as a fraction of the audio buffer length. | |
| float | getAudioSelectionEndPositionPercent (int segmentIndex) |
| Returns the end position of an audio segment selection as a fraction of the audio buffer length. | |
| Range< int > | getAudioSelectionRange (int segmentIndex) |
| Returns the start and end position of an audio segment selection as a Range. | |
| Range< int > | getAudioSelectionRangeRelative (int segmentIndex) |
| Returns the selection range of an audio segment relative to the segment's start position. | |
| const String & | getAudioSegmentName (int segmentIndex) const |
| Returns the name of an audio segment. | |
| bool | allSegmentsMuted () |
Private Attributes | |
| bool | m_updateDisplayTrigger {false} |
| volatile bool | m_advancedMode {false} |
| Point< float > | m_puckPosition {0.f, 0.f} |
| GranularPlaybackMode | m_oscillatorTypeIndicator {GranularPlaybackMode::MSampler} |
| MIDIMode | m_oscillatorMIDIMode {MIDIMode::All} |
| volatile bool | m_AnalysisRequested {false} |
| volatile bool | m_AnalysisInProgress {false} |
| int | m_currentPolyphony {0} |
| Grain | m_grainArray [MAX_NUM_GRAINS] |
| int | m_grainLimit {MAX_NUM_GRAINS} |
| volatile float | m_indicator1Value {0.f} |
| volatile float | m_indicator2Value {0.f} |
| volatile float | m_indicatorRPMValue {0.f} |
| Array< AudioSegment > | m_audioSegments |
| int | m_segmentRoundRobinIndex {0} |
| int | m_lastSegmentRoundRobinIndex {-1} |
| bool | m_allSegmentsMuted {false} |
| int | m_skippedSegmentIndex {-1} |
Additional Inherited Members | |
Public Types inherited from krotos::KrotosAudioBufferDSP | |
| enum class | SegmentationMethod { SegmentationNone = 0 , STFT = 32 , EnvOnset = 64 , OverlapWindow = 96 , SuperFlux = 128 , NUM_SEGMENTATIONS = 129 } |
| enum class | FeatureExtrMethod { FeatureExtrMethodNone = 0 , Harmonic_PitchEstimation = 1 , MFCC_PCA = 32 , Centroid_Level = 64 , SpCentroid_RMS = 96 , SpFlatness_RMS = 128 , ERBSpCentroid_RMS = 160 , ERBSpCentroid_ERBSpFlatness = 192 , NUM_FEATUREMETHODS = 193 } |
| enum class | AnalysisScheme { SchemeNone = 0 , Vehicle , GeneralScheme , NUM_SCHEMES } |
Public Types inherited from krotos::KrotosAudioBuffer | |
| enum | BufferType { Samples = 0 , Spectral } |
| enum | InterpolationType { Linear = 0 , Cubic , Cosine , Cubic3d , NUM_TYPES } |
Static Public Member Functions inherited from krotos::KrotosAudioBuffer | |
| static KrotosAudioBuffer | mixToMono (KrotosAudioBuffer &multiChannelBuffer) |
| void krotos::SampleEngine::addAudioSegment | ( | AudioSegment & | seg | ) |
| Grain * krotos::SampleEngine::allocateGrain | ( | ) |
|
private |
| void krotos::SampleEngine::calculatePolyphonyCount | ( | ) |
| void krotos::SampleEngine::clearAudioSegments | ( | ) |
| void krotos::SampleEngine::flushGrains | ( | ) |
| void krotos::SampleEngine::freeGrain | ( | Grain * | grain | ) |
|
private |
Returns the end position of an audio segment as a fraction of the audio buffer length.
| int krotos::SampleEngine::getAudioSegmentLengthInSamples | ( | int | segmentIndex | ) |
Returns the length of an audio segment.
|
private |
Returns the name of an audio segment.
| StringArray krotos::SampleEngine::getAudioSegmentNames | ( | ) | const |
Returns a StringArray of audio segment names loaded in the engine.
|
inline |
|
private |
Returns the start and end positions of an audio segment as a Range.
|
inline |
Returns the audio segment array loaded in the sample engine.(read-only)
|
inline |
| int krotos::SampleEngine::getAudioSegmentStartPosition | ( | int | segmentIndex | ) |
Returns the start of an audio segment.
|
private |
Returns the start position of an audio segment as a fraction of the audio buffer length.
|
private |
Returns the end position of an audio segment selection as a fraction of the audio buffer length.
| int krotos::SampleEngine::getAudioSelectionLengthInSamples | ( | int | segmentIndex | ) |
Returns the length of the selected section of an audio segment.
|
private |
Returns the start and end position of an audio segment selection as a Range.
|
private |
Returns the selection range of an audio segment relative to the segment's start position.
| int krotos::SampleEngine::getAudioSelectionStartPosition | ( | int | segmentIndex | ) |
Returns the start of the selected section of an audio segment.
|
private |
Returns the start position of an audio segment selection as a fraction of the audio buffer length.
|
inline |
Returns the index of the next segment to be played.
| String krotos::SampleEngine::getGetLoadedFilePathsAsCSV | ( | ) |
| Grain * krotos::SampleEngine::getGrainArray | ( | ) |
|
inline |
Fetch the MIDI receive mode
|
inline |
| float krotos::SampleEngine::getIndicator1 | ( | ) |
| float krotos::SampleEngine::getIndicator2 | ( | ) |
| float krotos::SampleEngine::getIndicatorRPM | ( | ) |
| const int krotos::SampleEngine::getLastSegmentIndex | ( | ) | const |
Returns the index of the previous segment that was played.
| String krotos::SampleEngine::getNextCuedSegmentName | ( | ) | const |
Returns the next cued segment name TODO: Update this to return actual cued segment. as right now it just returns the just played segment name, since the SampleEngine decides the robin index during playback.
| const int krotos::SampleEngine::getNextSegmentIndex | ( | ) | const |
Returns the index of the next segment to be played.
|
inline |
|
inline |
|
inline |
| std::vector< Range< int > > krotos::SampleEngine::getSelectionRanges | ( | ) |
Returns an array of segment selection ranges.
| Value & krotos::SampleEngine::getSoloValue | ( | int | index | ) |
Returns a reference to the 'solo' Value of an audio segment. You can use Value::referTo to have the segment share the same Value as that from external state / UI to keep it up to date. The solo Value is used to ensure a soloed segment cannot be unmuted. Setting this Value to true won't solo the segment, it's just a flag to prevent unmuting. To Solo a sample, you'll need to implement this from a UI controller.
| index |
|
inline |
| bool krotos::SampleEngine::isPlaying | ( | ) |
returns true if any grains are active
|
inline |
| void krotos::SampleEngine::prepareNextSegmentIndex | ( | bool | sequential = true | ) |
Calculate the next segment to be played back.
| void krotos::SampleEngine::removeSegment | ( | int | segmentIndex | ) |
Remove a segment from the sample engine.
| segmentIndex | The index of the segment to remove. |
|
inline |
|
private |
Sets the length an audio segment.
|
private |
Sets the start and end of an audio segment relative to the audio buffer start.
|
private |
Sets the start of an audio segment relative to the audio buffer start.
| void krotos::SampleEngine::setAudioSelectionLength | ( | int | segmentIndex, |
| int | length ) |
Sets the length of an audio segment selection.
|
private |
Sets the absolute selection range of an audio segment relative to the audio buffer start.
| void krotos::SampleEngine::setAudioSelectionRangeRelative | ( | int | segmentIndex, |
| Range< int > | range ) |
Sets the selection range of an audio segment relative to the segment.
| void krotos::SampleEngine::setAudioSelectionStartPositionAbsolute | ( | int | segmentIndex, |
| int | startPosition ) |
Sets the absolute start of an audio segment selection relative to the audio buffer start.
| void krotos::SampleEngine::setGrainLimit | ( | int | newLimit | ) |
|
inline |
Inform the Sample Engine of the required MIDI receive mode
| newMode | The mode you want to set |
|
inline |
| void krotos::SampleEngine::setIndicator1 | ( | float | newVal | ) |
| void krotos::SampleEngine::setIndicator2 | ( | float | newVal | ) |
| void krotos::SampleEngine::setIndicatorRPM | ( | float | newVal | ) |
| void krotos::SampleEngine::setNextSegmentIndex | ( | int | index | ) |
Sets the next segment index to be picked.
| index |
|
inline |
| void krotos::SampleEngine::setSegmentMuted | ( | int | segmentIndex, |
| bool | isMuted ) |
'Mutes' an audio segment in the sampler. In effect, this just means the sample is skipped in the round robin selection logic.
Note, it's not possible to mute all samples in the engine, the last remaining sample will remain unmuted.
| segmentIndex | The segment index of the sample to set the mute state |
| isMuted | Mute state to set the sample to |
| void krotos::SampleEngine::setSelectionRanges | ( | const std::vector< Range< int > > & | selectionRanges | ) |
Sets the selection ranges of the audio segments.
| selectionRanges | A vector of Range<int> objects representing the selection ranges |
|
inline |
returns true if the sample engine requires the grain display to be redrawn
|
inline |
send a trigger signal for the grain display to redraw
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
static |