seal 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (421) hide show
  1. data/.yardopts +1 -0
  2. data/LICENSE +13 -0
  3. data/README.md +265 -0
  4. data/ext/seal/extconf.rb +45 -0
  5. data/include/al/al.h +724 -0
  6. data/include/al/alc.h +277 -0
  7. data/include/al/efx-presets.h +402 -0
  8. data/include/al/efx.h +758 -0
  9. data/include/mpg123/mpg123.h +1034 -0
  10. data/include/ogg/config_types.h +25 -0
  11. data/include/ogg/ogg.h +210 -0
  12. data/include/ogg/os_types.h +147 -0
  13. data/include/seal.h +23 -0
  14. data/include/seal/buf.h +143 -0
  15. data/include/seal/core.h +95 -0
  16. data/include/seal/efs.h +112 -0
  17. data/include/seal/err.h +93 -0
  18. data/include/seal/fmt.h +58 -0
  19. data/include/seal/listener.h +103 -0
  20. data/include/seal/raw.h +86 -0
  21. data/include/seal/rvb.h +520 -0
  22. data/include/seal/src.h +413 -0
  23. data/include/seal/stream.h +81 -0
  24. data/include/vorbis/codec.h +243 -0
  25. data/include/vorbis/vorbisfile.h +206 -0
  26. data/mpg123/AUTHORS +150 -0
  27. data/mpg123/COPYING +773 -0
  28. data/mpg123/ChangeLog +3 -0
  29. data/mpg123/INSTALL +111 -0
  30. data/mpg123/Makefile.am +99 -0
  31. data/mpg123/Makefile.in +1043 -0
  32. data/mpg123/NEWS +1200 -0
  33. data/mpg123/NEWS.libmpg123 +133 -0
  34. data/mpg123/README +203 -0
  35. data/mpg123/TODO +38 -0
  36. data/mpg123/aclocal.m4 +1168 -0
  37. data/mpg123/build/config.guess +1530 -0
  38. data/mpg123/build/config.sub +1782 -0
  39. data/mpg123/build/depcomp +707 -0
  40. data/mpg123/build/install-sh +527 -0
  41. data/mpg123/build/ltmain.sh +9655 -0
  42. data/mpg123/build/missing +330 -0
  43. data/mpg123/configure +20267 -0
  44. data/mpg123/configure.ac +2178 -0
  45. data/mpg123/doc/ACCURACY +2 -0
  46. data/mpg123/doc/BENCHMARKING +110 -0
  47. data/mpg123/doc/BUGS +3 -0
  48. data/mpg123/doc/CONTACT +17 -0
  49. data/mpg123/doc/LICENSE +22 -0
  50. data/mpg123/doc/Makefile.am +32 -0
  51. data/mpg123/doc/Makefile.in +490 -0
  52. data/mpg123/doc/PATENTS +39 -0
  53. data/mpg123/doc/README.3DNOW +56 -0
  54. data/mpg123/doc/README.gain +171 -0
  55. data/mpg123/doc/README.remote +218 -0
  56. data/mpg123/doc/ROAD_TO_LGPL +270 -0
  57. data/mpg123/doc/THANKS +13 -0
  58. data/mpg123/doc/TODO +63 -0
  59. data/mpg123/doc/doxy_examples.c +21 -0
  60. data/mpg123/doc/doxygen.conf +41 -0
  61. data/mpg123/doc/doxyhead.xhtml +12 -0
  62. data/mpg123/doc/examples/dump_seekindex.c +41 -0
  63. data/mpg123/doc/examples/extract_frames.c +92 -0
  64. data/mpg123/doc/examples/feedseek.c +238 -0
  65. data/mpg123/doc/examples/id3dump.c +178 -0
  66. data/mpg123/doc/examples/mpg123_to_wav.c +118 -0
  67. data/mpg123/doc/examples/mpglib.c +92 -0
  68. data/mpg123/doc/examples/scan.c +47 -0
  69. data/mpg123/doc/libmpg123_speed.txt +84 -0
  70. data/mpg123/equalize.dat +37 -0
  71. data/mpg123/libmpg123.pc.in +11 -0
  72. data/mpg123/m4/addrconfig.m4 +34 -0
  73. data/mpg123/m4/libtool.m4 +7982 -0
  74. data/mpg123/m4/ltoptions.m4 +384 -0
  75. data/mpg123/m4/ltsugar.m4 +123 -0
  76. data/mpg123/m4/ltversion.m4 +23 -0
  77. data/mpg123/m4/lt~obsolete.m4 +98 -0
  78. data/mpg123/makedll.sh +19 -0
  79. data/mpg123/man1/mpg123.1 +512 -0
  80. data/mpg123/mpg123.spec +68 -0
  81. data/mpg123/mpg123.spec.in +68 -0
  82. data/mpg123/ports/MSVC++/2005/libmpg123/libmpg123.vcproj +741 -0
  83. data/mpg123/ports/MSVC++/2008/dump_seekindex/dump_seekindex.vcproj +194 -0
  84. data/mpg123/ports/MSVC++/2008/feedseek/feedseek.vcproj +195 -0
  85. data/mpg123/ports/MSVC++/2008/libmpg123/libmpg123.vcproj +1357 -0
  86. data/mpg123/ports/MSVC++/2008/mpg123.sln +44 -0
  87. data/mpg123/ports/MSVC++/2008/mpglib/mpglib.vcproj +191 -0
  88. data/mpg123/ports/MSVC++/2008/scan/scan.vcproj +195 -0
  89. data/mpg123/ports/MSVC++/2008clr/2008clr.sln +81 -0
  90. data/mpg123/ports/MSVC++/2008clr/examples/ReplaceReaderclr/Program.cs +435 -0
  91. data/mpg123/ports/MSVC++/2008clr/examples/ReplaceReaderclr/Properties/AssemblyInfo.cs +36 -0
  92. data/mpg123/ports/MSVC++/2008clr/examples/ReplaceReaderclr/ReplaceReaderclr.csproj +72 -0
  93. data/mpg123/ports/MSVC++/2008clr/examples/feedseekclr/Program.cs +331 -0
  94. data/mpg123/ports/MSVC++/2008clr/examples/feedseekclr/Properties/AssemblyInfo.cs +36 -0
  95. data/mpg123/ports/MSVC++/2008clr/examples/feedseekclr/feedseekclr.csproj +71 -0
  96. data/mpg123/ports/MSVC++/2008clr/examples/scanclr/Program.cs +79 -0
  97. data/mpg123/ports/MSVC++/2008clr/examples/scanclr/Properties/AssemblyInfo.cs +36 -0
  98. data/mpg123/ports/MSVC++/2008clr/examples/scanclr/scanclr.csproj +70 -0
  99. data/mpg123/ports/MSVC++/2008clr/mpg123clr/AssemblyInfo.cpp +76 -0
  100. data/mpg123/ports/MSVC++/2008clr/mpg123clr/ReadMe.txt +165 -0
  101. data/mpg123/ports/MSVC++/2008clr/mpg123clr/advanced.cpp +91 -0
  102. data/mpg123/ports/MSVC++/2008clr/mpg123clr/advanced.h +130 -0
  103. data/mpg123/ports/MSVC++/2008clr/mpg123clr/dllmain.cpp +19 -0
  104. data/mpg123/ports/MSVC++/2008clr/mpg123clr/enum.h +218 -0
  105. data/mpg123/ports/MSVC++/2008clr/mpg123clr/error.cpp +48 -0
  106. data/mpg123/ports/MSVC++/2008clr/mpg123clr/error.h +134 -0
  107. data/mpg123/ports/MSVC++/2008clr/mpg123clr/id3v1.cpp +92 -0
  108. data/mpg123/ports/MSVC++/2008clr/mpg123clr/id3v1.h +132 -0
  109. data/mpg123/ports/MSVC++/2008clr/mpg123clr/id3v2.cpp +138 -0
  110. data/mpg123/ports/MSVC++/2008clr/mpg123clr/id3v2.h +152 -0
  111. data/mpg123/ports/MSVC++/2008clr/mpg123clr/mpg123clr.cpp +896 -0
  112. data/mpg123/ports/MSVC++/2008clr/mpg123clr/mpg123clr.h +953 -0
  113. data/mpg123/ports/MSVC++/2008clr/mpg123clr/mpg123clr.rc +102 -0
  114. data/mpg123/ports/MSVC++/2008clr/mpg123clr/mpg123clr.vcproj +328 -0
  115. data/mpg123/ports/MSVC++/2008clr/mpg123clr/resource.h +14 -0
  116. data/mpg123/ports/MSVC++/2008clr/mpg123clr/stdafx.cpp +8 -0
  117. data/mpg123/ports/MSVC++/2008clr/mpg123clr/stdafx.h +38 -0
  118. data/mpg123/ports/MSVC++/2008clr/mpg123clr/string.cpp +166 -0
  119. data/mpg123/ports/MSVC++/2008clr/mpg123clr/string.h +265 -0
  120. data/mpg123/ports/MSVC++/2008clr/mpg123clr/targetver.h +24 -0
  121. data/mpg123/ports/MSVC++/2008clr/mpg123clr/text.cpp +67 -0
  122. data/mpg123/ports/MSVC++/2008clr/mpg123clr/text.h +111 -0
  123. data/mpg123/ports/MSVC++/2010/dump_seekindex/dump_seekindex.vcxproj +90 -0
  124. data/mpg123/ports/MSVC++/2010/dump_seekindex/dump_seekindex.vcxproj.filters +6 -0
  125. data/mpg123/ports/MSVC++/2010/feedseek/feedseek.vcxproj +95 -0
  126. data/mpg123/ports/MSVC++/2010/feedseek/feedseek.vcxproj.filters +6 -0
  127. data/mpg123/ports/MSVC++/2010/libmpg123/libmpg123.vcxproj +960 -0
  128. data/mpg123/ports/MSVC++/2010/libmpg123/libmpg123.vcxproj.user +3 -0
  129. data/mpg123/ports/MSVC++/2010/libmpg123/yasm.exe +0 -0
  130. data/mpg123/ports/MSVC++/2010/mpg123.sln +38 -0
  131. data/mpg123/ports/MSVC++/2010/scan/scan.vcxproj +93 -0
  132. data/mpg123/ports/MSVC++/2010/scan/scan.vcxproj.filters +6 -0
  133. data/mpg123/ports/MSVC++/CMP3Stream/INCLUDE/CORE/CORE_FileIn.H +15 -0
  134. data/mpg123/ports/MSVC++/CMP3Stream/INCLUDE/CORE/SourceFilter_MP3.H +139 -0
  135. data/mpg123/ports/MSVC++/CMP3Stream/INCLUDE/IIEP_Def.H +206 -0
  136. data/mpg123/ports/MSVC++/CMP3Stream/INCLUDE/IIEP_FileIn.H +167 -0
  137. data/mpg123/ports/MSVC++/CMP3Stream/README +4 -0
  138. data/mpg123/ports/MSVC++/CMP3Stream/SOURCE/CORE_FileIn.CPP +462 -0
  139. data/mpg123/ports/MSVC++/CMP3Stream/SOURCE/CORE_Log.CPP +122 -0
  140. data/mpg123/ports/MSVC++/CMP3Stream/SOURCE/CORE_Mutex.CPP +35 -0
  141. data/mpg123/ports/MSVC++/CMP3Stream/SOURCE/SourceFilter_MP3Stream.CPP +586 -0
  142. data/mpg123/ports/MSVC++/CMP3Stream/libMPG123/PLACE_LIBMPG123_SOURCES_HERE +0 -0
  143. data/mpg123/ports/MSVC++/CMP3Stream/libMPG123/libMPG123.vcproj +245 -0
  144. data/mpg123/ports/MSVC++/config.h +35 -0
  145. data/mpg123/ports/MSVC++/examples/feedseek.c +240 -0
  146. data/mpg123/ports/MSVC++/examples/scan.c +47 -0
  147. data/mpg123/ports/MSVC++/mpg123.h +46 -0
  148. data/mpg123/ports/MSVC++/msvc.c +59 -0
  149. data/mpg123/ports/README +26 -0
  150. data/mpg123/ports/Sony_PSP/Makefile.psp +38 -0
  151. data/mpg123/ports/Sony_PSP/README +11 -0
  152. data/mpg123/ports/Sony_PSP/config.h +368 -0
  153. data/mpg123/ports/Sony_PSP/readers.c.patch +2 -0
  154. data/mpg123/ports/Xcode/config.h +197 -0
  155. data/mpg123/ports/Xcode/mpg123.h +17 -0
  156. data/mpg123/ports/Xcode/mpg123.xcodeproj/project.pbxproj +670 -0
  157. data/mpg123/ports/mpg123_.pas +478 -0
  158. data/mpg123/scripts/benchmark-cpu.pl +56 -0
  159. data/mpg123/scripts/tag_lyrics.py +76 -0
  160. data/mpg123/src/Makefile.am +186 -0
  161. data/mpg123/src/Makefile.in +1097 -0
  162. data/mpg123/src/audio.c +725 -0
  163. data/mpg123/src/audio.h +106 -0
  164. data/mpg123/src/buffer.c +312 -0
  165. data/mpg123/src/buffer.h +45 -0
  166. data/mpg123/src/common.c +240 -0
  167. data/mpg123/src/common.h +29 -0
  168. data/mpg123/src/config.h.in +436 -0
  169. data/mpg123/src/control_generic.c +809 -0
  170. data/mpg123/src/equalizer.c +48 -0
  171. data/mpg123/src/genre.c +271 -0
  172. data/mpg123/src/genre.h +15 -0
  173. data/mpg123/src/getlopt.c +148 -0
  174. data/mpg123/src/getlopt.h +77 -0
  175. data/mpg123/src/httpget.c +700 -0
  176. data/mpg123/src/httpget.h +66 -0
  177. data/mpg123/src/legacy_module.c +74 -0
  178. data/mpg123/src/libmpg123/Makefile.am +141 -0
  179. data/mpg123/src/libmpg123/Makefile.in +919 -0
  180. data/mpg123/src/libmpg123/compat.c +138 -0
  181. data/mpg123/src/libmpg123/compat.h +178 -0
  182. data/mpg123/src/libmpg123/dct36_3dnow.S +505 -0
  183. data/mpg123/src/libmpg123/dct36_3dnowext.S +512 -0
  184. data/mpg123/src/libmpg123/dct64.c +174 -0
  185. data/mpg123/src/libmpg123/dct64_3dnow.S +712 -0
  186. data/mpg123/src/libmpg123/dct64_3dnowext.S +714 -0
  187. data/mpg123/src/libmpg123/dct64_altivec.c +315 -0
  188. data/mpg123/src/libmpg123/dct64_i386.c +336 -0
  189. data/mpg123/src/libmpg123/dct64_i486.c +342 -0
  190. data/mpg123/src/libmpg123/dct64_mmx.S +811 -0
  191. data/mpg123/src/libmpg123/dct64_neon.S +297 -0
  192. data/mpg123/src/libmpg123/dct64_neon_float.S +270 -0
  193. data/mpg123/src/libmpg123/dct64_sse.S +454 -0
  194. data/mpg123/src/libmpg123/dct64_sse_float.S +401 -0
  195. data/mpg123/src/libmpg123/dct64_x86_64.S +464 -0
  196. data/mpg123/src/libmpg123/dct64_x86_64_float.S +426 -0
  197. data/mpg123/src/libmpg123/debug.h +171 -0
  198. data/mpg123/src/libmpg123/decode.h +268 -0
  199. data/mpg123/src/libmpg123/dither.c +119 -0
  200. data/mpg123/src/libmpg123/dither.h +23 -0
  201. data/mpg123/src/libmpg123/equalizer.c +17 -0
  202. data/mpg123/src/libmpg123/equalizer_3dnow.S +70 -0
  203. data/mpg123/src/libmpg123/feature.c +106 -0
  204. data/mpg123/src/libmpg123/format.c +521 -0
  205. data/mpg123/src/libmpg123/frame.c +1046 -0
  206. data/mpg123/src/libmpg123/frame.h +410 -0
  207. data/mpg123/src/libmpg123/gapless.h +119 -0
  208. data/mpg123/src/libmpg123/getbits.h +100 -0
  209. data/mpg123/src/libmpg123/getcpuflags.S +91 -0
  210. data/mpg123/src/libmpg123/getcpuflags.h +47 -0
  211. data/mpg123/src/libmpg123/huffman.h +340 -0
  212. data/mpg123/src/libmpg123/icy.c +32 -0
  213. data/mpg123/src/libmpg123/icy.h +38 -0
  214. data/mpg123/src/libmpg123/icy2utf8.c +438 -0
  215. data/mpg123/src/libmpg123/icy2utf8.h +10 -0
  216. data/mpg123/src/libmpg123/id3.c +999 -0
  217. data/mpg123/src/libmpg123/id3.h +43 -0
  218. data/mpg123/src/libmpg123/index.c +134 -0
  219. data/mpg123/src/libmpg123/index.h +59 -0
  220. data/mpg123/src/libmpg123/intsym.h +256 -0
  221. data/mpg123/src/libmpg123/l12_integer_tables.h +278 -0
  222. data/mpg123/src/libmpg123/l2tables.h +164 -0
  223. data/mpg123/src/libmpg123/l3_integer_tables.h +1002 -0
  224. data/mpg123/src/libmpg123/layer1.c +155 -0
  225. data/mpg123/src/libmpg123/layer2.c +371 -0
  226. data/mpg123/src/libmpg123/layer3.c +2053 -0
  227. data/mpg123/src/libmpg123/lfs_alias.c +252 -0
  228. data/mpg123/src/libmpg123/lfs_wrap.c +751 -0
  229. data/mpg123/src/libmpg123/libmpg123.c +1607 -0
  230. data/mpg123/src/libmpg123/mangle.h +74 -0
  231. data/mpg123/src/libmpg123/mpeghead.h +87 -0
  232. data/mpg123/src/libmpg123/mpg123.h.in +1075 -0
  233. data/mpg123/src/libmpg123/mpg123lib_intern.h +338 -0
  234. data/mpg123/src/libmpg123/ntom.c +148 -0
  235. data/mpg123/src/libmpg123/optimize.c +964 -0
  236. data/mpg123/src/libmpg123/optimize.h +219 -0
  237. data/mpg123/src/libmpg123/parse.c +1179 -0
  238. data/mpg123/src/libmpg123/parse.h +25 -0
  239. data/mpg123/src/libmpg123/reader.h +137 -0
  240. data/mpg123/src/libmpg123/readers.c +1235 -0
  241. data/mpg123/src/libmpg123/sample.h +152 -0
  242. data/mpg123/src/libmpg123/stringbuf.c +163 -0
  243. data/mpg123/src/libmpg123/synth.c +816 -0
  244. data/mpg123/src/libmpg123/synth.h +196 -0
  245. data/mpg123/src/libmpg123/synth_3dnow.S +318 -0
  246. data/mpg123/src/libmpg123/synth_3dnowext.S +6 -0
  247. data/mpg123/src/libmpg123/synth_8bit.c +142 -0
  248. data/mpg123/src/libmpg123/synth_8bit.h +86 -0
  249. data/mpg123/src/libmpg123/synth_altivec.c +1057 -0
  250. data/mpg123/src/libmpg123/synth_arm.S +271 -0
  251. data/mpg123/src/libmpg123/synth_arm_accurate.S +287 -0
  252. data/mpg123/src/libmpg123/synth_i486.c +252 -0
  253. data/mpg123/src/libmpg123/synth_i586.S +336 -0
  254. data/mpg123/src/libmpg123/synth_i586_dither.S +375 -0
  255. data/mpg123/src/libmpg123/synth_mmx.S +125 -0
  256. data/mpg123/src/libmpg123/synth_mono.h +64 -0
  257. data/mpg123/src/libmpg123/synth_neon.S +123 -0
  258. data/mpg123/src/libmpg123/synth_neon_accurate.S +173 -0
  259. data/mpg123/src/libmpg123/synth_neon_float.S +149 -0
  260. data/mpg123/src/libmpg123/synth_neon_s32.S +168 -0
  261. data/mpg123/src/libmpg123/synth_ntom.h +213 -0
  262. data/mpg123/src/libmpg123/synth_real.c +404 -0
  263. data/mpg123/src/libmpg123/synth_s32.c +411 -0
  264. data/mpg123/src/libmpg123/synth_sse.S +6 -0
  265. data/mpg123/src/libmpg123/synth_sse3d.h +246 -0
  266. data/mpg123/src/libmpg123/synth_sse_accurate.S +294 -0
  267. data/mpg123/src/libmpg123/synth_sse_float.S +241 -0
  268. data/mpg123/src/libmpg123/synth_sse_s32.S +306 -0
  269. data/mpg123/src/libmpg123/synth_stereo_neon.S +175 -0
  270. data/mpg123/src/libmpg123/synth_stereo_neon_accurate.S +262 -0
  271. data/mpg123/src/libmpg123/synth_stereo_neon_float.S +220 -0
  272. data/mpg123/src/libmpg123/synth_stereo_neon_s32.S +247 -0
  273. data/mpg123/src/libmpg123/synth_stereo_sse_accurate.S +508 -0
  274. data/mpg123/src/libmpg123/synth_stereo_sse_float.S +416 -0
  275. data/mpg123/src/libmpg123/synth_stereo_sse_s32.S +540 -0
  276. data/mpg123/src/libmpg123/synth_stereo_x86_64.S +335 -0
  277. data/mpg123/src/libmpg123/synth_stereo_x86_64_accurate.S +454 -0
  278. data/mpg123/src/libmpg123/synth_stereo_x86_64_float.S +396 -0
  279. data/mpg123/src/libmpg123/synth_stereo_x86_64_s32.S +473 -0
  280. data/mpg123/src/libmpg123/synth_x86_64.S +244 -0
  281. data/mpg123/src/libmpg123/synth_x86_64_accurate.S +301 -0
  282. data/mpg123/src/libmpg123/synth_x86_64_float.S +259 -0
  283. data/mpg123/src/libmpg123/synth_x86_64_s32.S +312 -0
  284. data/mpg123/src/libmpg123/synths.h +52 -0
  285. data/mpg123/src/libmpg123/tabinit.c +294 -0
  286. data/mpg123/src/libmpg123/tabinit_mmx.S +210 -0
  287. data/mpg123/src/libmpg123/testcpu.c +35 -0
  288. data/mpg123/src/libmpg123/true.h +14 -0
  289. data/mpg123/src/local.c +63 -0
  290. data/mpg123/src/local.h +21 -0
  291. data/mpg123/src/metaprint.c +373 -0
  292. data/mpg123/src/metaprint.h +17 -0
  293. data/mpg123/src/module.c +306 -0
  294. data/mpg123/src/module.h +48 -0
  295. data/mpg123/src/mpg123.c +1405 -0
  296. data/mpg123/src/mpg123app.h +171 -0
  297. data/mpg123/src/output/Makefile.am +213 -0
  298. data/mpg123/src/output/Makefile.in +1238 -0
  299. data/mpg123/src/output/aix.c +300 -0
  300. data/mpg123/src/output/alib.c +209 -0
  301. data/mpg123/src/output/alsa.c +297 -0
  302. data/mpg123/src/output/arts.c +117 -0
  303. data/mpg123/src/output/coreaudio.c +370 -0
  304. data/mpg123/src/output/dummy.c +78 -0
  305. data/mpg123/src/output/esd.c +167 -0
  306. data/mpg123/src/output/hp.c +184 -0
  307. data/mpg123/src/output/jack.c +450 -0
  308. data/mpg123/src/output/mint.c +197 -0
  309. data/mpg123/src/output/nas.c +335 -0
  310. data/mpg123/src/output/openal.c +197 -0
  311. data/mpg123/src/output/os2.c +665 -0
  312. data/mpg123/src/output/oss.c +319 -0
  313. data/mpg123/src/output/portaudio.c +255 -0
  314. data/mpg123/src/output/pulse.c +164 -0
  315. data/mpg123/src/output/sdl.c +206 -0
  316. data/mpg123/src/output/sgi.c +213 -0
  317. data/mpg123/src/output/sndio.c +161 -0
  318. data/mpg123/src/output/sun.c +281 -0
  319. data/mpg123/src/output/win32.c +229 -0
  320. data/mpg123/src/playlist.c +596 -0
  321. data/mpg123/src/playlist.h +52 -0
  322. data/mpg123/src/resolver.c +319 -0
  323. data/mpg123/src/resolver.h +25 -0
  324. data/mpg123/src/sfifo.c +146 -0
  325. data/mpg123/src/sfifo.h +95 -0
  326. data/mpg123/src/streamdump.c +74 -0
  327. data/mpg123/src/streamdump.h +20 -0
  328. data/mpg123/src/term.c +479 -0
  329. data/mpg123/src/term.h +81 -0
  330. data/mpg123/src/tests/noise.c +52 -0
  331. data/mpg123/src/tests/plain_id3.c +109 -0
  332. data/mpg123/src/tests/seek_accuracy.c +261 -0
  333. data/mpg123/src/tests/seek_whence.c +56 -0
  334. data/mpg123/src/tests/testtext.h +34 -0
  335. data/mpg123/src/tests/text.c +80 -0
  336. data/mpg123/src/wav.c +464 -0
  337. data/mpg123/src/wavhead.h +68 -0
  338. data/mpg123/src/win32_net.c +599 -0
  339. data/mpg123/src/win32_support.c +191 -0
  340. data/mpg123/src/win32_support.h +152 -0
  341. data/mpg123/src/xfermem.c +321 -0
  342. data/mpg123/src/xfermem.h +74 -0
  343. data/mpg123/windows-builds.sh +137 -0
  344. data/msvc/lib/OpenAL32.lib +0 -0
  345. data/spec/fixtures/heal.ogg +0 -0
  346. data/spec/fixtures/tone_up.wav +0 -0
  347. data/spec/seal/buffer_spec.rb +37 -0
  348. data/spec/seal/core_spec.rb +29 -0
  349. data/spec/seal/effect_slot_spec.rb +38 -0
  350. data/spec/seal/listener_spec.rb +33 -0
  351. data/spec/seal/reverb_spec.rb +51 -0
  352. data/spec/seal/source_spec.rb +370 -0
  353. data/spec/seal/stream_spec.rb +38 -0
  354. data/spec/spec_helper.rb +45 -0
  355. data/spec/support/attribute_examples.rb +75 -0
  356. data/spec/support/audio_object_with_format.rb +27 -0
  357. data/spec/support/movable_object.rb +22 -0
  358. data/src/libogg/bitwise.c +857 -0
  359. data/src/libogg/framing.c +2093 -0
  360. data/src/libvorbis/backends.h +144 -0
  361. data/src/libvorbis/bitrate.c +253 -0
  362. data/src/libvorbis/bitrate.h +59 -0
  363. data/src/libvorbis/block.c +1046 -0
  364. data/src/libvorbis/codebook.c +484 -0
  365. data/src/libvorbis/codebook.h +119 -0
  366. data/src/libvorbis/codec_internal.h +167 -0
  367. data/src/libvorbis/envelope.c +375 -0
  368. data/src/libvorbis/envelope.h +80 -0
  369. data/src/libvorbis/floor0.c +221 -0
  370. data/src/libvorbis/floor1.c +1100 -0
  371. data/src/libvorbis/highlevel.h +58 -0
  372. data/src/libvorbis/info.c +668 -0
  373. data/src/libvorbis/lookup.c +94 -0
  374. data/src/libvorbis/lookup.h +32 -0
  375. data/src/libvorbis/lookup_data.h +192 -0
  376. data/src/libvorbis/lpc.c +160 -0
  377. data/src/libvorbis/lpc.h +29 -0
  378. data/src/libvorbis/lsp.c +456 -0
  379. data/src/libvorbis/lsp.h +28 -0
  380. data/src/libvorbis/mapping0.c +816 -0
  381. data/src/libvorbis/masking.h +785 -0
  382. data/src/libvorbis/mdct.c +563 -0
  383. data/src/libvorbis/mdct.h +71 -0
  384. data/src/libvorbis/misc.h +57 -0
  385. data/src/libvorbis/os.h +186 -0
  386. data/src/libvorbis/psy.c +1206 -0
  387. data/src/libvorbis/psy.h +154 -0
  388. data/src/libvorbis/registry.c +45 -0
  389. data/src/libvorbis/registry.h +32 -0
  390. data/src/libvorbis/res0.c +889 -0
  391. data/src/libvorbis/scales.h +90 -0
  392. data/src/libvorbis/sharedbook.c +579 -0
  393. data/src/libvorbis/smallft.c +1255 -0
  394. data/src/libvorbis/smallft.h +34 -0
  395. data/src/libvorbis/synthesis.c +184 -0
  396. data/src/libvorbis/vorbisfile.c +2337 -0
  397. data/src/libvorbis/window.c +2135 -0
  398. data/src/libvorbis/window.h +26 -0
  399. data/src/rubyext.c +2329 -0
  400. data/src/seal/buf.c +124 -0
  401. data/src/seal/core.c +283 -0
  402. data/src/seal/efs.c +74 -0
  403. data/src/seal/err.c +118 -0
  404. data/src/seal/fmt.c +86 -0
  405. data/src/seal/listener.c +111 -0
  406. data/src/seal/mpg.c +174 -0
  407. data/src/seal/mpg.h +24 -0
  408. data/src/seal/ov.c +180 -0
  409. data/src/seal/ov.h +22 -0
  410. data/src/seal/raw.c +59 -0
  411. data/src/seal/reader.c +102 -0
  412. data/src/seal/reader.h +59 -0
  413. data/src/seal/rvb.c +368 -0
  414. data/src/seal/src.c +654 -0
  415. data/src/seal/stream.c +109 -0
  416. data/src/seal/threading.c +66 -0
  417. data/src/seal/threading.h +20 -0
  418. data/src/seal/wav.c +297 -0
  419. data/src/seal/wav.h +23 -0
  420. data/src/win32api.rb +29 -0
  421. metadata +563 -0
