LMMS
Loading...
Searching...
No Matches
calf_plugins::monosynth_audio_module Class Reference

#include <modules_synths.h>

Inheritance diagram for calf_plugins::monosynth_audio_module:
calf_plugins::audio_module< monosynth_metadata > calf_plugins::line_graph_iface calf_plugins::mod_matrix_impl calf_plugins::monosynth_metadata calf_plugins::audio_module_iface calf_plugins::plugin_metadata< monosynth_metadata > calf_plugins::plugin_metadata_iface

Public Member Functions

 monosynth_audio_module ()
void set_sample_rate (uint32_t sr)
 Set sample rate for the plugin.
void delayed_note_on ()
void end_note ()
 Release a note (physically), called from note-off handler or when note-off has been scheduled after note-on (very short queued note).
void note_on (int channel, int note, int vel)
void note_off (int channel, int note, int vel)
 Handle MIDI Note Off message.
void channel_pressure (int channel, int value)
 Handle MIDI Channel Pressure.
void pitch_bend (int, int value)
 Handle pitch bend message.
void set_frequency ()
 Update oscillator frequency based on base frequency, detune amount, pitch bend scaling factor and sample rate.
void control_change (int channel, int controller, int value)
 Handle control change messages.
void params_changed ()
 Update variables from control ports.
void activate ()
 LADSPA-esque activate function, except it is called after ports are connected, not before.
void deactivate ()
 LADSPA-esque deactivate function.
void post_instantiate (uint32_t)
 Called after instantiating (after all the feature pointers are set - including interfaces like progress_report_iface).
void lookup_waveforms ()
 Set waveform addresses for oscillators.
void calculate_buffer_oscs (float lfo)
 Run oscillators.
void calculate_buffer_ser ()
 Run two filters in series to produce mono output samples.
void calculate_buffer_single ()
 Run one filter to produce mono output samples.
void calculate_buffer_stereo ()
 Run two filters (one per channel) to produce stereo output samples.
bool get_graph (int index, int subindex, int phase, float *data, int points, cairo_iface *context, int *mode) const
 Retrieve filter graph (which is 'live' so it cannot be generated by get_static_graph), or fall back to get_static_graph.
bool get_layers (int index, int generation, unsigned int &layers) const
bool is_cv (int param_no) const
bool is_noisy (int param_no) const
 Practically all the stuff here is noisy.
uint32_t process (uint32_t offset, uint32_t nsamples, uint32_t inputs_mask, uint32_t outputs_mask)
 Main processing function.
virtual void send_configures (send_configure_iface *sci)
 Send all configure variables set within a plugin to given destination (which may be limited to only those that plugin understands).
virtual char * configure (const char *key, const char *value)
 DSSI configure call.
Public Member Functions inherited from calf_plugins::audio_module< monosynth_metadata >
 audio_module ()
void program_change (int channel, int program)
 Handle MIDI Program Change.
void execute (int cmd_no)
 Execute menu command with given number.
int send_status_updates (send_updates_iface *sui, int last_serial)
 Send all supported status vars (none by default).
void params_reset ()
 Reset parameter values for epp:trigger type parameters (ones activated by oneshot push button instead of check box).
uint32_t message_run (const void *valid_ports, void *output_ports)
virtual void get_port_arrays (float **&ins_ptrs, float **&outs_ptrs, float **&params_ptrs)
 Return the array of input port pointers.
virtual const plugin_metadata_ifaceget_metadata_iface () const
 Return metadata object.
virtual void set_progress_report_iface (progress_report_iface *iface)
 Set the progress report interface to communicate progress to.
void zero_by_mask (uint32_t mask, uint32_t offset, uint32_t nsamples)
 utility function: zero port values if mask is 0
uint32_t process_slice (uint32_t offset, uint32_t end)
 utility function: call process, and if it returned zeros in output masks, zero out the relevant output port buffers
