Skyscraper
2.0
src
sbs
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
27
namespace
SBS
{
28
29
class
SBSIMPEXP
Sound
:
public
Object
30
{
31
public
:
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
74
private
:
75
76
bool
IsValid();
77
78
#ifndef DISABLE_SOUND
79
//sound channel
80
FMOD::Channel *
channel
;
81
#endif
82
83
//associated sound data
84
SoundData
*
sound
;
85
86
SoundSystem
*
system
;
87
88
// sound parameters
89
Vector3
Position
;
90
Vector3
Velocity
;
91
float
Volume
;
92
float
MaxDistance
;
93
float
MinDistance
;
94
Vector3
Direction
;
95
bool
SoundLoop
;
96
int
Speed
;
97
float
Percent
;
98
std::string
Filename
;
99
float
default_speed
;
100
float
doppler_level
;
101
bool
position_queued
;
102
bool
enabled
;
103
104
struct
SBSIMPEXP
SoundEntry
105
{
106
std::string
filename
;
107
bool
loop
;
108
bool
played
;
109
};
110
111
std::vector<SoundEntry>
queue
;
112
};
113
114
}
115
116
#endif
SBS::Object
Definition
object.h:56
SBS::SoundSystem
Definition
soundsystem.h:37
SBS::Sound
Definition
sound.h:30
SBS::Sound::Direction
Vector3 Direction
Definition
sound.h:94
SBS::Sound::Speed
int Speed
Definition
sound.h:96
SBS::Sound::sound
SoundData * sound
Definition
sound.h:84
SBS::Sound::queue
std::vector< SoundEntry > queue
Definition
sound.h:111
SBS::Sound::SetVelocity
bool SetVelocity
Definition
sound.h:33
SBS::Sound::Velocity
Vector3 Velocity
Definition
sound.h:90
SBS::Sound::position_queued
bool position_queued
Definition
sound.h:101
SBS::Sound::MinDistance
float MinDistance
Definition
sound.h:93
SBS::Sound::Volume
float Volume
Definition
sound.h:91
SBS::Sound::channel
FMOD::Channel * channel
Definition
sound.h:80
SBS::Sound::doppler_level
float doppler_level
Definition
sound.h:100
SBS::Sound::Percent
float Percent
Definition
sound.h:97
SBS::Sound::Position
Vector3 Position
Definition
sound.h:89
SBS::Sound::default_speed
float default_speed
Definition
sound.h:99
SBS::Sound::enabled
bool enabled
Definition
sound.h:102
SBS::Sound::system
SoundSystem * system
Definition
sound.h:86
SBS::Sound::Filename
std::string Filename
Definition
sound.h:98
SBS::Sound::MaxDistance
float MaxDistance
Definition
sound.h:92
SBS::Sound::SoundLoop
bool SoundLoop
Definition
sound.h:95
Vector3
Ogre::Vector3 Vector3
Definition
globals.h:58
Real
Ogre::Real Real
Definition
globals.h:57
SBSIMPEXP
#define SBSIMPEXP
Definition
globals.h:53
SBS
Definition
skyscraper.h:45
SBS::SoundData
Definition
soundsystem.h:95
SBS::Sound::SoundEntry
Definition
sound.h:105
SBS::Sound::SoundEntry::loop
bool loop
Definition
sound.h:107
SBS::Sound::SoundEntry::filename
std::string filename
Definition
sound.h:106
SBS::Sound::SoundEntry::played
bool played
Definition
sound.h:108
Generated by
1.11.0