ScummVM API documentation
mpu401.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef AUDIO_MPU401_H
23 #define AUDIO_MPU401_H
24 
25 #include "audio/mididrv.h"
26 
28 //
29 // Common MPU401 implementation methods
30 //
32 
34 
35 private:
36  MidiDriver *_owner;
37  bool _allocated;
38  byte _channel;
39 
40 public:
41  MidiDriver *device();
42  byte getNumber() { return _channel; }
43  virtual void release() { _allocated = false; }
44 
45  virtual void send(uint32 b);
46 
47  // Regular messages
48  virtual void noteOff(byte note);
49  virtual void noteOn(byte note, byte velocity);
50  virtual void programChange(byte program);
51  virtual void pitchBend(int16 bend);
52 
53  // Control Change messages
54  virtual void controlChange(byte control, byte value);
55  virtual void pitchBendFactor(byte value);
56 
57  // SysEx messages
58  virtual void sysEx_customInstrument(uint32 type, const byte *instr, uint32 datasize) {}
59 
60  // Only to be called by the owner
61  void init(MidiDriver *owner, byte channel);
62  bool allocate();
63 };
64 
65 
66 
67 class MidiDriver_MPU401 : public MidiDriver {
68 private:
69  MidiChannel_MPU401 _midi_channels[16];
71  uint16 _channel_mask;
72 
73 public:
75  virtual ~MidiDriver_MPU401();
76 
77  virtual void close();
78  virtual void setTimerCallback(void *timer_param, Common::TimerManager::TimerProc timer_proc);
79  virtual uint32 getBaseTempo(void) { return 10000; }
80  virtual uint32 property(int prop, uint32 param);
81 
82  virtual MidiChannel *allocateChannel();
83  virtual MidiChannel *getPercussionChannel() { return &_midi_channels[9]; }
84 };
85 
86 
87 #endif
void(* TimerProc)(void *refCon)
Definition: timer.h:42
Definition: mididrv.h:309
Definition: mpu401.h:33
Definition: mididrv.h:537
virtual uint32 getBaseTempo(void)
Definition: mpu401.h:79
Definition: mpu401.h:67