Public Member Functions | List of all members
ScriptingApi::Synth Class Reference

Provides access to the synth where the script processor resides. More...

Inheritance diagram for ScriptingApi::Synth:
ScriptingObject ApiClass

Public Member Functions

void addController (int channel, int number, int value, int timeStampSamples)
 Adds a controller to the buffer. More...
 
ScriptEffect * addEffect (const String &type, const String &id, int index)
 Adds a effect (index = -1 to append it at the end). More...
 
int addMessageFromHolder (var messageHolder)
 Adds the event from the given holder and returns a event id for note ons. More...
 
ScriptModulatoraddModulator (int chainId, const String &type, const String &id)
 Adds a Modulator to the synth's chain. More...
 
void addNoteOff (int channel, int noteNumber, int timeStampSamples)
 Adds a note off to the buffer. More...
 
int addNoteOn (int channel, int noteNumber, int velocity, int timeStampSamples)
 Adds a note on to the buffer. More...
 
void addPitchFade (int eventId, int fadeTimeMilliseconds, int targetCoarsePitch, int targetFinePitch)
 Adds a pitch fade to the given event ID. More...
 
void addToFront (bool addToFront)
 Adds the interface to the Container's body (or the frontend interface if compiled)
 
void addVolumeFade (int eventId, int fadeTimeMilliseconds, int targetVolume)
 Fades all voices with the given event id to the target volume (in decibels). More...
 
void deferCallbacks (bool makeAsynchronous)
 Defers all callbacks to the message thread (midi callbacks become read-only). More...
 
var getAllModulators (String regex)
 Returns an array of all modulators that match the given regex. More...
 
float getAttribute (int attributeIndex) const
 Returns the attribute of the parent synth. More...
 
ScriptAudioSampleProcessor * getAudioSampleProcessor (const String &name)
 Returns the child synth with the supplied name. More...
 
ScriptSynth * getChildSynth (const String &name)
 Returns the child synth with the supplied name. More...
 
ScriptSynth * getChildSynthByIndex (int index)
 Returns the child synth with the given index. More...
 
ScriptEffect * getEffect (const String &name)
 Returns the Effect with the supplied name. More...
 
var getIdList (const String &type)
 Searches the child processors and returns a list with every ID of the given type. More...
 
ScriptMidiProcessor * getMidiProcessor (const String &name)
 Returns the MidiProcessor with the supplied name. More...
 
ScriptModulatorgetModulator (const String &name)
 Returns the Modulator with the supplied name. More...
 
int getModulatorIndex (int chainId, const String &id) const
 Returns the index of the Modulator in the chain with the supplied chainId.
 
int getNumChildSynths () const
 Returns the number of child synths. More...
 
int getNumPressedKeys () const
 Returns the number of pressed keys (!= the number of playing voices!). More...
 
SamplergetSampler (const String &name)
 Returns the first sampler with the name name. More...
 
ScriptSlotFX * getSlotFX (const String &name)
 Returns the first slot with the given name. More...
 
ScriptTableProcessor * getTableProcessor (const String &name)
 Returns the table processor with the given name. More...
 
double getTimerInterval () const
 Returns the current timer interval in seconds. More...
 
bool isKeyDown (int noteNumber)
 Checks if the given key is pressed. More...
 
bool isLegatoInterval () const
 Checks if any key is pressed. More...
 
bool isSustainPedalDown () const
 Returns true if the sustain pedal is pressed. More...
 
bool isTimerRunning () const
 Checks if the timer for this script is running. More...
 
void noteOff (int noteNumber)
 Sends a note off message. More...
 
void noteOffByEventId (int eventId)
 Sends a note off message for the supplied event ID. More...
 
void noteOffDelayedByEventId (int eventId, int timestamp)
 Sends a note off message for the supplied event ID with the given delay in samples. More...
 
int playNote (int noteNumber, int velocity)
 Plays a note and returns the event id. More...
 
int playNoteWithStartOffset (int channel, int number, int velocity, int offset)
 Plays a note and returns the event id with the given channel and start offset. More...
 
bool removeEffect (var effect)
 Removes the given effect. More...
 
bool removeModulator (var mod)
 Removes the modulator. More...
 
void sendController (int controllerNumber, int controllerValue)
 Sends a controller event to the synth. More...
 
void sendControllerToChildSynths (int controllerNumber, int controllerValue)
 The same as sendController (for backwards compatibility)
 
