|
@@ -228,11 +228,13 @@ namespace openal
|
|
switch (*((Source::Unit*) unit)) {
|
|
switch (*((Source::Unit*) unit)) {
|
|
case Source::UNIT_SAMPLES:
|
|
case Source::UNIT_SAMPLES:
|
|
if (type == TYPE_STREAM) {
|
|
if (type == TYPE_STREAM) {
|
|
|
|
+ offsetSamples = offset;
|
|
ALint buffer;
|
|
ALint buffer;
|
|
alGetSourcei(source, AL_BUFFER, &buffer);
|
|
alGetSourcei(source, AL_BUFFER, &buffer);
|
|
int freq;
|
|
int freq;
|
|
alGetBufferi(buffer, AL_FREQUENCY, &freq);
|
|
alGetBufferi(buffer, AL_FREQUENCY, &freq);
|
|
offset /= freq;
|
|
offset /= freq;
|
|
|
|
+ offsetSeconds = offset;
|
|
decoder->seek(offset);
|
|
decoder->seek(offset);
|
|
} else {
|
|
} else {
|
|
alSourcef(source, AL_SAMPLE_OFFSET, offset);
|
|
alSourcef(source, AL_SAMPLE_OFFSET, offset);
|
|
@@ -241,12 +243,26 @@ namespace openal
|
|
case Source::UNIT_SECONDS:
|
|
case Source::UNIT_SECONDS:
|
|
default:
|
|
default:
|
|
if (type == TYPE_STREAM) {
|
|
if (type == TYPE_STREAM) {
|
|
|
|
+ offsetSeconds = offset;
|
|
decoder->seek(offset);
|
|
decoder->seek(offset);
|
|
|
|
+ ALint buffer;
|
|
|
|
+ alGetSourcei(source, AL_BUFFER, &buffer);
|
|
|
|
+ int freq;
|
|
|
|
+ alGetBufferi(buffer, AL_FREQUENCY, &freq);
|
|
|
|
+ offsetSamples = offset*freq;
|
|
} else {
|
|
} else {
|
|
alSourcef(source, AL_SEC_OFFSET, offset);
|
|
alSourcef(source, AL_SEC_OFFSET, offset);
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
|
|
+ if (type == TYPE_STREAM)
|
|
|
|
+ {
|
|
|
|
+ // Because we still have old data
|
|
|
|
+ // from before the seek in the buffers
|
|
|
|
+ // let's empty them.
|
|
|
|
+ stopAtomic(false);
|
|
|
|
+ playAtomic();
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -380,7 +396,7 @@ namespace openal
|
|
//but this prevents a horrible, horrible bug
|
|
//but this prevents a horrible, horrible bug
|
|
}
|
|
}
|
|
|
|
|
|
- void Source::stopAtomic()
|
|
|
|
|
|
+ void Source::stopAtomic(bool rewind)
|
|
{
|
|
{
|
|
if(valid)
|
|
if(valid)
|
|
{
|
|
{
|
|
@@ -404,7 +420,8 @@ namespace openal
|
|
|
|
|
|
alSourcei(source, AL_BUFFER, AL_NONE);
|
|
alSourcei(source, AL_BUFFER, AL_NONE);
|
|
}
|
|
}
|
|
- rewindAtomic();
|
|
|
|
|
|
+ if (rewind)
|
|
|
|
+ rewindAtomic();
|
|
valid = false;
|
|
valid = false;
|
|
}
|
|
}
|
|
|
|
|