tdraudio: add irq_enable flag, add pcmaudio library

runtime: disable interrupts on PTERM
stdlib: check for error state in FileSize
This commit is contained in:
slederer 2025-10-07 00:37:53 +02:00
parent 7cc9ee807d
commit 5c00dfcec9
8 changed files with 390 additions and 21 deletions

47
examples/pcmtest.pas Normal file
View file

@ -0,0 +1,47 @@
{$H1536}
program pcmtest;
uses pcmaudio;
var filename:string;
buf:SndBufPtr;
f:file;
size:integer;
i:integer;
c:char;
sampleRate:integer;
err:integer;
begin
if ParamCount > 0 then
filename := ParamStr(1)
else
begin
write('Filename> ');
readln(filename);
end;
err := 1;
if ParamCount > 1 then
val(ParamStr(2),sampleRate, err);
if err <> 0 then
sampleRate := 16000;
open(f, filename, ModeReadOnly);
size := FileSize(f);
new(buf, size);
buf^ := '';
write('Reading ', size, ' bytes...');
for i := 1 to size do
begin
read(f,c);
AppendChar(buf^,c);
end;
writeln;
close(f);
PlaySample(buf, sampleRate);
dispose(buf);
end.