ScummVM API documentation
music.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 
23 #ifndef GAMOS_MUSIC_H
24 #define GAMOS_MUSIC_H
25 
26 
27 
28 #include "audio/mididrv.h"
29 #include "common/memstream.h"
30 #include "common/mutex.h"
31 #include "common/scummsys.h"
32 #include "common/timer.h"
33 #include "common/system.h"
34 
35 namespace Gamos {
36 
37 class MidiMusic {
38 private:
39  MidiDriver *_driver = nullptr;
40  Common::Array<byte> _pMidiData;
41 
42  Common::Mutex _mutex;
43 
44  uint32 _dataPos = 0;
45  uint32 _dataStart = 0;
46  int32 _midiDelayTicks = 0;
47  int32 _midiDelayCount = 0;
48  uint32 _midiTimeStamp = 0;
49  uint32 _midiOp = 0; /* save midi event type between update cycles */
50  bool _midiMute = false;
51 
52  uint8 _volume;
53 
54 public:
55 
56  MidiMusic();
57  ~MidiMusic();
58 
59  void stopMusic();
60  bool playMusic(Common::Array<byte> *midiData);
61  void update();
62 
63  void setVolume(uint8 volume);
64 
65  int16 midi2low();
66 
67  static void _timerProc(void *data);
68 };
69 
70 }
71 
72 #endif //GAMOS_MUSIC_H
Definition: music.h:37
Definition: mididrv.h:313
Definition: blit.h:28
Definition: mutex.h:67