Browse Source

GUI optimisation, added --CallbackOnly mode, detection of fltk built with --enable-shared

master
nebogeo 22 years ago
parent
commit
d92afcaf26
10 changed files with 39 additions and 15 deletions
  1. +3
    -3
      SpiralSound/Plugins/MatrixPlugin/MatrixPluginGUI.C
  2. +2
    -1
      SpiralSound/Plugins/MatrixPlugin/MatrixPluginGUI.h
  3. +1
    -1
      SpiralSound/Plugins/PoshSamplerPlugin/Makefile.in
  4. +2
    -2
      SpiralSound/Plugins/PoshSamplerPlugin/PoshSamplerPluginGUI.C
  5. +1
    -1
      SpiralSound/Plugins/PoshSamplerPlugin/PoshSamplerPluginGUI.h
  6. +5
    -1
      SpiralSound/Plugins/SpiralPluginGUI.C
  7. +2
    -0
      SpiralSound/Plugins/SpiralPluginGUI.h
  8. +4
    -3
      SpiralSynthModular.C
  9. +4
    -0
      configure.in
  10. +15
    -3
      main.cpp

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

@@ -141,16 +141,16 @@ SpiralPluginGUI(w,h,o,ch)
end();
}

void MatrixPluginGUI::draw()
void MatrixPluginGUI::Update()
{
SpiralPluginGUI::draw();
for(int x=0; x<MATX; x++)
{
m_Flash[x]->value(0);
}

m_Flash[m_GUICH->GetInt("Step")]->value(1);
redraw();
}

void MatrixPluginGUI::UpdateValues(SpiralPlugin *o)


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

@@ -37,8 +37,9 @@ class MatrixPluginGUI : public SpiralPluginGUI
{
public:
MatrixPluginGUI(int w, int h, MatrixPlugin *o,ChannelHandler *ch,const HostInfo *Info);
virtual void draw();
virtual void UpdateValues(SpiralPlugin *o);
virtual void Update();
private:


+ 1
- 1
SpiralSound/Plugins/PoshSamplerPlugin/Makefile.in View File

@@ -14,7 +14,7 @@ CXXFLAGS= @CXXFLAGS@ @FLTK_CXXFLAGS@
INCPATH =
LINK = g++ -shared
LFLAGS =
LIBS = @FLTK_LIBS@ -lm -ldl
LIBS = @FLTK_LIBS@
MOC = moc
UIC =



+ 2
- 2
SpiralSound/Plugins/PoshSamplerPlugin/PoshSamplerPluginGUI.C View File

@@ -406,10 +406,10 @@ void PoshSamplerPluginGUI::UpdateSampleDisplay(int num)
}
}

void PoshSamplerPluginGUI::draw()
void PoshSamplerPluginGUI::Update()
{
SpiralPluginGUI::draw();
SetPlayPos(m_GUICH->GetLong("PlayPos"));
redraw();
}

void PoshSamplerPluginGUI::UpdateValues(SpiralPlugin *o)


+ 1
- 1
SpiralSound/Plugins/PoshSamplerPlugin/PoshSamplerPluginGUI.h View File

@@ -74,7 +74,7 @@ public:
PoshSamplerPluginGUI(int w, int h, PoshSamplerPlugin *o,ChannelHandler *ch, const HostInfo *Info);
virtual void UpdateValues(SpiralPlugin *o);
virtual void draw();
virtual void Update();
void SetPlayPos(long s) { m_Display->SetPlayPos(s); }
int GetCurrentSample() { return (int)m_SampleNum->value(); }


+ 5
- 1
SpiralSound/Plugins/SpiralPluginGUI.C View File

@@ -49,7 +49,11 @@ SpiralPluginGUI::~SpiralPluginGUI()
// Needed to properly remove the window.
Fl::check();
}

void SpiralPluginGUI::Update()
{
}

//// Callbacks ////

inline void SpiralPluginGUI::cb_Hide_i(Fl_Button* o, void* v)


+ 2
- 0
SpiralSound/Plugins/SpiralPluginGUI.h View File

