@@ -65,10 +65,8 @@ SpiralGUIType *MixSwitchPlugin::CreateGUI () { | |||||
void MixSwitchPlugin::ExecuteCommands () { | void MixSwitchPlugin::ExecuteCommands () { | ||||
if (m_AudioCH->IsCommandWaiting ()) { | if (m_AudioCH->IsCommandWaiting ()) { | ||||
switch (m_AudioCH->GetCommand()) { | switch (m_AudioCH->GetCommand()) { | ||||
case (SETCHANS) : SetChans (m_GUIArgs.Chans); | |||||
break; | |||||
case (SETSWITCH) : SetSwitch (m_GUIArgs.Switch); | |||||
break; | |||||
case SETCHANS : SetChans (m_GUIArgs.Chans); | |||||
break; | |||||
} | } | ||||
} | } | ||||
} | } | ||||
@@ -109,14 +107,11 @@ void MixSwitchPlugin::SetChans (int n) { | |||||
UpdatePluginInfoWithHost (); | UpdatePluginInfoWithHost (); | ||||
} | } | ||||
void MixSwitchPlugin::SetSwitch (int n) { | |||||
m_SwitchPos=(m_GUIArgs.Switch - 1) % (m_PluginInfo.NumInputs - 2); | |||||
} | |||||
void MixSwitchPlugin::Execute() { | void MixSwitchPlugin::Execute() { | ||||
int n; | int n; | ||||
float f; | float f; | ||||
int NumChans = m_PluginInfo.NumInputs - 2; | int NumChans = m_PluginInfo.NumInputs - 2; | ||||
m_SwitchPos=(m_GUIArgs.Switch - 1) % (m_PluginInfo.NumInputs - 2); | |||||
for (n=0; n<m_HostInfo->BUFSIZE; n++) { | for (n=0; n<m_HostInfo->BUFSIZE; n++) { | ||||
if (InputExists (0)) { | if (InputExists (0)) { | ||||
// Check the Switch Pos CV Value | // Check the Switch Pos CV Value | ||||
@@ -34,7 +34,7 @@ class MixSwitchPlugin : public SpiralPlugin { | |||||
virtual void StreamIn (istream &s); | virtual void StreamIn (istream &s); | ||||
int GetSwitch (void) { return m_SwitchPos + 1; } | int GetSwitch (void) { return m_SwitchPos + 1; } | ||||
int GetChans (void) { return m_PluginInfo.NumInputs - 2; } | int GetChans (void) { return m_PluginInfo.NumInputs - 2; } | ||||
enum GUICommands {NONE, SETCHANS, SETSWITCH}; | |||||
enum GUICommands {NONE, SETCHANS}; | |||||
struct GUIArgs { | struct GUIArgs { | ||||
int Chans; | int Chans; | ||||
int Switch; | int Switch; | ||||
@@ -43,7 +43,6 @@ class MixSwitchPlugin : public SpiralPlugin { | |||||
private: | private: | ||||
GUIArgs m_GUIArgs; | GUIArgs m_GUIArgs; | ||||
void SetChans (int n); | void SetChans (int n); | ||||
void SetSwitch (int n); | |||||
int m_SwitchPos; | int m_SwitchPos; | ||||
bool m_Triggered; | bool m_Triggered; | ||||
void CreatePorts (int n = 2, bool AddPorts = false); | void CreatePorts (int n = 2, bool AddPorts = false); | ||||
@@ -66,7 +66,6 @@ inline void MixSwitchPluginGUI::cb_Switch_i (Fl_Counter* o, void* v) { | |||||
if (o->value() < 1 || o->value() > m_Chans->value ()) | if (o->value() < 1 || o->value() > m_Chans->value ()) | ||||
o->value (1); | o->value (1); | ||||
m_GUICH->Set ("Switch", int (o->value ())); | m_GUICH->Set ("Switch", int (o->value ())); | ||||
m_GUICH->SetCommand (MixSwitchPlugin::SETSWITCH); | |||||
} | } | ||||
void MixSwitchPluginGUI::cb_Switch (Fl_Counter* o, void* v) { | void MixSwitchPluginGUI::cb_Switch (Fl_Counter* o, void* v) { | ||||
@@ -74,7 +73,8 @@ void MixSwitchPluginGUI::cb_Switch (Fl_Counter* o, void* v) { | |||||
} | } | ||||
void MixSwitchPluginGUI::Update () { | void MixSwitchPluginGUI::Update () { | ||||
m_Switch->value (m_GUICH->GetInt ("Echo")); | |||||
int e = m_GUICH->GetInt ("Echo"); | |||||
if (m_Switch->value () != e) m_Switch->value (e); | |||||
} | } | ||||
void MixSwitchPluginGUI::UpdateValues (SpiralPlugin *o) { | void MixSwitchPluginGUI::UpdateValues (SpiralPlugin *o) { | ||||
@@ -40,6 +40,8 @@ class MixSwitchPluginGUI : public SpiralPluginGUI { | |||||
static void cb_Switch (Fl_Counter* o, void* v); | static void cb_Switch (Fl_Counter* o, void* v); | ||||
inline void cb_Chans_i (Fl_Counter* o, void* v); | inline void cb_Chans_i (Fl_Counter* o, void* v); | ||||
static void cb_Chans (Fl_Counter* o, void* v); | static void cb_Chans (Fl_Counter* o, void* v); | ||||
// Andy Preston - multiple inputs | |||||
}; | }; | ||||
#endif | #endif |