Csound Csound-dev Csound-tekno Search About

Re: [Cs-dev] Performance thread using the csound api in c

Date2010-04-28 07:32
FromFrancois PINOT
SubjectRe: [Cs-dev] Performance thread using the csound api in c
AttachmentsNone  None  
If you're compiling and linking with the double version of the csound library (libcsound64) don't forget to set -DUSE_DOUBLE in your gcc command. Forgetting this can cause no sound output...

Francois Pinot


Date: Tue, 27 Apr 2010 03:34:20 +0100
From: Josh Brown <lovell_josh@hotmail.co.uk>
Subject: [Cs-dev] Performance thread using the csound api in c.
To: <csound-devel@lists.sourceforge.net>
Message-ID: <COL102-W41335F21DDB21EA977F3BEC3030@phx.gbl>
Content-Type: text/plain; charset="iso-8859-1"


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



Date2010-04-28 22:34
FromJosh Brown
SubjectRe: [Cs-dev] Performance thread using the csound api in c
Still no luck getting any sound ... here is what the program outputs:

joshua@joshua-laptop:~/beatgenerator$ ./basic csth.csd
PortAudio real-time audio module for Csound
virtual_keyboard real time MIDI plugin for Csound
PortMIDI real time MIDI plugin for Csound
0dBFS level = 32768.0
Csound version 5.08 (double samples) Apr 14 2009
libsndfile-1.0.17
UnifiedCSD:  csth.csd
STARTING FILE
Creating options
Creating orchestra
Creating score
orchname:  /tmp/file4x01tf.orc
scorename: /tmp/fileSw2WgD.sco
rtmidi: PortMIDI module enabled
rtaudio: PortAudio module enabled ... using blocking interface
orch compiler:
16 lines read
    instr    1    
Elapsed time at end of orchestra compile: real: 0.025s, CPU: 0.000s
sorting score ...
    ... done
Elapsed time at end of score sort: real: 0.029s, CPU: 0.000s
Csound version 5.08 (double samples) Apr 14 2009
0dBFS level = 1.0
orch now loaded
audio buffered in 256 sample-frame blocks
PortAudio V19-devel (built Mar  4 2009)
PortAudio: available output devices:
   0: /dev/dsp
   1: HDA Intel: ALC269 Analog (hw:0,0)
   2: front
   3: surround40
   4: surround51
   5: surround71
   6: pulse
   7: dmix
   8: default
PortAudio: selected output device 'default'
writing 512-byte blks of shorts to dac
SECTION 1:
ftable 1:

Enter a pitch in Hz(0 to Exit) and type return
new alloc for instr 1:
WARNING: Buffer underrun in real-time audio output
WARNING: Buffer underrun in real-time audio output
440


________________________________
> Date: Wed, 28 Apr 2010 08:32:05 +0200
> Subject: Re: Performance thread using the csound api in c
> From: fggpinot@gmail.com
> To: csound-devel@lists.sourceforge.net
> CC: lovell_josh@hotmail.co.uk
>
> If you're compiling and linking with the double version of the csound library (libcsound64) don't forget to set -DUSE_DOUBLE in your gcc command. Forgetting this can cause no sound output...
>
> Francois Pinot
>
>
>
>
> Date: Tue, 27 Apr 2010 03:34:20 +0100
>
> From: Josh Brown
>
> Subject: [Cs-dev] Performance thread using the csound api in c.
>
> To:
>
> Message-ID:
>
> Content-Type: text/plain; charset="iso-8859-1"
>
>
>
>
>
> 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/197222280/direct/01/
Do you have a story that started on Hotmail? Tell us now
------------------------------------------------------------------------------
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2010-04-28 23:05
FromVictor Lazzarini
SubjectRe: [Cs-dev] Performance thread using the csound api in c
Did you build with -DUSE_DOUBLE ? Otherwise that is where you are  
going wrong.

On 28 Apr 2010, at 22:34, Josh Brown wrote:

> Csound version 5.08 (double samples) Apr 14 2009


------------------------------------------------------------------------------
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2010-04-29 01:58
FromJosh Brown
SubjectRe: [Cs-dev] Performance thread using the csound api in c
I did:

gcc -Wall -c basic.c
gcc -Wall basic.o /usr/lib/libcsound64.so.5.1 -DUSE_DOUBLE -o basic

