All Classes Namespaces Functions Variables Enumerations Enumerator Modules Pages
Public Member Functions | Protected Member Functions | List of all members
AudioSampleProcessor Class Referenceabstract
Inheritance diagram for AudioSampleProcessor:
SafeChangeListener ExternalFileProcessor AudioFileEnvelope ConvolutionEffect

Public Member Functions

virtual ~AudioSampleProcessor ()
void saveToValueTree (ValueTree &v) const
void restoreFromValueTree (const ValueTree &v)
AudioThumbnailCache & getCache ()
void setLoadedFile (const String &fileName, bool loadThisFile=false, bool forceReload=false)
void setRange (Range< int > newSampleRange)
Range< int > getRange () const
const AudioSampleBuffer * getBuffer ()
String getFileName () const
void changeListenerCallback (SafeChangeBroadcaster *b) override
virtual void rangeUpdated ()
virtual void newFileLoaded ()
- Public Member Functions inherited from ExternalFileProcessor
File getFile (const String &fileNameOrReference, PresetPlayerHandler::FolderType type=PresetPlayerHandler::GlobalSampleDirectory)
String getGlobalReferenceForFile (const String &file, PresetPlayerHandler::FolderType type=PresetPlayerHandler::GlobalSampleDirectory)

Protected Member Functions

 AudioSampleProcessor (Processor *p)

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 ( )

Automatically releases the sample in the pool.

AudioSampleProcessor ( Processor p)

Call this constructor within your subclass constructor.

Member Function Documentation

void changeListenerCallback ( SafeChangeBroadcaster b)

This callback sets the loaded file.

The AudioSampleBuffer should not change anything, but only send a message to the AudioSampleProcessor. This is where the actual reloading happens.

Implements SafeChangeListener.

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.

AudioThumbnailCache& getCache ( )

Returns the global thumbnail cache. Use this whenever you need a AudioSampleBufferComponent.

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.

Range<int> getRange ( ) const

Returns the range of the sample.

virtual 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.

virtual void rangeUpdated ( )

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.