Re: [LAD] Fw: Re: Deriving a steady MIDI clock crossplatform?

2022-05-19 Thread Fons Adriaensen
On Thu, May 19, 2022 at 11:17:28PM +0200, Jeanette C. wrote:

> Thanks both of you. Based on timed_wait, I looked at the boost libraries and
> found two candidates in the Thread library:
> conditional_varaible::timed_wait
> and
> thread::sleep_until
> which can both take an absolute time. I suppose both should be equally
> usable, since again absolute time can be calculated independent of the last
> wait/sleep?

Better check how this is implemented. It could just use usleep().
And then all precision is lost, even if the sleep times are adjusted to
compensate for the latency of the previous event.

Ciao,

-- 
FA



___
Linux-audio-dev mailing list
Linux-audio-dev@lists.linuxaudio.org
https://lists.linuxaudio.org/listinfo/linux-audio-dev


Re: [LAD] Fw: Re: Deriving a steady MIDI clock crossplatform?

2022-05-19 Thread Jeanette C.
Thanks both of you. Based on timed_wait, I looked at the boost libraries and 
found two candidates in the Thread library:

conditional_varaible::timed_wait
and
thread::sleep_until
which can both take an absolute time. I suppose both should be equally usable, 
since again absolute time can be calculated independent of the last 
wait/sleep?


Best wishes,

Jeanette

May 19 2022, Fons Adriaensen has written:


On Thu, May 19, 2022 at 10:40:48PM +0200, Robin Gareus wrote:


While there is a corresponding mach/clock.h, for the case at hand it is
preferable to use Apple's Core Audio, CoreMIDI. MIDI Event scheduling is
abstracted, and there is dedicated API to convert timestamped events
with high precision:

AudioConvertNanosToHostTime() and AudioConvertHostTimeToNanos()


The problem here is not conversion, but what to wait for,

In zita-convolver.h there is an implementation of sem_t for OSX
(which only has a crippled implementation), using a condition
variable. It doesn't have sem_timedwait(), (since zita-convolver
doesn't need it) but that could be added quite easily.

Ciao,

--
FA

___
Linux-audio-dev mailing list
Linux-audio-dev@lists.linuxaudio.org
https://lists.linuxaudio.org/listinfo/linux-audio-dev


--
 * Website: http://juliencoder.de - for summer is a state of sound
 * Youtube: https://www.youtube.com/channel/UCMS4rfGrTwz8W7jhC1Jnv7g
 * Audiobombs: https://www.audiobombs.com/users/jeanette_c
 * GitHub: https://github.com/jeanette-c

If there's nothing missing in my life
Then why do these tears come at night <3
(Britney Spears)
___
Linux-audio-dev mailing list
Linux-audio-dev@lists.linuxaudio.org
https://lists.linuxaudio.org/listinfo/linux-audio-dev


Re: [LAD] Fw: Re: Deriving a steady MIDI clock crossplatform?

2022-05-19 Thread Fons Adriaensen
On Thu, May 19, 2022 at 10:40:48PM +0200, Robin Gareus wrote:
 
> While there is a corresponding mach/clock.h, for the case at hand it is
> preferable to use Apple's Core Audio, CoreMIDI. MIDI Event scheduling is
> abstracted, and there is dedicated API to convert timestamped events
> with high precision:
> 
> AudioConvertNanosToHostTime() and AudioConvertHostTimeToNanos()

The problem here is not conversion, but what to wait for,

In zita-convolver.h there is an implementation of sem_t for OSX
(which only has a crippled implementation), using a condition
variable. It doesn't have sem_timedwait(), (since zita-convolver
doesn't need it) but that could be added quite easily.

Ciao,

-- 
FA

___
Linux-audio-dev mailing list
Linux-audio-dev@lists.linuxaudio.org
https://lists.linuxaudio.org/listinfo/linux-audio-dev


Re: [LAD] Fw: Re: Deriving a steady MIDI clock crossplatform?

2022-05-19 Thread Robin Gareus
On 5/19/22 22:27, Fons Adriaensen wrote:
> Don't know about Apple. Last time I looked it didn't have clock_gettime(),

While there is a corresponding mach/clock.h, for the case at hand it is
preferable to use Apple's Core Audio, CoreMIDI. MIDI Event scheduling is
abstracted, and there is dedicated API to convert timestamped events
with high precision:

AudioConvertNanosToHostTime() and AudioConvertHostTimeToNanos()

--
robin


OpenPGP_signature
Description: OpenPGP digital signature
___
Linux-audio-dev mailing list
Linux-audio-dev@lists.linuxaudio.org
https://lists.linuxaudio.org/listinfo/linux-audio-dev