Re: MIDIOutputPortCreate returning a odd MIDIPortRef
Re: MIDIOutputPortCreate returning a odd MIDIPortRef
- Subject: Re: MIDIOutputPortCreate returning a odd MIDIPortRef
- From: Doug Wyatt <email@hidden>
- Date: Mon, 7 Jun 2004 12:57:46 -0700
On Jun 5, 2004, at 3:46, p3consulting wrote:
The confusing thing is
typedef struct OpaqueMIDIPort * MIDIPortRef;
in MIDIServices.h, this declaration pretends MIDIPortRef is an
address...
If MIDIPortRef is just a reference number it should be something like
unsigned MIDIPortRef ;
or better yet
unsigned MIDIPortID ;
OK, I didn't elaborate enough. It's just a number masquerading as a
pointer type so that the C compiler will give you a type error if you
try to use a MIDIPortRef as a MIDIClientRef (for example).
It's an opaque object -- you're not given any structure members to
access by dereferencing the pointer, so why does it matter if it's a
valid address?
Are they other xxxxRef in MIDI that are not the pointer they "pretend"
to be ?
All of them.
Also, most of the objects in the AudioToolbox behave the same, e.g.
AudioConverter, AudioFile, MusicSequence, MusicTrack, MusicPlayer, and
perhaps some more that I can't think of off the top of my head.
On Jun 7, 2004, at 10:04, Pete Gontier wrote:
Probably. This paradigm is used all over the Mac OS API these days.
That's
why there are accessor functions and high-level debugger plug-ins
which call
them. (I don't know if there is a debugger plug-in for CoreMIDI.)
No, however ...
The following doesn't work for CoreMIDI objects because they live in
the MIDIServer process (unless you attach to MIDIServer in gdb...), but
for the AudioToolbox opaque objects, you can do this:
(gdb) call (void)CAShow(object)
and get a printout, of the underlying object (this is implemented with
varying degrees of detail for the different objects -- I've found it
particularly helpful with AudioConverters). You can also just call
CAShow(void *) from your code. Note that this is only for *opaque*
objects -- for things like an AudioBufferList, AudioTimestamp,
AudioStreamBasicDescription, you're on your own. (Well, you can assign
an AudioStreamBasicDescription to a CAAudioStreamBasicDescription [SDK:
PublicUtility] and then invoke its Print method).
Doug
_______________________________________________
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.