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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1541 by iliev, Tue Dec 4 18:09:26 2007 UTC revision 2500 by schoenebeck, Fri Jan 10 12:20:05 2014 UTC
# Line 3  Line 3 
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, 2006 Christian Schoenebeck                        *   *   Copyright (C) 2005 - 2014 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  *
# Line 38  namespace LinuxSampler { Line 38  namespace LinuxSampler {
38      // just symbol prototyping      // just symbol prototyping
39      class Sampler;      class Sampler;
40    
41      /** @brief LinuxSampler sampler channel      /** @brief LinuxSampler sampler channel (a.k.a. "sampler part")
42       *       *
43       * Encapsulates a channel of a specific sampler engine type, 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
# Line 64  namespace LinuxSampler { Line 64  namespace LinuxSampler {
64               * the old connection will automatically be removed before.               * the old connection will automatically be removed before.
65               *               *
66               * @param pDevice - audio output device to connect to               * @param pDevice - audio output device to connect to
67                 * @throws Exception in case the audio device is tried to be
68                 *                   changed while the sampler channel is used by a
69                 *                   host plugin (e.g. VST, AU, DSSI, LV2) which
70                 *                   don't allow to change the audio output device
71               */               */
72              void SetAudioOutputDevice(AudioOutputDevice* pDevice);              void SetAudioOutputDevice(AudioOutputDevice* pDevice) throw (Exception);
73    
74              /**              /**
75               * Connect this sampler channel to a MIDI input device.               * Connect the given MIDIInputPort to this SamplerChannel. The
76                 * connection is added to the sampler channel. So other MIDI input
77                 * connections remain unaffected by this call. If the given port is
78                 * already connected to this sampler channel, then this call is
79                 * ignored.
80               *               *
81               * @param pDevice - MIDI input device to connect to               * @param pPort - MIDI input port to connect to
82                 * @throws Exception in case the MIDI device is tried to be changed
83                 *                   while the sampler channel is being used by a
84                 *                   host plugin (e.g. VST, AU, DSSI, LV2) which
85                 *                   don't allow to change the MIDI port or even
86                 *                   device
87                 */
88                void Connect(MidiInputPort* pPort) throw (Exception);
89    
90                /**
91                 * Disconnects the given MidiInputPort from this SamplerChannel.
92                 * All other MIDI input ports connected to this sampler channel
93                 * remain unaffected. If the given port is not currently connected
94                 * to this sampler channel, then this call is ignored.
95                 *
96                 * @param pPort - MIDI input port to disconnect
97                 * @throws Exception in case the MIDI device is tried to be changed
98                 *                   while the sampler channel is being used by a
99                 *                   host plugin (e.g. VST, AU, DSSI, LV2) which
100                 *                   don't allow to change the MIDI port or even
101                 *                   device
102                 */
103                void Disconnect(MidiInputPort* pPort) throw (Exception);
104    
105                /**
106                 * Disconnects all MIDI input ports currently connected with this
107                 * SamplerChannel.
108                 *
109                 * @throws Exception in case the MIDI device is tried to be changed
110                 *                   while the sampler channel is being used by a
111                 *                   host plugin (e.g. VST, AU, DSSI, LV2) which
112                 *                   don't allow to change the MIDI port or even
113                 *                   device
114                 */
115                void DisconnectAllMidiInputPorts() throw (Exception);
116    
117                /**
118                 * Returns all MIDI input ports currently connected to this sampler
119                 * channel.
120               */               */
121              void SetMidiInputDevice(MidiInputDevice *pDevice);              std::vector<MidiInputPort*> GetMidiInputPorts();
122    
123              /**              /**
124               * Connect this sampler channel to a MIDI input port.               * Connect this sampler channel to a MIDI input device.
125                 *
126                 * This call will also disconnect <b>all</b> existing MIDI input
127                 * connections from this sampler channel before establishing the
128                 * new connection! Disconnection of all previous connections is
129                 * done to preserve full behavior backward compatibility to times
130                 * when this API only allowed one MIDI input port per sampler
131                 * channel.
132                 *
133                 * @param pDevice - MIDI input device to connect to
134                 * @throws Exception in case the MIDI device is tried to be changed
135                 *                   while the sampler channel is being used by a
136                 *                   host plugin (e.g. VST, AU, DSSI, LV2) which
137                 *                   don't allow to change the MIDI port or even
138                 *                   device
139                 * @deprecated This method is only provided for backward
140                 *             compatibility. It is a relict from days where there
141                 *             was only 1 MIDI input allowed per SamplerChannel.
142                 */
143                void SetMidiInputDevice(MidiInputDevice *pDevice) throw (Exception) DEPRECATED_API;
144    
145                /**
146                 * Change the MIDI input port connected to this sampler channel.
147                 *
148                 * Calling this method will switch the connection of the first
149                 * (and only the first) MIDIInputPort currently being connected to
150                 * this sampler channel, to another port of the same
151                 * MidiInputDevice. Or in other words: the first MIDIInputPort
152                 * currently connected to this sampler channel will be disconnected,
153                 * and the requested other port of its MIDIInputDevice will be
154                 * connected to this sampler channel instead.
155                 *
156                 * This behavior is implemented to preserve full behavior backward
157                 * compatibility to times when this API only allowed one MIDI input
158                 * port per SamplerChannel.
159               *               *
160               * @param MidiPort - MIDI port to connect to               * @param MidiPort - MIDI port to connect to
161                 * @throws Exception in case the MIDI port is tried to be changed
162                 *                   while the sampler channel is being used by a
163                 *                   host plugin (e.g. VST, AU, DSSI, LV2) which
164                 *                   don't allow to change the MIDI port
165                 * @deprecated This method is only provided for backward
166                 *             compatibility. It is a relict from days where there
167                 *             was only 1 MIDI input allowed per SamplerChannel.
168               */               */
169              void SetMidiInputPort(int MidiPort);              void SetMidiInputPort(int MidiPort) throw (Exception) DEPRECATED_API;
170    
171              /**              /**
172               * Define on which MIDI channel(s) this sampler channel should               * Define on which MIDI channel(s) this sampler channel should
173               * listen to. By default, that is after creation of a new               * listen to (on all MIDI ports and all virtual MIDI devices
174               * sampler channel, the sampler channel will listen to all MIDI               * connected to this sampler channel). By default, that is after
175               * channels.               * creation of a new sampler channel, the sampler channel will
176                 * listen to all MIDI channels (a.k.a. "MIDI Omni mode").
177               *               *
178               * @param MidiChannel - MIDI channel to listen               * @param MidiChannel - MIDI channel to listen
179                 * @throws Exception if provided MidiChannel is not a valid constant
180                 *                   as defined by midi_chan_t
181               */               */
182              void SetMidiInputChannel(midi_chan_t MidiChannel);              void SetMidiInputChannel(midi_chan_t MidiChannel);
183    
184              /**              /**
185               * Connect this sampler channel to a MIDI input triplet.               * Connect this sampler channel to a MIDI input triplet.
186               *               *
187                 * This call will also disconnect <b>all</b> existing MIDI input
188                 * connections from this sampler channel before establishing the
189                 * new connection! Disconnection of all previous connections is
190                 * done to preserve full behavior backward compatibility to times
191                 * when this API only allowed one MIDI input port per sampler
192                 * channel.
193                 *
194               * @param pDevice - MIDI input device to connect to               * @param pDevice - MIDI input device to connect to
195               * @param iMidiPort - MIDI port to connect to               * @param iMidiPort - MIDI port to connect to
196               * @param MidiChannel - optional: MIDI channel on which the               * @param MidiChannel - optional: MIDI channel on which the
197               *                      sampler channel should listen to               *                      sampler channel should listen to
198               *                      (default: listen on all MIDI channels)               *                      (default: listen on all MIDI channels)
199                 * @throws Exception in case the MIDI port is tried to be changed
200                 *                   while the sampler channel is being used by a
201                 *                   host plugin (e.g. VST, AU, DSSI, LV2) which
202                 *                   don't allow to change the MIDI port
203                 * @deprecated This method is only provided for backward
204                 *             compatibility. It is a relict from days where there
205                 *             was only 1 MIDI input allowed per sampler channel.
206               */               */
207              void SetMidiInput(MidiInputDevice* pDevice, int iMidiPort, midi_chan_t MidiChannel = midi_chan_all);              void SetMidiInput(MidiInputDevice* pDevice, int iMidiPort, midi_chan_t MidiChannel = midi_chan_all) throw (Exception) DEPRECATED_API;
208    
209              /**              /**
210               * Returns the EngineChannel object that was deployed on this               * Returns the EngineChannel object that was deployed on this
# Line 123  namespace LinuxSampler { Line 227  namespace LinuxSampler {
227               * Returns the MIDI input port number to which this sampler               * Returns the MIDI input port number to which this sampler
228               * channel is currently connected to.               * channel is currently connected to.
229               *               *
230                 * This method should not be used in new applications anymore!
231                 *
232               * @returns  MIDI input port number or -1 if not connected               * @returns  MIDI input port number or -1 if not connected
233                 * @deprecated This method is only provided for backward
234                 *             compatibility. It is a relict from days where there
235                 *             was only 1 MIDI input allowed per sampler channel.
236               */               */
237              int GetMidiInputPort();              int GetMidiInputPort() DEPRECATED_API;
238    
239              /**              /**
240               * Returns the audio output device to which this sampler channel               * Returns the audio output device to which this sampler channel
# Line 142  namespace LinuxSampler { Line 251  namespace LinuxSampler {
251               *               *
252               * @returns  pointer to MIDI input device or NULL if not               * @returns  pointer to MIDI input device or NULL if not
253               *           connected               *           connected
254                 * @deprecated This method is only provided for backward
255                 *             compatibility. It is a relict from days where there
256                 *             was only 1 MIDI input allowed per sampler channel.
257               */               */
258              MidiInputDevice* GetMidiInputDevice();              MidiInputDevice* GetMidiInputDevice() DEPRECATED_API;
259    
260              /**              /**
261               * Returns the index number of this sampler channel within the               * Returns the index number of this sampler channel within the
262               * Sampler instance.               * Sampler instance.
263               */               */
264              uint Index();              uint Index();
265                
266                /** Returns the sampler to which this channel belongs */
267                Sampler* GetSampler();
268    
269                ///////////////////////////////////////////////////////////////
270                // Event Listener methods
271    
272              /**              /**
273               * Registers the specified listener to be notified               * Registers the specified listener to be notified
274               * when the engine type of this sampler channel is changed.               * when the engine type of this sampler channel is changed.
# Line 168  namespace LinuxSampler { Line 286  namespace LinuxSampler {
286              void RemoveAllEngineChangeListeners();              void RemoveAllEngineChangeListeners();
287    
288              /**              /**
289                 * Notifies listeners that the engine type of this sampler
290                 * channel is going to be changed soon.
291                 */
292                void fireEngineToBeChanged();
293    
294                /**
295               * Notifies listeners that the engine               * Notifies listeners that the engine
296               * type of this sampler channel is changed.               * type of this sampler channel is changed.
297               */               */
# Line 178  namespace LinuxSampler { Line 302  namespace LinuxSampler {
302              SamplerChannel(Sampler* pS);              SamplerChannel(Sampler* pS);
303              virtual ~SamplerChannel();              virtual ~SamplerChannel();
304    
             /** Getting MIDI input device port given its index number. */  
             MidiInputPort* __GetMidiInputDevicePort(int iMidiPort);  
   
