|
it's my problem,
I can't play any sound with this code:
#include
#include "csound/csound.h"
//performance thread function prototype
uintptr_t csThread(void *clientData);
//userData structure declaration
struct userData {
int result;
CSOUND* csound;
int PERF_STATUS;
};
typedef struct userData UD;
typedef struct userData * PUD;
//------------------------------------------------------------
int main(int argc, char *argv[])
{
int userInput=200;
void* ThreadID;
PUD ud;
// struct userData *ud;
ud = (struct userData *)malloc(sizeof(struct 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;
}
while(userInput!=0)
{
if(csoundGetChannelPtr(ud->csound, &pvalue, "pitch",
CSOUND_INPUT_CHANNEL | CSOUND_CONTROL_CHANNEL)==0);
*pvalue = (MYFLT)userInput;
scanf("%d", &userInput);
}
ud->PERF_STATUS=0;
return ud->result;
}
//-------------------------------------------------------------
//definition of our performance thread function
uintptr_t csThread(void *data)
{
struct userData* udata = (struct userData*)data;
if(!udata->result)
{
while((csoundPerformKsmps(udata->csound) == 0)
&&(udata->PERF_STATUS==1));
csoundDestroy(udata->csound);
}
udata->PERF_STATUS = 0;
return 1;
}
//--------------------------------------------------------------------------------------------
new alloc for instr 102:
B 0.000 .. 3.000 T 3.000 TT 3.000 M: 0.0
Score finished in csoundPerformKsmps().
inactive allocs returned to freespace
end of score. overall amps: 0.0
overall samples out of range: 0
0 errors in performance
Elapsed time at end of performance: real: 6.558s, CPU: 0.170s
I followed the roryWalsh manual, but when I change to the channel value, it
shows 0 in the amp option
does exist any command that I forgot? or Do I need to declare the channel
in other point in the code? I'm using a basic program to generate a senoidal
signal and, as the manual says, I'm only modifying the frequenci value
By the way, I'm using csound5.1
Thanks, David
--
View this message in context: http://www.nabble.com/csoundGetChannelPtr-dont-sound-tp21429389p21429389.html
Sent from the Csound - Dev mailing list archive at Nabble.com.
------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net |