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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2343 - (hide annotations) (download)
Sun Apr 29 16:14:45 2012 UTC (12 years ago) by persson
File size: 4990 byte(s)
* fixed configure script error with old autoconf versions
* LV2: use the new lv2 package if present
* lsatomic.h: use gcc provided atomic functions if building with gcc
  4.7 and C++11
* added comments in lsatomic.h

1 schoenebeck 1374 /***************************************************************************
2     * *
3 schoenebeck 1876 * Copyright (C) 2007 - 2009 Christian Schoenebeck *
4 schoenebeck 1374 * *
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 schoenebeck 1425 #include "../common/global_private.h"
24    
25 schoenebeck 1374 #include <algorithm>
26     #include <functional>
27    
28     namespace LinuxSampler {
29    
30     InstrumentEditor::InstrumentEditor() : Thread(false, false, -1, 0) {
31     pInstrument = NULL;
32 schoenebeck 1876 pUserData = NULL;
33 schoenebeck 1374 }
34    
35 schoenebeck 1653 InstrumentEditor::~InstrumentEditor() {
36     }
37    
38 schoenebeck 1876 void InstrumentEditor::Launch(void* pInstrument, String sTypeName, String sTypeVersion, void* pUserData) {
39 schoenebeck 1374 dmsg(1,("InstrumentEditor::Launch(instr=%x,type=%s,version=%s)\n", pInstrument, sTypeName.c_str(), sTypeVersion.c_str()));
40     // prepare the editor's mandatory parameters
41     this->pInstrument = pInstrument;
42     this->sTypeName = sTypeName;
43     this->sTypeVersion = sTypeVersion;
44 schoenebeck 1876 this->pUserData = pUserData;
45 schoenebeck 1374 // start the editor in its own thread
46     StartThread();
47     }
48    
49     int InstrumentEditor::Main() {
50     dmsg(1,("InstrumentEditor::Main()\n"));
51     // run the editor's main loop
52 schoenebeck 1876 int iResult = Main(pInstrument, sTypeName, sTypeVersion, pUserData);
53 schoenebeck 1374 // reset editor parameters
54     this->pInstrument = NULL;
55     this->sTypeName = "";
56     this->sTypeVersion = "";
57 schoenebeck 1876 this->pUserData = NULL;
58 schoenebeck 1374 dmsg(1,("Instrument editor '%s' returned with exit status %d\n", Name().c_str(), iResult));
59     // notify all registered listeners
60     std::for_each(
61     listeners.begin(), listeners.end(),
62     std::bind2nd(std::mem_fun(&InstrumentEditorListener::OnInstrumentEditorQuit), this)
63     );
64     // done
65     return iResult;
66     }
67    
68     void InstrumentEditor::AddListener(InstrumentEditorListener* pListener) {
69     listeners.insert(pListener);
70     }
71    
72     void InstrumentEditor::RemoveListener(InstrumentEditorListener* pListener) {
73     listeners.erase(pListener);
74     }
75    
76     void InstrumentEditor::NotifySamplesToBeRemoved(std::set<void*> Samples) {
77     for ( // notify all registered listeners
78     std::set<InstrumentEditorListener*>::iterator iter = listeners.begin();
79     iter != listeners.end(); iter++
80     ) (*iter)->OnSamplesToBeRemoved(Samples, this);
81     }
82    
83     void InstrumentEditor::NotifySamplesRemoved() {
84     for ( // notify all registered listeners
85     std::set<InstrumentEditorListener*>::iterator iter = listeners.begin();
86     iter != listeners.end(); iter++
87     ) (*iter)->OnSamplesRemoved(this);
88     }
89    
90     void InstrumentEditor::NotifyDataStructureToBeChanged(void* pStruct, String sStructType) {
91     for ( // notify all registered listeners
92     std::set<InstrumentEditorListener*>::iterator iter = listeners.begin();
93     iter != listeners.end(); iter++
94     ) (*iter)->OnDataStructureToBeChanged(pStruct, sStructType, this);
95     }
96    
97     void InstrumentEditor::NotifyDataStructureChanged(void* pStruct, String sStructType) {
98     for ( // notify all registered listeners
99     std::set<InstrumentEditorListener*>::iterator iter = listeners.begin();
100     iter != listeners.end(); iter++
101     ) (*iter)->OnDataStructureChanged(pStruct, sStructType, this);
102     }
103    
104     void InstrumentEditor::NotifySampleReferenceChanged(void* pOldSample, void* pNewSample) {
105     for ( // notify all registered listeners
106     std::set<InstrumentEditorListener*>::iterator iter = listeners.begin();
107     iter != listeners.end(); iter++
108     ) (*iter)->OnSampleReferenceChanged(pOldSample, pNewSample, this);
109     }
110    
111     } // namespace LinuxSampler

  ViewVC Help
Powered by ViewVC