sndfile2k  1.2.0
Data Structures | Enumerations | Functions
Command interface

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...
 

Enumerations

enum  SF_COMMAND {
  SFC_GET_LIB_VERSION = 0x1000, SFC_GET_LOG_INFO = 0x1001, SFC_GET_CURRENT_SF_INFO = 0x1002, SFC_GET_NORM_DOUBLE = 0x1010,
  SFC_GET_NORM_FLOAT = 0x1011, SFC_SET_NORM_DOUBLE = 0x1012, SFC_SET_NORM_FLOAT = 0x1013, SFC_SET_SCALE_FLOAT_INT_READ = 0x1014,
  SFC_SET_SCALE_INT_FLOAT_WRITE = 0x1015, SFC_GET_SIMPLE_FORMAT_COUNT = 0x1020, SFC_GET_SIMPLE_FORMAT = 0x1021, SFC_GET_FORMAT_INFO = 0x1028,
  SFC_GET_FORMAT_MAJOR_COUNT = 0x1030, SFC_GET_FORMAT_MAJOR = 0x1031, SFC_GET_FORMAT_SUBTYPE_COUNT = 0x1032, SFC_GET_FORMAT_SUBTYPE = 0x1033,
  SFC_CALC_SIGNAL_MAX = 0x1040, SFC_CALC_NORM_SIGNAL_MAX = 0x1041, SFC_CALC_MAX_ALL_CHANNELS = 0x1042, SFC_CALC_NORM_MAX_ALL_CHANNELS = 0x1043,
  SFC_GET_SIGNAL_MAX = 0x1044, SFC_GET_MAX_ALL_CHANNELS = 0x1045, SFC_SET_ADD_PEAK_CHUNK = 0x1050, SFC_SET_ADD_HEADER_PAD_CHUNK = 0x1051,
  SFC_UPDATE_HEADER_NOW = 0x1060, SFC_SET_UPDATE_HEADER_AUTO = 0x1061, SFC_FILE_TRUNCATE = 0x1080, SFC_SET_RAW_START_OFFSET = 0x1090,
  SFC_SET_DITHER_ON_WRITE = 0x10A0, SFC_SET_DITHER_ON_READ = 0x10A1, SFC_GET_DITHER_INFO_COUNT = 0x10A2, SFC_GET_DITHER_INFO = 0x10A3,
  SFC_GET_EMBED_FILE_INFO = 0x10B0, SFC_SET_CLIPPING = 0x10C0, SFC_GET_CLIPPING = 0x10C1, SFC_GET_CUE_COUNT = 0x10CD,
  SFC_GET_CUE = 0x10CE, SFC_SET_CUE = 0x10CF, SFC_GET_INSTRUMENT = 0x10D0, SFC_SET_INSTRUMENT = 0x10D1,
  SFC_GET_LOOP_INFO = 0x10E0, SFC_GET_BROADCAST_INFO = 0x10F0, SFC_SET_BROADCAST_INFO = 0x10F1, SFC_GET_CHANNEL_MAP_INFO = 0x1100,
  SFC_SET_CHANNEL_MAP_INFO = 0x1101, SFC_RAW_DATA_NEEDS_ENDSWAP = 0x1110, SFC_WAVEX_SET_AMBISONIC = 0x1200, SFC_WAVEX_GET_AMBISONIC = 0x1201,
  SFC_RF64_AUTO_DOWNGRADE = 0x1210, SFC_SET_VBR_ENCODING_QUALITY = 0x1300, SFC_SET_COMPRESSION_LEVEL = 0x1301, SFC_SET_CART_INFO = 0x1400,
  SFC_GET_CART_INFO = 0x1401, SFC_TEST_IEEE_FLOAT_REPLACE = 0x6001, SFC_SET_ADD_DITHER_ON_WRITE = 0x1070, SFC_SET_ADD_DITHER_ON_READ = 0x1071
}
 Defines command constants for sf_command() 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...
 

Detailed Description

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.

Enumeration Type Documentation

◆ SF_COMMAND

enum SF_COMMAND

Defines command constants for sf_command()

Enumerator
SFC_GET_LIB_VERSION 

