It freezes before the sound plays

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

It freezes before the sound plays

RadekXxX
Hi,
the code is written in CodeTyphon for Raspberry CM4, I use the latest version of the UOS library, the system library and the UOS library (libSnd..so, ...) are identical. When I call UOS_Play, the audio file starts playing in about 4 minutes. The file being played is about 3 seconds.

This is the code:
uos_CreatePlayer (0);
uos_AddIntoDevOut (0, fDevice, 0.3, -1, 1, -1, -1, -1);
uos_AddFromFile (0, PChar (FileName), -1, -1, -1);
uos_Play (0);

Debug listing:
StreamIn [x] .Data.status = 1
Getting the level before DSP procedure
DSPin AfterBuffProcBefore
DSPin AfterBuffProcAfter
The synchro main loop procedure before
Getting the level after DSP procedure
End level after DSP procedure
Seeking if StreamIn is terminated
status = 1
Give Buffer to Output
Buffer [x2]: = cfloat (0.0)
length (StreamIn [x2] .Data.Buffer) = 37882
length (StreamOut [x] .Data.Buffer) = 65536
for x3: = 0 to high (StreamIn [x2] .Data.Buffer) do
high (StreamIn [x2] .Data.Buffer) = 37881
StreamOut [x] .Data.Buffer ------------------------------
for x3: = 0 to high (StreamIn [x2] .Data.Buffer) done
copy buffer-in into buffer-out
 if (length (Plugin)> 0) then
Convert Input format into Output
Finally give buffer to output
Give to output device
length (StreamOut [x] .Data.Buffer) = 65536
OUTPUT DATA into portaudio ------------------------------


=========> IN THIS POINT IT WILL FREEZE FOR 4 MINUTES, THEN THE SOUND PLAYS


give to output device 1
End give to output device 2
Before LoopEndProc ------------------------------
Before if (nofree = true) and (status = 0) -----
Before until status = 0; ----
Before for x: = 0 to high (StreamIn)
Before StreamIn [x] .Data.Seekable = True
DSPin BeforeBufProc 1
DSPin BeforeBufProc 2
Before sf_read 65536 length (StreamIn [x] .Data.Buffer 65536
0
after sf_read
OUTPUT DATA sf_read_ () ---------------------------
StreamIn [x] .Data.outframes = 0
StreamIn [x] .Data.status = 0
Seeking if StreamIn is terminated
status = 0
Before LoopEndProc ------------------------------
Before if (nofree = true) and (status = 0) -----
Before until status = 0; ----
Before Terminate Thread ---
Status = 0
Destroy DSP In
Destroy DSP Out
EndProc ---
EndProc All
This is the end ...

Can you please advise me where I am making a mistake?
Reply | Threaded
Open this post in threaded view
|

Re: It freezes before the sound plays

fredvs
Administrator
Hello RadekXxX and welcome in uos forum.

>  When I call UOS_Play, the audio file starts playing in about 4 minutes. The file being played is about 3 seconds.

Sorry but I need some more infos.
Does the player only start after 4 minutes and then plays only 3 seconds ?

That is indeed not ok.

How did you catch the debug log ?
Debugging is not possible with uos and sound-program in general.
The processor needs lot of resource for audio and debugging will have bad impact on latency.

Did you try to run your program without debugger ?

Do you have tested the demos from https://github.com/fredvs/uos/examples ?
There are also lpi project files ( CodeTyphon can convert Lazarus project into CT project )

Is the uos demo SimplePlayer working on your Rpi ?

Fre;D