@@ -349,7 +349,7 @@ void MatrixPlugin::PastePattern() { | |||||
m_Matrix[m_GUICurrent].Octave = m_Matrix[m_CopyPattern].Octave; | m_Matrix[m_GUICurrent].Octave = m_Matrix[m_CopyPattern].Octave; | ||||
for (int y=0; y<MATY; y++) { | for (int y=0; y<MATY; y++) { | ||||
for (int x=0; x<MATX; x++) { | for (int x=0; x<MATX; x++) { | ||||
m_Matrix[m_Current].Matrix[x][y] = m_Matrix[m_CopyPattern].Matrix[x][y]; | |||||
m_Matrix[m_GUICurrent].Matrix[x][y] = m_Matrix[m_CopyPattern].Matrix[x][y]; | |||||
} | } | ||||
} | } | ||||
} | } | ||||
@@ -21,7 +21,6 @@ | |||||
#include <FL/Fl_Button.h> | #include <FL/Fl_Button.h> | ||||
#include "SpiralIcon.xpm" | #include "SpiralIcon.xpm" | ||||
#define DENORMALISE(fv) (((*(unsigned int*)&(fv))&0x7f800000)==0)?0.0f:(fv) | |||||
#define PI 3.141592654 | #define PI 3.141592654 | ||||
static const int GRANULARITY = 10; | static const int GRANULARITY = 10; | ||||
@@ -46,7 +45,7 @@ int GetID() | |||||
/////////////////////////////////////////////////////// | /////////////////////////////////////////////////////// | ||||
SVFilterPlugin::SVFilterPlugin() : | SVFilterPlugin::SVFilterPlugin() : | ||||
Cutoff(50.0f), | |||||
Cutoff(0.0f), | |||||
Resonance(0.0f), | Resonance(0.0f), | ||||
fs(44100.0f), | fs(44100.0f), | ||||
fc(1000.0f), | fc(1000.0f), | ||||
@@ -54,11 +53,11 @@ q(1.0f), | |||||
m_f(0.0f), | m_f(0.0f), | ||||
m_q(0.0f), | m_q(0.0f), | ||||
m_qnrm(0.0f), | m_qnrm(0.0f), | ||||
m_h(1.0f), | |||||
m_b(1.0f), | |||||
m_l(1.0f), | |||||
m_p(1.0f), | |||||
m_n(1.0f) | |||||
m_h(0.0f), | |||||
m_b(0.0f), | |||||
m_l(0.0f), | |||||
m_p(0.0f), | |||||
m_n(0.0f) | |||||
{ | { | ||||
m_PluginInfo.Name="SVF"; | m_PluginInfo.Name="SVF"; | ||||
m_PluginInfo.Width=120; | m_PluginInfo.Width=120; | ||||
@@ -104,47 +103,26 @@ void SVFilterPlugin::Execute() | |||||
{ | { | ||||
if (n%GRANULARITY==0) | if (n%GRANULARITY==0) | ||||
{ | { | ||||
fc = 220.0*(float)pow(2.0f, Cutoff+GetInput(1,n))*5.0f; | |||||
fc = 4000.0f*(Cutoff+GetInput(1,n)); | |||||
q = 1-Resonance+GetInput(2,n); | q = 1-Resonance+GetInput(2,n); | ||||
m_f = 2.0*sin(PI*fc/fs); | |||||
m_q = 2.0*cos(pow(q,0.1)*PI*0.5); | |||||
m_qnrm = sqrt(m_q/2.0+0.01); | |||||
m_f = 2.0f*sin(PI*fc/fs); | |||||
} | } | ||||
in = m_qnrm*GetInput(0,n); | |||||
in = GetInput(0,n); | |||||
//if (in!=0) | |||||
//{ | |||||
in = DENORMALISE(in); | |||||
m_l = DENORMALISE(m_l); | |||||
float scale=0.5f; | |||||
// Protect the filter from breaking | |||||
if (m_b>10) m_b=10; | |||||
if (m_b<-10) m_b=-10; | |||||
m_b = m_b - m_b*m_b*m_b*0.001; | |||||
m_h = in - m_l - q*m_b; | |||||
m_b = m_b + m_f*m_h; | |||||
m_l = m_l + m_f*m_b; | |||||
m_n = m_l + m_h; | |||||
m_p = m_l - m_h; | |||||
m_l = m_l + m_f*m_b; | |||||
m_h = scale*in - m_l - q*m_b; | |||||
m_b = m_b + m_f*m_h; | |||||
m_n = m_l + m_h; | |||||
m_p = m_l - m_h; | |||||
SetOutput(0,n,m_l); | |||||
SetOutput(1,n,m_b); | |||||
SetOutput(2,n,m_h); | |||||
SetOutput(3,n,m_n); | |||||
SetOutput(4,n,m_p); | |||||
//} | |||||
//else | |||||
//{ | |||||
// m_Output[0]->Set(n,0); | |||||
// m_Output[1]->Set(n,0); | |||||
// m_Output[2]->Set(n,0); | |||||
// m_Output[3]->Set(n,0); | |||||
// m_Output[4]->Set(n,0); | |||||
//} | |||||
SetOutput(0,n,m_l); | |||||
SetOutput(1,n,m_b); | |||||
SetOutput(2,n,m_h); | |||||
SetOutput(3,n,m_n); | |||||
SetOutput(4,n,m_p); | |||||
} | } | ||||
} | } | ||||
@@ -46,11 +46,7 @@ SpiralPluginGUI(w,h,o,ch) | |||||
Resonance->step(0.00001); | Resonance->step(0.00001); | ||||
Resonance->value(0); | Resonance->value(0); | ||||
Resonance->callback((Fl_Callback*)cb_Resonance); | Resonance->callback((Fl_Callback*)cb_Resonance); | ||||
Reset = new Fl_Button(60,80,40,20,"Reset"); | |||||
Reset->labelsize(10); | |||||
Reset->callback((Fl_Callback*)cb_Reset); | |||||
end(); | end(); | ||||
} | } | ||||
@@ -72,25 +68,14 @@ void SVFilterPluginGUI::cb_Cutoff(Fl_Slider* o, void* v) | |||||
{ ((SVFilterPluginGUI*)(o->parent()))->cb_Cutoff_i(o,v); } | { ((SVFilterPluginGUI*)(o->parent()))->cb_Cutoff_i(o,v); } | ||||
inline void SVFilterPluginGUI::cb_Resonance_i(Fl_Knob* o, void* v) | inline void SVFilterPluginGUI::cb_Resonance_i(Fl_Knob* o, void* v) | ||||
{ m_GUICH->Set("Resonance",o->value()); } | |||||
{ m_GUICH->Set("Resonance",(float)o->value()); } | |||||
void SVFilterPluginGUI::cb_Resonance(Fl_Knob* o, void* v) | void SVFilterPluginGUI::cb_Resonance(Fl_Knob* o, void* v) | ||||
{ ((SVFilterPluginGUI*)(o->parent()))->cb_Resonance_i(o,v); } | { ((SVFilterPluginGUI*)(o->parent()))->cb_Resonance_i(o,v); } | ||||
inline void SVFilterPluginGUI::cb_Reset_i(Fl_Button* o, void* v) | |||||
{ } | |||||
void SVFilterPluginGUI::cb_Reset(Fl_Button* o, void* v) | |||||
{ ((SVFilterPluginGUI*)(o->parent()))->cb_Reset_i(o,v); } | |||||
const string SVFilterPluginGUI::GetHelpText(const string &loc){ | const string SVFilterPluginGUI::GetHelpText(const string &loc){ | ||||
return string("") | return string("") | ||||
+ "A State Variable Filter. First thing to say is, it's a bit\n" | |||||
+ "broken. Seems to generate glitchy noise when the cutoff is \n" | |||||
+ "modulated. Possibly a range bug on the cutoff too.\n" | |||||
+ "On the other hand, I like some of the noises it seems to\n" | |||||
+ "make, so it's here anyway (I'll fix it some day).\n\n" | |||||
+ "Works pretty well at band,high and peaking useful for creating\n" | |||||
+ "some different sounds.\n\n" | |||||
+ "Note: Comes with a reset button, so if you break it pushing\n" | |||||
+ "the emphasis up too high, you can reset the cooeficients\n" | |||||
+ "(which fixes it)."; | |||||
+ "A 12db approximation of Chamberlin two-pole filter.\n" | |||||
+ "State Variable Filter with low, band and highpass modes plus\n" | |||||
+ "notch and peaking outputs that you can use simulaneously.\n\n" | |||||
+ "It was broken for ages, but it's fixed now - dave"; | |||||
} | } |
@@ -44,16 +44,13 @@ private: | |||||
Fl_Group *GUIFilterGroup; | Fl_Group *GUIFilterGroup; | ||||
Fl_Slider *Cutoff; | Fl_Slider *Cutoff; | ||||
Fl_Knob *Resonance; | Fl_Knob *Resonance; | ||||
Fl_Button *Reset; | |||||
//// Callbacks //// | //// Callbacks //// | ||||
inline void cb_Cutoff_i(Fl_Slider* o, void* v); | inline void cb_Cutoff_i(Fl_Slider* o, void* v); | ||||
static void cb_Cutoff(Fl_Slider*, void*); | static void cb_Cutoff(Fl_Slider*, void*); | ||||
inline void cb_Resonance_i(Fl_Knob* o, void* v); | inline void cb_Resonance_i(Fl_Knob* o, void* v); | ||||
static void cb_Resonance(Fl_Knob* o, void* v); | |||||
inline void cb_Reset_i(Fl_Button* o, void* v); | |||||
static void cb_Reset(Fl_Button* o, void* v); | |||||
static void cb_Resonance(Fl_Knob* o, void* v); | |||||
}; | }; | ||||
#endif | #endif |
@@ -84,7 +84,7 @@ void StereoMixerPluginGUI::cb_Chan(Fl_Slider* o, void* v) { | |||||
inline void StereoMixerPluginGUI::cb_Pan_i(Fl_Knob* o, void* v) { | inline void StereoMixerPluginGUI::cb_Pan_i(Fl_Knob* o, void* v) { | ||||
m_GUICH->Set("Num",*(int*)(v)); | m_GUICH->Set("Num",*(int*)(v)); | ||||
m_GUICH->Set("Value",(float)(2.0f-o->value())); | |||||
m_GUICH->Set("Value",(float)(1.0f-o->value())); | |||||
m_GUICH->SetCommand(StereoMixerPlugin::SETPAN); | m_GUICH->SetCommand(StereoMixerPlugin::SETPAN); | ||||
} | } | ||||
@@ -56,7 +56,8 @@ void watchdog (void *arg) | |||||
while (1) | while (1) | ||||
{ | { | ||||
usleep (10000000); | usleep (10000000); | ||||
if (watchdog_check == 0 || gui_watchdog_check== 0) | |||||
// gui watchdog goes off with modal dialog boxes | |||||
if (watchdog_check == 0)// || gui_watchdog_check== 0) | |||||
{ | { | ||||
cerr<<"ssm watchdog: timeout - killing ssm"<<endl; | cerr<<"ssm watchdog: timeout - killing ssm"<<endl; | ||||
if (watchdog_check==0) cerr<<"diagnosis: audio hung?"<<endl; | if (watchdog_check==0) cerr<<"diagnosis: audio hung?"<<endl; | ||||