Gorgon Game Engine
Basic.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "../Enum.h"
4 #include "../String.h"
5 
6 namespace Gorgon { namespace Audio {
9  enum class Format {
10  PCM8,
11  PCM16,
12  Float
13  };
14 
16  enum class Channel {
17  Unknown,
18  Mono,
19  FrontLeft,
20  FrontRight,
21  BackLeft,
22  BackRight,
23  Center,
24  LowFreq
25  };
26 
28  { Channel::Unknown , "Unknown" },
29  { Channel::Mono , "Mono" },
30  { Channel::FrontLeft , "Front left" },
31  { Channel::FrontRight , "Front right" },
32  { Channel::BackLeft , "Back left" },
33  { Channel::BackRight , "Back right" },
34  { Channel::Center , "Center" },
35  { Channel::LowFreq , "Bass" },
36  );
37 
38 
39  inline std::vector<Channel> StandardChannels(int channelcount) {
40  std::vector<Channel> channels;
41  switch(channelcount) {
42  case 1:
43  return{Channel::Mono};
44  case 2:
45  return{Channel::FrontLeft, Channel::FrontRight};
46  case 3:
47  return{Channel::FrontLeft, Channel::FrontRight, Channel::Center};
48  case 4:
49  return{Channel::FrontLeft, Channel::FrontRight, Channel::BackLeft, Channel::BackRight};
50  case 5:
51  return{Channel::FrontLeft, Channel::FrontRight, Channel::Center, Channel::BackLeft, Channel::BackRight};
52  case 6:
53  return{Channel::FrontLeft, Channel::FrontRight, Channel::Center, Channel::LowFreq, Channel::BackLeft, Channel::BackRight};
54  default:
55  return{};
56  }
57  }
58 
59 } }
Gorgon::Audio::Channel::Center
@ Center
Gorgon::String::From
std::enable_if< decltype(gorgon__enum_tr_loc(T_()))::isupgradedenum, std::string >::type From(const T_ &e)
Definition: Enum.h:303
Gorgon::Audio::internal::audiothread
std::thread audiothread
Definition: Audio.cpp:29
Gorgon::Audio::Environment::Current
static Environment Current
Currently active environment.
Definition: Environment.h:128
Gorgon::Audio::StandardChannels
std::vector< Channel > StandardChannels(int channelcount)
Definition: Basic.h:39
Gorgon::Audio::Device::FindChannel
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
Gorgon::Geometry::basic_Point3D::Normalize
basic_Point3D Normalize() const
Definition: Point3D.h:46
Gorgon::Audio::BasicController::GetDuration
float GetDuration() const
Returns the duration of the audio buffer in seconds. This function will return 0 if data is not set.
Definition: Controllers.cpp:95
Gorgon::Containers::Wave::FindChannel
int FindChannel(Audio::Channel channel) const
Returns the index of the given channel. If the given channel does not exists, this function returns -...
Definition: Wave.h:442
Gorgon::Float
float Float
Represents floating point data type.
Definition: Types.h:16
Gorgon::Audio::internal::BufferSize
int BufferSize
Definition: Audio.cpp:32
Gorgon::Audio::internal::ControllerMtx
std::mutex ControllerMtx
Definition: Controllers.cpp:127
Gorgon::Audio::Device::GetChannel
Channel GetChannel(int index) const
Returns the channel type with the given index.
Definition: Audio.h:72
Gorgon
Root namespace for Gorgon Game Engine.
Definition: Any.h:19
Gorgon::Audio::internal::Controllers
Containers::Collection< Controller > Controllers
Definition: Controllers.cpp:126
Gorgon::Audio::internal::volume
std::vector< float > volume
Definition: Audio.cpp:35
Gorgon::Utils::Logger
Eases logging procedure by appending necessary information to the given data and streams to a standar...
Definition: Logging.h:19
Gorgon::Audio::internal::exitfn
void exitfn()
Definition: Audio.cpp:37
Gorgon::Audio::Current
Device Current
Definition: Audio.cpp:24
Gorgon::Audio::internal::mastervolume
float mastervolume
Definition: Audio.cpp:34
Gorgon::Audio::AudioLoop
void AudioLoop()
Definition: Audio.cpp:76
Gorgon::Audio::DefineEnumStrings
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" },)
Gorgon::Audio::internal::BufferDuration
float BufferDuration
Definition: Audio.cpp:31
Gorgon::Audio::Device::IsHeadphones
bool IsHeadphones() const
Returns if this device is connected to headphones.
Definition: Audio.h:91
Gorgon::Audio::BasicController::wavedata
const Containers::Wave * wavedata
Contains the data for this controller.
Definition: Controllers.h:119
Gorgon::Audio::SetVolume
void SetVolume(float volume)
Changes the master volume.
Definition: Audio.cpp:44
Gorgon::Audio::Device
Represents an audio device.
Definition: Audio.h:36
Controllers.h
Gorgon::Audio::Log
Utils::Logger Log
Gorgon::Audio::BasicController
Basic controller, allows non-positional playback of data buffer.
Definition: Controllers.h:41
Gorgon::Audio::Device::GetSampleRate
int GetSampleRate() const
Returns number of samples per second.
Definition: Audio.h:56
Gorgon::Audio::Channel
Channel
Names for channels.
Definition: Basic.h:16
Environment.h
Gorgon::exiting
bool exiting
Definition: Main.cpp:62
Gorgon::Audio::PositionalController
Positional controller allows sounds to be played at a specific location.
Definition: Controllers.h:140
Gorgon::Audio::Device::GetChannelCount
int GetChannelCount() const
Returns the number of channels available.
Definition: Audio.h:67
Gorgon::Audio::ControllerType::Basic
@ Basic
Gorgon::Audio::GetVolume
float GetVolume()
Returns the master volume.
Definition: Audio.cpp:63
Gorgon::Audio::Channel::Unknown
@ Unknown
Gorgon::Audio::Format
Format
Sample format.
Definition: Basic.h:9