Skyscraper 2.0
sound.h
Go to the documentation of this file.
1/*
2 Scalable Building Simulator - Sound Object
3 The Skyscraper Project - Version 2.0
4 Copyright (C)2004-2024 Ryan Thoryk
5 https://www.skyscrapersim.net
6 https://sourceforge.net/projects/skyscraper/
7 Contact - ryan@skyscrapersim.net
8
9 This program is free software; you can redistribute it and/or
10 modify it under the terms of the GNU General Public License
11 as published by the Free Software Foundation; either version 2
12 of the License, or (at your option) any later version.
13
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22*/
23
24#ifndef _SBS_SOUND_H
25#define _SBS_SOUND_H
26
27namespace SBS {
28
29class SBSIMPEXP Sound : public Object
30{
31public:
32
33 bool SetVelocity; //set sound velocity on move
34
35 Sound(Object *parent, const std::string &name, bool permanent);
36 ~Sound();
37 void SetVolume(Real value);
38 Real GetVolume();
39 void SetDistances(Real min, Real max);
40 Real GetMinimumDistance();
41 Real GetMaximumDistance();
42 void SetDirection(const Vector3 &direction);
43 Vector3 GetDirection();
44 void SetLoopState(bool value);
45 bool GetLoopState();
46 void Pause(bool value = true);
47 bool IsPaused();
48 void Stop();
49 bool Play(bool reset = true);
50 void Reset();
51 void SetSpeed(int percent);
52 int GetSpeed();
53 bool Load(const std::string &filename, bool force = false);
54 bool IsPlaying();
55 Real GetPlayPosition();
56 void SetPlayPosition(Real percent);
57 void SetConeSettings(Real inside_angle = 360.0, Real outside_angle = 360.0, Real outside_volume = 1.0);
58 void SetDopplerLevel(Real level);
59 bool IsLoaded();
60 void PlayQueued(const std::string &filename, bool stop = true, bool loop = false);
61 void ProcessQueue();
62 void Report(const std::string &message);
63 bool ReportError(const std::string &message);
64 void OnMove(bool parent);
65 void OnRotate(bool parent);
66 void Unload();
67 void Enabled(bool value);
68 bool IsEnabled();
69#ifndef DISABLE_SOUND
70 FMOD::Channel* GetChannel();
71#endif
72 bool GetNearestReverbPosition(Vector3 &position);
73
74private:
75
76 bool IsValid();
77
78#ifndef DISABLE_SOUND
79 //sound channel
80 FMOD::Channel *channel;
81#endif
82
83 //associated sound data
85
87
88 // sound parameters
91 float Volume;
96 int Speed;
97 float Percent;
98 std::string Filename;
103
105 {
106 std::string filename;
107 bool loop;
108 bool played;
109 };
110
111 std::vector<SoundEntry> queue;
112};
113
114}
115
116#endif
Vector3 Direction
Definition sound.h:94
int Speed
Definition sound.h:96
SoundData * sound
Definition sound.h:84
std::vector< SoundEntry > queue
Definition sound.h:111
bool SetVelocity
Definition sound.h:33
Vector3 Velocity
Definition sound.h:90
bool position_queued
Definition sound.h:101
float MinDistance
Definition sound.h:93
float Volume
Definition sound.h:91
FMOD::Channel * channel
Definition sound.h:80
float doppler_level
Definition sound.h:100
float Percent
Definition sound.h:97
Vector3 Position
Definition sound.h:89
float default_speed
Definition sound.h:99
bool enabled
Definition sound.h:102
SoundSystem * system
Definition sound.h:86
std::string Filename
Definition sound.h:98
float MaxDistance
Definition sound.h:92
bool SoundLoop
Definition sound.h:95
Ogre::Vector3 Vector3
Definition globals.h:58
Ogre::Real Real
Definition globals.h:57
#define SBSIMPEXP
Definition globals.h:53
std::string filename
Definition sound.h:106