@@ -105,7 +105,6 @@ void ControllerPlugin::ExecuteCommands() | |||||
switch (m_AudioCH->GetCommand()) | switch (m_AudioCH->GetCommand()) | ||||
{ | { | ||||
case (SETCHANNEL) : | case (SETCHANNEL) : | ||||
cerr<<m_GUIArgs.Name<<endl; | |||||
SetChannel(m_GUIArgs.Number,m_GUIArgs.Value,m_GUIArgs.Min,m_GUIArgs.Max,m_GUIArgs.Name); | SetChannel(m_GUIArgs.Number,m_GUIArgs.Value,m_GUIArgs.Min,m_GUIArgs.Max,m_GUIArgs.Name); | ||||
break; | break; | ||||
case (SETNUM) : | case (SETNUM) : | ||||
@@ -164,7 +163,7 @@ void ControllerPlugin::StreamOut(ostream &s) | |||||
{ | { | ||||
s<<m_ChannelVal[n]<<" "; | s<<m_ChannelVal[n]<<" "; | ||||
} | } | ||||
s<<1<<endl; | |||||
s<<m_Num<<" "; | s<<m_Num<<" "; | ||||
for (int n=0; n<m_Num; n++) | for (int n=0; n<m_Num; n++) | ||||
{ | { | ||||
@@ -201,8 +200,8 @@ void ControllerPlugin::StreamIn(istream &s) | |||||
} | } | ||||
char Buf[4096]; | char Buf[4096]; | ||||
int size; | |||||
int size,dummy; | |||||
s>>dummy; | |||||
s>>m_Num; | s>>m_Num; | ||||
for (int n=0; n<m_Num; n++) | for (int n=0; n<m_Num; n++) | ||||
{ | { | ||||
@@ -154,9 +154,9 @@ inline void ControllerPluginGUI::cb_Chan_i(Fl_Slider* o, void* v) | |||||
int num=*(int*)(v); | int num=*(int*)(v); | ||||
// swap em over, cos it's the easiqest way to reverse | // swap em over, cos it's the easiqest way to reverse | ||||
// the fltk slider, which is upside down imho | // the fltk slider, which is upside down imho | ||||
long max=strtol(m_GuiVec[num]->m_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("Number",(int)num); | ||||
m_GUICH->Set("Value",(float)val); | m_GUICH->Set("Value",(float)val); | ||||
m_GUICH->Set("Min",(float)min); | m_GUICH->Set("Min",(float)min); | ||||
@@ -37,19 +37,6 @@ cb_context(NULL) | |||||
m_SliderHidden=true; | m_SliderHidden=true; | ||||
m_VolVal=255; | 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) | int Fl_MatrixButton::handle(int event) | ||||
{ | { | ||||
@@ -63,6 +50,8 @@ int Fl_MatrixButton::handle(int event) | |||||
m_Volume->maximum(255); | m_Volume->maximum(255); | ||||
m_Volume->step(1); | m_Volume->step(1); | ||||
m_Volume->value(255-m_VolVal); | m_Volume->value(255-m_VolVal); | ||||
m_Volume->user_data((void*)this); | |||||
m_Volume->callback((Fl_Callback*)cb_Vol); | |||||
m_Volume->show(); | m_Volume->show(); | ||||
parent()->add(m_Volume); | parent()->add(m_Volume); | ||||
parent()->redraw(); | parent()->redraw(); | ||||
@@ -71,7 +60,7 @@ int Fl_MatrixButton::handle(int event) | |||||
else | else | ||||
{ | { | ||||
m_Volume->hide(); | m_Volume->hide(); | ||||
m_VolVal=m_Volume->value(); | |||||
m_VolVal=255-m_Volume->value(); | |||||
parent()->remove(m_Volume); | parent()->remove(m_Volume); | ||||
parent()->redraw(); | parent()->redraw(); | ||||
m_Volume=NULL; | m_Volume=NULL; | ||||
@@ -81,11 +70,33 @@ int Fl_MatrixButton::handle(int event) | |||||
return 1; | 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); | if (Fl::event_button()!=3) return Fl_Button::handle(event); | ||||
return 1; | 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) : | MatrixPluginGUI::MatrixPluginGUI(int w, int h,MatrixPlugin *o,ChannelHandler *ch,const HostInfo *Info) : | ||||
@@ -39,7 +39,6 @@ public: | |||||
Fl_MatrixButton(int x, int y, int w, int h, char* n); | Fl_MatrixButton(int x, int y, int w, int h, char* n); | ||||
~Fl_MatrixButton() {} | ~Fl_MatrixButton() {} | ||||
virtual void draw(); | |||||
virtual int handle(int event); | virtual int handle(int event); | ||||
float GetVolume() { return m_VolVal/255.0f; } | float GetVolume() { return m_VolVal/255.0f; } | ||||
@@ -58,6 +57,10 @@ private: | |||||
void (*cb_VolChange)(Fl_Widget*, void*); | void (*cb_VolChange)(Fl_Widget*, void*); | ||||
void *cb_context; | 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 | class MatrixPluginGUI : public SpiralPluginGUI | ||||
@@ -80,6 +80,7 @@ SpiralPluginGUI(w,h,o,ch) | |||||
m_DeviceNum = new Fl_Counter(20,30,40,20,"Channel"); | m_DeviceNum = new Fl_Counter(20,30,40,20,"Channel"); | ||||
m_DeviceNum->type(FL_SIMPLE_COUNTER); | m_DeviceNum->type(FL_SIMPLE_COUNTER); | ||||
m_DeviceNum->step(1); | m_DeviceNum->step(1); | ||||
m_DeviceNum->value(1); | |||||
m_DeviceNum->callback((Fl_Callback*)cb_DeviceNum, NULL); | m_DeviceNum->callback((Fl_Callback*)cb_DeviceNum, NULL); | ||||
m_NoteCut = new Fl_Button(5,70,75,20,"Note Cut"); | m_NoteCut = new Fl_Button(5,70,75,20,"Note Cut"); | ||||
@@ -109,7 +110,12 @@ void MidiPluginGUI::UpdateValues(SpiralPlugin *o) | |||||
//// Callbacks //// | //// Callbacks //// | ||||
inline void MidiPluginGUI::cb_DeviceNum_i(Fl_Counter* o, void* v) | 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) | void MidiPluginGUI::cb_DeviceNum(Fl_Counter* o, void* v) | ||||
{ ((MidiPluginGUI*)(o->parent()))->cb_DeviceNum_i(o,v);} | { ((MidiPluginGUI*)(o->parent()))->cb_DeviceNum_i(o,v);} | ||||
@@ -115,16 +115,18 @@ void Fl_WaveDisplay::draw() | |||||
Value = NextValue; | Value = NextValue; | ||||
// get max | // get max | ||||
NextValue=(*m_Sample)[n]; | |||||
float max=(*m_Sample)[n]; | |||||
float min=(*m_Sample)[n]; | |||||
for (int m=n; m<n+Jump; m++) | for (int m=n; m<n+Jump; m++) | ||||
{ | { | ||||
if (NextValue<(*m_Sample)[m]) NextValue=(*m_Sample)[m]; | |||||
if (max<(*m_Sample)[m]) max=(*m_Sample)[m]; | |||||
if (min>(*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++; | pos++; | ||||
} | } | ||||
} | } | ||||
@@ -386,11 +388,11 @@ m_UpdateMe(false) | |||||
m_ZoomIn = new Fl_Button(bx+(n++*bs),by,bw,bh,"Zoom +"); | m_ZoomIn = new Fl_Button(bx+(n++*bs),by,bw,bh,"Zoom +"); | ||||
m_ZoomIn->labelsize(10); | 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 = new Fl_Button(bx+(n++*bs),by,bw,bh,"Zoom -"); | ||||
m_ZoomOut->labelsize(10); | m_ZoomOut->labelsize(10); | ||||
m_ZoomOut->callback((Fl_Callback*)cb_ZoomOut); | |||||
//m_ZoomOut->callback((Fl_Callback*)cb_ZoomOut); | |||||
end(); | end(); | ||||
@@ -417,6 +419,9 @@ void PoshSamplerPluginGUI::Update() | |||||
{ | { | ||||
SetPlayPos(m_GUICH->GetLong("PlayPos")); | SetPlayPos(m_GUICH->GetLong("PlayPos")); | ||||
if (m_ZoomIn->value()) m_Display->ZoomIn(); | |||||
if (m_ZoomOut->value()) m_Display->ZoomOut(); | |||||
if (m_UpdateMe) | if (m_UpdateMe) | ||||
{ | { | ||||
UpdateSampleDisplay((int)m_SampleNum->value()); | UpdateSampleDisplay((int)m_SampleNum->value()); | ||||
@@ -82,6 +82,11 @@ void ScopePluginGUI::Display(const float *data) | |||||
if (!m_Bypass) m_Scope->redraw(); | if (!m_Bypass) m_Scope->redraw(); | ||||
} | } | ||||
void ScopePluginGUI::Update() | |||||
{ | |||||
redraw(); | |||||
} | |||||
void ScopePluginGUI::draw() | void ScopePluginGUI::draw() | ||||
{ | { | ||||
SpiralGUIType::draw(); | SpiralGUIType::draw(); | ||||
@@ -54,7 +54,8 @@ public: | |||||
ScopePluginGUI(int w, int h, SpiralPlugin *o, ChannelHandler *ch, const HostInfo *Info); | ScopePluginGUI(int w, int h, SpiralPlugin *o, ChannelHandler *ch, const HostInfo *Info); | ||||
virtual void UpdateValues(SpiralPlugin* o); | virtual void UpdateValues(SpiralPlugin* o); | ||||
virtual void draw(); | |||||
virtual void Update(); | |||||
virtual void draw(); | |||||
void Display(const float *data); | void Display(const float *data); | ||||
private: | private: | ||||
@@ -40,6 +40,7 @@ | |||||
#include "GUI/Widgets/PawfalYesNo.h" | #include "GUI/Widgets/PawfalYesNo.h" | ||||
//#define DEBUG_PLUGINS | //#define DEBUG_PLUGINS | ||||
#define DEBUG_STREAM | |||||
const static string LABEL = "SpiralSynthModular "+VER_STRING; | const static string LABEL = "SpiralSynthModular "+VER_STRING; | ||||
static string TITLEBAR; | static string TITLEBAR; | ||||
@@ -687,7 +688,7 @@ istream &operator>>(istream &s, SynthModular &o) | |||||
{ | { | ||||
o.PauseAudio(); | o.PauseAudio(); | ||||
string dummy; | |||||
string dummy,dummy2; | |||||
int ver; | int ver; | ||||
s>>dummy>>dummy>>dummy>>ver; | s>>dummy>>dummy>>dummy>>ver; | ||||
@@ -714,13 +715,20 @@ istream &operator>>(istream &s, SynthModular &o) | |||||
for(int n=0; n<Num; n++) | for(int n=0; n<Num; n++) | ||||
{ | { | ||||
//cerr<<"Loading Device "<<n<<endl; | |||||
#ifdef DEBUG_STREAM | |||||
cerr<<"Loading Device "<<n<<endl; | |||||
#endif | |||||
s>>dummy; //cerr<<dummy<<" "; | |||||
s>>ID; //cerr<<ID<<" "; | |||||
s>>dummy; //cerr<<dummy<<" "; | |||||
s>>PluginID; //cerr<<PluginID<<endl; | |||||
s>>dummy; | |||||
s>>ID; | |||||
s>>dummy2; | |||||
s>>PluginID; | |||||
s>>x>>y; | s>>x>>y; | ||||
#ifdef DEBUG_STREAM | |||||
cerr<<dummy<<" "<<ID<<" "<<dummy2<<" "<<PluginID<<" "<<x<<" "<<y<<endl; | |||||
#endif | |||||
if (ver>1) s>>ps>>px>>py; | if (ver>1) s>>ps>>px>>py; | ||||
// Check we're not duplicating an ID | // Check we're not duplicating an ID | ||||