HISE Docs

AudioSampleProcessor

A Processor that uses an audio sample.
If you want to use a audio sample from the pool, subclass your Processor from this and you will get some nice tools:


In order to use this class with a AudioSampleBufferComponent, just follow these steps:


Class Hierarchy

Base Classes

Class methods

~AudioSampleProcessor

~AudioSampleProcessor()

Automatically releases the sample in the pool.

saveToValueTree

void saveToValueTree(ValueTree &v) const

Call this method within your exportAsValueTree method to store the sample settings.

restoreFromValueTree

void restoreFromValueTree(const ValueTree &v)

Call this method within your restoreFromValueTree() method to load the sample settings.

setLoadedFile

void setLoadedFile(const String &fileName, bool loadThisFile=false, bool forceReload=false)

This loads the file from disk (or from the pool, if existing and loadThisFile is false.

setRange

void setRange(Range< int > newSampleRange)

Sets the sample range that should be used in the plugin.
This is called automatically if a AudioSampleBufferComponent is set up correctly.

getRange

Range< int > getRange() const

Returns the range of the sample.

getBuffer

const AudioSampleBuffer * getBuffer()

Returns a const pointer to the audio sample buffer.
The pointer references a object from a AudioSamplePool and should be valid as long as the pool is not cleared.

getFileName

String getFileName() const

Returns the filename that was loaded.
It is possible that the file does not exist on your system: If you restore a pool completely from a ValueTree, it still uses the absolute filename as identification.

rangeUpdated

void rangeUpdated()

Overwrite this method and do whatever needs to be done when the selected range changes.

newFileLoaded

void newFileLoaded()

Overwrite this method and do whatever needs to be done when a new file is loaded.
You don't need to call setLoadedFile() , but if you got some internal stuff going on, this is the place.