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 SHERLOCK_MUSIC_H
23#define SHERLOCK_MUSIC_H
24
25#include "audio/midiparser.h"
26#include "audio/mididrv.h"
27// for 3DO digital music
28#include "audio/mixer.h"
29#include "common/mutex.h"
30#include "common/str-array.h"
31
32namespace Sherlock {
33
34class SherlockEngine;
35
36class MidiParser_SH : public MidiParser {
37public:
39 ~MidiParser_SH() override;
40
41protected:
42 Common::Mutex _mutex;
43 void parseNextEvent(EventInfo &info) override;
44
45 uint8 _beats;
46 uint8 _lastEvent;
47 const byte *_data;
48 const byte *_trackEnd;
49
50public:
51 bool loadMusic(const byte *musData, uint32 musSize) override;
52 void unloadMusic() override;
53
54private:
55 const byte *_musData;
56 uint32 _musDataSize;
57};
58
59class Music {
60private:
61 SherlockEngine *_vm;
62 Audio::Mixer *_mixer;
63 MidiParser *_midiParser;
64 MidiDriver *_midiDriver;
65 Audio::SoundHandle _digitalMusicHandle;
66 MusicType _musicType;
67 const byte *_midiMusicData;
68
72 bool playMusic(const Common::String &name);
73public:
74 bool _musicPlaying;
75 bool _musicOn;
76 int _musicVolume;
77 bool _midiOption;
78 Common::String _currentSongName, _nextSongName;
79public:
81 ~Music();
82
87
91 bool loadSong(int songNumber);
92
96 bool loadSong(const Common::String &songName);
97
101 void startSong();
102
106 void freeSong();
107
111 void stopMusic();
112
113 bool isPlaying();
114 uint32 getCurrentPosition();
115
116 bool waitUntilMSec(uint32 msecTarget, uint32 maxMSec, uint32 additionalDelay, uint32 noMusicDelay);
117
121 void setMusicVolume(int volume);
122
127
133};
134
135} // End of namespace Sherlock
136
137#endif
Definition: mixer.h:70
Definition: mixer.h:49
Definition: mutex.h:67
Definition: str.h:59
Definition: mididrv.h:313
Definition: midiparser.h:354
Definition: music.h:36
Definition: music.h:59
void checkSongProgress()
bool loadSong(int songNumber)
void setMusicVolume(int volume)
void getSongNames(Common::StringArray &songs)
bool loadSong(const Common::String &songName)
void syncMusicSettings()
Definition: sherlock.h:206
MusicType
Definition: mididrv.h:44
Definition: midiparser.h:135