CALF: updated up to commit b9b6dc839c40cebbd632ca776817a11c2543265c

There were many changes in the CALF repository. Cherry picking all of
them individually would be lot's of work, that's why I just applied
a diff made up from the following commits:

 * Add ChangeLog entries of the remaining bugfix 0.0.18 releases.
 * First attempt to update ChangeLog with the changes from last 2 years.
 * Fluidsynth: set sample rate on a synth instance.
 * Monosynth: allow modulation matrix when configure is available.
 * Improve LADISH level 1 integration. Doxygenize host_session a little bit.
 * Avoid starting LASH just to display the help text.
 * Reuse instance IDs of removed plugins.
 * Don't crash on failure of the save operation.
 * Remove by pointer, not by position - better for rearranged lists.
 * Mark the reorder function as experimental. Print new plugin order to stdout.
 * Add channel number to internal MIDI API. Fix stack overflow in Calf Organ.
 * Ignore data type for now, to help diagnosing restore issue with Ardour.
(cherry picked from commit a6c6e18508)
This commit is contained in:
Tobias Doerffel
2011-01-02 23:54:59 +01:00
parent a04df066bd
commit 2bb08099b3
21 changed files with 195 additions and 62 deletions

View File

@@ -5,7 +5,10 @@ Thorsten Wilms <t_w_@freenet.de>
Hans Baier <hansfbaier@googlemail.com>
Torben Hohn <torbenh@gmx.de>
Markus Schmidt <schmidt@boomshop.net>
Tom Szilagyi <tomszilagyi@gmail.com>
Damien Zammit <damien.zammit@gmail.com>
Additional bugfixes/enhancement patches:
David Täht <d@teklibre.com>
Dave Robillard <dave@drobilla.net>
Alexandre Prokoudine <alexandre.prokoudine@gmail.com>

View File

@@ -1,3 +1,53 @@
Version 0.0.60.0 (unreleased)
+ Awesome new bitmap-based GUI by Markus Schmidt
+ New plugins by Markus Schmidt:
* several EQs (5, 8, 12 bands)
* new compressors (sidechain, multiband, deesser)
* new distortion plugins (based on code by Tom Szilagyi)
* amplitude modulator plugin (pulsator)
+ New experimental plugin - a simple wrapper for Fluidsynth
+ JACK host: save/load of sessions
+ Vintage Delay: fix another reinitialisation bug that caused,
noise bursts on enable/disable, add Width and LR/RL modes
+ many improvements to Monosynth:
* modulation matrix (not compatible with all plugin standards yet)
* PWM in both oscillators
* stretch (pseudo-hard-sync) for oscillator 1
* detune scaling (depending on pitch)
* second envelope
+ envelopes now have an extra stage called 'Fade': when enabled,
it replaces Sustain with either ramp down to 0% or ramp up to 100%
+ more options in the build system (LASH use can now be disabled)
+ support for LADISH level 1 in calfjackhost (SIGUSR1-triggered Save)
+ uses more recent LV2 extensions (external UI, persist and others)
+ many bugfixes
- removed small plugins - if anyone's interested, please use the old code
in some new project
Version 0.0.18.6
+ LADSPA: do not delete singletons after .so is unloaded
+ Rotary speaker: fix spelling of plugin class
Version 0.0.18.5
+ Vintage Delay: clear buffer on startup and reactivation
+ GUI: fix dodgy icons
+ JACK host: fix a problem with numeric variant of -M option and the new
versions of JACK
Version 0.0.18.4
+ Framework: gcc-4.4 compilation fix (Orcan Ogetbil)
Version 0.0.18.3
+ Framework: do not use x86 assembler code on non-x86 platforms
+ Monosynth, Organ: fix serious audio quality issues
+ Monosynth: implement inertia for cutoff knob and pitch bend, make
pitch bend range adjustable
+ Organ: fix polyphony limit bug
Version 0.0.18.2
+ Organ: fix voice stealing of released notes, sort out GUI, add quadratic

View File

