ResidualVM logo ResidualVM website - Forums - Contact us BuildBot - Doxygen - Wiki curved edge

mpu401.h

Go to the documentation of this file.
00001 /* ScummVM - Graphic Adventure Engine
00002  *
00003  * ScummVM is the legal property of its developers, whose names
00004  * are too numerous to list here. Please refer to the COPYRIGHT
00005  * file distributed with this source distribution.
00006  *
00007  * This program is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU General Public License
00009  * as published by the Free Software Foundation; either version 2
00010  * of the License, or (at your option) any later version.
00011  *
00012  * This program is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00020  *
00021  */
00022 
00023 #ifndef AUDIO_MPU401_H
00024 #define AUDIO_MPU401_H
00025 
00026 #include "audio/mididrv.h"
00027 
00029 //
00030 // Common MPU401 implementation methods
00031 //
00033 
00034 class MidiChannel_MPU401 : public MidiChannel {
00035 
00036 private:
00037     MidiDriver *_owner;
00038     bool _allocated;
00039     byte _channel;
00040 
00041 public:
00042     MidiDriver *device();
00043     byte getNumber() { return _channel; }
00044     virtual void release() { _allocated = false; }
00045 
00046     virtual void send(uint32 b);
00047 
00048     // Regular messages
00049     virtual void noteOff(byte note);
00050     virtual void noteOn(byte note, byte velocity);
00051     virtual void programChange(byte program);
00052     virtual void pitchBend(int16 bend);
00053 
00054     // Control Change messages
00055     virtual void controlChange(byte control, byte value);
00056     virtual void pitchBendFactor(byte value);
00057 
00058     // SysEx messages
00059     virtual void sysEx_customInstrument(uint32 type, const byte *instr);
00060 
00061     // Only to be called by the owner
00062     void init(MidiDriver *owner, byte channel);
00063     bool allocate();
00064 };
00065 
00066 
00067 
00068 class MidiDriver_MPU401 : public MidiDriver {
00069 private:
00070     MidiChannel_MPU401 _midi_channels[16];
00071     Common::TimerManager::TimerProc _timer_proc;
00072     uint16 _channel_mask;
00073 
00074 public:
00075     MidiDriver_MPU401();
00076     virtual ~MidiDriver_MPU401();
00077 
00078     virtual void close();
00079     virtual void setTimerCallback(void *timer_param, Common::TimerManager::TimerProc timer_proc);
00080     virtual uint32 getBaseTempo(void) { return 10000; }
00081     virtual uint32 property(int prop, uint32 param);
00082 
00083     virtual MidiChannel *allocateChannel();
00084     virtual MidiChannel *getPercussionChannel() { return &_midi_channels[9]; }
00085 };
00086 
00087 
00088 #endif


Generated on Sat Mar 23 2019 05:01:52 for ResidualVM by doxygen 1.7.1
curved edge   curved edge