System.Classes, System.SysUtils;
{$INCLUDE spWav}
-function readFmtChank(fp: TFileStream; waveFmtPcm: tWaveFormatPcm): integer;
+function readFmtChank(fp: TFileStream; out waveFmtPcm: tWaveFormatPcm): integer;
function wavHdrRead(wavefile: PChar; var sampRate: LongWord; var sampBits: Byte;
var posOfData, sizeOfData: LongInt): integer;
implementation
-function readFmtChank(fp: TFileStream; waveFmtPcm: tWaveFormatPcm): integer;
+function readFmtChank(fp: TFileStream; out waveFmtPcm: tWaveFormatPcm): integer;
begin
result := 0;
try
Writeln('\83o\83C\83g\90\94\81@/\81@\95b\81F', waveFmtPcm.bytesPerSec);
Writeln('\83o\83C\83g\90\94 \82w\83`\83\83\83\93\83l\83\8b\90\94\81F', waveFmtPcm.blockAlign);
Writeln('\83r\83b\83g\90\94\81@/\81@\83T\83\93\83v\83\8b\81F', waveFmtPcm.bitsPerSample);
- if waveFmtPcm.channels <> 2 then
+ with waveFmtPcm do
begin
- Writeln('\83X\83e\83\8c\83I\83t\83@\83C\83\8b\82ð\91Î\8fÛ\82Æ\82µ\82Ä\82¢\82Ü\82·');
- Writeln('\83`\83\83\83\93\83l\83\8b\90\94\82Í', waveFmtPcm.channels);
- result := -1;
- end;
- if waveFmtPcm.formatTag <> 1 then
- begin
- Writeln('\96³\88³\8fk\82ÌPCM\82Ì\82Ý\91Î\8fÛ');
- Writeln('\83t\83H\81[\83}\83b\83g\8c`\8e®\82Í', waveFmtPcm.formatTag);
- result := -1;
- end;
- if (waveFmtPcm.bitsPerSample <> 8) and (waveFmtPcm.bitsPerSample <> 16) then
- begin
- Writeln('8/16\83r\83b\83g\82Ì\82Ý\91Î\8fÛ');
- Writeln('bit/sec\82Í', waveFmtPcm.bitsPerSample);
- result := -1;
+ if channels <> 2 then
+ begin
+ Writeln('\83X\83e\83\8c\83I\83t\83@\83C\83\8b\82ð\91Î\8fÛ\82Æ\82µ\82Ä\82¢\82Ü\82·');
+ Writeln('\83`\83\83\83\93\83l\83\8b\90\94\82Í', channels);
+ result := -1;
+ end;
+ if formatTag <> 1 then
+ begin
+ Writeln('\96³\88³\8fk\82ÌPCM\82Ì\82Ý\91Î\8fÛ');
+ Writeln('\83t\83H\81[\83}\83b\83g\8c`\8e®\82Í', formatTag);
+ result := -1;
+ end;
+ if (bitsPerSample <> 8) and (bitsPerSample <> 16) then
+ begin
+ Writeln('8/16\83r\83b\83g\82Ì\82Ý\91Î\8fÛ');
+ Writeln('bit/sec\82Í', bitsPerSample);
+ result := -1;
+ end;
end;
except
on EReadError do
fp.Free;
Exit;
end;
+ fPos := 0;
+ len := 0;
while True do
begin
try
break;
end;
end;
- fPos:=0;
- len:=0;
if CompareStr(chank.hdrFmtData, STR_fmt) = 0 then
begin
len := chank.sizeOfFmtData;