is this correct?
----------------------------------------
> From: Victor.Lazzarini@nuim.ie
> To: csound-devel@lists.sourceforge.net
> Date: Wed, 28 Apr 2010 23:05:50 +0100
> Subject: Re: [Cs-dev] Performance thread using the csound api in c
>
> Did you build with -DUSE_DOUBLE ? Otherwise that is where you are
> going wrong.
>
> On 28 Apr 2010, at 22:34, Josh Brown wrote:
>
>> Csound version 5.08 (double samples) Apr 14 2009
>
>
> ------------------------------------------------------------------------------
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
 		 	   		  
_________________________________________________________________
http://clk.atdmt.com/UKM/go/195013117/direct/01/

------------------------------------------------------------------------------
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2010-04-29 03:40
FromMichael Gogins
SubjectRe: [Cs-dev] Performance thread using the csound api in c
Not correct. You need -DUSE_DOUBLE in all compiler commands. Either  do this:

gcc -Wall -DUSE_DOUBLE -c basic.c
gcc -Wall basic.o /usr/lib/libcsound64.so.5.1 -DUSE_DOUBLE -o basic

Or do this:

gcc -Wall basic.c /usr/lib/libcsound64.so.5.1 -DUSE_DOUBLE -o basic

Hope this helps,
MIke

On Wed, Apr 28, 2010 at 8:58 PM, Josh Brown  wrote:
>
> I did:
>
> gcc -Wall -c basic.c
> gcc -Wall basic.o /usr/lib/libcsound64.so.5.1 -DUSE_DOUBLE -o basic
>
> is this correct?
> ----------------------------------------
>> From: Victor.Lazzarini@nuim.ie
>> To: csound-devel@lists.sourceforge.net
>> Date: Wed, 28 Apr 2010 23:05:50 +0100
>> Subject: Re: [Cs-dev] Performance thread using the csound api in c
>>
>> Did you build with -DUSE_DOUBLE ? Otherwise that is where you are
>> going wrong.
>>
>> On 28 Apr 2010, at 22:34, Josh Brown wrote:
>>
>>> Csound version 5.08 (double samples) Apr 14 2009
>>
>>
>> ------------------------------------------------------------------------------
>> _______________________________________________
>> Csound-devel mailing list
>> Csound-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>
> _________________________________________________________________
> http://clk.atdmt.com/UKM/go/195013117/direct/01/
>
> ------------------------------------------------------------------------------
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
>



-- 
Michael Gogins
Irreducible Productions
http://www.michael-gogins.com
Michael dot Gogins at gmail dot com

------------------------------------------------------------------------------
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2010-04-29 08:17
FromVictor Lazzarini
SubjectRe: [Cs-dev] Performance thread using the csound api in c
No you need to use the flag in compilation

gcc -Wall -c basic.c -DUSE_DOUBLE

Victor
On 29 Apr 2010, at 01:58, Josh Brown wrote:

>
> I did:
>
> gcc -Wall -c basic.c
> gcc -Wall basic.o /usr/lib/libcsound64.so.5.1 -DUSE_DOUBLE -o basic
>
> is this correct?
> ----------------------------------------
>> From: Victor.Lazzarini@nuim.ie
>> To: csound-devel@lists.sourceforge.net
>> Date: Wed, 28 Apr 2010 23:05:50 +0100
>> Subject: Re: [Cs-dev] Performance thread using the csound api in c
>>
>> Did you build with -DUSE_DOUBLE ? Otherwise that is where you are
>> going wrong.
>>
>> On 28 Apr 2010, at 22:34, Josh Brown wrote:
>>
>>> Csound version 5.08 (double samples) Apr 14 2009
>>
>>
>> ------------------------------------------------------------------------------
>> _______________________________________________
>> Csound-devel mailing list
>> Csound-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/csound-devel
> 		 	   		
> _________________________________________________________________
> http://clk.atdmt.com/UKM/go/195013117/direct/01/
>
> ------------------------------------------------------------------------------
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel


------------------------------------------------------------------------------
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2010-04-29 17:18
FromJosh Brown
SubjectRe: [Cs-dev] Performance thread using the csound api in c
yay! it worked... thank you everyone.

