Csound Csound-dev Csound-tekno Search About

Re: [Cs-dev] starting/stopping performance thread...

Date2008-06-11 20:12
FromMichael Gogins
SubjectRe: [Cs-dev] starting/stopping performance thread...
Now that I think about, I think that I also create a new performance thread object just before each use.

Hope this helps,
Mike

-----Original Message-----
>From: victor 
>Sent: Jun 11, 2008 2:52 PM
>To: Developer discussions 
>Subject: Re: [Cs-dev] starting/stopping performance thread...
>
>Try deleting the thread object and creating a new one.
>----- Original Message ----- 
>From: "Rory Walsh" 
>To: "Michael Gogins" ; "Developer discussions" 
>
>Sent: Wednesday, June 11, 2008 3:38 PM
>Subject: Re: [Cs-dev] starting/stopping performance thread...
>
>
>> Although I can't seem to reproduce the crash I am getting I did whip up
>> a minimal example that doesn't seem to work as I would expect. The
>> following code(below) will start a performance, stop the performance and
>> then recompile. After the recompile, Play() is called but this time
>> doesn't do anything. The program just sits in silence until 4 seconds
>> are up and then exits. Surely I'm doing something wrong, anyone care to
>> enlighten me?
>>
>> Rory.
>>
>>
>> #include "csound.hpp"
>> #include "csPerfThread.hpp"
>> #include "windows.h" //sleep function...
>>
>> int main()
>> {
>> Csound* csound = new Csound;
>> csound->PreCompile();
>> csound->Compile("basic.csd");
>> CsoundPerformanceThread* perf = new CsoundPerformanceThread(csound);
>>
>> perf->Play();
>> Sleep(1000);
>> perf->Stop();
>> perf->Join();
>> csound->PreCompile();
>> csound->Compile("basic.csd");
>> perf->Play();
>> Sleep(4000);
>>
>> perf->Stop();
>> delete csound, perf;
>> }
>>
>>
>>
>> -------------------------------------------------------------------------
>> Check out the new SourceForge.net Marketplace.
>> It's the best place to buy or sell services for
>> just about anything Open Source.
>> http://sourceforge.net/services/buy/index.php
>> _______________________________________________
>> Csound-devel mailing list
>> Csound-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/csound-devel 
>
>
>-------------------------------------------------------------------------
>Check out the new SourceForge.net Marketplace.
>It's the best place to buy or sell services for
>just about anything Open Source.
>http://sourceforge.net/services/buy/index.php
>_______________________________________________
>Csound-devel mailing list
>Csound-devel@lists.sourceforge.net
>https://lists.sourceforge.net/lists/listinfo/csound-devel




-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2008-06-11 20:32
FromRory Walsh
SubjectRe: [Cs-dev] starting/stopping performance thread...
Ok, I didn't try that, I'm pretty sure that will work. If one must 
delete the thread object then what is the point of the Join() method?


Michael Gogins wrote:
> Now that I think about, I think that I also create a new performance thread object just before each use.
> 
> Hope this helps,
> Mike
> 
> -----Original Message-----
>> From: victor 
>> Sent: Jun 11, 2008 2:52 PM
>> To: Developer discussions 
>> Subject: Re: [Cs-dev] starting/stopping performance thread...
>>
>> Try deleting the thread object and creating a new one.
>> ----- Original Message ----- 
>> From: "Rory Walsh" 
>> To: "Michael Gogins" ; "Developer discussions" 
>> 
>> Sent: Wednesday, June 11, 2008 3:38 PM
>> Subject: Re: [Cs-dev] starting/stopping performance thread...
>>
>>
>>> Although I can't seem to reproduce the crash I am getting I did whip up
>>> a minimal example that doesn't seem to work as I would expect. The
>>> following code(below) will start a performance, stop the performance and
>>> then recompile. After the recompile, Play() is called but this time
>>> doesn't do anything. The program just sits in silence until 4 seconds
>>> are up and then exits. Surely I'm doing something wrong, anyone care to
>>> enlighten me?
>>>
>>> Rory.
>>>
>>>
>>> #include "csound.hpp"
>>> #include "csPerfThread.hpp"
>>> #include "windows.h" //sleep function...
>>>
>>> int main()
>>> {
>>> Csound* csound = new Csound;
>>> csound->PreCompile();
>>> csound->Compile("basic.csd");
>>> CsoundPerformanceThread* perf = new CsoundPerformanceThread(csound);
>>>
>>> perf->Play();
>>> Sleep(1000);
>>> perf->Stop();
>>> perf->Join();
>>> csound->PreCompile();
>>> csound->Compile("basic.csd");
>>> perf->Play();
>>> Sleep(4000);
>>>
>>> perf->Stop();
>>> delete csound, perf;
>>> }
>>>
>>>
>>>
>>> -------------------------------------------------------------------------
>>> Check out the new SourceForge.net Marketplace.
>>> It's the best place to buy or sell services for
>>> just about anything Open Source.
>>> http://sourceforge.net/services/buy/index.php
>>> _______________________________________________
>>> Csound-devel mailing list
>>> Csound-devel@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/csound-devel 
>>
>> -------------------------------------------------------------------------
>> Check out the new SourceForge.net Marketplace.
>> It's the best place to buy or sell services for
>> just about anything Open Source.
>> http://sourceforge.net/services/buy/index.php
>> _______________________________________________
>> Csound-devel mailing list
>> Csound-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/csound-devel
> 
> 
> 
> 
> -------------------------------------------------------------------------
> Check out the new SourceForge.net Marketplace.
> It's the best place to buy or sell services for
> just about anything Open Source.
> http://sourceforge.net/services/buy/index.php
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
> 

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2008-06-12 16:58
FromRory Walsh
SubjectRe: [Cs-dev] starting/stopping performance thread...
Is the following code ok? It works but should I actually delete the 
previous object or simply re-instantiate it if that's the correct word. 
DO I leave my code open to problems by doing it like this?

#include "csound.hpp"
#include "csPerfThread.hpp"
#include "windows.h"

int main()
{
Csound* csound = new Csound;
csound->Compile("basic.csd");
CsoundPerformanceThread* perf = new CsoundPerformanceThread(csound);

perf->Play();
Sleep(1000);
perf->Stop();
perf->Join();
csound->Compile("basic.csd");
perf = new CsoundPerformanceThread(csound);
perf->Play();
Sleep(4000);

perf->Stop();
delete csound, perf;
}

Rory.


-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2008-06-12 17:26
FromFelipe Sateler
SubjectRe: [Cs-dev] starting/stopping performance thread...
AttachmentsNone