API for reading and writing data in particular format as frames.
More...
|
SNDFILE2K_EXPORT sf_count_t | sf_readf_short (SNDFILE *sndfile, short *ptr, sf_count_t frames) |
| Reads short (16-bit) frames from file. More...
|
|
SNDFILE2K_EXPORT sf_count_t | sf_writef_short (SNDFILE *sndfile, const short *ptr, sf_count_t frames) |
| Writes short (16-bit) frames to file. More...
|
|
SNDFILE2K_EXPORT sf_count_t | sf_readf_int (SNDFILE *sndfile, int *ptr, sf_count_t frames) |
| Reads integer (32-bit) frames from file. More...
|
|
SNDFILE2K_EXPORT sf_count_t | sf_writef_int (SNDFILE *sndfile, const int *ptr, sf_count_t frames) |
| Writes integer (32-bit) frames to file. More...
|
|
SNDFILE2K_EXPORT sf_count_t | sf_readf_float (SNDFILE *sndfile, float *ptr, sf_count_t frames) |
| Reads float (32-bit) frames from file. More...
|
|
SNDFILE2K_EXPORT sf_count_t | sf_writef_float (SNDFILE *sndfile, const float *ptr, sf_count_t frames) |
| Writes float (32-bit) frames to file. More...
|
|
SNDFILE2K_EXPORT sf_count_t | sf_readf_double (SNDFILE *sndfile, double *ptr, sf_count_t frames) |
| Reads double (64-bit) frames from file. More...
|
|
SNDFILE2K_EXPORT sf_count_t | sf_writef_double (SNDFILE *sndfile, const double *ptr, sf_count_t frames) |
| Writes double (64-bit) frames to file. More...
|
|
API for reading and writing data in particular format as frames.
This set of high-level functions read/write data in terms of frame and/or performing type conversion and byte-swapping if necessary.
One frame is one item (sample) for each channel. For example, to read 10
frames as integers (32-bit) from stereo (2 channles) sound file you need to allocate buffer of 20
integers size and call sf_readf_int() function with frames
parameter set to 10
.
When file format data type differs from function type, e.g you read WAV file with float
data, data type conversion if automatically performed.
When endianness of file data differs from host system endianness, byte-swapping is performed and no additional manipulations are required.
◆ sf_readf_double()
Reads double (64-bit) frames from file.
- Parameters
-
[in] | sndfile | Pointer to a sound file state |
[out] | ptr | Pointer to an allocated block of memory. |
[in] | frames | Count of frames to read |
- Returns
- Number of frames actually read.
◆ sf_readf_float()
Reads float (32-bit) frames from file.
- Parameters
-
[in] | sndfile | Pointer to a sound file state |
[out] | ptr | Pointer to an allocated block of memory. |
[in] | frames | Count of frames to read |
- Returns
- Number of frames actually read.
◆ sf_readf_int()
Reads integer (32-bit) frames from file.
- Parameters
-
[in] | sndfile | Pointer to a sound file state |
[out] | ptr | Pointer to an allocated block of memory. |
[in] | frames | Count of frames to read |
- Returns
- Number of frames actually read.
◆ sf_readf_short()
Reads short (16-bit) frames from file.
- Parameters
-
[in] | sndfile | Pointer to a sound file state |
[out] | ptr | Pointer to an allocated block of memory. |
[in] | frames | Count of frames to read |
- Returns
- Number of frames actually read.
◆ sf_writef_double()
Writes double (64-bit) frames to file.
- Parameters
-
[in] | sndfile | Pointer to a sound file state |
[in] | ptr | Pointer to an allocated block of memory. |
[in] | frames | Count of frames to write |
- Returns
- Number of frames actually written.
◆ sf_writef_float()
Writes float (32-bit) frames to file.
- Parameters
-
[in] | sndfile | Pointer to a sound file state |
[in] | ptr | Pointer to an allocated block of memory. |
[in] | frames | Count of frames to write |
- Returns
- Number of frames actually written.
◆ sf_writef_int()
Writes integer (32-bit) frames to file.
- Parameters
-
[in] | sndfile | Pointer to a sound file state |
[in] | ptr | Pointer to an allocated block of memory. |
[in] | frames | Count of frames to write |
- Returns
- Number of frames actually written.
◆ sf_writef_short()
Writes short (16-bit) frames to file.
- Parameters
-
[in] | sndfile | Pointer to a sound file state |
[in] | ptr | Pointer to an allocated block memory. |
[in] | frames | Count of frames to write |
- Returns
- Number of frames actually written.