@@ -16,7 +16,7 @@ | |||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |||
*/ | |||
#include "Fl/fl_draw.H" | |||
#include "FL/fl_draw.H" | |||
#include "Fl_Canvas.h" | |||
#include "Fl_DeviceGUI.h" | |||
#include <iostream> | |||
@@ -36,10 +36,10 @@ cb_AddDevice(NULL), | |||
m_ToolMenu(false), | |||
m_UpdateTimer(0) | |||
{ | |||
m_IncompleteWire.OutputChild=-1; | |||
m_IncompleteWire.OutputID=-1; | |||
m_IncompleteWire.OutputPort=-1; | |||
m_IncompleteWire.OutputTerminal=false; | |||
m_IncompleteWire.InputChild=-1; | |||
m_IncompleteWire.InputID=-1; | |||
m_IncompleteWire.InputPort=-1; | |||
m_IncompleteWire.InputTerminal=false; | |||
@@ -183,17 +183,9 @@ void Fl_Canvas::DrawWires() | |||
{ | |||
for(vector<CanvasWire>::iterator i=m_WireVec.begin(); | |||
i!=m_WireVec.end(); i++) | |||
{ | |||
if (i->OutputChild>children() || i->InputChild>children()) | |||
{ | |||
cerr<<"wire output child = "<<i->OutputChild<<endl; | |||
cerr<<"wire input child = "<<i->InputChild<<endl; | |||
SpiralInfo::Alert("Wire drawing mismatch!"); | |||
return; | |||
} | |||
Fl_DeviceGUI* SourceDevice = (Fl_DeviceGUI*)(child(i->OutputChild)); | |||
Fl_DeviceGUI* DestDevice = (Fl_DeviceGUI*)(child(i->InputChild)); | |||
{ | |||
Fl_DeviceGUI* SourceDevice = FindDevice(i->OutputID); | |||
Fl_DeviceGUI* DestDevice = FindDevice(i->InputID); | |||
if (!SourceDevice || !DestDevice) | |||
{ | |||
@@ -225,7 +217,7 @@ void Fl_Canvas::DrawWires() | |||
bool Fl_Canvas::UserMakingConnection() | |||
{ | |||
return (m_IncompleteWire.InputChild!=-1 || m_IncompleteWire.OutputChild!=-1); | |||
return (m_IncompleteWire.InputID!=-1 || m_IncompleteWire.OutputID!=-1); | |||
} | |||
//////////////////////////////////////////////////////////////////////// | |||
@@ -233,9 +225,9 @@ bool Fl_Canvas::UserMakingConnection() | |||
void Fl_Canvas::DrawIncompleteWire() | |||
{ | |||
// draw the wire we are currently connecting | |||
if(m_IncompleteWire.InputChild!=-1) | |||
if(m_IncompleteWire.InputID!=-1) | |||
{ | |||
Fl_DeviceGUI* Device = (Fl_DeviceGUI*)(child(m_IncompleteWire.InputChild)); | |||
Fl_DeviceGUI* Device = FindDevice(m_IncompleteWire.InputID); | |||
if (!Device) | |||
{ | |||
@@ -261,9 +253,9 @@ void Fl_Canvas::DrawIncompleteWire() | |||
Fl::event_y()); | |||
} | |||
if(m_IncompleteWire.OutputChild!=-1) | |||
if(m_IncompleteWire.OutputID!=-1) | |||
{ | |||
Fl_DeviceGUI* Device = (Fl_DeviceGUI*)(child(m_IncompleteWire.OutputChild)); | |||
Fl_DeviceGUI* Device = FindDevice(m_IncompleteWire.OutputID); | |||
if (!Device) | |||
{ | |||
@@ -295,15 +287,14 @@ void Fl_Canvas::DrawIncompleteWire() | |||
void Fl_Canvas::ClearIncompleteWire() | |||
{ | |||
// Turn off both ports | |||
if (m_IncompleteWire.OutputChild!=-1) | |||
if (m_IncompleteWire.OutputID!=-1) | |||
{ | |||
((Fl_DeviceGUI*)(child(m_IncompleteWire.OutputChild)))->RemoveConnection(m_IncompleteWire.OutputPort+ | |||
((Fl_DeviceGUI*)(child(m_IncompleteWire.OutputChild)))->GetInfo()->NumInputs); | |||
FindDevice(m_IncompleteWire.OutputID)->RemoveConnection(m_IncompleteWire.OutputPort+FindDevice(m_IncompleteWire.OutputID)->GetInfo()->NumInputs); | |||
} | |||
if (m_IncompleteWire.InputChild!=-1) | |||
if (m_IncompleteWire.InputID!=-1) | |||
{ | |||
((Fl_DeviceGUI*)(child(m_IncompleteWire.InputChild)))->RemoveConnection(m_IncompleteWire.InputPort); | |||
FindDevice(m_IncompleteWire.InputID)->RemoveConnection(m_IncompleteWire.InputPort); | |||
} | |||
m_IncompleteWire.Clear(); | |||
} | |||
@@ -313,11 +304,21 @@ void Fl_Canvas::ClearIncompleteWire() | |||
int Fl_Canvas::handle(int event) | |||
{ | |||
if (Fl_Group::handle(event)) return 1; | |||
if (event==FL_PUSH) | |||
{ | |||
ClearIncompleteWire(); | |||
redraw(); | |||
m_DragX=Fl::event_x(); | |||
m_DragY=Fl::event_y(); | |||
} | |||
if (Fl::event_button()==1 && event==FL_DRAG) | |||
{ | |||
position(x()+(Fl::event_x()-m_DragX),y()+(Fl::event_y()-m_DragY)); | |||
m_DragX=Fl::event_x(); | |||
m_DragY=Fl::event_y(); | |||
redraw(); | |||
} | |||
if (Fl::event_button()==3) | |||
@@ -349,37 +350,20 @@ int Fl_Canvas::handle(int event) | |||
return 1; | |||
} | |||
//////////////////////////////////////////////////////////////////////// | |||
void Fl_Canvas::PortClicked(Fl_DeviceGUI* Device, int Type, int Port, bool Value) | |||
{ | |||
// find out which child this comes from. | |||
int ChildNum=-1; | |||
for(int n=0; n<children(); n++) | |||
{ | |||
if(child(n)==Device) | |||
{ | |||
ChildNum=n; | |||
} | |||
} | |||
if (ChildNum==-1) | |||
{ | |||
SpiralInfo::Alert("Port clicked callback can't find source child."); | |||
return; | |||
} | |||
if(Value) // Turned on the port | |||
{ | |||
if(m_IncompleteWire.InputChild==-1 || m_IncompleteWire.OutputChild==-1) | |||
if(m_IncompleteWire.InputID==-1 || m_IncompleteWire.OutputID==-1) | |||
{ | |||
if (Type==Fl_DeviceGUI::OUTPUT) | |||
{ | |||
// make sure we don't make a output->output connection | |||
if (m_IncompleteWire.OutputChild==-1) | |||
if (m_IncompleteWire.OutputID==-1) | |||
{ | |||
m_IncompleteWire.OutputChild=ChildNum; | |||
m_IncompleteWire.OutputPort=Port; | |||
m_IncompleteWire.OutputID=Device->GetID(); | |||
m_IncompleteWire.OutputTerminal=Device->IsTerminal(); | |||
@@ -392,9 +376,8 @@ void Fl_Canvas::PortClicked(Fl_DeviceGUI* Device, int Type, int Port, bool Value | |||
else | |||
{ | |||
// make sure we don't make a input->input connection | |||
if (m_IncompleteWire.InputChild==-1) | |||
if (m_IncompleteWire.InputID==-1) | |||
{ | |||
m_IncompleteWire.InputChild=ChildNum; | |||
m_IncompleteWire.InputPort=Port; | |||
m_IncompleteWire.InputID=Device->GetID(); | |||
m_IncompleteWire.InputTerminal=Device->IsTerminal(); | |||
@@ -406,7 +389,7 @@ void Fl_Canvas::PortClicked(Fl_DeviceGUI* Device, int Type, int Port, bool Value | |||
} | |||
// if both have now been set... | |||
if (m_IncompleteWire.InputChild!=-1 && m_IncompleteWire.OutputChild!=-1) | |||
if (m_IncompleteWire.InputID!=-1 && m_IncompleteWire.OutputID!=-1) | |||
{ | |||
m_WireVec.push_back(m_IncompleteWire); | |||
@@ -416,13 +399,12 @@ void Fl_Canvas::PortClicked(Fl_DeviceGUI* Device, int Type, int Port, bool Value | |||
m_IncompleteWire.InputID,m_IncompleteWire.InputTerminal); | |||
// Turn on both ports | |||
Fl_DeviceGUI* ODGUI = (Fl_DeviceGUI*)(child(m_IncompleteWire.OutputChild)); | |||
Fl_DeviceGUI* ODGUI = FindDevice(m_IncompleteWire.OutputID); | |||
ODGUI->AddConnection(m_IncompleteWire.OutputPort+ODGUI->GetInfo()->NumInputs); | |||
Fl_DeviceGUI* IDGUI = (Fl_DeviceGUI*)(child(m_IncompleteWire.InputChild)); | |||
Fl_DeviceGUI* IDGUI = FindDevice(m_IncompleteWire.InputID); | |||
IDGUI->AddConnection(m_IncompleteWire.InputPort); | |||
m_IncompleteWire.Clear(); | |||
redraw(); | |||
@@ -441,14 +423,14 @@ void Fl_Canvas::PortClicked(Fl_DeviceGUI* Device, int Type, int Port, bool Value | |||
for(vector<CanvasWire>::iterator i=m_WireVec.begin(); | |||
i!=m_WireVec.end(); i++) | |||
{ | |||
if ((Type==Fl_DeviceGUI::OUTPUT && i->OutputChild==ChildNum && i->OutputPort==Port) || | |||
(Type==Fl_DeviceGUI::INPUT && i->InputChild==ChildNum && i->InputPort==Port)) | |||
if ((Type==Fl_DeviceGUI::OUTPUT && i->OutputID==Device->GetID() && i->OutputPort==Port) || | |||
(Type==Fl_DeviceGUI::INPUT && i->InputID==Device->GetID() && i->InputPort==Port)) | |||
{ | |||
// Turn off both ports | |||
Fl_DeviceGUI* ODGUI = (Fl_DeviceGUI*)(child(i->OutputChild)); | |||
Fl_DeviceGUI* ODGUI = FindDevice(i->OutputID); | |||
ODGUI->RemoveConnection(i->OutputPort+ODGUI->GetInfo()->NumInputs); | |||
Fl_DeviceGUI* IDGUI = (Fl_DeviceGUI*)(child(i->InputChild)); | |||
Fl_DeviceGUI* IDGUI = FindDevice(i->InputID); | |||
IDGUI->RemoveConnection(i->InputPort); | |||
// send the unconnect callback | |||
@@ -475,22 +457,6 @@ void Fl_Canvas::PortClicked(Fl_DeviceGUI* Device, int Type, int Port, bool Value | |||
void Fl_Canvas::ClearConnections(Fl_DeviceGUI* Device) | |||
{ | |||
// find out which child this comes from. | |||
int ChildNum=-1; | |||
for(int n=0; n<children(); n++) | |||
{ | |||
if(child(n)==Device) | |||
{ | |||
ChildNum=n; | |||
} | |||
} | |||
if (ChildNum==-1) | |||
{ | |||
SpiralInfo::Alert("Clear connections callback can't find source child."); | |||
return; | |||
} | |||
bool removedall=false; | |||
while (!removedall) | |||
@@ -500,13 +466,12 @@ void Fl_Canvas::ClearConnections(Fl_DeviceGUI* Device) | |||
for (vector<CanvasWire>::iterator i=m_WireVec.begin(); | |||
i!=m_WireVec.end(); i++) | |||
{ | |||
if (i->OutputChild==ChildNum || | |||
i->InputChild==ChildNum) | |||
if (i->OutputID==Device->GetID() || | |||
i->InputID==Device->GetID()) | |||
{ | |||
// Turn off both ports | |||
((Fl_DeviceGUI*)(child(i->OutputChild)))->RemoveConnection(i->OutputPort+ | |||
((Fl_DeviceGUI*)(child(i->OutputChild)))->GetInfo()->NumInputs); | |||
((Fl_DeviceGUI*)(child(i->InputChild)))->RemoveConnection(i->InputPort); | |||
FindDevice(i->OutputID)->RemoveConnection(i->OutputPort+FindDevice(i->OutputID)->GetInfo()->NumInputs); | |||
FindDevice(i->InputID)->RemoveConnection(i->InputPort); | |||
// send the unconnect callback | |||
cb_Unconnect(this,(void*)&(*i)); | |||
@@ -524,32 +489,8 @@ void Fl_Canvas::ClearConnections(Fl_DeviceGUI* Device) | |||
void Fl_Canvas::RemoveDevice(Fl_DeviceGUI* Device) | |||
{ | |||
// find out which child this comes from. | |||
int ChildNum=-1; | |||
for(int n=0; n<children(); n++) | |||
{ | |||
if(child(n)==Device) | |||
{ | |||
ChildNum=n; | |||
} | |||
} | |||
if (ChildNum==-1) | |||
{ | |||
SpiralInfo::Alert("Remove device callback can't find source child."); | |||
return; | |||
} | |||
ClearConnections(Device); | |||
for (vector<CanvasWire>::iterator i=m_WireVec.begin(); | |||
i!=m_WireVec.end(); i++) | |||
{ | |||
if (i->OutputChild>ChildNum) i->OutputChild--; | |||
if (i->InputChild>ChildNum) i->InputChild--; | |||
} | |||
remove(child(ChildNum)); | |||
remove(Device); | |||
redraw(); | |||
} | |||
@@ -579,7 +520,82 @@ void Fl_Canvas::Rename(Fl_DeviceGUI* Device) | |||
} | |||
//////////////////////////////////////////////////////////////////////// | |||
Fl_DeviceGUI *Fl_Canvas::FindDevice(int ID) | |||
{ | |||
for(int n=0; n<children(); n++) | |||
{ | |||
if(((Fl_DeviceGUI*)child(n))->GetID()==ID) | |||
{ | |||
return (Fl_DeviceGUI*)child(n); | |||
} | |||
} | |||
return NULL; | |||
} | |||
///////////////////////////////////////////////////////////////////////// | |||
void Fl_Canvas::ToTop(Fl_DeviceGUI *o) | |||
{ | |||
if (children()<2) return; //no need to do anything | |||
// cast away the const :P | |||
Fl_Widget** a=(Fl_Widget**)array(); | |||
int p=find(o); | |||
if (p<0) | |||
{ | |||
cerr<<"ToTop couldn't find widget!"<<endl; | |||
return; | |||
} | |||
Fl_Widget *temp=a[0]; | |||
Fl_Widget *last=a[0]; | |||
for(int n=1; n<children(); n++) | |||
{ | |||
if (n>p) // after the widget in the list | |||
{ | |||
// move the widgets up | |||
a[n-1]=a[n]; | |||
} | |||
} | |||
a[children()-1]=o; // put the raised one at the top of the list | |||
} | |||
void Fl_Canvas::ToBot(Fl_DeviceGUI *o) | |||
{ | |||
if (children()<2) return; //no need to do anything | |||
// cast away the const :P | |||
Fl_Widget** a=(Fl_Widget**)array(); | |||
int p=find(o); | |||
if (p<0) | |||
{ | |||
cerr<<"ToBot couldn't find widget!"<<endl; | |||
return; | |||
} | |||
Fl_Widget *temp=a[0]; | |||
Fl_Widget *last=a[0]; | |||
for(int n=1; n<children(); n++) | |||
{ | |||
if (n<=p) // before the widget in the list | |||
{ | |||
// move the widgets down | |||
temp=a[n]; | |||
a[n]=last; | |||
last=temp; | |||
} | |||
} | |||
a[0]=o; // put the lowered one at the top of the list | |||
} | |||
///////////////////////////////////////////////////////////////////////// | |||
istream &operator>>(istream &s, Fl_Canvas &o) | |||
{ | |||
@@ -596,20 +612,21 @@ istream &operator>>(istream &s, Fl_Canvas &o) | |||
for(int n=0; n<NumWires; n++) | |||
{ | |||
CanvasWire NewWire; | |||
int dummy; | |||
s>>NewWire.OutputID; | |||
s>>NewWire.OutputChild; | |||
s>>dummy; | |||
s>>NewWire.OutputPort; | |||
s>>NewWire.OutputTerminal; | |||
s>>NewWire.InputID; | |||
s>>NewWire.InputChild; | |||
s>>dummy; | |||
s>>NewWire.InputPort; | |||
s>>NewWire.InputTerminal; | |||
// if we can turn on both ports | |||
if (((Fl_DeviceGUI*)(o.child(NewWire.OutputChild)))->AddConnection(NewWire.OutputPort+ | |||
((Fl_DeviceGUI*)(o.child(NewWire.OutputChild)))->GetInfo()->NumInputs) && | |||
((Fl_DeviceGUI*)(o.child(NewWire.InputChild)))->AddConnection(NewWire.InputPort)) | |||
if (o.FindDevice(NewWire.OutputID)->AddConnection(NewWire.OutputPort+ | |||
o.FindDevice(NewWire.OutputID)->GetInfo()->NumInputs) && | |||
o.FindDevice(NewWire.InputID)->AddConnection(NewWire.InputPort)) | |||
{ | |||
o.m_WireVec.push_back(NewWire); | |||
@@ -625,18 +642,19 @@ istream &operator>>(istream &s, Fl_Canvas &o) | |||
for(int n=0; n<NumWires; n++) | |||
{ | |||
CanvasWire NewWire; | |||
int dummy; | |||
s>>NewWire.OutputID; | |||
s>>NewWire.OutputChild; | |||
s>>dummy; | |||
s>>NewWire.OutputPort; | |||
s>>NewWire.InputID; | |||
s>>NewWire.InputChild; | |||
s>>dummy; | |||
s>>NewWire.InputPort; | |||
// if we can turn on both ports | |||
if (((Fl_DeviceGUI*)(o.child(NewWire.OutputChild)))->AddConnection(NewWire.OutputPort+ | |||
((Fl_DeviceGUI*)(o.child(NewWire.OutputChild)))->GetInfo()->NumInputs) && | |||
((Fl_DeviceGUI*)(o.child(NewWire.InputChild)))->AddConnection(NewWire.InputPort)) | |||
if (o.FindDevice(NewWire.OutputID)->AddConnection(NewWire.OutputPort+ | |||
o.FindDevice(NewWire.OutputID)->GetInfo()->NumInputs) && | |||
o.FindDevice(NewWire.InputID)->AddConnection(NewWire.InputPort)) | |||
{ | |||
o.m_WireVec.push_back(NewWire); | |||
@@ -662,11 +680,11 @@ ostream &operator<<(ostream &s, Fl_Canvas &o) | |||
i!=o.m_WireVec.end(); i++) | |||
{ | |||
s<<i->OutputID<<" "; | |||
s<<i->OutputChild<<" "; | |||
s<<0<<" "; | |||
s<<i->OutputPort<<" "; | |||
s<<i->OutputTerminal<<" "; | |||
s<<i->InputID<<" "; | |||
s<<i->InputChild<<" "; | |||
s<<0<<" "; | |||
s<<i->InputPort<<" "; | |||
s<<i->InputTerminal<<endl; | |||
} | |||
@@ -37,11 +37,9 @@ public: | |||
void Clear() | |||
{ | |||
OutputChild=-1; | |||
OutputPort=-1; | |||
OutputID=-1; | |||
OutputTerminal=false; | |||
InputChild=-1; | |||
InputPort=-1; | |||
InputID=-1; | |||
InputTerminal=false; | |||
@@ -49,11 +47,9 @@ public: | |||
} | |||
int OutputID; | |||
int OutputChild; | |||
int OutputPort; | |||
bool OutputTerminal; | |||
int InputID; | |||
int InputChild; | |||
int InputPort; | |||
bool InputTerminal; | |||
bool DelMe; | |||
@@ -84,13 +80,17 @@ public: | |||
void Poll(); | |||
void ToTop(Fl_DeviceGUI *o); | |||
void ToBot(Fl_DeviceGUI *o); | |||
private: | |||
void DrawWires(); | |||
void ClearIncompleteWire(); | |||
void DrawIncompleteWire(); | |||
bool UserMakingConnection(); | |||
Fl_DeviceGUI *FindDevice(int ID); | |||
Fl_Image *m_BG; | |||
char *m_BGData; | |||
@@ -108,6 +108,7 @@ private: | |||
GraphSort m_Graph; | |||
int m_UpdateTimer; | |||
int m_DragX,m_DragY; | |||
friend istream &operator>>(istream &s, Fl_Canvas &o); | |||
friend ostream &operator<<(ostream &s, Fl_Canvas &o); | |||
@@ -135,7 +135,7 @@ int Fl_DeviceGUI::handle(int event) | |||
m_IconButton->show(); | |||
} | |||
return t; | |||
return 1; | |||
} | |||
void Fl_DeviceGUI::Minimise() | |||
@@ -159,6 +159,7 @@ void Fl_DeviceGUI::Maximise() | |||
m_PluginWindow->show(); | |||
m_IconButton->hide(); | |||
((Fl_Canvas*)parent())->ToTop(this); | |||
} | |||
void Fl_DeviceGUI::Resize(int width, int height) | |||
@@ -173,7 +174,11 @@ void Fl_DeviceGUI::Resize(int width, int height) | |||
m_PortVec[n]->position(x()+width-8,m_PortVec[n]->y()); | |||
} | |||
position(x()+(oldw-w())/2,y()+(oldh-h())/2); | |||
position(x()+(oldw-w())/2,y()+(oldh-h())/2); | |||
int Centx=x()+w()/2; | |||
int Centy=y()+h()/2; | |||
m_IconButton->position(Centx-m_Icon->w()/2,Centy-m_Icon->h()/2); | |||
} | |||
void Fl_DeviceGUI::Setup(const DeviceGUIInfo& Info, bool FirstTime) | |||
@@ -26,6 +26,7 @@ bool Pawfal_Input(const char *a, const char *b, char *out) | |||
strcpy(out,pi.getText()); | |||
return true; | |||
} | |||
return false; | |||
} | |||
@@ -111,22 +111,22 @@ static char * SpiralIcon_xpm[] = { | |||
"). c #2D2F00", | |||
"!. c #111200", | |||
"~. c #0B0C00", | |||
"{. c #FFF200", | |||
"]. c #727175", | |||
"^. c #FEFEFF", | |||
"/. c #9D99AA", | |||
"(. c #DBD9E0", | |||
"_. c #E9E9E9", | |||
":. c #CBCBCB", | |||
"<. c #E0E0E0", | |||
"[. c #6C6C6C", | |||
"}. c #050500", | |||
"|. c #515151", | |||
"1. c #A6A6A7", | |||
"2. c #827E93", | |||
"3. c #615C77", | |||
"4. c #EAEAED", | |||
"5. c #DFDFE1", | |||
"{. c #727175", | |||
"]. c #FEFEFF", | |||
"^. c #9D99AA", | |||
"/. c #DBD9E0", | |||
"(. c #E9E9E9", | |||
"_. c #CBCBCB", | |||
":. c #E0E0E0", | |||
"<. c #6C6C6C", | |||
"[. c #050500", | |||
"}. c #515151", | |||
"|. c #A6A6A7", | |||
"1. c #827E93", | |||
"2. c #615C77", | |||
"3. c #EAEAED", | |||
"4. c #DFDFE1", | |||
"5. c #FFF200", | |||
"6. c #1E1D24", | |||
"7. c #9894A7", | |||
"8. c #B1AEBB", | |||
@@ -287,18 +287,18 @@ static char * SpiralIcon_xpm[] = { | |||
" t u ; v w 6 6 x y z A B 6 C ; D E 6 F G ; H ", | |||
" I J ; ; K L 6 6 M N O P E 6 6 6 Q Q M R S T U V W ", | |||
" X Y ; ; ; ; Z ` .6 ..6 6 6 6 6 +.@.#.$.%.&.*.=.-.;. ", | |||
" >.; ; ; ; ; ; = ,.'.).!.~.6 {.{.6 6 6 6 E ].^.; ; /. ", | |||
" (.; ; _.R h :.<.[.6 }.6 6 6 {.{.6 6 6 6 6 E |.1.4 2. ", | |||
" 3.4.; 5...6 6 6 6 6 6 6 6 6 6 {.{.6 6 6 6 6 6 6 6.7. ", | |||
" V @ 8.9.0.6 6 6 6 6 6 6 6 6 6 {.{.6 6 6 6 6 6 6 ", | |||
" a.b.c.6 d.6 6 6 6 6 6 6 {.{.6 {.{.6 6 6 6 6 6 e. ", | |||
" f.; ; g.h.h.i.j.h.6 6 6 6 {.6 6 6 {.{.6 6 6 6 6 6 ", | |||
" k.; ; l.m.; ; ; n.6 {.{.{.6 6 6 6 6 {.{.{.{.{.6 6 ", | |||
" o.; ; ; ; p.; ; q.6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 r., ", | |||
" s.; ; p.; : t.u.v.6 6 6 {.6 {.6 {.6 {.{.{.6 6 6 6 p.w.x. ", | |||
" y.; ; ; z.A.B.6 6 6 6 {.6 6 {.6 {.6 {.6 6 6 6 6 6 ; ; C.D. ", | |||
" E.J ; : F.6 6 6 6 G...6 {.6 {.6 {.6 {.{.{.6 6 6 H.I.; ; J.K. ", | |||
" L.; ; M.6 E 6 N.O.P.{.6 6 6 {.6 6 {.6 Q.6 6 6 6 R.S.; ; > K. ", | |||
" >.; ; ; ; ; ; = ,.'.).!.~.6 6 6 6 6 6 6 E {.].; ; ^. ", | |||
" /.; ; (.R h _.:.<.6 [.6 6 6 6 6 6 6 6 6 6 E }.|.4 1. ", | |||
" 2.3.; 4...6 6 6 6 6 6 6 6 6 5.5.6 6 6 6 6 6 6 6 6.7. ", | |||
" V @ 8.9.0.6 6 6 6 6 6 6 6 5.6 6 5.6 6 6 6 6 6 6 ", | |||
" a.b.c.6 d.6 6 6 6 5.5.5.6 6 6 5.6 6 6 6 6 6 6 e. ", | |||
" f.; ; g.h.h.i.j.h.6 6 6 6 6 6 6 6 5.6 6 6 6 6 6 6 ", | |||
" k.; ; l.m.; ; ; n.6 6 6 6 6 6 6 6 5.6 6 6 6 6 6 6 ", | |||
" o.; ; ; ; p.; ; q.6 6 6 6 6 6 6 6 5.6 6 6 6 6 6 6 r., ", | |||
" s.; ; p.; : t.u.v.6 6 6 6 6 6 6 6 6 5.6 6 6 6 6 6 p.w.x. ", | |||
" y.; ; ; z.A.B.6 6 6 6 6 6 6 6 6 6 6 5.5.6 6 6 6 6 ; ; C.D. ", | |||
" E.J ; : F.6 6 6 6 G...6 6 6 6 6 6 6 6 5.5.5.6 6 H.I.; ; J.K. ", | |||
" L.; ; M.6 E 6 N.O.P.6 6 6 6 6 6 6 6 6 Q.6 6 6 6 R.S.; ; > K. ", | |||
" T.; U.V.W.6 6 P.p.; X.Y.6 6 6 6 6 6 6 6 Z.`.6 6 6 +.+; ; ++@+ ", | |||
" K.#+! $+%+&+x ; ; *+=+-+;+l >+6 6 6 ,+'+)+!+6 6 6 ~+{+]+; ; ^+@ ", | |||
" /+(+_+:+<+[+; }+|+1+; I.>+6 6 E 2+; ; 3+6 6 E 6 o 4+; ; = 5+ ", | |||
@@ -111,27 +111,27 @@ static char * SpiralIcon_xpm[] = { | |||
"). c #2D2F00", | |||
"!. c #111200", | |||
"~. c #0B0C00", | |||
"{. c #FFF200", | |||
"]. c #727175", | |||
"^. c #FEFEFF", | |||
"/. c #9D99AA", | |||
"(. c #DBD9E0", | |||
"_. c #E9E9E9", | |||
":. c #CBCBCB", | |||
"<. c #E0E0E0", | |||
"[. c #6C6C6C", | |||
"}. c #050500", | |||
"|. c #515151", | |||
"1. c #A6A6A7", | |||
"2. c #827E93", | |||
"3. c #615C77", | |||
"4. c #EAEAED", | |||
"5. c #DFDFE1", | |||
"6. c #1E1D24", | |||
"7. c #9894A7", | |||
"8. c #B1AEBB", | |||
"9. c #69686F", | |||
"0. c #000001", | |||
"{. c #727175", | |||
"]. c #FEFEFF", | |||
"^. c #9D99AA", | |||
"/. c #DBD9E0", | |||
"(. c #E9E9E9", | |||
"_. c #CBCBCB", | |||
":. c #E0E0E0", | |||
"<. c #6C6C6C", | |||
"[. c #050500", | |||
"}. c #515151", | |||
"|. c #A6A6A7", | |||
"1. c #827E93", | |||
"2. c #615C77", | |||
"3. c #EAEAED", | |||
"4. c #DFDFE1", | |||
"5. c #1E1D24", | |||
"6. c #9894A7", | |||
"7. c #B1AEBB", | |||
"8. c #69686F", | |||
"9. c #000001", | |||
"0. c #FFF200", | |||
"a. c #615C76", | |||
"b. c #5F5A75", | |||
"c. c #413E4D", | |||
@@ -287,18 +287,18 @@ static char * SpiralIcon_xpm[] = { | |||
" t u ; v w 6 6 x y z A B 6 C ; D E 6 F G ; H ", | |||
" I J ; ; K L 6 6 M N O P E 6 6 6 Q Q M R S T U V W ", | |||
" X Y ; ; ; ; Z ` .6 ..6 6 6 6 6 +.@.#.$.%.&.*.=.-.;. ", | |||
" >.; ; ; ; ; ; = ,.'.).!.~.6 {.{.6 6 6 6 E ].^.; ; /. ", | |||
" (.; ; _.R h :.<.[.6 }.6 6 6 {.{.6 6 6 6 6 E |.1.4 2. ", | |||
" 3.4.; 5...6 6 6 6 6 6 6 6 6 6 {.{.6 6 6 6 6 6 6 6.7. ", | |||
" V @ 8.9.0.6 6 6 6 6 6 6 6 6 6 {.{.6 6 6 6 6 6 6 ", | |||
" a.b.c.6 d.6 6 6 6 6 6 6 {.{.6 {.{.6 6 6 6 6 6 e. ", | |||
" f.; ; g.h.h.i.j.h.6 6 6 6 {.6 6 6 {.{.6 6 6 6 6 6 ", | |||
" k.; ; l.m.; ; ; n.6 {.{.{.6 6 6 6 6 {.{.{.{.{.6 6 ", | |||
" o.; ; ; ; p.; ; q.6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 r., ", | |||
" s.; ; p.; : t.u.v.6 6 6 {.6 {.6 {.6 {.{.{.6 6 6 6 p.w.x. ", | |||
" y.; ; ; z.A.B.6 6 6 6 {.6 6 {.6 {.6 {.6 6 6 6 6 6 ; ; C.D. ", | |||
" E.J ; : F.6 6 6 6 G...6 {.6 {.6 {.6 {.{.{.6 6 6 H.I.; ; J.K. ", | |||
" L.; ; M.6 E 6 N.O.P.{.6 6 6 {.6 6 {.6 Q.6 6 6 6 R.S.; ; > K. ", | |||
" >.; ; ; ; ; ; = ,.'.).!.~.6 6 6 6 6 6 6 E {.].; ; ^. ", | |||
" /.; ; (.R h _.:.<.6 [.6 6 6 6 6 6 6 6 6 6 E }.|.4 1. ", | |||
" 2.3.; 4...6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 5.6. ", | |||
" V @ 7.8.9.6 6 6 6 6 6 6 0.0.0.6 6 0.0.0.6 6 6 6 ", | |||
" a.b.c.6 d.6 6 6 6 0.0.6 6 6 0.0.6 6 6 0.0.6 6 e. ", | |||
" f.; ; g.h.h.i.j.h.0.6 6 6 6 6 6 6 6 6 6 6 6 0.6 6 ", | |||
" k.; ; l.m.; ; ; n.6 0.6 6 6 6 6 6 6 6 6 6 0.6 6 6 ", | |||
" o.; ; ; ; p.; ; q.6 6 0.0.6 6 6 6 6 6 0.0.6 6 6 6 r., ", | |||
" s.; ; p.; : t.u.v.6 6 6 6 0.0.0.0.0.0.6 6 6 6 6 6 p.w.x. ", | |||
" y.; ; ; z.A.B.6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 ; ; C.D. ", | |||
" E.J ; : F.6 6 6 6 G...6 6 6 6 6 6 6 6 6 6 6 6 6 H.I.; ; J.K. ", | |||
" L.; ; M.6 E 6 N.O.P.6 6 6 6 6 6 6 6 6 Q.6 6 6 6 R.S.; ; > K. ", | |||
" T.; U.V.W.6 6 P.p.; X.Y.6 6 6 6 6 6 6 6 Z.`.6 6 6 +.+; ; ++@+ ", | |||
" K.#+! $+%+&+x ; ; *+=+-+;+l >+6 6 6 ,+'+)+!+6 6 6 ~+{+]+; ; ^+@ ", | |||
" /+(+_+:+<+[+; }+|+1+; I.>+6 6 E 2+; ; 3+6 6 E 6 o 4+; ; = 5+ ", | |||
@@ -55,6 +55,7 @@ m_Loop(true), | |||
m_NoteCut(false), | |||
m_Current(0), | |||
m_GUICurrent(0), | |||
m_CurPatSeq(0), | |||
m_CurrentNoteCV(0), | |||
m_CurrentTriggerCV(0), | |||
m_Triggered(false), | |||
@@ -63,10 +64,10 @@ m_CopyPattern(0), | |||
m_PatAdvance(false), | |||
m_PatReset(false) | |||
{ | |||
m_Version=3; | |||
m_Version=4; | |||
m_PluginInfo.Name="Matrix"; | |||
m_PluginInfo.Width=560; | |||
m_PluginInfo.Width=600; | |||
m_PluginInfo.Height=270; | |||
m_PluginInfo.NumInputs=5; | |||
m_PluginInfo.NumOutputs=19; | |||
@@ -113,6 +114,11 @@ m_PatReset(false) | |||
m_TriggerLevel[n]=0; | |||
} | |||
for (int n=0; n<NUM_PATSEQ; n++) | |||
{ | |||
m_PatSeq[n]=0; | |||
} | |||
m_AudioCH->Register("NoteCut",&m_NoteCut,ChannelHandler::INPUT); | |||
m_AudioCH->Register("Volume",&m_GUIArgs.Volume,ChannelHandler::INPUT); | |||
m_AudioCH->Register("Current",&m_GUICurrent,ChannelHandler::INPUT); | |||
@@ -124,6 +130,7 @@ m_PatReset(false) | |||
m_AudioCH->Register("Y",&m_GUIArgs.Y,ChannelHandler::INPUT); | |||
m_AudioCH->Register("Octave",&m_GUIArgs.Octave,ChannelHandler::INPUT); | |||
m_AudioCH->Register("Step",&m_Step,ChannelHandler::OUTPUT); | |||
m_AudioCH->Register("PatSeqStep",&m_CurPatSeq,ChannelHandler::OUTPUT); | |||
m_AudioCH->RegisterData("Matrix",ChannelHandler::OUTPUT_REQUEST,&m_Matrix,sizeof(m_Matrix)); | |||
} | |||
@@ -220,42 +227,12 @@ void MatrixPlugin::Execute() | |||
{ | |||
m_Step=-1; | |||
ExternalClockTriggered=true; | |||
m_CurPatSeq++; | |||
if (m_PatSeq[m_CurPatSeq]==-1 || m_CurPatSeq==NUM_PATSEQ) m_CurPatSeq=0; | |||
m_Current=m_PatSeq[m_CurPatSeq]; | |||
} | |||
} | |||
/* not yet... | |||
// external pattern advance | |||
if (GetInput(5,n)>0) | |||
{ | |||
if (!m_PatAdvance) | |||
{ | |||
m_Current++; | |||
if (m_Current==16) m_Current=0; | |||
m_PatAdvance=true; | |||
m_Step=-1; | |||
ExternalClockTriggered=true; | |||
} | |||
} | |||
else | |||
{ | |||
m_PatAdvance=false; | |||
} | |||
// external pattern reset | |||
if (GetInput(6,n)>0) | |||
{ | |||
if (!m_PatReset) | |||
{ | |||
m_Current=0; | |||
m_PatReset=true; | |||
m_Step=-1; | |||
ExternalClockTriggered=true; | |||
} | |||
} | |||
else | |||
{ | |||
m_PatReset=false; | |||
} | |||
*/ | |||
// An external clock pulse overrides the internal timing | |||
if ((!ExternalClock && m_Time>=m_StepTime*(1/m_Matrix[m_Current].Speed)) || | |||
(ExternalClock && ExternalClockTriggered)) | |||
@@ -263,11 +240,13 @@ void MatrixPlugin::Execute() | |||
m_Time=0; | |||
m_Step++; | |||
if (m_Step >= m_Matrix[m_Current].Length) | |||
{ | |||
SetOutput(18, n, 1); | |||
m_Step=0; | |||
m_CurPatSeq++; | |||
if (m_PatSeq[m_CurPatSeq]==-1 || m_CurPatSeq==NUM_PATSEQ) m_CurPatSeq=0; | |||
m_Current=m_PatSeq[m_CurPatSeq]; | |||
} | |||
// Reset the values | |||
@@ -284,7 +263,6 @@ void MatrixPlugin::Execute() | |||
{ | |||
if (m_Matrix[m_Current].Matrix[m_Step][i]) | |||
{ | |||
m_CurrentNoteCV=NoteTable[i+m_Matrix[m_Current].Octave*12]; | |||
m_CurrentTriggerCV=m_Matrix[m_Current].Volume[m_Step][i]; | |||
m_TriggerLevel[i]=m_Matrix[m_Current].Volume[m_Step][i]; | |||
@@ -344,6 +322,9 @@ void MatrixPlugin::ExecuteCommands() | |||
case SET_CURRENT : | |||
m_Current=m_GUIArgs.Num; | |||
break; | |||
case SET_PATSEQ : | |||
m_PatSeq[m_GUIArgs.Y]=m_GUIArgs.Num; | |||
break; | |||
} | |||
} | |||
} | |||
@@ -425,6 +406,12 @@ void MatrixPlugin::StreamOut(ostream &s) | |||
} | |||
s<<"-1 "; | |||
} | |||
s<<endl; | |||
for (int n=0; n<NUM_PATSEQ; n++) | |||
{ | |||
s<<m_PatSeq[n]<<" "; | |||
} | |||
} | |||
void MatrixPlugin::StreamIn(istream &s) | |||
@@ -472,6 +459,7 @@ void MatrixPlugin::StreamIn(istream &s) | |||
} break; | |||
case 3: | |||
case 4: | |||
{ | |||
s>>m_Current>>m_Time>>m_Step>>m_Loop>>m_NoteCut; | |||
@@ -495,6 +483,15 @@ void MatrixPlugin::StreamIn(istream &s) | |||
} | |||
} | |||
} | |||
if (version>3) | |||
{ | |||
for (int n=0; n<NUM_PATSEQ; n++) | |||
{ | |||
s>>m_PatSeq[n]; | |||
} | |||
} | |||
} break; | |||
} | |||
} |
@@ -25,6 +25,7 @@ | |||
static const int MATX = 64; | |||
static const int MATY = 32; | |||
static const int NUM_PATTERNS = 16; | |||
static const int NUM_PATSEQ = 16; | |||
struct Pattern | |||
{ | |||
@@ -52,9 +53,11 @@ public: | |||
int GetCurrent() { return m_Current; } | |||
float GetStepTime() { return m_StepTime; } | |||
Pattern* GetPattern() { return &m_Matrix[m_Current]; } | |||
int GetPatSeq(int n) { return m_PatSeq[n]; } | |||
enum GUICommands{NONE,MAT_LENGTH,MAT_SPEED,MAT_ACTIVATE,MAT_DEACTIVATE, | |||
MAT_OCTAVE,COPY,PASTE,CLEAR,TUP,TDOWN,MAT_VOLUME,SET_CURRENT}; | |||
MAT_OCTAVE,COPY,PASTE,CLEAR,TUP,TDOWN,MAT_VOLUME, | |||
SET_CURRENT,SET_PATSEQ}; | |||
struct GUIArgs | |||
{ | |||
@@ -89,6 +92,8 @@ private: | |||
int m_GUICurrent; | |||
Pattern m_Matrix[NUM_PATTERNS]; | |||
float m_TriggerLevel[MATY]; | |||
int m_PatSeq[NUM_PATSEQ]; | |||
int m_CurPatSeq; | |||
float m_CurrentNoteCV; | |||
float m_CurrentTriggerCV; | |||
@@ -101,7 +101,8 @@ void Fl_MatrixButton::cb_Vol(Fl_Slider* o, void* v) | |||
MatrixPluginGUI::MatrixPluginGUI(int w, int h,MatrixPlugin *o,ChannelHandler *ch,const HostInfo *Info) : | |||
SpiralPluginGUI(w,h,o,ch), | |||
m_LastLight(0) | |||
m_LastLight(0), | |||
m_LastPatSeqLight(0) | |||
{ | |||
//size_range(10,10); | |||
m_NoteCut = new Fl_Button (5, h-30, 85, 20,"NoteCut"); | |||
@@ -236,6 +237,28 @@ m_LastLight(0) | |||
add(m_Flash[x]); | |||
} | |||
xoff=560; | |||
yoff=40; | |||
int height=12,gap=2; | |||
Fl_Box *patseqlabel = new Fl_Box(xoff,yoff-15,30,10,"Pat Seq"); | |||
patseqlabel->labelsize(10); | |||
add(patseqlabel); | |||
for(int y=0; y<NUM_PATSEQ; y++) | |||
{ | |||
m_PatSeq[y]= new Fl_Counter(xoff,yoff+y*(height+gap),25,height); | |||
m_PatSeq[y]->type(FL_SIMPLE_COUNTER); | |||
m_PatSeq[y]->step(1); | |||
m_PatSeq[y]->textsize(8); | |||
m_PatSeq[y]->callback((Fl_Callback*)cb_PatSeq,(void*)&Numbers[y]); | |||
add(m_PatSeq[y]); | |||
m_PatSeqFlash[y] = new Fl_LED_Button(xoff+25,yoff+y*(height+gap),15,15,""); | |||
m_PatSeqFlash[y]->selection_color(FL_WHITE); | |||
add(m_PatSeqFlash[y]); | |||
} | |||
end(); | |||
} | |||
@@ -247,6 +270,14 @@ void MatrixPluginGUI::Update() | |||
m_Flash[Light]->value(1); | |||
m_Flash[m_LastLight]->value(0); | |||
m_LastLight=Light; | |||
int PatSeqLight=m_GUICH->GetInt("PatSeqStep"); | |||
if (PatSeqLight!=m_LastPatSeqLight) | |||
{ | |||
m_PatSeqFlash[PatSeqLight]->value(1); | |||
m_PatSeqFlash[m_LastPatSeqLight]->value(0); | |||
m_LastPatSeqLight=PatSeqLight; | |||
} | |||
} | |||
} | |||
@@ -265,7 +296,12 @@ void MatrixPluginGUI::UpdateValues(SpiralPlugin *o) | |||
{ | |||
m_Matrix[x][y]->value(Plugin->GetPattern()->Matrix[x][y]); | |||
m_Matrix[x][y]->SetVolume(Plugin->GetPattern()->Volume[x][y]); | |||
} | |||
} | |||
for(int n=0; n<NUM_PATSEQ; n++) | |||
{ | |||
m_PatSeq[n]->value(Plugin->GetPatSeq(n)); | |||
} | |||
} | |||
void MatrixPluginGUI::UpdateMatrix() | |||
@@ -441,6 +477,17 @@ void MatrixPluginGUI::cb_TransDnBtn (Fl_Button* o, void* v) | |||
((MatrixPluginGUI*)(o->parent())) -> cb_TransDnBtn_i (o, v); | |||
} | |||
inline void MatrixPluginGUI::cb_PatSeq_i(Fl_Counter* o, void* v) | |||
{ | |||
if (o->value()<-1) o->value(-1); | |||
if (o->value()>NUM_PATTERNS-1) o->value(NUM_PATTERNS-1); | |||
m_GUICH->Set("Num",(int)o->value()); | |||
m_GUICH->Set("Y",*(int*)v); | |||
m_GUICH->SetCommand(MatrixPlugin::SET_PATSEQ); | |||
} | |||
void MatrixPluginGUI::cb_PatSeq(Fl_Counter* o, void* v) | |||
{ ((MatrixPluginGUI*)(o->parent()))->cb_PatSeq_i(o,v);} | |||
const string MatrixPluginGUI::GetHelpText(const string &loc){ | |||
return string("") | |||
+ "This is a matrix style step sequencer for techno purists. Great for\n" | |||
@@ -465,5 +512,10 @@ const string MatrixPluginGUI::GetHelpText(const string &loc){ | |||
+ "oscillator clock. To allow you to sync these matrixes, the matrix is\n" | |||
+ "provided with a Reset Trigger, which when plugged into the Play Trigger\n" | |||
+ "of another matrix, will synch the two so they start at the same clock\n" | |||
+ "pulse."; | |||
+ "pulse.\n\n" | |||
+ "On the right hand side of the matrix you will find the pattern sequencer\n" | |||
+ "this will advance each time a full pattern is played, and you can use it\n" | |||
+ "to select which pattern will be played next. There are a maximum of 16\n" | |||
+ "patterns to the sequence, but you can use less by setting a slot to -1\n" | |||
+ "this will cause the sequence to loop back to zero"; | |||
} |
@@ -81,6 +81,7 @@ private: | |||
int Numbers[MATX*MATY]; | |||
Pattern m_GUIMatrix[NUM_PATTERNS]; | |||
int m_LastLight; | |||
int m_LastPatSeqLight; | |||
Fl_Button* m_NoteCut; | |||
Fl_Counter* m_Pattern; | |||
@@ -97,6 +98,9 @@ private: | |||
Fl_Box* m_TransLbl; | |||
Fl_Button* m_TransUpBtn; | |||
Fl_Button* m_TransDnBtn; | |||
Fl_Counter* m_PatSeq[NUM_PATSEQ]; | |||
Fl_LED_Button* m_PatSeqFlash[NUM_PATSEQ]; | |||
//// Callbacks //// | |||
inline void cb_Matrix_i(Fl_Button* o, void* v); | |||
@@ -127,6 +131,8 @@ private: | |||
static void cb_TransUpBtn (Fl_Button* o, void* v); | |||
inline void cb_TransDnBtn_i (Fl_Button* o, void* v); | |||
static void cb_TransDnBtn (Fl_Button* o, void* v); | |||
inline void cb_PatSeq_i(Fl_Counter* o, void* v); | |||
static void cb_PatSeq(Fl_Counter* o, void* v); | |||
}; | |||
#endif |
@@ -69,10 +69,10 @@ SpiralPluginGUI(w,h,o,ch), | |||
m_Bypass(false) | |||
{ | |||
m_Scope = new ScopeWidget(5, 20, 210, 85, "Scope", Info->BUFSIZE); | |||
Bypass = new Fl_Button(175, 107, 40, 16, "Bypass"); | |||
/*Bypass = new Fl_Button(175, 107, 40, 16, "Bypass"); | |||
Bypass->labelsize(10); | |||
Bypass->type(1); | |||
Bypass->callback((Fl_Callback*)cb_Bypass); | |||
Bypass->callback((Fl_Callback*)cb_Bypass);*/ | |||
end(); | |||
} | |||
@@ -62,9 +62,6 @@ m_LoopPoint(0), | |||
m_Speed(1.0f), | |||
m_Volume(1.0f), | |||
m_RecordingSource(NULL), | |||
m_Balance(1.0f), | |||
m_LeftVol(1.0f), | |||
m_RightVol(1.0f), | |||
m_FirstRecord(true), | |||
m_FixedRecord(false), | |||
m_RecLength(0), | |||
@@ -225,14 +222,30 @@ void SpiralLoopPlugin::ExecuteCommands() | |||
void SpiralLoopPlugin::StreamOut(ostream &s) | |||
{ | |||
s<<m_Version; | |||
s<<m_LoopPoint<<" "<<m_Speed<<" "<<m_Volume<<" "<<m_TicksPerLoop<<" "; | |||
s<<m_TriggerVec.size()<<" "; | |||
for (vector<TriggerInfo>::iterator i=m_TriggerVec.begin(); | |||
i!=m_TriggerVec.end(); i++) | |||
{ | |||
s<<i->Channel<<" "<<i->Time<<" "; | |||
} | |||
} | |||
void SpiralLoopPlugin::StreamIn(istream &s) | |||
{ | |||
int version; | |||
s>>version; | |||
s>>m_LoopPoint>>m_Speed>>m_Volume>>m_TicksPerLoop; | |||
int size; | |||
s>>size; | |||
for (int n=0; n<size; n++) | |||
{ | |||
TriggerInfo t; | |||
s>>t.Channel>>t.Time; | |||
m_TriggerVec.push_back(t); | |||
} | |||
} | |||
bool SpiralLoopPlugin::SaveExternalFiles(const string &Dir) | |||
@@ -79,10 +79,8 @@ public: | |||
void SetRecordingSource(const float *s) { m_RecordingSource=s; } | |||
void Record(bool r) { m_Recording=r; if (!r) EndRecordBuf(); } | |||
void DelMe() { m_DelMe=true; } | |||
void SetBalance(float s) { m_Balance=s; m_LeftVol=(2-s)/2; m_RightVol=(1+s-1.0f)/2;} | |||
void Trigger() { m_Pos=0; SetPlaying(true); } | |||
const float GetBalance() {return m_Balance;} | |||
const bool IsPlaying() {return m_Playing;} | |||
const float *GetLoopPtr() {return m_StoreBuffer.GetBuffer();} | |||
const int GetId() {return m_Id;} | |||
@@ -91,8 +89,7 @@ public: | |||
const int GetTotalLength() {assert(m_StoreBuffer.GetLength()==m_DubBuffer.GetLength()); return m_StoreBuffer.GetLength();} | |||
const bool Delete() {return m_DelMe; } | |||
const float GetSpeed() {return m_Speed;} | |||
const float GetLeftVol() { return m_LeftVol; } | |||
const float GetRightVol() { return m_RightVol; } | |||
const float GetVolume() { return m_Volume; } | |||
const float GetCurrentAngle() { return m_LoopPoint?(m_Pos/m_LoopPoint)*360.0f:0; } | |||
const string& GetSampleName() { return m_Sample; } | |||
@@ -106,6 +103,8 @@ public: | |||
void Halve(); | |||
void SelectAll(); | |||
void Move(int Start); | |||
Sample *GetStoreBuffer() { return &m_StoreBuffer; } | |||
private: | |||
@@ -138,8 +137,6 @@ private: | |||
Sample m_RecBuffer; | |||
Sample m_CopyBuffer; | |||
int m_RecPos; | |||
float m_Balance; | |||
float m_LeftVol,m_RightVol; | |||
bool m_FirstRecord; | |||
bool m_FixedRecord; | |||
@@ -223,6 +223,13 @@ SpiralPluginGUI(w,h,o,ch) | |||
void SpiralLoopPluginGUI::UpdateValues(SpiralPlugin *o) | |||
{ | |||
SpiralLoopPlugin *Plugin=(SpiralLoopPlugin *)o; | |||
m_SampleSize=Plugin->GetStoreBuffer()->GetLength(); | |||
m_LoopGUI->SetData((float*)Plugin->GetStoreBuffer()->GetBuffer(),m_SampleSize); | |||
m_Volume->value(Plugin->GetVolume()); | |||
m_Speed->value(Plugin->GetSpeed()); | |||
m_Length->value(Plugin->GetLoopLength()/m_SampleSize); | |||
} | |||
void SpiralLoopPluginGUI::Update() | |||
@@ -79,13 +79,13 @@ inline void SpiralPluginGUI::cb_Help_i(Fl_Button* o, void* v) | |||
{ | |||
if (m_HelpWin==NULL) | |||
{ | |||
int w=330,h=200; | |||
int w=450,h=200; | |||
m_HelpWin = new Fl_Double_Window(w,h,"Help"); | |||
Fl_Text_Display* text = new Fl_Text_Display(0,0,10,10); | |||
text->buffer(new Fl_Text_Buffer); | |||
text->insert(GetHelpText(SpiralInfo::LOCALE).c_str()); | |||
text->textsize(10); | |||
text->textsize(12); | |||
m_HelpWin->add(text); | |||
m_HelpWin->resizable(text); | |||
m_HelpWin->show(); | |||
@@ -3,7 +3,7 @@ | |||
#ifndef Fl_Knob_H | |||
#define Fl_Knob_H | |||
#include <FL/Fl.H> | |||
#include <Fl/Fl_Valuator.H> | |||
#include <FL/Fl_Valuator.H> | |||
class Fl_Knob : public Fl_Valuator { | |||
public: | |||
@@ -1,7 +1,7 @@ | |||
// generated by Fast Light User Interface Designer (fluid) version 1.0100 | |||
#include "Fl_Knob.H" | |||
#include <Fl/fl_draw.H> | |||
#include <FL/fl_draw.H> | |||
#include <math.h> | |||
#include <iostream.h> | |||
@@ -95,7 +95,8 @@ void SpiralInfo::StreamOutPrefs(ostream &s) | |||
void SpiralInfo::Alert(string Text) | |||
{ | |||
fl_message(Text.c_str()); | |||
//fl_message(Text.c_str()); | |||
cerr<<"Spiral alert: "<<Text<<endl; | |||
} | |||
void SpiralInfo::Log(string Text) | |||
@@ -869,9 +869,11 @@ istream &operator>>(istream &s, SynthModular &o) | |||
temp->m_Device->SetUpdateInfoCallback(ID,o.cb_UpdatePluginInfo); | |||
o.m_DeviceWinMap[ID]=temp; | |||
o.m_DeviceWinMap[ID]->m_Device->StreamIn(s); // load the plugin | |||
// load external files | |||
o.m_DeviceWinMap[ID]->m_Device->LoadExternalFiles(o.m_FilePath+"_files/"); | |||
if (ver>1 && o.m_DeviceWinMap[ID]->m_DeviceGUI->GetPluginWindow()) | |||
{ | |||
{ | |||
// set the GUI up with the loaded values | |||
// looks messy, but if we do it here, the plugin and it's gui can remain | |||
// totally seperated. | |||
@@ -887,9 +889,6 @@ istream &operator>>(istream &s, SynthModular &o) | |||
if (ps) o.m_DeviceWinMap[ID]->m_DeviceGUI->Maximise(); | |||
else o.m_DeviceWinMap[ID]->m_DeviceGUI->Minimise(); | |||
// load external files | |||
o.m_DeviceWinMap[ID]->m_Device->LoadExternalFiles(o.m_FilePath+"_files/"); | |||
} | |||
if (o.m_NextID<=ID) o.m_NextID=ID+1; | |||