[SCM] calf/master: + AutoHell: remove files which are autogenerated anyway (thanks larsl!)
js at users.alioth.debian.org
js at users.alioth.debian.org
Tue May 7 15:37:08 UTC 2013
The following commit has been merged in the master branch:
commit dc59c7d8cd161f99ddf599a85f97bffb7a732e43
Author: kfoltman <kfoltman at 78b06b96-2940-0410-b7fc-879d825d01d8>
Date: Sat Apr 12 14:39:11 2008 +0000
+ AutoHell: remove files which are autogenerated anyway (thanks larsl!)
git-svn-id: https://calf.svn.sourceforge.net/svnroot/calf/trunk@154 78b06b96-2940-0410-b7fc-879d825d01d8
diff --git a/src/calf/giface.h b/src/calf/giface.h
index 93f510c..eefc55b 100644
--- a/src/calf/giface.h
+++ b/src/calf/giface.h
@@ -89,6 +89,7 @@ enum parameter_flags
PF_UNIT_SEMITONES = 0x07000000,
PF_UNIT_BPM = 0x08000000,
PF_UNIT_DEG = 0x09000000,
+ PF_UNIT_NOTE = 0x0A000000,
};
struct parameter_properties
diff --git a/src/calf/organ.h b/src/calf/organ.h
index f8a242a..c02c010 100644
--- a/src/calf/organ.h
+++ b/src/calf/organ.h
@@ -61,8 +61,9 @@ struct organ_parameters {
double perc_decay_const;
float multiplier[9];
int phaseshift[9];
+ float cutoff;
+ unsigned int foldvalue;
- inline bool get_foldover() { return foldover >= 0.5f; }
inline int get_percussion_harmonic() { return dsp::fastf2i_drm(percussion_harmonic); }
};
@@ -104,11 +105,12 @@ protected:
dsp::fixed_point<int64_t, 52> phase, dphase;
biquad<float> filterL[2], filterR[2];
adsr envs[EnvCount];
- int age;
+ inertia<linear_ramp> expression;
public:
organ_voice()
- : organ_voice_base(NULL) {
+ : organ_voice_base(NULL),
+ expression(linear_ramp(16)) {
}
void reset() {
@@ -118,7 +120,6 @@ public:
filterL[i].reset();
filterR[i].reset();
}
- age = 0;
}
void note_on(int note, int /*vel*/) {
@@ -140,75 +141,8 @@ public:
released = true;
}
- void render_block() {
- if (note == -1)
- return;
-
- dsp::zero(&output_buffer[0][0], Channels * BlockSize);
- dsp::zero(&aux_buffers[1][0][0], 2 * Channels * BlockSize);
- if (!amp.get_active())
- return;
-
- dsp::fixed_point<int, 20> tphase, tdphase;
- for (int h = 0; h < 9; h++)
- {
- float amp = parameters->drawbars[h];
- if (amp < small_value<float>())
- continue;
- float *data;
- dsp::fixed_point<int, 24> hm = dsp::fixed_point<int, 24>(parameters->multiplier[h] * (1.0 / 2.0));
- int waveid = (int)parameters->waveforms[h];
- if (waveid < 0 || waveid >= wave_count)
- waveid = 0;
- for (int i = 0; i < 4; i++)
- {
- data = waves[waveid].get_level((dphase * hm).get() >> i);
- if (data)
- break;
- }
- if (!data)
- continue;
- tphase.set((uint32_t)((phase * hm).get()) + parameters->phaseshift[h]);
- tdphase.set((uint32_t)(dphase * hm).get());
- float ampl = amp * 0.5f * (-1 + parameters->pan[h]);
- float ampr = amp * 0.5f * (1 + parameters->pan[h]);
- float (*out)[Channels] = aux_buffers[dsp::fastf2i_drm(parameters->routing[h])];
- for (int i=0; i < (int)BlockSize; i++) {
- float wv = wave(data, tphase);
- out[i][0] += wv * ampl;
- out[i][1] += wv * ampr;
- tphase += tdphase;
- }
- }
- phase += dphase * BlockSize;
- for (int i = 0; i < FilterCount; i++)
- {
- float mod = parameters->filters[i].envmod[0] * envs[0].value;
- mod += parameters->filters[i].keyf * 100 * (note - 60);
- for (int j = 1; j < EnvCount; j++)
- {
- mod += parameters->filters[i].envmod[j] * envs[j].value;
- }
- float fc = parameters->filters[i].cutoff * pow(2.0f, mod * (1.f / 1200.f));
- filterL[i].set_lp_rbj(dsp::clip<float>(fc, 10, 18000), parameters->filters[i].resonance, sample_rate);
- filterR[i].copy_coeffs(filterL[i]);
- }
- for (int i = 0; i < EnvCount; i++)
- envs[i].advance();
- age++;
- for (int i=0; i < (int) BlockSize; i++) {
- output_buffer[i][0] += filterL[0].process_d1(aux_buffers[1][i][0]) + filterL[1].process_d1(aux_buffers[2][i][0]);
- output_buffer[i][1] += filterR[0].process_d1(aux_buffers[1][i][1]) + filterR[1].process_d1(aux_buffers[2][i][1]);
- }
- if (released)
- {
- for (int i=0; i < (int) BlockSize; i++) {
- output_buffer[i][0] *= amp.get();
- output_buffer[i][1] *= amp.get();
- amp.age_lin((1.0/44100.0)/0.03,0.0);
- }
- }
- }
+ void render_block();
+
virtual int get_current_note() {
return note;
}
@@ -304,16 +238,17 @@ struct drawbar_organ: public synth::basic_synth {
virtual void setup(int sr) {
basic_synth::setup(sr);
percussion.setup(sr);
+ parameters->cutoff = 0;
update_params();
}
- void update_params()
+ void update_params();
+ void control_change(int controller, int value)
{
- parameters->perc_decay_const = dsp::decay::calc_exp_constant(1.0 / 1024.0, 0.001 * parameters->percussion_time * sample_rate);
- for (int i = 0; i < 9; i++)
+ if (controller == 11)
{
- parameters->multiplier[i] = parameters->harmonics[i] * pow(2.0, parameters->detune[i] * (1.0 / 1200.0));
- parameters->phaseshift[i] = int(parameters->phase[i] * 65536 / 360) << 16;
+ parameters->cutoff = value / 64.0 - 1;
}
+ synth::basic_synth::control_change(controller, value);
}
};
diff --git a/src/calf/osctl.h b/src/calf/osctl.h
index 643635e..f353d0f 100644
--- a/src/calf/osctl.h
+++ b/src/calf/osctl.h
@@ -21,6 +21,7 @@
#include <string>
#include <vector>
+#include <string.h>
#include <glib.h>
#include <errno.h>
#include <netinet/in.h>
diff --git a/src/calf/preset.h b/src/calf/preset.h
index 85836f9..dcb17af 100644
--- a/src/calf/preset.h
+++ b/src/calf/preset.h
@@ -26,6 +26,8 @@
#include <map>
#include <sstream>
#include <ostream>
+#include <string.h>
+#include "utils.h"
namespace synth {
diff --git a/src/giface.cpp b/src/giface.cpp
index 1c213fa..9d6e55d 100644
--- a/src/giface.cpp
+++ b/src/giface.cpp
@@ -28,6 +28,22 @@
using namespace synth;
using namespace std;
+static std::string i2s(int value)
+{
+ char buf[32];
+ sprintf(buf, "%d", value);
+
+ return string(buf);
+}
+
+static string f2s(double value)
+{
+ // XXXKF might not work with some locale settings
+ char buf[64];
+ sprintf(buf, "%g", value);
+ return buf;
+}
+
float parameter_properties::from_01(float value01) const
{
float value = dsp::clip(value01, 0.f, 1.f);
@@ -157,27 +173,19 @@ std::string parameter_properties::to_string(float value) const
case PF_UNIT_SEMITONES: return string(buf) + "#";
case PF_UNIT_BPM: return string(buf) + " bpm";
case PF_UNIT_DEG: return string(buf) + " deg";
+ case PF_UNIT_NOTE:
+ {
+ static const char *notes = "C C#D D#E F F#G G#A A#B ";
+ int note = (int)value;
+ if (note < 0 || note > 127)
+ return "---";
+ return string(notes + 2 * (note % 12), 2) + i2s(note / 12 - 2);
+ }
}
return string(buf);
}
-static std::string i2s(int value)
-{
- char buf[32];
- sprintf(buf, "%d", value);
-
- return string(buf);
-}
-
-static string f2s(double value)
-{
- // XXXKF might not work with some locale settings
- char buf[64];
- sprintf(buf, "%g", value);
- return buf;
-}
-
std::string synth::xml_escape(const std::string &src)
{
string dest;
diff --git a/src/organ.cpp b/src/organ.cpp
index 44914d5..f2f9db1 100644
--- a/src/organ.cpp
+++ b/src/organ.cpp
@@ -54,8 +54,9 @@ const char *organ_audio_module::get_gui_xml()
"<vbox border=\"10\">"
"<hbox>"
"<vbox>"
- "<label param=\"foldover\"/>"
- "<align><toggle param=\"foldover\"/></align>"
+ "<label param=\"foldnote\"/>"
+ "<align><knob param=\"foldnote\"/></align>"
+ "<value param=\"foldnote\"/>"
"</vbox>"
"<vbox>"
"<label param=\"perc_decay\"/>"
@@ -321,7 +322,7 @@ parameter_properties organ_audio_module::param_props[] = {
{ 0, 0, 2, 0, PF_ENUM | PF_SCALE_LINEAR | PF_CTL_COMBO, organ_routing_names, "routing8", "Routing 8" },
{ 0, 0, 2, 0, PF_ENUM | PF_SCALE_LINEAR | PF_CTL_COMBO, organ_routing_names, "routing9", "Routing 9" },
- { 1, 0, 1, 2, PF_BOOL | PF_CTL_TOGGLE, NULL, "foldover", "Foldover" },
+ { 96, 0, 127, 128, PF_INT | PF_CTL_KNOB | PF_UNIT_NOTE, NULL, "foldnote", "Foldover" },
{ 200, 10, 3000, 100, PF_FLOAT | PF_SCALE_LOG | PF_CTL_KNOB | PF_UNIT_MSEC, NULL, "perc_decay", "Perc. decay" },
{ 0.25, 0, 1, 100, PF_FLOAT | PF_SCALE_GAIN | PF_CTL_KNOB, NULL, "perc_level", "Perc. level" },
{ 3, 2, 3, 1, PF_ENUM | PF_CTL_COMBO, organ_percussion_harmonic_names, "perc_harm", "Perc. harmonic" },
@@ -518,3 +519,91 @@ organ_voice_base::organ_voice_base(organ_parameters *_parameters)
waves[wave_w9].make(bl, tmp);
}
}
+
+void organ_voice::render_block() {
+ if (note == -1)
+ return;
+
+ dsp::zero(&output_buffer[0][0], Channels * BlockSize);
+ dsp::zero(&aux_buffers[1][0][0], 2 * Channels * BlockSize);
+ if (!amp.get_active())
+ return;
+
+ dsp::fixed_point<int, 20> tphase, tdphase;
+ unsigned int foldvalue = parameters->foldvalue;
+ for (int h = 0; h < 9; h++)
+ {
+ float amp = parameters->drawbars[h];
+ if (amp < small_value<float>())
+ continue;
+ float *data;
+ dsp::fixed_point<int, 24> hm = dsp::fixed_point<int, 24>(parameters->multiplier[h] * (1.0 / 2.0));
+ int waveid = (int)parameters->waveforms[h];
+ if (waveid < 0 || waveid >= wave_count)
+ waveid = 0;
+
+ unsigned int rate = (dphase * hm).get();
+ unsigned int foldback = 0;
+ while (rate > foldvalue)
+ {
+ rate >>= 1;
+ foldback++;
+ }
+ hm.set(hm.get() >> foldback);
+ data = waves[waveid].get_level(rate);
+ if (!data)
+ continue;
+ tphase.set((uint32_t)((phase * hm).get()) + parameters->phaseshift[h]);
+ tdphase.set((uint32_t)(dphase * hm).get());
+ float ampl = amp * 0.5f * (1 - parameters->pan[h]);
+ float ampr = amp * 0.5f * (1 + parameters->pan[h]);
+ float (*out)[Channels] = aux_buffers[dsp::fastf2i_drm(parameters->routing[h])];
+ for (int i=0; i < (int)BlockSize; i++) {
+ float wv = wave(data, tphase);
+ out[i][0] += wv * ampl;
+ out[i][1] += wv * ampr;
+ tphase += tdphase;
+ }
+ }
+ expression.set_inertia(parameters->cutoff);
+ phase += dphase * BlockSize;
+ for (int i = 0; i < FilterCount; i++)
+ {
+ float mod = parameters->filters[i].envmod[0] * envs[0].value;
+ mod += parameters->filters[i].keyf * 100 * (note - 60);
+ for (int j = 1; j < EnvCount; j++)
+ {
+ mod += parameters->filters[i].envmod[j] * envs[j].value;
+ }
+ if (i) mod += expression.get() * 1200 * 4;
+ float fc = parameters->filters[i].cutoff * pow(2.0f, mod * (1.f / 1200.f));
+ filterL[i].set_lp_rbj(dsp::clip<float>(fc, 10, 18000), parameters->filters[i].resonance, sample_rate);
+ filterR[i].copy_coeffs(filterL[i]);
+ }
+ for (int i = 0; i < EnvCount; i++)
+ envs[i].advance();
+ for (int i=0; i < (int) BlockSize; i++) {
+ output_buffer[i][0] += filterL[0].process_d1(aux_buffers[1][i][0]) + filterL[1].process_d1(aux_buffers[2][i][0]);
+ output_buffer[i][1] += filterR[0].process_d1(aux_buffers[1][i][1]) + filterR[1].process_d1(aux_buffers[2][i][1]);
+ }
+ if (released)
+ {
+ for (int i=0; i < (int) BlockSize; i++) {
+ output_buffer[i][0] *= amp.get();
+ output_buffer[i][1] *= amp.get();
+ amp.age_lin((1.0/44100.0)/0.03,0.0);
+ }
+ }
+}
+
+void drawbar_organ::update_params()
+{
+ parameters->perc_decay_const = dsp::decay::calc_exp_constant(1.0 / 1024.0, 0.001 * parameters->percussion_time * sample_rate);
+ for (int i = 0; i < 9; i++)
+ {
+ parameters->multiplier[i] = parameters->harmonics[i] * pow(2.0, parameters->detune[i] * (1.0 / 1200.0));
+ parameters->phaseshift[i] = int(parameters->phase[i] * 65536 / 360) << 16;
+ }
+ double dphase = synth::midi_note_to_phase((int)parameters->foldover, 0, sample_rate);
+ parameters->foldvalue = (int)(dphase);
+}
diff --git a/src/osctl.cpp b/src/osctl.cpp
index efd5934..95d5036 100644
--- a/src/osctl.cpp
+++ b/src/osctl.cpp
@@ -2,6 +2,7 @@
#include <assert.h>
#include <arpa/inet.h>
#include <sys/socket.h>
+#include <stdlib.h>
#include <sstream>
using namespace osctl;
diff --git a/src/preset.cpp b/src/preset.cpp
index dad013a..cb97607 100644
--- a/src/preset.cpp
+++ b/src/preset.cpp
@@ -23,6 +23,7 @@
#include <fcntl.h>
#include <stdlib.h>
#include <errno.h>
+#include <string.h>
#include <sys/stat.h>
#include <expat.h>
--
calf audio plugins packaging
More information about the pkg-multimedia-commits
mailing list