----------------------------------------
> Date: Wed, 28 Apr 2010 22:40:38 -0400
> From: michael.gogins@gmail.com
> To: csound-devel@lists.sourceforge.net
> Subject: Re: [Cs-dev] Performance thread using the csound api in c
>
> Not correct. You need -DUSE_DOUBLE in all compiler commands. Either do this:
>
> gcc -Wall -DUSE_DOUBLE -c basic.c
> gcc -Wall basic.o /usr/lib/libcsound64.so.5.1 -DUSE_DOUBLE -o basic
>
> Or do this:
>
> gcc -Wall basic.c /usr/lib/libcsound64.so.5.1 -DUSE_DOUBLE -o basic
>
> Hope this helps,
> MIke
>
> On Wed, Apr 28, 2010 at 8:58 PM, Josh Brown  wrote:
>>
>> I did:
>>
>> gcc -Wall -c basic.c
>> gcc -Wall basic.o /usr/lib/libcsound64.so.5.1 -DUSE_DOUBLE -o basic
>>
>> is this correct?
>> ----------------------------------------
>>> From: Victor.Lazzarini@nuim.ie
>>> To: csound-devel@lists.sourceforge.net
>>> Date: Wed, 28 Apr 2010 23:05:50 +0100
>>> Subject: Re: [Cs-dev] Performance thread using the csound api in c
>>>
>>> Did you build with -DUSE_DOUBLE ? Otherwise that is where you are
>>> going wrong.
>>>
>>> On 28 Apr 2010, at 22:34, Josh Brown wrote:
>>>
>>>> Csound version 5.08 (double samples) Apr 14 2009
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> _______________________________________________
>>> Csound-devel mailing list
>>> Csound-devel@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>
>> _________________________________________________________________
>> http://clk.atdmt.com/UKM/go/195013117/direct/01/
>>
>> ------------------------------------------------------------------------------
>> _______________________________________________
>> Csound-devel mailing list
>> Csound-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>
>
>
>
> --
> Michael Gogins
> Irreducible Productions
> http://www.michael-gogins.com
> Michael dot Gogins at gmail dot com
>
> ------------------------------------------------------------------------------
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
 		 	   		  
_________________________________________________________________
http://clk.atdmt.com/UKM/go/195013117/direct/01/

------------------------------------------------------------------------------
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2010-04-29 23:37
FromJosh Brown
Subject[Cs-dev] Now we're on the subject...
Does anyone know how to use multiple threads? At the moment I can only change one variable, ideally, I would like to be able to control more. I tried editing the code but with no success. Any help with this would be very much appreciated.

----------------------------------------
> From: lovell_josh@hotmail.co.uk
> To: csound-devel@lists.sourceforge.net
> Date: Thu, 29 Apr 2010 17:18:05 +0100
> Subject: Re: [Cs-dev] Performance thread using the csound api in c
>
>
> yay! it worked... thank you everyone.
>
> ----------------------------------------
>> Date: Wed, 28 Apr 2010 22:40:38 -0400
>> From: michael.gogins@gmail.com
>> To: csound-devel@lists.sourceforge.net
>> Subject: Re: [Cs-dev] Performance thread using the csound api in c
>>
>> Not correct. You need -DUSE_DOUBLE in all compiler commands. Either do this:
>>
>> gcc -Wall -DUSE_DOUBLE -c basic.c
>> gcc -Wall basic.o /usr/lib/libcsound64.so.5.1 -DUSE_DOUBLE -o basic
>>
>> Or do this:
>>
>> gcc -Wall basic.c /usr/lib/libcsound64.so.5.1 -DUSE_DOUBLE -o basic
>>
>> Hope this helps,
>> MIke
>>
>> On Wed, Apr 28, 2010 at 8:58 PM, Josh Brown wrote:
>>>
>>> I did:
>>>
>>> gcc -Wall -c basic.c
>>> gcc -Wall basic.o /usr/lib/libcsound64.so.5.1 -DUSE_DOUBLE -o basic
>>>
>>> is this correct?
>>> ----------------------------------------
>>>> From: Victor.Lazzarini@nuim.ie
>>>> To: csound-devel@lists.sourceforge.net
>>>> Date: Wed, 28 Apr 2010 23:05:50 +0100
>>>> Subject: Re: [Cs-dev] Performance thread using the csound api in c
>>>>
>>>> Did you build with -DUSE_DOUBLE ? Otherwise that is where you are
>>>> going wrong.
>>>>
>>>> On 28 Apr 2010, at 22:34, Josh Brown wrote:
>>>>
>>>>> Csound version 5.08 (double samples) Apr 14 2009
>>>>
>>>>
>>>> ------------------------------------------------------------------------------
>>>> _______________________________________________
>>>> Csound-devel mailing list
>>>> Csound-devel@lists.sourceforge.net
>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>
>>> _________________________________________________________________
>>> http://clk.atdmt.com/UKM/go/195013117/direct/01/
>>>
>>> ------------------------------------------------------------------------------
>>> _______________________________________________
>>> Csound-devel mailing list
>>> Csound-devel@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>
>>
>>
>>
>> --
>> Michael Gogins
>> Irreducible Productions
>> http://www.michael-gogins.com
>> Michael dot Gogins at gmail dot com
>>
>> ------------------------------------------------------------------------------
>> _______________________________________________
>> Csound-devel mailing list
>> Csound-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>
> _________________________________________________________________
> http://clk.atdmt.com/UKM/go/195013117/direct/01/
>
> ------------------------------------------------------------------------------
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
 		 	   		  
