Browse Source

Audio: Implement missing getters for Audio::Renderer

Signed-off-by: Squareys <Squareys@googlemail.com>
pull/107/head
Squareys 11 years ago
parent
commit
badbc41b4e
  1. 85
      src/Magnum/Audio/Renderer.h

85
src/Magnum/Audio/Renderer.h

@ -61,6 +61,16 @@ class Renderer {
/** @{ @name Listener positioning */ /** @{ @name Listener positioning */
/**
* @brief Listener position
* @see @ref setListenerPosition(), @fn_al{GetListenerfv} with @def_al{POSITION}
*/
static Vector3 listenerPosition() {
Vector3 position;
alGetListenerfv(AL_POSITION, position.data());
return position;
}
/** /**
* @brief Set listener position * @brief Set listener position
* *
@ -78,6 +88,16 @@ class Renderer {
alListeneriv(AL_POSITION, position.data()); alListeneriv(AL_POSITION, position.data());
} }
/**
* @brief Listener orientation
* @see @ref setListenerOrientation(), @fn_al{GetListenerfv} with @def_al{ORIENTATION}
*/
static std::array<Vector3, 2> listenerOrientation() {
std::array<Vector3, 2> data;
alGetListenerfv(AL_ORIENTATION, data[0].data());
return data;
}
/** /**
* @brief Set listener orientation * @brief Set listener orientation
* *
@ -85,12 +105,28 @@ class Renderer {
* normalized. Default is -Z and +Y. * normalized. Default is -Z and +Y.
* @see @fn_al{Listenerfv} with @def_al{ORIENTATION} * @see @fn_al{Listenerfv} with @def_al{ORIENTATION}
*/ */
static void setListenerOrientation(const Vector3& forward, const Vector3& up); static void setListenerOrientation(const Vector3& forward, const Vector3& up) {
const Vector3 data[] = {forward, up};
alListenerfv(AL_ORIENTATION, data[0].data());
}
/** @overload /** @overload
* @see @fn_al{Listeneriv} with @def_al{ORIENTATION} * @see @fn_al{Listeneriv} with @def_al{ORIENTATION}
*/ */
static void setListenerOrientation(const Vector3i& forward, const Vector3i& up); static void setListenerOrientation(const Vector3i& forward, const Vector3i& up) {
const Vector3i data[] = {forward, up};
alListeneriv(AL_ORIENTATION, data[0].data());
}
/**
* @brief Listener position
* @see @ref setListenerVelocity(), @fn_al{GetListenerfv} with @def_al{VELOCITY}
*/
static Vector3 listenerVelocity() {
Vector3 velocity;
alGetListenerfv(AL_VELOCITY, velocity.data());
return velocity;
}
/** /**
* @brief Set listener velocity * @brief Set listener velocity
@ -141,6 +177,16 @@ class Renderer {
ExponentClamped = AL_EXPONENT_DISTANCE_CLAMPED ExponentClamped = AL_EXPONENT_DISTANCE_CLAMPED
}; };
/**
* @brief Listener gain
* @see @ref setListenerGain(), @fn_al{GetListenerf} with @def_al{GAIN}
*/
static Float listenerGain() {
Float gain;
alGetListenerf(AL_GAIN, &gain);
return gain;
}
/** /**
* @brief Set listener gain * @brief Set listener gain
* *
@ -152,6 +198,14 @@ class Renderer {
alListenerf(AL_GAIN, gain); alListenerf(AL_GAIN, gain);
} }
/**
* @brief Doppler factor
* @see @ref setDopplerFactor(), @fn_al{GetFloat} with @def_al{DOPPLER_FACTOR}
*/
static Float dopplerFactor() {
return alGetFloat(AL_DOPPLER_FACTOR);
}
/** /**
* @brief Set Doppler factor * @brief Set Doppler factor
* *
@ -162,6 +216,14 @@ class Renderer {
alDopplerFactor(factor); alDopplerFactor(factor);
} }
/**
* @brief Speed of sound
* @see @ref setSpeedOfSound(), @fn_al{GetFloat} with @def_al{SPEED_OF_SOUND}
*/
static Float speedOfSound() {
return alGetFloat(AL_SPEED_OF_SOUND);
}
/** /**
* @brief Set speed of sound * @brief Set speed of sound
* *
@ -172,6 +234,14 @@ class Renderer {
alSpeedOfSound(speed); alSpeedOfSound(speed);
} }
/**
* @brief Distance model
* @see @ref setDistanceModel(), @fn_al{GetInteger} with @def_al{DISTANCE_MODEL}
*/
static DistanceModel distanceModel() {
return DistanceModel(alGetInteger(AL_DISTANCE_MODEL));
}
/** /**
* @brief Set distance model * @brief Set distance model
* *
@ -188,15 +258,8 @@ class Renderer {
/** @debugoperatorclassenum{Magnum::Audio::Renderer,Magnum::Audio::Renderer::Error} */ /** @debugoperatorclassenum{Magnum::Audio::Renderer,Magnum::Audio::Renderer::Error} */
Debug MAGNUM_AUDIO_EXPORT operator<<(Debug debug, Renderer::Error value); Debug MAGNUM_AUDIO_EXPORT operator<<(Debug debug, Renderer::Error value);
inline void Renderer::setListenerOrientation(const Vector3& forward, const Vector3& up) { /** @debugoperatorclassenum{Magnum::Audio::Renderer,Magnum::Audio::Renderer::DistanceModel} */
const Vector3 data[] = {forward, up}; Debug MAGNUM_AUDIO_EXPORT operator<<(Debug debug, Renderer::DistanceModel value);
alListenerfv(AL_ORIENTATION, data[0].data());
}
inline void Renderer::setListenerOrientation(const Vector3i& forward, const Vector3i& up) {
const Vector3i data[] = {forward, up};
alListeneriv(AL_ORIENTATION, data[0].data());
}
}} }}

Loading…
Cancel
Save