Browse Source

* New volume controls for individual matrix notes (rmb over note)

* ChannelHandler bulk transfer bug fix
* PoshSampler fixes
	Sample display fixes
	Zoom back in (on buttons)
* Delay mix bugfix
* Pwm on oscillator fix
* autogen.sh added
* Added initial files for the (incomplete) sequencer
master
nebogeo 22 years ago
parent
commit
c259990fac
18 changed files with 1581 additions and 88 deletions
  1. +23
    -21
      SpiralSound/ChannelHandler.C
  2. +1
    -1
      SpiralSound/Plugins/DelayPlugin/DelayPluginGUI.C
  3. +35
    -4
      SpiralSound/Plugins/MatrixPlugin/MatrixPlugin.C
  4. +3
    -1
      SpiralSound/Plugins/MatrixPlugin/MatrixPlugin.h
  5. +82
    -3
      SpiralSound/Plugins/MatrixPlugin/MatrixPluginGUI.C
  6. +30
    -1
      SpiralSound/Plugins/MatrixPlugin/MatrixPluginGUI.h
  7. +2
    -2
      SpiralSound/Plugins/OscillatorPlugin/OscillatorPluginGUI.C
  8. +60
    -36
      SpiralSound/Plugins/PoshSamplerPlugin/PoshSamplerPluginGUI.C
  9. +9
    -0
      SpiralSound/Plugins/PoshSamplerPlugin/PoshSamplerPluginGUI.h
  10. +199
    -0
      SpiralSound/Plugins/SequencerPlugin/Makefile.in
  11. +269
    -0
      SpiralSound/Plugins/SequencerPlugin/SequencerPlugin.C
  12. +100
    -0
      SpiralSound/Plugins/SequencerPlugin/SequencerPlugin.h
  13. +191
    -0
      SpiralSound/Plugins/SequencerPlugin/SequencerPluginGUI.C
  14. +86
    -0
      SpiralSound/Plugins/SequencerPlugin/SequencerPluginGUI.h
  15. +325
    -0
      SpiralSound/Plugins/SequencerPlugin/SpiralIcon.xpm
  16. +36
    -17
      SpiralSound/Plugins/Widgets/Fl_SEvent.C
  17. +7
    -2
      SpiralSound/Plugins/Widgets/Fl_SEvent.h
  18. +123
    -0
      autogen.sh

+ 23
- 21
SpiralSound/ChannelHandler.C View File

@@ -93,27 +93,30 @@ void ChannelHandler::UpdateDataNow()
// one off request type
case OUTPUT_REQUEST :
{
if (m_BulkPos!=-1 && m_BulkID==i->first)
if (m_BulkID==i->first)
{
// doing a bulk transfer
if (m_BulkPos+ch->size>m_BulkSize)
if (m_BulkPos!=-1)
{
// last transfer
#ifdef CHANNEL_DEBUG
cerr<<"memcpy (last) bulk output channel: ["<<i->first<<"]"<<endl;
#endif
memcpy(ch->data_buf,((char*)m_BulkSrc)+m_BulkPos,m_BulkSize-m_BulkPos);
m_BulkPos=-1;
}
else
{
#ifdef CHANNEL_DEBUG
cerr<<"memcpy bulk output channel: ["<<i->first<<"]"<<endl;
#endif
memcpy(ch->data_buf,((char*)m_BulkSrc)+m_BulkPos,ch->size);
m_BulkPos+=ch->size;
}
ch->updated=true;
// doing a bulk transfer
if (m_BulkPos+ch->size>m_BulkSize)
{
// last transfer
#ifdef CHANNEL_DEBUG
cerr<<"memcpy (last) bulk output channel: ["<<i->first<<"]"<<endl;
#endif
memcpy(ch->data_buf,((char*)m_BulkSrc)+m_BulkPos,m_BulkSize-m_BulkPos);
m_BulkPos=-1;
}
else
{
#ifdef CHANNEL_DEBUG
cerr<<"memcpy bulk output channel: ["<<i->first<<"]"<<endl;
#endif
memcpy(ch->data_buf,((char*)m_BulkSrc)+m_BulkPos,ch->size);
m_BulkPos+=ch->size;
}
ch->updated=true;
}
}
else
{
@@ -321,8 +324,7 @@ void ChannelHandler::BulkTransfer(const string &ID, void *dest, int size)
else
{
GetData(ID,((char*)dest)+pos);
}
}
pos+=buffersize;
}
}


+ 1
- 1
SpiralSound/Plugins/DelayPlugin/DelayPluginGUI.C View File

@@ -67,6 +67,6 @@ void DelayPluginGUI::cb_Delay(Fl_Slider* o, void* v)
{ ((DelayPluginGUI*)(o->parent()))->cb_Delay_i(o,v); }

inline void DelayPluginGUI::cb_Mix_i(Fl_Knob* o, void* v)
{ m_GUICH->Set("Mix",o->value()); }
{ m_GUICH->Set("Mix",(float)o->value()); }
void DelayPluginGUI::cb_Mix(Fl_Knob* o, void* v)
{ ((DelayPluginGUI*)(o->parent()))->cb_Mix_i(o,v); }

+ 35
- 4
SpiralSound/Plugins/MatrixPlugin/MatrixPlugin.C View File

@@ -55,7 +55,7 @@ m_Triggered(false),
m_ClockHigh(false),
m_CopyPattern(0)
{
m_Version=2;
m_Version=3;

m_PluginInfo.Name="Matrix";
m_PluginInfo.Width=555;
@@ -97,12 +97,14 @@ m_CopyPattern(0)
for (int y=0; y<MATY; y++)
{
m_Matrix[n].Matrix[x][y]=false;
m_Matrix[n].Volume[x][y]=1;
}
m_TriggerLevel[n]=0;
}
m_AudioCH->Register("NoteCut",&m_NoteCut,ChannelHandler::INPUT);
m_AudioCH->Register("Volume",&m_GUIArgs.Volume,ChannelHandler::INPUT);
m_AudioCH->Register("Current",&m_Current,ChannelHandler::INPUT);
m_AudioCH->Register("StepTime",&m_StepTime,ChannelHandler::INPUT);
m_AudioCH->Register("Num",&m_GUIArgs.Num,ChannelHandler::INPUT);
@@ -245,8 +247,8 @@ void MatrixPlugin::Execute()
{
m_CurrentNoteCV=NoteTable[i+m_Matrix[m_Current].Octave*12];
m_CurrentTriggerCV=1;
m_TriggerLevel[i]=1;
m_CurrentTriggerCV=m_Matrix[m_Current].Volume[m_Step][i];
m_TriggerLevel[i]=m_Matrix[m_Current].Volume[m_Step][i];
}
}
@@ -297,6 +299,9 @@ void MatrixPlugin::ExecuteCommands()
case TDOWN :
if (CanTransposeDown()) TransposeDown();
break;
case MAT_VOLUME :
m_Matrix[m_Current].Volume[m_GUIArgs.X][m_GUIArgs.Y]=m_GUIArgs.Volume;
break;
}
}
}
@@ -373,7 +378,7 @@ void MatrixPlugin::StreamOut(ostream &s)
{
for (int x=0; x<MATX; x++)
{
if (m_Matrix[n].Matrix[x][y]) s<<x<<" "<<y<<" ";
if (m_Matrix[n].Matrix[x][y]) s<<x<<" "<<y<<" "<<m_Matrix[n].Volume[x][y]<<" ";
}
}
s<<"-1 ";
@@ -423,5 +428,31 @@ void MatrixPlugin::StreamIn(istream &s)
}
}
} break;
case 3:
{
s>>m_Current>>m_Time>>m_Step>>m_Loop>>m_NoteCut;
for (int n=0; n<NUM_PATTERNS; n++)
{
s>>m_Matrix[n].Length>>m_Matrix[n].Speed>>m_Matrix[n].Octave;
int x=0,y=0;
float v;
while(x!=-1)
{
s>>x;
if (x!=-1)
{
s>>y>>v;
if (y!=-1)
{
m_Matrix[n].Matrix[x][y]=true;
m_Matrix[n].Volume[x][y]=v;
}
}
}
}
} break;
}
}

+ 3
- 1
SpiralSound/Plugins/MatrixPlugin/MatrixPlugin.h View File

@@ -31,6 +31,7 @@ struct Pattern
int Length;
float Speed;
int Octave;
float Volume[MATX][MATY];
bool Matrix[MATX][MATY];
};

@@ -53,7 +54,7 @@ public:
Pattern* GetPattern() { return &m_Matrix[m_Current]; }
enum GUICommands{NONE,MAT_LENGTH,MAT_SPEED,MAT_ACTIVATE,MAT_DEACTIVATE,
MAT_OCTAVE,COPY,PASTE,CLEAR,TUP,TDOWN};
MAT_OCTAVE,COPY,PASTE,CLEAR,TUP,TDOWN,MAT_VOLUME};
struct GUIArgs
{
@@ -62,6 +63,7 @@ public:
float Speed;
int X,Y;
int Octave;
float Volume;
};
private:


