All Classes Namespaces Functions Variables Enumerations Enumerator Modules Pages
Public Member Functions | List of all members
ModulatorSamplerSoundPool Class Reference
Inheritance diagram for ModulatorSamplerSoundPool:
SafeChangeBroadcaster

Public Member Functions

void setDebugProcessor (Processor *p)
 
ModulatorSamplerSoundaddSound (const ValueTree &soundDescription, int index, bool forceReuse=false)
 
void deleteSound (ModulatorSamplerSound *soundToDelete)
 
int getNumSoundsInPool () const noexcept
 
size_t getMemoryUsageForAllSamples () const noexcept
 
- Public Member Functions inherited from SafeChangeBroadcaster
void sendSynchronousChangeMessage ()
 
void addChangeListener (SafeChangeListener *listener)
 
void removeChangeListener (SafeChangeListener *listener)
 
void removeAllChangeListeners ()
 
void sendChangeMessage (const String &=String())
 
void sendAllocationFreeChangeMessage ()
 

Detailed Description

This object acts as global pool for all samples used in an instance of the plugin

It uses reference counting to decide if a sound is used. If a sound is added more than once, it will not load it again, but pass a reference to the already loaded Sound.

This is achieved by isolating the actual sample data into a StreamingSamplerSound object which will be wrapped by a ModulatorSamplerSound object.

Member Function Documentation

ModulatorSamplerSound * addSound ( const ValueTree &  soundDescription,
int  index,
bool  forceReuse = false 
)

looks in the global sample pool if the file is already loaded and returns a new ModulatorSamplerSound.

If a copy of a existing sound is found, the following Properties will be shared among all sound instances:

  • sample start / end
  • loop settings
  • sample start modulation

This is necessary because they affect the memory usage of the sound. All other properties (mapping properties and volume / pitch settings) will be unique.

void deleteSound ( ModulatorSamplerSound soundToDelete)

Decreases the reference count of the wrapped sound in the pool and deletes it if no references are left.

size_t getMemoryUsageForAllSamples ( ) const
noexcept

Returns the memory usage for all sounds in the pool.

This is not the exact amount of memory usage of the application, because every sampler has voices which have intermediate buffers, so the total memory footprint might be a few megabytes larger.

int getNumSoundsInPool ( ) const
noexcept

returns the number of sounds in the pool.

void setDebugProcessor ( Processor p)

call this with any processor to enable console output.

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