305              Sampler*           pSampler;              Sampler*           pSampler;
306              EngineChannel*     pEngineChannel;              EngineChannel*     pEngineChannel;
307              AudioOutputDevice* pAudioOutputDevice;              AudioOutputDevice* pAudioOutputDevice; //FIXME: should be stored as numeric device ID instead of raw pointer to avoid pointer invalidation problems
             MidiInputDevice*   pMidiInputDevice;  
308              int                iIndex;              int                iIndex;
309    
310              friend class Sampler;              friend class Sampler;
311    
312          private:          private:
313              int                iMidiPort;   ///< Don't access directly, read GetMidiInputPort() instead !              struct midi_conn_t {
314                    uint deviceID;
315                    uint portNr;
316    
317                    bool operator== (const midi_conn_t& other) const {
318                        return other.deviceID == this->deviceID &&
319                               other.portNr   == this->portNr;
320                    }
321    
322                    bool operator< (const midi_conn_t& other) const {
323                        return memcmp(this, &other, sizeof(midi_conn_t)) < 0;
324                    }
325                };
326    
327                int                iMidiPort;   ///< Don't access directly, read GetMidiInputPort() instead ! @deprecated This variable is just for backward compatibility from days when there was only one MIDI connection per SamplerChannel.
328              midi_chan_t        midiChannel; ///< Don't access directly, read GetMidiInputChannel() instead !              midi_chan_t        midiChannel; ///< Don't access directly, read GetMidiInputChannel() instead !
329                std::vector<midi_conn_t> vMidiInputs; ///< MIDI input ports connected to this sampler channel. Only used as "cache" (device id, port nr pair) in initial situation where no engine type is selected yet, and accordingly no EngineChannel instance exists which actually manages the device connections. This way users can "connect" MIDI input ports to this SamplerChannel before an engine type is chosen.
330              ListenerList<EngineChangeListener*> llEngineChangeListeners;              ListenerList<EngineChangeListener*> llEngineChangeListeners;
331    
332                static MidiInputPort* _getPortForID(const midi_conn_t& c);
333      };      };
334    
335      /** @brief LinuxSampler main class      /** @brief LinuxSampler main class
# Line 199  namespace LinuxSampler { Line 337  namespace LinuxSampler {
337       * This is the toplevel class for a LinuxSampler instance.       * This is the toplevel class for a LinuxSampler instance.
338       *       *
339       * LinuxSampler can have arbitrary numbers of sampler channels. Each       * LinuxSampler can have arbitrary numbers of sampler channels. Each
340       * sampler channel can individually be deployed with it's own sampler       * sampler channel (a.k.a. "sampler part") can individually be deployed
341       * engine, connected to an arbitrary MIDI input device and connected to       * with it's own sampler engine, connected to an arbitrary MIDI input
342       * an arbitrary audio output device. Here an example setup:       * device and connected to an arbitrary audio output device. Here an
343         * example setup:
344       * @code       * @code
345       * S.Channel    MIDI in    S.Engine         Audio out       * S.Channel    MIDI in    S.Engine         Audio out
346       * -------------------------------------------------------------------       * -------------------------------------------------------------------
347       *   0          Alsa   ->  gig::Engine  ->  Jack       *   0          Alsa   ->  gig::Engine  ->  Jack
348       *   1          VSTi   ->  Akai::Engine ->  VSTi       *   1          VSTi   ->  gig::Engine  ->  VSTi
349       *   2          Jack   ->  DLS::Engine  ->  Jack       *   2          Jack   ->  sfz::Engine  ->  Jack
350       *   3          Jack   ->  SF::Engine   ->  Alsa       *   3          Jack   ->  SF2::Engine  ->  Alsa
351         *   4          LV2    ->  sfz::Engine  ->  LV2
352       *       *
353       * ... (and so on) ...       * ... (and so on) ...
354       * @endcode       * @endcode
355       *       *
      * Note that not all audio and MIDI backends and sampler engines listed  
      * in the example above might already been implemented!  
      *  
356       * 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
357       * several, different audio output and MIDI input systems       * several, different audio output and MIDI input systems
358       * simultaniously at the same time. Here the example setup shown in the       * simultaniously at the same time. Here the example setup shown in the
# Line 308  namespace LinuxSampler { Line 445  namespace LinuxSampler {
445              void RemoveSamplerChannel(uint uiSamplerChannel);              void RemoveSamplerChannel(uint uiSamplerChannel);
446    
447              /**              /**
448                 * Destroy and remove all sampler channels from this
449                 * Sampler instance.
450                 */
451                void RemoveAllSamplerChannels();
452    
453                /**
454                 * Returns the names of all available audio output drivers.
455                 */
456                std::vector<String> AvailableAudioOutputDrivers();
457    
458                /**
459                 * Returns the names of all available MIDI input drivers.
460                 */
461                std::vector<String> AvailableMidiInputDrivers();
462    
463                /**
464                 * Returns the names of all available sampler engine types.
465                 * @see SamplerChannel::SetEngineType()
466                 */
467                std::vector<String> AvailableEngineTypes();
468    
469                /**
470                 * Create an audio output device.
471                 *
472                 * @param AudioDriver - name of the audio driver
473                 * @param Parameters - eventually needed driver parameters to
474                 *                     create the device
475                 * @returns  pointer to created audio output device
476                 * @throws Exception  if device could not be created
477                 */
478                AudioOutputDevice* CreateAudioOutputDevice(String AudioDriver, std::map<String,String> Parameters) throw (Exception);
479    
480                /**
481                 * Create a midi input device.
482                 *
483                 * @param MidiDriver - name of the midi driver
484                 * @param Parameters - eventually needed driver parameters to
485                 *                     create the device
486                 * @returns  pointer to created midi input device
487                 * @throws Exception  if device could not be created
488                 */
489                MidiInputDevice* CreateMidiInputDevice(String MidiDriver, std::map<String,String> Parameters) throw (Exception);
490    
491                /**
492                 * Returns the number of all created audio output devices.
493                 */
494                uint AudioOutputDevices();
495    
496                /**
497                 * Returns the number of all created MIDI input devices.
498                 */
499                uint MidiInputDevices();
500    
501                /**
502                 * Returns all created audio output devices.
503                 */
504                std::map<uint, AudioOutputDevice*> GetAudioOutputDevices();
505    
506                /**
507                 * Returns all created MIDI input devices.
508                 */
509                std::map<uint, MidiInputDevice*> GetMidiInputDevices();
510    
511                /**
512                 * Destroy the given audio output device and takes care if there
513                 * are still sampler engines connected to this device, etc.
514                 *
515                 * @throws Exception  if sampler channels are still
516                 *                    connected to the device
517                 */
518                void DestroyAudioOutputDevice(AudioOutputDevice* pDevice) throw (Exception);
519    
520                /**
521                 * Destroy all audio output devices and takes care if there
522                 * are still sampler engines connected to devices, etc.
523                 *
524                 * Note: non-autonomous devices, that is devices associated with
525                 * host plugin instances like VST, AU, DSSI, LV2 are not
526                 * destroyed by this method.
527                 *
528                 * @throws Exception  if sampler channels are still
529                 *                    connected to device
530                 */
531                void DestroyAllAudioOutputDevices() throw (Exception);
532    
533                /**
534                 * Destroy the given MIDI input device and takes care if there
535                 * are still sampler engines connected to this device, etc.
536                 *
537                 * @throws Exception  if sampler channels are still
538                 *                    connected to the device
539                 */
540                void DestroyMidiInputDevice(MidiInputDevice* pDevice) throw (Exception);
541    
542                /**
543                 * Destroy all MIDI input devices and take care if there
544                 * are still sampler engines connected to device, etc.
545                 *
546                 * Note: non-autonomous devices, that is devices associated with
547                 * host plugin instances like VST, AU, DSSI, LV2 are not
548                 * destroyed by this method.
549                 *
550                 * @throws Exception  if sampler channels are still
551                 *                    connected to device
552                 */
553                void DestroyAllMidiInputDevices() throw (Exception);
554    
555                 /**
556                 * Gets the current number of all active streams.
557                 * @returns The current number of all active streams.
558                 */
559                int GetDiskStreamCount();
560    
561                /**
562                 * Gets the current number of all active voices.
563                 * @returns The current number of all active voices.
564                 */
565                int GetVoiceCount();
566    
567                /**
568                 * @see SetGlobalMaxVoices()
569                 */
570                int GetGlobalMaxVoices();
571    
572                /**
573                 * @see SetGlobalMaxStreams()
574                 */
575                int GetGlobalMaxStreams();
576    
577                /**
578                 * Sets the global maximum amount limit of voices.
579                 *
580                 * Note that this voice limit can also be altered for
581                 * each sampler engine instance individually instead.
582                 *
583                 * @throws Exception  if \a n is invalid
584                 */
585                void SetGlobalMaxVoices(int n) throw (Exception);
586    
587                /**
588                 * Sets the global maximum amount limit of disk streams.
589                 *
590                 * Note that this stream limit can also be altered for
591                 * each sampler engine instance individually instead.
592                             *
593                 * @throws Exception  if \a n is invalid
594                 */
595                void SetGlobalMaxStreams(int n) throw (Exception);
596    
597                /**
598                 * Reset the whole sampler. Destroy all engines, sampler
599                 * channels, MIDI input devices and audio output devices.
600                 */
601                void Reset();
602    
603                ///////////////////////////////////////////////////////////////
604                // Event Listener methods
605    
606                /**
607               * Registers the specified listener to be notified               * Registers the specified listener to be notified
608               * when the number of sampler chanels is changed.               * when the number of sampler chanels is changed.
609               */               */
# Line 329  namespace LinuxSampler { Line 625  namespace LinuxSampler {
625               */               */
626              void RemoveAudioDeviceCountListener(AudioDeviceCountListener* l);              void RemoveAudioDeviceCountListener(AudioDeviceCountListener* l);
627    
               
