mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 849713 - Part 3: Set the loop parameters on AudioBufferSourceNodeEngine if looping is turned on when start() gets called; r=roc
This commit is contained in:
parent
dca28d002b
commit
3ebb3793d6
@ -194,6 +194,25 @@ AudioBufferSourceNode::Start(JSContext* aCx, double aWhen, double aOffset,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Don't compute and set the loop parameters unnecessarily
|
||||||
|
if (mLoop) {
|
||||||
|
double actualLoopStart, actualLoopEnd;
|
||||||
|
if (((mLoopStart != 0.0) || (mLoopEnd != 0.0)) &&
|
||||||
|
mLoopStart >= 0.0 && mLoopEnd > 0.0 &&
|
||||||
|
mLoopStart < mLoopEnd) {
|
||||||
|
actualLoopStart = (mLoopStart > length) ? 0.0 : mLoopStart;
|
||||||
|
actualLoopEnd = std::min(mLoopEnd, length);
|
||||||
|
} else {
|
||||||
|
actualLoopStart = 0.0;
|
||||||
|
actualLoopEnd = length;
|
||||||
|
}
|
||||||
|
int32_t loopStartTicks = NS_lround(actualLoopStart * rate);
|
||||||
|
int32_t loopEndTicks = NS_lround(actualLoopEnd * rate);
|
||||||
|
ns->SetInt32Parameter(AudioBufferSourceNodeEngine::LOOP, 1);
|
||||||
|
ns->SetInt32Parameter(AudioBufferSourceNodeEngine::LOOPSTART, loopStartTicks);
|
||||||
|
ns->SetInt32Parameter(AudioBufferSourceNodeEngine::LOOPEND, loopEndTicks);
|
||||||
|
}
|
||||||
|
|
||||||
ns->SetBuffer(data.forget());
|
ns->SetBuffer(data.forget());
|
||||||
// Don't set parameter unnecessarily
|
// Don't set parameter unnecessarily
|
||||||
if (aWhen > 0.0) {
|
if (aWhen > 0.0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user