ScummVM API documentation
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
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 #ifndef DARKSEED_MUSIC_H
23 #define DARKSEED_MUSIC_H
24 
25 #include "darkseed/adlib_dsf.h"
26 #include "darkseed/adlib_worx.h"
27 
28 #include "audio/mididrv_ms.h"
29 #include "audio/midiparser.h"
30 #include "common/mutex.h"
31 
32 namespace Darkseed {
33 
34 class DarkseedEngine;
35 
36 class MusicPlayer {
37 protected:
38  DarkseedEngine *_vm;
39 
40  Common::Mutex _mutex;
41  MidiDriver_Multisource *_driver;
42  MidiDriver_DarkSeedFloppy_AdLib *_floppyAdLibDriver;
43 
44  MidiParser *_parser;
45  byte *_musicData;
46  byte *_tosInstrumentBankData;
47  bool _tosInstrumentBankLoaded;
48  bool _useFloppyMusic;
49 
50  bool _paused;
51 
52  static void onTimer(void *data);
53 
54 public:
55  MusicPlayer(DarkseedEngine *vm, bool useFloppyMusic);
56  ~MusicPlayer();
57 
58  int open();
59 
60  void load(Common::SeekableReadStream *in, int32 size = -1, bool sfx = false);
61  void loadTosInstrumentBankData(Common::SeekableReadStream *in, int32 size = -1);
62  void loadTosInstrumentBank();
63  void loadInstrumentBank(Common::SeekableReadStream *in, int32 size = -1);
64 
65  void play(uint8 priority = 0xFF, bool loop = false);
66  void setLoop(bool loop);
67  bool isPlaying();
68  void stop();
69  void pause(bool pause);
70 
71  void startFadeOut();
72  bool isFading();
73 
74  void syncSoundSettings();
75 
76 private:
77  // The type of the music device selected for playback.
78  MusicType _deviceType;
79 };
80 
81 } // namespace Darkseed
82 
83 #endif // DARKSEED_MUSIC_H
Definition: music.h:36
Definition: mididrv_ms.h:86
MusicType
Definition: mididrv.h:44
Definition: stream.h:745
Definition: darkseed.h:78
Definition: mutex.h:67
Definition: adlib_dsf.h:27
Definition: midiparser.h:354