diff --git a/src/Magnum/Audio/Source.h b/src/Magnum/Audio/Source.h index 57f877d1f..cf8c34f1a 100644 --- a/src/Magnum/Audio/Source.h +++ b/src/Magnum/Audio/Source.h @@ -761,6 +761,12 @@ inline Source& Source::operator=(Source&& other) { return *this; } +inline auto Source::type() const -> Type { + ALint type; + alGetSourcei(_id, AL_SOURCE_TYPE, &type); + return Type(type); +} + inline auto Source::state() const -> State { ALint state; alGetSourcei(_id, AL_SOURCE_STATE, &state); diff --git a/src/Magnum/Audio/Test/SourceALTest.cpp b/src/Magnum/Audio/Test/SourceALTest.cpp index 66fe83cb3..f53306a51 100644 --- a/src/Magnum/Audio/Test/SourceALTest.cpp +++ b/src/Magnum/Audio/Test/SourceALTest.cpp @@ -25,6 +25,7 @@ #include +#include "Magnum/Audio/Buffer.h" #include "Magnum/Audio/Context.h" #include "Magnum/Audio/Source.h" @@ -46,6 +47,7 @@ struct SourceALTest: TestSuite::Tester { void minGain(); void coneAnglesAndGain(); void rolloffFactor(); + void type(); Context _context; }; @@ -63,7 +65,8 @@ SourceALTest::SourceALTest() { &SourceALTest::maxGain, &SourceALTest::minGain, &SourceALTest::coneAnglesAndGain, - &SourceALTest::rolloffFactor}); + &SourceALTest::rolloffFactor, + &SourceALTest::type}); } void SourceALTest::construct() { @@ -168,6 +171,15 @@ void SourceALTest::rolloffFactor() { CORRADE_COMPARE(source.rolloffFactor(), fact); } +void SourceALTest::type() { + Source source; + CORRADE_COMPARE(source.type(), Source::Type::Undetermined); + + Buffer buffer; + source.setBuffer(&buffer); + CORRADE_COMPARE(source.type(), Source::Type::Static); +} + }}}} CORRADE_TEST_MAIN(Magnum::Audio::Test::SourceALTest)