@@ -388,19 +388,19 @@ extern const char *load_gui_xml(const std::string &plugin_id);
struct audio_module_iface
{
/// Handle MIDI Note On
virtual void note_on(int note, int velocity) = 0;
virtual void note_on(int channel, int note, int velocity) = 0;
/// Handle MIDI Note Off
virtual void note_off(int note, int velocity) = 0;
virtual void note_off(int channel, int note, int velocity) = 0;
/// Handle MIDI Program Change
virtual void program_change(int program) = 0;
virtual void program_change(int channel, int program) = 0;
/// Handle MIDI Control Change
virtual void control_change(int controller, int value) = 0;
virtual void control_change(int channel, int controller, int value) = 0;
/// Handle MIDI Pitch Bend
/// @param value pitch bend value (-8192 to 8191, defined as in MIDI ie. 8191 = 200 ct by default)
virtual void pitch_bend(int value) = 0;
virtual void pitch_bend(int channel, int value) = 0;
/// Handle MIDI Channel Pressure
/// @param value channel pressure (0 to 127)
virtual void channel_pressure(int value) = 0;
virtual void channel_pressure(int channel, int value) = 0;
/// Called when params are changed (before processing)
virtual void params_changed() = 0;
/// LADSPA-esque activate function, except it is called after ports are connected, not before
@@ -427,9 +427,9 @@ struct audio_module_iface
virtual const plugin_metadata_iface *get_metadata_iface() const = 0;
/// Set the progress report interface to communicate progress to
virtual void set_progress_report_iface(progress_report_iface *iface) = 0;
/// Clear a part of output buffers that have 0s at mask
virtual void process_slice(uint32_t offset, uint32_t end) = 0;
/// The audio processing loop
/// Clear a part of output buffers that have 0s at mask; subdivide the buffer so that no runs > MAX_SAMPLE_RUN are fed to process function
virtual uint32_t process_slice(uint32_t offset, uint32_t end) = 0;
/// The audio processing loop; assumes numsamples <= MAX_SAMPLE_RUN, for larger buffers, call process_slice
virtual uint32_t process(uint32_t offset, uint32_t numsamples, uint32_t inputs_mask, uint32_t outputs_mask) = 0;
/// Message port processing function
virtual uint32_t message_run(const void *valid_ports, void *output_ports) = 0;
@@ -461,19 +461,19 @@ public:
}
/// Handle MIDI Note On
void note_on(int note, int velocity) {}
void note_on(int channel, int note, int velocity) {}
/// Handle MIDI Note Off
void note_off(int note, int velocity) {}
void note_off(int channel, int note, int velocity) {}
/// Handle MIDI Program Change
void program_change(int program) {}
void program_change(int channel, int program) {}
/// Handle MIDI Control Change
void control_change(int controller, int value) {}
void control_change(int channel, int controller, int value) {}
/// Handle MIDI Pitch Bend
/// @param value pitch bend value (-8192 to 8191, defined as in MIDI ie. 8191 = 200 ct by default)
void pitch_bend(int value) {}
void pitch_bend(int channel, int value) {}
/// Handle MIDI Channel Pressure
/// @param value channel pressure (0 to 127)
void channel_pressure(int value) {}
void channel_pressure(int channel, int value) {}
/// Called when params are changed (before processing)
void params_changed() {}
/// LADSPA-esque activate function, except it is called after ports are connected, not before
@@ -522,15 +522,18 @@ public:
}
}
/// utility function: call process, and if it returned zeros in output masks, zero out the relevant output port buffers
void process_slice(uint32_t offset, uint32_t end)
uint32_t process_slice(uint32_t offset, uint32_t end)
{
uint32_t total_out_mask = 0;
while(offset < end)
{
uint32_t newend = std::min(offset + MAX_SAMPLE_RUN, end);
uint32_t out_mask = process(offset, newend - offset, -1, -1);
total_out_mask |= out_mask;
zero_by_mask(out_mask, offset, newend - offset);
offset = newend;
}
return total_out_mask;
}
/// @return line_graph_iface if any
virtual const line_graph_iface *get_line_graph_iface() const { return dynamic_cast<const line_graph_iface *>(this); }

View File

@@ -99,8 +99,10 @@ struct lv2_instance: public plugin_ctl_iface, public progress_report_iface
size_t len = 0;
uint32_t type = 0;
const void *ptr = (*retrieve)(callback_data, vars[i], &len, &type);
if (ptr && type == string_type)
if (ptr)
{
if (type != string_type)
fprintf(stderr, "Warning: type is %d, expected %d\n", (int)type, (int)string_type);
printf("Calling configure on %s\n", vars[i]);
configure(vars[i], std::string((const char *)ptr, len).c_str());
}
@@ -130,14 +132,15 @@ struct lv2_instance: public plugin_ctl_iface, public progress_report_iface
if (item->type == midi_event_type)
{
// printf("Midi message %x %x %x %x %d\n", item->data[0], item->data[1], item->data[2], item->data[3], item->size);
int channel = item->data[0] & 15;
switch(item->data[0] >> 4)
{
case 8: module->note_off(item->data[1], item->data[2]); break;
case 9: module->note_on(item->data[1], item->data[2]); break;
case 11: module->control_change(item->data[1], item->data[2]); break;
case 12: module->program_change(item->data[1]); break;
case 13: module->channel_pressure(item->data[1]); break;
case 14: module->pitch_bend(item->data[1] + 128 * item->data[2] - 8192); break;
case 8: module->note_off(channel, item->data[1], item->data[2]); break;
case 9: module->note_on(channel, item->data[1], item->data[2]); break;
case 11: module->control_change(channel, item->data[1], item->data[2]); break;
case 12: module->program_change(channel, item->data[1]); break;
case 13: module->channel_pressure(channel, item->data[1]); break;
case 14: module->pitch_bend(channel, item->data[1] + 128 * item->data[2] - 8192); break;
}
}
else

