• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Calculating size for MIDIPacketListAdd
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Calculating size for MIDIPacketListAdd


  • Subject: Re: Calculating size for MIDIPacketListAdd
  • From: Doug Wyatt <email@hidden>
  • Date: Thu, 19 Sep 2002 10:40:53 -0700

On Thursday, Sep 19, 2002, at 06:17 US/Pacific, email@hidden wrote:
When a MIDIPacketList is init'ed it has single MIDIPacket inside (an array
with a single element.)

It's dangerous to think of the MIDIPacketList's MIDIPackets as array elements. It's declared that way because it's the closest way to express it in C. A MIDIPacketList is actually a *stream* of variable-sized MIDIPackets and they can't be randomly accessed except by walking through the stream/structure from the beginning.

Can/should I assume that this is how the MIDIPacketList
coming into my Read Proc is sized?

It's just a chunk of memory ... you can't make any assumptions about how big a chunk of memory was allocated.

Question: Is MIDIPacketListInit creating a MIDIPacketList or *blessing* a block of data
as a MIDIPacketList? I read it originally as a way to create lists but now I think I'm wrong.

It's just initializing a buffer for use with MIDIPacketListAdd.

The problem is - if I'm adding to someone else's MIDIPacketList (like the one I get passed
in my Read Proc) I've got no guarantee of it's maximum size - just that it's *at least* sizeof(MIDIPacketList). That makes me think that I shouldn't be adding my packets to someone else's packet list?

Right. That's why the incoming MIDIPacketList is declared const. You're not supposed to alter it at all, just read from it. It won't be someone else's data you're corrupting, if you succeed in writing to the memory without a memory protection fault, it'll probably be a buffer in the implementation, and the data you write could well get stomped on when more comes in.

Doug

--
Doug Wyatt
work: email@hidden (CoreAudio)
personal: email@hidden http://www.sonosphere.com
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: Calculating size for MIDIPacketListAdd (From: email@hidden)

  • Prev by Date: Re: Sound Font?
  • Next by Date: Re: Connecting AU's without an AUGraph
  • Previous by thread: Re: Calculating size for MIDIPacketListAdd
  • Next by thread: Re: Calculating size for MIDIPacketListAdd
  • Index(es):
    • Date
    • Thread