sndfile2k  1.2.0
Data Structures | Macros | Typedefs | Enumerations | Functions
sndfile2k.h File Reference

SndFile2K C API reference. More...

#include <stdio.h>
#include <stdint.h>
#include <sys/types.h>
#include "sndfile2k_export.h"

Go to the source code of this file.

Data Structures

struct  SF_INFO
 Contains information about format of sound file. More...
 
struct  SF_FORMAT_INFO
 Contains information about the sound file format. More...
 
struct  SF_DITHER_INFO
 Contains information about dithering. More...
 
struct  SF_EMBED_FILE_INFO
 Contains information about embedded file. More...
 
struct  SF_CUE_POINT
 Contains CUE marker information. More...
 
struct  SF_INSTRUMENT
 Contains instrument information. More...
 
struct  SF_LOOP_INFO
 Defines loop information. More...
 
struct  SF_CART_TIMER
 Contanins information about CART timer. More...
 
struct  SF_VIRTUAL_IO
 Defines virtual file I/O context. More...
 
struct  SF_CHUNK_INFO
 Describes sound file chunk. More...
 

Macros

#define SNDFILE2K_H
 
#define SNDFILE_1
 
#define SF_STR_FIRST   SF_STR_TITLE
 Defines start index of of tags fields.
 
#define SF_STR_LAST   SF_STR_GENRE
 Defines last index of of tags fields.
 
#define SF_COUNT_MAX   INT64_MAX
 Defines maximum value of sf_count_t.
 
#define SF_CUES_VAR(count)
 Defines struct containing desired count of CUE markers. More...
 
#define SF_BROADCAST_INFO_VAR(coding_hist_size)
 
#define SF_CART_INFO_VAR(p_tag_text_size)
 Defines CART timer struct with tag_text of desired size. More...
 

Typedefs

typedef struct sf_private_tag SNDFILE
 Represents opened sound file. More...
 
typedef int64_t sf_count_t
 Represents file offset type. More...
 
typedef unsigned long(* sf_ref_callback) (void *user_data)
 Type of user defined function that increases reference count. More...
 
typedef void(* sf_unref_callback) (void *user_data)
 Type of user defined function that decreases reference count. More...
 
typedef sf_count_t(* sf_vio_get_filelen) (void *user_data)
 Type of user defined function that returns file size. More...
 
typedef sf_count_t(* sf_vio_seek) (sf_count_t offset, int whence, void *user_data)
 Type of user defined seek function. More...
 
typedef sf_count_t(* sf_vio_read) (void *ptr, sf_count_t count, void *user_data)
 Type of user defined read function. More...
 
typedef sf_count_t(* sf_vio_write) (const void *ptr, sf_count_t count, void *user_data)
 Type of user defined write function. More...
 
typedef sf_count_t(* sf_vio_tell) (void *user_data)
 Type of user defined function that returns current position in file. More...
 
typedef void(* sf_vio_flush) (void *user_data)
 Type of user defined function that forces the writing of data to disk. More...
 
typedef int(* sf_vio_set_filelen) (void *user_data, sf_count_t len)
 Type of user defined function truncates stream size. More...
 
typedef SF_BOOL(* sf_vio_is_pipe) (void *user_data)
 Type of user defined function indicates pipe mode. More...
 
typedef struct SF_CHUNK_ITERATOR SF_CHUNK_ITERATOR
 An opaque structure to an iterator over the all chunks of a given id.
 

Enumerations

