rename last_cc to ccIn
This commit is contained in:
10
src/API.ts
10
src/API.ts
@ -619,7 +619,7 @@ export class UserAPI {
|
||||
return note ? note.note : 60;
|
||||
};
|
||||
|
||||
public last_cc = (control: number, channel?: number): number => {
|
||||
public ccIn = (control: number, channel?: number): number => {
|
||||
/**
|
||||
* @returns Returns last received cc
|
||||
*/
|
||||
@ -806,9 +806,9 @@ export class UserAPI {
|
||||
}
|
||||
|
||||
if ((typeof input !== "string" || validSyntax) && (!player || replace)) {
|
||||
if(typeof input === "string" && player && this.forceEvaluator) {
|
||||
if (typeof input === "string" && player && this.forceEvaluator) {
|
||||
// If pattern change is forced in the middle of the cycle
|
||||
if(!player.updatePattern(input, options)) {
|
||||
if (!player.updatePattern(input, options)) {
|
||||
this.logOnce(`Invalid syntax: ${input}`);
|
||||
};
|
||||
this.forceEvaluator = false;
|
||||
@ -1952,7 +1952,7 @@ export class UserAPI {
|
||||
};
|
||||
|
||||
logOnce = (message: any) => {
|
||||
if(this.onceEvaluator) {
|
||||
if (this.onceEvaluator) {
|
||||
console.log(message);
|
||||
this._logMessage(message);
|
||||
this.onceEvaluator = false;
|
||||
@ -1985,7 +1985,7 @@ export class UserAPI {
|
||||
};
|
||||
|
||||
all = (operation: EventOperation<AbstractEvent>): true => {
|
||||
AbstractEvent.prototype.chainAll = function (...args: any[]) {
|
||||
AbstractEvent.prototype.chainAll = function(...args: any[]) {
|
||||
return operation(this, ...args);
|
||||
};
|
||||
return true;
|
||||
|
||||
@ -25,7 +25,7 @@ ${makeExample(
|
||||
beat(1) && active_notes() && sound('sine').chord(active_notes()).out()
|
||||
`,
|
||||
true,
|
||||
)}
|
||||
)}
|
||||
|
||||
${makeExample(
|
||||
"Play active notes as arpeggios",
|
||||
@ -35,7 +35,7 @@ ${makeExample(
|
||||
).cutoff(300 + usine(1/4) * 2000).out()
|
||||
`,
|
||||
false,
|
||||
)}
|
||||
)}
|
||||
|
||||
|
||||
* <ic>sticky_notes(channel?: number)</ic>: returns array of the last pressed keys as an array of MIDI note numbers (0-127). Notes are added and removed from the list with the "Note on"-event. Returns undefined if no keys have been pressed.
|
||||
@ -47,7 +47,7 @@ ${makeExample(
|
||||
.note(sticky_notes().palindrome().beat(0.25)).out()
|
||||
`,
|
||||
true,
|
||||
)}
|
||||
)}
|
||||
|
||||
* <ic>last_note(channel?: number)</ic>: returns the last note that has been received. Returns 60 if no other notes have been received.
|
||||
|
||||
@ -59,7 +59,7 @@ ${makeExample(
|
||||
.vibmod([1,3,2,4].beat(2)).out()
|
||||
`,
|
||||
false,
|
||||
)}
|
||||
)}
|
||||
|
||||
* <ic>buffer()</ic>: return true if there are notes in the buffer.
|
||||
* <ic>buffer_note(channel?: number)</ic>: returns last unread note that has been received. Note is fetched and removed from start of the buffer once this is called. Returns undefined if no notes have been received.
|
||||
@ -70,7 +70,7 @@ ${makeExample(
|
||||
beat(1) && buffer() && sound('sine').note(buffer_note()).out()
|
||||
`,
|
||||
false,
|
||||
)}
|
||||
)}
|
||||
|
||||
|
||||
|
||||
@ -80,33 +80,33 @@ ${makeExample(
|
||||
Midi CC messages can be used to control any value in Topos. MIDI input can be defined in Settings and last received CC message can be used to control any numeric value within Topos.
|
||||
|
||||
Currently supported methods for CC input are:
|
||||
* <ic>last_cc(control: number, channel?: number)</ic>: Returns last received CC value for given control number (and optional channel). By default last CC value is last value from ANY channel or 64 if no CC messages have been received.
|
||||
* <ic>ccIn(control: number, channel?: number)</ic>: Returns last received CC value for given control number (and optional channel). By default last CC value is last value from ANY channel or 64 if no CC messages have been received.
|
||||
|
||||
${makeExample(
|
||||
"Play notes with cc",
|
||||
`
|
||||
beat(0.5) && sound('arp').note(last_cc(74)).out()
|
||||
beat(0.5) && sound('arp').note(ccin(74)).out()
|
||||
`,
|
||||
true,
|
||||
)}
|
||||
)}
|
||||
|
||||
${makeExample(
|
||||
"Control everything with CCs",
|
||||
`
|
||||
beat(0.5) :: sound('sine')
|
||||
.freq(last_cc(75)*3)
|
||||
.cutoff(last_cc(76)*2*usine())
|
||||
.freq(ccIn(75)*3)
|
||||
.cutoff(ccIn(76)*2*usine())
|
||||
.sustain(1.0)
|
||||
.out()
|
||||
|
||||
beat(last_cc(74)/127*.5) :: sound('sine')
|
||||
.freq(last_cc(75)*6)
|
||||
.cutoff(last_cc(76)*3*usine())
|
||||
.sustain(last_cc(74)/127*.25)
|
||||
beat(ccIn(74)/127*.5) :: sound('sine')
|
||||
.freq(ccIn(75)*6)
|
||||
.cutoff(ccIn(76)*3*usine())
|
||||
.sustain(ccIn(74)/127*.25)
|
||||
.out()
|
||||
`,
|
||||
false,
|
||||
)}
|
||||
)}
|
||||
|
||||
|
||||
## Run scripts with MIDI
|
||||
@ -129,7 +129,7 @@ ${makeExample(
|
||||
"Show scale on external keyboard",
|
||||
`show_scale("F","aeolian",0,4)`,
|
||||
true,
|
||||
)}
|
||||
)}
|
||||
|
||||
${makeExample("Hide scale", `hide_scale("F","aeolian",0,4)`, true)}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user