| I'll give it a go. With regards threads in general, once they finish the
endthread function is automatically called and the instance of that
thread is freed, is this right? So am I then right in using the new
operator to create a new instance of my thread each time I want to
process the audio. If this is right then I am beginning to understand
things better, if not can anyone clarify it for me? Another question.
What if the thread where I create an instance of Csound terminates
before csound did, would the instance of Csound be destroyed automatically?
Rory.
Victor Lazzarini wrote:
> As Michael said, a typical use is to create the instance
> when
> your program starts and destroy it when it ends. You can
> do new compilations by calling csoundReset(), this puts
> the csound instance into a state that is ready for new
> compilation.
>
> So I suggest the following:
>
> 1. Create Csound
> 2. Compile
> 3. Start your thread when you want to generate audio
> 4. Finish the thread and Reset Csound when you want to stop
> for a
> new compilation
> 5. Destroy csound on exit.
>
> Caveat: if you are accessing the Csound structure from two
> different threads, to make it thread-safe, you will need to
> use
> locks. Non-thread-safe code might work in the majority of
> times, but there is always the chance that something might
> go wrong.
>
> Victor
>
>>Hi everyone. Thanks for your suggestions however I remain
>>unsuccessful in preventing the error. If you don't mind
>>I'd like to fire a few questions out there. Firstly can I
>>call csoundCompile as many times as I like passing the
>>same instance of csound, or do I need to create a new
>>instance each time? They reason I was creating a new
>>thread each time the user ran the program was that i
>>wanted to allow them to change the file being loaded each
>>time, but from some of your comments I guess one thread
>>will do fine. At the moment, every time I click RunCsound
>>in my app I create a specific Csound thread. In the
>>thread I call csoundCreate(); csoundPerformKsmps();
>>csoundCleanup();
>>csoundReset();
>>csoundDestroy();
>>Am I right in saying that this will first create an
>>instance of Csound, then it will perform run csound, then
>>it will cleanup and reset the audio devices and other
>>callback routines. In my case once that thread has
>>finished execution it should free itself, and seen as I
>>have destroyed the instance of Csound I should then be
>>able to call my RunCsound in my app again without any
>>problems, or so I thought. It's here that the error pops
>>up. The first timer it pops up I can click ok and then I
>>hear the audio, but the second time after I click ok the
>>audio stops. From what I can make of it, it's possible
>>that my thread is not freeing itself for some reason? Or
>>csound is not being destroyed for some reason, perhaps
>>because PortAudio is not closing. The one thing that does
>>work is Victor's advice to add a -+rtaudio=MME flag to the
>>command line. I was pretty sure that this was just a
>>simple mistake in my implementation of things but after
>>reading your posts I'm now sure it is. Can anyone think
>>of any likely things I may be doing wrong? Thanks again
>>for all the help and suggestions. Oh yeah one last thing.
>>When I close out of my application there are often times
>>when the program still appears when I check the task
>>manager. Again, this must surely be because of the way I
>>implemented my csound thread. Cheers,
>>
>>Rory.
>>
>>
>>
>>Michael Gogins wrote:
>>
>>>My code (see CsoundVST.cpp and CsoundVstFltk.cpp) is
>>
>>similar. However, I do not destroy Csound after creating
>>it. I keep re-using the same instance. This seems to work
>>
>>>fine.
>>>Regards,
>>>Mike
>>>
>>>-----Original Message-----
>>>
>>>
>>>>From: Rory Walsh
>>>>Sent: Jan 27, 2006 10:25 AM
>>>>To: csound-devel@lists.sourceforge.net
>>>>Subject: [Cs-dev] ASIOMME.dll?
>>>>
>>>>Hi everyone, sorry to bother you when I know you're all
>>
>>busy working on >>the upcoming release but I have a
>>question regarding the CsoundAPI. I am >>working on a
>>simple application, everything is working fine except that
>>
>>>>after I make a call to csoundDestroy and then try the
>>
>>thread again I get >>a message saying ASIOMME.dll still
>>running. My processing thread is >>attached below. Is
>>calling csoundDestroy() enough to kill an instance of
>>
>>>>csound and free anything that it was using? Thanks,
>>>>Rory. >>
>>
>>
>>
>>-------------------------------------------------------
>>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
>>https://lists.sourceforge.net/lists/listinfo/csound-devel
>
>
>
> -------------------------------------------------------
> 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
> https://lists.sourceforge.net/lists/listinfo/csound-devel
>
-------------------------------------------------------
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 |