sndfile.pp 24 KB

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