ScummVM API documentation
media_manager.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 HARVESTER_MEDIA_MANAGER_H
23#define HARVESTER_MEDIA_MANAGER_H
24
25#include "audio/mixer.h"
26#include "common/array.h"
27#include "common/str.h"
28
29namespace Graphics {
30class Screen;
31}
32
33namespace Harvester {
34
35class Art;
36class ResourceManager;
37class EntityManager;
38struct AudioCommand;
39class Text;
40
42public:
43 explicit MediaManager(ResourceManager &resources);
45
46 EntityManager *getRuntimeEntities() const { return _entityManager; }
47 Graphics::Screen *getScreen() const { return _screen; }
48 int getDisplayWidth() const { return _displayWidth; }
49 int getDisplayHeight() const { return _displayHeight; }
50 Art *getArt() const { return _art; }
51 Text *getText() const { return _text; }
52 const Common::String &getMusicPath() const { return _musicPath; }
53
54 static float mapGammaLevelToBrightnessScale(int level);
55
56 void resetScreen(int width, int height);
57 void requestRoomFadeAfterMovie() { _fadeRoomAfterNextMovie = true; }
58 void finishMoviePlayback();
59 bool isRoomPaletteFadePending() const { return _roomPaletteFadePending; }
60 void clearRoomPaletteFade() { _roomPaletteFadePending = false; }
61 void resetMoviePaletteState();
62 bool loadArt();
63 bool loadText();
64 bool loadQuickTipsResources(bool useTextboxPanel);
65 void drawWaitFrame() const;
66 void applyMixerLevels(int fxLevel, int musicLevel);
67 bool isMusicPlaying() const;
68 bool playMusic(const Common::String &path);
69 void pauseMusic(bool paused);
70 void stopMusic();
71 bool executeAudioCommand(const AudioCommand &command);
72 bool playSound(const Common::String &path);
73 bool playSingleSound(const Common::String &path);
74 void stopSingleSound();
75 bool isSingleSoundPlaying() const;
76 bool playSpeech(const Common::String &path);
77 void stopSpeech();
78 bool isSpeechPlaying() const;
79 bool loadSound(int slot, const Common::String &path);
80 bool playLoadedSound(int slot);
81 bool deleteLoadedSound(int slot);
82 void stopSound();
83
84private:
85 void stopSoundHandle(Audio::SoundHandle &handle);
86 bool validateLoadedSoundSlot(int slot) const;
87
88 ResourceManager &_resources;
89 EntityManager *_entityManager = nullptr;
90 Graphics::Screen *_screen = nullptr;
91 int _displayWidth = 0;
92 int _displayHeight = 0;
93 bool _fadeRoomAfterNextMovie = false;
94 bool _roomPaletteFadePending = false;
95 Art *_art = nullptr;
96 Text *_text = nullptr;
97 Audio::SoundHandle _musicHandle;
98 Audio::SoundHandle _singleSoundHandle;
99 Audio::SoundHandle _speechHandle;
100 Common::String _musicPath;
101 int _soundSlotIndex = -1;
102 Common::String _soundPaths[8];
103 Audio::SoundHandle _soundHandles[8];
104 Common::String _loadedSoundPaths[4];
105 Common::Array<byte> _loadedSoundData[4];
106 Audio::SoundHandle _loadedSoundHandles[4];
107};
108
109} // End of namespace Harvester
110
111#endif // HARVESTER_MEDIA_MANAGER_H
Definition: mixer.h:49
Definition: str.h:59
Definition: screen.h:47
Definition: art.h:35
Definition: entity.h:184
Definition: media_manager.h:41
Definition: resources.h:32
Definition: text.h:55
Definition: formatinfo.h:28
Definition: script.h:231
Definition: atari-screen.h:58