--- gigedit/trunk/src/plugin/linuxsamplerplugin.cpp 2008/01/30 02:20:48 1654 +++ gigedit/trunk/src/plugin/linuxsamplerplugin.cpp 2008/02/02 08:18:19 1656 @@ -20,9 +20,11 @@ #include "linuxsamplerplugin.h" #include +#include "../gigedit/gigedit.h" #include #include +#include REGISTER_INSTRUMENT_EDITOR(LinuxSamplerPlugin) @@ -98,13 +100,22 @@ sigc::mem_fun(*this, &LinuxSamplerPlugin::NotifySampleReferenceChanged) ); - app->add_timeout_job(this); + // register a timeout job to gigedit's main loop, so we can poll the + // the sampler periodically for MIDI events (I HOPE it works on all + // archs, because gigedit is actually running in another thread than + // the one that is calling this timeout handler register code) + const Glib::RefPtr timeout_source = + Glib::TimeoutSource::create(100); // poll every 100ms + timeout_source->connect( + sigc::mem_fun(this, &LinuxSamplerPlugin::__onPollPeriod) + ); + timeout_source->attach(Glib::MainContext::get_default()); // run gigedit application return app->run(pGigInstr); } -bool LinuxSamplerPlugin::runGigEditJob() { +bool LinuxSamplerPlugin::__onPollPeriod() { GigEdit* app = (GigEdit*) pApp; if (!NotesChanged()) return true; for (int iKey = 0; iKey < 128; iKey++)