• 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: Which is the correct way to set the packet->timestamp?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Which is the correct way to set the packet->timestamp?


  • Subject: Re: Which is the correct way to set the packet->timestamp?
  • From: "email@hidden" <email@hidden>
  • Date: Tue, 10 Jul 2012 11:30:12 +1000

Hi

My understanding is timestamp = 0 or "now" simply states that the packet should be transmitted at the earliest possible time. Depending on the MIDI interface, driver etc, that may not be a true "now". The packet is simply queued and sent as soon as possible irrespective of how other packets are timestamped in the transmit queue. Therefore, I think you are always better to set the timestamp to be some time in the future. This gives Core MIDI the best chance of correctly scheduling the packet and therefore reducing timing fluctuations, e.g timestamp = CurrentHostTime + kMIDIPropertyAdvanceScheduleTimeMuSec

Likewise when receiving a packet with timestamp of 0 or "now" it simply means a packet has arrived we don't know when but it's here. I have found in that case in my internal queuing and processing of incoming data, it's better to re-timestamp with CurrentHostTime. This also gives you a chance to order the arriving data by time.

regards
peter



On 10/07/2012, at 6:12 AM, Stephen Kay wrote:

> I'd like to verify that the following is the correct way to set the
> timestamp, for real-time generation of MIDI data "now":
>
> packet->timestamp = AudioGetCurrentHostTime();
>
> ... As opposed to:
>
> packet->timestamp = 0;  // docs say this means "now"
>
> If you use the second one, then MIDI Monitor by sNoize shows all events as
>
> *** ZERO ***
>
> Whereas using the first method shows them all with timestamps - which seems
> the way that most MIDI coming from other apps ends up looking.
>
> I used to use packet->timestamp = 0, but changed to the other method several
> months ago, and now I'm wondering if it has possibly introduced some timing
> fluctuations that didn't used to be there...
>
> Thanks,
> - Stephen
>
> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
> Stephen Kay
> Karma-Lab :: developers of KARMA
> http://www.karma-lab.com
> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
>
>
>
> _______________________________________________
> 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: 
 >Which is the correct way to set the packet->timestamp? (From: Stephen Kay <email@hidden>)

  • Prev by Date: Re: achieving very low latency
  • Next by Date: RE: iOS: Multiple AUs versus everything in one render callback
  • Previous by thread: Which is the correct way to set the packet->timestamp?
  • Next by thread: Re: achieving very low latency
  • Index(es):
    • Date
    • Thread