ScummVM API documentation
MusicManager.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/*
23 * This code is based on the CRAB engine
24 *
25 * Copyright (c) Arvind Raja Yadav
26 *
27 * Licensed under MIT
28 *
29 */
30
31#ifndef CRAB_MUSICMANAGER_H
32#define CRAB_MUSICMANAGER_H
33
34#include "audio/mixer.h"
35#include "audio/decoders/wave.h"
36#include "crab/music/musicparam.h"
37
38namespace Crab {
39
40namespace pyrodactyl {
41namespace music {
43 struct EffectAudio {
44 Common::File _file;
46 Audio::SoundHandle *_handle;
47 };
48
49 // The background music for our current level
50 MusicData _bg;
51
53
54 Audio::SoundHandle *_musicHandle;
55
56public:
57 // The notification sound
58 ChunkKey _notify, _repInc, _repDec;
59
60 MusicManager() {
61 _notify = -1;
62 _repInc = -1;
63 _repDec = -1;
64
65 _musicHandle = nullptr;
66 }
67 ~MusicManager() {}
68
69 bool load(rapidxml::xml_node<char> *node);
70
71 void syncSettings();
72
73 void playMusic(const MusicKey &id);
74 void playEffect(const ChunkKey &id, const int &loops);
75
76 static void pause() {
77 g_system->getMixer()->pauseAll(true);
78 }
79
80 static void resume() {
81 g_system->getMixer()->pauseAll(false);
82 }
83
84 static void stop() {
86 }
87
88 static void volEffects(const int &volume, const bool &unmute = false) {
89 if (unmute)
92 }
93
94 static int volEffects() {
96 }
97
98 static void volMusic(const int &volume, const bool &unmute = false) {
99 if (unmute)
102 }
103
104 static int volMusic() {
106 }
107
108 void saveState();
109
110 void freeMusic();
111 void freeChunk();
112
113 void quit() {
115
116 freeMusic();
117 freeChunk();
118 }
119};
120
121} // End of namespace music
122} // End of namespace pyrodactyl
123
124} // End of namespace Crab
125
126#endif // CRAB_MUSICMANAGER_H
virtual int getVolumeForSoundType(SoundType type) const =0
virtual void muteSoundType(SoundType type, bool mute)=0
virtual void stopAll()=0
virtual void pauseAll(bool paused)=0
@ kMusicSoundType
Definition: mixer.h:76
@ kSFXSoundType
Definition: mixer.h:77
virtual void setVolumeForSoundType(SoundType type, int volume)=0
Definition: audiostream.h:212
Definition: mixer.h:49
Definition: file.h:47
Definition: MusicManager.h:42
virtual Audio::Mixer * getMixer()=0
OSystem * g_system
Definition: musicparam.h:51