![]() |
VR-Forces Developer's Guide
|
The Audio Manager ensures the application's current audio settings are applied.
The manager ensure the following audio settings are applied:
The manager is also responsible applying updating the listener location based on the selected scheme. Possible listener schemes include:

Public Types | |
| enum | ListenerLocationType { ObserverListener, EntityListener, ExplicitListener } |
Public Member Functions | |
| virtual bool | init () |
| virtual bool | playbackDeviceInitialized () |
| virtual bool | captureDeviceInitialized () |
| virtual bool | isEnabled () |
| virtual void | setEnabled (bool enable) |
| virtual double | soundVolume () |
| virtual void | setSoundVolume (double volume) |
| virtual void | setListenerLocationType (ListenerLocationType listenerType) |
| virtual ListenerLocationType | listenerLocationType () const |
| virtual void | setEntityListener (DtElementID listenerEntity) |
| virtual DtElementID | entityListener () const |
| virtual void | setListenerLocation (const DtVector &location) |
| virtual const DtVector & | listenerLocation () const |
| virtual void | setListenerVelocity (const DtVector &velocity) |
| virtual const DtVector & | listenerVelocity () const |
| virtual void | setListenerFront (const DtVector &frontVec) |
| virtual const DtVector & | listenerFront () const |
| virtual void | setListenerUp (const DtVector &upVec) |
| virtual const DtVector & | listenerUp () const |
| virtual int | maxVoices () |
| virtual void | setMaxVoices (int numVoices) |
| virtual double | speedOfSound () |
| virtual void | setSpeedOfSound (double c) |
| virtual float | maximumOutputDecibelCapability () |
| virtual bool | environmentalProcessingAvailable () |
| virtual bool | isEnvironmentalProcessingEnabled () |
| virtual void | setEnvironmentalProcessingEnabled (bool enable) |
| virtual void | loadDefaults () |
| virtual bool | environmentalProcessingAvailable () const |
| virtual std::vector< std::string > | playbackDeviceList () const |
| virtual std::vector< std::string > | captureDeviceList () const |
| virtual void | playOneShot3D (const std::string &resolvedFilepath, float dbfs, const DtVector &position, const DtVector &velocity=DtVector::zero(), float minAudibleDistanceM=DtAudioLevel::kUseDefaultDistance, float maxAudibleDistanceM=DtAudioLevel::kUseDefaultDistance, makAudio::DtAbstractAudio::Priority priority=makAudio::DtAbstractAudio::BACKGROUND_FX) |
| virtual void | setFixedListenerObserverName (const std::string &name) |
| virtual void | setFixedListenerObserver (DtObserver *obs) |
| virtual const std::string & | fixedListenerObserverName () const |
| virtual void | clearFixedListenerObserver () |
| virtual bool | isFixedListenerObserverActive () const |
| virtual DtObserver * | resolvedListenerObserver () const |
Public Member Functions inherited from makVrv::DtVirtualBaseClass | |
| DtVirtualBaseClass () | |
| virtual | ~DtVirtualBaseClass () |
Static Public Member Functions | |
| static DtAudioManager & | instance (DtDe &de) |
Public Attributes | |
| boost::signalslib::signal < void(DtObserver *)> | signal_audioListenerObserverChanged |
| boost::signalslib::signal< void()> | signal_playbackDeviceInitialized |
| boost::signalslib::signal< void()> | signal_captureDeviceInitialized |
Protected Member Functions | |
| DtAudioManager (DtDe &) | |
| virtual | ~DtAudioManager () |
| void | connectSignals () |
| virtual void | tick () |
| virtual void | shutdown () |
| virtual void | kinStateFromObserver () |
| virtual void | kinStateFromEntity () |
| virtual void | initializeAudioDevicesIfNeeded () |
| virtual void | slot_AudioEnabledUpdated (bool enabled) |
| virtual void | slot_VolumeUpdated (double volume) |
| virtual void | slot_playbackDeviceUpdated (const std::string &device) |
| virtual void | slot_captureDeviceUpdated (const std::string &device) |
| virtual void | slot_showCaptureDeviceSettingsUpdated (bool show) |
| virtual void | slot_SpeedOfSoundUpdated (double speed) |
| virtual void | slot_MaxVoicesUpdated (double numOfVoices) |
| virtual void | slot_EnvironmentalProcessingEnabledUpdated (bool enabled) |
Protected Attributes | |
| DtDe & | myDe |
| DtSignalConnectionManager | myConnections |
| ListenerLocationType | myListenerLocationType |
| DtElementID | myListenerEntity |
| DtVector | myListenerLocation |
| DtVector | myListenerFront |
| DtVector | myListenerUp |
| DtVector | myListenerVelocity |
| bool | myPlaybackDeviceInitialized |
| bool | myCaptureDeviceInitialized |
| std::string | myFixedObserverName |
| DtObserver * | myLastResolvedObserver |
| bool | myFirstResolutionDone |
Private Member Functions | |
| DtAudioManager () | |
| DtAudioManager (const DtAudioManager &) | |
| DtAudioManager & | operator= (const DtAudioManager &) |
Friends | |
| template<typename ManagerClass > | |
| ManagerClass & | defaultManagerInstanceFunction (DtDe &, bool) |
| template<typename ManagerClass > | |
| void | defaultManagerRegisterInstanceFunction (DtDe &, ManagerClass *) |
|
protected |
CTOR.
|
protectedvirtual |
DTOR.
|
private |
Default Constructor not implemented - default constructor not allowed.
|
private |
Copy Constructor not implemented - Copy not allowed.
|
static |
Get an instance of the DtAudioManager.
|
virtual |
Inits the sound system and create the audio context.
|
virtual |
Return whether the playback device is initialized.
|
virtual |
Return whether the capture device is initialized.
|
virtual |
Return whether the audio manager is enabled.
|
virtual |
Sets whether the audio manager is enabled. If set to false, audio manage will stop playing any sound.
|
virtual |
Return the volume of the sound.
|
virtual |
Sets the volume of the sound.
|
virtual |
Set the type of listener the audio manager should use. listenerType will be one of ObserverListener, EntityListener, or ExplicitListener. If the listener type is set to ObserverListener, then the audio manager will retrieve and use the current observer's location, orientation, and velocity. If the listener type is set to EntityListener, then the audio manager will look up the entity set with setEntityListener() and take its kinematic input from there. Finally, if the listener type is set to ExplicitListener, then the audio manager will use whatever values are currently in its kinematic member variables, which can be set through the API.
|
virtual |
Get the current listener type.
|
virtual |
If listener type is set to EntityListener, look up the object specified by the listenerEntity element ID.
|
virtual |
Get the entity listener's element ID (may be (DtUniqueID) -1)
|
virtual |
Set a location to use (local coords) when the listener type is set to ExplicitListener.
|
virtual |
Get the audio manager's current listener location (local coords)
|
virtual |
Set a velocity to use (local coords) when the listener type is set to ExplicitListener.
|
virtual |
Get the audio manager's current listener velocity (local coords)
|
virtual |
Set a front vector (local coords) to use when the listener type is set to ExplicitListener.
|
virtual |
Get the audio manager's current listener front vector (local coords)
|
virtual |
Set an up vector (local coords) to use when the listener type is set to ExplicitListener.
|
virtual |
Get the audio manager's current listener up vector (local coords)
|
virtual |
Return the maximum number of voice allowed in the scene.
|
virtual |
Sets the maximum number of voice allowed in the scene.
|
virtual |
Gets the speed of the sound in m/s. the speed of sound. Currently returns the standard speed of sound in dry air at sea level. But one could calculate it and set it below.
|
virtual |
Sets the speed of the sound in m/s. the speed of sound. Currently returns the standard speed of sound in dry air at sea level. But one could calculate it and set it below.
|
virtual |
Read-only accessor for makAudio's internal SPL reference in dB.
VR-Vantage no longer persists or mutates this value. It is retained solely as a pass-through to makAudio's internal reference used by:
|
virtual |
Return whether the environmental processing is available. Environmental processing enables low pass filtering on sounds so that at a distance only the lower frequencies are heard, since higher frequencies are absorbed by air at a faster rate. Uses a standard day to calculate absorption rate.
|
virtual |
Return whethe the environmental processing is enabled. Environmental processing enables low pass filtering on sounds so that at a distance only the lower frequencies are heard, since higher frequencies are absorbed by air at a faster rate. Uses a standard day to calculate absorption rate.
|
virtual |
Sets whethe the environmental processing is enabled. Environmental processing enables low pass filtering on sounds so that at a distance only the lower frequencies are heard, since higher frequencies are absorbed by air at a faster rate. Uses a standard day to calculate absorption rate.
|
virtual |
Load the default definitions.
|
virtual |
Get the environmental processing available state.
| true | for processing is available on current hardware. |
| false | otherwise. |
|
virtual |
Get the list of audio playback devices available.
|
virtual |
Get the list of audio capture devices available.
|
virtual |
Play a fire-and-forget 3D sound on the canonical dBFS scale.
Creates a makAudio::DtSound, sets its gain from the authored dBFS via DtAudioLevel::linearGainFromDbfs, applies optional per-sound distance overrides via DtAudioLevel::applyAttenuation, then hands ownership to makAudio's deferred queue so the sound plays after its speed-of-sound travel time. makAudio owns and cleans up the transient voice.
Replaces every use of makAudio::DtAudioManager::playSoundOneTime from VR-Vantage code. See DtAudioLevel.h for the canonical scale contract.
| resolvedFilepath | Fully resolved audio file path. |
| dbfs | Playback level in dBFS. 0 = unity, negatives attenuate. |
| position | World position of the source. |
| velocity | World velocity for Doppler; DtVector::zero() if unused. |
| minAudibleDistanceM | Optional inner-radius override in metres; pass DtAudioLevel::kUseDefaultDistance to accept the audio engine's physical default. |
| maxAudibleDistanceM | Optional outer-radius override in metres; pass DtAudioLevel::kUseDefaultDistance to accept the audio engine's physical default. |
| priority | Voice-pool preemption priority. |
|
virtual |
Fix the audio listener to a specific observer by name.
When name is non-empty the audio listener is resolved to the observer with that name instead of following the input driver's current observer. The fix is stored as a name (not a pointer) so it survives observer add/remove and can be set before the observer exists. Setting an empty name is equivalent to calling clearFixedListenerObserver().
Resolution is deferred to tick(); the signal signal_audioListenerObserverChanged fires on the next tick when the resolved observer actually changes.
| name | Observer name to pin, or empty string to unpin. |
|
virtual |
Convenience overload: fix by pointer.
Forwards obs->name() to setFixedListenerObserverName(), or an empty string if obs is nullptr (equivalent to clearing the fix).
| obs | Observer to pin, or nullptr to unpin. |
|
virtual |
Return the currently configured fixed observer name.
Empty when no fix is active.
|
virtual |
Clear the fixed observer, restoring default follow-focus behavior.
Equivalent to setFixedListenerObserverName("").
|
virtual |
Return whether the fixed observer override is currently in effect.
Returns true only when a fix name is set AND an observer with that name is found in the input driver's observer list.
|
virtual |
Resolve the effective audio listener observer.
Single authoritative fallback chain:
Every vrvAudio consumer that needs the listener observer must call this method rather than accessing the input driver directly.
|
protected |
Connects all the signals. Non virtual, called in CTOR.
|
protectedvirtual |
Updates the sound system per tick. Mainly update the listener and sounds.
|
protectedvirtual |
Shut down the sound system, destory the context and release all the sound resources.
|
protectedvirtual |
If listenerLocationType is ObserverListener, this method is called by tick to set myListenerLocation, myListenerFront, myListenerUp, and myListenerVelocity from the current observer.
|
protectedvirtual |
If listenerLocationType is EntityListener, this method is called by tick to set myListenerLocation, myListenerFront, myListenerUp, and myListenerVelocity from myListenerEntity If the entity is not found, the values are unchanged.
|
protectedvirtual |
Initialize the playback and/or capture device if either device is not already initialized. This function does nothing if both devices have already been successfully initialized.
|
protectedvirtual |
Methods connected to audio signals.
Slot when enables/disables the audio.
|
protectedvirtual |
Slot when the volume of the audio changes.
|
protectedvirtual |
Slot when the playback device changes.
|
protectedvirtual |
Slot when the capture device changes.
|
protectedvirtual |
Slot when show/hide the capture device settings.
|
protectedvirtual |
Slot when the speed of the sound changes.
|
protectedvirtual |
Slot when the number of the maximum voice allowed changes.
|
protectedvirtual |
Slot when enables/disables the environmental processing.
|
private |
Assignment Operator not implemented - Copy not allowed.
|
friend |
Befriend the manager instance functions for instance retrieval/creation.
Then simply in the implementation of instance call defaultManagerInstanceFunction with the de object and return the return value.
|
friend |
Befriend the manager instance functions for instance retrieval/creation.
| boost::signalslib::signal<void(DtObserver*)> makVrv::DtAudioManager::signal_audioListenerObserverChanged |
Signaled when the resolved audio listener observer changes.
Fires at the end of tick() when the observer returned by resolvedListenerObserver() differs from the previous tick. The first tick silently seeds the cached value without firing. Subscribers should use this signal in place of DtInputDriverSignaler::signal_currentObserverChanged for all audio listener tracking purposes.
| boost::signalslib::signal<void()> makVrv::DtAudioManager::signal_playbackDeviceInitialized |
Signaled when the playback device is initialized.
| boost::signalslib::signal<void()> makVrv::DtAudioManager::signal_captureDeviceInitialized |
Signaled when the playback device is initialized.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
Name of the observer pinned as the audio listener; empty when unfixed.
|
protected |
Observer returned by the previous resolvedListenerObserver() call in tick().
|
protected |
False until tick() has run at least once; suppresses the initial signal fire.