Classes | Public Types | Public Member Functions | List of all members
ModulatorSampler Class Reference

The main sampler class. More...

Inheritance diagram for ModulatorSampler:
ModulatorSynth LookupTableProcessor Processor RoutableProcessor SafeChangeBroadcaster RestorableObject ControlledObject Dispatchable

Classes

class  ScopedUpdateDelayer
 If you add or delete multiple samples at once (but not the entire sample set), it will fire an UI update for each sample drastically slowing down the UI responsiveness. More...
 
class  SoundIterator
 A small helper tool that iterates over the sound array in a thread-safe way. More...
 

Public Types

enum  InternalChains { SampleStartModulation = ModulatorSynth::numInternalChains }
 Additional modulator chains. More...
 
enum  Parameters
 Special Parameters for the ModulatorSampler. More...
 
enum  RepeatMode { KillNote = 0, NoteOff, DoNothing }
 Different behaviour for retriggered notes. More...
 
- Public Types inherited from ModulatorSynth
enum  InternalChains
 These are the three Chains that the ModulatorSynth uses. More...
 
enum  Parameters { Gain = 0, Balance, VoiceLimit, KillFadeTime }
 
- Public Types inherited from Processor
enum  InternalChains
 Overwrite this enum and list all internal chains. More...
 
enum  SpecialParameters
 Overwrite this enum and add new parameters. More...
 

Public Member Functions

void deleteAllSounds ()
 Deletes all sounds. More...
 
void deleteSound (int index)
 Deletes the sound from the sampler. More...
 
double getDiskUsage ()
 Returns the time spent reading samples from disk. More...
 
 ModulatorSampler (MainController *mc, const String &id, int numVoices)
 Creates a new ModulatorSampler. More...
 
void noteOff (const HiseEvent &m) override
 Overwrites the base class method and ignores the note off event if Parameters::OneShot is enabled. More...
 
bool preloadAllSamples ()
 This function will be called on a background thread and preloads all samples. More...
 
void refreshMemoryUsage ()
 Scans all sounds and voices and adds their memory usage. More...
 
void refreshPreloadSizes ()
 Refreshes the preload sizes for all samples. More...
 
void refreshStreamingBuffers ()
 This resets the streaming buffer size of the voices. More...
 
bool setCurrentGroupIndex (int currentIndex)
 Sets the current index to the group. More...
 
void setCurrentPlayingPosition (double normalizedPosition)
 this sets the current playing position that will be displayed in the editor. More...
 
void setPreloadSizeAsync (int newPreloadSize)
 Sets the streaming buffer and preload buffer sizes asynchronously. More...
 
void setUseRoundRobinLogic (bool shouldUseRoundRobinLogic) noexcept
 Disables the automatic cycling and allows custom setting of the used round robin group. More...
 
void setVoiceAmount (int newVoiceAmount)
 Allows dynamically changing the voice amount. More...
 
- Public Member Functions inherited from ModulatorSynth
virtual void addProcessorsWhenEmpty ()
 Adds a SimpleEnvelope to a empty ModulatorSynth to prevent clicks. More...
 
virtual bool areVoicesActive () const
 Call this from the message thread and it'll kill all voices at the next buffer. More...
 
virtual int collectSoundsToBeStarted (const HiseEvent &m)
 This method should go through all sounds that are playable and fill the soundsToBeStarted array. More...
 
float getBalance (bool getRightChannelGain) const
 Returns the calculated (equal power) pan value for either the left or the right channel. More...
 
const float * getConstantPitchValues () const
 Returns the pointer to the calculated pitch buffers for the ModulatorSynthVoice's render callback. More...
 
ModulatorSynthVoicegetFreeVoice (SynthesiserSound *s, int midiChannel, int midiNoteNumber)
 Returns a read pointer to the calculated pitch values. More...
 
float getGain () const
 Returns the gain of the ModulatorSynth from 0.0 to 1.0. More...
 
ModulatorSynthGroupgetGroup () const
 Returns the ModulatorSynthGroup that this ModulatorSynth belongs to. More...
 
int getIndexInGroup () const
 Returns the index of the child synth if it resides in a group and -1 if not. More...
 
float * getPitchValuesForVoice () const
 Returns a read pointer to the calculated pitch values. More...
 
ModulatorSynthgetPlayingSynth ()
 Returns either itself or the group that is playing its voices. More...
 
