![]() |
Gorgon Game Engine
|
Represents an audio device. More...
Public Member Functions | |
Device ()=default | |
Device (const std::string &id, const std::string &name, int rate, Format format, bool headphones, const std::vector< Channel > &channels) | |
int | FindChannel (Channel type) const |
Returns the index of the given type of channel. If that channel type does not exists, -1 is returned. More... | |
Channel | GetChannel (int index) const |
Returns the channel type with the given index. More... | |
int | GetChannelCount () const |
Returns the number of channels available. More... | |
Format | GetFormat () const |
Returns the format of this device. More... | |
std::string | GetID () const |
Returns the ID of this device. More... | |
std::string | GetName () const |
Returns the readable name of this device. More... | |
int | GetSampleRate () const |
Returns number of samples per second. More... | |
bool | IsHeadphones () const |
Returns if this device is connected to headphones. More... | |
bool | IsValid () const |
Returns if this is a valid device. More... | |
Static Public Member Functions | |
static Device | Default () |
Returns the default device of the current system. More... | |
static const std::vector< Device > & | Devices () |
Returns the devices in the current system. More... | |
static Device | Find (const std::string &id) |
Name based device lookup. More... | |
static void | Refresh () |
Refreshes the list of audio devices. Calling this function triggers ChangedEvent. More... | |
Static Public Attributes | |
static Event | ChangedEvent |
Triggers when the audio device configuration is changed. More... | |
Represents an audio device.
|
default |
Device | ( | const std::string & | id, |
const std::string & | name, | ||
int | rate, | ||
Format | format, | ||
bool | headphones, | ||
const std::vector< Channel > & | channels | ||
) |
|
static |
Returns the default device of the current system.
|
static |
Returns the devices in the current system.
|
static |
Name based device lookup.
Fires std::runtime_error if the given device cannot be found.
int FindChannel | ( | Channel | type | ) | const |
Returns the index of the given type of channel. If that channel type does not exists, -1 is returned.
Channel GetChannel | ( | int | index | ) | const |
Returns the channel type with the given index.
int GetChannelCount | ( | ) | const |
Returns the number of channels available.
Format GetFormat | ( | ) | const |
Returns the format of this device.
In some cases, this format might be different than the actual device format.
std::string GetID | ( | ) | const |
Returns the ID of this device.
std::string GetName | ( | ) | const |
Returns the readable name of this device.
int GetSampleRate | ( | ) | const |
Returns number of samples per second.
bool IsHeadphones | ( | ) | const |
Returns if this device is connected to headphones.
bool IsValid | ( | ) | const |
Returns if this is a valid device.
|
static |
Refreshes the list of audio devices. Calling this function triggers ChangedEvent.
|
static |
Triggers when the audio device configuration is changed.
Depending on the operating system this event might be unavailable. When this even is triggered, current audio configuration must be checked but should not be recreated unless there is a change.