View File

@@ -150,6 +150,7 @@ struct monosynth_metadata: public plugin_metadata<monosynth_metadata>
monosynth_metadata();
/// Lookup of table edit interface
virtual const table_metadata_iface *get_table_metadata_iface(const char *key) const { if (!strcmp(key, "mod_matrix")) return &mm_metadata; else return NULL; }
const char *const *get_configure_vars() const;
};
/// Thor's compressor - metadata

View File

@@ -22,6 +22,7 @@
#define __CALF_MODMATRIX_H
#include "giface.h"
#include <stdio.h>
namespace dsp {
@@ -88,6 +89,32 @@ public:
void send_configures(send_configure_iface *);
char *configure(const char *key, const char *value);
/// Return a list of configure variables used by the modulation matrix
template<int rows>
static const char **get_configure_vars()
{
static std::vector<std::string> names_vector;
static const char *names[rows * 5 + 1];
if (names[0] == NULL)
{
for (int i = 0; i < rows; i++)
{
for (int j = 0; j < 5; j++)
{
char buf[40];
sprintf(buf, "mod_matrix:%d,%d", i, j);
names_vector.push_back(buf);
}
}
for (size_t i = 0; i < names_vector.size(); i++)
names[i] = names_vector[i].c_str();
names[names_vector.size()] = NULL;
}
return names;
}
private:
std::string get_cell(int row, int column) const;
void set_cell(int row, int column, const std::string &src, std::string &error);

View File

@@ -230,8 +230,8 @@ public:
void deactivate();
/// MIDI control
virtual void note_on(int note, int vel);
virtual void note_off(int note, int vel);
virtual void note_on(int channel, int note, int vel);
virtual void note_off(int channel, int note, int vel);
bool get_graph(int index, int subindex, float *data, int points, cairo_iface *context) const;

View File

@@ -69,18 +69,18 @@ public:
void post_instantiate();
void set_sample_rate(uint32_t sr) { srate = sr; }
/// Handle MIDI Note On message (by sending it to fluidsynth)
void note_on(int note, int vel);
void note_on(int channel, int note, int vel);
/// Handle MIDI Note Off message (by sending it to fluidsynth)
void note_off(int note, int vel);
void note_off(int channel, int note, int vel);
/// Handle pitch bend message.
inline void pitch_bend(int value)
inline void pitch_bend(int channel, int value)
{
fluid_synth_pitch_bend(synth, 0, value + 0x2000);
}
/// Handle control change messages.
void control_change(int controller, int value);
void control_change(int channel, int controller, int value);
/// Handle program change messages.
void program_change(int program);
void program_change(int channel, int program);
/// Update variables from control ports.
void params_changed() {

View File

@@ -128,7 +128,7 @@ public:
/// Increase or decrease aspeed towards raspeed, with required negative and positive rate
bool incr_towards(float &aspeed, float raspeed, float delta_decc, float delta_acc);
uint32_t process(uint32_t offset, uint32_t nsamples, uint32_t inputs_mask, uint32_t outputs_mask);
virtual void control_change(int ctl, int val);
virtual void control_change(int channel, int ctl, int val);
};
/// A multitap stereo chorus thing

View File

@@ -127,20 +127,20 @@ public:
void end_note();
/// Handle MIDI Note On message (does not immediately trigger a note, as it must start on
/// boundary of step_size samples).
void note_on(int note, int vel);
void note_on(int channel, int note, int vel);
/// Handle MIDI Note Off message
void note_off(int note, int vel);
void note_off(int channel, int note, int vel);
/// Handle MIDI Channel Pressure
void channel_pressure(int value);
void channel_pressure(int channel, int value);
/// Handle pitch bend message.
inline void pitch_bend(int value)
inline void pitch_bend(int /*channel*/, int value)
{
inertia_pitchbend.set_inertia(pow(2.0, (value * *params[par_pwhlrange]) / (1200.0 * 8192.0)));
}
/// Update oscillator frequency based on base frequency, detune amount, pitch bend scaling factor and sample rate.
void set_frequency();
/// Handle control change messages.
void control_change(int controller, int value);
void control_change(int channel, int controller, int value);
/// Update variables from control ports.
void params_changed();
void activate();

View File

@@ -321,10 +321,10 @@ public:
uint32_t message_run(const void *valid_inputs, void *output_ports);
public:
// overrides
virtual void note_on(int note, int velocity) { dsp::drawbar_organ::note_on(note, velocity); }
virtual void note_off(int note, int velocity) { dsp::drawbar_organ::note_off(note, velocity); }
virtual void control_change(int controller, int value) { dsp::drawbar_organ::control_change(controller, value); }
virtual void pitch_bend(int value) { dsp::drawbar_organ::pitch_bend(value); }
virtual void note_on(int /*channel*/, int note, int velocity) { dsp::drawbar_organ::note_on(note, velocity); }
virtual void note_off(int /*channel*/, int note, int velocity) { dsp::drawbar_organ::note_off(note, velocity); }
virtual void control_change(int /*channel*/, int controller, int value) { dsp::drawbar_organ::control_change(controller, value); }
virtual void pitch_bend(int /*channel*/, int value) { dsp::drawbar_organ::pitch_bend(value); }
};
};

