20 |
#include "linuxsamplerplugin.h" |
#include "linuxsamplerplugin.h" |
21 |
|
|
22 |
#include <linuxsampler/plugins/InstrumentEditorFactory.h> |
#include <linuxsampler/plugins/InstrumentEditorFactory.h> |
23 |
|
#include "../gigedit/gigedit.h" |
24 |
|
|
25 |
#include <iostream> |
#include <iostream> |
26 |
#include <sigc++/bind.h> |
#include <sigc++/bind.h> |
27 |
|
#include <glibmm/main.h> |
28 |
|
|
29 |
REGISTER_INSTRUMENT_EDITOR(LinuxSamplerPlugin) |
REGISTER_INSTRUMENT_EDITOR(LinuxSamplerPlugin) |
30 |
|
|
100 |
sigc::mem_fun(*this, &LinuxSamplerPlugin::NotifySampleReferenceChanged) |
sigc::mem_fun(*this, &LinuxSamplerPlugin::NotifySampleReferenceChanged) |
101 |
); |
); |
102 |
|
|
103 |
app->add_timeout_job(this); |
// register a timeout job to gigedit's main loop, so we can poll the |
104 |
|
// the sampler periodically for MIDI events (I HOPE it works on all |
105 |
|
// archs, because gigedit is actually running in another thread than |
106 |
|
// the one that is calling this timeout handler register code) |
107 |
|
const Glib::RefPtr<Glib::TimeoutSource> timeout_source = |
108 |
|
Glib::TimeoutSource::create(100); // poll every 100ms |
109 |
|
timeout_source->connect( |
110 |
|
sigc::mem_fun(this, &LinuxSamplerPlugin::__onPollPeriod) |
111 |
|
); |
112 |
|
timeout_source->attach(Glib::MainContext::get_default()); |
113 |
|
|
114 |
// run gigedit application |
// run gigedit application |
115 |
return app->run(pGigInstr); |
return app->run(pGigInstr); |
116 |
} |
} |
117 |
|
|
118 |
bool LinuxSamplerPlugin::runGigEditJob() { |
bool LinuxSamplerPlugin::__onPollPeriod() { |
119 |
GigEdit* app = (GigEdit*) pApp; |
GigEdit* app = (GigEdit*) pApp; |
120 |
if (!NotesChanged()) return true; |
if (!NotesChanged()) return true; |
121 |
for (int iKey = 0; iKey < 128; iKey++) |
for (int iKey = 0; iKey < 128; iKey++) |