Skyscraper 2.0
SBS::Sound Class Reference

#include <sound.h>

Inheritance diagram for SBS::Sound:
Collaboration diagram for SBS::Sound:

Classes

struct  SoundEntry
 

Public Member Functions

 Sound (Object *parent, const std::string &name, bool permanent)
 
 ~Sound ()
 
void SetVolume (Real value)
 
Real GetVolume ()
 
void SetDistances (Real min, Real max)
 
Real GetMinimumDistance ()
 
Real GetMaximumDistance ()
 
void SetDirection (const Vector3 &direction)
 
Vector3 GetDirection ()
 
void SetLoopState (bool value)
 
bool GetLoopState ()
 
void Pause (bool value=true)
 
bool IsPaused ()
 
void Stop ()
 
bool Play (bool reset=true)
 
void Reset ()
 
void SetSpeed (int percent)
 
int GetSpeed ()
 
bool Load (const std::string &filename, bool force=false)
 
bool IsPlaying ()
 
Real GetPlayPosition ()
 
void SetPlayPosition (Real percent)
 
void SetConeSettings (Real inside_angle=360.0, Real outside_angle=360.0, Real outside_volume=1.0)
 
void SetDopplerLevel (Real level)
 
bool IsLoaded ()
 
void PlayQueued (const std::string &filename, bool stop=true, bool loop=false)
 
void ProcessQueue ()
 
void Report (const std::string &message)
 
bool ReportError (const std::string &message)
 
void OnMove (bool parent)
 
void OnRotate (bool parent)
 
void Unload ()
 
void Enabled (bool value)
 
bool IsEnabled ()
 
FMOD::Channel * GetChannel ()
 
bool GetNearestReverbPosition (Vector3 &position)
 
- Public Member Functions inherited from SBS::Object
 Object (Object *parent)
 
virtual ~Object ()
 
void SetValues (const std::string &type, const std::string &name, bool is_permanent, bool is_movable=true)
 
bool IsPermanent ()
 
bool IsMovable ()
 
const std::string & GetType ()
 
int GetNumber ()
 
void AddChild (Object *object)
 
ObjectGetChild (int index)
 
int GetChildrenCount ()
 
void RemoveChild (Object *object)
 
SceneNodeGetSceneNode ()
 
void ShowBoundingBox (bool value)
 
virtual void Move (const Vector3 &vector, Real speed=1.0)
 
virtual void Move (Real X, Real Y, Real Z, Real speed=1.0)
 
virtual void SetPosition (const Vector3 &position)
 
void SetPositionRelative (const Vector3 &position)
 
virtual void SetPosition (Real X, Real Y, Real Z)
 
void SetPositionRelative (Real X, Real Y, Real Z)
 
virtual void SetPositionY (Real value)
 
virtual Vector3 GetPosition (bool relative=false)
 
virtual void Rotate (const Vector3 &vector, Real speed=1.0)
 
virtual void Rotate (Real X, Real Y, Real Z, Real speed=1.0)
 
virtual void SetRotation (const Vector3 &rotation)
 
virtual void SetRotation (Real X, Real Y, Real Z)
 
virtual Vector3 GetRotation ()
 
Quaternion GetOrientation (bool relative=false)
 
void SetOrientation (const Quaternion &q, bool relative=false)
 
virtual void OnClick (Vector3 &position, bool shift, bool ctrl, bool alt, bool right)
 
virtual void OnUnclick (bool right)
 
virtual void OnHit ()
 
void NotifyMove (bool parent=false)
 
void NotifyRotate (bool parent=false)
 
virtual void ResetState ()
 
void ChangeParent (Object *new_parent)
 
bool IsGlobal ()
 
void Init (bool children=true)
 
virtual void OnInit ()
 
virtual void Loop ()
 
void RegisterLoop (Object *object)
 
void UnregisterLoop (Object *object)
 
std::string GetNameBase ()
 
template<typename T >
bool IsType ()
 
template<typename T >
T * ConvertTo ()
 
- Public Member Functions inherited from SBS::ObjectBase
 ObjectBase (Object *parent)
 