View File

@@ -65,16 +65,22 @@ public:
}
};
/// Exception-safe mutex lock
class ptlock
class ptlock_base
{
protected:
ptmutex &mutex;
bool locked;
ptlock_base(ptmutex &_m)
: mutex(_m)
, locked(false)
{
}
public:
ptlock(ptmutex &_m) : mutex(_m), locked(true)
bool is_locked()
{
mutex.lock();
return locked;
}
void unlock()
{
@@ -85,13 +91,33 @@ public:
{
locked = false;
}
~ptlock()
~ptlock_base()
{
if (locked)
mutex.unlock();
}
};
/// Exception-safe mutex lock
class ptlock: public ptlock_base
{
public:
ptlock(ptmutex &_m) : ptlock_base(_m)
{
locked = mutex.lock();
}
};
/// Exception-safe polling mutex lock
class pttrylock: public ptlock_base
{
public:
pttrylock(ptmutex &_m) : ptlock_base(_m)
{
locked = mutex.trylock();
}
};
/// Exception-safe temporary assignment
template<class T, class Tref = T&>
class scope_assign

View File

@@ -149,10 +149,13 @@ public:
inertia_pitchbend.ramp.set_length(crate / 30); // 1/30s
inertia_pressure.ramp.set_length(crate / 30); // 1/30s - XXXKF monosynth needs that too
}
virtual void note_on(int /*channel*/, int note, int velocity) { dsp::basic_synth::note_on(note, velocity); }
virtual void note_off(int /*channel*/, int note, int velocity) { dsp::basic_synth::note_off(note, velocity); }
virtual void control_change(int /*channel*/, int controller, int value) { dsp::basic_synth::control_change(controller, value); }
/// Handle MIDI Channel Pressure
void channel_pressure(int value);
virtual void channel_pressure(int channel, int value);
/// Handle pitch bend message.
inline void pitch_bend(int value)
virtual void pitch_bend(int channel, int value)
{
inertia_pitchbend.set_inertia(pow(2.0, (value * *params[par_pwhlrange]) / (1200.0 * 8192.0)));
}

View File

@@ -22,6 +22,7 @@
#include <calf/giface.h>
#include <calf/metadata.h>
#include <calf/audio_fx.h>
#include <calf/modmatrix.h>
using namespace dsp;
using namespace calf_plugins;
@@ -808,6 +809,11 @@ monosynth_metadata::monosynth_metadata()
{
}
const char *const *monosynth_metadata::get_configure_vars() const
{
return mod_matrix_impl::get_configure_vars<mod_matrix_slots>();
}
////////////////////////////////////////////////////////////////////////////
CALF_PLUGIN_INFO(organ) = { 0x8481, "Organ", "Calf Organ", "Krzysztof Foltman", calf_plugins::calf_copyright_info, "SynthesizerPlugin" };

View File