+ 82
- 3
SpiralSound/Plugins/MatrixPlugin/MatrixPluginGUI.C View File

@@ -25,6 +25,65 @@ static const int GUI_COLOUR = 179;
static const int GUIBG_COLOUR = 144;
static const int GUIBG2_COLOUR = 145;

////////////////////////////////////////////
Fl_MatrixButton::Fl_MatrixButton(int x, int y, int w, int h, char* n) :
Fl_Button(x,y,w,h,n),
m_Volume(NULL),
cb_VolChange(NULL),
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)
{
if (value()==true && event==FL_PUSH && Fl::event_button()==3)
{
if (m_SliderHidden)
{
m_Volume = new Fl_Slider(x(),y()+h(),w(),50,"");
m_Volume->type(4);
m_Volume->selection_color(GUI_COLOUR);
m_Volume->maximum(255);
m_Volume->step(1);
m_Volume->value(255-m_VolVal);
m_Volume->show();
parent()->add(m_Volume);
parent()->redraw();
m_SliderHidden=false;
}
else
{
m_Volume->hide();
m_VolVal=m_Volume->value();
parent()->remove(m_Volume);
parent()->redraw();
m_Volume=NULL;
m_SliderHidden=true;
}
return 1;
}
if (Fl::event_button()!=3) return Fl_Button::handle(event);
return 1;
}

////////////////////////////////////////////

MatrixPluginGUI::MatrixPluginGUI(int w, int h,MatrixPlugin *o,ChannelHandler *ch,const HostInfo *Info) :
@@ -115,17 +174,22 @@ SpiralPluginGUI(w,h,o,ch)
int butsize=7;
int n=0;
fl_color(150,150,150);
int markercol=fl_color();
for(int x=0; x<MATX; x++)
for(int y=0; y<MATY; y++)
{
Numbers[n]=n;
m_Matrix[x][y] = new Fl_Button(xoff+x*butsize,yoff+y*butsize,butsize+1,butsize+1,"");
m_Matrix[x][y] = new Fl_MatrixButton(xoff+x*butsize,yoff+y*butsize,butsize+1,butsize+1,"");
m_Matrix[x][y]->type(1);
m_Matrix[x][y]->box(FL_BORDER_BOX);
if ((x%8)==0) m_Matrix[x][y]->color(FL_WHITE);
if ((x%8)==0) m_Matrix[x][y]->color(markercol);
else m_Matrix[x][y]->color(FL_GRAY);
m_Matrix[x][y]->selection_color(FL_BLACK);
m_Matrix[x][y]->selection_color(FL_WHITE);
m_Matrix[x][y]->callback((Fl_Callback*)cb_Matrix,(void*)&Numbers[n]);
m_Matrix[x][y]->SetVolCallback((Fl_Callback*)cb_MatVol,(void*)&Numbers[n]);
add(m_Matrix[x][y]);
n++;
}
@@ -167,6 +231,7 @@ void MatrixPluginGUI::UpdateValues(SpiralPlugin *o)
for(int y=0; y<MATY; y++)
{
m_Matrix[x][y]->value(Plugin->GetPattern()->Matrix[x][y]);
m_Matrix[x][y]->SetVolume(Plugin->GetPattern()->Volume[x][y]);
}
//if (Plugin->CanTransposeUp()) m_TransUpBtn->activate(); else m_TransUpBtn->deactivate();
@@ -192,6 +257,7 @@ void MatrixPluginGUI::UpdateMatrix()
for(int y=0; y<MATY; y++)
{
m_Matrix[x][y]->value(m_GUIMatrix[(int)m_Pattern->value()].Matrix[x][y]);
m_Matrix[x][y]->SetVolume(m_GUIMatrix[(int)m_Pattern->value()].Volume[x][y]);
}

}
@@ -210,10 +276,22 @@ inline void MatrixPluginGUI::cb_Matrix_i(Fl_Button* o, void* v)

if (o->value()) m_GUICH->SetCommand(MatrixPlugin::MAT_ACTIVATE);
else m_GUICH->SetCommand(MatrixPlugin::MAT_DEACTIVATE);
m_GUICH->Wait();
}
void MatrixPluginGUI::cb_Matrix(Fl_Button* o, void* v)
{ ((MatrixPluginGUI*)(o->parent()))->cb_Matrix_i(o,v);}

inline void MatrixPluginGUI::cb_MatVol_i(Fl_Button* o, void* v)
{
m_GUICH->Set("X",*(int*)v/MATY);
m_GUICH->Set("Y",*(int*)v%MATY);
m_GUICH->Set("Volume",((Fl_MatrixButton*)o)->GetVolume());
m_GUICH->SetCommand(MatrixPlugin::MAT_VOLUME);
}
void MatrixPluginGUI::cb_MatVol(Fl_Button* o, void* v)
{ ((MatrixPluginGUI*)(o->parent()))->cb_MatVol_i(o,v);}

inline void MatrixPluginGUI::cb_Pattern_i(Fl_Counter* o, void* v)
{
if (o->value()<0) o->value(0);
@@ -276,6 +354,7 @@ inline void MatrixPluginGUI::cb_CopyBtn_i (Fl_Button* o, void* v)
{
m_PasteBtn->activate();
m_GUICH->SetCommand(MatrixPlugin::COPY);
UpdateMatrix();
}

void MatrixPluginGUI::cb_CopyBtn (Fl_Button* o, void* v)


+ 30
- 1
SpiralSound/Plugins/MatrixPlugin/MatrixPluginGUI.h View File

@@ -33,6 +33,33 @@
#ifndef MatrixGUI
#define MatrixGUI

class Fl_MatrixButton : public Fl_Button
{
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; }
void SetVolume(float s)
{
m_VolVal=s*255;
fl_color((char)m_VolVal,(char)m_VolVal,255);
selection_color(fl_color());
}
void SetVolCallback(Fl_Callback* s, void *c) { cb_VolChange=s; cb_context=c; }

private:
bool m_SliderHidden;
Fl_Slider *m_Volume;
float m_VolVal;
void (*cb_VolChange)(Fl_Widget*, void*);
void *cb_context;
};

class MatrixPluginGUI : public SpiralPluginGUI
{
public:
@@ -52,7 +79,7 @@ private:
Fl_Counter* m_Pattern;
Fl_Counter* m_Length;
Fl_Knob* m_Speed;
Fl_Button* m_Matrix[MATX][MATY];
Fl_MatrixButton* m_Matrix[MATX][MATY];
Fl_Counter* m_Octave;
Fl_Counter* m_SpeedVal;
Fl_LED_Button* m_Flash[MATX];
@@ -66,6 +93,8 @@ private:
//// Callbacks ////
inline void cb_Matrix_i(Fl_Button* o, void* v);
static void cb_Matrix(Fl_Button* o, void* v);
inline void cb_MatVol_i(Fl_Button* o, void* v);
static void cb_MatVol(Fl_Button* o, void* v);
inline void cb_Pattern_i(Fl_Counter* o, void* v);
static void cb_Pattern(Fl_Counter* o, void* v);
inline void cb_Length_i(Fl_Counter* o, void* v);


+ 2
- 2
SpiralSound/Plugins/OscillatorPlugin/OscillatorPluginGUI.C View File

@@ -302,8 +302,8 @@ void OscillatorPluginGUI::cb_FineTune(Fl_Knob* o, void* v)
inline void OscillatorPluginGUI::cb_PulseWidth_i(Fl_Slider* o, void* v)
{
char str[10];
m_GUICH->Set("PulseWidth",o->value());
sprintf(str,"%4.0f %%", 100*o->value());
m_GUICH->Set("PulseWidth",(float)o->value());
sprintf(str,"%4.0f %%",(float)(100*o->value()));
m_out_pulseW->value(str);
}


+ 60
- 36
SpiralSound/Plugins/PoshSamplerPlugin/PoshSamplerPluginGUI.C View File

@@ -114,14 +114,15 @@ void Fl_WaveDisplay::draw()
Value = NextValue;
// get average
NextValue=0;
// get max
NextValue=(*m_Sample)[n];
for (int m=n; m<n+Jump; m++)
{
NextValue+=(*m_Sample)[m];
if (NextValue<(*m_Sample)[m]) NextValue=(*m_Sample)[m];
}
NextValue=(NextValue*ho)/Jump;
NextValue*=ho;
fl_line(x()+pos-2, y()+ho-(int)Value,
x()+pos-1, y()+ho-(int)NextValue);
pos++;
@@ -233,38 +234,36 @@ int Fl_WaveDisplay::handle(int event)
redraw();
}
if (event==FL_KEYBOARD || event==FL_SHORTCUT)
{
if (Fl::event_key('+'))
{
int Zoom=(int)((m_ViewEnd-m_ViewStart)*0.03f);
if ((m_ViewEnd-m_ViewStart)/w()>1)
{
m_ViewStart+=Zoom;
m_ViewEnd-=Zoom;
}
redraw();
}
if (Fl::event_key('-'))
{
int Zoom=(int)((m_ViewEnd-m_ViewStart)*0.03f);
m_ViewStart-=Zoom;
m_ViewEnd+=Zoom;
redraw();
}
}
if (m_EndPos>=m_Sample->GetLength()) m_EndPos=m_Sample->GetLength()-1;
return 1;
}