628              /**              /**
629               * Registers the specified listener to be notified               * Registers the specified listener to be notified
630               * when the number of MIDI input devices is changed.               * when the number of MIDI input devices is changed.
# Line 415  namespace LinuxSampler { Line 710  namespace LinuxSampler {
710               * @param NewCount The new number of active voices.               * @param NewCount The new number of active voices.
711               */               */
712              void fireTotalVoiceCountChanged(int NewCount);              void fireTotalVoiceCountChanged(int NewCount);
               
             void AddTotalStreamCountListener(TotalStreamCountListener* l);  
             void RemoveTotalStreamCountListener(TotalStreamCountListener* l);  
             void fireTotalStreamCountChanged(int NewCount);  
713    
714              /**              /**
715               * Registers the specified listener to be notified when the number               * Registers the specified listener to be notified when the number
716               * of effect sends on a particular sampler channel is changed.               * of total streams is changed.
717               */               */
718              void AddFxSendCountListener(FxSendCountListener* l);              void AddTotalStreamCountListener(TotalStreamCountListener* l);
719    
720              /**              /**
721               * Removes the specified listener.               * Removes the specified listener.
722               */               */
723              void RemoveFxSendCountListener(FxSendCountListener* l);              void RemoveTotalStreamCountListener(TotalStreamCountListener* l);
   
             /**  
              * Returns the names of all available audio output drivers.  
              */  
             std::vector<String> AvailableAudioOutputDrivers();  
   
             /**  
              * Returns the names of all available MIDI input drivers.  
              */  
             std::vector<String> AvailableMidiInputDrivers();  
   
             /**  
              * Returns the names of all available sampler engine types.  
              * @see SamplerChannel::SetEngineType()  
              */  
             std::vector<String> AvailableEngineTypes();  
   
             /**  
              * Create an audio output device.  
              *  
              * @param AudioDriver - name of the audio driver  
              * @param Parameters - eventually needed driver parameters to  
              *                     create the device  
              * @returns  pointer to created audio output device  
              * @throws Exception  if device could not be created  
              */  
             AudioOutputDevice* CreateAudioOutputDevice(String AudioDriver, std::map<String,String> Parameters) throw (Exception);  
