Administrator
|
Hello.
Sorry but I cannot reproduce. Is there a uos demo with the problem ? If no coud you give a example with the problem ? Thanks, Fre;D |
Hi, Fred! So, the issues appears after I updated uos libraries (my project doesn't was using memorybuffer yet). With uos_AddFromFile and uos_AddIntoDevOut, a framecount of 1024 reduced the duration of each sound, but I resolved with -1 as parameter. But even so, a particular sound (a splash wav) still be playing with a cut off at the end. Ah, some mp3 files not even play. Strange... after downgrade, everything is back to normal again.
|
Administrator
|
Hello Fauri and sorry for the inconvenient.
Could you try with last commit : f4ffcc7..3504688 Thanks. Fre;D |
Administrator
|
Re-hello.
oops, I see something. Write you later. Fre;D |
Administrator
|
Re-hello.
Could you try with last commit 3504688..301375f? Thanks. Fre;D |
Thanks again for your effort, Fred. No more cut offs at the end, but...
I don't know why (and don't know to say if there a problem with my code), but for me, uos_EndProc doesn't works anymore. Plus, I noticed that ogg synchronism is more inaccurate, such as the format takes more time to be recognized. I'm still using uos_AddFromFile (no memory buffer envolved). |
Administrator
|
Hello.
Was it working with old release ? Fre;D |
This post was updated on .
> Was it working with old release?
No more... I don't understand what happened. I made a short project with the method I use to loop a sound (attached) for you take a look when you have a time. Thanks for now. loop_test.zip |
Administrator
|
Hello.
It cannot work. You define as endproc() for player1 to re-play player1. You should use 2 players and swicth from one to the other like this: unit Unit1; {$mode objfpc}{$H+} interface uses Classes, uos_flat, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls; type { TForm1 } TForm1 = class(TForm) Button1: TButton; procedure Button1Click(Sender: TObject); procedure FormCreate(Sender: TObject); private { private declarations } public { public declarations } procedure Restart1; procedure Restart2; end; var Form1: TForm1; implementation {$R *.lfm} { TForm1 } procedure TForm1.Button1Click(Sender: TObject); begin uos_Playnofree(0); end; procedure TForm1.FormCreate(Sender: TObject); var ordir, lib1, lib2: string; begin ordir := Application.Location; lib1 := ordir + 'lib\LibPortaudio-32.dll'; lib2 := ordir + 'lib\LibSndFile-32.dll'; uos_LoadLib(Pchar(lib1), Pchar(lib2), nil, nil, nil, nil); uos_CreatePlayer(0); uos_AddFromFile(0, Pchar(Application.Location + 'loop.wav'), -1, 0, -1); uos_AddIntoDevOut(0, -1, -1,uos_InputGetSampleRate(0, 0), uos_InputGetChannels(0,0), 0, -1); uos_EndProc(0, @Restart2); uos_CreatePlayer(1); uos_AddFromFile(1, Pchar(Application.Location + 'loop.wav'), -1, 0, -1); uos_AddIntoDevOut(1, -1, -1,uos_InputGetSampleRate(1, 0), uos_InputGetChannels(1,0), 0, -1); uos_EndProc(1, @Restart1); end; procedure TForm1.Restart1; begin uos_Playnofree(0); end; procedure TForm1.Restart2; begin uos_Playnofree(1); end; end. |
This post was updated on .
I see. But I remember that it worked until some days ago, with only one player, but I don't know to explain how and why.
By the way, did you realized that a single unit (without a form, as is in my small project) can't calls a own method using uos_EndProc? It's necessary to point another procedure outside. As I had once said, seems a FPC limitation. I've some suggestions about loops, but I believe that this topic is far way from your initial goal! So, I'll create another. Thanks! |
Administrator
|
> It's necessary to point another procedure outside. As I had once said, seems a FPC limitation.
uos_EndProc is a procedure of object. Synchronize() or Queue() work inside threads only for methods of object. You do not need a other unit but your method must be a method of object. . Fre;D |
Administrator
|
In reply to this post by fauri
> By the way, did you realized that a single unit (without a form, as is in my small project) can't calls a own method using uos_EndProc? It's necessary to point another procedure outside. As I had once said, seems a FPC limitation.
Hello. Added ProcEndOnly (procedure pure, not of object) to execute at end of player. You should use this only if you do not have to synchronize anything (like graphic things). Example with your drum machine: unit Unit1; {$mode objfpc}{$H+} interface uses uos_flat, SysUtils, Forms, StdCtrls; type { TForm1 } TForm1 = class(TForm) Button1: TButton; procedure Button1Click(Sender: TObject); procedure FormCreate(Sender: TObject); end; procedure Restart1; // this is a ProcEndOnly procedure Restart2; // this is a ProcEndOnly var Form1: TForm1; first: boolean = true; implementation {$R *.lfm} { TForm1 } procedure TForm1.Button1Click(Sender: TObject); begin uos_Playnofree(0); end; procedure TForm1.FormCreate(Sender: TObject); var ordir, lib1, lib2: string; begin ordir := Application.Location; lib1 := ordir + 'lib\LibPortaudio-32.dll'; lib2 := ordir + 'lib\LibSndFile-32.dll'; uos_LoadLib(Pchar(lib1), Pchar(lib2), nil, nil, nil, nil); uos_CreatePlayer(0); uos_AddFromFile(0, Pchar(Application.Location + 'loop.wav'), -1, 0, 256); uos_AddIntoDevOut(0, -1, -1,uos_InputGetSampleRate(0, 0), uos_InputGetChannels(0,0), 0, 256); uos_EndProcOnly(0, @Restart2); // Here procedure not of object uos_CreatePlayer(1); uos_AddFromFile(1, Pchar(Application.Location + 'loop.wav'), -1, 0, 256); uos_AddIntoDevOut(1, -1, -1,uos_InputGetSampleRate(1, 0), uos_InputGetChannels(1,0), 0, 256); uos_EndProcOnly(1, @Restart1); // Here procedure not of object end; procedure Restart1; // Here procedure not of object begin sleep(220); // this to ajust +- the tempo because your wav is too short uos_Playnofree(0); end; procedure Restart2; // Here procedure not of object begin if first = false then sleep(220); // this to ajust +- the tempo because your wav is too short first := false ; uos_Playnofree(1); end; end. |
Free forum by Nabble | Edit this page |