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

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

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

  ViewVC Help
Powered by ViewVC