void Fl_WaveDisplay::ZoomIn()
{
int Zoom=(int)((m_ViewEnd-m_ViewStart)*0.03f);
if ((m_ViewEnd-m_ViewStart)/w()>1)
{
m_ViewStart+=Zoom;
m_ViewEnd-=Zoom;
}
redraw();
}

void Fl_WaveDisplay::ZoomOut()
{
int Zoom=(int)((m_ViewEnd-m_ViewStart)*0.03f);
m_ViewStart-=Zoom;
m_ViewEnd+=Zoom;
redraw();
}

////////////////////////////////////////////

PoshSamplerPluginGUI::PoshSamplerPluginGUI(int w, int h,PoshSamplerPlugin *o,ChannelHandler *ch,const HostInfo *Info) :
SpiralPluginGUI(w,h,o,ch)
SpiralPluginGUI(w,h,o,ch),
m_UpdateMe(false)
{
int n=0;
@@ -354,7 +353,7 @@ SpiralPluginGUI(w,h,o,ch)
m_Display = new Fl_WaveDisplay(5,85,w-10,100,"");
m_Display->callback((Fl_Callback*)cb_WaveDisplay);
int bx=5,by=190,bw=w/7-2,bh=20,bs=w/7-2;
int bx=5,by=190,bw=w/9-2,bh=20,bs=w/9-2;
n=0;
m_Cut = new Fl_Button(bx+(n++*bs),by,bw,bh,"Cut");
@@ -385,6 +384,14 @@ SpiralPluginGUI(w,h,o,ch)
m_Amp->labelsize(10);
m_Amp->callback((Fl_Callback*)cb_Amp);

m_ZoomIn = new Fl_Button(bx+(n++*bs),by,bw,bh,"Zoom +");
m_ZoomIn->labelsize(10);
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);

end();
redraw();
@@ -396,11 +403,11 @@ void PoshSamplerPluginGUI::UpdateSampleDisplay(int num)
m_GUICH->Wait();
m_GUICH->RequestChannelAndWait("SampleSize");
long SampleSize=m_GUICH->GetLong("SampleSize");
if (SampleSize)
{
char *TempBuf = new char[SampleSize];
m_GUICH->BulkTransfer("SampleBuffer",(void*)TempBuf,SampleSize);
m_GUICH->BulkTransfer("SampleBuffer",(void*)TempBuf,SampleSize);
m_Display->SetSample((float*)TempBuf,SampleSize/sizeof(float));
delete[] TempBuf;
}
@@ -409,6 +416,13 @@ void PoshSamplerPluginGUI::UpdateSampleDisplay(int num)
void PoshSamplerPluginGUI::Update()
{
SetPlayPos(m_GUICH->GetLong("PlayPos"));
if (m_UpdateMe)
{
UpdateSampleDisplay((int)m_SampleNum->value());
m_Display->redraw();
m_UpdateMe=false;
}
redraw();
}

@@ -420,11 +434,7 @@ void PoshSamplerPluginGUI::UpdateValues(SpiralPlugin *o)
m_Pitch->value(Plugin->GetPitch((int)m_SampleNum->value()));
m_Note->value(Plugin->GetNote((int)m_SampleNum->value()));
m_Loop->value(Plugin->GetLoop((int)m_SampleNum->value()));
Sample *sample = Plugin->GetSample((int)m_SampleNum->value());
if (sample->GetLength())
{
m_Display->SetSample(sample->GetBuffer(),sample->GetLength());
}
m_UpdateMe=true;
m_Display->SetPlayStart(Plugin->GetPlayStart((int)m_SampleNum->value()));
m_Display->SetLoopStart(Plugin->GetLoopStart((int)m_SampleNum->value()));
m_Display->SetLoopEnd(Plugin->GetLoopEnd((int)m_SampleNum->value()));
@@ -646,3 +656,17 @@ inline void PoshSamplerPluginGUI::cb_WaveDisplay_i(Fl_WaveDisplay* o, void* v)
}
void PoshSamplerPluginGUI::cb_WaveDisplay(Fl_WaveDisplay* o, void* v)
{ ((PoshSamplerPluginGUI*)(o->parent()))->cb_WaveDisplay_i(o,v);}

inline void PoshSamplerPluginGUI::cb_ZoomIn_i(Fl_Button* o, void* v)
{
m_Display->ZoomIn();
}
void PoshSamplerPluginGUI::cb_ZoomIn(Fl_Button* o, void* v)
{ ((PoshSamplerPluginGUI*)(o->parent()))->cb_ZoomIn_i(o,v);}

inline void PoshSamplerPluginGUI::cb_ZoomOut_i(Fl_Button* o, void* v)
{
m_Display->ZoomOut();
}
void PoshSamplerPluginGUI::cb_ZoomOut(Fl_Button* o, void* v)
{ ((PoshSamplerPluginGUI*)(o->parent()))->cb_ZoomOut_i(o,v);}

+ 9
- 0
SpiralSound/Plugins/PoshSamplerPlugin/PoshSamplerPluginGUI.h View File

@@ -50,6 +50,8 @@ class Fl_WaveDisplay : public Fl_Widget
void SetLoopEnd(long s) { m_LoopEnd=s; }
long GetLoopEnd() { return m_LoopEnd; }
void SetPosMarker(bool s) { m_PosMarker=s; }
void ZoomIn();
void ZoomOut();
private:
@@ -85,6 +87,7 @@ private:

char m_TextBuf[256];
int Numbers[NUM_SAMPLES];
bool m_UpdateMe;
Fl_Button* m_Load;
Fl_Button* m_Save;
@@ -98,6 +101,8 @@ private:
Fl_Counter* m_Note;
Fl_WaveDisplay* m_Display;
Fl_Counter* m_SampleNum;
Fl_Button* m_ZoomIn;
Fl_Button* m_ZoomOut;
Fl_Button* m_Cut;
Fl_Button* m_Copy;
@@ -145,6 +150,10 @@ private:
static void cb_Reverse(Fl_Button* o, void* v);
inline void cb_Amp_i(Fl_Button* o, void* v);
static void cb_Amp(Fl_Button* o, void* v);
inline void cb_ZoomIn_i(Fl_Button* o, void* v);
static void cb_ZoomIn(Fl_Button* o, void* v);
inline void cb_ZoomOut_i(Fl_Button* o, void* v);
static void cb_ZoomOut(Fl_Button* o, void* v);
inline void cb_WaveDisplay_i(Fl_WaveDisplay* o, void* v);
static void cb_WaveDisplay(Fl_WaveDisplay* o, void* v);
};


+ 199
- 0
SpiralSound/Plugins/SequencerPlugin/Makefile.in View File

@@ -0,0 +1,199 @@
#############################################################################
# Makefile for building SequencerPlugin.so
# Generated by tmake at 22:13, 2001/09/17
# Project: SequencerPlugin
# Template: app
#############################################################################

####### Compiler, tools and options

CC = gcc
CXX = g++
CFLAGS = @CFLAGS@
CXXFLAGS= @CXXFLAGS@
INCPATH = -I/usr/X11R6/include
LINK = g++ -shared
LFLAGS =
LIBS = -L/usr/X11R6/lib -lfltk -lGL -lXext -lX11 -lm -ldl
MOC = moc
UIC =

TAR = tar -cf
GZIP = gzip -9f

INSTALL = @INSTALL@

###### Autoconf variables

prefix = @prefix@
exec_prefix = @exec_prefix@

bindir = @bindir@
sbindir = @sbindir@
libexecdir = @libexecdir@
datadir = @datadir@
sysconfdir = @sysconfdir@
sharedstatedir = @sharedstatedir@
localstatedir = @localstatedir@
libdir = @libdir@
infodir = @infodir@
mandir = @mandir@

####### Files

