26enum class CVMode : uint8_t { off, pitch, mod, aftertouch, velocity };
31class CVInstrument final :
public NonAudioInstrument {
34 void noteOnPostArp(int32_t noteCodePostArp,
ArpNote* arpNote, int32_t noteIndex)
override;
35 void noteOffPostArp(int32_t noteCode, int32_t oldMIDIChannel, int32_t velocity, int32_t noteIndex)
override;
36 void polyphonicExpressionEventPostArpeggiator(int32_t newValue, int32_t noteCodeAfterArpeggiation,
37 int32_t expressionDmiension,
ArpNote* arpNote,
38 int32_t noteIndex)
override;
39 bool writeDataToFile(
Serializer& writer,
Clip* clipForSavingOutputOnly,
Song* song)
override;
40 bool readTagFromFile(
Deserializer& reader,
const char* tagName)
override;
41 void monophonicExpressionEvent(int32_t newValue, int32_t expressionDmiension)
override;
43 void setupWithoutActiveClip(
ModelStack* modelStack)
override;
44 static int32_t navigateChannels(
int oldChannel,
int offset) {
45 auto newChannel = (oldChannel + offset) % kNumCVInstrumentChannels;
46 if (newChannel == -1) {
47 newChannel = kNumCVInstrumentChannels - 1;
51 bool matchesPreset(OutputType otherType, int32_t otherChannel, int32_t channelSuffix,
char const* otherName,
52 char const* otherPath)
override {
54 if (type == otherType) {
55 auto ourChannel = getChannel();
56 match = ourChannel == otherChannel || ourChannel == both || otherChannel == both;
63 int32_t monophonicPitchBendValue;
64 int32_t polyPitchBendValue;
66 char const* getXMLTag()
override {
return "cvChannel"; }
67 void setChannel(
int channel)
override {
68 if (channel <= both) {
69 NonAudioInstrument::setChannel(channel);
70 setMode(
static_cast<CVInstrumentMode
>(channel));
73 NonAudioInstrument::setChannel(0);
74 setMode(
static_cast<CVInstrumentMode
>(0));
77 CVMode getCV2Mode() {
return cvmode[1]; }
79 void setCV2Mode(CVMode mode);
82 void updatePitchBendOutput(
bool outputToo =
true);
84 int32_t getPitchChannel() {
85 auto c = getChannel();
91 void setMode(CVInstrumentMode channel) {
94 case CVInstrumentMode::one: {
95 gateMode[0] = GateMode::gate;
96 cvmode[0] = CVMode::pitch;
98 case CVInstrumentMode::two: {
99 gateMode[1] = GateMode::gate;
100 cvmode[1] = CVMode::pitch;
102 case CVInstrumentMode::both: {
103 gateMode[0] = GateMode::gate;
104 gateMode[1] = GateMode::trigger;
105 cvmode[0] = CVMode::pitch;
106 if (cvmode[1] == CVMode::off) {
107 cvmode[1] = CVMode::aftertouch;
113 gateMode[0] = GateMode::off;
114 gateMode[1] = GateMode::off;
115 cvmode[0] = CVMode::off;
116 cvmode[1] = CVMode::off;
119 GateMode gateMode[2]{GateMode::off, GateMode::off};
120 CVMode cvmode[2]{CVMode::off, CVMode::off};
121 void sendMonophonicExpressionEvent(int32_t dimension);
Definition model_stack.h:231