@@ -0,0 +1,26 @@
1
+ /********************************************************************
2
+ * *
3
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
4
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
5
+ * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
6
+ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
7
+ * *
8
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 *
9
+ * by the Xiph.Org Foundation http://www.xiph.org/ *
10
+ * *
11
+ ********************************************************************
12
+
13
+ function: window functions
14
+ last mod: $Id: window.h 13293 2007-07-24 00:09:47Z xiphmont $
15
+
16
+ ********************************************************************/
17
+
18
+ #ifndef _V_WINDOW_
19
+ #define _V_WINDOW_
20
+
21
+ extern float *_vorbis_window_get(int n);
22
+ extern void _vorbis_apply_window(float *d,int *winno,long *blocksizes,
23
+ int lW,int W,int nW);
24
+
25
+
26
+ #endif
@@ -0,0 +1,2329 @@
1
+ /*
2
+ * ruby_binding.c is part of the Scorched End Audio Library (SEAL) and is
3
+ * licensed under the terms of the GNU Lesser General Public License.
4
+ * See COPYING attached with the library.
5
+ */
6
+
7
+ #include <stdlib.h>
8
+ #include <seal.h>
9
+ #include "ruby.h"
10
+
11
+ static const char WAV_SYM[] = "wav";
12
+ static const char OV_SYM[] = "ov";
13
+ static const char MPG_SYM[] = "mpg";
14
+
15
+ static const char UNDETERMINED_SYM[] = "undetermined";
16
+ static const char STATIC_SYM[] = "static";
17
+ static const char STREAMING_SYM[] = "streaming";
18
+
19
+ static const char INITIAL_SYM[] = "initial";
20
+ static const char PLAYING_SYM[] = "playing";
21
+ static const char PAUSED_SYM[] = "paused";
22
+ static const char STOPPED_SYM[] = "stopped";
23
+
24
+ static VALUE mSeal;
25
+ static VALUE eSealError;
26
+
27
+ #define DEFINE_ALLOCATOR(obj) \
28
+ static \
29
+ VALUE \
30
+ alloc_##obj(VALUE klass) \
31
+ { \
32
+ return alloc(klass, sizeof (seal_##obj##_t), free_##obj); \
33
+ }
34
+
35
+ #define DEFINE_DEALLOCATOR(obj) \
36
+ static \
37
+ void \
38
+ free_##obj(void* obj) \
39
+ { \
40
+ free_obj(obj, seal_destroy_##obj); \
41
+ }
42
+
43
+ static
44
+ VALUE
45
+ name2sym(const char* name)
46
+ {
47
+ return ID2SYM(rb_intern(name));
48
+ }
49
+
50
+ static
51
+ void*
52
+ validate_memory(void* memory)
53
+ {
54
+ if (memory == 0)
55
+ rb_raise(eSealError, "%s", seal_get_err_msg(SEAL_CANNOT_ALLOC_MEM));
56
+ return memory;
57
+ }
58
+
59
+ static
60
+ void
61
+ check_seal_err(seal_err_t err)
62
+ {
63
+ if (err != SEAL_OK)
64
+ rb_raise(eSealError, "%s", seal_get_err_msg(err));
65
+ }
66
+
67
+ static
68
+ void
69
+ free_obj(void* obj, void *destroy)
70
+ {
71
+ ((seal_err_t (*)(void*)) destroy)(obj);
72
+ free(obj);
73
+ }
74
+
75
+ DEFINE_DEALLOCATOR(src)
76
+ DEFINE_DEALLOCATOR(buf)
77
+ DEFINE_DEALLOCATOR(rvb)
78
+ DEFINE_DEALLOCATOR(efs)
79
+
80
+ static
81
+ void
82
+ free_stream(void* stream)
83
+ {
84
+ free_obj(stream, seal_close_stream);
85
+ }
86
+
87
+ static
88
+ VALUE
89
+ alloc(VALUE klass, size_t size, void* free)
90
+ {
91
+ void* obj;
92
+
93
+ obj = validate_memory(calloc(1, size));
94
+
95
+ return Data_Wrap_Struct(klass, 0, free, obj);
96
+ }
97
+
98
+ DEFINE_ALLOCATOR(src)
99
+ DEFINE_ALLOCATOR(buf)
100
+ DEFINE_ALLOCATOR(stream)
101
+ DEFINE_ALLOCATOR(rvb)
102
+ DEFINE_ALLOCATOR(efs)
103
+
104
+ static
105
+ void
106
+ extract_3float(VALUE rarr, float* x, float* y, float* z)
107
+ {
108
+ rarr = rb_convert_type(rarr, T_ARRAY, "Array", "to_a");
109
+ *x = NUM2DBL(rb_ary_entry(rarr, 0));
110
+ *y = NUM2DBL(rb_ary_entry(rarr, 1));
111
+ *z = NUM2DBL(rb_ary_entry(rarr, 2));
112
+ }
113
+
114
+ static
115
+ void
116
+ convert_bulk_float(VALUE* rtuple, float* tuple, int len)
117
+ {
118
+ int i;
119
+ for (i = 0; i < len; ++i)
120
+ rtuple[i] = rb_float_new(tuple[i]);
121
+ }
122
+
123
+ static
124
+ VALUE
125
+ set_obj_float(VALUE robj, VALUE rflt, void* set)
126
+ {
127
+ check_seal_err(((seal_err_t (*)(void*, float)) set)(
128
+ DATA_PTR(robj), NUM2DBL(rflt)
129
+ ));
130
+
131
+ return rflt;
132
+ }
133
+
134
+ static
135
+ VALUE
136
+ set_obj_int(VALUE robj, VALUE rnum, void* set)
137
+ {
138
+ check_seal_err(((seal_err_t (*)(void*, int)) set)(
139
+ DATA_PTR(robj), NUM2INT(rnum)
140
+ ));
141
+ }
142
+
143
+ static
144
+ VALUE
145
+ set_obj_ulong(VALUE robj, VALUE rnum, void* set)
146
+ {
147
+ check_seal_err(((seal_err_t (*)(void*, int)) set)(
148
+ DATA_PTR(robj), NUM2ULONG(rnum)
149
+ ));
150
+ }
151
+
152
+ static
153
+ VALUE
154
+ set_obj_char(VALUE robj, VALUE rbool, void* set)
155
+ {
156
+ check_seal_err(((seal_err_t (*)(void*, char)) set)(
157
+ DATA_PTR(robj), RTEST(rbool)
158
+ ));
159
+
160
+ return rbool;
161
+ }
162
+
163
+ static
164
+ VALUE
165
+ set_obj_3float(VALUE robj, VALUE rarr, void* set)
166
+ {
167
+ float x, y, z;
168
+
169
+ extract_3float(rarr, &x, &y, &z);
170
+ check_seal_err(((seal_err_t (*)(void*, float, float, float)) set)(
171
+ DATA_PTR(robj), x, y, z
172
+ ));
173
+
174
+ return rarr;
175
+ }
176
+
177
+ static
178
+ void
179
+ get_obj_attr(VALUE robj, void* pvalue, void* get)
180
+ {
181
+ check_seal_err(((seal_err_t (*)(void*, void*)) get)(
182
+ DATA_PTR(robj), pvalue
183
+ ));
184
+ }
185
+
186
+ static
187
+ VALUE
188
+ get_obj_float(VALUE robj, void* get)
189
+ {
190
+ float flt;
191
+
192
+ get_obj_attr(robj, &flt, get);
193
+
194
+ return rb_float_new(flt);
195
+ }
196
+
197
+ static
198
+ VALUE
199
+ get_obj_int(VALUE robj, void* get)
200
+ {
201
+ int integer;
202
+
203
+ get_obj_attr(robj, &integer, get);
204
+
205
+ return INT2NUM(integer);
206
+ }
207
+
208
+ static
209
+ VALUE
210
+ get_obj_ulong(VALUE robj, void* get)
211
+ {
212
+ unsigned long long_integer;
213
+
214
+ get_obj_attr(robj, &long_integer, get);
215
+
216
+ return ULONG2NUM(long_integer);
217
+ }
218
+
219
+ static
220
+ VALUE
221
+ get_obj_char(VALUE robj, void* get)
222
+ {
223
+ char bool;
224
+
225
+ get_obj_attr(robj, &bool, get);
226
+
227
+ return bool ? Qtrue : Qfalse;
228
+ }
229
+
230
+ static
231
+ VALUE
232
+ get_obj_3float(VALUE robj, void* get)
233
+ {
234
+ float tuple[3];
235
+ VALUE rtuple[3];
236
+
237
+ check_seal_err(((seal_err_t (*)(void*, float*, float*, float*)) get)(
238
+ DATA_PTR(robj), tuple, tuple + 1, tuple + 2
239
+ ));
240
+ convert_bulk_float(rtuple, tuple, 3);
241
+
242
+ return rb_ary_new4(3, rtuple);
243
+ }
244
+
245
+ static
246
+ seal_fmt_t
247
+ map_format(VALUE symbol)
248
+ {
249
+ if (NIL_P(symbol))
250
+ return SEAL_UNKNOWN_FMT;
251
+
252
+ symbol = rb_convert_type(symbol, T_SYMBOL, "Symbol", "to_sym");
253
+ if (symbol == name2sym(WAV_SYM))
254
+ return SEAL_WAV_FMT;
255
+ else if (symbol == name2sym(OV_SYM))
256
+ return SEAL_OV_FMT;
257
+ else if (symbol == name2sym(MPG_SYM))
258
+ return SEAL_MPG_FMT;
259
+ else
260
+ return SEAL_UNKNOWN_FMT;
261
+ }
262
+
263
+ static
264
+ void
265
+ input_audio(int argc, VALUE* argv, void* media, void* _input)
266
+ {
267
+ typedef seal_err_t inputter_t(void*, const char*, seal_fmt_t);
268
+
269
+ VALUE filename;
270
+ VALUE format;
271
+
272
+ inputter_t* input = (inputter_t*) _input;
273
+ rb_scan_args(argc, argv, "11", &filename, &format);
274
+ check_seal_err(input(media, rb_string_value_ptr(&filename),
275
+ map_format(format)));
276
+ }
277
+
278
+ static
279
+ VALUE
280
+ set_listener_3float(VALUE rarr, seal_err_t (*set)(float, float, float))
281
+ {
282
+ float x, y, z;
283
+
284
+ extract_3float(rarr, &x, &y, &z);
285
+ check_seal_err(set(x, y, z));
286
+
287
+ return rarr;
288
+ }
289
+
290
+ static
291
+ VALUE
292
+ get_listener_3float(seal_err_t (*get)(float*, float*, float*))
293
+ {
294
+ float tuple[3];
295
+ VALUE rtuple[3];
296
+
297
+ check_seal_err(get(tuple, tuple + 1, tuple + 2));
298
+ convert_bulk_float(rtuple, tuple, 3);
299
+
300
+ return rb_ary_new4(3, rtuple);
301
+ }
302
+
303
+ static
304
+ VALUE
305
+ set_listener_float(VALUE rflt, seal_err_t (*set)(float))
306
+ {
307
+ check_seal_err(set(NUM2DBL(rflt)));
308
+
309
+ return rflt;
310
+ }
311
+
312
+ static
313
+ VALUE
314
+ get_listener_float(seal_err_t (*get)(float*))
315
+ {
316
+ float value;
317
+
318
+ check_seal_err(get(&value));
319
+
320
+ return rb_float_new(value);
321
+ }
322
+
323
+ static
324
+ VALUE
325
+ src_op(VALUE rsrc, seal_err_t (*op)(seal_src_t*))
326
+ {
327
+ check_seal_err(op(DATA_PTR(rsrc)));
328
+
329
+ return rsrc;
330
+ }
331
+
332
+ static
333
+ seal_stream_t*
334
+ extract_stream(VALUE rstream)
335
+ {
336
+ return DATA_PTR(rstream);
337
+ }
338
+
339
+ /*
340
+ * call-seq:
341
+ * Seal.startup -> nil
342
+ * Seal.startup(str) -> nil
343
+ *
344
+ * Initializes Seal by specifying the device name _str_. This function is
345
+ * not re-entrant nor thread-safe and should be called only once per Seal
346
+ * session. Match a call to <code>seal_startup</code> with a call to
347
+ * <code>seal_cleanup</code> and never call <code>seal_starup</code> twice in
348
+ * a row.
349
+ */
350
+ static
351
+ VALUE
352
+ startup(int argc, VALUE* argv)
353
+ {
354
+ VALUE rstring;
355
+
356
+ rb_scan_args(argc, argv, "01", &rstring);
357
+ check_seal_err(seal_startup(NIL_P(rstring)
358
+ ? 0 : rb_string_value_ptr(&rstring)));
359
+
360
+ return Qnil;
361
+ }
362
+
363
+ /*
364
+ * call-seq:
365
+ * Seal.cleanup -> nil
366
+ *
367
+ * Uninitializes Seal and invalidate all Seal objects. Thread-unsafe.
368
+ */
369
+ static
370
+ VALUE
371
+ cleanup()
372
+ {
373
+ seal_cleanup();
374
+
375
+ return Qnil;
376
+ }
377
+
378
+ /*
379
+ * call-seq:
380
+ * Seal.per_source_effect_limit -> fixnum
381
+ *
382
+ * Returns the maximum number of effect slots a source can feed concurrently.
383
+ */
384
+ static
385
+ VALUE
386
+ per_source_effect_limit()
387
+ {
388
+ return INT2NUM(seal_get_per_src_effect_limit());
389
+ }
390
+
391
+ /*
392
+ * call-seq:
393
+ * Seal::Buffer.new(filename [, format]) -> buffer
394
+ *
395
+ * Initializes a new buffer and loads it with audio from _filename_. _format_
396
+ * specifies the format of the audio file; automatic recognition of the audio
397
+ * format will be attempted if _format_ is not specified. See Seal::Format for
398
+ * possible values. Sets all the attributes appropriately.
399
+ */
400
+ static
401
+ VALUE
402
+ init_buf(int argc, VALUE* argv, VALUE rbuf)
403
+ {
404
+ seal_buf_t* buf;
405
+
406
+ buf = DATA_PTR(rbuf);
407
+ check_seal_err(seal_init_buf(buf));
408
+ input_audio(argc, argv, buf, seal_load2buf);
409
+
410
+ return rbuf;
411
+ }
412
+
413
+ /*
414
+ * call-seq:
415
+ * buffer.load(filename [, format]) -> buffer
416
+ *
417
+ * Loads audio from _filename_ to _buffer_ which must not be currently used by
418
+ * any source. Sets all the attributes appropriately. _format_ specifies the
419
+ * format of the audio file; automatic recognition of the audio format will be
420
+ * attempted if _format_ is not specified. See Seal::Format for possible
421
+ * values.Sets all the attributes appropriately.
422
+ */
423
+ static
424
+ VALUE
425
+ load_buf(int argc, VALUE* argv, VALUE rbuf)
426
+ {
427
+ input_audio(argc, argv, DATA_PTR(rbuf), seal_load2buf);
428
+
429
+ return rbuf;
430
+ }
431
+
432
+ /*
433
+ * call-seq:
434
+ * buffer.size -> fixnum
435
+ *
436
+ * Gets the size, in bytes, of _buffer_.
437
+ */
438
+ static
439
+ VALUE
440
+ get_buf_size(VALUE rbuf)
441
+ {
442
+ return get_obj_int(rbuf, seal_get_buf_size);
443
+ }
444
+
445
+ /*
446
+ * call-seq:
447
+ * buffer.frequency -> fixnum
448
+ *
449
+ * Gets the frequency (sample rate) of the audio contained in _buffer_.
450
+ */
451
+ static
452
+ VALUE
453
+ get_buf_freq(VALUE rbuf)
454
+ {
455
+ return get_obj_int(rbuf, seal_get_buf_freq);
456
+ }
457
+
458
+ /*
459
+ * call-seq:
460
+ * buffer.bit_depth -> fixnum
461
+ *
462
+ * Gets the bit depth (bits per sample) of the audio contained in _buffer_.
463
+ */
464
+ static
465
+ VALUE
466
+ get_buf_bps(VALUE rbuf)
467
+ {
468
+ return get_obj_int(rbuf, seal_get_buf_bps);
469
+ }
470
+
471
+ /*
472
+ * call-seq:
473
+ * buffer.channel_count -> fixnum
474
+ *
475
+ * Gets the number of channels of the audio contained in _buffer_.
476
+ */
477
+ static
478
+ VALUE
479
+ get_buf_nchannels(VALUE rbuf)
480
+ {
481
+ return get_obj_int(rbuf, seal_get_buf_nchannels);
482
+ }
483
+
484
+ /*
485
+ * call-seq:
486
+ * Seal::Stream.new(filename [, format]) -> stream
487
+ * Seal::Stream.open(filename [, format]) -> stream
488
+ *
489
+ * Opens a audio stream from _filename_. _format_ specifies the format of the
490
+ * audio file; automatic recognition of the audio format will be attempted if
491
+ * _format_ is nil. See Seal::Format for possible values.
492
+ */
493
+ static
494
+ VALUE
495
+ init_stream(int argc, VALUE* argv, VALUE rstream)
496
+ {
497
+ input_audio(argc, argv, DATA_PTR(rstream), seal_open_stream);
498
+
499
+ return rstream;
500
+ }
501
+
502
+ /*
503
+ * call-seq:
504
+ * stream.frequency -> fixnum
505
+ *
506
+ * Gets the frequency (sample rate) of the audio contained in _streamed_. The
507
+ * default is 0 when the stream is not opened.
508
+ */
509
+ static
510
+ VALUE
511
+ get_stream_freq(VALUE rstream)
512
+ {
513
+ return INT2NUM(extract_stream(rstream)->attr.freq);
514
+ }
515
+
516
+ /*
517
+ * call-seq:
518
+ * stream.bit_depth -> fixnum
519
+ *
520
+ * Gets the bit depth (bits per sample) of the audio contained in _stream_.
521
+ * The default is 16 when the stream is not opened.
522
+ */
523
+ static
524
+ VALUE
525
+ get_stream_bps(VALUE rstream)
526
+ {
527
+ return INT2NUM(extract_stream(rstream)->attr.bit_depth);
528
+ }
529
+
530
+ /*
531
+ * call-seq:
532
+ * stream.channel_count -> fixnum
533
+ *
534
+ * Gets the number of channels of the audio contained in _stream_. The default
535
+ * is 1 when the stream is not opened.
536
+ */
537
+ static
538
+ VALUE
539
+ get_stream_nchannels(VALUE rstream)
540
+ {
541
+ return INT2NUM(extract_stream(rstream)->attr.nchannels);
542
+ }
543
+
544
+ /*
545
+ * call-seq:
546
+ * stream.rewind -> stream
547
+ *
548
+ * Rewinds _stream_ to the beginning.
549
+ */
550
+ static
551
+ VALUE
552
+ rewind_stream(VALUE rstream)
553
+ {
554
+ seal_rewind_stream(DATA_PTR(rstream));
555
+
556
+ return rstream;
557
+ }
558
+
559
+ /*
560
+ * call-seq:
561
+ * stream.close -> stream
562
+ *
563
+ * Closes _stream_.
564
+ */
565
+ static
566
+ VALUE
567
+ close_stream(VALUE rstream)
568
+ {
569
+ check_seal_err(seal_close_stream(DATA_PTR(rstream)));
570
+
571
+ return rstream;
572
+ }
573
+
574
+ /*
575
+ * call-seq:
576
+ * Seal::Source.new -> source
577
+ *
578
+ * Initializes a new source.
579
+ */
580
+ static
581
+ VALUE
582
+ init_src(VALUE rsrc)
583
+ {
584
+ check_seal_err(seal_init_src(DATA_PTR(rsrc)));
585
+
586
+ return rsrc;
587
+ }
588
+
589
+ /*
590
+ * call-seq:
591
+ * source.play -> source
592
+ *
593
+ * Starts to play _source_. Applying to a playing source will restart the
594
+ * playback from the beginning thus reset the sampling offset too. If the
595
+ * source is a streaming source, restarting the playback will automatically
596
+ * rewind the stream to the beginning. Applying to an initial or stopped
597
+ * source will start start playing and change its state to State::PLAYING.
598
+ * Applying to a paused source will resume playing and change its state to
599
+ * State::PLAYING.
600
+ */
601
+ static
602
+ VALUE
603
+ play_src(VALUE rsrc)
604
+ {
605
+ return src_op(rsrc, seal_play_src);
606
+ }
607
+
608
+ /*
609
+ * call-seq:
610
+ * source.pause -> source
611
+ *
612
+ * Pauses the playing of _source_. Applying to a playing source will change
613
+ * its state to State::PAUSED. Applying to an initial, paused or stopped
614
+ * source has no effect.
615
+ */
616
+ static
617
+ VALUE
618
+ pause_src(VALUE rsrc)
619
+ {
620
+ return src_op(rsrc, seal_pause_src);
621
+ }
622
+
623
+ /*
624
+ * call-seq:
625
+ * source.stop -> source
626
+ *
627
+ * Stops the playing of _source_. Applying to a playing or paused source will
628
+ * change its state to State::STOPPED. Applying to an initial or stopped
629
+ * source has no effect. Resets the sampling offset.
630
+ */
631
+ static
632
+ VALUE
633
+ stop_src(VALUE rsrc)
634
+ {
635
+ return src_op(rsrc, seal_stop_src);
636
+ }
637
+
638
+ /*
639
+ * call-seq:
640
+ * source.rewind -> source
641
+ *
642
+ * Rewinds _source_ to the beginning. Applying to a playing, paused or stopped
643
+ * source will change its state to State::INITIAL. Applying to an initial
644
+ * source has no effect. The sampling offset will be reset to the beginning.
645
+ * Other attributes are preserved.
646
+ */
647
+ static
648
+ VALUE
649
+ rewind_src(VALUE rsrc)
650
+ {
651
+ return src_op(rsrc, seal_rewind_src);
652
+ }
653
+
654
+ /*
655
+ * call-seq:
656
+ * source.buffer = buffer -> buffer
657
+ * source.buffer = nil -> nil
658
+ *
659
+ * Associates _buffer_ with _source_ so that the source is ready to play the
660
+ * audio contained in _buffer_. Can be applied only to sources in the initial
661
+ * or stopped states and that are not of streaming type. If successful, the
662
+ * source will become or remain as Type::STATIC.
663
+ *
664
+ * If nil is specified, the source will give up the buffer it has and will
665
+ * reset the source to Type::UNDETERMINED and the source state to
666
+ * State::STOPPED. It will not free the buffer.
667
+ */
668
+ static
669
+ VALUE
670
+ set_src_buf(VALUE rsrc, VALUE rbuf)
671
+ {
672
+ seal_buf_t* buf;
673
+
674
+ if (NIL_P(rbuf)) {
675
+ src_op(rsrc, seal_detach_src_audio);
676
+ } else {
677
+ Data_Get_Struct(rbuf, seal_buf_t, buf);
678
+ check_seal_err(seal_set_src_buf(DATA_PTR(rsrc), buf));
679
+ }
680
+ rb_iv_set(rsrc, "@buffer", rbuf);
681
+
682
+ return rbuf;
683
+ }
684
+
685
+ /*
686
+ * call-seq:
687
+ * source.buffer -> buffer
688
+ *
689
+ * Gets the buffer of _source_. The default is nil.
690
+ */
691
+ static
692
+ VALUE
693
+ get_src_buf(VALUE rsrc)
694
+ {
695
+ return rb_iv_get(rsrc, "@buffer");
696
+ }
697
+
698
+ /*
699
+ * call-seq:
700
+ * source.stream = stream -> stream
701
+ * source.stream = nil
702
+ *
703
+ * Associates (opened) _stream_ with _source_ so that audio data can be
704
+ * continuously fetched from a file rather than loading everything to memory
705
+ * at once. Can be applied to sources in any playing state but not on static
706
+ * sources. When replacing an attached stream, the new stream must have the
707
+ * same audio format as the old one. Also be aware of the fact that in this
708
+ * case there could still be some chunks of the old stream at the front of the
709
+ * streaming queue waiting to be played. If successful, the source will become
710
+ * or remain as Type::STREAMING. The streaming queue will be filled after this
711
+ * call returns; after the queue starts to be played, #update should be called
712
+ * to refill the queue.
713
+ *
714
+ * If nil is specified, the source will give up the stream it has and will
715
+ * reset the source to Type::UNDETERMINED and the source state to
716
+ * State::STOPPED. It will not free the stream.
717
+ */
718
+ static
719
+ VALUE
720
+ set_src_stream(VALUE rsrc, VALUE rstream)
721
+ {
722
+ seal_stream_t* stream;
723
+
724
+ if (NIL_P(rstream)) {
725
+ src_op(rsrc, seal_detach_src_audio);
726
+ } else {
727
+ Data_Get_Struct(rstream, seal_stream_t, stream);
728
+ check_seal_err(seal_set_src_stream(DATA_PTR(rsrc), stream));
729
+ }
730
+ rb_iv_set(rsrc, "@stream", rstream);
731
+
732
+ return rstream;
733
+ }
734
+
735
+ /*
736
+ * call-seq:
737
+ * source.stream -> stream
738
+ *
739
+ * Gets the stream of _source_. The default is nil.
740
+ */
741
+ static
742
+ VALUE
743
+ get_src_stream(VALUE rsrc)
744
+ {
745
+ return rb_iv_get(rsrc, "@stream");
746
+ }
747
+
748
+ /*
749
+ * call-seq:
750
+ * source.update -> source
751
+ *
752
+ * Updates _source_. If _source_ is not up-to-date, the playback will end
753
+ * before the end of the stream is reached. Does nothing if _source_ is not a
754
+ * streaming source. Also does nothing if auto update is on.
755
+ */
756
+ static
757
+ VALUE update_src(VALUE rsrc)
758
+ {
759
+ return src_op(rsrc, seal_update_src);
760
+ }
761
+
762
+ /*
763
+ * call-seq:
764
+ * source.position = [flt, flt, flt] -> [flt, flt, flt]
765
+ *
766
+ * Sets the position of _source_ in a right-handed Cartesian coordinate
767
+ * system. Use of NaN and infinity is undefined.
768
+ */
769
+ static
770
+ VALUE
771
+ set_src_pos(VALUE rsrc, VALUE value)
772
+ {
773
+ return set_obj_3float(rsrc, value, seal_set_src_pos);
774
+ }
775
+
776
+ /*
777
+ * call-seq:
778
+ * source.position -> [flt, flt, flt]
779
+ *
780
+ * Gets the position of _source_. The default is ( 0.0, 0.0, 0.0 ).
781
+ */
782
+ static
783
+ VALUE
784
+ get_src_pos(VALUE rsrc)
785
+ {
786
+ return get_obj_3float(rsrc, seal_get_src_pos);
787
+ }
788
+
789
+ /*
790
+ * call-seq:
791
+ * source.velocity = [flt, flt, flt] -> [flt, flt, flt]
792
+ *
793
+ * Sets the velocity of _source_ in a right-handed Cartesian coordinate
794
+ * system. The velocity of the source does not affect its position but is a
795
+ * factor used during the Doppler effect emulation. Use of NaN is undefined.
796
+ *
797
+ */
798
+ static
799
+ VALUE
800
+ set_src_vel(VALUE rsrc, VALUE value)
801
+ {
802
+ return set_obj_3float(rsrc, value, seal_set_src_vel);
803
+ }
804
+
805
+ /*
806
+ * call-seq:
807
+ * source.velocity -> [flt, flt, flt]
808
+ *
809
+ * Gets the velocity of _source_. The default is ( 0.0, 0.0, 0.0 ).
810
+ */
811
+ static
812
+ VALUE
813
+ get_src_vel(VALUE rsrc)
814
+ {
815
+ return get_obj_3float(rsrc, seal_get_src_vel);
816
+ }
817
+
818
+ /*
819
+ * call-seq:
820
+ * source.pitch = flt -> [flt, flt, flt]
821
+ *
822
+ * Sets the pitch shift multiplier of _source_. 1.0 means identity; each
823
+ * reduction by 1/2 means a pitch shift of -12 semitones; each doubling means
824
+ * a pitch shift of 12 semitones. Use of 0.0 is undefined. The valid range is
825
+ * (0.0, +inf.).
826
+ */
827
+ static
828
+ VALUE
829
+ set_src_pitch(VALUE rsrc, VALUE value)
830
+ {
831
+ return set_obj_float(rsrc, value, seal_set_src_pitch);
832
+ }
833
+
834
+ /*
835
+ * call-seq:
836
+ * source.pitch -> flt
837
+ *
838
+ * Gets the pitch of _source_. The default is 1.0.
839
+ */
840
+ static
841
+ VALUE
842
+ get_src_pitch(VALUE rsrc)
843
+ {
844
+ return get_obj_float(rsrc, seal_get_src_pitch);
845
+ }
846
+
847
+ /*
848
+ * call-seq:
849
+ * source.gain = flt -> [flt, flt, flt]
850
+ *
851
+ * Sets the scalar amplitude multiplier of _source_ in the interval
852
+ * [0.0, +inf.). 1.0 means that the sound is unattenuated; 0.5 means an
853
+ * attenuation of 6 dB; 0.0 means silence.
854
+ */
855
+ static
856
+ VALUE
857
+ set_src_gain(VALUE rsrc, VALUE value)
858
+ {
859
+ return set_obj_float(rsrc, value, seal_set_src_gain);
860
+ }
861
+
862
+ /*
863
+ * call-seq:
864
+ * source.gain -> flt
865
+ *
866
+ * Gets the gain of _source_. The default is 1.0.
867
+ */
868
+ static
869
+ VALUE
870
+ get_src_gain(VALUE rsrc)
871
+ {
872
+ return get_obj_float(rsrc, seal_get_src_gain);
873
+ }
874
+
875
+ /*
876
+ * call-seq:
877
+ * source.auto = true or false -> true or false
878
+ *
879
+ * Sets whether _source_ should be automatically updated asynchronously by a
880
+ * background thread. If this thread is running, user calls to #update does
881
+ * nothing. If auto update is disabled after it is enabled, it will take
882
+ * effect the next time the source gets played.
883
+ */
884
+ static
885
+ VALUE
886
+ set_src_auto(VALUE rsrc, VALUE value)
887
+ {
888
+ return set_obj_char(rsrc, value, seal_set_src_auto);
889
+ }
890
+
891
+ /*
892
+ * call-seq:
893
+ * source.auto -> true or false
894
+ *
895
+ * Determines if _source_ is automatically updated. The default is true.
896
+ */
897
+ static
898
+ VALUE
899
+ is_src_auto(VALUE rsrc)
900
+ {
901
+ return get_obj_char(rsrc, seal_is_src_auto);
902
+ }
903
+
904
+ /*
905
+ * call-seq:
906
+ * source.relative = true or false -> true or false
907
+ *
908
+ * Sets whether _source_'s position, velocity, cone and direction are all
909
+ * relative to the listener position.
910
+ */
911
+ static
912
+ VALUE
913
+ set_src_relative(VALUE rsrc, VALUE value)
914
+ {
915
+ return set_obj_char(rsrc, value, seal_set_src_relative);
916
+ }
917
+
918
+ /*
919
+ * call-seq:
920
+ * source.relative -> true or false
921
+ *
922
+ * Determines if _source_ is relative. The default is false.
923
+ */
924
+ static
925
+ VALUE
926
+ is_src_relative(VALUE rsrc)
927
+ {
928
+ return get_obj_char(rsrc, seal_is_src_relative);
929
+ }
930
+
931
+ /*
932
+ * call-seq:
933
+ * source.looping = true or false -> true or false
934
+ *
935
+ * Sets whether the playback of _source_ is looping. A looping source will
936
+ * never enter State::STOPPED; it will immediate enter State::INITIAL and then
937
+ * State::Playing after it reaches the end of the last buffer.
938
+ */
939
+ static
940
+ VALUE
941
+ set_src_looping(VALUE rsrc, VALUE value)
942
+ {
943
+ return set_obj_char(rsrc, value, seal_set_src_looping);
944
+ }
945
+
946
+ /*
947
+ * call-seq:
948
+ * source.looping -> true or false
949
+ *
950
+ * Determines if _source_ is looping. The default is false (0).
951
+ */
952
+ static
953
+ VALUE
954
+ is_src_looping(VALUE rsrc)
955
+ {
956
+ return get_obj_char(rsrc, seal_is_src_looping);
957
+ }
958
+
959
+ /*
960
+ * call-seq:
961
+ * source.queue_size = fixnum -> true or false
962
+ *
963
+ * Sets the size of the streaming queue internally used by _source_. The queue
964
+ * maintains a multiple buffering mechanism when streaming the audio data.
965
+ * Multiple bufferring allows buffers in the queue to be processed while the
966
+ * one at the front of the queue is still being played. A queue of size 2
967
+ * (double buffering) may still be inefficient in CPU-, and I/O-bound
968
+ * situations while triple, or even quad buffering generally produces better
969
+ * sound quality in non-memory-bound situations. _fixnum_ must be in the
970
+ * interval [2, 63].
971
+ */
972
+ static
973
+ VALUE
974
+ set_src_queue_size(VALUE rsrc, VALUE value)
975
+ {
976
+ return set_obj_int(rsrc, value, seal_set_src_queue_size);
977
+ }
978
+
979
+ /*
980
+ * call-seq:
981
+ * source.queue_size -> fixnum
982
+ *
983
+ * Gets the size, in byte, of _source_'s streaming queue. The default is 3.
984
+ */
985
+ static
986
+ VALUE
987
+ get_src_queue_size(VALUE rsrc)
988
+ {
989
+ return get_obj_int(rsrc, seal_get_src_queue_size);
990
+ }
991
+
992
+ /*
993
+ * call-seq:
994
+ * source.chunk_size = fixnum -> true or false
995
+ *
996
+ * Sets the maximum size, in byte, of the audio chunk which buffers the audio
997
+ * data constantly fetched from an audio stream. Using small chunks may cause
998
+ * playback to occur before the required audio chunk is ready, which in turn
999
+ * causes unexpected stop of playback. _fixnum_ must be in the interval
1000
+ * \[9216, 16773120] and must be a multiple of 9216; non-multiple value will be
1001
+ * adjusted to the closest smaller multiple automatically.
1002
+ */
1003
+ static
1004
+ VALUE
1005
+ set_src_chunk_size(VALUE rsrc, VALUE value)
1006
+ {
1007
+ return set_obj_int(rsrc, value, seal_set_src_chunk_size);
1008
+ }
1009
+
1010
+ /*
1011
+ * call-seq:
1012
+ * source.chunk_size -> fixnum
1013
+ *
1014
+ * Gets the size, in byte, of _source_'s streaming chunk. The default is
1015
+ * 36864.
1016
+ */
1017
+ static
1018
+ VALUE
1019
+ get_src_chunk_size(VALUE rsrc)
1020
+ {
1021
+ return get_obj_int(rsrc, seal_get_src_chunk_size);
1022
+ }
1023
+ /*
1024
+ * call-seq:
1025
+ * source.type -> :streaming or :static
1026
+ *
1027
+ * Gets the type of _source_.
1028
+ */
1029
+ static
1030
+ VALUE
1031
+ get_src_type(VALUE rsrc)
1032
+ {
1033
+ seal_src_type_t type;
1034
+
1035
+ check_seal_err(seal_get_src_type(DATA_PTR(rsrc), &type));
1036
+ switch (type) {
1037
+ case SEAL_STATIC:
1038
+ return name2sym(STATIC_SYM);
1039
+ case SEAL_STREAMING:
1040
+ return name2sym(STREAMING_SYM);
1041
+ default:
1042
+ return name2sym(UNDETERMINED_SYM);
1043
+ }
1044
+ }
1045
+
1046
+ /*
1047
+ * call-seq:
1048
+ * source.state -> :playing, :paused, :stopped or :initial
1049
+ *
1050
+ * Gets the state of _source_.
1051
+ */
1052
+ static
1053
+ VALUE
1054
+ get_src_state(VALUE rsrc)
1055
+ {
1056
+ seal_src_state_t state;
1057
+
1058
+ check_seal_err(seal_get_src_state(DATA_PTR(rsrc), &state));
1059
+ switch (state) {
1060
+ case SEAL_PLAYING:
1061
+ return name2sym(PLAYING_SYM);
1062
+ case SEAL_PAUSED:
1063
+ return name2sym(PAUSED_SYM);
1064
+ case SEAL_STOPPED:
1065
+ return name2sym(STOPPED_SYM);
1066
+ default:
1067
+ return name2sym(INITIAL_SYM);
1068
+ }
1069
+ }
1070
+
1071
+ /*
1072
+ * call-seq:
1073
+ * reverb.load(preset) -> reverb
1074
+ *
1075
+ * Loads the specified reverb paramter preset into _reverb_.
1076
+ */
1077
+ static
1078
+ VALUE
1079
+ load_rvb(VALUE rrvb, VALUE rpreset)
1080
+ {
1081
+ seal_rvb_t* rvb;
1082
+
1083
+ Data_Get_Struct(rrvb, seal_rvb_t, rvb);
1084
+ check_seal_err(seal_load_rvb(DATA_PTR(rrvb), NUM2INT(rpreset)));
1085
+
1086
+ return rrvb;
1087
+ }
1088
+
1089
+ /*
1090
+ * call-seq:
1091
+ * Seal::Reverb.new -> reverb
1092
+ * Seal::Reverb.new(preset) -> reverb
1093
+ *
1094
+ * Initializes a new reverb effect. If a preset is specified, initializes
1095
+ * the reverb object to load the preset.
1096
+ */
1097
+ static
1098
+ VALUE
1099
+ init_rvb(int argc, VALUE* argv, VALUE rrvb)
1100
+ {
1101
+ seal_rvb_t* rvb;
1102
+ VALUE rpreset;
1103
+
1104
+ rvb = DATA_PTR(rrvb);
1105
+ check_seal_err(seal_init_rvb(rvb));
1106
+
1107
+ rb_scan_args(argc, argv, "01", &rpreset);
1108
+ if (!NIL_P(rpreset))
1109
+ load_rvb(rrvb, rpreset);
1110
+
1111
+ return rrvb;
1112
+ }
1113
+
1114
+ /*
1115
+ * call-seq:
1116
+ * reverb.density = flt -> flt
1117
+ *
1118
+ * Sets the modal density of _reverb_ in the interval [0.0, 1.0]. The
1119
+ * density controls the coloration of the late reverb. The Lower the value,
1120
+ * the more coloration.
1121
+ */
1122
+ static
1123
+ VALUE
1124
+ set_rvb_density(VALUE rrvb, VALUE value)
1125
+ {
1126
+ return set_obj_float(rrvb, value, seal_set_rvb_density);
1127
+ }
1128
+
1129
+ /*
1130
+ * call-seq:
1131
+ * reverb.density -> flt
1132
+ *
1133
+ * Gets the density of _reverb_. The default is 1.0.
1134
+ */
1135
+ static
1136
+ VALUE
1137
+ get_rvb_density(VALUE rrvb)
1138
+ {
1139
+ return get_obj_float(rrvb, seal_get_rvb_density);
1140
+ }
1141
+
1142
+ /*
1143
+ * call-seq:
1144
+ * reverb.diffusion = flt -> flt
1145
+ *
1146
+ * Sets the diffusion of _reverb_ in the interval [0.0, 1.0]. The diffusion
1147
+ * controls the echo density in the reverberation decay. Reducing diffusion
1148
+ * gives the reverberation a more "grainy" character that is especially
1149
+ * noticeable with percussive sound sources. If you set a diffusion value of
1150
+ * 0.0, the later reverberation sounds like a succession of distinct echoes.
1151
+ */
1152
+ static
1153
+ VALUE
1154
+ set_rvb_diffusion(VALUE rrvb, VALUE value)
1155
+ {
1156
+ return set_obj_float(rrvb, value, seal_set_rvb_diffusion);
1157
+ }
1158
+
1159
+ /*
1160
+ * call-seq:
1161
+ * reverb.diffusion -> flt
1162
+ *
1163
+ * Gets the diffusion of _reverb_. The default is 1.0.
1164
+ */
1165
+ static
1166
+ VALUE
1167
+ get_rvb_diffusion(VALUE rrvb)
1168
+ {
1169
+ return get_obj_float(rrvb, seal_get_rvb_diffusion);
1170
+ }
1171
+
1172
+ /*
1173
+ * call-seq:
1174
+ * reverb.gain = flt -> flt
1175
+ *
1176
+ * Sets the gain of _reverb_ in the interval [0.0, 1.0], or from -100 dB (no
1177
+ * reflected sound at all) to 0 dB (the maximum amount). The gain is the
1178
+ * master volume control for the reflected sound (both early reflections and
1179
+ * reverberation) that the reverb effect adds to all sources. It sets the
1180
+ * maximum amount of reflections and reverberation added to the final sound
1181
+ * mix.
1182
+ */
1183
+ static
1184
+ VALUE
1185
+ set_rvb_gain(VALUE rrvb, VALUE value)
1186
+ {
1187
+ return set_obj_float(rrvb, value, seal_set_rvb_gain);
1188
+ }
1189
+
1190
+ /*
1191
+ * call-seq:
1192
+ * reverb.gain -> flt
1193
+ *
1194
+ * Gets the gain of _reverb_. The default is 0.32.
1195
+ */
1196
+ static
1197
+ VALUE
1198
+ get_rvb_gain(VALUE rrvb)
1199
+ {
1200
+ return get_obj_float(rrvb, seal_get_rvb_gain);
1201
+ }
1202
+
1203
+ /*
1204
+ * call-seq:
1205
+ * reverb.hfgain = flt -> flt
1206
+ *
1207
+ * Sets the high-frequency gain of _reverb_ in the interval [0.0, 1.0], or
1208
+ * from -100 dB (virtually no reflected sound) to 0 dB (no filter). The high-
1209
+ * frequency gain further tweaks reflected sound by attenuating it at high
1210
+ * frequencies. It controls a low-pass filter that applies globally to the
1211
+ * reflected sound of all sound sources feeding the particular instance of the
1212
+ * reverb effect.
1213
+ */
1214
+ static
1215
+ VALUE
1216
+ set_rvb_hfgain(VALUE rrvb, VALUE value)
1217
+ {
1218
+ return set_obj_float(rrvb, value, seal_set_rvb_hfgain);
1219
+ }
1220
+
1221
+ /*
1222
+ * call-seq:
1223
+ * reverb.hfgain -> flt
1224
+ *
1225
+ * Gets the high-frequency gain of _reverb_. The default is 0.89.
1226
+ */
1227
+ static
1228
+ VALUE
1229
+ get_rvb_hfgain(VALUE rrvb)
1230
+ {
1231
+ return get_obj_float(rrvb, seal_get_rvb_hfgain);
1232
+ }
1233
+
1234
+ /*
1235
+ * call-seq:
1236
+ * reverb.decay_time = flt -> flt
1237
+ *
1238
+ * Sets the decay time of _reverb_ in the interval [0.1, 20.0], typically
1239
+ * from a small room with very dead surfaces to a large room with very live
1240
+ * surfaces.
1241
+ */
1242
+ static
1243
+ VALUE
1244
+ set_rvb_decay_time(VALUE rrvb, VALUE value)
1245
+ {
1246
+ return set_obj_float(rrvb, value, seal_set_rvb_decay_time);
1247
+ }
1248
+
1249
+ /*
1250
+ * call-seq:
1251
+ * reverb.decay_time -> flt
1252
+ *
1253
+ * Gets the decay time of _reverb_. The default is 1.49.
1254
+ */
1255
+ static
1256
+ VALUE
1257
+ get_rvb_decay_time(VALUE rrvb)
1258
+ {
1259
+ return get_obj_float(rrvb, seal_get_rvb_decay_time);
1260
+ }
1261
+
1262
+ /*
1263
+ * call-seq:
1264
+ * reverb.hfdecay_ratio = flt -> flt
1265
+ *
1266
+ * Sets the high-frequency decay ratio, or the spectral quality of the decay
1267
+ * time of _reverb_ in the interval [0.1, 2.0]. It is the ratio of
1268
+ * high-frequency decay time relative to the time set by decay Time. 1.0 means
1269
+ * neutral: the decay time is equal for all frequencies. As this value
1270
+ * increases above 1.0, the high-frequency decay time increases so it's longer
1271
+ * than the decay time at low frequencies. You hear a more brilliant
1272
+ * reverberation with a longer decay at high frequencies. As this value
1273
+ * decreases below 1.0, the high-frequency decay time decreases so it's
1274
+ * shorter than the decay time of the low frequencies. You hear a more natural
1275
+ * reverberation.
1276
+ */
1277
+ static
1278
+ VALUE
1279
+ set_rvb_hfdecay_ratio(VALUE rrvb, VALUE value)
1280
+ {
1281
+ return set_obj_float(rrvb, value, seal_set_rvb_hfdecay_ratio);
1282
+ }
1283
+
1284
+ /*
1285
+ * call-seq:
1286
+ * reverb.hfdecay_ratio -> flt
1287
+ *
1288
+ * Gets the high-frequency decay ratio of _reverb_. The default is 0.83.
1289
+ */
1290
+ static
1291
+ VALUE
1292
+ get_rvb_hfdecay_ratio(VALUE rrvb)
1293
+ {
1294
+ return get_obj_float(rrvb, seal_get_rvb_hfdecay_ratio);
1295
+ }
1296
+
1297
+ /*
1298
+ * call-seq:
1299
+ * reverb.reflections_gain = flt -> flt
1300
+ *
1301
+ * Sets the reflections gain, or the overall amount of initial reflections
1302
+ * relative to the gain of _reverb_ in the interval [0.0, 3.16], or from
1303
+ * -100 dB (no initial reflections at all) to 10 dB. The reflections gain is
1304
+ * corrected by the value of the gain property and does not affect the
1305
+ * subsequent reverberation decay.
1306
+ *
1307
+ * You can increase the amount of initial reflections to simulate a more
1308
+ * narrow space or closer walls, especially effective if you associate the
1309
+ * initial reflections increase with a reduction in reflections delays by
1310
+ * lowering the value of the reflection delay property. To simulate open or
1311
+ * semi-open environments, you can maintain the amount of early reflections
1312
+ * while reducing the value of the late gain property, which controls later
1313
+ * reflections.
1314
+ */
1315
+ static
1316
+ VALUE
1317
+ set_rvb_reflections_gain(VALUE rrvb, VALUE value)
1318
+ {
1319
+ return set_obj_float(rrvb, value, seal_set_rvb_reflections_gain);
1320
+ }
1321
+
1322
+ /*
1323
+ * call-seq:
1324
+ * reverb.reflections_gain -> flt
1325
+ *
1326
+ * Gets the reflections gain of _reverb_. The default is 0.05.
1327
+ */
1328
+ static
1329
+ VALUE
1330
+ get_rvb_reflections_gain(VALUE rrvb)
1331
+ {
1332
+ return get_obj_float(rrvb, seal_get_rvb_reflections_gain);
1333
+ }
1334
+
1335
+ /*
1336
+ * call-seq:
1337
+ * reverb.reflections_delay = flt -> flt
1338
+ *
1339
+ * Sets the reflections delay of _reverb_ in the interval [0.0, 0.3] (in
1340
+ * seconds). It is the amount of delay between the arrival time of the direct
1341
+ * path from the source to the first reflection from the source. You can
1342
+ * reduce or increase this delay to simulate closer or more distant reflective
1343
+ * surfaces and therefore control the perceived size of the room.
1344
+ */
1345
+ static
1346
+ VALUE
1347
+ set_rvb_reflections_delay(VALUE rrvb, VALUE value)
1348
+ {
1349
+ return set_obj_float(rrvb, value, seal_set_rvb_reflections_delay);
1350
+ }
1351
+
1352
+ /*
1353
+ * call-seq:
1354
+ * reverb.reflections_delay -> flt
1355
+ *
1356
+ * Gets the reflections delay of _reverb_. The default is 0.007.
1357
+ */
1358
+ static
1359
+ VALUE
1360
+ get_rvb_reflections_delay(VALUE rrvb)
1361
+ {
1362
+ return get_obj_float(rrvb, seal_get_rvb_reflections_delay);
1363
+ }
1364
+
1365
+ /*
1366
+ * call-seq:
1367
+ * reverb.late_gain = flt -> flt
1368
+ *
1369
+ * Sets the late gain, or the overall amount of later reverberation relative
1370
+ * to the gain of _reverb_ in the interval [0.0, 10.0], or from -100 dB (no
1371
+ * late reverberation at all) to 20 dB.
1372
+ *
1373
+ * Note that late gain and decay time are independent properties: if you
1374
+ * adjust decay time without changing late gain, the total intensity (the
1375
+ * averaged square of the amplitude) of the late reverberation remains
1376
+ * constant.
1377
+ */
1378
+ static
1379
+ VALUE
1380
+ set_rvb_late_gain(VALUE rrvb, VALUE value)
1381
+ {
1382
+ return set_obj_float(rrvb, value, seal_set_rvb_late_gain);
1383
+ }
1384
+
1385
+ /*
1386
+ * call-seq:
1387
+ * reverb.late_gain -> flt
1388
+ *
1389
+ * Gets the late gain of _reverb_. The default is 1.26.
1390
+ */
1391
+ static
1392
+ VALUE
1393
+ get_rvb_late_gain(VALUE rrvb)
1394
+ {
1395
+ return get_obj_float(rrvb, seal_get_rvb_late_gain);
1396
+ }
1397
+
1398
+ /*
1399
+ * call-seq:
1400
+ * reverb.late_delay = flt -> flt
1401
+ *
1402
+ * Sets the late delay of _reverb_ in the interval [0.0, 0.1] (in second)
1403
+ * It defines the begin time of the late reverberation relative to the time of
1404
+ * the initial reflection (the first of the early reflections). Reducing or
1405
+ * increasing late delay is useful for simulating a smaller or larger room.
1406
+ */
1407
+ static
1408
+ VALUE
1409
+ set_rvb_late_delay(VALUE rrvb, VALUE value)
1410
+ {
1411
+ return set_obj_float(rrvb, value, seal_set_rvb_late_delay);
1412
+ }
1413
+
1414
+ /*
1415
+ * call-seq:
1416
+ * reverb.late_delay -> flt
1417
+ *
1418
+ * Gets the late delay of _reverb_. The default is 0.011.
1419
+ */
1420
+ static
1421
+ VALUE
1422
+ get_rvb_late_delay(VALUE rrvb)
1423
+ {
1424
+ return get_obj_float(rrvb, seal_get_rvb_late_delay);
1425
+ }
1426
+ /*
1427
+ * call-seq:
1428
+ * reverb.air_absorbtion_hfgain = flt -> flt
1429
+ *
1430
+ * Sets the air absorption high-frequency gain of _reverb_ in the interval
1431
+ * [0.892, 1.0]. It controls the distance-dependent attenuation at high
1432
+ * frequencies caused by the propagation medium. It applies to reflected sound
1433
+ * only. You can use this value to simulate sound transmission through foggy
1434
+ * air, dry air, smoky atmosphere, and so on. The default value 0.994
1435
+ * (-0.05 dB) per meter, which roughly corresponds to typical condition of
1436
+ * atmospheric humidity, temperature, and so on. Lowering the value simulates
1437
+ * a more absorbent medium (more humidity in the air, for example); raising
1438
+ * the value simulates a less absorbent medium (dry desert air, for example).
1439
+ */
1440
+ static
1441
+ VALUE
1442
+ set_rvb_air_absorbtion_hfgain(VALUE rrvb, VALUE value)
1443
+ {
1444
+ return set_obj_float(rrvb, value, seal_set_rvb_air_absorbtion_hfgain);
1445
+ }
1446
+
1447
+ /*
1448
+ * call-seq:
1449
+ * reverb.air_absorbtion_hfgain -> flt
1450
+ *
1451
+ * Gets the air absorbtion high-frequency gain of _reverb_. The default is
1452
+ * 0.994.
1453
+ */
1454
+ static
1455
+ VALUE
1456
+ get_rvb_air_absorbtion_hfgain(VALUE rrvb)
1457
+ {
1458
+ return get_obj_float(rrvb, seal_get_rvb_air_absorbtion_hfgain);
1459
+ }
1460
+
1461
+ /*
1462
+ * call-seq:
1463
+ * reverb.room_rolloff_factor = flt -> flt
1464
+ *
1465
+ * Sets the room rolloff factor of _reverb_ in the interval [0.0, 10.0]. It
1466
+ * is one of two methods available to attenuate the reflected sound
1467
+ * (containing both reflections and reverberation) according to source-
1468
+ * listener distance. It is defined the same way as the global rolloff factor,
1469
+ * but operates on reverb sound instead of direct-path sound. Setting the room
1470
+ * rolloff factor value to 1.0 specifies that the reflected sound will decay
1471
+ * by 6 dB every time the distance doubles. Any value other than 1.0 is
1472
+ * equivalent to a scaling factor applied to the quantity specified by
1473
+ * ((source listener distance) - (Reference Distance)). Reference Distance is
1474
+ * an OpenAL source parameter that specifies the inner border for distance
1475
+ * rolloff effects: if the source comes closer to the listener than the
1476
+ * reference distance, the direct-path sound isn't increased as the source
1477
+ * comes closer to the listener, and neither is the reflected sound.
1478
+ *
1479
+ * The default value of Room Rolloff Factor is 0.0 because, by default, the
1480
+ * reverb effect naturally manages the reflected sound level automatically for
1481
+ * each sound source to simulate the natural rolloff of reflected sound vs.
1482
+ * distance in typical rooms. (Note that this isn't the case if the source
1483
+ * property @TODO is set to false.) You can use this value as an option to
1484
+ * automatic control so you can exaggerate or replace the default
1485
+ * automatically-controlled rolloff.
1486
+ */
1487
+ static
1488
+ VALUE
1489
+ set_rvb_room_rolloff_factor(VALUE rrvb, VALUE value)
1490
+ {
1491
+ return set_obj_float(rrvb, value, seal_set_rvb_room_rolloff_factor);
1492
+ }
1493
+
1494
+ /*
1495
+ * call-seq:
1496
+ * reverb.room_rolloff_factor -> flt
1497
+ *
1498
+ * Gets the room rolloff factor of _reverb_. The default is 0.0.
1499
+ */
1500
+ static
1501
+ VALUE
1502
+ get_rvb_room_rolloff_factor(VALUE rrvb)
1503
+ {
1504
+ return get_obj_float(rrvb, seal_get_rvb_room_rolloff_factor);
1505
+ }
1506
+
1507
+ /*
1508
+ * call-seq:
1509
+ * reverb.hfdecay_limited = true or false -> true or false
1510
+ *
1511
+ * Sets whether the high-frequency decay time automatically stays below a
1512
+ * limit value that's derived from the setting of the air absorption high-
1513
+ * frequency gain. This limit applies regardless of the setting of the
1514
+ * decay high-frequency ratio, and the limit doesn't affect the value of decay
1515
+ * high-frequency ratio. This limit, when on, maintains a natural sounding
1516
+ * reverberation decay by allowing you to increase the value of decay time
1517
+ * without the risk of getting an unnaturally long decay time at high
1518
+ * frequencies. If this flag is set to false, high-frequency decay time isn't
1519
+ * automatically limited.
1520
+ */
1521
+ static
1522
+ VALUE
1523
+ set_rvb_hfdecay_limited(VALUE rrvb, VALUE value)
1524
+ {
1525
+ return set_obj_char(rrvb, value, seal_set_rvb_hfdecay_limited);
1526
+ }
1527
+
1528
+ /*
1529
+ * call-seq:
1530
+ * reverb.hfdecay_limited -> true or false
1531
+ *
1532
+ * Determines if the high-frequency decay of _reverb_ is limited. The default
1533
+ * is true.
1534
+ */
1535
+ static
1536
+ VALUE
1537
+ is_rvb_hfdecay_limited(VALUE rrvb)
1538
+ {
1539
+ return get_obj_char(rrvb, seal_is_rvb_hfdecay_limited);
1540
+ }
1541
+
1542
+ /*
1543
+ * call-seq:
1544
+ * effect_slot.effect = effect -> effect
1545
+ *
1546
+ * Fills _effect_slot_ with _effect_, then _effect_slot_ will become ready to
1547
+ * feed sources. Pass nil to unfill the slot.
1548
+ */
1549
+ static
1550
+ VALUE
1551
+ set_efs_effect(VALUE rslot, VALUE reffect)
1552
+ {
1553
+ void* effect;
1554
+ seal_err_t err;
1555
+
1556
+ if (NIL_P(reffect)) {
1557
+ err = seal_set_efs_effect(DATA_PTR(rslot), 0);
1558
+ } else {
1559
+ Data_Get_Struct(reffect, void*, effect);
1560
+ err = seal_set_efs_effect(DATA_PTR(rslot), effect);
1561
+ }
1562
+ check_seal_err(err);
1563
+ rb_iv_set(rslot, "@effect", reffect);
1564
+
1565
+ return reffect;
1566
+ }
1567
+
1568
+ /*
1569
+ * call-seq:
1570
+ * EffectSlot.new -> effect_slot
1571
+ * EffectSlot.new(effect) -> effect_slot
1572
+ *
1573
+ * Initializes a new effect slot. If an effect object is specified,
1574
+ * initializes the effect slot to have that effect object associated.
1575
+ */
1576
+ static
1577
+ VALUE
1578
+ init_efs(int argc, VALUE* argv, VALUE rslot)
1579
+ {
1580
+ VALUE reffect;
1581
+
1582
+ rb_scan_args(argc, argv, "01", &reffect);
1583
+ check_seal_err(seal_init_efs(DATA_PTR(rslot)));
1584
+ if (!NIL_P(reffect))
1585
+ set_efs_effect(rslot, reffect);
1586
+
1587
+ return rslot;
1588
+ }
1589
+
1590
+ /*
1591
+ * call-seq:
1592
+ * effect_slot.effect -> effect
1593
+ *
1594
+ * Gets the effect object in _effect_slot_. The default is nil.
1595
+ */
1596
+ static
1597
+ VALUE
1598
+ get_efs_effect(VALUE rslot)
1599
+ {
1600
+ return rb_iv_get(rslot, "@effect");
1601
+ }
1602
+
1603
+ /*
1604
+ * call-seq:
1605
+ * slot.feed(index, source) -> slot
1606
+ *
1607
+ * Mixes a sound effect loaded into _effect_slot_ with _source_'s output.
1608
+ * Later calls to this function with a different effect slot and the same
1609
+ * index will override the old effect slot association.
1610
+ */
1611
+ static
1612
+ VALUE
1613
+ feed_efs(VALUE rslot, VALUE rindex, VALUE rsrc)
1614
+ {
1615
+ seal_src_t* src;
1616
+
1617
+ Data_Get_Struct(rsrc, seal_src_t, src);
1618
+ check_seal_err(seal_feed_efs(DATA_PTR(rslot), NUM2INT(rindex), src));
1619
+
1620
+ return rslot;
1621
+ }
1622
+
1623
+ /*
1624
+ * call-seq:
1625
+ * effect_slot.gain = flt -> flt
1626
+ *
1627
+ * Sets the output level of _effect_slot_ in the interval [0.0, 1.0]. A
1628
+ * value of 0.0 mutes the output.
1629
+ */
1630
+ static
1631
+ VALUE
1632
+ set_efs_gain(VALUE refs, VALUE value)
1633
+ {
1634
+ return set_obj_float(refs, value, seal_set_efs_gain);
1635
+ }
1636
+
1637
+ /*
1638
+ * call-seq:
1639
+ * effect_slot.gain -> flt
1640
+ *
1641
+ * Gets the output level of _effect_slot_ in the interval. The default is
1642
+ * 1.0.
1643
+ */
1644
+ static
1645
+ VALUE
1646
+ get_efs_gain(VALUE refs)
1647
+ {
1648
+ return get_obj_float(refs, seal_get_efs_gain);
1649
+ }
1650
+
1651
+ /*
1652
+ * call-seq:
1653
+ * effect_slot.auto = true or false -> true or false
1654
+ *
1655
+ * Sets whether the effect should have automatic adjustments based on the
1656
+ * physical positions of the sources and the listener.
1657
+ */
1658
+ static
1659
+ VALUE
1660
+ set_efs_auto(VALUE refs, VALUE value)
1661
+ {
1662
+ return set_obj_char(refs, value, seal_set_efs_auto);
1663
+ }
1664
+
1665
+ /*
1666
+ * call-seq:
1667
+ * effect_slot.auto -> true or false
1668
+ *
1669
+ * Determines if the effect is automatically adjusted. The default is true
1670
+ * (nonzero).
1671
+ */
1672
+ static
1673
+ VALUE
1674
+ is_efs_auto(VALUE refs)
1675
+ {
1676
+ return get_obj_char(refs, seal_is_efs_auto);
1677
+ }
1678
+
1679
+ /*
1680
+ * call-seq:
1681
+ * Seal.listener -> listener
1682
+ *
1683
+ * Gets the singleton Listener instance.
1684
+ */
1685
+ static
1686
+ VALUE
1687
+ get_listener()
1688
+ {
1689
+ return rb_const_get(mSeal, rb_intern("LISTENER"));
1690
+ }
1691
+
1692
+ /*
1693
+ * call-seq:
1694
+ * Seal.listener.gain = flt -> [flt, flt, flt]
1695
+ *
1696
+ * Sets the master scalar amplitude multiplier of the listener which applies
1697
+ * to all the sources. 1.0 means that the sound is unattenuated; 0.5 means
1698
+ * an attenuation of 6 dB; 0.0 means silence. The valid range is [0.0, +inf.).
1699
+ */
1700
+ static
1701
+ VALUE
1702
+ set_listener_gain(VALUE rlistener, VALUE value)
1703
+ {
1704
+ return set_listener_float(value, seal_set_listener_gain);
1705
+ }
1706
+
1707
+ /*
1708
+ * call-seq:
1709
+ * Seal.listener.gain -> flt
1710
+ *
1711
+ * Gets the gain of the listener. The default is 1.0.
1712
+ */
1713
+ static
1714
+ VALUE
1715
+ get_listener_gain(VALUE rlistener, VALUE value)
1716
+ {
1717
+ return get_listener_float(seal_get_listener_gain);
1718
+ }
1719
+
1720
+ /*
1721
+ * call-seq:
1722
+ * Seal.listener.position = [flt, flt, flt] -> [flt, flt, flt]
1723
+ *
1724
+ * Sets the position of the listener in a right-handed Cartesian coordinate
1725
+ * system. Use of NaN and infinity is undefined.
1726
+ */
1727
+ static
1728
+ VALUE
1729
+ set_listener_pos(VALUE rlistener, VALUE value)
1730
+ {
1731
+ return set_listener_3float(value, seal_set_listener_pos);
1732
+ }
1733
+
1734
+ /*
1735
+ * call-seq:
1736
+ * Seal.listener.position -> [flt, flt, flt]
1737
+ *
1738
+ * Gets the position of the listener. The default is ( 0.0, 0.0, 0.0 ).
1739
+ */
1740
+ static
1741
+ VALUE
1742
+ get_listener_pos(VALUE rlistener, VALUE value)
1743
+ {
1744
+ return get_listener_3float(seal_get_listener_pos);
1745
+ }
1746
+
1747
+ /*
1748
+ * call-seq:
1749
+ * Seal.listener.velocity = flt, flt, flt -> [flt, flt, flt]
1750
+ *
1751
+ * Sets the velocity of the listener in a right-handed Cartesian coordinate
1752
+ * system. The velocity of the listener does not affect its position but is a
1753
+ * factor used during the Doppler effect emulation.
1754
+ */
1755
+ static
1756
+ VALUE
1757
+ set_listener_vel(VALUE rlistener, VALUE value)
1758
+ {
1759
+ return set_listener_3float(value, seal_set_listener_vel);
1760
+ }
1761
+
1762
+
1763
+ /*
1764
+ * call-seq:
1765
+ * Seal.listener.velocity -> [flt, flt, flt]
1766
+ *
1767
+ * Gets the velocity of the listener. The default is ( 0.0, 0.0, 0.0 ).
1768
+ */
1769
+ static
1770
+ VALUE
1771
+ get_listener_vel(VALUE rlistener, VALUE value)
1772
+ {
1773
+ return get_listener_3float(seal_get_listener_vel);
1774
+ }
1775
+
1776
+ /*
1777
+ * call-seq:
1778
+ * Seal.listener.orientation = [flt, flt, flt], [flt, flt, flt]
1779
+ * -> [[flt, flt, flt], [flt, flt, flt]]
1780
+ *
1781
+ * Sets the orientation of the listener. The argument must be a pair of
1782
+ * 3-tuple consisting of an 'at' vector and an 'up' vector, where the 'at'
1783
+ * vector represents the 'forward' direction of the listener and the 'up'
1784
+ * vector represents the 'up' direction for the listener. These two vectors
1785
+ * must be linearly independent, must not be NaN and must not be normalized.
1786
+ * Otherwise, the operation is undefined.
1787
+ */
1788
+ static
1789
+ VALUE
1790
+ set_listener_orien(VALUE rlistener, VALUE rarr)
1791
+ {
1792
+ float orien[6];
1793
+
1794
+ rarr = rb_convert_type(rarr, T_ARRAY, "Array", "to_a");
1795
+ extract_3float(rb_ary_entry(rarr, 0), orien, orien + 1, orien + 2);
1796
+ extract_3float(rb_ary_entry(rarr, 1), orien + 3, orien + 4, orien + 5);
1797
+ check_seal_err(seal_set_listener_orien(orien));
1798
+
1799
+ return rarr;
1800
+ }
1801
+
1802
+ /*
1803
+ * call-seq:
1804
+ * Seal.listener.orientation -> [[flt, flt, flt], [flt, flt, flt]]
1805
+ *
1806
+ * Gets the orientation of the listener. The default is
1807
+ * ((0.0, 0.0, -1.0), (0.0, 1.0, 0.0)).
1808
+ *
1809
+ * Examples:
1810
+ * # at references the `at' vector [flt, flt, flt]
1811
+ * # up references the `up' vector [flt, flt, flt]
1812
+ * at, up = Seal.listener.orientation
1813
+ * # at_x references the x component of the `at' vector
1814
+ * # ...
1815
+ * # up_z references the z component of the `up' vector
1816
+ * (at_x, at_y, ay_z), (up_x, up_y, up_z) = Seal.listener.orientation
1817
+ */
1818
+ static
1819
+ VALUE
1820
+ get_listener_orien(VALUE rlistener)
1821
+ {
1822
+ float tuple[6];
1823
+ VALUE rtuple[6];
1824
+ VALUE orien[2];
1825
+
1826
+ check_seal_err(seal_get_listener_orien(tuple));
1827
+ convert_bulk_float(rtuple, tuple, 6);
1828
+ orien[0] = rb_ary_new4(3, rtuple);
1829
+ orien[1] = rb_ary_new4(3, rtuple + 3);
1830
+
1831
+ return rb_ary_new4(2, orien);
1832
+ }
1833
+
1834
+ static
1835
+ void
1836
+ singletonify(VALUE klass)
1837
+ {
1838
+ rb_undef_alloc_func(klass);
1839
+ rb_undef_method(rb_singleton_class(klass), "new");
1840
+ }
1841
+
1842
+ /*
1843
+ * Document-module: Seal::Format
1844
+ *
1845
+ * A collection of supported audio formats.
1846
+ */
1847
+
1848
+ /*
1849
+ * Document-class: Seal::SealError
1850
+ *
1851
+ * The Seal Exception class.
1852
+ */
1853
+
1854
+ static
1855
+ void
1856
+ bind_core(void)
1857
+ {
1858
+ VALUE mFormat;
1859
+
1860
+ mSeal = rb_define_module("Seal");
1861
+ mFormat = rb_define_module_under(mSeal, "Format");
1862
+
1863
+ eSealError = rb_define_class_under(mSeal, "SealError", rb_eException);
1864
+ rb_define_singleton_method(mSeal, "startup", startup, -1);
1865
+ rb_define_singleton_method(mSeal, "cleanup", cleanup, 0);
1866
+ rb_define_singleton_method(mSeal, "per_source_effect_limit",
1867
+ per_source_effect_limit, 0);
1868
+ /* A string indicating the version of Seal. */
1869
+ rb_define_const(mSeal, "VERSION", rb_str_new2(seal_get_version()));
1870
+ /* WAVE format. */
1871
+ rb_define_const(mFormat, "WAV", name2sym(WAV_SYM));
1872
+ /* Ogg Vorbis format. */
1873
+ rb_define_const(mFormat, "OV", name2sym(OV_SYM));
1874
+ /* MPEG audio format. */
1875
+ rb_define_const(mFormat, "MPG", name2sym(MPG_SYM));
1876
+ }
1877
+
1878
+ /*
1879
+ * Document-class: Seal::Buffer
1880
+ *
1881
+ * Buffers are essentially abstract representations of the (raw) audio data
1882
+ * and are used by sources. Buffers are most suitable for small-sized sound
1883
+ * effect which can be efficiently loaded to memory at once. Streams, on the
1884
+ * other hand, are more suitable for long audio such as background music.
1885
+ */
1886
+ static
1887
+ void
1888
+ bind_buf(void)
1889
+ {
1890
+ VALUE cBuffer = rb_define_class_under(mSeal, "Buffer", rb_cObject);
1891
+
1892
+ rb_define_alloc_func(cBuffer, alloc_buf);
1893
+ rb_define_method(cBuffer, "initialize", init_buf, -1);
1894
+ rb_define_method(cBuffer, "load", load_buf, -1);
1895
+ rb_define_method(cBuffer, "size", get_buf_size, 0);
1896
+ rb_define_method(cBuffer, "frequency", get_buf_freq, 0);
1897
+ rb_define_method(cBuffer, "bit_depth", get_buf_bps, 0);
1898
+ rb_define_method(cBuffer, "channel_count", get_buf_nchannels, 0);
1899
+ }
1900
+
1901
+ /*
1902
+ * Document-class: Seal::Stream
1903
+ *
1904
+ * Streams are used by streaming sources to avoid loading big audio into
1905
+ * memory. It is the front end for various decoders.
1906
+ */
1907
+ static
1908
+ void
1909
+ bind_stream(void)
1910
+ {
1911
+ VALUE cStream = rb_define_class_under(mSeal, "Stream", rb_cObject);
1912
+
1913
+ rb_define_alloc_func(cStream, alloc_stream);
1914
+ rb_define_method(cStream, "initialize", init_stream, -1);
1915
+ rb_define_method(cStream, "frequency", get_stream_freq, 0);
1916
+ rb_define_method(cStream, "bit_depth", get_stream_bps, 0);
1917
+ rb_define_method(cStream, "channel_count", get_stream_nchannels, 0);
1918
+ rb_define_method(cStream, "rewind", rewind_stream, 0);
1919
+ rb_define_method(cStream, "close", close_stream, 0);
1920
+ rb_define_alias(rb_singleton_class(cStream), "open", "new");
1921
+ }
1922
+
1923
+ /*
1924
+ * Document-class: Seal::Source
1925
+ *
1926
+ * Sources are abstract representations of sound sources which emit sound in
1927
+ * Euclidean space.
1928
+ */
1929
+
1930
+ /*
1931
+ * Document-module: Seal::Source::State
1932
+ *
1933
+ * A collection of Source states.
1934
+ */
1935
+
1936
+ /*
1937
+ * Document-module: Seal::Source::Type
1938
+ *
1939
+ * A collection of Source types.
1940
+ */
1941
+ static
1942
+ void
1943
+ bind_src(void)
1944
+ {
1945
+ VALUE cSource = rb_define_class_under(mSeal, "Source", rb_cObject);
1946
+ VALUE mState = rb_define_module_under(cSource, "State");
1947
+ VALUE mType = rb_define_module_under(cSource, "Type");
1948
+
1949
+ rb_define_alloc_func(cSource, alloc_src);
1950
+ rb_define_method(cSource, "initialize", init_src, 0);
1951
+ rb_define_method(cSource, "play", play_src, 0);
1952
+ rb_define_method(cSource, "pause", pause_src, 0);
1953
+ rb_define_method(cSource, "stop", stop_src, 0);
1954
+ rb_define_method(cSource, "rewind", rewind_src, 0);
1955
+ rb_define_method(cSource, "buffer=", set_src_buf, 1);
1956
+ rb_define_method(cSource, "buffer", get_src_buf, 0);
1957
+ rb_define_method(cSource, "stream=", set_src_stream, 1);
1958
+ rb_define_method(cSource, "stream", get_src_stream, 0);
1959
+ rb_define_method(cSource, "update", update_src, 0);
1960
+ rb_define_method(cSource, "position=", set_src_pos, 1);
1961
+ rb_define_method(cSource, "position", get_src_pos, 0);
1962
+ rb_define_method(cSource, "velocity=", set_src_vel, 1);
1963
+ rb_define_method(cSource, "velocity", get_src_vel, 0);
1964
+ rb_define_method(cSource, "pitch=", set_src_pitch, 1);
1965
+ rb_define_method(cSource, "pitch", get_src_pitch, 0);
1966
+ rb_define_method(cSource, "gain=", set_src_gain, 1);
1967
+ rb_define_method(cSource, "gain", get_src_gain, 0);
1968
+ rb_define_method(cSource, "auto=", set_src_auto, 1);
1969
+ rb_define_method(cSource, "auto", is_src_auto, 0);
1970
+ rb_define_alias(cSource, "auto?", "auto");
1971
+ rb_define_method(cSource, "relative=", set_src_relative, 1);
1972
+ rb_define_method(cSource, "relative", is_src_relative, 0);
1973
+ rb_define_alias(cSource, "relative?", "relative");
1974
+ rb_define_method(cSource, "looping=", set_src_looping, 1);
1975
+ rb_define_method(cSource, "looping", is_src_looping, 0);
1976
+ rb_define_alias(cSource, "looping?", "looping");
1977
+ rb_define_method(cSource, "queue_size=", set_src_queue_size, 1);
1978
+ rb_define_method(cSource, "queue_size", get_src_queue_size, 0);
1979
+ rb_define_method(cSource, "chunk_size=", set_src_chunk_size, 1);
1980
+ rb_define_method(cSource, "chunk_size", get_src_chunk_size, 0);
1981
+ rb_define_method(cSource, "type", get_src_type, 0);
1982
+ rb_define_method(cSource, "state", get_src_state, 0);
1983
+
1984
+ /* Indicates a source is in initial state. */
1985
+ rb_define_const(mState, "INITIAL", name2sym(INITIAL_SYM));
1986
+ /* Indicates a source is playing. */
1987
+ rb_define_const(mState, "PLAYING", name2sym(PLAYING_SYM));
1988
+ /* Indicates a source is paused from playing. */
1989
+ rb_define_const(mState, "PAUSED", name2sym(PAUSED_SYM));
1990
+ /* Indicates a source is stopped from playing. */
1991
+ rb_define_const(mState, "STOPPED", name2sym(STOPPED_SYM));
1992
+
1993
+ /* Sources with no audio attached. */
1994
+ rb_define_const(mType, "UNDETERMINED", name2sym(UNDETERMINED_SYM));
1995
+ /* Sources with an audio buffer attached. */
1996
+ rb_define_const(mType, "STATIC", name2sym(STATIC_SYM));
1997
+ /* Sources with an audio stream attached. */
1998
+ rb_define_const(mType, "STREAMING", name2sym(STREAMING_SYM));
1999
+ }
2000
+
2001
+ /*
2002
+ * Document-class: Seal::Reverb
2003
+ *
2004
+ * A Reverb object is a set of parameters that define a reverberation effect.
2005
+ * Effect objects can be put into an effect slot for sources to use.
2006
+ */
2007
+ static
2008
+ void
2009
+ bind_rvb(void)
2010
+ {
2011
+ VALUE cReverb = rb_define_class_under(mSeal, "Reverb", rb_cObject);
2012
+ VALUE mPreset = rb_define_module_under(cReverb, "Preset");
2013
+ VALUE mCastle = rb_define_module_under(mPreset, "Castle");
2014
+ VALUE mFactory = rb_define_module_under(mPreset, "Factory");
2015
+ VALUE mIcePalace = rb_define_module_under(mPreset, "IcePalace");
2016
+ VALUE mSpaceStation = rb_define_module_under(mPreset, "SpaceStation");
2017
+ VALUE mWoodenGalleon = rb_define_module_under(mPreset, "WoodenGalleon");
2018
+ VALUE mSports = rb_define_module_under(mPreset, "Sports");
2019
+ VALUE mPrefab = rb_define_module_under(mPreset, "Prefab");
2020
+ VALUE mDome = rb_define_module_under(mPreset, "Dome");
2021
+ VALUE mPipe = rb_define_module_under(mPreset, "Pipe");
2022
+ VALUE mOutdoors = rb_define_module_under(mPreset, "Outdoors");
2023
+ VALUE mMood = rb_define_module_under(mPreset, "Mood");
2024
+ VALUE mDriving = rb_define_module_under(mPreset, "Driving");
2025
+ VALUE mCity = rb_define_module_under(mPreset, "City");
2026
+ VALUE mMisc = rb_define_module_under(mPreset, "Misc");
2027
+
2028
+ rb_define_alloc_func(cReverb, alloc_rvb);
2029
+ rb_define_method(cReverb, "initialize", init_rvb, -1);
2030
+ rb_define_method(cReverb, "load", load_rvb, 1);
2031
+ rb_define_method(cReverb, "density=", set_rvb_density, 1);
2032
+ rb_define_method(cReverb, "density", get_rvb_density, 0);
2033
+ rb_define_method(cReverb, "diffusion=", set_rvb_diffusion, 1);
2034
+ rb_define_method(cReverb, "diffusion", get_rvb_diffusion, 0);
2035
+ rb_define_method(cReverb, "gain=", set_rvb_gain, 1);
2036
+ rb_define_method(cReverb, "gain", get_rvb_gain, 0);
2037
+ rb_define_method(cReverb, "hfgain=", set_rvb_hfgain, 1);
2038
+ rb_define_method(cReverb, "hfgain", get_rvb_hfgain, 0);
2039
+ rb_define_method(cReverb, "decay_time=", set_rvb_decay_time, 1);
2040
+ rb_define_method(cReverb, "decay_time", get_rvb_decay_time, 0);
2041
+ rb_define_method(cReverb, "hfdecay_ratio=", set_rvb_hfdecay_ratio, 1);
2042
+ rb_define_method(cReverb, "hfdecay_ratio", get_rvb_hfdecay_ratio, 0);
2043
+ rb_define_method(cReverb, "reflections_gain=",
2044
+ set_rvb_reflections_gain, 1);
2045
+ rb_define_method(cReverb, "reflections_gain",
2046
+ get_rvb_reflections_gain, 0);
2047
+ rb_define_method(cReverb, "reflections_delay=",
2048
+ set_rvb_reflections_delay, 1);
2049
+ rb_define_method(cReverb, "reflections_delay",
2050
+ get_rvb_reflections_delay, 0);
2051
+ rb_define_method(cReverb, "late_gain=", set_rvb_late_gain, 1);
2052
+ rb_define_method(cReverb, "late_gain", get_rvb_late_gain, 0);
2053
+ rb_define_method(cReverb, "late_delay=", set_rvb_late_delay, 1);
2054
+ rb_define_method(cReverb, "late_delay", get_rvb_late_delay, 0);
2055
+ rb_define_method(cReverb, "air_absorbtion_hfgain=",
2056
+ set_rvb_air_absorbtion_hfgain, 1);
2057
+ rb_define_method(cReverb, "air_absorbtion_hfgain",
2058
+ get_rvb_air_absorbtion_hfgain, 0);
2059
+ rb_define_method(cReverb, "room_rolloff_factor=",
2060
+ set_rvb_room_rolloff_factor, 1);
2061
+ rb_define_method(cReverb, "room_rolloff_factor",
2062
+ get_rvb_room_rolloff_factor, 0);
2063
+ rb_define_method(cReverb, "hfdecay_limited=",
2064
+ set_rvb_hfdecay_limited, 1);
2065
+ rb_define_method(cReverb, "hfdecay_limited",
2066
+ is_rvb_hfdecay_limited, 0);
2067
+ rb_define_alias(cReverb, "hfdecay_limited?", "hfdecay_limited");
2068
+
2069
+ rb_define_const(mPreset, "GENERIC", INT2NUM(SEAL_GENERIC_REVERB));
2070
+ rb_define_const(mPreset, "PADDEDCELL", INT2NUM(SEAL_PADDEDCELL_REVERB));
2071
+ rb_define_const(mPreset, "ROOM", INT2NUM(SEAL_ROOM_REVERB));
2072
+ rb_define_const(mPreset, "BATHROOM", INT2NUM(SEAL_BATHROOM_REVERB));
2073
+ rb_define_const(mPreset, "LIVINGROOM", INT2NUM(SEAL_LIVINGROOM_REVERB));
2074
+ rb_define_const(mPreset, "STONEROOM", INT2NUM(SEAL_STONEROOM_REVERB));
2075
+ rb_define_const(mPreset, "AUDITORIUM", INT2NUM(SEAL_AUDITORIUM_REVERB));
2076
+ rb_define_const(mPreset, "CONCERTHALL", INT2NUM(SEAL_CONCERTHALL_REVERB));
2077
+ rb_define_const(mPreset, "CAVE", INT2NUM(SEAL_CAVE_REVERB));
2078
+ rb_define_const(mPreset, "ARENA", INT2NUM(SEAL_ARENA_REVERB));
2079
+ rb_define_const(mPreset, "HANGAR", INT2NUM(SEAL_HANGAR_REVERB));
2080
+ rb_define_const(mPreset, "CARPETEDHALLWAY",
2081
+ INT2NUM(SEAL_CARPETEDHALLWAY_REVERB));
2082
+ rb_define_const(mPreset, "HALLWAY", INT2NUM(SEAL_HALLWAY_REVERB));
2083
+ rb_define_const(mPreset, "STONECORRIDOR",
2084
+ INT2NUM(SEAL_STONECORRIDOR_REVERB));
2085
+ rb_define_const(mPreset, "ALLEY", INT2NUM(SEAL_ALLEY_REVERB));
2086
+ rb_define_const(mPreset, "FOREST", INT2NUM(SEAL_FOREST_REVERB));
2087
+ rb_define_const(mPreset, "CITY", INT2NUM(SEAL_CITY_REVERB));
2088
+ rb_define_const(mPreset, "MOUNTAINS", INT2NUM(SEAL_MOUNTAINS_REVERB));
2089
+ rb_define_const(mPreset, "QUARRY", INT2NUM(SEAL_QUARRY_REVERB));
2090
+ rb_define_const(mPreset, "PLAIN", INT2NUM(SEAL_PLAIN_REVERB));
2091
+ rb_define_const(mPreset, "PARKINGLOT", INT2NUM(SEAL_PARKINGLOT_REVERB));
2092
+ rb_define_const(mPreset, "SEWERPIPE", INT2NUM(SEAL_SEWERPIPE_REVERB));
2093
+ rb_define_const(mPreset, "UNDERWATER", INT2NUM(SEAL_UNDERWATER_REVERB));
2094
+ rb_define_const(mPreset, "DRUGGED", INT2NUM(SEAL_DRUGGED_REVERB));
2095
+ rb_define_const(mPreset, "DIZZY", INT2NUM(SEAL_DIZZY_REVERB));
2096
+ rb_define_const(mPreset, "PSYCHOTIC", INT2NUM(SEAL_PSYCHOTIC_REVERB));
2097
+
2098
+ rb_define_const(mCastle, "SMALLROOM",
2099
+ INT2NUM(SEAL_CASTLE_SMALLROOM_REVERB));
2100
+ rb_define_const(mCastle, "SHORTPASSAGE",
2101
+ INT2NUM(SEAL_CASTLE_SHORTPASSAGE_REVERB));
2102
+ rb_define_const(mCastle, "MEDIUMROOM",
2103
+ INT2NUM(SEAL_CASTLE_MEDIUMROOM_REVERB));
2104
+ rb_define_const(mCastle, "LARGEROOM",
2105
+ INT2NUM(SEAL_CASTLE_LARGEROOM_REVERB));
2106
+ rb_define_const(mCastle, "LONGPASSAGE",
2107
+ INT2NUM(SEAL_CASTLE_LONGPASSAGE_REVERB));
2108
+ rb_define_const(mCastle, "HALL", INT2NUM(SEAL_CASTLE_HALL_REVERB));
2109
+ rb_define_const(mCastle, "CUPBOARD", INT2NUM(SEAL_CASTLE_CUPBOARD_REVERB));
2110
+ rb_define_const(mCastle, "COURTYARD",
2111
+ INT2NUM(SEAL_CASTLE_COURTYARD_REVERB));
2112
+ rb_define_const(mCastle, "ALCOVE", INT2NUM(SEAL_CASTLE_ALCOVE_REVERB));
2113
+
2114
+ rb_define_const(mFactory, "SMALLROOM",
2115
+ INT2NUM(SEAL_FACTORY_SMALLROOM_REVERB));
2116
+ rb_define_const(mFactory, "SHORTPASSAGE",
2117
+ INT2NUM(SEAL_FACTORY_SHORTPASSAGE_REVERB));
2118
+ rb_define_const(mFactory, "MEDIUMROOM",
2119
+ INT2NUM(SEAL_FACTORY_MEDIUMROOM_REVERB));
2120
+ rb_define_const(mFactory, "LARGEROOM",
2121
+ INT2NUM(SEAL_FACTORY_LARGEROOM_REVERB));
2122
+ rb_define_const(mFactory, "LONGPASSAGE",
2123
+ INT2NUM(SEAL_FACTORY_LONGPASSAGE_REVERB));
2124
+ rb_define_const(mFactory, "HALL", INT2NUM(SEAL_FACTORY_HALL_REVERB));
2125
+ rb_define_const(mFactory, "CUPBOARD",
2126
+ INT2NUM(SEAL_FACTORY_CUPBOARD_REVERB));
2127
+ rb_define_const(mFactory, "COURTYARD",
2128
+ INT2NUM(SEAL_FACTORY_COURTYARD_REVERB));
2129
+ rb_define_const(mFactory, "ALCOVE",
2130
+ INT2NUM(SEAL_FACTORY_ALCOVE_REVERB));
2131
+
2132
+ rb_define_const(mIcePalace, "SMALLROOM",
2133
+ INT2NUM(SEAL_ICEPALACE_SMALLROOM_REVERB));
2134
+ rb_define_const(mIcePalace, "SHORTPASSAGE",
2135
+ INT2NUM(SEAL_ICEPALACE_SHORTPASSAGE_REVERB));
2136
+ rb_define_const(mIcePalace, "MEDIUMROOM",
2137
+ INT2NUM(SEAL_ICEPALACE_MEDIUMROOM_REVERB));
2138
+ rb_define_const(mIcePalace, "LARGEROOM",
2139
+ INT2NUM(SEAL_ICEPALACE_LARGEROOM_REVERB));
2140
+ rb_define_const(mIcePalace, "LONGPASSAGE",
2141
+ INT2NUM(SEAL_ICEPALACE_LONGPASSAGE_REVERB));
2142
+ rb_define_const(mIcePalace, "HALL",
2143
+ INT2NUM(SEAL_ICEPALACE_HALL_REVERB));
2144
+ rb_define_const(mIcePalace, "CUPBOARD",
2145
+ INT2NUM(SEAL_ICEPALACE_CUPBOARD_REVERB));
2146
+ rb_define_const(mIcePalace, "COURTYARD",
2147
+ INT2NUM(SEAL_ICEPALACE_COURTYARD_REVERB));
2148
+ rb_define_const(mIcePalace, "ALCOVE",
2149
+ INT2NUM(SEAL_ICEPALACE_ALCOVE_REVERB));
2150
+
2151
+ rb_define_const(mSpaceStation, "SMALLROOM",
2152
+ INT2NUM(SEAL_SPACESTATION_SMALLROOM_REVERB));
2153
+ rb_define_const(mSpaceStation, "SHORTPASSAGE",
2154
+ INT2NUM(SEAL_SPACESTATION_SHORTPASSAGE_REVERB));
2155
+ rb_define_const(mSpaceStation, "MEDIUMROOM",
2156
+ INT2NUM(SEAL_SPACESTATION_MEDIUMROOM_REVERB));
2157
+ rb_define_const(mSpaceStation, "LARGEROOM",
2158
+ INT2NUM(SEAL_SPACESTATION_LARGEROOM_REVERB));
2159
+ rb_define_const(mSpaceStation, "LONGPASSAGE",
2160
+ INT2NUM(SEAL_SPACESTATION_LONGPASSAGE_REVERB));
2161
+ rb_define_const(mSpaceStation, "HALL",
2162
+ INT2NUM(SEAL_SPACESTATION_HALL_REVERB));
2163
+ rb_define_const(mSpaceStation, "CUPBOARD",
2164
+ INT2NUM(SEAL_SPACESTATION_CUPBOARD_REVERB));
2165
+ rb_define_const(mSpaceStation, "ALCOVE",
2166
+ INT2NUM(SEAL_SPACESTATION_ALCOVE_REVERB));
2167
+ rb_define_const(mWoodenGalleon, "SMALLROOM",
2168
+ INT2NUM(SEAL_WOODEN_SMALLROOM_REVERB));
2169
+ rb_define_const(mWoodenGalleon, "SHORTPASSAGE",
2170
+ INT2NUM(SEAL_WOODEN_SHORTPASSAGE_REVERB));
2171
+ rb_define_const(mWoodenGalleon, "MEDIUMROOM",
2172
+ INT2NUM(SEAL_WOODEN_MEDIUMROOM_REVERB));
2173
+ rb_define_const(mWoodenGalleon, "LARGEROOM",
2174
+ INT2NUM(SEAL_WOODEN_LARGEROOM_REVERB));
2175
+ rb_define_const(mWoodenGalleon, "LONGPASSAGE",
2176
+ INT2NUM(SEAL_WOODEN_LONGPASSAGE_REVERB));
2177
+ rb_define_const(mWoodenGalleon, "HALL", INT2NUM(SEAL_WOODEN_HALL_REVERB));
2178
+ rb_define_const(mWoodenGalleon, "CUPBOARD",
2179
+ INT2NUM(SEAL_WOODEN_CUPBOARD_REVERB));
2180
+ rb_define_const(mWoodenGalleon, "COURTYARD",
2181
+ INT2NUM(SEAL_WOODEN_COURTYARD_REVERB));
2182
+ rb_define_const(mWoodenGalleon, "ALCOVE",
2183
+ INT2NUM(SEAL_WOODEN_ALCOVE_REVERB));
2184
+
2185
+ rb_define_const(mSports, "EMPTYSTADIUM",
2186
+ INT2NUM(SEAL_SPORT_EMPTYSTADIUM_REVERB));
2187
+ rb_define_const(mSports, "SQUASHCOURT",
2188
+ INT2NUM(SEAL_SPORT_SQUASHCOURT_REVERB));
2189
+ rb_define_const(mSports, "SMALLSWIMMINGPOOL",
2190
+ INT2NUM(SEAL_SPORT_SMALLSWIMMINGPOOL_REVERB));
2191
+ rb_define_const(mSports, "LARGESWIMMINGPOOL",
2192
+ INT2NUM(SEAL_SPORT_LARGESWIMMINGPOOL_REVERB));
2193
+ rb_define_const(mSports, "GYMNASIUM",
2194
+ INT2NUM(SEAL_SPORT_GYMNASIUM_REVERB));
2195
+ rb_define_const(mSports, "FULLSTADIUM",
2196
+ INT2NUM(SEAL_SPORT_FULLSTADIUM_REVERB));
2197
+ rb_define_const(mSports, "STADIUMTANNOY",
2198
+ INT2NUM(SEAL_SPORT_STADIUMTANNOY_REVERB));
2199
+
2200
+ rb_define_const(mPrefab, "WORKSHOP", INT2NUM(SEAL_PREFAB_WORKSHOP_REVERB));
2201
+ rb_define_const(mPrefab, "SCHOOLROOM",
2202
+ INT2NUM(SEAL_PREFAB_SCHOOLROOM_REVERB));
2203
+ rb_define_const(mPrefab, "PRACTISEROOM",
2204
+ INT2NUM(SEAL_PREFAB_PRACTISEROOM_REVERB));
2205
+ rb_define_const(mPrefab, "OUTHOUSE", INT2NUM(SEAL_PREFAB_OUTHOUSE_REVERB));
2206
+ rb_define_const(mPrefab, "CARAVAN", INT2NUM(SEAL_PREFAB_CARAVAN_REVERB));
2207
+
2208
+ rb_define_const(mDome, "TOMB", INT2NUM(SEAL_DOME_TOMB_REVERB));
2209
+ rb_define_const(mDome, "SAINTPAULS", INT2NUM(SEAL_DOME_SAINTPAULS_REVERB));
2210
+
2211
+ rb_define_const(mPipe, "SMALL", INT2NUM(SEAL_PIPE_SMALL_REVERB));
2212
+ rb_define_const(mPipe, "LONGTHIN", INT2NUM(SEAL_PIPE_LONGTHIN_REVERB));
2213
+ rb_define_const(mPipe, "LARGE", INT2NUM(SEAL_PIPE_LARGE_REVERB));
2214
+ rb_define_const(mPipe, "RESONANT", INT2NUM(SEAL_PIPE_RESONANT_REVERB));
2215
+
2216
+ rb_define_const(mOutdoors, "BACKYARD",
2217
+ INT2NUM(SEAL_OUTDOORS_BACKYARD_REVERB));
2218
+ rb_define_const(mOutdoors, "ROLLINGPLAINS",
2219
+ INT2NUM(SEAL_OUTDOORS_ROLLINGPLAINS_REVERB));
2220
+ rb_define_const(mOutdoors, "DEEPCANYON",
2221
+ INT2NUM(SEAL_OUTDOORS_DEEPCANYON_REVERB));
2222
+ rb_define_const(mOutdoors, "CREEK",
2223
+ INT2NUM(SEAL_OUTDOORS_CREEK_REVERB));
2224
+ rb_define_const(mOutdoors, "VALLEY",
2225
+ INT2NUM(SEAL_OUTDOORS_VALLEY_REVERB));
2226
+
2227
+ rb_define_const(mMood, "HEAVEN",
2228
+ INT2NUM(SEAL_MOOD_HEAVEN_REVERB));
2229
+ rb_define_const(mMood, "HELL",
2230
+ INT2NUM(SEAL_MOOD_HELL_REVERB));
2231
+ rb_define_const(mMood, "MEMORY",
2232
+ INT2NUM(SEAL_MOOD_MEMORY_REVERB));
2233
+
2234
+ rb_define_const(mDriving, "COMMENTATOR",
2235
+ INT2NUM(SEAL_DRIVING_COMMENTATOR_REVERB));
2236
+ rb_define_const(mDriving, "PITGARAGE",
2237
+ INT2NUM(SEAL_DRIVING_PITGARAGE_REVERB));
2238
+ rb_define_const(mDriving, "INCAR_RACER",
2239
+ INT2NUM(SEAL_DRIVING_INCAR_RACER_REVERB));
2240
+ rb_define_const(mDriving, "INCAR_SPORTS",
2241
+ INT2NUM(SEAL_DRIVING_INCAR_SPORTS_REVERB));
2242
+ rb_define_const(mDriving, "INCAR_LUXURY",
2243
+ INT2NUM(SEAL_DRIVING_INCAR_LUXURY_REVERB));
2244
+ rb_define_const(mDriving, "FULLGRANDSTAND",
2245
+ INT2NUM(SEAL_DRIVING_FULLGRANDSTAND_REVERB));
2246
+ rb_define_const(mDriving, "EMPTYGRANDSTAND",
2247
+ INT2NUM(SEAL_DRIVING_EMPTYGRANDSTAND_REVERB));
2248
+ rb_define_const(mDriving, "TUNNEL", INT2NUM(SEAL_DRIVING_TUNNEL_REVERB));
2249
+
2250
+ rb_define_const(mCity, "STREETS", INT2NUM(SEAL_CITY_STREETS_REVERB));
2251
+ rb_define_const(mCity, "SUBWAY", INT2NUM(SEAL_CITY_SUBWAY_REVERB));
2252
+ rb_define_const(mCity, "MUSEUM", INT2NUM(SEAL_CITY_MUSEUM_REVERB));
2253
+ rb_define_const(mCity, "LIBRARY", INT2NUM(SEAL_CITY_LIBRARY_REVERB));
2254
+ rb_define_const(mCity, "UNDERPASS", INT2NUM(SEAL_CITY_UNDERPASS_REVERB));
2255
+ rb_define_const(mCity, "ABANDONED", INT2NUM(SEAL_CITY_ABANDONED_REVERB));
2256
+
2257
+ rb_define_const(mMisc, "DUSTYROOM", INT2NUM(SEAL_DUSTYROOM_REVERB));
2258
+ rb_define_const(mMisc, "CHAPEL", INT2NUM(SEAL_CHAPEL_REVERB));
2259
+ rb_define_const(mMisc, "SMALLWATERROOM",
2260
+ INT2NUM(SEAL_SMALLWATERROOM_REVERB));
2261
+ }
2262
+
2263
+ /*
2264
+ * Document-class: Seal::EffectSlot
2265
+ *
2266
+ * EffectSlot is the container type for effects. A source can mix an effect in
2267
+ * an effect slot to filter the output sound.
2268
+ */
2269
+ static
2270
+ void
2271
+ bind_efs(void)
2272
+ {
2273
+ VALUE cEffectSlot = rb_define_class_under(mSeal, "EffectSlot", rb_cObject);
2274
+
2275
+ rb_define_alloc_func(cEffectSlot, alloc_efs);
2276
+ rb_define_method(cEffectSlot, "initialize", init_efs, -1);
2277
+ rb_define_method(cEffectSlot, "effect=", set_efs_effect, 1);
2278
+ rb_define_method(cEffectSlot, "effect", get_efs_effect, 0);
2279
+ rb_define_method(cEffectSlot, "feed", feed_efs, 2);
2280
+ rb_define_method(cEffectSlot, "gain=", set_efs_gain, 1);
2281
+ rb_define_method(cEffectSlot, "gain", get_efs_gain, 0);
2282
+ rb_define_method(cEffectSlot, "auto=", set_efs_auto, 1);
2283
+ rb_define_method(cEffectSlot, "auto", is_efs_auto, 0);
2284
+ rb_define_alias(cEffectSlot, "auto?", "auto");
2285
+ }
2286
+
2287
+ /*
2288
+ * Document-class: Seal::Listener
2289
+ *
2290
+ * Listener has a singleton instance representing the sole listener who hears
2291
+ * the sound.
2292
+ */
2293
+ static
2294
+ void
2295
+ bind_listener(void)
2296
+ {
2297
+ VALUE cListener = rb_define_class_under(mSeal, "Listener", rb_cObject);
2298
+ VALUE listener = rb_data_object_alloc(cListener, 0, 0, 0);
2299
+
2300
+ /* The singleton Listener instance. */
2301
+ rb_define_const(mSeal, "LISTENER", listener);
2302
+ rb_define_singleton_method(mSeal, "listener", get_listener, 0);
2303
+ singletonify(cListener);
2304
+ rb_define_method(cListener, "position=", set_listener_pos, 1);
2305
+ rb_define_method(cListener, "position", get_listener_pos, 0);
2306
+ rb_define_method(cListener, "velocity=", set_listener_vel, 1);
2307
+ rb_define_method(cListener, "velocity", get_listener_vel, 0);
2308
+ rb_define_method(cListener, "gain=", set_listener_gain, 1);
2309
+ rb_define_method(cListener, "gain", get_listener_gain, 0);
2310
+ rb_define_method(cListener, "orientation=", set_listener_orien, 1);
2311
+ rb_define_method(cListener, "orientation", get_listener_orien, 0);
2312
+ }
2313
+
2314
+ /*
2315
+ * Document-module: Seal
2316
+ *
2317
+ * The top-level namespace of Seal.
2318
+ */
2319
+ void
2320
+ Init_seal(void)
2321
+ {
2322
+ bind_core();
2323
+ bind_buf();
2324
+ bind_stream();
2325
+ bind_src();
2326
+ bind_rvb();
2327
+ bind_efs();
2328
+ bind_listener();
2329
+ }