[SCM] calf/master: + Organ, Monosynth: fix All Sounds Off message (thanks Nedko!) and unmuckify a little
js at users.alioth.debian.org
js at users.alioth.debian.org
Tue May 7 15:39:05 UTC 2013
The following commit has been merged in the master branch:
commit ffd47b9c7bde8c020971f92b89164885cedc6fe9
Author: Krzysztof Foltman <wdev at foltman.com>
Date: Sat Jan 24 11:26:49 2009 +0000
+ Organ, Monosynth: fix All Sounds Off message (thanks Nedko!) and unmuckify a little
diff --git a/src/calf/modules_synths.h b/src/calf/modules_synths.h
index 76fdd3b..f8c517c 100644
--- a/src/calf/modules_synths.h
+++ b/src/calf/modules_synths.h
@@ -46,7 +46,7 @@ public:
uint32_t srate, crate;
static dsp::waveform_family<MONOSYNTH_WAVE_BITS> *waves;
dsp::waveform_oscillator<MONOSYNTH_WAVE_BITS> osc1, osc2;
- bool running, stopping, gate;
+ bool running, stopping, gate, force_fadeout;
int last_key;
float buffer[step_size], buffer2[step_size];
@@ -69,36 +69,9 @@ public:
void delayed_note_on();
/// 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)
- {
- queue_note_on = note;
- last_key = note;
- queue_vel = vel / 127.f;
- stack.push(note);
- }
+ void note_on(int note, int vel);
/// Handle MIDI Note Off message
- void note_off(int note, int vel)
- {
- stack.pop(note);
- // If releasing the currently played note, try to get another one from note stack.
- if (note == last_key) {
- if (stack.count())
- {
- last_key = note = stack.nth(stack.count() - 1);
- start_freq = freq;
- target_freq = freq = dsp::note_to_hz(note);
- set_frequency();
- if (!(legato & 1)) {
- envelope.note_on();
- stopping = false;
- running = true;
- }
- return;
- }
- gate = false;
- envelope.note_off();
- }
- }
+ void note_off(int note, int vel);
/// Handle pitch bend message.
inline void pitch_bend(int value)
{
@@ -129,7 +102,7 @@ public:
set_frequency();
}
void activate();
- void deactivate() {}
+ void deactivate();
/// Run oscillators and two filters in series to produce mono output samples.
void calculate_buffer_ser();
/// Run oscillators and just one filter to produce mono output samples.
@@ -237,8 +210,7 @@ public:
setup(srate);
panic_flag = false;
}
- void deactivate() {
- }
+ void deactivate();
uint32_t process(uint32_t offset, uint32_t nsamples, uint32_t inputs_mask, uint32_t outputs_mask) {
float *o[2] = { outs[0] + offset, outs[1] + offset };
if (panic_flag)
diff --git a/src/monosynth.cpp b/src/monosynth.cpp
index 1726f70..b4d8a1f 100644
--- a/src/monosynth.cpp
+++ b/src/monosynth.cpp
@@ -248,6 +248,7 @@ void monosynth_audio_module::calculate_buffer_stereo()
void monosynth_audio_module::delayed_note_on()
{
+ force_fadeout = false;
stop_count = 0;
porta_time = 0.f;
start_freq = freq;
@@ -432,7 +433,7 @@ void monosynth_audio_module::calculate_step()
calculate_buffer_stereo();
break;
}
- if (envelope.state == adsr::STOP)
+ if (envelope.state == adsr::STOP || force_fadeout)
{
enum { ramp = step_size * 4 };
for (int i = 0; i < step_size; i++)
@@ -446,16 +447,59 @@ void monosynth_audio_module::calculate_step()
}
}
+void monosynth_audio_module::note_on(int note, int vel)
+{
+ queue_note_on = note;
+ last_key = note;
+ queue_vel = vel / 127.f;
+ stack.push(note);
+}
+
+void monosynth_audio_module::note_off(int note, int vel)
+{
+ stack.pop(note);
+ // If releasing the currently played note, try to get another one from note stack.
+ if (note == last_key) {
+ if (stack.count())
+ {
+ last_key = note = stack.nth(stack.count() - 1);
+ start_freq = freq;
+ target_freq = freq = dsp::note_to_hz(note);
+ set_frequency();
+ if (!(legato & 1)) {
+ envelope.note_on();
+ stopping = false;
+ running = true;
+ }
+ return;
+ }
+ gate = false;
+ envelope.note_off();
+ }
+}
+
+
void monosynth_audio_module::control_change(int controller, int value)
{
switch(controller)
{
case 120: // all sounds off
+ force_fadeout = true;
+ // fall through
case 123: // all notes off
gate = false;
+ queue_note_on = -1;
envelope.note_off();
stack.clear();
break;
}
}
+void monosynth_audio_module::deactivate()
+{
+ gate = false;
+ running = false;
+ stopping = false;
+ envelope.reset();
+ stack.clear();
+}
diff --git a/src/organ.cpp b/src/organ.cpp
index 13adc77..ec63b78 100644
--- a/src/organ.cpp
+++ b/src/organ.cpp
@@ -811,3 +811,7 @@ void organ_audio_module::send_configures(send_configure_iface *sci)
sci->send_configure("map_curve", var_map_curve.c_str());
}
+void organ_audio_module::deactivate()
+{
+
+}
diff --git a/src/synth.cpp b/src/synth.cpp
index 0f34ec0..5b7518b 100644
--- a/src/synth.cpp
+++ b/src/synth.cpp
@@ -182,7 +182,10 @@ void basic_synth::control_change(int ctl, int val)
}
for_all_voices(i)
{
- (*i)->note_off(127);
+ if (ctl == 123)
+ (*i)->note_off(127);
+ else
+ (*i)->steal();
}
}
if (ctl == 121) {
--
calf audio plugins packaging
More information about the pkg-multimedia-commits
mailing list