VR-Engage  2.2
Loading...
Searching...
No Matches
makVre::DtSoundscape Class Reference

Detailed Description

DtSoundscape loads and manages a collection of background ambient sounds and periodic sound effects from a configuration file. Background sounds play continuously with varying volume and pitch, while periodic sounds play at random intervals from random positions within a specified range. This provides a dynamic audio environment for immersive simulations.

#include <soundscape.h>

Inheritance diagram for makVre::DtSoundscape:
[legend]

Classes

struct  Background
 
struct  Periodic
 
struct  Varying
 

Public Member Functions

 DtSoundscape (std::string filename)
 
virtual ~DtSoundscape () override
 
virtual bool play () override
 
virtual bool pause () override
 
virtual bool stop () override
 
virtual void setGain (float vol) override
 

Protected Member Functions

virtual void update (double dt) override
 
void loadBackground (DtInitTable &data)
 
void loadPeriodic (DtInitTable &data)
 

Protected Attributes

std::vector< Background * > myBackgrounds
 
std::vector< Periodic * > myPeriodics
 
std::string mySoundscapePath
 

Constructor & Destructor Documentation

◆ DtSoundscape()

makVre::DtSoundscape::DtSoundscape ( std::string filename)

Constructor that loads a soundscape from a configuration file.

Parameters
filenameThe path to the soundscape configuration file

Loads background and periodic sound definitions from the specified configuration file, preparing them for playback when play() is called.

Referenced by makVre::DtSoundscape::Background::Background(), and makVre::DtSoundscape::Periodic::Periodic().

◆ ~DtSoundscape()

virtual makVre::DtSoundscape::~DtSoundscape ( )
overridevirtual

Destructor that cleans up all sound resources.

Stops all sounds and releases allocated resources for background and periodic sounds.

Member Function Documentation

◆ play()

virtual bool makVre::DtSoundscape::play ( )
overridevirtual

Starts playing all background and periodic sounds.

Returns
True if playback started successfully

Plays all background sounds immediately and begins the timer for periodic sounds. Also registers this soundscape for updates with the audio manager.

◆ pause()

virtual bool makVre::DtSoundscape::pause ( )
overridevirtual

Pauses all currently playing sounds.

Returns
True if all sounds were paused successfully

Pauses all background and periodic sounds and stops updates from the audio manager.

◆ stop()

virtual bool makVre::DtSoundscape::stop ( )
overridevirtual

Stops all sounds and resets them.

Returns
True if all sounds were stopped successfully

Stops all background and periodic sounds and unregisters this soundscape from the audio manager.

◆ setGain()

virtual void makVre::DtSoundscape::setGain ( float vol)
overridevirtual

Sets the master volume multiplier for all sounds.

Parameters
volThe volume multiplier (gain) to apply

Sets the master volume for all sounds in the soundscape. Individual sound volumes will be multiplied by this value.

◆ update()

virtual void makVre::DtSoundscape::update ( double dt)
overrideprotectedvirtual

Updates all sounds in the soundscape.

Parameters
dtThe time elapsed since the last update in seconds

Called by the audio manager to update the state of all background and periodic sounds, applying volume and pitch variations and triggering periodic sounds as needed.

◆ loadBackground()

void makVre::DtSoundscape::loadBackground ( DtInitTable & data)
protected

Loads a background sound configuration from initialization data.

Parameters
dataThe initialization table containing background sound parameters

Creates and configures a new background sound that plays continuously with varying volume and pitch parameters defined in the data table.

◆ loadPeriodic()

void makVre::DtSoundscape::loadPeriodic ( DtInitTable & data)
protected

Loads a periodic sound configuration from initialization data.

Parameters
dataThe initialization table containing periodic sound parameters

Creates and configures a new periodic sound that plays at random intervals from random positions within a specified range.

Member Data Documentation

◆ myBackgrounds

std::vector<Background*> makVre::DtSoundscape::myBackgrounds
protected

Collection of all background sounds in this soundscape.

◆ myPeriodics

std::vector<Periodic*> makVre::DtSoundscape::myPeriodics
protected

Collection of all periodic sounds in this soundscape.

◆ mySoundscapePath

std::string makVre::DtSoundscape::mySoundscapePath
protected

Path to the directory containing sound files.


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