virtual const line_graph_ifaceget_line_graph_iface () const
virtual const phase_graph_ifaceget_phase_graph_iface () const
Public Member Functions inherited from calf_plugins::audio_module_iface
virtual ~audio_module_iface ()
Public Member Functions inherited from calf_plugins::line_graph_iface
virtual bool get_moving (int index, int subindex, int &direction, float *data, int x, int y, int &offset, uint32_t &color) const
virtual bool get_dot (int index, int subindex, int phase, float &x, float &y, int &size, cairo_iface *context) const
virtual bool get_gridline (int index, int subindex, int phase, float &pos, bool &vertical, std::string &legend, cairo_iface *context) const
virtual std::string get_crosshair_label (int x, int y, int sx, int sy, float q, int dB, int name, int note, int cents) const
virtual ~line_graph_iface ()
 Standard destructor to make compiler happy.
Public Member Functions inherited from calf_plugins::mod_matrix_impl
 mod_matrix_impl (dsp::modulation_entry *_matrix, calf_plugins::mod_matrix_metadata *_metadata)
void calculate_modmatrix (float *moddest, int moddest_count, float *modsrc)
 Process modulation matrix, calculate outputs from inputs.
void send_configures (send_configure_iface *)
char * configure (const char *key, const char *value)
virtual const dsp::modulation_entryget_default_mod_matrix_value (int row) const

Public Attributes

uint32_t srate
uint32_t crate
dsp::waveform_oscillator< MONOSYNTH_WAVE_BITSosc1
dsp::waveform_oscillator< MONOSYNTH_WAVE_BITSosc2
dsp::waveform_oscillator< MONOSYNTH_WAVE_BITSdetosc
dsp::triangle_lfo lfo1
dsp::triangle_lfo lfo2
dsp::simple_oscillator unison_osc
dsp::biquad_d1_lerp filter
dsp::biquad_d1_lerp filter2
bool running
 The step code is producing non-zero values.
bool stopping
 This is the last non-zero buffer (set on calculate_step after fadeout is complete, the next calculate_step will zero running).
bool gate
 A key is kept pressed.
bool force_fadeout
 All notes off fadeout.
int last_key
 Last triggered note.
float buffer [step_size]
 Output buffers, used to ensure updates are done every step_size regardless of process buffer size.
float buffer2 [step_size]
uint32_t output_pos
 Read position within the buffers, on each '0' the buffers are being filled with new data by calculate_step.
int wave1
 Waveform number - OSC1.
int wave2
 Waveform number - OSC2.
int prev_wave1
 Last used waveform number - OSC1.
int prev_wave2
 Last used waveform number - OSC2.
int filter_type
 Filter type.
int last_filter_type
 Filter type on the last calculate_step.
float freq
float start_freq
float target_freq
float cutoff
float fgain
float fgain_delta
float separation
float detune
float xpose1
float xpose2
float xfade
float ampctl
float fltctl
float odcr
float porta_time
float lfo_bend
float modwheel_value
 Modulation wheel position (0.f-1.f).
float lfo_clock
 Delay counter for LFOs.
int32_t last_pwshift1
 Last value of phase shift for pulse width emulation for OSC1.
int32_t last_pwshift2
 Last value of phase shift for pulse width emulation for OSC2.
int32_t last_stretch1
 Last value of stretch for osc sync emulation for OSC1.
int queue_note_on
 Next note to play on the next calculate_step.
bool queue_note_on_and_off
 Whether the queued note has been already released.
float queue_vel
 Velocity of the next note to play.
int modwheel_value_int
 Integer value for modwheel (0-16383, read from CC1 - MSBs and CC33 - LSBs).
int legato
 Legato mode (bitmask).
dsp::adsr envelope1
 Envelope Generators.
dsp::adsr envelope2
dsp::keystack stack
dsp::gain_smoothing master
 Smoothing for master volume.
dsp::fadeout fadeout
 Fadeout for buffer 1.
dsp::fadeout fadeout2
 Fadeout for buffer 2.
dsp::inertia< dsp::exponential_rampinertia_cutoff
 Smoothed cutoff value.
dsp::inertia< dsp::exponential_rampinertia_pitchbend
 Smoothed pitch bend value.
