webaudio-wav-stream-player icon indicating copy to clipboard operation
webaudio-wav-stream-player copied to clipboard

source question

Open DoubleCouponDay opened this issue 5 years ago • 0 comments

At line 29 of WavPlayer.js. Why are you using an expression that will always be false? (waspositive and wasnegative).

    wasPositive = currentSample[0] > 0;

    for (let i = buffer.length - 1; i > 0; i -= 1) {
        buffer.copyFromChannel(currentSample, 0, i);

        if ((wasPositive && currentSample[0] < 0) || (!wasPositive && currentSample[0] > 0)) {
            break;
        }

        currentSample[0] = 0;
        buffer.copyToChannel(currentSample, 0, i);
    }

DoubleCouponDay avatar Nov 14 '19 00:11 DoubleCouponDay