Public Types | Public Member Functions | Static Public Member Functions | List of all members
ModulatorSamplerSound Class Reference

A ModulatorSamplerSound is a wrapper around a StreamingSamplerSound that allows modulation of parameters. More...

Inheritance diagram for ModulatorSamplerSound:
ControlledObject

Public Types

enum  Property {
  ID = 1, FileName, RootNote, HiKey,
  LoKey, LoVel, HiVel, RRGroup,
  Volume , Normalized, Pitch, SampleStart,
  SampleEnd, SampleStartMod, LoopStart, LoopEnd,
  LoopXFade, LoopEnabled, LowerVelocityXFade, UpperVelocityXFade,
  SampleState
}
 The extended properties of the ModulatorSamplerSound. More...
 

Public Member Functions

void calculateNormalizedPeak ()
 Calculates the gain value that must be applied to normalize the volume of the sample ( 1.0 / peakValue ). More...
 
void closeFileHandle ()
 Opens the file handle for all samples of this sound. More...
 
void endPropertyChange (const Identifier &id, int startValue, int endValue)
 Call this whenever you finish a series of property modifications. More...
 
float getBalance (bool getRightChannelGain) const
 Returns the calculated (equal power) pan value for either the left or the right channel. More...
 
int getId () const
 Returns the id. More...
 
float getNormalizedPeak () const
 Returns the gain value that must be applied to normalize the volume of the sample ( 1.0 / peakValue ). More...
 
String getPropertyAsString (const Identifier &id) const
 Returns a string version of the Property. More...
 
double getPropertyPitch () const noexcept
 Returns the pitch value of the sound. More...
 
Range< int > getPropertyRange (const Identifier &p) const
 Returns the min and max values for the Property. More...
 
float getPropertyVolume () const noexcept
 Returns the gain value of the sound. More...
 
int getRootNote () const noexcept
 returns the root note. More...
 
double getSampleRate () const
 returns the sample rate of the sound (!= the sample rate of the current audio settings)
 
bool isNormalizedEnabled () const noexcept
 Checks if the normalization gain should be applied to the sample. More...
 
void openFileHandle ()
 Closes the file handle for all samples of this sound. More...
 
void setMappingData (MappingData newData)
 This sets the MIDI related properties without undo / range checks. More...
 
void startPropertyChange (const Identifier &id, int newValue)
 Call this whenever you want to start a new series of property modifications. More...
 
void toggleBoolProperty (const Identifier &id)
 Toggles the boolean properties. 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...
 

Static Public Member Functions

static bool isAsyncProperty (const Identifier &id)
 Returns the name of the Property. More...
 

Detailed Description

A ModulatorSamplerSound is a wrapper around a StreamingSamplerSound that allows modulation of parameters.

It also contains methods that extend the properties of a StreamingSamplerSound.

Member Enumeration Documentation

enum Property

The extended properties of the ModulatorSamplerSound.

Enumerator
ID 

a unique ID which corresponds to the number in the sound array

FileName 

the complete filename of the audio file

RootNote 

the root note

HiKey 

the highest mapped key

LoKey 

the lowest mapped key

LoVel 

the lowest mapped velocity

HiVel 

the highest mapped velocity

RRGroup 

the group index for round robin / random group start behaviour

Volume 

the gain in decibels. It is converted to a gain value internally

Normalized 

enables normalization of the sample data

Pitch 

the pitch factor in cents (+- 100). This is for fine tuning, for anything else, use RootNote.

SampleStart 

the start sample

SampleEnd 

the end sample,

SampleStartMod 

the amount of samples that the sample start can be modulated.

LoopStart 

the loop start in samples. This is independent from the sample start / end, but it checks the bounds.

LoopEnd 

the loop end in samples. This is independent from the sample start / end, but it checks the bounds.

LoopXFade 

the loop crossfade at the end of the loop (using a precalculated buffer)

LoopEnabled 

true if the sample should be looped

LowerVelocityXFade 

the length of the velocity crossfade (0 if there is no crossfade). If the crossfade starts at the bottom, it will have negative values.

UpperVelocityXFade 

the length of the velocity crossfade (0 if there is no crossfade). If the crossfade starts at the bottom, it will have negative values.

SampleState 

this property allows to set the state of samples between 'Normal', 'Disabled' and 'Purged'

Member Function Documentation

void calculateNormalizedPeak ( )

Calculates the gain value that must be applied to normalize the volume of the sample ( 1.0 / peakValue ).

It should save calculated value along with the other properties, but if a new sound is added, it will call StreamingSamplerSound::getPeakValue(), which scans the whole file.

void closeFileHandle ( )

Opens the file handle for all samples of this sound.

void endPropertyChange ( const Identifier &  id,
int  startValue,
int  endValue 
)

Call this whenever you finish a series of property modifications.

It will group all actions since startPropertyChange and saves it to the UndoManager list with a description "CHANGING PROPERTY FROM X TO Y"

float getBalance ( bool  getRightChannelGain) const

Returns the calculated (equal power) pan value for either the left or the right channel.

int getId ( ) const
inline

Returns the id.

Can also be achieved by getProperty(ID), but this is more convenient.

float getNormalizedPeak ( ) const

Returns the gain value that must be applied to normalize the volume of the sample ( 1.0 / peakValue ).

juce::String getPropertyAsString ( const Identifier &  id) const

Returns a string version of the Property.

This is used for displaying a nicer value than the raw data value (eg. note names, or milliseconds). Do not use the return value for further processing, use getProperty() instead.

double getPropertyPitch ( ) const
noexcept

Returns the pitch value of the sound.

Unlike getProperty(Pitch), it returns the pitch factor (from 0.5 to 2.0)

juce::Range< int > getPropertyRange ( const Identifier &  p) const

Returns the min and max values for the Property.

This method is non-static because you can change the range dynamically eg. depending on other properties.

It returns the following ranges:

  • MIDI Upper limits: Low limits - 127
  • MIDI Lower limits: 0 -> Upper Limit
  • RRGroups: 0 -> number of RR groups
  • Volume: -100dB -> +18dB
  • Pitch: -100ct -> +100ct
  • Sample Start: 0 -> sample end or loop start or sample end - sample start mod
  • Sample End: sample start + sampleStartMod -> file end
  • Sample Start Mod: 0 -> sample length
  • Loop enabled: 0 -> 1
  • Loop Start: (SampleStart + Crossfade) -> (LoopEnd - Crossfade)
  • Loop End: (LoopStart + Crossfade) -> SampleEnd
  • Loop Xfade: 0 -> (LoopStart - SampleStart) or LoopLength
float getPropertyVolume ( ) const
noexcept

Returns the gain value of the sound.

Unlike getProperty(Volume), it returns a value from 0.0 to 1.0, so use this for internal stuff

int getRootNote ( ) const
inlinenoexcept

returns the root note.

bool isAsyncProperty ( const Identifier &  id)
static

Returns the name of the Property.

This is used to display the name in the user interface and for the tag name within the XML samplemap, so you must return a valid tag name here. Returns true if the property should be changed asynchronously when all voices are killed.

bool isNormalizedEnabled ( ) const
inlinenoexcept

Checks if the normalization gain should be applied to the sample.

void openFileHandle ( )

Closes the file handle for all samples of this sound.

void setMappingData ( MappingData  newData)

This sets the MIDI related properties without undo / range checks.

void startPropertyChange ( const Identifier &  id,
int  newValue 
)

Call this whenever you want to start a new series of property modifications.

void toggleBoolProperty ( const Identifier &  id)

Toggles the boolean properties.

Currently supported Properties:

  • Normalized
  • LoopEnabled

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