TPlayList = class
public
Index: integer;//index actual
Count: integer;//cantidad total de elementos
Item: array[1..50] of string; //lista de nombres
constructor Create;
private
procedure LoadFromFile;
procedure Play;
procedure Next;
end;
constructor TPlayList.Create();
var
i: integer;
begin
Index:=0;
for i := 1 to 50 do Item[i] := 'SinAsignar';
end;
procedure TPlayList.LoadFromFile; //carga la playlist
var
i: integer;
f: text;
S: string;
begin
AssignFile(f, 'playlist.txt');
Reset(f);
while not eof(f) do
begin
Inc(I);
ReadLn(f, Item[i]);
end;
Count := i;
end;
procedure TPlayList.Next; //posiciona el Index mas adelante
begin
Inc(Index);
end;
procedure TPlayList.Play; // reproduce elemento actual del index
begin
Form1.MediaPlayer1.Stop;
Form1.MediaPlayer1.FileName := Form1.OpenDialog1.FileName;
Form1.MediaPlayer1.Open;
Form1.MediaPlayer1.Play;
end;