1b815c7f3Sopenharmony_ci--- 2b815c7f3Sopenharmony_cilayout: page 3b815c7f3Sopenharmony_cititle: libsndfile : the sf_command function. 4b815c7f3Sopenharmony_ci--- 5b815c7f3Sopenharmony_ci 6b815c7f3Sopenharmony_ci# sf_command 7b815c7f3Sopenharmony_ci 8b815c7f3Sopenharmony_ci```c 9b815c7f3Sopenharmony_ciint sf_command (SNDFILE *sndfile, int cmd, void *data, int datasize) ; 10b815c7f3Sopenharmony_ci``` 11b815c7f3Sopenharmony_ci 12b815c7f3Sopenharmony_ciThis function allows the caller to retrieve information from or change aspects 13b815c7f3Sopenharmony_ciof the library behaviour. Examples include retrieving a string containing the 14b815c7f3Sopenharmony_cilibrary version or changing the scaling applied to floating point sample data 15b815c7f3Sopenharmony_ciduring read and write. Most of these operations are performed on a per-file 16b815c7f3Sopenharmony_cibasis. 17b815c7f3Sopenharmony_ci 18b815c7f3Sopenharmony_ciThe cmd parameter is an integer identifier which is defined in *sndfile.h*. All 19b815c7f3Sopenharmony_ciof the valid command identifiers have names beginning with "SFC_". Data is 20b815c7f3Sopenharmony_cipassed to and returned from the library by use of a void pointer. The library 21b815c7f3Sopenharmony_ciwill not read or write more than datasize bytes from the void pointer. For some 22b815c7f3Sopenharmony_cicalls no data is required in which case data should be NULL and datasize may be 23b815c7f3Sopenharmony_ciused for some other purpose. 24b815c7f3Sopenharmony_ci 25b815c7f3Sopenharmony_ciThe available commands are as follows: 26b815c7f3Sopenharmony_ci 27b815c7f3Sopenharmony_ci| Name | Description | 28b815c7f3Sopenharmony_ci|:------------------------------------------------------------------|:--------------------------------------------------------| 29b815c7f3Sopenharmony_ci| [SFC_GET_LIB_VERSION](#sfc_get_lib_version) | Retrieve the version of the library as a string. | 30b815c7f3Sopenharmony_ci| [SFC_GET_LOG_INFO](#sfc_get_log_info) | Retrieve the internal per-file operation log. | 31b815c7f3Sopenharmony_ci| [SFC_GET_CURRENT_SF_INFO](#sfc_get_current_sf_info) | Retrieve `SF_INFO` struct of opened file. | 32b815c7f3Sopenharmony_ci| [SFC_CALC_SIGNAL_MAX](#sfc_calc_signal_max) | Calculate the measured maximum signal value. | 33b815c7f3Sopenharmony_ci| [SFC_CALC_NORM_SIGNAL_MAX](#sfc_calc_norm_signal_max) | Calculate the measured normalised maximum signal value. | 34b815c7f3Sopenharmony_ci| [SFC_CALC_MAX_ALL_CHANNELS](#sfc_calc_max_all_channels) | Calculate the peak value for each channel. | 35b815c7f3Sopenharmony_ci| [SFC_CALC_NORM_MAX_ALL_CHANNELS](#sfc_calc_norm_max_all_channels) | Calculate the normalised peak for each channel. | 36b815c7f3Sopenharmony_ci| [SFC_GET_SIGNAL_MAX](#sfc_get_signal_max) | Retrieve the peak value for the file. | 37b815c7f3Sopenharmony_ci| [SFC_GET_MAX_ALL_CHANNELS](#sfc_get_max_all_channels) | Retrieve the peak value for each channel. | 38b815c7f3Sopenharmony_ci| [SFC_SET_NORM_FLOAT](#sfc_set_norm_float) | Set float normalisation behaviour. | 39b815c7f3Sopenharmony_ci| [SFC_SET_NORM_DOUBLE](#sfc_set_norm_double) | Set double normalisation behaviour. | 40b815c7f3Sopenharmony_ci| [SFC_GET_NORM_FLOAT](#sfc_get_norm_float) | Get float normalisation behaviour. | 41b815c7f3Sopenharmony_ci| [SFC_GET_NORM_DOUBLE](#sfc_get_norm_double) | Get double normalisation behaviour. | 42b815c7f3Sopenharmony_ci| [SFC_SET_SCALE_FLOAT_INT_READ](#sfc_set_scale_float_int_read) | Control scale factor on read. | 43b815c7f3Sopenharmony_ci| [SFC_SET_SCALE_INT_FLOAT_WRITE](#sfc_set_scale_int_float_write) | Control scale factor on write. | 44b815c7f3Sopenharmony_ci| [SFC_GET_SIMPLE_FORMAT_COUNT](#sfc_get_simple_format_count) | Get simple formats count. | 45b815c7f3Sopenharmony_ci| [SFC_GET_SIMPLE_FORMAT](#sfc_get_simple_format) | Get information about a simple format. | 46b815c7f3Sopenharmony_ci| [SFC_GET_FORMAT_INFO](#sfc_get_format_info) | Get information about a major or subtype format. | 47b815c7f3Sopenharmony_ci| [SFC_GET_FORMAT_MAJOR_COUNT](#sfc_get_format_major_count) | Get the number of major formats. | 48b815c7f3Sopenharmony_ci| [SFC_GET_FORMAT_MAJOR](#sfc_get_format_major) | Get information about a major format type. | 49b815c7f3Sopenharmony_ci| [SFC_GET_FORMAT_SUBTYPE_COUNT](#sfc_get_format_subtype_count) | Get the number of subformats. | 50b815c7f3Sopenharmony_ci| [SFC_GET_FORMAT_SUBTYPE](#sfc_get_format_subtype) | Get information about a subformat. | 51b815c7f3Sopenharmony_ci| [SFC_SET_ADD_PEAK_CHUNK](#sfc_set_add_peak_chunk) | Control PEAK chunk write to WAV and AIFF. | 52b815c7f3Sopenharmony_ci| [SFC_UPDATE_HEADER_NOW](#sfc_update_header_now) | Update the file header in write mode on demand. | 53b815c7f3Sopenharmony_ci| [SFC_SET_UPDATE_HEADER_AUTO](#sfc_set_update_header_auto) | Update the file header on each write. | 54b815c7f3Sopenharmony_ci| [SFC_FILE_TRUNCATE](#sfc_file_truncate) | Truncate a file open for write or for read/write. | 55b815c7f3Sopenharmony_ci| [SFC_SET_RAW_START_OFFSET](#sfc_set_raw_start_offset) | Change the data start offset for raw files. | 56b815c7f3Sopenharmony_ci| SFC_SET_DITHER_ON_WRITE | Not implemented. | 57b815c7f3Sopenharmony_ci| SFC_SET_DITHER_ON_READ | Not implemented. | 58b815c7f3Sopenharmony_ci| SFC_GET_DITHER_INFO_COUNT | Not implemented. | 59b815c7f3Sopenharmony_ci| SFC_GET_DITHER_INFO | Not implemented. | 60b815c7f3Sopenharmony_ci| [SFC_SET_CLIPPING](#sfc_set_clipping) | Control automatic clipping behaviour. | 61b815c7f3Sopenharmony_ci| [SFC_GET_CLIPPING](#sfc_get_clipping) | Get current clipping setting. | 62b815c7f3Sopenharmony_ci| [SFC_GET_EMBED_FILE_INFO](#sfc_get_embed_file_info) | Get information about embedded audio files. | 63b815c7f3Sopenharmony_ci| [SFC_WAVEX_GET_AMBISONIC](#sfc_wavex_get_ambisonic) | Test a WAVEX file for Ambisonic format. | 64b815c7f3Sopenharmony_ci| [SFC_WAVEX_SET_AMBISONIC](#sfc_wavex_set_ambisonic) | Modify a WAVEX header for Ambisonic format. | 65b815c7f3Sopenharmony_ci| [SFC_SET_VBR_ENCODING_QUALITY](#sfc_set_vbr_encoding_quality) | Set the Variable Bit Rate encoding quality. | 66b815c7f3Sopenharmony_ci| [SFC_SET_OGG_PAGE_LATENCY_MS](#sfc_set_ogg_page_latency_ms) | Set Ogg page latency for Opus file. | 67b815c7f3Sopenharmony_ci| [SFC_GET_OGG_STREAM_SERIALNO](#sfc_get_ogg_stream_serialno) | Get Ogg stream serial number. | 68b815c7f3Sopenharmony_ci| [SFC_SET_COMPRESSION_LEVEL](#sfc_set_compression_level) | Set the compression level. | 69b815c7f3Sopenharmony_ci| [SFC_RAW_DATA_NEEDS_ENDSWAP](#sfc_raw_data_needs_endswap) | Determine if raw data needs endswapping. | 70b815c7f3Sopenharmony_ci| [SFC_GET_BROADCAST_INFO](#sfc_get_broadcast_info) | Get the Broadcast Chunk info. | 71b815c7f3Sopenharmony_ci| [SFC_SET_BROADCAST_INFO](#sfc_set_broadcast_info) | Set the Broadcast Chunk info. | 72b815c7f3Sopenharmony_ci| [SFC_GET_CHANNEL_MAP_INFO](#sfc_get_channel_map_info) | Get the channel map info. | 73b815c7f3Sopenharmony_ci| [SFC_SET_CHANNEL_MAP_INFO](#sfc_set_channel_map_info) | Set the channel map info. | 74b815c7f3Sopenharmony_ci| [SFC_SET_CART_INFO](#sfc_set_cart_info) | Set the Cart Chunk info. | 75b815c7f3Sopenharmony_ci| [SFC_GET_CART_INFO](#sfc_get_cart_info) | Get the Cart Chunk info. | 76b815c7f3Sopenharmony_ci| [SFC_GET_LOOP_INFO](#sfc_get_loop_info) | Get loop info. | 77b815c7f3Sopenharmony_ci| [SFC_GET_INSTRUMENT](#sfc_get_instrument) | Get instrument info. | 78b815c7f3Sopenharmony_ci| [SFC_SET_INSTRUMENT](#sfc_set_instrument) | Set instrument info. | 79b815c7f3Sopenharmony_ci| [SFC_GET_CUE_COUNT](#sfc_get_cue_count) | Get the cue marker count. | 80b815c7f3Sopenharmony_ci| [SFC_GET_CUE](#sfc_get_cue) | Get cue marker info. | 81b815c7f3Sopenharmony_ci| [SFC_SET_CUE](#sfc_set_cue) | Set cue marker info. | 82b815c7f3Sopenharmony_ci| [SFC_RF64_AUTO_DOWNGRADE](#sfc_rf64_auto_downgrade) | Set auto downgrade from RF64 to WAV. | 83b815c7f3Sopenharmony_ci| [SFC_GET_ORIGINAL_SAMPLERATE](#sfc_get_original_samplerate) | Get original samplerate metadata. | 84b815c7f3Sopenharmony_ci| [SFC_SET_ORIGINAL_SAMPLERATE](#sfc_set_original_samplerate) | Set original samplerate metadata. | 85b815c7f3Sopenharmony_ci| [SFC_GET_BITRATE_MODE](#sfc_get_bitrate_mode) | Get bitrate mode. | 86b815c7f3Sopenharmony_ci| [SFC_SET_BITRATE_MODE](#sfc_set_bitrate_mode) | Set bitrate mode. | 87b815c7f3Sopenharmony_ci 88b815c7f3Sopenharmony_ci--- 89b815c7f3Sopenharmony_ci 90b815c7f3Sopenharmony_ci## SFC_GET_LIB_VERSION 91b815c7f3Sopenharmony_ci 92b815c7f3Sopenharmony_ciRetrieve the version of the library as a string. 93b815c7f3Sopenharmony_ci 94b815c7f3Sopenharmony_ci### Parameters 95b815c7f3Sopenharmony_ci 96b815c7f3Sopenharmony_cisndfile 97b815c7f3Sopenharmony_ci: Not used 98b815c7f3Sopenharmony_ci 99b815c7f3Sopenharmony_cicmd 100b815c7f3Sopenharmony_ci: SFC_GET_LIB_VERSION 101b815c7f3Sopenharmony_ci 102b815c7f3Sopenharmony_cidata 103b815c7f3Sopenharmony_ci: A pointer to a char buffer 104b815c7f3Sopenharmony_ci 105b815c7f3Sopenharmony_cidatasize 106b815c7f3Sopenharmony_ci: The size of the buffer 107b815c7f3Sopenharmony_ci 108b815c7f3Sopenharmony_ci### Examples 109b815c7f3Sopenharmony_ci 110b815c7f3Sopenharmony_ci```c 111b815c7f3Sopenharmony_cichar buffer [128] ; 112b815c7f3Sopenharmony_cisf_command (NULL, SFC_GET_LIB_VERSION, buffer, sizeof (buffer)) ; 113b815c7f3Sopenharmony_ci``` 114b815c7f3Sopenharmony_ci 115b815c7f3Sopenharmony_ci### Return value 116b815c7f3Sopenharmony_ci 117b815c7f3Sopenharmony_ciThis call will return the length of the retrieved version string. 118b815c7f3Sopenharmony_ci 119b815c7f3Sopenharmony_ci### Notes 120b815c7f3Sopenharmony_ci 121b815c7f3Sopenharmony_ciThe string returned in the buffer passed to this function will not overflow the 122b815c7f3Sopenharmony_cibuffer and will always be null terminated . 123b815c7f3Sopenharmony_ci 124b815c7f3Sopenharmony_ci## SFC_GET_LOG_INFO 125b815c7f3Sopenharmony_ci 126b815c7f3Sopenharmony_ciRetrieve the internal per-file operation log. 127b815c7f3Sopenharmony_ci 128b815c7f3Sopenharmony_ciThis log buffer can often contain a good reason for why libsndfile failed to 129b815c7f3Sopenharmony_ciopen a particular file. 130b815c7f3Sopenharmony_ci 131b815c7f3Sopenharmony_ci### Parameters 132b815c7f3Sopenharmony_ci 133b815c7f3Sopenharmony_cisndfile 134b815c7f3Sopenharmony_ci: A valid SNDFILE* pointer 135b815c7f3Sopenharmony_ci 136b815c7f3Sopenharmony_cicmd 137b815c7f3Sopenharmony_ci: SFC_GET_LOG_INFO 138b815c7f3Sopenharmony_ci 139b815c7f3Sopenharmony_cidata 140b815c7f3Sopenharmony_ci: A pointer to a char buffer 141b815c7f3Sopenharmony_ci 142b815c7f3Sopenharmony_cidatasize 143b815c7f3Sopenharmony_ci: The size of the buffer 144b815c7f3Sopenharmony_ci 145b815c7f3Sopenharmony_ciExample: 146b815c7f3Sopenharmony_ci 147b815c7f3Sopenharmony_ci```c 148b815c7f3Sopenharmony_cichar buffer [2048] ; 149b815c7f3Sopenharmony_cisf_command (sndfile, SFC_GET_LOG_INFO, buffer, sizeof (buffer)) ; 150b815c7f3Sopenharmony_ci``` 151b815c7f3Sopenharmony_ci 152b815c7f3Sopenharmony_ci### Return value 153b815c7f3Sopenharmony_ci 154b815c7f3Sopenharmony_ciThis call will return the length of the retrieved version string. 155b815c7f3Sopenharmony_ci 156b815c7f3Sopenharmony_ci### Notes 157b815c7f3Sopenharmony_ci 158b815c7f3Sopenharmony_ciThe string returned in the buffer passed to this function will not overflow the 159b815c7f3Sopenharmony_cibuffer and will always be null terminated. 160b815c7f3Sopenharmony_ci 161b815c7f3Sopenharmony_ci## SFC_GET_CURRENT_SF_INFO 162b815c7f3Sopenharmony_ci 163b815c7f3Sopenharmony_ciRetrieve `SF_INFO` struct of opened file. 164b815c7f3Sopenharmony_ci 165b815c7f3Sopenharmony_ci`SFC_GET_CURRENT_SF_INFO` command copies `SF_INFO` struct of `sndfile` object to 166b815c7f3Sopenharmony_ciprovided buffer. 167b815c7f3Sopenharmony_ci 168b815c7f3Sopenharmony_ci### Parameters 169b815c7f3Sopenharmony_ci 170b815c7f3Sopenharmony_cisndfile 171b815c7f3Sopenharmony_ci: A valid SNDFILE* pointer 172b815c7f3Sopenharmony_ci 173b815c7f3Sopenharmony_cicmd 174b815c7f3Sopenharmony_ci: SFC_GET_CURRENT_SF_INFO 175b815c7f3Sopenharmony_ci 176b815c7f3Sopenharmony_cidata 177b815c7f3Sopenharmony_ci: A pointer to a valid SF_INFO* pointer 178b815c7f3Sopenharmony_ci 179b815c7f3Sopenharmony_cidatasize 180b815c7f3Sopenharmony_ci: sizeof (SF_INFO) 181b815c7f3Sopenharmony_ci 182b815c7f3Sopenharmony_ci### Examples 183b815c7f3Sopenharmony_ci 184b815c7f3Sopenharmony_ci```c 185b815c7f3Sopenharmony_ciSF_INFO sfinfo ; 186b815c7f3Sopenharmony_cisf_command (sndfile, SFC_GET_CURRENT_SF_INFO, sfinfo, sizeof (SF_INFO)) ; 187b815c7f3Sopenharmony_ci``` 188b815c7f3Sopenharmony_ci 189b815c7f3Sopenharmony_ci### Return value 190b815c7f3Sopenharmony_ci 191b815c7f3Sopenharmony_ciZero on success, non-zero otherwise. 192b815c7f3Sopenharmony_ci 193b815c7f3Sopenharmony_ci## SFC_CALC_SIGNAL_MAX 194b815c7f3Sopenharmony_ci 195b815c7f3Sopenharmony_ciRetrieve the measured maximum signal value. This involves reading through the 196b815c7f3Sopenharmony_ciwhole file which can be slow on large files. 197b815c7f3Sopenharmony_ci 198b815c7f3Sopenharmony_ci### Parameters 199b815c7f3Sopenharmony_ci 200b815c7f3Sopenharmony_cisndfile 201b815c7f3Sopenharmony_ci: A valid SNDFILE* pointer 202b815c7f3Sopenharmony_ci 203b815c7f3Sopenharmony_cicmd 204b815c7f3Sopenharmony_ci: SFC_CALC_SIGNAL_MAX 205b815c7f3Sopenharmony_ci 206b815c7f3Sopenharmony_cidata 207b815c7f3Sopenharmony_ci: A pointer to a double 208b815c7f3Sopenharmony_ci 209b815c7f3Sopenharmony_cidatasize 210b815c7f3Sopenharmony_ci: sizeof (double) 211b815c7f3Sopenharmony_ci 212b815c7f3Sopenharmony_ci### Examples 213b815c7f3Sopenharmony_ci 214b815c7f3Sopenharmony_ci```c 215b815c7f3Sopenharmony_cidouble max_val ; 216b815c7f3Sopenharmony_cisf_command (sndfile, SFC_CALC_SIGNAL_MAX, &max_val, sizeof (max_val)) ; 217b815c7f3Sopenharmony_ci``` 218b815c7f3Sopenharmony_ci 219b815c7f3Sopenharmony_ci### Return value 220b815c7f3Sopenharmony_ci 221b815c7f3Sopenharmony_ciZero on success, non-zero otherwise. 222b815c7f3Sopenharmony_ci 223b815c7f3Sopenharmony_ci## SFC_CALC_NORM_SIGNAL_MAX 224b815c7f3Sopenharmony_ci 225b815c7f3Sopenharmony_ciRetrieve the measured normalised maximum signal value. This involves reading 226b815c7f3Sopenharmony_cithrough the whole file which can be slow on large files. 227b815c7f3Sopenharmony_ci 228b815c7f3Sopenharmony_ci### Parameters 229b815c7f3Sopenharmony_ci 230b815c7f3Sopenharmony_cisndfile 231b815c7f3Sopenharmony_ci: A valid SNDFILE* pointer 232b815c7f3Sopenharmony_ci 233b815c7f3Sopenharmony_cicmd 234b815c7f3Sopenharmony_ci: SFC_CALC_NORM_SIGNAL_MAX 235b815c7f3Sopenharmony_ci 236b815c7f3Sopenharmony_cidata 237b815c7f3Sopenharmony_ci: A pointer to a double 238b815c7f3Sopenharmony_ci 239b815c7f3Sopenharmony_cidatasize 240b815c7f3Sopenharmony_ci: sizeof (double) 241b815c7f3Sopenharmony_ci 242b815c7f3Sopenharmony_ci### Examples 243b815c7f3Sopenharmony_ci 244b815c7f3Sopenharmony_ci```c 245b815c7f3Sopenharmony_cidouble max_val ; 246b815c7f3Sopenharmony_cisf_command (sndfile, SFC_CALC_NORM_SIGNAL_MAX, &max_val, sizeof (max_val)) ; 247b815c7f3Sopenharmony_ci``` 248b815c7f3Sopenharmony_ci 249b815c7f3Sopenharmony_ci### Return value 250b815c7f3Sopenharmony_ci 251b815c7f3Sopenharmony_ciZero on success, non-zero otherwise. 252b815c7f3Sopenharmony_ci 253b815c7f3Sopenharmony_ci## SFC_CALC_MAX_ALL_CHANNELS 254b815c7f3Sopenharmony_ci 255b815c7f3Sopenharmony_ciCalculate the peak value (ie a single number) for each channel. This involves 256b815c7f3Sopenharmony_cireading through the whole file which can be slow on large files. 257b815c7f3Sopenharmony_ci 258b815c7f3Sopenharmony_ci### Parameters 259b815c7f3Sopenharmony_ci 260b815c7f3Sopenharmony_cisndfile 261b815c7f3Sopenharmony_ci: A valid SNDFILE* pointer 262b815c7f3Sopenharmony_ci 263b815c7f3Sopenharmony_cicmd 264b815c7f3Sopenharmony_ci: SFC_CALC_MAX_ALL_CHANNELS 265b815c7f3Sopenharmony_ci 266b815c7f3Sopenharmony_cidata 267b815c7f3Sopenharmony_ci: A pointer to a double 268b815c7f3Sopenharmony_ci 269b815c7f3Sopenharmony_cidatasize 270b815c7f3Sopenharmony_ci: sizeof (double) * number_of_channels 271b815c7f3Sopenharmony_ci 272b815c7f3Sopenharmony_ci### Examples 273b815c7f3Sopenharmony_ci 274b815c7f3Sopenharmony_ci```c 275b815c7f3Sopenharmony_cidouble peaks [number_of_channels] ; 276b815c7f3Sopenharmony_cisf_command (sndfile, SFC_CALC_MAX_ALL_CHANNELS, peaks, sizeof (peaks)) ; 277b815c7f3Sopenharmony_ci``` 278b815c7f3Sopenharmony_ci 279b815c7f3Sopenharmony_ci### Return value 280b815c7f3Sopenharmony_ci 281b815c7f3Sopenharmony_ciZero if peaks have been calculated successfully and non-zero otherwise. 282b815c7f3Sopenharmony_ci 283b815c7f3Sopenharmony_ci## SFC_CALC_NORM_MAX_ALL_CHANNELS 284b815c7f3Sopenharmony_ci 285b815c7f3Sopenharmony_ciCalculate the normalised peak for each channel. This involves reading through 286b815c7f3Sopenharmony_cithe whole file which can be slow on large files. 287b815c7f3Sopenharmony_ci 288b815c7f3Sopenharmony_ci### Parameters 289b815c7f3Sopenharmony_ci 290b815c7f3Sopenharmony_cisndfile 291b815c7f3Sopenharmony_ci: A valid SNDFILE* pointer 292b815c7f3Sopenharmony_ci 293b815c7f3Sopenharmony_cicmd 294b815c7f3Sopenharmony_ci: SFC_CALC_NORM_MAX_ALL_CHANNELS 295b815c7f3Sopenharmony_ci 296b815c7f3Sopenharmony_cidata 297b815c7f3Sopenharmony_ci: A pointer to a double 298b815c7f3Sopenharmony_ci 299b815c7f3Sopenharmony_cidatasize 300b815c7f3Sopenharmony_ci: sizeof (double) * number_of_channels 301b815c7f3Sopenharmony_ci 302b815c7f3Sopenharmony_ci### Examples 303b815c7f3Sopenharmony_ci 304b815c7f3Sopenharmony_ci```c 305b815c7f3Sopenharmony_cidouble peaks [number_of_channels] ; 306b815c7f3Sopenharmony_cisf_command (sndfile, SFC_CALC_NORM_MAX_ALL_CHANNELS, peaks, sizeof (peaks)) ; 307b815c7f3Sopenharmony_ci``` 308b815c7f3Sopenharmony_ci 309b815c7f3Sopenharmony_ci### Return value 310b815c7f3Sopenharmony_ci 311b815c7f3Sopenharmony_ciZero if peaks have been calculated successfully and non-zero otherwise. 312b815c7f3Sopenharmony_ci 313b815c7f3Sopenharmony_ci## SFC_GET_SIGNAL_MAX 314b815c7f3Sopenharmony_ci 315b815c7f3Sopenharmony_ciRetrieve the peak value for the file as stored in the file header. 316b815c7f3Sopenharmony_ci 317b815c7f3Sopenharmony_ci### Parameters 318b815c7f3Sopenharmony_ci 319b815c7f3Sopenharmony_cisndfile 320b815c7f3Sopenharmony_ci: A valid SNDFILE* pointer 321b815c7f3Sopenharmony_ci 322b815c7f3Sopenharmony_cicmd 323b815c7f3Sopenharmony_ci: SFC_GET_SIGNAL_MAX 324b815c7f3Sopenharmony_ci 325b815c7f3Sopenharmony_cidata 326b815c7f3Sopenharmony_ci: A pointer to a double 327b815c7f3Sopenharmony_ci 328b815c7f3Sopenharmony_cidatasize 329b815c7f3Sopenharmony_ci: sizeof (double) 330b815c7f3Sopenharmony_ci 331b815c7f3Sopenharmony_ci### Examples 332b815c7f3Sopenharmony_ci 333b815c7f3Sopenharmony_ci```c 334b815c7f3Sopenharmony_cidouble max_peak ; 335b815c7f3Sopenharmony_cisf_command (sndfile, SFC_GET_SIGNAL_MAX, &max_peak, sizeof (max_peak)) ; 336b815c7f3Sopenharmony_ci``` 337b815c7f3Sopenharmony_ci 338b815c7f3Sopenharmony_ci### Return value 339b815c7f3Sopenharmony_ci 340b815c7f3Sopenharmony_ciSF_TRUE if the file header contained the peak value. SF_FALSE 341b815c7f3Sopenharmony_ciotherwise. 342b815c7f3Sopenharmony_ci 343b815c7f3Sopenharmony_ci## SFC_GET_MAX_ALL_CHANNELS 344b815c7f3Sopenharmony_ci 345b815c7f3Sopenharmony_ciRetrieve the peak value for the file as stored in the file header. 346b815c7f3Sopenharmony_ci 347b815c7f3Sopenharmony_ci### Parameters 348b815c7f3Sopenharmony_ci 349b815c7f3Sopenharmony_cisndfile 350b815c7f3Sopenharmony_ci: A valid SNDFILE* pointer 351b815c7f3Sopenharmony_ci 352b815c7f3Sopenharmony_cicmd 353b815c7f3Sopenharmony_ci: SFC_GET_SIGNAL_MAX 354b815c7f3Sopenharmony_ci 355b815c7f3Sopenharmony_cidata 356b815c7f3Sopenharmony_ci: A pointer to an array of doubles 357b815c7f3Sopenharmony_ci 358b815c7f3Sopenharmony_cidatasize 359b815c7f3Sopenharmony_ci: sizeof (double) * number_of_channels 360b815c7f3Sopenharmony_ci 361b815c7f3Sopenharmony_ci### Example 362b815c7f3Sopenharmony_ci 363b815c7f3Sopenharmony_ci```c 364b815c7f3Sopenharmony_cidouble peaks [number_of_channels] ; 365b815c7f3Sopenharmony_cisf_command (sndfile, SFC_GET_MAX_ALL_CHANNELS, peaks, sizeof (peaks)) ; 366b815c7f3Sopenharmony_ci``` 367b815c7f3Sopenharmony_ci 368b815c7f3Sopenharmony_ci### Return value 369b815c7f3Sopenharmony_ci 370b815c7f3Sopenharmony_ciSF_TRUE if the file header contains per channel peak values for the file, 371b815c7f3Sopenharmony_ciSF_FALSE otherwise. 372b815c7f3Sopenharmony_ci 373b815c7f3Sopenharmony_ci## SFC_SET_NORM_FLOAT 374b815c7f3Sopenharmony_ci 375b815c7f3Sopenharmony_ciThis command only affects data read from or written to using the 376b815c7f3Sopenharmony_cifloating point 377b815c7f3Sopenharmony_cifunctions: 378b815c7f3Sopenharmony_ci 379b815c7f3Sopenharmony_ci```c 380b815c7f3Sopenharmony_cisize_t sf_read_float (SNDFILE *sndfile, float *ptr, size_t items) ; 381b815c7f3Sopenharmony_cisize_t sf_readf_float (SNDFILE *sndfile, float *ptr, size_t frames) ; 382b815c7f3Sopenharmony_ci 383b815c7f3Sopenharmony_cisize_t sf_write_float (SNDFILE *sndfile, float *ptr, size_t items) ; 384b815c7f3Sopenharmony_cisize_t sf_writef_float (SNDFILE *sndfile, float *ptr, size_t frames) ; 385b815c7f3Sopenharmony_ci``` 386b815c7f3Sopenharmony_ci 387b815c7f3Sopenharmony_ci### Parameters 388b815c7f3Sopenharmony_ci 389b815c7f3Sopenharmony_cisndfile 390b815c7f3Sopenharmony_ci: A valid SNDFILE* pointer 391b815c7f3Sopenharmony_ci 392b815c7f3Sopenharmony_cicmd 393b815c7f3Sopenharmony_ci: SFC_SET_NORM_FLOAT 394b815c7f3Sopenharmony_ci 395b815c7f3Sopenharmony_cidata 396b815c7f3Sopenharmony_ci: NULL 397b815c7f3Sopenharmony_ci 398b815c7f3Sopenharmony_cidatasize 399b815c7f3Sopenharmony_ci: SF_TRUE or SF_FALSE 400b815c7f3Sopenharmony_ci 401b815c7f3Sopenharmony_ciFor read operations setting normalisation to SF_TRUE means that the data from 402b815c7f3Sopenharmony_ciall subsequent reads will be be normalised to the range [-1.0, 1.0]. 403b815c7f3Sopenharmony_ci 404b815c7f3Sopenharmony_ciFor write operations, setting normalisation to SF_TRUE means than all data 405b815c7f3Sopenharmony_cisupplied to the float write functions should be in the range [-1.0, 1.0] and 406b815c7f3Sopenharmony_ciwill be scaled for the file format as necessary. 407b815c7f3Sopenharmony_ci 408b815c7f3Sopenharmony_ciFor both cases, setting normalisation to SF_FALSE means that no scaling will 409b815c7f3Sopenharmony_citake place. 410b815c7f3Sopenharmony_ci 411b815c7f3Sopenharmony_ci### Examples 412b815c7f3Sopenharmony_ci 413b815c7f3Sopenharmony_ci```c 414b815c7f3Sopenharmony_cisf_command (sndfile, SFC_SET_NORM_FLOAT, NULL, SF_TRUE) ; 415b815c7f3Sopenharmony_ci 416b815c7f3Sopenharmony_cisf_command (sndfile, SFC_SET_NORM_FLOAT, NULL, SF_FALSE) ; 417b815c7f3Sopenharmony_ci``` 418b815c7f3Sopenharmony_ci 419b815c7f3Sopenharmony_ci### Return value 420b815c7f3Sopenharmony_ci 421b815c7f3Sopenharmony_ciReturns the previous float normalisation mode. 422b815c7f3Sopenharmony_ci 423b815c7f3Sopenharmony_ci## SFC_SET_NORM_DOUBLE 424b815c7f3Sopenharmony_ci 425b815c7f3Sopenharmony_ciThis command only affects data read from or written to using the double 426b815c7f3Sopenharmony_ciprecision floating point 427b815c7f3Sopenharmony_cifunctions: 428b815c7f3Sopenharmony_ci 429b815c7f3Sopenharmony_ci```c 430b815c7f3Sopenharmony_cisize_t sf_read_double (SNDFILE *sndfile, double *ptr, size_t items) ; 431b815c7f3Sopenharmony_cisize_t sf_readf_double (SNDFILE *sndfile, double *ptr, size_t frames) ; 432b815c7f3Sopenharmony_ci 433b815c7f3Sopenharmony_cisize_t sf_write_double (SNDFILE *sndfile, double *ptr, size_t items) ; 434b815c7f3Sopenharmony_cisize_t sf_writef_double (SNDFILE *sndfile, double *ptr, size_t frames) ; 435b815c7f3Sopenharmony_ci``` 436b815c7f3Sopenharmony_ci 437b815c7f3Sopenharmony_ci### Parameters 438b815c7f3Sopenharmony_ci 439b815c7f3Sopenharmony_cisndfile 440b815c7f3Sopenharmony_ci: A valid SNDFILE* pointer 441b815c7f3Sopenharmony_ci 442b815c7f3Sopenharmony_cicmd 443b815c7f3Sopenharmony_ci: SFC_SET_NORM_DOUBLE 444b815c7f3Sopenharmony_ci 445b815c7f3Sopenharmony_cidata 446b815c7f3Sopenharmony_ci: NULL 447b815c7f3Sopenharmony_ci 448b815c7f3Sopenharmony_cidatasize 449b815c7f3Sopenharmony_ci: SF_TRUE or SF_FALSE 450b815c7f3Sopenharmony_ci 451b815c7f3Sopenharmony_ciFor read operations setting normalisation to SF_TRUE means that the data from 452b815c7f3Sopenharmony_ciall subsequent reads will be be normalised to the range [-1.0, 1.0]. 453b815c7f3Sopenharmony_ci 454b815c7f3Sopenharmony_ciFor write operations, setting normalisation to SF_TRUE means than all data 455b815c7f3Sopenharmony_cisupplied to the double write functions should be in the range [-1.0, 1.0] and 456b815c7f3Sopenharmony_ciwill be scaled for the file format as necessary. 457b815c7f3Sopenharmony_ci 458b815c7f3Sopenharmony_ciFor both cases, setting normalisation to SF_FALSE means that no scaling will 459b815c7f3Sopenharmony_citake place. 460b815c7f3Sopenharmony_ci 461b815c7f3Sopenharmony_ci### Examples 462b815c7f3Sopenharmony_ci 463b815c7f3Sopenharmony_ci```c 464b815c7f3Sopenharmony_cisf_command (sndfile, SFC_SET_NORM_DOUBLE, NULL, SF_TRUE) ; 465b815c7f3Sopenharmony_ci 466b815c7f3Sopenharmony_cisf_command (sndfile, SFC_SET_NORM_DOUBLE, NULL, SF_FALSE) ; 467b815c7f3Sopenharmony_ci``` 468b815c7f3Sopenharmony_ci 469b815c7f3Sopenharmony_ci### Return value 470b815c7f3Sopenharmony_ci 471b815c7f3Sopenharmony_ciReturns the previous double normalisation mode. 472b815c7f3Sopenharmony_ci 473b815c7f3Sopenharmony_ci## SFC_GET_NORM_FLOAT 474b815c7f3Sopenharmony_ci 475b815c7f3Sopenharmony_ciRetrieve the current float normalisation mode. 476b815c7f3Sopenharmony_ci 477b815c7f3Sopenharmony_ci### Parameters 478b815c7f3Sopenharmony_ci 479b815c7f3Sopenharmony_cisndfile 480b815c7f3Sopenharmony_ci: A valid SNDFILE* pointer 481b815c7f3Sopenharmony_ci 482b815c7f3Sopenharmony_cicmd 483b815c7f3Sopenharmony_ci: SFC_GET_NORM_FLOAT 484b815c7f3Sopenharmony_ci 485b815c7f3Sopenharmony_cidata 486b815c7f3Sopenharmony_ci: NULL 487b815c7f3Sopenharmony_ci 488b815c7f3Sopenharmony_cidatasize 489b815c7f3Sopenharmony_ci: anything 490b815c7f3Sopenharmony_ci 491b815c7f3Sopenharmony_ci### Examples 492b815c7f3Sopenharmony_ci 493b815c7f3Sopenharmony_ci```c 494b815c7f3Sopenharmony_cinormalisation = sf_command (sndfile, SFC_GET_NORM_FLOAT, NULL, 0) ; 495b815c7f3Sopenharmony_ci``` 496b815c7f3Sopenharmony_ci 497b815c7f3Sopenharmony_ci### Return value 498b815c7f3Sopenharmony_ci 499b815c7f3Sopenharmony_ciReturns TRUE if normalisation is on and FALSE otherwise. 500b815c7f3Sopenharmony_ci 501b815c7f3Sopenharmony_ci## SFC_GET_NORM_DOUBLE 502b815c7f3Sopenharmony_ci 503b815c7f3Sopenharmony_ciRetrieve the current float normalisation mode. 504b815c7f3Sopenharmony_ci 505b815c7f3Sopenharmony_ci### Parameters 506b815c7f3Sopenharmony_ci 507b815c7f3Sopenharmony_cisndfile 508b815c7f3Sopenharmony_ci: A valid SNDFILE* pointer 509b815c7f3Sopenharmony_ci 510b815c7f3Sopenharmony_cicmd 511b815c7f3Sopenharmony_ci: SFC_GET_NORM_DOUBLE 512b815c7f3Sopenharmony_ci 513b815c7f3Sopenharmony_cidata 514b815c7f3Sopenharmony_ci: NULL 515b815c7f3Sopenharmony_ci 516b815c7f3Sopenharmony_cidatasize 517b815c7f3Sopenharmony_ci: anything 518b815c7f3Sopenharmony_ci 519b815c7f3Sopenharmony_ciExample: 520b815c7f3Sopenharmony_ci 521b815c7f3Sopenharmony_ci```c 522b815c7f3Sopenharmony_cinormalisation = sf_command (sndfile, SFC_GET_NORM_DOUBLE, NULL, 0) ; 523b815c7f3Sopenharmony_ci``` 524b815c7f3Sopenharmony_ci 525b815c7f3Sopenharmony_ci### Return value 526b815c7f3Sopenharmony_ci 527b815c7f3Sopenharmony_ciReturns TRUE if normalisation is on and FALSE otherwise. 528b815c7f3Sopenharmony_ci 529b815c7f3Sopenharmony_ci## SFC_SET_SCALE_FLOAT_INT_READ 530b815c7f3Sopenharmony_ci 531b815c7f3Sopenharmony_ciSet/clear the scale factor when integer (short/int) data is read from a file 532b815c7f3Sopenharmony_cicontaining floating point data. 533b815c7f3Sopenharmony_ci 534b815c7f3Sopenharmony_ci### Parameters 535b815c7f3Sopenharmony_ci 536b815c7f3Sopenharmony_cisndfile 537b815c7f3Sopenharmony_ci: A valid SNDFILE* pointer 538b815c7f3Sopenharmony_ci 539b815c7f3Sopenharmony_cicmd: 540b815c7f3Sopenharmony_ciSFC_SET_SCALE_FLOAT_INT_READ 541b815c7f3Sopenharmony_ci 542b815c7f3Sopenharmony_cidata 543b815c7f3Sopenharmony_ci: NULL 544b815c7f3Sopenharmony_ci 545b815c7f3Sopenharmony_cidatasize 546b815c7f3Sopenharmony_ci: TRUE or FALSE 547b815c7f3Sopenharmony_ci 548b815c7f3Sopenharmony_ciExample: 549b815c7f3Sopenharmony_ci 550b815c7f3Sopenharmony_ci```c 551b815c7f3Sopenharmony_cisf_command (sndfile, SFC_SET_SCALE_FLOAT_INT_READ, NULL, SF_TRUE) ; 552b815c7f3Sopenharmony_ci``` 553b815c7f3Sopenharmony_ci 554b815c7f3Sopenharmony_ci### Return value 555b815c7f3Sopenharmony_ci 556b815c7f3Sopenharmony_ciReturns the previous `SFC_SET_SCALE_FLOAT_INT_READ` setting for this file. 557b815c7f3Sopenharmony_ci 558b815c7f3Sopenharmony_ci## SFC_SET_SCALE_INT_FLOAT_WRITE 559b815c7f3Sopenharmony_ci 560b815c7f3Sopenharmony_ciSet/clear the scale factor when integer (short/int) data is written to a file as 561b815c7f3Sopenharmony_cifloating point data. 562b815c7f3Sopenharmony_ci 563b815c7f3Sopenharmony_ci### Parameters 564b815c7f3Sopenharmony_ci 565b815c7f3Sopenharmony_cisndfile 566b815c7f3Sopenharmony_ci: A valid SNDFILE* pointer 567b815c7f3Sopenharmony_ci 568b815c7f3Sopenharmony_cicmd 569b815c7f3Sopenharmony_ci: SFC_SET_SCALE_INT_FLOAT_WRITE 570b815c7f3Sopenharmony_ci 571b815c7f3Sopenharmony_cidata 572b815c7f3Sopenharmony_ci: NULL 573b815c7f3Sopenharmony_ci 574b815c7f3Sopenharmony_cidatasize 575b815c7f3Sopenharmony_ci: TRUE or FALSE 576b815c7f3Sopenharmony_ci 577b815c7f3Sopenharmony_ci### Examples 578b815c7f3Sopenharmony_ci 579b815c7f3Sopenharmony_ci```c 580b815c7f3Sopenharmony_cisf_command (sndfile, SFC_SET_SCALE_INT_FLOAT_WRITE, NULL, SF_TRUE) ; 581b815c7f3Sopenharmony_ci``` 582b815c7f3Sopenharmony_ci 583b815c7f3Sopenharmony_ci### Return value 584b815c7f3Sopenharmony_ci 585b815c7f3Sopenharmony_ciReturns the previous `SFC_SET_SCALE_INT_FLOAT_WRITE` setting for this file. 586b815c7f3Sopenharmony_ci 587b815c7f3Sopenharmony_ci## SFC_GET_SIMPLE_FORMAT_COUNT 588b815c7f3Sopenharmony_ci 589b815c7f3Sopenharmony_ciRetrieve the number of simple formats supported by libsndfile. 590b815c7f3Sopenharmony_ci 591b815c7f3Sopenharmony_ci### Parameters 592b815c7f3Sopenharmony_ci 593b815c7f3Sopenharmony_cisndfile 594b815c7f3Sopenharmony_ci: Not used. 595b815c7f3Sopenharmony_ci 596b815c7f3Sopenharmony_cicmd 597b815c7f3Sopenharmony_ci: SFC_GET_SIMPLE_FORMAT_COUNT 598b815c7f3Sopenharmony_ci 599b815c7f3Sopenharmony_cidata 600b815c7f3Sopenharmony_ci: a pointer to an int 601b815c7f3Sopenharmony_ci 602b815c7f3Sopenharmony_cidatasize 603b815c7f3Sopenharmony_ci: sizeof (int) 604b815c7f3Sopenharmony_ci 605b815c7f3Sopenharmony_ci### Examples 606b815c7f3Sopenharmony_ci 607b815c7f3Sopenharmony_ci```c 608b815c7f3Sopenharmony_ciint count ; 609b815c7f3Sopenharmony_cisf_command (sndfile, SFC_GET_SIMPLE_FORMAT_COUNT, &count, sizeof (int)) ; 610b815c7f3Sopenharmony_ci``` 611b815c7f3Sopenharmony_ci 612b815c7f3Sopenharmony_ci### Return value 613b815c7f3Sopenharmony_ci 614b815c7f3Sopenharmony_ci`0`. 615b815c7f3Sopenharmony_ci 616b815c7f3Sopenharmony_ci## SFC_GET_SIMPLE_FORMAT 617b815c7f3Sopenharmony_ci 618b815c7f3Sopenharmony_ciRetrieve information about a simple format. 619b815c7f3Sopenharmony_ci 620b815c7f3Sopenharmony_ci### Parameters 621b815c7f3Sopenharmony_ci 622b815c7f3Sopenharmony_cisndfile 623b815c7f3Sopenharmony_ci: Not used. 624b815c7f3Sopenharmony_ci 625b815c7f3Sopenharmony_cicmd 626b815c7f3Sopenharmony_ci: SFC_GET_SIMPLE_FORMAT 627b815c7f3Sopenharmony_ci 628b815c7f3Sopenharmony_cidata 629b815c7f3Sopenharmony_ci: a pointer to an SF_FORMAT_INFO struct 630b815c7f3Sopenharmony_ci 631b815c7f3Sopenharmony_cidatasize 632b815c7f3Sopenharmony_ci: sizeof (SF_FORMAT_INFO) 633b815c7f3Sopenharmony_ci 634b815c7f3Sopenharmony_ciThe SF_FORMAT_INFO struct is defined in *sndfile.h* as: 635b815c7f3Sopenharmony_ci 636b815c7f3Sopenharmony_ci```c 637b815c7f3Sopenharmony_citypedef struct 638b815c7f3Sopenharmony_ci{ int format ; 639b815c7f3Sopenharmony_ci const char *name ; 640b815c7f3Sopenharmony_ci const char *extension ; 641b815c7f3Sopenharmony_ci} SF_FORMAT_INFO ; 642b815c7f3Sopenharmony_ci``` 643b815c7f3Sopenharmony_ci 644b815c7f3Sopenharmony_ciWhen `sf_command()` is called with `SF_GET_SIMPLE_FORMAT`, the value of the 645b815c7f3Sopenharmony_ciformat field should be the format number (ie 0 \<= format \<= count value 646b815c7f3Sopenharmony_ciobtained using `SF_GET_SIMPLE_FORMAT_COUNT). 647b815c7f3Sopenharmony_ci 648b815c7f3Sopenharmony_ci### Examples 649b815c7f3Sopenharmony_ci 650b815c7f3Sopenharmony_ci```c 651b815c7f3Sopenharmony_ciSF_FORMAT_INFO format_info ; 652b815c7f3Sopenharmony_ciint k, count ; 653b815c7f3Sopenharmony_ci 654b815c7f3Sopenharmony_cisf_command (sndfile, SFC_GET_SIMPLE_FORMAT_COUNT, &count, sizeof (int)) ; 655b815c7f3Sopenharmony_ci 656b815c7f3Sopenharmony_cifor (k = 0 ; k < count ; k++) 657b815c7f3Sopenharmony_ci{ format_info.format = k ; 658b815c7f3Sopenharmony_ci sf_command (sndfile, SFC_GET_SIMPLE_FORMAT, &format_info, sizeof (format_info)) ; 659b815c7f3Sopenharmony_ci printf ("%08x %s %s\n", format_info.format, format_info.name, format_info.extension) ; 660b815c7f3Sopenharmony_ci } ; 661b815c7f3Sopenharmony_ci``` 662b815c7f3Sopenharmony_ci 663b815c7f3Sopenharmony_ci### Return value 664b815c7f3Sopenharmony_ci 665b815c7f3Sopenharmony_ci0 on success and non-zero otherwise. 666b815c7f3Sopenharmony_ci 667b815c7f3Sopenharmony_ciThe value of the format field of the `SF_FORMAT_INFO` struct will be a value 668b815c7f3Sopenharmony_ciwhich can be placed in the format field of an `SF_INFO` struct when a file is to 669b815c7f3Sopenharmony_cibe opened for write. The name field will contain a char\* pointer to the name of 670b815c7f3Sopenharmony_cithe string, eg. "WAV (Microsoft 16 bit PCM)". The extension field will contain 671b815c7f3Sopenharmony_cithe most commonly used file extension for that file type. 672b815c7f3Sopenharmony_ci 673b815c7f3Sopenharmony_ci## SFC_GET_FORMAT_INFO 674b815c7f3Sopenharmony_ci 675b815c7f3Sopenharmony_ciRetrieve information about a major or subtype format. 676b815c7f3Sopenharmony_ci 677b815c7f3Sopenharmony_ci### Parameters 678b815c7f3Sopenharmony_ci 679b815c7f3Sopenharmony_cisndfile 680b815c7f3Sopenharmony_ci: Not used. 681b815c7f3Sopenharmony_ci 682b815c7f3Sopenharmony_cicmd 683b815c7f3Sopenharmony_ci: SFC_GET_FORMAT_INFO 684b815c7f3Sopenharmony_ci 685b815c7f3Sopenharmony_cidata 686b815c7f3Sopenharmony_ci: a pointer to an SF_FORMAT_INFO struct 687b815c7f3Sopenharmony_ci 688b815c7f3Sopenharmony_cidatasize 689b815c7f3Sopenharmony_ci: sizeof (SF_FORMAT_INFO) 690b815c7f3Sopenharmony_ci 691b815c7f3Sopenharmony_ciThe `SF_FORMAT_INFO` struct is defined in \<sndfile.h\> as: 692b815c7f3Sopenharmony_ci 693b815c7f3Sopenharmony_ci```c 694b815c7f3Sopenharmony_citypedef struct 695b815c7f3Sopenharmony_ci{ int format ; 696b815c7f3Sopenharmony_ci const char *name ; 697b815c7f3Sopenharmony_ci const char *extension ; 698b815c7f3Sopenharmony_ci} SF_FORMAT_INFO ; 699b815c7f3Sopenharmony_ci``` 700b815c7f3Sopenharmony_ci 701b815c7f3Sopenharmony_ciWhen `sf_command()` is called with `SF_GET_FORMAT_INFO`, the format field is 702b815c7f3Sopenharmony_ciexamined and if (format & `SF_FORMAT_TYPEMASK`) is a valid format then the 703b815c7f3Sopenharmony_cistruct is filled in with information about the given major type. If (format & 704b815c7f3Sopenharmony_ci`SF_FORMAT_TYPEMASK`) is FALSE and (format & `SF_FORMAT_SUBMASK`) is a valid 705b815c7f3Sopenharmony_cisubtype format then the struct is filled in with information about the given 706b815c7f3Sopenharmony_cisubtype. 707b815c7f3Sopenharmony_ci 708b815c7f3Sopenharmony_ci### Examples 709b815c7f3Sopenharmony_ci 710b815c7f3Sopenharmony_ci```c 711b815c7f3Sopenharmony_ciSF_FORMAT_INFO format_info ; 712b815c7f3Sopenharmony_ci 713b815c7f3Sopenharmony_ciformat_info.format = SF_FORMAT_WAV ; 714b815c7f3Sopenharmony_cisf_command (sndfile, SFC_GET_FORMAT_INFO, &format_info, sizeof (format_info)) ; 715b815c7f3Sopenharmony_ciprintf ("%08x %s %s\n", format_info.format, format_info.name, format_info.extension) ; 716b815c7f3Sopenharmony_ci 717b815c7f3Sopenharmony_ciformat_info.format = SF_FORMAT_ULAW ; 718b815c7f3Sopenharmony_cisf_command (sndfile, SFC_GET_FORMAT_INFO, &format_info, sizeof (format_info)) ; 719b815c7f3Sopenharmony_ciprintf ("%08x %s\n", format_info.format, format_info.name) ; 720b815c7f3Sopenharmony_ci``` 721b815c7f3Sopenharmony_ci 722b815c7f3Sopenharmony_ci### Return value 723b815c7f3Sopenharmony_ci 724b815c7f3Sopenharmony_ci0 on success and non-zero otherwise. 725b815c7f3Sopenharmony_ci 726b815c7f3Sopenharmony_ci## SFC_GET_FORMAT_MAJOR_COUNT 727b815c7f3Sopenharmony_ci 728b815c7f3Sopenharmony_ciRetrieve the number of major formats. 729b815c7f3Sopenharmony_ci 730b815c7f3Sopenharmony_ci### Parameters 731b815c7f3Sopenharmony_ci 732b815c7f3Sopenharmony_cisndfile 733b815c7f3Sopenharmony_ci: Not used. 734b815c7f3Sopenharmony_ci 735b815c7f3Sopenharmony_cicmd 736b815c7f3Sopenharmony_ci: SFC_GET_FORMAT_MAJOR_COUNT 737b815c7f3Sopenharmony_ci 738b815c7f3Sopenharmony_cidata 739b815c7f3Sopenharmony_ci: a pointer to an int 740b815c7f3Sopenharmony_ci 741b815c7f3Sopenharmony_cidatasize 742b815c7f3Sopenharmony_ci: sizeof (int) 743b815c7f3Sopenharmony_ci 744b815c7f3Sopenharmony_ci### Examples 745b815c7f3Sopenharmony_ci 746b815c7f3Sopenharmony_ci```c 747b815c7f3Sopenharmony_ciint count ; 748b815c7f3Sopenharmony_cisf_command (sndfile, SFC_GET_FORMAT_MAJOR_COUNT, &count, sizeof (int)) ; 749b815c7f3Sopenharmony_ci``` 750b815c7f3Sopenharmony_ci 751b815c7f3Sopenharmony_ci### Return value 752b815c7f3Sopenharmony_ci 753b815c7f3Sopenharmony_ci0. 754b815c7f3Sopenharmony_ci 755b815c7f3Sopenharmony_ci## SFC_GET_FORMAT_MAJOR 756b815c7f3Sopenharmony_ci 757b815c7f3Sopenharmony_ciRetrieve information about a major format type. 758b815c7f3Sopenharmony_ci 759b815c7f3Sopenharmony_ci### Parameters 760b815c7f3Sopenharmony_ci 761b815c7f3Sopenharmony_cisndfile 762b815c7f3Sopenharmony_ci: Not used. 763b815c7f3Sopenharmony_ci 764b815c7f3Sopenharmony_cicmd 765b815c7f3Sopenharmony_ci: SFC_GET_FORMAT_MAJOR 766b815c7f3Sopenharmony_ci 767b815c7f3Sopenharmony_cidata 768b815c7f3Sopenharmony_ci: a pointer to an SF_FORMAT_INFO struct 769b815c7f3Sopenharmony_ci 770b815c7f3Sopenharmony_cidatasize 771b815c7f3Sopenharmony_ci: sizeof (SF_FORMAT_INFO) 772b815c7f3Sopenharmony_ci 773b815c7f3Sopenharmony_ci### Examples 774b815c7f3Sopenharmony_ci 775b815c7f3Sopenharmony_ci```c 776b815c7f3Sopenharmony_ciSF_FORMAT_INFO format_info ; 777b815c7f3Sopenharmony_ciint k, count ; 778b815c7f3Sopenharmony_ci 779b815c7f3Sopenharmony_cisf_command (sndfile, SFC_GET_FORMAT_MAJOR_COUNT, &count, sizeof (int)) ; 780b815c7f3Sopenharmony_ci 781b815c7f3Sopenharmony_cifor (k = 0 ; k < count ; k++) 782b815c7f3Sopenharmony_ci{ format_info.format = k ; 783b815c7f3Sopenharmony_ci sf_command (sndfile, SFC_GET_FORMAT_MAJOR, &format_info, sizeof (format_info)) ; 784b815c7f3Sopenharmony_ci printf ("%08x %s %s\n", format_info.format, format_info.name, format_info.extension) ; 785b815c7f3Sopenharmony_ci } ; 786b815c7f3Sopenharmony_ci``` 787b815c7f3Sopenharmony_ci 788b815c7f3Sopenharmony_ciFor a more comprehensive example, see the program `list_formats.c` in the 789b815c7f3Sopenharmony_ci`examples/` directory of the libsndfile source code distribution. 790b815c7f3Sopenharmony_ci 791b815c7f3Sopenharmony_ci### Return value 792b815c7f3Sopenharmony_ci 793b815c7f3Sopenharmony_ci0 on success and non-zero otherwise. 794b815c7f3Sopenharmony_ci 795b815c7f3Sopenharmony_ciThe value of the format field will be one of the major format identifiers such 796b815c7f3Sopenharmony_cias `SF_FORMAT_WAV` or `SF_FORMAT`_AIFF. The name field will contain a char\* 797b815c7f3Sopenharmony_cipointer to the name of the string, eg. "WAV (Microsoft)". The extension field 798b815c7f3Sopenharmony_ciwill contain the most commonly used file extension for that file type. 799b815c7f3Sopenharmony_ci 800b815c7f3Sopenharmony_ci## SFC_GET_FORMAT_SUBTYPE_COUNT 801b815c7f3Sopenharmony_ci 802b815c7f3Sopenharmony_ciRetrieve the number of subformats. 803b815c7f3Sopenharmony_ci 804b815c7f3Sopenharmony_ci### Parameters 805b815c7f3Sopenharmony_ci 806b815c7f3Sopenharmony_cisndfile 807b815c7f3Sopenharmony_ci: Not used. 808b815c7f3Sopenharmony_ci 809b815c7f3Sopenharmony_cicmd 810b815c7f3Sopenharmony_ci: SFC_GET_FORMAT_SUBTYPE_COUNT 811b815c7f3Sopenharmony_ci 812b815c7f3Sopenharmony_cidata 813b815c7f3Sopenharmony_ci: a pointer to an int 814b815c7f3Sopenharmony_ci 815b815c7f3Sopenharmony_cidatasize 816b815c7f3Sopenharmony_ci: sizeof (int) 817b815c7f3Sopenharmony_ci 818b815c7f3Sopenharmony_ci### Examples 819b815c7f3Sopenharmony_ci 820b815c7f3Sopenharmony_ci```c 821b815c7f3Sopenharmony_ciint count ; 822b815c7f3Sopenharmony_cisf_command (sndfile, SFC_GET_FORMAT_SUBTYPE_COUNT, &count, sizeof (int)) ; 823b815c7f3Sopenharmony_ci``` 824b815c7f3Sopenharmony_ci 825b815c7f3Sopenharmony_ci### Return value 826b815c7f3Sopenharmony_ci 827b815c7f3Sopenharmony_ciReturns zero. 828b815c7f3Sopenharmony_ci 829b815c7f3Sopenharmony_ci## SFC_GET_FORMAT_SUBTYPE 830b815c7f3Sopenharmony_ci 831b815c7f3Sopenharmony_ciEnumerate the subtypes (this function does not translate a subtype into a string 832b815c7f3Sopenharmony_cidescribing that subtype). A typical use case might be retrieving a string 833b815c7f3Sopenharmony_cidescription of all subtypes so that a dialog box can be filled in. 834b815c7f3Sopenharmony_ci 835b815c7f3Sopenharmony_ci### Parameters 836b815c7f3Sopenharmony_ci 837b815c7f3Sopenharmony_cisndfile 838b815c7f3Sopenharmony_ci: Not used. 839b815c7f3Sopenharmony_ci 840b815c7f3Sopenharmony_cicmd 841b815c7f3Sopenharmony_ci: SFC_GET_FORMAT_SUBTYPE 842b815c7f3Sopenharmony_ci 843b815c7f3Sopenharmony_cidata 844b815c7f3Sopenharmony_ci: a pointer to an SF_FORMAT_INFO struct 845b815c7f3Sopenharmony_ci 846b815c7f3Sopenharmony_cidatasize 847b815c7f3Sopenharmony_ci: sizeof (SF_FORMAT_INFO) 848b815c7f3Sopenharmony_ci 849b815c7f3Sopenharmony_ci### Examples 850b815c7f3Sopenharmony_ci 851b815c7f3Sopenharmony_ciExample 1: Retrieve all sybtypes supported by the WAV format. 852b815c7f3Sopenharmony_ci 853b815c7f3Sopenharmony_ci```c 854b815c7f3Sopenharmony_ciSF_FORMAT_INFO format_info ; 855b815c7f3Sopenharmony_ciint k, count ; 856b815c7f3Sopenharmony_ci 857b815c7f3Sopenharmony_cisf_command (sndfile, SFC_GET_FORMAT_SUBTYPE_COUNT, &count, sizeof (int)) ; 858b815c7f3Sopenharmony_ci 859b815c7f3Sopenharmony_cifor (k = 0 ; k < count ; k++) 860b815c7f3Sopenharmony_ci{ format_info.format = k ; 861b815c7f3Sopenharmony_ci sf_command (sndfile, SFC_GET_FORMAT_SUBTYPE, &format_info, sizeof (format_info)) ; 862b815c7f3Sopenharmony_ci if (! sf_format_check (format_info.format | SF_FORMAT_WAV)) 863b815c7f3Sopenharmony_ci continue ; 864b815c7f3Sopenharmony_ci printf ("%08x %s\n", format_info.format, format_info.name) ; 865b815c7f3Sopenharmony_ci } ; 866b815c7f3Sopenharmony_ci``` 867b815c7f3Sopenharmony_ci 868b815c7f3Sopenharmony_ciExample 2: Print a string describing the `SF_FORMAT_PCM_16` subtype. 869b815c7f3Sopenharmony_ci 870b815c7f3Sopenharmony_ci```c 871b815c7f3Sopenharmony_ciSF_FORMAT_INFO format_info ; 872b815c7f3Sopenharmony_ciint k, count ; 873b815c7f3Sopenharmony_ci 874b815c7f3Sopenharmony_cisf_command (sndfile, SFC_GET_FORMAT_SUBTYPE_COUNT, &count, sizeof (int)) ; 875b815c7f3Sopenharmony_ci 876b815c7f3Sopenharmony_cifor (k = 0 ; k < count ; k++) 877b815c7f3Sopenharmony_ci{ format_info.format = k ; 878b815c7f3Sopenharmony_ci sf_command (sndfile, SFC_GET_FORMAT_SUBTYPE, &format_info, sizeof (format_info)) ; 879b815c7f3Sopenharmony_ci if (format_info.format == SF_FORMAT_PCM_16) 880b815c7f3Sopenharmony_ci { printf ("%08x %s\n", format_info.format, format_info.name) ; 881b815c7f3Sopenharmony_ci break ; 882b815c7f3Sopenharmony_ci } ; 883b815c7f3Sopenharmony_ci } ; 884b815c7f3Sopenharmony_ci``` 885b815c7f3Sopenharmony_ci 886b815c7f3Sopenharmony_ciFor a more comprehensive example, see the program `list_formats.c` in the 887b815c7f3Sopenharmony_ci`examples/` directory of the libsndfile source code distribution. 888b815c7f3Sopenharmony_ci 889b815c7f3Sopenharmony_ci### Return value 890b815c7f3Sopenharmony_ci 891b815c7f3Sopenharmony_ci0 on success and non-zero otherwise. 892b815c7f3Sopenharmony_ci 893b815c7f3Sopenharmony_ciThe value of the format field will be one of the major format identifiers such 894b815c7f3Sopenharmony_cias `SF_FORMAT_WAV` or `SF_FORMAT_AIFF`. The name field will contain a char\* 895b815c7f3Sopenharmony_cipointer to the name of the string; for instance "WAV (Microsoft)" or "AIFF 896b815c7f3Sopenharmony_ci(Apple/SGI)". The extension field will be a NULL pointer. 897b815c7f3Sopenharmony_ci 898b815c7f3Sopenharmony_ci## SFC_SET_ADD_PEAK_CHUNK 899b815c7f3Sopenharmony_ci 900b815c7f3Sopenharmony_ciBy default, WAV and AIFF files which contain floating point data (subtype 901b815c7f3Sopenharmony_ci`SF_FORMAT_FLOAT` or `SF_FORMAT_DOUBLE`) have a PEAK chunk. By using this 902b815c7f3Sopenharmony_cicommand, the addition of a PEAK chunk can be turned on or off. 903b815c7f3Sopenharmony_ci 904b815c7f3Sopenharmony_ci**Note**: This call must be made before any data is written to the file. 905b815c7f3Sopenharmony_ci 906b815c7f3Sopenharmony_ci### Parameters 907b815c7f3Sopenharmony_ci 908b815c7f3Sopenharmony_cisndfile 909b815c7f3Sopenharmony_ci: A valid SNDFILE* pointer 910b815c7f3Sopenharmony_ci 911b815c7f3Sopenharmony_cicmd 912b815c7f3Sopenharmony_ci: SFC_SET_ADD_PEAK_CHUNK 913b815c7f3Sopenharmony_ci 914b815c7f3Sopenharmony_cidata 915b815c7f3Sopenharmony_ci: Not used (should be NULL) 916b815c7f3Sopenharmony_ci 917b815c7f3Sopenharmony_cidatasize 918b815c7f3Sopenharmony_ci: TRUE or FALSE. 919b815c7f3Sopenharmony_ci 920b815c7f3Sopenharmony_ci### Examples 921b815c7f3Sopenharmony_ci 922b815c7f3Sopenharmony_ci```c 923b815c7f3Sopenharmony_ci/* Turn on the PEAK chunk. */ 924b815c7f3Sopenharmony_cisf_command (sndfile, SFC_SET_ADD_PEAK_CHUNK, NULL, SF_TRUE) ; 925b815c7f3Sopenharmony_ci 926b815c7f3Sopenharmony_ci/* Turn off the PEAK chunk. */ 927b815c7f3Sopenharmony_cisf_command (sndfile, SFC_SET_ADD_PEAK_CHUNK, NULL, SF_FALSE) ; 928b815c7f3Sopenharmony_ci``` 929b815c7f3Sopenharmony_ci 930b815c7f3Sopenharmony_ci### Return value 931b815c7f3Sopenharmony_ci 932b815c7f3Sopenharmony_ciReturns SF_TRUE if the peak chunk will be written after this call. Returns 933b815c7f3Sopenharmony_ciSF_FALSE if the peak chunk will not be written after this call. 934b815c7f3Sopenharmony_ci 935b815c7f3Sopenharmony_ci## SFC_UPDATE_HEADER_NOW 936b815c7f3Sopenharmony_ci 937b815c7f3Sopenharmony_ciThe header of an audio file is normally written by libsndfile when the file is 938b815c7f3Sopenharmony_ciclosed using [**sf_close()**](api.md#file-close-function). 939b815c7f3Sopenharmony_ci 940b815c7f3Sopenharmony_ciThere are however situations where large files are being generated and it would 941b815c7f3Sopenharmony_cibe nice to have valid data in the header before the file is complete. Using this 942b815c7f3Sopenharmony_cicommand will update the file header to reflect the amount of data written to the 943b815c7f3Sopenharmony_cifile so far. Other programs opening the file for read (before any more data is 944b815c7f3Sopenharmony_ciwritten) will then read a valid sound file header. 945b815c7f3Sopenharmony_ci 946b815c7f3Sopenharmony_ci### Parameters 947b815c7f3Sopenharmony_ci 948b815c7f3Sopenharmony_cisndfile 949b815c7f3Sopenharmony_ci: A valid SNDFILE* pointer 950b815c7f3Sopenharmony_ci 951b815c7f3Sopenharmony_cicmd 952b815c7f3Sopenharmony_ci: SFC_UPDATE_HEADER_NOW 953b815c7f3Sopenharmony_ci 954b815c7f3Sopenharmony_cidata 955b815c7f3Sopenharmony_ci: Not used (should be NULL) 956b815c7f3Sopenharmony_ci 957b815c7f3Sopenharmony_cidatasize 958b815c7f3Sopenharmony_ci: Not used. 959b815c7f3Sopenharmony_ci 960b815c7f3Sopenharmony_ci### Examples 961b815c7f3Sopenharmony_ci 962b815c7f3Sopenharmony_ci```c 963b815c7f3Sopenharmony_ci/* Update the header now. */ 964b815c7f3Sopenharmony_cisf_command (sndfile, SFC_UPDATE_HEADER_NOW, NULL, 0) ; 965b815c7f3Sopenharmony_ci``` 966b815c7f3Sopenharmony_ci 967b815c7f3Sopenharmony_ci### Return value 968b815c7f3Sopenharmony_ci 969b815c7f3Sopenharmony_ciReturns zero. 970b815c7f3Sopenharmony_ci 971b815c7f3Sopenharmony_ci## SFC_SET_UPDATE_HEADER_AUTO 972b815c7f3Sopenharmony_ci 973b815c7f3Sopenharmony_ciSimilar to `SFC_UPDATE_HEADER_NOW` but updates the header at the end of every 974b815c7f3Sopenharmony_cicall to the [sf_write\*](api.md#write) functions. 975b815c7f3Sopenharmony_ci 976b815c7f3Sopenharmony_ci### Parameters 977b815c7f3Sopenharmony_ci 978b815c7f3Sopenharmony_cisndfile 979b815c7f3Sopenharmony_ci: A valid SNDFILE* pointer 980b815c7f3Sopenharmony_ci 981b815c7f3Sopenharmony_cicmd 982b815c7f3Sopenharmony_ci: SFC_SET_UPDATE_HEADER_AUTO 983b815c7f3Sopenharmony_ci 984b815c7f3Sopenharmony_cidata 985b815c7f3Sopenharmony_ci: Not used (should be NULL) 986b815c7f3Sopenharmony_ci 987b815c7f3Sopenharmony_cidatasize 988b815c7f3Sopenharmony_ci: `SF_TRUE` or `SF_FALSE` 989b815c7f3Sopenharmony_ci 990b815c7f3Sopenharmony_ci### Examples 991b815c7f3Sopenharmony_ci 992b815c7f3Sopenharmony_ci```c 993b815c7f3Sopenharmony_ci/* Turn on auto header update. */ 994b815c7f3Sopenharmony_cisf_command (sndfile, SFC_SET_UPDATE_HEADER_AUTO, NULL, SF_TRUE) ; 995b815c7f3Sopenharmony_ci 996b815c7f3Sopenharmony_ci/* Turn off auto header update. */ 997b815c7f3Sopenharmony_cisf_command (sndfile, SFC_SET_UPDATE_HEADER_AUTO, NULL, SF_FALSE) ; 998b815c7f3Sopenharmony_ci``` 999b815c7f3Sopenharmony_ci 1000b815c7f3Sopenharmony_ci### Return value 1001b815c7f3Sopenharmony_ci 1002b815c7f3Sopenharmony_ciTRUE if auto update header is now on; FALSE otherwise. 1003b815c7f3Sopenharmony_ci 1004b815c7f3Sopenharmony_ci## SFC_FILE_TRUNCATE 1005b815c7f3Sopenharmony_ci 1006b815c7f3Sopenharmony_ciTruncate a file that was opened for write or read/write. 1007b815c7f3Sopenharmony_ci 1008b815c7f3Sopenharmony_ci### Parameters 1009b815c7f3Sopenharmony_ci 1010b815c7f3Sopenharmony_cisndfile 1011b815c7f3Sopenharmony_ci: A valid SNDFILE* pointer 1012b815c7f3Sopenharmony_ci 1013b815c7f3Sopenharmony_cicmd 1014b815c7f3Sopenharmony_ci: SFC_FILE_TRUNCATE 1015b815c7f3Sopenharmony_ci 1016b815c7f3Sopenharmony_cidata 1017b815c7f3Sopenharmony_ci: A pointer to an sf_count_t. 1018b815c7f3Sopenharmony_ci 1019b815c7f3Sopenharmony_cidatasize 1020b815c7f3Sopenharmony_ci: sizeof (sf_count_t) 1021b815c7f3Sopenharmony_ci 1022b815c7f3Sopenharmony_ciTruncate the file to the number of frames specified by the sf_count_t pointed to 1023b815c7f3Sopenharmony_ciby data. After this command, both the read and the write pointer will be at the 1024b815c7f3Sopenharmony_cinew end of the file. This command will fail (returning non-zero) if the 1025b815c7f3Sopenharmony_cirequested truncate position is beyond the end of the file. 1026b815c7f3Sopenharmony_ci 1027b815c7f3Sopenharmony_ci### Examples 1028b815c7f3Sopenharmony_ci 1029b815c7f3Sopenharmony_ci```c 1030b815c7f3Sopenharmony_ci/* Truncate the file to a length of 20 frames. */ 1031b815c7f3Sopenharmony_cisf_count_t frames = 20 ; 1032b815c7f3Sopenharmony_cisf_command (sndfile, SFC_FILE_TRUNCATE, &frames, sizeof (frames)) ; 1033b815c7f3Sopenharmony_ci``` 1034b815c7f3Sopenharmony_ci 1035b815c7f3Sopenharmony_ci### Return value 1036b815c7f3Sopenharmony_ci 1037b815c7f3Sopenharmony_ciZero on sucess, non-zero otherwise. 1038b815c7f3Sopenharmony_ci 1039b815c7f3Sopenharmony_ci## SFC_SET_RAW_START_OFFSET 1040b815c7f3Sopenharmony_ci 1041b815c7f3Sopenharmony_ciChange the data start offset for files opened up as `SF_FORMAT_RAW`. 1042b815c7f3Sopenharmony_ci 1043b815c7f3Sopenharmony_ci### Parameters 1044b815c7f3Sopenharmony_ci 1045b815c7f3Sopenharmony_cisndfile 1046b815c7f3Sopenharmony_ci: A valid SNDFILE* pointer 1047b815c7f3Sopenharmony_ci 1048b815c7f3Sopenharmony_cicmd 1049b815c7f3Sopenharmony_ci: SFC_SET_RAW_START_OFFSET 1050b815c7f3Sopenharmony_ci 1051b815c7f3Sopenharmony_cidata 1052b815c7f3Sopenharmony_ci: A pointer to an sf_count_t. 1053b815c7f3Sopenharmony_ci 1054b815c7f3Sopenharmony_cidatasize 1055b815c7f3Sopenharmony_ci: sizeof (sf_count_t) 1056b815c7f3Sopenharmony_ci 1057b815c7f3Sopenharmony_ciFor a file opened as format `SF_FORMAT_RAW`, set the data offset to the value 1058b815c7f3Sopenharmony_cigiven by `data`. 1059b815c7f3Sopenharmony_ci 1060b815c7f3Sopenharmony_ci### Examples 1061b815c7f3Sopenharmony_ci 1062b815c7f3Sopenharmony_ci```c 1063b815c7f3Sopenharmony_ci/* Reset the data offset to 5 bytes from the start of the file. */ 1064b815c7f3Sopenharmony_cisf_count_t offset = 5 ; 1065b815c7f3Sopenharmony_cisf_command (sndfile, SFC_SET_RAW_START_OFFSET, &offset, sizeof (offset)) ; 1066b815c7f3Sopenharmony_ci``` 1067b815c7f3Sopenharmony_ci 1068b815c7f3Sopenharmony_ci### Return value 1069b815c7f3Sopenharmony_ci 1070b815c7f3Sopenharmony_ciZero on success, non-zero otherwise. 1071b815c7f3Sopenharmony_ci 1072b815c7f3Sopenharmony_ci## SFC_SET_CLIPPING 1073b815c7f3Sopenharmony_ci 1074b815c7f3Sopenharmony_ciTurn on/off automatic clipping when doing floating point to integer conversion. 1075b815c7f3Sopenharmony_ci 1076b815c7f3Sopenharmony_ci### Parameters 1077b815c7f3Sopenharmony_ci 1078b815c7f3Sopenharmony_cisndfile 1079b815c7f3Sopenharmony_ci: A valid SNDFILE* pointer 1080b815c7f3Sopenharmony_ci 1081b815c7f3Sopenharmony_cicmd 1082b815c7f3Sopenharmony_ci: SFC_SET_CLIPPING 1083b815c7f3Sopenharmony_ci 1084b815c7f3Sopenharmony_cidata 1085b815c7f3Sopenharmony_ci: NULL 1086b815c7f3Sopenharmony_ci 1087b815c7f3Sopenharmony_cidatasize 1088b815c7f3Sopenharmony_ci: SF_TRUE or SF_FALSE. 1089b815c7f3Sopenharmony_ci 1090b815c7f3Sopenharmony_ciTurn on (datasize == SF_TRUE) or off (datasize == SF_FALSE) clipping. 1091b815c7f3Sopenharmony_ci 1092b815c7f3Sopenharmony_ci### Examples 1093b815c7f3Sopenharmony_ci 1094b815c7f3Sopenharmony_ci```c 1095b815c7f3Sopenharmony_cisf_command (sndfile, SFC_SET_CLIPPING, NULL, SF_TRUE) ; 1096b815c7f3Sopenharmony_ci``` 1097b815c7f3Sopenharmony_ci 1098b815c7f3Sopenharmony_ci### Return value 1099b815c7f3Sopenharmony_ci 1100b815c7f3Sopenharmony_ciClipping mode (SF_TRUE or SF_FALSE). 1101b815c7f3Sopenharmony_ci 1102b815c7f3Sopenharmony_ci## SFC_GET_CLIPPING 1103b815c7f3Sopenharmony_ci 1104b815c7f3Sopenharmony_ciTurn on/off automatic clipping when doing floating point to integer conversion. 1105b815c7f3Sopenharmony_ci 1106b815c7f3Sopenharmony_ci### Parameters 1107b815c7f3Sopenharmony_ci 1108b815c7f3Sopenharmony_cisndfile 1109b815c7f3Sopenharmony_ci: A valid SNDFILE* pointer 1110b815c7f3Sopenharmony_ci 1111b815c7f3Sopenharmony_cicmd 1112b815c7f3Sopenharmony_ci: SFC_GET_CLIPPING 1113b815c7f3Sopenharmony_ci 1114b815c7f3Sopenharmony_cidata 1115b815c7f3Sopenharmony_ci: NULL 1116b815c7f3Sopenharmony_ci 1117b815c7f3Sopenharmony_cidatasize 1118b815c7f3Sopenharmony_ci: 0 1119b815c7f3Sopenharmony_ci 1120b815c7f3Sopenharmony_ciRetrieve the current cliiping setting. 1121b815c7f3Sopenharmony_ci 1122b815c7f3Sopenharmony_ci### Examples 1123b815c7f3Sopenharmony_ci 1124b815c7f3Sopenharmony_ci```c 1125b815c7f3Sopenharmony_cisf_command (sndfile, SFC_GET_CLIPPING, NULL, 0) ; 1126b815c7f3Sopenharmony_ci``` 1127b815c7f3Sopenharmony_ci 1128b815c7f3Sopenharmony_ci### Return value 1129b815c7f3Sopenharmony_ci 1130b815c7f3Sopenharmony_ciClipping mode (SF_TRUE or SF_FALSE). 1131b815c7f3Sopenharmony_ci 1132b815c7f3Sopenharmony_ci## SFC_GET_EMBED_FILE_INFO 1133b815c7f3Sopenharmony_ci 1134b815c7f3Sopenharmony_ciGet the file offset and file length of a file enbedded within another larger 1135b815c7f3Sopenharmony_cifile. 1136b815c7f3Sopenharmony_ci 1137b815c7f3Sopenharmony_ci### Parameters 1138b815c7f3Sopenharmony_ci 1139b815c7f3Sopenharmony_cisndfile 1140b815c7f3Sopenharmony_ci: A valid SNDFILE* pointer 1141b815c7f3Sopenharmony_ci 1142b815c7f3Sopenharmony_cicmd 1143b815c7f3Sopenharmony_ci: SFC_GET_EMBED_FILE_INFO 1144b815c7f3Sopenharmony_ci 1145b815c7f3Sopenharmony_cidata 1146b815c7f3Sopenharmony_ci: a pointer to an SF_EMBED_FILE_INFO struct 1147b815c7f3Sopenharmony_ci 1148b815c7f3Sopenharmony_cidatasize 1149b815c7f3Sopenharmony_ci: sizeof (SF_EMBED_FILE_INFO) 1150b815c7f3Sopenharmony_ci 1151b815c7f3Sopenharmony_ciThe `SF_EMBED_FILE_INFO` struct is defined in *sndfile.h* as: 1152b815c7f3Sopenharmony_ci 1153b815c7f3Sopenharmony_ci```c 1154b815c7f3Sopenharmony_citypedef struct 1155b815c7f3Sopenharmony_ci{ sf_count_t offset ; 1156b815c7f3Sopenharmony_ci sf_count_t length ; 1157b815c7f3Sopenharmony_ci} SF_EMBED_FILE_INFO ; 1158b815c7f3Sopenharmony_ci``` 1159b815c7f3Sopenharmony_ci 1160b815c7f3Sopenharmony_ci### Return value 1161b815c7f3Sopenharmony_ci 1162b815c7f3Sopenharmony_ci0 on success and non-zero otherwise. 1163b815c7f3Sopenharmony_ci 1164b815c7f3Sopenharmony_ciThe value of the offset field of the `SF_EMBED_FILE_INFO` struct will be the 1165b815c7f3Sopenharmony_cioffsets in bytes from the start of the outer file to the start of the audio 1166b815c7f3Sopenharmony_cifile. The value of the offset field of the `SF_EMBED_FILE_INFO` struct will be 1167b815c7f3Sopenharmony_cithe length in bytes of the embedded file. 1168b815c7f3Sopenharmony_ci 1169b815c7f3Sopenharmony_ci## SFC_WAVEX_GET_AMBISONIC 1170b815c7f3Sopenharmony_ci 1171b815c7f3Sopenharmony_ciTest if the current file has the GUID of a WAVEX file for any of the Ambisonic 1172b815c7f3Sopenharmony_ciformats. 1173b815c7f3Sopenharmony_ci 1174b815c7f3Sopenharmony_ci### Parameters 1175b815c7f3Sopenharmony_ci 1176b815c7f3Sopenharmony_cisndfile 1177b815c7f3Sopenharmony_ci: A valid SNDFILE* pointer 1178b815c7f3Sopenharmony_ci 1179b815c7f3Sopenharmony_cicmd 1180b815c7f3Sopenharmony_ci: SFC_WAVEX_GET_AMBISONIC 1181b815c7f3Sopenharmony_ci 1182b815c7f3Sopenharmony_cidata 1183b815c7f3Sopenharmony_ci: NULL 1184b815c7f3Sopenharmony_ci 1185b815c7f3Sopenharmony_cidatasize 1186b815c7f3Sopenharmony_ci: 0 1187b815c7f3Sopenharmony_ci 1188b815c7f3Sopenharmony_ciThe Ambisonic WAVEX formats are defined here: 1189b815c7f3Sopenharmony_ci<http://dream.cs.bath.ac.uk/researchdev/wave-ex/bformat.html>. 1190b815c7f3Sopenharmony_ci 1191b815c7f3Sopenharmony_ci### Return value 1192b815c7f3Sopenharmony_ci 1193b815c7f3Sopenharmony_ci`SF_AMBISONIC_NONE(0x40)` or `SF_AMBISONIC_B_FORMAT(0x41)` or zero if the file 1194b815c7f3Sopenharmony_ciformat does not support ambisonic formats. 1195b815c7f3Sopenharmony_ci 1196b815c7f3Sopenharmony_ci## SFC_WAVEX_SET_AMBISONIC 1197b815c7f3Sopenharmony_ci 1198b815c7f3Sopenharmony_ciSet the GUID of a new WAVEX file to indicate an Ambisonics format. 1199b815c7f3Sopenharmony_ci 1200b815c7f3Sopenharmony_ci### Parameters 1201b815c7f3Sopenharmony_ci 1202b815c7f3Sopenharmony_cisndfile 1203b815c7f3Sopenharmony_ci: A valid SNDFILE* pointer 1204b815c7f3Sopenharmony_ci 1205b815c7f3Sopenharmony_cicmd 1206b815c7f3Sopenharmony_ci: SFC_WAVEX_SET_AMBISONIC 1207b815c7f3Sopenharmony_ci 1208b815c7f3Sopenharmony_cidata 1209b815c7f3Sopenharmony_ci: NULL 1210b815c7f3Sopenharmony_ci 1211b815c7f3Sopenharmony_cidatasize 1212b815c7f3Sopenharmony_ci: SF_AMBISONIC_NONE or SF_AMBISONIC_B_FORMAT 1213b815c7f3Sopenharmony_ci 1214b815c7f3Sopenharmony_ciTurn on (`SF_AMBISONIC_B_FORMAT(0x41)`) or off (`SF_AMBISONIC_NONE(0x40)`) 1215b815c7f3Sopenharmony_ciencoding. This command is currently only supported for files with 1216b815c7f3Sopenharmony_ci`SF_FORMAT_WAVEX` format. 1217b815c7f3Sopenharmony_ci 1218b815c7f3Sopenharmony_ciThe Ambisonic WAVEX formats are defined here: 1219b815c7f3Sopenharmony_ci 1220b815c7f3Sopenharmony_ci<http://dream.cs.bath.ac.uk/researchdev/wave-ex/bformat.html>. 1221b815c7f3Sopenharmony_ci 1222b815c7f3Sopenharmony_ci### Return value 1223b815c7f3Sopenharmony_ci 1224b815c7f3Sopenharmony_ciReturn the ambisonic value that has just been set or zero if the 1225b815c7f3Sopenharmony_cifile format does not support ambisonic encoding. 1226b815c7f3Sopenharmony_ci 1227b815c7f3Sopenharmony_ci## SFC_SET_VBR_ENCODING_QUALITY 1228b815c7f3Sopenharmony_ci 1229b815c7f3Sopenharmony_ciSet the Variable Bit Rate encoding quality. The encoding quality value 1230b815c7f3Sopenharmony_cishould be between 0.0 (lowest quality) and 1.0 (highest quality). 1231b815c7f3Sopenharmony_ciCurrenly this command is only implemented for FLAC and Ogg/Vorbis files. 1232b815c7f3Sopenharmony_ciIt has no effect on un-compressed file formats. 1233b815c7f3Sopenharmony_ci 1234b815c7f3Sopenharmony_ci### Parameters 1235b815c7f3Sopenharmony_ci 1236b815c7f3Sopenharmony_cisndfile 1237b815c7f3Sopenharmony_ci: A valid SNDFILE* pointer 1238b815c7f3Sopenharmony_ci 1239b815c7f3Sopenharmony_cicmd 1240b815c7f3Sopenharmony_ci: SFC_SET_VBR_ENCODING_QUALITY 1241b815c7f3Sopenharmony_ci 1242b815c7f3Sopenharmony_cidata 1243b815c7f3Sopenharmony_ci: A pointer to a double value 1244b815c7f3Sopenharmony_ci 1245b815c7f3Sopenharmony_cidatasize 1246b815c7f3Sopenharmony_ci: sizeof (double) 1247b815c7f3Sopenharmony_ci 1248b815c7f3Sopenharmony_ciThe command must be sent before any audio data is written to the file. 1249b815c7f3Sopenharmony_ci 1250b815c7f3Sopenharmony_ci### Return value 1251b815c7f3Sopenharmony_ci 1252b815c7f3Sopenharmony_ciSF_TRUE if VBR encoding quality was set. SF_FALSE otherwise. 1253b815c7f3Sopenharmony_ci 1254b815c7f3Sopenharmony_ci## SFC_SET_OGG_PAGE_LATENCY_MS 1255b815c7f3Sopenharmony_ci 1256b815c7f3Sopenharmony_ciSet page latency for Ogg Opus file in milliseconds. The value should be between 1257b815c7f3Sopenharmony_ci50.0 and 1600.0. This command is only implemented for Ogg Opus files. 1258b815c7f3Sopenharmony_ci 1259b815c7f3Sopenharmony_ci### Parameters 1260b815c7f3Sopenharmony_ci 1261b815c7f3Sopenharmony_cisndfile 1262b815c7f3Sopenharmony_ci: A valid SNDFILE* pointer 1263b815c7f3Sopenharmony_ci 1264b815c7f3Sopenharmony_cicmd 1265b815c7f3Sopenharmony_ci: SFC_SET_OGG_PAGE_LATENCY_MS 1266b815c7f3Sopenharmony_ci 1267b815c7f3Sopenharmony_cidata 1268b815c7f3Sopenharmony_ci: A pointer to a double value 1269b815c7f3Sopenharmony_ci 1270b815c7f3Sopenharmony_cidatasize 1271b815c7f3Sopenharmony_ci: sizeof (double) 1272b815c7f3Sopenharmony_ci 1273b815c7f3Sopenharmony_ci### Return value 1274b815c7f3Sopenharmony_ci 1275b815c7f3Sopenharmony_ci0 on success and non-zero otherwise. 1276b815c7f3Sopenharmony_ci 1277b815c7f3Sopenharmony_ci## SFC_GET_OGG_STREAM_SERIALNO 1278b815c7f3Sopenharmony_ci 1279b815c7f3Sopenharmony_ciGet the Ogg stream serial number for files with the Ogg major format. Ogg 1280b815c7f3Sopenharmony_cistream serail numbers are a randomly chosen 32-bit value, used for 1281b815c7f3Sopenharmony_cidifferentiating logical Ogg streams. 1282b815c7f3Sopenharmony_ci 1283b815c7f3Sopenharmony_ci### Parameters 1284b815c7f3Sopenharmony_ci 1285b815c7f3Sopenharmony_cisndfile 1286b815c7f3Sopenharmony_ci: A valid SNDFILE* pointer 1287b815c7f3Sopenharmony_ci 1288b815c7f3Sopenharmony_cicmd 1289b815c7f3Sopenharmony_ci: SFC_SET_OGG_STREAM_SERIALNO 1290b815c7f3Sopenharmony_ci 1291b815c7f3Sopenharmony_cidata 1292b815c7f3Sopenharmony_ci: A pointer to a 32-bit int value 1293b815c7f3Sopenharmony_ci 1294b815c7f3Sopenharmony_cidatasize 1295b815c7f3Sopenharmony_ci: sizeof (int32_t) = 4 1296b815c7f3Sopenharmony_ci 1297b815c7f3Sopenharmony_ci### Return value 1298b815c7f3Sopenharmony_ci 1299b815c7f3Sopenharmony_ci0 on success and non-zero otherwise. 1300b815c7f3Sopenharmony_ci 1301b815c7f3Sopenharmony_ci## SFC_SET_COMPRESSION_LEVEL 1302b815c7f3Sopenharmony_ci 1303b815c7f3Sopenharmony_ciSet the compression level. The compression level should be between 0.0 (minimum 1304b815c7f3Sopenharmony_cicompression level) and 1.0 (highest compression level). Currenly this command is 1305b815c7f3Sopenharmony_cionly implemented for FLAC and Ogg/Vorbis files. It has no effect on 1306b815c7f3Sopenharmony_ciuncompressed file formats. 1307b815c7f3Sopenharmony_ci 1308b815c7f3Sopenharmony_ci### Parameters 1309b815c7f3Sopenharmony_ci 1310b815c7f3Sopenharmony_cisndfile 1311b815c7f3Sopenharmony_ci: A valid SNDFILE* pointer 1312b815c7f3Sopenharmony_ci 1313b815c7f3Sopenharmony_cicmd 1314b815c7f3Sopenharmony_ci: SFC_SET_COMPRESSION_LEVEL 1315b815c7f3Sopenharmony_ci 1316b815c7f3Sopenharmony_cidata 1317b815c7f3Sopenharmony_ci: A pointer to a double value 1318b815c7f3Sopenharmony_ci 1319b815c7f3Sopenharmony_cidatasize 1320b815c7f3Sopenharmony_ci: sizeof (double) 1321b815c7f3Sopenharmony_ci 1322b815c7f3Sopenharmony_ciThe command must be sent before any audio data is written to the file. 1323b815c7f3Sopenharmony_ci 1324b815c7f3Sopenharmony_ci### Return value 1325b815c7f3Sopenharmony_ci 1326b815c7f3Sopenharmony_ciSF_TRUE if compression level was set. SF_FALSE otherwise. 1327b815c7f3Sopenharmony_ci 1328b815c7f3Sopenharmony_ci## SFC_RAW_DATA_NEEDS_ENDSWAP 1329b815c7f3Sopenharmony_ci 1330b815c7f3Sopenharmony_ciDetermine if raw data read using [sf_read_raw()](api.md#raw) needs to be end 1331b815c7f3Sopenharmony_ciswapped on the host CPU. 1332b815c7f3Sopenharmony_ci 1333b815c7f3Sopenharmony_ciFor instance, will return SF_TRUE on when reading WAV containing 1334b815c7f3Sopenharmony_ci`SF_FORMAT_PCM_16` data on a big endian machine and `SF_FALSE` on a 1335b815c7f3Sopenharmony_cilittle endian machine. 1336b815c7f3Sopenharmony_ci 1337b815c7f3Sopenharmony_ci### Parameters 1338b815c7f3Sopenharmony_ci 1339b815c7f3Sopenharmony_cisndfile 1340b815c7f3Sopenharmony_ci: A valid SNDFILE* pointer 1341b815c7f3Sopenharmony_ci 1342b815c7f3Sopenharmony_cicmd 1343b815c7f3Sopenharmony_ci: SFC_RAW_DATA_NEEDS_ENDSWAP 1344b815c7f3Sopenharmony_ci 1345b815c7f3Sopenharmony_cidata 1346b815c7f3Sopenharmony_ci: NULL 1347b815c7f3Sopenharmony_ci 1348b815c7f3Sopenharmony_cidatasize 1349b815c7f3Sopenharmony_ci: 0 1350b815c7f3Sopenharmony_ci 1351b815c7f3Sopenharmony_ci### Return value 1352b815c7f3Sopenharmony_ci 1353b815c7f3Sopenharmony_ci`SF_TRUE` or `SF_FALSE`. 1354b815c7f3Sopenharmony_ci 1355b815c7f3Sopenharmony_ci## SFC_GET_BROADCAST_INFO 1356b815c7f3Sopenharmony_ci 1357b815c7f3Sopenharmony_ciRetrieve the Broadcast Extension Chunk from WAV (and related) files. 1358b815c7f3Sopenharmony_ci 1359b815c7f3Sopenharmony_ci### Parameters 1360b815c7f3Sopenharmony_ci 1361b815c7f3Sopenharmony_cisndfile 1362b815c7f3Sopenharmony_ci: A valid SNDFILE* pointer 1363b815c7f3Sopenharmony_ci 1364b815c7f3Sopenharmony_cicmd 1365b815c7f3Sopenharmony_ci: SFC_GET_BROADCAST_INFO 1366b815c7f3Sopenharmony_ci 1367b815c7f3Sopenharmony_cidata 1368b815c7f3Sopenharmony_ci: a pointer to an SF_BROADCAST_INFO struct 1369b815c7f3Sopenharmony_ci 1370b815c7f3Sopenharmony_cidatasize 1371b815c7f3Sopenharmony_ci: sizeof (SF_BROADCAST_INFO) 1372b815c7f3Sopenharmony_ci 1373b815c7f3Sopenharmony_ciThe SF_BROADCAST_INFO struct is defined in *sndfile.h* as: 1374b815c7f3Sopenharmony_ci 1375b815c7f3Sopenharmony_ci```c 1376b815c7f3Sopenharmony_citypedef struct 1377b815c7f3Sopenharmony_ci{ char description [256] ; 1378b815c7f3Sopenharmony_ci char originator [32] ; 1379b815c7f3Sopenharmony_ci char originator_reference [32] ; 1380b815c7f3Sopenharmony_ci char origination_date [10] ; 1381b815c7f3Sopenharmony_ci char origination_time [8] ; 1382b815c7f3Sopenharmony_ci unsigned int time_reference_low ; 1383b815c7f3Sopenharmony_ci unsigned int time_reference_high ; 1384b815c7f3Sopenharmony_ci short version ; 1385b815c7f3Sopenharmony_ci char umid [64] ; 1386b815c7f3Sopenharmony_ci char reserved [190] ; 1387b815c7f3Sopenharmony_ci unsigned int coding_history_size ; 1388b815c7f3Sopenharmony_ci char coding_history [256] ; 1389b815c7f3Sopenharmony_ci} SF_BROADCAST_INFO ; 1390b815c7f3Sopenharmony_ci``` 1391b815c7f3Sopenharmony_ci 1392b815c7f3Sopenharmony_ci### Return value 1393b815c7f3Sopenharmony_ci 1394b815c7f3Sopenharmony_ci`SF_TRUE` if the file contained a Broadcast Extension chunk or `SF_FALSE` 1395b815c7f3Sopenharmony_ciotherwise. 1396b815c7f3Sopenharmony_ci 1397b815c7f3Sopenharmony_ci## SFC_SET_BROADCAST_INFO 1398b815c7f3Sopenharmony_ci 1399b815c7f3Sopenharmony_ciSet the Broadcast Extension Chunk for WAV (and related) files. 1400b815c7f3Sopenharmony_ci 1401b815c7f3Sopenharmony_ci### Parameters 1402b815c7f3Sopenharmony_ci 1403b815c7f3Sopenharmony_cisndfile 1404b815c7f3Sopenharmony_ci: A valid SNDFILE* pointer 1405b815c7f3Sopenharmony_ci 1406b815c7f3Sopenharmony_cicmd 1407b815c7f3Sopenharmony_ci: SFC_SET_BROADCAST_INFO 1408b815c7f3Sopenharmony_ci 1409b815c7f3Sopenharmony_cidata 1410b815c7f3Sopenharmony_ci: a pointer to an SF_BROADCAST_INFO struct 1411b815c7f3Sopenharmony_ci 1412b815c7f3Sopenharmony_cidatasize 1413b815c7f3Sopenharmony_ci: sizeof (SF_BROADCAST_INFO) 1414b815c7f3Sopenharmony_ci 1415b815c7f3Sopenharmony_ci### Return value 1416b815c7f3Sopenharmony_ci 1417b815c7f3Sopenharmony_ci`SF_TRUE` if setting the Broadcast Extension chunk was successful and `SF_FALSE` 1418b815c7f3Sopenharmony_ciotherwise. 1419b815c7f3Sopenharmony_ci 1420b815c7f3Sopenharmony_ci## SFC_GET_CHANNEL_MAP_INFO 1421b815c7f3Sopenharmony_ci 1422b815c7f3Sopenharmony_ciRetrieve the channel map contained in an AIFF or CAF Channel Layout chunk. 1423b815c7f3Sopenharmony_ci 1424b815c7f3Sopenharmony_ci### Parameters 1425b815c7f3Sopenharmony_ci 1426b815c7f3Sopenharmony_cisndfile 1427b815c7f3Sopenharmony_ci: A valid SNDFILE* pointer 1428b815c7f3Sopenharmony_ci 1429b815c7f3Sopenharmony_cicmd 1430b815c7f3Sopenharmony_ci: SFC_GET_CHANNEL_MAP_INFO 1431b815c7f3Sopenharmony_ci 1432b815c7f3Sopenharmony_cidata 1433b815c7f3Sopenharmony_ci: a pointer to an array of int, the same size as the number of channels in the 1434b815c7f3Sopenharmony_cifile 1435b815c7f3Sopenharmony_ci 1436b815c7f3Sopenharmony_cidatasize 1437b815c7f3Sopenharmony_ci: number of channels * sizeof (int) 1438b815c7f3Sopenharmony_ci 1439b815c7f3Sopenharmony_ciChannel map positions are defined in an enum in *sndfile.h*: 1440b815c7f3Sopenharmony_ci 1441b815c7f3Sopenharmony_ci| Name | Value | Description | 1442b815c7f3Sopenharmony_ci|:-------------------------------------|:------|:------------------------------------------------------------------| 1443b815c7f3Sopenharmony_ci| SF_CHANNEL_MAP_INVALID | 0 | | 1444b815c7f3Sopenharmony_ci| SF_CHANNEL_MAP_MONO | 1 | | 1445b815c7f3Sopenharmony_ci| SF_CHANNEL_MAP_LEFT | 2 | Apple calls this 'Left' | 1446b815c7f3Sopenharmony_ci| SF_CHANNEL_MAP_RIGHT | 3 | Apple calls this 'Right' | 1447b815c7f3Sopenharmony_ci| SF_CHANNEL_MAP_CENTER | 4 | Apple calls this 'Center' | 1448b815c7f3Sopenharmony_ci| SF_CHANNEL_MAP_FRONT_LEFT | 5 | | 1449b815c7f3Sopenharmony_ci| SF_CHANNEL_MAP_FRONT_RIGHT | 6 | | 1450b815c7f3Sopenharmony_ci| SF_CHANNEL_MAP_FRONT_CENTER | 7 | | 1451b815c7f3Sopenharmony_ci| SF_CHANNEL_MAP_REAR_CENTER | 8 | Apple calls this 'Center Surround', Msft calls this 'Back Center' | 1452b815c7f3Sopenharmony_ci| SF_CHANNEL_MAP_REAR_LEFT | 9 | Apple calls this 'Left Surround', Msft calls this 'Back Left' | 1453b815c7f3Sopenharmony_ci| SF_CHANNEL_MAP_REAR_RIGHT | 10 | Apple calls this 'Right Surround', Msft calls this 'Back Right' | 1454b815c7f3Sopenharmony_ci| SF_CHANNEL_MAP_LFE | 11 | Apple calls this 'LFEScreen', Msft calls this 'Low Frequency' | 1455b815c7f3Sopenharmony_ci| SF_CHANNEL_MAP_FRONT_LEFT_OF_CENTER | 12 | Apple calls this 'Left Center' | 1456b815c7f3Sopenharmony_ci| SF_CHANNEL_MAP_FRONT_RIGHT_OF_CENTER | 13 | Apple calls this 'Right Center' | 1457b815c7f3Sopenharmony_ci| SF_CHANNEL_MAP_SIDE_LEFT | 14 | Apple calls this 'Left Surround Direct' | 1458b815c7f3Sopenharmony_ci| SF_CHANNEL_MAP_SIDE_RIGHT | 15 | Apple calls this 'Right Surround Direct' | 1459b815c7f3Sopenharmony_ci| SF_CHANNEL_MAP_TOP_CENTER | 16 | Apple calls this 'Top Center Surround' | 1460b815c7f3Sopenharmony_ci| SF_CHANNEL_MAP_TOP_FRONT_LEFT | 17 | Apple calls this 'Vertical Height Left' | 1461b815c7f3Sopenharmony_ci| SF_CHANNEL_MAP_TOP_FRONT_RIGHT | 18 | Apple calls this 'Vertical Height Right' | 1462b815c7f3Sopenharmony_ci| SF_CHANNEL_MAP_TOP_FRONT_CENTER | 19 | Apple calls this 'Vertical Height Center' | 1463b815c7f3Sopenharmony_ci| SF_CHANNEL_MAP_TOP_REAR_LEFT | 20 | Apple and MS call this 'Top Back Left' | 1464b815c7f3Sopenharmony_ci| SF_CHANNEL_MAP_TOP_REAR_RIGHT | 21 | Apple and MS call this 'Top Back Right' | 1465b815c7f3Sopenharmony_ci| SF_CHANNEL_MAP_TOP_REAR_CENTER | 22 | Apple and MS call this 'Top Back Center' | 1466b815c7f3Sopenharmony_ci| SF_CHANNEL_MAP_AMBISONIC_B_W | 23 | | 1467b815c7f3Sopenharmony_ci| SF_CHANNEL_MAP_AMBISONIC_B_X | 24 | | 1468b815c7f3Sopenharmony_ci| SF_CHANNEL_MAP_AMBISONIC_B_Y | 25 | | 1469b815c7f3Sopenharmony_ci| SF_CHANNEL_MAP_AMBISONIC_B_Z | 26 | | 1470b815c7f3Sopenharmony_ci| SF_CHANNEL_MAP_MAX | 27 | | 1471b815c7f3Sopenharmony_ci 1472b815c7f3Sopenharmony_ci### Return value 1473b815c7f3Sopenharmony_ci 1474b815c7f3Sopenharmony_ci`SF_TRUE` if the file contained a Channel Layout chunk or `SF_FALSE` otherwise. 1475b815c7f3Sopenharmony_ci 1476b815c7f3Sopenharmony_ci## SFC_SET_CHANNEL_MAP_INFO 1477b815c7f3Sopenharmony_ci 1478b815c7f3Sopenharmony_ciSet the channel map contained in an AIFF or CAF Channel Layout chunk. 1479b815c7f3Sopenharmony_ci 1480b815c7f3Sopenharmony_ci### Parameters 1481b815c7f3Sopenharmony_ci 1482b815c7f3Sopenharmony_cisndfile 1483b815c7f3Sopenharmony_ci: A valid SNDFILE* pointer 1484b815c7f3Sopenharmony_ci 1485b815c7f3Sopenharmony_cicmd 1486b815c7f3Sopenharmony_ci: SFC_SET_CHANNEL_MAP_INFO 1487b815c7f3Sopenharmony_ci 1488b815c7f3Sopenharmony_cidata 1489b815c7f3Sopenharmony_ci: a pointer to an array of int, the same size as the number of channels in the 1490b815c7f3Sopenharmony_cifile 1491b815c7f3Sopenharmony_ci 1492b815c7f3Sopenharmony_cidatasize 1493b815c7f3Sopenharmony_ci: number of channels * sizeof (int) 1494b815c7f3Sopenharmony_ci 1495b815c7f3Sopenharmony_ci### Return value 1496b815c7f3Sopenharmony_ci 1497b815c7f3Sopenharmony_ci`SF_TRUE` if setting the Channel Layout chunk was successful and `SF_FALSE` 1498b815c7f3Sopenharmony_ciotherwise. 1499b815c7f3Sopenharmony_ci 1500b815c7f3Sopenharmony_ci## SFC_GET_CART_INFO 1501b815c7f3Sopenharmony_ci 1502b815c7f3Sopenharmony_ciRetrieve the Cart Chunk from WAV (and related) files. Based on AES46 standard 1503b815c7f3Sopenharmony_cifor CartChunk (see [CartChunk.org](http://www.cartchunk.org/) for more 1504b815c7f3Sopenharmony_ciinformation. 1505b815c7f3Sopenharmony_ci 1506b815c7f3Sopenharmony_ci### Parameters 1507b815c7f3Sopenharmony_ci 1508b815c7f3Sopenharmony_cisndfile 1509b815c7f3Sopenharmony_ci: A valid SNDFILE* pointer 1510b815c7f3Sopenharmony_ci 1511b815c7f3Sopenharmony_cicmd 1512b815c7f3Sopenharmony_ci: SFC_GET_CART_INFO 1513b815c7f3Sopenharmony_ci 1514b815c7f3Sopenharmony_cidata 1515b815c7f3Sopenharmony_ci: a pointer to an SF_CART_INFO struct 1516b815c7f3Sopenharmony_ci 1517b815c7f3Sopenharmony_cidatasize 1518b815c7f3Sopenharmony_ci: sizeof (SF_CART_INFO) 1519b815c7f3Sopenharmony_ci 1520b815c7f3Sopenharmony_ciThe SF_CART_INFO struct is defined in *sndfile.h* as: 1521b815c7f3Sopenharmony_ci 1522b815c7f3Sopenharmony_ci```c 1523b815c7f3Sopenharmony_ci#define SF_CART_INFO_VAR(p_tag_text_size) \ 1524b815c7f3Sopenharmony_ci struct 1525b815c7f3Sopenharmony_ci { char version [4] ; 1526b815c7f3Sopenharmony_ci char title [64] ; 1527b815c7f3Sopenharmony_ci char artist [64] ; 1528b815c7f3Sopenharmony_ci char cut_id [64] ; 1529b815c7f3Sopenharmony_ci char client_id [64] ; 1530b815c7f3Sopenharmony_ci char category [64] ; 1531b815c7f3Sopenharmony_ci char classification [64] ; 1532b815c7f3Sopenharmony_ci char out_cue [64] ; 1533b815c7f3Sopenharmony_ci char start_date [10] ; 1534b815c7f3Sopenharmony_ci char start_time [8] ; 1535b815c7f3Sopenharmony_ci char end_date [10] ; 1536b815c7f3Sopenharmony_ci char end_time [8] ; 1537b815c7f3Sopenharmony_ci char producer_app_id [64] ; 1538b815c7f3Sopenharmony_ci char producer_app_version [64] ; 1539b815c7f3Sopenharmony_ci char user_def [64] ; 1540b815c7f3Sopenharmony_ci long level_reference ; 1541b815c7f3Sopenharmony_ci SF_CART_TIMER post_timers [8] ; 1542b815c7f3Sopenharmony_ci char reserved [276] ; 1543b815c7f3Sopenharmony_ci char url [1024] ; 1544b815c7f3Sopenharmony_ci unsigned int tag_text_size ; 1545b815c7f3Sopenharmony_ci char tag_text[p_tag_text_size] ; 1546b815c7f3Sopenharmony_ci } 1547b815c7f3Sopenharmony_ci``` 1548b815c7f3Sopenharmony_ci 1549b815c7f3Sopenharmony_ci### Return value 1550b815c7f3Sopenharmony_ci 1551b815c7f3Sopenharmony_ci`SF_TRUE` if the file contained a Cart chunk or `SF_FALSE` otherwise. 1552b815c7f3Sopenharmony_ci 1553b815c7f3Sopenharmony_ci## SFC_SET_CART_INFO 1554b815c7f3Sopenharmony_ci 1555b815c7f3Sopenharmony_ciSet the Cart Chunk for WAV (and related) files. 1556b815c7f3Sopenharmony_ci 1557b815c7f3Sopenharmony_ci### Parameters 1558b815c7f3Sopenharmony_ci 1559b815c7f3Sopenharmony_cisndfile 1560b815c7f3Sopenharmony_ci: A valid SNDFILE* pointer 1561b815c7f3Sopenharmony_ci 1562b815c7f3Sopenharmony_cicmd 1563b815c7f3Sopenharmony_ci: SFC_SET_CART_INFO 1564b815c7f3Sopenharmony_ci 1565b815c7f3Sopenharmony_cidata 1566b815c7f3Sopenharmony_ci: a pointer to an SF_CART_INFO struct 1567b815c7f3Sopenharmony_ci 1568b815c7f3Sopenharmony_cidatasize 1569b815c7f3Sopenharmony_ci: sizeof (SF_CART_INFO) 1570b815c7f3Sopenharmony_ci 1571b815c7f3Sopenharmony_ci### Return value 1572b815c7f3Sopenharmony_ci 1573b815c7f3Sopenharmony_ciSF_TRUE if setting the Cart chunk was successful and SF_FALSE otherwise. 1574b815c7f3Sopenharmony_ci 1575b815c7f3Sopenharmony_ci## SFC_GET_LOOP_INFO 1576b815c7f3Sopenharmony_ci 1577b815c7f3Sopenharmony_ciRetrieve loop information for file including time signature, length in beats and 1578b815c7f3Sopenharmony_cioriginal MIDI base note 1579b815c7f3Sopenharmony_ci 1580b815c7f3Sopenharmony_ci### Parameters 1581b815c7f3Sopenharmony_ci 1582b815c7f3Sopenharmony_cisndfile 1583b815c7f3Sopenharmony_ci: A valid SNDFILE* pointer 1584b815c7f3Sopenharmony_ci 1585b815c7f3Sopenharmony_cicmd 1586b815c7f3Sopenharmony_ci: SFC_GET_LOOP_INFO 1587b815c7f3Sopenharmony_ci 1588b815c7f3Sopenharmony_cidata 1589b815c7f3Sopenharmony_ci: a pointer to an SF_LOOP_INFO struct 1590b815c7f3Sopenharmony_ci 1591b815c7f3Sopenharmony_cidatasize 1592b815c7f3Sopenharmony_ci: sizeof (SF_LOOP_INFO) 1593b815c7f3Sopenharmony_ci 1594b815c7f3Sopenharmony_ciThe SF_LOOP_INFO struct is defined in *sndfile.h* as: 1595b815c7f3Sopenharmony_ci 1596b815c7f3Sopenharmony_ci```c 1597b815c7f3Sopenharmony_citypedef struct 1598b815c7f3Sopenharmony_ci{ short time_sig_num ; /* any positive integer > 0 */ 1599b815c7f3Sopenharmony_ci short time_sig_den ; /* any positive power of 2 > 0 */ 1600b815c7f3Sopenharmony_ci int loop_mode ; /* see SF_LOOP enum */ 1601b815c7f3Sopenharmony_ci 1602b815c7f3Sopenharmony_ci int num_beats ; /* this is NOT the amount of quarter notes !!!*/ 1603b815c7f3Sopenharmony_ci /* a full bar of 4/4 is 4 beats */ 1604b815c7f3Sopenharmony_ci /* a full bar of 7/8 is 7 beats */ 1605b815c7f3Sopenharmony_ci 1606b815c7f3Sopenharmony_ci float bpm ; /* suggestion, as it can be calculated using other fields:*/ 1607b815c7f3Sopenharmony_ci /* file's lenght, file's sampleRate and our time_sig_den*/ 1608b815c7f3Sopenharmony_ci /* -> bpms are always the amount of _quarter notes_ per minute */ 1609b815c7f3Sopenharmony_ci 1610b815c7f3Sopenharmony_ci int root_key ; /* MIDI note, or -1 for None */ 1611b815c7f3Sopenharmony_ci int future [6] ; 1612b815c7f3Sopenharmony_ci} SF_LOOP_INFO ; 1613b815c7f3Sopenharmony_ci``` 1614b815c7f3Sopenharmony_ci 1615b815c7f3Sopenharmony_ci### Examples 1616b815c7f3Sopenharmony_ci 1617b815c7f3Sopenharmony_ci```c 1618b815c7f3Sopenharmony_ciSF_LOOP_INFO loop; 1619b815c7f3Sopenharmony_cisf_command (sndfile, SFC_GET_LOOP_INFO, &loop, sizeof (loop)) ; 1620b815c7f3Sopenharmony_ci``` 1621b815c7f3Sopenharmony_ci 1622b815c7f3Sopenharmony_ci### Return value 1623b815c7f3Sopenharmony_ci 1624b815c7f3Sopenharmony_ci`SF_TRUE` if the file header contains loop information for the file, `SF_FALSE` 1625b815c7f3Sopenharmony_ciotherwise. 1626b815c7f3Sopenharmony_ci 1627b815c7f3Sopenharmony_ci## SFC_GET_INSTRUMENT 1628b815c7f3Sopenharmony_ci 1629b815c7f3Sopenharmony_ciRetrieve instrument information from file including MIDI base note, keyboard 1630b815c7f3Sopenharmony_cimapping and looping informations(start/stop and mode). 1631b815c7f3Sopenharmony_ci 1632b815c7f3Sopenharmony_ci### Parameters 1633b815c7f3Sopenharmony_ci 1634b815c7f3Sopenharmony_cisndfile 1635b815c7f3Sopenharmony_ci: A valid SNDFILE* pointer 1636b815c7f3Sopenharmony_ci 1637b815c7f3Sopenharmony_cicmd 1638b815c7f3Sopenharmony_ci: SFC_GET_INSTRUMENT 1639b815c7f3Sopenharmony_ci 1640b815c7f3Sopenharmony_cidata 1641b815c7f3Sopenharmony_ci: a pointer to an SF_INSTRUMENT struct 1642b815c7f3Sopenharmony_ci 1643b815c7f3Sopenharmony_cidatasize 1644b815c7f3Sopenharmony_ci: sizeof (SF_INSTRUMENT) 1645b815c7f3Sopenharmony_ci 1646b815c7f3Sopenharmony_ciThe `SF_INSTRUMENT` struct is defined in *sndfile.h* as: 1647b815c7f3Sopenharmony_ci 1648b815c7f3Sopenharmony_ci```c 1649b815c7f3Sopenharmony_citypedef struct 1650b815c7f3Sopenharmony_ci{ int gain ; 1651b815c7f3Sopenharmony_ci char basenote, detune ; 1652b815c7f3Sopenharmony_ci char velocity_lo, velocity_hi ; 1653b815c7f3Sopenharmony_ci char key_lo, key_hi ; 1654b815c7f3Sopenharmony_ci int loop_count ; 1655b815c7f3Sopenharmony_ci 1656b815c7f3Sopenharmony_ci struct 1657b815c7f3Sopenharmony_ci { int mode ; 1658b815c7f3Sopenharmony_ci unsigned int start ; 1659b815c7f3Sopenharmony_ci unsigned int end ; 1660b815c7f3Sopenharmony_ci unsigned int count ; 1661b815c7f3Sopenharmony_ci } loops [16] ; /* make variable in a sensible way */ 1662b815c7f3Sopenharmony_ci} SF_INSTRUMENT ; 1663b815c7f3Sopenharmony_ci``` 1664b815c7f3Sopenharmony_ci 1665b815c7f3Sopenharmony_ci`mode` values are defined as: 1666b815c7f3Sopenharmony_ci 1667b815c7f3Sopenharmony_ci| Name | Value | Description | 1668b815c7f3Sopenharmony_ci|:--------------------|:------|:------------| 1669b815c7f3Sopenharmony_ci| SF_LOOP_NONE | 800 | | 1670b815c7f3Sopenharmony_ci| SF_LOOP_FORWARD | 801 | | 1671b815c7f3Sopenharmony_ci| SF_LOOP_BACKWARD | 802 | | 1672b815c7f3Sopenharmony_ci| SF_LOOP_ALTERNATING | 803 | | 1673b815c7f3Sopenharmony_ci 1674b815c7f3Sopenharmony_ci### Examples 1675b815c7f3Sopenharmony_ci 1676b815c7f3Sopenharmony_ci```c 1677b815c7f3Sopenharmony_ciSF_INSTRUMENT inst ; 1678b815c7f3Sopenharmony_cisf_command (sndfile, SFC_GET_INSTRUMENT, &inst, sizeof (inst)) ; 1679b815c7f3Sopenharmony_ci``` 1680b815c7f3Sopenharmony_ci 1681b815c7f3Sopenharmony_ci### Return value 1682b815c7f3Sopenharmony_ci 1683b815c7f3Sopenharmony_ci`SF_TRUE` if the file header contains instrument information for the file, 1684b815c7f3Sopenharmony_ci`SF_FALSE` otherwise. 1685b815c7f3Sopenharmony_ci 1686b815c7f3Sopenharmony_ci## SFC_SET_INSTRUMENT 1687b815c7f3Sopenharmony_ci 1688b815c7f3Sopenharmony_ciSet the instrument information for the file. 1689b815c7f3Sopenharmony_ci 1690b815c7f3Sopenharmony_ci### Parameters 1691b815c7f3Sopenharmony_ci 1692b815c7f3Sopenharmony_cisndfile 1693b815c7f3Sopenharmony_ci: A valid SNDFILE* pointer 1694b815c7f3Sopenharmony_ci 1695b815c7f3Sopenharmony_cicmd 1696b815c7f3Sopenharmony_ci: SFC_SET_INSTRUMENT 1697b815c7f3Sopenharmony_ci 1698b815c7f3Sopenharmony_cidata 1699b815c7f3Sopenharmony_ci: a pointer to an SF_INSTRUMENT struct 1700b815c7f3Sopenharmony_ci 1701b815c7f3Sopenharmony_cidatasize 1702b815c7f3Sopenharmony_ci: sizeof (SF_INSTRUMENT) 1703b815c7f3Sopenharmony_ci 1704b815c7f3Sopenharmony_ci### Examples 1705b815c7f3Sopenharmony_ci 1706b815c7f3Sopenharmony_ci```c 1707b815c7f3Sopenharmony_ciSF_INSTRUMENT inst ; 1708b815c7f3Sopenharmony_cisf_command (sndfile, SFC_SET_INSTRUMENT, &inst, sizeof (inst)) ; 1709b815c7f3Sopenharmony_ci``` 1710b815c7f3Sopenharmony_ci 1711b815c7f3Sopenharmony_ci### Return value 1712b815c7f3Sopenharmony_ci 1713b815c7f3Sopenharmony_ci`SF_TRUE` if the file header contains instrument information for the file, 1714b815c7f3Sopenharmony_ci`SF_FALSE` otherwise. 1715b815c7f3Sopenharmony_ci 1716b815c7f3Sopenharmony_ci## SFC_GET_CUE_COUNT 1717b815c7f3Sopenharmony_ci 1718b815c7f3Sopenharmony_ciRetrieve the number of cue markers available for retrieval using the 1719b815c7f3Sopenharmony_ci[SFC_GET_CUE](#sfc_get_cue) command. 1720b815c7f3Sopenharmony_ci 1721b815c7f3Sopenharmony_ci### Parameters 1722b815c7f3Sopenharmony_ci 1723b815c7f3Sopenharmony_cisndfile 1724b815c7f3Sopenharmony_ci: A valid SNDFILE* pointer 1725b815c7f3Sopenharmony_ci 1726b815c7f3Sopenharmony_cicmd 1727b815c7f3Sopenharmony_ci: SFC_GET_CUE_COUNT 1728b815c7f3Sopenharmony_ci 1729b815c7f3Sopenharmony_cidata 1730b815c7f3Sopenharmony_ci: a pointer to a uint32_t 1731b815c7f3Sopenharmony_ci 1732b815c7f3Sopenharmony_cidatasize 1733b815c7f3Sopenharmony_ci: sizeof (uint32_t) 1734b815c7f3Sopenharmony_ci 1735b815c7f3Sopenharmony_ci### Examples 1736b815c7f3Sopenharmony_ci 1737b815c7f3Sopenharmony_ci```c 1738b815c7f3Sopenharmony_ciuint32_t cue_count ; 1739b815c7f3Sopenharmony_cisf_command (sndfile, SFC_GET_CUE_COUNT, &cue_count, sizeof (cue_count)) ; 1740b815c7f3Sopenharmony_ci``` 1741b815c7f3Sopenharmony_ci 1742b815c7f3Sopenharmony_ci### Return value 1743b815c7f3Sopenharmony_ci 1744b815c7f3Sopenharmony_ci`SF_TRUE` if the file header contains cue marker information for the file, 1745b815c7f3Sopenharmony_ci`SF_FALSE` otherwise. 1746b815c7f3Sopenharmony_ci 1747b815c7f3Sopenharmony_ci## SFC_GET_CUE 1748b815c7f3Sopenharmony_ci 1749b815c7f3Sopenharmony_ciRetrieve cue marker information from file. 1750b815c7f3Sopenharmony_ci 1751b815c7f3Sopenharmony_ci### Parameters 1752b815c7f3Sopenharmony_ci 1753b815c7f3Sopenharmony_cisndfile 1754b815c7f3Sopenharmony_ci: A valid SNDFILE* pointer 1755b815c7f3Sopenharmony_ci 1756b815c7f3Sopenharmony_cicmd 1757b815c7f3Sopenharmony_ci: SFC_GET_CUE 1758b815c7f3Sopenharmony_ci 1759b815c7f3Sopenharmony_cidata 1760b815c7f3Sopenharmony_ci: a pointer to an SF_CUES struct 1761b815c7f3Sopenharmony_ci 1762b815c7f3Sopenharmony_cidatasize 1763b815c7f3Sopenharmony_ci: sizeof (SF_CUES) 1764b815c7f3Sopenharmony_ci 1765b815c7f3Sopenharmony_ciThe SF_CUES struct is defined in *sndfile.h* as: 1766b815c7f3Sopenharmony_ci 1767b815c7f3Sopenharmony_ci```c 1768b815c7f3Sopenharmony_citypedef struct 1769b815c7f3Sopenharmony_ci{ int cue_count ; 1770b815c7f3Sopenharmony_ci 1771b815c7f3Sopenharmony_ci struct 1772b815c7f3Sopenharmony_ci { int32_t indx ; 1773b815c7f3Sopenharmony_ci uint32_t position ; 1774b815c7f3Sopenharmony_ci int32_t fcc_chunk ; 1775b815c7f3Sopenharmony_ci int32_t chunk_start ; 1776b815c7f3Sopenharmony_ci int32_t block_start ; 1777b815c7f3Sopenharmony_ci uint32_t sample_offset ; 1778b815c7f3Sopenharmony_ci char name [256] ; 1779b815c7f3Sopenharmony_ci } cue_points [100] ; 1780b815c7f3Sopenharmony_ci} SF_CUES ; 1781b815c7f3Sopenharmony_ci``` 1782b815c7f3Sopenharmony_ci 1783b815c7f3Sopenharmony_ciThere is also an SF_CUES_VAR \#define that allows reading/writing more than 100 1784b815c7f3Sopenharmony_cicue markers. 1785b815c7f3Sopenharmony_ci 1786b815c7f3Sopenharmony_ci### Examples 1787b815c7f3Sopenharmony_ci 1788b815c7f3Sopenharmony_ci```c 1789b815c7f3Sopenharmony_ciSF_CUES cues ; 1790b815c7f3Sopenharmony_cisf_command (sndfile, SFC_GET_CUE, &cues, sizeof (cues)) ; 1791b815c7f3Sopenharmony_ci``` 1792b815c7f3Sopenharmony_ci 1793b815c7f3Sopenharmony_ci### Return value 1794b815c7f3Sopenharmony_ci 1795b815c7f3Sopenharmony_ci`SF_TRUE` if the file header contains cue marker information for the file, 1796b815c7f3Sopenharmony_ci`SF_FALSE` otherwise. 1797b815c7f3Sopenharmony_ci 1798b815c7f3Sopenharmony_ci## SFC_SET_CUE 1799b815c7f3Sopenharmony_ci 1800b815c7f3Sopenharmony_ciSet the cue marker information for the file. 1801b815c7f3Sopenharmony_ci 1802b815c7f3Sopenharmony_ci### Parameters 1803b815c7f3Sopenharmony_ci 1804b815c7f3Sopenharmony_cisndfile 1805b815c7f3Sopenharmony_ci: A valid SNDFILE* pointer 1806b815c7f3Sopenharmony_ci 1807b815c7f3Sopenharmony_cicmd 1808b815c7f3Sopenharmony_ci: SFC_SET_CUE 1809b815c7f3Sopenharmony_ci 1810b815c7f3Sopenharmony_cidata 1811b815c7f3Sopenharmony_ci: a pointer to an SF_CUES struct 1812b815c7f3Sopenharmony_ci 1813b815c7f3Sopenharmony_cidatasize 1814b815c7f3Sopenharmony_ci: sizeof (SF_CUES) 1815b815c7f3Sopenharmony_ci 1816b815c7f3Sopenharmony_ci### Examples 1817b815c7f3Sopenharmony_ci 1818b815c7f3Sopenharmony_ci```c 1819b815c7f3Sopenharmony_ciSF_CUES cues ; 1820b815c7f3Sopenharmony_cisf_command (sndfile, SFC_SET_CUE, &cues, sizeof (cues)) ; 1821b815c7f3Sopenharmony_ci``` 1822b815c7f3Sopenharmony_ci 1823b815c7f3Sopenharmony_ci### Return value 1824b815c7f3Sopenharmony_ci 1825b815c7f3Sopenharmony_ci`SF_TRUE` if the file header contains cue marker information for the file, 1826b815c7f3Sopenharmony_ci`SF_FALSE` otherwise. 1827b815c7f3Sopenharmony_ci 1828b815c7f3Sopenharmony_ci## SFC_RF64_AUTO_DOWNGRADE 1829b815c7f3Sopenharmony_ci 1830b815c7f3Sopenharmony_ciEnable auto downgrade from RF64 to WAV. 1831b815c7f3Sopenharmony_ci 1832b815c7f3Sopenharmony_ciThe EBU recomendation is that when writing RF64 files and the resulting file is 1833b815c7f3Sopenharmony_ciless than 4Gig in size, it should be downgraded to a WAV file (WAV files have a 1834b815c7f3Sopenharmony_cimaximum size of 4Gig). libsndfile doesn't follow the EBU recommendations 1835b815c7f3Sopenharmony_ciexactly, mainly because the test suite needs to be able test reading/writing 1836b815c7f3Sopenharmony_ciRF64 files without having to generate files larger than 4 gigabytes. 1837b815c7f3Sopenharmony_ci 1838b815c7f3Sopenharmony_ciNote: This command should be issued before the first bit of audio data has been 1839b815c7f3Sopenharmony_ciwritten to the file. Calling this command after audio data has been written will 1840b815c7f3Sopenharmony_cireturn the current value of this setting, but will not allow it to be changed. 1841b815c7f3Sopenharmony_ci 1842b815c7f3Sopenharmony_ci### Parameters 1843b815c7f3Sopenharmony_ci 1844b815c7f3Sopenharmony_cisndfile 1845b815c7f3Sopenharmony_ci: A valid SNDFILE* pointer 1846b815c7f3Sopenharmony_ci 1847b815c7f3Sopenharmony_cicmd 1848b815c7f3Sopenharmony_ci: SFC_RF64_AUTO_DOWNGRADE 1849b815c7f3Sopenharmony_ci 1850b815c7f3Sopenharmony_cidata 1851b815c7f3Sopenharmony_ci: NULL 1852b815c7f3Sopenharmony_ci 1853b815c7f3Sopenharmony_cidatasize 1854b815c7f3Sopenharmony_ci: SF_TRUE or SF_FALSE 1855b815c7f3Sopenharmony_ci 1856b815c7f3Sopenharmony_ci### Examples 1857b815c7f3Sopenharmony_ci 1858b815c7f3Sopenharmony_ci```c 1859b815c7f3Sopenharmony_ci/* Enable auto downgrade on file close. */ 1860b815c7f3Sopenharmony_cisf_command (sndfile, SFC_RF64_AUTO_DOWNGRADE, NULL, SF_TRUE) ; 1861b815c7f3Sopenharmony_ci``` 1862b815c7f3Sopenharmony_ci 1863b815c7f3Sopenharmony_ci### Return value 1864b815c7f3Sopenharmony_ci 1865b815c7f3Sopenharmony_ciReturns `SF_TRUE` if `SFC_RF64_AUTO_DOWNGRADE` is set and `SF_FALSE` otherwise. 1866b815c7f3Sopenharmony_ci 1867b815c7f3Sopenharmony_ci## SFC_GET_ORIGINAL_SAMPLERATE 1868b815c7f3Sopenharmony_ci 1869b815c7f3Sopenharmony_ciGet original samplerate metadata. 1870b815c7f3Sopenharmony_ci 1871b815c7f3Sopenharmony_ciThe Opus audio codec stores audio data independent of samplerate, but only 1872b815c7f3Sopenharmony_cisupports encoding or decoding at 8000Hz, 12000Hz, 16000Hz, 24000Hz or 48000Hz. 1873b815c7f3Sopenharmony_ciOpus includes a header field to record the original source input samplerate, and 1874b815c7f3Sopenharmony_cia samplerate converter may be used if needed. 1875b815c7f3Sopenharmony_ci 1876b815c7f3Sopenharmony_ciThis command gets the original samplerate header field. It does not enable any 1877b815c7f3Sopenharmony_ci(non-existent) samplerate conversion, nor change the current decoder samplerate. 1878b815c7f3Sopenharmony_ci 1879b815c7f3Sopenharmony_ci### Parameters 1880b815c7f3Sopenharmony_ci 1881b815c7f3Sopenharmony_cisndfile 1882b815c7f3Sopenharmony_ci: A valid SNDFILE* pointer 1883b815c7f3Sopenharmony_ci 1884b815c7f3Sopenharmony_cicmd 1885b815c7f3Sopenharmony_ci: SFC_GET_ORIGINAL_SAMPLERATE 1886b815c7f3Sopenharmony_ci 1887b815c7f3Sopenharmony_cidata 1888b815c7f3Sopenharmony_ci: pointer to an integer 1889b815c7f3Sopenharmony_ci 1890b815c7f3Sopenharmony_cidatasize 1891b815c7f3Sopenharmony_ci: sizeof (int) 1892b815c7f3Sopenharmony_ci 1893b815c7f3Sopenharmony_ci### Examples 1894b815c7f3Sopenharmony_ci 1895b815c7f3Sopenharmony_ci```c 1896b815c7f3Sopenharmony_ci/* Get the original sample rate */ 1897b815c7f3Sopenharmony_ciint original_samplerate ; 1898b815c7f3Sopenharmony_cisf_command (sndfile, SFC_GET_ORIGINAL_SAMPLERATE, &original_samplerate, sizeof (original_samplerate)) ; 1899b815c7f3Sopenharmony_ci``` 1900b815c7f3Sopenharmony_ci 1901b815c7f3Sopenharmony_ci### Return value 1902b815c7f3Sopenharmony_ci 1903b815c7f3Sopenharmony_ciReturns `SF_TRUE` on success, `SF_FALSE` otherwise. 1904b815c7f3Sopenharmony_ci 1905b815c7f3Sopenharmony_ciThe passed integer is set to the value of the original samplerate. 1906b815c7f3Sopenharmony_ci 1907b815c7f3Sopenharmony_ci## SFC_SET_ORIGINAL_SAMPLERATE 1908b815c7f3Sopenharmony_ci 1909b815c7f3Sopenharmony_ciSet original samplerate metadata. 1910b815c7f3Sopenharmony_ci 1911b815c7f3Sopenharmony_ciThe Opus audio codec stores audio data independent of samplerate, but only 1912b815c7f3Sopenharmony_cisupports encoding or decoding at 8000Hz, 12000Hz, 16000Hz, 24000Hz or 48000Hz. 1913b815c7f3Sopenharmony_ciOpus includes a header field to record the original source input samplerate, and 1914b815c7f3Sopenharmony_cia samplerate converter may be used if needed. 1915b815c7f3Sopenharmony_ci 1916b815c7f3Sopenharmony_ciWhen writing an Opus file this command sets the original samplerate header field 1917b815c7f3Sopenharmony_cito the provided value, which is then stored in the file. This has no effect on 1918b815c7f3Sopenharmony_cithe current encoder samplerate. 1919b815c7f3Sopenharmony_ci 1920b815c7f3Sopenharmony_ciWhen reading an Opus file this command overrides the original samplerate value 1921b815c7f3Sopenharmony_cias read from the file. libsndfile uses this value to choose what samplerate to 1922b815c7f3Sopenharmony_cidecode at, rounding up to the nearest valid Opus samplerate. After a successful 1923b815c7f3Sopenharmony_cicall, the file samplerate and frames count may have changed. 1924b815c7f3Sopenharmony_ci 1925b815c7f3Sopenharmony_ciNote: This command should be issued before the first bit of audio data has been 1926b815c7f3Sopenharmony_ciread from or written to the file. 1927b815c7f3Sopenharmony_ci 1928b815c7f3Sopenharmony_ci### Parameters 1929b815c7f3Sopenharmony_ci 1930b815c7f3Sopenharmony_cisndfile 1931b815c7f3Sopenharmony_ci: A valid SNDFILE* pointer 1932b815c7f3Sopenharmony_ci 1933b815c7f3Sopenharmony_cicmd 1934b815c7f3Sopenharmony_ci: SFC_SET_ORIGINAL_SAMPLERATE 1935b815c7f3Sopenharmony_ci 1936b815c7f3Sopenharmony_cidata 1937b815c7f3Sopenharmony_ci: pointer to an integer 1938b815c7f3Sopenharmony_ci 1939b815c7f3Sopenharmony_cidatasize 1940b815c7f3Sopenharmony_ci: sizeof (int) 1941b815c7f3Sopenharmony_ci 1942b815c7f3Sopenharmony_ci### Examples 1943b815c7f3Sopenharmony_ci 1944b815c7f3Sopenharmony_ci```c 1945b815c7f3Sopenharmony_ci/* Store the original sample rate as 44100 */ 1946b815c7f3Sopenharmony_ciint original_samplerate 44100; 1947b815c7f3Sopenharmony_cisf_command (sndfile, SFC_SET_ORIGINAL_SAMPLERATE, &original_samplerate, sizeof (input_samplerate)) ; 1948b815c7f3Sopenharmony_ci``` 1949b815c7f3Sopenharmony_ci 1950b815c7f3Sopenharmony_ci### Return value 1951b815c7f3Sopenharmony_ci 1952b815c7f3Sopenharmony_ciReturns SF_TRUE on success, SF_FALSE otherwise. 1953b815c7f3Sopenharmony_ci 1954b815c7f3Sopenharmony_ciOn write, can only succeed if no data has been written. On read, if successful, 1955b815c7f3Sopenharmony_ci[SFC_GET_CURRENT_SF_INFO](#sfc_get_current_sf_info) should be called to 1956b815c7f3Sopenharmony_cidetermine the new frames count and samplerate 1957b815c7f3Sopenharmony_ci 1958b815c7f3Sopenharmony_ci## SFC_GET_BITRATE_MODE 1959b815c7f3Sopenharmony_ci 1960b815c7f3Sopenharmony_ciGet bitrate mode. 1961b815c7f3Sopenharmony_ci 1962b815c7f3Sopenharmony_ciThe bitrate mode is one of: 1963b815c7f3Sopenharmony_ci 1964b815c7f3Sopenharmony_ci| Name | Value | Description | 1965b815c7f3Sopenharmony_ci|:-------------------------|:------|:------------------| 1966b815c7f3Sopenharmony_ci| SF_BITRATE_MODE_CONSTANT | 800 | Constant bitrate. | 1967b815c7f3Sopenharmony_ci| SF_BITRATE_MODE_AVERAGE | 801 | Average bitrate. | 1968b815c7f3Sopenharmony_ci| SF_BITRATE_MODE_VARIABLE | 802 | Variable bitrate. | 1969b815c7f3Sopenharmony_ci 1970b815c7f3Sopenharmony_ci### Parameters 1971b815c7f3Sopenharmony_ci 1972b815c7f3Sopenharmony_cisndfile 1973b815c7f3Sopenharmony_ci: A valid SNDFILE* pointer 1974b815c7f3Sopenharmony_ci 1975b815c7f3Sopenharmony_cicmd 1976b815c7f3Sopenharmony_ci: SFC_GET_BITRATE_MODE 1977b815c7f3Sopenharmony_ci 1978b815c7f3Sopenharmony_cidata 1979b815c7f3Sopenharmony_ci: NULL 1980b815c7f3Sopenharmony_ci 1981b815c7f3Sopenharmony_cidatasize 1982b815c7f3Sopenharmony_ci: anything 1983b815c7f3Sopenharmony_ci 1984b815c7f3Sopenharmony_ci### Return value 1985b815c7f3Sopenharmony_ci 1986b815c7f3Sopenharmony_ciReturns one of `SF_BITRATE_MODE_XXX` on success, `-1` otherwise. 1987b815c7f3Sopenharmony_ci 1988b815c7f3Sopenharmony_ci## SFC_SET_BITRATE_MODE 1989b815c7f3Sopenharmony_ci 1990b815c7f3Sopenharmony_ciSet bitrate mode. 1991b815c7f3Sopenharmony_ci 1992b815c7f3Sopenharmony_ciThe bitrate mode is one of: 1993b815c7f3Sopenharmony_ci 1994b815c7f3Sopenharmony_ci| Name | Value | Description | 1995b815c7f3Sopenharmony_ci|:-------------------------|:------|:------------------| 1996b815c7f3Sopenharmony_ci| SF_BITRATE_MODE_CONSTANT | 800 | Constant bitrate. | 1997b815c7f3Sopenharmony_ci| SF_BITRATE_MODE_AVERAGE | 801 | Average bitrate. | 1998b815c7f3Sopenharmony_ci| SF_BITRATE_MODE_VARIABLE | 802 | Variable bitrate. | 1999b815c7f3Sopenharmony_ci 2000b815c7f3Sopenharmony_ci### Parameters 2001b815c7f3Sopenharmony_ci 2002b815c7f3Sopenharmony_cisndfile 2003b815c7f3Sopenharmony_ci: A valid SNDFILE* pointer 2004b815c7f3Sopenharmony_ci 2005b815c7f3Sopenharmony_cicmd 2006b815c7f3Sopenharmony_ci: SFC_SET_BITRATE_MODE 2007b815c7f3Sopenharmony_ci 2008b815c7f3Sopenharmony_cidata 2009b815c7f3Sopenharmony_ci: pointer to an integer 2010b815c7f3Sopenharmony_ci 2011b815c7f3Sopenharmony_cidatasize 2012b815c7f3Sopenharmony_ci: sizeof (int) 2013b815c7f3Sopenharmony_ci 2014b815c7f3Sopenharmony_ci### Return value 2015b815c7f3Sopenharmony_ci 2016b815c7f3Sopenharmony_ciReturns `SF_TRUE` on success, `SF_FALSE` otherwise. 2017