HEADERS = ../SpiralPlugin.h \
../SpiralPluginGUI.h \
../../ChannelHandler.h \
../Widgets/Fl_Knob.H \
../Widgets/Fl_DragBar.H \
../Widgets/Fl_EventMap.h \
../Widgets/Fl_SEvent.h \
../../Sample.h \
../../RiffWav.h \
SequencerPlugin.h \
SequencerPluginGUI.h
SOURCES = ../SpiralPlugin.C \
../SpiralPluginGUI.C \
../../ChannelHandler.C \
../Widgets/Fl_Knob.cxx \
../Widgets/Fl_DragBar.cxx \
../Widgets/Fl_EventMap.C \
../Widgets/Fl_SEvent.C \
../../Sample.C \
../../RiffWav.C \
SequencerPlugin.C \
SequencerPluginGUI.C
OBJECTS = ../SpiralPlugin.o \
../SpiralPluginGUI.o \
../../ChannelHandler.o \
../Widgets/Fl_Knob.o \
../Widgets/Fl_DragBar.o \
../Widgets/Fl_EventMap.o \
../Widgets/Fl_SEvent.o \
../../Sample.o \
../../RiffWav.o \
SequencerPlugin.o \
SequencerPluginGUI.o
INTERFACES =
UICDECLS =
UICIMPLS =
SRCMOC =
OBJMOC =
DIST =
TARGET = SequencerPlugin.so

####### Implicit rules

.SUFFIXES: .cpp .cxx .cc .C .c

.cpp.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<

.cxx.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<

.cc.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<

.C.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<

.c.o:
$(CC) -c $(CFLAGS) $(INCPATH) -o $@ $<

####### Build rules


all: $(TARGET)

$(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC)
$(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS)

moc: $(SRCMOC)

tmake:
tmake SequencerPlugin.pro

dist:
$(TAR) SequencerPlugin.tar SequencerPlugin.pro $(SOURCES) $(HEADERS) $(INTERFACES) $(DIST)
$(GZIP) SequencerPlugin.tar

clean:
-rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS) $(TARGET)
-rm -f *~ core
install:
$(INSTALL) $(TARGET) $(libdir)/SpiralPlugins

####### Sub-libraries


###### Combined headers


####### Compile

../SpiralPlugin.o: ../SpiralPlugin.C \
../SpiralPlugin.h \
../../Sample.h

../SpiralPluginGUI.o: ../SpiralPluginGUI.C \
../SpiralPluginGUI.h \
../Widgets/Fl_DragBar.H \
../SpiralPlugin.h \
../../Sample.h

../Widgets/Fl_Knob.o: ../Widgets/Fl_Knob.cxx \
../Widgets/Fl_Knob.H

../Widgets/Fl_DragBar.o: ../Widgets/Fl_DragBar.cxx \
../Widgets/Fl_DragBar.H

../Widgets/Fl_EventMap.o: ../Widgets/Fl_EventMap.C \
../Widgets/Fl_EventMap.h \
../Widgets/Fl_SEvent.h

../Widgets/Fl_SEvent.o: ../Widgets/Fl_SEvent.C \
../Widgets/Fl_SEvent.h \
../Widgets/Fl_EventMap.h

../../Sample.o: ../../Sample.C \
../../Sample.h \
../../SpiralInfo.h

../../RiffWav.o: ../../RiffWav.C \
../../RiffWav.h \
../../Sample.h \
../../SpiralInfo.h

SequencerPlugin.o: SequencerPlugin.C \
SequencerPlugin.h \
../SpiralPlugin.h \
../../Sample.h \
../../SpiralInfo.h \
../../Sample.h \
../Widgets/Fl_EventMap.h \
../Widgets/Fl_SEvent.h \
SequencerPluginGUI.h \
../SpiralPluginGUI.h \
../Widgets/Fl_DragBar.H \
../Widgets/Fl_Knob.H \
SpiralIcon.xpm \
../../RiffWav.h \
../../NoteTable.h

SequencerPluginGUI.o: SequencerPluginGUI.C \
SequencerPluginGUI.h \
SequencerPluginss.h \
../SpiralPlugin.h \
../../Sample.h \
../../SpiralInfo.h \
../../Sample.h \
../Widgets/Fl_EventMap.h \
../Widgets/Fl_SEvent.h \
../SpiralPluginGUI.h \
../Widgets/Fl_DragBar.H \
../Widgets/Fl_Knob.H

../../ChannelHandler.o: ../../ChannelHandler.C \
../../ChannelHandler.h

+ 269
- 0
SpiralSound/Plugins/SequencerPlugin/SequencerPlugin.C View File

@@ -0,0 +1,269 @@
/* SpiralSound
* Copyleft (C) 2001 David Griffiths <dave@pawfal.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "SequencerPlugin.h"
#include "SequencerPluginGUI.h"
#include <FL/Fl_Button.h>
#include "SpiralIcon.xpm"
#include "../../RiffWav.h"
#include "../../NoteTable.h"

// for note on's
static const float TRIGGER_LEV=0.1;

extern "C" {
SpiralPlugin* CreateInstance()
{
return new SequencerPlugin;
}

char** GetIcon()
{
return SpiralIcon_xpm;
}

int GetID()
{
return 0x0011;
}
}

///////////////////////////////////////////////////////

SequencerPlugin::SequencerPlugin() :
m_Time(0.0f),
m_Length(10.0f),
m_SpeedMod(1.0f),
m_CurrentNoteCV(0),
m_CurrentTriggerCV(0),
m_InNoteDown(false),
m_InNoteID(0),
m_CurrentPattern(0),
m_Triggered(false)
{
m_Version=2;
m_PluginInfo.Name="Sequencer";
m_PluginInfo.Width=540;
m_PluginInfo.Height=290;
m_PluginInfo.NumInputs=4;
m_PluginInfo.NumOutputs=2;
m_PluginInfo.PortTips.push_back("Play Trigger");
m_PluginInfo.PortTips.push_back("Speed CV");
m_PluginInfo.PortTips.push_back("Input Pitch CV");
m_PluginInfo.PortTips.push_back("Input Trigger CV");
m_PluginInfo.PortTips.push_back("Output Pitch");
m_PluginInfo.PortTips.push_back("Output Trigger");
}

SequencerPlugin::~SequencerPlugin()
{
}

PluginInfo &SequencerPlugin::Initialise(const HostInfo *Host)
{
return SpiralPlugin::Initialise(Host);
}

SpiralGUIType *SequencerPlugin::CreateGUI()
{
return new SequencerPluginGUI(m_PluginInfo.Width,
m_PluginInfo.Height,
this,m_AudioCH,m_HostInfo);
}

void SequencerPlugin::SetPattern(int s)
{
//m_Eventmap[m_CurrentPattern]->hide();
m_CurrentPattern=s;
//m_Eventmap[m_CurrentPattern]->show();
}


void SequencerPlugin::Execute()
{
float Speed;
for (int n=0; n<m_HostInfo->BUFSIZE; n++)
{
if (GetInputPitch(0,n)>0)
{
if (!m_Triggered)
{
float Freq=GetInputPitch(0,n);
// Notes 0 to 16 trigger patterns 0 to 16
// No other notes catered for
for (int i=0; i<NUM_PATTERNS; i++)
{
if (feq(Freq,NoteTable[i],0.01f))
{
SetPattern(i);
break;
}
}
m_Time=0;
m_Triggered=true;
}
}
else
{
m_Triggered=false;
}

if (InputExists(1))
Speed =(1.1025f/m_HostInfo->SAMPLERATE) * (GetInput(1,n)+1.0f);
else
Speed =1.1025f/m_HostInfo->SAMPLERATE;
if (!m_InNoteDown)
{
// Check trigger
if (GetInput(3,n)>TRIGGER_LEV)
{
m_InNoteDown=true;
float Freq=GetInputPitch(2,n);

int NoteNum=0;
for (int i=0; i<131; i++)
{
if (feq(Freq,NoteTable[i],0.01f))
{
NoteNum=i;
break;
}
}
/*cerr<<"note recieved ="<<NoteNum<<" f="<<Freq
<<" t-1="<<NoteTable[NoteNum-1]
<<" t="<<NoteTable[NoteNum]
<<" t+1="<<NoteTable[NoteNum+1]<<endl;
*/
//m_InNoteID=m_Eventmap[m_CurrentPattern]->AddEventTime(m_Time, NoteNum, 0.5, Fl_SEvent::MELODY, false);
m_InNoteTime=m_Time;
}
}
else
{
// Check trigger
if (GetInput(3,n)<TRIGGER_LEV)
{
//m_Eventmap[m_CurrentPattern]->SetEventLength(m_InNoteID, m_Time-m_InNoteTime);
m_InNoteDown=false;
}
}
// Get the notes from the map
/*vector<EventInfo> NoteVec=m_Eventmap[m_CurrentPattern]->GetEvents(m_Time);
// play all the notes found
for (vector<EventInfo>::iterator i=NoteVec.begin();
i!=NoteVec.end(); i++)
{
if (i->m_Type==EventInfo::START)
{
m_CurrentNoteCV=NoteTable[i->m_Group];
m_CurrentTriggerCV=1;
}
if (i->m_Type==EventInfo::END)
{
m_CurrentTriggerCV=0;
if (m_NoteCut) m_CurrentNoteCV=0;
}
}
*/
SetOutputPitch(0,n,m_CurrentNoteCV);
SetOutput(1,n,m_CurrentTriggerCV);
m_Time+=Speed*m_SpeedMod;
if (m_Time>m_Length)
{
m_Time=0;
}
if (m_Time<0)
{
m_Time=m_Length;
}
}
}

