History

Preliminary Win32 updates.

Erik de Castro Lopo committed 18 years ago

Commit bf3d57b1 parent a58d4345 files · +230 −96Browse files

Unified · Split

5 files
  1. ChangeLog +3 −0
  2. Make.bat +0 −9
  3. Win32/Makefile.am +0 −7
  4. Win32/config.h +23 −15
  5. Win32/sndfile.h +204 −65
ChangeLog+3−0
@@ -3,6 +3,9 @@ · 2 unmodified lines
3 * src/* tests/*3 * src/* tests/*
4 Remove all traces of old SRC_OLD_SINC_* converters.4 Remove all traces of old SRC_OLD_SINC_* converters.
5 5
6 * Make.bat Win32/*
7 Preliminary Win32 updates.
8
6 * configure.ac9 * configure.ac
7 Bump version to 0.1.3.10 Bump version to 0.1.3.
8 11
Make.bat+0−9
@@ -20,12 +20,3 @@ goto END · 19 unmodified lines
20 20
21:END21:END
22 22
23goto skipArchTag
24
25 Do not edit or modify anything in this comment block.
26 The arch-tag line is a file identity tag for the GNU Arch
27 revision control system.
28
29 arch-tag: 8700080b-8d9a-4852-ad8a-8ecd027f1f61
30
31:skipArchTag
Win32/Makefile.am+0−7
@@ -1,9 +1,2 @@
1EXTRA_DIST = Makefile.msvc config.h unistd.h unistd.h libsamplerate.def1EXTRA_DIST = Makefile.msvc config.h unistd.h unistd.h libsamplerate.def
2 2
3
4## Do not edit or modify anything in this comment block.
5## The arch-tag line is a file identity tag for the GNU Arch
6## revision control system.
7##
8## arch-tag: fcba51ab-858b-462c-9954-66fee32b7f8f
9
Win32/config.h+23−15
@@ -1,5 +1,5 @@
1/*1/*
2** Copyright (C) 2002-2004 Erik de Castro Lopo <erikd@mega-nerd.com>2** Copyright (C) 2002-2008 Erik de Castro Lopo <erikd@mega-nerd.com>
3**3**
4** This program is free software; you can redistribute it and/or modify4** This program is free software; you can redistribute it and/or modify
5** it under the terms of the GNU General Public License as published by5** it under the terms of the GNU General Public License as published by
@@ -53,12 +53,21 @@ · 47 unmodified lines
53/* Target processor clips on positive float to int conversion. */53/* Target processor clips on positive float to int conversion. */
54#define CPU_CLIPS_POSITIVE 054#define CPU_CLIPS_POSITIVE 0
55 55
56/* Target processor is big endian. */
57#define CPU_IS_BIG_ENDIAN 0
58
59/* Target processor is little endian. */
60#define CPU_IS_LITTLE_ENDIAN 1
61
56/* Set to 1 to enable debugging. */62/* Set to 1 to enable debugging. */
57#define ENABLE_DEBUG 063#define ENABLE_DEBUG 0
58 64
59/* Major version of GCC or 3 otherwise. */65/* Major version of GCC or 3 otherwise. */
60/* #undef GCC_MAJOR_VERSION */66/* #undef GCC_MAJOR_VERSION */
61 67
68/* Define to 1 if you have the `alarm' function. */
69/* #undef HAVE_ALARM */
70
62/* Define to 1 if you have the `calloc' function. */71/* Define to 1 if you have the `calloc' function. */
63#define HAVE_CALLOC 172#define HAVE_CALLOC 1
64 73
@@ -68,9 +77,6 @@ · 3 unmodified lines
68/* Define to 1 if you have the <dlfcn.h> header file. */77/* Define to 1 if you have the <dlfcn.h> header file. */
69/* #undef HAVE_DLFCN_H */78/* #undef HAVE_DLFCN_H */
70 79
71/* Set to 1 if you have libfftw3. */
72/* #undef HAVE_FFTW3 */
73
74/* Define to 1 if you have the `floor' function. */80/* Define to 1 if you have the `floor' function. */
75#define HAVE_FLOOR 181#define HAVE_FLOOR 1
76 82
@@ -86,9 +92,15 @@ · 9 unmodified lines
86/* Define to 1 if you have the `efence' library (-lefence). */92/* Define to 1 if you have the `efence' library (-lefence). */
87/* #undef HAVE_LIBEFENCE */93/* #undef HAVE_LIBEFENCE */
88 94
95/* Define to 1 if you have the `fftw' library (-lfftw). */
96/* #undef HAVE_LIBFFTW */
97
89/* Define to 1 if you have the `m' library (-lm). */98/* Define to 1 if you have the `m' library (-lm). */
90/* #undef HAVE_LIBM */99/* #undef HAVE_LIBM */
91 100
101/* Define to 1 if you have the `rfftw' library (-lrfftw). */
102/* #undef HAVE_LIBRFFTW */
103
92/* Define if you have C99's lrint function. */104/* Define if you have C99's lrint function. */
93/* #undef HAVE_LRINT */105/* #undef HAVE_LRINT */
94 106
@@ -107,6 +119,12 @@ · 12 unmodified lines
107/* Define to 1 if you have the <memory.h> header file. */119/* Define to 1 if you have the <memory.h> header file. */
108#define HAVE_MEMORY_H 1120#define HAVE_MEMORY_H 1
109 121
122/* Define if you have signal SIGALRM. */
123/* #undef HAVE_SIGALRM */
124
125/* Define to 1 if you have the `signal' function. */
126/* #undef HAVE_SIGNAL */
127
110/* Set to 1 if you have libsndfile. */128/* Set to 1 if you have libsndfile. */
111#define HAVE_SNDFILE 1129#define HAVE_SNDFILE 1
112 130
@@ -125,9 +143,6 @@ · 12 unmodified lines
125/* Define to 1 if you have the <sys/stat.h> header file. */143/* Define to 1 if you have the <sys/stat.h> header file. */
126#define HAVE_SYS_STAT_H 1144#define HAVE_SYS_STAT_H 1
127 145
128/* Define to 1 if you have the <sys/times.h> header file. */
129/* #undef HAVE_SYS_TIMES_H */
130
131/* Define to 1 if you have the <sys/types.h> header file. */146/* Define to 1 if you have the <sys/types.h> header file. */
132#define HAVE_SYS_TYPES_H 1147#define HAVE_SYS_TYPES_H 1
133 148
@@ -171,12 +186,5 @@ · 37 unmodified lines
171#define STDC_HEADERS 1186#define STDC_HEADERS 1
172 187
173/* Version number of package */188/* Version number of package */
174#define VERSION "0.1.2"189#define VERSION "0.1.3"
175 190
176/*
177** Do not edit or modify anything in this comment block.
178** The arch-tag line is a file identity tag for the GNU Arch
179** revision control system.
180**
181** arch-tag: 7c5a8910-8149-4e89-98ce-be92835e435b
182*/
Win32/sndfile.h+204−65
@@ -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** This program is free software; you can redistribute it and/or modify4** This program is free software; you can redistribute it and/or modify
5** it under the terms of the GNU Lesser General Public License as published by5** it under the terms of the GNU Lesser General Public License as published by
@@ -30,14 +30,7 @@ · 24 unmodified lines
30#define SNDFILE_130#define SNDFILE_1
31 31
32#include <stdio.h>32#include <stdio.h>
33 33#include <sys/types.h>
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
41 34
42#ifdef __cplusplus35#ifdef __cplusplus
43extern "C" {36extern "C" {
@@ -52,7 +45,7 @@ extern "C" { · 8 unmodified lines
52 45
53enum46enum
54{ /* Major formats. */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 SF_FORMAT_AIFF = 0x020000, /* Apple/SGI AIFF format (big endian). */49 SF_FORMAT_AIFF = 0x020000, /* Apple/SGI AIFF format (big endian). */
57 SF_FORMAT_AU = 0x030000, /* Sun/NeXT AU format (big endian). */50 SF_FORMAT_AU = 0x030000, /* Sun/NeXT AU format (big endian). */
58 SF_FORMAT_RAW = 0x040000, /* RAW PCM data. */51 SF_FORMAT_RAW = 0x040000, /* RAW PCM data. */
@@ -68,7 +61,14 @@ enum · 9 unmodified lines
68 SF_FORMAT_XI = 0x0F0000, /* Fasttracker 2 Extended Instrument */61 SF_FORMAT_XI = 0x0F0000, /* Fasttracker 2 Extended Instrument */
69 SF_FORMAT_HTK = 0x100000, /* HMM Tool Kit format */62 SF_FORMAT_HTK = 0x100000, /* HMM Tool Kit format */
70 SF_FORMAT_SDS = 0x110000, /* Midi Sample Dump Standard */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 /* Subtypes from here on. */72 /* Subtypes from here on. */
73 73
74 SF_FORMAT_PCM_S8 = 0x0001, /* Signed 8 bit data */74 SF_FORMAT_PCM_S8 = 0x0001, /* Signed 8 bit data */
@@ -123,11 +123,15 @@ enum · 48 unmodified lines
123enum123enum
124{ SFC_GET_LIB_VERSION = 0x1000,124{ SFC_GET_LIB_VERSION = 0x1000,
125 SFC_GET_LOG_INFO = 0x1001,125 SFC_GET_LOG_INFO = 0x1001,
126 SFC_GET_CURRENT_SF_INFO = 0x1002,
127
126 128
127 SFC_GET_NORM_DOUBLE = 0x1010,129 SFC_GET_NORM_DOUBLE = 0x1010,
128 SFC_GET_NORM_FLOAT = 0x1011,130 SFC_GET_NORM_FLOAT = 0x1011,
129 SFC_SET_NORM_DOUBLE = 0x1012,131 SFC_SET_NORM_DOUBLE = 0x1012,
130 SFC_SET_NORM_FLOAT = 0x1013,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 SFC_GET_SIMPLE_FORMAT_COUNT = 0x1020,136 SFC_GET_SIMPLE_FORMAT_COUNT = 0x1020,
133 SFC_GET_SIMPLE_FORMAT = 0x1021,137 SFC_GET_SIMPLE_FORMAT = 0x1021,
@@ -143,6 +147,8 @@ enum · 9 unmodified lines
143 SFC_CALC_NORM_SIGNAL_MAX = 0x1041,147 SFC_CALC_NORM_SIGNAL_MAX = 0x1041,
144 SFC_CALC_MAX_ALL_CHANNELS = 0x1042,148 SFC_CALC_MAX_ALL_CHANNELS = 0x1042,
145 SFC_CALC_NORM_MAX_ALL_CHANNELS = 0x1043,149 SFC_CALC_NORM_MAX_ALL_CHANNELS = 0x1043,
150 SFC_GET_SIGNAL_MAX = 0x1044,
151 SFC_GET_MAX_ALL_CHANNELS = 0x1045,
146 152
147 SFC_SET_ADD_PEAK_CHUNK = 0x1050,153 SFC_SET_ADD_PEAK_CHUNK = 0x1050,
148 154
@@ -150,7 +156,7 @@ enum · 1 unmodified line
150 SFC_SET_UPDATE_HEADER_AUTO = 0x1061,156 SFC_SET_UPDATE_HEADER_AUTO = 0x1061,
151 157
152 SFC_FILE_TRUNCATE = 0x1080,158 SFC_FILE_TRUNCATE = 0x1080,
153 159
154 SFC_SET_RAW_START_OFFSET = 0x1090,160 SFC_SET_RAW_START_OFFSET = 0x1090,
155 161
156 SFC_SET_DITHER_ON_WRITE = 0x10A0,162 SFC_SET_DITHER_ON_WRITE = 0x10A0,
@@ -160,21 +166,37 @@ enum · 3 unmodified lines
160 SFC_GET_DITHER_INFO = 0x10A3,166 SFC_GET_DITHER_INFO = 0x10A3,
161 167
162 SFC_GET_EMBED_FILE_INFO = 0x10B0,168 SFC_GET_EMBED_FILE_INFO = 0x10B0,
163 169
164 SFC_SET_CLIPPING = 0x10C0,170 SFC_SET_CLIPPING = 0x10C0,
165 SFC_GET_CLIPPING = 0x10C1,171 SFC_GET_CLIPPING = 0x10C1,
166 172
167 SFC_GET_INSTRUMENT = 0x10D0,173 SFC_GET_INSTRUMENT = 0x10D0,
168 SFC_SET_INSTRUMENT = 0x10D1,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 /* Following commands for testing only. */192 /* Following commands for testing only. */
171 SFC_TEST_IEEE_FLOAT_REPLACE = 0x6001,193 SFC_TEST_IEEE_FLOAT_REPLACE = 0x6001,
172 194
173 /*195 /*
174 ** SFC_SET_ADD_* values are deprecated and will disappear at some196 ** 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 197 ** 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. 198 ** including version 1.0.8 to avoid breakage of existng software.
177 ** They currently do nothing and will continue to do nothing. 199 ** They currently do nothing and will continue to do nothing.
178 */200 */
179 SFC_SET_ADD_DITHER_ON_WRITE = 0x1070,201 SFC_SET_ADD_DITHER_ON_WRITE = 0x1070,
180 SFC_SET_ADD_DITHER_ON_READ = 0x1071202 SFC_SET_ADD_DITHER_ON_READ = 0x1071
@@ -193,9 +215,19 @@ enum · 12 unmodified lines
193 SF_STR_SOFTWARE = 0x03,215 SF_STR_SOFTWARE = 0x03,
194 SF_STR_ARTIST = 0x04,216 SF_STR_ARTIST = 0x04,
195 SF_STR_COMMENT = 0x05,217 SF_STR_COMMENT = 0x05,
196 SF_STR_DATE = 0x06218 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
199enum231enum
200{ /* True and false */232{ /* True and false */
201 SF_FALSE = 0,233 SF_FALSE = 0,
@@ -204,33 +236,75 @@ enum · 2 unmodified lines
204 /* Modes for opening files. */236 /* Modes for opening files. */
205 SFM_READ = 0x10,237 SFM_READ = 0x10,
206 SFM_WRITE = 0x20,238 SFM_WRITE = 0x20,
207 SFM_RDWR = 0x30239 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 duration245/* Public error values. These are guaranteed to remain unchanged for the duration
211** of the library major version number. 246** of the library major version number.
212** There are also a large number of private error numbers which are internal to247** There are also a large number of private error numbers which are internal to
213** the library which can change at any time.248** the library which can change at any time.
214*/249*/
215 250
216enum251enum
217{ SF_ERR_NO_ERROR = 0,252{ SF_ERR_NO_ERROR = 0,
218 SF_ERR_UNRECOGNISED_FORMAT = 1,253 SF_ERR_UNRECOGNISED_FORMAT = 1,
219 SF_ERR_SYSTEM = 2254 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
263enum
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/* A SNDFILE* pointer can be passed around much like stdio.h's FILE* pointer. */290/* A SNDFILE* pointer can be passed around much like stdio.h's FILE* pointer. */
223 291
224typedef struct SNDFILE_tag SNDFILE ;292typedef struct SNDFILE_tag SNDFILE ;
225 293
226/* The following typedef is system specific and is defined when libsndfile is.294/* 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), 295** compiled. sf_count_t can be one of loff_t (Linux), off_t (*BSD), off64_t
228** off64_t (Solaris), __int64_t (Win32) etc.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
231typedef __int64 sf_count_t ;300#ifdef _MSCVER
301typedef __int64_t sf_count_t ;
302#define SF_COUNT_MAX 0x7fffffffffffffffi64
303#else
304typedef loff_t sf_count_t ;
305#define SF_COUNT_MAX 0x7FFFFFFFFFFFFFFFLL
306#endif
232 307
233#define SF_COUNT_MAX 0x7FFFFFFFFFFFFFFFi64
234 308
235/* A pointer to a SF_INFO structure is passed to sf_open_read () and filled in.309/* A pointer to a SF_INFO structure is passed to sf_open_read () and filled in.
236** On write, the SF_INFO structure is filled in by the user and passed into310** 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
262typedef struct336typedef struct
263{ int format ;337{ int format ;
264 const char *name ;338 const char *name ;
265 const char *extension ;339 const char *extension ;
266} SF_FORMAT_INFO ;340} SF_FORMAT_INFO ;
267 341
268/*342/*
269** Enums and typedefs for adding dither on read and write. 343** Enums and typedefs for adding dither on read and write.
270** See the html documentation for sf_command(), SFC_SET_DITHER_ON_WRITE 344** See the html documentation for sf_command(), SFC_SET_DITHER_ON_WRITE
271** and SFC_SET_DITHER_ON_READ.345** and SFC_SET_DITHER_ON_READ.
272*/346*/
273 347
@@ -295,26 +369,91 @@ typedef struct · 21 unmodified lines
295 sf_count_t length ;369 sf_count_t length ;
296} SF_EMBED_FILE_INFO ;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
376enum
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
301typedef struct386typedef struct
302{ int basenote ;387{ int gain ;
303 int gain ;388 char basenote, detune ;
304 int sustain_mode ;389 char velocity_lo, velocity_hi ;
305 int sustain_start, sustain_end ;390 char key_lo, key_hi ;
306 int release_mode ;391 int loop_count ;
307 int release_start, reslease_end ;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} SF_INSTRUMENT ;399} SF_INSTRUMENT ;
309 400
310/* sustain_mode and release_mode will be one of the following. */
311 401
312enum402
313{ SF_LOOP_NONE = 800,403/* Struct used to retrieve loop information from a file.*/
314 SF_LOOP_FORWARD,404typedef struct
315 SF_LOOP_BACKWARD,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*/
426typedef 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
441typedef sf_count_t (*sf_vio_get_filelen) (void *user_data) ;
442typedef sf_count_t (*sf_vio_seek) (sf_count_t offset, int whence, void *user_data) ;
443typedef sf_count_t (*sf_vio_read) (void *ptr, sf_count_t count, void *user_data) ;
444typedef sf_count_t (*sf_vio_write) (const void *ptr, sf_count_t count, void *user_data) ;
445typedef sf_count_t (*sf_vio_tell) (void *user_data) ;
446
447struct 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
455typedef struct SF_VIRTUAL_IO SF_VIRTUAL_IO ;
456
318/* Open the specified file for read, write or both. On error, this will457/* Open the specified file for read, write or both. On error, this will
319** return a NULL pointer. To find the error number, pass a NULL SNDFILE458** return a NULL pointer. To find the error number, pass a NULL SNDFILE
320** to sf_perror () or sf_error_str ().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** When passed a descriptor like this, the library will assume that the start468** When passed a descriptor like this, the library will assume that the start
330** of file header is at the current file offset. This allows sound files within469** of file header is at the current file offset. This allows sound files within
331** larger container files to be read and/or written.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** NULL SNDFILE to sf_perror () or sf_error_str ().472** NULL SNDFILE to sf_perror () or sf_error_str ().
334** All calls to sf_open_fd() should be matched with a call to sf_close().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
338SNDFILE* sf_open_fd (int fd, int mode, SF_INFO *sfinfo, int close_desc) ;477SNDFILE* 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 479SNDFILE* 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** string using sf_error_number().482** string using sf_error_number().
342*/483*/
343 484
344int sf_error (SNDFILE *sndfile) ;485int 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** the given SNDFILE.488** the given SNDFILE.
348*/489*/
349 490
350const char* sf_strerror (SNDFILE *sndfile) ;491const char* sf_strerror (SNDFILE *sndfile) ;
351 492
352/* sf_error_number () allows the retrieval of the error string for each internal493/* 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
405sf_count_t sf_read_raw (SNDFILE *sndfile, void *ptr, sf_count_t bytes) ;546sf_count_t sf_read_raw (SNDFILE *sndfile, void *ptr, sf_count_t bytes) ;
406sf_count_t sf_write_raw (SNDFILE *sndfile, void *ptr, sf_count_t bytes) ;547sf_count_t sf_write_raw (SNDFILE *sndfile, const void *ptr, sf_count_t bytes) ;
407 548
408/* Functions for reading and writing the data chunk in terms of frames.549/* Functions for reading and writing the data chunk in terms of frames.
409** The number of items actually read/written = frames * number of channels.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
418sf_count_t sf_readf_short (SNDFILE *sndfile, short *ptr, sf_count_t frames) ;559sf_count_t sf_readf_short (SNDFILE *sndfile, short *ptr, sf_count_t frames) ;
419sf_count_t sf_writef_short (SNDFILE *sndfile, short *ptr, sf_count_t frames) ;560sf_count_t sf_writef_short (SNDFILE *sndfile, const short *ptr, sf_count_t frames) ;
420 561
421sf_count_t sf_readf_int (SNDFILE *sndfile, int *ptr, sf_count_t frames) ;562sf_count_t sf_readf_int (SNDFILE *sndfile, int *ptr, sf_count_t frames) ;
422sf_count_t sf_writef_int (SNDFILE *sndfile, int *ptr, sf_count_t frames) ;563sf_count_t sf_writef_int (SNDFILE *sndfile, const int *ptr, sf_count_t frames) ;
423 564
424sf_count_t sf_readf_float (SNDFILE *sndfile, float *ptr, sf_count_t frames) ;565sf_count_t sf_readf_float (SNDFILE *sndfile, float *ptr, sf_count_t frames) ;
425sf_count_t sf_writef_float (SNDFILE *sndfile, float *ptr, sf_count_t frames) ;566sf_count_t sf_writef_float (SNDFILE *sndfile, const float *ptr, sf_count_t frames) ;
426 567
427sf_count_t sf_readf_double (SNDFILE *sndfile, double *ptr, sf_count_t frames) ;568sf_count_t sf_readf_double (SNDFILE *sndfile, double *ptr, sf_count_t frames) ;
428sf_count_t sf_writef_double (SNDFILE *sndfile, double *ptr, sf_count_t frames) ;569sf_count_t sf_writef_double (SNDFILE *sndfile, const double *ptr, sf_count_t frames) ;
429 570
430/* Functions for reading and writing the data chunk in terms of items.571/* Functions for reading and writing the data chunk in terms of items.
431** Otherwise similar to above.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
435sf_count_t sf_read_short (SNDFILE *sndfile, short *ptr, sf_count_t items) ;576sf_count_t sf_read_short (SNDFILE *sndfile, short *ptr, sf_count_t items) ;
436sf_count_t sf_write_short (SNDFILE *sndfile, short *ptr, sf_count_t items) ;577sf_count_t sf_write_short (SNDFILE *sndfile, const short *ptr, sf_count_t items) ;
437 578
438sf_count_t sf_read_int (SNDFILE *sndfile, int *ptr, sf_count_t items) ;579sf_count_t sf_read_int (SNDFILE *sndfile, int *ptr, sf_count_t items) ;
439sf_count_t sf_write_int (SNDFILE *sndfile, int *ptr, sf_count_t items) ;580sf_count_t sf_write_int (SNDFILE *sndfile, const int *ptr, sf_count_t items) ;
440 581
441sf_count_t sf_read_float (SNDFILE *sndfile, float *ptr, sf_count_t items) ;582sf_count_t sf_read_float (SNDFILE *sndfile, float *ptr, sf_count_t items) ;
442sf_count_t sf_write_float (SNDFILE *sndfile, float *ptr, sf_count_t items) ;583sf_count_t sf_write_float (SNDFILE *sndfile, const float *ptr, sf_count_t items) ;
443 584
444sf_count_t sf_read_double (SNDFILE *sndfile, double *ptr, sf_count_t items) ;585sf_count_t sf_read_double (SNDFILE *sndfile, double *ptr, sf_count_t items) ;
445sf_count_t sf_write_double (SNDFILE *sndfile, double *ptr, sf_count_t items) ;586sf_count_t sf_write_double (SNDFILE *sndfile, const double *ptr, sf_count_t items) ;
446 587
447/* Close the SNDFILE and clean up all memory allocations associated with this588/* Close the SNDFILE and clean up all memory allocations associated with this
448** file.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
452int sf_close (SNDFILE *sndfile) ;593int 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
600void sf_write_sync (SNDFILE *sndfile) ;
601
454#ifdef __cplusplus602#ifdef __cplusplus
455} /* extern "C" */603} /* extern "C" */
456#endif /* __cplusplus */604#endif /* __cplusplus */
457 605
458#endif /* SNDFILE_H */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

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t