Issue with uos_LoopProcIn(...) on MacOS (blocking the playback)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Issue with uos_LoopProcIn(...) on MacOS (blocking the playback)

manlio.mazzon
While testing UOS on the Mac (Lazarus 2.0, fpc 3.0.4) a point came up about tracking the position of an audio file over time.

Not knowing any better, initially I used a TTimer.OnTimer event, in which I read the current position with uos_InputPositionSeconds(...) and then update my position bar accordingly.

That was working fine, but then I learned that the proper way to do that is to use uos_LoopProcInt(...) with the callback procedure of object. So I started using that.

However now I discovered an issue with that:

When the audio is playing, if I grab the program's window by the title bar to move it around, the playing stops, and only continues after I let go of the window with the mouse.

So it looks like the callback procedure registered by uos_LoopProcInt(...) is blocking the playing thread.

On the other hand, if I read the current position using OnTimer events, the playing continues, and the position is updated even while I am dragging the program windows around.

I don't know if the same thing happens on Windows, Linux, etc. but it should be easy to try: open a demo app like SimplePlayer, start playing an audio file, and while it plays, move the program window -- on my Mac, the sound stops.

All the best!

Manny
Reply | Threaded
Open this post in threaded view
|

Re: Issue with uos_LoopProcIn(...) on MacOS (blocking the playback)

fredvs
Administrator
> I don't know if the same thing happens on Windows, Linux, etc. but it should be easy to try: open a demo app like SimplePlayer, start playing an audio file, and while it plays, move the program window -- on my Mac, the sound stops.

No, it does not append for Linux or Windows.
What widget are you using?
Of course if you do not need high precision you may use a timer.
Also what is the interval of the timer?
Maybe the speed of the loop-procedure is too fast for what you want to archive.

So in your uos_LoopProcIn(). method you may mimic a timer like:

 if now - lasttime > ainterval then
  begin
  lasttime := now;
  dothesynchro();
  end;


 
Reply | Threaded
Open this post in threaded view
|

Re: Issue with uos_LoopProcIn(...) on MacOS (blocking the playback)

manlio.mazzon

The problem happened with Lazarus 32 bit for MacOS, FOC 3.04, and Carbon for LCLWidgetType

Now I moved to 64 bit compiler and I used a different library which I downloaded online (see the previous thread) and things work correctly.

Thanks!