@@ -36,6 +36,8 @@ public:
SpiralPluginGUI(int w, int h, SpiralPlugin* o, ChannelHandler *ch);
~SpiralPluginGUI();
virtual void Update();
// called while audio thread is suspended, so direct access to the
// spiralplugin is acceptable
virtual void UpdateValues(SpiralPlugin *o)=0;


+ 4
- 3
SpiralSynthModular.C View File

@@ -185,7 +185,8 @@ void SynthModular::UpdatePluginGUIs()
{
if (i->second->m_DeviceGUI->GetPluginWindow())
{
i->second->m_DeviceGUI->GetPluginWindow()->redraw();
SpiralPluginGUI *GUI=(SpiralPluginGUI *)i->second->m_DeviceGUI->GetPluginWindow();
GUI->Update();
}
if (i->second->m_DeviceGUI->Killed())
@@ -632,7 +633,7 @@ void SynthModular::UpdateHostInfo()
m_Info.OUTPUTFILE = SpiralInfo::OUTPUTFILE;
m_Info.MIDIFILE = SpiralInfo::MIDIFILE;
m_Info.POLY = SpiralInfo::POLY;
str>>*this;
}

@@ -674,7 +675,7 @@ istream &operator>>(istream &s, SynthModular &o)
int Num, ID, PluginID, x,y,ps,px,py;
s>>dummy>>Num;
for(int n=0; n<Num; n++)
{
//cerr<<"Loading Device "<<n<<endl;


+ 4
- 0
configure.in View File

@@ -88,6 +88,10 @@ else
FLTK_CXXFLAGS=`$FLTK_CONFIG $fltk_config_args --cxxflags`
FLTK_CFLAGS=`$FLTK_CONFIG $fltk_config_args --cxxflags`
FLTK_LIBS=`$FLTK_CONFIG $fltk_config_args --ldflags`
if test "${FLTK_LIBS/*-rpath*/yes}" != "yes"; then
echo "*** FLTK needs to be configured with --enable-shared"
exit 1
fi
fi
AC_SUBST(FLTK_CXXFLAGS)
AC_SUBST(FLTK_CFLAGS)


+ 15
- 3
main.cpp View File

@@ -35,16 +35,25 @@ int pthread_create_realtime (pthread_t *new_thread,
void *(*start)(void *), void *arg,
int priority);

bool CallbackOnly = false;

void audioloop(void* o)
{
while(1)
{
if (!synth->CallbackMode())
{
// do funky stuff
synth->Update();
// slow down this thread if we are not going to be using the
// oss plugin. prevents maxing the CPU out for no reason.
if (CallbackOnly) usleep(100);
}
else
{
// the engine is currently in callback mode, so we don't
// need to do anything unless we are switched back
usleep(1000000);
}
}
@@ -69,6 +78,7 @@ int main(int argc, char **argv)
{
if (!strcmp(argv[a],"--NoGUI")) GUI = false;
else if (!strcmp(argv[a],"--SHED_FIFO")) FIFO = true;
else if (!strcmp(argv[a],"--CallbackOnly")) CallbackOnly = true;
else
{
cmd_filename = argv[1];
@@ -85,17 +95,19 @@ int main(int argc, char **argv)
Fl_Window* win = synth->CreateWindow();
synth->LoadPlugins();
win->xclass("");
if (GUI) win->show(argc, argv); // prevents stuff happening before the plugins have loaded
if (GUI) win->show(1, argv); // prevents stuff happening before the plugins have loaded
// set some fltk defaults
Fl_Tooltip::size(10);
Fl::visible_focus(false);
// spawn the audio thread
int ret;
if (FIFO) ret=pthread_create_realtime(&loopthread,(void*(*)(void*))audioloop,NULL,10);
else ret=pthread_create(&loopthread,NULL,(void*(*)(void*))audioloop,NULL);

pthread_t GUIThread = pthread_self();
// do we need to load a patch on startup?
if (cmd_specd) synth->LoadPatch(cmd_filename.c_str());


Loading…
Cancel
Save