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

track.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 COPYRIGHT
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 GRIM_SOUNDTRACK_H
00024 #define GRIM_SOUNDTRACK_H
00025 
00026 #include "audio/mixer.h"
00027 #include "audio/timestamp.h"
00028 #include "math/vector3d.h"
00029 
00030 namespace Common {
00031     class String;
00032 }
00033 
00034 namespace Audio {
00035     class AudioStream;
00036     class SoundHandle;
00037 }
00038 
00039 namespace Grim {
00040 
00041 class SaveGame;
00042 
00046 class SoundTrack {
00047 public:
00048     enum FadeMode {
00049         FadeNone,
00050         FadeIn,
00051         FadeOut
00052     };
00053 protected:
00054     Common::String _soundName;
00055     Audio::AudioStream *_stream;
00056     Audio::SoundHandle *_handle;
00057     Audio::Mixer::SoundType _soundType;
00058     DisposeAfterUse::Flag _disposeAfterPlaying;
00059     bool _paused;
00060     bool _positioned;
00061     Math::Vector3d _pos;
00062     FadeMode _fadeMode;
00063     float _fade;
00064     float _attenuation;
00065     int _balance;
00066     int _volume;
00067     int _sync;
00068 public:
00069     SoundTrack();
00070     virtual ~SoundTrack();
00071     virtual bool openSound(const Common::String &filename, const Common::String &voiceName, const Audio::Timestamp *start = nullptr) = 0;
00072     virtual bool isPlaying() = 0;
00073     virtual bool play();
00074     virtual void pause();
00075     virtual void stop();
00076 
00077     void fadeIn() { _fadeMode = FadeIn; }
00078     void fadeOut() { _fadeMode = FadeOut; }
00079     void setFadeMode(FadeMode fadeMode) { _fadeMode = fadeMode; }
00080     void setFade(float fade);
00081     float getFade() const { return _fade; }
00082     FadeMode getFadeMode() const { return _fadeMode; }
00083     void setBalance(int balance);
00084     void setVolume(int volume);
00085     void setPosition(bool positioned, const Math::Vector3d &pos = Math::Vector3d());
00086     void updatePosition();
00087     void setSync(int sync) { _sync = sync; }
00088     int getEffectiveVolume();
00089     int getVolume() const { return _volume; }
00090     int getBalance() const { return _balance; }
00091     int getSync() const { return _sync; }
00092     virtual Audio::Timestamp getPos() = 0;
00093     Common::String getSoundName();
00094     void setSoundName(const Common::String &name);
00095     virtual bool hasLooped() { return false; }
00096     virtual void setLooping(bool looping) { }
00097     virtual bool isLooping() const { return false; }
00098     bool isPaused() const { return _paused; }
00099     bool isPositioned() const { return _positioned; }
00100     Math::Vector3d getWorldPos() const { return _pos; }
00101     Audio::Mixer::SoundType getSoundType() const { return _soundType; }
00102 };
00103 
00104 }
00105 
00106 #endif


Generated on Sat Feb 16 2019 05:01:09 for ResidualVM by doxygen 1.7.1
curved edge   curved edge