• Home
  • Raw
  • Download

Lines Matching refs:bat

33 static int update_fmt_to_bat(struct bat *bat, struct chunk_fmt *fmt)  in update_fmt_to_bat()  argument
35 bat->channels = fmt->channels; in update_fmt_to_bat()
36 bat->rate = fmt->sample_rate; in update_fmt_to_bat()
37 bat->sample_size = fmt->sample_length / 8; in update_fmt_to_bat()
38 if (bat->sample_size > 4) { in update_fmt_to_bat()
39 fprintf(bat->err, _("Invalid format: sample size=%d\n"), in update_fmt_to_bat()
40 bat->sample_size); in update_fmt_to_bat()
43 bat->frame_size = fmt->blocks_align; in update_fmt_to_bat()
49 static int update_frames_to_bat(struct bat *bat, in update_frames_to_bat() argument
55 bat->frames = header->length / bat->frame_size; in update_frames_to_bat()
56 if (!bat->local) in update_frames_to_bat()
57 bat->frames /= 2; in update_frames_to_bat()
62 static int read_chunk_fmt(struct bat *bat, char *file, FILE *fp, bool skip, in read_chunk_fmt() argument
71 fprintf(bat->err, _("Read chunk fmt error: %s:%zd\n"), in read_chunk_fmt()
80 fprintf(bat->err, _("Seek fmt header error: %s:%zd\n"), in read_chunk_fmt()
88 err = update_fmt_to_bat(bat, &chunk_fmt); in read_chunk_fmt()
96 int read_wav_header(struct bat *bat, char *file, FILE *fp, bool skip) in read_wav_header() argument
106 fprintf(bat->err, _("Read header error: %s:%zd\n"), file, err); in read_wav_header()
111 fprintf(bat->err, _("%s is not a riff/wave file\n"), file); in read_wav_header()
119 fprintf(bat->err, _("Read chunk header error: ")); in read_wav_header()
120 fprintf(bat->err, _("%s:%zd\n"), file, err); in read_wav_header()
127 err = read_chunk_fmt(bat, file, fp, skip, in read_wav_header()
137 err = update_frames_to_bat(bat, &chunk_header, in read_wav_header()
149 fprintf(bat->err, _("Fail to skip unknown")); in read_wav_header()
150 fprintf(bat->err, _(" chunk of %s:%zd\n"), in read_wav_header()
160 void prepare_wav_info(struct wav_container *wav, struct bat *bat) in prepare_wav_info() argument
167 wav->format.channels = bat->channels; in prepare_wav_info()
168 wav->format.sample_rate = bat->rate; in prepare_wav_info()
169 wav->format.sample_length = bat->sample_size * 8; in prepare_wav_info()
170 wav->format.blocks_align = bat->channels * bat->sample_size; in prepare_wav_info()
171 wav->format.bytes_p_second = wav->format.blocks_align * bat->rate; in prepare_wav_info()
172 wav->chunk.length = bat->frames * bat->frame_size; in prepare_wav_info()
178 int write_wav_header(FILE *fp, struct wav_container *wav, struct bat *bat) in write_wav_header() argument
184 fprintf(bat->err, _("Write file error: header %d\n"), err); in write_wav_header()
189 fprintf(bat->err, _("Write file error: format %d\n"), err); in write_wav_header()
194 fprintf(bat->err, _("Write file error: chunk %d\n"), err); in write_wav_header()
202 int update_wav_header(struct bat *bat, FILE *fp, int bytes) in update_wav_header() argument
207 prepare_wav_info(&wav, bat); in update_wav_header()
212 err = write_wav_header(fp, &wav, bat); in update_wav_header()
224 int generate_input_data(struct bat *bat, void *buffer, int bytes, int frames) in generate_input_data() argument
229 if (bat->playback.file != NULL) { in generate_input_data()
234 err = fread((char *)buffer + load, 1, bytes - load, bat->fp); in generate_input_data()
236 if (feof(bat->fp)) { in generate_input_data()
237 fprintf(bat->log, in generate_input_data()
242 if (ferror(bat->fp)) { in generate_input_data()
243 fprintf(bat->err, _("Read file error")); in generate_input_data()
244 fprintf(bat->err, _(": %d\n"), err); in generate_input_data()
254 if ((bat->sinus_duration) && (load > bat->sinus_duration)) in generate_input_data()
257 err = generate_sine_wave(bat, frames, buffer); in generate_input_data()