10 WriteHeader in 'WriteHeader.pas';
12 function effect8BitWav(fpIn, fpOut: TFileStream; sizeOfData: LongInt): integer;
16 c: array [0 .. 1] of Byte;
20 s := sizeOfData / SizeOf(c);
24 fpIn.ReadBuffer(c, SizeOf(c));
26 fpOut.WriteBuffer(c, SizeOf(c));
31 Writeln(c[0], ' : ', c[1]);
36 function effect16BitWav(fpIn, fpOut: TFileStream; sizeOfData: LongInt): integer;
40 c: array [0 .. 1] of ShortInt;
44 s := sizeOfData / SizeOf(c);
48 fpIn.ReadBuffer(c, SizeOf(c));
50 fpOut.WriteBuffer(c, SizeOf(c));
55 Writeln(c[0], ' : ', c[1]);
60 function wavDataWrite(fpIn, fpOut: TFileStream; posOfData, sizeOfData: LongInt;
61 bytesPerSingleCh: SmallInt): integer;
63 fpOut.Position := posOfData;
64 if bytesPerSingleCh = 1 then
65 result := effect8BitWav(fpIn, fpOut, sizeOfData)
67 result := effect16BitWav(fpIn, fpOut, sizeOfData);
70 function wavWrite(inFile, outFile: PChar; sampRate: LongWord; sampBits: Byte;
71 posOfData, sizeOfData: LongInt): integer;
73 bytesPerSingleCh: Word;
74 fpIn, fpOut: TFileStream;
77 if FileExists(inFile) = true then
78 fpIn := TFileStream.Create(inFile, fmOpenRead)
82 Writeln(inFile, '
\82ð
\83I
\81[
\83v
\83\93\82Å
\82«
\82Ü
\82¹
\82ñ');
85 fpOut := TFileStream.Create(outFile, fmCreate);
86 bytesPerSingleCh := sampBits div 8;
87 if waveHeaderWrite(fpOut, sizeOfData, bytesPerSingleCh, sampRate,
91 Writeln('
\83w
\83b
\83_
\82ð
\8f\91\82«
\8d\9e\82ß
\82Ü
\82¹
\82ñ');
94 if wavDataWrite(fpIn, fpOut, posOfData, sizeOfData, bytesPerSingleCh) = -1
98 Write('
\83G
\83\89\81[
\94
\90¶');
111 posOfData, sizeOfData: LongInt;
115 { TODO -oUser -cConsole
\83\81\83C
\83\93 :
\82±
\82±
\82É
\83R
\81[
\83h
\82ð
\8bL
\8fq
\82µ
\82Ä
\82
\82¾
\82³
\82¢ }
116 wavHdrRead(PChar(ParamStr(1)), sampRate, sampBits, posOfData, sizeOfData);
117 wavWrite(PChar(ParamStr(1)), PChar(ParamStr(2)), sampRate, sampBits,
118 posOfData, sizeOfData);
122 Writeln(E.ClassName, ': ', E.Message);