ScummVM API documentation
midi_player.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 ULTIMA8_AUDIO_MIDI_PLAYER_H
23 #define ULTIMA8_AUDIO_MIDI_PLAYER_H
24 
25 #include "audio/mixer.h"
26 #include "audio/mididrv_ms.h"
27 #include "audio/midiparser.h"
28 
29 namespace Ultima {
30 namespace Ultima8 {
31 
32 class MidiPlayer {
33 public:
34  MidiPlayer();
35  ~MidiPlayer();
36 
40  void load(byte *data, size_t size, int seqNo);
41 
46  void loadTransitionData(byte *data, size_t size);
47 
53  void play(int trackNo, int branchNo);
54 
62  void playTransition(int trackNo, bool overlay);
63 
67  void stop();
68 
72  void pause(bool pause);
73 
77  bool isPlaying();
78 
82  void startFadeOut(uint16 length);
83 
87  bool isFading();
88 
92  void syncSoundSettings();
93 
97  void setLooping(bool loop);
98 
103  bool hasBranchIndex(uint8 index);
104 
105  bool isFMSynth() const {
106  return _isFMSynth;
107  };
108 
109  static void xmidiCallback(byte eventData, void *data);
110 
111  byte getSequenceCallbackData(int seq) const {
112  assert(seq == 0 || seq == 1);
113  return _callbackData[seq];
114  }
115 
116  void onTimer();
117  static void timerCallback(void *data);
118 
119 private:
120  MidiDriver_Multisource *_driver;
121  MidiParser *_parser;
122  MidiParser *_transitionParser;
123 
124  bool _isFMSynth;
125  bool _playingTransition;
126  static byte _callbackData[2];
127 };
128 
129 } // End of namespace Ultima8
130 } // End of namespace Ultima
131 
132 #endif
bool hasBranchIndex(uint8 index)
void play(int trackNo, int branchNo)
Definition: mididrv_ms.h:86
void playTransition(int trackNo, bool overlay)
Definition: detection.h:27
Definition: midi_player.h:32
void load(byte *data, size_t size, int seqNo)
void loadTransitionData(byte *data, size_t size)
void setLooping(bool loop)
Definition: midiparser.h:289
void startFadeOut(uint16 length)