1 |
/*************************************************************************** |
/*************************************************************************** |
2 |
* * |
* * |
3 |
* Copyright (C) 2007 Grigor Iliev * |
* Copyright (C) 2007, 2008 Grigor Iliev * |
4 |
* * |
* * |
5 |
* This program is free software; you can redistribute it and/or modify * |
* 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 * |
* it under the terms of the GNU General Public License as published by * |
26 |
|
|
27 |
namespace LinuxSampler { |
namespace LinuxSampler { |
28 |
|
|
29 |
|
// just symbol prototyping |
30 |
|
class SamplerChannel; |
31 |
|
class MidiInputDevice; |
32 |
|
class MidiInputPort; |
33 |
|
|
34 |
template<class L> |
template<class L> |
35 |
class ListenerList { |
class ListenerList { |
36 |
public: |
public: |
81 |
std::vector<L> vListenerList; |
std::vector<L> vListenerList; |
82 |
}; |
}; |
83 |
|
|
84 |
|
#define REGISTER_FIRE_EVENT_METHOD(method) virtual void method() \ |
85 |
|
{ for(int i = 0; i < GetListenerCount(); i++) GetListener(i)->method(); } |
86 |
|
|
87 |
|
#define REGISTER_FIRE_EVENT_METHOD_ARG1(method, T1) virtual void method(T1 _evt_arg1_) \ |
88 |
|
{ for(int i = 0; i < GetListenerCount(); i++) GetListener(i)->method(_evt_arg1_); } |
89 |
|
|
90 |
|
#define REGISTER_FIRE_EVENT_METHOD_ARG2(method, T1, T2) virtual void method(T1 _evt_arg1_, T2 _evt_arg2_) \ |
91 |
|
{ for(int i = 0; i < GetListenerCount(); i++) GetListener(i)->method(_evt_arg1_, _evt_arg2_); } |
92 |
|
|
93 |
/** |
/** |
94 |
* This class is used as a listener, which is notified |
* This class is used as a listener, which is notified |
95 |
* when the number of sampler channels is changed. |
* when the number of sampler channels is changed. |
101 |
* @param NewCount The new number of sampler channels. |
* @param NewCount The new number of sampler channels. |
102 |
*/ |
*/ |
103 |
virtual void ChannelCountChanged(int NewCount) = 0; |
virtual void ChannelCountChanged(int NewCount) = 0; |
104 |
|
virtual void ChannelAdded(SamplerChannel* pChannel) = 0; |
105 |
|
virtual void ChannelToBeRemoved(SamplerChannel* pChannel) = 0; |
106 |
|
}; |
107 |
|
|
108 |
|
/** |
109 |
|
* This class exists as convenience for creating listener objects. |
110 |
|
* The methods in this class are empty. |
111 |
|
*/ |
112 |
|
class ChannelCountAdapter : public ChannelCountListener { |
113 |
|
public: |
114 |
|
virtual void ChannelCountChanged(int NewCount) { }; |
115 |
|
virtual void ChannelAdded(SamplerChannel* pChannel) { }; |
116 |
|
virtual void ChannelToBeRemoved(SamplerChannel* pChannel) { }; |
117 |
}; |
}; |
118 |
|
|
119 |
/** |
/** |
140 |
* @param NewCount The new number of MIDI input devices. |
* @param NewCount The new number of MIDI input devices. |
141 |
*/ |
*/ |
142 |
virtual void MidiDeviceCountChanged(int NewCount) = 0; |
virtual void MidiDeviceCountChanged(int NewCount) = 0; |
143 |
|
|
144 |
|
/** |
145 |
|
* Invoked right before the supplied MIDI input device is going |
146 |
|
* to be destroyed. |
147 |
|
* @param pDevice MidiInputDevice to be deleted |
148 |
|
*/ |
149 |
|
virtual void MidiDeviceToBeDestroyed(MidiInputDevice* pDevice) = 0; |
150 |
|
|
151 |
|
/** |
152 |
|
* Invoked to inform that a new MidiInputDevice has just been |
153 |
|
* created. |
154 |
|
* @param pDevice newly created MidiInputDevice |
155 |
|
*/ |
156 |
|
virtual void MidiDeviceCreated(MidiInputDevice* pDevice) = 0; |
157 |
|
}; |
158 |
|
|
159 |
|
/** |
160 |
|
* This class is used as a listener, which is notified |
161 |
|
* when the number of MIDI input ports is changed. |
162 |
|
*/ |
163 |
|
class MidiPortCountListener { |
164 |
|
public: |
165 |
|
/** |
166 |
|
* Invoked when the number of MIDI input ports has changed. |
167 |
|
* @param NewCount The new number of MIDI input ports. |
168 |
|
*/ |
169 |
|
virtual void MidiPortCountChanged(int NewCount) = 0; |
170 |
|
|
171 |
|
/** |
172 |
|
* Invoked right before the supplied MIDI input port is going |
173 |
|
* to be destroyed. |
174 |
|
* @param pPort MidiInputPort to be deleted |
175 |
|
*/ |
176 |
|
virtual void MidiPortToBeRemoved(MidiInputPort* pPort) = 0; |
177 |
|
|
178 |
|
/** |
179 |
|
* Invoked to inform that a new MidiInputPort has just been |
180 |
|
* added. |
181 |
|
* @param pPort newly created MidiInputPort |
182 |
|
*/ |
183 |
|
virtual void MidiPortAdded(MidiInputPort* pPort) = 0; |
184 |
}; |
}; |
185 |
|
|
186 |
/** |
/** |
331 |
class EngineChangeListener { |
class EngineChangeListener { |
332 |
public: |
public: |
333 |
/** |
/** |
334 |
|
* Invoked when the engine type of the specified sampler channel |
335 |
|
* is going to be changed soon. |
336 |
|
* @param ChannelId The numerical ID of the sampler channel |
337 |
|
*/ |
338 |
|
virtual void EngineToBeChanged(int ChannelId) = 0; |
339 |
|
|
340 |
|
/** |
341 |
* Invoked when the engine type of the |
* Invoked when the engine type of the |
342 |
* specified sampler channel is changed. |
* specified sampler channel was changed. |
343 |
* @param ChannelId The numerical ID of the sampler |
* @param ChannelId The numerical ID of the sampler |
344 |
* channel, which engine type has been changed. |
* channel, which engine type has been changed. |
345 |
*/ |
*/ |