class
SourceSource.
Contents
Manages positional audio source.
Constructors, destructors, conversion operators
Public functions
Source positioning
- auto position() const -> Vector3
- Position.
- auto setPosition(const Vector3& position) -> Source&
- Set position.
- auto setPosition(const Vector3i& position) -> Source&
- auto velocity() const -> Vector3
- Velocity.
- auto setVelocity(const Vector3& velocity) -> Source&
- Set velocity.
- auto setVelocity(const Vector3i& velocity) -> Source&
- auto isRelative() const -> bool
- Whether the source is interpreted relative to the listener.
- auto setRelative(bool relative) -> Source&
- Interpret source relatively to listener.
Source behavior
- auto gain() const -> Float
- Gain.
- auto setGain(Float gain) -> Source&
- Set gain.
- auto minGain() const -> Float
- Minimal gain to clamp to.
- auto setMinGain(Float gain) -> Source&
- Set min gain.
- auto maxGain() const -> Float
- Maximal gain to clamp to.
- auto setMaxGain(Float gain) -> Source&
- Set max gain.
- auto referenceDistance() const -> Float
- Reference distance.
- auto setReferenceDistance(Float distance) -> Source&
- Set reference distance.
- auto setReferenceDistance(Int distance) -> Source&
- auto rolloffFactor() const -> Float
- Rolloff factor.
- auto setRolloffFactor(Float factor) -> Source&
- Set rolloff factor.
- auto setRolloffFactor(Int factor) -> Source&
- auto maxDistance() const -> Float
- Maximal distance to clamp to.
- auto setMaxDistance(Float distance) -> Source&
- Set max distance.
- auto setMaxDistance(Int distance) -> Source&
- auto direction() const -> Vector3
- Direction.
- auto setDirection(const Vector3& direction) -> Source&
- Set direction.
- auto setDirection(const Vector3i& direction) -> Source&
- auto innerConeAngle() const -> Deg
- Inner cone angle.
- auto setInnerConeAngle(Deg angle) -> Source&
- Set inner cone angle.
- auto outerConeAngle() const -> Deg
- Outer cone angle.
- auto setOuterConeAngle(Deg angle) -> Source&
- Set outer cone angle.
- auto outerConeGain() const -> Float
- Outer cone gain.
- auto setOuterConeGain(Float multiplier) -> Source&
- Set outer cone gain multiplier.
- auto pitch() const -> Float
- Pitch.
- auto setPitch(Float pitch) -> Source&
- Set pitch.
Buffer management
State management
- enum class State: ALint { Initial = AL_INITIAL, Playing = AL_PLAYING, Paused = AL_PAUSED, Stopped = AL_STOPPED }
- Source state.
- auto state() const -> State
- State.
- void play()
- Play.
- void pause()
- Pause.
- void stop()
- Stop.
- void rewind()
- Rewind.
- auto isLooping() const -> bool
- Whether the source is looping.
- auto setLooping(bool loop) -> Source&
- Set source looping.
- auto offsetInSeconds() const -> Float
- Offset in seconds.
- auto setOffsetInSeconds(Float offset) -> Source&
- Set offset in seconds.
- auto offsetInBytes() const -> Int
- Offset in bytes.
- auto setOffsetInBytes(Int offset) -> Source&
- Set offset in bytes.
- auto offsetInSamples() const -> Int
- Offset in samples.
- auto setOffsetInSamples(Int offset) -> Source&
- Set offset in samples.
-
static void play(std::
initializer_list<std:: reference_wrapper<Source>> sources) - Play more sources at once.
-
static void play(const std::
vector<std:: reference_wrapper<Source>>& sources) -
static void pause(std::
initializer_list<std:: reference_wrapper<Source>> sources) - Pause more sources at once.
-
static void pause(const std::
vector<std:: reference_wrapper<Source>>& sources) -
static void stop(std::
initializer_list<std:: reference_wrapper<Source>> sources) - Stop more sources at once.
-
static void stop(const std::
vector<std:: reference_wrapper<Source>>& sources) -
static void rewind(std::
initializer_list<std:: reference_wrapper<Source>> sources) - Rewind more sources at once.
-
static void rewind(const std::
vector<std:: reference_wrapper<Source>>& sources)
Enum documentation
enum class Magnum:: Audio:: Source:: Type: ALint
Source type.
Enumerators | |
---|---|
Undetermined |
Undetermined (default) |
Static |
Static source |
Streaming |
Streaming source |
Function documentation
Source& Magnum:: Audio:: Source:: setPosition(const Vector3& position)
Set position.
Returns | Reference to self (for method chaining) |
---|
Default is {0.0f, 0.0f, 0.0f}
.
Source& Magnum:: Audio:: Source:: setPosition(const Vector3i& position)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Source& Magnum:: Audio:: Source:: setVelocity(const Vector3& velocity)
Set velocity.
Returns | Reference to self (for method chaining) |
---|
Default is {0.0f, 0.0f, 0.0f}
.
Source& Magnum:: Audio:: Source:: setVelocity(const Vector3i& velocity)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
bool Magnum:: Audio:: Source:: isRelative() const
Whether the source is interpreted relative to the listener.
Source& Magnum:: Audio:: Source:: setRelative(bool relative)
Interpret source relatively to listener.
When enabled, source position, direction and velocity will be interpreted relatively to listener. Default is false
.
Source& Magnum:: Audio:: Source:: setMinGain(Float gain)
Set min gain.
Returns | Reference to self (for method chaining) |
---|
If effective gain is lower than min gain, min gain is used. Note that this is done before listener gain is applied. Default is 0.0f
.
Source& Magnum:: Audio:: Source:: setMaxGain(Float gain)
Set max gain.
Returns | Reference to self (for method chaining) |
---|
If effective gain is higher than max gain, max gain is used. Note that this is done before listener gain is applied. Default is 1.0f
. If set to 0.0f
, the source is muted.
Float Magnum:: Audio:: Source:: referenceDistance() const
Reference distance.
Source& Magnum:: Audio:: Source:: setReferenceDistance(Int distance)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Float Magnum:: Audio:: Source:: rolloffFactor() const
Rolloff factor.
Source& Magnum:: Audio:: Source:: setRolloffFactor(Float factor)
Set rolloff factor.
Returns | Reference to self (for method chaining) |
---|
Default is 1.0f
.
Source& Magnum:: Audio:: Source:: setRolloffFactor(Int factor)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Float Magnum:: Audio:: Source:: maxDistance() const
Maximal distance to clamp to.
Source& Magnum:: Audio:: Source:: setMaxDistance(Float distance)
Set max distance.
Returns | Reference to self (for method chaining) |
---|
Default is max representable value.
Source& Magnum:: Audio:: Source:: setMaxDistance(Int distance)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Source& Magnum:: Audio:: Source:: setDirection(const Vector3& direction)
Set direction.
Returns | Reference to self (for method chaining) |
---|
Default is {0.0f, 0.0f, 0.0f}
, which means that the source is not directional.
Source& Magnum:: Audio:: Source:: setDirection(const Vector3i& direction)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Deg Magnum:: Audio:: Source:: innerConeAngle() const
Inner cone angle.
Source& Magnum:: Audio:: Source:: setInnerConeAngle(Deg angle)
Set inner cone angle.
Returns | Reference to self (for method chaining) |
---|
Has effect only if the source is directional. Default is 360.0_degf
.
Deg Magnum:: Audio:: Source:: outerConeAngle() const
Outer cone angle.
Source& Magnum:: Audio:: Source:: setOuterConeAngle(Deg angle)
Set outer cone angle.
Returns | Reference to self (for method chaining) |
---|
Has effect only if the source is directional. Default is 360.0_degf
.
Float Magnum:: Audio:: Source:: outerConeGain() const
Outer cone gain.
Source& Magnum:: Audio:: Source:: setOuterConeGain(Float multiplier)
Set outer cone gain multiplier.
Returns | Reference to self (for method chaining) |
---|
The factor with which the gain is multiplied outside the outer cone. Default is 0.0f
.
Source& Magnum:: Audio:: Source:: setBuffer(Buffer* buffer)
Attach buffer.
Parameters | |
---|---|
buffer | Buffer to attach or nullptr |
Returns | Reference to self (for method chaining) |
If an buffer is attached, changes source type to Type::
void Magnum:: Audio:: Source:: play()
Play.
void Magnum:: Audio:: Source:: pause()
Pause.
void Magnum:: Audio:: Source:: stop()
Stop.
void Magnum:: Audio:: Source:: rewind()
Rewind.
bool Magnum:: Audio:: Source:: isLooping() const
Whether the source is looping.
Source& Magnum:: Audio:: Source:: setLooping(bool loop)
Set source looping.
Returns | Reference to self (for method chaining) |
---|
Default is false
.
Float Magnum:: Audio:: Source:: offsetInSeconds() const
Offset in seconds.
Source& Magnum:: Audio:: Source:: setOffsetInSeconds(Float offset)
Set offset in seconds.
Returns | Reference to self (for method chaining) |
---|
Int Magnum:: Audio:: Source:: offsetInBytes() const
Offset in bytes.
Source& Magnum:: Audio:: Source:: setOffsetInBytes(Int offset)
Set offset in bytes.
Returns | Reference to self (for method chaining) |
---|
Int Magnum:: Audio:: Source:: offsetInSamples() const
Offset in samples.
Source& Magnum:: Audio:: Source:: setOffsetInSamples(Int offset)
Set offset in samples.
Returns | Reference to self (for method chaining) |
---|
static void Magnum:: Audio:: Source:: play(std:: initializer_list<std:: reference_wrapper<Source>> sources)
Play more sources at once.
The operation is guaranteed to be done for all sources at the same time.
static void Magnum:: Audio:: Source:: play(const std:: vector<std:: reference_wrapper<Source>>& sources)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
static void Magnum:: Audio:: Source:: pause(std:: initializer_list<std:: reference_wrapper<Source>> sources)
Pause more sources at once.
The operation is guaranteed to be done for all sources at the same time.
static void Magnum:: Audio:: Source:: pause(const std:: vector<std:: reference_wrapper<Source>>& sources)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
static void Magnum:: Audio:: Source:: stop(std:: initializer_list<std:: reference_wrapper<Source>> sources)
Stop more sources at once.
The operation is guaranteed to be done for all sources at the same time.
static void Magnum:: Audio:: Source:: stop(const std:: vector<std:: reference_wrapper<Source>>& sources)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
static void Magnum:: Audio:: Source:: rewind(std:: initializer_list<std:: reference_wrapper<Source>> sources)
Rewind more sources at once.
The operation is guaranteed to be done for all sources at the same time.
static void Magnum:: Audio:: Source:: rewind(const std:: vector<std:: reference_wrapper<Source>>& sources)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Debug& operator<<(Debug& debug,
Source:: State value)
Debug output operator.