void SequencerPlugin::ExecuteCommands()
{
}

void SequencerPlugin::StreamOut(ostream &s)
{
s<<m_Version<<" ";
switch (m_Version)
{
case 2:
{
s<<m_Time<<" ";
s<<m_Length<<" ";
s<<m_SpeedMod<<" ";
s<<m_Loop<<" ";
s<<m_NoteCut<<" ";
s<<m_CurrentPattern<<" ";
}
// fallthrough
case 1:
{
for(int n=0; n<NUM_PATTERNS; n++)
{
//s<<*m_Eventmap[n]<<" ";
}
} break;
}
}

void SequencerPlugin::StreamIn(istream &s)
{
int version;
s>>version;
switch (version)
{
case 2:
{
s>>m_Time;
s>>m_Length;
s>>m_SpeedMod;
s>>m_Loop;
s>>m_NoteCut;
s>>m_CurrentPattern;
}
// fallthrough
case 1:
{
for(int n=0; n<NUM_PATTERNS; n++)
{
//s>>*m_Eventmap[n];
}
} break;
}
}

+ 100
- 0
SpiralSound/Plugins/SequencerPlugin/SequencerPlugin.h View File

@@ -0,0 +1,100 @@
/* SpiralSound
* Copyleft (C) 2001 David Griffiths <dave@pawfal.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/

#include "../SpiralPlugin.h"
#include <FL/Fl_Pixmap.H>
#include "../Widgets/Fl_EventMap.h"
#include <list>

#ifndef SequencerPLUGIN
#define SequencerPLUGIN

const int NUM_PATTERNS = 16;

class Track
{
public:
class Sequence
{
public:
class Pattern
{
public:
class Note
{
public:
float time;
int note;
float vol;
};
map<int,Note> m_NoteMap;
};
float m_StartTime;
int m_Pattern;
};
map<int,Sequence::Pattern> m_PatternMap;
list<Sequence> m_SequenceList;
};

class SequencerPlugin : public SpiralPlugin
{
public:
SequencerPlugin();
virtual ~SequencerPlugin();
virtual PluginInfo &Initialise(const HostInfo *Host);
virtual SpiralGUIType *CreateGUI();
virtual void Execute();
virtual void ExecuteCommands();
virtual void StreamOut(ostream &s);
virtual void StreamIn(istream &s);
bool GetNoteCut() { return m_NoteCut; }
void ClearAll() { /*m_Eventmap[m_CurrentPattern]->RemoveAllEvents();*/ }
int GetCurrentPattern() { return m_CurrentPattern; }
private:

Track m_Track;

void SetEventMap(int n, Fl_EventMap* s) { /*m_Eventmap[n]=s;*/ }
void SetUpdate(bool s) { /*m_Eventmap[m_CurrentPattern]->SetUpdate(s);*/ }
void SetZoom(float s) { /*m_Eventmap[m_CurrentPattern]->SetZoomLevel(s);*/ }
void SetNoteCut(bool s) { m_NoteCut=s; }
void SetEndTime(float s) { /*m_Eventmap[m_CurrentPattern]->SetEndTime(s);*/ m_Length=s; }
void SetSpeed(float s) { m_SpeedMod=s; }
void SetPattern(int s);
float m_Time;
float m_Length;
bool m_Loop;
bool m_NoteCut;
float m_SpeedMod;
float m_CurrentNoteCV;
float m_CurrentTriggerCV;
bool m_InNoteDown;
int m_InNoteID;
float m_InNoteTime;
int m_CurrentPattern;
bool m_Triggered;
};

#endif

+ 191
- 0
SpiralSound/Plugins/SequencerPlugin/SequencerPluginGUI.C View File

