seal 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.yardopts +1 -0
- data/LICENSE +13 -0
- data/README.md +265 -0
- data/ext/seal/extconf.rb +45 -0
- data/include/al/al.h +724 -0
- data/include/al/alc.h +277 -0
- data/include/al/efx-presets.h +402 -0
- data/include/al/efx.h +758 -0
- data/include/mpg123/mpg123.h +1034 -0
- data/include/ogg/config_types.h +25 -0
- data/include/ogg/ogg.h +210 -0
- data/include/ogg/os_types.h +147 -0
- data/include/seal.h +23 -0
- data/include/seal/buf.h +143 -0
- data/include/seal/core.h +95 -0
- data/include/seal/efs.h +112 -0
- data/include/seal/err.h +93 -0
- data/include/seal/fmt.h +58 -0
- data/include/seal/listener.h +103 -0
- data/include/seal/raw.h +86 -0
- data/include/seal/rvb.h +520 -0
- data/include/seal/src.h +413 -0
- data/include/seal/stream.h +81 -0
- data/include/vorbis/codec.h +243 -0
- data/include/vorbis/vorbisfile.h +206 -0
- data/mpg123/AUTHORS +150 -0
- data/mpg123/COPYING +773 -0
- data/mpg123/ChangeLog +3 -0
- data/mpg123/INSTALL +111 -0
- data/mpg123/Makefile.am +99 -0
- data/mpg123/Makefile.in +1043 -0
- data/mpg123/NEWS +1200 -0
- data/mpg123/NEWS.libmpg123 +133 -0
- data/mpg123/README +203 -0
- data/mpg123/TODO +38 -0
- data/mpg123/aclocal.m4 +1168 -0
- data/mpg123/build/config.guess +1530 -0
- data/mpg123/build/config.sub +1782 -0
- data/mpg123/build/depcomp +707 -0
- data/mpg123/build/install-sh +527 -0
- data/mpg123/build/ltmain.sh +9655 -0
- data/mpg123/build/missing +330 -0
- data/mpg123/configure +20267 -0
- data/mpg123/configure.ac +2178 -0
- data/mpg123/doc/ACCURACY +2 -0
- data/mpg123/doc/BENCHMARKING +110 -0
- data/mpg123/doc/BUGS +3 -0
- data/mpg123/doc/CONTACT +17 -0
- data/mpg123/doc/LICENSE +22 -0
- data/mpg123/doc/Makefile.am +32 -0
- data/mpg123/doc/Makefile.in +490 -0
- data/mpg123/doc/PATENTS +39 -0
- data/mpg123/doc/README.3DNOW +56 -0
- data/mpg123/doc/README.gain +171 -0
- data/mpg123/doc/README.remote +218 -0
- data/mpg123/doc/ROAD_TO_LGPL +270 -0
- data/mpg123/doc/THANKS +13 -0
- data/mpg123/doc/TODO +63 -0
- data/mpg123/doc/doxy_examples.c +21 -0
- data/mpg123/doc/doxygen.conf +41 -0
- data/mpg123/doc/doxyhead.xhtml +12 -0
- data/mpg123/doc/examples/dump_seekindex.c +41 -0
- data/mpg123/doc/examples/extract_frames.c +92 -0
- data/mpg123/doc/examples/feedseek.c +238 -0
- data/mpg123/doc/examples/id3dump.c +178 -0
- data/mpg123/doc/examples/mpg123_to_wav.c +118 -0
- data/mpg123/doc/examples/mpglib.c +92 -0
- data/mpg123/doc/examples/scan.c +47 -0
- data/mpg123/doc/libmpg123_speed.txt +84 -0
- data/mpg123/equalize.dat +37 -0
- data/mpg123/libmpg123.pc.in +11 -0
- data/mpg123/m4/addrconfig.m4 +34 -0
- data/mpg123/m4/libtool.m4 +7982 -0
- data/mpg123/m4/ltoptions.m4 +384 -0
- data/mpg123/m4/ltsugar.m4 +123 -0
- data/mpg123/m4/ltversion.m4 +23 -0
- data/mpg123/m4/lt~obsolete.m4 +98 -0
- data/mpg123/makedll.sh +19 -0
- data/mpg123/man1/mpg123.1 +512 -0
- data/mpg123/mpg123.spec +68 -0
- data/mpg123/mpg123.spec.in +68 -0
- data/mpg123/ports/MSVC++/2005/libmpg123/libmpg123.vcproj +741 -0
- data/mpg123/ports/MSVC++/2008/dump_seekindex/dump_seekindex.vcproj +194 -0
- data/mpg123/ports/MSVC++/2008/feedseek/feedseek.vcproj +195 -0
- data/mpg123/ports/MSVC++/2008/libmpg123/libmpg123.vcproj +1357 -0
- data/mpg123/ports/MSVC++/2008/mpg123.sln +44 -0
- data/mpg123/ports/MSVC++/2008/mpglib/mpglib.vcproj +191 -0
- data/mpg123/ports/MSVC++/2008/scan/scan.vcproj +195 -0
- data/mpg123/ports/MSVC++/2008clr/2008clr.sln +81 -0
- data/mpg123/ports/MSVC++/2008clr/examples/ReplaceReaderclr/Program.cs +435 -0
- data/mpg123/ports/MSVC++/2008clr/examples/ReplaceReaderclr/Properties/AssemblyInfo.cs +36 -0
- data/mpg123/ports/MSVC++/2008clr/examples/ReplaceReaderclr/ReplaceReaderclr.csproj +72 -0
- data/mpg123/ports/MSVC++/2008clr/examples/feedseekclr/Program.cs +331 -0
- data/mpg123/ports/MSVC++/2008clr/examples/feedseekclr/Properties/AssemblyInfo.cs +36 -0
- data/mpg123/ports/MSVC++/2008clr/examples/feedseekclr/feedseekclr.csproj +71 -0
- data/mpg123/ports/MSVC++/2008clr/examples/scanclr/Program.cs +79 -0
- data/mpg123/ports/MSVC++/2008clr/examples/scanclr/Properties/AssemblyInfo.cs +36 -0
- data/mpg123/ports/MSVC++/2008clr/examples/scanclr/scanclr.csproj +70 -0
- data/mpg123/ports/MSVC++/2008clr/mpg123clr/AssemblyInfo.cpp +76 -0
- data/mpg123/ports/MSVC++/2008clr/mpg123clr/ReadMe.txt +165 -0
- data/mpg123/ports/MSVC++/2008clr/mpg123clr/advanced.cpp +91 -0
- data/mpg123/ports/MSVC++/2008clr/mpg123clr/advanced.h +130 -0
- data/mpg123/ports/MSVC++/2008clr/mpg123clr/dllmain.cpp +19 -0
- data/mpg123/ports/MSVC++/2008clr/mpg123clr/enum.h +218 -0
- data/mpg123/ports/MSVC++/2008clr/mpg123clr/error.cpp +48 -0
- data/mpg123/ports/MSVC++/2008clr/mpg123clr/error.h +134 -0
- data/mpg123/ports/MSVC++/2008clr/mpg123clr/id3v1.cpp +92 -0
- data/mpg123/ports/MSVC++/2008clr/mpg123clr/id3v1.h +132 -0
- data/mpg123/ports/MSVC++/2008clr/mpg123clr/id3v2.cpp +138 -0
- data/mpg123/ports/MSVC++/2008clr/mpg123clr/id3v2.h +152 -0
- data/mpg123/ports/MSVC++/2008clr/mpg123clr/mpg123clr.cpp +896 -0
- data/mpg123/ports/MSVC++/2008clr/mpg123clr/mpg123clr.h +953 -0
- data/mpg123/ports/MSVC++/2008clr/mpg123clr/mpg123clr.rc +102 -0
- data/mpg123/ports/MSVC++/2008clr/mpg123clr/mpg123clr.vcproj +328 -0
- data/mpg123/ports/MSVC++/2008clr/mpg123clr/resource.h +14 -0
- data/mpg123/ports/MSVC++/2008clr/mpg123clr/stdafx.cpp +8 -0
- data/mpg123/ports/MSVC++/2008clr/mpg123clr/stdafx.h +38 -0
- data/mpg123/ports/MSVC++/2008clr/mpg123clr/string.cpp +166 -0
- data/mpg123/ports/MSVC++/2008clr/mpg123clr/string.h +265 -0
- data/mpg123/ports/MSVC++/2008clr/mpg123clr/targetver.h +24 -0
- data/mpg123/ports/MSVC++/2008clr/mpg123clr/text.cpp +67 -0
- data/mpg123/ports/MSVC++/2008clr/mpg123clr/text.h +111 -0
- data/mpg123/ports/MSVC++/2010/dump_seekindex/dump_seekindex.vcxproj +90 -0
- data/mpg123/ports/MSVC++/2010/dump_seekindex/dump_seekindex.vcxproj.filters +6 -0
- data/mpg123/ports/MSVC++/2010/feedseek/feedseek.vcxproj +95 -0
- data/mpg123/ports/MSVC++/2010/feedseek/feedseek.vcxproj.filters +6 -0
- data/mpg123/ports/MSVC++/2010/libmpg123/libmpg123.vcxproj +960 -0
- data/mpg123/ports/MSVC++/2010/libmpg123/libmpg123.vcxproj.user +3 -0
- data/mpg123/ports/MSVC++/2010/libmpg123/yasm.exe +0 -0
- data/mpg123/ports/MSVC++/2010/mpg123.sln +38 -0
- data/mpg123/ports/MSVC++/2010/scan/scan.vcxproj +93 -0
- data/mpg123/ports/MSVC++/2010/scan/scan.vcxproj.filters +6 -0
- data/mpg123/ports/MSVC++/CMP3Stream/INCLUDE/CORE/CORE_FileIn.H +15 -0
- data/mpg123/ports/MSVC++/CMP3Stream/INCLUDE/CORE/SourceFilter_MP3.H +139 -0
- data/mpg123/ports/MSVC++/CMP3Stream/INCLUDE/IIEP_Def.H +206 -0
- data/mpg123/ports/MSVC++/CMP3Stream/INCLUDE/IIEP_FileIn.H +167 -0
- data/mpg123/ports/MSVC++/CMP3Stream/README +4 -0
- data/mpg123/ports/MSVC++/CMP3Stream/SOURCE/CORE_FileIn.CPP +462 -0
- data/mpg123/ports/MSVC++/CMP3Stream/SOURCE/CORE_Log.CPP +122 -0
- data/mpg123/ports/MSVC++/CMP3Stream/SOURCE/CORE_Mutex.CPP +35 -0
- data/mpg123/ports/MSVC++/CMP3Stream/SOURCE/SourceFilter_MP3Stream.CPP +586 -0
- data/mpg123/ports/MSVC++/CMP3Stream/libMPG123/PLACE_LIBMPG123_SOURCES_HERE +0 -0
- data/mpg123/ports/MSVC++/CMP3Stream/libMPG123/libMPG123.vcproj +245 -0
- data/mpg123/ports/MSVC++/config.h +35 -0
- data/mpg123/ports/MSVC++/examples/feedseek.c +240 -0
- data/mpg123/ports/MSVC++/examples/scan.c +47 -0
- data/mpg123/ports/MSVC++/mpg123.h +46 -0
- data/mpg123/ports/MSVC++/msvc.c +59 -0
- data/mpg123/ports/README +26 -0
- data/mpg123/ports/Sony_PSP/Makefile.psp +38 -0
- data/mpg123/ports/Sony_PSP/README +11 -0
- data/mpg123/ports/Sony_PSP/config.h +368 -0
- data/mpg123/ports/Sony_PSP/readers.c.patch +2 -0
- data/mpg123/ports/Xcode/config.h +197 -0
- data/mpg123/ports/Xcode/mpg123.h +17 -0
- data/mpg123/ports/Xcode/mpg123.xcodeproj/project.pbxproj +670 -0
- data/mpg123/ports/mpg123_.pas +478 -0
- data/mpg123/scripts/benchmark-cpu.pl +56 -0
- data/mpg123/scripts/tag_lyrics.py +76 -0
- data/mpg123/src/Makefile.am +186 -0
- data/mpg123/src/Makefile.in +1097 -0
- data/mpg123/src/audio.c +725 -0
- data/mpg123/src/audio.h +106 -0
- data/mpg123/src/buffer.c +312 -0
- data/mpg123/src/buffer.h +45 -0
- data/mpg123/src/common.c +240 -0
- data/mpg123/src/common.h +29 -0
- data/mpg123/src/config.h.in +436 -0
- data/mpg123/src/control_generic.c +809 -0
- data/mpg123/src/equalizer.c +48 -0
- data/mpg123/src/genre.c +271 -0
- data/mpg123/src/genre.h +15 -0
- data/mpg123/src/getlopt.c +148 -0
- data/mpg123/src/getlopt.h +77 -0
- data/mpg123/src/httpget.c +700 -0
- data/mpg123/src/httpget.h +66 -0
- data/mpg123/src/legacy_module.c +74 -0
- data/mpg123/src/libmpg123/Makefile.am +141 -0
- data/mpg123/src/libmpg123/Makefile.in +919 -0
- data/mpg123/src/libmpg123/compat.c +138 -0
- data/mpg123/src/libmpg123/compat.h +178 -0
- data/mpg123/src/libmpg123/dct36_3dnow.S +505 -0
- data/mpg123/src/libmpg123/dct36_3dnowext.S +512 -0
- data/mpg123/src/libmpg123/dct64.c +174 -0
- data/mpg123/src/libmpg123/dct64_3dnow.S +712 -0
- data/mpg123/src/libmpg123/dct64_3dnowext.S +714 -0
- data/mpg123/src/libmpg123/dct64_altivec.c +315 -0
- data/mpg123/src/libmpg123/dct64_i386.c +336 -0
- data/mpg123/src/libmpg123/dct64_i486.c +342 -0
- data/mpg123/src/libmpg123/dct64_mmx.S +811 -0
- data/mpg123/src/libmpg123/dct64_neon.S +297 -0
- data/mpg123/src/libmpg123/dct64_neon_float.S +270 -0
- data/mpg123/src/libmpg123/dct64_sse.S +454 -0
- data/mpg123/src/libmpg123/dct64_sse_float.S +401 -0
- data/mpg123/src/libmpg123/dct64_x86_64.S +464 -0
- data/mpg123/src/libmpg123/dct64_x86_64_float.S +426 -0
- data/mpg123/src/libmpg123/debug.h +171 -0
- data/mpg123/src/libmpg123/decode.h +268 -0
- data/mpg123/src/libmpg123/dither.c +119 -0
- data/mpg123/src/libmpg123/dither.h +23 -0
- data/mpg123/src/libmpg123/equalizer.c +17 -0
- data/mpg123/src/libmpg123/equalizer_3dnow.S +70 -0
- data/mpg123/src/libmpg123/feature.c +106 -0
- data/mpg123/src/libmpg123/format.c +521 -0
- data/mpg123/src/libmpg123/frame.c +1046 -0
- data/mpg123/src/libmpg123/frame.h +410 -0
- data/mpg123/src/libmpg123/gapless.h +119 -0
- data/mpg123/src/libmpg123/getbits.h +100 -0
- data/mpg123/src/libmpg123/getcpuflags.S +91 -0
- data/mpg123/src/libmpg123/getcpuflags.h +47 -0
- data/mpg123/src/libmpg123/huffman.h +340 -0
- data/mpg123/src/libmpg123/icy.c +32 -0
- data/mpg123/src/libmpg123/icy.h +38 -0
- data/mpg123/src/libmpg123/icy2utf8.c +438 -0
- data/mpg123/src/libmpg123/icy2utf8.h +10 -0
- data/mpg123/src/libmpg123/id3.c +999 -0
- data/mpg123/src/libmpg123/id3.h +43 -0
- data/mpg123/src/libmpg123/index.c +134 -0
- data/mpg123/src/libmpg123/index.h +59 -0
- data/mpg123/src/libmpg123/intsym.h +256 -0
- data/mpg123/src/libmpg123/l12_integer_tables.h +278 -0
- data/mpg123/src/libmpg123/l2tables.h +164 -0
- data/mpg123/src/libmpg123/l3_integer_tables.h +1002 -0
- data/mpg123/src/libmpg123/layer1.c +155 -0
- data/mpg123/src/libmpg123/layer2.c +371 -0
- data/mpg123/src/libmpg123/layer3.c +2053 -0
- data/mpg123/src/libmpg123/lfs_alias.c +252 -0
- data/mpg123/src/libmpg123/lfs_wrap.c +751 -0
- data/mpg123/src/libmpg123/libmpg123.c +1607 -0
- data/mpg123/src/libmpg123/mangle.h +74 -0
- data/mpg123/src/libmpg123/mpeghead.h +87 -0
- data/mpg123/src/libmpg123/mpg123.h.in +1075 -0
- data/mpg123/src/libmpg123/mpg123lib_intern.h +338 -0
- data/mpg123/src/libmpg123/ntom.c +148 -0
- data/mpg123/src/libmpg123/optimize.c +964 -0
- data/mpg123/src/libmpg123/optimize.h +219 -0
- data/mpg123/src/libmpg123/parse.c +1179 -0
- data/mpg123/src/libmpg123/parse.h +25 -0
- data/mpg123/src/libmpg123/reader.h +137 -0
- data/mpg123/src/libmpg123/readers.c +1235 -0
- data/mpg123/src/libmpg123/sample.h +152 -0
- data/mpg123/src/libmpg123/stringbuf.c +163 -0
- data/mpg123/src/libmpg123/synth.c +816 -0
- data/mpg123/src/libmpg123/synth.h +196 -0
- data/mpg123/src/libmpg123/synth_3dnow.S +318 -0
- data/mpg123/src/libmpg123/synth_3dnowext.S +6 -0
- data/mpg123/src/libmpg123/synth_8bit.c +142 -0
- data/mpg123/src/libmpg123/synth_8bit.h +86 -0
- data/mpg123/src/libmpg123/synth_altivec.c +1057 -0
- data/mpg123/src/libmpg123/synth_arm.S +271 -0
- data/mpg123/src/libmpg123/synth_arm_accurate.S +287 -0
- data/mpg123/src/libmpg123/synth_i486.c +252 -0
- data/mpg123/src/libmpg123/synth_i586.S +336 -0
- data/mpg123/src/libmpg123/synth_i586_dither.S +375 -0
- data/mpg123/src/libmpg123/synth_mmx.S +125 -0
- data/mpg123/src/libmpg123/synth_mono.h +64 -0
- data/mpg123/src/libmpg123/synth_neon.S +123 -0
- data/mpg123/src/libmpg123/synth_neon_accurate.S +173 -0
- data/mpg123/src/libmpg123/synth_neon_float.S +149 -0
- data/mpg123/src/libmpg123/synth_neon_s32.S +168 -0
- data/mpg123/src/libmpg123/synth_ntom.h +213 -0
- data/mpg123/src/libmpg123/synth_real.c +404 -0
- data/mpg123/src/libmpg123/synth_s32.c +411 -0
- data/mpg123/src/libmpg123/synth_sse.S +6 -0
- data/mpg123/src/libmpg123/synth_sse3d.h +246 -0
- data/mpg123/src/libmpg123/synth_sse_accurate.S +294 -0
- data/mpg123/src/libmpg123/synth_sse_float.S +241 -0
- data/mpg123/src/libmpg123/synth_sse_s32.S +306 -0
- data/mpg123/src/libmpg123/synth_stereo_neon.S +175 -0
- data/mpg123/src/libmpg123/synth_stereo_neon_accurate.S +262 -0
- data/mpg123/src/libmpg123/synth_stereo_neon_float.S +220 -0
- data/mpg123/src/libmpg123/synth_stereo_neon_s32.S +247 -0
- data/mpg123/src/libmpg123/synth_stereo_sse_accurate.S +508 -0
- data/mpg123/src/libmpg123/synth_stereo_sse_float.S +416 -0
- data/mpg123/src/libmpg123/synth_stereo_sse_s32.S +540 -0
- data/mpg123/src/libmpg123/synth_stereo_x86_64.S +335 -0
- data/mpg123/src/libmpg123/synth_stereo_x86_64_accurate.S +454 -0
- data/mpg123/src/libmpg123/synth_stereo_x86_64_float.S +396 -0
- data/mpg123/src/libmpg123/synth_stereo_x86_64_s32.S +473 -0
- data/mpg123/src/libmpg123/synth_x86_64.S +244 -0
- data/mpg123/src/libmpg123/synth_x86_64_accurate.S +301 -0
- data/mpg123/src/libmpg123/synth_x86_64_float.S +259 -0
- data/mpg123/src/libmpg123/synth_x86_64_s32.S +312 -0
- data/mpg123/src/libmpg123/synths.h +52 -0
- data/mpg123/src/libmpg123/tabinit.c +294 -0
- data/mpg123/src/libmpg123/tabinit_mmx.S +210 -0
- data/mpg123/src/libmpg123/testcpu.c +35 -0
- data/mpg123/src/libmpg123/true.h +14 -0
- data/mpg123/src/local.c +63 -0
- data/mpg123/src/local.h +21 -0
- data/mpg123/src/metaprint.c +373 -0
- data/mpg123/src/metaprint.h +17 -0
- data/mpg123/src/module.c +306 -0
- data/mpg123/src/module.h +48 -0
- data/mpg123/src/mpg123.c +1405 -0
- data/mpg123/src/mpg123app.h +171 -0
- data/mpg123/src/output/Makefile.am +213 -0
- data/mpg123/src/output/Makefile.in +1238 -0
- data/mpg123/src/output/aix.c +300 -0
- data/mpg123/src/output/alib.c +209 -0
- data/mpg123/src/output/alsa.c +297 -0
- data/mpg123/src/output/arts.c +117 -0
- data/mpg123/src/output/coreaudio.c +370 -0
- data/mpg123/src/output/dummy.c +78 -0
- data/mpg123/src/output/esd.c +167 -0
- data/mpg123/src/output/hp.c +184 -0
- data/mpg123/src/output/jack.c +450 -0
- data/mpg123/src/output/mint.c +197 -0
- data/mpg123/src/output/nas.c +335 -0
- data/mpg123/src/output/openal.c +197 -0
- data/mpg123/src/output/os2.c +665 -0
- data/mpg123/src/output/oss.c +319 -0
- data/mpg123/src/output/portaudio.c +255 -0
- data/mpg123/src/output/pulse.c +164 -0
- data/mpg123/src/output/sdl.c +206 -0
- data/mpg123/src/output/sgi.c +213 -0
- data/mpg123/src/output/sndio.c +161 -0
- data/mpg123/src/output/sun.c +281 -0
- data/mpg123/src/output/win32.c +229 -0
- data/mpg123/src/playlist.c +596 -0
- data/mpg123/src/playlist.h +52 -0
- data/mpg123/src/resolver.c +319 -0
- data/mpg123/src/resolver.h +25 -0
- data/mpg123/src/sfifo.c +146 -0
- data/mpg123/src/sfifo.h +95 -0
- data/mpg123/src/streamdump.c +74 -0
- data/mpg123/src/streamdump.h +20 -0
- data/mpg123/src/term.c +479 -0
- data/mpg123/src/term.h +81 -0
- data/mpg123/src/tests/noise.c +52 -0
- data/mpg123/src/tests/plain_id3.c +109 -0
- data/mpg123/src/tests/seek_accuracy.c +261 -0
- data/mpg123/src/tests/seek_whence.c +56 -0
- data/mpg123/src/tests/testtext.h +34 -0
- data/mpg123/src/tests/text.c +80 -0
- data/mpg123/src/wav.c +464 -0
- data/mpg123/src/wavhead.h +68 -0
- data/mpg123/src/win32_net.c +599 -0
- data/mpg123/src/win32_support.c +191 -0
- data/mpg123/src/win32_support.h +152 -0
- data/mpg123/src/xfermem.c +321 -0
- data/mpg123/src/xfermem.h +74 -0
- data/mpg123/windows-builds.sh +137 -0
- data/msvc/lib/OpenAL32.lib +0 -0
- data/spec/fixtures/heal.ogg +0 -0
- data/spec/fixtures/tone_up.wav +0 -0
- data/spec/seal/buffer_spec.rb +37 -0
- data/spec/seal/core_spec.rb +29 -0
- data/spec/seal/effect_slot_spec.rb +38 -0
- data/spec/seal/listener_spec.rb +33 -0
- data/spec/seal/reverb_spec.rb +51 -0
- data/spec/seal/source_spec.rb +370 -0
- data/spec/seal/stream_spec.rb +38 -0
- data/spec/spec_helper.rb +45 -0
- data/spec/support/attribute_examples.rb +75 -0
- data/spec/support/audio_object_with_format.rb +27 -0
- data/spec/support/movable_object.rb +22 -0
- data/src/libogg/bitwise.c +857 -0
- data/src/libogg/framing.c +2093 -0
- data/src/libvorbis/backends.h +144 -0
- data/src/libvorbis/bitrate.c +253 -0
- data/src/libvorbis/bitrate.h +59 -0
- data/src/libvorbis/block.c +1046 -0
- data/src/libvorbis/codebook.c +484 -0
- data/src/libvorbis/codebook.h +119 -0
- data/src/libvorbis/codec_internal.h +167 -0
- data/src/libvorbis/envelope.c +375 -0
- data/src/libvorbis/envelope.h +80 -0
- data/src/libvorbis/floor0.c +221 -0
- data/src/libvorbis/floor1.c +1100 -0
- data/src/libvorbis/highlevel.h +58 -0
- data/src/libvorbis/info.c +668 -0
- data/src/libvorbis/lookup.c +94 -0
- data/src/libvorbis/lookup.h +32 -0
- data/src/libvorbis/lookup_data.h +192 -0
- data/src/libvorbis/lpc.c +160 -0
- data/src/libvorbis/lpc.h +29 -0
- data/src/libvorbis/lsp.c +456 -0
- data/src/libvorbis/lsp.h +28 -0
- data/src/libvorbis/mapping0.c +816 -0
- data/src/libvorbis/masking.h +785 -0
- data/src/libvorbis/mdct.c +563 -0
- data/src/libvorbis/mdct.h +71 -0
- data/src/libvorbis/misc.h +57 -0
- data/src/libvorbis/os.h +186 -0
- data/src/libvorbis/psy.c +1206 -0
- data/src/libvorbis/psy.h +154 -0
- data/src/libvorbis/registry.c +45 -0
- data/src/libvorbis/registry.h +32 -0
- data/src/libvorbis/res0.c +889 -0
- data/src/libvorbis/scales.h +90 -0
- data/src/libvorbis/sharedbook.c +579 -0
- data/src/libvorbis/smallft.c +1255 -0
- data/src/libvorbis/smallft.h +34 -0
- data/src/libvorbis/synthesis.c +184 -0
- data/src/libvorbis/vorbisfile.c +2337 -0
- data/src/libvorbis/window.c +2135 -0
- data/src/libvorbis/window.h +26 -0
- data/src/rubyext.c +2329 -0
- data/src/seal/buf.c +124 -0
- data/src/seal/core.c +283 -0
- data/src/seal/efs.c +74 -0
- data/src/seal/err.c +118 -0
- data/src/seal/fmt.c +86 -0
- data/src/seal/listener.c +111 -0
- data/src/seal/mpg.c +174 -0
- data/src/seal/mpg.h +24 -0
- data/src/seal/ov.c +180 -0
- data/src/seal/ov.h +22 -0
- data/src/seal/raw.c +59 -0
- data/src/seal/reader.c +102 -0
- data/src/seal/reader.h +59 -0
- data/src/seal/rvb.c +368 -0
- data/src/seal/src.c +654 -0
- data/src/seal/stream.c +109 -0
- data/src/seal/threading.c +66 -0
- data/src/seal/threading.h +20 -0
- data/src/seal/wav.c +297 -0
- data/src/seal/wav.h +23 -0
- data/src/win32api.rb +29 -0
- metadata +563 -0
@@ -0,0 +1,319 @@
|
|
1
|
+
/*
|
2
|
+
oss: audio output via Open Sound System
|
3
|
+
|
4
|
+
copyright ?-2006 by the mpg123 project - free software under the terms of the LGPL 2.1
|
5
|
+
see COPYING and AUTHORS files in distribution or http://mpg123.org
|
6
|
+
initially written by Michael Hipp
|
7
|
+
*/
|
8
|
+
|
9
|
+
#include <sys/ioctl.h>
|
10
|
+
#include <fcntl.h>
|
11
|
+
|
12
|
+
#include "mpg123app.h"
|
13
|
+
|
14
|
+
#ifdef HAVE_LINUX_SOUNDCARD_H
|
15
|
+
#include <linux/soundcard.h>
|
16
|
+
#endif
|
17
|
+
|
18
|
+
#ifdef HAVE_SYS_SOUNDCARD_H
|
19
|
+
#include <sys/soundcard.h>
|
20
|
+
#endif
|
21
|
+
|
22
|
+
#ifdef HAVE_MACHINE_SOUNDCARD_H
|
23
|
+
#include <machine/soundcard.h>
|
24
|
+
#endif
|
25
|
+
|
26
|
+
#ifndef AFMT_S16_NE
|
27
|
+
# ifdef OSS_BIG_ENDIAN
|
28
|
+
# define AFMT_S16_NE AFMT_S16_BE
|
29
|
+
# else
|
30
|
+
# define AFMT_S16_NE AFMT_S16_LE
|
31
|
+
# endif
|
32
|
+
#endif
|
33
|
+
|
34
|
+
#ifndef AFMT_U16_NE
|
35
|
+
# ifdef OSS_BIG_ENDIAN
|
36
|
+
# define AFMT_U16_NE AFMT_U16_BE
|
37
|
+
# else
|
38
|
+
# define AFMT_U16_NE AFMT_U16_LE
|
39
|
+
# endif
|
40
|
+
#endif
|
41
|
+
|
42
|
+
#include "debug.h"
|
43
|
+
|
44
|
+
struct oss_stuff
|
45
|
+
{
|
46
|
+
int fragment; /* size of one fragment */
|
47
|
+
int nfrag; /* number of fragments */
|
48
|
+
};
|
49
|
+
|
50
|
+
static int rate_best_match_oss(audio_output_t *ao)
|
51
|
+
{
|
52
|
+
int ret,dsp_rate;
|
53
|
+
|
54
|
+
if(!ao || ao->fn < 0 || ao->rate < 0) return -1;
|
55
|
+
dsp_rate = ao->rate;
|
56
|
+
|
57
|
+
ret = ioctl(ao->fn, SNDCTL_DSP_SPEED,&dsp_rate);
|
58
|
+
if(ret < 0) return ret;
|
59
|
+
ao->rate = dsp_rate;
|
60
|
+
return 0;
|
61
|
+
}
|
62
|
+
|
63
|
+
static int set_rate_oss(audio_output_t *ao)
|
64
|
+
{
|
65
|
+
int dsp_rate;
|
66
|
+
int ret = 0;
|
67
|
+
|
68
|
+
if(ao->rate >= 0) {
|
69
|
+
dsp_rate = ao->rate;
|
70
|
+
ret = ioctl(ao->fn, SNDCTL_DSP_SPEED,&dsp_rate);
|
71
|
+
}
|
72
|
+
return ret;
|
73
|
+
}
|
74
|
+
|
75
|
+
static int set_channels_oss(audio_output_t *ao)
|
76
|
+
{
|
77
|
+
int chan = ao->channels - 1;
|
78
|
+
int ret;
|
79
|
+
|
80
|
+
if(ao->channels < 0) return 0;
|
81
|
+
|
82
|
+
ret = ioctl(ao->fn, SNDCTL_DSP_STEREO, &chan);
|
83
|
+
if(chan != (ao->channels-1)) return -1;
|
84
|
+
|
85
|
+
return ret;
|
86
|
+
}
|
87
|
+
|
88
|
+
static int set_format_oss(audio_output_t *ao)
|
89
|
+
{
|
90
|
+
int fmts;
|
91
|
+
int sf,ret;
|
92
|
+
|
93
|
+
if(ao->format == -1) return 0;
|
94
|
+
|
95
|
+
switch(ao->format) {
|
96
|
+
case MPG123_ENC_SIGNED_16:
|
97
|
+
default:
|
98
|
+
fmts = AFMT_S16_NE;
|
99
|
+
break;
|
100
|
+
case MPG123_ENC_UNSIGNED_8:
|
101
|
+
fmts = AFMT_U8;
|
102
|
+
break;
|
103
|
+
case MPG123_ENC_SIGNED_8:
|
104
|
+
fmts = AFMT_S8;
|
105
|
+
break;
|
106
|
+
case MPG123_ENC_ULAW_8:
|
107
|
+
fmts = AFMT_MU_LAW;
|
108
|
+
break;
|
109
|
+
case MPG123_ENC_ALAW_8:
|
110
|
+
fmts = AFMT_A_LAW;
|
111
|
+
break;
|
112
|
+
case MPG123_ENC_UNSIGNED_16:
|
113
|
+
fmts = AFMT_U16_NE;
|
114
|
+
break;
|
115
|
+
}
|
116
|
+
|
117
|
+
sf = fmts;
|
118
|
+
ret = ioctl(ao->fn, SNDCTL_DSP_SETFMT, &fmts);
|
119
|
+
if(sf != fmts) return -1;
|
120
|
+
|
121
|
+
return ret;
|
122
|
+
}
|
123
|
+
|
124
|
+
|
125
|
+
static int reset_parameters_oss(audio_output_t *ao)
|
126
|
+
{
|
127
|
+
int ret;
|
128
|
+
ret = ioctl(ao->fn, SNDCTL_DSP_RESET, NULL);
|
129
|
+
if(ret < 0 && !AOQUIET) error("Can't reset audio!");
|
130
|
+
ret = set_format_oss(ao);
|
131
|
+
if (ret == -1) goto err;
|
132
|
+
ret = set_channels_oss(ao);
|
133
|
+
if (ret == -1) goto err;
|
134
|
+
ret = set_rate_oss(ao);
|
135
|
+
if (ret == -1) goto err;
|
136
|
+
|
137
|
+
/* Careful here. As per OSS v1.1, the next ioctl() commits the format
|
138
|
+
* set above, so we must issue SNDCTL_DSP_RESET before we're allowed to
|
139
|
+
* change it again. [dk]
|
140
|
+
*/
|
141
|
+
|
142
|
+
/* FIXME: this needs re-enabled (but not using global variables this time):
|
143
|
+
if (ioctl(ao->fn, SNDCTL_DSP_GETBLKSIZE, &outburst) == -1 ||
|
144
|
+
outburst > MAXOUTBURST)
|
145
|
+
outburst = MAXOUTBURST;
|
146
|
+
*/
|
147
|
+
|
148
|
+
err:
|
149
|
+
return ret;
|
150
|
+
}
|
151
|
+
|
152
|
+
|
153
|
+
static int open_oss(audio_output_t *ao)
|
154
|
+
{
|
155
|
+
char usingdefdev = 0;
|
156
|
+
|
157
|
+
if(!ao) return -1;
|
158
|
+
|
159
|
+
if(!ao->device) {
|
160
|
+
ao->device = "/dev/dsp";
|
161
|
+
usingdefdev = 1;
|
162
|
+
}
|
163
|
+
|
164
|
+
ao->fn = open(ao->device,O_WRONLY);
|
165
|
+
|
166
|
+
if(ao->fn < 0)
|
167
|
+
{
|
168
|
+
if(usingdefdev) {
|
169
|
+
ao->device = "/dev/sound/dsp";
|
170
|
+
ao->fn = open(ao->device,O_WRONLY);
|
171
|
+
if(ao->fn < 0) {
|
172
|
+
if(!AOQUIET) error("Can't open default sound device!");
|
173
|
+
return -1;
|
174
|
+
}
|
175
|
+
} else {
|
176
|
+
if(!AOQUIET) error1("Can't open %s!",ao->device);
|
177
|
+
return -1;
|
178
|
+
}
|
179
|
+
}
|
180
|
+
|
181
|
+
if(reset_parameters_oss(ao) < 0) {
|
182
|
+
close(ao->fn);
|
183
|
+
return -1;
|
184
|
+
}
|
185
|
+
|
186
|
+
if(ao->gain >= 0) {
|
187
|
+
int e,mask;
|
188
|
+
e = ioctl(ao->fn , SOUND_MIXER_READ_DEVMASK ,&mask);
|
189
|
+
if(e < 0) {
|
190
|
+
if(!AOQUIET) error("audio/gain: Can't get audio device features list.");
|
191
|
+
}
|
192
|
+
else if(mask & SOUND_MASK_PCM) {
|
193
|
+
int gain = (ao->gain<<8)|(ao->gain);
|
194
|
+
e = ioctl(ao->fn, SOUND_MIXER_WRITE_PCM , &gain);
|
195
|
+
}
|
196
|
+
else if(!(mask & SOUND_MASK_VOLUME)) {
|
197
|
+
if(!AOQUIET) error1("audio/gain: setable Volume/PCM-Level not supported by your audio device: %#04x",mask);
|
198
|
+
}
|
199
|
+
else {
|
200
|
+
int gain = (ao->gain<<8)|(ao->gain);
|
201
|
+
e = ioctl(ao->fn, SOUND_MIXER_WRITE_VOLUME , &gain);
|
202
|
+
}
|
203
|
+
}
|
204
|
+
|
205
|
+
return ao->fn;
|
206
|
+
}
|
207
|
+
|
208
|
+
|
209
|
+
|
210
|
+
/*
|
211
|
+
* get formats for specific channel/rate parameters
|
212
|
+
*/
|
213
|
+
static int get_formats_oss(audio_output_t *ao)
|
214
|
+
{
|
215
|
+
int fmt = 0;
|
216
|
+
int r = ao->rate;
|
217
|
+
int c = ao->channels;
|
218
|
+
int i;
|
219
|
+
|
220
|
+
static int fmts[] = {
|
221
|
+
MPG123_ENC_ULAW_8 , MPG123_ENC_SIGNED_16 ,
|
222
|
+
MPG123_ENC_UNSIGNED_8 , MPG123_ENC_SIGNED_8 ,
|
223
|
+
MPG123_ENC_UNSIGNED_16 , MPG123_ENC_ALAW_8
|
224
|
+
};
|
225
|
+
|
226
|
+
/* Reset is required before we're allowed to set the new formats. [dk] */
|
227
|
+
ioctl(ao->fn, SNDCTL_DSP_RESET, NULL);
|
228
|
+
|
229
|
+
for(i=0;i<6;i++) {
|
230
|
+
ao->format = fmts[i];
|
231
|
+
if(set_format_oss(ao) < 0) {
|
232
|
+
continue;
|
233
|
+
}
|
234
|
+
ao->channels = c;
|
235
|
+
if(set_channels_oss(ao) < 0) {
|
236
|
+
continue;
|
237
|
+
}
|
238
|
+
ao->rate = r;
|
239
|
+
if(rate_best_match_oss(ao) < 0) {
|
240
|
+
continue;
|
241
|
+
}
|
242
|
+
if( (ao->rate*100 > r*(100-AUDIO_RATE_TOLERANCE)) && (ao->rate*100 < r*(100+AUDIO_RATE_TOLERANCE)) ) {
|
243
|
+
fmt |= fmts[i];
|
244
|
+
}
|
245
|
+
}
|
246
|
+
|
247
|
+
|
248
|
+
#if 0
|
249
|
+
if(ioctl(ao->fn,SNDCTL_DSP_GETFMTS,&fmts) < 0) {
|
250
|
+
if(!AOQUIET) error("Failed to get SNDCTL_DSP_GETFMTS");
|
251
|
+
return -1;
|
252
|
+
}
|
253
|
+
|
254
|
+
if(fmts & AFMT_MU_LAW)
|
255
|
+
ret |= MPG123_ENC_ULAW_8;
|
256
|
+
if(fmts & AFMT_S16_NE)
|
257
|
+
ret |= MPG123_ENC_SIGNED_16;
|
258
|
+
if(fmts & AFMT_U8)
|
259
|
+
ret |= MPG123_ENC_UNSIGNED_8;
|
260
|
+
if(fmts & AFMT_S8)
|
261
|
+
ret |= MPG123_ENC_SIGNED_8;
|
262
|
+
if(fmts & AFMT_U16_NE)
|
263
|
+
ret |= MPG123_ENC_UNSIGNED_16;
|
264
|
+
if(fmts & AFMT_A_LAW)
|
265
|
+
ret |= MPG123_ENC_ALAW_8;
|
266
|
+
#endif
|
267
|
+
|
268
|
+
return fmt;
|
269
|
+
}
|
270
|
+
|
271
|
+
static int write_oss(audio_output_t *ao,unsigned char *buf,int len)
|
272
|
+
{
|
273
|
+
return write(ao->fn,buf,len);
|
274
|
+
}
|
275
|
+
|
276
|
+
static int close_oss(audio_output_t *ao)
|
277
|
+
{
|
278
|
+
close(ao->fn);
|
279
|
+
return 0;
|
280
|
+
}
|
281
|
+
|
282
|
+
static void flush_oss(audio_output_t *ao)
|
283
|
+
{
|
284
|
+
}
|
285
|
+
|
286
|
+
|
287
|
+
|
288
|
+
|
289
|
+
static int init_oss(audio_output_t* ao)
|
290
|
+
{
|
291
|
+
if (ao==NULL) return -1;
|
292
|
+
|
293
|
+
/* Set callbacks */
|
294
|
+
ao->open = open_oss;
|
295
|
+
ao->flush = flush_oss;
|
296
|
+
ao->write = write_oss;
|
297
|
+
ao->get_formats = get_formats_oss;
|
298
|
+
ao->close = close_oss;
|
299
|
+
|
300
|
+
/* Success */
|
301
|
+
return 0;
|
302
|
+
}
|
303
|
+
|
304
|
+
|
305
|
+
|
306
|
+
/*
|
307
|
+
Module information data structure
|
308
|
+
*/
|
309
|
+
mpg123_module_t mpg123_output_module_info = {
|
310
|
+
/* api_version */ MPG123_MODULE_API_VERSION,
|
311
|
+
/* name */ "oss",
|
312
|
+
/* description */ "Output audio using OSS",
|
313
|
+
/* revision */ "$Rev: 2927 $",
|
314
|
+
/* handle */ NULL,
|
315
|
+
|
316
|
+
/* init_output */ init_oss,
|
317
|
+
};
|
318
|
+
|
319
|
+
|
@@ -0,0 +1,255 @@
|
|
1
|
+
/*
|
2
|
+
portaudio: audio output via PortAudio cross-platform audio API
|
3
|
+
|
4
|
+
copyright 2006-9 by the mpg123 project - free software under the terms of the LGPL 2.1
|
5
|
+
see COPYING and AUTHORS files in distribution or http://mpg123.org
|
6
|
+
initially written by Nicholas J. Humfrey
|
7
|
+
*/
|
8
|
+
|
9
|
+
#include <math.h>
|
10
|
+
|
11
|
+
#include <portaudio.h>
|
12
|
+
|
13
|
+
#include "audio.h"
|
14
|
+
#include "mpg123app.h"
|
15
|
+
|
16
|
+
#ifdef WIN32
|
17
|
+
#include <windows.h>
|
18
|
+
#endif
|
19
|
+
|
20
|
+
/* Including the sfifo code locally, to avoid module linkage issues. */
|
21
|
+
#define SFIFO_STATIC
|
22
|
+
#include "sfifo.c"
|
23
|
+
|
24
|
+
#include "debug.h"
|
25
|
+
|
26
|
+
#define SAMPLE_SIZE (2)
|
27
|
+
#define FRAMES_PER_BUFFER (256)
|
28
|
+
#define FIFO_DURATION (0.5f)
|
29
|
+
|
30
|
+
|
31
|
+
typedef struct {
|
32
|
+
PaStream *stream;
|
33
|
+
sfifo_t fifo;
|
34
|
+
} mpg123_portaudio_t;
|
35
|
+
|
36
|
+
#ifdef PORTAUDIO18
|
37
|
+
#define PaTime PaTimestamp
|
38
|
+
#define Pa_IsStreamActive Pa_StreamActive
|
39
|
+
#endif
|
40
|
+
|
41
|
+
|
42
|
+
#ifdef PORTAUDIO18
|
43
|
+
static int paCallback( void *inputBuffer, void *outputBuffer,
|
44
|
+
unsigned long framesPerBuffer,
|
45
|
+
PaTime outTime, void *userData )
|
46
|
+
#else
|
47
|
+
static int paCallback(
|
48
|
+
const void *inputBuffer, void *outputBuffer,
|
49
|
+
unsigned long framesPerBuffer,
|
50
|
+
const PaStreamCallbackTimeInfo* timeInfo,
|
51
|
+
PaStreamCallbackFlags statusFlags,
|
52
|
+
void *userData )
|
53
|
+
#endif
|
54
|
+
{
|
55
|
+
audio_output_t *ao = userData;
|
56
|
+
mpg123_portaudio_t *pa = (mpg123_portaudio_t*)ao->userptr;
|
57
|
+
unsigned long bytes = framesPerBuffer * SAMPLE_SIZE * ao->channels;
|
58
|
+
|
59
|
+
if (sfifo_used(&pa->fifo)<bytes) {
|
60
|
+
error("ringbuffer for PortAudio is empty");
|
61
|
+
return 1;
|
62
|
+
} else {
|
63
|
+
sfifo_read( &pa->fifo, outputBuffer, bytes );
|
64
|
+
return 0;
|
65
|
+
}
|
66
|
+
}
|
67
|
+
|
68
|
+
|
69
|
+
static int open_portaudio(audio_output_t *ao)
|
70
|
+
{
|
71
|
+
mpg123_portaudio_t *pa = (mpg123_portaudio_t*)ao->userptr;
|
72
|
+
PaError err;
|
73
|
+
|
74
|
+
/* Open an audio I/O stream. */
|
75
|
+
if (ao->rate > 0 && ao->channels >0 ) {
|
76
|
+
|
77
|
+
err = Pa_OpenDefaultStream(
|
78
|
+
&pa->stream,
|
79
|
+
0, /* no input channels */
|
80
|
+
ao->channels, /* number of output channels */
|
81
|
+
paInt16, /* signed 16-bit samples */
|
82
|
+
ao->rate, /* sample rate */
|
83
|
+
FRAMES_PER_BUFFER, /* frames per buffer */
|
84
|
+
#ifdef PORTAUDIO18
|
85
|
+
0, /* number of buffers, if zero then use default minimum */
|
86
|
+
#endif
|
87
|
+
paCallback, /* no callback - use blocking IO */
|
88
|
+
ao );
|
89
|
+
|
90
|
+
if( err != paNoError ) {
|
91
|
+
error1("Failed to open PortAudio default stream: %s", Pa_GetErrorText( err ));
|
92
|
+
return -1;
|
93
|
+
}
|
94
|
+
|
95
|
+
/* Initialise FIFO */
|
96
|
+
sfifo_init( &pa->fifo, ao->rate * FIFO_DURATION * SAMPLE_SIZE *ao->channels );
|
97
|
+
|
98
|
+
}
|
99
|
+
|
100
|
+
return(0);
|
101
|
+
}
|
102
|
+
|
103
|
+
|
104
|
+
static int get_formats_portaudio(audio_output_t *ao)
|
105
|
+
{
|
106
|
+
/* Only implemented Signed 16-bit audio for now */
|
107
|
+
return MPG123_ENC_SIGNED_16;
|
108
|
+
}
|
109
|
+
|
110
|
+
|
111
|
+
static int write_portaudio(audio_output_t *ao, unsigned char *buf, int len)
|
112
|
+
{
|
113
|
+
mpg123_portaudio_t *pa = (mpg123_portaudio_t*)ao->userptr;
|
114
|
+
PaError err;
|
115
|
+
int written;
|
116
|
+
|
117
|
+
/* Sleep for half the length of the FIFO */
|
118
|
+
while (sfifo_space( &pa->fifo ) < len ) {
|
119
|
+
#ifdef WIN32
|
120
|
+
Sleep( (FIFO_DURATION/2) * 1000);
|
121
|
+
#else
|
122
|
+
usleep( (FIFO_DURATION/2) * 1000000 );
|
123
|
+
#endif
|
124
|
+
}
|
125
|
+
|
126
|
+
/* Write the audio to the ring buffer */
|
127
|
+
written = sfifo_write( &pa->fifo, buf, len );
|
128
|
+
|
129
|
+
/* Start stream if not ative */
|
130
|
+
err = Pa_IsStreamActive( pa->stream );
|
131
|
+
if (err == 0) {
|
132
|
+
err = Pa_StartStream( pa->stream );
|
133
|
+
if( err != paNoError ) {
|
134
|
+
error1("Failed to start PortAudio stream: %s", Pa_GetErrorText( err ));
|
135
|
+
return -1; /* triggering exit here is not good, better handle that somehow... */
|
136
|
+
}
|
137
|
+
} else if (err < 0) {
|
138
|
+
error1("Failed to check state of PortAudio stream: %s", Pa_GetErrorText( err ));
|
139
|
+
return -1;
|
140
|
+
}
|
141
|
+
|
142
|
+
return written;
|
143
|
+
}
|
144
|
+
|
145
|
+
|
146
|
+
static int close_portaudio(audio_output_t *ao)
|
147
|
+
{
|
148
|
+
mpg123_portaudio_t *pa = (mpg123_portaudio_t*)ao->userptr;
|
149
|
+
PaError err;
|
150
|
+
|
151
|
+
if (pa->stream) {
|
152
|
+
/* stop the stream if it is active */
|
153
|
+
if (Pa_IsStreamActive( pa->stream ) == 1) {
|
154
|
+
err = Pa_StopStream( pa->stream );
|
155
|
+
if( err != paNoError ) {
|
156
|
+
error1("Failed to stop PortAudio stream: %s", Pa_GetErrorText( err ));
|
157
|
+
return -1;
|
158
|
+
}
|
159
|
+
}
|
160
|
+
|
161
|
+
/* and then close the stream */
|
162
|
+
err = Pa_CloseStream( pa->stream );
|
163
|
+
if( err != paNoError ) {
|
164
|
+
error1("Failed to close PortAudio stream: %s", Pa_GetErrorText( err ));
|
165
|
+
return -1;
|
166
|
+
}
|
167
|
+
|
168
|
+
pa->stream = NULL;
|
169
|
+
}
|
170
|
+
|
171
|
+
/* and free memory used by fifo */
|
172
|
+
sfifo_close( &pa->fifo );
|
173
|
+
|
174
|
+
return 0;
|
175
|
+
}
|
176
|
+
|
177
|
+
|
178
|
+
static void flush_portaudio(audio_output_t *ao)
|
179
|
+
{
|
180
|
+
mpg123_portaudio_t *pa = (mpg123_portaudio_t*)ao->userptr;
|
181
|
+
PaError err;
|
182
|
+
|
183
|
+
/* throw away contents of FIFO */
|
184
|
+
sfifo_flush( &pa->fifo );
|
185
|
+
|
186
|
+
/* and empty out PortAudio buffers */
|
187
|
+
err = Pa_AbortStream( pa->stream );
|
188
|
+
|
189
|
+
}
|
190
|
+
|
191
|
+
|
192
|
+
static int deinit_portaudio(audio_output_t* ao)
|
193
|
+
{
|
194
|
+
/* Free up memory */
|
195
|
+
if (ao->userptr) {
|
196
|
+
free( ao->userptr );
|
197
|
+
ao->userptr = NULL;
|
198
|
+
}
|
199
|
+
|
200
|
+
/* Shut down PortAudio */
|
201
|
+
Pa_Terminate();
|
202
|
+
|
203
|
+
/* Success */
|
204
|
+
return 0;
|
205
|
+
}
|
206
|
+
|
207
|
+
|
208
|
+
static int init_portaudio(audio_output_t* ao)
|
209
|
+
{
|
210
|
+
int err = paNoError;
|
211
|
+
|
212
|
+
if (ao==NULL) return -1;
|
213
|
+
|
214
|
+
/* Set callbacks */
|
215
|
+
ao->open = open_portaudio;
|
216
|
+
ao->flush = flush_portaudio;
|
217
|
+
ao->write = write_portaudio;
|
218
|
+
ao->get_formats = get_formats_portaudio;
|
219
|
+
ao->close = close_portaudio;
|
220
|
+
ao->deinit = deinit_portaudio;
|
221
|
+
|
222
|
+
/* Allocate memory for handle */
|
223
|
+
ao->userptr = malloc( sizeof(mpg123_portaudio_t) );
|
224
|
+
if (ao->userptr==NULL) {
|
225
|
+
error( "Failed to allocated memory for driver structure" );
|
226
|
+
return -1;
|
227
|
+
}
|
228
|
+
memset( ao->userptr, 0, sizeof(mpg123_portaudio_t) );
|
229
|
+
|
230
|
+
/* Initialise PortAudio */
|
231
|
+
err = Pa_Initialize();
|
232
|
+
if( err != paNoError ) {
|
233
|
+
error1("Failed to initialise PortAudio: %s", Pa_GetErrorText( err ));
|
234
|
+
return -1;
|
235
|
+
}
|
236
|
+
|
237
|
+
/* Success */
|
238
|
+
return 0;
|
239
|
+
}
|
240
|
+
|
241
|
+
|
242
|
+
|
243
|
+
/*
|
244
|
+
Module information data structure
|
245
|
+
*/
|
246
|
+
mpg123_module_t mpg123_output_module_info = {
|
247
|
+
/* api_version */ MPG123_MODULE_API_VERSION,
|
248
|
+
/* name */ "portaudio",
|
249
|
+
/* description */ "Output audio using PortAudio",
|
250
|
+
/* revision */ "$Rev:$",
|
251
|
+
/* handle */ NULL,
|
252
|
+
|
253
|
+
/* init_output */ init_portaudio,
|
254
|
+
};
|
255
|
+
|