};
midihandler.key_{|d, v, n|
- if (onlyWhite) {
- n = 60 + this.distanceWhite(60, n);
- };
- if (d) {
- var newFreq = this.midiKeyToFreq(n);
- var newParams = params.value.asPairs++[
- \gate, 1,
- \freq, newFreq,
- \amp, amp * v,
- ]++this.makePanParam(n);
- midinote = n;
- if (note.notNil) {
- if (poly) {
- note.set(*newParams);
- } {
- note.set(\gate, 0);
- };
- };
- if (poly.not) {
- note = Synth(synthName, newParams, group);
+ if (this.isWhiteKey(n) || onlyWhite.not) {
+ if (onlyWhite) {
+ n = 60 + this.distanceWhite(60, n);
};
- } {
- if (n == midinote) {
- note.set(\gate, 0);
+ if (d) {
+ var newFreq = this.midiKeyToFreq(n);
+ var newParams = params.value.asPairs++[
+ \gate, 1,
+ \freq, newFreq,
+ \amp, amp * v,
+ ]++this.makePanParam(n);
+ midinote = n;
+ if (note.notNil) {
+ if (poly) {
+ note.set(*newParams);
+ } {
+ note.set(\gate, 0);
+ };
+ };
if (poly.not) {
- note = nil;
+ note = Synth(synthName, newParams, group);
+ };
+ } {
+ if (n == midinote) {
+ note.set(\gate, 0);
+ if (poly.not) {
+ note = nil;
+ };
};
};
+ } {
+ // black keys in onlyWhite mode
};
};
midihandler.bend_{|v|
bend = v * bendRadius;
if (note.notNil) {
- note.set(\freq, (midinote+bend).midicps);
+ note.set(\freq, this.midiKeyToFreq(midinote));
};
};
}