mirror of
https://github.com/love2d/love.git
synced 2026-08-17 19:23:38 +02:00
Source:seek didn't work properly for streaming sources, fixed that
--HG-- branch : minor
This commit is contained in:
@@ -225,13 +225,24 @@ namespace openal
|
|||||||
{
|
{
|
||||||
switch (unit) {
|
switch (unit) {
|
||||||
case Source::UNIT_SAMPLES:
|
case Source::UNIT_SAMPLES:
|
||||||
if (type == TYPE_STREAM) offset -= offsetSamples;
|
if (type == TYPE_STREAM) {
|
||||||
alSourcef(source, AL_SAMPLE_OFFSET, offset);
|
ALint buffer;
|
||||||
|
alGetSourcei(source, AL_BUFFER, &buffer);
|
||||||
|
int freq;
|
||||||
|
alGetBufferi(buffer, AL_FREQUENCY, &freq);
|
||||||
|
offset /= freq;
|
||||||
|
decoder->seek(offset);
|
||||||
|
} else {
|
||||||
|
alSourcef(source, AL_SAMPLE_OFFSET, offset);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case Source::UNIT_SECONDS:
|
case Source::UNIT_SECONDS:
|
||||||
default:
|
default:
|
||||||
if (type == TYPE_STREAM) offset -= offsetSeconds;
|
if (type == TYPE_STREAM) {
|
||||||
alSourcef(source, AL_SEC_OFFSET, offset);
|
decoder->seek(offset);
|
||||||
|
} else {
|
||||||
|
alSourcef(source, AL_SEC_OFFSET, offset);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user