linuxsampler 1.0.0
|
00001 /*************************************************************************** 00002 * * 00003 * Copyright (C) 2007 - 2009 Christian Schoenebeck * 00004 * * 00005 * This program is free software; you can redistribute it and/or modify * 00006 * it under the terms of the GNU General Public License as published by * 00007 * the Free Software Foundation; either version 2 of the License, or * 00008 * (at your option) any later version. * 00009 * * 00010 * This program is distributed in the hope that it will be useful, * 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00013 * GNU General Public License for more details. * 00014 * * 00015 * You should have received a copy of the GNU General Public License * 00016 * along with this program; if not, write to the Free Software * 00017 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, * 00018 * MA 02111-1307 USA * 00019 ***************************************************************************/ 00020 00021 #ifndef LS_INSTRUMENT_EDITOR_H 00022 #define LS_INSTRUMENT_EDITOR_H 00023 00024 #include "../common/global.h" 00025 #include "../common/Thread.h" 00026 #include "../drivers/midi/VirtualMidiDevice.h" 00027 00028 #include <set> 00029 00030 namespace LinuxSampler { 00031 00032 // just symbol prototyping 00033 class InstrumentEditorListener; 00034 00050 class InstrumentEditor : public VirtualMidiDevice, protected Thread { 00051 public: 00052 00054 // abstract methods 00055 // (these have to be implemented by the descendant) 00056 00073 virtual int Main(void* pInstrument, String sTypeName, String sTypeVersion, void* pUserData = NULL) = 0; 00074 00085 virtual bool IsTypeSupported(String sTypeName, String sTypeVersion) = 0; 00086 00090 virtual String Name() = 0; 00091 00095 virtual String Version() = 0; 00096 00101 virtual String Description() = 0; 00102 00103 00104 00106 // normal methods 00107 // (usually not to be overriden by descendant) 00108 00122 void NotifySamplesToBeRemoved(std::set<void*> Samples); 00123 00129 void NotifySamplesRemoved(); 00130 00151 void NotifyDataStructureToBeChanged(void* pStruct, String sStructType); 00152 00162 void NotifyDataStructureChanged(void* pStruct, String sStructType); 00163 00190 void NotifySampleReferenceChanged(void* pOldSample, void* pNewSample); 00191 00201 void Launch(void* pInstrument, String sTypeName, String sTypeVersion, void* pUserData = NULL); 00202 00206 void AddListener(InstrumentEditorListener* pListener); 00207 00211 void RemoveListener(InstrumentEditorListener* pListener); 00212 00216 InstrumentEditor(); 00217 00221 virtual ~InstrumentEditor(); 00222 00223 protected: 00224 std::set<InstrumentEditorListener*> listeners; 00225 00226 // derived abstract method from base class 'Thread' 00227 virtual int Main(); 00228 private: 00229 void* pInstrument; 00230 String sTypeName; 00231 String sTypeVersion; 00232 void* pUserData; 00233 }; 00234 00243 class InstrumentEditorListener { 00244 public: 00252 virtual void OnInstrumentEditorQuit(InstrumentEditor* pSender) = 0; 00253 00265 virtual void OnSamplesToBeRemoved(std::set<void*> Samples, InstrumentEditor* pSender) = 0; 00266 00275 virtual void OnSamplesRemoved(InstrumentEditor* pSender) = 0; 00276 00289 virtual void OnDataStructureToBeChanged(void* pStruct, String sStructType, InstrumentEditor* pSender) = 0; 00290 00302 virtual void OnDataStructureChanged(void* pStruct, String sStructType, InstrumentEditor* pSender) = 0; 00303 00313 virtual void OnSampleReferenceChanged(void* pOldSample, void* pNewSample, InstrumentEditor* pSender) = 0; 00314 }; 00315 00316 } // namespace LinuxSampler 00317 00318 #endif // LS_INSTRUMENT_EDITOR_H