Re: Calling MIDIPacketListAdd from NSTimer
Re: Calling MIDIPacketListAdd from NSTimer
- Subject: Re: Calling MIDIPacketListAdd from NSTimer
- From: philippe wicker <email@hidden>
- Date: Wed, 12 Oct 2011 19:42:22 +0200
On 12 Oct 2011, at 19:26, Tom Jeffries wrote:
> So if I do:
>
> MIDIPacketListInit
> MIDIPacketListAdd
> MIDISend
>
> with all the correct parameters, does the packet get played when I do
> the MIDISend or at the time given in MIDIPacketListAdd (provided, of
> course, it is in the future rather than the past)?
The packet list is passed to (copied by) the midi server which will schedule it according with the MIDITimeStamp. The MIDITimeStamp is an absolute time - the number of clock ticks since the machine has started I believe. I think the MIDI server will "immediately" send the packet if this absolute time is less than the current machine time, and else send this packet at the absolute time specified in the time stamp.
>
> I haven't been involved with the application level of audio on Mac
> products for a number of years, my company has done quite a bit of
> driver work but that seems to be better documented.
>
> On Wed, Oct 12, 2011 at 10:14 AM, Robert Martin
> <email@hidden> wrote:
>> No - I don't think you've missed a 'secret' documentation cache. I learned to move my MIDI code from OS9 to OSX by looking at the source code from Kurt Revis' projects at snoize.com - MIDI Monitor, SysEx Librarian, & SnoizeMIDI - great stuff. Peter Yandell also wrote a great MIDI 'toolkit' for his 'MIDI Patchbay' app - the source is also available. The MIDIPacketxxx routines simply manipulate 'midi' bytes stored in structs called MIDIPackets. The important thing to get is what Brian pointed out - that the coreMIDI engine handles the 'exact time' that a message is transmitted - as long as you provide a timestamp and enough 'slop' for it to do its job. In other words, adding a packet to the 'queue' does not in fact 'send' it - coreMIDI sends it for you at the right time - provided it's been added to the queue with a valid timestamp for when it should be sent.
>>
>> Rob
>>
>>
>>
>> On Oct 12, 2011, at 12:41 PM, Tom Jeffries wrote:
>>
>>> … A question for you, Doug, and anybody else- the documentation on MIDI
>>> packets seems very sparse! The MIDI services reference has sparse
>>> documentation for MIDIPacketListInit, MIDIPacketListInit, and
>>> MIDIPacketNext (I'm still not sure how or why you use MIDIPacketNext,
>>> by the way) and there are a few source code examples from various
>>> sources, but it's been pretty much "guess and go" programming trying
>>> to make this program work. I remember last spring there was a book
>>> coming out covering CoreAudio, they hadn't finished the MIDI section
>>> and as far as I've seen the book still hasn't come out.
>>>
>>> Is there some piece of solid documentation that I've been missing all
>>> this time? It seems to me that the fact that you need to call
>>> MIDISend for each packet and MIDIPacketInit before sending another
>>> packet should be something that developers can find fairly easily.
>>> Maybe I've just missed something?
>>
>>
> _______________________________________________
> 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