724    
725              /**              /**
726               * Create a midi input device.               * Notifies listeners that the total number of total streams changed.
727               *               * @param NewCount The new number of total streams.
              * @param MidiDriver - name of the midi driver  
              * @param Parameters - eventually needed driver parameters to  
              *                     create the device  
              * @returns  pointer to created midi input device  
              * @throws Exception  if device could not be created  
728               */               */
729              MidiInputDevice* CreateMidiInputDevice(String MidiDriver, std::map<String,String> Parameters) throw (Exception);              void fireTotalStreamCountChanged(int NewCount);
730    
731              /**              /**
732               * Returns the number of all created audio output devices.               * Registers the specified listener to be notified when the number
733                 * of effect sends on a particular sampler channel is changed.
734               */               */
735              uint AudioOutputDevices();              void AddFxSendCountListener(FxSendCountListener* l);
736    
737              /**              /**
738               * Returns the number of all created MIDI input devices.               * Removes the specified listener.
739               */               */
740              uint MidiInputDevices();              void RemoveFxSendCountListener(FxSendCountListener* l);
741    
742              /**              /**
743               * Returns all created audio output devices.               * Notifies listeners about the current number of voices,
744                 * streams and total voices, and the current fill state of
745                 * the disk stream buffers.
746               */               */
747              std::map<uint, AudioOutputDevice*> GetAudioOutputDevices();              void fireStatistics();
748    
749              /**              ///////////////////////////////////////////////////////////////
750               * Returns all created MIDI input devices.              // system specific methods
              */  
             std::map<uint, MidiInputDevice*> GetMidiInputDevices();  
