| It definitely works in my machine, so I am not sure what
your problem is. It's not with the code.
The csound32.dll I am using is from the Csound5.00 release
of Feb 1.
Victor
At 13:12 07/02/2006, you wrote:
>Thanks Victor. Unfortunately when I run that code I still get a crash once
>I try the thread again after some time. I know that I am not testing the
>thread to see if it's done, I can do that later, for now I just want to
>make sure it will exit by itself. I gotta go now, I'll try it again later,
>
>Rory.
>
>
>Victor wrote....
>
>If I wait a little after the sound has stopped I can run any number
>of times. No problems. Your code does not have a way of not
>launching a thread if there is one still running. That's the problem.
>
>I'm using pretty much your code, with pdata as public member
>of TForm1. Here it is
>
>unit1.h
>//---------------------------------------------------------------------------
>
>#ifndef Unit1H
>#define Unit1H
>//---------------------------------------------------------------------------
>#include
>#include
>#include
>#include
>#include "csound.h"
>//----------------------------------------------------------------------------
> struct csdata {
> CSOUND *instance; /* csound object */
> int result; /* action result */
> void *threadID; /* processing thread ID */
> int status; /* perf status */
> };
>
>//---------------------------------------------------------------------------
>class TForm1 : public TForm
>{
>__published: // IDE-managed Components
> TButton *Button1;
> void __fastcall Button1Click(TObject *Sender);
>private: // User declarations
>public: // User declarations
> __fastcall TForm1(TComponent* Owner);
> friend uintptr_t csThread(void *clientData);
> char **cmdl;
> csdata *pd;
> bool CSOUND_ON;
> bool PERFCSOUND;
>};
>//---------------------------------------------------------------------------
>extern PACKAGE TForm1 *Form1;
>//---------------------------------------------------------------------------
>#endif
> ========================================================
>Unit1.cpp
>
>//---------------------------------------------------------------------------
>
>#include
>#pragma hdrstop
>
>#include "Unit1.h"
>//---------------------------------------------------------------------------
>#pragma package(smart_init)
>#pragma resource "*.dfm"
>TForm1 *Form1;
>//---------------------------------------------------------------------------
>__fastcall TForm1::TForm1(TComponent* Owner)
> : TForm(Owner)
>{
>cmdl = (char **) malloc(sizeof(char*)*(2));
>pd = (csdata *) malloc(sizeof(csdata));
>
>}
>//---------------------------------------------------------------------------
>
>void __fastcall TForm1::Button1Click(TObject *Sender)
>{
> cmdl[0] = "csound";
> cmdl[1] = "d:/tmp/proj/basic.csd";
> CSOUND *cs = csoundCreate(0);
> pd->instance = cs;
> pd->result = csoundCompile(cs, 2, cmdl);
> csoundCreateThread((uintptr_t(*)(void *))csThread, (void *)pd);
>
>}
>//---------------------------------------------------------------------------
>
>
>uintptr_t csThread(void *clientData)
>{
>csdata *p = (csdata *) clientData;
> if(!p->result)
> {
>
>if((csoundPerformKsmps(p->instance)!=0)&&(csoundPerformKsmps(p->instance)!=1))ShowMessage("Runtime
>Error 107");
> else{
> while(csoundPerformKsmps(p->instance) == 0)
> {
>
> }
> }
> csoundReset(p->instance);
> }
> return 1;
>}
>
>//--------------------------------------------------------------------------
>
>At 12:17 07/02/2006, you wrote:
> >Hi Victor, I know that your bust at the mo but did you get that program to
> >run yesterday and if so can you try to see if it will run the second time
> >you press the button? Something strange is occuring with the thread...
>
>Victor Lazzarini
>Music Technology Laboratory
>Music Department
>National University of Ireland, Maynooth
>
>
>
>
>
>-------------------------------------------------------
>This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
>for problems? Stop! Download the new AJAX search engine that makes
>searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
>http://sel.as-us.falkag.net/sel?cmdlnk&kid3432&bid#0486&dat1642
>_______________________________________________
>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: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net |