Skip to content

Audio Documentation

Hekbas edited this page Feb 24, 2024 · 1 revision

Audio Engine Documentation

Overview

The audio engine module is responsible for managing audio playback within the game engine. It provides functions for registering game objects, playing audio events, controlling playback, and setting global sound volume.

Branch Information

The audio engine development is housed in the Development-Audio-Events branch.

Audio Playback

The audio engine utilizes Wwise for audio management. Each game object within the engine is associated with a unique AkGameObjectID, which is initialized using the RegisterGameObject function. Audio events can then be played using the PlayEvent function, specifying the event name and the associated AkGameObjectID. Playback control functions include PauseEvent, ResumeEvent, and StopEvent.

Camera Integration

The audio engine supports integration with the game camera for spatial audio purposes. The camera game object can be registered using RegisterGameObject, and its default listener can be set using SetDefaultListener. Additionally, the camera's position in Wwise can be updated using SetAudioGameObjectTransform.

Global Sound Volume

A function SetGlobalSound is provided to adjust the global sound volume. It accepts a percentage value from 0 (mute) to 100 (maximum volume). Currently, this function affects all audio within the game. Future improvements may include implementing separate volume controls for music, sound effects (SFX), and dialogues.

Implementation Notes

  • The AkGameObjectID component for a game object is not yet implemented within the engine's GameObject. Testing is pending until this implementation is completed.
  • Further refinements and optimizations may be explored as development progresses.

Usage Example

// Register game object
gameObject_name->AkGameObjectID_name = audioEngine->RegisterGameObject("name");

// Play audio event
audioEngine->PlayEvent(AK::EVENTS::event_name, gameObject_name->AkGameObjectID_name);

// Set global sound volume
audioEngine->SetGlobalSound(50); // Sets volume to 50%