linuxsampler 2.3.1
InstrumentEditor.h
Go to the documentation of this file.
1/***************************************************************************
2 * *
3 * Copyright (C) 2007 - 2015 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#ifndef LS_INSTRUMENT_EDITOR_H
22#define LS_INSTRUMENT_EDITOR_H
23
24#include "../common/global.h"
25#include "../common/Thread.h"
26#include "../drivers/midi/VirtualMidiDevice.h"
27
28#include <set>
29
30namespace LinuxSampler {
31
32 // just symbol prototyping
33 class InstrumentEditorListener;
34 class EngineChannel;
35
51 class InstrumentEditor : public VirtualMidiDevice, protected Thread {
52 public:
53
55 // abstract methods
56 // (these have to be implemented by the descendant)
57
74 virtual int Main(void* pInstrument, String sTypeName, String sTypeVersion, void* pUserData = NULL) = 0;
75
86 virtual bool IsTypeSupported(String sTypeName, String sTypeVersion) = 0;
87
91 virtual String Name() = 0;
92
96 virtual String Version() = 0;
97
102 virtual String Description() = 0;
103
104
105
107 // normal methods
108 // (usually not to be overriden by descendant)
109
123 void NotifySamplesToBeRemoved(std::set<void*> Samples);
124
131
153
164
192
210 void Launch(EngineChannel* pEngineChannel, void* pInstrument, String sTypeName, String sTypeVersion, void* pUserData = NULL);
211
218
223
228
233
238
239 protected:
240 std::set<InstrumentEditorListener*> listeners;
241
242 // derived abstract method from base class 'Thread'
243 virtual int Main();
244 private:
245 void* pInstrument;
246 String sTypeName;
247 String sTypeVersion;
248 void* pUserData;
249 EngineChannel* pEngineChannel;
250 };
251
332
333} // namespace LinuxSampler
334
335#endif // LS_INSTRUMENT_EDITOR_H
Channel Interface for LinuxSampler Sampler Engines.
Instrument Editor Notifications.
virtual void OnSampleReferenceChanged(void *pOldSample, void *pNewSample, InstrumentEditor *pSender)=0
Called after some data structure changed its reference to a sample.
virtual void OnInstrumentEditorQuit(InstrumentEditor *pSender)=0
Called after the instrument editor stopped running.
virtual void OnSamplesRemoved(InstrumentEditor *pSender)=0
Called after samples have been deleted.
virtual void OnDataStructureToBeChanged(void *pStruct, String sStructType, InstrumentEditor *pSender)=0
Called before data structure is to be modified.
virtual void OnDataStructureChanged(void *pStruct, String sStructType, InstrumentEditor *pSender)=0
Called after data structure has been modified.
virtual void OnSamplesToBeRemoved(std::set< void * > Samples, InstrumentEditor *pSender)=0
Called before samples are to be deleted.
Instrument Editor Interface (external plugin)
virtual String Description()=0
Arbitrary textual description of the instrument editor (i.e.
void AddListener(InstrumentEditorListener *pListener)
Registers object that wants to be notified on events.
void NotifySamplesRemoved()
Dispatch completed sample removal event.
virtual String Version()=0
The instrument editor's version (i.e.
virtual int Main()
This method needs to be implemented by the descending class and is the entry point for the new thread...
EngineChannel * GetEngineChannel()
Returns the EngineChannel for which this instrument editor was spawned for, for editing the respectiv...
void NotifySampleReferenceChanged(void *pOldSample, void *pNewSample)
Dispatch sample reference changed event.
virtual int Main(void *pInstrument, String sTypeName, String sTypeVersion, void *pUserData=NULL)=0
Entry point for the instrument editor's thread.
void NotifyDataStructureChanged(void *pStruct, String sStructType)
Dispatch completed data structure modification event.
void Launch(EngineChannel *pEngineChannel, void *pInstrument, String sTypeName, String sTypeVersion, void *pUserData=NULL)
Launch the instrument editor for the given instrument.
virtual ~InstrumentEditor()
Destructor.
std::set< InstrumentEditorListener * > listeners
void RemoveListener(InstrumentEditorListener *pListener)
Unregisters object that doesn't want to be notified anymore.
virtual bool IsTypeSupported(String sTypeName, String sTypeVersion)=0
The instrument editor has to return true in case it supports the given instrument data structure type...
void NotifyDataStructureToBeChanged(void *pStruct, String sStructType)
Dispatch pending data structure modification event.
void NotifySamplesToBeRemoved(std::set< void * > Samples)
Dispatch pending sample removal event.
virtual String Name()=0
The instrument editor's name (i.e.
Wraps as a kind of pointer class some data object shared with other threads, to protect / synchronize...
Abstract base class for classes that need to run in an own thread.
Definition Thread.h:64
Light-weight MIDI interface (for MIDI in & out) intended to be used by pure software MIDI "devices",...
std::string String
Definition global.h:44