Thanks Eduardo
This seems to be half of the solution. But what does this mean in java-code …
I suppose you can do almost any kind of tricks utilising pointers and casting in c-code.
I’m not sure how to do the same in java…
Here are some pieces of code in java and the question after that.
First object creation:
CsoundMYFLTArray CtNbrChannel = new CsoundMYFLTArray();
…
c.GetChannelPtr(CtNbrChannel.GetPtr(), “CtNbr”, …
…
And usage, setting a single value e.g.:
CtNbrChannel.SetValue(0, (double) 0);
As you can guess the Channel requires double as the actual value java data-type and some
integer argument 0.
The java-help (in Eclipse) tells about that method:
void csnd6.CsoundMYFLTArray.SetValue(int arg0, double arg1)
So now the question is how is it possible to feed a double-array as an argument instead of a double scalar here ?
One guess that I have in mind is that it could be enough to use the 1’st element of a double array as the value-argument.
If the internal behaviour of the API is such that only pointers are in use, then referring to the first element of a double-array
would point to the whole array at the same time …hmmm, just guessing.
Then I could have in java:
// an array definition
double Cnbr = { 71,72,73,74,75,76,77,78 };
…
And usage:
CtNbrChannel.SetValue(0, Cnbr[0]);
Still wondering what should the value of the arg0 ?
Does anyone have better information about this ?
–Risto
pe 11. lokak. 2024 klo 0.54 Eduardo Moguillansky (eduardo.moguillansky@gmail.com) kirjoitti:
I made an opcode pair (ref/deref) which can be used to pass an array by reference (https://csound-plugins.github.io/csound-plugins/opcodes/ref.html). In this case you can use a scalar channel:
--nosound
sr = 44100
ksmps = 64
nchnls = 2
0dbfs = 1
instr 1
karr fillarray 1, 2, 3, 4
chnset ref(karr), “mychan”
turnoff
endin
instr 2
karr2 deref chnget(“mychan”)
printarray karr2
turnoff
endin
i 1 0 1
i 2 0 1
hello everybody,
i have a problem with using the chnset and chnget opcodes.
i want to send an array of k values with chnset to a destination which also expects a k-array.
but the console tells me i do something wrong with at leats chnset and the examples in the manual did not help me.
this is my sketch. what do i do wrong?
// sending
kMidiData ctrlsave 1,
0,1,2,3,4,5,6,7,8,9,10,
11,12,13,14,15
chnset kMidiData, "midiData_faderfoxec4“
// receiving
kPreset ctrlpreset p4, chnget(“midiData_faderfoxec4”)
Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here
Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here
Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here