Gets library version string.

Parameters
[in]sndfileNot used
[out]dataA pointer to a char buffer
[in]datasizeThe size of the buffer
Returns
Length of string in characters
SFC_GET_LOG_INFO 

Gets the internal per-file operation log.

Parameters
[in]sndfileA valid SNDFILE* pointer
[out]dataA pointer to a char buffer
[in]datasizeThe size of the buffer

This log buffer can often contain a good reason for why libsndfile failed to open a particular file.

Returns
Length of string in characters
SFC_GET_CURRENT_SF_INFO 

Gets SF_INFO of given sound file.

Parameters
[in]sndfileA valid SNDFILE* pointer
[out]dataA pointer to a SF_INFO struct
[in]datasizesizeof(SF_INFO)
Returns
SF_ERR_NO_ERROR on succes, error code otherwise
SFC_GET_NORM_DOUBLE 

Gets the current double normalization mode.

Parameters
[in]sndfileA valid SNDFILE* pointer
[in]dataNot used
[in]datasizeNot used
Returns
SF_TRUE if double normalization if enabled, SF_FALSE otherwise.
SFC_GET_NORM_FLOAT 

Gets the current float normalization mode.

Parameters
[in]sndfileA valid SNDFILE* pointer
[in]dataNot used
[in]datasizeNot used
Returns
SF_TRUE if float normalization if enabled, SF_FALSE otherwise.
SFC_SET_NORM_DOUBLE 

Sets the current double normalization mode.

Parameters
[in]sndfileA valid SNDFILE* pointer
[in]dataNot used
[in]datasizeSF_TRUE or SF_FALSE

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 [-1.0, 1.0].

For write operations, setting normalisation to SF_TRUE means than all data supplied to the double write functions should be in the range [-1.0, 1.0] and will be scaled for the file format as necessary.

For both cases, setting normalisation to SF_FALSE means that no scaling will take place.

Returns
SF_TRUE if double normalization if enabled, SF_FALSE otherwise.
SFC_SET_NORM_FLOAT 

Sets the current float normalization mode.

Parameters
[in]sndfileA valid SNDFILE* pointer
[in]dataNot used
[in]datasizeSF_TRUE or SF_FALSE

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 [-1.0, 1.0].

For write operations, setting normalisation to SF_TRUE means than all data supplied to the double write functions should be in the range [-1.0, 1.0] and will be scaled for the file format as necessary.

For both cases, setting normalisation to SF_FALSE means that no scaling will take place.

Returns
SF_TRUE if float normalization if enabled, SF_FALSE otherwise.
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.

Parameters
[in]sndfileA valid SNDFILE* pointer
[in]dataNot used
[in]datasizeSF_TRUE or SF_FALSE
Returns
The previous SFC_SET_SCALE_FLOAT_INT_READ setting for this file.
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.

Parameters
[in]sndfileA valid SNDFILE* pointer
[in]dataNot used
[in]datasizeSF_TRUE or SF_FALSE
Returns
The previous SFC_SET_SCALE_INT_FLOAT_WRITE setting for this file.
SFC_GET_SIMPLE_FORMAT_COUNT 

Retrieves the number of simple formats supported by libsndfile.

Parameters
[in]sndfileNot used
[in]dataA pointer to an int variable
[in]datasizesizeof(int)
Returns
SF_ERR_NO_ERROR.
SFC_GET_SIMPLE_FORMAT 

Retrieves information about a simple format.

Parameters
[in]sndfileNot used
[in]dataA pointer to an SF_FORMAT_INFO struct
[in]datasizesizeof(SF_FORMAT_INFO)

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.

Returns
SF_ERR_NO_ERROR on succes, negative error code otherwise.
SFC_GET_FORMAT_INFO 

Retrieves information about a major or subtype format.

Parameters
[in]sndfileNot used
[in]dataA pointer to an SF_FORMAT_INFO struct
[in]datasizesizeof(SF_FORMAT_INFO)

When sf_command() is called with SFC_GET_FORMAT_INFO, the format field is examined and if (format & SF_FORMAT_TYPEMASK) is a valid format then the struct is filled in with information about the given major type.

