/[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 900 by schoenebeck, Wed Jul 5 17:53:22 2006 UTC revision 1541 by iliev, Tue Dec 4 18:09:26 2007 UTC
# Line 26  Line 26 
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/Exception.h"  #include "common/Exception.h"
32  #include "engines/EngineChannel.h"  #include "engines/EngineChannel.h"
# Line 149  namespace LinuxSampler { Line 150  namespace LinuxSampler {
150               * Sampler instance.               * Sampler instance.
151               */               */
152              uint Index();              uint Index();
153                
154                /**
155                 * Registers the specified listener to be notified
156                 * when the engine type of this sampler channel is changed.
157                 */
158                void AddEngineChangeListener(EngineChangeListener* l);
159    
160                /**
161                 * Removes the specified listener.
162                 */
163                void RemoveEngineChangeListener(EngineChangeListener* l);
164    
165                /**
166                 * Removes the specified listener.
167                 */
168                void RemoveAllEngineChangeListeners();
169    
170                /**
171                 * Notifies listeners that the engine
172                 * type of this sampler channel is changed.
173                 */
174                void fireEngineChanged();
175    
176    
177          protected:          protected:
178              SamplerChannel(Sampler* pS);              SamplerChannel(Sampler* pS);
# Line 167  namespace LinuxSampler { Line 191  namespace LinuxSampler {
191          private:          private:
192              int                iMidiPort;   ///< Don't access directly, read GetMidiInputPort() instead !              int                iMidiPort;   ///< Don't access directly, read GetMidiInputPort() instead !
193              midi_chan_t        midiChannel; ///< Don't access directly, read GetMidiInputChannel() instead !              midi_chan_t        midiChannel; ///< Don't access directly, read GetMidiInputChannel() instead !
194                ListenerList<EngineChangeListener*> llEngineChangeListeners;
195      };      };
196    
197      /** @brief LinuxSampler main class      /** @brief LinuxSampler main class
# Line 283  namespace LinuxSampler { Line 308  namespace LinuxSampler {
308              void RemoveSamplerChannel(uint uiSamplerChannel);              void RemoveSamplerChannel(uint uiSamplerChannel);
309    
310              /**              /**
311                 * Registers the specified listener to be notified
312                 * when the number of sampler chanels is changed.
313                 */
314                void AddChannelCountListener(ChannelCountListener* l);
315    
316                /**
317                 * Removes the specified listener.
318                 */
319                void RemoveChannelCountListener(ChannelCountListener* l);
320    
321                /**
322                 * Registers the specified listener to be notified
323                 * when the number of audio output devices is changed.
324                 */
325                void AddAudioDeviceCountListener(AudioDeviceCountListener* l);
326    
327                /**
328                 * Removes the specified listener.
329                 */
330                void RemoveAudioDeviceCountListener(AudioDeviceCountListener* l);
331    
332                
333                /**
334                 * Registers the specified listener to be notified
335                 * when the number of MIDI input devices is changed.
336                 */
337                void AddMidiDeviceCountListener(MidiDeviceCountListener* l);
338    
339                /**
340                 * Removes the specified listener.
341                 */
342                void RemoveMidiDeviceCountListener(MidiDeviceCountListener* l);
343    
344                /**
345                 * Registers the specified listener to be notified when the number
346                 * of active voices in a particular sampler channel is changed.
347                 */
348                void AddVoiceCountListener(VoiceCountListener* l);
349    
350                /**
351                 * Removes the specified listener.
352                 */
353                void RemoveVoiceCountListener(VoiceCountListener* l);
354    
355                /**
356                 * Notifies listeners that the number of active voices
357                 * on the specified sampler channel is changed.
358                 * @param ChannelId The numerical ID of the sampler channel.
359                 * @param NewCount The new number of active voices.
360                 */
361                void fireVoiceCountChanged(int ChannelId, int NewCount);
362    
363                /**
364                 * Registers the specified listener to be notified when the number
365                 * of active disk streams in a particular sampler channel is changed.
366                 */
367                void AddStreamCountListener(StreamCountListener* l);
368    
369                /**
370                 * Removes the specified listener.
371                 */
372                void RemoveStreamCountListener(StreamCountListener* l);
373    
374                /**
375                 * Notifies listeners that the number of active disk streams
376                 * on the specified sampler channel is changed.
377                 * @param ChannelId The numerical ID of the sampler channel.
378                 * @param NewCount The new number of active disk streams.
379                 */
380                void fireStreamCountChanged(int ChannelId, int NewCount);
381    
382                /**
383                 * Registers the specified listener to be
384                 * notified when the fill state of the disk stream
385                 * buffers on a specific sampler channel is changed.
386                 */
387                void AddBufferFillListener(BufferFillListener* l);
388    
389                /**
390                 * Removes the specified listener.
391                 */
392                void RemoveBufferFillListener(BufferFillListener* l);
393    
394                /**
395                 * Notifies listeners that the fill state of the disk stream
396                 * buffers on the specified sampler channel is changed.
397                 * @param ChannelId The numerical ID of the sampler channel.
398                 * @param FillData The buffer fill data for the specified sampler channel.
399                 */
400                void fireBufferFillChanged(int ChannelId, String FillData);
401    
402                /**
403                 * Registers the specified listener to be notified
404                 * when total number of active voices is changed.
405                 */
406                void AddTotalVoiceCountListener(TotalVoiceCountListener* l);
407    
408                /**
409                 * Removes the specified listener.
410                 */
411                void RemoveTotalVoiceCountListener(TotalVoiceCountListener* l);
412    
413                /**
414                 * Notifies listeners that the total number of active voices is changed.
415                 * @param NewCount The new number of active voices.
416                 */
417                void fireTotalVoiceCountChanged(int NewCount);
418                
419                void AddTotalStreamCountListener(TotalStreamCountListener* l);
420                void RemoveTotalStreamCountListener(TotalStreamCountListener* l);
421                void fireTotalStreamCountChanged(int NewCount);
422    
423                /**
424                 * Registers the specified listener to be notified when the number
425                 * of effect sends on a particular sampler channel is changed.
426                 */
427                void AddFxSendCountListener(FxSendCountListener* l);
428    
429                /**
430                 * Removes the specified listener.
431                 */
432                void RemoveFxSendCountListener(FxSendCountListener* l);
433    
434                /**
435               * Returns the names of all available audio output drivers.               * Returns the names of all available audio output drivers.
436               */               */
437              std::vector<String> AvailableAudioOutputDrivers();              std::vector<String> AvailableAudioOutputDrivers();
# Line 358  namespace LinuxSampler { Line 507  namespace LinuxSampler {
507               */               */
508              void DestroyMidiInputDevice(MidiInputDevice* pDevice) throw (Exception);              void DestroyMidiInputDevice(MidiInputDevice* pDevice) throw (Exception);
509    
510                 /**
511                 * Gets the current number of all active streams.
512                 * @returns The current number of all active streams.
513                 */
514                int GetDiskStreamCount();
515    
516              /**              /**
517               * Gets the current number of all active voices.               * Gets the current number of all active voices.
518               * @returns The current number of all active voices.               * @returns The current number of all active voices.
# Line 371  namespace LinuxSampler { Line 526  namespace LinuxSampler {
526              void Reset();              void Reset();
527    
528          protected:          protected:
529                /**
530                 * Notifies listeners that the number of sampler channels has been changed.
531                 * @param NewCount The new number of sampler channels.
532                 */
533                void fireChannelCountChanged(int NewCount);
534    
535                /**
536                 * Notifies listeners that the number of audio output devices has been changed.
537                 * @param NewCount The new number of audio output devices.
538                 */
539                void fireAudioDeviceCountChanged(int NewCount);
540    
541                /**
542                 * Notifies listeners that the number of MIDI input devices has been changed.
543                 * @param NewCount The new number of MIDI input devices.
544                 */
545                void fireMidiDeviceCountChanged(int NewCount);
546    
547                /**
548                 * Notifies listeners that the number of effect sends
549                 * on a particular sampler channel is changed.
550                 * @param ChannelId The numerical ID of the sampler channel.
551                 * @param NewCount The new number of sampler channels.
552                 */
553                void fireFxSendCountChanged(int ChannelId, int NewCount);
554    
555              typedef std::map<uint, AudioOutputDevice*> AudioOutputDeviceMap;              typedef std::map<uint, AudioOutputDevice*> AudioOutputDeviceMap;
556              typedef std::map<uint, MidiInputDevice*> MidiInputDeviceMap;              typedef std::map<uint, MidiInputDevice*> MidiInputDeviceMap;
557              typedef std::map<uint, SamplerChannel*> SamplerChannelMap;              typedef std::map<uint, SamplerChannel*> SamplerChannelMap;
# Line 380  namespace LinuxSampler { Line 561  namespace LinuxSampler {
561              MidiInputDeviceMap    mMidiInputDevices;   ///< contains all created MIDI input devices              MidiInputDeviceMap    mMidiInputDevices;   ///< contains all created MIDI input devices
562    
563              friend class SamplerChannel;              friend class SamplerChannel;
564    
565            private:
566                ListenerList<ChannelCountListener*> llChannelCountListeners;
567                ListenerList<AudioDeviceCountListener*> llAudioDeviceCountListeners;
568                ListenerList<MidiDeviceCountListener*> llMidiDeviceCountListeners;
569                ListenerList<VoiceCountListener*> llVoiceCountListeners;
570                ListenerList<StreamCountListener*> llStreamCountListeners;
571                ListenerList<BufferFillListener*> llBufferFillListeners;
572                ListenerList<TotalStreamCountListener*> llTotalStreamCountListeners;
573                ListenerList<TotalVoiceCountListener*> llTotalVoiceCountListeners;
574                ListenerList<FxSendCountListener*> llFxSendCountListeners;
575    
576                class EventHandler : public EngineChangeListener, public FxSendCountListener {
577                    public:
578                        void SetSampler(Sampler* pSampler) { this->pSampler = pSampler; }
579    
580                        /**
581                         * Invoked when the engine type of the
582                         * specified sampler channel is changed.
583                         * @param ChannelId The numerical ID of the sampler
584                         * channel, which engine type has been changed.
585                         */
586                        virtual void EngineChanged(int ChannelId);
587    
588                        /**
589                         * Invoked when the number of effect sends
590                         * on the specified sampler channel has changed.
591                         * @param ChannelId The numerical ID of the sampler channel.
592                         * @param NewCount The new number of effect sends.
593                         */
594                        virtual void FxSendCountChanged(int ChannelId, int NewCount);
595    
596                    private:
597                        Sampler* pSampler;
598                } eventHandler;
599      };      };
600  }  }
601    

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

  ViewVC Help
Powered by ViewVC