enum  SF_FORMAT {
  SF_FORMAT_WAV = 0x010000, SF_FORMAT_AIFF = 0x020000, SF_FORMAT_AU = 0x030000, SF_FORMAT_RAW = 0x040000,
  SF_FORMAT_PAF = 0x050000, SF_FORMAT_SVX = 0x060000, SF_FORMAT_NIST = 0x070000, SF_FORMAT_VOC = 0x080000,
  SF_FORMAT_IRCAM = 0x0A0000, SF_FORMAT_W64 = 0x0B0000, SF_FORMAT_MAT4 = 0x0C0000, SF_FORMAT_MAT5 = 0x0D0000,
  SF_FORMAT_PVF = 0x0E0000, SF_FORMAT_XI = 0x0F0000, SF_FORMAT_HTK = 0x100000, SF_FORMAT_SDS = 0x110000,
  SF_FORMAT_AVR = 0x120000, SF_FORMAT_WAVEX = 0x130000, SF_FORMAT_SD2 = 0x160000, SF_FORMAT_FLAC = 0x170000,
  SF_FORMAT_CAF = 0x180000, SF_FORMAT_WVE = 0x190000, SF_FORMAT_OGG = 0x200000, SF_FORMAT_MPC2K = 0x210000,
  SF_FORMAT_RF64 = 0x220000, SF_FORMAT_PCM_S8 = 0x0001, SF_FORMAT_PCM_16 = 0x0002, SF_FORMAT_PCM_24 = 0x0003,
  SF_FORMAT_PCM_32 = 0x0004, SF_FORMAT_PCM_U8 = 0x0005, SF_FORMAT_FLOAT = 0x0006, SF_FORMAT_DOUBLE = 0x0007,
  SF_FORMAT_ULAW = 0x0010, SF_FORMAT_ALAW = 0x0011, SF_FORMAT_IMA_ADPCM = 0x0012, SF_FORMAT_MS_ADPCM = 0x0013,
  SF_FORMAT_GSM610 = 0x0020, SF_FORMAT_VOX_ADPCM = 0x0021, SF_FORMAT_NMS_ADPCM_16 = 0x0022, SF_FORMAT_NMS_ADPCM_24 = 0x0023,
  SF_FORMAT_NMS_ADPCM_32 = 0x0024, SF_FORMAT_G721_32 = 0x0030, SF_FORMAT_G723_24 = 0x0031, SF_FORMAT_G723_40 = 0x0032,
  SF_FORMAT_DWVW_12 = 0x0040, SF_FORMAT_DWVW_16 = 0x0041, SF_FORMAT_DWVW_24 = 0x0042, SF_FORMAT_DWVW_N = 0x0043,
  SF_FORMAT_DPCM_8 = 0x0050, SF_FORMAT_DPCM_16 = 0x0051, SF_FORMAT_VORBIS = 0x0060, SF_FORMAT_ALAC_16 = 0x0070,
  SF_FORMAT_ALAC_20 = 0x0071, SF_FORMAT_ALAC_24 = 0x0072, SF_FORMAT_ALAC_32 = 0x0073, SF_ENDIAN_FILE = 0x00000000,
  SF_ENDIAN_LITTLE = 0x10000000, SF_ENDIAN_BIG = 0x20000000, SF_ENDIAN_CPU = 0x30000000, SF_FORMAT_SUBMASK = 0x0000FFFF,
  SF_FORMAT_TYPEMASK = 0x0FFF0000, SF_FORMAT_ENDMASK = 0xF0000000
}
 Set of format bit flags. More...
 
