[Csnd] help with csoundScoreEvent()
Date | 2012-11-28 19:22 |
From | Blaz Jakopin |
Subject | [Csnd] help with csoundScoreEvent() |
Hello! I have a few questions about Csound API. I've been working with Rory Walsh's API manual, and it's been very useful so far, but when I get to the csoundScoreEvent() function use, I get confused.
I've modified the code as requested by the manual, but I get a Run-Time Check error #3 saying that the variable userInput is being used without being initialized. Can someone help me with this?
Another thing I dont't quite understand is how the instrument or. the csd file should communicate with the program. What do you have to initialize in the csd file to make it accept 5 p-fields. Is it a similar command as with chnget?
Thanks for your help! Best regard, Blaz
|
Date | 2012-11-28 19:48 |
From | Rory Walsh |
Subject | Re: [Csnd] help with csoundScoreEvent() |
Can you post the code? On 28 November 2012 19:22, Blaz Jakopin |
Date | 2012-11-28 19:49 |
From | Rory Walsh |
Subject | Re: [Csnd] help with csoundScoreEvent() |
And do you mean the tutorial online, or the one from the Audio programming book? On 28 November 2012 19:48, Rory Walsh |
Date | 2012-11-28 19:59 |
From | Blaz Jakopin |
Subject | Re: [Csnd] help with csoundScoreEvent() |
I think I found an answer to the first problem. It may seem trivial, but I had to modified the userInput variable to be initialized in this manner: const double *userInput; const double p[5] = {2000.0, 0.0, 4.0, 10.0, 1.0}; userInput = &p[0]; and now the program works fine. But I still do not understand how to modify the cds file to accept this p-fields being sent.
I apologize if the questions are trivial, and thank for your help. Blaz On Wed, Nov 28, 2012 at 8:49 PM, Rory Walsh <rorywalsh@ear.ie> wrote: And do you mean the tutorial online, or the one from the Audio programming book? |
Date | 2012-11-28 20:04 |
From | Blaz Jakopin |
Subject | Re: [Csnd] help with csoundScoreEvent() |
Oh, and I get this in the program, after setting the arguments for the p - fields: Usage: p1 p2 p3 p4 p5 Enter 0 for p1 to quit new alloc for instr 1: new alloc for instr 2: 1 0 20 10000 400 insert_score_event(): invalid instrument number or name On Wed, Nov 28, 2012 at 8:59 PM, Blaz Jakopin <jakopinorama@gmail.com> wrote:
|
Date | 2012-11-28 20:05 |
From | Blaz Jakopin |
Subject | Re: [Csnd] help with csoundScoreEvent() |
I am working with: Introduction to using the Csound Host API On Wed, Nov 28, 2012 at 9:04 PM, Blaz Jakopin <jakopinorama@gmail.com> wrote:
|
Date | 2012-11-28 20:31 |
From | Blaz Jakopin |
Subject | Re: [Csnd] help with csoundScoreEvent() |
And the code: int main(int argc, char *argv[]) { int userInput1=200; int userInput2=200; const double *userInput; const double p[5] = {2000.0, 0.0, 4.0, 10.0, 1.0}; userInput = &p[0]; MYFLT ftable[5] = {1, 0, 4096, 10, 1}; void* ThreadID; userData* ud; ud = (userData *)malloc(sizeof(userData)); MYFLT* pvalue1; MYFLT* pvalue2; ud->csound=csoundCreate(NULL); csoundInitialize(&argc, &argv, 0); ud->result=csoundCompile(ud->csound,argc,argv); if(!ud->result) { ud->PERF_STATUS=1; ThreadID = csoundCreateThread(csThread, (void*)ud); } else { printf("csoundCompiled returned an error"); return 0; } printf("\n Usage: p1 p2 p3 p4 p5\nEnter 0 for p1 to quit\n"); while(1) { for(int i=0;i<5;i++) scanf("%f", &userInput[i]); if(userInput[0]<1) { ud->PERF_STATUS=0; break; } csoundScoreEvent(ud->csound, 'f', ftable, 5); csoundScoreEvent(ud->csound, 'i', userInput, 5); } ud->PERF_STATUS=0; return ud->result; } On Wed, Nov 28, 2012 at 9:05 PM, Blaz Jakopin <jakopinorama@gmail.com> wrote: I am working with: Introduction to using the Csound Host API |