[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[sc-dev] SF.net SVN: supercollider:[8203] trunk/Source/lang/LangPrimSource/ SC_CoreMIDI.cpp
Revision: 8203
http://supercollider.svn.sourceforge.net/supercollider/?rev=8203&view=rev
Author: thelych
Date: 2008-12-19 09:31:01 +0000 (Fri, 19 Dec 2008)
Log Message:
-----------
Disposing the MIDI Client in OS X (prDisposeMIDIClient) now calls directly midiCleanUp() + the function won't throw an error if there is no MIDIClient to dispose (fix the current MIDI initialization problem).
Modified Paths:
--------------
trunk/Source/lang/LangPrimSource/SC_CoreMIDI.cpp
Modified: trunk/Source/lang/LangPrimSource/SC_CoreMIDI.cpp
===================================================================
--- trunk/Source/lang/LangPrimSource/SC_CoreMIDI.cpp 2008-12-19 05:00:13 UTC (rev 8202)
+++ trunk/Source/lang/LangPrimSource/SC_CoreMIDI.cpp 2008-12-19 09:31:01 UTC (rev 8203)
@@ -310,7 +310,7 @@
}
}
-void midiCleanUp();
+int midiCleanUp();
int initMIDI(int numIn, int numOut)
{
@@ -371,22 +371,33 @@
return errNone;
}
-void midiCleanUp()
-{
+int midiCleanUp()
+{
+ /*
+ * do not catch errors when disposing ports
+ * MIDIClientDispose should normally dispose the ports attached to it
+ * but clean up the pointers in case
+ */
for (int i=0; i<gNumMIDIOutPorts; ++i) {
MIDIPortDispose(gMIDIOutPort[i]);
+ gMIDIOutPort[i] = 0;
}
gNumMIDIOutPorts = 0;
for (int i=0; i<gNumMIDIInPorts; ++i) {
MIDIPortDispose(gMIDIInPort[i]);
+ gMIDIInPort[i] = 0;
}
gNumMIDIInPorts = 0;
if (gMIDIClient) {
- MIDIClientDispose(gMIDIClient);
+ if( MIDIClientDispose(gMIDIClient) ) {
+ post( "Error: failed to dispose MIDIClient\n" );
+ return errFailed;
+ }
gMIDIClient = 0;
}
+ return errNone;
}
@@ -594,7 +605,7 @@
err = slotIntVal(b, &numIn);
if (err) return errWrongType;
- err = slotIntVal(c, &numOut);
+ err = slotIntVal(c, &numOut);
if (err) return errWrongType;
return initMIDI(numIn, numOut);
@@ -602,15 +613,7 @@
int prDisposeMIDIClient(VMGlobals *g, int numArgsPushed);
int prDisposeMIDIClient(VMGlobals *g, int numArgsPushed)
{
- PyrSlot *a;
- a = g->sp - 1;
- OSStatus err = MIDIClientDispose(gMIDIClient);
- if (err) {
- post("error could not dispose MIDIClient \n");
- return errFailed;
- }
- return errNone;
-
+ return midiCleanUp();
}
int prRestartMIDI(VMGlobals *g, int numArgsPushed);
int prRestartMIDI(VMGlobals *g, int numArgsPushed)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
_______________________________________________
sc-dev mailing list
info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: https://listarc.bham.ac.uk/marchives/sc-dev/
search: https://listarc.bham.ac.uk/lists/sc-dev/search/