mirror of
https://github.com/love2d/love.git
synced 2026-08-17 11:00:31 +02:00
added Source:seek/tell
--HG-- branch : minor
This commit is contained in:
@@ -200,6 +200,41 @@ namespace openal
|
||||
// In case the Source isn't playing.
|
||||
return volume;
|
||||
}
|
||||
|
||||
void Source::seek(float offset, Source::Unit unit)
|
||||
{
|
||||
if (valid)
|
||||
{
|
||||
switch (unit) {
|
||||
case Source::UNIT_SAMPLES:
|
||||
alSourcef(source, AL_SAMPLE_OFFSET, offset);
|
||||
break;
|
||||
case Source::UNIT_SECONDS:
|
||||
default:
|
||||
alSourcef(source, AL_SEC_OFFSET, offset);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
float Source::tell(Source::Unit unit) const
|
||||
{
|
||||
if (valid)
|
||||
{
|
||||
ALfloat offset;
|
||||
switch (unit) {
|
||||
case Source::UNIT_SAMPLES:
|
||||
alGetSourcef(source, AL_SAMPLE_OFFSET, &offset);
|
||||
break;
|
||||
case Source::UNIT_SECONDS:
|
||||
default:
|
||||
alGetSourcef(source, AL_SEC_OFFSET, &offset);
|
||||
break;
|
||||
}
|
||||
return offset;
|
||||
}
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
void Source::setPosition(float * v)
|
||||
{
|
||||
|
||||
@@ -84,6 +84,8 @@ namespace openal
|
||||
virtual float getPitch() const;
|
||||
virtual void setVolume(float volume);
|
||||
virtual float getVolume() const;
|
||||
virtual void seek(float offset, Unit unit);
|
||||
virtual float tell(Unit unit) const;
|
||||
virtual void setPosition(float * v);
|
||||
virtual void getPosition(float * v) const;
|
||||
virtual void setVelocity(float * v);
|
||||
|
||||
Reference in New Issue
Block a user