Gorgon Game Engine
Gorgon::Audio Namespace Reference

Contains audio subsystem. For audio primitives look into multimedia namespace. More...

Namespaces

 internal
 

Classes

class  BasicController
 Basic controller, allows non-positional playback of data buffer. More...
 
class  Controller
 This is the base class for all controllers. More...
 
class  Device
 Represents an audio device. More...
 
class  Environment
 The environment which the audio system works on. More...
 
class  Listener
 Listener class sets the properties for the audio listener. More...
 
class  PositionalController
 Positional controller allows sounds to be played at a specific location. More...
 

Enumerations

enum  Channel {
  Unknown, Mono, FrontLeft, FrontRight,
  BackLeft, BackRight, Center, LowFreq
}
 Names for channels. More...
 
enum  ControllerType { Basic, Positional }
 Identifies controller types. More...
 
enum  Format { PCM8, PCM16, Float }
 Sample format. More...
 

Functions

void AudioLoop ()
 
 DefineEnumStrings (Channel, { Channel::Unknown, "Unknown" }, { Channel::Mono, "Mono" }, { Channel::FrontLeft, "Front left" }, { Channel::FrontRight, "Front right" }, { Channel::BackLeft, "Back left" }, { Channel::BackRight, "Back right" }, { Channel::Center, "Center" }, { Channel::LowFreq, "Bass" },)
 
float GetVolume ()
 Returns the master volume. More...
 
float GetVolume (Channel channel)
 Returns the volume of a channel. More...
 
void Initialize ()
 Starts audio subsystem with the default device. More...
 
bool IsAvailable ()
 Whether the audio is available. More...
 
Utils::Logger Log ("Audio")
 
void SetVolume (Channel channel, float volume)
 Changes the volume of a channel. More...
 
void SetVolume (float volume)
 Changes the master volume. More...
 
std::vector< ChannelStandardChannels (int channelcount)
 

Variables

Device Current
 
Utils::Logger Log
 

Detailed Description

Contains audio subsystem. For audio primitives look into multimedia namespace.

Enumeration Type Documentation

◆ Channel

enum Channel
strong

Names for channels.

Enumerator
Unknown 
Mono 
FrontLeft 
FrontRight 
BackLeft 
BackRight 
Center 
LowFreq 

◆ ControllerType

enum ControllerType
strong

Identifies controller types.

Enumerator
Basic 
Positional 

◆ Format

enum Format
strong

Sample format.

For now only Float will be used and all conversions are done by the underlying library.

Enumerator
PCM8 
PCM16 
Float 

Function Documentation

◆ AudioLoop()

◆ DefineEnumStrings()

Gorgon::Audio::DefineEnumStrings ( Channel  ,
{ Channel::Unknown, "Unknown" }  ,
{ Channel::Mono, "Mono" }  ,
{ Channel::FrontLeft, "Front left" }  ,
{ Channel::FrontRight, "Front right" }  ,
{ Channel::BackLeft, "Back left" }  ,
{ Channel::BackRight, "Back right" }  ,
{ Channel::Center, "Center" }  ,
{ Channel::LowFreq, "Bass" }   
)

References Unknown.

◆ GetVolume() [1/2]

float GetVolume ( )

Returns the master volume.

References Gorgon::Audio::internal::mastervolume.

◆ GetVolume() [2/2]

float GetVolume ( Channel  channel)

Returns the volume of a channel.

If the channel does not exists, this function will return 0.

References Current, Device::GetChannel(), Device::GetChannelCount(), and Gorgon::Audio::internal::volume.

◆ Initialize()

void Gorgon::Audio::Initialize ( )

Starts audio subsystem with the default device.

Initializes the filesystem module.

Gorgon system requires every module to have initialization function even if they are not used. Currently used for following tasks:

  • Set startup directory

    There is a mechanism to ensure initialization is performed once.

◆ IsAvailable()

bool Gorgon::Audio::IsAvailable ( )

Whether the audio is available.

◆ Log()

Utils::Logger Gorgon::Audio::Log ( "Audio"  )

◆ SetVolume() [1/2]

void SetVolume ( Channel  channel,
float  volume 
)

Changes the volume of a channel.

If the channel is not found, nothing is done except if the channel is mono. In that case all channel's volume is changed.

References Current, Device::GetChannel(), Device::GetChannelCount(), and Gorgon::Audio::internal::volume.

◆ SetVolume() [2/2]

void SetVolume ( float  volume)

Changes the master volume.

References Gorgon::Audio::internal::mastervolume, and Gorgon::Audio::internal::volume.

◆ StandardChannels()

std::vector<Channel> Gorgon::Audio::StandardChannels ( int  channelcount)

References Center, and Unknown.

Variable Documentation

◆ Current

Device Current

◆ Log

Utils::Logger Log("Audio")