sndfile2k  1.2.0
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
sndfile2k.h
Go to the documentation of this file.
1 /*
2 ** Copyright (C) 1999-2016 Erik de Castro Lopo <erikd@mega-nerd.com>
3 ** Copyright (C) 2017 evpobr <evpobr@gmail.com>
4 **
5 ** This program is free software; you can redistribute it and/or modify
6 ** it under the terms of the GNU Lesser General Public License as published by
7 ** the Free Software Foundation; either version 2.1 of the License, or
8 ** (at your option) any later version.
9 **
10 ** This program is distributed in the hope that it will be useful,
11 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
12 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 ** GNU Lesser General Public License for more details.
14 **
15 ** You should have received a copy of the GNU Lesser General Public License
16 ** along with this program; if not, write to the Free Software
17 ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 */
19 
26 #pragma once
27 
28 #ifndef SNDFILE2K_H
29 #define SNDFILE2K_H
30 
31 /* This is the version 1.0.X header file. */
32 #define SNDFILE_1
33 
34 #include <stdio.h>
35 #include <stdint.h>
36 #include <sys/types.h>
37 
38 #ifdef __cplusplus
39 extern "C" {
40 #endif
41 
59 typedef enum SF_FORMAT
60 {
61  // Major formats.
62 
64  SF_FORMAT_WAV = 0x010000,
66  SF_FORMAT_AIFF = 0x020000,
68  SF_FORMAT_AU = 0x030000,
70  SF_FORMAT_RAW = 0x040000,
72  SF_FORMAT_PAF = 0x050000,
74  SF_FORMAT_SVX = 0x060000,
76  SF_FORMAT_NIST = 0x070000,
78  SF_FORMAT_VOC = 0x080000,
80  SF_FORMAT_IRCAM = 0x0A0000,
82  SF_FORMAT_W64 = 0x0B0000,
84  SF_FORMAT_MAT4 = 0x0C0000,
86  SF_FORMAT_MAT5 = 0x0D0000,
88  SF_FORMAT_PVF = 0x0E0000,
90  SF_FORMAT_XI = 0x0F0000,
92  SF_FORMAT_HTK = 0x100000,
94  SF_FORMAT_SDS = 0x110000,
96  SF_FORMAT_AVR = 0x120000,
98  SF_FORMAT_WAVEX = 0x130000,
100  SF_FORMAT_SD2 = 0x160000,
102  SF_FORMAT_FLAC = 0x170000,
104  SF_FORMAT_CAF = 0x180000,
106  SF_FORMAT_WVE = 0x190000,
108  SF_FORMAT_OGG = 0x200000,
110  SF_FORMAT_MPC2K = 0x210000,
112  SF_FORMAT_RF64 = 0x220000,
113 
114  // Subtypes from here on
115 
127  SF_FORMAT_FLOAT = 0x0006,
131  SF_FORMAT_ULAW = 0x0010,
133  SF_FORMAT_ALAW = 0x0011,
176 
177  // Endian-ness options
178 
180  SF_ENDIAN_FILE = 0x00000000,
182  SF_ENDIAN_LITTLE = 0x10000000,
184  SF_ENDIAN_BIG = 0x20000000,
186  SF_ENDIAN_CPU = 0x30000000,
188  SF_FORMAT_SUBMASK = 0x0000FFFF,
190  SF_FORMAT_TYPEMASK = 0x0FFF0000,
192  SF_FORMAT_ENDMASK = 0xF0000000
193 } SF_FORMAT;
194 
199 typedef enum SF_COMMAND
200 {
210 
222 
232 
243 
254 
281 
307 
319 
331 
341 
358 
389 
399 
418 
428 
451 
461 
471 
481 
491 
502 
513 
532 
538 
559 
573 
589 
599 
609 
619 
625 
631 
642 
653 
663 
674 
684  SFC_GET_CUE = 0x10CE,
694  SFC_SET_CUE = 0x10CF,
695 
720 
731 
756 
778 
789 
790  // Support for Wavex Ambisonics Format
791 
825 
847 
875 
906 
910 
921 } SF_COMMAND;
922 
929 typedef enum SF_STR_FIELD
930 {
932  SF_STR_TITLE = 0x01,
942  SF_STR_DATE = 0x06,
944  SF_STR_ALBUM = 0x07,
951 } SF_STR_FIELD;
952 
955 #define SF_STR_FIRST SF_STR_TITLE
956 
958 #define SF_STR_LAST SF_STR_GENRE
959 
963 typedef enum SF_BOOL
964 {
966  SF_FALSE = 0,
968  SF_TRUE = 1,
969 } SF_BOOL;
970 
975 typedef enum SF_FILEMODE
976 {
978  SFM_READ = 0x10,
980  SFM_WRITE = 0x20,
982  SFM_RDWR = 0x30,
983 } SF_FILEMODE;
984 
989 typedef enum SF_AMBISONIC_MODE
990 {
996 
1007 typedef enum SF_ERR
1008 {
1019 } SF_ERR;
1020 
1024 typedef enum SF_CHANNEL_MAP
1025 {
1026  SF_CHANNEL_MAP_INVALID = 0,
1027  SF_CHANNEL_MAP_MONO = 1,
1028  SF_CHANNEL_MAP_LEFT,
1029  SF_CHANNEL_MAP_RIGHT,
1030  SF_CHANNEL_MAP_CENTER,
1031  SF_CHANNEL_MAP_FRONT_LEFT,
1032  SF_CHANNEL_MAP_FRONT_RIGHT,
1033  SF_CHANNEL_MAP_FRONT_CENTER,
1034  SF_CHANNEL_MAP_REAR_CENTER,
1035  SF_CHANNEL_MAP_REAR_LEFT,
1036  SF_CHANNEL_MAP_REAR_RIGHT,
1037  SF_CHANNEL_MAP_LFE,
1038  SF_CHANNEL_MAP_FRONT_LEFT_OF_CENTER,
1039  SF_CHANNEL_MAP_FRONT_RIGHT_OF_CENTER,
1040  SF_CHANNEL_MAP_SIDE_LEFT,
1041  SF_CHANNEL_MAP_SIDE_RIGHT,
1042  SF_CHANNEL_MAP_TOP_CENTER,
1043  SF_CHANNEL_MAP_TOP_FRONT_LEFT,
1044  SF_CHANNEL_MAP_TOP_FRONT_RIGHT,
1045  SF_CHANNEL_MAP_TOP_FRONT_CENTER,
1046  SF_CHANNEL_MAP_TOP_REAR_LEFT,
1047  SF_CHANNEL_MAP_TOP_REAR_RIGHT,
1048  SF_CHANNEL_MAP_TOP_REAR_CENTER,
1049 
1050  SF_CHANNEL_MAP_AMBISONIC_B_W,
1051  SF_CHANNEL_MAP_AMBISONIC_B_X,
1052  SF_CHANNEL_MAP_AMBISONIC_B_Y,
1053  SF_CHANNEL_MAP_AMBISONIC_B_Z,
1054 
1055  SF_CHANNEL_MAP_MAX
1056 } SF_CHANNEL_MAP;
1057 
1072 typedef struct sf_private_tag SNDFILE;
1073 
1078 typedef int64_t sf_count_t;
1079 
1082 #define SF_COUNT_MAX INT64_MAX
1083 
1086 typedef struct SF_INFO
1087 {
1089  sf_count_t frames;
1095  int format;
1100 } SF_INFO;
1101 
1111 typedef struct SF_FORMAT_INFO
1112 {
1114  int format;
1116  const char *name;
1118  const char *extension;
1119 } SF_FORMAT_INFO;
1120 
1123 typedef enum SF_DITHER_TYPE
1124 {
1128  SFD_CUSTOM_LEVEL = 0x40000000,
1129 
1133  SFD_WHITE = 501,
1136 } SF_DITHER_TYPE;
1137 
1140 typedef struct SF_DITHER_INFO
1141 {
1143  int type;
1145  double level;
1147  const char *name;
1148 } SF_DITHER_INFO;
1149 
1154 typedef struct SF_EMBED_FILE_INFO
1155 {
1157  sf_count_t offset;
1159  sf_count_t length;
1161 
1164 typedef struct SF_CUE_POINT
1165 {
1166  int32_t indx;
1167  uint32_t position;
1168  int32_t fcc_chunk;
1169  int32_t chunk_start;
1170  int32_t block_start;
1171  uint32_t sample_offset;
1172  char name[256];
1173 } SF_CUE_POINT;
1174 
1179 #define SF_CUES_VAR(count) \
1180  struct \
1181  { \
1182  uint32_t cue_count; \
1183  SF_CUE_POINT cue_points[count]; \
1184  }
1185 
1188 typedef SF_CUES_VAR(100) SF_CUES;
1189 
1194 typedef enum SF_LOOP_MODE
1195 {
1204 } SF_LOOP_MODE;
1205 
1208 typedef struct SF_INSTRUMENT
1209 {
1210  int gain;
1211  char basenote, detune;
1212  char velocity_lo, velocity_hi;
1213  char key_lo, key_hi;
1214  int loop_count;
1215 
1216  struct
1217  {
1218  int mode;
1219  uint32_t start;
1220  uint32_t end;
1221  uint32_t count;
1222  } loops[16]; // make variable in a sensible way
1223 } SF_INSTRUMENT;
1224 
1227 typedef struct SF_LOOP_INFO
1228 {
1229  short time_sig_num; // any positive integer > 0
1230  short time_sig_den; // any positive power of 2 > 0
1231  int loop_mode; // see SF_LOOP enum
1232 
1233  /*
1234  * this is NOT the amount of quarter notes !!!
1235  * a full bar of 4/4 is 4 beats
1236  * a full bar of 7/8 is 7 beats
1237  */
1238  int num_beats;
1239 
1240  /*
1241  * suggestion, as it can be calculated using other fields:
1242  * file's length, file's sampleRate and our time_sig_den
1243  * -> bpms are always the amount of _quarter notes_ per minute
1244  */
1245  float bpm;
1246 
1247  int root_key; // MIDI note, or -1 for None
1248  int future[6];
1249 } SF_LOOP_INFO;
1250 
1251 /* Struct used to retrieve broadcast (EBU) information from a file.
1252  *
1253  * Strongly (!) based on EBU "bext" chunk format used in Broadcast WAVE.
1254  *
1255  * @deprecated This feature and will be removed in next major release.
1256  *
1257  */
1258 #define SF_BROADCAST_INFO_VAR(coding_hist_size) \
1259  struct \
1260  { \
1261  char description[256]; \
1262  char originator[32]; \
1263  char originator_reference[32]; \
1264  char origination_date[10]; \
1265  char origination_time[8]; \
1266  uint32_t time_reference_low; \
1267  uint32_t time_reference_high; \
1268  short version; \
1269  char umid[64]; \
1270  char reserved[190]; \
1271  uint32_t coding_history_size; \
1272  char coding_history[coding_hist_size]; \
1273  }
1274 
1279 typedef SF_BROADCAST_INFO_VAR(256) SF_BROADCAST_INFO;
1280 
1285 typedef struct SF_CART_TIMER
1286 {
1287  char usage[4];
1288  int32_t value;
1289 } SF_CART_TIMER;
1290 
1295 #define SF_CART_INFO_VAR(p_tag_text_size) \
1296  struct \
1297  { \
1298  char version[4]; \
1299  char title[64]; \
1300  char artist[64]; \
1301  char cut_id[64]; \
1302  char client_id[64]; \
1303  char category[64]; \
1304  char classification[64]; \
1305  char out_cue[64]; \
1306  char start_date[10]; \
1307  char start_time[8]; \
1308  char end_date[10]; \
1309  char end_time[8]; \
1310  char producer_app_id[64]; \
1311  char producer_app_version[64]; \
1312  char user_def[64]; \
1313  int32_t level_reference; \
1314  SF_CART_TIMER post_timers[8]; \
1315  char reserved[276]; \
1316  char url[1024]; \
1317  uint32_t tag_text_size; \
1318  char tag_text[p_tag_text_size]; \
1319  }
1320 
1325 typedef SF_CART_INFO_VAR(256) SF_CART_INFO;
1326 
1333 typedef unsigned long (*sf_ref_callback)(void *user_data);
1338 typedef void (*sf_unref_callback)(void *user_data);
1339 
1348 typedef sf_count_t (*sf_vio_get_filelen)(void *user_data);
1349 
1364 typedef sf_count_t (*sf_vio_seek)(sf_count_t offset, int whence, void *user_data);
1375 typedef sf_count_t (*sf_vio_read)(void *ptr, sf_count_t count, void *user_data);
1376 
1387 typedef sf_count_t (*sf_vio_write)(const void *ptr, sf_count_t count, void *user_data);
1396 typedef sf_count_t (*sf_vio_tell)(void *user_data);
1405 typedef void (*sf_vio_flush)(void *user_data);
1415 typedef int (*sf_vio_set_filelen)(void *user_data, sf_count_t len);
1416 
1425 typedef SF_BOOL (*sf_vio_is_pipe)(void *user_data);
1426 
1439 typedef struct SF_VIRTUAL_IO
1440 {
1461 } SF_VIRTUAL_IO;
1462 
1463 #include "sndfile2k_export.h"
1464 
1503 SNDFILE2K_EXPORT SNDFILE *sf_open(const char *path, int mode, SF_INFO *sfinfo);
1504 
1542 SNDFILE2K_EXPORT SNDFILE *sf_open_fd(int fd, int mode, SF_INFO *sfinfo, int close_desc);
1543 
1574 SNDFILE2K_EXPORT SNDFILE *sf_open_virtual(SF_VIRTUAL_IO *sfvirtual, int mode, SF_INFO *sfinfo,
1575  void *user_data);
1576 
1616 SNDFILE2K_EXPORT SNDFILE *sf_open_virtual_ex(SF_VIRTUAL_IO *sfvirtual, int mode, SF_INFO *sfinfo, void *user_data);
1617 
1644 SNDFILE2K_EXPORT int sf_error(SNDFILE *sndfile);
1645 
1654 SNDFILE2K_EXPORT const char *sf_strerror(SNDFILE *sndfile);
1655 
1664 SNDFILE2K_EXPORT const char *sf_error_number(int errnum);
1665 
1680 SNDFILE2K_EXPORT int sf_perror(SNDFILE *sndfile);
1681 
1699 SNDFILE2K_EXPORT int sf_error_str(SNDFILE *sndfile, char *str, size_t len);
1700 
1723 SNDFILE2K_EXPORT int sf_command(SNDFILE *sndfile, int command, void *data, int datasize);
1724 
1739 SNDFILE2K_EXPORT int sf_format_check(const SF_INFO *info);
1740 
1745 typedef enum SF_SEEK_MODE
1746 {
1748  SF_SEEK_SET = SEEK_SET,
1750  SF_SEEK_CUR = SEEK_CUR,
1752  SF_SEEK_END = SEEK_END
1753 } SF_SEEK_MODE;
1754 
1784 SNDFILE2K_EXPORT sf_count_t sf_seek(SNDFILE *sndfile, sf_count_t frames, int whence);
1785 
1811 SNDFILE2K_EXPORT int sf_set_string(SNDFILE *sndfile, int str_type, const char *str);
1812 
1821 SNDFILE2K_EXPORT const char *sf_get_string(SNDFILE *sndfile, int str_type);
1822 
1830 SNDFILE2K_EXPORT const char *sf_version_string(void);
1831 
1840 SNDFILE2K_EXPORT int sf_current_byterate(SNDFILE *sndfile);
1841 
1853 SNDFILE2K_EXPORT sf_count_t sf_read_raw(SNDFILE *sndfile, void *ptr, sf_count_t bytes);
1854 
1866 SNDFILE2K_EXPORT sf_count_t sf_write_raw(SNDFILE *sndfile, const void *ptr, sf_count_t bytes);
1867 
1897 SNDFILE2K_EXPORT sf_count_t sf_readf_short(SNDFILE *sndfile, short *ptr, sf_count_t frames);
1906 SNDFILE2K_EXPORT sf_count_t sf_writef_short(SNDFILE *sndfile, const short *ptr, sf_count_t frames);
1907 
1916 SNDFILE2K_EXPORT sf_count_t sf_readf_int(SNDFILE *sndfile, int *ptr, sf_count_t frames);
1925 SNDFILE2K_EXPORT sf_count_t sf_writef_int(SNDFILE *sndfile, const int *ptr, sf_count_t frames);
1926 
1935 SNDFILE2K_EXPORT sf_count_t sf_readf_float(SNDFILE *sndfile, float *ptr, sf_count_t frames);
1944 SNDFILE2K_EXPORT sf_count_t sf_writef_float(SNDFILE *sndfile, const float *ptr, sf_count_t frames);
1945 
1954 SNDFILE2K_EXPORT sf_count_t sf_readf_double(SNDFILE *sndfile, double *ptr, sf_count_t frames);
1963 SNDFILE2K_EXPORT sf_count_t sf_writef_double(SNDFILE *sndfile, const double *ptr,
1964  sf_count_t frames);
1965 
1997 SNDFILE2K_EXPORT sf_count_t sf_read_short(SNDFILE *sndfile, short *ptr, sf_count_t items);
2006 SNDFILE2K_EXPORT sf_count_t sf_write_short(SNDFILE *sndfile, const short *ptr, sf_count_t items);
2007 
2016 SNDFILE2K_EXPORT sf_count_t sf_read_int(SNDFILE *sndfile, int *ptr, sf_count_t items);
2025 SNDFILE2K_EXPORT sf_count_t sf_write_int(SNDFILE *sndfile, const int *ptr, sf_count_t items);
2026 
2035 SNDFILE2K_EXPORT sf_count_t sf_read_float(SNDFILE *sndfile, float *ptr, sf_count_t items);
2044 SNDFILE2K_EXPORT sf_count_t sf_write_float(SNDFILE *sndfile, const float *ptr, sf_count_t items);
2045 
2054 SNDFILE2K_EXPORT sf_count_t sf_read_double(SNDFILE *sndfile, double *ptr, sf_count_t items);
2063 SNDFILE2K_EXPORT sf_count_t sf_write_double(SNDFILE *sndfile, const double *ptr, sf_count_t items);
2074 SNDFILE2K_EXPORT int sf_close(SNDFILE *sndfile);
2075 
2086 SNDFILE2K_EXPORT void sf_write_sync(SNDFILE *sndfile);
2087 
2088 #if (defined(_WIN32) || defined(__CYGWIN__))
2089 
2109 SNDFILE2K_EXPORT SNDFILE *sf_wchar_open(const wchar_t *wpath, int mode, SF_INFO *sfinfo);
2110 #endif
2111 
2130 {
2131  char id[64];
2132  unsigned id_size;
2133  unsigned datalen;
2134  void *data;
2135 };
2136 
2137 typedef struct SF_CHUNK_INFO SF_CHUNK_INFO;
2138 
2152 SNDFILE2K_EXPORT int sf_set_chunk(SNDFILE *sndfile, const SF_CHUNK_INFO *chunk_info);
2153 
2157 
2187 SNDFILE2K_EXPORT SF_CHUNK_ITERATOR *sf_get_chunk_iterator(SNDFILE *sndfile,
2188  const SF_CHUNK_INFO *chunk_info);
2189 
2210 SNDFILE2K_EXPORT SF_CHUNK_ITERATOR *sf_next_chunk_iterator(SF_CHUNK_ITERATOR *iterator);
2211 
2229 SNDFILE2K_EXPORT int sf_get_chunk_size(const SF_CHUNK_ITERATOR *it, SF_CHUNK_INFO *chunk_info);
2230 
2247 SNDFILE2K_EXPORT int sf_get_chunk_data(const SF_CHUNK_ITERATOR *it, SF_CHUNK_INFO *chunk_info);
2248 
2251 #ifdef __cplusplus
2252 } /* extern "C" */
2253 #endif /* __cplusplus */
2254 
2255 #endif /* SNDFILE2K_H */
Gets the internal per-file operation log.
Definition: sndfile2k.h:221
SF_LOOP_MODE
Defines loop mode constants.
Definition: sndfile2k.h:1194
Calculates the measured maximum signal value.
Definition: sndfile2k.h:460
Custom level.
Definition: sndfile2k.h:1128
Sets the channel mapping info.
Definition: sndfile2k.h:777
Calculates the peak value (ie a single number) for each channel.
Definition: sndfile2k.h:480
typedef SF_BROADCAST_INFO_VAR(256) SF_BROADCAST_INFO
Defines Broadcast struct with coding_history field of 256 bytes.
int seekable
Indicates that sound file is seekable if set to non-zero value.
Definition: sndfile2k.h:1099
None.
Definition: sndfile2k.h:1197
sf_vio_seek seek
Pointer to a user defined seek function.
Definition: sndfile2k.h:1444
Gets the number of major formats.
Definition: sndfile2k.h:398
Sets the Broadcast Chunk info.
Definition: sndfile2k.h:755
#define SF_CART_INFO_VAR(p_tag_text_size)
Defines CART timer struct with tag_text of desired size.
Definition: sndfile2k.h:1295
Software.
Definition: sndfile2k.h:936
SNDFILE2K_EXPORT sf_count_t sf_writef_float(SNDFILE *sndfile, const float *ptr, sf_count_t frames)
Writes float (32-bit) frames to file.
SNDFILE2K_EXPORT sf_count_t sf_read_short(SNDFILE *sndfile, short *ptr, sf_count_t items)
Reads short (16-bit) samples from file.
Endianness submask.
Definition: sndfile2k.h:192
Berkeley/IRCAM/CARL.
Definition: sndfile2k.h:80
int64_t sf_count_t
Represents file offset type.
Definition: sndfile2k.h:1078
Sets the current double normalization mode.
Definition: sndfile2k.h:280
SF_DITHER_TYPE
Defines dither type constants.
Definition: sndfile2k.h:1123
Contains CUE marker information.
Definition: sndfile2k.h:1164
Supported file format but unsupported encoding.
Definition: sndfile2k.h:1018
SNDFILE2K_EXPORT int sf_error(SNDFILE *sndfile)
Returns the current error code for the given SNDFILE.
SNDFILE2K_EXPORT sf_count_t sf_writef_short(SNDFILE *sndfile, const short *ptr, sf_count_t frames)
Writes short (16-bit) frames to file.
Determines if raw data read using sf_read_raw() needs to be end swapped on the host CPU...
Definition: sndfile2k.h:788
No error (success)
Definition: sndfile2k.h:1010
SF_BOOL
Defines boolean constants.
Definition: sndfile2k.h:963
sf_count_t length
Length of embedded file.
Definition: sndfile2k.h:1159
sf_ref_callback ref
Pointer to a user defined function that increases reference count.
Definition: sndfile2k.h:1458
Gets information about a subformat.
Definition: sndfile2k.h:450
SNDFILE2K_EXPORT int sf_get_chunk_data(const SF_CHUNK_ITERATOR *it, SF_CHUNK_INFO *chunk_info)
Gets the specified chunk data.
Force big endian-ness.
Definition: sndfile2k.h:184
Akai MPC 2000 sampler.
Definition: sndfile2k.h:110
const char * extension
Format file extension.
Definition: sndfile2k.h:1118
sf_count_t(* sf_vio_get_filelen)(void *user_data)
Type of user defined function that returns file size.
Definition: sndfile2k.h:1348
sf_count_t offset
Embedded file offset from start of container.
Definition: sndfile2k.h:1157
Read mode.
Definition: sndfile2k.h:978
Signed 32 bit data.
Definition: sndfile2k.h:123
SNDFILE2K_EXPORT int sf_command(SNDFILE *sndfile, int command, void *data, int datasize)
Gets or sets parameters of library or sound file.
Backward.
Definition: sndfile2k.h:1201
Gets instrument information.
Definition: sndfile2k.h:709
Apple Lossless Audio Codec (24 bit)
Definition: sndfile2k.h:173
Used when a file is open for write, this command will cause the file header to be updated after each ...
Definition: sndfile2k.h:572
False.
Definition: sndfile2k.h:966
SF_SEEK_MODE
Defines file seek mode constants.
Definition: sndfile2k.h:1745
SNDFILE2K_EXPORT sf_count_t sf_write_float(SNDFILE *sndfile, const float *ptr, sf_count_t items)
Writes float (32-bit) samples to file.
SNDFILE2K_EXPORT SNDFILE * sf_open_fd(int fd, int mode, SF_INFO *sfinfo, int close_desc)
Opens sound file using POSIX file descriptor.
B-format.
Definition: sndfile2k.h:994
int channels
The count of channels.
Definition: sndfile2k.h:1093
Amiga IFF / SVX8 / SV16 format.
Definition: sndfile2k.h:74
Force little endian-ness.
Definition: sndfile2k.h:182
Seek from end.
Definition: sndfile2k.h:1752
Sun/NeXT AU format (big endian)
Definition: sndfile2k.h:68
16 bit differential PCM (XI only)
Definition: sndfile2k.h:165
unsigned datalen
The size of the chunk identifier.
Definition: sndfile2k.h:2133
Read/write mode.
Definition: sndfile2k.h:982
SNDFILE2K_EXPORT sf_count_t sf_write_short(SNDFILE *sndfile, const short *ptr, sf_count_t items)
Writes short (16-bit) samples to file.
Gets the channel mapping info.
Definition: sndfile2k.h:768
sf_count_t(* sf_vio_read)(void *ptr, sf_count_t count, void *user_data)
Type of user defined read function.
Definition: sndfile2k.h:1375
12 bit Delta Width Variable Word encoding
Definition: sndfile2k.h:155
Contains instrument information.
Definition: sndfile2k.h:1208
16 bit Delta Width Variable Word encoding
Definition: sndfile2k.h:157
Triangular probability density function Dither.
Definition: sndfile2k.h:1135
Fasttracker 2 Extended Instrument.
Definition: sndfile2k.h:90
RF64 WAV file.
Definition: sndfile2k.h:112
Controls dithering on write.
Definition: sndfile2k.h:608
Sets compression level.
Definition: sndfile2k.h:874
Album.
Definition: sndfile2k.h:944
Xiph Vorbis encoding.
Definition: sndfile2k.h:167
24kbs NMS G721-variant encoding
Definition: sndfile2k.h:145
SF_CHANNEL_MAP
Defines channel map constants.
Definition: sndfile2k.h:1024
sf_vio_get_filelen get_filelen
Pointer to a used defined function that returns file size.
Definition: sndfile2k.h:1442
Forward.
Definition: sndfile2k.h:1199
sf_vio_write write
Pointer to a user defined write function.
Definition: sndfile2k.h:1448
SNDFILE2K_EXPORT sf_count_t sf_read_int(SNDFILE *sndfile, int *ptr, sf_count_t items)
Reads integer (32-bit) samples from file.
Contains information about embedded file.
Definition: sndfile2k.h:1154
SF_ERR
Defines public error values.
Definition: sndfile2k.h:1007
SF_COMMAND
Defines command constants for sf_command()
Definition: sndfile2k.h:199
sf_vio_set_filelen set_filelen
Pointer to a user defined function that truncates stream.
Definition: sndfile2k.h:1454
Describes sound file chunk.
Definition: sndfile2k.h:2129
SF_BOOL(* sf_vio_is_pipe)(void *user_data)
Type of user defined function indicates pipe mode.
Definition: sndfile2k.h:1425
Sets/clears the scale factor when integer (short/int) data is written to a file as floating point dat...
Definition: sndfile2k.h:330
SNDFILE2K_EXPORT SNDFILE * sf_open_virtual_ex(SF_VIRTUAL_IO *sfvirtual, int mode, SF_INFO *sfinfo, void *user_data)
Opens sound file using Virtual I/O context.
Sets the GUID of a new WAVEX file to indicate an Ambisonics format.
Definition: sndfile2k.h:807
Gets the file offset and file length of a file enbedded within another larger file.
Definition: sndfile2k.h:641
Signed 8 bit data.
Definition: sndfile2k.h:117
unsigned id_size
The chunk identifier.
Definition: sndfile2k.h:2132
RAW PCM data.
Definition: sndfile2k.h:70
32kbs NMS G721-variant encoding
Definition: sndfile2k.h:147
Sets cue marker information for the file.
Definition: sndfile2k.h:694
SF_AMBISONIC_MODE
Defines Ambisonics format constants.
Definition: sndfile2k.h:989
unsigned long(* sf_ref_callback)(void *user_data)
Type of user defined function that increases reference count.
Definition: sndfile2k.h:1333
Sonic Foundry&#39;s 64 bit RIFF/WAV.
Definition: sndfile2k.h:82
Date.
Definition: sndfile2k.h:942
int sections
Unused.
Definition: sndfile2k.h:1097
SNDFILE2K_EXPORT const char * sf_version_string(void)
Returns the library version string.
Contains information about the sound file format.
Definition: sndfile2k.h:1111
void(* sf_unref_callback)(void *user_data)
Type of user defined function that decreases reference count.
Definition: sndfile2k.h:1338
A-Law encoded.
Definition: sndfile2k.h:133
SNDFILE2K_EXPORT int sf_set_chunk(SNDFILE *sndfile, const SF_CHUNK_INFO *chunk_info)
Sets the specified chunk info.
Portable Voice Format.
Definition: sndfile2k.h:88
Retrieves information about a simple format.
Definition: sndfile2k.h:357
Switches the code for adding the PEAK chunk to WAV and AIFF files on or off.
Definition: sndfile2k.h:531
SNDFILE2K_EXPORT const char * sf_strerror(SNDFILE *sndfile)
Returns textual description of the current error code for the given SNDFILE.
SNDFILE2K_EXPORT SNDFILE * sf_open(const char *path, int mode, SF_INFO *sfinfo)
Opens the specified sound file using path.
SF_FILEMODE
Defines the kind of file access.
Definition: sndfile2k.h:975
Gets the number of subformats.
Definition: sndfile2k.h:427
SNDFILE2K_EXPORT int sf_set_string(SNDFILE *sndfile, int str_type, const char *str)
Sets string field for given sound file.
Retrieves current clipping setting.
Definition: sndfile2k.h:662
Signed 24 bit data.
Definition: sndfile2k.h:121
Track number.
Definition: sndfile2k.h:948
int format
Sound file format characterictics, see SF_FORMAT for details.
Definition: sndfile2k.h:1114
SNDFILE2K_EXPORT sf_count_t sf_write_double(SNDFILE *sndfile, const double *ptr, sf_count_t items)
Writes double (64-bit) samples to file.
int samplerate
The sampling rate in Hz.
Definition: sndfile2k.h:1091
Seek from beginning.
Definition: sndfile2k.h:1748
Truncates a file open for write or for read/write.
Definition: sndfile2k.h:588
SNDFILE2K_EXPORT SNDFILE * sf_open_virtual(SF_VIRTUAL_IO *sfvirtual, int mode, SF_INFO *sfinfo, void *user_data)
Opens sound file using Virtual I/O context.
void * data
The size of that data.
Definition: sndfile2k.h:2134
Matlab (tm) V5.0 / GNU Octave 2.1.
Definition: sndfile2k.h:86
Write mode.
Definition: sndfile2k.h:980
8 bit differential PCM (XI only)
Definition: sndfile2k.h:163
Apple Lossless Audio Codec (20 bit)
Definition: sndfile2k.h:171
Deprecated.
Definition: sndfile2k.h:920
Signed 16 bit data.
Definition: sndfile2k.h:119
SNDFILE2K_EXPORT sf_count_t sf_write_raw(SNDFILE *sndfile, const void *ptr, sf_count_t bytes)
Writes raw bytes to sound file.
double level
Dither level.
Definition: sndfile2k.h:1145
Sound Designer 2.
Definition: sndfile2k.h:100
Supported file format but file is malformed.
Definition: sndfile2k.h:1016
Default file endian-ness.
Definition: sndfile2k.h:180
Calculates the normalised peak for each channel.
Definition: sndfile2k.h:490
int type
Dither type, see SF_DITHER_TYPE for details.
Definition: sndfile2k.h:1143
SNDFILE2K_EXPORT sf_count_t sf_readf_int(SNDFILE *sndfile, int *ptr, sf_count_t frames)
Reads integer (32-bit) frames from file.
Minor format submask.
Definition: sndfile2k.h:190
32kbs G721 ADPCM encoding
Definition: sndfile2k.h:149
N bit Delta Width Variable Word encoding.
Definition: sndfile2k.h:161
None.
Definition: sndfile2k.h:992
Sets instrument information.
Definition: sndfile2k.h:719
SNDFILE2K_EXPORT int sf_close(SNDFILE *sndfile)
Closes the SNDFILE object.
Controls auto downgrade from RF64 to WAV.
Definition: sndfile2k.h:846
Default level.
Definition: sndfile2k.h:1126
IMA ADPCM.
Definition: sndfile2k.h:135
Xiph OGG container.
Definition: sndfile2k.h:108
GSM 6.10 encoding.
Definition: sndfile2k.h:139
24 bit Delta Width Variable Word encoding
Definition: sndfile2k.h:159
Artist.
Definition: sndfile2k.h:938
Gets the current double normalization mode.
Definition: sndfile2k.h:242
Apple Lossless Audio Codec (16 bit)
Definition: sndfile2k.h:169
Contains information about dithering.
Definition: sndfile2k.h:1140
Contanins information about CART timer.
Definition: sndfile2k.h:1285
Gets the Cart Chunk info.
Definition: sndfile2k.h:890
Turns on/off automatic clipping when doing floating point to integer conversion.
Definition: sndfile2k.h:652
int(* sf_vio_set_filelen)(void *user_data, sf_count_t len)
Type of user defined function truncates stream size.
Definition: sndfile2k.h:1415
Microsoft ADPCM.
Definition: sndfile2k.h:137
Gets SF_INFO of given sound file.
Definition: sndfile2k.h:231
24kbs G723 ADPCM encoding
Definition: sndfile2k.h:151
Seek from current position.
Definition: sndfile2k.h:1750
SNDFILE2K_EXPORT void sf_write_sync(SNDFILE *sndfile)
Forces writing of data to disk.
Core Audio File format.
Definition: sndfile2k.h:104
Format not recognised.
Definition: sndfile2k.h:1012
Midi Sample Dump Standard.
Definition: sndfile2k.h:94
SNDFILE2K_EXPORT sf_count_t sf_writef_int(SNDFILE *sndfile, const int *ptr, sf_count_t frames)
Writes integer (32-bit) frames to file.
sf_count_t(* sf_vio_seek)(sf_count_t offset, int whence, void *user_data)
Type of user defined seek function.
Definition: sndfile2k.h:1364
SNDFILE2K_EXPORT sf_count_t sf_read_raw(SNDFILE *sndfile, void *ptr, sf_count_t bytes)
Read raw bytes from sound file.
Internal, do not use.
Definition: sndfile2k.h:909
SNDFILE2K_EXPORT sf_count_t sf_readf_short(SNDFILE *sndfile, short *ptr, sf_count_t frames)
Reads short (16-bit) frames from file.
Gets the peak value for each channel as stored in the file header.
Definition: sndfile2k.h:512
OKI / Dialogix ADPCM.
Definition: sndfile2k.h:141
FLAC lossless file format.
Definition: sndfile2k.h:102
sf_vio_flush flush
Pointer to a user defined function that forces the writing of data to disk.
Definition: sndfile2k.h:1452
Apple Lossless Audio Codec (32 bit)
Definition: sndfile2k.h:175
sf_count_t(* sf_vio_tell)(void *user_data)
Type of user defined function that returns current position in file.
Definition: sndfile2k.h:1396
Comment.
Definition: sndfile2k.h:940
SNDFILE2K_EXPORT sf_count_t sf_readf_double(SNDFILE *sndfile, double *ptr, sf_count_t frames)
Reads double (64-bit) frames from file.
SF_STR_FIELD
Defines field type constants.
Definition: sndfile2k.h:929
Defines virtual file I/O context.
Definition: sndfile2k.h:1439
Gets the current float normalization mode.
Definition: sndfile2k.h:253
SNDFILE2K_EXPORT sf_count_t sf_write_int(SNDFILE *sndfile, const int *ptr, sf_count_t items)
Writes integer (32-bit) samples to file.
SNDFILE2K_EXPORT sf_count_t sf_read_double(SNDFILE *sndfile, double *ptr, sf_count_t items)
Reads double (64-bit) samples from file.
Sets the Variable Bit Rate encoding quality.
Definition: sndfile2k.h:860
Gets library version string.
Definition: sndfile2k.h:209
Genre.
Definition: sndfile2k.h:950
SNDFILE2K_EXPORT SF_CHUNK_ITERATOR * sf_next_chunk_iterator(SF_CHUNK_ITERATOR *iterator)
Iterates through chunks by incrementing the iterator.
sf_vio_tell tell
Pointer to a user defined function that returns file position.
Definition: sndfile2k.h:1450
Gets the peak value for the file as stored in the file header.
Definition: sndfile2k.h:501
True.
Definition: sndfile2k.h:968
Forces update of the file header to reflect the data written so far when a file is open for write...
Definition: sndfile2k.h:558
Title.
Definition: sndfile2k.h:932
int format
Combination of major and minor format flags. See SF_FORMAT for details.
Definition: sndfile2k.h:1095
SNDFILE2K_EXPORT sf_count_t sf_readf_float(SNDFILE *sndfile, float *ptr, sf_count_t frames)
Reads float (32-bit) frames from file.
SF_FORMAT
Set of format bit flags.
Definition: sndfile2k.h:59
Gets the Broadcast Chunk info.
Definition: sndfile2k.h:743
struct sf_private_tag SNDFILE
Represents opened sound file.
Definition: sndfile2k.h:1072
Sets the current float normalization mode.
Definition: sndfile2k.h:306
White.
Definition: sndfile2k.h:1133
Not used.
Definition: sndfile2k.h:537
SNDFILE2K_EXPORT const char * sf_get_string(SNDFILE *sndfile, int str_type)
Gets string field from given sound file.
Sets/clears the scale factor when integer (short/int) data is read from a file containing floating po...
Definition: sndfile2k.h:318
SNDFILE2K_EXPORT sf_count_t sf_read_float(SNDFILE *sndfile, float *ptr, sf_count_t items)
Reads float (32-bit) samples from file.
Sets loop information.
Definition: sndfile2k.h:730
const char * name
Dither name.
Definition: sndfile2k.h:1147
Audio Visual Research.
Definition: sndfile2k.h:96
void(* sf_vio_flush)(void *user_data)
Type of user defined function that forces the writing of data to disk.
Definition: sndfile2k.h:1405
Gets the cue marker count.
Definition: sndfile2k.h:673
struct SF_CHUNK_ITERATOR SF_CHUNK_ITERATOR
An opaque structure to an iterator over the all chunks of a given id.
Definition: sndfile2k.h:2156
SNDFILE2K_EXPORT sf_count_t sf_seek(SNDFILE *sndfile, sf_count_t frames, int whence)
Changes position of sound file.
sf_vio_is_pipe is_pipe
Pointer to a user defined function that indicates pipe mode.
Definition: sndfile2k.h:1456
Controls dithering on read.
Definition: sndfile2k.h:618
Changes the data start offset for files opened up as SF_FORMAT_RAW.
Definition: sndfile2k.h:598
const char * name
Format description.
Definition: sndfile2k.h:1116
Retrieves the number of simple formats supported by libsndfile.
Definition: sndfile2k.h:340
64 bit float data
Definition: sndfile2k.h:129
License.
Definition: sndfile2k.h:946
sf_unref_callback unref
Pointer to a user defined function that decreases reference count.
Definition: sndfile2k.h:1460
Sphere NIST format.
Definition: sndfile2k.h:76
Alternating.
Definition: sndfile2k.h:1203
Matlab (tm) V4.2 / GNU Octave 2.0.
Definition: sndfile2k.h:84
SNDFILE2K_EXPORT const char * sf_error_number(int errnum)
Returns text description of error code.
sf_count_t frames
The count of frames.
Definition: sndfile2k.h:1089
Gets information about a major format type.
Definition: sndfile2k.h:417
#define SF_CUES_VAR(count)
Defines struct containing desired count of CUE markers.
Definition: sndfile2k.h:1179
Deprecated.
Definition: sndfile2k.h:915
Gets cue marker information from file.
Definition: sndfile2k.h:684
Contains information about format of sound file.
Definition: sndfile2k.h:1086
sf_count_t(* sf_vio_write)(const void *ptr, sf_count_t count, void *user_data)
Type of user defined write function.
Definition: sndfile2k.h:1387
Copyright.
Definition: sndfile2k.h:934
Apple/SGI AIFF format (big endian)
Definition: sndfile2k.h:66
System error.
Definition: sndfile2k.h:1014
No dither.
Definition: sndfile2k.h:1131
HMM Tool Kit format.
Definition: sndfile2k.h:92
SNDFILE2K_EXPORT int sf_current_byterate(SNDFILE *sndfile)
Returns current byterate of the file.
Microsoft WAV format (little endian default)
Definition: sndfile2k.h:64
Force CPU endian-ness.
Definition: sndfile2k.h:186
Major format submask.
Definition: sndfile2k.h:188
Defines loop information.
Definition: sndfile2k.h:1227
Not used.
Definition: sndfile2k.h:630
VOC files.
Definition: sndfile2k.h:78
SNDFILE2K_EXPORT int sf_format_check(const SF_INFO *info)
Checks correctness of SF_INFO::format field.
Unsigned 8 bit data (WAV and RAW only)
Definition: sndfile2k.h:125
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.
16kbs NMS G721-variant encoding
Definition: sndfile2k.h:143
40kbs G723 ADPCM encoding
Definition: sndfile2k.h:153
SNDFILE2K_EXPORT SF_CHUNK_ITERATOR * sf_get_chunk_iterator(SNDFILE *sndfile, const SF_CHUNK_INFO *chunk_info)
Gets an iterator for all chunks matching chunk_info.
Not used.
Definition: sndfile2k.h:624
MS WAVE with WAVEFORMATEX.
Definition: sndfile2k.h:98
U-Law encoded.
Definition: sndfile2k.h:131
SNDFILE2K_EXPORT int sf_perror(SNDFILE *sndfile)
Returns internal error code for the given SNDFILE.
Calculates the measured normalised maximum signal value.
Definition: sndfile2k.h:470
sf_vio_read read
Pointer to a user defined read function.
Definition: sndfile2k.h:1446
Ensoniq PARIS file format.
Definition: sndfile2k.h:72
SNDFILE2K_EXPORT sf_count_t sf_writef_double(SNDFILE *sndfile, const double *ptr, sf_count_t frames)
Writes double (64-bit) frames to file.
Gets the Cart Chunk info.
Definition: sndfile2k.h:905
SNDFILE2K_EXPORT int sf_get_chunk_size(const SF_CHUNK_ITERATOR *it, SF_CHUNK_INFO *chunk_info)
Gets the size of the specified chunk.
32 bit float data
Definition: sndfile2k.h:127
Retrieves information about a major or subtype format.
Definition: sndfile2k.h:388
Tests if the current file has the GUID of a WAVEX file for any of the Ambisonic formats.
Definition: sndfile2k.h:824
Psion WVE format.
Definition: sndfile2k.h:106