Csound Csound-dev Csound-tekno Search About

[Cs-dev] bug in csoundScoreEvent()

Date2008-07-23 14:54
FromVictor Lazzarini
Subject[Cs-dev] bug in csoundScoreEvent()
...possibly not there but somewhere else. However it is through
this API function that I identitied it. Test program:

int main(int argc, char** argv){
   CSOUND *cs;
   int res;
   MYFLT f[3] =  {1.0,0.0,2.0};
   csoundInitialize(&argc, &argv, 0);
   cs  = csoundCreate(NULL);
   res =csoundCompile(cs, argc,argv);
   csoundScoreEvent(cs, 'i',f, 3);
   while(res == 0) res =csoundPerformKsmps(cs);
   csoundReset(cs);
}

with CSD




-odac



sr= 44100
ksmps = 64
nchnls= 1

instr 1
a1 rand 16000
    out a1
endin


f0 5



prints out:

SECTION 1:
insert_score_event(): invalid instrument number or name

============
if I use csoundInputMessage(cs, "i1 0 2") instead, no such problem occurs.

clues anyone?

Victor



Victor Lazzarini
Music Technology Laboratory
Music Department
National University of Ireland, Maynooth 


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2008-07-23 15:25
FromVictor Lazzarini
Subject[Cs-dev] what am I doing wrong?
this is csoundScoreEvent() in Top/csound.c, with a little printout added:

PUBLIC int csoundScoreEvent(CSOUND *csound, char type,
                               const MYFLT *pfields, long numFields)
   {
     EVTBLK  evt;
     int     i;

     evt.strarg = NULL;
     evt.opcod = type;
     evt.pcnt = (int16) numFields;
     for (i = 0; i < (int) numFields; i++){
       evt.p[i + 1] = pfields[i];
       /* I added this to printout the values of pfields */
       csoundMessage(csound, "%c => p%d=%f\n",type,i+1, pfields[i]);
     }
     return insert_score_event(csound, &evt, csound->curTime);
   }


Running my program as before I get:

p1=0.000000
p2=0.000000
p3=0.000000

why are the values in my array not being passed?
Could anyone show me please where I am going wrong?

Victor

At 14:54 23/07/2008, you wrote:

>...possibly not there but somewhere else. However it is through
>this API function that I identitied it. Test program:
>
>int main(int argc, char** argv){
>    CSOUND *cs;
>    int res;
>    MYFLT f[3] =  {1.0,0.0,2.0};
>    csoundInitialize(&argc, &argv, 0);
>    cs  = csoundCreate(NULL);
>    res =csoundCompile(cs, argc,argv);
>    csoundScoreEvent(cs, 'i',f, 3);
>    while(res == 0) res =csoundPerformKsmps(cs);
>    csoundReset(cs);
>}
>
>with CSD
>
>
>
>
>-odac
>
>
>
>sr= 44100
>ksmps = 64
>nchnls= 1
>
>instr 1
>a1 rand 16000
>     out a1
>endin
>
>
>f0 5
>
>
>
>prints out:
>
>SECTION 1:
>insert_score_event(): invalid instrument number or name
>
>============
>if I use csoundInputMessage(cs, "i1 0 2") instead, no such problem occurs.
>
>clues anyone?
>
>Victor
>
>
>
>Victor Lazzarini
>Music Technology Laboratory
>Music Department
>National University of Ireland, Maynooth
>
>
>-------------------------------------------------------------------------
>This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
>Build the coolest Linux based applications with Moblin SDK & win great prizes
>Grand prize is a trip for two to an Open Source event anywhere in the world
>http://moblin-contest.org/redirect.php?banner_id=100&url=/
>_______________________________________________
>Csound-devel mailing list
>Csound-devel@lists.sourceforge.net
>https://lists.sourceforge.net/lists/listinfo/csound-devel

Victor Lazzarini
Music Technology Laboratory
Music Department
National University of Ireland, Maynooth 


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2008-07-23 15:30
FromVictor Lazzarini
Subject[Cs-dev] I should think before asking...
I was using a 64bit libcsound, but compiling without -DUSE_DOUBLE.

...the reason I came to this was because of reports of csoundScoreEvent()
misbehaviour. But it comes down to mixing versions....

Regards

Victor

At 15:25 23/07/2008, you wrote:
>this is csoundScoreEvent() in Top/csound.c, with a little printout added:
>
>PUBLIC int csoundScoreEvent(CSOUND *csound, char type,
>                                const MYFLT *pfields, long numFields)
>    {
>      EVTBLK  evt;
>      int     i;
>
>      evt.strarg = NULL;
>      evt.opcod = type;
>      evt.pcnt = (int16) numFields;
>      for (i = 0; i < (int) numFields; i++){
>        evt.p[i + 1] = pfields[i];
>        /* I added this to printout the values of pfields */
>        csoundMessage(csound, "%c => p%d=%f\n",type,i+1, pfields[i]);
>      }
>      return insert_score_event(csound, &evt, csound->curTime);
>    }
>
>
>Running my program as before I get:
>
>p1=0.000000
>p2=0.000000
>p3=0.000000
>
>why are the values in my array not being passed?
>Could anyone show me please where I am going wrong?
>
>Victor
>
>At 14:54 23/07/2008, you wrote:
>
> >...possibly not there but somewhere else. However it is through
> >this API function that I identitied it. Test program:
> >
> >int main(int argc, char** argv){
> >    CSOUND *cs;
> >    int res;
> >    MYFLT f[3] =  {1.0,0.0,2.0};
> >    csoundInitialize(&argc, &argv, 0);
> >    cs  = csoundCreate(NULL);
> >    res =csoundCompile(cs, argc,argv);
> >    csoundScoreEvent(cs, 'i',f, 3);
> >    while(res == 0) res =csoundPerformKsmps(cs);
> >    csoundReset(cs);
> >}
> >
> >with CSD
> >
> >
> >
> >
> >-odac
> >
> >
> >
> >sr= 44100
> >ksmps = 64
> >nchnls= 1
> >
> >instr 1
> >a1 rand 16000
> >     out a1
> >endin
> >
> >
> >f0 5
> >
> >
> >
> >prints out:
> >
> >SECTION 1:
> >insert_score_event(): invalid instrument number or name
> >
> >============
> >if I use csoundInputMessage(cs, "i1 0 2") instead, no such problem occurs.
> >
> >clues anyone?
> >
> >Victor
> >
> >
> >
> >Victor Lazzarini
> >Music Technology Laboratory
> >Music Department
> >National University of Ireland, Maynooth
> >
> >
> >-------------------------------------------------------------------------
> >This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> >Build the coolest Linux based applications with Moblin SDK & win 
> great prizes
> >Grand prize is a trip for two to an Open Source event anywhere in the world
> >http://moblin-contest.org/redirect.php?banner_id=100&url=/
> >_______________________________________________
> >Csound-devel mailing list
> >Csound-devel@lists.sourceforge.net
> >https://lists.sourceforge.net/lists/listinfo/csound-devel
>
>Victor Lazzarini
>Music Technology Laboratory
>Music Department
>National University of Ireland, Maynooth
>
>
>-------------------------------------------------------------------------
>This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
>Build the coolest Linux based applications with Moblin SDK & win great prizes
>Grand prize is a trip for two to an Open Source event anywhere in the world
>http://moblin-contest.org/redirect.php?banner_id=100&url=/
>_______________________________________________
>Csound-devel mailing list
>Csound-devel@lists.sourceforge.net
>https://lists.sourceforge.net/lists/listinfo/csound-devel

Victor Lazzarini
Music Technology Laboratory
Music Department
National University of Ireland, Maynooth 


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net