This post was updated on .
Hi, Fred, how are you?
I don't know why, but after the last updates (specifically, 185 e 186 revisions), my routines don't work anymore as expected. Basically, I've the follow code in a Thread Loop: uos_CreatePlayer(id); with(sounds[id]) do begin input_id := uos_AddFromFile(id, pchar(file), -1, 0, 1024); output_id := uos_AddIntoDevOut(id, -1, LATENCY,uos_InputGetSampleRate(id, input_id), uos_InputGetChannels(id, input_id), 0, 1024); end; uos_Play(id); Until revision 184, the code above works very well, but, with 185 or 186, it plays only once, and then stops. The Thread Timer loop stops too, but the executable still keeps running (no freezing). Thanks for your attention! |
Administrator
|
Hello Fauri.
Huh, please, could you give a demo of your problem, I cannot reproduce it. Thanks. Fre;D |
Administrator
|
In reply to this post by fauri
Re-hello fauri.
Did you read my last post of this topic : http://uos.2369694.n4.nabble.com/Strange-issues-with-different-formats-td58i20.html Fre;D |
This post was updated on .
The example in attachment shows what's happening. Until revision 184, it's playing as expected. But, with 185 or 186 revisions, the performance falls down. Yeap, but I ended up with another solution: A thread timer loop with the code bellow inside it: if(uos_GetStatus(0) <> 1) then uos_PlayNoFree(0);For me, that solution was more accurate. Cheers! test.zip |
Administrator
|
Hello Fauri.
OK, we will find your solution. In last commit 3ed91ff..4dce331 I re-writed SimpleDrums demo with same ideas as in beginning --> 1 player for each instrument. Could you try it ? > The example in attachment shows what's happening. Ok, I will take a look (but maybe last commit does it). Fre;D |
Administrator
|
In reply to this post by fauri
> The example in attachment shows what's happening.
Oooops, indeed, there was a horrible bug. Well seen and thanks ! Fixed in last commit 4dce331..6832b23. Huh, by the way, I am not sure your demo is the best way to do loop for drums. Did you try with a TMemoryStream, like in consoleplaymemorystream demo ? Or with a memory-buffer like from consoleplaymemorybuffer demo ? And this with PlayNoFree() ? Fre;D |
Administrator
|
Re-hello.
No, it is not good yet. ;-( I did try simpledrums_fpGUI ---> +- ok. But with simpledrums LCL (Lazarus) ---> a disaster, no synchro at all. Fre;D |
I noticed that! So far, unfortunely, this was the best way I found to create the drum machine. I didn't saw any performance differences using the Memory Buffer method. In fact, it was even worse when the sounds was changed from one to another (a delay until the file was loaded into memory). With Memory Stream, initially I came across with some errors. Now, it plays only once, then nothing more happens. Same sync problems... :( |
Administrator
|
Yep, I updated SimpleDrums demos in last commit : 6832b23..092f4a2 Aaargh, ok, I will take a look. Maybe with Qt it is better ? Look at this : http://forum.lazarus.freepascal.org/index.php/topic,15223.msg81442.html#msg81442 Fre;D |
Administrator
|
In reply to this post by fauri
Hello. Updated SimpleDrums demos using TMemoryStream in last commit 092f4a2..4c97dcd . I have good result for LCL too. Fre;D |
Good! With this last commit, my project worked fine again. I was using revision 184 until now, which gave me the results I wish.
With the last SimpleDrums example, I realized the fact that uos_PlayNoFree's problem is the latency parameter. But, for me at least, values less than 0.04 result in a problematic sound at all. The problem is, even with 0.04, is perceptible a little bit of desync. Another thing: I don't see any performance differences using uos_AddFromFile instead of uos_AddFromMemoryStream. Best Regards! |
Administrator
|
uos_AddFromFile does access to disk vs uos_AddFromMemoryStream does access only on ram-memory. Now about performance, indeed access to disk, those days, is very fast. What os are you using, with what lcl (gtk, qt, win32,...), with what fpc version ? Fre;D |
Now, I'm using FPC 3.0.0, with win32, Lazarus 1.6. With Lazarus 1.6.4 and FPC 3.0.2, I had the same problems in the last week, when I was testing. Fred, a few hours ago, I'm noticed another strange issue. After many builds that I did in my application, the last UOS commit was slow again. So, I did a downgrade one more time to 184 revision, and everything worked fine again. Strange, don't you? |
Administrator
|
Huh, what is 184 revision, can you give the date of that commit so I can compare. Fre;D |
Of course! :)
The Date of revision 184 is 03/20/2017 (bellow it's in Brazilian Portuguese). Revision: 184 Author: fredvs Date: segunda-feira, 20 de março de 2017 16:41:43 Message: Added some improvements from Phoenix. ---- Modified : /branches/master/examples/consoleplaymemorybuffer.prj Modified : /branches/master/examples/uos_flat.pas Modified : /branches/master/src/uos_flat.pas Modified : /branches/master/examples/uos.pas Modified : /branches/master/examples/waveform_fpGUI.prj Modified : /branches/master/src/uos.pas |
Administrator
|
Obrigado.
Huh, was do you feel slower, the synchro, the loading of sound,... ? |
:D Mijn genoegen! (You're dutch, right? I guess...) Yeap, synchro problem again... |
Administrator
|
No, only my name, I am latino, like you (I guess). Could you try last commit 2125bb9..1fa1930, it takes all what can influe to synchro from earlier-working commit. Fre;D |
Ahmm... I can't find "simpledrums.lpi" and "simpledrums.pas" anymore... It's a bug with my svn method, or the files aren't present in the last commit?
|
Administrator
|
> Ahmm... I can't find "simpledrums.lpi" and "simpledrums.pas" anymore...
Huh, in GitHub, it is there: https://github.com/fredvs/uos/blob/master/examples/simpledrums.lpi https://github.com/fredvs/uos/blob/master/examples/simpledrums.lpr https://github.com/fredvs/uos/blob/master/examples/main_sd.pas https://github.com/fredvs/uos/blob/master/examples/main_sd.lfm Fre;D |
Free forum by Nabble | Edit this page |