/[svn]/linuxsampler/trunk/src/Sampler.h
ViewVC logotype

Annotation of /linuxsampler/trunk/src/Sampler.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1897 - (hide annotations) (download) (as text)
Sun May 10 09:31:51 2009 UTC (14 years, 11 months ago) by persson
File MIME type: text/x-c++hdr
File size: 28673 byte(s)
* Windows: look for editor plugins and Fantasia using base directory
  of liblinuxsampler dll
* lscp bugfix: SET CHANNEL MIDI_INPUT_TYPE didn't work with the MME
  driver

1 schoenebeck 53 /***************************************************************************
2     * *
3     * LinuxSampler - modular, streaming capable sampler *
4     * *
5 schoenebeck 61 * Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck *
6 persson 1897 * Copyright (C) 2005 - 2009 Christian Schoenebeck *
7 schoenebeck 53 * *
8     * This program is free software; you can redistribute it and/or modify *
9     * it under the terms of the GNU General Public License as published by *
10     * the Free Software Foundation; either version 2 of the License, or *
11     * (at your option) any later version. *
12     * *
13     * This program is distributed in the hope that it will be useful, *
14     * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16     * GNU General Public License for more details. *
17     * *
18     * You should have received a copy of the GNU General Public License *
19     * along with this program; if not, write to the Free Software *
20     * Foundation, Inc., 59 Temple Place, Suite 330, Boston, *
21     * MA 02111-1307 USA *
22     ***************************************************************************/
23    
24     #ifndef __LS_SAMPLER_H__
25     #define __LS_SAMPLER_H__
26    
27     #include <vector>
28     #include <map>
29 iliev 1130 #include "EventListeners.h"
30 schoenebeck 53 #include "common/global.h"
31 schoenebeck 880 #include "common/Exception.h"
32 schoenebeck 890 #include "engines/EngineChannel.h"
33 schoenebeck 203 #include "drivers/midi/MidiInputDevice.h"
34     #include "drivers/audio/AudioOutputDevice.h"
35 schoenebeck 53
36     namespace LinuxSampler {
37    
38     // just symbol prototyping
39     class Sampler;
40    
41 schoenebeck 411 /** @brief LinuxSampler sampler channel
42 schoenebeck 57 *
43 persson 840 * Encapsulates a channel of a specific sampler engine type, one
44 schoenebeck 411 * connection to a MIDI input device and one connection to an audio
45     * output device. You cannot create an instance of this class on your
46     * own, you have to use the AddSamplerChannel() method of the Sampler
47     * object to create a new sampler channel.
48 schoenebeck 57 */
49 schoenebeck 53 class SamplerChannel {
50     public:
51 schoenebeck 57 /**
52 schoenebeck 411 * Assign a sampler engine type to this sampler channel.
53 schoenebeck 57 *
54 schoenebeck 411 * @param EngineType - type of the engine to use
55 schoenebeck 880 * @throws Exception - if \a EngineType is invalid
56 schoenebeck 900 * @see Sampler::AvailableEngineTypes()
57 schoenebeck 57 */
58 schoenebeck 880 void SetEngineType(String EngineType) throw (Exception);
59 schoenebeck 57
60     /**
61 schoenebeck 123 * Connect this sampler channel to an audio output device, that
62     * is an instance of an audio output driver. If this sampler
63     * channel was already connected to an audio output device, then
64     * the old connection will automatically be removed before.
65 schoenebeck 57 *
66 schoenebeck 123 * @param pDevice - audio output device to connect to
67 schoenebeck 57 */
68 schoenebeck 123 void SetAudioOutputDevice(AudioOutputDevice* pDevice);
69 schoenebeck 57
70     /**
71 schoenebeck 411 * Connect this sampler channel to a MIDI input device.
72 schoenebeck 57 *
73 capela 159 * @param pDevice - MIDI input device to connect to
74     */
75     void SetMidiInputDevice(MidiInputDevice *pDevice);
76    
77     /**
78 schoenebeck 411 * Connect this sampler channel to a MIDI input port.
79 capela 159 *
80     * @param MidiPort - MIDI port to connect to
81     */
82     void SetMidiInputPort(int MidiPort);
83    
84     /**
85 schoenebeck 411 * Define on which MIDI channel(s) this sampler channel should
86     * listen to. By default, that is after creation of a new
87     * sampler channel, the sampler channel will listen to all MIDI
88     * channels.
89 capela 159 *
90 schoenebeck 411 * @param MidiChannel - MIDI channel to listen
91 capela 159 */
92 schoenebeck 675 void SetMidiInputChannel(midi_chan_t MidiChannel);
93 capela 159
94     /**
95     * Connect this sampler channel to a MIDI input triplet.
96     *
97     * @param pDevice - MIDI input device to connect to
98 schoenebeck 221 * @param iMidiPort - MIDI port to connect to
99 schoenebeck 57 * @param MidiChannel - optional: MIDI channel on which the
100     * sampler channel should listen to
101     * (default: listen on all MIDI channels)
102     */
103 schoenebeck 675 void SetMidiInput(MidiInputDevice* pDevice, int iMidiPort, midi_chan_t MidiChannel = midi_chan_all);
104 schoenebeck 57
105     /**
106 schoenebeck 411 * Returns the EngineChannel object that was deployed on this
107     * sampler channel appropriate to the given sampler engine type.
108 schoenebeck 57 *
109     * @returns pointer to engine or NULL if no engine deployed
110     */
111 schoenebeck 411 EngineChannel* GetEngineChannel();
112 schoenebeck 57
113     /**
114 capela 159 * Returns the MIDI input channel to which this sampler
115     * channel is currently connected to.
116 schoenebeck 57 *
117 capela 159 * @returns The MIDI input channel on which the sampler
118     * channel is listening to.
119 schoenebeck 57 */
120 schoenebeck 675 midi_chan_t GetMidiInputChannel();
121 schoenebeck 57
122     /**
123 capela 159 * Returns the MIDI input port number to which this sampler
124     * channel is currently connected to.
125     *
126     * @returns MIDI input port number or -1 if not connected
127     */
128     int GetMidiInputPort();
129    
130     /**
131 schoenebeck 57 * Returns the audio output device to which this sampler channel
132     * is currently connected to.
133     *
134     * @returns pointer to audio output device or NULL if not
135     * connected
136     */
137     AudioOutputDevice* GetAudioOutputDevice();
138    
139     /**
140 capela 159 * Returns the MIDI input device to which this sampler channel
141 senkov 155 * is currently connected to.
142     *
143 capela 159 * @returns pointer to MIDI input device or NULL if not
144 senkov 155 * connected
145     */
146     MidiInputDevice* GetMidiInputDevice();
147    
148     /**
149 schoenebeck 57 * Returns the index number of this sampler channel within the
150     * Sampler instance.
151     */
152     uint Index();
153 iliev 1761
154     /** Returns the sampler to which this channel belongs */
155     Sampler* GetSampler();
156 iliev 1130
157     /**
158     * Registers the specified listener to be notified
159     * when the engine type of this sampler channel is changed.
160     */
161     void AddEngineChangeListener(EngineChangeListener* l);
162 schoenebeck 57
163 iliev 1130 /**
164     * Removes the specified listener.
165     */
166     void RemoveEngineChangeListener(EngineChangeListener* l);
167    
168     /**
169     * Removes the specified listener.
170     */
171     void RemoveAllEngineChangeListeners();
172    
173     /**
174 schoenebeck 1686 * Notifies listeners that the engine type of this sampler
175     * channel is going to be changed soon.
176     */
177     void fireEngineToBeChanged();
178    
179     /**
180 iliev 1130 * Notifies listeners that the engine
181     * type of this sampler channel is changed.
182     */
183     void fireEngineChanged();
184    
185    
186 schoenebeck 57 protected:
187 schoenebeck 53 SamplerChannel(Sampler* pS);
188 letz 502 virtual ~SamplerChannel();
189 schoenebeck 57
190 capela 159 /** Getting MIDI input device port given its index number. */
191 schoenebeck 675 MidiInputPort* __GetMidiInputDevicePort(int iMidiPort);
192 schoenebeck 203
193 schoenebeck 53 Sampler* pSampler;
194 schoenebeck 411 EngineChannel* pEngineChannel;
195 schoenebeck 53 AudioOutputDevice* pAudioOutputDevice;
196 capela 159 MidiInputDevice* pMidiInputDevice;
197 schoenebeck 53 int iIndex;
198 schoenebeck 57
199     friend class Sampler;
200 schoenebeck 675 private:
201     int iMidiPort; ///< Don't access directly, read GetMidiInputPort() instead !
202     midi_chan_t midiChannel; ///< Don't access directly, read GetMidiInputChannel() instead !
203 iliev 1130 ListenerList<EngineChangeListener*> llEngineChangeListeners;
204 schoenebeck 53 };
205    
206 schoenebeck 411 /** @brief LinuxSampler main class
207 schoenebeck 57 *
208     * This is the toplevel class for a LinuxSampler instance.
209     *
210     * LinuxSampler can have arbitrary numbers of sampler channels. Each
211     * sampler channel can individually be deployed with it's own sampler
212     * engine, connected to an arbitrary MIDI input device and connected to
213     * an arbitrary audio output device. Here an example setup:
214 schoenebeck 675 * @code
215 schoenebeck 898 * S.Channel MIDI in S.Engine Audio out
216 schoenebeck 675 * -------------------------------------------------------------------
217 schoenebeck 898 * 0 Alsa -> gig::Engine -> Jack
218     * 1 VSTi -> Akai::Engine -> VSTi
219     * 2 Jack -> DLS::Engine -> Jack
220     * 3 Jack -> SF::Engine -> Alsa
221 schoenebeck 57 *
222 schoenebeck 675 * ... (and so on) ...
223     * @endcode
224 schoenebeck 57 *
225     * Note that not all audio and MIDI backends and sampler engines listed
226 schoenebeck 898 * in the example above might already been implemented!
227 schoenebeck 57 *
228     * As you can see in the example setup, LinuxSampler is capable to use
229     * several, different audio output and MIDI input systems
230     * simultaniously at the same time. Here the example setup shown in the
231 schoenebeck 898 * aspect of MIDI input and audio output devices / drivers:
232 schoenebeck 675 * @code
233 schoenebeck 898 * ######################### #########################
234     * # AudioOutputDeviceJack # # AudioOutputDeviceVSTi #
235     * ######################### #########################
236     * ^ ^ ^
237     * /------------>|Sampler Channel 0|-----/ | |
238     * | /--------->|Sampler Channel 1|---------------------/
239     * | | /------>|Sampler Channel 2|---------/
240     * | | | /--->|Sampler Channel 3|------------>#########################
241     * | | | | ... (and so on) ... # AudioOutputDeviceAlsa #
242     * | | | | #########################
243     * | | | \-----------------------------------------------------\
244     * | | \--------------------------------------------\ |
245     * | \--------------------\ | |
246     * | | | |
247 schoenebeck 675 * ####################### ####################### #######################
248     * # MidiInputDeviceAlsa # # MidiInputDeviceVSTi # # MidiInputDeviceJack #
249     * ####################### ####################### #######################
250     * @endcode
251 schoenebeck 57 *
252     * As you can see in this example setup, one device (that is midi input
253     * driver / audio output driver) can be connected multiple times to
254     * different sampler channels.
255 schoenebeck 898 *
256     * It's even possible to create multiple instances of the same driver, for
257     * example multiple instances of the Alsa output driver to use multiple
258     * sound cards at the same time, or multiple instances of the JACK audio
259     * output driver to leverage SMP systems or boxes with several hard discs.
260 schoenebeck 57 */
261 schoenebeck 53 class Sampler {
262     public:
263 schoenebeck 57 /**
264     * Constructor. Create a LinuxSampler instance.
265     */
266 schoenebeck 53 Sampler();
267 schoenebeck 57
268     /**
269     * Destructor.
270     */
271 letz 502 virtual ~Sampler();
272 schoenebeck 57
273     /**
274     * Returns the number of sampler channels currently allocated.
275     */
276     uint SamplerChannels();
277    
278     /**
279 schoenebeck 209 * Create and add a new sampler channel to this Sampler
280     * instance. For race condition reasons the new channel will use
281     * an index past the last already existing sampler channel
282     * index (in case the index limit was not reached yet, otherwise
283     * a free index starting from 0 is searched).
284 schoenebeck 57 *
285     * @returns pointer to new sampler channel
286     */
287     SamplerChannel* AddSamplerChannel();
288    
289     /**
290     * Returns the sampler channel of the given sampler channel
291     * index.
292     *
293     * @returns pointer to sought sampler channel
294     */
295     SamplerChannel* GetSamplerChannel(uint uiSamplerChannel);
296    
297     /**
298 schoenebeck 209 * Returns all created sampler channels.
299     */
300     std::map<uint, SamplerChannel*> GetSamplerChannels();
301    
302     /**
303 schoenebeck 57 * Destroy and remove the given sampler channel from this
304     * Sampler instance.
305     *
306     * @param pSamplerChannel - pointer to sampler channel to remove
307     */
308     void RemoveSamplerChannel(SamplerChannel* pSamplerChannel);
309    
310     /**
311     * Destroy and remove the given sampler channel from this
312     * Sampler instance.
313     *
314     * @param uiSamplerChannel - index of the sampler channel to
315     * remove
316     */
317     void RemoveSamplerChannel(uint uiSamplerChannel);
318    
319 schoenebeck 209 /**
320 iliev 1835 * Destroy and remove all sampler channels from this
321     * Sampler instance.
322     */
323     void RemoveAllSamplerChannels();
324    
325     /**
326 iliev 1130 * Registers the specified listener to be notified
327     * when the number of sampler chanels is changed.
328     */
329     void AddChannelCountListener(ChannelCountListener* l);
330    
331     /**
332     * Removes the specified listener.
333     */
334     void RemoveChannelCountListener(ChannelCountListener* l);
335    
336     /**
337     * Registers the specified listener to be notified
338     * when the number of audio output devices is changed.
339     */
340     void AddAudioDeviceCountListener(AudioDeviceCountListener* l);
341    
342     /**
343     * Removes the specified listener.
344     */
345     void RemoveAudioDeviceCountListener(AudioDeviceCountListener* l);
346    
347    
348     /**
349     * Registers the specified listener to be notified
350     * when the number of MIDI input devices is changed.
351     */
352     void AddMidiDeviceCountListener(MidiDeviceCountListener* l);
353    
354     /**
355     * Removes the specified listener.
356     */
357     void RemoveMidiDeviceCountListener(MidiDeviceCountListener* l);
358    
359     /**
360     * Registers the specified listener to be notified when the number
361     * of active voices in a particular sampler channel is changed.
362     */
363     void AddVoiceCountListener(VoiceCountListener* l);
364    
365     /**
366     * Removes the specified listener.
367     */
368     void RemoveVoiceCountListener(VoiceCountListener* l);
369    
370     /**
371     * Notifies listeners that the number of active voices
372     * on the specified sampler channel is changed.
373     * @param ChannelId The numerical ID of the sampler channel.
374     * @param NewCount The new number of active voices.
375     */
376     void fireVoiceCountChanged(int ChannelId, int NewCount);
377    
378     /**
379     * Registers the specified listener to be notified when the number
380     * of active disk streams in a particular sampler channel is changed.
381     */
382     void AddStreamCountListener(StreamCountListener* l);
383    
384     /**
385     * Removes the specified listener.
386     */
387     void RemoveStreamCountListener(StreamCountListener* l);
388    
389     /**
390     * Notifies listeners that the number of active disk streams
391     * on the specified sampler channel is changed.
392     * @param ChannelId The numerical ID of the sampler channel.
393     * @param NewCount The new number of active disk streams.
394     */
395     void fireStreamCountChanged(int ChannelId, int NewCount);
396    
397     /**
398     * Registers the specified listener to be
399     * notified when the fill state of the disk stream
400     * buffers on a specific sampler channel is changed.
401     */
402     void AddBufferFillListener(BufferFillListener* l);
403    
404     /**
405     * Removes the specified listener.
406     */
407     void RemoveBufferFillListener(BufferFillListener* l);
408    
409     /**
410     * Notifies listeners that the fill state of the disk stream
411     * buffers on the specified sampler channel is changed.
412     * @param ChannelId The numerical ID of the sampler channel.
413     * @param FillData The buffer fill data for the specified sampler channel.
414     */
415     void fireBufferFillChanged(int ChannelId, String FillData);
416    
417     /**
418     * Registers the specified listener to be notified
419     * when total number of active voices is changed.
420     */
421     void AddTotalVoiceCountListener(TotalVoiceCountListener* l);
422    
423     /**
424     * Removes the specified listener.
425     */
426     void RemoveTotalVoiceCountListener(TotalVoiceCountListener* l);
427    
428     /**
429     * Notifies listeners that the total number of active voices is changed.
430     * @param NewCount The new number of active voices.
431     */
432     void fireTotalVoiceCountChanged(int NewCount);
433 iliev 1541
434     void AddTotalStreamCountListener(TotalStreamCountListener* l);
435     void RemoveTotalStreamCountListener(TotalStreamCountListener* l);
436     void fireTotalStreamCountChanged(int NewCount);
437 iliev 1130
438     /**
439     * Registers the specified listener to be notified when the number
440     * of effect sends on a particular sampler channel is changed.
441     */
442     void AddFxSendCountListener(FxSendCountListener* l);
443    
444     /**
445     * Removes the specified listener.
446     */
447     void RemoveFxSendCountListener(FxSendCountListener* l);
448    
449     /**
450 schoenebeck 209 * Returns the names of all available audio output drivers.
451     */
452 schoenebeck 123 std::vector<String> AvailableAudioOutputDrivers();
453    
454 schoenebeck 57 /**
455 schoenebeck 900 * Returns the names of all available MIDI input drivers.
456     */
457     std::vector<String> AvailableMidiInputDrivers();
458    
459     /**
460     * Returns the names of all available sampler engine types.
461     * @see SamplerChannel::SetEngineType()
462     */
463     std::vector<String> AvailableEngineTypes();
464    
465     /**
466 senkov 155 * Create an audio output device.
467 schoenebeck 57 *
468 schoenebeck 123 * @param AudioDriver - name of the audio driver
469     * @param Parameters - eventually needed driver parameters to
470     * create the device
471 schoenebeck 57 * @returns pointer to created audio output device
472 schoenebeck 880 * @throws Exception if device could not be created
473 schoenebeck 57 */
474 schoenebeck 880 AudioOutputDevice* CreateAudioOutputDevice(String AudioDriver, std::map<String,String> Parameters) throw (Exception);
475 schoenebeck 57
476 senkov 155 /**
477     * Create a midi input device.
478     *
479     * @param MidiDriver - name of the midi driver
480     * @param Parameters - eventually needed driver parameters to
481     * create the device
482     * @returns pointer to created midi input device
483 schoenebeck 880 * @throws Exception if device could not be created
484 senkov 155 */
485 schoenebeck 880 MidiInputDevice* CreateMidiInputDevice(String MidiDriver, std::map<String,String> Parameters) throw (Exception);
486 senkov 155
487 schoenebeck 209 /**
488     * Returns the number of all created audio output devices.
489     */
490 schoenebeck 123 uint AudioOutputDevices();
491 schoenebeck 209
492     /**
493     * Returns the number of all created MIDI input devices.
494     */
495 senkov 155 uint MidiInputDevices();
496 schoenebeck 57
497 schoenebeck 209 /**
498     * Returns all created audio output devices.
499     */
500 schoenebeck 123 std::map<uint, AudioOutputDevice*> GetAudioOutputDevices();
501    
502 schoenebeck 209 /**
503     * Returns all created MIDI input devices.
504     */
505 senkov 155 std::map<uint, MidiInputDevice*> GetMidiInputDevices();
506    
507 schoenebeck 209 /**
508     * Destroy the given audio output device and takes care if there
509 iliev 1835 * are still sampler engines connected to this device, etc.
510 schoenebeck 209 *
511 schoenebeck 880 * @throws Exception if sampler channels are still
512     * connected to the device
513 schoenebeck 209 */
514 schoenebeck 880 void DestroyAudioOutputDevice(AudioOutputDevice* pDevice) throw (Exception);
515 schoenebeck 123
516 schoenebeck 209 /**
517 iliev 1835 * Destroy all audio output devices and takes care if there
518     * are still sampler engines connected to devices, etc.
519     *
520     * @throws Exception if sampler channels are still
521     * connected to device
522     */
523     void DestroyAllAudioOutputDevices() throw (Exception);
524    
525     /**
526 schoenebeck 209 * Destroy the given MIDI input device and takes care if there
527 iliev 1835 * are still sampler engines connected to this device, etc.
528 schoenebeck 209 *
529 schoenebeck 880 * @throws Exception if sampler channels are still
530     * connected to the device
531 schoenebeck 209 */
532 schoenebeck 880 void DestroyMidiInputDevice(MidiInputDevice* pDevice) throw (Exception);
533 schoenebeck 209
534 iliev 1835 /**
535     * Destroy all MIDI input devices and take care if there
536     * are still sampler engines connected to device, etc.
537     *
538     * @throws Exception if sampler channels are still
539     * connected to device
540     */
541     void DestroyAllMidiInputDevices() throw (Exception);
542    
543 iliev 1541 /**
544     * Gets the current number of all active streams.
545     * @returns The current number of all active streams.
546     */
547     int GetDiskStreamCount();
548    
549 schoenebeck 212 /**
550 iliev 778 * Gets the current number of all active voices.
551     * @returns The current number of all active voices.
552     */
553     int GetVoiceCount();
554    
555     /**
556 schoenebeck 212 * Reset the whole sampler. Destroy all engines, sampler
557     * channels, MIDI input devices and audio output devices.
558     */
559     void Reset();
560    
561 schoenebeck 1723 /**
562     * Advise the FPU to treat denormal floating point numbers as
563     * zero, to avoid severe performance penalty when dealing with
564     * such extreme floating point values.
565     *
566     * @returns @c true if FPU supports it, @c false otherwise
567     */
568     static bool EnableDenormalsAreZeroMode();
569    
570 persson 1765 /**
571     * Notifies listeners about the current number of voices,
572     * streams and total voices, and the current fill state of
573     * the disk stream buffers.
574     */
575     void fireStatistics();
576    
577 persson 1897 #if defined(WIN32)
578     /**
579     * Gets the directory where the liblinuxsampler dll is
580     * located.
581     * @returns installation directory
582     */
583     static String GetInstallDir();
584     #endif
585 schoenebeck 53 protected:
586 iliev 1130 /**
587     * Notifies listeners that the number of sampler channels has been changed.
588     * @param NewCount The new number of sampler channels.
589     */
590     void fireChannelCountChanged(int NewCount);
591    
592     /**
593 schoenebeck 1686 * Notifies listeners that the specified sampler channel has just
594     * been added.
595     * @param pChannel The new sampler channel.
596     */
597     void fireChannelAdded(SamplerChannel* pChannel);
598    
599     /**
600     * Notifies listeners that the specified sampler channel is
601     * going to be removed soon.
602     * @param pChannel sampler channel to be removed.
603     */
604     void fireChannelToBeRemoved(SamplerChannel* pChannel);
605    
606     /**
607 iliev 1130 * Notifies listeners that the number of audio output devices has been changed.
608     * @param NewCount The new number of audio output devices.
609     */
610     void fireAudioDeviceCountChanged(int NewCount);
611    
612     /**
613     * Notifies listeners that the number of MIDI input devices has been changed.
614     * @param NewCount The new number of MIDI input devices.
615     */
616     void fireMidiDeviceCountChanged(int NewCount);
617    
618     /**
619 schoenebeck 1695 * Notifies listeners that the supplied MIDI input device is
620     * going to be destroyed soon.
621     * @param pDevice MIDI input device to be destroyed
622     */
623     void fireMidiDeviceToBeDestroyed(MidiInputDevice* pDevice);
624    
625     /**
626     * Notifies listeners that the supplied MIDI input device was
627     * just created.
628     * @param pDevice new MIDI input device
629     */
630     void fireMidiDeviceCreated(MidiInputDevice* pDevice);
631    
632     /**
633 iliev 1130 * Notifies listeners that the number of effect sends
634     * on a particular sampler channel is changed.
635     * @param ChannelId The numerical ID of the sampler channel.
636     * @param NewCount The new number of sampler channels.
637     */
638     void fireFxSendCountChanged(int ChannelId, int NewCount);
639    
640 schoenebeck 123 typedef std::map<uint, AudioOutputDevice*> AudioOutputDeviceMap;
641 senkov 155 typedef std::map<uint, MidiInputDevice*> MidiInputDeviceMap;
642 schoenebeck 209 typedef std::map<uint, SamplerChannel*> SamplerChannelMap;
643 schoenebeck 53
644 schoenebeck 209 SamplerChannelMap mSamplerChannels; ///< contains all created sampler channels
645     AudioOutputDeviceMap mAudioOutputDevices; ///< contains all created audio output devices
646     MidiInputDeviceMap mMidiInputDevices; ///< contains all created MIDI input devices
647 schoenebeck 53
648 iliev 1789 // statistics cache
649     uint uiOldTotalVoiceCount;
650     uint uiOldTotalStreamCount;
651     std::map<uint, uint> mOldVoiceCounts;
652     std::map<uint, uint> mOldStreamCounts;
653    
654 schoenebeck 53 friend class SamplerChannel;
655 iliev 1130
656     private:
657     ListenerList<ChannelCountListener*> llChannelCountListeners;
658     ListenerList<AudioDeviceCountListener*> llAudioDeviceCountListeners;
659     ListenerList<MidiDeviceCountListener*> llMidiDeviceCountListeners;
660     ListenerList<VoiceCountListener*> llVoiceCountListeners;
661     ListenerList<StreamCountListener*> llStreamCountListeners;
662     ListenerList<BufferFillListener*> llBufferFillListeners;
663 iliev 1541 ListenerList<TotalStreamCountListener*> llTotalStreamCountListeners;
664 iliev 1130 ListenerList<TotalVoiceCountListener*> llTotalVoiceCountListeners;
665     ListenerList<FxSendCountListener*> llFxSendCountListeners;
666    
667     class EventHandler : public EngineChangeListener, public FxSendCountListener {
668     public:
669     void SetSampler(Sampler* pSampler) { this->pSampler = pSampler; }
670    
671     /**
672 schoenebeck 1686 * Invoked when the engine type of the specified sampler
673     * channel is going to be changed soon.
674     * @param ChannelId The numerical ID of the sampler channel
675     */
676     virtual void EngineToBeChanged(int ChannelId);
677    
678     /**
679 iliev 1130 * Invoked when the engine type of the
680     * specified sampler channel is changed.
681     * @param ChannelId The numerical ID of the sampler
682     * channel, which engine type has been changed.
683     */
684     virtual void EngineChanged(int ChannelId);
685    
686     /**
687     * Invoked when the number of effect sends
688     * on the specified sampler channel has changed.
689     * @param ChannelId The numerical ID of the sampler channel.
690     * @param NewCount The new number of effect sends.
691     */
692     virtual void FxSendCountChanged(int ChannelId, int NewCount);
693    
694     private:
695     Sampler* pSampler;
696     } eventHandler;
697 schoenebeck 53 };
698     }
699    
700     #endif // __LS_SAMPLER_H__

  ViewVC Help
Powered by ViewVC