void setAttribute (int attributeIndex, float newAttribute)
 Sets an attribute of the parent synth. More...
 
void setClockSpeed (int clockSpeed)
 Sets the internal clock speed. More...
 
void setMacroControl (int macroIndex, float newValue)
 Sets one of the eight macro controllers to the newValue. More...
 
void setModulatorAttribute (int chainId, int modulatorIndex, int attributeIndex, float newValue)
 Sets a ModulatorAttribute. More...
 
void setShouldKillRetriggeredNote (bool killNote)
 If set to true, this will kill retriggered notes (default). More...
 
void setVoiceGainValue (int voiceIndex, float gainValue)
 Applies a gain factor to a specified voice. More...
 
void setVoicePitchValue (int voiceIndex, double pitchValue)
 Applies a pitch factor (0.5 ... More...
 
void startTimer (double seconds)
 Starts the timer of the synth. More...
 
void stopTimer ()
 Stops the timer of the synth. More...
 
- Public Member Functions inherited from ApiClass
void addConstant (String constantName, var value)
 Adds a constant. More...
 
void addFunction (const Identifier &id, call0 newFunction)
 Adds a function with no parameters. More...
 
void addFunction1 (const Identifier &id, call1 newFunction)
 Adds a function with one parameter. More...
 
void addFunction2 (const Identifier &id, call2 newFunction)
 Adds a function with two parameters. More...
 
void addFunction3 (const Identifier &id, call3 newFunction)
 Adds a function with three parameters. More...
 
void addFunction4 (const Identifier &id, call4 newFunction)
 Adds a function with four parameters. More...
 
void addFunction5 (const Identifier &id, call5 newFunction)
 Adds a function with five parameters. More...
 
virtual bool allowIllegalCallsOnAudioThread (int) const
 You can overwrite this method and return true if you want to allow illegal calls that would otherwise fire a warning. More...
 
 ApiClass (int numConstants_)
 Creates a Api class with the given amount of constants. More...
 
var callFunction (int index, var *args, int numArgs)
 Calls the function with the index and the argument data. More...
 
void getAllConstants (Array< Identifier > &ids) const
 Returns all constant names as alphabetically sorted array. More...
 
void getAllFunctionNames (Array< Identifier > &ids) const
 This returns all function names alphabetically sorted. More...
 
int getConstantIndex (const Identifier &id) const
 Return the index for the given name. More...
 
Identifier getConstantName (int index) const
 Returns the name for the constant as it is used in the scripting context. More...
 
const var getConstantValue (int index) const
 Returns the constant at the given index. More...
 
void getIndexAndNumArgsForFunction (const Identifier &id, int &index, int &numArgs) const
 This will fill in the information for the given function. More...
 

Detailed Description

Provides access to the synth where the script processor resides.

There are special methods for SynthGroups which only work with SynthGroups

Member Function Documentation

void addController ( int  channel,
int  number,
int  value,
int  timeStampSamples 
)

Adds a controller to the buffer.

ScriptingApi::Synth::ScriptEffect * addEffect ( const String &  type,
const String &  id,
int  index 
)

Adds a effect (index = -1 to append it at the end).

int addMessageFromHolder ( var  messageHolder)

Adds the event from the given holder and returns a event id for note ons.

ScriptingObjects::ScriptingModulator * addModulator ( int  chainId,
const String &  type,
const String &  id 
)

Adds a Modulator to the synth's chain.

If it already exists, it returns the index.

void addNoteOff ( int  channel,
int  noteNumber,
int  timeStampSamples 
)

Adds a note off to the buffer.

int addNoteOn ( int  channel,
int  noteNumber,
int  velocity,
int  timeStampSamples 
)

Adds a note on to the buffer.

void addPitchFade ( int  eventId,
int  fadeTimeMilliseconds,
int  targetCoarsePitch,
int  targetFinePitch 
)

Adds a pitch fade to the given event ID.

void addVolumeFade ( int  eventId,
int  fadeTimeMilliseconds,
int  targetVolume 
)

Fades all voices with the given event id to the target volume (in decibels).

void deferCallbacks ( bool  makeAsynchronous)

Defers all callbacks to the message thread (midi callbacks become read-only).

var getAllModulators ( String  regex)

Returns an array of all modulators that match the given regex.

float getAttribute ( int  attributeIndex) const

Returns the attribute of the parent synth.

ScriptingObjects::ScriptingAudioSampleProcessor * getAudioSampleProcessor ( const String &  name)

Returns the child synth with the supplied name.

ScriptingObjects::ScriptingSynth * getChildSynth ( const String &  name)

Returns the child synth with the supplied name.

ScriptingApi::Synth::ScriptSynth * getChildSynthByIndex ( int  index)

Returns the child synth with the given index.

ScriptingObjects::ScriptingEffect * getEffect ( const String &  name)

Returns the Effect with the supplied name.

Can only be called in onInit(). It looks also in all child processors.

var getIdList ( const String &  type)

Searches the child processors and returns a list with every ID of the given type.

ScriptingObjects::ScriptingMidiProcessor * getMidiProcessor ( const String &  name)

Returns the MidiProcessor with the supplied name.

Can not be the own name!

ScriptingObjects::ScriptingModulator * getModulator ( const String &  name)

Returns the Modulator with the supplied name.

Can be only called in onInit. It looks also in all child processors.

int getNumChildSynths ( ) const

Returns the number of child synths.

Works with SynthGroups and SynthChains.

int getNumPressedKeys ( ) const
inline

Returns the number of pressed keys (!= the number of playing voices!).

ScriptingApi::Sampler * getSampler ( const String &  name)

Returns the first sampler with the name name.

ScriptingApi::Synth::ScriptSlotFX * getSlotFX ( const String &  name)

Returns the first slot with the given name.

ScriptingObjects::ScriptingTableProcessor * getTableProcessor ( const String &  name)

Returns the table processor with the given name.

double getTimerInterval ( ) const

Returns the current timer interval in seconds.

bool isKeyDown ( int  noteNumber)
inline

Checks if the given key is pressed.

bool isLegatoInterval ( ) const
inline

Checks if any key is pressed.

bool isSustainPedalDown ( ) const
inline

Returns true if the sustain pedal is pressed.

bool isTimerRunning ( ) const

Checks if the timer for this script is running.

void noteOff ( int  noteNumber)

Sends a note off message.

The envelopes will tail off.

void noteOffByEventId ( int  eventId)

Sends a note off message for the supplied event ID.

This is more stable than the deprecated noteOff() method.

void noteOffDelayedByEventId ( int  eventId,
int  timestamp 
)

Sends a note off message for the supplied event ID with the given delay in samples.

int playNote ( int  noteNumber,
int  velocity 
)

Plays a note and returns the event id.

Be careful or you get stuck notes!

int playNoteWithStartOffset ( int  channel,
int  number,
int  velocity,
int  offset 
)

Plays a note and returns the event id with the given channel and start offset.

bool removeEffect ( var  effect)

Removes the given effect.

bool removeModulator ( var  mod)

Removes the modulator.

void sendController ( int  controllerNumber,
int  controllerValue 
)

Sends a controller event to the synth.

void setAttribute ( int  attributeIndex,
float  newAttribute 
)

Sets an attribute of the parent synth.

void setClockSpeed ( int  clockSpeed)

Sets the internal clock speed.

void setMacroControl ( int  macroIndex,
float  newValue 
)

Sets one of the eight macro controllers to the newValue.

Parameters
macroIndexthe index of the macro from 1 - 8
newValueThe range for the newValue is 0.0 - 127.0.
void setModulatorAttribute ( int  chainId,
int  modulatorIndex,
int  attributeIndex,
float  newValue 
)

Sets a ModulatorAttribute.

Parameters
chainIdthe chain where the Modulator is. GainModulation = 1, PitchModulation = 0
modulatorIndexthe index of the Modulator starting with 0.
attributeIndexthe index of the Modulator starting with 0. Intensity is '-12', Bypassed is '-13'
newValuethe value. The range for Gain is 0.0 - 1.0, the Range for Pitch is -12.0 ... 12.0
void setShouldKillRetriggeredNote ( bool  killNote)

If set to true, this will kill retriggered notes (default).

void setVoiceGainValue ( int  voiceIndex,
float  gainValue 
)

Applies a gain factor to a specified voice.

void setVoicePitchValue ( int  voiceIndex,
double  pitchValue 
)

Applies a pitch factor (0.5 ...

2.0) to a specified voice.

void startTimer ( double  seconds)

Starts the timer of the synth.

void stopTimer ( )

Stops the timer of the synth.

You can call this also in the timer callback.

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