@@ -0,0 +1,191 @@
/* SpiralPlugin
* Copyleft (C) 2000 David Griffiths <dave@pawfal.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/

#include <stdio.h>
#include "SequencerPluginGUI.h"
#include <FL/fl_draw.h>
#include <FL/fl_draw.H>
#include <FL/fl_file_chooser.h>

static const int GUI_COLOUR = 179;
static const int GUIBG_COLOUR = 144;
static const int GUIBG2_COLOUR = 145;

////////////////////////////////////////////

SequencerPluginGUI::PatternWin::PatternWin(int w,int h,const char* n) :
Fl_Double_Window(w,h,n)
{
m_Scroll = new Fl_Scroll(0, 0, w, h, "");
resizable(m_Scroll);
add(m_Scroll);
m_Melody = new Fl_EventMap(0, 0, 1000, 1000, "");
m_Melody->SetType(Fl_EventMap::MELODY_MAP);
m_Scroll->add(m_Melody);
m_Melody->CreateWindow();
m_Melody->SetUpdateLineClip(0, 18, w, h-38);
m_Melody->show();
end();
}

////////////////////////////////////////////

SequencerPluginGUI::SequencerPluginGUI(int w, int h,SequencerPlugin *o,ChannelHandler *ch,const HostInfo *Info) :
SpiralPluginGUI(w,h,o,ch)
{
m_Scroll = new Fl_Scroll(50, 20, w-57, h-26, "");
add(m_Scroll);
m_ArrangementMap = new Fl_EventMap(0, 0, 1000, 1000, "");
m_ArrangementMap->user_data((void*)this);
m_ArrangementMap->SetType(Fl_EventMap::ARRANGE_MAP);
m_Scroll->add(m_ArrangementMap);
m_ArrangementMap->CreateWindow();
m_ArrangementMap->SetUpdateLineClip(0, 18, w, h-38);
m_ArrangementMap->show();
m_Length = new Fl_Knob(5, 60, 40, 40, "Length");
m_Length->color(GUI_COLOUR);
m_Length->type(Fl_Knob::DOTLIN);
m_Length->labelsize(10);
m_Length->maximum(30);
m_Length->step(0.01);
m_Length->value(1.0);
m_Length->callback((Fl_Callback*)cb_Length);
add(m_Length);
m_Speed = new Fl_Knob(5, 115, 40, 40, "Speed");
m_Speed->color(GUI_COLOUR);
m_Speed->type(Fl_Knob::DOTLIN);
m_Speed->labelsize(10);
m_Speed->maximum(4);
m_Speed->step(0.01);
m_Speed->value(2.0);
m_Speed->callback((Fl_Callback*)cb_Speed);
add(m_Speed);
m_Zoom = new Fl_Knob(5,170,40,40,"Zoom");
m_Zoom->color(GUI_COLOUR);
m_Zoom->type(Fl_Knob::DOTLIN);
m_Zoom->labelsize(10);
m_Zoom->maximum(2);
m_Zoom->step(0.01);
m_Zoom->value(1.0);
m_Zoom->callback((Fl_Callback*)cb_Zoom);
add(m_Zoom);
m_NewPattern = new Fl_Button(2,225,45,20,"New Pat");
m_NewPattern->type(0);
m_NewPattern->labelsize(10);
m_NewPattern->callback((Fl_Callback*)cb_NewPattern,NULL);
add(m_NewPattern);
m_NoteCut = new Fl_Button(2,245,45,20,"NoteCut");
m_NoteCut->type(1);
m_NoteCut->labelsize(10);
m_NoteCut->value(0);
m_NoteCut->callback((Fl_Callback*)cb_NoteCut);
add(m_NoteCut);
m_Clear = new Fl_Button(2,265,45,20,"Clear");
m_Clear->type(0);
m_Clear->labelsize(10);
m_Clear->value(0);
m_Clear->callback((Fl_Callback*)cb_Clear);
add(m_Clear);
end();
}

void SequencerPluginGUI::UpdateValues(SpiralPlugin *o)
{
}
inline void SequencerPluginGUI::cb_NoteCut_i(Fl_Button* o, void* v)
{
//m_Plugin->SetNoteCut(o->value());
}
void SequencerPluginGUI::cb_NoteCut(Fl_Button* o, void* v)
{ ((SequencerPluginGUI*)(o->parent()))->cb_NoteCut_i(o,v);}

inline void SequencerPluginGUI::cb_Zoom_i(Fl_Knob* o, void* v)
{
//m_Plugin->SetZoom(o->value());
}
void SequencerPluginGUI::cb_Zoom(Fl_Knob* o, void* v)
{ ((SequencerPluginGUI*)(o->parent()))->cb_Zoom_i(o,v);}



inline void SequencerPluginGUI::cb_Pattern_i(Fl_Counter* o, void* v)
{
if (o->value()<0) o->value(0);
if (o->value()>NUM_PATTERNS-1) o->value(NUM_PATTERNS-1);
//m_Plugin->SetPattern((int)o->value());
//UpdateValues();
}
void SequencerPluginGUI::cb_Pattern(Fl_Counter* o, void* v)
{ ((SequencerPluginGUI*)(o->parent()))->cb_Pattern_i(o,v);}

inline void SequencerPluginGUI::cb_Length_i(Fl_Knob* o, void* v)
{
//m_Plugin->SetEndTime(o->value());
}
void SequencerPluginGUI::cb_Length(Fl_Knob* o, void* v)
{ ((SequencerPluginGUI*)(o->parent()))->cb_Length_i(o,v);}

inline void SequencerPluginGUI::cb_Speed_i(Fl_Knob* o, void* v)
{
//m_Plugin->SetSpeed(o->value()-2.0f);
}
void SequencerPluginGUI::cb_Speed(Fl_Knob* o, void* v)
{ ((SequencerPluginGUI*)(o->parent()))->cb_Speed_i(o,v);}

inline void SequencerPluginGUI::cb_Clear_i(Fl_Button* o, void* v)
{
//m_Plugin->ClearAll();
}
void SequencerPluginGUI::cb_Clear(Fl_Button* o, void* v)
{ ((SequencerPluginGUI*)(o->parent()))->cb_Clear_i(o,v);}

inline void SequencerPluginGUI::cb_NewPattern_i(Fl_Button* o, void* v)
{
int eid = m_ArrangementMap->AddEvent(300,100,100,Fl_SEvent::NO_TYPE);
m_ArrangementMap->GetEvent(eid)->SetName("My Pattern");
const char *name = fl_input("Name the new pattern:", "My Pattern");
if (name) m_ArrangementMap->GetEvent(eid)->SetName(name);
m_PatternWinMap[eid] = new PatternWin(400,200,m_ArrangementMap->GetEvent(eid)->GetName().c_str());
m_ArrangementMap->SetEventCallback((Fl_Callback*)cb_ArrangeRM);
redraw();
}
void SequencerPluginGUI::cb_NewPattern(Fl_Button* o, void* v)
{ ((SequencerPluginGUI*)(o->parent()))->cb_NewPattern_i(o,v);}

inline void SequencerPluginGUI::cb_ArrangeRM_i(Fl_Button* o, void* v)
{
int ID=((Fl_SEvent*)o)->GetID();
if (m_PatternWinMap[ID]->shown()) m_PatternWinMap[ID]->hide();
else m_PatternWinMap[ID]->show();
}
void SequencerPluginGUI::cb_ArrangeRM(Fl_Button* o, void* v)
{ ((SequencerPluginGUI*)(o->parent()->user_data()))->cb_ArrangeRM_i(o,v);}


+ 86
- 0
SpiralSound/Plugins/SequencerPlugin/SequencerPluginGUI.h View File

@@ -0,0 +1,86 @@
/* SpiralPlugin
* Copyleft (C) 2000 David Griffiths <dave@pawfal.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/

#include <FL/Fl.H>
#include <FL/Fl_Window.H>
#include <FL/Fl_Group.H>
#include <FL/Fl_Scroll.H>
#include <FL/Fl_Slider.H>
#include <FL/Fl_Counter.H>
#include <FL/Fl_Output.H>

#include "SequencerPlugin.h"
#include "../SpiralPluginGUI.h"
#include "../Widgets/Fl_Knob.H"
#include "../Widgets/Fl_EventMap.h"

#ifndef MixerGUI
#define MixerGUI


class SequencerPluginGUI : public SpiralPluginGUI
{
public:
SequencerPluginGUI(int w, int h, SequencerPlugin *o, ChannelHandler *ch,const HostInfo *Info);
virtual void UpdateValues(SpiralPlugin *o);

private:
Fl_Scroll* m_Scroll;
Fl_Button* m_NewPattern;
Fl_Button* m_NoteCut;
Fl_Knob* m_Zoom;
Fl_Knob* m_Length;
Fl_Knob* m_Speed;
Fl_Button* m_Clear;
class PatternWin : public Fl_Double_Window
{
public:
PatternWin(int w,int h,const char* n);
private:
Fl_Scroll* m_Scroll;
Fl_EventMap* m_Melody;
};
map<int,PatternWin*> m_PatternWinMap;
Fl_EventMap* m_ArrangementMap;
//// Callbacks ////
inline void cb_Zoom_i(Fl_Knob* o, void* v);
static void cb_Zoom(Fl_Knob* o, void* v);
inline void cb_NoteCut_i(Fl_Button* o, void* v);
static void cb_NoteCut(Fl_Button* o, void* v);
inline void cb_Pattern_i(Fl_Counter* o, void* v);
static void cb_Pattern(Fl_Counter* o, void* v);
inline void cb_Length_i(Fl_Knob* o, void* v);
static void cb_Length(Fl_Knob* o, void* v);
inline void cb_Speed_i(Fl_Knob* o, void* v);
static void cb_Speed(Fl_Knob* o, void* v);
inline void cb_Clear_i(Fl_Button* o, void* v);
static void cb_Clear(Fl_Button* o, void* v);
inline void cb_NewPattern_i(Fl_Button* o, void* v);
static void cb_NewPattern(Fl_Button* o, void* v);
inline void cb_ArrangeRM_i(Fl_Button* o, void* v);
static void cb_ArrangeRM(Fl_Button* o, void* v);
};

#endif

+ 325
- 0
SpiralSound/Plugins/SequencerPlugin/SpiralIcon.xpm View File

@@ -0,0 +1,325 @@
/* XPM */
static char * SpiralIcon_xpm[] = {
"36 36 286 2",
" c None",
". c #8B889B",
"+ c #9C99AA",
"@ c #ADAAB9",
"# c #837F94",
"$ c #7D7990",
"% c #9995A7",
"& c #67627C",
"* c #CDCBD4",
"= c #FCFCFC",
"- c #D1D0D8",
"; c #FFFFFF",
"> c #F1F1F3",
", c #848095",
"' c #2A2248",
") c #CFCED6",
"! c #68637D",
"~ c #ABA8B6",
"{ c #D5D3DB",
"] c #9490A2",
"^ c #C4C4C4",
"/ c #1D1C1D",
"( c #313134",
"_ c #EEEFEE",
": c #FBFBFB",
"< c #EFEFEF",
"[ c #7B768D",
"} c #464060",
"| c #DEDEE1",
"1 c #CBCACC",
"2 c #EEEEF1",
"3 c #79758C",
"4 c #FBFBFC",
"5 c #A2A2A2",
"6 c #000000",
"7 c #F5F6F5",
"8 c #747474",
"9 c #2A2A2B",
"0 c #403958",
"a c #7D788F",
"b c #C0BEC8",
"c c #BCBAC6",
"d c #BCBAC5",
"e c #625C79",
"f c #2B2932",
"g c #191919",
"h c #CCCCCC",
"i c #807B91",
"j c #3B3556",
"k c #F2F2F4",
"l c #929292",
"m c #0E0E0E",
"n c #BFBFBF",
"o c #111111",
"p c #100E15",
"q c #868689",
"r c #FEFDFE",
"s c #D9D7DE",
"t c #9C98AA",
"u c #FDFCFD",
"v c #DDDDDD",
"w c #575755",
"x c #5E5E5E",
"y c #C4C2CD",
"z c #423C5C",
"A c #F0F0F2",
"B c #939393",
"C c #555555",
"D c #4A4A4A",
"E c #010101",
"F c #282828",
"G c #C2C2C2",
"H c #DBDAE0",
"I c #615C78",
"J c #F6F6F7",
"K c #DADADA",
"L c #545454",
"M c #0F0F0F",
"N c #B8B8B8",
"O c #48445C",
"P c #2B2B2C",
"Q c #181900",
"R c #D3D3D3",
"S c #C1BEC9",
"T c #474060",
"U c #31294D",
"V c #716C85",
"W c #65607A",
"X c #625D78",
"Y c #D5D4DB",
"Z c #F7F7F7",
"` c #8B8B8B",
" . c #161616",
".. c #0A0A0A",
"+. c #151700",
"@. c #1A1B00",
"#. c #060600",
"$. c #191A00",
"%. c #393643",
"&. c #47415F",
"*. c #9692A4",
"=. c #D9D8DE",
"-. c #F7F7F8",
";. c #918DA0",
">. c #B8B5C1",
",. c #D1D1D1",
"'. c #212121",
"). c #282900",
"!. c #030300",
"~. c #070700",
"{. c #020200",
"]. c #727175",
"^. c #FEFEFF",
"/. c #9D99AA",
"(. c #DBD9E0",
"_. c #E9E9E9",
":. c #CBCBCB",
"<. c #E0E0E0",
"[. c #6C6C6C",
"}. c #FEF100",
"|. c #515151",
"1. c #A6A6A7",
"2. c #827E93",
"3. c #615C77",
"4. c #EAEAED",
"5. c #DFDFE1",
"6. c #0C0C0C",
"7. c #191700",
"8. c #1E1D24",
"9. c #9894A7",
"0. c #B1AEBB",
"a. c #69686F",
"b. c #000001",
"c. c #615C76",
"d. c #5F5A75",
"e. c #413E4D",
"f. c #020203",
"g. c #010100",
"h. c #1A1A1C",
"i. c #C3C1CB",
"j. c #9D9D9D",
"k. c #202020",
"l. c #383838",
"m. c #4C4C4C",
"n. c #1E1C00",
"o. c #111112",
"p. c #C9C7D0",
"q. c #F1F1F1",
"r. c #F8F8F8",
"s. c #232323",
"t. c #050408",
"u. c #AEACB9",
"v. c #FEFEFE",
"w. c #1D1D1D",
"x. c #B7B5C1",
"y. c #9390A2",
"z. c #BBBBBB",
"A. c #414141",
"B. c #030303",
"C. c #28272A",
"D. c #F4F4F6",
"E. c #605B76",
"F. c #736E86",
"G. c #D8D8D8",
"H. c #727272",
"I. c #101010",
"J. c #848486",
"K. c #CCCBD3",
"L. c #747087",
"M. c #6D6881",
"N. c #1C1C1C",
"O. c #242424",
"P. c #212205",
"Q. c #1B1D00",
"R. c #000100",
"S. c #656566",
"T. c #F6F6F6",
"U. c #E8E6EA",
"V. c #706B84",
"W. c #E3E1E6",
"X. c #474746",
"Y. c #151515",
"Z. c #C8C8C8",
"`. c #AEAEAE",
" + c #070707",
".+ c #373639",
"++ c #FDFCFE",
"@+ c #ABA8B7",
"#+ c #F1F0F3",
"$+ c #6D6980",
"%+ c #0A090E",
"&+ c #95929E",
"*+ c #0A0810",
"=+ c #0D0D0D",
"-+ c #050505",
";+ c #5B5A5C",
">+ c #F7F6F7",
",+ c #F4F3F5",
"'+ c #908C9F",
")+ c #C8C6D0",
"!+ c #837E96",
"~+ c #86868A",
"{+ c #070608",
"]+ c #ECEBEE",
"^+ c #5B5571",
"/+ c #646078",
"(+ c #AFAFB0",
"_+ c #454545",
":+ c #363636",
"<+ c #7A7A7A",
"[+ c #C8C8C9",
"}+ c #212025",
"|+ c #060607",
"1+ c #969699",
"2+ c #FAFAFA",
"3+ c #F8F8F9",
"4+ c #A29EAF",
"5+ c #F7F6F8",
"6+ c #F0F0F1",
"7+ c #B8B7B9",
"8+ c #E4E4E4",
"9+ c #FDFDFD",
"0+ c #A5A2B2",
"a+ c #3B3456",
"b+ c #A8A5B4",
"c+ c #525252",
"d+ c #848387",
"e+ c #CDCDCD",
"f+ c #8D899C",
"g+ c #494262",
"h+ c #68627C",
"i+ c #40395A",
"j+ c #ECECEC",
"k+ c #020202",
"l+ c #B4B5B5",
"m+ c #0B0B0B",
"n+ c #313232",
"o+ c #E3E3E3",
"p+ c #B1AEBC",
"q+ c #BDBBC6",
"r+ c #3C3556",
"s+ c #898599",
"t+ c #EDEDED",
"u+ c #39393A",
"v+ c #040404",
"w+ c #333333",
"x+ c #F5F5F5",
"y+ c #2B2B2B",
"z+ c #2D2A3D",
"A+ c #B6B4C1",
"B+ c #F5F5F6",
"C+ c #605A76",
"D+ c #DAD8DF",
"E+ c #F5F4F6",
"F+ c #615B76",
"G+ c #524D6A",
"H+ c #E4E3E8",
"I+ c #D5D5D5",
"J+ c #1B1B1B",
"K+ c #303030",
"L+ c #AAABAB",
"M+ c #585464",
"N+ c #B0AEBB",
"O+ c #A29FAF",
"P+ c #E9E8E9",
"Q+ c #787779",
"R+ c #0F0E15",
"S+ c #2D2D2E",
"T+ c #595959",
"U+ c #FAFAFB",
"V+ c #807B92",
"W+ c #B0ADBB",
"X+ c #E8E7EB",
"Y+ c #3A3258",
"Z+ c #E6E5EA",
"`+ c #DFDEE3",
" @ c #443E5E",
".@ c #BAB8C4",
"+@ c #C1BFCA",
"@@ c #E0E0E5",
"#@ c #D0CED6",
"$@ c #362F52",
"%@ c #CECCD5",
"&@ c #413A5B",
"*@ c #6A657F",
"=@ c #9793A6",
" ",
" ",
" ",
" . + @ # $ % ",
" & * = * - ; > , ' ; ; ; ) ! ",
" ~ ; ; { ] ; ^ / ( _ ; : < [ ",
" } | 1 2 3 4 5 6 6 7 : 8 9 0 a b ",
" c : d e f g h i j k l 6 m ; n o 6 p q r s ",
" 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 6 E ].^.; ; /. ",
" (.; ; _.R h :.<.[.6 }.}.}.}.}.}.}.}.}.}.}.E |.1.4 2. ",
" 3.4.; 5.6.6 6 6 6 6 6 }.6 6 6 6 6 6 6 6 6 }.7.6 8.9. ",
" V @ 0.a.b.6 6 6 6 6 {.}.6 6 6 6 }.}.}.6 6 }.6 6 ",
" c.d.e.6 f.6 6 6 6 g.}.}.}.6 6 6 6 6 6 6 }.6 6 h. ",
" i.; ; j.k.k.l.m.k.6 6 }.6 6 6 6 6 n.6 6 6 }.6 6 o. ",
" p.; ; q.r.; ; ; s.6 6 }.6 6 }.}.}.6 6 }.}.}.6 6 t. ",
" u.; ; ; ; v.; ; w.6 6 }.6 6 6 6 6 6 6 6 6 }.6 6 6 x., ",
" y.; ; v.; : z.A.B.6 6 }.6 6 6 6 6 6 6 6 6 }.6 6 C.v.D.E. ",
" F.; ; ; G.H.I.6 6 6 6 }.}.}.}.}.}.}.}.}.}.}.6 6 J.; ; K.L. ",
" M.J ; : N.6 6 6 6 O.P.Q.6 R.6 6 6 6 6 6 6 6 6 6 S.T.; ; U.V. ",
" W.; ; X.6 E 6 Y.Z.`. +6 6 6 6 6 6 6 6 g.6 6 6 6 .+++; ; > V. ",
" @+; #+$+%+6 6 `.v.; &+*+6 6 6 6 6 6 6 6 =+-+6 6 6 ;+>+; ; ,+'+ ",
" V.)+! !+~+{+x ; ; ]+^+/+(+l _+6 6 6 :+<+[+}+6 6 6 |+1+2+; ; 3+@ ",
" 4+5+6+7+8+9+; 0+a+b+; T._+6 6 E c+; ; d+6 6 E 6 o e+; ; = f+ ",
" g+> ; ; ; ; ; ; h+i+; ; j+l.6 6 k+D ; ; l+m+6 6 6 n+o+; ; p+ ",
" > ; ; ; ; q+r+s+; ; t+u+6 6 v+w+; ; x+y+6 6 z+A+; B+3 ",
" C+D+= ; E+F+G+H+; ; I+J+6 6 k+K+; ; ; L+c+M+ ",
" N+4 O+ X ; ; ; P+Q+K+R+S+T+; ; ; v.U+V+ ",
" W+; ; ; ; ; X+Y+Z+; ; ; ; = `+ @ ",
" .@+@@@4 ; ; #@$@%@; ; ; s s+T ",
" &@ *@=@s+ ",
" ",
" ",
" "};

