aboutsummaryrefslogtreecommitdiffhomepage
path: root/desktop/core/library/d.js
blob: 46cdb8684c38a603ab6d37cf88623f898fe17cdc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
'use strict'

import Operator from '../operator.js'

export default function OperatorD (orca, x, y, passive) {
  Operator.call(this, orca, x, y, 'd', passive)

  this.name = 'delay'
  this.info = 'Bangs on modulo of frame'

  this.ports.haste.rate = { x: -1, y: 0, clamp: { min: 1 } }
  this.ports.input.mod = { x: 1, y: 0, default: '8' }
  this.ports.output = { x: 0, y: 1, bang: true }

  this.operation = function (force = false) {
    const rate = this.listen(this.ports.haste.rate, true)
    const mod = this.listen(this.ports.input.mod, true)
    const res = orca.f % (mod * rate)
    return res === 0 || mod === 1
  }
}