|
Sorry about that but I still have a question about EndProc :
When I browse the discotheque, I need to be able to edit the intro time or the ending time of a sound.
So until I click on another sound, I want to be able to play it as many time as I want, from the beginning, from the end of the intro, etc...
I first tried uos_playnofree, but then uos_inputseekseconds wouldn't work. Every command would play the sound from the beginning.
I'm now using uos_play, but since the player is freed with endproc, that's why I'm asking that the sound be reloaded with endproc.
Now they're a conflict when I stop first sound and click on a second sound. (The program becomes unresponsive, as with an endless loop).
CODE :
Procedure TFrmDisco.ChargeSon(nPlayer: integer; LePath: string); var
temptime: ttime;
ho, mi, se, ms: word;
begin
uos_CreatePlayer(nPlayer);
If Fileexists(LePath) then
begin
InputIndex1 := uos_AddFromFile(0, PChar(LePath), -1, 0, 1024);
{$if defined(cpuarm)} // needs lower latency
uos_AddIntoDevOut(0, -1, 0.3, -1, -1, 0, 1024, -1);
{$else}
uos_AddIntoDevOut(0, -1, -1, -1, -1, 0, 1024, -1);
{$endif}
uos_EndProc(0, @ClosePlayer0);
uos_InputSetPositionEnable(0, InputIndex1, 1) ;
uos_InputSetLevelEnable(0, InputIndex1, 3) ;
uos_InputLength(0, InputIndex1);
temptime:= uos_InputLengthTime(0, InputIndex1);
DecodeTime(temptime, ho, mi, se, ms);
LabelTOT.tag:= integer(ms + 1000*se + 60000*mi + 3600000*ho);
LabelTOT.caption:= format('%.2d:%.2d:%.2d.%.3d', [ho, mi, se, ms]);
end;
end;
Procedure TFrmDisco.ClosePlayer0; var
Lepath: string;
aRow: integer;
begin
aRow:=ListViewDisco.Row;
Lepath:=ListViewDisco.Cells[11,aRow];
ChargeSon(0, LePath);
end;
//// This is when one of the buttons "Play" is clicked : Procedure PlayFile(n : integer; nPos : single);
begin
uos_InputSeekSeconds(n, InputIndex1, nPos);
uos_Play(n);
end;
//// This is when a sound is clicked on the discotheque list : Procedure AfficheRow(aRow : integer);
...
uos_stop(0);
uos_FreePlayer(0);
If Fileexists(LePath) then FrmDisco.ChargeSon(0, LePath);
|