dsp::inertia< dsp::linear_rampinertia_pressure
 Smoothed channel pressure value.
dsp::modulation_entry mod_matrix_data [mod_matrix_slots]
 Rows of the modulation matrix.
float velocity
 Currently used velocity.
float last_xfade
 Last value of oscillator mix ratio.
float last_unison
 Last value of unison amount.
float moddest [moddest_count]
 Current calculated mod matrix outputs.
Public Attributes inherited from calf_plugins::audio_module< monosynth_metadata >
float * ins [(monosynth_metadata::in_count !=0) ? monosynth_metadata::in_count :1]
float * outs [(monosynth_metadata::out_count !=0) ? monosynth_metadata::out_count :1]
float * params [monosynth_metadata::param_count]
bool questionable_data_reported_in
bool questionable_data_reported_out
progress_report_ifaceprogress_report

Static Public Attributes

static dsp::waveform_family< MONOSYNTH_WAVE_BITS > * waves

Private Member Functions

void reset ()
float get_lfo (dsp::triangle_lfo &lfo, int param)
void apply_fadeout ()
 Apply anti-click'n'pop fadeout (used at the end of the sound).
void calculate_step ()
 Calculate control signals and produce step_size samples of output.
bool is_stereo_filter () const

Static Private Member Functions

static void precalculate_waves (progress_report_iface *reporter)

Additional Inherited Members

Public Types inherited from calf_plugins::audio_module< monosynth_metadata >
typedef monosynth_metadata metadata_type
Protected Attributes inherited from calf_plugins::mod_matrix_impl
dsp::modulation_entrymatrix
mod_matrix_metadatametadata
unsigned int matrix_rows
Static Protected Attributes inherited from calf_plugins::mod_matrix_impl
static const float scaling_coeffs [calf_plugins::mod_matrix_metadata::map_type_count][3]
 Polynomials for different scaling modes (1, x, x^2).

Detailed Description

Monosynth-in-making. Parameters may change at any point, so don't make songs with it! It lacks inertia for parameters, even for those that really need it.

Constructor & Destructor Documentation

◆ monosynth_audio_module()

monosynth_audio_module::monosynth_audio_module ( )

Member Function Documentation

◆ activate()

void monosynth_audio_module::activate ( )
virtual

LADSPA-esque activate function, except it is called after ports are connected, not before.

Reimplemented from calf_plugins::audio_module< monosynth_metadata >.

◆ apply_fadeout()

void monosynth_audio_module::apply_fadeout ( )
private

Apply anti-click'n'pop fadeout (used at the end of the sound).

◆ calculate_buffer_oscs()

void monosynth_audio_module::calculate_buffer_oscs ( float lfo)

Run oscillators.

◆ calculate_buffer_ser()

void monosynth_audio_module::calculate_buffer_ser ( )

Run two filters in series to produce mono output samples.

◆ calculate_buffer_single()

void monosynth_audio_module::calculate_buffer_single ( )

Run one filter to produce mono output samples.

◆ calculate_buffer_stereo()

void monosynth_audio_module::calculate_buffer_stereo ( )

Run two filters (one per channel) to produce stereo output samples.

◆ calculate_step()

void monosynth_audio_module::calculate_step ( )
private

Calculate control signals and produce step_size samples of output.

◆ channel_pressure()

void monosynth_audio_module::channel_pressure ( int channel,
int value )
virtual

Handle MIDI Channel Pressure.

Reimplemented from calf_plugins::audio_module< monosynth_metadata >.

◆ configure()

virtual char * calf_plugins::monosynth_audio_module::configure ( const char * key,
const char * value )
inlinevirtual

DSSI configure call.

Reimplemented from calf_plugins::audio_module< monosynth_metadata >.

◆ control_change()

void monosynth_audio_module::control_change ( int channel,
int controller,
int value )
virtual

Handle control change messages.

Reimplemented from calf_plugins::audio_module< monosynth_metadata >.

◆ deactivate()

