ray 0.1.0.pre1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (370) hide show
  1. data/README.md +235 -32
  2. data/Rakefile +20 -49
  3. data/ext/audio.c +68 -0
  4. data/ext/audio_source.c +197 -0
  5. data/ext/buffer_renderer.c +130 -0
  6. data/ext/color.c +179 -0
  7. data/ext/drawable.c +446 -0
  8. data/ext/event.c +337 -0
  9. data/ext/extconf.rb +80 -6
  10. data/ext/font.c +97 -0
  11. data/ext/gl.c +114 -0
  12. data/ext/gl_buffer.c +224 -0
  13. data/ext/gl_index_buffer.c +202 -0
  14. data/ext/gl_int_array.c +139 -0
  15. data/ext/gl_vertex.c +157 -0
  16. data/ext/image.c +263 -0
  17. data/ext/image_target.c +84 -0
  18. data/ext/input.c +53 -0
  19. data/ext/matrix.c +374 -0
  20. data/ext/music.c +113 -0
  21. data/ext/polygon.c +426 -0
  22. data/ext/ray.c +59 -0
  23. data/ext/ray.h +168 -0
  24. data/ext/rect.c +255 -0
  25. data/ext/say.h +31 -0
  26. data/ext/say_all.h +77 -0
  27. data/ext/say_arial.h +14689 -0
  28. data/ext/say_array.c +124 -0
  29. data/ext/say_array.h +34 -0
  30. data/ext/say_audio.c +64 -0
  31. data/ext/say_audio.h +170 -0
  32. data/ext/say_audio_context.c +40 -0
  33. data/ext/say_audio_source.c +96 -0
  34. data/ext/say_basic_type.c +17 -0
  35. data/ext/say_basic_type.h +47 -0
  36. data/ext/say_buffer.c +277 -0
  37. data/ext/say_buffer.h +37 -0
  38. data/ext/say_buffer_renderer.c +121 -0
  39. data/ext/say_buffer_renderer.h +33 -0
  40. data/ext/say_buffer_slice.c +247 -0
  41. data/ext/say_buffer_slice.h +29 -0
  42. data/ext/say_clean_up.c +14 -0
  43. data/ext/say_context.c +163 -0
  44. data/ext/say_context.h +26 -0
  45. data/ext/say_drawable.c +350 -0
  46. data/ext/say_drawable.h +100 -0
  47. data/ext/say_error.c +27 -0
  48. data/ext/say_event.h +213 -0
  49. data/ext/say_font.c +335 -0
  50. data/ext/say_font.h +51 -0
  51. data/ext/say_image.c +283 -0
  52. data/ext/say_image.h +52 -0
  53. data/ext/say_image_target.c +134 -0
  54. data/ext/say_image_target.h +25 -0
  55. data/ext/say_imp.h +70 -0
  56. data/ext/say_index_buffer.c +90 -0
  57. data/ext/say_index_buffer.h +29 -0
  58. data/ext/say_index_buffer_slice.c +227 -0
  59. data/ext/say_index_buffer_slice.h +28 -0
  60. data/ext/say_input.c +35 -0
  61. data/ext/say_matrix.c +314 -0
  62. data/ext/say_matrix.h +55 -0
  63. data/ext/say_music.c +225 -0
  64. data/ext/say_osx.h +62 -0
  65. data/ext/say_osx_context.h +98 -0
  66. data/ext/say_osx_window.h +766 -0
  67. data/ext/say_polygon.c +358 -0
  68. data/ext/say_polygon.h +62 -0
  69. data/ext/say_renderer.c +42 -0
  70. data/ext/say_renderer.h +22 -0
  71. data/ext/say_shader.c +375 -0
  72. data/ext/say_shader.h +91 -0
  73. data/ext/say_sound.c +67 -0
  74. data/ext/say_sound_buffer.c +96 -0
  75. data/ext/say_sprite.c +273 -0
  76. data/ext/say_sprite.h +53 -0
  77. data/ext/say_string.c +9 -0
  78. data/ext/say_table.c +86 -0
  79. data/ext/say_table.h +24 -0
  80. data/ext/say_target.c +264 -0
  81. data/ext/say_target.h +67 -0
  82. data/ext/say_text.c +441 -0
  83. data/ext/say_text.h +56 -0
  84. data/ext/say_thread.c +46 -0
  85. data/ext/say_thread.h +39 -0
  86. data/ext/say_thread_variable.c +44 -0
  87. data/ext/say_utf.c +62 -0
  88. data/ext/say_vertex_type.c +113 -0
  89. data/ext/say_vertex_type.h +40 -0
  90. data/ext/say_vfile.c +57 -0
  91. data/ext/say_view.c +150 -0
  92. data/ext/say_view.h +44 -0
  93. data/ext/say_win.h +24 -0
  94. data/ext/say_win_context.h +91 -0
  95. data/ext/say_win_window.h +670 -0
  96. data/ext/say_window.c +155 -0
  97. data/ext/say_window.h +43 -0
  98. data/ext/say_x11.h +41 -0
  99. data/ext/say_x11_context.h +96 -0
  100. data/ext/say_x11_window.h +818 -0
  101. data/ext/shader.c +302 -0
  102. data/ext/sound.c +118 -0
  103. data/ext/sound_buffer.c +75 -0
  104. data/ext/sprite.c +241 -0
  105. data/ext/stb_image.h +4971 -0
  106. data/ext/stb_image_write.h +511 -0
  107. data/ext/target.c +184 -0
  108. data/ext/text.c +162 -0
  109. data/ext/utils.c +10 -0
  110. data/ext/vector.c +261 -0
  111. data/ext/vendor/freetype/bin/freetype6.dll +0 -0
  112. data/ext/vendor/freetype/bin/zlib1.dll +0 -0
  113. data/ext/vendor/freetype/include/freetype2/freetype/config/ftconfig.h +350 -0
  114. data/ext/vendor/freetype/include/freetype2/freetype/config/ftheader.h +729 -0
  115. data/ext/vendor/freetype/include/freetype2/freetype/config/ftmodule.h +22 -0
  116. data/ext/vendor/freetype/include/freetype2/freetype/config/ftoption.h +695 -0
  117. data/ext/vendor/freetype/include/freetype2/freetype/config/ftstdlib.h +180 -0
  118. data/ext/vendor/freetype/include/freetype2/freetype/freetype.h +3434 -0
  119. data/ext/vendor/freetype/include/freetype2/freetype/ftbbox.h +94 -0
  120. data/ext/vendor/freetype/include/freetype2/freetype/ftbdf.h +200 -0
  121. data/ext/vendor/freetype/include/freetype2/freetype/ftbitmap.h +206 -0
  122. data/ext/vendor/freetype/include/freetype2/freetype/ftcache.h +1110 -0
  123. data/ext/vendor/freetype/include/freetype2/freetype/ftchapters.h +100 -0
  124. data/ext/vendor/freetype/include/freetype2/freetype/fterrdef.h +239 -0
  125. data/ext/vendor/freetype/include/freetype2/freetype/fterrors.h +206 -0
  126. data/ext/vendor/freetype/include/freetype2/freetype/ftgasp.h +113 -0
  127. data/ext/vendor/freetype/include/freetype2/freetype/ftglyph.h +575 -0
  128. data/ext/vendor/freetype/include/freetype2/freetype/ftgxval.h +358 -0
  129. data/ext/vendor/freetype/include/freetype2/freetype/ftgzip.h +102 -0
  130. data/ext/vendor/freetype/include/freetype2/freetype/ftimage.h +1237 -0
  131. data/ext/vendor/freetype/include/freetype2/freetype/ftincrem.h +331 -0
  132. data/ext/vendor/freetype/include/freetype2/freetype/ftlcdfil.h +166 -0
  133. data/ext/vendor/freetype/include/freetype2/freetype/ftlist.h +273 -0
  134. data/ext/vendor/freetype/include/freetype2/freetype/ftlzw.h +99 -0
  135. data/ext/vendor/freetype/include/freetype2/freetype/ftmac.h +272 -0
  136. data/ext/vendor/freetype/include/freetype2/freetype/ftmm.h +378 -0
  137. data/ext/vendor/freetype/include/freetype2/freetype/ftmodapi.h +406 -0
  138. data/ext/vendor/freetype/include/freetype2/freetype/ftmoderr.h +155 -0
  139. data/ext/vendor/freetype/include/freetype2/freetype/ftotval.h +198 -0
  140. data/ext/vendor/freetype/include/freetype2/freetype/ftoutln.h +526 -0
  141. data/ext/vendor/freetype/include/freetype2/freetype/ftpfr.h +172 -0
  142. data/ext/vendor/freetype/include/freetype2/freetype/ftrender.h +229 -0
  143. data/ext/vendor/freetype/include/freetype2/freetype/ftsizes.h +159 -0
  144. data/ext/vendor/freetype/include/freetype2/freetype/ftsnames.h +170 -0
  145. data/ext/vendor/freetype/include/freetype2/freetype/ftstroke.h +716 -0
  146. data/ext/vendor/freetype/include/freetype2/freetype/ftsynth.h +73 -0
  147. data/ext/vendor/freetype/include/freetype2/freetype/ftsystem.h +346 -0
  148. data/ext/vendor/freetype/include/freetype2/freetype/fttrigon.h +350 -0
  149. data/ext/vendor/freetype/include/freetype2/freetype/fttypes.h +583 -0
  150. data/ext/vendor/freetype/include/freetype2/freetype/ftwinfnt.h +263 -0
  151. data/ext/vendor/freetype/include/freetype2/freetype/ftxf86.h +80 -0
  152. data/ext/vendor/freetype/include/freetype2/freetype/t1tables.h +450 -0
  153. data/ext/vendor/freetype/include/freetype2/freetype/ttnameid.h +1132 -0
  154. data/ext/vendor/freetype/include/freetype2/freetype/tttables.h +756 -0
  155. data/ext/vendor/freetype/include/freetype2/freetype/tttags.h +99 -0
  156. data/ext/vendor/freetype/include/freetype2/freetype/ttunpat.h +59 -0
  157. data/ext/vendor/freetype/include/ft2build.h +61 -0
  158. data/ext/vendor/freetype/lib/freetype-bcc.lib +0 -0
  159. data/ext/vendor/freetype/lib/freetype6.def +249 -0
  160. data/ext/vendor/freetype/lib/libfreetype.dll.a +0 -0
  161. data/ext/vendor/freetype/lib/tmp.freetype.lib +0 -0
  162. data/ext/vendor/glew/LICENSE.txt +73 -0
  163. data/ext/vendor/glew/README.txt +18 -0
  164. data/ext/vendor/glew/include/GL/glew.h +15507 -0
  165. data/ext/vendor/glew/include/GL/glxew.h +1568 -0
  166. data/ext/vendor/glew/include/GL/wglew.h +1361 -0
  167. data/ext/vendor/glew/lib/glew32.dll +0 -0
  168. data/ext/vendor/glew/lib/glew32mx.dll +0 -0
  169. data/ext/vendor/glew/lib/libglew32.a +0 -0
  170. data/ext/vendor/glew/lib/libglew32.dll.a +0 -0
  171. data/ext/vendor/glew/lib/libglew32mx.a +0 -0
  172. data/ext/vendor/glew/lib/libglew32mx.dll.a +0 -0
  173. data/ext/vendor/openal/COPYING +484 -0
  174. data/ext/vendor/openal/Win32/soft_oal.dll +0 -0
  175. data/ext/vendor/openal/include/AL/al.h +724 -0
  176. data/ext/vendor/openal/include/AL/alc.h +277 -0
  177. data/ext/vendor/openal/include/AL/alext.h +165 -0
  178. data/ext/vendor/openal/include/AL/efx-creative.h +3 -0
  179. data/ext/vendor/openal/include/AL/efx.h +758 -0
  180. data/ext/vendor/openal/lib/libOpenAL32.dll.a +0 -0
  181. data/ext/vendor/sndfile/bin/libsndfile-1.dll +0 -0
  182. data/ext/vendor/sndfile/include/sndfile.h +666 -0
  183. data/ext/vendor/sndfile/include/sndfile.hh +422 -0
  184. data/ext/vendor/sndfile/lib/libsndfile-1.def +41 -0
  185. data/ext/vendor/sndfile/lib/libsndfile-1.lib +0 -0
  186. data/ext/vertex.c +96 -0
  187. data/ext/view.c +131 -0
  188. data/ext/window.c +183 -0
  189. data/lib/ray/animation.rb +248 -0
  190. data/lib/ray/animation/block_animation.rb +36 -0
  191. data/lib/ray/animation/circular_motion.rb +57 -0
  192. data/lib/ray/animation/color_variation.rb +102 -0
  193. data/lib/ray/animation/combination.rb +71 -0
  194. data/lib/ray/animation/float_variation.rb +76 -0
  195. data/lib/ray/animation/sequence.rb +65 -0
  196. data/lib/ray/animation/sprite_animation.rb +68 -0
  197. data/lib/ray/animation/vector_variation.rb +111 -0
  198. data/lib/ray/animation_list.rb +50 -0
  199. data/lib/ray/audio.rb +4 -7
  200. data/lib/ray/buffer_renderer.rb +9 -0
  201. data/lib/ray/color.rb +41 -6
  202. data/lib/ray/drawable.rb +34 -9
  203. data/lib/ray/dsl.rb +6 -0
  204. data/lib/ray/dsl/event.rb +1 -1
  205. data/lib/ray/dsl/event_listener.rb +14 -10
  206. data/lib/ray/dsl/event_raiser.rb +5 -2
  207. data/lib/ray/dsl/event_runner.rb +4 -10
  208. data/lib/ray/dsl/event_translator.rb +67 -99
  209. data/lib/ray/dsl/handler.rb +1 -1
  210. data/lib/ray/dsl/matcher.rb +40 -27
  211. data/lib/ray/event.rb +22 -0
  212. data/lib/ray/font.rb +0 -42
  213. data/lib/ray/font_set.rb +3 -7
  214. data/lib/ray/game.rb +33 -73
  215. data/lib/ray/gl/int_array.rb +24 -0
  216. data/lib/ray/gl/vertex.rb +106 -0
  217. data/lib/ray/helper.rb +25 -11
  218. data/lib/ray/image.rb +9 -154
  219. data/lib/ray/image_set.rb +3 -8
  220. data/lib/ray/image_target.rb +12 -0
  221. data/lib/ray/matrix.rb +90 -0
  222. data/lib/ray/music.rb +12 -0
  223. data/lib/ray/polygon.rb +77 -0
  224. data/lib/ray/ray.rb +45 -13
  225. data/lib/ray/rect.rb +14 -3
  226. data/lib/ray/resource_set.rb +18 -35
  227. data/lib/ray/scene.rb +43 -81
  228. data/lib/ray/scene_list.rb +12 -5
  229. data/lib/ray/shader.rb +82 -0
  230. data/lib/ray/sound.rb +18 -0
  231. data/lib/ray/sound_buffer.rb +6 -0
  232. data/lib/ray/sound_buffer_set.rb +32 -0
  233. data/lib/ray/sprite.rb +111 -97
  234. data/lib/ray/target.rb +18 -0
  235. data/lib/ray/text.rb +80 -58
  236. data/lib/ray/text_helper.rb +21 -27
  237. data/lib/ray/turtle.rb +49 -38
  238. data/lib/ray/vector.rb +76 -1
  239. data/lib/ray/vertex.rb +24 -0
  240. data/lib/ray/view.rb +47 -0
  241. data/lib/ray/window.rb +23 -0
  242. data/samples/_media/Beep.wav +0 -0
  243. data/samples/_media/CptnRuby Gem.png +0 -0
  244. data/samples/_media/CptnRuby Map.txt +25 -0
  245. data/samples/_media/CptnRuby Tileset.png +0 -0
  246. data/samples/_media/CptnRuby.png +0 -0
  247. data/samples/_media/Space.png +0 -0
  248. data/samples/_media/Star.png +0 -0
  249. data/samples/_media/Starfighter.png +0 -0
  250. data/samples/animation/chain.rb +33 -0
  251. data/samples/animation/circle.rb +38 -0
  252. data/samples/animation/color.rb +18 -0
  253. data/samples/animation/rotation.rb +17 -0
  254. data/samples/animation/sequence.rb +33 -0
  255. data/samples/animation/shader.rb +65 -0
  256. data/samples/animation/sprite_motion.rb +103 -0
  257. data/samples/animation/translation.rb +23 -0
  258. data/samples/audio/spacial.rb +25 -11
  259. data/samples/buffer/buffer.rb +28 -0
  260. data/samples/buffer/index_buffer.rb +36 -0
  261. data/samples/buffer/renderer.rb +27 -0
  262. data/samples/cptn_ruby/cptn_ruby.rb +279 -0
  263. data/samples/hello_world/hello.rb +2 -2
  264. data/samples/hello_world/hello_dsl.rb +3 -3
  265. data/samples/hello_world/text.rb +2 -2
  266. data/samples/opengl/cube.rb +124 -0
  267. data/samples/opengl/image.rb +36 -16
  268. data/samples/opengl/obj_loader.rb +99 -0
  269. data/samples/opengl/opengl.rb +24 -18
  270. data/samples/opengl/shader.rb +36 -26
  271. data/samples/pong/pong.rb +41 -39
  272. data/samples/{run_scene.rb → scenes/run_scene.rb} +21 -7
  273. data/samples/shaders/geometry.rb +98 -0
  274. data/samples/shaders/scene.rb +19 -12
  275. data/samples/shaders/shaders.rb +34 -17
  276. data/samples/shaders/shape.rb +12 -7
  277. data/samples/sokoban/level_1 +11 -7
  278. data/samples/sokoban/sokoban.rb +36 -63
  279. data/samples/starfighter/starfighter.rb +159 -0
  280. data/samples/test/actual_scene.rb +3 -3
  281. data/samples/test/scene_riot.rb +4 -4
  282. data/samples/test/scene_spec.rb +3 -3
  283. data/samples/test/scene_test_unit.rb +1 -1
  284. data/samples/turtle/byzantium.rb +10 -5
  285. data/samples/turtle/hilbert.rb +16 -11
  286. data/samples/turtle/koch.rb +16 -11
  287. data/samples/turtle/mandala.rb +43 -38
  288. data/samples/turtle/tree.rb +13 -8
  289. data/samples/view/resize.rb +26 -0
  290. data/samples/view/view.rb +35 -0
  291. data/samples/window/all_events.rb +44 -0
  292. data/samples/window/change_title.rb +16 -0
  293. data/samples/window/fullscreen.rb +18 -0
  294. data/samples/window/get_pixel.rb +29 -0
  295. data/samples/window/icon.rb +88 -0
  296. data/samples/window/input.rb +27 -0
  297. data/samples/window/no_border.rb +16 -0
  298. data/samples/window/resize.rb +24 -0
  299. data/test/animation/color_variation_test.rb +64 -0
  300. data/test/animation/combination_test.rb +35 -0
  301. data/test/animation/float_variation_test.rb +75 -0
  302. data/test/animation/vector_variation_test.rb +123 -0
  303. data/test/animation_list_test.rb +122 -0
  304. data/test/animation_test.rb +83 -0
  305. data/test/audio_test.rb +88 -33
  306. data/test/buffer_renderer_test.rb +38 -0
  307. data/test/color_test.rb +31 -22
  308. data/test/drawable_test.rb +207 -7
  309. data/test/dsl_test.rb +25 -7
  310. data/test/font_test.rb +6 -40
  311. data/test/game_test.rb +76 -0
  312. data/test/gl_buffer_test.rb +26 -0
  313. data/test/gl_index_buffer_test.rb +17 -0
  314. data/test/gl_vertex_test.rb +117 -0
  315. data/test/helpers.rb +45 -5
  316. data/test/image_target_test.rb +19 -0
  317. data/test/image_test.rb +73 -53
  318. data/test/int_array_test.rb +64 -0
  319. data/test/matrix_test.rb +134 -0
  320. data/test/polygon_test.rb +126 -0
  321. data/test/rect_test.rb +6 -8
  322. data/test/res/frag.c +14 -0
  323. data/test/res/frag3d.c +10 -0
  324. data/test/res/frag_gray.c +17 -0
  325. data/test/res/frag_light3d.c +20 -0
  326. data/test/res/light3d.c +20 -0
  327. data/test/res/sprite.png +0 -0
  328. data/test/res/teapot.obj +12831 -0
  329. data/test/res/vert.c +17 -0
  330. data/test/res/vertex3d.c +14 -0
  331. data/test/resource_set_test.rb +8 -45
  332. data/test/run_all.rb +1 -1
  333. data/test/scene_list_test.rb +79 -0
  334. data/test/scene_test.rb +168 -0
  335. data/test/shader_test.rb +58 -0
  336. data/test/sprite_test.rb +46 -41
  337. data/test/target_test.rb +34 -0
  338. data/test/text_test.rb +20 -31
  339. data/test/turtle_test.rb +35 -20
  340. data/test/vector_test.rb +61 -19
  341. data/test/vertex_test.rb +43 -0
  342. data/test/view_test.rb +61 -0
  343. metadata +347 -126
  344. data/.yardopts +0 -4
  345. data/VERSION +0 -1
  346. data/ext/audio.cpp +0 -723
  347. data/ext/color.cpp +0 -159
  348. data/ext/drawable.cpp +0 -91
  349. data/ext/event.cpp +0 -460
  350. data/ext/font.cpp +0 -190
  351. data/ext/image.cpp +0 -733
  352. data/ext/input.cpp +0 -74
  353. data/ext/ray.cpp +0 -168
  354. data/ext/ray.hpp +0 -356
  355. data/ext/rect.cpp +0 -245
  356. data/ext/shader.cpp +0 -169
  357. data/ext/shape.cpp +0 -409
  358. data/ext/sprite.cpp +0 -306
  359. data/ext/text.cpp +0 -181
  360. data/ext/vector.cpp +0 -215
  361. data/guide.md +0 -619
  362. data/lib/ray/input.rb +0 -10
  363. data/lib/ray/music_set.rb +0 -37
  364. data/lib/ray/rmagick.rb +0 -41
  365. data/lib/ray/shape.rb +0 -132
  366. data/lib/ray/sound_set.rb +0 -37
  367. data/samples/opengl/binding.rb +0 -38
  368. data/test/ray_test.rb +0 -25
  369. data/test/shape_test.rb +0 -101
  370. data/yard_ext.rb +0 -63
