| 73 | } |
| 74 | |
| 75 | void processTerminalInput(const ProcessArgs& args) override |
| 76 | { |
| 77 | const uint32_t processCounter = pcontext->processCounter; |
| 78 | |
| 79 | // local variables for faster access |
| 80 | double tick, tickClock; |
| 81 | |
| 82 | // Update time position if running a new audio block |
| 83 | if (lastProcessCounter != processCounter) |
| 84 | { |
| 85 | lastProcessCounter = processCounter; |
| 86 | timeInfo.reset = pcontext->reset; |
| 87 | timeInfo.bar = pcontext->bar; |
| 88 | timeInfo.beat = pcontext->beat; |
| 89 | timeInfo.seconds = pcontext->frame / pcontext->sampleRate; |
| 90 | tick = pcontext->tick; |
| 91 | tickClock = pcontext->tickClock; |
| 92 | } |
| 93 | else |
| 94 | { |
| 95 | tick = timeInfo.tick; |
| 96 | tickClock = timeInfo.tickClock; |
| 97 | } |
| 98 | |
| 99 | const bool playing = pcontext->playing; |
| 100 | const bool playingWithBBT = playing && pcontext->bbtValid; |
| 101 | |
| 102 | if (playingWithBBT) |
| 103 | { |
| 104 | if (d_isZero(tick)) |
| 105 | { |
| 106 | pulseBeat.trigger(); |
| 107 | if (timeInfo.beat == 1) |
| 108 | pulseBar.trigger(); |
| 109 | } |
| 110 | |
| 111 | if (d_isZero(tickClock)) |
| 112 | pulseClock.trigger(); |
| 113 | |
| 114 | if (timeInfo.reset) |
| 115 | { |
| 116 | timeInfo.reset = false; |
| 117 | pulseReset.trigger(); |
| 118 | } |
| 119 | |
| 120 | tick += pcontext->ticksPerFrame; |
| 121 | |
| 122 | // give a little help to keep tick active, |
| 123 | // as otherwise we might miss it if located at the very end of the audio block |
| 124 | if (tick + 0.0001 >= pcontext->ticksPerBeat) |
| 125 | { |
| 126 | tick -= pcontext->ticksPerBeat; |
| 127 | pulseBeat.trigger(); |
| 128 | |
| 129 | if (++timeInfo.beat > pcontext->beatsPerBar) |
| 130 | { |
| 131 | timeInfo.beat = 1; |
| 132 | ++timeInfo.bar; |
nothing calls this directly
no test coverage detected