Hi, here is a quick introduction to what im trying to do:
load sounds (midi,mp3,wav) into a memory stream, then when called determine from the memory stream what type of file it is and play it.
im not a expert coder and am always keen to learn, code samples is easiest way for me to do this. searching for ages on the net i found this:
i can identify the file extension if i wanted by using ExtractFileExt('C\my file.mp3'), but if the file is in memory how could i do it?
Thanks
load sounds (midi,mp3,wav) into a memory stream, then when called determine from the memory stream what type of file it is and play it.
im not a expert coder and am always keen to learn, code samples is easiest way for me to do this. searching for ages on the net i found this:
Code:
procedure LoadFromFileToMemory(const AFilename: String; memStream: TMemoryStream);
var
aFileStream: TFileStream;
begin
aFileStream:= TFileStream.Create(AFilename, fmOpenRead);
try
memStream.CopyFrom(aFileStream, 0);
finally
aFileStream.Free;
end;
end;
{
LoadFromFileToMemory usage example
**********************************
var
memStream: TMemoryStream;
memStream:= TMemoryStream.Create;
try
LoadFromFileToMemory('C\my file.mp3',memStream);
finally
memStream.Free;
end;
end;
}
i can identify the file extension if i wanted by using ExtractFileExt('C\my file.mp3'), but if the file is in memory how could i do it?
Thanks