pcmaudio: add routine/external procedure to read sample file

This commit is contained in:
slederer 2026-03-30 00:43:31 +02:00
parent 819c808c50
commit 0d9db023a1
3 changed files with 23 additions and 9 deletions

View file

@ -35,8 +35,7 @@ var pic:PictData;
procedure WaitVSync; external;
function readAudioFile(fname:string):SndBufPtr;
var i,size:integer;
c:char;
var size:integer;
buf:SndBufPtr;
f:file;
begin
@ -44,13 +43,8 @@ begin
size := FileSize(f);
new(buf, size);
buf^ := '';
write('Reading ', size, ' bytes from ', fname);
for i := 1 to size do
begin
read(f,c);
AppendChar(buf^,c);
end;
ReadSample(f, buf);
writeln;
close(f);
readAudioFile := buf;