Dumb table question


#1

Hi, I'm quasi code literate, but I can't figure this out. I have a patch that uses a table to store midi notes. I am able to store and retrieve notes on the fly, but I want to prepopulate the table with a list of note values. I just want to type in a list of 16 note numbers, but I can't figure out how to format it correctly. Help?
Thanks!


#2

You could just make a simple array, like this, in local data:
int Array[8]{10,20,30,40,50,60,70,80};

And play it back like this from k-rate:
outlet_out= Array[inlet_in];


#3

Right idea, but incorrect. Try:
int Array[8]={10,20,30,40,50,60,70,80};


#4

I don't think it's wrong. The patch builds and works and so does the array. What you wrote there is just another way of doing the same.

int Array[8]{10,20,30,40,50,60,70,80};

... Works fine. I just double checked to be sure.


#5

Ahh, yes. Must be a C++ thing. (long-time C coder, grudgingly familiar with C++); I should have tested it before writing.

It works on some compilers, not others. For instance, it doesn't work with the compiler installed by Xcode on my Mac (clang-1001.0.46.4), does work with the cross-compiler for Axoloti.

This is the kind of thing I dislike about C++.


#6

Thanks for the help! I tried the first one and realized it didn’t work, but haven’t had time to dig into it again yet.


#7

Yeah I should probably just change it to do what you said, to follow the paradigm and to make it more logical.

I only know c++, so not sure how about other languages.


#8

Try this here:
Array .axp (2.0 KB)