Browse Source

gui controls finer and added a small filter to try to remove pops

master
nebogeo 21 years ago
parent
commit
2647e23bf6
3 changed files with 32 additions and 22 deletions
  1. +21
    -13
      SpiralSound/Plugins/EnvelopePlugin/EnvelopePlugin.C
  2. +2
    -0
      SpiralSound/Plugins/EnvelopePlugin/EnvelopePlugin.h
  3. +9
    -9
      SpiralSound/Plugins/EnvelopePlugin/EnvelopePluginGUI.C

+ 21
- 13
SpiralSound/Plugins/EnvelopePlugin/EnvelopePlugin.C View File

@@ -22,6 +22,10 @@

using namespace std;

// a bit of a crap filter to smooth clicks
static float SMOOTH = 0.99;
static float ONEMINUS_SMOOTH = 1-SMOOTH;

extern "C" {
SpiralPlugin* SpiralPlugin_CreateInstance()
{
@@ -54,7 +58,8 @@ m_Decay(0.5f),
m_Sustain(1.0f),
m_Release(1.0f),
m_Volume(0.5f),
m_TrigThresh(0.01)
m_TrigThresh(0.01),
m_Current(0)
{
m_PluginInfo.Name="Envelope";
m_PluginInfo.Width=142;
@@ -105,14 +110,6 @@ void EnvelopePlugin::Execute()
float temp=0;
bool Freeze=false;
// Early out?
/*if (m_t<0 && (!m_Input[0] || m_Input[0]->IsEmpty()))
{
m_Output[0]->Zero();
m_Output[1]->Zero();
return;
}*/
for (int n=0; n<m_HostInfo->BUFSIZE; n++)
{
// Check the trigger CV values
@@ -171,22 +168,33 @@ void EnvelopePlugin::Execute()
temp*=m_Volume;
if (!feq(temp,m_Current,0.01))
{
// only filter if necc
temp=(temp*ONEMINUS_SMOOTH+m_Current*SMOOTH);
}
SetOutput(0,n,temp);
SetOutput(1,n,GetInput(1,n)*temp);
m_Current=temp;
if (!Freeze) m_t+=m_SampleTime;
}
else
{
SetOutput(0,n,0);
SetOutput(1,n,0);
if (!feq(temp,m_Current,0.01))
{
temp=m_Current*SMOOTH;
}
SetOutput(0,n,temp);
SetOutput(1,n,GetInput(1,n)*temp);
m_Current=temp;
// if we've run off the end
if (m_t>m_Attack+m_Decay+m_Release)
{
m_t=-1;
//m_Output[0]->Zero();
//m_Output[1]->Zero();
return;
}



+ 2
- 0
SpiralSound/Plugins/EnvelopePlugin/EnvelopePlugin.h View File

@@ -59,6 +59,8 @@ private:
float m_TrigThresh;
float m_SampleTime;
float m_Current;
friend std::istream &operator>>(std::istream &s, EnvelopePlugin &o);
friend std::ostream &operator<<(std::ostream &s, EnvelopePlugin &o);
};


+ 9
- 9
SpiralSound/Plugins/EnvelopePlugin/EnvelopePluginGUI.C View File

@@ -45,7 +45,7 @@ SpiralPluginGUI(w,h,o,ch)
m_Thresh->box (FL_PLASTIC_DOWN_BOX);
m_Thresh->labelsize (10);
m_Thresh->maximum (1.0);
m_Thresh->step (0.01);
m_Thresh->step (0.0001);
m_Thresh->value (0.99f);
m_Thresh->callback ((Fl_Callback*)cb_Thresh);
m_CtlGroup->add (m_Thresh);
@@ -57,7 +57,7 @@ SpiralPluginGUI(w,h,o,ch)
m_Attack->box (FL_PLASTIC_DOWN_BOX);
m_Attack->labelsize (10);
m_Attack->maximum (TIMED_SLIDER_MAX);
m_Attack->step (0.01);
m_Attack->step (0.0001);
m_Attack->value (3.0f);
m_Attack->callback ((Fl_Callback*)cb_Attack);
m_CtlGroup->add (m_Attack);
@@ -69,7 +69,7 @@ SpiralPluginGUI(w,h,o,ch)
m_Decay->box (FL_PLASTIC_DOWN_BOX);
m_Decay->labelsize (10);
m_Decay->maximum (TIMED_SLIDER_MAX);
m_Decay->step (0.01);
m_Decay->step (0.0001);
m_Decay->value (2.29);
m_Decay->callback ((Fl_Callback*)cb_Decay);
m_CtlGroup->add (m_Decay);
@@ -81,7 +81,7 @@ SpiralPluginGUI(w,h,o,ch)
m_Sustain->box (FL_PLASTIC_DOWN_BOX);
m_Sustain->labelsize (10);
m_Sustain->maximum (1);
m_Sustain->step (0.01);
m_Sustain->step (0.0001);
m_Sustain->value (0.0);
m_Sustain->callback ((Fl_Callback*)cb_Sustain);
m_CtlGroup->add (m_Sustain);
@@ -93,7 +93,7 @@ SpiralPluginGUI(w,h,o,ch)
m_Release->box (FL_PLASTIC_DOWN_BOX);
m_Release->labelsize (10);
m_Release->maximum (TIMED_SLIDER_MAX);
m_Release->step (0.01);
m_Release->step (0.0001);
m_Release->value (2.0);
m_Release->callback ((Fl_Callback*)cb_Release);
m_CtlGroup->add (m_Release);
@@ -105,7 +105,7 @@ SpiralPluginGUI(w,h,o,ch)
m_Volume->box (FL_PLASTIC_DOWN_BOX);
m_Volume->labelsize (10);
m_Volume->maximum (1);
m_Volume->step (0.01);
m_Volume->step (0.0001);
m_Volume->value (0.5f);
m_Volume->callback ((Fl_Callback*)cb_Volume);
m_CtlGroup->add (m_Volume);
@@ -135,7 +135,7 @@ SpiralPluginGUI(w,h,o,ch)
m_NumAttack->labelsize (8);
m_NumAttack->maximum (TIMED_SLIDER_MAX * TIMED_SLIDER_MAX);
m_NumAttack->minimum (0);
m_NumAttack->step (0.1);
m_NumAttack->step (0.001);
m_NumAttack->value (0);
m_NumAttack->callback ((Fl_Callback*)cb_NumAttack);
m_NumGroup->add (m_NumAttack);
@@ -148,7 +148,7 @@ SpiralPluginGUI(w,h,o,ch)
m_NumDecay->labelsize (8);
m_NumDecay->maximum (TIMED_SLIDER_MAX * TIMED_SLIDER_MAX);
m_NumDecay->minimum (0);
m_NumDecay->step (0.1);
m_NumDecay->step (0.001);
m_NumDecay->value (0.5);
m_NumDecay->callback ((Fl_Callback*)cb_NumDecay);
m_NumGroup->add (m_NumDecay);
@@ -174,7 +174,7 @@ SpiralPluginGUI(w,h,o,ch)
m_NumRelease->labelsize (8);
m_NumRelease->maximum (TIMED_SLIDER_MAX * TIMED_SLIDER_MAX);
m_NumRelease->minimum (0);
m_NumRelease->step (0.1);
m_NumRelease->step (0.001);
m_NumRelease->value (1.0);
m_NumRelease->callback ((Fl_Callback*)cb_NumRelease);
m_NumGroup->add (m_NumRelease);


Loading…
Cancel
Save