diff --git a/SpiralSound/Plugins/ControllerPlugin/ControllerPlugin.C b/SpiralSound/Plugins/ControllerPlugin/ControllerPlugin.C index 7e64249..c19d98f 100644 --- a/SpiralSound/Plugins/ControllerPlugin/ControllerPlugin.C +++ b/SpiralSound/Plugins/ControllerPlugin/ControllerPlugin.C @@ -105,7 +105,6 @@ void ControllerPlugin::ExecuteCommands() switch (m_AudioCH->GetCommand()) { case (SETCHANNEL) : - cerr<>dummy; s>>m_Num; for (int n=0; nm_Min->value(),NULL,10); - long min=strtol(m_GuiVec[num]->m_Max->value(),NULL,10); - float val=o->value()*(max-min)+min; + long max=strtol(m_GuiVec[num]->m_Max->value(),NULL,10); + long min=strtol(m_GuiVec[num]->m_Min->value(),NULL,10); + float val=(1.0f-o->value())*(max-min)+min; m_GUICH->Set("Number",(int)num); m_GUICH->Set("Value",(float)val); m_GUICH->Set("Min",(float)min); diff --git a/SpiralSound/Plugins/MatrixPlugin/MatrixPluginGUI.C b/SpiralSound/Plugins/MatrixPlugin/MatrixPluginGUI.C index 9dcc571..7e2998c 100644 --- a/SpiralSound/Plugins/MatrixPlugin/MatrixPluginGUI.C +++ b/SpiralSound/Plugins/MatrixPlugin/MatrixPluginGUI.C @@ -37,19 +37,6 @@ cb_context(NULL) m_SliderHidden=true; m_VolVal=255; } - -void Fl_MatrixButton::draw() -{ - if (m_Volume) - { - m_VolVal=255-m_Volume->value(); - fl_color((char)m_VolVal,(char)m_VolVal,255); - selection_color(fl_color()); - - if (cb_VolChange) cb_VolChange(this,cb_context); - } - Fl_Button::draw(); -} int Fl_MatrixButton::handle(int event) { @@ -63,6 +50,8 @@ int Fl_MatrixButton::handle(int event) m_Volume->maximum(255); m_Volume->step(1); m_Volume->value(255-m_VolVal); + m_Volume->user_data((void*)this); + m_Volume->callback((Fl_Callback*)cb_Vol); m_Volume->show(); parent()->add(m_Volume); parent()->redraw(); @@ -71,7 +60,7 @@ int Fl_MatrixButton::handle(int event) else { m_Volume->hide(); - m_VolVal=m_Volume->value(); + m_VolVal=255-m_Volume->value(); parent()->remove(m_Volume); parent()->redraw(); m_Volume=NULL; @@ -81,11 +70,33 @@ int Fl_MatrixButton::handle(int event) return 1; } + if (event==FL_PUSH && Fl::event_button()==1 && !m_SliderHidden) + { + m_Volume->hide(); + m_VolVal=255-m_Volume->value(); + parent()->remove(m_Volume); + parent()->redraw(); + m_Volume=NULL; + m_SliderHidden=true; + } + if (Fl::event_button()!=3) return Fl_Button::handle(event); return 1; } +inline void Fl_MatrixButton::cb_Vol_i(Fl_Slider* o, void* v) +{ + m_VolVal=255-m_Volume->value(); + fl_color((char)m_VolVal,(char)m_VolVal,255); + selection_color(fl_color()); + + if (cb_VolChange) cb_VolChange(this,cb_context); + redraw(); +} +void Fl_MatrixButton::cb_Vol(Fl_Slider* o, void* v) +{ ((Fl_MatrixButton*)(o->user_data()))->cb_Vol_i(o,v);} + //////////////////////////////////////////// MatrixPluginGUI::MatrixPluginGUI(int w, int h,MatrixPlugin *o,ChannelHandler *ch,const HostInfo *Info) : diff --git a/SpiralSound/Plugins/MatrixPlugin/MatrixPluginGUI.h b/SpiralSound/Plugins/MatrixPlugin/MatrixPluginGUI.h index c1fd196..b861606 100644 --- a/SpiralSound/Plugins/MatrixPlugin/MatrixPluginGUI.h +++ b/SpiralSound/Plugins/MatrixPlugin/MatrixPluginGUI.h @@ -39,7 +39,6 @@ public: Fl_MatrixButton(int x, int y, int w, int h, char* n); ~Fl_MatrixButton() {} - virtual void draw(); virtual int handle(int event); float GetVolume() { return m_VolVal/255.0f; } @@ -58,6 +57,10 @@ private: void (*cb_VolChange)(Fl_Widget*, void*); void *cb_context; + + inline void cb_Vol_i(Fl_Slider* o, void* v); + static void cb_Vol(Fl_Slider* o, void* v); + }; class MatrixPluginGUI : public SpiralPluginGUI diff --git a/SpiralSound/Plugins/MidiPlugin/MidiPluginGUI.C b/SpiralSound/Plugins/MidiPlugin/MidiPluginGUI.C index c4c27ac..d091abc 100644 --- a/SpiralSound/Plugins/MidiPlugin/MidiPluginGUI.C +++ b/SpiralSound/Plugins/MidiPlugin/MidiPluginGUI.C @@ -80,6 +80,7 @@ SpiralPluginGUI(w,h,o,ch) m_DeviceNum = new Fl_Counter(20,30,40,20,"Channel"); m_DeviceNum->type(FL_SIMPLE_COUNTER); m_DeviceNum->step(1); + m_DeviceNum->value(1); m_DeviceNum->callback((Fl_Callback*)cb_DeviceNum, NULL); m_NoteCut = new Fl_Button(5,70,75,20,"Note Cut"); @@ -109,7 +110,12 @@ void MidiPluginGUI::UpdateValues(SpiralPlugin *o) //// Callbacks //// inline void MidiPluginGUI::cb_DeviceNum_i(Fl_Counter* o, void* v) -{ m_GUICH->Set("DeviceNum",(int)o->value()); } +{ + if (o->value()<1) o->value(1); + if (o->value()>128) o->value(128); + + m_GUICH->Set("DeviceNum",(int)o->value()-1); +} void MidiPluginGUI::cb_DeviceNum(Fl_Counter* o, void* v) { ((MidiPluginGUI*)(o->parent()))->cb_DeviceNum_i(o,v);} diff --git a/SpiralSound/Plugins/PoshSamplerPlugin/PoshSamplerPluginGUI.C b/SpiralSound/Plugins/PoshSamplerPlugin/PoshSamplerPluginGUI.C index 5be0daf..46b2a1a 100644 --- a/SpiralSound/Plugins/PoshSamplerPlugin/PoshSamplerPluginGUI.C +++ b/SpiralSound/Plugins/PoshSamplerPlugin/PoshSamplerPluginGUI.C @@ -115,16 +115,18 @@ void Fl_WaveDisplay::draw() Value = NextValue; // get max - NextValue=(*m_Sample)[n]; + float max=(*m_Sample)[n]; + float min=(*m_Sample)[n]; for (int m=n; m(*m_Sample)[m]) min=(*m_Sample)[m]; } - NextValue*=ho; + min*=ho; max*=ho; - fl_line(x()+pos-2, y()+ho-(int)Value, - x()+pos-1, y()+ho-(int)NextValue); + fl_line(x()+pos-1, y()+ho-(int)min, + x()+pos-1, y()+ho-(int)max); pos++; } } @@ -386,11 +388,11 @@ m_UpdateMe(false) m_ZoomIn = new Fl_Button(bx+(n++*bs),by,bw,bh,"Zoom +"); m_ZoomIn->labelsize(10); - m_ZoomIn->callback((Fl_Callback*)cb_ZoomIn); + //m_ZoomIn->callback((Fl_Callback*)cb_ZoomIn); m_ZoomOut = new Fl_Button(bx+(n++*bs),by,bw,bh,"Zoom -"); m_ZoomOut->labelsize(10); - m_ZoomOut->callback((Fl_Callback*)cb_ZoomOut); + //m_ZoomOut->callback((Fl_Callback*)cb_ZoomOut); end(); @@ -417,6 +419,9 @@ void PoshSamplerPluginGUI::Update() { SetPlayPos(m_GUICH->GetLong("PlayPos")); + if (m_ZoomIn->value()) m_Display->ZoomIn(); + if (m_ZoomOut->value()) m_Display->ZoomOut(); + if (m_UpdateMe) { UpdateSampleDisplay((int)m_SampleNum->value()); diff --git a/SpiralSound/Plugins/ScopePlugin/ScopePluginGUI.C b/SpiralSound/Plugins/ScopePlugin/ScopePluginGUI.C index 340217e..6004416 100644 --- a/SpiralSound/Plugins/ScopePlugin/ScopePluginGUI.C +++ b/SpiralSound/Plugins/ScopePlugin/ScopePluginGUI.C @@ -82,6 +82,11 @@ void ScopePluginGUI::Display(const float *data) if (!m_Bypass) m_Scope->redraw(); } +void ScopePluginGUI::Update() +{ + redraw(); +} + void ScopePluginGUI::draw() { SpiralGUIType::draw(); diff --git a/SpiralSound/Plugins/ScopePlugin/ScopePluginGUI.h b/SpiralSound/Plugins/ScopePlugin/ScopePluginGUI.h index 3c587b7..cc1ecb7 100644 --- a/SpiralSound/Plugins/ScopePlugin/ScopePluginGUI.h +++ b/SpiralSound/Plugins/ScopePlugin/ScopePluginGUI.h @@ -54,7 +54,8 @@ public: ScopePluginGUI(int w, int h, SpiralPlugin *o, ChannelHandler *ch, const HostInfo *Info); virtual void UpdateValues(SpiralPlugin* o); - virtual void draw(); + virtual void Update(); + virtual void draw(); void Display(const float *data); private: diff --git a/SpiralSynthModular.C b/SpiralSynthModular.C index 272cbe2..0086fab 100644 --- a/SpiralSynthModular.C +++ b/SpiralSynthModular.C @@ -40,6 +40,7 @@ #include "GUI/Widgets/PawfalYesNo.h" //#define DEBUG_PLUGINS +#define DEBUG_STREAM const static string LABEL = "SpiralSynthModular "+VER_STRING; static string TITLEBAR; @@ -687,7 +688,7 @@ istream &operator>>(istream &s, SynthModular &o) { o.PauseAudio(); - string dummy; + string dummy,dummy2; int ver; s>>dummy>>dummy>>dummy>>ver; @@ -714,13 +715,20 @@ istream &operator>>(istream &s, SynthModular &o) for(int n=0; n>dummy; //cerr<>ID; //cerr<>dummy; //cerr<>PluginID; //cerr<>dummy; + s>>ID; + s>>dummy2; + s>>PluginID; s>>x>>y; + + #ifdef DEBUG_STREAM + cerr<1) s>>ps>>px>>py; // Check we're not duplicating an ID