19 |
|
|
20 |
#include "linuxsamplerplugin.h" |
#include "linuxsamplerplugin.h" |
21 |
|
|
|
#include <gig.h> |
|
22 |
#include <linuxsampler/engines/InstrumentEditorFactory.h> |
#include <linuxsampler/engines/InstrumentEditorFactory.h> |
23 |
#include "../gigedit/gigedit.h" |
#include "../gigedit/gigedit.h" |
24 |
|
|
25 |
#include <iostream> |
#include <iostream> |
26 |
|
#include <sigc++/bind.h> |
27 |
|
|
28 |
REGISTER_INSTRUMENT_EDITOR(LinuxSamplerPlugin) |
REGISTER_INSTRUMENT_EDITOR(LinuxSamplerPlugin) |
29 |
|
|
33 |
int LinuxSamplerPlugin::Main(void* pInstrument, String sTypeName, String sTypeVersion) { |
int LinuxSamplerPlugin::Main(void* pInstrument, String sTypeName, String sTypeVersion) { |
34 |
std::cout << "Entered Gigedit Main() loop :)\n" << std::flush; |
std::cout << "Entered Gigedit Main() loop :)\n" << std::flush; |
35 |
gig::Instrument* pGigInstr = static_cast<gig::Instrument*>(pInstrument); |
gig::Instrument* pGigInstr = static_cast<gig::Instrument*>(pInstrument); |
36 |
return GigEdit::run(pGigInstr); |
GigEdit app; |
37 |
|
// connect notification signals |
38 |
|
app.signal_file_structure_to_be_changed().connect( |
39 |
|
sigc::bind( |
40 |
|
sigc::mem_fun( |
41 |
|
*this, &LinuxSamplerPlugin::NotifyDataStructureToBeChanged |
42 |
|
), |
43 |
|
"gig::File" |
44 |
|
) |
45 |
|
); |
46 |
|
app.signal_file_structure_changed().connect( |
47 |
|
sigc::bind( |
48 |
|
sigc::mem_fun( |
49 |
|
*this, &LinuxSamplerPlugin::NotifyDataStructureChanged |
50 |
|
), |
51 |
|
"gig::File" |
52 |
|
) |
53 |
|
); |
54 |
|
app.signal_samples_to_be_removed().connect( |
55 |
|
sigc::mem_fun(*this, &LinuxSamplerPlugin::__onSamplesToBeRemoved) |
56 |
|
); |
57 |
|
app.signal_samples_removed().connect( |
58 |
|
sigc::mem_fun(*this, &LinuxSamplerPlugin::NotifySamplesRemoved) |
59 |
|
); |
60 |
|
app.signal_region_to_be_changed().connect( |
61 |
|
sigc::bind( |
62 |
|
sigc::mem_fun( |
63 |
|
*this, &LinuxSamplerPlugin::NotifyDataStructureToBeChanged |
64 |
|
), |
65 |
|
"gig::Region" |
66 |
|
) |
67 |
|
); |
68 |
|
app.signal_region_changed().connect( |
69 |
|
sigc::bind( |
70 |
|
sigc::mem_fun( |
71 |
|
*this, &LinuxSamplerPlugin::NotifyDataStructureChanged |
72 |
|
), |
73 |
|
"gig::Region" |
74 |
|
) |
75 |
|
); |
76 |
|
app.signal_dimreg_to_be_changed().connect( |
77 |
|
sigc::bind( |
78 |
|
sigc::mem_fun( |
79 |
|
*this, &LinuxSamplerPlugin::NotifyDataStructureToBeChanged |
80 |
|
), |
81 |
|
"gig::DimensionRegion" |
82 |
|
) |
83 |
|
); |
84 |
|
app.signal_dimreg_changed().connect( |
85 |
|
sigc::bind( |
86 |
|
sigc::mem_fun( |
87 |
|
*this, &LinuxSamplerPlugin::NotifyDataStructureChanged |
88 |
|
), |
89 |
|
"gig::DimensionRegion" |
90 |
|
) |
91 |
|
); |
92 |
|
app.signal_sample_ref_changed().connect( |
93 |
|
sigc::mem_fun(*this, &LinuxSamplerPlugin::NotifySampleReferenceChanged) |
94 |
|
); |
95 |
|
// run gigedit application |
96 |
|
return app.run(pGigInstr); |
97 |
|
} |
98 |
|
|
99 |
|
void LinuxSamplerPlugin::__onSamplesToBeRemoved(std::list<gig::Sample*> lSamples) { |
100 |
|
// we have to convert the gig::Sample* list to a void* list first |
101 |
|
std::set<void*> samples; |
102 |
|
for ( |
103 |
|
std::list<gig::Sample*>::iterator iter = lSamples.begin(); |
104 |
|
iter != lSamples.end(); iter++ |
105 |
|
) samples.insert((void*)*iter); |
106 |
|
// finally send notification to sampler |
107 |
|
NotifySamplesToBeRemoved(samples); |
108 |
} |
} |
109 |
|
|
110 |
bool LinuxSamplerPlugin::IsTypeSupported(String sTypeName, String sTypeVersion) { |
bool LinuxSamplerPlugin::IsTypeSupported(String sTypeName, String sTypeVersion) { |