/[svn]/linuxsampler/trunk/src/plugins/InstrumentEditor.cpp
ViewVC logotype

Contents of /linuxsampler/trunk/src/plugins/InstrumentEditor.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1876 - (show annotations) (download)
Fri Mar 27 12:16:12 2009 UTC (15 years, 1 month ago) by schoenebeck
File size: 5020 byte(s)
* added optional 3rd party user data parameter for following
  liblinuxsampler C++ API methods: InstrumentEditor::Main(),
  InstrumentEditor::Launch(), InstrumentManager::LaunchInstrumentEditor()
* minor cosmetics regarding configure script summary
* debian packaging: include DSSI and LV2 plugin binaries of the sampler
  into the liblinuxsampler package
* RPM packaging: include DSSI and LV2 plugin binaries of the sampler
  into the liblinuxsampler package
* bumped version to 0.5.1.12cvs

1 /***************************************************************************
2 * *
3 * Copyright (C) 2007 - 2009 Christian Schoenebeck *
4 * *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
9 * *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the Free Software *
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, *
18 * MA 02111-1307 USA *
19 ***************************************************************************/
20
21 #include "InstrumentEditor.h"
22
23 #include "../common/global_private.h"
24 #include "../common/atomic.h"
25
26 #include <algorithm>
27 #include <functional>
28
29 namespace LinuxSampler {
30
31 InstrumentEditor::InstrumentEditor() : Thread(false, false, -1, 0) {
32 pInstrument = NULL;
33 pUserData = NULL;
34 }
35
36 InstrumentEditor::~InstrumentEditor() {
37 }
38
39 void InstrumentEditor::Launch(void* pInstrument, String sTypeName, String sTypeVersion, void* pUserData) {
40 dmsg(1,("InstrumentEditor::Launch(instr=%x,type=%s,version=%s)\n", pInstrument, sTypeName.c_str(), sTypeVersion.c_str()));
41 // prepare the editor's mandatory parameters
42 this->pInstrument = pInstrument;
43 this->sTypeName = sTypeName;
44 this->sTypeVersion = sTypeVersion;
45 this->pUserData = pUserData;
46 // start the editor in its own thread
47 StartThread();
48 }
49
50 int InstrumentEditor::Main() {
51 dmsg(1,("InstrumentEditor::Main()\n"));
52 // run the editor's main loop
53 int iResult = Main(pInstrument, sTypeName, sTypeVersion, pUserData);
54 // reset editor parameters
55 this->pInstrument = NULL;
56 this->sTypeName = "";
57 this->sTypeVersion = "";
58 this->pUserData = NULL;
59 dmsg(1,("Instrument editor '%s' returned with exit status %d\n", Name().c_str(), iResult));
60 // notify all registered listeners
61 std::for_each(
62 listeners.begin(), listeners.end(),
63 std::bind2nd(std::mem_fun(&InstrumentEditorListener::OnInstrumentEditorQuit), this)
64 );
65 // done
66 return iResult;
67 }
68
69 void InstrumentEditor::AddListener(InstrumentEditorListener* pListener) {
70 listeners.insert(pListener);
71 }
72
73 void InstrumentEditor::RemoveListener(InstrumentEditorListener* pListener) {
74 listeners.erase(pListener);
75 }
76
77 void InstrumentEditor::NotifySamplesToBeRemoved(std::set<void*> Samples) {
78 for ( // notify all registered listeners
79 std::set<InstrumentEditorListener*>::iterator iter = listeners.begin();
80 iter != listeners.end(); iter++
81 ) (*iter)->OnSamplesToBeRemoved(Samples, this);
82 }
83
84 void InstrumentEditor::NotifySamplesRemoved() {
85 for ( // notify all registered listeners
86 std::set<InstrumentEditorListener*>::iterator iter = listeners.begin();
87 iter != listeners.end(); iter++
88 ) (*iter)->OnSamplesRemoved(this);
89 }
90
91 void InstrumentEditor::NotifyDataStructureToBeChanged(void* pStruct, String sStructType) {
92 for ( // notify all registered listeners
93 std::set<InstrumentEditorListener*>::iterator iter = listeners.begin();
94 iter != listeners.end(); iter++
95 ) (*iter)->OnDataStructureToBeChanged(pStruct, sStructType, this);
96 }
97
98 void InstrumentEditor::NotifyDataStructureChanged(void* pStruct, String sStructType) {
99 for ( // notify all registered listeners
100 std::set<InstrumentEditorListener*>::iterator iter = listeners.begin();
101 iter != listeners.end(); iter++
102 ) (*iter)->OnDataStructureChanged(pStruct, sStructType, this);
103 }
104
105 void InstrumentEditor::NotifySampleReferenceChanged(void* pOldSample, void* pNewSample) {
106 for ( // notify all registered listeners
107 std::set<InstrumentEditorListener*>::iterator iter = listeners.begin();
108 iter != listeners.end(); iter++
109 ) (*iter)->OnSampleReferenceChanged(pOldSample, pNewSample, this);
110 }
111
112 } // namespace LinuxSampler

  ViewVC Help
Powered by ViewVC