Re: [Jack-Devel] How to sync non-audio actions to JACK audio?

PrevNext  Index
DateMon, 21 Feb 2011 00:05:54 +0100
From Slavko Glamočanin <[hidden] at gmail dot com>
ToFelix Homann <[hidden] at web dot de>
Cc[hidden] at lists dot jackaudio dot org
In-Reply-ToFelix Homann [Jack-Devel] How to sync non-audio actions to JACK audio?
You can use a ringbuffer to trigger events outside the jack processing
thread (see the jack examples for ringbuffer usage). If you are using SDL
you can just push events to its main processing thread.

As for video, at 60fps thats 16ms per frame, jack processing callback should
be under 10ms usually, so that gives you ample time to manipulate video.
You can calculate which frame to display or something like that in the
processing callback and communicate this with other threads via a ringbuffer
(if sending video commands like play, position), or just writing to a
currentFrame type variable, which you read when displaying video (in another
thread).

This is more of a threading implementation thing, if you're using SDL you
should be ok:)

Regards,
Slavko

On Fri, Feb 18, 2011 at 9:59 PM, Felix Homann <[hidden]> wrote:

> Hi again,
>
> here's another question for a better understanding of JACK.
>
> I want to sync non-audio actions as sample accurate as possible to a sound
> file. For example, video playback or as in my case, I want to trigger some
> actions via OSC (Open Sound Control) instead of MIDI.
>
> Say, my process() callback has just written N audio frames to an output
> buffer. I want to call some function as exactly as possible when frame
> number n  (with 0 < = n <= N) is "played". When is frame number n actually
>  "played" after process() was called? What means are there in the JACK API
> to sync external non-audio actions to audio? Are there some examples for
> best practices?
>
> Kind regards,
>
> Felix
> 
> Jack-Devel mailing list
> [hidden]
> http://lists.jackaudio.org/listinfo.cgi/jack-devel-jackaudio.org
>
PrevNext  Index

1298243182.28049_0.ltw:2,a <AANLkTikwsKQNEBPrAoEjocdfHSz+CU0UGttBV9cSP7CS at mail dot gmail dot com>