void monosynth_audio_module::deactivate ( )
virtual

LADSPA-esque deactivate function.

Reimplemented from calf_plugins::audio_module< monosynth_metadata >.

◆ delayed_note_on()

void monosynth_audio_module::delayed_note_on ( )

◆ end_note()

void monosynth_audio_module::end_note ( )

Release a note (physically), called from note-off handler or when note-off has been scheduled after note-on (very short queued note).

◆ get_graph()

bool monosynth_audio_module::get_graph ( int index,
int subindex,
int phase,
float * data,
int points,
cairo_iface * context,
int * mode ) const
virtual

Retrieve filter graph (which is 'live' so it cannot be generated by get_static_graph), or fall back to get_static_graph.

Reimplemented from calf_plugins::line_graph_iface.

◆ get_layers()

bool calf_plugins::monosynth_audio_module::get_layers ( int index,
int generation,
unsigned int & layers ) const
inlinevirtual

Return which layers need to be redrawn in the next GTK drawing cycle

Parameters
indexParameter/graph identifier (usually tied to particular plugin control port)
generationThe overall amount of drawing cycles since the last full refresh of all surfaces
layersBitmask defining the layers to be redrawn (see layers_flags above)
Return values
truethere's at least one layer to be redrawn; false nothing to draw in this cycle

Reimplemented from calf_plugins::line_graph_iface.

◆ get_lfo()

float monosynth_audio_module::get_lfo ( dsp::triangle_lfo & lfo,
int param )
private

◆ is_cv()

bool calf_plugins::monosynth_audio_module::is_cv ( int param_no) const
inlinevirtual
Return values
trueif the filter 1 is to be used for the left channel and filter 2 for the right channel No CV inputs for now

Implements calf_plugins::plugin_metadata_iface.

◆ is_noisy()

bool calf_plugins::monosynth_audio_module::is_noisy ( int param_no) const
inlinevirtual

Practically all the stuff here is noisy.

Implements calf_plugins::plugin_metadata_iface.

◆ is_stereo_filter()

bool calf_plugins::monosynth_audio_module::is_stereo_filter ( ) const
inlineprivate
Return values
falseif filters are to be connected in series and sent (mono) to both channels

◆ lookup_waveforms()

void monosynth_audio_module::lookup_waveforms ( )

Set waveform addresses for oscillators.

◆ note_off()

void monosynth_audio_module::note_off ( int channel,
int note,
int vel )
virtual

Handle MIDI Note Off message.

Reimplemented from calf_plugins::audio_module< monosynth_metadata >.

◆ note_on()

void monosynth_audio_module::note_on ( int channel,
int note,
int vel )
virtual

Handle MIDI Note On message (does not immediately trigger a note, as it must start on boundary of step_size samples).

Reimplemented from calf_plugins::audio_module< monosynth_metadata >.

◆ params_changed()

void monosynth_audio_module::params_changed ( )
virtual

Update variables from control ports.

Reimplemented from calf_plugins::audio_module< monosynth_metadata >.

◆ pitch_bend()

void calf_plugins::monosynth_audio_module::pitch_bend ( int ,
int value )
inlinevirtual

Handle pitch bend message.

Reimplemented from calf_plugins::audio_module< monosynth_metadata >.

◆ post_instantiate()

void calf_plugins::monosynth_audio_module::post_instantiate ( uint32_t )
inlinevirtual

Called after instantiating (after all the feature pointers are set - including interfaces like progress_report_iface).

Reimplemented from calf_plugins::audio_module< monosynth_metadata >.

◆ precalculate_waves()

void monosynth_audio_module::precalculate_waves ( progress_report_iface * reporter)
staticprivate

◆ process()

uint32_t monosynth_audio_module::process ( uint32_t offset,
uint32_t nsamples,
uint32_t inputs_mask,
uint32_t outputs_mask )
virtual

Main processing function.

Implements calf_plugins::audio_module_iface.

◆ reset()

void monosynth_audio_module::reset ( )
private

◆ send_configures()

