Skip to content

Commit

Permalink
styling fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jopedroliveira committed Oct 9, 2017
1 parent 7010835 commit 27c6e14
Showing 1 changed file with 14 additions and 15 deletions.
29 changes: 14 additions & 15 deletions examples/C++/demo2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,19 @@
#define model_filename "resources/snowboy.umdl"
#define sensitivity_str "0.5"

struct wavHeader { //Para HEADER DE 44 bytes,
char RIFF[4]; //4: 'RIFF', "low endian"
int RIFFsize; //4: size do "RIFF chunk" (não usuar)
char fmt[8]; //8: string com 'WAVEfmt '
int fmtSize; //4: size do "format chunk": usualmente 14, 16, 18 ou 40 bytes
short fmtTag; //2: "format tag". Apenas se considera 1=PCM (sem codificação)
short nchan; //2: nº de canais (apenas mono ou stereo neste caso; isto é, não se considera WAVEFORMATEXTENSIBLE)
int fs; //4: frequência de amostragem
int avgBps; //4: AvgBytesPerSec
short nBlockAlign;//2: nchan*bytes_per_value = bytes per sample;
short bps; //2: Number of bits per sample of mono data (apenas presente se WAVEFORMATEX: fmtSize>=16)
//short extraSize; //2: The count in bytes of the extra size (nem sempre presente). 0 if fmtSize=18; 22 if fmtTag=65534
char data[4]; //4: 'data' chunk
int datasize; //4: Num. Data Bytes (size of "data chunk")
struct wavHeader { //44 byte HEADER only
char RIFF[4];
int RIFFsize;
char fmt[8];
int fmtSize;
short fmtTag;
short nchan;
int fs;
int avgBps;
short nBlockAlign;
short bps;
char data[4];
int datasize;
};


Expand All @@ -33,7 +32,7 @@ void readWavHeader(wavHeader *wavhdr, FILE *fi){
// Returns a pointer pointing to the begining of the data

char *tag = (char *)wavhdr;
fread(wavhdr, 34, 1, fi); //tag inicial tem de ser "RIFF"
fread(wavhdr, 34, 1, fi); //starting tag should be "RIFF"
if (tag[0] != 'R' || tag[1] != 'I' || tag[2] != 'F' || tag[3] != 'F'){
fclose(fi);
perror("NO 'RIFF'.");
Expand Down

0 comments on commit 27c6e14

Please sign in to comment.