Ich würd weiterhin auf diese Arrays verzichten und bei TObjectList bleiben.
Delphi-Quellcode:
TfrmMain =
class (TForm)
...
public
MusicFiles : TObjectList ;
procedure AddFiles (Files :
array of string) ;
end ;
implementation
procedure TfrmMain.AddFiles (Files :
array of string) ;
var
AudioFile : TAudioFile ;
begin
for i := low(Files)
to high(Files)
do begin
if lowercase(ExtractFileExt(Files[i])) = '
.mp3'
then
AudioFile := Tmp3File.create (Files[i])
else if lowercase(ExtractFileExt(Files[i])) = '
.wma'
then
AudioFile := TwmaFile.create (Files[i])
else
raise exception.create ('
Fileextension unknown for Audiofile') ;
MusicFiles.Add (AudioFile) ;
// MusicFiles nicht vergessen zu initialisieren
end ;
end ;
end.