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;
}
//--------------------------------------------------------------------------------------------
... with this instrument file:
instr 1
kval chnget "pitch"
a1 oscil 10000, kval, 1
out a1
endin



what I was doing wrong:
I needed to build with -DUSE_DOUBLE, as below.
gcc -Wall -DUSE_DOUBLE -c basic.c
gcc -Wall basic.o /usr/lib/libcsound64.so.5.1 -DUSE_DOUBLE -o basic
... Thanks to the people at the csound-dev mailing list for suggesting this.