virtual void calf_plugins::monosynth_audio_module::send_configures ( send_configure_iface * sci)
inlinevirtual

Send all configure variables set within a plugin to given destination (which may be limited to only those that plugin understands).

Reimplemented from calf_plugins::audio_module< monosynth_metadata >.

◆ set_frequency()

void monosynth_audio_module::set_frequency ( )

Update oscillator frequency based on base frequency, detune amount, pitch bend scaling factor and sample rate.

◆ set_sample_rate()

void monosynth_audio_module::set_sample_rate ( uint32_t sr)
virtual

Set sample rate for the plugin.

Reimplemented from calf_plugins::audio_module< monosynth_metadata >.

Member Data Documentation

◆ ampctl

float calf_plugins::monosynth_audio_module::ampctl

◆ buffer

float calf_plugins::monosynth_audio_module::buffer[step_size]

Output buffers, used to ensure updates are done every step_size regardless of process buffer size.

◆ buffer2

float calf_plugins::monosynth_audio_module::buffer2[step_size]

◆ crate

uint32_t calf_plugins::monosynth_audio_module::crate

◆ cutoff

float calf_plugins::monosynth_audio_module::cutoff

◆ detosc

dsp::waveform_oscillator<MONOSYNTH_WAVE_BITS> calf_plugins::monosynth_audio_module::detosc

◆ detune

float calf_plugins::monosynth_audio_module::detune

◆ envelope1

dsp::adsr calf_plugins::monosynth_audio_module::envelope1

Envelope Generators.

◆ envelope2

dsp::adsr calf_plugins::monosynth_audio_module::envelope2

◆ fadeout

dsp::fadeout calf_plugins::monosynth_audio_module::fadeout

Fadeout for buffer 1.

◆ fadeout2

dsp::fadeout calf_plugins::monosynth_audio_module::fadeout2

Fadeout for buffer 2.

◆ fgain

float calf_plugins::monosynth_audio_module::fgain

◆ fgain_delta

float calf_plugins::monosynth_audio_module::fgain_delta

◆ filter

dsp::biquad_d1_lerp calf_plugins::monosynth_audio_module::filter

◆ filter2

dsp::biquad_d1_lerp calf_plugins::monosynth_audio_module::filter2

◆ filter_type

int calf_plugins::monosynth_audio_module::filter_type

Filter type.

◆ fltctl

float calf_plugins::monosynth_audio_module::fltctl

◆ force_fadeout

bool calf_plugins::monosynth_audio_module::force_fadeout

All notes off fadeout.

◆ freq

float calf_plugins::monosynth_audio_module::freq

◆ gate

bool calf_plugins::monosynth_audio_module::gate

A key is kept pressed.

◆ inertia_cutoff

dsp::inertia<dsp::exponential_ramp> calf_plugins::monosynth_audio_module::inertia_cutoff

Smoothed cutoff value.

◆ inertia_pitchbend

dsp::inertia<dsp::exponential_ramp> calf_plugins::monosynth_audio_module::inertia_pitchbend

Smoothed pitch bend value.

◆ inertia_pressure

dsp::inertia<dsp::linear_ramp> calf_plugins::monosynth_audio_module::inertia_pressure

Smoothed channel pressure value.

◆ last_filter_type

int calf_plugins::monosynth_audio_module::last_filter_type

Filter type on the last calculate_step.

◆ last_key

int calf_plugins::monosynth_audio_module::last_key

Last triggered note.

◆ last_pwshift1

int32_t calf_plugins::monosynth_audio_module::last_pwshift1

Last value of phase shift for pulse width emulation for OSC1.

◆ last_pwshift2

int32_t calf_plugins::monosynth_audio_module::last_pwshift2

Last value of phase shift for pulse width emulation for OSC2.

◆ last_stretch1

int32_t calf_plugins::monosynth_audio_module::last_stretch1

Last value of stretch for osc sync emulation for OSC1.

◆ last_unison

float calf_plugins::monosynth_audio_module::last_unison

Last value of unison amount.

◆ last_xfade

