• 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: Stuck MIDI notes
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Stuck MIDI notes


  • Subject: Re: Stuck MIDI notes
  • From: Bill Stewart <email@hidden>
  • Date: Thu, 31 Oct 2002 10:53:19 -0800

For a simple MIDI In to *any* AudioUnit we have a new API in Jaguar -
AUMIDIController...

Basically - it works like this...


int numMIDI = MIDIGetNumberOfSources ();

if (numMIDI > 0) {
RequireNoErr (AUMIDIControllerCreate (NULL, &mMIDIController));

MIDIEndpointRef endpoint = MIDIGetSource (0);

RequireNoErr (AUMIDIControllerConnectSource (mMIDIController,
endpoint));

Then to map this to a particular AU:
RequireNoErr (AUMIDIControllerMapChannelToAU(mMIDIController, -1,
mAudioUnit, -1, false));


This will parse all the MIDI packets, etc for you and will do exactly what
you need I think

(There's more docs on this in the SDK - and this code has been added to
AudioUnitHostiing - due out shortly:)

Bill

on 30/10/02 7:12 PM, Kurt Revis wrote:

> On Wednesday, October 30, 2002, at 05:03 PM, Robert Grant wrote:
>
>> So then I'm confused about why I'm losing the note offs. My code is
>> to crunch the packets is pretty straightforward:
>>
>> MIDIPacket *inPacket = (MIDIPacket *)list->packet; // remove const
>>
>> for ( j = 0; j < list->numPackets; ++j) {
>> if ((inPacket->data[0] & 0x7) == m_channel) {
>> MusicDeviceMIDIEvent(unit, inPacket->data[0],
>> inPacket->data[1], inPacket->data[2],
>> 0);
>> }
>> inPacket = MIDIPacketNext(inPacket);
>> }
>
> This really isn't enough to parse MIDI correctly. Contrary to what
> you're assuming, each packet may contain more than one MIDI event.
> There may also be realtime messages (like MIDI clock) interspersed with
> the data, and sysex messages may get split across multiple packets.
> You need to handle all of these cases. Most of the time you'll only
> get one event per packet, but it's not something you can count on.
>
> You might find it educational to print out all the bytes in each packet
> as they come in, so you can see this for yourself. And read the MIDI
> spec... you'll be amazed at how weird things can get.
>
> --
> Kurt Revis
> email@hidden
> _______________________________________________
> 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.

--
mailto:email@hidden
tel: +1 408 974 4056

__________________________________________________________________________
"Much human ingenuity has gone into finding the ultimate Before.
The current state of knowledge can be summarized thus:
In the beginning, there was nothing, which exploded" - Terry Pratchett
__________________________________________________________________________
_______________________________________________
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: Stuck MIDI notes (From: Kurt Revis <email@hidden>)

  • Prev by Date: Problems with AppleMIDISerialDriver.plugin
  • Next by Date: Re: ANN: Rax 0.2b
  • Previous by thread: Re: Stuck MIDI notes
  • Next by thread: Re: Stuck MIDI notes
  • Index(es):
    • Date
    • Thread