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 ULTIMA4_SOUND_MUSIC_H
23#define ULTIMA4_SOUND_MUSIC_H
24
25#include "audio/audiostream.h"
26#include "audio/midiplayer.h"
27#include "audio/mixer.h"
28
29namespace Ultima {
30namespace Ultima4 {
31
32#define CAMP_FADE_OUT_TIME 1000
33#define CAMP_FADE_IN_TIME 0
34#define INN_FADE_OUT_TIME 1000
35#define INN_FADE_IN_TIME 5000
36#define NLOOPS -1
37
38
39class Music : public Audio::MidiPlayer {
40public:
41 enum Type {
42 NONE,
43 OUTSIDE,
44 TOWNS,
45 SHRINES,
46 SHOPPING,
47 RULEBRIT,
48 FANFARE,
49 DUNGEON,
50 COMBAT,
51 CASTLES,
52 MAX
53 };
54
55 Type _introMid;
56private:
57 Audio::Mixer *_mixer;
58 Audio::SoundHandle _soundHandle;
60
64 bool startMusic(const Common::String &filename);
65protected:
66 // Overload Audio::MidiPlayer method
67 void sendToChannel(byte channel, uint32 b) override;
68public:
69 Music(Audio::Mixer *mixer);
70 ~Music() override;
71
75 void playMusic(const Common::String &filename);
76
80 void playMusic(Type music);
81
86
87 void stop() override;
88
89
93 void fadeOut(int msecs) {
94 // TODO
95 }
96
100 void fadeIn(int msecs, bool loadFromMap) {
101 // TODO
102 }
103
107 void lordBritish() {
108 playMusic(RULEBRIT);
109 }
110
114 void hawkwind() {
115 playMusic(SHOPPING);
116 }
117
121 void camp() {
122 fadeOut(1000);
123 }
124
128 void shopping() {
129 playMusic(SHOPPING);
130 }
131
132 void intro() {
133#ifdef IOS_ULTIMA4
134 _on = true; // Force iOS to turn this back on from going in the background.
135#endif
136 playMusic(_introMid);
137 }
138
142 void introSwitch(int n);
143};
144
145extern Music *g_music;
146
147} // End of namespace Ultima4
148} // End of namespace Ultima
149
150#endif
Definition: midiplayer.h:63
Definition: mixer.h:70
Definition: mixer.h:49
Definition: str.h:59
Definition: music.h:39
void playMusic(const Common::String &filename)
void sendToChannel(byte channel, uint32 b) override
void shopping()
Definition: music.h:128
void hawkwind()
Definition: music.h:114
void playMusic(Type music)
void fadeOut(int msecs)
Definition: music.h:93
void lordBritish()
Definition: music.h:107
void fadeIn(int msecs, bool loadFromMap)
Definition: music.h:100
void camp()
Definition: music.h:121