virtual ~ObjectBase ()
 
ObjectGetParent ()
 
SBSGetRoot ()
 
void SetName (const std::string &name)
 
const std::string & GetName ()
 
std::string GetNameBase ()
 

Public Attributes

bool SetVelocity
 
- Public Attributes inherited from SBS::Object
std::string command
 
std::string command_processed
 
std::string context
 
int linenum
 
std::string includefile
 
bool parent_deleting
 

Private Member Functions

bool IsValid ()
 

Private Attributes

FMOD::Channel * channel
 
SoundDatasound
 
SoundSystemsystem
 
Vector3 Position
 
Vector3 Velocity
 
float Volume
 
float MaxDistance
 
float MinDistance
 
Vector3 Direction
 
bool SoundLoop
 
int Speed
 
float Percent
 
std::string Filename
 
float default_speed
 
float doppler_level
 
bool position_queued
 
bool enabled
 
std::vector< SoundEntryqueue
 

Additional Inherited Members

- Protected Member Functions inherited from SBS::Object
void EnableLoop (bool value)
 
void LoopChildren ()
 
bool SelfDestruct ()
 
- Protected Attributes inherited from SBS::ObjectBase
SBSsbs
 

Detailed Description

Definition at line 29 of file sound.h.

Constructor & Destructor Documentation

◆ Sound()

◆ ~Sound()

Member Function Documentation

◆ Enabled()

void SBS::Sound::Enabled ( bool value)
virtual

Reimplemented from SBS::Object.

Definition at line 620 of file sound.cpp.

References enabled, and Stop().

Referenced by Skyscraper::SoundManager::On_bEnabled_Click().

Here is the call graph for this function:

◆ GetChannel()

FMOD::Channel * SBS::Sound::GetChannel ( )

Definition at line 558 of file sound.cpp.

References channel.

Referenced by SBS::SoundData::RemoveHandle().

◆ GetDirection()

Vector3 SBS::Sound::GetDirection ( )

Definition at line 191 of file sound.cpp.

References Direction.

◆ GetLoopState()

bool SBS::Sound::GetLoopState ( )

Definition at line 218 of file sound.cpp.

References SoundLoop.

Referenced by Skyscraper::SoundManager::Loop(), and Skyscraper::SoundManager::On_bSetLoop_Click().

◆ GetMaximumDistance()

Real SBS::Sound::GetMaximumDistance ( )

Definition at line 174 of file sound.cpp.

References MaxDistance.

◆ GetMinimumDistance()

Real SBS::Sound::GetMinimumDistance ( )

Definition at line 169 of file sound.cpp.

References MinDistance.

◆ GetNearestReverbPosition()

bool SBS::Sound::GetNearestReverbPosition ( Vector3 & position)

◆ GetPlayPosition()

Real SBS::Sound::GetPlayPosition ( )

Definition at line 414 of file sound.cpp.

References channel, SBS::SoundSystem::GetLength(), IsValid(), Percent, sound, and system.

Referenced by Skyscraper::SoundManager::Loop().

Here is the call graph for this function:

◆ GetSpeed()

int SBS::Sound::GetSpeed ( )

Definition at line 287 of file sound.cpp.

References Speed.

Referenced by Skyscraper::SoundManager::Loop().

◆ GetVolume()

Real SBS::Sound::GetVolume ( )

Definition at line 152 of file sound.cpp.

References Volume.

Referenced by Skyscraper::SoundManager::Loop().

◆ IsEnabled()

bool SBS::Sound::IsEnabled ( )

Definition at line 630 of file sound.cpp.

References enabled.

Referenced by Skyscraper::SoundManager::Loop(), and Skyscraper::SoundManager::On_bEnabled_Click().

◆ IsLoaded()

bool SBS::Sound::IsLoaded ( )

Definition at line 475 of file sound.cpp.

References sound.

Referenced by SBS::Elevator::Loop(), and SBS::ElevatorCar::Loop().

◆ IsPaused()

bool SBS::Sound::IsPaused ( )

Definition at line 242 of file sound.cpp.

References channel, and IsValid().