+ 36
- 17
SpiralSound/Plugins/Widgets/Fl_SEvent.C View File

@@ -27,12 +27,12 @@ static const int MELODY_WIDGET_COL = 142;
static const int PERCUSSION_WIDGET_COL = 140;

Fl_SEvent::Fl_SEvent(int x, int y, int w, int h, const char* label) :
Fl_Button(x,y,w,h,label),
Fl_Group(x,y,w,h,""),
m_Type(NO_TYPE),
m_LastState(false),
m_FirstUpdate(false),
m_LastUpdate(false),
m_Name("No Name"),
m_Name(""),
m_ID(-1),
m_GridX(0),
m_GridY(0),
@@ -47,11 +47,21 @@ m_SnapGap(0.0f),
m_CurrentDragMode(NONE),
m_DelMe(false)
{
Fl_Button::label(m_Name.c_str());
Fl_Group::label(m_Name.c_str());
labelsize(8);
m_Menu = new Fl_Menu_Button(x,y,w,h,"");
m_Menu->type(Fl_Menu_Button::POPUP2);
m_Menu->textsize(8);
m_Menu->add("copy", 0, NULL);
m_Menu->add("instance", 0, NULL);
m_Menu->add("edit", 0, NULL);
m_Menu->add("delete", 0, NULL);
add(m_Menu);
}

