Gin
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | List of all members
Synthesiser Class Reference

Advanced MPE-capable synthesizer with mono/poly modes, glide, and voice management. More...

#include <gin_synthesiser.h>

Inherits juce::MPESynthesiser.

Public Member Functions

 Synthesiser ()
 
void setMono (bool m)
 
void setNumVoices (int v)
 
void setLegato (bool l)
 
void setGlissando (bool g)
 
void setPortamento (bool p)
 
void setGlideRate (float r)
 
void turnOffAllVoices (bool allowTailOff) override
 
void setMPE (bool newMPE)
 
void handleMidiEvent (const juce::MidiMessage &message) override
 
void setPitchBendRange (int newPB)
 
void noteAdded (juce::MPENote newNote) override
 
void noteReleased (juce::MPENote finishedNote) override
 
void noteAddedMono (juce::MPENote newNote)
 
void noteReleasedMonoGlide (juce::MPENote finishedNote)
 
void noteReleasedMono (juce::MPENote finishedNote)
 
bool isNotePlaying (juce::MPENote &n)
 
int getNumActiveVoices ()
 
juce::Array< SynthesiserVoice * > getActiveVoices ()
 
int getCpuUsage ()
 
void startBlock ()
 
void endBlock (int blockSize)
 
void retriggerVoice (SynthesiserVoice *v, juce::MPENote note)
 
virtual void startVoice (juce::MPESynthesiserVoice *v, juce::MPENote note)
 
void updateGlide (juce::MPESynthesiserVoice *v)
 
void stopVoiceFastKill (juce::MPESynthesiserVoice *v, juce::MPENote note, bool tailOff)
 
juce::MPESynthesiserVoice * findVoiceToSteal (juce::MPENote noteToStealVoiceFor=juce::MPENote()) const override
 
template<typename floatType >
void renderNextBlock (juce::AudioBuffer< floatType > &outputAudio, const juce::MidiBuffer &inputMidi, int startSample, int numSamples)
 
SynthesiserVoicegetOldestVoice ()
 
SynthesiserVoicegetNewestVoice ()
 

Protected Attributes

int noteOnIndex = -1
 
int noteOffIndex = -1
 

Detailed Description

Advanced MPE-capable synthesizer with mono/poly modes, glide, and voice management.

Synthesiser extends JUCE's MPESynthesiser with professional features commonly needed in modern synthesizers:

Key Features:

Mono Mode: In monophonic mode, only one voice plays at a time. New notes either retrigger the envelope (non-legato) or smoothly transition pitch without retriggering (legato). Released notes in the note stack will cause the synth to jump back to the most recent held note.

Voice Stealing: When voice limit is reached, the oldest voice is stolen. The fast-kill mechanism allows immediate voice termination rather than waiting for release envelope, preventing audio glitches.

Glide Modes:

Usage:

synth.addVoice(new MyVoice());
synth.setSampleRate(44100.0);
// Configure mono mode with portamento
synth.setMono(true);
synth.setLegato(true);
synth.setPortamento(true);
synth.setGlideRate(250.0f); // 250ms glide
// Or poly mode
synth.setMono(false);
synth.setNumVoices(8); // Max 8 simultaneous voices
// MPE mode
synth.setMPE(true);
synth.setPitchBendRange(48); // ±48 semitones
synth.renderNextBlock(audioBuffer, midiBuffer, 0, numSamples);
A lightweight 2D point class for projects that don't use juce_graphics.
Definition gin_point.h:25
Advanced MPE-capable synthesizer with mono/poly modes, glide, and voice management.
Definition gin_synthesiser.h:145
See also
SynthesiserVoice, GlideInfo, juce::MPESynthesiser

Constructor & Destructor Documentation

◆ Synthesiser()

Synthesiser::Synthesiser ( )

Member Function Documentation

◆ setMono()

void Synthesiser::setMono ( bool  m)

