added Source:seek/tell

--HG--
branch : minor
This commit is contained in:
Bill Meltsner
2011-03-19 20:21:40 -05:00
parent 9251c2b4b1
commit 8de9499979
8 changed files with 105 additions and 0 deletions
+35
View File
@@ -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)
{
+2
View File
@@ -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);