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 // Music class
23 
24 #ifndef MADE_MUSIC_H
25 #define MADE_MUSIC_H
26 
27 #include "made.h"
28 
29 #include "audio/adlib_ms.h"
30 #include "audio/mididrv.h"
31 #include "audio/mididrv_ms.h"
32 #include "audio/mt32gm.h"
33 #include "audio/midiparser.h"
34 
35 namespace Made {
36 
37 class GenericResource;
38 
39 class MusicPlayer {
40 public:
41  virtual ~MusicPlayer() {}
42 
43  virtual void close() = 0;
44 
45  virtual bool load(int16 musicNum) = 0;
46  virtual void play(int16 musicNum) = 0;
47  virtual void stop() = 0;
48  virtual void pause() = 0;
49  virtual void resume() = 0;
50 
51  virtual bool isPlaying() = 0;
52  virtual void syncSoundSettings() = 0;
53 };
54 
55 class DOSMusicPlayer : public MusicPlayer {
56 private:
57  static const uint8 MT32_GOODBYE_MSG[MidiDriver_MT32GM::MT32_DISPLAY_NUM_CHARS];
58 
59 public:
60  DOSMusicPlayer(MadeEngine *vm, bool milesAudio);
61  ~DOSMusicPlayer();
62 
63  void close() override;
64 
65  bool load(int16 musicNum) override;
66  void play(int16 musicNum) override;
67  void stop() override;
68  void pause() override;
69  void resume() override;
70 
71  bool isPlaying() override;
72  void syncSoundSettings() override;
73 
74 private:
75  MadeEngine *_vm;
76  MidiParser *_parser;
77  MidiDriver_Multisource *_driver;
78 
79  MusicType _driverType;
80 
81  GenericResource *_musicRes;
82 
83  void playXMIDI(GenericResource *midiResource);
84  void playSMF(GenericResource *midiResource);
85 
86  static void timerCallback(void *refCon);
87  void onTimer();
88 };
89 
91 public:
93 
94  // TODO Implement AdLib driver logic for Manhole / LGoP2
95 };
96 
97 } // End of namespace Made
98 
99 #endif
Definition: resource.h:165
Definition: mididrv_ms.h:86
Definition: made.h:69
MusicType
Definition: mididrv.h:44
Definition: music.h:39
Definition: adlib_ms.h:289
Definition: music.h:90
OplType
Definition: fmopl.h:58
Definition: music.h:55
Definition: console.h:27
Definition: midiparser.h:354