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 8 * modify it under the terms of the GNU General Public License 9 * as published by the Free Software Foundation; either version 2 10 * of the License, or (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, write to the Free Software 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 * 21 */ 22 23 #ifndef LASTEXPRESS_SOUND_QUEUE_H 24 #define LASTEXPRESS_SOUND_QUEUE_H 25 26 #include "lastexpress/shared.h" 27 28 #include "common/array.h" 29 #include "common/mutex.h" 30 #include "common/serializer.h" 31 32 namespace LastExpress { 33 34 class LastExpressEngine; 35 class SoundEntry; 36 class SubtitleEntry; 37 38 class SoundQueue : Common::Serializable { 39 public: 40 SoundQueue(LastExpressEngine *engine); 41 ~SoundQueue() override; 42 43 // Queue 44 void addToQueue(SoundEntry *entry); 45 void stop(Common::String filename); 46 void stop(EntityIndex entity); 47 void updateQueue(); 48 void stopAmbient(); 49 void stopAllExcept(SoundTag tag1, SoundTag tag2 = kSoundTagNone); 50 void destroyAllSound(); 51 52 // State 53 void stopAll(); getAmbientState()54 int getAmbientState() { return _ambientState; } startAmbient()55 void startAmbient() { _ambientState |= kAmbientSoundEnabled; } setAmbientToSteam()56 void setAmbientToSteam() { _ambientState |= kAmbientSoundSteam; } 57 58 // Entries 59 void assignNISLink(EntityIndex index); 60 void fade(EntityIndex entity); 61 void fade(SoundTag tag); 62 void fade(Common::String filename); 63 void endAmbient(); 64 SoundEntry *getEntry(SoundTag tag); 65 SoundEntry *getEntry(EntityIndex index); 66 SoundEntry *getEntry(Common::String name); 67 uint32 getEntryTime(EntityIndex index); 68 bool isBuffered(Common::String filename, bool testForEntity = false); 69 bool isBuffered(EntityIndex entity); 70 71 // Subtitles 72 void updateSubtitles(); addSubtitle(SubtitleEntry * entry)73 void addSubtitle(SubtitleEntry *entry) { _subtitles.push_back(entry); } removeSubtitle(SubtitleEntry * entry)74 void removeSubtitle(SubtitleEntry *entry) { _subtitles.remove(entry); } setCurrentSubtitle(SubtitleEntry * entry)75 void setCurrentSubtitle(SubtitleEntry *entry) { _currentSubtitle = entry; } getCurrentSubtitle()76 SubtitleEntry *getCurrentSubtitle() { return _currentSubtitle; } 77 78 // Serializable 79 void saveLoadWithSerializer(Common::Serializer &ser) override; 80 uint32 count(); 81 82 // Accessors getFlag()83 uint32 getFlag() { return _flag; } getSubtitleFlag()84 int getSubtitleFlag() { return _subtitlesFlag; } setSubtitleFlag(int flag)85 void setSubtitleFlag(int flag) { _subtitlesFlag = flag; } 86 generateNextTag()87 int32 generateNextTag() { return _currentTag++; } 88 89 protected: 90 // Debug 91 void stopAllSound(); 92 93 private: 94 LastExpressEngine *_engine; 95 96 // State & shared data 97 int _ambientState; 98 int32 _currentTag; 99 uint32 _flag; 100 101 // Entries 102 Common::List<SoundEntry *> _soundList; ///< List of all sound entries 103 //void *_soundCacheData; 104 105 // Subtitles 106 int _subtitlesFlag; 107 Common::List<SubtitleEntry *> _subtitles; 108 SubtitleEntry *_currentSubtitle; 109 110 friend class Debugger; 111 }; 112 113 } // End of namespace LastExpress 114 115 #endif // LASTEXPRESS_SOUND_QUEUE_H 116