Re: Who owns MIDIPacketList memory supplied to MIDISend
Re: Who owns MIDIPacketList memory supplied to MIDISend
- Subject: Re: Who owns MIDIPacketList memory supplied to MIDISend
- From: Eric Kampman <email@hidden>
- Date: Sun, 05 Jun 2011 15:04:06 -0700
On Jun 5, 2011, at 2:06 PM, philippe wicker wrote:
> On 5 Jun 2011, at 21:40, Eric Kampman wrote:
>> 2) if I use a global or some other more "permanant" memory, then if the data is NOT copied then I must ensure that I don't overwrite the data before it goes out the door.
>
> Your remark 2) is precisely why I assumed that the data inside the MIDIPAcketList are copied. That's especially true when using MIDISend API where single packet in the packet list may have a time stamp in the future (and are scheduled by CoreMIDI accordingly). Not copying the data would put on the caller the burden to manage the packet list life cycle. Anyway, my assumption may be wrong, people from Apple could easily clear that point.
For what it's worth I haven't found an official answer, but I've seen many examples of usage and they all put the MIDIPacketList on the stack. I'm adopting the "MIDISend copies the data" perspective. (of course it could be the same mistake replicated over and over). I'd still like a definitive answer, since passing an address of something on the stack makes me very uncomfortable.
Eric
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden