Public Member Functions | Protected Member Functions | List of all members
AudioSampleProcessor Class Referenceabstract

A Processor that uses an audio sample. More...

Inheritance diagram for AudioSampleProcessor:
PoolBase::Listener AudioFileEnvelope AudioLooper ConvolutionEffect

Public Member Functions

const AudioSampleBuffer * getBuffer ()
 Returns a const pointer to the audio sample buffer. More...
 
String getFileName () const
 Returns the filename that was loaded. More...
 
Range< int > getRange () const
 Returns the range of the sample. More...
 
virtual void newFileLoaded ()
 Overwrite this method and do whatever needs to be done when a new file is loaded. More...
 
virtual void rangeUpdated ()
 Overwrite this method and do whatever needs to be done when the selected range changes. More...
 
void restoreFromValueTree (const ValueTree &v)
 Call this method within your restoreFromValueTree() method to load the sample settings. More...
 
void saveToValueTree (ValueTree &v) const
 Call this method within your exportAsValueTree method to store the sample settings. More...
 
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. More...
 
void setRange (Range< int > newSampleRange)
 Sets the sample range that should be used in the plugin. More...
 
virtual ~AudioSampleProcessor ()
 Automatically releases the sample in the pool. More...
 
- Public Member Functions inherited from PoolBase::Listener
virtual void poolEntryAdded ()
 Called whenever a pool entry was added. More...
 
virtual void poolEntryChanged (PoolReference referenceThatWasChanged)
 If a pool entry gets changed, this will be called. More...
 
virtual void poolEntryRemoved ()
 Called when a pool entry was removed. More...
 

Protected Member Functions

 AudioSampleProcessor (Processor *p)
 Call this constructor within your subclass constructor. More...
 

Detailed Description

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:

  1. Create a AudioSampleBufferComponent and use the method getCache() in the constructor.
  2. Set the reference to the AudioSampleBuffer with AudioSampleBufferComponent::setAudioSampleBuffer();
  3. Add the AudioSampleBuffer as ChangeListener (and remove it in the destructor!)
  4. Add an AreaListener to the AudioSampleBufferComponent and call setRange() and setLoadedFile in the rangeChanged() callback

Constructor & Destructor Documentation

~AudioSampleProcessor ( )
virtual

Automatically releases the sample in the pool.

AudioSampleProcessor ( Processor p)
protected

Call this constructor within your subclass constructor.

Member Function Documentation

const AudioSampleBuffer* getBuffer ( )
inline

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.

String getFileName ( ) const
inline

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.

Range<int> getRange ( ) const
inline

Returns the range of the sample.

virtual void newFileLoaded ( )
inlinevirtual

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.

virtual void rangeUpdated ( )
inlinevirtual

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

void restoreFromValueTree ( const ValueTree &  v)

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

void saveToValueTree ( ValueTree &  v) const

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

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.

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.

©2017 HISE. This documentation is autogenerated from the HISE source code using Doxygen.