| If you avoid using MIDI, does it still crash? I am wondering whether
portmidi is playing up.
Also, unrelated to this, I would suggest not calling any of
>> csoundStop(udata->csound);
>> csoundCleanup(udata->csound);
>> csoundDestroy(udata->csound);
in the thread function. Instead, join the thread, then stop Csound.
Is there any reason not to use CsoundPerformanceThread(). As
far as I can remember I have used it with RT events in Python
and it did not used to crash.
1. Make sure that no calls to csoundScoreEvent or csoundInputMessage
are issued outside the thread function.
2. The culprit might be processEventQueue(udata). Make sure it
is working as it should and calling the functions above properly.
3. I am not sure how portmidi implements MIDI polling on OSX,
whether it uses a separate thread. But that should not matter, because
the MIDI read functions are called by sensMidi(), called by
sensevents(), called by PerformKsmps(), so wherever that is placed,
main or secondary thread, it should work in the same way.
Regards
Victor
----- Original Message -----
From: "Andres Cabrera"
To: "Developer discussions"
Sent: Tuesday, October 28, 2008 6:52 PM
Subject: Re: [Cs-dev] Realtime events and threads using the API
Thanks, I guess this happens since the function is called from a
qutecsound method.
I've fixed this, but it has no effect on the stability on Mac.
Gracias,
Andrés
On Tue, Oct 28, 2008 at 3:27 PM, Felipe Sateler wrote:
> It seems to me that the compiler is doing some magic by associating
> ::csThread
> with qutecsound::csThread. I think you should be doing
>
> ThreadID = csoundCreateThread(qutecsound::csThread, (void*)ud);
>
> Whether this has anything to do with the crashes on Mac, I'm not sure.
>
> El 28/10/08 12:16 Andres Cabrera escribió:
>> Hi all,
>>
>> What would be necessary to avoid crashes on Mac when receiving MIDI
>> using the API in a separate thread?
>> Currently, QuteCsound currently crashes the moment a MIDI event or a
>> realtime event score is received.
>> I create the thread using:
>>
>> ThreadID = csoundCreateThread(csThread, (void*)ud);
>>
>> my thread function looks like:
>>
>> uintptr_t qutecsound::csThread(void *data)
>> {
>> CsoundUserData* udata = (CsoundUserData*)data;
>> if(!udata->result) {
>> unsigned int numWidgets = udata->qcs->widgetPanel->widgetCount();
>> udata->qcs->channelNames.resize(numWidgets);
>> udata->qcs->values.resize(numWidgets);
>> while((csoundPerformKsmps(udata->csound) == 0)
>> and (udata->PERF_STATUS == 1)) {
>> if (udata->qcs->m_options->enableWidgets) {
>> udata->qcs->widgetPanel->getValues(&udata->qcs->channelNames,
>> &udata->qcs->values);
>> if (udata->qcs->m_options->chngetEnabled) {
>> writeWidgetValues(udata);
>> readWidgetValues(udata);
>> }
>> processEventQueue(udata);
>> }
>> }
>> csoundStop(udata->csound);
>> csoundCleanup(udata->csound);
>> csoundDestroy(udata->csound);
>> }
>> return 1;
>> }
>>
>> These crashes do not occur on Linux (haven't tested on Windows). Maybe
>> there's a problem with threaded operation on Mac, or there's something
>> else I need to do? Running within the same thread has no problem at
>> all.
>>
>> I get these suspicious messages on the console when QuteCsound crashes...
>>
>> 2008-10-28 09:52:35.238 qutecsound[753] CFLog (0): CFMessagePort:
>> bootstrap_register(): failed 1103 (0x44f), port = 0x4587, name =
>> 'Apple MIDI Client 753'
>> See /usr/include/servers/bootstrap_defs.h for the error codes.
>> 2008-10-28 09:52:35.239 qutecsound[753] CFLog (99):
>> CFMessagePortCreateLocal(): failed to name Mach port (Apple MIDI
>> Client 753)
>>
>> This is on OSX 10.4.11.
>>
>> Cheers,
>> Andrés
>
>
>
> Saludos,
> Felipe Sateler
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's
> challenge
> Build the coolest Linux based applications with Moblin SDK & win great
> prizes
> Grand prize is a trip for two to an Open Source event anywhere in the
> world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
>
>
--
Andrés
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great
prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net |