LV2 Toolkit  1.2.0
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Voice Class Reference

#include <synth.hpp>

Collaboration diagram for Voice:
Collaboration graph
[legend]

Public Member Functions

void on (unsigned char key, unsigned char velocity)
 
void off (unsigned char velocity)
 
unsigned char get_key () const
 
void render (uint32_t from, uint32_t to)
 
void set_port_buffers (vector< void * > &ports)
 

Protected Member Functions

template<typename T >
T *& p (uint32_t port)
 
float *& p (uint32_t port)
 

Protected Attributes

vector< void * > * m_ports
 

Detailed Description

A base class for synth voices, to be used with the Synth template class. You don't have to make your voice classes inherit this one, but it makes some things easier.

Examples:
beep.cpp.

Member Function Documentation

unsigned char get_key ( ) const
inline

Return the MIDI key that the voice is currently playing. lvtk::INVALID_KEY means that the voice is not active and could be used to play a new note.

Examples:
beep.cpp.
void off ( unsigned char  velocity)
inline

Turn the voice off. This default implementation does nothing, you probably want to override it.

Parameters
velocityThe MIDI velocity for the Note Off event.
Examples:
beep.cpp.
void on ( unsigned char  key,
unsigned char  velocity 
)
inline

Turn the voice on. This default implementation does nothing, you probably want to override it.

If key is lvtk::INVALID_KEY the voice should go silent as fast at possible (the synth may use this when it receives an All Sound Off event).

Parameters
keyThe MIDI key for the note that the voice should play.
velocityThe MIDI velocity for the Note On event.
Examples:
beep.cpp.
T*& p ( uint32_t  port)
inlineprotected

Same as Plugin::p() - returns the buffer for the given port.

Examples:
beep.cpp.
float*& p ( uint32_t  port)
inlineprotected

Same as Plugin::p() - returns the buffer for the given port.

void render ( uint32_t  from,
uint32_t  to 
)
inline

Render audio for this voice to the output buffers, from sample from to sample to. The buffers may already contain audio from other voices, so use += instead of = when writing to it. This default implementation does nothing, you probably want to override it.

Examples:
beep.cpp.

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