lib/waa/dsp.js
function(t1, v2, duration) {
          var i = 0, line, newLines = []
          
          // Find the point in the queue where we should insert the new line.
          while ((line = this._queue[i++]) && (t1 >= line.t2)) 1
          this._queue = this._queue.slice(0)

          if (this._queue.length) {
            var lastLine = this._queue[this._queue.length - 1]

            // If the new line interrupts the last in the queue, we have to interpolate
            // a new line
            if (t1 < lastLine.t2) {
              this._queue = this._queue.slice(0, -1)
              line = {
                t1: lastLine.t1, v1: lastLine.v1,
                t2: t1, v2: this._interpolate(lastLine, t1)
              }
              newLines.push(line)
              this._queue.push(line)

            // Otherwise, we have to fill-in the gap with a straight line
            } else if (t1 > lastLine.t2) {
              line = {
                t1: lastLine.t2, v1: lastLine.v2,
                t2: t1, v2: lastLine.v2
              }
              newLines.push(line)
              this._queue.push(line)
            }

          // If there isn't any value in the queue yet, we fill in the gap with
          // a straight line from `_lastValue` all the way to `t1` 
          } else {
            line = {
              t1: 0, v1: this._lastValue,
              t2: t1, v2: this._lastValue
            }
            newLines.push(line)
            this._queue.push(line)
          }

          // Finally create the line and add it to the queue
          line = {
            t1: t1, v1: this._queue[this._queue.length - 1].v2,
            t2: t1 + duration, v2: v2
          }
          newLines.push(line)
          this._queue.push(line)
          return newLines
        }
function(t1, v2, duration) {
          var i = 0, line, newLines = []
          
          // Find the point in the queue where we should insert the new line.
          while ((line = this._queue[i++]) && (t1 >= line.t2)) 1
          this._queue = this._queue.slice(0)

          if (this._queue.length) {
            var lastLine = this._queue[this._queue.length - 1]

            // If the new line interrupts the last in the queue, we have to interpolate
            // a new line
            if (t1 < lastLine.t2) {
              this._queue = this._queue.slice(0, -1)
              line = {
                t1: lastLine.t1, v1: lastLine.v1,
                t2: t1, v2: this._interpolate(lastLine, t1)
              }
              newLines.push(line)
              this._queue.push(line)

            // Otherwise, we have to fill-in the gap with a straight line
            } else if (t1 > lastLine.t2) {
              line = {
                t1: lastLine.t2, v1: lastLine.v2,
                t2: t1, v2: lastLine.v2
              }
              newLines.push(line)
              this._queue.push(line)
            }

          // If there isn't any value in the queue yet, we fill in the gap with
          // a straight line from `_lastValue` all the way to `t1` 
          } else {
            line = {
              t1: 0, v1: this._lastValue,
              t2: t1, v2: this._lastValue
            }
            newLines.push(line)
            this._queue.push(line)
          }

          // Finally create the line and add it to the queue
          line = {
            t1: t1, v1: this._queue[this._queue.length - 1].v2,
            t2: t1 + duration, v2: v2
          }
          newLines.push(line)
          this._queue.push(line)
          return newLines
        }
function ( t1 , v2 , duration ) { var i = 0 , line , newLines = [ ] // Find the point in the queue where we should insert the new line. while ( ( line = this . _queue [ i ++ ] ) && ( t1 >= line . t2 ) ) 1 this . _queue = this . _queue . slice ( 0 ) if ( this . _queue . length ) { var lastLine = this . _queue [ this . _queue . length - 1 ] // If the new line interrupts the last in the queue, we have to interpolate // a new line if ( t1 < lastLine . t2 ) { this . _queue = this . _queue . slice ( 0 , - 1 ) line = { t1 : lastLine . t1 , v1 : lastLine . v1 , t2 : t1 , v2 : this . _interpolate ( lastLine , t1 ) } newLines . push ( line ) this . _queue . push ( line ) // Otherwise, we have to fill-in the gap with a straight line } else if ( t1 > lastLine . t2 ) { line = { t1 : lastLine . t2 , v1 : lastLine . v2 , t2 : t1 , v2 : lastLine . v2 } newLines . push ( line ) this . _queue . push ( line ) } // If there isn't any value in the queue yet, we fill in the gap with // a straight line from `_lastValue` all the way to `t1`  } else { line = { t1 : 0 , v1 : this . _lastValue , t2 : t1 , v2 : this . _lastValue } newLines . push ( line ) this . _queue . push ( line ) } // Finally create the line and add it to the queue line = { t1 : t1 , v1 : this . _queue [ this . _queue . length - 1 ] . v2 , t2 : t1 + duration , v2 : v2 } newLines . push ( line ) this . _queue . push ( line ) return newLines }
push a line to the queue, overriding the lines that were after it, and creating new lines if interrupting something in its middle.
push a line to the queue overriding the lines that were after it and creating new lines if interrupting something in its middle .