int getVoiceIndex (const SynthesiserVoice *v) const
 Returns the voice index for the voice (the index in the internal voice array). More...
 
void handleHiseEvent (const HiseEvent &e)
 Same functionality as Synthesiser::handleMidiEvent(), but sends the midi event to all Modulators in the chains. More...
 
virtual void initRenderCallback ()
 Clears the internal buffer. More...
 
bool isInGroup () const
 Checks if the Synth was added to a group. More...
 
void killAllVoicesWithNoteNumber (int noteNumber)
 Kills the note with the specified note number. More...
 
int killLastVoice (bool allowTailOff=true)
 Kills the voice that is playing for the longest time. More...
 
void noteOn (const HiseEvent &m)
 Same functionality as Synthesiser::noteOn(), but calls calculateVoiceStartValue() if a new voice is started. More...
 
void postVoiceRendering (int startSample, int numThisTime)
 This method is called to handle all modulatorchains after the voice rendering and handles the GUI metering. More...
 
virtual void preVoiceRendering (int startSample, int numThisTime)
 This method is called to handle all modulatorchains just before the voice rendering. More...
 
void renderVoice (int startSample, int numThisTime)
 This method is called to actually render all voices. More...
 
void setBalance (float newBalance)
 sets the balance from -1.0 (left) to 1.0 (right) and applies a equal power pan rule. More...
 
void setClockSpeed (ClockSpeed newClockSpeed)
 Sets the interval for the internal clock callback. More...
 
void setGain (float newGain)
 sets the gain of the ModulatorSynth from 0.0 to 1.0. More...
 
void setGroup (ModulatorSynthGroup *parent)
 Sets the parent group. More...
 
- Public Member Functions inherited from Processor
void enableConsoleOutput (bool shouldBeEnabled)
 Enables the Processor to output messages to the Console. More...
 
bool getEditorState (int state) const
 Restores the state of the Processor's editor. More...
 
const String & getId () const
 Returns the unique id of the Processor instance (!= the Processor name). More...
 
virtual Identifier getIdentifierForParameterIndex (int parameterIndex) const
 This returns a Identifier with the name of the parameter. More...
 
float getInputValue () const
 This can be used to display the Processors input value. More...
 
int getLargestBlockSize () const
 Returns the block size. More...
 
virtual const String getName () const
 Overwrite this and return a pretty name. More...
 
int getNumParameters () const
 This returns the number of (named) parameters. More...
 
float getOutputValue () const
 This can be used to display the Processors output value. More...
 
double getSampleRate () const
 Returns the sample rate. More...
 
const Path getSymbol () const
 Returns the symbol of the Processor. More...
 
virtual const Identifier getType () const =0
 Overwrite this method to specify the name. More...
 
int getVoiceAmount () const noexcept
 getNumVoices() is occupied by the Synthesiser class, d'oh!
 
bool isBypassed () const noexcept
 Returns true if the processor is bypassed. More...
 
 Processor (MainController *m, const String &id_, int numVoices)
 Creates a new Processor with the given Identifier. More...
 
void restoreCompleteEditorState (const XmlElement *storedState)
 Restores the EditorState from a BigInteger that was retrieved using getCompleteEditorState. More...
 
void setAttribute (int parameterIndex, float newValue, juce::NotificationType notifyEditor)
 Changes a Processor parameter. More...
 
void setEditorState (int state, bool isOn, NotificationType notifyView=sendNotification)
 Saves the state of the Processor's editor. More...
 
void setIsOnAir (bool isBeingProcessedInAudioThread)
 Call this method after inserting the processor in the signal chain. More...
 
void setSymbol (Path newSymbol)
 Sets a special symbol for the Processor. More...
 
virtual ~Processor ()
 Overwrite this if you need custom destruction behaviour. More...
 
- Public Member Functions inherited from SafeChangeBroadcaster
void addChangeListener (SafeChangeListener *listener)
 Registers a listener to receive change callbacks from this broadcaster. More...
 
void removeAllChangeListeners ()
 Removes all listeners from the list. More...
 
void removeChangeListener (SafeChangeListener *listener)
 Unregisters a listener from the list. More...
 
void sendAllocationFreeChangeMessage ()
 This will send a message without allocating a message slot. More...
 
void sendChangeMessage (const String &=String())
 Causes an asynchronous change message to be sent to all the registered listeners. More...
 
