I'm building an external where I want to create a two dimensional array. I'm following this http://www.tutorialspoint.com/cprogramming/c_multi_dimensional_arrays.htm example which works well with the attached test code, but creates an error when I try to compile my external. The external's code where the array is being declared and initialized is this: float x_iem_coeff[5][2] = { {0.045535, 1.0277}, {0.161621, 1.2569}, {0.393858, 1.96655}, {1.13986, 4.51667}, {6.36341, 22.7468} };
which is in the object structure. The error I get is: overDrive~.c:35:25: error: expected ';' at end of declaration list float x_iem_coeff[5][2] = { ^ ;
I've tried to declare the array in the object structure and initialize it in the new function, but I still got the same error. Any tips?
I solved it by declaring the array in the object structure like this: float x_iem_coeff[5][2];
and in the new function I create another, one dimensional array, and run a nested for loop and set the local array's elements to x_iem_coeff[5][2] one by one. This seemed to work, no errors during compilation. The object crashes Pd when the DSP is turned on, but I guess (and think) it's something else that causes that. The array declaration and initialization shouldn't have anything to do with the DSP state, right?
On Sun, Jul 27, 2014 at 7:41 PM, Alexandros Drymonitis adrcki@gmail.com wrote:
I'm building an external where I want to create a two dimensional array. I'm following this http://www.tutorialspoint.com/cprogramming/c_multi_dimensional_arrays.htm example which works well with the attached test code, but creates an error when I try to compile my external. The external's code where the array is being declared and initialized is this: float x_iem_coeff[5][2] = { {0.045535, 1.0277}, {0.161621, 1.2569}, {0.393858, 1.96655}, {1.13986, 4.51667}, {6.36341, 22.7468} };
which is in the object structure. The error I get is: overDrive~.c:35:25: error: expected ';' at end of declaration list float x_iem_coeff[5][2] = { ^ ;
I've tried to declare the array in the object structure and initialize it in the new function, but I still got the same error. Any tips?
On 07/27/2014 01:05 PM, Alexandros Drymonitis wrote:
I solved it by declaring the array in the object structure like this: float x_iem_coeff[5][2];
and in the new function I create another, one dimensional array, and run a nested for loop and set the local array's elements to x_iem_coeff[5][2] one by one. This seemed to work, no errors during compilation. The object crashes Pd when the DSP is turned on, but I guess (and think) it's something else that causes that. The array declaration and initialization shouldn't have anything to do with the DSP state, right?
On Sun, Jul 27, 2014 at 7:41 PM, Alexandros Drymonitis <adrcki@gmail.com mailto:adrcki@gmail.com> wrote:
I'm building an external where I want to create a two dimensional array. I'm following this <http://www.tutorialspoint.com/cprogramming/c_multi_dimensional_arrays.htm> example which works well with the attached test code, but creates an error when I try to compile my external. The external's code where the array is being declared and initialized is this: float x_iem_coeff[5][2] = { {0.045535, 1.0277}, {0.161621, 1.2569}, {0.393858, 1.96655}, {1.13986, 4.51667}, {6.36341, 22.7468} }; which is in the object structure. The error I get is: overDrive~.c:35:25: error: expected ';' at end of declaration list float x_iem_coeff[5][2] = { ^ ; I've tried to declare the array in the object structure and initialize it in the new function, but I still got the same error. Any tips?
In C, you can't initialize inside a struct. But you should be able to initialize outside of it. What's the error you get when you try that?
-Jonathan
Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
I was getting the same error, but what I was doing was this: In the object structure I would write: float x_iem_filter[5][2];
and in the new function I would write: x->x_iem_filter[5][2] = { {0.1, 0.2}, {0.3, 0.4}, etc.
different values though, this is an example. Then I would get the error: overDrive~.c:35:25: error: expected ';' at end of declaration list float x_iem_coeff[5][2] = {
What I finally did was create a one dimensional array in the new structure like this: float iem_filter[10] = { ten values here };
and in the same function I run this: for(i = 0; i < 5; i++){ for(j = 0; j < 2; j++) x->x_iem_filter[i][j] = iem_filter[index++]; }
which seems to work
On Sun, Jul 27, 2014 at 9:46 PM, Jonathan Wilkes via Pd-list < pd-list@lists.iem.at> wrote:
On 07/27/2014 01:05 PM, Alexandros Drymonitis wrote:
I solved it by declaring the array in the object structure like this: float x_iem_coeff[5][2];
and in the new function I create another, one dimensional array, and run a nested for loop and set the local array's elements to x_iem_coeff[5][2] one by one. This seemed to work, no errors during compilation. The object crashes Pd when the DSP is turned on, but I guess (and think) it's something else that causes that. The array declaration and initialization shouldn't have anything to do with the DSP state, right?
On Sun, Jul 27, 2014 at 7:41 PM, Alexandros Drymonitis adrcki@gmail.com wrote:
I'm building an external where I want to create a two dimensional array. I'm following this http://www.tutorialspoint.com/cprogramming/c_multi_dimensional_arrays.htm example which works well with the attached test code, but creates an error when I try to compile my external. The external's code where the array is being declared and initialized is this: float x_iem_coeff[5][2] = { {0.045535, 1.0277}, {0.161621, 1.2569}, {0.393858, 1.96655}, {1.13986, 4.51667}, {6.36341, 22.7468} };
which is in the object structure. The error I get is: overDrive~.c:35:25: error: expected ';' at end of declaration list float x_iem_coeff[5][2] = { ^ ;
I've tried to declare the array in the object structure and initialize it in the new function, but I still got the same error. Any tips?
In C, you can't initialize inside a struct. But you should be able to initialize outside of it. What's the error you get when you try that?
-Jonathan
_______________________________________________Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256
On 2014-07-28 09:48, Alexandros Drymonitis wrote:
different values though, this is an example. Then I would get the error: overDrive~.c:35:25: error: expected ';' at end of declaration list
it might help very much if you could link to the actual code you are talking about (or post it)¹
float x_iem_coeff[5][2] = {
out of curiosity: are there any specific reasons why you use the "iem" infix? it somehow sounds familiar....
fgasdr IOhannes
¹ and probably to pd-dev; but that's minor
On Mon, Jul 28, 2014 at 11:30 AM, IOhannes m zmoelnig zmoelnig@iem.at wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256
On 2014-07-28 09:48, Alexandros Drymonitis wrote:
different values though, this is an example. Then I would get the error: overDrive~.c:35:25: error: expected ';' at end of declaration list
it might help very much if you could link to the actual code you are talking about (or post it)¹
I'm not getting an error any more, it compiles and a d_fat binary is created. It still crushes Pd when the DSP is turned on, but since the initalization of the array is being done when the object is being loaded, before the DSP goes on, it should be something else that crashes Pd, right? I'm still porting here since I started the thread here. I guess moving it to pd-dev wouldn't be painful though.
float x_iem_coeff[5][2] = {
out of curiosity: are there any specific reasons why you use the "iem" infix? it somehow sounds familiar....
Yup, I'm trying to convert Mike Moser-Booth's [distortion.mmb~] abstraction into an external and he uses the [lp10_cheb~] abstraction which is based on iemlib's [filter~]. There are five cascaded [lp2c~] abstractions, hence the two dimensional array I want to use. I'm trying to call a function from the perform routine, which simulates [filter~]'s code, five time and each time set different coefficients (The ones given from [lp2c~]).
fgasdr IOhannes
¹ and probably to pd-dev; but that's minor -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 Comment: Using GnuPG with Icedove - http://www.enigmail.net/
iQIcBAEBCAAGBQJT1gogAAoJELZQGcR/ejb4sMsQAIwo04OskvGAKDp8+dTIVWt0 jheKziil1EQT269/z6Ki1dXhX1JjcpCjdgAMo8PtOdozrKoz3+5bpGZlYe7cra8t yzt94l0Nj2oHfAOcIpptGXZ8EpDXDN15G65qvLmGxIQTpBFKksMM1JH5E7M0HR/S xHBxLEJtBeaxcKwVyxBzq7dTp11PHiCXc7a/Ewu7kYVeoDnCFNC4rm0atHS/LSel mLiI43B3AHzcZNgxWSl0aSCXvGsSPSKK6QpWV+VEeA/Fayf5Bx6Txctje0bIDpvk 2OGbr6TNYXN173o6cA5bnxdm4hZ9b7Ib8NR5nZ6WraKqpF+GpxEUqcZYZCn8rZ9U Qdg8rOSpEEJUBCOqH7qqg7lnseowf3OmTLumQ0XkwbqMp9avIo6v2S3C5n7VfyHM lag+OoVFc/+X7hXqr1hABXFLlPuMcw4lDbYufM1xNuJbBMUbwBxEwcwi9908rnZR Pi3UfYPzLYGZIlQYP32yOqkz9pbJsH/4USh6nrOEaa+p4A+lQZDn8eo8UZYHzfUh KjN0d1cS6YmAE3+FW+blyKJwz3cSYwreVSEmiF+XSvcnpUUDOZekNkTzTeqcd7jW wAY7OX5YXtdwlNUQ1IjjRVkMayWQVR3ww1NxIadZxIzn4dHKMsZSTvnCIqXqYcJh 7Qitoq8q78Dgqkx4NntD =cQMw -----END PGP SIGNATURE-----
Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list