10 WriteHeader in 'WriteHeader.pas';
12 function cut(fpIn, fpOut: TFileStream; sp: SpParam): integer;
17 function checkRange(var sp: SpParam): integer;
20 if sp.startpos * sp.bytesPerSec > sp.sizeOfData then
22 Writeln('
\8aJ
\8en
\88Ê
\92u
\82ª
\83t
\83@
\83C
\83\8b\83T
\83C
\83Y
\82ð
\92´
\82¦
\82Ä
\82¢
\82Ü
\82·');
25 else if (sp.endpos + 1) * sp.bytesPerSec > sp.sizeOfData then
27 Writeln('
\8fI
\97¹
\88Ê
\92u
\82ª
\83t
\83@
\83C
\83\8b\83T
\83C
\83Y
\82ð
\92´
\82¦
\82Ä
\82¢
\82Ü
\82·');
28 Writeln('
\8fI
\97¹
\82ð
\83t
\83@
\83C
\83\8b\82Ì
\8dÅ
\8cã
\82É
\92²
\90®
\82µ
\82Ü
\82µ
\82½');
29 sp.endpos := (sp.sizeOfData div sp.bytesPerSec) - 1;
33 function wavDataWrite(fpIn, fpOut: TFileStream; sp: SpParam): integer;
35 fpIn.Position := sp.posOfData;
36 // fpOut.Position := sp.posOfData;
37 result:=cut(fpIn,fpOut,sp);
40 function wavWrite(inFile, outFile: PChar; sp: SpParam): integer;
42 fpIn, fpOut: TFileStream;
45 fpIn := TFileStream.Create(inFile, fmOpenRead);
46 fpOut := TFileStream.Create(outFile, fmCreate);
47 sp.sizeOfData := (sp.endpos - sp.startpos + 1) * sp.bytesPerSec;
48 if waveHeaderWrite(fpOut, sp) > 44 then
49 raise EWriteError.Create('
\83w
\83b
\83_
\82ð
\8f\91\82«
\8d\9e\82ß
\82Ü
\82¹
\82ñ');
50 if wavDataWrite(fpIn, fpOut, sp) = -1 then
51 raise EWriteError.Create('
\83G
\83\89\81[
\94
\90¶');
54 Writeln(inFile, '
\82ð
\83I
\81[
\83v
\83\93\82Å
\82«
\82Ü
\82¹
\82ñ');
74 { TODO -oUser -cConsole
\83\81\83C
\83\93 :
\82±
\82±
\82É
\83R
\81[
\83h
\82ð
\8bL
\8fq
\82µ
\82Ä
\82
\82¾
\82³
\82¢ }
75 sp.startpos := LongInt(ParamStr(3));
76 sp.endpos := LongInt(ParamStr(4));
77 if sp.startpos > sp.endpos then
79 Writeln('
\8aJ
\8en
\95b
\82Í
\8fI
\97¹
\95b
\82ð
\92´
\82¦
\82Ä
\82Í
\82È
\82è
\82Ü
\82¹
\82ñ');
82 if wavHdrRead(PChar(ParamStr(1)), sp) = -1 then
84 if wavWrite(PChar(ParamStr(1)), PChar(ParamStr(2)), sp) = -1 then
89 Writeln(E.ClassName, ': ', E.Message);