If (format & SF_FORMAT_TYPEMASK) is SF_FALSE and (format & SF_FORMAT_SUBMASK) is a valid subtype format then the struct is filled in with information about the given subtype.

SF_FORMAT_INFO format_info;
format_info.format = SF_FORMAT_WAV;
sf_command(sndfile, SFC_GET_FORMAT_INFO, &format_info, sizeof (format_info));
printf("%08x %s %s\n", format_info.format, format_info.name, format_info.extension);
format_info.format = SF_FORMAT_ULAW;
sf_command (sndfile, SFC_GET_FORMAT_INFO, &format_info, sizeof (format_info));
printf ("%08x %s\n", format_info.format, format_info.name);
Returns
SF_ERR_NO_ERROR on succes, negative error code otherwise.
SFC_GET_FORMAT_MAJOR_COUNT 

Gets the number of major formats.

Parameters
[in]sndfileNot used
[in]dataA pointer to an int
[in]datasizesizeof(int)
Returns
SF_ERR_NO_ERROR.
SFC_GET_FORMAT_MAJOR 

Gets information about a major format type.

Parameters
[in]sndfileNot used
[in]dataA pointer to an SF_FORMAT_INFO struct
[in]datasizesizeof(SF_FORMAT_INFO)

The value of the format field will be one of the major format identifiers such as SF_FORMAT_WAV or SF_FORMAT_AIFF.

The name field will contain a char* pointer to the name of the string, eg. "WAV (Microsoft)".

The extension field will contain the most commonly used file extension for that file type.

Returns
SF_ERR_NO_ERROR on succes, negative error code otherwise.
SFC_GET_FORMAT_SUBTYPE_COUNT 

Gets the number of subformats.

Parameters
[in]sndfileNot used
[in]dataA pointer to an int
[in]datasizesizeof(int)
Returns
SF_ERR_NO_ERROR.
SFC_GET_FORMAT_SUBTYPE 

Gets information about a subformat.

Parameters
[in]sndfileNot used
[out]dataA pointer to an SF_FORMAT_INFO struct
[in]datasizesizeof(SF_FORMAT_INFO)

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 format field will be one of the major format identifiers such as SF_FORMAT_WAV or SF_FORMAT_AIFF.

The name field will contain a char* pointer to the name of the string; for instance "WAV (Microsoft)" or "AIFF (Apple/SGI)".

The extension field will be a NULL pointer.

Returns
SF_ERR_NO_ERROR on succes, negative error code otherwise.
SFC_CALC_SIGNAL_MAX 

Calculates the measured maximum signal value.

Parameters
[in]sndfilea valid SNDFILE* pointer
[out]dataa pointer to a double
[in]datasizesizeof(double)
Returns
SF_ERR_NO_ERROR on succes, negative error code otherwise.
SFC_CALC_NORM_SIGNAL_MAX 

Calculates the measured normalised maximum signal value.

Parameters
[in]sndfilea valid SNDFILE* pointer
[out]dataa pointer to a double
[in]datasizesizeof(double)
Returns
SF_ERR_NO_ERROR on succes, negative error code otherwise.
SFC_CALC_MAX_ALL_CHANNELS 

Calculates the peak value (ie a single number) for each channel.

Parameters
[in]sndfilea valid SNDFILE* pointer
[out]dataa pointer to a double array
[in]datasizesizeof(double) * number of channels
Returns
SF_ERR_NO_ERROR on succes, negative error code otherwise.
SFC_CALC_NORM_MAX_ALL_CHANNELS 

Calculates the normalised peak for each channel.

Parameters
[in]sndfilea valid SNDFILE* pointer
[out]dataa pointer to a double array
[in]datasizesizeof(double) * number of channels
Returns
SF_ERR_NO_ERROR on succes, negative error code otherwise.
SFC_GET_SIGNAL_MAX 

Gets the peak value for the file as stored in the file header.

Parameters
[in]sndfilea valid SNDFILE* pointer
[out]dataa pointer to a double
[in]datasizesizeof(double)
Returns
SF_TRUE if the file header contained the peak value, SF_FALSE otherwise.
SFC_GET_MAX_ALL_CHANNELS 

