34 auto& emuClk = getEmuClock();
35 if (
unsigned emuNum = emuClk.getTicksTill(time); emuNum > 0) {
39 const unsigned len = emuNum * CHANNELS + std::max(3u, CHANNELS);
41 EmuTime emu1 = emuClk.getFastAdd(1);
42 assert(emu1 > hostClock.getTime());
43 if (input.generateInput(buf.data(), emuNum)) {
45 hostClock.getTicksTill(emu1, pos1);
46 for (
auto ch :
xrange(CHANNELS)) {
53 buf[CHANNELS * emuNum + ch] =
54 buf[CHANNELS * (emuNum - 1) + ch] + 1.0f;
56 auto last = lastInput[ch];
57 for (
unsigned i = 0; ; ++i) {
58 if (
auto delta = buf[CHANNELS * i + ch] - last;
59 delta != 0) [[unlikely]] {
63 last = buf[CHANNELS * i + ch];
75 hostClock.getTicksTill(emu1, pos);
76 for (
auto ch :
xrange(CHANNELS)) {
77 if (lastInput[ch] != 0.0f) {
78 auto delta = -lastInput[ch];
80 blip[ch].addDelta(pos, delta);
87 std::array<bool, CHANNELS> results;
88 for (
auto ch :
xrange(CHANNELS)) {
89 results[ch] = blip[ch].template readSamples<CHANNELS>(dataOut + ch, hostNum);
91 static_assert(CHANNELS ==
one_of(1u, 2u),
"either mono or stereo");
92 if constexpr (CHANNELS == 1) {
95 if (results[0] == results[1]) {
101 unsigned offset = results[0] ? 1 : 0;
102 for (
auto i :
xrange(hostNum)) {
103 dataOut[2 * i + offset] = 0.0f;