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 ULTIMA3_MUSIC_H
23#define ULTIMA3_MUSIC_H
24
25#include "audio/midiplayer.h"
26
27namespace Ultima {
28namespace Ultima3 {
29
33enum Song {
34 SONG_NONE = -1,
35 SONG_WANDER = 0,
36 SONG_CASTLES = 1,
37 SONG_RULEBRIT = 2,
38 SONG_TOWNS = 3,
39 SONG_SHOPPING = 4,
40 SONG_COMBAT = 5,
41 SONG_DUNGEON = 6,
42 SONG_ALIVE = 7,
43 SONG_FANFARE = 8,
44 SONG_EXODUS = 9,
45 SONG_COUNT = 10
46};
47
48// The kinds of place that have a song, other than the ones in the savegame
49constexpr byte MUSIC_LOCATION_SCENE = 4;
50constexpr byte MUSIC_LOCATION_GEM = 0x11;
51constexpr byte MUSIC_LOCATION_COMBAT = 0x80;
52
57class Music : public Audio::MidiPlayer {
58private:
59 static constexpr int UNSELECTED = -2;
60
61 bool _enabled = false;
62 bool _driverOpened = false;
63 bool _miles = false;
64 int _song = SONG_NONE;
65 int _current = SONG_NONE;
66 int _jingle = SONG_NONE;
67 int _selected = UNSELECTED;
68
72 void openDriver();
73
77 void start(int song, bool loop);
78
83 bool startFile(const Common::String &name, bool loop);
84
85public:
86 Music() {}
87 ~Music() override {}
88
92 void setEnabled(bool enabled);
93
97 void play(int song);
98
102 void jingle(int song);
103
109 bool playFile(const Common::String &name);
110
114 void silence();
115
121 void autoSelect(byte location, bool inExodus);
122
126 void resync() {
127 _selected = UNSELECTED;
128 }
129
133 void update();
134
135 // MidiDriver_BASE API
136 void send(uint32 b) override;
137};
138
139} // namespace Ultima3
140} // namespace Ultima
141
142#endif
Definition: midiplayer.h:63
Definition: str.h:59
Definition: music.h:57
void resync()
Definition: music.h:126
void setEnabled(bool enabled)
void autoSelect(byte location, bool inExodus)
bool playFile(const Common::String &name)
void jingle(int song)
void play(int song)
void send(uint32 b) override