load of uos on main thread during playback

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

load of uos on main thread during playback

masman
Hi Fred.
1st let me praise your work on uos.  was looking for an audio object /library that we could grow into but could be scaled back as needed. you were the 3rd library and your code just worked!  we added it to my  software that plays back non audio data on the screen.  my software uses a timer to trigger the reading of data and then display it on the screen.
When I start an audio playback at the same time, my timer slows down to the point I can see it's off by nearly 3 seconds after just 120 seconds.  the CPU load from task manager say the whole program only take 1% of 1 of my 7 cores running win 10 so I don't think it's a hardware resource issue.
My question is Do you think the uos wav playback will have a lesser impact on the main thread timing if I move it into it's own thread?  I read in this forum somewhere where you said it already ran in it's own thread so I question my solution.
the bottom line is I wish to synchronize what was heard/played when data was recorded.
Thank you.
mas
Reply | Threaded
Open this post in threaded view
|

Re: load of uos on main thread during playback

fredvs
Administrator
This post was updated on .
Hello and welcome to uos forum.

Not sure to understand.

You have a timer that reads data and shows it to display.

And when you run a uos_player it breaks the synchronization of the timer.

Is it this?

If yes, what timer are you using?
What widgetset (LCL, MSEgui, fpGUI)?

Each uos_player is a thread so no need to encapsulate in a other thread.
Did you try to use the uos_player to synchronize what the timer does?

You may use then the uos_player as a timer and synchronize what you want with uos_LoopProcIn().
Please take a look at Simpleplayer demo how to use uos_LoopProcIn().

To mimic a timer you may use in the LoopProc:

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


Reply | Threaded
Open this post in threaded view
|

Re: load of uos on main thread during playback

fredvs
Administrator
Re-hello.

Could you try this:

Run your program with the timer on (without uos_player as playback).

Run the uos demo "SimplePlayer" and play a sound.

Does it affect the timer of your running program?

Fre;D
Reply | Threaded
Open this post in threaded view
|

Re: load of uos on main thread during playback

masman
thank you for the suggestions.  my main question is if I will improve my timing by making my uos library into a thread.  I do not see this delay when I run simplePlayer at the same time I our code (with sound off).  
The timing delay is in our code (another developer) so I was trying to avoid having them correct their code. The "loop" suggestion is  a good one and is just what we need for the next stage (full sync).  
Thank you.