Para obtener la duracion y la posicion actual de cualquier canción usas las propiedades length y position como bien te dijo coso. Haciendo las operaciones adecuadas podemos conseguir el formato x:xx:xx.
Código Delphi
[-]
function ObtenerDuracion(milisegundos: integer) : string;
var
min, sec, hor: integer;
segundos, minutos: string;
begin
sec:= milisegundos div 1000;
min:= sec div 60;
hor:= min div 60;
sec:= sec mod 60;
segundos:=inttostr(sec);
minutos:=inttostr(min);
if min<10 then begin
minutos:='0' + inttostr(min);
end;
if sec<10 then begin
segundos:='0' + inttostr(sec);
end;
result:= inttostr(hor) +':' +minutos + ':' + segundos;
end;
Cada vez que cargues una cancion actualizas el label de la duracion total de la pista, y en el timer harias algo asi:
Código Delphi
[-]
procedure TForm1.Timer1Timer(Sender: TObject);
var
r:integer;
begin
If MediaPlayer1.mode=mpplaying then LabelPosicion.caption:=ObtenerDuracion(MediaPlayer1.position);
if mediaplayer1.Mode=mpstopped then
begin
If MediaPlayer1.position=mediaplayer1.Length then
begin
If checkbox1.Checked=false then
begin
If ListBox1.itemindex= ListBox1.items.count then
ListBox1.itemindex:= -1;
ListBox1.itemindex:= ListBox1.itemindex + 1;
listbox2.ItemIndex:=listbox2.ItemIndex + 1;
end;
If checkbox1.Checked=true then
begin
Randomize;
r:= Random(ListBox1.items.count);
listbox1.ItemIndex:=r;
listbox2.ItemIndex:=r;
end;
reproducirdelistbox(listbox1.ItemIndex);
end;
end;
end;
Salu2