1 #ifndef INCLUDE_AL_SOUND_SPEAKER_HPP
2 #define INCLUDE_AL_SOUND_SPEAKER_HPP
50 #include "al/math/al_Constants.hpp"
51 #include "al/math/al_Vec.hpp"
73 Speaker(
unsigned int deviceChan = 0,
float az = 0.f,
float el = 0.f,
81 float cosel = cos(elr);
82 xyz[0] = -cos(azr) * cosel *
radius;
83 xyz[1] = sin(azr) * cosel *
radius;
84 xyz[2] = sin(elr) *
radius;
88 void posCart2(
Vec3d xyz);
96 static double toRad(
double d) {
return d * M_PI / 180.; }
97 static float toRad(
float d) {
return d * float(M_PI) / 180.f; }
114 float phase = 0.f,
float radius = 1.f,
117 mSpeakers.reserve(N);
118 for (
unsigned int i = 0; i < N; ++i) {
119 mSpeakers.emplace_back(
Speaker(
120 i + deviceChannelStart, (360.f / N) * i + phase, 0.f, 0,
radius,
gain));
135 float angle = 30.f,
float distance = 1.f,
142 float phase = 0.f,
float radius = 1.f,
float gain
Gain of speaker.
unsigned int deviceChannel
Index in the output device channels array.
Vec3d vecGraphics() const
Get position as Cartesian coordinate (in graphics space)
float azimuth
Angle from forward to right vector (i.e. CW)
int group
Group identifier.
Speaker & posCart(T *xyz)
Get position in Cartesian coordinate (in audio space)
Speaker(unsigned int deviceChan=0, float az=0.f, float el=0.f, int group=0, float radius=1.f, float gain=1.f)
float radius
Distance from center of listening space.
Vec3d vec() const
Get position as Cartesian coordinate (in audio space)
Speakers SpeakerRingLayout(unsigned int deviceChannelStart=0, float phase=0.f, float radius=1.f, float gain=1.f)
Speakers StereoSpeakerLayout(unsigned int deviceChannelStart=0, float angle=30.f, float distance=1.f, float gain=1.f)
Speakers OctalSpeakerLayout(unsigned int deviceChannelStart=0, float phase=0.f, float radius=1.f, float gain=1.f)
Speakers CubeLayout(unsigned int deviceChannelStart=0)
std::vector< Speaker > Speakers
A set of speakers.
T angle(const Vec< N, T > &a, const Vec< N, T > &b)
Returns angle, in interval [0, pi], between two vectors.
Speakers HeadsetSpeakerLayout(unsigned int deviceChannelStart=0, float radius=1.f, float gain=1.f)