Browse Source

Audio: Add remaining getters to Source

Signed-off-by: Squareys <Squareys@googlemail.com>
pull/107/head
Squareys 11 years ago
parent
commit
111f566f2f
  1. 149
      src/Magnum/Audio/Source.h

149
src/Magnum/Audio/Source.h

@ -82,6 +82,16 @@ class MAGNUM_AUDIO_EXPORT Source {
/** @{ @name Source positioning */
/**
* @brief Position
* @see @ref setPosition(), @fn_al{GetSourcefv} with @def_al{POSITION}
*/
Vector3 position() const {
Vector3 v;
alGetSourcefv(_id, AL_POSITION, v.data());
return v;
}
/**
* @brief Set position
* @return Reference to self (for method chaining)
@ -102,6 +112,16 @@ class MAGNUM_AUDIO_EXPORT Source {
return *this;
}
/**
* @brief Velocity
* @see @ref setVelocity(), @fn_al{GetSourcefv} with @def_al{VELOCITY}
*/
Vector3 velocity() const {
Vector3 v;
alGetSourcefv(_id, AL_VELOCITY, v.data());
return v;
}
/**
* @brief Set velocity
* @return Reference to self (for method chaining)
@ -122,6 +142,17 @@ class MAGNUM_AUDIO_EXPORT Source {
return *this;
}
/**
* @brief Whether the source is interpreted relative to the listener
* @see @ref setRelative(), @ref position(), @ref direction(), @ref velocity(),
* @fn_al{GetSourcei} with @def_al{SOURCE_RELATIVE}
*/
bool isRelative() const {
Int relative;
alGetSourcei(_id, AL_SOURCE_RELATIVE, &relative);
return (relative == 1);
}
/**
* @brief Interpret source relatively to listener
*
@ -139,6 +170,16 @@ class MAGNUM_AUDIO_EXPORT Source {
/** @{ @name Source behavior */
/**
* @brief Gain
* @see @ref setGain(), @fn_al{GetSourcef} with @def_al{GAIN}
*/
Float gain() const {
Float gain;
alGetSourcef(_id, AL_GAIN, &gain);
return gain;
}
/**
* @brief Set gain
* @return Reference to self (for method chaining)
@ -153,6 +194,17 @@ class MAGNUM_AUDIO_EXPORT Source {
return *this;
}
/**
* @brief Minimal gain to clamp to
* @see @ref setMinGain(), @ref setMaxGain(), @ref setGain(), @ref maxGain(),
* @ref gain(), @fn_al{GetSourcef} with @def_al{MIN_GAIN}
*/
Float minGain() const {
Float minGain;
alGetSourcef(_id, AL_MIN_GAIN, &minGain);
return minGain;
}
/**
* @brief Set min gain
* @return Reference to self (for method chaining)
@ -168,6 +220,17 @@ class MAGNUM_AUDIO_EXPORT Source {
return *this;
}
/**
* @brief Maximal gain to clamp to
* @see @ref setMaxGain(), @ref setMinGain(), @ref setGain(), @ref maxGain(),
* @ref gain(), @fn_al{GetSourcef} with @def_al{MAX_GAIN}
*/
Float maxGain() const {
Float maxGain;
alGetSourcef(_id, AL_MAX_GAIN, &maxGain);
return maxGain;
}
/**
* @brief Set max gain
* @return Reference to self (for method chaining)
@ -183,11 +246,23 @@ class MAGNUM_AUDIO_EXPORT Source {
return *this;
}
/**
* @brief Reference distance
* @see @ref setReferenceDistance(), @fn_al{GetSourcef} with @def_al{REFERENCE_DISTANCE}
*/
Float referenceDistance() const {
Float distance;
alGetSourcef(_id, AL_REFERENCE_DISTANCE, &distance);
return distance;
}
/**
* @brief Set reference distance
* @return Reference to self (for method chaining)
*
* Default is `1.0f`.
* Default is `1.0f`. Distance at which the listener will
* experience @ref gain() (or @ref minGain(), @ref maxGain()
* if gain was clamped).
* @see @ref setRolloffFactor(), @fn_al{Sourcef} with
* @def_al{REFERENCE_DISTANCE}
*/
@ -204,6 +279,16 @@ class MAGNUM_AUDIO_EXPORT Source {
return *this;
}
/**
* @brief Rolloff factor
* @see @ref setRolloffFactor(), @fn_al{GetSourcef} with @def_al{ROLLOFF_FACTOR}
*/
Float rolloffFactor() const {
Float factor;
alGetSourcef(_id, AL_ROLLOFF_FACTOR, &factor);
return factor;
}
/**
* @brief Set rolloff factor
* @return Reference to self (for method chaining)
@ -225,6 +310,16 @@ class MAGNUM_AUDIO_EXPORT Source {
return *this;
}
/**
* @brief Maximal distance to clamp to
* @see @ref setRolloffFactor(), @fn_al{GetSourcef} with @def_al{MAX_DISTANCE}
*/
Float maxDistance() const {
Float distance;
alGetSourcef(_id, AL_MAX_DISTANCE, &distance);
return distance;
}
/**
* @brief Set max distance
* @return Reference to self (for method chaining)
@ -245,6 +340,16 @@ class MAGNUM_AUDIO_EXPORT Source {
return *this;
}
/**
* @brief Direction
* @see @ref setDirection(), @fn_al{GetSourcefv} with @def_al{DIRECTION}
*/
Vector3 direction() const {
Vector3 direction;
alGetSourcef(_id, AL_DIRECTION, direction.data());
return direction;
}
/**
* @brief Set direction
* @return Reference to self (for method chaining)
@ -267,6 +372,16 @@ class MAGNUM_AUDIO_EXPORT Source {
return *this;
}
/**
* @brief Inner cone angle
* @see @ref setInnerConeAngle(), @fn_al{GetSourcef} with @def_al{CONE_INNER_ANGLE}
*/
Deg innerConeAngle() const {
Float angle;
alGetSourcef(_id, AL_CONE_INNER_ANGLE, &angle);
return Deg(angle);
}
/**
* @brief Set inner cone angle
* @return Reference to self (for method chaining)
@ -281,6 +396,16 @@ class MAGNUM_AUDIO_EXPORT Source {
return *this;
}
/**
* @brief Outer cone angle
* @see @ref setOuterConeAngle(), @fn_al{GetSourcef} with @def_al{CONE_OUTER_ANGLE}
*/
Deg outerConeAngle() const {
Float angle;
alGetSourcef(_id, AL_CONE_OUTER_ANGLE, &angle);
return Deg(angle);
}
/**
* @brief Set outer cone angle
* @return Reference to self (for method chaining)
@ -296,6 +421,16 @@ class MAGNUM_AUDIO_EXPORT Source {
return *this;
}
/**
* @brief Outer cone gain
* @see @ref setOuterConeGain(), @fn_al{GetSourcef} with @def_al{CONE_OUTER_GAIN}
*/
Float outerConeGain() const {
Float gain;
alGetSourcef(_id, AL_CONE_OUTER_GAIN, &gain);
return gain;
}
/**
* @brief Set outer cone gain multiplier
* @return Reference to self (for method chaining)
@ -306,10 +441,20 @@ class MAGNUM_AUDIO_EXPORT Source {
* @def_al{CONE_OUTER_GAIN}
*/
Source& setOuterConeGain(Float multiplier) {
alSourcef(_id, AL_CONE_OUTER_ANGLE, multiplier);
alSourcef(_id, AL_CONE_OUTER_GAIN, multiplier);
return *this;
}
/**
* @brief Pitch
* @see @ref setPitch(), @fn_al{GetSourcef} with @def_al{PITCH}
*/
Float pitch() const {
Float pitch;
alGetSourcef(_id, AL_PITCH, &pitch);
return pitch;
}
/**
* @brief Set pitch
* @return Reference to self (for method chaining)

Loading…
Cancel
Save