|
@@ -506,23 +506,23 @@ float Source::getVolume() const
|
|
|
return volume;
|
|
|
}
|
|
|
|
|
|
-void Source::seek(float offset, Source::Unit unit)
|
|
|
+void Source::seek(double offset, Source::Unit unit)
|
|
|
{
|
|
|
Lock l = pool->lock();
|
|
|
|
|
|
int offsetSamples = 0;
|
|
|
- float offsetSeconds = 0.0f;
|
|
|
+ double offsetSeconds = 0.0f;
|
|
|
|
|
|
switch (unit)
|
|
|
{
|
|
|
case Source::UNIT_SAMPLES:
|
|
|
- offsetSamples = offset;
|
|
|
- offsetSeconds = offset / sampleRate;
|
|
|
+ offsetSamples = (int) offset;
|
|
|
+ offsetSeconds = offset / (double) sampleRate;
|
|
|
break;
|
|
|
case Source::UNIT_SECONDS:
|
|
|
default:
|
|
|
offsetSeconds = offset;
|
|
|
- offsetSamples = offset * sampleRate;
|
|
|
+ offsetSamples = (int) (offset * sampleRate);
|
|
|
break;
|
|
|
}
|
|
|
|
|
@@ -573,12 +573,13 @@ void Source::seek(float offset, Source::Unit unit)
|
|
|
}
|
|
|
if (unusedBuffers.empty())
|
|
|
offsetSamples = 0;
|
|
|
- offsetSeconds = offsetSamples / sampleRate;
|
|
|
+ offsetSeconds = offsetSamples / (double) sampleRate;
|
|
|
}
|
|
|
break;
|
|
|
case TYPE_MAX_ENUM:
|
|
|
break;
|
|
|
}
|
|
|
+
|
|
|
if (wasPlaying && (alGetError() == AL_INVALID_VALUE || (sourceType == TYPE_STREAM && !isPlaying())))
|
|
|
{
|
|
|
stop();
|
|
@@ -586,10 +587,11 @@ void Source::seek(float offset, Source::Unit unit)
|
|
|
play();
|
|
|
return;
|
|
|
}
|
|
|
+
|
|
|
this->offsetSamples = offsetSamples;
|
|
|
}
|
|
|
|
|
|
-float Source::tell(Source::Unit unit)
|
|
|
+double Source::tell(Source::Unit unit)
|
|
|
{
|
|
|
Lock l = pool->lock();
|
|
|
|
|
@@ -601,7 +603,7 @@ float Source::tell(Source::Unit unit)
|
|
|
offset += offsetSamples;
|
|
|
|
|
|
if (unit == UNIT_SECONDS)
|
|
|
- return offset / (float)sampleRate;
|
|
|
+ return offset / (double) sampleRate;
|
|
|
else
|
|
|
return offset;
|
|
|
}
|
|
@@ -867,7 +869,7 @@ void Source::prepareAtomic()
|
|
|
}
|
|
|
|
|
|
// Seek to the current/pending offset.
|
|
|
- alSourcef(source, AL_SAMPLE_OFFSET, offsetSamples);
|
|
|
+ alSourcei(source, AL_SAMPLE_OFFSET, offsetSamples);
|
|
|
}
|
|
|
|
|
|
void Source::teardownAtomic()
|