◆ setNumVoices()

void Synthesiser::setNumVoices ( int  v)

◆ setLegato()

void Synthesiser::setLegato ( bool  l)

◆ setGlissando()

void Synthesiser::setGlissando ( bool  g)

◆ setPortamento()

void Synthesiser::setPortamento ( bool  p)

◆ setGlideRate()

void Synthesiser::setGlideRate ( float  r)

◆ turnOffAllVoices()

void Synthesiser::turnOffAllVoices ( bool  allowTailOff)
override

Referenced by handleMidiEvent().

◆ setMPE()

void Synthesiser::setMPE ( bool  newMPE)

◆ handleMidiEvent()

void Synthesiser::handleMidiEvent ( const juce::MidiMessage &  message)
override

References turnOffAllVoices().

◆ setPitchBendRange()

void Synthesiser::setPitchBendRange ( int  newPB)

◆ noteAdded()

void Synthesiser::noteAdded ( juce::MPENote  newNote)
override

◆ noteReleased()

void Synthesiser::noteReleased ( juce::MPENote  finishedNote)
override

◆ noteAddedMono()

void Synthesiser::noteAddedMono ( juce::MPENote  newNote)

References retriggerVoice(), and startVoice().

Referenced by noteAdded().

◆ noteReleasedMonoGlide()

void Synthesiser::noteReleasedMonoGlide ( juce::MPENote  finishedNote)

References retriggerVoice(), and startVoice().

Referenced by noteReleased().

◆ noteReleasedMono()

void Synthesiser::noteReleasedMono ( juce::MPENote  finishedNote)

References retriggerVoice(), and startVoice().

Referenced by noteReleased().

◆ isNotePlaying()

bool Synthesiser::isNotePlaying ( juce::MPENote &  n)

◆ getNumActiveVoices()

int Synthesiser::getNumActiveVoices ( )

Referenced by noteAdded().

◆ getActiveVoices()

juce::Array< SynthesiserVoice * > Synthesiser::getActiveVoices ( )

◆ getCpuUsage()

int Synthesiser::getCpuUsage ( )

◆ startBlock()

void Synthesiser::startBlock ( )

◆ endBlock()

void Synthesiser::endBlock ( int  blockSize)

◆ retriggerVoice()

void Synthesiser::retriggerVoice ( SynthesiserVoice v,
juce::MPENote  note 
)

◆ startVoice()

virtual void Synthesiser::startVoice ( juce::MPESynthesiserVoice *  v,
juce::MPENote  note 
)
virtual

◆ updateGlide()

void Synthesiser::updateGlide ( juce::MPESynthesiserVoice *  v)

Referenced by retriggerVoice(), and startVoice().

◆ stopVoiceFastKill()

void Synthesiser::stopVoiceFastKill ( juce::MPESynthesiserVoice *  v,
juce::MPENote  note,
bool  tailOff 
)

◆ findVoiceToSteal()

juce::MPESynthesiserVoice * Synthesiser::findVoiceToSteal ( juce::MPENote  noteToStealVoiceFor = juce::MPENote()) const
override

Referenced by noteAdded().

◆ renderNextBlock()

template<typename floatType >
void Synthesiser::renderNextBlock ( juce::AudioBuffer< floatType > &  outputAudio,
const juce::MidiBuffer &  inputMidi,
int  startSample,
int  numSamples 
)

◆ getOldestVoice()

SynthesiserVoice * Synthesiser::getOldestVoice ( )

◆ getNewestVoice()

SynthesiserVoice * Synthesiser::getNewestVoice ( )

Referenced by renderNextBlock().

Member Data Documentation

◆ noteOnIndex

int Synthesiser::noteOnIndex = -1
protected

Referenced by renderNextBlock().

◆ noteOffIndex

int Synthesiser::noteOffIndex = -1
protected

Referenced by renderNextBlock().


The documentation for this class was generated from the following file: