/[svn]/gigedit/trunk/src/plugin/linuxsamplerplugin.cpp
ViewVC logotype

Contents of /gigedit/trunk/src/plugin/linuxsamplerplugin.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1376 - (show annotations) (download)
Wed Oct 3 19:15:47 2007 UTC (12 years, 10 months ago) by schoenebeck
File size: 3977 byte(s)
* honored recent LS refactoring: #include paths for LS instrument
  editor plugin classes have changed to:

  <linuxsampler/plugins/InstrumentEditor.h>,
  <linuxsampler/plugins/InstrumentEditorFactory.h>

1 /*
2 * Copyright (C) 2007 Andreas Persson
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation; either version 2, or (at
7 * your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with program; see the file COPYING. If not, write to the Free
16 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
17 * 02110-1301 USA.
18 */
19
20 #include "linuxsamplerplugin.h"
21
22 #include <linuxsampler/plugins/InstrumentEditorFactory.h>
23 #include "../gigedit/gigedit.h"
24
25 #include <iostream>
26 #include <sigc++/bind.h>
27
28 REGISTER_INSTRUMENT_EDITOR(LinuxSamplerPlugin)
29
30 LinuxSamplerPlugin::LinuxSamplerPlugin() {
31 }
32
33 int LinuxSamplerPlugin::Main(void* pInstrument, String sTypeName, String sTypeVersion) {
34 std::cout << "Entered Gigedit Main() loop :)\n" << std::flush;
35 gig::Instrument* pGigInstr = static_cast<gig::Instrument*>(pInstrument);
36 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) {
111 return sTypeName == gig::libraryName() &&
112 sTypeVersion == gig::libraryVersion();
113 }
114
115 String LinuxSamplerPlugin::Name() {
116 return "gigedit";
117 }
118
119 String LinuxSamplerPlugin::Version() {
120 return VERSION; // gigedit's version
121 }
122
123 String LinuxSamplerPlugin::Description() {
124 return "Gigedit is an instrument editor for gig files.";
125 }

  ViewVC Help
Powered by ViewVC