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#ifndef DARKSEED_MUSIC_H
23#define DARKSEED_MUSIC_H
24
25#include "darkseed/adlib_dsf.h"
26#include "darkseed/adlib_worx.h"
27#include "darkseed/midiparser_sbr.h"
28
29#include "audio/mididrv_ms.h"
30#include "audio/midiparser.h"
31#include "common/mutex.h"
32
33namespace Darkseed {
34
35class DarkseedEngine;
36
38protected:
39 static const uint8 NUM_SFX_PARSERS = 5;
40
41 DarkseedEngine *_vm;
42
43 Common::Mutex _mutex;
45 MidiDriver_DarkSeedFloppy_AdLib *_floppyAdLibDriver;
46
47 MidiParser *_musicParser;
48 MidiParser *_sfxParsers[NUM_SFX_PARSERS];
49 MidiParser_SBR *_sfxParserSbr;
50 // The type of the music device selected for playback.
51 MusicType _deviceType;
52 byte *_musicData;
53 byte *_sfxData;
54 byte *_tosInstrumentBankData;
55 bool _tosInstrumentBankLoaded;
56 bool _useFloppyMusic;
57 bool _useFloppySfx;
58
59 bool _paused;
60
61 static void onTimer(void *data);
62
63public:
64 MusicPlayer(DarkseedEngine *vm, bool useFloppyMusic, bool useFloppySfx);
66
67 int open();
68
69 void load(Common::SeekableReadStream *in, int32 size = -1, bool sfx = false);
70 void loadTosInstrumentBankData(Common::SeekableReadStream *in, int32 size = -1);
71 void loadTosInstrumentBank();
72 void loadInstrumentBank(Common::SeekableReadStream *in, int32 size = -1);
73 bool isSampleSfx(uint8 sfxId);
74
75 void playMusic(uint8 priority = 0xFF, bool loop = false);
76 void setLoopMusic(bool loop);
77 bool isPlayingMusic();
78 void stopMusic();
79 void pauseMusic(bool pause);
80 void playSfx(uint8 sfxId, uint8 priority = 0xFF);
81 bool isPlayingSfx();
82 bool isPlayingSfx(uint8 sfxId);
83 void stopAllSfx();
84 bool stopSfx(uint8 sfxId);
85
86 void startFadeOutMusic();
87 bool isFadingMusic();
88
89 void syncSoundSettings();
90
91protected:
92 uint8 assignSfxParser();
93};
94
95} // namespace Darkseed
96
97#endif // DARKSEED_MUSIC_H
Definition: mutex.h:67
Definition: stream.h:745
Definition: darkseed.h:79
Definition: midiparser_sbr.h:32
Definition: music.h:37
Definition: mididrv_ms.h:86
Definition: midiparser.h:354
MusicType
Definition: mididrv.h:44