enum  SF_COMMAND {
  SFC_GET_LIB_VERSION = 0x1000, SFC_GET_LOG_INFO = 0x1001, SFC_GET_CURRENT_SF_INFO = 0x1002, SFC_GET_NORM_DOUBLE = 0x1010,
  SFC_GET_NORM_FLOAT = 0x1011, SFC_SET_NORM_DOUBLE = 0x1012, SFC_SET_NORM_FLOAT = 0x1013, SFC_SET_SCALE_FLOAT_INT_READ = 0x1014,
  SFC_SET_SCALE_INT_FLOAT_WRITE = 0x1015, SFC_GET_SIMPLE_FORMAT_COUNT = 0x1020, SFC_GET_SIMPLE_FORMAT = 0x1021, SFC_GET_FORMAT_INFO = 0x1028,
  SFC_GET_FORMAT_MAJOR_COUNT = 0x1030, SFC_GET_FORMAT_MAJOR = 0x1031, SFC_GET_FORMAT_SUBTYPE_COUNT = 0x1032, SFC_GET_FORMAT_SUBTYPE = 0x1033,
  SFC_CALC_SIGNAL_MAX = 0x1040, SFC_CALC_NORM_SIGNAL_MAX = 0x1041, SFC_CALC_MAX_ALL_CHANNELS = 0x1042, SFC_CALC_NORM_MAX_ALL_CHANNELS = 0x1043,
  SFC_GET_SIGNAL_MAX = 0x1044, SFC_GET_MAX_ALL_CHANNELS = 0x1045, SFC_SET_ADD_PEAK_CHUNK = 0x1050, SFC_SET_ADD_HEADER_PAD_CHUNK = 0x1051,
  SFC_UPDATE_HEADER_NOW = 0x1060, SFC_SET_UPDATE_HEADER_AUTO = 0x1061, SFC_FILE_TRUNCATE = 0x1080, SFC_SET_RAW_START_OFFSET = 0x1090,
  SFC_SET_DITHER_ON_WRITE = 0x10A0, SFC_SET_DITHER_ON_READ = 0x10A1, SFC_GET_DITHER_INFO_COUNT = 0x10A2, SFC_GET_DITHER_INFO = 0x10A3,
  SFC_GET_EMBED_FILE_INFO = 0x10B0, SFC_SET_CLIPPING = 0x10C0, SFC_GET_CLIPPING = 0x10C1, SFC_GET_CUE_COUNT = 0x10CD,
  SFC_GET_CUE = 0x10CE, SFC_SET_CUE = 0x10CF, SFC_GET_INSTRUMENT = 0x10D0, SFC_SET_INSTRUMENT = 0x10D1,
  SFC_GET_LOOP_INFO = 0x10E0, SFC_GET_BROADCAST_INFO = 0x10F0, SFC_SET_BROADCAST_INFO = 0x10F1, SFC_GET_CHANNEL_MAP_INFO = 0x1100,
  SFC_SET_CHANNEL_MAP_INFO = 0x1101, SFC_RAW_DATA_NEEDS_ENDSWAP = 0x1110, SFC_WAVEX_SET_AMBISONIC = 0x1200, SFC_WAVEX_GET_AMBISONIC = 0x1201,
  SFC_RF64_AUTO_DOWNGRADE = 0x1210, SFC_SET_VBR_ENCODING_QUALITY = 0x1300, SFC_SET_COMPRESSION_LEVEL = 0x1301, SFC_SET_CART_INFO = 0x1400,
  SFC_GET_CART_INFO = 0x1401, SFC_TEST_IEEE_FLOAT_REPLACE = 0x6001, SFC_SET_ADD_DITHER_ON_WRITE = 0x1070, SFC_SET_ADD_DITHER_ON_READ = 0x1071
}
 Defines command constants for sf_command() More...
 
enum  SF_STR_FIELD {
  SF_STR_TITLE = 0x01, SF_STR_COPYRIGHT = 0x02, SF_STR_SOFTWARE = 0x03, SF_STR_ARTIST = 0x04,
  SF_STR_COMMENT = 0x05, SF_STR_DATE = 0x06, SF_STR_ALBUM = 0x07, SF_STR_LICENSE = 0x08,
  SF_STR_TRACKNUMBER = 0x09, SF_STR_GENRE = 0x10
}
 Defines field type constants. More...
 
enum  SF_BOOL { SF_FALSE = 0, SF_TRUE = 1 }
 Defines boolean constants. More...
 
enum  SF_FILEMODE { SFM_READ = 0x10, SFM_WRITE = 0x20, SFM_RDWR = 0x30 }
 Defines the kind of file access. More...
 
enum  SF_AMBISONIC_MODE { SF_AMBISONIC_NONE = 0x40, SF_AMBISONIC_B_FORMAT = 0x41 }
 Defines Ambisonics format constants. More...
 
enum  SF_ERR {
  SF_ERR_NO_ERROR = 0, SF_ERR_UNRECOGNISED_FORMAT = 1, SF_ERR_SYSTEM = 2, SF_ERR_MALFORMED_FILE = 3,
  SF_ERR_UNSUPPORTED_ENCODING = 4
}
 Defines public error values. More...
 
enum  SF_CHANNEL_MAP {
  SF_CHANNEL_MAP_INVALID = 0, SF_CHANNEL_MAP_MONO = 1, SF_CHANNEL_MAP_LEFT, SF_CHANNEL_MAP_RIGHT,
  SF_CHANNEL_MAP_CENTER, SF_CHANNEL_MAP_FRONT_LEFT, SF_CHANNEL_MAP_FRONT_RIGHT, SF_CHANNEL_MAP_FRONT_CENTER,
  SF_CHANNEL_MAP_REAR_CENTER, SF_CHANNEL_MAP_REAR_LEFT, SF_CHANNEL_MAP_REAR_RIGHT, SF_CHANNEL_MAP_LFE,
  SF_CHANNEL_MAP_FRONT_LEFT_OF_CENTER, SF_CHANNEL_MAP_FRONT_RIGHT_OF_CENTER, SF_CHANNEL_MAP_SIDE_LEFT, SF_CHANNEL_MAP_SIDE_RIGHT,
  SF_CHANNEL_MAP_TOP_CENTER, SF_CHANNEL_MAP_TOP_FRONT_LEFT, SF_CHANNEL_MAP_TOP_FRONT_RIGHT, SF_CHANNEL_MAP_TOP_FRONT_CENTER,
  SF_CHANNEL_MAP_TOP_REAR_LEFT, SF_CHANNEL_MAP_TOP_REAR_RIGHT, SF_CHANNEL_MAP_TOP_REAR_CENTER, SF_CHANNEL_MAP_AMBISONIC_B_W,
  SF_CHANNEL_MAP_AMBISONIC_B_X, SF_CHANNEL_MAP_AMBISONIC_B_Y, SF_CHANNEL_MAP_AMBISONIC_B_Z, SF_CHANNEL_MAP_MAX
}
 Defines channel map constants.
 
