sndfile2k
1.2.0
|
API to retrieve information from or change aspects of the library behaviour. More...
Data Structures | |
struct | SF_FORMAT_INFO |
Contains information about the sound file format. More... | |
Functions | |
SNDFILE2K_EXPORT int | sf_command (SNDFILE *sndfile, int command, void *data, int datasize) |
Gets or sets parameters of library or sound file. More... | |
API to retrieve information from or change aspects of the library behaviour.
Examples include retrieving a string containing the library version or changing the scaling applied to floating point sample data during read and write. Most of these operations are performed on a per-file basis.
enum SF_COMMAND |
Defines command constants for sf_command()
Enumerator | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
SFC_GET_LIB_VERSION | Gets library version string.
| |||||||||
SFC_GET_LOG_INFO | Gets the internal per-file operation log.
This log buffer can often contain a good reason for why libsndfile failed to open a particular file.
| |||||||||
SFC_GET_CURRENT_SF_INFO | Gets SF_INFO of given sound file.
| |||||||||
SFC_GET_NORM_DOUBLE | Gets the current double normalization mode.
| |||||||||
SFC_GET_NORM_FLOAT | Gets the current float normalization mode.
| |||||||||
SFC_SET_NORM_DOUBLE | Sets the current double normalization mode. This parameter is SF_FALSE by default. Double normalization changes behavior on sf_read_double(), sf_readf_double(), sf_write_double() and sf_writef_double() functions. For read operations setting normalisation to SF_TRUE means that the data from all subsequent reads will be be normalised to the range For write operations, setting normalisation to SF_TRUE means than all data supplied to the double write functions should be in the range For both cases, setting normalisation to SF_FALSE means that no scaling will take place. | |||||||||
SFC_SET_NORM_FLOAT | Sets the current float normalization mode. This parameter is SF_FALSE by default. Float normalization changes behavior on sf_read_float(), sf_readf_float(), sf_write_float() and sf_writef_float() functions. For read operations setting normalisation to SF_TRUE means that the data from all subsequent reads will be be normalised to the range For write operations, setting normalisation to SF_TRUE means than all data supplied to the double write functions should be in the range For both cases, setting normalisation to SF_FALSE means that no scaling will take place. | |||||||||
SFC_SET_SCALE_FLOAT_INT_READ | Sets/clears the scale factor when integer (short/int) data is read from a file containing floating point data.
| |||||||||
SFC_SET_SCALE_INT_FLOAT_WRITE | Sets/clears the scale factor when integer (short/int) data is written to a file as floating point data.
| |||||||||
SFC_GET_SIMPLE_FORMAT_COUNT | Retrieves the number of simple formats supported by libsndfile.
| |||||||||
SFC_GET_SIMPLE_FORMAT | Retrieves information about a simple format.
SF_FORMAT_INFO::format field should be set to the format number, retrieved by SFC_GET_SIMPLE_FORMAT_COUNT command. The value of the format field of the SF_FORMAT_INFO struct will be a value which can be placed in the SF_INFO struct::format field when a file is to be opened for write.
| |||||||||
SFC_GET_FORMAT_INFO | Retrieves information about a major or subtype format.
When sf_command() is called with SFC_GET_FORMAT_INFO, the If (
| |||||||||
SFC_GET_FORMAT_MAJOR_COUNT | Gets the number of major formats.
| |||||||||
SFC_GET_FORMAT_MAJOR | Gets information about a major format type.
The value of the The name field will contain a The extension field will contain the most commonly used file extension for that file type.
| |||||||||
SFC_GET_FORMAT_SUBTYPE_COUNT | Gets the number of subformats.
| |||||||||
SFC_GET_FORMAT_SUBTYPE | Gets information about a subformat.
This command enumerates the subtypes (this function does not translate a subtype into a string describing that subtype). A typical use case might be retrieving a string description of all subtypes so that a dialog box can be filled in. On return the value of the The The
| |||||||||
SFC_CALC_SIGNAL_MAX | Calculates the measured maximum signal value.
| |||||||||
SFC_CALC_NORM_SIGNAL_MAX | Calculates the measured normalised maximum signal value.
| |||||||||
SFC_CALC_MAX_ALL_CHANNELS | Calculates the peak value (ie a single number) for each channel.
| |||||||||
SFC_CALC_NORM_MAX_ALL_CHANNELS | Calculates the normalised peak for each channel.
| |||||||||
SFC_GET_SIGNAL_MAX | Gets the peak value for the file as stored in the file header.
| |||||||||
SFC_GET_MAX_ALL_CHANNELS | Gets the peak value for each channel as stored in the file header.
| |||||||||
SFC_SET_ADD_PEAK_CHUNK | Switches the code for adding the PEAK chunk to WAV and AIFF files on or off.
By default, WAV and AIFF files which contain floating point data (subtype SF_FORMAT_FLOAT or SF_FORMAT_DOUBLE) have a PEAK chunk. By using this command, the addition of a PEAK chunk can be turned on or off.
| |||||||||
SFC_SET_ADD_HEADER_PAD_CHUNK | Not used.
| |||||||||
SFC_UPDATE_HEADER_NOW | Forces update of the file header to reflect the data written so far when a file is open for write.
The header of an audio file is normally written by libsndfile when the file is closed using sf_close(). There are however situations where large files are being generated and it would be nice to have valid data in the header before the file is complete. Using this command will update the file header to reflect the amount of data written to the file so far. Other programs opening the file for read (before any more data is written) will then read a valid sound file header.
| |||||||||
SFC_SET_UPDATE_HEADER_AUTO | Used when a file is open for write, this command will cause the file header to be updated after each write to the file. Similar to SFC_UPDATE_HEADER_NOW but updates the header at the end of every call to the | |||||||||
SFC_FILE_TRUNCATE | Truncates a file open for write or for read/write.
Truncate the file to the number of frames specified by the sf_count_t pointed to by data. After this command, both the read and the write pointer will be at the new end of the file. This command will fail (returning non-zero) if the requested truncate position is beyond the end of the file.
| |||||||||
SFC_SET_RAW_START_OFFSET | Changes the data start offset for files opened up as SF_FORMAT_RAW.
| |||||||||
SFC_SET_DITHER_ON_WRITE | Controls dithering on write.
| |||||||||
SFC_SET_DITHER_ON_READ | Controls dithering on read.
| |||||||||
SFC_GET_DITHER_INFO_COUNT | Not used.
| |||||||||
SFC_GET_DITHER_INFO | Not used.
| |||||||||
SFC_GET_EMBED_FILE_INFO | Gets the file offset and file length of a file enbedded within another larger file.
| |||||||||
SFC_SET_CLIPPING | Turns on/off automatic clipping when doing floating point to integer conversion. | |||||||||
SFC_GET_CLIPPING | Retrieves current clipping setting.
| |||||||||
SFC_GET_CUE_COUNT | Gets the cue marker count.
| |||||||||
SFC_GET_CUE | Gets cue marker information from file.
| |||||||||
SFC_SET_CUE | Sets cue marker information for the file.
| |||||||||
SFC_GET_INSTRUMENT | Gets instrument information.
This command retrieves instrument information from file including MIDI base note, keyboard mapping and looping informations(start/stop and mode). | |||||||||
SFC_SET_INSTRUMENT | Sets instrument information.
| |||||||||
SFC_GET_LOOP_INFO | Sets loop information.
| |||||||||
SFC_GET_BROADCAST_INFO | Gets the Broadcast Chunk info.
| |||||||||
SFC_SET_BROADCAST_INFO | Sets the Broadcast Chunk info.
| |||||||||
SFC_GET_CHANNEL_MAP_INFO | Gets the channel mapping info.
When succeeded SFC_GET_CHANNEL_MAP_INFO fills data array with channel mapping values. | |||||||||
SFC_SET_CHANNEL_MAP_INFO | Sets the channel mapping info.
| |||||||||
SFC_RAW_DATA_NEEDS_ENDSWAP | Determines if raw data read using sf_read_raw() needs to be end swapped on the host CPU.
| |||||||||
SFC_WAVEX_SET_AMBISONIC | Sets the GUID of a new WAVEX file to indicate an Ambisonics format. This command turns on (SF_AMBISONIC_B_FORMAT) or off (SF_AMBISONIC_NONE) encoding.
| |||||||||
SFC_WAVEX_GET_AMBISONIC | Tests if the current file has the GUID of a WAVEX file for any of the Ambisonic formats.
| |||||||||
SFC_RF64_AUTO_DOWNGRADE | Controls auto downgrade from RF64 to WAV. The EBU recomendation is that when writing RF64 files and the resulting file is less than 4Gig in size, it should be downgraded to a WAV file (WAV files have a maximum size of 4Gig). libsndfile doesn't follow the EBU recommendations exactly, , mainly because the test suite needs to be able test reading/writing RF64 files without having to generate files larger than 4 gigabytes.
| |||||||||
SFC_SET_VBR_ENCODING_QUALITY | Sets the Variable Bit Rate encoding quality.
The encoding quality value should be between 0.0 (lowest quality) and 1.0 (highest quality). Currenly this command is only implemented for FLAC and Ogg/Vorbis files. It has no effect on un-compressed file formats. | |||||||||
SFC_SET_COMPRESSION_LEVEL | Sets compression level.
The compression level should be between 0.0 (minimum compression level) and 1.0 (highest compression level). Currenly this command is only implemented for FLAC and Ogg/Vorbis files. It has no effect on un-compressed file formats. | |||||||||
SFC_SET_CART_INFO | Gets the Cart Chunk info.
This command retrieves the Cart Chunk from WAV (and related) files. Based on AES46 standard for CartChunk (see CartChunk.org for more information.
| |||||||||
SFC_GET_CART_INFO | Gets the Cart Chunk info.
This command retrieves the Cart Chunk from WAV (and related) files. Based on AES46 standard for CartChunk (see CartChunk.org for more information.
| |||||||||
SFC_TEST_IEEE_FLOAT_REPLACE | Internal, do not use. | |||||||||
SFC_SET_ADD_DITHER_ON_WRITE | Deprecated.
| |||||||||
SFC_SET_ADD_DITHER_ON_READ | Deprecated.
|
SNDFILE2K_EXPORT int sf_command | ( | SNDFILE * | sndfile, |
int | command, | ||
void * | data, | ||
int | datasize | ||
) |
Gets or sets parameters of library or sound file.
[in] | sndfile | Pointer to a sound file state or NULL |
command | Command ID see SF_COMMAND for details | |
data | Command specific, could be NULL | |
datasize | Size of data , could be 0 |