ScummVM API documentation
midi.h
1 
2 /* ScummVM - Graphic Adventure Engine
3  *
4  * ScummVM is the legal property of its developers, whose names
5  * are too numerous to list here. Please refer to the COPYRIGHT
6  * file distributed with this source distribution.
7  *
8  * This program is free software: you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation, either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program. If not, see <http://www.gnu.org/licenses/>.
20  *
21  */
22 
23 #ifndef M4_SOUND_PLATFORM_MIDI_H
24 #define M4_SOUND_PLATFORM_MIDI_H
25 
26 #include "audio/mididrv_ms.h"
27 #include "audio/midiparser.h"
28 
29 namespace M4 {
30 namespace Sound {
31 
32 class Midi {
33 private:
34  static int _midiEndTrigger;
35 
36  Common::Mutex _mutex;
37 
38  MusicType _deviceType;
39 
40  MidiDriver_Multisource *_driver;
41  MidiParser *_midiParser;
42  byte *_midiData;
43 
44  bool _paused;
45 
46 protected:
47  static void onTimer(void *data);
48 
49 public:
50  Midi();
51  ~Midi();
52 
53  int open();
54 
55  void load(byte *in, int32 size);
56  void play();
57  void pause(bool pause);
58  void stop();
59  bool isPlaying();
60  void startFade(uint16 duration, uint16 targetVolume);
61  bool isFading();
62 
63  void syncSoundSettings();
64 
65  void midi_play(const char *name, int volume, bool loop, int trigger, int roomNum);
66  void task();
67  void loop();
68  void midi_fade_volume(int targetVolume, int duration);
69 };
70 
71 } // namespace Sound
72 
73 void midi_play(const char *name, int volume, bool loop, int trigger, int roomNum);
74 void midi_loop();
75 void midi_stop();
76 void midi_fade_volume(int targetVolume, int duration);
77 
78 } // namespace M4
79 
80 #endif
Definition: mididrv_ms.h:86
MusicType
Definition: mididrv.h:44
Definition: midi.h:32
Definition: mutex.h:67
Definition: database.h:28
Definition: midiparser.h:354