enum  SF_DITHER_TYPE {
  SFD_DEFAULT_LEVEL = 0, SFD_CUSTOM_LEVEL = 0x40000000, SFD_NO_DITHER = 500, SFD_WHITE = 501,
  SFD_TRIANGULAR_PDF = 502
}
 Defines dither type constants. More...
 
enum  SF_LOOP_MODE { SF_LOOP_NONE = 800, SF_LOOP_FORWARD, SF_LOOP_BACKWARD, SF_LOOP_ALTERNATING }
 Defines loop mode constants. More...
 
enum  SF_SEEK_MODE { SF_SEEK_SET = SEEK_SET, SF_SEEK_CUR = SEEK_CUR, SF_SEEK_END = SEEK_END }
 Defines file seek mode constants. More...
 

Functions

typedef SF_CUES_VAR (100) SF_CUES
 Represents CUE markers struct containing maximum of 100 CUE markers.
 
typedef SF_BROADCAST_INFO_VAR (256) SF_BROADCAST_INFO
 Defines Broadcast struct with coding_history field of 256 bytes. More...
 
typedef SF_CART_INFO_VAR (256) SF_CART_INFO
 Declares CART timer struct with tag_text of 256 elements. More...
 
SNDFILE2K_EXPORT SNDFILEsf_open (const char *path, int mode, SF_INFO *sfinfo)
 Opens the specified sound file using path. More...
 
SNDFILE2K_EXPORT SNDFILEsf_open_fd (int fd, int mode, SF_INFO *sfinfo, int close_desc)
 Opens sound file using POSIX file descriptor. More...
 
SNDFILE2K_EXPORT SNDFILEsf_open_virtual (SF_VIRTUAL_IO *sfvirtual, int mode, SF_INFO *sfinfo, void *user_data)
 Opens sound file using Virtual I/O context. More...
 
SNDFILE2K_EXPORT SNDFILEsf_open_virtual_ex (SF_VIRTUAL_IO *sfvirtual, int mode, SF_INFO *sfinfo, void *user_data)
 Opens sound file using Virtual I/O context. More...
 
SNDFILE2K_EXPORT int sf_error (SNDFILE *sndfile)
 Returns the current error code for the given SNDFILE. More...
 
SNDFILE2K_EXPORT const char * sf_strerror (SNDFILE *sndfile)
 Returns textual description of the current error code for the given SNDFILE. More...
 
SNDFILE2K_EXPORT const char * sf_error_number (int errnum)
 Returns text description of error code. More...
 
SNDFILE2K_EXPORT int sf_perror (SNDFILE *sndfile)
 Returns internal error code for the given SNDFILE. More...
 
SNDFILE2K_EXPORT int sf_error_str (SNDFILE *sndfile, char *str, size_t len)
 Fills provided buffer with text description of error code for the given SNDFILE. More...
 
SNDFILE2K_EXPORT int sf_command (SNDFILE *sndfile, int command, void *data, int datasize)
 Gets or sets parameters of library or sound file. More...
 
SNDFILE2K_EXPORT int sf_format_check (const SF_INFO *info)
 Checks correctness of SF_INFO::format field. More...
 
SNDFILE2K_EXPORT sf_count_t sf_seek (SNDFILE *sndfile, sf_count_t frames, int whence)
 Changes position of sound file. More...
 
SNDFILE2K_EXPORT int sf_set_string (SNDFILE *sndfile, int str_type, const char *str)
 Sets string field for given sound file. More...
 
