| @@ -1,5 +1,5 @@ |
| 1 | 1 | /* |
| 2 | | −** Copyright (C) 1999-2004 Erik de Castro Lopo <erikd@mega-nerd.com> |
| 2 | +** Copyright (C) 1999-2008 Erik de Castro Lopo <erikd@mega-nerd.com> |
| 3 | 3 | ** |
| 4 | 4 | ** This program is free software; you can redistribute it and/or modify |
| 5 | 5 | ** it under the terms of the GNU Lesser General Public License as published by |
| @@ -30,14 +30,7 @@ · 24 unmodified lines |
| 30 | 30 | #define SNDFILE_1 |
| 31 | 31 | |
| 32 | 32 | #include <stdio.h> |
| 33 | | − |
| 34 | | −/* For the Metrowerks CodeWarrior Pro Compiler (mainly MacOS) */ |
| 35 | | − |
| 36 | | −#if (defined (__MWERKS__)) |
| 37 | | −#include <unix.h> |
| 38 | | −#else |
| 39 | | −#include <sys/types.h> |
| 40 | | −#endif |
| 33 | +#include <sys/types.h> |
| 41 | 34 | |
| 42 | 35 | #ifdef __cplusplus |
| 43 | 36 | extern "C" { |
| @@ -52,7 +45,7 @@ extern "C" { · 8 unmodified lines |
| 52 | 45 | |
| 53 | 46 | enum |
| 54 | 47 | { /* Major formats. */ |
| 55 | | − SF_FORMAT_WAV = 0x010000, /* Microsoft WAV format (little endian). */ |
| 48 | + SF_FORMAT_WAV = 0x010000, /* Microsoft WAV format (little endian default). */ |
| 56 | 49 | SF_FORMAT_AIFF = 0x020000, /* Apple/SGI AIFF format (big endian). */ |
| 57 | 50 | SF_FORMAT_AU = 0x030000, /* Sun/NeXT AU format (big endian). */ |
| 58 | 51 | SF_FORMAT_RAW = 0x040000, /* RAW PCM data. */ |
| @@ -68,7 +61,14 @@ enum · 9 unmodified lines |
| 68 | 61 | SF_FORMAT_XI = 0x0F0000, /* Fasttracker 2 Extended Instrument */ |
| 69 | 62 | SF_FORMAT_HTK = 0x100000, /* HMM Tool Kit format */ |
| 70 | 63 | SF_FORMAT_SDS = 0x110000, /* Midi Sample Dump Standard */ |
| 71 | | − |
| 64 | + SF_FORMAT_AVR = 0x120000, /* Audio Visual Research */ |
| 65 | + SF_FORMAT_WAVEX = 0x130000, /* MS WAVE with WAVEFORMATEX */ |
| 66 | + SF_FORMAT_SD2 = 0x160000, /* Sound Designer 2 */ |
| 67 | + SF_FORMAT_FLAC = 0x170000, /* FLAC lossless file format */ |
| 68 | + SF_FORMAT_CAF = 0x180000, /* Core Audio File format */ |
| 69 | + SF_FORMAT_WVE = 0x190000, /* Psion WVE format */ |
| 70 | + SF_FORMAT_OGG = 0x200000, /* Xiph OGG container */ |
| 71 | + |
| 72 | 72 | /* Subtypes from here on. */ |
| 73 | 73 | |
| 74 | 74 | SF_FORMAT_PCM_S8 = 0x0001, /* Signed 8 bit data */ |
| @@ -123,11 +123,15 @@ enum · 48 unmodified lines |
| 123 | 123 | enum |
| 124 | 124 | { SFC_GET_LIB_VERSION = 0x1000, |
| 125 | 125 | SFC_GET_LOG_INFO = 0x1001, |
| 126 | + SFC_GET_CURRENT_SF_INFO = 0x1002, |
| 127 | + |
| 126 | 128 | |
| 127 | 129 | SFC_GET_NORM_DOUBLE = 0x1010, |
| 128 | 130 | SFC_GET_NORM_FLOAT = 0x1011, |
| 129 | 131 | SFC_SET_NORM_DOUBLE = 0x1012, |
| 130 | 132 | SFC_SET_NORM_FLOAT = 0x1013, |
| 133 | + SFC_SET_SCALE_FLOAT_INT_READ = 0x1014, |
| 134 | + SFC_SET_SCALE_INT_FLOAT_WRITE = 0x1015, |
| 131 | 135 | |
| 132 | 136 | SFC_GET_SIMPLE_FORMAT_COUNT = 0x1020, |
| 133 | 137 | SFC_GET_SIMPLE_FORMAT = 0x1021, |
| @@ -143,6 +147,8 @@ enum · 9 unmodified lines |
| 143 | 147 | SFC_CALC_NORM_SIGNAL_MAX = 0x1041, |
| 144 | 148 | SFC_CALC_MAX_ALL_CHANNELS = 0x1042, |
| 145 | 149 | SFC_CALC_NORM_MAX_ALL_CHANNELS = 0x1043, |
| 150 | + SFC_GET_SIGNAL_MAX = 0x1044, |
| 151 | + SFC_GET_MAX_ALL_CHANNELS = 0x1045, |
| 146 | 152 | |
| 147 | 153 | SFC_SET_ADD_PEAK_CHUNK = 0x1050, |
| 148 | 154 | |
| @@ -150,7 +156,7 @@ enum · 1 unmodified line |
| 150 | 156 | SFC_SET_UPDATE_HEADER_AUTO = 0x1061, |
| 151 | 157 | |
| 152 | 158 | SFC_FILE_TRUNCATE = 0x1080, |
| 153 | | − |
| 159 | + |
| 154 | 160 | SFC_SET_RAW_START_OFFSET = 0x1090, |
| 155 | 161 | |
| 156 | 162 | SFC_SET_DITHER_ON_WRITE = 0x10A0, |
| @@ -160,21 +166,37 @@ enum · 3 unmodified lines |
| 160 | 166 | SFC_GET_DITHER_INFO = 0x10A3, |
| 161 | 167 | |
| 162 | 168 | SFC_GET_EMBED_FILE_INFO = 0x10B0, |
| 163 | | − |
| 169 | + |
| 164 | 170 | SFC_SET_CLIPPING = 0x10C0, |
| 165 | 171 | SFC_GET_CLIPPING = 0x10C1, |
| 166 | 172 | |
| 167 | 173 | SFC_GET_INSTRUMENT = 0x10D0, |
| 168 | 174 | SFC_SET_INSTRUMENT = 0x10D1, |
| 169 | 175 | |
| 176 | + SFC_GET_LOOP_INFO = 0x10E0, |
| 177 | + |
| 178 | + SFC_GET_BROADCAST_INFO = 0x10F0, |
| 179 | + SFC_SET_BROADCAST_INFO = 0x10F1, |
| 180 | + |
| 181 | + SFC_GET_CHANNEL_MAP_INFO = 0x1100, |
| 182 | + SFC_SET_CHANNEL_MAP_INFO = 0x1101, |
| 183 | + |
| 184 | + SFC_RAW_DATA_NEEDS_ENDSWAP = 0x1110, |
| 185 | + |
| 186 | + /* Support for Wavex Ambisonics Format */ |
| 187 | + SFC_WAVEX_SET_AMBISONIC = 0x1200, |
| 188 | + SFC_WAVEX_GET_AMBISONIC = 0x1201, |
| 189 | + |
| 190 | + SFC_SET_VBR_ENCODING_QUALITY = 0x1300, |
| 191 | + |
| 170 | 192 | /* Following commands for testing only. */ |
| 171 | 193 | SFC_TEST_IEEE_FLOAT_REPLACE = 0x6001, |
| 172 | 194 | |
| 173 | 195 | /* |
| 174 | 196 | ** SFC_SET_ADD_* values are deprecated and will disappear at some |
| 175 | | − ** time in the future. They are guaranteed to be here up to and |
| 176 | | − ** including version 1.0.8 to avoid breakage of existng software. |
| 177 | | − ** They currently do nothing and will continue to do nothing. |
| 197 | + ** time in the future. They are guaranteed to be here up to and |
| 198 | + ** including version 1.0.8 to avoid breakage of existng software. |
| 199 | + ** They currently do nothing and will continue to do nothing. |
| 178 | 200 | */ |
| 179 | 201 | SFC_SET_ADD_DITHER_ON_WRITE = 0x1070, |
| 180 | 202 | SFC_SET_ADD_DITHER_ON_READ = 0x1071 |
| @@ -193,9 +215,19 @@ enum · 12 unmodified lines |
| 193 | 215 | SF_STR_SOFTWARE = 0x03, |
| 194 | 216 | SF_STR_ARTIST = 0x04, |
| 195 | 217 | SF_STR_COMMENT = 0x05, |
| 196 | | − SF_STR_DATE = 0x06 |
| 218 | + SF_STR_DATE = 0x06, |
| 219 | + SF_STR_ALBUM = 0x07, |
| 220 | + SF_STR_LICENSE = 0x08 |
| 197 | 221 | } ; |
| 198 | 222 | |
| 223 | +/* |
| 224 | +** Use the following as the start and end index when doing metadata |
| 225 | +** transcoding. |
| 226 | +*/ |
| 227 | + |
| 228 | +#define SF_STR_FIRST SF_STR_TITLE |
| 229 | +#define SF_STR_LAST SF_STR_LICENSE |
| 230 | + |
| 199 | 231 | enum |
| 200 | 232 | { /* True and false */ |
| 201 | 233 | SF_FALSE = 0, |
| @@ -204,33 +236,75 @@ enum · 2 unmodified lines |
| 204 | 236 | /* Modes for opening files. */ |
| 205 | 237 | SFM_READ = 0x10, |
| 206 | 238 | SFM_WRITE = 0x20, |
| 207 | | − SFM_RDWR = 0x30 |
| 239 | + SFM_RDWR = 0x30, |
| 240 | + |
| 241 | + SF_AMBISONIC_NONE = 0x40, |
| 242 | + SF_AMBISONIC_B_FORMAT = 0x41 |
| 208 | 243 | } ; |
| 209 | 244 | |
| 210 | | −/* Pubic error values. These are guaranteed to remain unchanged for the duration |
| 211 | | −** of the library major version number. |
| 245 | +/* Public error values. These are guaranteed to remain unchanged for the duration |
| 246 | +** of the library major version number. |
| 212 | 247 | ** There are also a large number of private error numbers which are internal to |
| 213 | 248 | ** the library which can change at any time. |
| 214 | 249 | */ |
| 215 | 250 | |
| 216 | 251 | enum |
| 217 | | −{ SF_ERR_NO_ERROR = 0, |
| 252 | +{ SF_ERR_NO_ERROR = 0, |
| 218 | 253 | SF_ERR_UNRECOGNISED_FORMAT = 1, |
| 219 | | − SF_ERR_SYSTEM = 2 |
| 254 | + SF_ERR_SYSTEM = 2, |
| 255 | + SF_ERR_MALFORMED_FILE = 3, |
| 256 | + SF_ERR_UNSUPPORTED_ENCODING = 4 |
| 220 | 257 | } ; |
| 221 | 258 | |
| 259 | + |
| 260 | +/* Channel map values (used with SFC_SET/GET_CHANNEL_MAP). |
| 261 | +*/ |
| 262 | + |
| 263 | +enum |
| 264 | +{ SF_CHANNEL_MAP_INVALID = 0, |
| 265 | + SF_CHANNEL_MAP_MONO = 1, |
| 266 | + SF_CHANNEL_MAP_LEFT, |
| 267 | + SF_CHANNEL_MAP_RIGHT, |
| 268 | + SF_CHANNEL_MAP_CENTER, |
| 269 | + SF_CHANNEL_MAP_FRONT_LEFT, |
| 270 | + SF_CHANNEL_MAP_FRONT_RIGHT, |
| 271 | + SF_CHANNEL_MAP_FRONT_CENTER, |
| 272 | + SF_CHANNEL_MAP_REAR_CENTER, |
| 273 | + SF_CHANNEL_MAP_REAR_LEFT, |
| 274 | + SF_CHANNEL_MAP_REAR_RIGHT, |
| 275 | + SF_CHANNEL_MAP_LFE, |
| 276 | + SF_CHANNEL_MAP_FRONT_LEFT_OF_CENTER, |
| 277 | + SF_CHANNEL_MAP_FRONT_RIGHT_OF_CENTER, |
| 278 | + SF_CHANNEL_MAP_SIDE_LEFT, |
| 279 | + SF_CHANNEL_MAP_SIDE_RIGHT, |
| 280 | + SF_CHANNEL_MAP_TOP_CENTER, |
| 281 | + SF_CHANNEL_MAP_TOP_FRONT_LEFT, |
| 282 | + SF_CHANNEL_MAP_TOP_FRONT_RIGHT, |
| 283 | + SF_CHANNEL_MAP_TOP_FRONT_CENTER, |
| 284 | + SF_CHANNEL_MAP_TOP_REAR_LEFT, |
| 285 | + SF_CHANNEL_MAP_TOP_REAR_RIGHT, |
| 286 | + SF_CHANNEL_MAP_TOP_REAR_CENTER |
| 287 | +} ; |
| 288 | + |
| 289 | + |
| 222 | 290 | /* A SNDFILE* pointer can be passed around much like stdio.h's FILE* pointer. */ |
| 223 | 291 | |
| 224 | 292 | typedef struct SNDFILE_tag SNDFILE ; |
| 225 | 293 | |
| 226 | | −/* The following typedef is system specific and is defined when libsndfile is. |
| 227 | | −** compiled. sf_count_t can be one of loff_t (Linux), off_t (*BSD), |
| 228 | | −** off64_t (Solaris), __int64_t (Win32) etc. |
| 294 | +/* The following typedef is system specific and is defined when libsndfile is |
| 295 | +** compiled. sf_count_t can be one of loff_t (Linux), off_t (*BSD), off64_t |
| 296 | +** (Solaris), __int64_t (Win32) etc. On windows, we need to allow the same |
| 297 | +** header file to be compiler by both GCC and the microsoft compiler. |
| 229 | 298 | */ |
| 230 | 299 | |
| 231 | | −typedef __int64 sf_count_t ; |
| 300 | +#ifdef _MSCVER |
| 301 | +typedef __int64_t sf_count_t ; |
| 302 | +#define SF_COUNT_MAX 0x7fffffffffffffffi64 |
| 303 | +#else |
| 304 | +typedef loff_t sf_count_t ; |
| 305 | +#define SF_COUNT_MAX 0x7FFFFFFFFFFFFFFFLL |
| 306 | +#endif |
| 232 | 307 | |
| 233 | | −#define SF_COUNT_MAX 0x7FFFFFFFFFFFFFFFi64 |
| 234 | 308 | |
| 235 | 309 | /* A pointer to a SF_INFO structure is passed to sf_open_read () and filled in. |
| 236 | 310 | ** On write, the SF_INFO structure is filled in by the user and passed into |
| @@ -261,13 +335,13 @@ typedef struct SF_INFO SF_INFO ; · 24 unmodified lines |
| 261 | 335 | |
| 262 | 336 | typedef struct |
| 263 | 337 | { int format ; |
| 264 | | − const char *name ; |
| 265 | | − const char *extension ; |
| 338 | + const char *name ; |
| 339 | + const char *extension ; |
| 266 | 340 | } SF_FORMAT_INFO ; |
| 267 | 341 | |
| 268 | 342 | /* |
| 269 | | −** Enums and typedefs for adding dither on read and write. |
| 270 | | −** See the html documentation for sf_command(), SFC_SET_DITHER_ON_WRITE |
| 343 | +** Enums and typedefs for adding dither on read and write. |
| 344 | +** See the html documentation for sf_command(), SFC_SET_DITHER_ON_WRITE |
| 271 | 345 | ** and SFC_SET_DITHER_ON_READ. |
| 272 | 346 | */ |
| 273 | 347 | |
| @@ -295,26 +369,91 @@ typedef struct · 21 unmodified lines |
| 295 | 369 | sf_count_t length ; |
| 296 | 370 | } SF_EMBED_FILE_INFO ; |
| 297 | 371 | |
| 298 | | −/* Struct used to retrieve music sample information from a file. |
| 372 | +/* |
| 373 | +** Structs used to retrieve music sample information from a file. |
| 299 | 374 | */ |
| 300 | 375 | |
| 376 | +enum |
| 377 | +{ /* |
| 378 | + ** The loop mode field in SF_INSTRUMENT will be one of the following. |
| 379 | + */ |
| 380 | + SF_LOOP_NONE = 800, |
| 381 | + SF_LOOP_FORWARD, |
| 382 | + SF_LOOP_BACKWARD, |
| 383 | + SF_LOOP_ALTERNATING |
| 384 | +} ; |
| 385 | + |
| 301 | 386 | typedef struct |
| 302 | | −{ int basenote ; |
| 303 | | − int gain ; |
| 304 | | − int sustain_mode ; |
| 305 | | − int sustain_start, sustain_end ; |
| 306 | | − int release_mode ; |
| 307 | | − int release_start, reslease_end ; |
| 387 | +{ int gain ; |
| 388 | + char basenote, detune ; |
| 389 | + char velocity_lo, velocity_hi ; |
| 390 | + char key_lo, key_hi ; |
| 391 | + int loop_count ; |
| 392 | + |
| 393 | + struct |
| 394 | + { int mode ; |
| 395 | + unsigned int start ; |
| 396 | + unsigned int end ; |
| 397 | + unsigned int count ; |
| 398 | + } loops [16] ; /* make variable in a sensible way */ |
| 308 | 399 | } SF_INSTRUMENT ; |
| 309 | 400 | |
| 310 | | −/* sustain_mode and release_mode will be one of the following. */ |
| 311 | 401 | |
| 312 | | −enum |
| 313 | | −{ SF_LOOP_NONE = 800, |
| 314 | | − SF_LOOP_FORWARD, |
| 315 | | − SF_LOOP_BACKWARD, |
| 402 | + |
| 403 | +/* Struct used to retrieve loop information from a file.*/ |
| 404 | +typedef struct |
| 405 | +{ |
| 406 | + short time_sig_num ; /* any positive integer > 0 */ |
| 407 | + short time_sig_den ; /* any positive power of 2 > 0 */ |
| 408 | + int loop_mode ; /* see SF_LOOP enum */ |
| 409 | + |
| 410 | + int num_beats ; /* this is NOT the amount of quarter notes !!!*/ |
| 411 | + /* a full bar of 4/4 is 4 beats */ |
| 412 | + /* a full bar of 7/8 is 7 beats */ |
| 413 | + |
| 414 | + float bpm ; /* suggestion, as it can be calculated using other fields:*/ |
| 415 | + /* file's lenght, file's sampleRate and our time_sig_den*/ |
| 416 | + /* -> bpms are always the amount of _quarter notes_ per minute */ |
| 417 | + |
| 418 | + int root_key ; /* MIDI note, or -1 for None */ |
| 419 | + int future [6] ; |
| 420 | +} SF_LOOP_INFO ; |
| 421 | + |
| 422 | + |
| 423 | +/* Struct used to retrieve broadcast (EBU) information from a file. |
| 424 | +** Strongly (!) based on EBU "bext" chunk format used in Broadcast WAVE. |
| 425 | +*/ |
| 426 | +typedef struct |
| 427 | +{ char description [256] ; |
| 428 | + char originator [32] ; |
| 429 | + char originator_reference [32] ; |
| 430 | + char origination_date [10] ; |
| 431 | + char origination_time [8] ; |
| 432 | + int time_reference_low ; |
| 433 | + int time_reference_high ; |
| 434 | + short version ; |
| 435 | + char umid [64] ; |
| 436 | + char reserved [190] ; |
| 437 | + unsigned int coding_history_size ; |
| 438 | + char coding_history [256] ; |
| 439 | +} SF_BROADCAST_INFO ; |
| 440 | + |
| 441 | +typedef sf_count_t (*sf_vio_get_filelen) (void *user_data) ; |
| 442 | +typedef sf_count_t (*sf_vio_seek) (sf_count_t offset, int whence, void *user_data) ; |
| 443 | +typedef sf_count_t (*sf_vio_read) (void *ptr, sf_count_t count, void *user_data) ; |
| 444 | +typedef sf_count_t (*sf_vio_write) (const void *ptr, sf_count_t count, void *user_data) ; |
| 445 | +typedef sf_count_t (*sf_vio_tell) (void *user_data) ; |
| 446 | + |
| 447 | +struct SF_VIRTUAL_IO |
| 448 | +{ sf_vio_get_filelen get_filelen ; |
| 449 | + sf_vio_seek seek ; |
| 450 | + sf_vio_read read ; |
| 451 | + sf_vio_write write ; |
| 452 | + sf_vio_tell tell ; |
| 316 | 453 | } ; |
| 317 | 454 | |
| 455 | +typedef struct SF_VIRTUAL_IO SF_VIRTUAL_IO ; |
| 456 | + |
| 318 | 457 | /* Open the specified file for read, write or both. On error, this will |
| 319 | 458 | ** return a NULL pointer. To find the error number, pass a NULL SNDFILE |
| 320 | 459 | ** to sf_perror () or sf_error_str (). |
| @@ -329,7 +468,7 @@ SNDFILE* sf_open (const char *path, int mode, SF_INFO *sfinfo) ; · 8 unmodified lines |
| 329 | 468 | ** When passed a descriptor like this, the library will assume that the start |
| 330 | 469 | ** of file header is at the current file offset. This allows sound files within |
| 331 | 470 | ** larger container files to be read and/or written. |
| 332 | | −** On error, this will return a NULL pointer. To find the error number, pass a |
| 471 | +** On error, this will return a NULL pointer. To find the error number, pass a |
| 333 | 472 | ** NULL SNDFILE to sf_perror () or sf_error_str (). |
| 334 | 473 | ** All calls to sf_open_fd() should be matched with a call to sf_close(). |
| 335 | 474 | |
| @@ -337,20 +476,22 @@ SNDFILE* sf_open (const char *path, int mode, SF_INFO *sfinfo) ; · 1 unmodified line |
| 337 | 476 | |
| 338 | 477 | SNDFILE* sf_open_fd (int fd, int mode, SF_INFO *sfinfo, int close_desc) ; |
| 339 | 478 | |
| 340 | | −/* sf_error () returns a error number which can be translated to a text |
| 479 | +SNDFILE* sf_open_virtual (SF_VIRTUAL_IO *sfvirtual, int mode, SF_INFO *sfinfo, void *user_data) ; |
| 480 | + |
| 481 | +/* sf_error () returns a error number which can be translated to a text |
| 341 | 482 | ** string using sf_error_number(). |
| 342 | 483 | */ |
| 343 | 484 | |
| 344 | 485 | int sf_error (SNDFILE *sndfile) ; |
| 345 | 486 | |
| 346 | | −/* sf_strerror () returns to the caller a pointer to the current error message for |
| 487 | +/* sf_strerror () returns to the caller a pointer to the current error message for |
| 347 | 488 | ** the given SNDFILE. |
| 348 | 489 | */ |
| 349 | 490 | |
| 350 | 491 | const char* sf_strerror (SNDFILE *sndfile) ; |
| 351 | 492 | |
| 352 | 493 | /* sf_error_number () allows the retrieval of the error string for each internal |
| 353 | | −** error number. |
| 494 | +** error number. |
| 354 | 495 | ** |
| 355 | 496 | */ |
| 356 | 497 | |
| @@ -403,7 +544,7 @@ const char* sf_get_string (SNDFILE *sndfile, int str_type) ; · 46 unmodified lines |
| 403 | 544 | */ |
| 404 | 545 | |
| 405 | 546 | sf_count_t sf_read_raw (SNDFILE *sndfile, void *ptr, sf_count_t bytes) ; |
| 406 | | −sf_count_t sf_write_raw (SNDFILE *sndfile, void *ptr, sf_count_t bytes) ; |
| 547 | +sf_count_t sf_write_raw (SNDFILE *sndfile, const void *ptr, sf_count_t bytes) ; |
| 407 | 548 | |
| 408 | 549 | /* Functions for reading and writing the data chunk in terms of frames. |
| 409 | 550 | ** The number of items actually read/written = frames * number of channels. |
| @@ -416,16 +557,16 @@ sf_count_t sf_write_raw (SNDFILE *sndfile, void *ptr, sf_count_t bytes) ; · 6 unmodified lines |
| 416 | 557 | */ |
| 417 | 558 | |
| 418 | 559 | sf_count_t sf_readf_short (SNDFILE *sndfile, short *ptr, sf_count_t frames) ; |
| 419 | | −sf_count_t sf_writef_short (SNDFILE *sndfile, short *ptr, sf_count_t frames) ; |
| 560 | +sf_count_t sf_writef_short (SNDFILE *sndfile, const short *ptr, sf_count_t frames) ; |
| 420 | 561 | |
| 421 | 562 | sf_count_t sf_readf_int (SNDFILE *sndfile, int *ptr, sf_count_t frames) ; |
| 422 | | −sf_count_t sf_writef_int (SNDFILE *sndfile, int *ptr, sf_count_t frames) ; |
| 563 | +sf_count_t sf_writef_int (SNDFILE *sndfile, const int *ptr, sf_count_t frames) ; |
| 423 | 564 | |
| 424 | 565 | sf_count_t sf_readf_float (SNDFILE *sndfile, float *ptr, sf_count_t frames) ; |
| 425 | | −sf_count_t sf_writef_float (SNDFILE *sndfile, float *ptr, sf_count_t frames) ; |
| 566 | +sf_count_t sf_writef_float (SNDFILE *sndfile, const float *ptr, sf_count_t frames) ; |
| 426 | 567 | |
| 427 | 568 | sf_count_t sf_readf_double (SNDFILE *sndfile, double *ptr, sf_count_t frames) ; |
| 428 | | −sf_count_t sf_writef_double (SNDFILE *sndfile, double *ptr, sf_count_t frames) ; |
| 569 | +sf_count_t sf_writef_double (SNDFILE *sndfile, const double *ptr, sf_count_t frames) ; |
| 429 | 570 | |
| 430 | 571 | /* Functions for reading and writing the data chunk in terms of items. |
| 431 | 572 | ** Otherwise similar to above. |
| @@ -433,16 +574,16 @@ sf_count_t sf_writef_double (SNDFILE *sndfile, double *ptr, sf_count_t frames) ; · 1 unmodified line |
| 433 | 574 | */ |
| 434 | 575 | |
| 435 | 576 | sf_count_t sf_read_short (SNDFILE *sndfile, short *ptr, sf_count_t items) ; |
| 436 | | −sf_count_t sf_write_short (SNDFILE *sndfile, short *ptr, sf_count_t items) ; |
| 577 | +sf_count_t sf_write_short (SNDFILE *sndfile, const short *ptr, sf_count_t items) ; |
| 437 | 578 | |
| 438 | 579 | sf_count_t sf_read_int (SNDFILE *sndfile, int *ptr, sf_count_t items) ; |
| 439 | | −sf_count_t sf_write_int (SNDFILE *sndfile, int *ptr, sf_count_t items) ; |
| 580 | +sf_count_t sf_write_int (SNDFILE *sndfile, const int *ptr, sf_count_t items) ; |
| 440 | 581 | |
| 441 | 582 | sf_count_t sf_read_float (SNDFILE *sndfile, float *ptr, sf_count_t items) ; |
| 442 | | −sf_count_t sf_write_float (SNDFILE *sndfile, float *ptr, sf_count_t items) ; |
| 583 | +sf_count_t sf_write_float (SNDFILE *sndfile, const float *ptr, sf_count_t items) ; |
| 443 | 584 | |
| 444 | 585 | sf_count_t sf_read_double (SNDFILE *sndfile, double *ptr, sf_count_t items) ; |
| 445 | | −sf_count_t sf_write_double (SNDFILE *sndfile, double *ptr, sf_count_t items) ; |
| 586 | +sf_count_t sf_write_double (SNDFILE *sndfile, const double *ptr, sf_count_t items) ; |
| 446 | 587 | |
| 447 | 588 | /* Close the SNDFILE and clean up all memory allocations associated with this |
| 448 | 589 | ** file. |
| @@ -451,17 +592,15 @@ sf_count_t sf_write_double (SNDFILE *sndfile, double *ptr, sf_count_t items) ; · 2 unmodified lines |
| 451 | 592 | |
| 452 | 593 | int sf_close (SNDFILE *sndfile) ; |
| 453 | 594 | |
| 595 | +/* If the file is opened SFM_WRITE or SFM_RDWR, call fsync() on the file |
| 596 | +** to force the writing of data to disk. If the file is opened SFM_READ |
| 597 | +** no action is taken. |
| 598 | +*/ |
| 599 | + |
| 600 | +void sf_write_sync (SNDFILE *sndfile) ; |
| 601 | + |
| 454 | 602 | #ifdef __cplusplus |
| 455 | 603 | } /* extern "C" */ |
| 456 | 604 | #endif /* __cplusplus */ |
| 457 | 605 | |
| 458 | 606 | #endif /* SNDFILE_H */ |
| 459 | | − |
| 460 | | −/* |
| 461 | | −** Do not edit or modify anything in this comment block. |
| 462 | | −** The arch-tag line is a file identity tag for the GNU Arch |
| 463 | | −** revision control system. |
| 464 | | −** |
| 465 | | −** arch-tag: 906bb197-18f2-4f66-a395-b4722bab5114 |
| 466 | | −*/ |
| 467 | | − |