Referenced by IsPlaying(), Skyscraper::SoundManager::Loop(), and Skyscraper::SoundManager::On_bSetPause_Click().

Here is the call graph for this function:

◆ IsPlaying()

◆ IsValid()

bool SBS::Sound::IsValid ( )
private

Definition at line 303 of file sound.cpp.

References channel, SBS::SoundData::RemoveChannel(), and sound.

Referenced by GetPlayPosition(), IsPaused(), IsPlaying(), Pause(), and Play().

Here is the call graph for this function:

◆ Load()

◆ OnMove()

void SBS::Sound::OnMove ( bool parent)
virtual

Reimplemented from SBS::Object.

Definition at line 97 of file sound.cpp.

References channel, SBS::SBS::GetElapsedTime(), SBS::Object::GetPosition(), Position, SBS::ObjectBase::sbs, SetVelocity, SBS::SBS::ToGlobal(), and Velocity.

Referenced by OnRotate().

Here is the call graph for this function:

◆ OnRotate()

void SBS::Sound::OnRotate ( bool parent)
virtual

Reimplemented from SBS::Object.

Definition at line 132 of file sound.cpp.

References OnMove().

Here is the call graph for this function:

◆ Pause()

void SBS::Sound::Pause ( bool value = true)

Definition at line 223 of file sound.cpp.

References channel, IsValid(), Report(), SBS::ObjectBase::sbs, and SBS::SBS::Verbose.

Referenced by SBS::ElevatorCar::Loop(), and Skyscraper::SoundManager::On_bSetPause_Click().

Here is the call graph for this function:

◆ Play()

◆ PlayQueued()

void SBS::Sound::PlayQueued ( const std::string & filename,
bool stop = true,
bool loop = false )

◆ ProcessQueue()

void SBS::Sound::ProcessQueue ( )

◆ Report()

void SBS::Sound::Report ( const std::string & message)
virtual

Reimplemented from SBS::ObjectBase.

Definition at line 480 of file sound.cpp.

References SBS::ObjectBase::GetName(), SBS::ObjectBase::GetParent(), and SBS::ObjectBase::Report().

Referenced by Load(), Pause(), Play(), PlayQueued(), ProcessQueue(), Reset(), SetPlayPosition(), SetSpeed(), SetVolume(), Sound(), Stop(), and Unload().

Here is the call graph for this function:

◆ ReportError()

bool SBS::Sound::ReportError ( const std::string & message)
virtual

Reimplemented from SBS::ObjectBase.

Definition at line 485 of file sound.cpp.

References SBS::ObjectBase::GetName(), SBS::ObjectBase::GetParent(), and SBS::ObjectBase::ReportError().

Referenced by Play().

Here is the call graph for this function:

◆ Reset()

void SBS::Sound::Reset ( )

◆ SetConeSettings()

void SBS::Sound::SetConeSettings ( Real inside_angle = 360.0,
Real outside_angle = 360.0,
Real outside_volume = 1.0 )

Definition at line 196 of file sound.cpp.

References channel.

Referenced by SBS::ElevatorCar::AddSound(), SBS::Floor::AddSound(), and SBS::SBS::AddSound().

◆ SetDirection()

void SBS::Sound::SetDirection ( const Vector3 & direction)

Definition at line 179 of file sound.cpp.

References channel, Direction, SBS::Object::GetOrientation(), and SBS::ObjectBase::sbs.

Referenced by SBS::ElevatorCar::AddSound(), SBS::Floor::AddSound(), SBS::SBS::AddSound(), and Play().

Here is the call graph for this function:

◆ SetDistances()

void SBS::Sound::SetDistances ( Real min,
Real max )

Definition at line 158 of file sound.cpp.

References channel, MaxDistance, and MinDistance.

Referenced by SBS::ElevatorCar::AddSound(), SBS::Floor::AddSound(), SBS::SBS::AddSound(), and Play().

◆ SetDopplerLevel()

void SBS::Sound::SetDopplerLevel ( Real level)

Definition at line 462 of file sound.cpp.

References channel, and doppler_level.