SNDFILE2K_EXPORT const char * sf_get_string (SNDFILE *sndfile, int str_type)
 Gets string field from given sound file. More...
 
SNDFILE2K_EXPORT const char * sf_version_string (void)
 Returns the library version string. More...
 
SNDFILE2K_EXPORT int sf_current_byterate (SNDFILE *sndfile)
 Returns current byterate of the file. More...
 
SNDFILE2K_EXPORT sf_count_t sf_read_raw (SNDFILE *sndfile, void *ptr, sf_count_t bytes)
 Read raw bytes from sound file. More...
 
SNDFILE2K_EXPORT sf_count_t sf_write_raw (SNDFILE *sndfile, const void *ptr, sf_count_t bytes)
 Writes raw bytes to sound file. More...
 
SNDFILE2K_EXPORT sf_count_t sf_readf_short (SNDFILE *sndfile, short *ptr, sf_count_t frames)
 Reads short (16-bit) frames from file. More...
 
SNDFILE2K_EXPORT sf_count_t sf_writef_short (SNDFILE *sndfile, const short *ptr, sf_count_t frames)
 Writes short (16-bit) frames to file. More...
 
SNDFILE2K_EXPORT sf_count_t sf_readf_int (SNDFILE *sndfile, int *ptr, sf_count_t frames)
 Reads integer (32-bit) frames from file. More...
 
SNDFILE2K_EXPORT sf_count_t sf_writef_int (SNDFILE *sndfile, const int *ptr, sf_count_t frames)
 Writes integer (32-bit) frames to file. More...
 
SNDFILE2K_EXPORT sf_count_t sf_readf_float (SNDFILE *sndfile, float *ptr, sf_count_t frames)
 Reads float (32-bit) frames from file. More...
 
SNDFILE2K_EXPORT sf_count_t sf_writef_float (SNDFILE *sndfile, const float *ptr, sf_count_t frames)
 Writes float (32-bit) frames to file. More...
 
SNDFILE2K_EXPORT sf_count_t sf_readf_double (SNDFILE *sndfile, double *ptr, sf_count_t frames)
 Reads double (64-bit) frames from file. More...
 
SNDFILE2K_EXPORT sf_count_t sf_writef_double (SNDFILE *sndfile, const double *ptr, sf_count_t frames)
 Writes double (64-bit) frames to file. More...
 
SNDFILE2K_EXPORT sf_count_t sf_read_short (SNDFILE *sndfile, short *ptr, sf_count_t items)
 Reads short (16-bit) samples from file. More...
 
SNDFILE2K_EXPORT sf_count_t sf_write_short (SNDFILE *sndfile, const short *ptr, sf_count_t items)
 Writes short (16-bit) samples to file. More...
 
SNDFILE2K_EXPORT sf_count_t sf_read_int (SNDFILE *sndfile, int *ptr, sf_count_t items)
 Reads integer (32-bit) samples from file. More...
 
SNDFILE2K_EXPORT sf_count_t sf_write_int (SNDFILE *sndfile, const int *ptr, sf_count_t items)
 Writes integer (32-bit) samples to file. More...
 
SNDFILE2K_EXPORT sf_count_t sf_read_float (SNDFILE *sndfile, float *ptr, sf_count_t items)
 Reads float (32-bit) samples from file. More...
 
SNDFILE2K_EXPORT sf_count_t sf_write_float (SNDFILE *sndfile, const float *ptr, sf_count_t items)
 Writes float (32-bit) samples to file. More...
 
SNDFILE2K_EXPORT sf_count_t sf_read_double (SNDFILE *sndfile, double *ptr, sf_count_t items)
 Reads double (64-bit) samples from file. More...
 
SNDFILE2K_EXPORT sf_count_t sf_write_double (SNDFILE *sndfile, const double *ptr, sf_count_t items)
 Writes double (64-bit) samples to file. More...
 
SNDFILE2K_EXPORT int sf_close (SNDFILE *sndfile)
 Closes the SNDFILE object. More...
 
SNDFILE2K_EXPORT void sf_write_sync (SNDFILE *sndfile)
 Forces writing of data to disk. More...
 
SNDFILE2K_EXPORT int sf_set_chunk (SNDFILE *sndfile, const SF_CHUNK_INFO *chunk_info)
 Sets the specified chunk info. More...
 
