1(*
2 - Translation for sndfile.h version 1.0.17 by Ido Kanner idokan at gmail dot com
3*)
4{
5** Copyright (C) 1999-2006 Erik de Castro Lopo <erikd@mega-nerd.com>
6**
7** This program is free software; you can redistribute it and/or modify
8** it under the terms of the GNU Lesser General Public License as published by
9** the Free Software Foundation; either version 2.1 of the License, or
10** (at your option) any later version.
11**
12** This program is distributed in the hope that it will be useful,
13** but WITHOUT ANY WARRANTY; without even the implied warranty of
14** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15** GNU Lesser General Public License for more details.
16**
17** You should have received a copy of the GNU Lesser General Public License
18** along with this program; if not, write to the Free Software
19** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20
21** sndfile.h -- system-wide definitions
22**
23** API documentation is in the doc/ directory of the source code tarball
24** and at http://www.mega-nerd.com/libsndfile/api.html.
25
26 This is the version 1.0.X header file.
27
28 For the Metrowerks CodeWarrior Pro Compiler (mainly MacOS)
29
30** The following file types can be read and written.
31** A file type would consist of a major type (ie SF_FORMAT_WAV) bitwise
32** ORed with a minor type (ie SF_FORMAT_PCM). SF_FORMAT_TYPEMASK and
33** SF_FORMAT_SUBMASK can be used to separate the major and minor file
34** types.
35}
36{$PACKRECORDS C}{$MACRO ON}
37unit sndfile;
38
39interface
40
41uses
42  ctypes, unixtype;
43
44const
45  sndfilelib = 'sndfile';
46
47const
48  // Major formats.
49  SF_FORMAT_WAV   = $010000;		// Microsoft WAV format (little endian default).
50	SF_FORMAT_AIFF  = $020000;		// Apple/SGI AIFF format (big endian).
51	SF_FORMAT_AU    = $030000;		// Sun/NeXT AU format (big endian).
52	SF_FORMAT_RAW   = $040000;		// RAW PCM data.
53	SF_FORMAT_PAF   = $050000;		// Ensoniq PARIS file format.
54	SF_FORMAT_SVX   = $060000;		// Amiga IFF / SVX8 / SV16 format.
55	SF_FORMAT_NIST  = $070000;		// Sphere NIST format.
56	SF_FORMAT_VOC		= $080000;		// VOC files.
57	SF_FORMAT_IRCAM = $0A0000;		// Berkeley/IRCAM/CARL
58	SF_FORMAT_W64   = $0B0000;		// Sonic Foundry's 64 bit RIFF/WAV
59	SF_FORMAT_MAT4  = $0C0000;		// Matlab (tm) V4.2 / GNU Octave 2.0
60	SF_FORMAT_MAT5  = $0D0000;		// Matlab (tm) V5.0 / GNU Octave 2.1
61	SF_FORMAT_PVF   = $0E0000;		// Portable Voice Format
62	SF_FORMAT_XI    = $0F0000;		// Fasttracker 2 Extended Instrument
63	SF_FORMAT_HTK   = $100000;		// HMM Tool Kit format
64	SF_FORMAT_SDS   = $110000;		// Midi Sample Dump Standard
65	SF_FORMAT_AVR   = $120000;		// Audio Visual Research
66	SF_FORMAT_WAVEX = $130000;		// MS WAVE with WAVEFORMATEX
67	SF_FORMAT_SD2   = $160000;		// Sound Designer 2
68	SF_FORMAT_FLAC  = $170000;		// FLAC lossless file format
69	SF_FORMAT_CAF   = $180000;		// Core Audio File format
70
71const
72  //Subtypes from here on.
73  SF_FORMAT_PCM_S8    = $0001;    // Signed 8 bit data
74	SF_FORMAT_PCM_16    = $0002;    // Signed 16 bit data
75	SF_FORMAT_PCM_24    = $0003;    // Signed 24 bit data
76	SF_FORMAT_PCM_32    = $0004;    // Signed 32 bit data
77
78	SF_FORMAT_PCM_U8    = $0005;    // Unsigned 8 bit data (WAV and RAW only)
79
80	SF_FORMAT_FLOAT     = $0006;    // 32 bit float data
81	SF_FORMAT_DOUBLE    = $0007;    // 64 bit float data
82
83	SF_FORMAT_ULAW      = $0010;    // U-Law encoded.
84	SF_FORMAT_ALAW      = $0011;    // A-Law encoded.
85	SF_FORMAT_IMA_ADPCM = $0012;    // IMA ADPCM.
86	SF_FORMAT_MS_ADPCM  = $0013;    // Microsoft ADPCM.
87
88	SF_FORMAT_GSM610    = $0020;    // GSM 6.10 encoding.
89	SF_FORMAT_VOX_ADPCM = $0021;    // OKI / Dialogix ADPCM
90
91	SF_FORMAT_G721_32   = $0030;    // 32kbs G721 ADPCM encoding.
92	SF_FORMAT_G723_24   = $0031;    // 24kbs G723 ADPCM encoding.
93	SF_FORMAT_G723_40   = $0032;    // 40kbs G723 ADPCM encoding.
94
95	SF_FORMAT_DWVW_12   = $0040;    // 12 bit Delta Width Variable Word encoding.
96	SF_FORMAT_DWVW_16   = $0041;    // 16 bit Delta Width Variable Word encoding.
97	SF_FORMAT_DWVW_24   = $0042;    // 24 bit Delta Width Variable Word encoding.
98	SF_FORMAT_DWVW_N    = $0043;    // N bit Delta Width Variable Word encoding.
99
100	SF_FORMAT_DPCM_8    = $0050;    // 8 bit differential PCM (XI only)
101	SF_FORMAT_DPCM_16   = $0051;    // 16 bit differential PCM (XI only)
102
103const
104  // Endian-ness options.
105	SF_ENDIAN_FILE     = $00000000;  // Default file endian-ness.
106	SF_ENDIAN_LITTLE   = $10000000;  // Force little endian-ness.
107	SF_ENDIAN_BIG      = $20000000;  // Force big endian-ness.
108	SF_ENDIAN_CPU      = $30000000;  // Force CPU endian-ness.
109
110	SF_FORMAT_SUBMASK  = $0000FFFF;
111	SF_FORMAT_TYPEMASK = $0FFF0000;
112	SF_FORMAT_ENDMASK  = $30000000;
113
114{
115** The following are the valid command numbers for the sf_command()
116** interface.  The use of these commands is documented in the file
117** command.html in the doc directory of the source code distribution.
118}
119const
120  SFC_GET_LIB_VERSION            = $1000;
121	SFC_GET_LOG_INFO               = $1001;
122
123	SFC_GET_NORM_DOUBLE            = $1010;
124	SFC_GET_NORM_FLOAT             = $1011;
125	SFC_SET_NORM_DOUBLE            = $1012;
126	SFC_SET_NORM_FLOAT             = $1013;
127	SFC_SET_SCALE_FLOAT_INT_READ   = $1014;
128
129	SFC_GET_SIMPLE_FORMAT_COUNT    = $1020;
130	SFC_GET_SIMPLE_FORMAT          = $1021;
131
132	SFC_GET_FORMAT_INFO            = $1028;
133
134	SFC_GET_FORMAT_MAJOR_COUNT     = $1030;
135	SFC_GET_FORMAT_MAJOR           = $1031;
136	SFC_GET_FORMAT_SUBTYPE_COUNT   = $1032;
137	SFC_GET_FORMAT_SUBTYPE         = $1033;
138
139	SFC_CALC_SIGNAL_MAX            = $1040;
140	SFC_CALC_NORM_SIGNAL_MAX       = $1041;
141	SFC_CALC_MAX_ALL_CHANNELS      = $1042;
142	SFC_CALC_NORM_MAX_ALL_CHANNELS = $1043;
143	SFC_GET_SIGNAL_MAX             = $1044;
144	SFC_GET_MAX_ALL_CHANNELS       = $1045;
145
146	SFC_SET_ADD_PEAK_CHUNK         = $1050;
147
148	SFC_UPDATE_HEADER_NOW          = $1060;
149	SFC_SET_UPDATE_HEADER_AUTO     = $1061;
150
151	SFC_FILE_TRUNCATE	             = $1080;
152
153	SFC_SET_RAW_START_OFFSET       = $1090;
154
155	SFC_SET_DITHER_ON_WRITE        = $10A0;
156	SFC_SET_DITHER_ON_READ         = $10A1;
157
158	SFC_GET_DITHER_INFO_COUNT      = $10A2;
159	SFC_GET_DITHER_INFO            = $10A3;
160
161	SFC_GET_EMBED_FILE_INFO        = $10B0;
162
163	SFC_SET_CLIPPING               = $10C0;
164	SFC_GET_CLIPPING               = $10C1;
165
166	SFC_GET_INSTRUMENT             = $10D0;
167	SFC_SET_INSTRUMENT             = $10D1;
168
169	SFC_GET_LOOP_INFO              = $10E0;
170
171	SFC_GET_BROADCAST_INFO         = $10F0;
172	SFC_SET_BROADCAST_INFO         = $10F1;
173
174	// Following commands for testing only.
175	SFC_TEST_IEEE_FLOAT_REPLACE	   = $6001;
176
177  {
178	** SFC_SET_ADD_* values are deprecated and will disappear at some
179	** time in the future. They are guaranteed to be here up to and
180	** including version 1.0.8 to avoid breakage of existng software.
181	** They currently do nothing and will continue to do nothing.
182  }
183	SFC_SET_ADD_DITHER_ON_WRITE	   = $1070;
184	SFC_SET_ADD_DITHER_ON_READ     = $1071;
185
186{
187** String types that can be set and read from files. Not all file types
188** support this and even the file types which support one, may not support
189** all string types.
190}
191const
192  SF_STR_TITLE     = $01;
193	SF_STR_COPYRIGHT = $02;
194	SF_STR_SOFTWARE  = $03;
195	SF_STR_ARTIST    = $04;
196	SF_STR_COMMENT   = $05;
197	SF_STR_DATE      = $06;
198
199{
200** Use the following as the start and end index when doing metadata
201** transcoding.
202}
203  SF_STR_FIRST     = SF_STR_TITLE;
204  SF_STR_LAST      = SF_STR_DATE;
205
206const
207  // True and false
208  SF_FALSE = 0;
209  SF_TRUE  = 1;
210
211const
212  // Modes for opening files.
213  SFM_READ  = $10;
214	SFM_WRITE = $20;
215	SFM_RDWR  = $30;
216
217{
218** Public error values. These are guaranteed to remain unchanged for the duration
219** of the library major version number.
220** There are also a large number of private error numbers which are internal to
221** the library which can change at any time.
222}
223const
224  SF_ERR_NO_ERROR             = 0;
225	SF_ERR_UNRECOGNISED_FORMAT  = 1;
226	SF_ERR_SYSTEM               = 2;
227	SF_ERR_MALFORMED_FILE       = 3;
228	SF_ERR_UNSUPPORTED_ENCODING = 4;
229
230//A SNDFILE* pointer can be passed around much like stdio.h's FILE* pointer.
231
232type
233  PSNDFILE     = pointer;
234  PSNDFILE_tag = PSNDFILE;
235
236{
237** The following typedef is system specific and is defined when libsndfile is.
238** compiled. sf_count_t can be one of loff_t (Linux), off_t (*BSD),
239** off64_t (Solaris), __int64_t (Win32) etc.
240}
241type
242  Psf_count_t  = ^Tsf_count_t;
243  Tsf_count_t = off_t;
244
245const
246  SF_COUNT_MAX = ctypes.clong($7FFFFFFFFFFFFFFF);
247
248{
249** A pointer to a SF_INFO structure is passed to sf_open_read () and filled in.
250** On write, the SF_INFO structure is filled in by the user and passed into
251** sf_open_write ().
252}
253type
254  PSF_INFO = ^TSF_INFO;
255  TSF_INFO = record
256               frames     : Tsf_count_t; // Used to be called samples.  Changed to avoid confusion.
257               samplerate : ctypes.cint;
258               channels   : ctypes.cint;
259               format     : ctypes.cint;
260               sections   : ctypes.cint;
261               seekable   : ctypes.cint;
262             end;
263
264{
265** The SF_FORMAT_INFO struct is used to retrieve information about the sound
266** file formats libsndfile supports using the sf_command () interface.
267**
268** Using this interface will allow applications to support new file formats
269** and encoding types when libsndfile is upgraded, without requiring
270** re-compilation of the application.
271**
272** Please consult the libsndfile documentation (particularly the information
273** on the sf_command () interface) for examples of its use.
274}
275type
276  PSF_FORMAT_INFO = ^TSF_FORMAT_INFO;
277  TSF_FORMAT_INFO = record
278                      format    : ctypes.cint;
279                      name      : ctypes.pcchar;
280                      extension : ctypes.pcchar;
281                    end;
282
283{
284** Enums and typedefs for adding dither on read and write.
285** See the html documentation for sf_command(), SFC_SET_DITHER_ON_WRITE
286** and SFC_SET_DITHER_ON_READ.
287}
288const
289  SFD_DEFAULT_LEVEL	 = 0;
290	SFD_CUSTOM_LEVEL	 = $40000000;
291
292	SFD_NO_DITHER      = 500;
293	SFD_WHITE          = 501;
294	SFD_TRIANGULAR_PDF = 502;
295
296type
297  PSF_DITHER_INFO = ^TSF_DITHER_INFO;
298  TSF_DITHER_INFO = record
299                      type_ : ctypes.cint;
300                      level : ctypes.cdouble;
301                      name  : ctypes.pcchar;
302                    end;
303
304{
305** Struct used to retrieve information about a file embedded within a
306** larger file. See SFC_GET_EMBED_FILE_INFO.
307}
308type
309  PSF_EMBED_FILE_INFO = ^TSF_EMBED_FILE_INFO;
310  TSF_EMBED_FILE_INFO = record
311                          offset : Tsf_count_t;
312                          length : Tsf_count_t;
313                        end;
314
315// Structs used to retrieve music sample information from a file.
316
317const
318// The loop mode field in SF_INSTRUMENT will be one of the following.
319  SF_LOOP_NONE        = 800;
320  SF_LOOP_FORWARD     = 801;
321  SF_LOOP_BACKWARD    = 802;
322  SF_LOOP_ALTERNATING = 803;
323
324type
325  PSF_INSTRUMENT = ^TSF_INSTRUMENT;
326  TSF_INSTRUMENT = record
327                     gain         : ctypes.cint;
328                     basenote,
329                     detune       : ctypes.cchar;
330                     velocity_lo,
331                     velocity_hi  : ctypes.cchar;
332                     loop_count   : ctypes.cint;
333                     loops        : array[0..15] of record
334                                                      mode  : ctypes.cint;
335                                                      start : ctypes.cuint;
336                                                      end_  : ctypes.cuint;
337                                                      count : ctypes.cuint;
338                                                    end;
339                   end;
340
341// Struct used to retrieve loop information from a file.
342type
343  PSF_LOOP_INFO = ^TSF_LOOP_INFO;
344  TSF_LOOP_INFO = record
345                    time_sig_num : ctypes.cushort;             // any positive integer    > 0
346                    time_sig_den : ctypes.cushort;             // any positive power of 2 > 0
347                    loop_mode    : ctypes.cint;                // see SF_LOOP enum
348
349                    num_beats    : ctypes.cint;                // this is NOT the amount of quarter notes !!!
350                                                               // a full bar of 4/4 is 4 beats
351                                                               // a full bar of 7/8 is 7 beats
352
353                    bpm          : ctypes.cfloat;              // suggestion, as it can be calculated using other fields:
354                                                               // file's lenght, file's sampleRate and our time_sig_den
355                                                               // -> bpms are always the amount of _quarter notes_ per minute
356
357                    root_key     : ctypes.cint;                // MIDI note, or -1 for None
358                    future       : array[0..5] of ctypes.cint;
359                  end;
360
361
362{
363**	Struct used to retrieve broadcast (EBU) information from a file.
364**	Strongly (!) based on EBU "bext" chunk format used in Broadcast WAVE.
365}
366type
367  PSF_BROADCAST_INFO = ^TSF_BROADCAST_INFO;
368  TSF_BROADCAST_INFO = record
369                         description          : array[0..255] of ctypes.cchar;
370                         originator           : array[0..31]  of ctypes.cchar;
371                         originator_reference : array[0..31]  of ctypes.cchar;
372                         origination_date     : array[0..9]   of ctypes.cchar;
373                         origination_time     : array[0..7]   of ctypes.cchar;
374                         time_reference_low   : ctypes.cint;
375                         time_reference_high  : ctypes.cint;
376                         version              : ctypes.cshort;
377                         umid                 : array[0..63]  of ctypes.cchar;
378                         reserved             : array[0..189] of ctypes.cchar;
379                         coding_history_size  : ctypes.cuint;
380                         coding_history       : array[0..255] of ctypes.cchar;
381                       end;
382
383type
384   Tsf_vio_get_filelen = function (user_date : pointer) : Tsf_count_t;           cdecl;
385
386   Tsf_vio_seek        = function (offest : Tsf_count_t; whence : ctypes.cint;
387                                   user_date : pointer) : Tsf_count_t;           cdecl;
388
389   Tsf_vio_read        = function (ptr : Pointer; count : Tsf_count_t;
390                                   user_date : pointer) : Tsf_count_t;           cdecl;
391
392   Tsf_vio_write       = function (ptr : Pointer; count : Tsf_count_t;
393                                   user_date : pointer) : Tsf_count_t;           cdecl;
394
395   Tsf_vio_tell        = function (user_data : Pointer) : Tsf_count_t;           cdecl;
396
397
398   PSF_VIRTUAL_IO = ^TSF_VIRTUAL_IO;
399   TSF_VIRTUAL_IO = record
400                      get_filelen : Tsf_vio_get_filelen;
401                      seek        : Tsf_vio_seek;
402                      read        : Tsf_vio_read;
403                      write       : Tsf_vio_write;
404                      tell        : Tsf_vio_tell;
405                    end;
406
407{
408** Open the specified file for read, write or both. On error, this will
409** return a NULL pointer. To find the error number, pass a NULL SNDFILE
410** to sf_perror () or sf_error_str ().
411** All calls to sf_open() should be matched with a call to sf_close().
412}
413function sf_open (path : pChar; mode : ctypes.cint; sfinfo : PSF_INFO) : PSNDFILE; cdecl;
414  external sndfilelib  name 'sf_open';
415
416{
417** Use the existing file descriptor to create a SNDFILE object. If close_desc
418** is TRUE, the file descriptor will be closed when sf_close() is called. If
419** it is FALSE, the descritor will not be closed.
420** When passed a descriptor like this, the library will assume that the start
421** of file header is at the current file offset. This allows sound files within
422** larger container files to be read and/or written.
423** On error, this will return a NULL pointer. To find the error number, pass a
424** NULL SNDFILE to sf_perror () or sf_error_str ().
425** All calls to sf_open_fd() should be matched with a call to sf_close().
426}
427
428function sf_open_fd (fd     : ctypes.cint; mode       : ctypes.cint;
429                     sfinfo : PSF_INFO;    close_desc : ctypes.cint) : PSNDFILE; cdecl;
430  external sndfilelib name 'sf_open_fd';
431
432function sf_open_virtual (sfvirtual : PSF_VIRTUAL_IO; mode      : ctypes.cint;
433                          sfinfo    : PSF_INFO;       user_data : Pointer) : PSNDFILE; cdecl;
434  external sndfilelib name 'sf_open_virtual';
435
436{
437** sf_error () returns a error number which can be translated to a text
438** string using sf_error_number().
439}
440
441function sf_error (sndfile : PSNDFILE) : ctypes.cint; cdecl;
442  external sndfilelib name 'sf_error';
443
444{
445** sf_strerror () returns to the caller a pointer to the current error message for
446** the given SNDFILE.
447}
448
449function sf_strerror (sndfile : PSNDFILE) : ctypes.pcchar; cdecl;
450  external sndfilelib name 'sf_strerror';
451
452{
453** sf_error_number () allows the retrieval of the error string for each internal
454** error number.
455}
456
457function sf_error_number (errnum : ctypes.cint) : ctypes.pcchar; cdecl;
458  external sndfilelib name 'sf_error_number';
459
460{
461** The following three error functions are deprecated but they will remain in the
462** library for the forseeable future. The function sf_strerror() should be used
463** in their place.
464}
465
466function sf_perror (sndfile : PSNDFILE) : ctypes.cint; cdecl;
467  external sndfilelib name 'sf_perror';
468
469function sf_error_str (sndfile : PSNDFILE; str : ctypes.pcchar;
470                       len     : size_t) : ctypes.cint; cdecl;
471  external sndfilelib name 'sf_error_str';
472
473// Return TRUE if fields of the SF_INFO struct are a valid combination of values.
474
475function sf_command (sndfile : PSNDFILE; command  : ctypes.cint;
476                     data    : Pointer;  datasize : ctypes.cint) : ctypes.cint; cdecl;
477  external sndfilelib name 'sf_command';
478
479// Return TRUE if fields of the SF_INFO struct are a valid combination of values.
480
481function sf_format_check (info : PSF_INFO) : ctypes.cint; cdecl;
482  external sndfilelib name 'sf_format_check';
483
484{
485** Seek within the waveform data chunk of the SNDFILE. sf_seek () uses
486** the same values for whence (SEEK_SET, SEEK_CUR and SEEK_END) as
487** stdio.h function fseek ().
488** An offset of zero with whence set to SEEK_SET will position the
489** read / write pointer to the first data sample.
490** On success sf_seek returns the current position in (multi-channel)
491** samples from the start of the file.
492** Please see the libsndfile documentation for moving the read pointer
493** separately from the write pointer on files open in mode SFM_RDWR.
494** On error all of these functions return -1.
495}
496
497function sf_seek (sndfile : PSNDFILE; frame : Tsf_count_t;
498                  whence  : ctypes.cint) : Tsf_count_t; cdecl;
499  external sndfilelib name 'sf_seek';
500
501{
502** Functions for retrieving and setting string data within sound files.
503** Not all file types support this features; AIFF and WAV do. For both
504** functions, the str_type parameter must be one of the SF_STR_* values
505** defined above.
506** On error, sf_set_string() returns non-zero while sf_get_string()
507** returns NULL.
508}
509
510function sf_set_string (sndfile : PSNDFILE;      str_type : ctypes.cint;
511                        str     : ctypes.pcchar) : ctypes.cint; cdecl;
512  external sndfilelib name 'sf_set_string';
513
514function sf_get_string (sndfile : PSNDFILE; str_type : ctypes.cint) : ctypes.pcchar; cdecl;
515  external sndfilelib name 'sf_get_string';
516
517// Functions for reading/writing the waveform data of a sound file.
518
519function sf_read_raw (sndfile : PSNDFILE; ptr : Pointer;
520                      bytes   : Tsf_count_t) : Tsf_count_t; cdecl;
521  external sndfilelib name 'sf_read_raw';
522
523function sf_write_raw (sndfile : PSNDFILE; ptr : Pointer;
524                      bytes   : Tsf_count_t) : Tsf_count_t; cdecl;
525  external sndfilelib name 'sf_write_raw';
526
527{
528** Functions for reading and writing the data chunk in terms of frames.
529** The number of items actually read/written = frames * number of channels.
530**     sf_xxxx_raw		read/writes the raw data bytes from/to the file
531**     sf_xxxx_short	passes data in the native short format
532**     sf_xxxx_int		passes data in the native int format
533**     sf_xxxx_float	passes data in the native float format
534**     sf_xxxx_double	passes data in the native double format
535** All of these read/write function return number of frames read/written.
536}
537
538function sf_readf_short (sndfile : PSNDFILE; ptr : ctypes.pcshort;
539                         frames  : Tsf_count_t) : Tsf_count_t; cdecl;
540  external sndfilelib name 'sf_readf_short';
541
542function sf_writef_short (sndfile : PSNDFILE; ptr : ctypes.pcshort;
543                          frames  : Tsf_count_t) : Tsf_count_t; cdecl;
544  external sndfilelib name 'sf_writef_short';
545
546function sf_readf_int (sndfile : PSNDFILE; ptr : ctypes.pcint;
547                       frames  : Tsf_count_t) : Tsf_count_t; cdecl;
548  external sndfilelib name 'sf_readf_int';
549
550function sf_writef_int (sndfile : PSNDFILE; ptr : ctypes.pcint;
551                        frames  : Tsf_count_t) : Tsf_count_t; cdecl;
552  external sndfilelib name 'sf_writef_int';
553
554function sf_readf_float (sndfile : PSNDFILE; ptr : ctypes.pcfloat;
555                         frames  : Tsf_count_t) : Tsf_count_t; cdecl;
556  external sndfilelib name 'sf_readf_float';
557
558function sf_writef_float (sndfile : PSNDFILE; ptr : ctypes.pcfloat;
559                          frames  : Tsf_count_t) : Tsf_count_t; cdecl;
560  external sndfilelib name 'sf_writef_float';
561
562function sf_readf_double (sndfile : PSNDFILE; ptr : ctypes.pcdouble;
563                          frames  : Tsf_count_t) : Tsf_count_t; cdecl;
564  external sndfilelib name 'sf_readf_double';
565
566function sf_writef_double (sndfile : PSNDFILE; ptr : ctypes.pcdouble;
567                           frames  : Tsf_count_t) : Tsf_count_t; cdecl;
568  external sndfilelib name 'sf_writef_double';
569
570{
571** Functions for reading and writing the data chunk in terms of items.
572** Otherwise similar to above.
573** All of these read/write function return number of items read/written.
574}
575
576function sf_read_short (sndfile : PSNDFILE; ptr : ctypes.pcshort;
577                        frames  : Tsf_count_t) : Tsf_count_t; cdecl;
578  external sndfilelib name 'sf_read_short';
579
580function sf_write_short (sndfile : PSNDFILE; ptr : ctypes.pcshort;
581                         frames  : Tsf_count_t) : Tsf_count_t; cdecl;
582  external sndfilelib name 'sf_write_short';
583
584function sf_read_int (sndfile : PSNDFILE; ptr : ctypes.pcint;
585                      frames  : Tsf_count_t) : Tsf_count_t; cdecl;
586  external sndfilelib name 'sf_read_int';
587
588function sf_write_int (sndfile : PSNDFILE; ptr : ctypes.pcint;
589                       frames  : Tsf_count_t) : Tsf_count_t; cdecl;
590  external sndfilelib name 'sf_write_int';
591
592function sf_read_float (sndfile : PSNDFILE; ptr : ctypes.pcfloat;
593                        frames  : Tsf_count_t) : Tsf_count_t; cdecl;
594  external sndfilelib name 'sf_read_float';
595
596function sf_write_float (sndfile : PSNDFILE; ptr : ctypes.pcfloat;
597                         frames  : Tsf_count_t) : Tsf_count_t; cdecl;
598  external sndfilelib name 'sf_write_float';
599
600function sf_read_double (sndfile : PSNDFILE; ptr : ctypes.pcdouble;
601                         frames  : Tsf_count_t) : Tsf_count_t; cdecl;
602  external sndfilelib name 'sf_read_double';
603
604function sf_write_double (sndfile : PSNDFILE; ptr : ctypes.pcdouble;
605                          frames  : Tsf_count_t) : Tsf_count_t; cdecl;
606  external sndfilelib name 'sf_write_double';
607
608{
609** Close the SNDFILE and clean up all memory allocations associated with this
610** file.
611** Returns 0 on success, or an error number.
612}
613
614function sf_close (sndfile : PSNDFILE) : ctypes.cint; cdecl;
615  external sndfilelib name 'sf_close';
616
617{
618** If the file is opened SFM_WRITE or SFM_RDWR, call fsync() on the file
619** to force the writing of data to disk. If the file is opened SFM_READ
620** no action is taken.
621}
622
623procedure sf_write_sync (sndfile : PSNDFILE); cdecl;
624  external sndfilelib name 'sf_write_sync';
625
626implementation
627
628end.
629
630