_________________________________________________________________
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

Date2010-04-30 00:13
FromRory Walsh
SubjectRe: [Cs-dev] Now we're on the subject...
If you want to control more variables in Csound you don't need to use
multiple threads. You only need to use more channels.

On 29 April 2010 23:37, Josh Brown  wrote:
>
> Does anyone know how to use multiple threads? At the moment I can only change one variable, ideally, I would like to be able to control more. I tried editing the code but with no success. Any help with this would be very much appreciated.
>
> ----------------------------------------
>> From: lovell_josh@hotmail.co.uk
>> To: csound-devel@lists.sourceforge.net
>> Date: Thu, 29 Apr 2010 17:18:05 +0100
>> Subject: Re: [Cs-dev] Performance thread using the csound api in c
>>
>>
>> yay! it worked... thank you everyone.
>>
>> ----------------------------------------
>>> Date: Wed, 28 Apr 2010 22:40:38 -0400
>>> From: michael.gogins@gmail.com
>>> To: csound-devel@lists.sourceforge.net
>>> Subject: Re: [Cs-dev] Performance thread using the csound api in c
>>>
>>> Not correct. You need -DUSE_DOUBLE in all compiler commands. Either do this:
>>>
>>> gcc -Wall -DUSE_DOUBLE -c basic.c
>>> gcc -Wall basic.o /usr/lib/libcsound64.so.5.1 -DUSE_DOUBLE -o basic
>>>
>>> Or do this:
>>>
>>> gcc -Wall basic.c /usr/lib/libcsound64.so.5.1 -DUSE_DOUBLE -o basic
>>>
>>> Hope this helps,
>>> MIke
>>>
>>> On Wed, Apr 28, 2010 at 8:58 PM, Josh Brown wrote:
>>>>
>>>> I did:
>>>>
>>>> gcc -Wall -c basic.c
>>>> gcc -Wall basic.o /usr/lib/libcsound64.so.5.1 -DUSE_DOUBLE -o basic
>>>>
>>>> is this correct?
>>>> ----------------------------------------
>>>>> From: Victor.Lazzarini@nuim.ie
>>>>> To: csound-devel@lists.sourceforge.net
>>>>> Date: Wed, 28 Apr 2010 23:05:50 +0100
>>>>> Subject: Re: [Cs-dev] Performance thread using the csound api in c
>>>>>
>>>>> Did you build with -DUSE_DOUBLE ? Otherwise that is where you are
>>>>> going wrong.
>>>>>
>>>>> On 28 Apr 2010, at 22:34, Josh Brown wrote:
>>>>>
>>>>>> Csound version 5.08 (double samples) Apr 14 2009
>>>>>
>>>>>
>>>>> ------------------------------------------------------------------------------
>>>>> _______________________________________________
>>>>> Csound-devel mailing list
>>>>> Csound-devel@lists.sourceforge.net
>>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>>
>>>> _________________________________________________________________
>>>> http://clk.atdmt.com/UKM/go/195013117/direct/01/
>>>>
>>>> ------------------------------------------------------------------------------
>>>> _______________________________________________
>>>> Csound-devel mailing list
>>>> Csound-devel@lists.sourceforge.net
>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>>
>>>
>>>
>>>
>>> --
>>> Michael Gogins
>>> Irreducible Productions
>>> http://www.michael-gogins.com
>>> Michael dot Gogins at gmail dot com
>>>
>>> ------------------------------------------------------------------------------
>>> _______________________________________________
>>> Csound-devel mailing list
>>> Csound-devel@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>
>> _________________________________________________________________
>> http://clk.atdmt.com/UKM/go/195013117/direct/01/
>>
>> ------------------------------------------------------------------------------
>> _______________________________________________
>> Csound-devel mailing list
>> Csound-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>
> _________________________________________________________________
> 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
>

