| 644 | } |
| 645 | |
| 646 | void processTerminalOutput(const ProcessArgs&) override |
| 647 | { |
| 648 | if (isBypassed()) |
| 649 | return; |
| 650 | |
| 651 | auto connected = midiOutput.connected; |
| 652 | |
| 653 | for (int c = 0; c < inputs[PITCH_INPUT].getChannels(); ++c) |
| 654 | { |
| 655 | if (connected.velocity) |
| 656 | { |
| 657 | const constexpr float n = 10.f * 100.f / 127.f; |
| 658 | const int vel = clamp( |
| 659 | static_cast<int>(inputs[VELOCITY_INPUT].getNormalPolyVoltage(n, c) / 10.f * 127.f + 0.5f), 0, 127); |
| 660 | midiOutput.setVelocity(vel, c); |
| 661 | } |
| 662 | else |
| 663 | { |
| 664 | midiOutput.setVelocity(100, c); |
| 665 | } |
| 666 | |
| 667 | const int note = clamp(static_cast<int>(inputs[PITCH_INPUT].getVoltage(c) * 12.f + 60.5f), 0, 127); |
| 668 | const bool gate = connected.gate ? inputs[GATE_INPUT].getPolyVoltage(c) >= 1.f : false; |
| 669 | midiOutput.setNoteGate(note, gate, c); |
| 670 | |
| 671 | if (connected.aftertouch) |
| 672 | { |
| 673 | const int aft = clamp( |
| 674 | static_cast<int>(inputs[AFTERTOUCH_INPUT].getPolyVoltage(c) / 10.f * 127.f + 0.5f), 0, 127); |
| 675 | midiOutput.setKeyPressure(aft, c); |
| 676 | } |
| 677 | else |
| 678 | { |
| 679 | midiOutput.setKeyPressure(0, c); |
| 680 | } |
| 681 | } |
| 682 | |
| 683 | if (connected.pitchbend) |
| 684 | { |
| 685 | const int pw = clamp( |
| 686 | static_cast<int>((inputs[PITCHBEND_INPUT].getVoltage() + 5.f) / 10.f * 16383.f + 0.5f), 0, 16383); |
| 687 | midiOutput.setPitchWheel(pw); |
| 688 | } |
| 689 | else |
| 690 | { |
| 691 | midiOutput.setPitchWheel(0); |
| 692 | } |
| 693 | |
| 694 | if (connected.modwheel) |
| 695 | { |
| 696 | const int mw = clamp( |
| 697 | static_cast<int>(inputs[MODWHEEL_INPUT].getVoltage() / 10.f * 127.f + 0.5f), 0, 127); |
| 698 | midiOutput.setModWheel(mw); |
| 699 | } |
| 700 | else |
| 701 | { |
| 702 | midiOutput.setModWheel(0); |
| 703 | } |
nothing calls this directly
no test coverage detected