SNDFILE2K_EXPORT SF_CHUNK_ITERATORsf_get_chunk_iterator (SNDFILE *sndfile, const SF_CHUNK_INFO *chunk_info)
 Gets an iterator for all chunks matching chunk_info. More...
 
SNDFILE2K_EXPORT SF_CHUNK_ITERATORsf_next_chunk_iterator (SF_CHUNK_ITERATOR *iterator)
 Iterates through chunks by incrementing the iterator. More...
 
SNDFILE2K_EXPORT int sf_get_chunk_size (const SF_CHUNK_ITERATOR *it, SF_CHUNK_INFO *chunk_info)
 Gets the size of the specified chunk. More...
 
SNDFILE2K_EXPORT int sf_get_chunk_data (const SF_CHUNK_ITERATOR *it, SF_CHUNK_INFO *chunk_info)
 Gets the specified chunk data. More...
 

Detailed Description

SndFile2K C API reference.

Macro Definition Documentation

◆ SF_BROADCAST_INFO_VAR

#define SF_BROADCAST_INFO_VAR (   coding_hist_size)
Value:
struct \
{ \
char description[256]; \
char originator[32]; \
char originator_reference[32]; \
char origination_date[10]; \
char origination_time[8]; \
uint32_t time_reference_low; \
uint32_t time_reference_high; \
short version; \
char umid[64]; \
char reserved[190]; \
uint32_t coding_history_size; \
char coding_history[coding_hist_size]; \
}

◆ SF_CART_INFO_VAR

#define SF_CART_INFO_VAR (   p_tag_text_size)
Value:
struct \
{ \
char version[4]; \
char title[64]; \
char artist[64]; \
char cut_id[64]; \
char client_id[64]; \
char category[64]; \
char classification[64]; \
char out_cue[64]; \
char start_date[10]; \
char start_time[8]; \
char end_date[10]; \
char end_time[8]; \
char producer_app_id[64]; \
char producer_app_version[64]; \
char user_def[64]; \
int32_t level_reference; \
SF_CART_TIMER post_timers[8]; \
char reserved[276]; \
char url[1024]; \
uint32_t tag_text_size; \
char tag_text[p_tag_text_size]; \
}

Defines CART timer struct with tag_text of desired size.

Deprecated:
This feature and will be removed in next major release.

◆ SF_CUES_VAR

#define SF_CUES_VAR (   count)
Value:
struct \
{ \
uint32_t cue_count; \
SF_CUE_POINT cue_points[count]; \
}

Defines struct containing desired count of CUE markers.

Parameters
[in]countSize of cue_points array

Typedef Documentation

◆ sf_count_t

typedef int64_t sf_count_t

Represents file offset type.

This type is always 64-bit unsigned integer.

◆ sf_ref_callback

typedef unsigned long(* sf_ref_callback) (void *user_data)

Type of user defined function that increases reference count.

Parameters
[in]user_dataUser defined value.
Returns
Reference count.

◆ sf_unref_callback

typedef void(* sf_unref_callback) (void *user_data)

Type of user defined function that decreases reference count.

Parameters
[in]user_dataUser defined value.

◆ sf_vio_flush

typedef void(* sf_vio_flush) (void *user_data)

Type of user defined function that forces the writing of data to disk.

Parameters
[in]user_dataUser defined value.
Returns
File offset on success, - 1 otherwise.

◆ sf_vio_is_pipe

typedef SF_BOOL(* sf_vio_is_pipe) (void *user_data)

Type of user defined function indicates pipe mode.

Parameters
[in]user_dataUser defined value.
Returns
SF_TRUE on success, - 1 otherwise.

◆ sf_vio_set_filelen

typedef int(* sf_vio_set_filelen) (void *user_data, sf_count_t len)

Type of user defined function truncates stream size.

Parameters
[in]user_dataUser defined value.
[in]lenNew size of stream.
Returns
New file size on success, - 1 otherwise.

Enumeration Type Documentation

◆ SF_AMBISONIC_MODE

Defines Ambisonics format constants.

See also
SFC_WAVEX_GET_AMBISONIC, SFC_WAVEX_GET_AMBISONIC
Enumerator
SF_AMBISONIC_NONE 

None.

SF_AMBISONIC_B_FORMAT 

B-format.

◆ SF_BOOL

enum SF_BOOL

Defines boolean constants.

Enumerator
SF_FALSE 

False.

SF_TRUE 

True.