Referenced by SBS::ElevatorCar::AddSound(), SBS::Floor::AddSound(), SBS::SBS::AddSound(), and Play().

◆ SetLoopState()

◆ SetPlayPosition()

void SBS::Sound::SetPlayPosition ( Real percent)

◆ SetSpeed()

void SBS::Sound::SetSpeed ( int percent)

◆ SetVolume()

void SBS::Sound::SetVolume ( Real value)

◆ Stop()

◆ Unload()

void SBS::Sound::Unload ( )

Definition at line 540 of file sound.cpp.

References channel, SBS::SoundData::RemoveHandle(), Report(), SBS::ObjectBase::sbs, sound, Stop(), and SBS::SBS::Verbose.

Referenced by Load(), Skyscraper::SoundManager::On_bUnload_Click(), and ~Sound().

Here is the call graph for this function:

Member Data Documentation

◆ channel

◆ default_speed

float SBS::Sound::default_speed
private

Definition at line 99 of file sound.h.

Referenced by Play(), SetSpeed(), and Sound().

◆ Direction

Vector3 SBS::Sound::Direction
private

Definition at line 94 of file sound.h.

Referenced by GetDirection(), Play(), SetDirection(), and Sound().

◆ doppler_level

float SBS::Sound::doppler_level
private

Definition at line 100 of file sound.h.

Referenced by Play(), SetDopplerLevel(), and Sound().

◆ enabled

bool SBS::Sound::enabled
private

Definition at line 102 of file sound.h.

Referenced by Enabled(), IsEnabled(), Load(), Play(), and Sound().

◆ Filename

std::string SBS::Sound::Filename
private

Definition at line 98 of file sound.h.

Referenced by Load(), and Play().

◆ MaxDistance

float SBS::Sound::MaxDistance
private

Definition at line 92 of file sound.h.

Referenced by GetMaximumDistance(), Play(), SetDistances(), and Sound().

◆ MinDistance

float SBS::Sound::MinDistance
private

Definition at line 93 of file sound.h.

Referenced by GetMinimumDistance(), Play(), SetDistances(), and Sound().

◆ Percent

float SBS::Sound::Percent
private

Definition at line 97 of file sound.h.

Referenced by GetPlayPosition(), Play(), SetPlayPosition(), and Sound().

◆ Position

Vector3 SBS::Sound::Position
private

Definition at line 89 of file sound.h.

Referenced by OnMove(), Play(), and Sound().

◆ position_queued

bool SBS::Sound::position_queued
private

Definition at line 101 of file sound.h.

Referenced by Play(), SetPlayPosition(), and Sound().

◆ queue

std::vector<SoundEntry> SBS::Sound::queue
private

Definition at line 111 of file sound.h.

Referenced by PlayQueued(), and ProcessQueue().

◆ SetVelocity

bool SBS::Sound::SetVelocity

Definition at line 33 of file sound.h.

Referenced by OnMove(), and Sound().

◆ sound

SoundData* SBS::Sound::sound
private

Definition at line 84 of file sound.h.

Referenced by GetPlayPosition(), IsLoaded(), IsValid(), Load(), Play(), SetPlayPosition(), Sound(), and Unload().

◆ SoundLoop

bool SBS::Sound::SoundLoop
private

Definition at line 95 of file sound.h.

Referenced by GetLoopState(), Play(), SetLoopState(), and Sound().

◆ Speed

int SBS::Sound::Speed
private

Definition at line 96 of file sound.h.

Referenced by GetSpeed(), Play(), SetSpeed(), and Sound().

◆ system

SoundSystem* SBS::Sound::system
private

Definition at line 86 of file sound.h.

Referenced by GetPlayPosition(), Load(), Play(), SetPlayPosition(), Sound(), and ~Sound().

◆ Velocity

Vector3 SBS::Sound::Velocity
private

Definition at line 90 of file sound.h.

Referenced by OnMove().

◆ Volume

float SBS::Sound::Volume
private

Definition at line 91 of file sound.h.

Referenced by GetVolume(), Play(), SetVolume(), and Sound().


The documentation for this class was generated from the following files: