 |
Gorgon Game Engine
|
Go to the documentation of this file.
41 Device(
const std::string &
id,
const std::string &name,
int rate,
Format format,
bool headphones,
const std::vector<Channel> &channels) :
42 name(name), id(id), rate(rate), format(format), headphones(headphones), channels(channels)
68 return (
int)channels.size();
73 return channels[index];
78 for(
int i = 0; i<(int)channels.size(); i++)
96 static const std::vector<Device> &
Devices() {
111 for(
auto &dev : devices) {
112 if(dev.id ==
id)
return dev;
115 throw std::runtime_error(
"Cannot find device: "+
id);
127 bool headphones =
false;
132 std::vector<Channel> channels;
134 static std::vector<Device> devices;
145 extern std::vector<float>
volume;
void Initialize()
Starts audio subsystem with the default device.
Definition: Filesystem.cpp:14
std::thread audiothread
Definition: Audio.cpp:29
int FindChannel(Channel type) const
Returns the index of the given type of channel. If that channel type does not exists,...
Definition: Audio.h:77
This class provides event mechanism.
Definition: Event.h:134
static void Refresh()
Refreshes the list of audio devices. Calling this function triggers ChangedEvent.
bool IsAvailable()
Whether the audio is available.
bool IsValid() const
Returns if this is a valid device.
Definition: Audio.h:86
Channel GetChannel(int index) const
Returns the channel type with the given index.
Definition: Audio.h:72
Root namespace for Gorgon Game Engine.
Definition: Any.h:19
static Device Find(const std::string &id)
Name based device lookup.
Definition: Audio.h:110
std::vector< float > volume
Definition: Audio.cpp:35
Eases logging procedure by appending necessary information to the given data and streams to a standar...
Definition: Logging.h:19
std::string GetName() const
Returns the readable name of this device.
Definition: Audio.h:51
Device Current
Definition: Audio.cpp:24
static Event ChangedEvent
Triggers when the audio device configuration is changed.
Definition: Audio.h:121
float mastervolume
Definition: Audio.cpp:34
Device(const std::string &id, const std::string &name, int rate, Format format, bool headphones, const std::vector< Channel > &channels)
Definition: Audio.h:41
bool IsHeadphones() const
Returns if this device is connected to headphones.
Definition: Audio.h:91
void SetVolume(float volume)
Changes the master volume.
Definition: Audio.cpp:44
std::string GetID() const
Returns the ID of this device.
Definition: Audio.h:46
Represents an audio device.
Definition: Audio.h:36
contains event distribution mechanism
int GetSampleRate() const
Returns number of samples per second.
Definition: Audio.h:56
Channel
Names for channels.
Definition: Basic.h:16
int GetChannelCount() const
Returns the number of channels available.
Definition: Audio.h:67
static const std::vector< Device > & Devices()
Returns the devices in the current system.
Definition: Audio.h:96
float GetVolume()
Returns the master volume.
Definition: Audio.cpp:63
static Device Default()
Returns the default device of the current system.
Definition: Audio.h:101
Format
Sample format.
Definition: Basic.h:9
Format GetFormat() const
Returns the format of this device.
Definition: Audio.h:62