ScummVM API documentation
sound_midi.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 // Music class
23 
24 #ifndef AGI_SOUND_MIDI_H
25 #define AGI_SOUND_MIDI_H
26 
27 #include "agi/sound.h"
28 
29 #include "audio/midiplayer.h"
30 
31 namespace Agi {
32 
33 class MIDISound : public AgiSound {
34 public:
35  MIDISound(uint8 *data, uint32 len, int resnum);
36  ~MIDISound() override { free(_data); }
37  uint16 type() override { return _type; }
38  uint8 *_data;
39  uint32 _len;
40 
41 protected:
42  uint16 _type;
43 };
44 
45 class SoundGenMIDI : public SoundGen, public Audio::MidiPlayer {
46 public:
47  SoundGenMIDI(AgiBase *vm, Audio::Mixer *pMixer);
48 
49  void play(int resnum) override;
50  // We must overload stop() here to implement the pure virtual
51  // stop() method of the SoundGen class.
52  void stop() override { Audio::MidiPlayer::stop(); }
53 
54  // MidiDriver_BASE interface implementation
55  void send(uint32 b) override;
56 
57  // Overload Audio::MidiPlayer method
58  void sendToChannel(byte channel, uint32 b) override;
59  void endOfTrack() override;
60 
61 private:
62  bool _isGM;
63 };
64 
65 } // End of namespace Agi
66 
67 #endif
Definition: sound_midi.h:33
Definition: midiplayer.h:63
Definition: agi.h:663
uint32 _len
Length of the raw sound resource.
Definition: sound_midi.h:39
Definition: sound.h:74
Definition: sound_midi.h:45
uint16 _type
Sound resource type.
Definition: sound_midi.h:42
Definition: mixer.h:59
Definition: sound.h:93
uint8 * _data
Raw sound resource data.
Definition: sound_midi.h:38
Definition: agi.h:63