MCPcopy Create free account
hub / github.com/DISTRHO/Cardinal / processTerminalInput

Method processTerminalInput

plugins/Cardinal/src/HostTime.cpp:75–181  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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;

Callers

nothing calls this directly

Calls 6

log2Function · 0.85
triggerMethod · 0.80
setBrightnessMethod · 0.80
setBrightnessSmoothMethod · 0.80
processMethod · 0.45
setVoltageMethod · 0.45

Tested by

no test coverage detected