seal 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
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,896 @@
1
+ /*
2
+ mpg123clr: MPEG Audio Decoder library Common Language Runtime version.
3
+
4
+ copyright 2009-2011 by Malcolm Boczek - free software under the terms of the LGPL 2.1
5
+ mpg123clr.dll is a derivative work of libmpg123 - all original mpg123 licensing terms apply.
6
+
7
+ All rights to this work freely assigned to the mpg123 project.
8
+ */
9
+ /*
10
+ libmpg123: MPEG Audio Decoder library
11
+
12
+ copyright 1995-2011 by the mpg123 project - free software under the terms of the LGPL 2.1
13
+ see COPYING and AUTHORS files in distribution or http://mpg123.org
14
+
15
+ */
16
+ /*
17
+ 1.8.1.0 04-Aug-09 Initial release.
18
+ 1.9.0.0 24-Sep-09 Function names harmonized with libmpg123 (mb)
19
+ 1.9.0.0 01-Oct-09 Technical cleanup - subst nullptr for NULL (mb)
20
+ 1.9.0.0 13-Oct-09 pin_ptr = nullptr on return (mb)
21
+ 1.9.0.1 24-Nov-09 performance update - removed try/finally (mb)
22
+ 1.10.0.0 30-Nov-09 release match - added mpg123_feature (mb)
23
+ 1.12.0.0 14-Apr-10 release match - added framebyframe and "handle" ReplaceReaders (mb)
24
+ 1.13.0.0 13-Jan-11 release match - added encsize (mb)
25
+ */
26
+
27
+ // mpg123clr.cpp : Defines the exported functions for the DLL application.
28
+ //
29
+
30
+ #include "stdafx.h"
31
+ #include "mpg123clr.h"
32
+
33
+
34
+ mpg123clr::mpg123::mpg123(void)
35
+ {
36
+ mh = nullptr;
37
+ useHandleReplacement = false;
38
+ lastReplacementWasHandle = false;
39
+ }
40
+
41
+ mpg123clr::mpg123::mpg123(mpg123_handle* mh)
42
+ {
43
+ this->mh = mh;
44
+ useHandleReplacement = false;
45
+ lastReplacementWasHandle = false;
46
+ }
47
+
48
+ // Destructor
49
+ mpg123clr::mpg123::~mpg123(void)
50
+ {
51
+ // clean up code to release managed resources
52
+
53
+ // call Finalizer to clean up unmanaged resources
54
+ this->!mpg123();
55
+
56
+ // CLI implements SuppressFinalize - therefore not required here...
57
+ //GC::SuppressFinalize(this);
58
+ }
59
+
60
+ // Finalizer
61
+ mpg123clr::mpg123::!mpg123(void)
62
+ {
63
+ // clean up unmanaged resources
64
+ if (mh != nullptr)
65
+ {
66
+ ::mpg123_delete(mh);
67
+ mh = nullptr;
68
+ }
69
+ }
70
+
71
+ void mpg123clr::mpg123::mpg123_delete(void)
72
+ {
73
+ if (mh != nullptr)
74
+ {
75
+ ::mpg123_delete(mh);
76
+ mh = nullptr;
77
+ }
78
+ }
79
+
80
+ mpg123clr::mpg::ErrorCode mpg123clr::mpg123::mpg123_init(void)
81
+ {
82
+ return (mpg123clr::mpg::ErrorCode) ::mpg123_init();
83
+ }
84
+
85
+ void mpg123clr::mpg123::mpg123_exit(void)
86
+ {
87
+ ::mpg123_exit();
88
+ }
89
+
90
+ mpg123clr::mpg::ErrorCode mpg123clr::mpg123::mpg123_new(String ^ decoder)
91
+ {
92
+ const char* chars = (const char*)(Marshal::StringToHGlobalAnsi(decoder)).ToPointer();
93
+
94
+ int err;
95
+ mh = ::mpg123_new(chars, &err);
96
+
97
+ Marshal::FreeHGlobal(IntPtr((void*)chars));
98
+
99
+ return (mpg123clr::mpg::ErrorCode) err;
100
+ }
101
+ mpg123clr::mpg::ErrorCode mpg123clr::mpg123::mpg123_new(void)
102
+ {
103
+ int err;
104
+ mh = ::mpg123_new(NULL, &err);
105
+
106
+ return (mpg123clr::mpg::ErrorCode) err;
107
+ }
108
+
109
+ mpg123clr::mpg::ErrorCode mpg123clr::mpg123::mpg123_parnew(mpg123clr::advpars^ par, String ^ decoder)
110
+ {
111
+ const char* chars = (const char*)(Marshal::StringToHGlobalAnsi(decoder)).ToPointer();
112
+
113
+ int err;
114
+ mh = ::mpg123_parnew(par->mp, chars, &err);
115
+
116
+ Marshal::FreeHGlobal(IntPtr((void*)chars));
117
+
118
+ return (mpg123clr::mpg::ErrorCode) err;
119
+ }
120
+ mpg123clr::mpg::ErrorCode mpg123clr::mpg123::mpg123_parnew(mpg123clr::advpars^ par)
121
+ {
122
+ int err;
123
+ mh = ::mpg123_parnew(par->mp, NULL, &err);
124
+
125
+ return (mpg123clr::mpg::ErrorCode) err;
126
+ }
127
+
128
+ mpg123clr::mpg::ErrorCode mpg123clr::mpg123::mpg123_param(mpg123clr::mpg::parms type, int val, double fval)
129
+ {
130
+ return (mpg123clr::mpg::ErrorCode) ::mpg123_param(mh, (mpg123_parms)type, val, fval);
131
+ }
132
+
133
+ mpg123clr::mpg::ErrorCode mpg123clr::mpg123::mpg123_getparam(mpg123clr::mpg::parms type, [Out] int% val, [Out] double% fval)
134
+ {
135
+ // Avoid need for local intermediary variables
136
+ pin_ptr<int> _val = &val;
137
+ pin_ptr<double> _fval = &fval;
138
+
139
+ int ret = ::mpg123_getparam(mh, (mpg123_parms)type, (long*) _val, _fval);
140
+
141
+ _fval = nullptr;
142
+ _val = nullptr;
143
+
144
+ return (mpg123clr::mpg::ErrorCode) ret;
145
+ }
146
+
147
+ int mpg123clr::mpg123::mpg123_feature(mpg123clr::mpg::feature_set key)
148
+ {
149
+ return ::mpg123_feature((mpg123_feature_set) key);
150
+ }
151
+
152
+ String^ mpg123clr::mpg123::mpg123_strerror(void)
153
+ {
154
+ return gcnew String(::mpg123_strerror(mh));
155
+ }
156
+
157
+ mpg123clr::mpg::ErrorCode mpg123clr::mpg123::mpg123_errcode(void)
158
+ {
159
+ return (mpg123clr::mpg::ErrorCode) ::mpg123_errcode(mh);
160
+ }
161
+
162
+ array<String^>^ mpg123clr::mpg123::StringArrayFromPtr(const char** ptr)
163
+ {
164
+ int count = 0;
165
+
166
+ // count how many strings in array by walking up the array until NULL found
167
+ while (*(ptr++) != NULL){ ++count; }
168
+
169
+ // create an array of the correct size
170
+ array<String^> ^ str = gcnew array<String^>(count);
171
+
172
+ --ptr; // loop leaves ptr +2 beyond end of array - put ptr back to just after last index
173
+
174
+ // walk back down the array, extracting the strings
175
+ while (count-- > 0){ str[count] = gcnew String(*(--ptr)); }
176
+
177
+ return str;
178
+ }
179
+
180
+ array<String^>^ mpg123clr::mpg123::mpg123_decoders(void)
181
+ {
182
+ return StringArrayFromPtr(::mpg123_decoders());
183
+ }
184
+
185
+ array<String^>^ mpg123clr::mpg123::mpg123_supported_decoders(void)
186
+ {
187
+ return StringArrayFromPtr(::mpg123_supported_decoders());
188
+ }
189
+
190
+ mpg123clr::mpg::ErrorCode mpg123clr::mpg123::mpg123_decoder(String^ name)
191
+ {
192
+ const char* chars = (const char*)(Marshal::StringToHGlobalAnsi(name)).ToPointer();
193
+
194
+ int ret;
195
+
196
+ // one of the few mpg123 places that fault with an exception...
197
+ try { ret = ::mpg123_decoder(mh, chars); }
198
+ catch(Exception^){ ret = MPG123_ERR; }
199
+
200
+ Marshal::FreeHGlobal(IntPtr((void*)chars));
201
+
202
+ return (mpg123clr::mpg::ErrorCode) ret;
203
+ }
204
+
205
+ String^ mpg123clr::mpg123::mpg123_current_decoder(void)
206
+ {
207
+ return gcnew String(::mpg123_current_decoder(mh));
208
+ }
209
+
210
+ array<long>^ mpg123clr::mpg123::mpg123_rates(void)
211
+ {
212
+ size_t number;
213
+ const long* list;
214
+
215
+ ::mpg123_rates(&list, &number);
216
+
217
+ array<long>^ rList = gcnew array<long>((int)number);
218
+
219
+ int index = 0;
220
+
221
+ // walk the array, extracting the rates
222
+ while (index < (int)number){ rList[index++] = *(list++); }
223
+
224
+ return rList;
225
+ }
226
+
227
+ array<mpg123clr::mpg::enc>^ mpg123clr::mpg123::mpg123_encodings(void)
228
+ {
229
+ size_t number;
230
+ const int* list;
231
+
232
+ ::mpg123_encodings(&list, &number);
233
+
234
+ // WARN 4267 - assuming that the number of encodings will never exceed 32bits
235
+ array<mpg123clr::mpg::enc>^ rList = gcnew array<mpg123clr::mpg::enc>((int)number);
236
+
237
+ int index = 0;
238
+
239
+ // walk the array, extracting the rates
240
+ while (index < (int)number){ rList[index++] = (mpg123clr::mpg::enc) *(list++); }
241
+
242
+ return rList;
243
+ }
244
+
245
+ int mpg123clr::mpg123::mpg123_encsize(mpg123clr::mpg::enc encoding)
246
+ {
247
+ return ::mpg123_encsize((int) encoding);
248
+ }
249
+
250
+ mpg123clr::mpg::ErrorCode mpg123clr::mpg123::mpg123_format_none(void)
251
+ {
252
+ return (mpg123clr::mpg::ErrorCode) ::mpg123_format_none(mh);
253
+ }
254
+
255
+ mpg123clr::mpg::ErrorCode mpg123clr::mpg123::mpg123_format_all(void)
256
+ {
257
+ return (mpg123clr::mpg::ErrorCode) ::mpg123_format_all(mh);
258
+ }
259
+
260
+ mpg123clr::mpg::ErrorCode mpg123clr::mpg123::mpg123_format(int rate, mpg123clr::mpg::channelcount channels, mpg123clr::mpg::enc encodings)
261
+ {
262
+ return (mpg123clr::mpg::ErrorCode) ::mpg123_format(mh, rate, (int) channels, (int) encodings);
263
+ }
264
+
265
+ mpg123clr::mpg::channelcount mpg123clr::mpg123::mpg123_format_support(int rate, mpg123clr::mpg::enc encodings)
266
+ {
267
+ return (mpg123clr::mpg::channelcount) ::mpg123_format_support(mh, rate, (int) encodings);
268
+ }
269
+
270
+ mpg123clr::mpg::ErrorCode mpg123clr::mpg123::mpg123_getformat([Out] int% rate, [Out] mpg123clr::mpg::channelcount% channels, [Out] mpg123clr::mpg::enc% encodings)
271
+ {
272
+ // either:-
273
+ //
274
+ // long _rate;
275
+ // int _chan, _enc;
276
+ // int ret = mpg123_getformat(mh, &_rate, &_chan, &_enc);
277
+ // rate = _rate;
278
+ // channels = _chan;
279
+ // encodings = _enc;
280
+ // return (mpg123clr::mpg::ErrorCode) ret;
281
+ //
282
+ // or:-
283
+ // use pinned pointers instead
284
+ pin_ptr<int> _rate = &rate;
285
+ pin_ptr<mpg123clr::mpg::channelcount> _chan = &channels;
286
+ pin_ptr<mpg123clr::mpg::enc> _enc = &encodings;
287
+
288
+ int ret = ::mpg123_getformat(mh, (long*)_rate, (int*)_chan, (int*)_enc);
289
+
290
+ _enc = nullptr;
291
+ _chan = nullptr;
292
+ _rate = nullptr;
293
+
294
+ return (mpg123clr::mpg::ErrorCode) ret;
295
+ }
296
+
297
+ mpg123clr::mpg::ErrorCode mpg123clr::mpg123::mpg123_open(String^ path)
298
+ {
299
+ const char* chars = (const char*)(Marshal::StringToHGlobalAnsi(path)).ToPointer();
300
+
301
+ _ReplaceReader();
302
+
303
+ int ret = ::mpg123_open(mh, chars);
304
+
305
+ Marshal::FreeHGlobal(IntPtr((void*)chars));
306
+
307
+ return (mpg123clr::mpg::ErrorCode) ret;
308
+ }
309
+
310
+ mpg123clr::mpg::ErrorCode mpg123clr::mpg123::mpg123_open_fd(int filedescriptor)
311
+ {
312
+ _ReplaceReader();
313
+
314
+ return (mpg123clr::mpg::ErrorCode) ::mpg123_open_fd(mh, filedescriptor);
315
+ }
316
+
317
+ mpg123clr::mpg::ErrorCode mpg123clr::mpg123::mpg123_open_handle(System::Object^ obj)
318
+ {
319
+ // NOTE: You must have configured callbacks using mpg123_replace_reader_handle
320
+ // before calling mpg123_open_handle!
321
+
322
+ _ReplaceReader(); // activate callbacks
323
+
324
+ // Make sure we free this in Close functions
325
+ userObjectHandle = GCHandle::Alloc(obj);
326
+
327
+ // NOTE: This sends a HANDLE not an ADDRESS, no pinning required
328
+ return (mpg123clr::mpg::ErrorCode) ::mpg123_open_handle(mh, (void*)GCHandle::ToIntPtr(userObjectHandle).ToPointer());
329
+ }
330
+
331
+ mpg123clr::mpg::ErrorCode mpg123clr::mpg123::mpg123_open_feed(void)
332
+ {
333
+ _ReplaceReader();
334
+
335
+ return (mpg123clr::mpg::ErrorCode) ::mpg123_open_feed(mh);
336
+ }
337
+
338
+ mpg123clr::mpg::ErrorCode mpg123clr::mpg123::mpg123_close(void)
339
+ {
340
+ // Closes 'mh' and calls Cleanup delegate if provided
341
+ int ret = ::mpg123_close(mh);
342
+
343
+ // See GCHandle.Free - caller must ensure Free called only once for a given handle.
344
+ if (userObjectHandle.IsAllocated) userObjectHandle.Free();
345
+
346
+ return (mpg123clr::mpg::ErrorCode) ret;
347
+ }
348
+
349
+ mpg123clr::mpg::ErrorCode mpg123clr::mpg123::mpg123_read(array<unsigned char>^ buffer, [Out] size_t% count)
350
+ {
351
+ pin_ptr<size_t> _count = &count;
352
+ pin_ptr<unsigned char> _ptr = &buffer[0];
353
+
354
+ int ret = ::mpg123_read(mh, _ptr, buffer->Length, _count);
355
+
356
+ _ptr = nullptr;
357
+ _count = nullptr;
358
+
359
+ return (mpg123clr::mpg::ErrorCode) ret;
360
+ }
361
+
362
+ mpg123clr::mpg::ErrorCode mpg123clr::mpg123::mpg123_read(array<unsigned char>^ buffer, size_t offset, size_t size, [Out] size_t% count)
363
+ {
364
+ pin_ptr<size_t> _count = &count;
365
+ // WARN 4267 - clr limited to 32bit-length-size arrays!!
366
+ pin_ptr<unsigned char> _ptr = &buffer[(int)offset];
367
+
368
+ int ret = ::mpg123_read(mh, _ptr, size, _count);
369
+
370
+ _ptr = nullptr;
371
+ _count = nullptr;
372
+
373
+ return (mpg123clr::mpg::ErrorCode) ret;
374
+ }
375
+
376
+
377
+ mpg123clr::mpg::ErrorCode mpg123clr::mpg123::mpg123_feed(array<unsigned char>^ inbuffer, size_t size)
378
+ {
379
+ pin_ptr<unsigned char> _ptr = &inbuffer[0];
380
+
381
+ int ret = ::mpg123_feed(mh, _ptr, size);
382
+
383
+ _ptr = nullptr;
384
+
385
+ return (mpg123clr::mpg::ErrorCode) ret;
386
+ }
387
+
388
+ mpg123clr::mpg::ErrorCode mpg123clr::mpg123::mpg123_decode(array<unsigned char>^ inbuffer, size_t insize, array<unsigned char>^ outbuffer, size_t outsize, [Out] size_t% count)
389
+ {
390
+ pin_ptr<size_t> _count = &count;
391
+ pin_ptr<const unsigned char> _inptr = &inbuffer[0];
392
+ pin_ptr<unsigned char> _outptr = &outbuffer[0];
393
+
394
+ int ret = ::mpg123_decode(mh, _inptr, insize, _outptr, outsize, _count);
395
+
396
+ _outptr = nullptr;
397
+ _inptr = nullptr;
398
+ _count = nullptr;
399
+
400
+ return (mpg123clr::mpg::ErrorCode) ret;
401
+ }
402
+
403
+ mpg123clr::mpg::ErrorCode mpg123clr::mpg123::mpg123_decode_frame([Out] off_t% num, [Out] IntPtr% audio, [Out] size_t% count)
404
+ {
405
+ pin_ptr<size_t> _count = &count;
406
+ pin_ptr<off_t> _num = &num;
407
+ pin_ptr<IntPtr> _x = &audio;
408
+
409
+ int ret = ::mpg123_decode_frame(mh, _num, (unsigned char**)_x, _count);
410
+
411
+ _x = nullptr;
412
+ _num = nullptr;
413
+ _count = nullptr;
414
+
415
+ return (mpg123clr::mpg::ErrorCode) ret;
416
+ }
417
+
418
+ mpg123clr::mpg::ErrorCode mpg123clr::mpg123::mpg123_framebyframe_decode([Out] off_t% num, [Out] IntPtr% audio, [Out] size_t% count)
419
+ {
420
+ // NOTE: must use framebyframe_next to obtain successive frames
421
+
422
+ pin_ptr<size_t> _count = &count;
423
+ pin_ptr<off_t> _num = &num;
424
+ pin_ptr<IntPtr> _x = &audio;
425
+
426
+ int ret = ::mpg123_framebyframe_decode(mh, _num, (unsigned char**)_x, _count);
427
+
428
+ _x = nullptr;
429
+ _num = nullptr;
430
+ _count = nullptr;
431
+
432
+ return (mpg123clr::mpg::ErrorCode) ret;
433
+ }
434
+
435
+ mpg123clr::mpg::ErrorCode mpg123clr::mpg123::mpg123_framebyframe_next()
436
+ {
437
+ // mpg123lib has warning, Experimental API. Watch for updates!!!
438
+ // framebyframe_decode doesn't automatically move on to next frame,
439
+ // use framebyframe_next to move on to "Find, read and parse the next mp3 frame"
440
+ int ret = ::mpg123_framebyframe_next(mh);
441
+
442
+ return (mpg123clr::mpg::ErrorCode) ret;
443
+ }
444
+
445
+ long long mpg123clr::mpg123::mpg123_tell(void)
446
+ {
447
+ return ::mpg123_tell(mh);
448
+ }
449
+
450
+ long long mpg123clr::mpg123::mpg123_tellframe(void)
451
+ {
452
+ return ::mpg123_tellframe(mh);
453
+ }
454
+
455
+ long long mpg123clr::mpg123::mpg123_tell_stream(void)
456
+ {
457
+ return ::mpg123_tell_stream(mh);
458
+ }
459
+
460
+ long long mpg123clr::mpg123::mpg123_seek(long long offset, SeekOrigin origin)
461
+ {
462
+ return ::mpg123_seek(mh, (off_t)offset, (int)origin);
463
+ }
464
+
465
+ long long mpg123clr::mpg123::mpg123_feedseek(long long offset, SeekOrigin origin, [Out] long long% input_offset)
466
+ {
467
+ // NOTE: off_t fiddles...
468
+ // pin_ptr<int> _input_offset = &input_offset; // type mismatch between 32 and 64 bit offsets.
469
+
470
+ off_t _input_offset; // type accomodation
471
+
472
+ off_t ret = ::mpg123_feedseek(mh, (off_t)offset, (int)origin, &_input_offset); // ok types
473
+
474
+ input_offset = _input_offset; // type conversion
475
+
476
+ return ret;
477
+ }
478
+
479
+ long long mpg123clr::mpg123::mpg123_seek_frame(long long frameoffset, SeekOrigin origin)
480
+ {
481
+ return ::mpg123_seek_frame(mh, (off_t)frameoffset, (int)origin);
482
+ }
483
+
484
+ long long mpg123clr::mpg123::mpg123_timeframe(double seconds)
485
+ {
486
+ return ::mpg123_timeframe(mh, seconds);
487
+ }
488
+
489
+ mpg123clr::mpg::ErrorCode mpg123clr::mpg123::mpg123_index([Out] array<long long>^% index, [Out] long long% step)
490
+ {
491
+ // remnant: only works if off_t, index and step are 32 bit - possible redo for 64 bit library
492
+ // pin_ptr<int> _step = &step;
493
+ // int ret = mpg123_index(mh, &_list, (off_t*)_step, &_count);
494
+ // index = gcnew array<int>((int)_count);
495
+ // Marshal::Copy((IntPtr)_list, index, 0, (int)_count);
496
+
497
+ // alternate: works for 32 and 64 bit libraries - returns long long values
498
+ off_t* _list;
499
+ size_t _count;
500
+ off_t _step; // type accomodation
501
+
502
+ int ret = ::mpg123_index(mh, &_list, &_step, &_count);
503
+
504
+ step = _step; // type conversion
505
+
506
+ // WARN 4267 - clr limited to 32bit-length-size arrays!!
507
+ index = gcnew array<long long>((int)_count);
508
+
509
+ // walk the array, extracting the rates
510
+ int idx = 0; // array length limited to 32bit
511
+ while (idx < index->Length){ index[idx++] = *(_list++); }
512
+
513
+ return (mpg123clr::mpg::ErrorCode) ret;
514
+ }
515
+
516
+ mpg123clr::mpg::ErrorCode mpg123clr::mpg123::mpg123_index([Out] IntPtr% indexarr, [Out] long long% step, [Out] size_t% fill)
517
+ {
518
+ pin_ptr<size_t> _fill = &fill;
519
+ pin_ptr<IntPtr> _x = &indexarr; // NOTE: untyped index pointer.
520
+ off_t _step; // type accomodation
521
+
522
+ int ret = ::mpg123_index(mh, (off_t**)_x, &_step, _fill);
523
+
524
+ step = _step; // type conversion
525
+
526
+ _x = nullptr;
527
+ _fill = nullptr;
528
+
529
+ return (mpg123clr::mpg::ErrorCode) ret;
530
+ }
531
+
532
+ mpg123clr::mpg::ErrorCode mpg123clr::mpg123::mpg123_position(
533
+ long long frameoffset, long long bufferedbytes, [Out] long long% currentframe, [Out] long long% framesleft,
534
+ [Out] double% currentseconds, [Out] double% secondsleft)
535
+ {
536
+ // NOTE: off_t fiddles
537
+ // pin_ptr<int> _currentframe = &currentframe;
538
+ // pin_ptr<int> _framesleft = &framesleft;
539
+ pin_ptr<double> _currentseconds = &currentseconds;
540
+ pin_ptr<double> _secondsleft = &secondsleft;
541
+ off_t _currentframe; // type accomodation
542
+ off_t _framesleft; // type accomodation
543
+
544
+ int ret = ::mpg123_position(mh, (off_t)frameoffset, (off_t)bufferedbytes, &_currentframe, &_framesleft, _currentseconds, _secondsleft);
545
+
546
+ currentframe = _currentframe; // type conversion
547
+ framesleft = _framesleft; // type conversion
548
+
549
+ _secondsleft = nullptr;
550
+ _currentseconds = nullptr;
551
+
552
+ return (mpg123clr::mpg::ErrorCode) ret;
553
+ }
554
+
555
+ #pragma region Volume and Equalizer
556
+
557
+ /// \defgroup mpg123_voleq mpg123 volume and equalizer
558
+ ///
559
+
560
+ mpg123clr::mpg::ErrorCode mpg123clr::mpg123::mpg123_eq(mpg123clr::mpg::channels channel, int band, double fval)
561
+ {
562
+ return (mpg123clr::mpg::ErrorCode) ::mpg123_eq(mh, (mpg123_channels)channel, band, fval);
563
+ }
564
+
565
+ double mpg123clr::mpg123::mpg123_geteq(mpg123clr::mpg::channels channel, int band)
566
+ {
567
+ return ::mpg123_geteq(mh, (mpg123_channels)channel, band);
568
+ }
569
+
570
+ mpg123clr::mpg::ErrorCode mpg123clr::mpg123::mpg123_reset_eq(void)
571
+ {
572
+ return (mpg123clr::mpg::ErrorCode) ::mpg123_reset_eq(mh);
573
+ }
574
+
575
+ mpg123clr::mpg::ErrorCode mpg123clr::mpg123::mpg123_volume(double volume)
576
+ {
577
+ return (mpg123clr::mpg::ErrorCode) ::mpg123_volume(mh, volume);
578
+ }
579
+
580
+ mpg123clr::mpg::ErrorCode mpg123clr::mpg123::mpg123_volume_change(double change)
581
+ {
582
+ return (mpg123clr::mpg::ErrorCode) ::mpg123_volume_change(mh, change);
583
+ }
584
+
585
+ mpg123clr::mpg::ErrorCode mpg123clr::mpg123::mpg123_getvolume([Out] double% basevol, [Out] double% really, [Out] double% rva_db)
586
+ {
587
+ pin_ptr<double> _basevol = &basevol;
588
+ pin_ptr<double> _really = &really;
589
+ pin_ptr<double> _rva_db = &rva_db;
590
+
591
+ int ret = ::mpg123_getvolume(mh, _basevol, _really, _rva_db);
592
+
593
+ _rva_db = nullptr;
594
+ _really = nullptr;
595
+ _basevol = nullptr;
596
+
597
+ return (mpg123clr::mpg::ErrorCode) ret;
598
+ }
599
+
600
+ #pragma endregion -Volume and Equalizer
601
+ #pragma region Status and Information
602
+
603
+ // \defgroup mpg123_status mpg123 status and information
604
+ //
605
+ //
606
+ //
607
+
608
+ // The "proper" way to manage structs...
609
+ mpg123clr::mpg::ErrorCode mpg123clr::mpg123::mpg123_safeinfo([Out]mpeg_frameinfo^% finfo)
610
+ {
611
+ // "out" our return reference and grab some memory
612
+ finfo = gcnew mpeg_frameinfo;
613
+ IntPtr pp = Marshal::AllocHGlobal(Marshal::SizeOf(finfo));
614
+
615
+ // get the info
616
+
617
+ // could cast away...
618
+ // int ret = mpg123_info(mh, reinterpret_cast<mpg123_frameinfo*>((int)pp));
619
+ // int ret = mpg123_info(mh, static_cast<mpg123_frameinfo*>((void*)pp));
620
+
621
+ // or let the compiler decide...
622
+ int ret = ::mpg123_info(mh, (mpg123_frameinfo*)(void*)pp);
623
+
624
+ // marshal data into return object and free temporary memory
625
+ Marshal::PtrToStructure(pp, finfo);
626
+ Marshal::FreeHGlobal(pp);
627
+
628
+ return (mpg123clr::mpg::ErrorCode) ret;
629
+ }
630
+
631
+ // The "efficient" way to manage structs...
632
+ mpg123clr::mpg::ErrorCode mpg123clr::mpg123::mpg123_info([Out]mpeg_frameinfo^% finfo)
633
+ {
634
+ finfo = gcnew mpeg_frameinfo;
635
+
636
+ pin_ptr<mpg123clr::mpg::mpeg_version> _ptr = &finfo->version;
637
+
638
+ // According to SizeOf...
639
+ // The unmanaged and managed sizes of an object can differ, this would imply
640
+ // that the memory layout for each would also be different, which would indicate
641
+ // that using a ptr, derived from a ptr-to-a-managed type, in unmanaged code could
642
+ // have unforseen results.
643
+ //
644
+ // In non-homogenous structs (like mpg123text) it can lead to corrupted CLR stack.
645
+ // In homogenous structs (like finfo) it appears to be "managable".
646
+ //
647
+ // However, until it fails it'll do... and it's much faster (see mpg123_safeinfo(...)).
648
+
649
+ // WARNING:
650
+ // The epitome of "unsafe" as defined by CLR (using unmanaged pointers).
651
+ // If we start to get CLR stack corruptions - check here first! (see SafeInfo for "safe" managed version)
652
+ int ret = ::mpg123_info(mh, (mpg123_frameinfo*)_ptr);
653
+
654
+ _ptr = nullptr;
655
+
656
+ return (mpg123clr::mpg::ErrorCode) ret;
657
+ }
658
+
659
+ size_t mpg123clr::mpg123::mpg123_safe_buffer(void)
660
+ {
661
+ return ::mpg123_safe_buffer();
662
+ }
663
+
664
+ mpg123clr::mpg::ErrorCode mpg123clr::mpg123::mpg123_scan(void)
665
+ {
666
+ return (mpg123clr::mpg::ErrorCode) ::mpg123_scan(mh);
667
+ }
668
+
669
+ long long mpg123clr::mpg123::mpg123_length(void)
670
+ {
671
+ return ::mpg123_length(mh);
672
+ }
673
+
674
+ mpg123clr::mpg::ErrorCode mpg123clr::mpg123::mpg123_set_filesize(long long size)
675
+ {
676
+ return (mpg123clr::mpg::ErrorCode) ::mpg123_set_filesize(mh, (off_t)size);
677
+ }
678
+
679
+ double mpg123clr::mpg123::mpg123_tpf(void)
680
+ {
681
+ return ::mpg123_tpf(mh);
682
+ }
683
+
684
+ long mpg123clr::mpg123::mpg123_clip(void)
685
+ {
686
+ return ::mpg123_clip(mh);
687
+ }
688
+
689
+ mpg123clr::mpg::ErrorCode mpg123clr::mpg123::mpg123_getstate(mpg123clr::mpg::state key, [Out] int% val, [Out] double% fval)
690
+ {
691
+ pin_ptr<int> _val = &val;
692
+ pin_ptr<double> _fval = &fval;
693
+
694
+ int ret = ::mpg123_getstate(mh, (mpg123_state)key, (long*) _val, _fval);
695
+
696
+ _fval = nullptr;
697
+ _val = nullptr;
698
+
699
+ return (mpg123clr::mpg::ErrorCode) ret;
700
+ }
701
+
702
+ #pragma endregion -Status and Information
703
+
704
+ #pragma region Metadata Handling
705
+
706
+ // \defgroup mpg123_metadata mpg123 metadata handling
707
+ //
708
+ // Functions to retrieve the metadata from MPEG Audio files and streams.
709
+ // Also includes string handling functions.
710
+ //
711
+
712
+ mpg123clr::id3::id3check mpg123clr::mpg123::mpg123_meta_check(void)
713
+ {
714
+ return (mpg123clr::id3::id3check ) ::mpg123_meta_check(mh);
715
+ }
716
+
717
+ mpg123clr::mpg::ErrorCode mpg123clr::mpg123::mpg123_id3([Out]id3::mpg123id3v1^% v1, [Out]id3::mpg123id3v2^% v2)
718
+ {
719
+ mpg123_id3v1* pv1;
720
+ mpg123_id3v2* pv2;
721
+
722
+ // doc says "pv1 and pv2 may be set to NULL when there is no corresponding data."
723
+ // they may also be set to point to empty structure...
724
+ int ret = ::mpg123_id3(mh, &pv1, &pv2);
725
+
726
+ v1 = gcnew mpg123clr::id3::mpg123id3v1(pv1);
727
+ v2 = gcnew mpg123clr::id3::mpg123id3v2(pv2);
728
+
729
+ return (mpg123clr::mpg::ErrorCode) ret;
730
+ }
731
+
732
+ mpg123clr::mpg::ErrorCode mpg123clr::mpg123::mpg123_icy([Out]IntPtr% icy_meta)
733
+ {
734
+ char* _icy_meta;
735
+
736
+ int ret = ::mpg123_icy(mh, &_icy_meta);
737
+
738
+ icy_meta = (IntPtr) _icy_meta;
739
+
740
+ return (mpg123clr::mpg::ErrorCode) ret;
741
+ }
742
+
743
+ array<unsigned char>^ mpg123clr::mpg123::mpg123_icy2utf8(IntPtr icy_text)
744
+ {
745
+ // TODO: Do we really need this?
746
+ // char* putf8 = mpg123_icy2utf8(const_cast<char*>(reinterpret_cast<char*>(icy_text.ToPointer())));
747
+
748
+ // Or is this adequate?
749
+ char* putf8 = ::mpg123_icy2utf8((const char*)(void*) icy_text);
750
+
751
+ // WARN 4267 - clr limited to 32bit-length-size arrays!!
752
+ array<unsigned char>^ ary = gcnew array<unsigned char>((int)strlen(putf8));
753
+
754
+ Marshal::Copy((IntPtr)putf8, ary, 0, ary->Length);
755
+ free(putf8);
756
+
757
+ return ary;
758
+ }
759
+
760
+ #pragma endregion -Metadata Handling
761
+
762
+ #pragma region Low Level I/O
763
+
764
+ mpg123clr::mpg::ErrorCode mpg123clr::mpg123::mpg123_replace_buffer(IntPtr data, size_t size)
765
+ {
766
+ // "data" buffer should be fixed BEFORE calling this function.
767
+
768
+ // TODO: to cast or not to cast??
769
+ // return (mpg123clr::mpg::ErrorCode) mpg123_replace_buffer(mh, reinterpret_cast<unsigned char*>(data.ToPointer()), size);
770
+
771
+ return (mpg123clr::mpg::ErrorCode) ::mpg123_replace_buffer(mh, (unsigned char*)(void*) data, size);
772
+ }
773
+
774
+ size_t mpg123clr::mpg123::mpg123_outblock(void)
775
+ {
776
+ return ::mpg123_outblock(mh);
777
+ }
778
+
779
+ void mpg123clr::mpg123::_ReplaceReader(void)
780
+ {
781
+ if ((readDel == r_readDel) && (seekDel == r_seekDel)
782
+ && (readHDel == r_readHDel) && (seekDel == r_seekHDel) && (cleanHDel == r_cleanHDel)) return;
783
+
784
+ // readDel and seekDel are "keep alive" fields that prevent GC of the delegates.
785
+ // the underlying function pointers no not require "pinning".
786
+
787
+ // Note: most examples use GCHandle::Alloc to "pin" the delegate but this is usually to prevent GC
788
+ // outside of function scope and is not strictly necessary here since readDel and seekDel never go
789
+ // out of scope.
790
+
791
+ // See MS: c++, How to: Marshal Callbacks and Delegates Using C++ Interop
792
+ // for more details.
793
+
794
+ readDel = r_readDel;
795
+ seekDel = r_seekDel;
796
+ readHDel = r_readHDel;
797
+ seekHDel = r_seekHDel;
798
+ cleanHDel = r_cleanHDel;
799
+
800
+ // just for clarity
801
+ typedef off_t (_cdecl* SEEKCB)(int, off_t, int);
802
+ typedef ssize_t (_cdecl* READCB)(int, void*, size_t);
803
+ typedef off_t (_cdecl* HSEEKCB)(void*, off_t, int);
804
+ typedef ssize_t (_cdecl* HREADCB)(void*, void*, size_t);
805
+ typedef void (_cdecl* HCLEANCB)(void*);
806
+
807
+ // NOTE: GetFunctionPointerForDelegate doesn't like nullptr
808
+ // NOTE: I'm not suggesting that replace_reader and replace_reader_handle should be
809
+ // intermingled, just trying to maintain a clean stack
810
+
811
+ if (!useHandleReplacement)
812
+ {
813
+ if (lastReplacementWasHandle)
814
+ ::mpg123_replace_reader_handle(mh, nullptr, nullptr, nullptr);
815
+
816
+ ::mpg123_replace_reader(
817
+ mh,
818
+ (readDel != nullptr) ? (READCB)(Marshal::GetFunctionPointerForDelegate(readDel)).ToPointer() : nullptr,
819
+ (seekDel != nullptr) ? (SEEKCB)(Marshal::GetFunctionPointerForDelegate(seekDel)).ToPointer() : nullptr
820
+ );
821
+ }
822
+ else
823
+ {
824
+ if (!lastReplacementWasHandle) // can give redundant call on first use - microscopically inefficient - not catastrophic
825
+ ::mpg123_replace_reader(mh, nullptr, nullptr);
826
+
827
+ ::mpg123_replace_reader_handle(
828
+ mh,
829
+ (readHDel != nullptr) ? (HREADCB)(Marshal::GetFunctionPointerForDelegate(readHDel)).ToPointer() : nullptr,
830
+ (seekHDel != nullptr) ? (HSEEKCB)(Marshal::GetFunctionPointerForDelegate(seekHDel)).ToPointer() : nullptr,
831
+ (cleanHDel != nullptr) ? (HCLEANCB)(Marshal::GetFunctionPointerForDelegate(cleanHDel)).ToPointer() : nullptr
832
+ );
833
+ }
834
+ lastReplacementWasHandle = useHandleReplacement;
835
+ }
836
+
837
+ mpg123clr::mpg::ErrorCode mpg123clr::mpg123::mpg123_replace_reader(ReadDelegate^ r_read, SeekDelegate^ r_lseek)
838
+ {
839
+ // save temporary delegates to be implemented at next 'Open'
840
+ r_readDel = r_read;
841
+ r_seekDel = r_lseek;
842
+ r_readHDel = nullptr;
843
+ r_seekHDel = nullptr;
844
+ r_cleanHDel = nullptr;
845
+ useHandleReplacement = false;
846
+
847
+ return mpg123clr::mpg::ErrorCode::ok;
848
+
849
+ }
850
+
851
+ mpg123clr::mpg::ErrorCode mpg123clr::mpg123::mpg123_replace_reader_handle(ReadHandleDelegate^ rh_read, SeekHandleDelegate^ rh_lseek, CleanupHandleDelegate^ rh_clean)
852
+ {
853
+ // save temporary delegates to be implemented at next 'Open'
854
+ r_readHDel = rh_read;
855
+ r_seekHDel = rh_lseek;
856
+ r_cleanHDel = rh_clean;
857
+ r_readDel = nullptr;
858
+ r_seekDel = nullptr;
859
+ useHandleReplacement = true;
860
+
861
+ return mpg123clr::mpg::ErrorCode::ok;
862
+
863
+ }
864
+
865
+ #pragma endregion -Low Level I/O
866
+
867
+ #pragma region MS Unicode Extension
868
+
869
+ mpg123clr::mpg::ErrorCode mpg123clr::mpg123::mpg123_topen(String^ path)
870
+ {
871
+ _ReplaceReader(); // mpg123_tOpen will replace its own reader, this is just for consistency
872
+
873
+ const _TCHAR* chars = (const _TCHAR*)(Marshal::StringToHGlobalUni(path)).ToPointer();
874
+
875
+ int ret = ::mpg123_topen(mh, chars);
876
+
877
+ Marshal::FreeHGlobal(IntPtr((void*)chars));
878
+
879
+ return (mpg123clr::mpg::ErrorCode) ret;
880
+ }
881
+
882
+ mpg123clr::mpg::ErrorCode mpg123clr::mpg123::mpg123_tclose(void)
883
+ {
884
+ // Not sure if t_close calls Cleanup (it shouldn't since t_open substitutes its own readers)
885
+ int ret = ::mpg123_tclose(mh);
886
+
887
+ // Fairly sure replace_reader_handle, topen and tclose are incompatible, just for consistency
888
+ // See GCHandle.Free - caller must ensure Free called only once for a given handle.
889
+ if (userObjectHandle.IsAllocated) userObjectHandle.Free();
890
+
891
+ return (mpg123clr::mpg::ErrorCode) ret;
892
+ }
893
+
894
+ #pragma endregion -MS Unicode Extension
895
+
896
+