/*__________________________________________________________________________________*/ static MidiEvPtr CopyPrivateEv( lifo* fl, MidiEvPtr ev) { MidiEvPtr copy = MSNewCell( fl); if (copy) { MidiSTPtr ext = (MidiSTPtr)MSNewCell( fl); if (!ext) { MSFreeCell (copy, fl); return 0; } *copy = *ev; *ext = *LinkST(ev); LinkST(copy) = ext; } return copy; }
/*__________________________________________________________________________________*/ static MidiEvPtr NewPrivateEv( lifo* fl, short typeNum) { MidiEvPtr ev = MSNewCell( fl); if( ev) { MidiSTPtr ext= (MidiSTPtr)MSNewCell(fl); if ( !ext) { MSFreeCell (ev, fl); return 0; } /* creates a clear extension block */ ext->val[0]= ext->val[1]= ext->val[2]= ext->val[3]= 0; Link(ev)= 0; /* initialize the header */ Date(ev)= defaultTime; EvType(ev)= (uchar)typeNum; RefNum(ev)= 0xff; Chan(ev) = Port(ev) = 0; LinkST(ev)= ext; /* link the extension block */ } return ev; }
/*__________________________________________________________________________________*/ static MidiEvPtr NewSmallEv( lifo* fl, short typeNum) { MidiEvPtr ev = MSNewCell( fl); if( ev) { Link(ev)= 0; Date(ev)= defaultTime; EvType(ev)= (uchar)typeNum; RefNum(ev)= 0xff; Chan(ev) = Port(ev) = 0; ev->info.longField = 0; } return ev; }
/*__________________________________________________________________________________*/ static void AddFSexEv( lifo* fl, MidiEvPtr e, long v) { MidiSEXPtr nouv; MidiSEXPtr ext = LinkSE(e); int i = ext->data[11]; if( i < 11) { /* If there remains place */ ext->data[i] = (Byte)v; /* store the value */ ext->data[11]++; /* update the busy space count */ } else { nouv = (MidiSEXPtr)MSNewCell(fl); /* add a new cell */ if( nouv) { ext->data[11] = (Byte)v; /* store the value */ nouv->data[11] = 0; /* busy space count */ nouv->link= ext->link; /* link the new cell */ ext->link= nouv; LinkSE(e)= nouv; /* link header to the last cell */ } } }
/*__________________________________________________________________________________*/ static MidiEvPtr CopySmallEv( lifo* fl, MidiEvPtr ev) { MidiEvPtr copy = MSNewCell( fl); if (copy) *copy = *ev; return copy; }
MidiEvPtr MIDISHAREAPI MidiNewCell(void) { return MSNewCell(FreeList(Memory(gMem))); }