Do you have a score line to activate the instrument?
If not, you can add

csoundInputMessage(csound, "i1 0 10000");

just before you start the thread.

Victor

----- Original Message -----
From: Josh Brown <lovell_josh@hotmail.co.uk>
Date: Tuesday, April 27, 2010 3:34 am
Subject: [Cs-dev] Performance thread using the csound api in c.
To: csound-devel@lists.sourceforge.net

>
> Hello, not sure if I'm at the appropriate place but can anyone
> tell me why I don't get any sound with this program:
>
> #include "H/csound.h"
>
> #include
> uintptr_t csThread(void *clientData);
> typedef struct {
>
> int
> result;                                 //result of csoundCompile()
>
> CSOUND*
> csound;                         //instane of Csound
>
> int
> PERF_STATUS;                 //tells us if Csound is running
>
> }userData;
> //------------------------------------------------------------
>
> int main(int argc, char *argv[])
>
> {
>
> int userInput=200;
>
> void* ThreadID;
>
> userData* ud;
>
> ud = (userData *)malloc(sizeof(userData));
>
> MYFLT* pvalue;
>
> 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("\nEnter a pitch in Hz(0 to Exit) and type return\n");
>
> while(userInput!=0)
>
>       {
>
>       if(csoundGetChannelPtr(ud-
> >csound, &pvalue, "pitch", CSOUND_INPUT_CHANNEL |
> CSOUND_CONTROL_CHANNEL)==0);
>       *pvalue = (MYFLT)userInput;
>
>       scanf("%d", &userInput);
>
> printf("Okay, %d\n",userInput);
>
>         }
>
> ud->PERF_STATUS=0;
>
> return ud->result;
>
> }
>
> //-------------------------------------------------------------
>
> //definition of our performance thread function
>
> uintptr_t csThread(void *data)
>
> {
>
>          userData* udata
> = (userData*)data;
>
>          if(!udata->result)
>
>             {
>
>                     while((csoundPerformKsmps(udata->csound) == 0)
>
>                            &&(udata->PERF_STATUS==1));
>
>                   csoundDestroy(udata->csound);
>
>             }
>
>          udata-
> >PERF_STATUS = 0;
>
>           return 1;
>
> }
>
> //---------------------------------------------------------------
> -----------------------------
>
> ... I load this instrument file and get no sound:
>
> instr 1
>
> kval chnget "pitch"
>
> a1 oscil 10000, kval, 1
>
> out a1
>
> endin
>                                               
> _________________________________________________________________
> http://clk.atdmt.com/UKM/go/195013117/direct/01/
> We want to hear all your funny, exciting and crazy Hotmail
> stories. Tell us now
> -----------------------------------------------------------------
> -------------
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel

Dr Victor Lazzarini, Senior Lecturer, Dept. of Music,
National University of Ireland, Maynooth