Csound Csound-dev Csound-tekno Search About

[Csnd] help with csoundScoreEvent()

Date2012-11-28 19:22
FromBlaz 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

Date2012-11-28 19:48
FromRory Walsh
SubjectRe: [Csnd] help with csoundScoreEvent()
Can you post the code?

On 28 November 2012 19:22, Blaz Jakopin  wrote:
> 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

Date2012-11-28 19:49
FromRory Walsh
SubjectRe: [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  wrote:
> Can you post the code?
>
> On 28 November 2012 19:22, Blaz Jakopin  wrote:
>> 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

Date2012-11-28 19:59
FromBlaz Jakopin
SubjectRe: [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?

On 28 November 2012 19:48, Rory Walsh <rorywalsh@ear.ie> wrote:
> Can you post the code?
>
> On 28 November 2012 19:22, Blaz Jakopin <jakopinorama@gmail.com> wrote:
>> 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


Send bugs reports to the Sourceforge bug tracker
            https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"



Date2012-11-28 20:04
FromBlaz Jakopin
SubjectRe: [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:
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?

On 28 November 2012 19:48, Rory Walsh <rorywalsh@ear.ie> wrote:
> Can you post the code?
>
> On 28 November 2012 19:22, Blaz Jakopin <jakopinorama@gmail.com> wrote:
>> 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


Send bugs reports to the Sourceforge bug tracker
            https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"




Date2012-11-28 20:05
FromBlaz Jakopin
SubjectRe: [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:
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:
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?

On 28 November 2012 19:48, Rory Walsh <rorywalsh@ear.ie> wrote:
> Can you post the code?
>
> On 28 November 2012 19:22, Blaz Jakopin <jakopinorama@gmail.com> wrote:
>> 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


Send bugs reports to the Sourceforge bug tracker
            https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"





Date2012-11-28 20:31
FromBlaz Jakopin
SubjectRe: [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


On Wed, Nov 28, 2012 at 9:04 PM, Blaz Jakopin <jakopinorama@gmail.com> wrote:
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:
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?

On 28 November 2012 19:48, Rory Walsh <rorywalsh@ear.ie> wrote:
> Can you post the code?
>
> On 28 November 2012 19:22, Blaz Jakopin <jakopinorama@gmail.com> wrote:
>> 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


Send bugs reports to the Sourceforge bug tracker
            https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"