Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members

/home/pete/Work/TSE3.svn/tse3/src/tse3/Mixer.h

Go to the documentation of this file.
00001 /*
00002  * @(#)Mixer.h 3.00 31 March 2000
00003  *
00004  * Copyright (c) 2000 Pete Goodliffe (pete@cthree.org)
00005  *
00006  * This file is part of TSE3 - the Trax Sequencer Engine version 3.00.
00007  *
00008  * This library is modifiable/redistributable under the terms of the GNU
00009  * General Public License.
00010  *
00011  * You should have received a copy of the GNU General Public License along
00012  * with this program; see the file COPYING. If not, write to the Free Software
00013  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00014  *
00015  */
00016 
00017 #ifndef TSE3_MIXER_H
00018 #define TSE3_MIXER_H
00019 
00020 #include "tse3/listen/Mixer.h"
00021 
00022 #include "tse3/Notifier.h"
00023 #include "tse3/Midi.h"
00024 #include "tse3/listen/Transport.h"
00025 
00026 #include <cstddef>
00027 
00028 namespace TSE3
00029 {
00048     class MixerChannel : public Notifier<MixerChannelListener>
00049     {
00050         public:
00051 
00058             unsigned int volume() const { return _volume; }
00059 
00067             void setVolume(unsigned int v, bool send = true);
00068 
00075             unsigned int pan() const { return _volume; }
00076 
00084             void setPan(unsigned int p, bool send = true);
00085 
00092             unsigned int chorus() const { return _volume; }
00093 
00101             void setChorus(unsigned int c, bool send = true);
00102 
00109             unsigned int reverb() const { return _volume; }
00110 
00118             void setReverb(unsigned int r, bool send = true);
00119 
00126             unsigned int program() const { return _volume; }
00127 
00135             void setProgram(unsigned int p, bool send = true);
00136 
00143             unsigned int bankLSB() const { return _volume; }
00144 
00152             void setBankLSB(unsigned int b, bool send = true);
00153 
00160             unsigned int bankMSB() const { return _volume; }
00161 
00169             void setBankMSB(unsigned int b, bool send = true);
00170 
00181             void command(MidiCommand mc);
00182 
00183             friend class MixerPort;
00184 
00185         private:
00186 
00190             MixerChannel(MixerPort *mixerPort, unsigned int channel);
00191             virtual ~MixerChannel();
00192 
00193             MixerChannel(const MixerChannel &);
00194             MixerChannel &operator=(const MixerChannel &);
00195 
00196             MixerPort     *mixerPort;
00197             unsigned int   channel;
00198             unsigned char  _volume;
00199             unsigned char  _pan;
00200             unsigned char  _chorus;
00201             unsigned char  _reverb;
00202             unsigned char  _program;
00203             unsigned char  _bankLSB;
00204             unsigned char  _bankMSB;
00205     };
00206 
00218     class MixerPort : public Notifier<MixerPortListener>
00219     {
00220         public:
00221 
00233             MixerChannel *operator[](size_t n) { return mixerChannels[n]; }
00234 
00241             unsigned int volume() const { return _volume; }
00242 
00250             void setVolume(unsigned int v, bool send = true);
00251 
00263             void command(MidiCommand mc);
00264 
00265             friend class Mixer;
00266             friend class MixerChannel;
00267 
00268         private:
00269 
00270             MixerPort(Mixer *mixer, unsigned int port);
00271             virtual ~MixerPort();
00272 
00273             MixerPort(const MixerPort &);
00274             MixerPort &operator=(const MixerPort &);
00275 
00280             void txCommand(MidiCommand mc);
00281 
00282             MixerChannel  *mixerChannels[16];
00283             Mixer         *mixer;
00284             unsigned int   port;
00285             unsigned char  _volume;
00286     };
00287 
00307     class Mixer : public Notifier<MixerListener>,
00308                   public Listener<TransportListener>,
00309                   public TransportCallback
00310     {
00311         public:
00312 
00320             Mixer(size_t noPorts, Transport *transport);
00321             virtual ~Mixer();
00322 
00334             MixerPort *operator[](size_t n) { return mixerPorts[n]; }
00335 
00344             void command(MidiCommand mc);
00345 
00349             virtual void Notifier_Deleted(Transport *);
00350 
00354             virtual void Transport_MidiIn(MidiCommand mc);
00355 
00359             virtual void Transport_MidiOut(MidiCommand mc);
00360 
00361             friend class MixerPort;
00362 
00363         private:
00364 
00365             Mixer(const Mixer &);
00366             Mixer &operator=(const Mixer &);
00367 
00372             void txCommand(MidiCommand mc);
00373 
00374             size_t      noPorts;
00375             MixerPort **mixerPorts;
00376             Transport  *transport;
00377             bool        _updateWithInput;
00378             bool        _updateWithOutput;
00379     };
00380 
00381 }
00382 
00383 #endif

Generated on Wed May 25 14:45:07 2005 for TSE3 by doxygen 1.3.2