ScummVM API documentation
queue.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 LASTEXPRESS_SOUND_QUEUE_H
23 #define LASTEXPRESS_SOUND_QUEUE_H
24 
25 #include "lastexpress/shared.h"
26 
27 #include "common/array.h"
28 #include "common/mutex.h"
29 #include "common/serializer.h"
30 
31 namespace LastExpress {
32 
33 class LastExpressEngine;
34 class SoundEntry;
35 class SubtitleEntry;
36 
38 public:
40  ~SoundQueue() override;
41 
42  // Queue
43  void addToQueue(SoundEntry *entry);
44  void stop(Common::String filename);
45  void stop(EntityIndex entity);
46  void updateQueue();
47  void stopAmbient();
48  void stopAllExcept(SoundTag tag1, SoundTag tag2 = kSoundTagNone);
49  void destroyAllSound();
50 
51  // State
52  void stopAll();
53  int getAmbientState() { return _ambientState; }
54  void startAmbient() { _ambientState |= kAmbientSoundEnabled; }
55  void setAmbientToSteam() { _ambientState |= kAmbientSoundSteam; }
56 
57  // Entries
58  void assignNISLink(EntityIndex index);
59  void fade(EntityIndex entity);
60  void fade(SoundTag tag);
61  void fade(Common::String filename);
62  void endAmbient();
63  SoundEntry *getEntry(SoundTag tag);
64  SoundEntry *getEntry(EntityIndex index);
65  SoundEntry *getEntry(Common::String name);
66  uint32 getEntryTime(EntityIndex index);
67  bool isBuffered(Common::String filename, bool testForEntity = false);
68  bool isBuffered(EntityIndex entity);
69 
70  // Subtitles
71  void updateSubtitles();
72  void addSubtitle(SubtitleEntry *entry) { _subtitles.push_back(entry); }
73  void removeSubtitle(SubtitleEntry *entry) { _subtitles.remove(entry); }
74  void setCurrentSubtitle(SubtitleEntry *entry) { _currentSubtitle = entry; }
75  SubtitleEntry *getCurrentSubtitle() { return _currentSubtitle; }
76 
77  // Serializable
78  void saveLoadWithSerializer(Common::Serializer &ser) override;
79  uint32 count();
80 
81  // Accessors
82  uint32 getFlag() { return _flag; }
83  int getSubtitleFlag() { return _subtitlesFlag; }
84  void setSubtitleFlag(int flag) { _subtitlesFlag = flag; }
85 
86  int32 generateNextTag() { return _currentTag++; }
87 
88 protected:
89  // Debug
90  void stopAllSound();
91 
92 private:
93  LastExpressEngine *_engine;
94 
95  // State & shared data
96  int _ambientState;
97  int32 _currentTag;
98  uint32 _flag;
99 
100  // Entries
101  Common::List<SoundEntry *> _soundList;
102  //void *_soundCacheData;
103 
104  // Subtitles
105  int _subtitlesFlag;
107  SubtitleEntry *_currentSubtitle;
108 
109  friend class Debugger;
110 };
111 
112 } // End of namespace LastExpress
113 
114 #endif // LASTEXPRESS_SOUND_QUEUE_H
Definition: str.h:59
Definition: lastexpress.h:69
Definition: list.h:44
Definition: queue.h:37
Definition: animation.h:45
Definition: serializer.h:79
Definition: entry.h:181
Definition: serializer.h:308
Definition: entry.h:91
Definition: debug.h:47