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
29namespace M4 {
30namespace Sound {
31
32class Midi {
33private:
34 // Trigger to fire once the current track has finished, or -1 for none.
35 // _pendingEndTrigger hands it from the audio thread to the main thread.
36 int _midiEndTrigger;
37 int _pendingEndTrigger;
38
39 Common::Mutex _mutex;
40
41 MusicType _deviceType;
42
44 MidiParser *_midiParser;
45 byte *_midiData;
46
47 bool _paused;
48
49protected:
50 static void onTimer(void *data);
51
52public:
53 Midi();
54 ~Midi();
55
56 int open();
57
58 void load(byte *in, int32 size);
59 void play();
60 void pause(bool pause);
61 void stop();
62 bool isPlaying();
63 void startFade(uint16 duration, uint16 targetVolume);
64 bool isFading();
65
66 void syncSoundSettings();
67
68 void midi_play(const char *name, int volume, bool loop, int trigger, int roomNum);
69 void task();
70 void loop();
71 void midi_fade_volume(int targetVolume, int duration);
72};
73
74} // namespace Sound
75
76void midi_play(const char *name, int volume, bool loop, int trigger, int roomNum);
77void midi_loop();
78void midi_stop();
79void midi_fade_volume(int targetVolume, int duration);
80
81} // namespace M4
82
83#endif
Definition: mutex.h:67
Definition: midi.h:32
Definition: mididrv_ms.h:86
Definition: midiparser.h:354
MusicType
Definition: mididrv.h:44
Definition: database.h:28