◆ SF_DITHER_TYPE

Defines dither type constants.

Enumerator
SFD_DEFAULT_LEVEL 

Default level.

SFD_CUSTOM_LEVEL 

Custom level.

SFD_NO_DITHER 

No dither.

SFD_WHITE 

White.

SFD_TRIANGULAR_PDF 

Triangular probability density function Dither.

◆ SF_FORMAT

enum SF_FORMAT

Set of format bit flags.

The SF_INFO::format field of the SF_INFO structure is made up of the bit-wise OR of a major format type (values between 0x10000 and 0x08000000), a minor format type (with values less than 0x10000) and an optional endianness value.

SF_FORMAT_SUBMASK, SF_FORMAT_TYPEMASK and SF_FORMAT_ENDMASK bit masks can be used to separate major, minor format types and endianness value.

Note
Not all combinations of endianness and major and minor file types are valid. You can use sf_format_check() function to check format flags combination.
See also
SF_INFO
sf_format_check()
Enumerator
SF_FORMAT_WAV 

Microsoft WAV format (little endian default)

SF_FORMAT_AIFF 

Apple/SGI AIFF format (big endian)

SF_FORMAT_AU 

Sun/NeXT AU format (big endian)

SF_FORMAT_RAW 

RAW PCM data.

SF_FORMAT_PAF 

Ensoniq PARIS file format.

SF_FORMAT_SVX 

Amiga IFF / SVX8 / SV16 format.

SF_FORMAT_NIST 

Sphere NIST format.

SF_FORMAT_VOC 

VOC files.

SF_FORMAT_IRCAM 

Berkeley/IRCAM/CARL.

SF_FORMAT_W64 

Sonic Foundry's 64 bit RIFF/WAV.

SF_FORMAT_MAT4 

Matlab (tm) V4.2 / GNU Octave 2.0.

SF_FORMAT_MAT5 

Matlab (tm) V5.0 / GNU Octave 2.1.

SF_FORMAT_PVF 

Portable Voice Format.

SF_FORMAT_XI 

Fasttracker 2 Extended Instrument.

SF_FORMAT_HTK 

HMM Tool Kit format.

SF_FORMAT_SDS 

Midi Sample Dump Standard.

SF_FORMAT_AVR 

Audio Visual Research.

SF_FORMAT_WAVEX 

MS WAVE with WAVEFORMATEX.

SF_FORMAT_SD2 

Sound Designer 2.

SF_FORMAT_FLAC 

FLAC lossless file format.

SF_FORMAT_CAF 

Core Audio File format.

SF_FORMAT_WVE 

Psion WVE format.

SF_FORMAT_OGG 

Xiph OGG container.

SF_FORMAT_MPC2K 

Akai MPC 2000 sampler.

SF_FORMAT_RF64 

RF64 WAV file.

SF_FORMAT_PCM_S8 

Signed 8 bit data.

SF_FORMAT_PCM_16 

Signed 16 bit data.

SF_FORMAT_PCM_24 

Signed 24 bit data.

SF_FORMAT_PCM_32 

Signed 32 bit data.

SF_FORMAT_PCM_U8 

Unsigned 8 bit data (WAV and RAW only)

SF_FORMAT_FLOAT 

32 bit float data

SF_FORMAT_DOUBLE 

64 bit float data

SF_FORMAT_ULAW 

U-Law encoded.

SF_FORMAT_ALAW 

A-Law encoded.

SF_FORMAT_IMA_ADPCM 

IMA ADPCM.

SF_FORMAT_MS_ADPCM 

Microsoft ADPCM.

SF_FORMAT_GSM610 

GSM 6.10 encoding.

SF_FORMAT_VOX_ADPCM 

OKI / Dialogix ADPCM.

SF_FORMAT_NMS_ADPCM_16 

16kbs NMS G721-variant encoding

SF_FORMAT_NMS_ADPCM_24 

24kbs NMS G721-variant encoding

SF_FORMAT_NMS_ADPCM_32 

32kbs NMS G721-variant encoding

SF_FORMAT_G721_32 

32kbs G721 ADPCM encoding

SF_FORMAT_G723_24 

24kbs G723 ADPCM encoding

SF_FORMAT_G723_40 

40kbs G723 ADPCM encoding

SF_FORMAT_DWVW_12 

12 bit Delta Width Variable Word encoding

SF_FORMAT_DWVW_16 