Fl_SEvent::Fl_SEvent(const Fl_SEvent &Other) :
Fl_Button(Other.x(),Other.y(),Other.w(),Other.h(),Other.label()),
Fl_Group(Other.x(),Other.y(),Other.w(),Other.h(),Other.label()),
m_Type(Other.m_Type),
m_LastState(Other.m_LastState),
m_FirstUpdate(Other.m_FirstUpdate),
@@ -95,6 +105,7 @@ bool Fl_SEvent::UpdateState(float Time)
void Fl_SEvent::draw()
{
Fl_Group::draw();
// check if clipped
//if (fl_clip()) return;

@@ -128,7 +139,7 @@ void Fl_SEvent::draw()
fl_line(x()+w(),y()+h(),x()+1,y()+h());
fl_push_clip(x()+1,y()+1,w()-1,h()-1);
fl_font(fl_font(), 10);
fl_font(fl_font(), 8);
fl_draw(m_Name.c_str(),x()+2,y()+h()-2);
fl_pop_clip();
}
@@ -144,8 +155,17 @@ int Fl_SEvent::handle(int event)

static int offsx,offsy;
switch (event)
if (Fl::event_button()==1 && event==FL_PUSH && Fl::event_clicks()==1)
{
// a bit crap I suppose
if (((Fl_EventMap*)parent())->cb_EventDoubleClicked!=NULL)
{
((Fl_EventMap*)parent())->cb_EventDoubleClicked(this,NULL);
}
}
switch (event)
{
case FL_PUSH:
LastButtonPushed=Fl::event_button();
@@ -165,23 +185,17 @@ int Fl_SEvent::handle(int event)
{
// if the last EVENT_RESIZE_GRAB pixels
// have been grabbed, resize.
/*if(!m_LockResize && mx>x()+w()-m_ResizeGrab && mx<x()+w())
{
m_CurrentDragMode=RESIZING;
}
else
{*/
m_CurrentDragMode=MOVING;
//}
}
if (LastButtonPushed==2)
/*if (LastButtonPushed==2)
{
// copy to end
Fl_EventMap *p = (Fl_EventMap*)parent();
if (p) p->CopyEvent(x()+w(),y(),w(),m_ID,m_LengthTime);
}
}*/
if (LastButtonPushed==3)
{
@@ -196,6 +210,8 @@ int Fl_SEvent::handle(int event)
if(m_CurrentDragMode==RESIZING)
{
w(mx-x()+(m_ResizeGrab/2));
//m_Menu->size(w(),h());
m_LengthTime=w()/(float)m_PixelsPerSec;
}
@@ -203,7 +219,8 @@ int Fl_SEvent::handle(int event)
{
x(mx-offsx);
y(my-offsy);

m_Menu->position(x(),y());
m_StartTime=(x()-GetParentX())/(float)m_PixelsPerSec;
}
@@ -221,8 +238,10 @@ int Fl_SEvent::handle(int event)
}
break;
}
return event;
Fl_Group::handle(event);
return 1;
}

void Fl_SEvent::SetPixelsPerSec(int s, bool FirstTime)


+ 7
- 2
SpiralSound/Plugins/Widgets/Fl_SEvent.h View File

@@ -18,8 +18,11 @@

#include <FL/Fl.H>
#include <FL/Fl_Group.H>
#include <FL/Fl_Button.H>
#include <FL/Fl_Group.H>
#include <FL/Fl_Window.H>
#include <FL/Fl_Menu_Button.H>
#include <FL/Fl_Menu_Item.H>

#include <iostream>
#include <map>
#include <string>
@@ -32,7 +35,7 @@ using namespace std;

class Fl_EventMap;

class Fl_SEvent : public Fl_Button
class Fl_SEvent : public Fl_Group
{
public:
enum Type{NO_TYPE,MELODY,PERCUSSION};
@@ -81,6 +84,8 @@ public:
private:

Fl_Menu_Button *m_Menu;
Type m_Type;
// whether we were active or not last tick
bool m_LastState;


+ 123
- 0
autogen.sh View File

@@ -0,0 +1,123 @@
#!/bin/sh
#
# autogen.sh - Generates the initial makefiles from a pristine CVS tree
#
# $Id: autogen.sh,v 1.1 2002-10-30 22:38:35 nebogeo Exp $
#
# USAGE: autogen.sh [configure options]
#
# If environment variable DRYRUN is set, no configuring will be done -
# (e.g. in bash) DRYRUN=1 ./autogen.sh
# will not do any configuring but will emit the programs that would be run.
#
# This script is based on similar scripts used in various tools
# commonly made available via CVS and used with GNU automake.
# Try 'locate autogen.sh' on your system and see what you get.
#

PACKAGE=spiralsynthmodular
DIE=

if test "X$DRYRUN" != X; then
DRYRUN=echo
fi

autoconf_vers=2.13
automake_vers=1.4
aclocal_vers=1.4

program=`basename $0`

if (autoconf --version) < /dev/null > /dev/null 2>&1 ; then
if (autoconf --version | awk 'NR==1 { if( $3 >= '$autoconf_vers') \
exit 1; exit 0; }');
then
echo "$program: ERROR: \`autoconf' is too old."
echo " (version $autoconf_vers or newer is required)"
DIE="yes"
fi
else
echo
echo "$program: ERROR: You must have \`autoconf' installed to compile $PACKAGE."
echo " (version $autoconf_vers or newer is required)"
DIE="yes"
fi

# Ensure that these are created by the versions on this system
# (indirectly via automake)
rm -f libtool ltmain.sh
if (automake --version) < /dev/null > /dev/null 2>&1 ; then
if (automake --version | awk 'NR==1 { if( $4 >= '$automake_vers') \
exit 1; exit 0; }');
then
echo "$program: ERROR: \`automake' is too old."
echo " (version $automake_vers or newer is required)"
DIE="yes"
fi
if (aclocal --version) < /dev/null > /dev/null 2>&1; then
if (aclocal --version | awk 'NR==1 { if( $4 >= '$aclocal_vers' ) \
exit 1; exit 0; }' );
then
echo "$program: ERROR: \`aclocal' is too old."
echo " (version $aclocal_vers or newer is required)"
DIE="yes"
fi
else
echo
echo "$program: ERROR: Missing \`aclocal'"
echo " The version of automake installed doesn't appear recent enough."
DIE="yes"
fi
else
echo
echo "$program: ERROR: You must have \`automake' installed to compile $PACKAGE."
echo " (version $automake_vers or newer is required)"
DIE="yes"
fi


if test "X$DIE" != X; then
exit 1
fi

if test -z "$*"; then
echo "$program: WARNING: Running \`configure' with no arguments."
echo "If you wish to pass any to it, please specify them on the"
echo "\`$0' command line."
fi

am_opt=

for coin in `find $srcdir -name configure.in -print`
do
dir=`dirname $coin`
if test -f $dir/NO-AUTO-GEN; then
echo $program: Skipping $dir -- flagged as no auto-gen
else
echo $program: Processing directory $dir
( cd $dir
aclocalinclude="$ACLOCAL_FLAGS"
echo "$program: Running aclocal $aclocalinclude"
$DRYRUN aclocal $aclocalinclude
if grep "^AM_CONFIG_HEADER" configure.in >/dev/null; then
echo "$program: Running autoheader"
$DRYRUN autoheader
fi
echo "$program: Running automake $am_opt"
$DRYRUN automake --add-missing $am_opt
echo "$program: Running autoconf"
$DRYRUN autoconf
)
fi
done

conf_flags=

echo "$program: Running ./configure $conf_flags $@"
if test "X$DRYRUN" = X; then
$DRYRUN ./configure $conf_flags "$@" \
&& echo "$program: Now type \`make' to compile $PACKAGE" || exit 1
else
$DRYRUN ./configure $conf_flags "$@"
fi


Loading…
Cancel
Save