751    
752              /**              /**
753               * Destroy the given audio output device and takes care if there               * Advise the FPU to treat denormal floating point numbers as
754               * are still sampler angines connected to this device, etc.               * zero, to avoid severe performance penalty when dealing with
755                 * such extreme floating point values.
756               *               *
757               * @throws Exception  if sampler channels are still               * @returns @c true if FPU supports it, @c false otherwise
              *                    connected to the device  
758               */               */
759              void DestroyAudioOutputDevice(AudioOutputDevice* pDevice) throw (Exception);              static bool EnableDenormalsAreZeroMode();
760    
761    #if defined(WIN32)
762              /**              /**
763               * Destroy the given MIDI input device and takes care if there               * Gets the directory where the liblinuxsampler dll is located.
764               * are still sampler angines connected to this device, etc.               * Note: this method is currently only available for Windows.
765               *               * @returns installation directory
              * @throws Exception  if sampler channels are still  
              *                    connected to the device  
766               */               */
767              void DestroyMidiInputDevice(MidiInputDevice* pDevice) throw (Exception);              static String GetInstallDir();
768    #endif
769               /**          protected:
              * Gets the current number of all active streams.  
              * @returns The current number of all active streams.  
              */  
             int GetDiskStreamCount();  
   
770              /**              /**
771               * Gets the current number of all active voices.               * Notifies listeners that the number of sampler channels has been changed.
772               * @returns The current number of all active voices.               * @param NewCount The new number of sampler channels.
773               */               */
774              int GetVoiceCount();              void fireChannelCountChanged(int NewCount);
775    
776              /**              /**
777               * Reset the whole sampler. Destroy all engines, sampler               * Notifies listeners that the specified sampler channel has just
778               * channels, MIDI input devices and audio output devices.               * been added.
779                 * @param pChannel The new sampler channel.
780               */               */
781              void Reset();              void fireChannelAdded(SamplerChannel* pChannel);
782    
         protected:  