16 bit Delta Width Variable Word encoding

SF_FORMAT_DWVW_24 

24 bit Delta Width Variable Word encoding

SF_FORMAT_DWVW_N 

N bit Delta Width Variable Word encoding.

SF_FORMAT_DPCM_8 

8 bit differential PCM (XI only)

SF_FORMAT_DPCM_16 

16 bit differential PCM (XI only)

SF_FORMAT_VORBIS 

Xiph Vorbis encoding.

SF_FORMAT_ALAC_16 

Apple Lossless Audio Codec (16 bit)

SF_FORMAT_ALAC_20 

Apple Lossless Audio Codec (20 bit)

SF_FORMAT_ALAC_24 

Apple Lossless Audio Codec (24 bit)

SF_FORMAT_ALAC_32 

Apple Lossless Audio Codec (32 bit)

SF_ENDIAN_FILE 

Default file endian-ness.

SF_ENDIAN_LITTLE 

Force little endian-ness.

SF_ENDIAN_BIG 

Force big endian-ness.

SF_ENDIAN_CPU 

Force CPU endian-ness.

SF_FORMAT_SUBMASK 

Major format submask.

SF_FORMAT_TYPEMASK 

Minor format submask.

SF_FORMAT_ENDMASK 

Endianness submask.

◆ SF_LOOP_MODE

Defines loop mode constants.

See also
SF_INSTRUMENT
Enumerator
SF_LOOP_NONE 

None.

SF_LOOP_FORWARD 

Forward.

SF_LOOP_BACKWARD 

Backward.

SF_LOOP_ALTERNATING 

Alternating.

Function Documentation

◆ SF_BROADCAST_INFO_VAR()

typedef SF_BROADCAST_INFO_VAR ( 256  )

Defines Broadcast struct with coding_history field of 256 bytes.

Deprecated:
This feature and will be removed in next major release.

◆ SF_CART_INFO_VAR()

typedef SF_CART_INFO_VAR ( 256  )

Declares CART timer struct with tag_text of 256 elements.

Deprecated:
This feature and will be removed in next major release.

◆ sf_close()

SNDFILE2K_EXPORT int sf_close ( SNDFILE sndfile)

Closes the SNDFILE object.

Parameters
[in]sndfilePointer to a sound file state
Returns
Zero on success, error code otherwise.
See also
sf_open(), sf_wchar_open(), sf_open_fd(), sf_open_virtual()

◆ sf_current_byterate()

SNDFILE2K_EXPORT int sf_current_byterate ( SNDFILE sndfile)

Returns current byterate of the file.

Parameters
[in]sndfilePointer to a sound file state
Note
This feature could be unsupported for particular format.
Returns
Byterate on success, -1 otherwise.

◆ sf_format_check()

SNDFILE2K_EXPORT int sf_format_check ( const SF_INFO info)

Checks correctness of SF_INFO::format field.

To open sound file in write mode you need to set up SF_INFO struct, which field SF_INFO::format is constructed as combination of major, minor format and endiannes. To be sure that format is correct and will be accepted you can use this function.

Returns
SF_TRUE if format is valid, SF_FALSE otherwise.
See also
SF_INFO
SF_FORMAT

◆ sf_read_raw()

SNDFILE2K_EXPORT sf_count_t sf_read_raw ( SNDFILE sndfile,
void *  ptr,
sf_count_t  bytes 
)

Read raw bytes from sound file.

Parameters
[in]sndfilePointer to a sound file state
[out]ptrPointer to an allocated block memory.
[in]bytesCount of bytes to read
Note
This function is not for general use. No type conversion or byte-swapping performed, data is returned as it is.
Returns
Number of bytes actually read.

◆ sf_version_string()

SNDFILE2K_EXPORT const char* sf_version_string ( void  )

Returns the library version string.

Returns
NULL-terminated string with version of library (X.Y.Z format, with -exp postfix if experimental features are enabled.)

◆ sf_write_raw()

SNDFILE2K_EXPORT sf_count_t sf_write_raw ( SNDFILE sndfile,
const void *  ptr,
sf_count_t  bytes 
)

Writes raw bytes to sound file.

Parameters
[in]sndfilePointer to a sound file state
[in]ptrPointer to an allocated block of memory.
[in]bytesCount of bytes to write
Note
This function is not for general use. No type conversion or byte-swapping performed, data is written as it is.
Returns
Number of bytes actually written.