@@ -134,6 +134,17 @@ char *mod_matrix_impl::configure(const char *key, const char *value)
if (row != -1 && column != -1)
{
string error;
string value_text;
if (value == NULL)
{
const table_column_info &ci = metadata->get_table_columns()[column];
if (ci.type == TCT_ENUM)
value_text = ci.values[(int)ci.def_value];
else
if (ci.type == TCT_FLOAT)
value_text = f2s(ci.def_value);
value = value_text.c_str();
}
set_cell(row, column, value, error);
if (!error.empty())
return strdup(error.c_str());

View File

@@ -380,7 +380,7 @@ void filterclavier_audio_module::deactivate()
}
void filterclavier_audio_module::note_on(int note, int vel)
void filterclavier_audio_module::note_on(int channel, int note, int vel)
{
last_note = note;
last_velocity = vel;
@@ -401,7 +401,7 @@ void filterclavier_audio_module::note_on(int note, int vel)
inertia_filter_module::calculate_filter();
}
void filterclavier_audio_module::note_off(int note, int vel)
void filterclavier_audio_module::note_off(int channel, int note, int vel)
{
if (note == last_note) {
inertia_filter_module::inertia_resonance.set_inertia(param_props[par_max_resonance].min);

View File

@@ -231,7 +231,7 @@ void rotary_speaker_audio_module::deactivate()
{
}
void rotary_speaker_audio_module::control_change(int ctl, int val)
void rotary_speaker_audio_module::control_change(int /*channel*/, int ctl, int val)
{
if (vibrato_mode == 3 && ctl == 64)
{

View File

@@ -607,7 +607,7 @@ void monosynth_audio_module::apply_fadeout()
}
}
void monosynth_audio_module::note_on(int note, int vel)
void monosynth_audio_module::note_on(int /*channel*/, int note, int vel)
{
queue_note_on = note;
queue_note_on_and_off = false;
@@ -616,7 +616,7 @@ void monosynth_audio_module::note_on(int note, int vel)
stack.push(note);
}
void monosynth_audio_module::note_off(int note, int vel)
void monosynth_audio_module::note_off(int /*channel*/, int note, int vel)
{
stack.pop(note);
if (note == queue_note_on)
@@ -653,12 +653,12 @@ void monosynth_audio_module::end_note()
envelope2.note_off();
}
void monosynth_audio_module::channel_pressure(int value)
void monosynth_audio_module::channel_pressure(int /*channel*/, int value)
{
inertia_pressure.set_inertia(value * (1.0 / 127.0));
}
void monosynth_audio_module::control_change(int controller, int value)
void monosynth_audio_module::control_change(int /*channel*/, int controller, int value)
{
switch(controller)
{

View File

@@ -994,7 +994,7 @@ void organ_audio_module::deactivate()
void drawbar_organ::render_separate(float *output[], int nsamples)
{
float buf[4096][2];
float buf[MAX_SAMPLE_RUN][2];
dsp::zero(&buf[0][0], 2 * nsamples);
basic_synth::render_to(buf, nsamples);
if (dsp::fastf2i_drm(parameters->lfo_mode) == organ_voice_base::lfomode_global)

View File

@@ -189,22 +189,22 @@ void ladspa_instance::process_dssi_event(snd_seq_event_t &event)
{
switch(event.type) {
case SND_SEQ_EVENT_NOTEON:
module->note_on(event.data.note.note, event.data.note.velocity);
module->note_on(event.data.note.channel, event.data.note.note, event.data.note.velocity);
break;
case SND_SEQ_EVENT_NOTEOFF:
module->note_off(event.data.note.note, event.data.note.velocity);
module->note_off(event.data.note.channel, event.data.note.note, event.data.note.velocity);
break;
case SND_SEQ_EVENT_PGMCHANGE:
module->program_change(event.data.control.value);
module->program_change(event.data.control.channel, event.data.control.value);
break;
case SND_SEQ_EVENT_CONTROLLER:
module->control_change(event.data.control.param, event.data.control.value);
module->control_change(event.data.control.channel, event.data.control.param, event.data.control.value);
break;
case SND_SEQ_EVENT_PITCHBEND:
module->pitch_bend(event.data.control.value);
module->pitch_bend(event.data.control.channel, event.data.control.value);
break;
case SND_SEQ_EVENT_CHANPRESS:
module->channel_pressure(event.data.control.value);
module->channel_pressure(event.data.control.channel, event.data.control.value);
break;
}
}

View File

@@ -544,7 +544,7 @@ wavetable_audio_module::wavetable_audio_module()
}
}
void wavetable_audio_module::channel_pressure(int value)
void wavetable_audio_module::channel_pressure(int /*channel*/, int value)
{
inertia_pressure.set_inertia(value * (1.0 / 127.0));
}