783              /**              /**
784               * Notifies listeners that the number of sampler channels has been changed.               * Notifies listeners that the specified sampler channel is
785               * @param NewCount The new number of sampler channels.               * going to be removed soon.
786                 * @param pChannel sampler channel to be removed.
787               */               */
788              void fireChannelCountChanged(int NewCount);              void fireChannelToBeRemoved(SamplerChannel* pChannel);
789    
790              /**              /**
791               * Notifies listeners that the number of audio output devices has been changed.               * Notifies listeners that the number of audio output devices has been changed.
# Line 545  namespace LinuxSampler { Line 800  namespace LinuxSampler {
800              void fireMidiDeviceCountChanged(int NewCount);              void fireMidiDeviceCountChanged(int NewCount);
801    
802              /**              /**
803                 * Notifies listeners that the supplied MIDI input device is
804                 * going to be destroyed soon.
805                 * @param pDevice MIDI input device to be destroyed
806                 */
807                void fireMidiDeviceToBeDestroyed(MidiInputDevice* pDevice);
808    
809                /**
810                 * Notifies listeners that the supplied MIDI input device was
811                 * just created.
812                 * @param pDevice new MIDI input device
813                 */
814                void fireMidiDeviceCreated(MidiInputDevice* pDevice);
815    
816                /**
817               * Notifies listeners that the number of effect sends               * Notifies listeners that the number of effect sends
818               * on a particular sampler channel is changed.               * on a particular sampler channel is changed.
819               * @param ChannelId The numerical ID of the sampler channel.               * @param ChannelId The numerical ID of the sampler channel.
# Line 552  namespace LinuxSampler { Line 821  namespace LinuxSampler {
821               */               */
822              void fireFxSendCountChanged(int ChannelId, int NewCount);              void fireFxSendCountChanged(int ChannelId, int NewCount);
823    
             typedef std::map<uint, AudioOutputDevice*> AudioOutputDeviceMap;  
             typedef std::map<uint, MidiInputDevice*> MidiInputDeviceMap;  
