32 auto& emuClk = getEmuClock();
33 if (
unsigned emuNum = emuClk.getTicksTill(time); emuNum > 0) {
37 const unsigned len = emuNum * CHANNELS + std::max(3u, CHANNELS);
39 EmuTime emu1 = emuClk.getFastAdd(1);
40 assert(emu1 > hostClock.getTime());
41 if (input.generateInput(buf.data(), emuNum)) {
43 hostClock.getTicksTill(emu1, pos1);
44 for (
auto ch :
xrange(CHANNELS)) {
51 buf[CHANNELS * emuNum + ch] =
52 buf[CHANNELS * (emuNum - 1) + ch] + 1.0f;
54 auto last = lastInput[ch];
55 for (
unsigned i = 0; ; ++i) {
56 if (
auto delta = buf[CHANNELS * i + ch] - last;
57 delta != 0) [[unlikely]] {
61 last = buf[CHANNELS * i + ch];
73 hostClock.getTicksTill(emu1, pos);
74 for (
auto ch :
xrange(CHANNELS)) {
75 if (lastInput[ch] != 0.0f) {
76 auto delta = -lastInput[ch];
78 blip[ch].addDelta(pos, delta);
85 std::array<bool, CHANNELS> results;
86 for (
auto ch :
xrange(CHANNELS)) {
87 results[ch] = blip[ch].template readSamples<CHANNELS>(dataOut + ch, hostNum);
89 static_assert(CHANNELS ==
one_of(1u, 2u),
"either mono or stereo");
90 if constexpr (CHANNELS == 1) {
93 if (results[0] == results[1]) {
99 unsigned offset = results[0] ? 1 : 0;
100 for (
auto i :
xrange(hostNum)) {
101 dataOut[2 * i + offset] = 0.0f;