Gets the peak value for each channel as stored in the file header.

Parameters
[in]sndfilea valid SNDFILE* pointer
[out]dataa pointer to a double array
[in]datasizesizeof(double) * number of channels
Returns
SF_TRUE if the file header contains per channel peak values for the file, SF_FALSE otherwise.
SFC_SET_ADD_PEAK_CHUNK 

Switches the code for adding the PEAK chunk to WAV and AIFF files on or off.

Parameters
[in]sndfileNot used
[out]dataA pointer to an SF_FORMAT_INFO struct
[in]datasizesizeof(SF_FORMAT_INFO)

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.

Warning
This call must be made before any data is written to the file.
Return values
SF_TRUEif the peak chunk will be written after this call.
SF_FALSEif the peak chunk will not be written after this call.
SFC_SET_ADD_HEADER_PAD_CHUNK 

Not used.

Returns
SF_ERR_NO_ERROR.
SFC_UPDATE_HEADER_NOW 

Forces update of the file header to reflect the data written so far when a file is open for write.

Parameters
[in]sndfilea valid SNDFILE* pointer
[in]dataNot used
[in]datasizeNot used

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.

Returns
SF_ERR_NO_ERROR.
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.

Parameters
[in]sndfilea valid SNDFILE* pointer
[in]dataNot used
[in]datasizeSF_TRUE or SF_FALSE

Similar to SFC_UPDATE_HEADER_NOW but updates the header at the end of every call to the sf_write* functions.

Returns
SF_TRUE if auto update header is now on; SF_FALSE otherwise.
SFC_FILE_TRUNCATE 

Truncates a file open for write or for read/write.

Parameters
[in]sndfilea valid SNDFILE* pointer
[in]dataA pointer to a variable of sf_count_t type
[in]datasizesizeof(sf_count_t)

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.

Returns
SF_ERR_NO_ERROR on succes, negative error code otherwise.
SFC_SET_RAW_START_OFFSET 

Changes the data start offset for files opened up as SF_FORMAT_RAW.

Parameters
[in]sndfilea valid SNDFILE* pointer
[in]dataA pointer to a variable of sf_count_t type
[in]datasizesizeof(sf_count_t)
Returns
SF_ERR_NO_ERROR on succes, negative error code otherwise.
SFC_SET_DITHER_ON_WRITE 

Controls dithering on write.

Parameters
[in]sndfilea valid SNDFILE* pointer
[in]dataA pointer to a SF_DITHER_INFO struct
[in]datasizesizeof(SF_DITHER_INFO)
Returns
SF_ERR_NO_ERROR on succes, negative error code otherwise.
SFC_SET_DITHER_ON_READ 

Controls dithering on read.

Parameters
[in]sndfilea valid SNDFILE* pointer
[in]dataA pointer to a SF_DITHER_INFO struct
[in]datasizesizeof(SF_DITHER_INFO)
Returns
SF_ERR_NO_ERROR on succes, negative error code otherwise.
SFC_GET_DITHER_INFO_COUNT 

Not used.

Returns
SF_ERR_NO_ERROR.
SFC_GET_DITHER_INFO 

Not used.

Returns
SF_ERR_NO_ERROR.
SFC_GET_EMBED_FILE_INFO 

Gets the file offset and file length of a file enbedded within another larger file.

Parameters
[in]sndfilea valid SNDFILE* pointer
[in]dataa pointer to an SF_EMBED_FILE_INFO struct
[in]datasizesizeof(SF_EMBED_FILE_INFO)
Returns
SF_ERR_NO_ERROR on succes, negative error code otherwise.
SFC_SET_CLIPPING 

Turns on/off automatic clipping when doing floating point to integer conversion.

Parameters
[in]sndfilea valid SNDFILE* pointer
[in]dataNot used
[in]datasizeSF_TRUE or SF_FALSE
Returns
SF_TRUE is clipping is now on or SF_FALSE otherwise.
SFC_GET_CLIPPING 

Retrieves current clipping setting.

Parameters
[in]sndfilea valid SNDFILE* pointer
[in]dataNot used
[in]datasizeNot used
Returns
SF_TRUE is clipping is on or SF_FALSE otherwise.
SFC_GET_CUE_COUNT 