824              typedef std::map<uint, SamplerChannel*> SamplerChannelMap;              typedef std::map<uint, SamplerChannel*> SamplerChannelMap;
825    
826              SamplerChannelMap     mSamplerChannels;    ///< contains all created sampler channels              SamplerChannelMap mSamplerChannels; ///< contains all created sampler channels
827              AudioOutputDeviceMap  mAudioOutputDevices; ///< contains all created audio output devices  
828              MidiInputDeviceMap    mMidiInputDevices;   ///< contains all created MIDI input devices              // statistics cache
829                uint uiOldTotalVoiceCount;
830                uint uiOldTotalStreamCount;
831                std::map<uint, uint> mOldVoiceCounts;
832                std::map<uint, uint> mOldStreamCounts;
833    
834              friend class SamplerChannel;              friend class SamplerChannel;
835    
# Line 578  namespace LinuxSampler { Line 849  namespace LinuxSampler {
849                      void SetSampler(Sampler* pSampler) { this->pSampler = pSampler; }                      void SetSampler(Sampler* pSampler) { this->pSampler = pSampler; }
850    
851                      /**                      /**
852                         * Invoked when the engine type of the specified sampler
853                         * channel is going to be changed soon.
854                         * @param ChannelId The numerical ID of the sampler channel
855                         */
856                        virtual void EngineToBeChanged(int ChannelId);
857    
858                        /**
859                       * Invoked when the engine type of the                       * Invoked when the engine type of the
860                       * specified sampler channel is changed.                       * specified sampler channel is changed.
861                       * @param ChannelId The numerical ID of the sampler                       * @param ChannelId The numerical ID of the sampler

Legend:
Removed from v.1541  
changed lines
  Added in v.2500

  ViewVC Help
Powered by ViewVC