diff --git a/src/Magnum/Audio/Renderer.h b/src/Magnum/Audio/Renderer.h index d6842e79e..027c1a73f 100644 --- a/src/Magnum/Audio/Renderer.h +++ b/src/Magnum/Audio/Renderer.h @@ -61,6 +61,16 @@ class Renderer { /** @{ @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 * @@ -78,6 +88,16 @@ class Renderer { alListeneriv(AL_POSITION, position.data()); } + /** + * @brief Listener orientation + * @see @ref setListenerOrientation(), @fn_al{GetListenerfv} with @def_al{ORIENTATION} + */ + static std::array listenerOrientation() { + std::array data; + alGetListenerfv(AL_ORIENTATION, data[0].data()); + return data; + } + /** * @brief Set listener orientation * @@ -85,12 +105,28 @@ class Renderer { * normalized. Default is -Z and +Y. * @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 * @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 @@ -141,6 +177,16 @@ class Renderer { 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 * @@ -152,6 +198,14 @@ class Renderer { 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 * @@ -162,6 +216,14 @@ class Renderer { 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 * @@ -172,6 +234,14 @@ class Renderer { 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 * @@ -188,15 +258,8 @@ class Renderer { /** @debugoperatorclassenum{Magnum::Audio::Renderer,Magnum::Audio::Renderer::Error} */ Debug MAGNUM_AUDIO_EXPORT operator<<(Debug debug, Renderer::Error value); -inline void Renderer::setListenerOrientation(const Vector3& forward, const Vector3& up) { - const Vector3 data[] = {forward, up}; - 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()); -} +/** @debugoperatorclassenum{Magnum::Audio::Renderer,Magnum::Audio::Renderer::DistanceModel} */ +Debug MAGNUM_AUDIO_EXPORT operator<<(Debug debug, Renderer::DistanceModel value); }}