Gets the cue marker count.

Parameters
[in]sndfilea valid SNDFILE* pointer
[out]dataA pointer to a variable of uint32_t type
[in]datasizesizeof(uint32_t)
Returns
SF_TRUE if the file header contains cue marker information for the file, SF_FALSE otherwise.
SFC_GET_CUE 

Gets cue marker information from file.

Parameters
[in]sndfilea valid SNDFILE* pointer
[out]dataA pointer to a ::SF_CUES struct
[in]datasizesizeof(SF_CUES)
Returns
SF_TRUE if the file header contains cue marker information for the file, SF_FALSE otherwise.
SFC_SET_CUE 

Sets cue marker information for the file.

Parameters
[in]sndfilea valid SNDFILE* pointer
[in]dataA pointer to a ::SF_CUES struct
[in]datasizesizeof(SF_CUES)
Returns
SF_TRUE if the file header contains cue marker information for the file, SF_FALSE otherwise.
SFC_GET_INSTRUMENT 

Gets instrument information.

Parameters
[in]sndfilea valid SNDFILE* pointer
[out]dataA pointer to a SF_INSTRUMENT struct
[in]datasizesizeof(SF_INSTRUMENT)

This command retrieves instrument information from file including MIDI base note, keyboard mapping and looping informations(start/stop and mode).

Returns
SF_TRUE if the file header contains instrument information for the file, SF_FALSE otherwise.
SFC_SET_INSTRUMENT 

Sets instrument information.

Parameters
[in]sndfilea valid SNDFILE* pointer
[in]dataA pointer to a SF_INSTRUMENT struct
[in]datasizesizeof(SF_INSTRUMENT)
Returns
SF_TRUE if the file header contains instrument information for the file, SF_FALSE otherwise.
SFC_GET_LOOP_INFO 

Sets loop information.

Parameters
[in]sndfilea valid SNDFILE* pointer
[out]dataA pointer to a ::SF_LOOP struct
[in]datasizesizeof(SF_LOOP)
Returns
SF_TRUE if the file header contains loop information for the file, SF_FALSE otherwise.
SFC_GET_BROADCAST_INFO 

Gets the Broadcast Chunk info.

Parameters
[in]sndfilea valid SNDFILE* pointer
[out]dataA pointer to a ::SF_BROADCAST_INFO struct
[in]datasizesizeof(SF_BROADCAST_INFO)
Returns
SF_TRUE if the file contained a Broadcast Extension chunk or SF_FALSE otherwise.
Deprecated:
This command is deprecated and will be removed in next major release.
SFC_SET_BROADCAST_INFO 

Sets the Broadcast Chunk info.

Parameters
[in]sndfilea valid SNDFILE* pointer
[in]dataA pointer to a ::SF_BROADCAST_INFO struct
[in]datasizesizeof(SF_BROADCAST_INFO)
Returns
SF_TRUE if setting the Broadcast Extension chunk was successful and SF_FALSE otherwise.
Deprecated:
This command is deprecated and will be removed in next major release.
SFC_GET_CHANNEL_MAP_INFO 

Gets the channel mapping info.

Parameters
[in]sndfilea valid SNDFILE* pointer
[out]dataA pointer to pointer to an int
[in]datasizedatasize sizeof (double) * number_of_channels

When succeeded SFC_GET_CHANNEL_MAP_INFO fills data array with channel mapping values.

Returns
SF_TRUE on success, SF_FALSE otherwise.
SFC_SET_CHANNEL_MAP_INFO 

Sets the channel mapping info.

Parameters
[in]sndfilea valid SNDFILE* pointer
[in]dataA pointer to pointer to an int
[in]datasizesizeof (double) * number_of_channels
Returns
SF_TRUE on success, SF_FALSE otherwise.
SFC_RAW_DATA_NEEDS_ENDSWAP 

Determines if raw data read using sf_read_raw() needs to be end swapped on the host CPU.

Parameters
[in]sndfilea valid SNDFILE* pointer
[in]dataNot used
[in]datasizeNot used
Returns
SF_TRUE on success, SF_FALSE otherwise.
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.

