iPlug2 - C++ Audio Plug-in Framework
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Public Attributes | Static Public Attributes | List of all members
VoiceAllocator Class Referencefinal

Public Types

enum  EATMode { kATModeChannel = 0 , kATModePoly , kNumATModes }
 
enum  EPolyMode { kPolyModePoly = 0 , kPolyModeMono , kNumPolyModes }
 
using VoiceControlRamps = ControlRampProcessor::ProcessorArray< kNumVoiceControlRamps >
 

Public Member Functions

 VoiceAllocator (const VoiceAllocator &)=delete
 
VoiceAllocatoroperator= (const VoiceAllocator &)=delete
 
void Clear ()
 
void SetSampleRateAndBlockSize (double sampleRate, int blockSize)
 
void SetNoteGlideTime (double t)
 
void SetControlGlideTime (double t)
 
void AddVoice (SynthVoice *pv, uint8_t zone)
 Add a synth voice to the allocator. More...
 
void AddEvent (VoiceInputEvent e)
 Add a single event to the input queue for the current processing block. More...
 
void ProcessEvents (int samples, int64_t sampleTime)
 Process all input events and generate voice outputs. More...
 
void SoftKillAllVoices ()
 Turn all voice gates off, allowing any voice envelopes to finish. More...
 
void HardKillAllVoices ()
 Stop all voices from making sound immdiately. More...
 
void SetKeyToPitchFunction (const std::function< float(int)> &fn)
 
void SendEventToVoices (VoiceInputEvent event)
 Send the event to the voices matching its address.
 
void ProcessVoices (sample **inputs, sample **outputs, int nInputs, int nOutputs, int startIndex, int blockSize)
 
size_t GetNVoices () const
 
SynthVoiceGetVoice (int voiceIndex) const
 
void SetPitchOffset (float offset)
 

Public Attributes

EPolyMode mPolyMode {kPolyModePoly}
 
EATMode mATMode {kATModeChannel}
 

Static Public Attributes

static constexpr int kVoiceMostRecent = 1 << 7
 

Detailed Description

Definition at line 81 of file VoiceAllocator.h.

Member Typedef Documentation

◆ VoiceControlRamps

using VoiceAllocator::VoiceControlRamps = ControlRampProcessor::ProcessorArray<kNumVoiceControlRamps>

Definition at line 102 of file VoiceAllocator.h.

Member Enumeration Documentation

◆ EATMode

enum VoiceAllocator::EATMode

Definition at line 85 of file VoiceAllocator.h.

◆ EPolyMode

enum VoiceAllocator::EPolyMode

Definition at line 92 of file VoiceAllocator.h.

Constructor & Destructor Documentation

◆ VoiceAllocator()

VoiceAllocator::VoiceAllocator ( )

Definition at line 26 of file VoiceAllocator.cpp.

◆ ~VoiceAllocator()

VoiceAllocator::~VoiceAllocator ( )

Definition at line 35 of file VoiceAllocator.cpp.

Member Function Documentation

◆ AddEvent()

void VoiceAllocator::AddEvent ( VoiceInputEvent  e)
inline

Add a single event to the input queue for the current processing block.

Definition at line 122 of file VoiceAllocator.h.

References IPlugQueue< T >::Push().

Referenced by MidiSynth::ProcessBlock().

◆ AddVoice()

void VoiceAllocator::AddVoice ( SynthVoice pv,
uint8_t  zone 
)

Add a synth voice to the allocator.

We do not take ownership ot the voice.

Parameters
pvPointer to the voice to add.
zoneA zone can be specified to make multitimbral synths.

Definition at line 54 of file VoiceAllocator.cpp.

Referenced by MidiSynth::AddVoice().

◆ Clear()

void VoiceAllocator::Clear ( )

Definition at line 39 of file VoiceAllocator.cpp.

◆ GetNVoices()

size_t VoiceAllocator::GetNVoices ( ) const
inline

Definition at line 140 of file VoiceAllocator.h.

◆ GetVoice()

SynthVoice * VoiceAllocator::GetVoice ( int  voiceIndex) const
inline

Definition at line 141 of file VoiceAllocator.h.

◆ HardKillAllVoices()

void VoiceAllocator::HardKillAllVoices ( )

Stop all voices from making sound immdiately.

Definition at line 392 of file VoiceAllocator.cpp.

References SoftKillAllVoices().

◆ ProcessEvents()

void VoiceAllocator::ProcessEvents ( int  samples,
int64_t  sampleTime 
)

Process all input events and generate voice outputs.

Definition at line 192 of file VoiceAllocator.cpp.

References IPlugQueue< T >::ElementsAvailable(), IPlugQueue< T >::Pop(), and SoftKillAllVoices().

Referenced by MidiSynth::ProcessBlock().

◆ ProcessVoices()

void VoiceAllocator::ProcessVoices ( sample **  inputs,
sample **  outputs,
int  nInputs,
int  nOutputs,
int  startIndex,
int  blockSize 
)

Definition at line 530 of file VoiceAllocator.cpp.

◆ SetControlGlideTime()

void VoiceAllocator::SetControlGlideTime ( double  t)
inline

Definition at line 114 of file VoiceAllocator.h.

◆ SetKeyToPitchFunction()

void VoiceAllocator::SetKeyToPitchFunction ( const std::function< float(int)> &  fn)
inline

Definition at line 133 of file VoiceAllocator.h.

◆ SetNoteGlideTime()

void VoiceAllocator::SetNoteGlideTime ( double  t)
inline

Definition at line 113 of file VoiceAllocator.h.

◆ SetPitchOffset()

void VoiceAllocator::SetPitchOffset ( float  offset)
inline

Definition at line 142 of file VoiceAllocator.h.

◆ SetSampleRateAndBlockSize()

void VoiceAllocator::SetSampleRateAndBlockSize ( double  sampleRate,
int  blockSize 
)
inline

Definition at line 112 of file VoiceAllocator.h.

◆ SoftKillAllVoices()

void VoiceAllocator::SoftKillAllVoices ( )

Turn all voice gates off, allowing any voice envelopes to finish.

Definition at line 379 of file VoiceAllocator.cpp.

Referenced by HardKillAllVoices(), and ProcessEvents().

Member Data Documentation

◆ kVoiceMostRecent

constexpr int VoiceAllocator::kVoiceMostRecent = 1 << 7
staticconstexpr

Definition at line 99 of file VoiceAllocator.h.

◆ mATMode

EATMode VoiceAllocator::mATMode {kATModeChannel}

Definition at line 192 of file VoiceAllocator.h.

◆ mPolyMode

EPolyMode VoiceAllocator::mPolyMode {kPolyModePoly}

Definition at line 191 of file VoiceAllocator.h.


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