[Csnd] Windows, Java APis and Csound6
Date | 2013-09-07 13:28 |
From | jean-pierre lemoine |
Subject | [Csnd] Windows, Java APis and Csound6 |
Having done many tests these last days, I will like to share some strange findings.
My Java code has run for a long, and it allows to stop/start csound without any problem without leaving the application. The same code was running either in W7 or Vista with csound 5.
When switching to csound 6, I have discovered that my code to stop and clean csound was then putting the next csound compilation in error. I have changed the call to Cleanup() by Reset(), and magic, everything is working fine. But, nothing is working in Vista (time to change this machine),
Also, When I close my application I have the following message, whatever csound is or w7 or Vista Microsft Visual C++ Runtime Library message: This Application has requested the Runtime to terminate it in an unsual way.
This error has alaways been present, jutst not annoying to report it protected static Csound csoundInstance;
protected static CsoundPerformanceThread csoundPerformanceThread = null; My code "start" if ( csoundInstance == null ) { csnd.csnd.csoundInitialize(null, null, csnd.csnd.CSOUNDINIT_NO_SIGNAL_HANDLER ); csoundInstance = new Csound();
} if ( CompositionGenerator.csdFile != null ) { if ( csoundPerformanceThread != null ) {
if ( csoundPerformanceThread.isRunning() == 0 ) { csoundPerformanceThread.Stop(); csoundPerformanceThread.Join();
csoundInstance.Reset(); } } int rc = csoundInstance.Compile( CompositionGenerator.csdFile );
if ( rc == 0 ) { handleInitRendering(); csoundPerformanceThread = new CsoundPerformanceThread( csoundInstance );
csoundPerformanceThread.Play(); } else {
handleEndRendering(); } } the code "stop" if ( csoundInstance != null ) { if ( csoundPerformanceThread != null ) { if ( csoundPerformanceThread.isRunning() == 0 ) {
csoundPerformanceThread.Stop(); csoundPerformanceThread.Join(); }
} csoundInstance.Stop(); csoundInstance.Reset();
} Thanks for any ideas - nothing very critical, I konw that my application is working with csound 6 on W7, and my very old Vista machine should be replaced - but I would like to avoid a bad practice in my code versus the Csound APIs
Best jp |
Date | 2013-09-08 13:18 |
From | Steven Yi |
Subject | Re: [Csnd] Windows, Java APis and Csound6 |
Hi Jean-Pierre, Do you get any more detailed error/exception information when the application exit crash happens? Two things you can try are: 1. You could try initializating with CSOUNDINIT_NO_ATEXIT, so something like: csnd.csnd.csoundInitialize(null, null, csnd.csnd.CSOUNDINIT_NO_SIGNAL_HANDLER | csnd.csnd.CSOUNDINIT_NO_ATEXIT); (or the equivalent call in CS6) 2. Check that when your program exits, that all Csound performance threads are joined and all Csound instances are stopped. I haven't been using the performanceThread so can't really comment further about that. Thanks! steven On Sat, Sep 7, 2013 at 1:28 PM, jean-pierre lemoine |
Date | 2013-09-09 05:42 |
From | jean-pierre lemoine |
Subject | Re: [Csnd] Windows, Java APis and Csound6 |
Hi Steven
No exception, or error message. 1/ I have tried it, as I have seen you are using it in Blue, but no change for the exit crash 2/ I am using Join, but I am not sure of how correctly stoping the Csound instance. The documentation says there is no garantee that the call to "stop" on a cound instance will return when it is stopped
Maybe these strange behaviours (crash on exit, csound 6 APIs not working on Vista but ok with W7), are related to the use of perfromanceThread. Thansk for your ideas Best JP On Sun, Sep 8, 2013 at 2:18 PM, Steven Yi <stevenyi@gmail.com> wrote: Hi Jean-Pierre, |
Date | 2013-09-09 12:54 |
From | jean-pierre lemoine |
Subject | Re: [Csnd] Windows, Java APis and Csound6 |
After further tests (Java Thread in place of CsoundPerforamnceThread, and CsoundPerfromanceThread without using Jogl), I am pretty sure the "Visual C++ runtime error" problem comes from combination of csound and jogl libraries. I am not investigating further.
On Mon, Sep 9, 2013 at 6:42 AM, jean-pierre lemoine <lemoine.jp@gmail.com> wrote:
|
Date | 2013-09-09 14:02 |
From | Michael Gogins |
Subject | Re: [Csnd] Windows, Java APis and Csound6 |
You could try not using any thread at all. Compile your orchestra, start csound, and then go into a loop where you run csoundPerformKsmps, then handle your GUI events, run csoundPerformKspms, then handle your gui events, until the performance ends. There are various ways to do this, but you will have to re-implement your application's main event loop. Fortunately, that is usually very easy to do. Regards, Mike =========================== Michael GoginsIrreducible Productions http://michaelgogins.tumblr.com Michael dot Gogins at gmail dot com On Mon, Sep 9, 2013 at 7:54 AM, jean-pierre lemoine <lemoine.jp@gmail.com> wrote:
|