From: Eugene Petkevich Date: Sat, 21 May 2022 17:00:05 +0000 (+0300) Subject: Fix led control / add starter animation X-Git-Url: https://git.zuelum.org/?a=commitdiff_plain;h=b810773177e32ffaad2fb2124567c26fd9c2630e;p=scprojects.git Fix led control / add starter animation --- diff --git a/extensions/classes/midimix.sc b/extensions/classes/midimix.sc index 23fdb6d..c92316b 100644 --- a/extensions/classes/midimix.sc +++ b/extensions/classes/midimix.sc @@ -1,8 +1,8 @@ MidiMix { - const caro; var <>joro, <>viro, <>wipu, <>wire; @@ -10,19 +10,19 @@ MidiMix { var <>sewo, <>luwo, <>fewo, <>viwo; var <>sypu, <>syre; - *new { - if (instance == nil) { - ledValues = IdentityDictionary[ - \on -> 127, - \light -> 127, - true -> 127, - \off -> 0, - \dark -> 0, - false -> 0 - ]; - instance = super.new.prInit; - }; - ^instance + *initClass { + ledValues = IdentityDictionary[ + \on -> 127, + \light -> 127, + true -> 127, + \off -> 0, + \dark -> 0, + false -> 0 + ]; + } + + *new {|name=\Mix101| + ^super.newCopyArgs(name).prInit; } prInit { @@ -38,6 +38,7 @@ MidiMix { // MIDI out channel selector (back of the device) // velocity is the channel MIDIdef.noteOn(\caro+name, {|...args| + channel = args[0]; caro.value(*args); }, 14, srcID: idin); @@ -92,15 +93,32 @@ MidiMix { MIDIdef.noteOn(\viwo+name, {|...args| viwo.value(*args); }, 20, srcID: idin); + + // Starter message and animation + this.animate; + "Шаҫиху готов к использованию 😊".postln; } // == LED control // pfl a leda {|value=true| value = ledValues[value] ? value; - (0..15).do {|i| - [i, value].postln; - midiout.noteOn(i, 1, value); - }; + midiout.noteOn(channel, 1, value); } + + animate {|stretch=1| + { + ((1..4)++(7..9)++(17..20)).do {|i| + midiout.noteOn(channel, i, 127); + (0.1*stretch).wait; + }; + stretch.wait; + ((1..4)++(7..9)++(17..20)).do {|i| + midiout.noteOn(channel, i, 0); + (0.1*stretch) + }; + midiout.noteOn(channel, 17, 127); + }.fork(); + } + } \ No newline at end of file diff --git "a/\320\245\321\215\320\267\320\270\321\204\321\203/mix101-control.scd" "b/\320\245\321\215\320\267\320\270\321\204\321\203/mix101-control.scd" index 40c8a9e..a41d1cb 100644 --- "a/\320\245\321\215\320\267\320\270\321\204\321\203/mix101-control.scd" +++ "b/\320\245\321\215\320\267\320\270\321\204\321\203/mix101-control.scd" @@ -23,12 +23,22 @@ MIDIdef.sysex(\testsysex, {|...args| ) ~mix = MidiMix(); -~mix.leda(127); -~mout = MIDIOut.newByName("Mix-101", "Mix-101").latency_(0); -~mout.noteOn(5, 1, 127); +~mix.ledb(\off); +~mout = MIDIOut.newByName("Mix-101", "Mix-101 MIDI 1").latency_(0); +~mix. +~mout.noteOn(5, 20, 127); + +( +(0..15).do {|i| + [i].postln; + ~mout.noteOn(i, 2, 0); +}; +) ( ~mix.joro = {|...args| args.postln; }; -) \ No newline at end of file +) + +~mix = MidiMix() \ No newline at end of file diff --git "a/\320\245\321\215\320\267\320\270\321\204\321\203/push-control.scd" "b/\320\245\321\215\320\267\320\270\321\204\321\203/push-control.scd" index fdc2437..1cbe5f7 100644 --- "a/\320\245\321\215\320\267\320\270\321\204\321\203/push-control.scd" +++ "b/\320\245\321\215\320\267\320\270\321\204\321\203/push-control.scd" @@ -256,7 +256,6 @@ }; // Starter message and animation - { (0..127).do({|i| ~push.pushOut.noteOn(0, i, 1);