ГОСТ Р 56047—2014
if(Etmplk) >= Е2(к])
Е[к] = Etmp[k);
else
ЕМ = E2[k];
)
return 0;
)
Файл: wavedump.h
Г Function prototypes */
int HeaderOump(FILE const char *);
int Readlnt(FILE *, int):
int SampleRate(FILE ’);
int BitForSample(FILE *):
int NumOfChan(FILE *);
int FindData(FILE *);
void fatalerr(char *....):
/• Prototypes end */
Файл: wavedump.c
include <stdio.h>
include <string.h>
^include <stdl*.h>
include <\vavedump.h>
extern int ermo;
int
HeaderDump{FILE *fp. const char “string)
{
char buff]7]:
int k. offset = 0:
while (Ifeof(fp)) {
if(!fread(txjff. 7,1, fp))
fataterr("err. error in WaveHeader"):
offset += 7;
for(k=0;k<4;k++)
if (!stmcmp<(char *Kbuff + k). string. 4)) {
fseek(fp. k-3. SEEK_CUR):
offset += k-3:
return offset:
}
fseek(fp. -3. SEEK_CUR);
offset += -3;
)
return -1:
}
int
SampleRate(FILE *fp)
{
int rate, offset;
if ((offset = HeaderOump^p.-fmt")) == -1)
return -1;
if (fseek(fp, 8. SEEK_CUR) == -1)
fatalerT("err %s“. strerror(ermo)):
rate = Readlnt(fp.4):
fseek(fp. -8 - offset. SEEK_CUR):
return rate;
}
87