ResidualVM logo ResidualVM website - Forums - Contact us BuildBot - Doxygen - Wiki curved edge

stark/resources/sound.h

Go to the documentation of this file.
00001 /* ResidualVM - A 3D game interpreter
00002  *
00003  * ResidualVM is the legal property of its developers, whose names
00004  * are too numerous to list here. Please refer to the AUTHORS
00005  * file distributed with this source distribution.
00006  *
00007  * This program is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU General Public License
00009  * as published by the Free Software Foundation; either version 2
00010  * of the License, or (at your option) any later version.
00011  *
00012  * This program is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00020  *
00021  */
00022 
00023 #ifndef STARK_RESOURCES_SOUND_H
00024 #define STARK_RESOURCES_SOUND_H
00025 
00026 #include "audio/mixer.h"
00027 
00028 #include "common/str.h"
00029 
00030 #include "engines/stark/resources/object.h"
00031 
00032 namespace Audio {
00033     class RewindableAudioStream;
00034 }
00035 
00036 namespace Stark {
00037 
00038 namespace Formats {
00039 class XRCReadStream;
00040 }
00041 
00042 namespace Resources {
00043 
00047 class Sound : public Object {
00048 public:
00049     static const Type::ResourceType TYPE = Type::kSoundItem;
00050 
00051     enum SubType {
00052         kSoundSub3  = 3,
00053         kSoundStock = 5
00054     };
00055 
00056     enum SoundType {
00057         kSoundTypeVoice  = 0,
00058         kSoundTypeEffect = 1,
00059         kSoundTypeMusic  = 2
00060     };
00061 
00062     Sound(Object *parent, byte subType, uint16 index, const Common::String &name);
00063     virtual ~Sound();
00064 
00065     // Resource API
00066     void readData(Formats::XRCReadStream *stream) override;
00067     void onPreDestroy() override;
00068     void onGameLoop() override;
00069     void saveLoadCurrent(ResourceSerializer *serializer) override;
00070     void onEnginePause(bool pause) override;
00071 
00073     void play();
00074 
00076     bool isPlaying();
00077 
00079     void stop();
00080 
00082     uint32 getStockSoundType() const;
00083 
00085     void changeVolumePan(int32 volume, int32 pan, int32 duration);
00086 
00088     void setLooping(bool looping) { _looping = looping; }
00089 
00094     void setStopOnDestroy(bool stopOnDestroy);
00095 
00096 protected:
00097     void printData() override;
00098 
00099     Audio::RewindableAudioStream *makeAudioStream();
00100     Audio::Mixer::SoundType getMixerSoundType();
00101 
00102     Common::String _filename;
00103     Common::String _archiveName;
00104     uint32 _enabled;
00105     bool _looping;
00106     uint32 _field_64;
00107     bool _loopIndefinitely;
00108     uint32 _maxDuration;
00109     bool _loadFromFile;
00110     uint32 _stockSoundType;
00111     Common::String _soundName;
00112     uint32 _field_6C;
00113     uint32 _soundType;
00114     float _pan;
00115     float _volume;
00116     bool _shouldStopOnDestroy;
00117 
00118     int32 _fadeDurationRemaining;
00119     float _fadeTargetVolume;
00120     float _fadeTargetPan;
00121 
00122     Audio::SoundHandle _handle;
00123 };
00124 
00125 } // End of namespace Resources
00126 } // End of namespace Stark
00127 
00128 #endif // STARK_RESOURCES_SOUND_H


Generated on Sat May 18 2019 05:01:20 for ResidualVM by doxygen 1.7.1
curved edge   curved edge