src/drawer.multicanvas.js
/**
     * Draw a waveform
     *
     * @param {number[]|Number.<Array[]>} peaks Can also be an array of arrays
     * for split channel rendering
     * @param {number} channelIndex The index of the current channel. Normally
     * should be 0
     * @param {number?} start The x-offset of the beginning of the area that
     * should be rendered (If this isn't set only a flat line is rendered)
     * @param {number?} end The x-offset of the end of the area that should be
     * rendered
     * @returns {void}
     */
Draw a waveform
@param {number[]|Number.} peaks Can also be an array of arrays
for split channel rendering
@param {number} channelIndex The index of the current channel. Normally
should be 0
@param {number?} start The x-offset of the beginning of the area that
should be rendered (If this isn't set only a flat line is rendered)
@param {number?} end The x-offset of the end of the area that should be
rendered
@returns {void}
Draw a waveform @param { number [] |Number . } peaks Can also be an array of arrays for split channel rendering @param { number } channelIndex The index of the current channel . Normally should be 0 @param { number? } start The x - offset of the beginning of the area that should be rendered ( If this isn ' t set only a flat line is rendered ) @param { number? } end The x - offset of the end of the area that should be rendered @returns { void }
drawWave(peaks, channelIndex, start, end) {
        return this.prepareDraw(
            peaks,
            channelIndex,
            start,
            end,
            ({ absmax, hasMinVals, height, offsetY, halfH, peaks }) => {
                if (!hasMinVals) {
                    const reflectedPeaks = [];
                    const len = peaks.length;
                    let i = 0;
                    for (i; i < len; i++) {
                        reflectedPeaks[2 * i] = peaks[i];
                        reflectedPeaks[2 * i + 1] = -peaks[i];
                    }
                    peaks = reflectedPeaks;
                }
                if (start !== undefined) {
                    this.drawLine(peaks, absmax, halfH, offsetY, start, end);
                }
                this.fillRect(
                    0,
                    halfH + offsetY - this.halfPixel,
                    this.width,
                    this.halfPixel
                );
            }
        );
    }
drawWave ( peaks , channelIndex , start , end ) { return this . prepareDraw ( peaks , channelIndex , start , end , ( { absmax , hasMinVals , height , offsetY , halfH , peaks } ) => { if ( ! hasMinVals ) { const reflectedPeaks = [ ] ; const len = peaks . length ; let i = 0 ; for ( i ; i < len ; i ++ ) { reflectedPeaks [ 2 * i ] = peaks [ i ] ; reflectedPeaks [ 2 * i + 1 ] = - peaks [ i ] ; } peaks = reflectedPeaks ; } if ( start !== undefined ) { this . drawLine ( peaks , absmax , halfH , offsetY , start , end ) ; } this . fillRect ( 0 , halfH + offsetY - this . halfPixel , this . width , this . halfPixel ) ; } ) ; }
Draw a waveform
 @param {number[]|Number.<Array[]>} peaks Can also be an array of arrays
 for split channel rendering
 @param {number} channelIndex The index of the current channel.
Draw a waveform @param { number [] |Number . <Array [] > } peaks Can also be an array of arrays for split channel rendering @param { number } channelIndex The index of the current channel .
// if drawWave was called within ws.empty we don't pass a start and // end and simply want a flat line // always draw a median line