@@ -0,0 +1,666 @@
1
+ /*
2
+ ** Copyright (C) 1999-2011Erik de Castro Lopo <erikd@mega-nerd.com>
3
+ **
4
+ ** 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 by
6
+ ** the Free Software Foundation; either version 2.1 of the License, or
7
+ ** (at your option) any later version.
8
+ **
9
+ ** This program is distributed in the hope that it will be useful,
10
+ ** but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ ** GNU Lesser General Public License for more details.
13
+ **
14
+ ** You should have received a copy of the GNU Lesser General Public License
15
+ ** along with this program; if not, write to the Free Software
16
+ ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17
+ */
18
+
19
+ /*
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
+ */
25
+
26
+ #ifndef SNDFILE_H
27
+ #define SNDFILE_H
28
+
29
+ /* This is the version 1.0.X header file. */
30
+ #define SNDFILE_1
31
+
32
+ #include <stdio.h>
33
+ #include <sys/types.h>
34
+
35
+ #ifdef __cplusplus
36
+ extern "C" {
37
+ #endif /* __cplusplus */
38
+
39
+ /* The following file types can be read and written.
40
+ ** A file type would consist of a major type (ie SF_FORMAT_WAV) bitwise
41
+ ** ORed with a minor type (ie SF_FORMAT_PCM). SF_FORMAT_TYPEMASK and
42
+ ** SF_FORMAT_SUBMASK can be used to separate the major and minor file
43
+ ** types.
44
+ */
45
+
46
+ enum
47
+ { /* Major formats. */
48
+ SF_FORMAT_WAV = 0x010000, /* Microsoft WAV format (little endian default). */
49
+ SF_FORMAT_AIFF = 0x020000, /* Apple/SGI AIFF format (big endian). */
50
+ SF_FORMAT_AU = 0x030000, /* Sun/NeXT AU format (big endian). */
51
+ SF_FORMAT_RAW = 0x040000, /* RAW PCM data. */
52
+ SF_FORMAT_PAF = 0x050000, /* Ensoniq PARIS file format. */
53
+ SF_FORMAT_SVX = 0x060000, /* Amiga IFF / SVX8 / SV16 format. */
54
+ SF_FORMAT_NIST = 0x070000, /* Sphere NIST format. */
55
+ SF_FORMAT_VOC = 0x080000, /* VOC files. */
56
+ SF_FORMAT_IRCAM = 0x0A0000, /* Berkeley/IRCAM/CARL */
57
+ SF_FORMAT_W64 = 0x0B0000, /* Sonic Foundry's 64 bit RIFF/WAV */
58
+ SF_FORMAT_MAT4 = 0x0C0000, /* Matlab (tm) V4.2 / GNU Octave 2.0 */
59
+ SF_FORMAT_MAT5 = 0x0D0000, /* Matlab (tm) V5.0 / GNU Octave 2.1 */
60
+ SF_FORMAT_PVF = 0x0E0000, /* Portable Voice Format */
61
+ SF_FORMAT_XI = 0x0F0000, /* Fasttracker 2 Extended Instrument */
62
+ SF_FORMAT_HTK = 0x100000, /* HMM Tool Kit format */
63
+ SF_FORMAT_SDS = 0x110000, /* Midi Sample Dump Standard */
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
+ SF_FORMAT_MPC2K = 0x210000, /* Akai MPC 2000 sampler */
72
+ SF_FORMAT_RF64 = 0x220000, /* RF64 WAV file */
73
+
74
+ /* Subtypes from here on. */
75
+
76
+ SF_FORMAT_PCM_S8 = 0x0001, /* Signed 8 bit data */
77
+ SF_FORMAT_PCM_16 = 0x0002, /* Signed 16 bit data */
78
+ SF_FORMAT_PCM_24 = 0x0003, /* Signed 24 bit data */
79
+ SF_FORMAT_PCM_32 = 0x0004, /* Signed 32 bit data */
80
+
81
+ SF_FORMAT_PCM_U8 = 0x0005, /* Unsigned 8 bit data (WAV and RAW only) */
82
+
83
+ SF_FORMAT_FLOAT = 0x0006, /* 32 bit float data */
84
+ SF_FORMAT_DOUBLE = 0x0007, /* 64 bit float data */
85
+
86
+ SF_FORMAT_ULAW = 0x0010, /* U-Law encoded. */
87
+ SF_FORMAT_ALAW = 0x0011, /* A-Law encoded. */
88
+ SF_FORMAT_IMA_ADPCM = 0x0012, /* IMA ADPCM. */
89
+ SF_FORMAT_MS_ADPCM = 0x0013, /* Microsoft ADPCM. */
90
+
91
+ SF_FORMAT_GSM610 = 0x0020, /* GSM 6.10 encoding. */
92
+ SF_FORMAT_VOX_ADPCM = 0x0021, /* OKI / Dialogix ADPCM */
93
+
94
+ SF_FORMAT_G721_32 = 0x0030, /* 32kbs G721 ADPCM encoding. */
95
+ SF_FORMAT_G723_24 = 0x0031, /* 24kbs G723 ADPCM encoding. */
96
+ SF_FORMAT_G723_40 = 0x0032, /* 40kbs G723 ADPCM encoding. */
97
+
98
+ SF_FORMAT_DWVW_12 = 0x0040, /* 12 bit Delta Width Variable Word encoding. */
99
+ SF_FORMAT_DWVW_16 = 0x0041, /* 16 bit Delta Width Variable Word encoding. */
100
+ SF_FORMAT_DWVW_24 = 0x0042, /* 24 bit Delta Width Variable Word encoding. */
101
+ SF_FORMAT_DWVW_N = 0x0043, /* N bit Delta Width Variable Word encoding. */
102
+
103
+ SF_FORMAT_DPCM_8 = 0x0050, /* 8 bit differential PCM (XI only) */
104
+ SF_FORMAT_DPCM_16 = 0x0051, /* 16 bit differential PCM (XI only) */
105
+
106
+ SF_FORMAT_VORBIS = 0x0060, /* Xiph Vorbis encoding. */
107
+
108
+ /* Endian-ness options. */
109
+
110
+ SF_ENDIAN_FILE = 0x00000000, /* Default file endian-ness. */
111
+ SF_ENDIAN_LITTLE = 0x10000000, /* Force little endian-ness. */
112
+ SF_ENDIAN_BIG = 0x20000000, /* Force big endian-ness. */
113
+ SF_ENDIAN_CPU = 0x30000000, /* Force CPU endian-ness. */
114
+
115
+ SF_FORMAT_SUBMASK = 0x0000FFFF,
116
+ SF_FORMAT_TYPEMASK = 0x0FFF0000,
117
+ SF_FORMAT_ENDMASK = 0x30000000
118
+ } ;
119
+
120
+ /*
121
+ ** The following are the valid command numbers for the sf_command()
122
+ ** interface. The use of these commands is documented in the file
123
+ ** command.html in the doc directory of the source code distribution.
124
+ */
125
+
126
+ enum
127
+ { SFC_GET_LIB_VERSION = 0x1000,
128
+ SFC_GET_LOG_INFO = 0x1001,
129
+ SFC_GET_CURRENT_SF_INFO = 0x1002,
130
+
131
+
132
+ SFC_GET_NORM_DOUBLE = 0x1010,
133
+ SFC_GET_NORM_FLOAT = 0x1011,
134
+ SFC_SET_NORM_DOUBLE = 0x1012,
135
+ SFC_SET_NORM_FLOAT = 0x1013,
136
+ SFC_SET_SCALE_FLOAT_INT_READ = 0x1014,
137
+ SFC_SET_SCALE_INT_FLOAT_WRITE = 0x1015,
138
+
139
+ SFC_GET_SIMPLE_FORMAT_COUNT = 0x1020,
140
+ SFC_GET_SIMPLE_FORMAT = 0x1021,
141
+
142
+ SFC_GET_FORMAT_INFO = 0x1028,
143
+
144
+ SFC_GET_FORMAT_MAJOR_COUNT = 0x1030,
145
+ SFC_GET_FORMAT_MAJOR = 0x1031,
146
+ SFC_GET_FORMAT_SUBTYPE_COUNT = 0x1032,
147
+ SFC_GET_FORMAT_SUBTYPE = 0x1033,
148
+
149
+ SFC_CALC_SIGNAL_MAX = 0x1040,
150
+ SFC_CALC_NORM_SIGNAL_MAX = 0x1041,
151
+ SFC_CALC_MAX_ALL_CHANNELS = 0x1042,
152
+ SFC_CALC_NORM_MAX_ALL_CHANNELS = 0x1043,
153
+ SFC_GET_SIGNAL_MAX = 0x1044,
154
+ SFC_GET_MAX_ALL_CHANNELS = 0x1045,
155
+
156
+ SFC_SET_ADD_PEAK_CHUNK = 0x1050,
157
+ SFC_SET_ADD_HEADER_PAD_CHUNK = 0x1051,
158
+
159
+ SFC_UPDATE_HEADER_NOW = 0x1060,
160
+ SFC_SET_UPDATE_HEADER_AUTO = 0x1061,
161
+
162
+ SFC_FILE_TRUNCATE = 0x1080,
163
+
164
+ SFC_SET_RAW_START_OFFSET = 0x1090,
165
+
166
+ SFC_SET_DITHER_ON_WRITE = 0x10A0,
167
+ SFC_SET_DITHER_ON_READ = 0x10A1,
168
+
169
+ SFC_GET_DITHER_INFO_COUNT = 0x10A2,
170
+ SFC_GET_DITHER_INFO = 0x10A3,
171
+
172
+ SFC_GET_EMBED_FILE_INFO = 0x10B0,
173
+
174
+ SFC_SET_CLIPPING = 0x10C0,
175
+ SFC_GET_CLIPPING = 0x10C1,
176
+
177
+ SFC_GET_INSTRUMENT = 0x10D0,
178
+ SFC_SET_INSTRUMENT = 0x10D1,
179
+
180
+ SFC_GET_LOOP_INFO = 0x10E0,
181
+
182
+ SFC_GET_BROADCAST_INFO = 0x10F0,
183
+ SFC_SET_BROADCAST_INFO = 0x10F1,
184
+
185
+ SFC_GET_CHANNEL_MAP_INFO = 0x1100,
186
+ SFC_SET_CHANNEL_MAP_INFO = 0x1101,
187
+
188
+ SFC_RAW_DATA_NEEDS_ENDSWAP = 0x1110,
189
+
190
+ /* Support for Wavex Ambisonics Format */
191
+ SFC_WAVEX_SET_AMBISONIC = 0x1200,
192
+ SFC_WAVEX_GET_AMBISONIC = 0x1201,
193
+
194
+ SFC_SET_VBR_ENCODING_QUALITY = 0x1300,
195
+
196
+ /* Following commands for testing only. */
197
+ SFC_TEST_IEEE_FLOAT_REPLACE = 0x6001,
198
+
199
+ /*
200
+ ** SFC_SET_ADD_* values are deprecated and will disappear at some
201
+ ** time in the future. They are guaranteed to be here up to and
202
+ ** including version 1.0.8 to avoid breakage of existng software.
203
+ ** They currently do nothing and will continue to do nothing.
204
+ */
205
+ SFC_SET_ADD_DITHER_ON_WRITE = 0x1070,
206
+ SFC_SET_ADD_DITHER_ON_READ = 0x1071
207
+ } ;
208
+
209
+
210
+ /*
211
+ ** String types that can be set and read from files. Not all file types
212
+ ** support this and even the file types which support one, may not support
213
+ ** all string types.
214
+ */
215
+
216
+ enum
217
+ { SF_STR_TITLE = 0x01,
218
+ SF_STR_COPYRIGHT = 0x02,
219
+ SF_STR_SOFTWARE = 0x03,
220
+ SF_STR_ARTIST = 0x04,
221
+ SF_STR_COMMENT = 0x05,
222
+ SF_STR_DATE = 0x06,
223
+ SF_STR_ALBUM = 0x07,
224
+ SF_STR_LICENSE = 0x08,
225
+ SF_STR_TRACKNUMBER = 0x09,
226
+ SF_STR_GENRE = 0x10
227
+ } ;
228
+
229
+ /*
230
+ ** Use the following as the start and end index when doing metadata
231
+ ** transcoding.
232
+ */
233
+
234
+ #define SF_STR_FIRST SF_STR_TITLE
235
+ #define SF_STR_LAST SF_STR_LICENSE
236
+
237
+ enum
238
+ { /* True and false */
239
+ SF_FALSE = 0,
240
+ SF_TRUE = 1,
241
+
242
+ /* Modes for opening files. */
243
+ SFM_READ = 0x10,
244
+ SFM_WRITE = 0x20,
245
+ SFM_RDWR = 0x30,
246
+
247
+ SF_AMBISONIC_NONE = 0x40,
248
+ SF_AMBISONIC_B_FORMAT = 0x41
249
+ } ;
250
+
251
+ /* Public error values. These are guaranteed to remain unchanged for the duration
252
+ ** of the library major version number.
253
+ ** There are also a large number of private error numbers which are internal to
254
+ ** the library which can change at any time.
255
+ */
256
+
257
+ enum
258
+ { SF_ERR_NO_ERROR = 0,
259
+ SF_ERR_UNRECOGNISED_FORMAT = 1,
260
+ SF_ERR_SYSTEM = 2,
261
+ SF_ERR_MALFORMED_FILE = 3,
262
+ SF_ERR_UNSUPPORTED_ENCODING = 4
263
+ } ;
264
+
265
+
266
+ /* Channel map values (used with SFC_SET/GET_CHANNEL_MAP).
267
+ */
268
+
269
+ enum
270
+ { SF_CHANNEL_MAP_INVALID = 0,
271
+ SF_CHANNEL_MAP_MONO = 1,
272
+ SF_CHANNEL_MAP_LEFT, /* Apple calls this 'Left' */
273
+ SF_CHANNEL_MAP_RIGHT, /* Apple calls this 'Right' */
274
+ SF_CHANNEL_MAP_CENTER, /* Apple calls this 'Center' */
275
+ SF_CHANNEL_MAP_FRONT_LEFT,
276
+ SF_CHANNEL_MAP_FRONT_RIGHT,
277
+ SF_CHANNEL_MAP_FRONT_CENTER,
278
+ SF_CHANNEL_MAP_REAR_CENTER, /* Apple calls this 'Center Surround', Msft calls this 'Back Center' */
279
+ SF_CHANNEL_MAP_REAR_LEFT, /* Apple calls this 'Left Surround', Msft calls this 'Back Left' */
280
+ SF_CHANNEL_MAP_REAR_RIGHT, /* Apple calls this 'Right Surround', Msft calls this 'Back Right' */
281
+ SF_CHANNEL_MAP_LFE, /* Apple calls this 'LFEScreen', Msft calls this 'Low Frequency' */
282
+ SF_CHANNEL_MAP_FRONT_LEFT_OF_CENTER, /* Apple calls this 'Left Center' */
283
+ SF_CHANNEL_MAP_FRONT_RIGHT_OF_CENTER, /* Apple calls this 'Right Center */
284
+ SF_CHANNEL_MAP_SIDE_LEFT, /* Apple calls this 'Left Surround Direct' */
285
+ SF_CHANNEL_MAP_SIDE_RIGHT, /* Apple calls this 'Right Surround Direct' */
286
+ SF_CHANNEL_MAP_TOP_CENTER, /* Apple calls this 'Top Center Surround' */
287
+ SF_CHANNEL_MAP_TOP_FRONT_LEFT, /* Apple calls this 'Vertical Height Left' */
288
+ SF_CHANNEL_MAP_TOP_FRONT_RIGHT, /* Apple calls this 'Vertical Height Right' */
289
+ SF_CHANNEL_MAP_TOP_FRONT_CENTER, /* Apple calls this 'Vertical Height Center' */
290
+ SF_CHANNEL_MAP_TOP_REAR_LEFT, /* Apple and MS call this 'Top Back Left' */
291
+ SF_CHANNEL_MAP_TOP_REAR_RIGHT, /* Apple and MS call this 'Top Back Right' */
292
+ SF_CHANNEL_MAP_TOP_REAR_CENTER, /* Apple and MS call this 'Top Back Center' */
293
+
294
+ SF_CHANNEL_MAP_AMBISONIC_B_W,
295
+ SF_CHANNEL_MAP_AMBISONIC_B_X,
296
+ SF_CHANNEL_MAP_AMBISONIC_B_Y,
297
+ SF_CHANNEL_MAP_AMBISONIC_B_Z,
298
+
299
+ SF_CHANNEL_MAP_MAX
300
+ } ;
301
+
302
+
303
+ /* A SNDFILE* pointer can be passed around much like stdio.h's FILE* pointer. */
304
+
305
+ typedef struct SNDFILE_tag SNDFILE ;
306
+
307
+ /* The following typedef is system specific and is defined when libsndfile is
308
+ ** compiled. sf_count_t will be a 64 bit value when the underlying OS allows
309
+ ** 64 bit file offsets.
310
+ ** On windows, we need to allow the same header file to be compiler by both GCC
311
+ ** and the Microsoft compiler.
312
+ */
313
+
314
+ #if (defined (_MSCVER) || defined (_MSC_VER))
315
+ typedef __int64 sf_count_t ;
316
+ #define SF_COUNT_MAX 0x7fffffffffffffffi64
317
+ #else
318
+ typedef __int64 sf_count_t ;
319
+ #define SF_COUNT_MAX 0x7FFFFFFFFFFFFFFFLL
320
+ #endif
321
+
322
+
323
+ /* A pointer to a SF_INFO structure is passed to sf_open () and filled in.
324
+ ** On write, the SF_INFO structure is filled in by the user and passed into
325
+ ** sf_open ().
326
+ */
327
+
328
+ struct SF_INFO
329
+ { sf_count_t frames ; /* Used to be called samples. Changed to avoid confusion. */
330
+ int samplerate ;
331
+ int channels ;
332
+ int format ;
333
+ int sections ;
334
+ int seekable ;
335
+ } ;
336
+
337
+ typedef struct SF_INFO SF_INFO ;
338
+
339
+ /* The SF_FORMAT_INFO struct is used to retrieve information about the sound
340
+ ** file formats libsndfile supports using the sf_command () interface.
341
+ **
342
+ ** Using this interface will allow applications to support new file formats
343
+ ** and encoding types when libsndfile is upgraded, without requiring
344
+ ** re-compilation of the application.
345
+ **
346
+ ** Please consult the libsndfile documentation (particularly the information
347
+ ** on the sf_command () interface) for examples of its use.
348
+ */
349
+
350
+ typedef struct
351
+ { int format ;
352
+ const char *name ;
353
+ const char *extension ;
354
+ } SF_FORMAT_INFO ;
355
+
356
+ /*
357
+ ** Enums and typedefs for adding dither on read and write.
358
+ ** See the html documentation for sf_command(), SFC_SET_DITHER_ON_WRITE
359
+ ** and SFC_SET_DITHER_ON_READ.
360
+ */
361
+
362
+ enum
363
+ { SFD_DEFAULT_LEVEL = 0,
364
+ SFD_CUSTOM_LEVEL = 0x40000000,
365
+
366
+ SFD_NO_DITHER = 500,
367
+ SFD_WHITE = 501,
368
+ SFD_TRIANGULAR_PDF = 502
369
+ } ;
370
+
371
+ typedef struct
372
+ { int type ;
373
+ double level ;
374
+ const char *name ;
375
+ } SF_DITHER_INFO ;
376
+
377
+ /* Struct used to retrieve information about a file embedded within a
378
+ ** larger file. See SFC_GET_EMBED_FILE_INFO.
379
+ */
380
+
381
+ typedef struct
382
+ { sf_count_t offset ;
383
+ sf_count_t length ;
384
+ } SF_EMBED_FILE_INFO ;
385
+
386
+ /*
387
+ ** Structs used to retrieve music sample information from a file.
388
+ */
389
+
390
+ enum
391
+ { /*
392
+ ** The loop mode field in SF_INSTRUMENT will be one of the following.
393
+ */
394
+ SF_LOOP_NONE = 800,
395
+ SF_LOOP_FORWARD,
396
+ SF_LOOP_BACKWARD,
397
+ SF_LOOP_ALTERNATING
398
+ } ;
399
+
400
+ typedef struct
401
+ { int gain ;
402
+ char basenote, detune ;
403
+ char velocity_lo, velocity_hi ;
404
+ char key_lo, key_hi ;
405
+ int loop_count ;
406
+
407
+ struct
408
+ { int mode ;
409
+ unsigned int start ;
410
+ unsigned int end ;
411
+ unsigned int count ;
412
+ } loops [16] ; /* make variable in a sensible way */
413
+ } SF_INSTRUMENT ;
414
+
415
+
416
+
417
+ /* Struct used to retrieve loop information from a file.*/
418
+ typedef struct
419
+ {
420
+ short time_sig_num ; /* any positive integer > 0 */
421
+ short time_sig_den ; /* any positive power of 2 > 0 */
422
+ int loop_mode ; /* see SF_LOOP enum */
423
+
424
+ int num_beats ; /* this is NOT the amount of quarter notes !!!*/
425
+ /* a full bar of 4/4 is 4 beats */
426
+ /* a full bar of 7/8 is 7 beats */
427
+
428
+ float bpm ; /* suggestion, as it can be calculated using other fields:*/
429
+ /* file's lenght, file's sampleRate and our time_sig_den*/
430
+ /* -> bpms are always the amount of _quarter notes_ per minute */
431
+
432
+ int root_key ; /* MIDI note, or -1 for None */
433
+ int future [6] ;
434
+ } SF_LOOP_INFO ;
435
+
436
+
437
+ /* Struct used to retrieve broadcast (EBU) information from a file.
438
+ ** Strongly (!) based on EBU "bext" chunk format used in Broadcast WAVE.
439
+ */
440
+ #define SF_BROADCAST_INFO_VAR(coding_hist_size) \
441
+ struct \
442
+ { char description [256] ; \
443
+ char originator [32] ; \
444
+ char originator_reference [32] ; \
445
+ char origination_date [10] ; \
446
+ char origination_time [8] ; \
447
+ unsigned int time_reference_low ; \
448
+ unsigned int time_reference_high ; \
449
+ short version ; \
450
+ char umid [64] ; \
451
+ char reserved [190] ; \
452
+ unsigned int coding_history_size ; \
453
+ char coding_history [coding_hist_size] ; \
454
+ }
455
+
456
+ /* SF_BROADCAST_INFO is the above struct with coding_history field of 256 bytes. */
457
+ typedef SF_BROADCAST_INFO_VAR (256) SF_BROADCAST_INFO ;
458
+
459
+
460
+ /* Virtual I/O functionality. */
461
+
462
+ typedef sf_count_t (*sf_vio_get_filelen) (void *user_data) ;
463
+ typedef sf_count_t (*sf_vio_seek) (sf_count_t offset, int whence, void *user_data) ;
464
+ typedef sf_count_t (*sf_vio_read) (void *ptr, sf_count_t count, void *user_data) ;
465
+ typedef sf_count_t (*sf_vio_write) (const void *ptr, sf_count_t count, void *user_data) ;
466
+ typedef sf_count_t (*sf_vio_tell) (void *user_data) ;
467
+
468
+ struct SF_VIRTUAL_IO
469
+ { sf_vio_get_filelen get_filelen ;
470
+ sf_vio_seek seek ;
471
+ sf_vio_read read ;
472
+ sf_vio_write write ;
473
+ sf_vio_tell tell ;
474
+ } ;
475
+
476
+ typedef struct SF_VIRTUAL_IO SF_VIRTUAL_IO ;
477
+
478
+
479
+ /* Open the specified file for read, write or both. On error, this will
480
+ ** return a NULL pointer. To find the error number, pass a NULL SNDFILE
481
+ ** to sf_strerror ().
482
+ ** All calls to sf_open() should be matched with a call to sf_close().
483
+ */
484
+
485
+ SNDFILE* sf_open (const char *path, int mode, SF_INFO *sfinfo) ;
486
+
487
+
488
+ /* Use the existing file descriptor to create a SNDFILE object. If close_desc
489
+ ** is TRUE, the file descriptor will be closed when sf_close() is called. If
490
+ ** it is FALSE, the descritor will not be closed.
491
+ ** When passed a descriptor like this, the library will assume that the start
492
+ ** of file header is at the current file offset. This allows sound files within
493
+ ** larger container files to be read and/or written.
494
+ ** On error, this will return a NULL pointer. To find the error number, pass a
495
+ ** NULL SNDFILE to sf_strerror ().
496
+ ** All calls to sf_open_fd() should be matched with a call to sf_close().
497
+
498
+ */
499
+
500
+ SNDFILE* sf_open_fd (int fd, int mode, SF_INFO *sfinfo, int close_desc) ;
501
+
502
+ SNDFILE* sf_open_virtual (SF_VIRTUAL_IO *sfvirtual, int mode, SF_INFO *sfinfo, void *user_data) ;
503
+
504
+
505
+ /* sf_error () returns a error number which can be translated to a text
506
+ ** string using sf_error_number().
507
+ */
508
+
509
+ int sf_error (SNDFILE *sndfile) ;
510
+
511
+
512
+ /* sf_strerror () returns to the caller a pointer to the current error message for
513
+ ** the given SNDFILE.
514
+ */
515
+
516
+ const char* sf_strerror (SNDFILE *sndfile) ;
517
+
518
+
519
+ /* sf_error_number () allows the retrieval of the error string for each internal
520
+ ** error number.
521
+ **
522
+ */
523
+
524
+ const char* sf_error_number (int errnum) ;
525
+
526
+
527
+ /* The following two error functions are deprecated but they will remain in the
528
+ ** library for the forseeable future. The function sf_strerror() should be used
529
+ ** in their place.
530
+ */
531
+
532
+ int sf_perror (SNDFILE *sndfile) ;
533
+ int sf_error_str (SNDFILE *sndfile, char* str, size_t len) ;
534
+
535
+
536
+ /* Return TRUE if fields of the SF_INFO struct are a valid combination of values. */
537
+
538
+ int sf_command (SNDFILE *sndfile, int command, void *data, int datasize) ;
539
+
540
+
541
+ /* Return TRUE if fields of the SF_INFO struct are a valid combination of values. */
542
+
543
+ int sf_format_check (const SF_INFO *info) ;
544
+
545
+
546
+ /* Seek within the waveform data chunk of the SNDFILE. sf_seek () uses
547
+ ** the same values for whence (SEEK_SET, SEEK_CUR and SEEK_END) as
548
+ ** stdio.h function fseek ().
549
+ ** An offset of zero with whence set to SEEK_SET will position the
550
+ ** read / write pointer to the first data sample.
551
+ ** On success sf_seek returns the current position in (multi-channel)
552
+ ** samples from the start of the file.
553
+ ** Please see the libsndfile documentation for moving the read pointer
554
+ ** separately from the write pointer on files open in mode SFM_RDWR.
555
+ ** On error all of these functions return -1.
556
+ */
557
+
558
+ sf_count_t sf_seek (SNDFILE *sndfile, sf_count_t frames, int whence) ;
559
+
560
+
561
+ /* Functions for retrieving and setting string data within sound files.
562
+ ** Not all file types support this features; AIFF and WAV do. For both
563
+ ** functions, the str_type parameter must be one of the SF_STR_* values
564
+ ** defined above.
565
+ ** On error, sf_set_string() returns non-zero while sf_get_string()
566
+ ** returns NULL.
567
+ */
568
+
569
+ int sf_set_string (SNDFILE *sndfile, int str_type, const char* str) ;
570
+
571
+ const char* sf_get_string (SNDFILE *sndfile, int str_type) ;
572
+
573
+
574
+ /* Return the library version string. */
575
+
576
+ const char * sf_version_string (void) ;
577
+
578
+
579
+ /* Functions for reading/writing the waveform data of a sound file.
580
+ */
581
+
582
+ sf_count_t sf_read_raw (SNDFILE *sndfile, void *ptr, sf_count_t bytes) ;
583
+ sf_count_t sf_write_raw (SNDFILE *sndfile, const void *ptr, sf_count_t bytes) ;
584
+
585
+
586
+ /* Functions for reading and writing the data chunk in terms of frames.
587
+ ** The number of items actually read/written = frames * number of channels.
588
+ ** sf_xxxx_raw read/writes the raw data bytes from/to the file
589
+ ** sf_xxxx_short passes data in the native short format
590
+ ** sf_xxxx_int passes data in the native int format
591
+ ** sf_xxxx_float passes data in the native float format
592
+ ** sf_xxxx_double passes data in the native double format
593
+ ** All of these read/write function return number of frames read/written.
594
+ */
595
+
596
+ sf_count_t sf_readf_short (SNDFILE *sndfile, short *ptr, sf_count_t frames) ;
597
+ sf_count_t sf_writef_short (SNDFILE *sndfile, const short *ptr, sf_count_t frames) ;
598
+
599
+ sf_count_t sf_readf_int (SNDFILE *sndfile, int *ptr, sf_count_t frames) ;
600
+ sf_count_t sf_writef_int (SNDFILE *sndfile, const int *ptr, sf_count_t frames) ;
601
+
602
+ sf_count_t sf_readf_float (SNDFILE *sndfile, float *ptr, sf_count_t frames) ;
603
+ sf_count_t sf_writef_float (SNDFILE *sndfile, const float *ptr, sf_count_t frames) ;
604
+
605
+ sf_count_t sf_readf_double (SNDFILE *sndfile, double *ptr, sf_count_t frames) ;
606
+ sf_count_t sf_writef_double (SNDFILE *sndfile, const double *ptr, sf_count_t frames) ;
607
+
608
+
609
+ /* Functions for reading and writing the data chunk in terms of items.
610
+ ** Otherwise similar to above.
611
+ ** All of these read/write function return number of items read/written.
612
+ */
613
+
614
+ sf_count_t sf_read_short (SNDFILE *sndfile, short *ptr, sf_count_t items) ;
615
+ sf_count_t sf_write_short (SNDFILE *sndfile, const short *ptr, sf_count_t items) ;
616
+
617
+ sf_count_t sf_read_int (SNDFILE *sndfile, int *ptr, sf_count_t items) ;
618
+ sf_count_t sf_write_int (SNDFILE *sndfile, const int *ptr, sf_count_t items) ;
619
+
620
+ sf_count_t sf_read_float (SNDFILE *sndfile, float *ptr, sf_count_t items) ;
621
+ sf_count_t sf_write_float (SNDFILE *sndfile, const float *ptr, sf_count_t items) ;
622
+
623
+ sf_count_t sf_read_double (SNDFILE *sndfile, double *ptr, sf_count_t items) ;
624
+ sf_count_t sf_write_double (SNDFILE *sndfile, const double *ptr, sf_count_t items) ;
625
+
626
+
627
+ /* Close the SNDFILE and clean up all memory allocations associated with this
628
+ ** file.
629
+ ** Returns 0 on success, or an error number.
630
+ */
631
+
632
+ int sf_close (SNDFILE *sndfile) ;
633
+
634
+
635
+ /* If the file is opened SFM_WRITE or SFM_RDWR, call fsync() on the file
636
+ ** to force the writing of data to disk. If the file is opened SFM_READ
637
+ ** no action is taken.
638
+ */
639
+
640
+ void sf_write_sync (SNDFILE *sndfile) ;
641
+
642
+
643
+
644
+ /* The function sf_wchar_open() is Windows Only!
645
+ ** Open a file passing in a Windows Unicode filename. Otherwise, this is
646
+ ** the same as sf_open().
647
+ **
648
+ ** In order for this to work, you need to do the following:
649
+ **
650
+ ** #include <windows.h>
651
+ ** #define ENABLE_SNDFILE_WINDOWS_PROTOTYPES 1
652
+ ** #including <sndfile.h>
653
+ */
654
+
655
+ #if ENABLE_SNDFILE_WINDOWS_PROTOTYPES
656
+ SNDFILE* sf_wchar_open (LPCWSTR wpath, int mode, SF_INFO *sfinfo) ;
657
+ #endif
658
+
659
+
660
+
661
+ #ifdef __cplusplus
662
+ } /* extern "C" */
663
+ #endif /* __cplusplus */
664
+
665
+ #endif /* SNDFILE_H */
666
+