Hey all!
I can see one possible issue, that is your call to ctrlpreset. The manual, even the online version gives the syntax as:
kpreset ctrlpreset ktag, kchnl, kctlno1, [kctlno2] [, kctlno3] …
In the manual as example is the array version used. And it’s working. The manual is not that precise with these opcodes.When you print this with ‚ctrlprintpresets‘ you get the right syntax, even with the preset number and channel.
One point, which is pure curiosity: why did you chose a UDO to read the note values and a macro to update the MIDI CC values? Coincidence or design?
I’m still experimenting with how i can streamline some of my code blocks. I guess, when i have this running i will use it very often.
I allredy have some midi input related UDOs but maybe i will combine these UDOs and some macros. i don’t know yet.
You might consider altering schedkwhen to schedule.
Schedkwhen was definitley a problem! i used ‚event’ now for this.
And with my i code later in the mail i also got it running. But it’s still not reliable enough, or i don’t get how ctrlpreset and ctrlprintpresets is executed.
So can someone who worked on these opcodes explain me what is happening there?
When i write the preset file with ‚ctrlprintpresets‘, i get a new ‚block‘ of presets every time i call csound new and save new presets.
How is ctrlpreset handling these blocks? is it just reading the newest one?
As example:
first call of csound
kpre41 ctrlpreset 41 , 1, 10, 64, 11, 127, 12, 0, 13, 0, 14, 0, 15, 0, 16, 0, 17, 0
second call
kpre41 ctrlpreset 41 , 1, 10, 64, 11, 127, 12, 0, 13, 0, 14, 0, 15, 0, 16, 0, 17, 0
kpre42 ctrlpreset 42 , 1, 10, 64, 11, 127, 12, 0, 13, 0, 14, 0, 15, 0, 16, 0, 17, 0
third call
kpre41 ctrlpreset 41 , 1, 10, 127, 11, 0, 12, 0, 13, 0, 14, 0, 15, 0, 16, 0, 17, 0
fourth call
kpre41 ctrlpreset 41 , 1, 10, 127, 11, 0, 12, 0, 13, 0, 14, 0, 15, 0, 16, 0, 17, 0
kpre42 ctrlpreset 42 , 1, 10, 127, 11, 127, 12, 127, 13, 0, 14, 0, 15, 0, 16, 0, 17, 0
Another question related to this opcode:
How much time needs it to write to the file?
I just wanted to call a designated instrument just for one k-cycle to write a new preset. Is this enough?
Also sometimes when i saved a preset to the file ‚ctrlpreset‘ is not able to call it. I don’t know yet what is happening there.
This iy my code right now:
-m0d
-d -odac -W -3 -+rtmidi=portmidi -Ma -Q0
sr = 44100
ksmps = 32
nchnls = 2
0dbfs = 1.0
#define UPDATE_CC(Chn’CC)