[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [sc-dev] [sc3] midi in

OK it's been a while but I've looked at this code and it has a problem that can cause heap corruption. You cannot store an SC object into a C object unless you have done something on the
language side to insure that it cannot get garbage collected.
All of your midi-in objects need to be in some global classvar array (in the same way that windows and files are done) in order to insure that they don't get garbage collected out from under you. In your example you store it in an interpreter variable, so it is safe there, but in the general case you need to make sure your object does not become garbage.
other problems:
You should use slotIntVal() to get the integer value of argument b.
It may not be of class Integer.
int prJtMIDIconnect(VMGlobals *g, int numArgsPushed){
    //connect port to client
    PyrSlot *a, *b;
    a = g->sp - 1;
    b = g->sp ;

    JtInitMidiInput(b->ui, a->uo);

On Thursday, July 18, 2002, at 07:41  AM, Jan Trutzschler wrote:

i made a new version of a the control midi in that is now based on a c++ class, so it does the things that one would expect from it.

sc-dev mailing list

--- james mccartney   james@xxxxxxxxxxxxxx   <http://www.audiosynth.com>
SuperCollider - a real time synthesis programming language for the PowerMac.