3 |
* LinuxSampler - modular, streaming capable sampler * |
* LinuxSampler - modular, streaming capable sampler * |
4 |
* * |
* * |
5 |
* Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck * |
* Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck * |
6 |
* Copyright (C) 2005 Christian Schoenebeck * |
* Copyright (C) 2005 - 2008 Christian Schoenebeck * |
7 |
* * |
* * |
8 |
* This program is free software; you can redistribute it and/or modify * |
* 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 * |
* it under the terms of the GNU General Public License as published by * |
26 |
|
|
27 |
#include <vector> |
#include <vector> |
28 |
#include <map> |
#include <map> |
29 |
|
#include "EventListeners.h" |
30 |
#include "common/global.h" |
#include "common/global.h" |
31 |
#include "common/LinuxSamplerException.h" |
#include "common/Exception.h" |
32 |
#include "engines/common/EngineChannel.h" |
#include "engines/EngineChannel.h" |
33 |
#include "drivers/midi/MidiInputDevice.h" |
#include "drivers/midi/MidiInputDevice.h" |
34 |
#include "drivers/audio/AudioOutputDevice.h" |
#include "drivers/audio/AudioOutputDevice.h" |
35 |
|
|
40 |
|
|
41 |
/** @brief LinuxSampler sampler channel |
/** @brief LinuxSampler sampler channel |
42 |
* |
* |
43 |
* Encapsulates a channel of a specific sampler engine typ, one |
* Encapsulates a channel of a specific sampler engine type, one |
44 |
* connection to a MIDI input device and one connection to an audio |
* 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 |
* output device. You cannot create an instance of this class on your |
46 |
* own, you have to use the AddSamplerChannel() method of the Sampler |
* own, you have to use the AddSamplerChannel() method of the Sampler |
52 |
* Assign a sampler engine type to this sampler channel. |
* Assign a sampler engine type to this sampler channel. |
53 |
* |
* |
54 |
* @param EngineType - type of the engine to use |
* @param EngineType - type of the engine to use |
55 |
* @throws LinuxSamplerException - if \a EngineType is invalid |
* @throws Exception - if \a EngineType is invalid |
56 |
|
* @see Sampler::AvailableEngineTypes() |
57 |
*/ |
*/ |
58 |
void SetEngineType(String EngineType) throw (LinuxSamplerException); |
void SetEngineType(String EngineType) throw (Exception); |
59 |
|
|
60 |
/** |
/** |
61 |
* Connect this sampler channel to an audio output device, that |
* Connect this sampler channel to an audio output device, that |
151 |
*/ |
*/ |
152 |
uint Index(); |
uint Index(); |
153 |
|
|
154 |
|
/** Returns the sampler to which this channel belongs */ |
155 |
|
Sampler* GetSampler(); |
156 |
|
|
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 |
|
|
163 |
|
/** |
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 |
|
* Notifies listeners that the engine type of this sampler |
175 |
|
* channel is going to be changed soon. |
176 |
|
*/ |
177 |
|
void fireEngineToBeChanged(); |
178 |
|
|
179 |
|
/** |
180 |
|
* Notifies listeners that the engine |
181 |
|
* type of this sampler channel is changed. |
182 |
|
*/ |
183 |
|
void fireEngineChanged(); |
184 |
|
|
185 |
|
|
186 |
protected: |
protected: |
187 |
SamplerChannel(Sampler* pS); |
SamplerChannel(Sampler* pS); |
188 |
virtual ~SamplerChannel(); |
virtual ~SamplerChannel(); |
189 |
|
|
190 |
/** Getting MIDI input device port given its index number. */ |
/** Getting MIDI input device port given its index number. */ |
191 |
MidiInputPort* __GetMidiInputDevicePort(int iMidiPort); |
MidiInputPort* __GetMidiInputDevicePort(int iMidiPort); |
|
midi_chan_t __GetMidiChannel(); |
|
192 |
|
|
193 |
Sampler* pSampler; |
Sampler* pSampler; |
194 |
EngineChannel* pEngineChannel; |
EngineChannel* pEngineChannel; |
200 |
private: |
private: |
201 |
int iMidiPort; ///< Don't access directly, read GetMidiInputPort() instead ! |
int iMidiPort; ///< Don't access directly, read GetMidiInputPort() instead ! |
202 |
midi_chan_t midiChannel; ///< Don't access directly, read GetMidiInputChannel() instead ! |
midi_chan_t midiChannel; ///< Don't access directly, read GetMidiInputChannel() instead ! |
203 |
|
ListenerList<EngineChangeListener*> llEngineChangeListeners; |
204 |
}; |
}; |
205 |
|
|
206 |
/** @brief LinuxSampler main class |
/** @brief LinuxSampler main class |
212 |
* engine, connected to an arbitrary MIDI input device and connected to |
* engine, connected to an arbitrary MIDI input device and connected to |
213 |
* an arbitrary audio output device. Here an example setup: |
* an arbitrary audio output device. Here an example setup: |
214 |
* @code |
* @code |
215 |
* S.Channel. MIDI in S.Engine Audio out |
* S.Channel MIDI in S.Engine Audio out |
216 |
* ------------------------------------------------------------------- |
* ------------------------------------------------------------------- |
217 |
* 0 Alsa -> gig::Engine -> Jack |
* 0 Alsa -> gig::Engine -> Jack |
218 |
* 1 VSTi -> Akai::Engine -> VSTi |
* 1 VSTi -> Akai::Engine -> VSTi |
219 |
* 2 Jack -> DLS::Engine -> Jack |
* 2 Jack -> DLS::Engine -> Jack |
220 |
* 3 Jack -> SF::Engine -> Alsa |
* 3 Jack -> SF::Engine -> Alsa |
221 |
* |
* |
222 |
* ... (and so on) ... |
* ... (and so on) ... |
223 |
* @endcode |
* @endcode |
224 |
* |
* |
225 |
* Note that not all audio and MIDI backends and sampler engines listed |
* Note that not all audio and MIDI backends and sampler engines listed |
226 |
* in the example above are already implemented! |
* in the example above might already been implemented! |
227 |
* |
* |
228 |
* As you can see in the example setup, LinuxSampler is capable to use |
* As you can see in the example setup, LinuxSampler is capable to use |
229 |
* several, different audio output and MIDI input systems |
* several, different audio output and MIDI input systems |
230 |
* simultaniously at the same time. Here the example setup shown in the |
* simultaniously at the same time. Here the example setup shown in the |
231 |
* ascpect of MIDI input and audio output devices / drivers: |
* aspect of MIDI input and audio output devices / drivers: |
232 |
* @code |
* @code |
233 |
* ######################### ######################### |
* ######################### ######################### |
234 |
* # AudioOutputDeviceJack # # AudioOutputDeviceVSTi # |
* # AudioOutputDeviceJack # # AudioOutputDeviceVSTi # |
235 |
* ######################### ######################### |
* ######################### ######################### |
236 |
* ^ ^ ^ |
* ^ ^ ^ |
237 |
* /------------>|Sampler Channel 0|-----/ | | |
* /------------>|Sampler Channel 0|-----/ | | |
238 |
* | /--------->|Sampler Channel 1|---------------------/ |
* | /--------->|Sampler Channel 1|---------------------/ |
239 |
* | | /------>|Sampler Channel 2|---------/ |
* | | /------>|Sampler Channel 2|---------/ |
240 |
* | | | /--->|Sampler Channel 3|------------>######################### |
* | | | /--->|Sampler Channel 3|------------>######################### |
241 |
* | | | | ... (and so on) ... # AudioOutputDeviceAlsa # |
* | | | | ... (and so on) ... # AudioOutputDeviceAlsa # |
242 |
* | | | | ######################### |
* | | | | ######################### |
243 |
* | | | \-----------------------------------------------------\ |
* | | | \-----------------------------------------------------\ |
244 |
* | | \--------------------------------------------\ | |
* | | \--------------------------------------------\ | |
245 |
* | \--------------------\ | | |
* | \--------------------\ | | |
246 |
* | | | | |
* | | | | |
247 |
* ####################### ####################### ####################### |
* ####################### ####################### ####################### |
248 |
* # MidiInputDeviceAlsa # # MidiInputDeviceVSTi # # MidiInputDeviceJack # |
* # MidiInputDeviceAlsa # # MidiInputDeviceVSTi # # MidiInputDeviceJack # |
249 |
* ####################### ####################### ####################### |
* ####################### ####################### ####################### |
252 |
* As you can see in this example setup, one device (that is midi input |
* 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 |
* driver / audio output driver) can be connected multiple times to |
254 |
* different sampler channels. |
* different sampler channels. |
255 |
|
* |
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 |
*/ |
*/ |
261 |
class Sampler { |
class Sampler { |
262 |
public: |
public: |
317 |
void RemoveSamplerChannel(uint uiSamplerChannel); |
void RemoveSamplerChannel(uint uiSamplerChannel); |
318 |
|
|
319 |
/** |
/** |
320 |
|
* Destroy and remove all sampler channels from this |
321 |
|
* Sampler instance. |
322 |
|
*/ |
323 |
|
void RemoveAllSamplerChannels(); |
324 |
|
|
325 |
|
/** |
326 |
|
* 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 |
|
|
434 |
|
void AddTotalStreamCountListener(TotalStreamCountListener* l); |
435 |
|
void RemoveTotalStreamCountListener(TotalStreamCountListener* l); |
436 |
|
void fireTotalStreamCountChanged(int NewCount); |
437 |
|
|
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 |
* Returns the names of all available audio output drivers. |
* Returns the names of all available audio output drivers. |
451 |
*/ |
*/ |
452 |
std::vector<String> AvailableAudioOutputDrivers(); |
std::vector<String> AvailableAudioOutputDrivers(); |
453 |
|
|
454 |
/** |
/** |
455 |
|
* 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 |
* Create an audio output device. |
* Create an audio output device. |
467 |
* |
* |
468 |
* @param AudioDriver - name of the audio driver |
* @param AudioDriver - name of the audio driver |
469 |
* @param Parameters - eventually needed driver parameters to |
* @param Parameters - eventually needed driver parameters to |
470 |
* create the device |
* create the device |
471 |
* @returns pointer to created audio output device |
* @returns pointer to created audio output device |
472 |
* @throws LinuxSamplerException if device could not be created |
* @throws Exception if device could not be created |
473 |
*/ |
*/ |
474 |
AudioOutputDevice* CreateAudioOutputDevice(String AudioDriver, std::map<String,String> Parameters) throw (LinuxSamplerException); |
AudioOutputDevice* CreateAudioOutputDevice(String AudioDriver, std::map<String,String> Parameters) throw (Exception); |
475 |
|
|
476 |
/** |
/** |
477 |
* Create a midi input device. |
* Create a midi input device. |
480 |
* @param Parameters - eventually needed driver parameters to |
* @param Parameters - eventually needed driver parameters to |
481 |
* create the device |
* create the device |
482 |
* @returns pointer to created midi input device |
* @returns pointer to created midi input device |
483 |
* @throws LinuxSamplerException if device could not be created |
* @throws Exception if device could not be created |
484 |
*/ |
*/ |
485 |
MidiInputDevice* CreateMidiInputDevice(String MidiDriver, std::map<String,String> Parameters) throw (LinuxSamplerException); |
MidiInputDevice* CreateMidiInputDevice(String MidiDriver, std::map<String,String> Parameters) throw (Exception); |
486 |
|
|
487 |
/** |
/** |
488 |
* Returns the number of all created audio output devices. |
* Returns the number of all created audio output devices. |
506 |
|
|
507 |
/** |
/** |
508 |
* Destroy the given audio output device and takes care if there |
* Destroy the given audio output device and takes care if there |
509 |
* are still sampler angines connected to this device, etc. |
* are still sampler engines connected to this device, etc. |
510 |
* |
* |
511 |
* @throws LinuxSamplerException if sampler channels are still |
* @throws Exception if sampler channels are still |
512 |
* connected to the device |
* connected to the device |
513 |
*/ |
*/ |
514 |
void DestroyAudioOutputDevice(AudioOutputDevice* pDevice) throw (LinuxSamplerException); |
void DestroyAudioOutputDevice(AudioOutputDevice* pDevice) throw (Exception); |
515 |
|
|
516 |
|
/** |
517 |
|
* 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 |
* Destroy the given MIDI input device and takes care if there |
* Destroy the given MIDI input device and takes care if there |
527 |
* are still sampler angines connected to this device, etc. |
* are still sampler engines connected to this device, etc. |
528 |
* |
* |
529 |
* @throws LinuxSamplerException if sampler channels are still |
* @throws Exception if sampler channels are still |
530 |
* connected to the device |
* connected to the device |
531 |
*/ |
*/ |
532 |
void DestroyMidiInputDevice(MidiInputDevice* pDevice) throw (LinuxSamplerException); |
void DestroyMidiInputDevice(MidiInputDevice* pDevice) throw (Exception); |
533 |
|
|
534 |
|
/** |
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 |
|
/** |
544 |
|
* Gets the current number of all active streams. |
545 |
|
* @returns The current number of all active streams. |
546 |
|
*/ |
547 |
|
int GetDiskStreamCount(); |
548 |
|
|
549 |
|
/** |
550 |
|
* Gets the current number of all active voices. |
551 |
|
* @returns The current number of all active voices. |
552 |
|
*/ |
553 |
|
int GetVoiceCount(); |
554 |
|
|
555 |
/** |
/** |
556 |
* Reset the whole sampler. Destroy all engines, sampler |
* Reset the whole sampler. Destroy all engines, sampler |
558 |
*/ |
*/ |
559 |
void Reset(); |
void Reset(); |
560 |
|
|
561 |
|
/** |
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 |
|
/** |
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 |
protected: |
protected: |
578 |
|
/** |
579 |
|
* Notifies listeners that the number of sampler channels has been changed. |
580 |
|
* @param NewCount The new number of sampler channels. |
581 |
|
*/ |
582 |
|
void fireChannelCountChanged(int NewCount); |
583 |
|
|
584 |
|
/** |
585 |
|
* Notifies listeners that the specified sampler channel has just |
586 |
|
* been added. |
587 |
|
* @param pChannel The new sampler channel. |
588 |
|
*/ |
589 |
|
void fireChannelAdded(SamplerChannel* pChannel); |
590 |
|
|
591 |
|
/** |
592 |
|
* Notifies listeners that the specified sampler channel is |
593 |
|
* going to be removed soon. |
594 |
|
* @param pChannel sampler channel to be removed. |
595 |
|
*/ |
596 |
|
void fireChannelToBeRemoved(SamplerChannel* pChannel); |
597 |
|
|
598 |
|
/** |
599 |
|
* Notifies listeners that the number of audio output devices has been changed. |
600 |
|
* @param NewCount The new number of audio output devices. |
601 |
|
*/ |
602 |
|
void fireAudioDeviceCountChanged(int NewCount); |
603 |
|
|
604 |
|
/** |
605 |
|
* Notifies listeners that the number of MIDI input devices has been changed. |
606 |
|
* @param NewCount The new number of MIDI input devices. |
607 |
|
*/ |
608 |
|
void fireMidiDeviceCountChanged(int NewCount); |
609 |
|
|
610 |
|
/** |
611 |
|
* Notifies listeners that the supplied MIDI input device is |
612 |
|
* going to be destroyed soon. |
613 |
|
* @param pDevice MIDI input device to be destroyed |
614 |
|
*/ |
615 |
|
void fireMidiDeviceToBeDestroyed(MidiInputDevice* pDevice); |
616 |
|
|
617 |
|
/** |
618 |
|
* Notifies listeners that the supplied MIDI input device was |
619 |
|
* just created. |
620 |
|
* @param pDevice new MIDI input device |
621 |
|
*/ |
622 |
|
void fireMidiDeviceCreated(MidiInputDevice* pDevice); |
623 |
|
|
624 |
|
/** |
625 |
|
* Notifies listeners that the number of effect sends |
626 |
|
* on a particular sampler channel is changed. |
627 |
|
* @param ChannelId The numerical ID of the sampler channel. |
628 |
|
* @param NewCount The new number of sampler channels. |
629 |
|
*/ |
630 |
|
void fireFxSendCountChanged(int ChannelId, int NewCount); |
631 |
|
|
632 |
typedef std::map<uint, AudioOutputDevice*> AudioOutputDeviceMap; |
typedef std::map<uint, AudioOutputDevice*> AudioOutputDeviceMap; |
633 |
typedef std::map<uint, MidiInputDevice*> MidiInputDeviceMap; |
typedef std::map<uint, MidiInputDevice*> MidiInputDeviceMap; |
634 |
typedef std::map<uint, SamplerChannel*> SamplerChannelMap; |
typedef std::map<uint, SamplerChannel*> SamplerChannelMap; |
637 |
AudioOutputDeviceMap mAudioOutputDevices; ///< contains all created audio output devices |
AudioOutputDeviceMap mAudioOutputDevices; ///< contains all created audio output devices |
638 |
MidiInputDeviceMap mMidiInputDevices; ///< contains all created MIDI input devices |
MidiInputDeviceMap mMidiInputDevices; ///< contains all created MIDI input devices |
639 |
|
|
640 |
|
// statistics cache |
641 |
|
uint uiOldTotalVoiceCount; |
642 |
|
uint uiOldTotalStreamCount; |
643 |
|
std::map<uint, uint> mOldVoiceCounts; |
644 |
|
std::map<uint, uint> mOldStreamCounts; |
645 |
|
|
646 |
friend class SamplerChannel; |
friend class SamplerChannel; |
647 |
|
|
648 |
|
private: |
649 |
|
ListenerList<ChannelCountListener*> llChannelCountListeners; |
650 |
|
ListenerList<AudioDeviceCountListener*> llAudioDeviceCountListeners; |
651 |
|
ListenerList<MidiDeviceCountListener*> llMidiDeviceCountListeners; |
652 |
|
ListenerList<VoiceCountListener*> llVoiceCountListeners; |
653 |
|
ListenerList<StreamCountListener*> llStreamCountListeners; |
654 |
|
ListenerList<BufferFillListener*> llBufferFillListeners; |
655 |
|
ListenerList<TotalStreamCountListener*> llTotalStreamCountListeners; |
656 |
|
ListenerList<TotalVoiceCountListener*> llTotalVoiceCountListeners; |
657 |
|
ListenerList<FxSendCountListener*> llFxSendCountListeners; |
658 |
|
|
659 |
|
class EventHandler : public EngineChangeListener, public FxSendCountListener { |
660 |
|
public: |
661 |
|
void SetSampler(Sampler* pSampler) { this->pSampler = pSampler; } |
662 |
|
|
663 |
|
/** |
664 |
|
* Invoked when the engine type of the specified sampler |
665 |
|
* channel is going to be changed soon. |
666 |
|
* @param ChannelId The numerical ID of the sampler channel |
667 |
|
*/ |
668 |
|
virtual void EngineToBeChanged(int ChannelId); |
669 |
|
|
670 |
|
/** |
671 |
|
* Invoked when the engine type of the |
672 |
|
* specified sampler channel is changed. |
673 |
|
* @param ChannelId The numerical ID of the sampler |
674 |
|
* channel, which engine type has been changed. |
675 |
|
*/ |
676 |
|
virtual void EngineChanged(int ChannelId); |
677 |
|
|
678 |
|
/** |
679 |
|
* Invoked when the number of effect sends |
680 |
|
* on the specified sampler channel has changed. |
681 |
|
* @param ChannelId The numerical ID of the sampler channel. |
682 |
|
* @param NewCount The new number of effect sends. |
683 |
|
*/ |
684 |
|
virtual void FxSendCountChanged(int ChannelId, int NewCount); |
685 |
|
|
686 |
|
private: |
687 |
|
Sampler* pSampler; |
688 |
|
} eventHandler; |
689 |
}; |
}; |
690 |
} |
} |
691 |
|
|