------------------------------------------------------------------------------
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2010-04-30 01:28
FromJosh Brown
SubjectRe: [Cs-dev] Now we're on the subject...
Okay, I tried this (with an extra channel) but it didn't work as expected:

#include 
#include "H/csound.h"

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;
int userInputtwo=440;
void* ThreadID;
userData* ud;
ud = (userData *)malloc(sizeof(userData));
MYFLT* pvalue;
MYFLT* pvaluetwo;
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)
{
while(userInputtwo!=0)
{
if(csoundGetChannelPtr(ud->csound, &pvalue, "pitch", CSOUND_INPUT_CHANNEL | CSOUND_CONTROL_CHANNEL)==0);
*pvalue = (MYFLT)userInput;
scanf("%d", &userInput);

if(csoundGetChannelPtr(ud->csound, &pvaluetwo, "pitchtwo", CSOUND_INPUT_CHANNEL | CSOUND_CONTROL_CHANNEL)==0);
*pvaluetwo = (MYFLT)userInputtwo;
scanf("%d", &userInputtwo);
}
}
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;
}
//--------------------------------------------------------------------------------------------

----------------------------------------
> From: rorywalsh@ear.ie
> Date: Fri, 30 Apr 2010 00:13:35 +0100
> To: csound-devel@lists.sourceforge.net
> Subject: Re: [Cs-dev] Now we're on the subject...
>
> If you want to control more variables in Csound you don't need to use
> multiple threads. You only need to use more channels.
>
> On 29 April 2010 23:37, Josh Brown  wrote:
>>
>> Does anyone know how to use multiple threads? At the moment I can only change one variable, ideally, I would like to be able to control more. I tried editing the code but with no success. Any help with this would be very much appreciated.
>>
>> ----------------------------------------
>>> From: lovell_josh@hotmail.co.uk
>>> To: csound-devel@lists.sourceforge.net
>>> Date: Thu, 29 Apr 2010 17:18:05 +0100
>>> Subject: Re: [Cs-dev] Performance thread using the csound api in c
>>>
>>>
>>> yay! it worked... thank you everyone.
>>>
>>> ----------------------------------------
>>>> Date: Wed, 28 Apr 2010 22:40:38 -0400
>>>> From: michael.gogins@gmail.com
>>>> To: csound-devel@lists.sourceforge.net
>>>> Subject: Re: [Cs-dev] Performance thread using the csound api in c
>>>>
>>>> Not correct. You need -DUSE_DOUBLE in all compiler commands. Either do this:
>>>>
>>>> gcc -Wall -DUSE_DOUBLE -c basic.c
>>>> gcc -Wall basic.o /usr/lib/libcsound64.so.5.1 -DUSE_DOUBLE -o basic
>>>>
>>>> Or do this:
>>>>
>>>> gcc -Wall basic.c /usr/lib/libcsound64.so.5.1 -DUSE_DOUBLE -o basic
>>>>
>>>> Hope this helps,
>>>> MIke
>>>>
>>>> On Wed, Apr 28, 2010 at 8:58 PM, Josh Brown wrote:
>>>>>
>>>>> I did:
>>>>>
>>>>> gcc -Wall -c basic.c
>>>>> gcc -Wall basic.o /usr/lib/libcsound64.so.5.1 -DUSE_DOUBLE -o basic
>>>>>
>>>>> is this correct?
>>>>> ----------------------------------------
>>>>>> From: Victor.Lazzarini@nuim.ie
>>>>>> To: csound-devel@lists.sourceforge.net
>>>>>> Date: Wed, 28 Apr 2010 23:05:50 +0100
>>>>>> Subject: Re: [Cs-dev] Performance thread using the csound api in c
>>>>>>
>>>>>> Did you build with -DUSE_DOUBLE ? Otherwise that is where you are
>>>>>> going wrong.
>>>>>>
>>>>>> On 28 Apr 2010, at 22:34, Josh Brown wrote:
>>>>>>
>>>>>>> Csound version 5.08 (double samples) Apr 14 2009
>>>>>>
>>>>>>
>>>>>> ------------------------------------------------------------------------------
>>>>>> _______________________________________________
>>>>>> Csound-devel mailing list
>>>>>> Csound-devel@lists.sourceforge.net
>>>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>>>
>>>>> _________________________________________________________________
>>>>> http://clk.atdmt.com/UKM/go/195013117/direct/01/
>>>>>
>>>>> ------------------------------------------------------------------------------
>>>>> _______________________________________________
>>>>> Csound-devel mailing list
>>>>> Csound-devel@lists.sourceforge.net
>>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Michael Gogins
>>>> Irreducible Productions
>>>> http://www.michael-gogins.com
>>>> Michael dot Gogins at gmail dot com
>>>>
>>>> ------------------------------------------------------------------------------
>>>> _______________________________________________
>>>> Csound-devel mailing list
>>>> Csound-devel@lists.sourceforge.net
>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>
>>> _________________________________________________________________
>>> http://clk.atdmt.com/UKM/go/195013117/direct/01/
>>>
>>> ------------------------------------------------------------------------------
>>> _______________________________________________
>>> Csound-devel mailing list
>>> Csound-devel@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>
>> _________________________________________________________________
>> 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
>>
>
> ------------------------------------------------------------------------------
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
 		 	   		  
