• 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: MIDISend output from with my program...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: MIDISend output from with my program...


  • Subject: Re: MIDISend output from with my program...
  • From: Brian Kennedy <email@hidden>
  • Date: Thu, 31 Mar 2005 17:19:49 -0700

I am also new to MIDI programming on the Mac and seem to be running
into a similar problem with the code I am working on.  My packets seem
to be correct according to what I see in the debugger but
unfortunately my data is not making its way out to the device I am
testing with.  I fear I may have set up the gOutPort incorrectly in my
code.  Following the echo example code, I am able to see all of the
available devices, but I can't seem to find any examples of how to
find out what gOutPort should be set to for those devices.  Is there
something I am missing or am I going about this in completely the
wrong way?  Thanks,

-Brian


On Thu, 31 Mar 2005 09:03:12 -0800, Doug Wyatt <email@hidden> wrote:
> On Mar 30, 2005, at 17:46, Paul Swearingen wrote:
>
> > inline void MidiOut3(int byte0, int byte1, int byte2)
> > {
> >     MIDIPacketList packetList;
> >
> >     MIDIPacket packet = packetList.packet[0];   // I think this
> > starts out pointing to the first packet
> >
>
> No, you've copied garbage from the uninitialized local variable
> packetList into the local variable packet.
>
>
> >     packetList.numPackets = 1;
> >
> >     packet.timeStamp = 0;
> >
> >     packet.length = 3;
> >
> >     packet.data[0] = byte0;
> >     packet.data[1] = byte1;
> >     packet.data[2] = byte2;
> >
>
> Now you've filled out packet, but packetList.packet[0] is still garbage.
>
> > MIDISend(gOutPort, gDest, &packetList);
> > }
> >
>
> Either make packet a C++ reference to packetList.packet[0], or a
> pointer to it, e.g.:
>
> MIDIPacket *packet = &packetList.packet[0];
> packet->timeStamp = 0;
> packet->length = 3;
> packet->data[0] = byte0;
> packet->data[1] = byte1;
> packet->data[2] = byte2;
>
> Don't do anything with packetList.packet[1] or beyond; packet[0] is
> variable-length. Use MIDIPacketNext to traverse the packets in a
> packetlist (on reading)... or MIDIPacketListInit / MIDIPacketListAdd
> to  build a multiple packet list dynamically.
>
> Doug
>
>  _______________________________________________
> 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
>
 _______________________________________________
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

References: 
 >MIDISend output from with my program... (From: "Paul Swearingen" <email@hidden>)
 >Re: MIDISend output from with my program... (From: Doug Wyatt <email@hidden>)

  • Prev by Date: Leisurely processing of incomming MIDI data
  • Next by Date: Re: MIDISend output from with my program...
  • Previous by thread: Re: MIDISend output from with my program...
  • Next by thread: Re: MIDISend output from with my program...
  • Index(es):
    • Date
    • Thread