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