7 System.SysUtils, System.Classes,
10 function dump8BitWav(fpIn: TFileStream; sizeOfData: SmallInt): integer;
14 c: array [0 .. 1] of Word;
18 s := sizeOfData / SizeOf(c);
22 fpIn.ReadBuffer(c, SizeOf(c));
27 Writeln(c[0], ',', c[1]);
32 function dump16BitWav(fpIn: TFileStream; sizeOfData: SmallInt): integer;
36 c: array [0 .. 1] of SmallInt;
40 s := sizeOfData / SizeOf(c);
44 fpIn.ReadBuffer(c, SizeOf(c));
49 Writeln(c[0], ',', c[1]);
54 function dumpDataSub(fpIn: TFileStream; posOfData, sizeOfData: integer;
55 bytesPerSingleCh: SmallInt): SmallInt;
57 fpIn.Seek(posOfData, soFromCurrent);
58 if bytesPerSingleCh = 1 then
59 result := dump8BitWav(fpIn, sizeOfData)
61 result := dump16BitWav(fpIn, sizeOfData);
64 function dumpData(inFile: PChar; sampBits, posOfData, sizeOfData: Word)
67 bytesPerSingleCh: SmallInt;
71 bytesPerSingleCh := sampBits div 8;
72 if FileExists(inFile) = false then
74 Writeln('
\83I
\81[
\83v
\83\93\82Å
\82«
\82Ü
\82¹
\82ñ.');
77 fpIn := TFileStream.Create(inFile, fmOpenRead);
79 if dumpDataSub(fpIn, posOfData, sizeOfData, bytesPerSingleCh) <> 0 then
80 Writeln('
\83G
\83\89\81[
\94
\90¶.')
89 sampRate, sampBits: SmallInt;
90 posOfData, sizeOfData: Cardinal;
95 { TODO -oUser -cConsole
\83\81\83C
\83\93 :
\82±
\82±
\82É
\83R
\81[
\83h
\82ð
\8bL
\8fq
\82µ
\82Ä
\82
\82¾
\82³
\82¢ }
96 if ParamCount < 1 then
98 Writeln('wav
\83t
\83@
\83C
\83\8b\82ð
\83_
\83\93\83v
\82µ
\82Ü
\82·.'#13#10, '
\88ø
\90\94\82É <
\93ü
\97Í
\83t
\83@
\83C
\83\8b\96¼>
\82ð
\8ew
\92è
\82µ
\82Ä
\82
\82¾
\82³
\82¢.'#13#10#13#10,
99 '
\97á : dumpWav in.wav');
102 if ParamStr(1) = '-h' then
106 wavHdrRead(PChar(ParamStr(i)), sampRate, sampBits, posOfData, sizeOfData);
108 dumpData(PChar(ParamStr(1)), sampBits, posOfData, sizeOfData);
112 Writeln(E.ClassName, ': ', E.Message);