float calf_plugins::monosynth_audio_module::last_xfade

Last value of oscillator mix ratio.

◆ legato

int calf_plugins::monosynth_audio_module::legato

Legato mode (bitmask).

◆ lfo1

dsp::triangle_lfo calf_plugins::monosynth_audio_module::lfo1

◆ lfo2

dsp::triangle_lfo calf_plugins::monosynth_audio_module::lfo2

◆ lfo_bend

float calf_plugins::monosynth_audio_module::lfo_bend

◆ lfo_clock

float calf_plugins::monosynth_audio_module::lfo_clock

Delay counter for LFOs.

◆ master

dsp::gain_smoothing calf_plugins::monosynth_audio_module::master

Smoothing for master volume.

◆ mod_matrix_data

dsp::modulation_entry calf_plugins::monosynth_audio_module::mod_matrix_data[mod_matrix_slots]

Rows of the modulation matrix.

◆ moddest

float calf_plugins::monosynth_audio_module::moddest[moddest_count]

Current calculated mod matrix outputs.

◆ modwheel_value

float calf_plugins::monosynth_audio_module::modwheel_value

Modulation wheel position (0.f-1.f).

◆ modwheel_value_int

int calf_plugins::monosynth_audio_module::modwheel_value_int

Integer value for modwheel (0-16383, read from CC1 - MSBs and CC33 - LSBs).

◆ odcr

float calf_plugins::monosynth_audio_module::odcr

◆ osc1

dsp::waveform_oscillator<MONOSYNTH_WAVE_BITS> calf_plugins::monosynth_audio_module::osc1

◆ osc2

dsp::waveform_oscillator<MONOSYNTH_WAVE_BITS> calf_plugins::monosynth_audio_module::osc2

◆ output_pos

uint32_t calf_plugins::monosynth_audio_module::output_pos

Read position within the buffers, on each '0' the buffers are being filled with new data by calculate_step.

◆ porta_time

float calf_plugins::monosynth_audio_module::porta_time

◆ prev_wave1

int calf_plugins::monosynth_audio_module::prev_wave1

Last used waveform number - OSC1.

◆ prev_wave2

int calf_plugins::monosynth_audio_module::prev_wave2

Last used waveform number - OSC2.

◆ queue_note_on

int calf_plugins::monosynth_audio_module::queue_note_on

Next note to play on the next calculate_step.

◆ queue_note_on_and_off

bool calf_plugins::monosynth_audio_module::queue_note_on_and_off

Whether the queued note has been already released.

◆ queue_vel

float calf_plugins::monosynth_audio_module::queue_vel

Velocity of the next note to play.

◆ running

bool calf_plugins::monosynth_audio_module::running

The step code is producing non-zero values.

◆ separation

float calf_plugins::monosynth_audio_module::separation

◆ srate

uint32_t calf_plugins::monosynth_audio_module::srate

◆ stack

dsp::keystack calf_plugins::monosynth_audio_module::stack

◆ start_freq

float calf_plugins::monosynth_audio_module::start_freq

◆ stopping

bool calf_plugins::monosynth_audio_module::stopping

This is the last non-zero buffer (set on calculate_step after fadeout is complete, the next calculate_step will zero running).

◆ target_freq

float calf_plugins::monosynth_audio_module::target_freq

◆ unison_osc

dsp::simple_oscillator calf_plugins::monosynth_audio_module::unison_osc

◆ velocity

float calf_plugins::monosynth_audio_module::velocity

Currently used velocity.

◆ wave1

int calf_plugins::monosynth_audio_module::wave1

Waveform number - OSC1.

◆ wave2

int calf_plugins::monosynth_audio_module::wave2

Waveform number - OSC2.

◆ waves

waveform_family< MONOSYNTH_WAVE_BITS > * monosynth_audio_module::waves
static

◆ xfade

float calf_plugins::monosynth_audio_module::xfade

◆ xpose1

float calf_plugins::monosynth_audio_module::xpose1

◆ xpose2

float calf_plugins::monosynth_audio_module::xpose2

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