_________________________________________________________________
http://clk.atdmt.com/UKM/go/195013117/direct/01/

------------------------------------------------------------------------------
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2010-04-30 18:57
FromJosh Brown
SubjectRe: [Cs-dev] Now we're on the subject...
Never mind, I got the multiple channels thing working now.

----------------------------------------
> From: lovell_josh@hotmail.co.uk
> To: csound-devel@lists.sourceforge.net
> Date: Fri, 30 Apr 2010 01:28:31 +0100
> Subject: Re: [Cs-dev] Now we're on the subject...
>
>
> Okay, I tried this (with an extra channel) but it didn't work as expected:
>
> #include 
> #include "H/csound.h"
>
> 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;
> int userInputtwo=440;
> void* ThreadID;
> userData* ud;
> ud = (userData *)malloc(sizeof(userData));
> MYFLT* pvalue;
> MYFLT* pvaluetwo;
> 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)
> {
> while(userInputtwo!=0)
> {
> if(csoundGetChannelPtr(ud->csound, &pvalue, "pitch", CSOUND_INPUT_CHANNEL | CSOUND_CONTROL_CHANNEL)==0);
> *pvalue = (MYFLT)userInput;
> scanf("%d", &userInput);
>
> if(csoundGetChannelPtr(ud->csound, &pvaluetwo, "pitchtwo", CSOUND_INPUT_CHANNEL | CSOUND_CONTROL_CHANNEL)==0);
> *pvaluetwo = (MYFLT)userInputtwo;
> scanf("%d", &userInputtwo);
> }
> }
> 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;
> }
> //--------------------------------------------------------------------------------------------
>
> ----------------------------------------
>> From: rorywalsh@ear.ie
>> Date: Fri, 30 Apr 2010 00:13:35 +0100
>> To: csound-devel@lists.sourceforge.net
>> Subject: Re: [Cs-dev] Now we're on the subject...
>>
>> If you want to control more variables in Csound you don't need to use
>> multiple threads. You only need to use more channels.
>>
>> On 29 April 2010 23:37, Josh Brown wrote:
>>>
>>> Does anyone know how to use multiple threads? At the moment I can only change one variable, ideally, I would like to be able to control more. I tried editing the code but with no success. Any help with this would be very much appreciated.
>>>
>>> ----------------------------------------
>>>> From: lovell_josh@hotmail.co.uk
>>>> To: csound-devel@lists.sourceforge.net
>>>> Date: Thu, 29 Apr 2010 17:18:05 +0100
>>>> Subject: Re: [Cs-dev] Performance thread using the csound api in c
>>>>
>>>>
>>>> yay! it worked... thank you everyone.
>>>>
>>>> ----------------------------------------
>>>>> Date: Wed, 28 Apr 2010 22:40:38 -0400
>>>>> From: michael.gogins@gmail.com
>>>>> To: csound-devel@lists.sourceforge.net
>>>>> Subject: Re: [Cs-dev] Performance thread using the csound api in c
>>>>>
>>>>> Not correct. You need -DUSE_DOUBLE in all compiler commands. Either do this:
>>>>>
>>>>> gcc -Wall -DUSE_DOUBLE -c basic.c
>>>>> gcc -Wall basic.o /usr/lib/libcsound64.so.5.1 -DUSE_DOUBLE -o basic
>>>>>
>>>>> Or do this:
>>>>>
>>>>> gcc -Wall basic.c /usr/lib/libcsound64.so.5.1 -DUSE_DOUBLE -o basic
>>>>>
>>>>> Hope this helps,
>>>>> MIke
>>>>>
>>>>> On Wed, Apr 28, 2010 at 8:58 PM, Josh Brown wrote:
>>>>>>
>>>>>> I did:
>>>>>>
>>>>>> gcc -Wall -c basic.c
>>>>>> gcc -Wall basic.o /usr/lib/libcsound64.so.5.1 -DUSE_DOUBLE -o basic
>>>>>>
>>>>>> is this correct?
>>>>>> ----------------------------------------
>>>>>>> From: Victor.Lazzarini@nuim.ie
>>>>>>> To: csound-devel@lists.sourceforge.net
>>>>>>> Date: Wed, 28 Apr 2010 23:05:50 +0100
>>>>>>> Subject: Re: [Cs-dev] Performance thread using the csound api in c
>>>>>>>
>>>>>>> Did you build with -DUSE_DOUBLE ? Otherwise that is where you are
>>>>>>> going wrong.
>>>>>>>
>>>>>>> On 28 Apr 2010, at 22:34, Josh Brown wrote:
>>>>>>>
>>>>>>>> Csound version 5.08 (double samples) Apr 14 2009
>>>>>>>
>>>>>>>
>>>>>>> ------------------------------------------------------------------------------
>>>>>>> _______________________________________________
>>>>>>> Csound-devel mailing list
>>>>>>> Csound-devel@lists.sourceforge.net
>>>>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>>>>
>>>>>> _________________________________________________________________
>>>>>> http://clk.atdmt.com/UKM/go/195013117/direct/01/
>>>>>>
>>>>>> ------------------------------------------------------------------------------
>>>>>> _______________________________________________
>>>>>> Csound-devel mailing list
>>>>>> Csound-devel@lists.sourceforge.net
>>>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Michael Gogins
>>>>> Irreducible Productions
>>>>> http://www.michael-gogins.com
>>>>> Michael dot Gogins at gmail dot com
>>>>>
>>>>> ------------------------------------------------------------------------------
>>>>> _______________________________________________
>>>>> Csound-devel mailing list
>>>>> Csound-devel@lists.sourceforge.net
>>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>>
>>>> _________________________________________________________________
>>>> http://clk.atdmt.com/UKM/go/195013117/direct/01/
>>>>
>>>> ------------------------------------------------------------------------------
>>>> _______________________________________________
>>>> Csound-devel mailing list
>>>> Csound-devel@lists.sourceforge.net
>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>
>>> _________________________________________________________________
>>> 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
>>>
>>
>> ------------------------------------------------------------------------------
>> _______________________________________________
>> Csound-devel mailing list
>> Csound-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>
> _________________________________________________________________
> http://clk.atdmt.com/UKM/go/195013117/direct/01/
>
> ------------------------------------------------------------------------------
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
 		 	   		  
_________________________________________________________________
http://clk.atdmt.com/UKM/go/197222280/direct/01/
Do you have a story that started on Hotmail? Tell us now
------------------------------------------------------------------------------
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net