|
VR-Engage
2.2
|
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>
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 |
| makVre::DtSoundscape::DtSoundscape | ( | std::string | filename | ) |
Constructor that loads a soundscape from a configuration file.
| filename | The 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().
|
overridevirtual |
Destructor that cleans up all sound resources.
Stops all sounds and releases allocated resources for background and periodic sounds.
|
overridevirtual |
Starts playing all background and periodic sounds.
Plays all background sounds immediately and begins the timer for periodic sounds. Also registers this soundscape for updates with the audio manager.
|
overridevirtual |
Pauses all currently playing sounds.
Pauses all background and periodic sounds and stops updates from the audio manager.
|
overridevirtual |
Stops all sounds and resets them.
Stops all background and periodic sounds and unregisters this soundscape from the audio manager.
|
overridevirtual |
Sets the master volume multiplier for all sounds.
| vol | The volume multiplier (gain) to apply |
Sets the master volume for all sounds in the soundscape. Individual sound volumes will be multiplied by this value.
|
overrideprotectedvirtual |
Updates all sounds in the soundscape.
| dt | The 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.
|
protected |
Loads a background sound configuration from initialization data.
| data | The 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.
|
protected |
Loads a periodic sound configuration from initialization data.
| data | The 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.
|
protected |
Collection of all background sounds in this soundscape.
|
protected |
Collection of all periodic sounds in this soundscape.
|
protected |
Path to the directory containing sound files.