GNU Radio 3.6.5 C++ API
|
#include <gr_core_api.h>
#include <cstdio>
Go to the source code of this file.
Functions | |
bool | gri_wavheader_parse (FILE *fp, unsigned int &sample_rate, int &nchans, int &bytes_per_sample, int &first_sample_pos, unsigned int &samples_per_chan) |
Read signal information from a given WAV file. | |
short int | gri_wav_read_sample (FILE *fp, int bytes_per_sample) |
Read one sample from an open WAV file at the current position. | |
bool | gri_wavheader_write (FILE *fp, unsigned int sample_rate, int nchans, int bytes_per_sample) |
Write a valid RIFF file header. | |
void | gri_wav_write_sample (FILE *fp, short int sample, int bytes_per_sample) |
Write one sample to an open WAV file at the current position. | |
bool | gri_wavheader_complete (FILE *fp, unsigned int byte_count) |
Complete a WAV header. |
short int gri_wav_read_sample | ( | FILE * | fp, |
int | bytes_per_sample | ||
) |
Read one sample from an open WAV file at the current position.
Takes care of endianness.
void gri_wav_write_sample | ( | FILE * | fp, |
short int | sample, | ||
int | bytes_per_sample | ||
) |
Write one sample to an open WAV file at the current position.
Takes care of endianness.
bool gri_wavheader_complete | ( | FILE * | fp, |
unsigned int | byte_count | ||
) |
Complete a WAV header.
Note: The stream position is changed during this function. If anything needs to be written to the WAV file after calling this function (which shouldn't happen), you need to fseek() to the end of the file (or whereever).
[in] | fp | File pointer to an open WAV file with a blank header |
[in] | byte_count | Length of all samples written to the file in bytes. |
bool gri_wavheader_parse | ( | FILE * | fp, |
unsigned int & | sample_rate, | ||
int & | nchans, | ||
int & | bytes_per_sample, | ||
int & | first_sample_pos, | ||
unsigned int & | samples_per_chan | ||
) |
Read signal information from a given WAV file.
[in] | fp | File pointer to an opened, empty file. |
[out] | sample_rate | Stores the sample rate [S/s] |
[out] | nchans | Number of channels |
[out] | bytes_per_sample | Bytes per sample, can either be 1 or 2 (corresponding o 8 or 16 bit samples, respectively) |
[out] | first_sample_pos | Number of the first byte containing a sample. Use this with fseek() to jump from the end of the file to the first sample when in repeat mode. |
[out] | samples_per_chan | Number of samples per channel |
bool gri_wavheader_write | ( | FILE * | fp, |
unsigned int | sample_rate, | ||
int | nchans, | ||
int | bytes_per_sample | ||
) |
Write a valid RIFF file header.
Note: Some header values are kept blank because they're usually not known a-priori (file and chunk lengths). Use gri_wavheader_complete() to fill these in.