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 
40 enum SynthType {
41  kSynthTypeDefault = 0,
42  kSynthTypePCSpeaker = 1,
43  kSynthTypeAdLib = 2,
44  kSynthTypeAdLibGold = 3,
45  kSynthTypeMT32 = 4
46 };
47 
48 class MusicPlayer {
49 public:
50  virtual ~MusicPlayer() {}
51 
52  virtual void close() = 0;
53 
54  virtual bool load(int16 musicNum) = 0;
55  virtual void play(int16 musicNum) = 0;
56  virtual void stop() = 0;
57  virtual void pause() = 0;
58  virtual void resume() = 0;
59 
60  virtual bool isPlaying() = 0;
61  virtual void syncSoundSettings() = 0;
62 
63  virtual SynthType getSynthType() const { return kSynthTypeDefault; }
64 };
65 
66 class DOSMusicPlayer : public MusicPlayer {
67 private:
68  static const uint8 MT32_GOODBYE_MSG[MidiDriver_MT32GM::MT32_DISPLAY_NUM_CHARS];
69 
70 public:
71  DOSMusicPlayer(MadeEngine *vm, bool milesAudio);
72  ~DOSMusicPlayer();
73 
74  void close() override;
75 
76  bool load(int16 musicNum) override;
77  void play(int16 musicNum) override;
78  void stop() override;
79  void pause() override;
80  void resume() override;
81 
82  bool isPlaying() override;
83  void syncSoundSettings() override;
84 
85  SynthType getSynthType() const override;
86 
87 private:
88  MadeEngine *_vm;
89  MidiParser *_parser;
90  MidiDriver_Multisource *_driver;
91 
92  MusicType _driverType;
93 
94  GenericResource *_musicRes;
95 
96  void playXMIDI(GenericResource *midiResource);
97  void playSMF(GenericResource *midiResource);
98 
99  static void timerCallback(void *refCon);
100  void onTimer();
101 };
102 
104 public:
106 
107  // TODO Implement AdLib driver logic for Manhole / LGoP2
108 };
109 
110 } // End of namespace Made
111 
112 #endif
Definition: resource.h:165
Definition: mididrv_ms.h:86
Definition: made.h:69
MusicType
Definition: mididrv.h:44
Definition: music.h:48
Definition: adlib_ms.h:295
Definition: music.h:103
OplType
Definition: fmopl.h:58
Definition: music.h:66
Definition: console.h:27
SynthType
Definition: music.h:40
Definition: midiparser.h:354