Parameters
[in]sndfileA valid SNDFILE* pointer
[in]dataNot used
[in]datasizeOne of SF_AMBISONIC_MODE values
Note
Ambisonics feature currently is supported with SF_FORMAT_WAVEX only.
Returns
The SF_AMBISONIC_MODE value that has just been set or zero if the file format does not support ambisonic encoding.
SFC_WAVEX_GET_AMBISONIC 

Tests if the current file has the GUID of a WAVEX file for any of the Ambisonic formats.

Parameters
[in]sndfileA valid SNDFILE* pointer
[in]dataNot used
[in]datasizeNot used
Note
Ambisonics feature currently is supported with SF_FORMAT_WAVEX only.
Returns
One of SF_AMBISONIC_MODE values if Ambisonics is supported, 0 otherwise.
See also
SFC_WAVEX_SET_AMBISONIC
SF_AMBISONIC_MODE
SFC_RF64_AUTO_DOWNGRADE 

Controls auto downgrade from RF64 to WAV.

Parameters
[in]sndfileA valid SNDFILE* pointer
[in]dataNot used
[in]datasizeSF_TRUE or SF_FALSE

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.

Note
This command should be issued before the first bit of audio data has been written to the file. Calling this command after audio data has been written will return the current value of this setting, but will not allow it to be changed.
Returns
SF_TRUE if mode is set, SF_FALSE otherwise.
SFC_SET_VBR_ENCODING_QUALITY 

Sets the Variable Bit Rate encoding quality.

Parameters
[in]sndfileA valid SNDFILE* pointer
[in]dataA pointer to a double value
[in]datasizesizeof(double)

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.

Returns
SF_TRUE if mode is set, SF_FALSE otherwise.
SFC_SET_COMPRESSION_LEVEL 

Sets compression level.

Parameters
[in]sndfileA valid SNDFILE* pointer
[in]dataA pointer to a double value
[in]datasizesizeof(double)

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.

Returns
SF_TRUE if mode is set, SF_FALSE otherwise.
SFC_SET_CART_INFO 

Gets the Cart Chunk info.

Parameters
[in]sndfilea valid SNDFILE* pointer
[out]dataA pointer to a ::SF_CART_INFO struct
[in]datasizedatasize sizeof (SF_CART_INFO)

This command retrieves the Cart Chunk from WAV (and related) files. Based on AES46 standard for CartChunk (see CartChunk.org for more information.

Returns
SF_TRUE if the file contains a Cart chunk or SF_FALSE otherwise.
Deprecated:
This command is deprecated and will be removed in next major release.
SFC_GET_CART_INFO 

Gets the Cart Chunk info.

Parameters
[in]sndfilea valid SNDFILE* pointer
[out]dataA pointer to a ::SF_CART_INFO struct
[in]datasizedatasize sizeof (SF_CART_INFO)

This command retrieves the Cart Chunk from WAV (and related) files. Based on AES46 standard for CartChunk (see CartChunk.org for more information.

Returns
SF_TRUE if the file contains a Cart chunk or SF_FALSE otherwise.
Deprecated:
This command is deprecated and will be removed in next major release.
SFC_TEST_IEEE_FLOAT_REPLACE 

Internal, do not use.

SFC_SET_ADD_DITHER_ON_WRITE 

Deprecated.

Deprecated:
SFC_SET_ADD_DITHER_ON_WRITE is deprecated and will be dropped from the library at some later date.
SFC_SET_ADD_DITHER_ON_READ 

Deprecated.

Deprecated:
SFC_SET_ADD_DITHER_ON_READ is deprecated and will be dropped from the library at some later date.

Function Documentation

◆ sf_command()

SNDFILE2K_EXPORT int sf_command ( SNDFILE sndfile,
int  command,
void *  data,
int  datasize 
)

Gets or sets parameters of library or sound file.

Parameters
[in]sndfilePointer to a sound file state or NULL
commandCommand ID see SF_COMMAND for details
dataCommand specific, could be NULL
datasizeSize of data, could be 0
Returns
Command-specific, see particular command description.