API for reading and writing data in particular format as items.
More...
|
SNDFILE2K_EXPORT sf_count_t | sf_read_short (SNDFILE *sndfile, short *ptr, sf_count_t items) |
| Reads short (16-bit) samples from file. More...
|
|
SNDFILE2K_EXPORT sf_count_t | sf_write_short (SNDFILE *sndfile, const short *ptr, sf_count_t items) |
| Writes short (16-bit) samples to file. More...
|
|
SNDFILE2K_EXPORT sf_count_t | sf_read_int (SNDFILE *sndfile, int *ptr, sf_count_t items) |
| Reads integer (32-bit) samples from file. More...
|
|
SNDFILE2K_EXPORT sf_count_t | sf_write_int (SNDFILE *sndfile, const int *ptr, sf_count_t items) |
| Writes integer (32-bit) samples to file. More...
|
|
SNDFILE2K_EXPORT sf_count_t | sf_read_float (SNDFILE *sndfile, float *ptr, sf_count_t items) |
| Reads float (32-bit) samples from file. More...
|
|
SNDFILE2K_EXPORT sf_count_t | sf_write_float (SNDFILE *sndfile, const float *ptr, sf_count_t items) |
| Writes float (32-bit) samples to file. More...
|
|
SNDFILE2K_EXPORT sf_count_t | sf_read_double (SNDFILE *sndfile, double *ptr, sf_count_t items) |
| Reads double (64-bit) samples from file. More...
|
|
SNDFILE2K_EXPORT sf_count_t | sf_write_double (SNDFILE *sndfile, const double *ptr, sf_count_t items) |
| Writes double (64-bit) samples to file. More...
|
|
API for reading and writing data in particular format as items.
This set of high-level functions read/write data in terms of sample and/or performing type conversion and byte-swapping if necessary.
One item is one sample for each channel. For example, to read 10
samples as integers (32-bit) from stereo (2 channles) sound file you need to allocate buffer of 10
integers size and call sf_read_int() function with items
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_read_double()
Reads double (64-bit) samples from file.
- Parameters
-
[in] | sndfile | Pointer to a sound file state |
[out] | ptr | Pointer to an allocated block of memory. |
[in] | items | Count of samples to read |
- Returns
- Number of samples actually read.
◆ sf_read_float()
Reads float (32-bit) samples from file.
- Parameters
-
[in] | sndfile | Pointer to a sound file state |
[out] | ptr | Pointer to an allocated block of memory. |
[in] | items | Count of samples to read |
- Returns
- Number of samples actually read.
◆ sf_read_int()
Reads integer (32-bit) samples from file.
- Parameters
-
[in] | sndfile | Pointer to a sound file state |
[out] | ptr | Pointer to an allocated block of memory. |
[in] | items | Count of samples to read |
- Returns
- Number of samples actually read.
◆ sf_read_short()
Reads short (16-bit) samples from file.
- Parameters
-
[in] | sndfile | Pointer to a sound file state |
[out] | ptr | Pointer to an allocated block of memory. |
[in] | items | Count of samples to read |
- Returns
- Number of samples actually read.
◆ sf_write_double()
Writes double (64-bit) samples to file.
- Parameters
-
[in] | sndfile | Pointer to a sound file state |
[in] | ptr | Pointer to an allocated block of memory. |
[in] | items | Count of samples to write |
- Returns
- Number of samples actually written.
◆ sf_write_float()
Writes float (32-bit) samples to file.
- Parameters
-
[in] | sndfile | Pointer to a sound file state |
[in] | ptr | Pointer to an allocated block of memory. |
[in] | items | Count of samples to write |
- Returns
- Number of samples actually written.
◆ sf_write_int()
Writes integer (32-bit) samples to file.
- Parameters
-
[in] | sndfile | Pointer to a sound file state |
[in] | ptr | Pointer to an allocated block of memory. |
[in] | items | Count of samples to write |
- Returns
- Number of samples actually written.
◆ sf_write_short()
Writes short (16-bit) samples to file.
- Parameters
-
[in] | sndfile | Pointer to a sound file state |
[in] | ptr | Pointer to an allocated block of memory. |
[in] | items | Count of samples to write |
- Returns
- Number of samples actually written.