void sendSynchronousChangeMessage ()
 Sends a synchronous change message to all the registered listeners. More...
 
- Public Member Functions inherited from ControlledObject
 ControlledObject (MainController *m)
 Creates a new ControlledObject. More...
 
const MainControllergetMainController () const noexcept
 Provides read-only access to the main controller. More...
 
MainControllergetMainController () noexcept
 Provides write access to the main controller. More...
 
- Public Member Functions inherited from RoutableProcessor
void editRouting (Component *childComponent)
 Opens a routing editor in the quasi modal popup. More...
 
int getLeftDestinationChannel () const
 Quick way to get the left target channel. More...
 
int getLeftSourceChannel () const
 Quick way to get the left channel for processing. More...
 
int getRightDestinationChannel () const
 Quick way to get the right target channel. More...
 
int getRightSourceChannel () const
 Quick way to get the right channel for processing. More...
 
- Public Member Functions inherited from LookupTableProcessor
void addTableChangeListener (SafeChangeListener *listener)
 Adds a listener to this processor. More...
 
virtual int getNumTables () const
 Overwrite this and return the number of tables that this processor uses. More...
 
void removeTableChangeListener (SafeChangeListener *listener)
 Removes a listener from this processor. More...
 
void sendTableIndexChangeMessage (bool sendSynchronous, Table *table, float tableIndex)
 Call this method whenever the table index is changed and all connected tables will receive a change message. More...
 

Additional Inherited Members

- Protected Member Functions inherited from Processor
virtual Path getSpecialSymbol () const
 Overwrite this method if you want to supply a custom symbol for the Processor. More...
 
void setInputValue (float newValue, NotificationType notify=sendNotification)
 Call this from the baseclass whenever you want its editor to display a input value change. More...
 
void setOutputValue (float newValue)
 Call this from the baseclass whenever you want its editor to display a value change. More...
 

Detailed Description

The main sampler class.

Features:

Member Enumeration Documentation

Additional modulator chains.

Enumerator
SampleStartModulation 

allows modification of the sample start if the sound allows this.

enum Parameters

Special Parameters for the ModulatorSampler.

enum RepeatMode

Different behaviour for retriggered notes.

Enumerator
KillNote 

kills the note (using the supplied fade time)

NoteOff 

triggers a note off event before starting the note

DoNothing 

do nothin (a new voice is started and the old keeps ringing).

Constructor & Destructor Documentation

ModulatorSampler ( MainController mc,
const String &  id,
int  numVoices 
)

Creates a new ModulatorSampler.

Member Function Documentation

void deleteAllSounds ( )

Deletes all sounds.

Call this instead of clearSounds().

void deleteSound ( int  index)

Deletes the sound from the sampler.

It removes the sound from the sampler and if no reference is left in the global sample pool deletes the sample and frees the storage.

double getDiskUsage ( )

Returns the time spent reading samples from disk.

void noteOff ( const HiseEvent m)
overridevirtual

Overwrites the base class method and ignores the note off event if Parameters::OneShot is enabled.

Reimplemented from ModulatorSynth.

bool preloadAllSamples ( )

This function will be called on a background thread and preloads all samples.

void refreshMemoryUsage ( )

Scans all sounds and voices and adds their memory usage.

void refreshPreloadSizes ( )

Refreshes the preload sizes for all samples.

This is the actual loading process, so it is put into a seperate thread with a progress window.

void refreshStreamingBuffers ( )

This resets the streaming buffer size of the voices.

Call this whenever you change the voice amount.

bool setCurrentGroupIndex ( int  currentIndex)

Sets the current index to the group.

void setCurrentPlayingPosition ( double  normalizedPosition)

this sets the current playing position that will be displayed in the editor.

void setPreloadSizeAsync ( int  newPreloadSize)

Sets the streaming buffer and preload buffer sizes asynchronously.

void setUseRoundRobinLogic ( bool  shouldUseRoundRobinLogic)
inlinenoexcept

Disables the automatic cycling and allows custom setting of the used round robin group.

void setVoiceAmount ( int  newVoiceAmount)

Allows dynamically changing the voice amount.

This is a ModulatorSampler specific function, because all other synths can have the full voice amount with almost no overhead, but since every ModulatorSamplerVoice has two streaming buffers, it could add up wasting unnecessary memory.

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