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
data/mpg123/src/audio.c
ADDED
@@ -0,0 +1,725 @@
|
|
1
|
+
/*
|
2
|
+
audio: audio output interface
|
3
|
+
|
4
|
+
copyright ?-2008 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 <errno.h>
|
10
|
+
#include "mpg123app.h"
|
11
|
+
#include "common.h"
|
12
|
+
#include "buffer.h"
|
13
|
+
|
14
|
+
#ifdef HAVE_SYS_WAIT_H
|
15
|
+
#include <sys/wait.h>
|
16
|
+
#endif
|
17
|
+
|
18
|
+
#include "debug.h"
|
19
|
+
|
20
|
+
static int file_write(struct audio_output_struct* ao, unsigned char *bytes, int count)
|
21
|
+
{
|
22
|
+
return (int)write(ao->fn, bytes, count);
|
23
|
+
}
|
24
|
+
static int wave_write(struct audio_output_struct* ao, unsigned char *bytes, int count)
|
25
|
+
{
|
26
|
+
return wav_write(bytes, count);
|
27
|
+
}
|
28
|
+
static int builtin_get_formats(struct audio_output_struct *ao)
|
29
|
+
{
|
30
|
+
if(param.outmode == DECODE_CDR)
|
31
|
+
{
|
32
|
+
if(ao->rate == 44100 && ao->channels == 2)
|
33
|
+
return MPG123_ENC_SIGNED_16;
|
34
|
+
else
|
35
|
+
return 0;
|
36
|
+
}
|
37
|
+
else if(param.outmode == DECODE_AU) return MPG123_ENC_SIGNED_16|MPG123_ENC_UNSIGNED_8|MPG123_ENC_ULAW_8;
|
38
|
+
else if(param.outmode == DECODE_WAV) return MPG123_ENC_SIGNED_16|MPG123_ENC_UNSIGNED_8|MPG123_ENC_FLOAT_32|MPG123_ENC_SIGNED_24|MPG123_ENC_SIGNED_32;
|
39
|
+
else return MPG123_ENC_ANY;
|
40
|
+
}
|
41
|
+
static int builtin_close(struct audio_output_struct *ao)
|
42
|
+
{
|
43
|
+
switch(param.outmode)
|
44
|
+
{
|
45
|
+
case DECODE_WAV:
|
46
|
+
return wav_close();
|
47
|
+
break;
|
48
|
+
case DECODE_AU:
|
49
|
+
return au_close();
|
50
|
+
break;
|
51
|
+
case DECODE_CDR:
|
52
|
+
return cdr_close();
|
53
|
+
break;
|
54
|
+
}
|
55
|
+
return -1;
|
56
|
+
}
|
57
|
+
static int builtin_nothingint(struct audio_output_struct *ao){ return 0; }
|
58
|
+
static void builtin_nothing(struct audio_output_struct *ao){}
|
59
|
+
|
60
|
+
audio_output_t* open_fake_module(void)
|
61
|
+
{
|
62
|
+
audio_output_t *ao = NULL;
|
63
|
+
ao = alloc_audio_output();
|
64
|
+
if(ao == NULL)
|
65
|
+
{
|
66
|
+
error("Cannot allocate memory for audio output data.");
|
67
|
+
return NULL;
|
68
|
+
}
|
69
|
+
ao->module = NULL;
|
70
|
+
ao->open = builtin_nothingint;
|
71
|
+
ao->flush = builtin_nothing;
|
72
|
+
ao->get_formats = builtin_get_formats;
|
73
|
+
ao->write = wave_write;
|
74
|
+
ao->close = builtin_close;
|
75
|
+
ao->device = param.filename;
|
76
|
+
ao->is_open = FALSE;
|
77
|
+
switch(param.outmode)
|
78
|
+
{
|
79
|
+
case DECODE_FILE:
|
80
|
+
ao->fn = OutputDescriptor;
|
81
|
+
ao->write = file_write;
|
82
|
+
break;
|
83
|
+
case DECODE_WAV:
|
84
|
+
ao->open = wav_open;
|
85
|
+
break;
|
86
|
+
case DECODE_CDR:
|
87
|
+
ao->open = cdr_open;
|
88
|
+
break;
|
89
|
+
case DECODE_AU:
|
90
|
+
ao->open = au_open;
|
91
|
+
break;
|
92
|
+
case DECODE_TEST:
|
93
|
+
break;
|
94
|
+
}
|
95
|
+
|
96
|
+
return ao;
|
97
|
+
}
|
98
|
+
|
99
|
+
/* Open an audio output module, trying modules in list (comma-separated). */
|
100
|
+
audio_output_t* open_output_module( const char* names )
|
101
|
+
{
|
102
|
+
mpg123_module_t *module = NULL;
|
103
|
+
audio_output_t *ao = NULL;
|
104
|
+
int result = 0;
|
105
|
+
char *curname, *modnames;
|
106
|
+
|
107
|
+
if(param.usebuffer || names==NULL) return NULL;
|
108
|
+
|
109
|
+
/* Use internal code. */
|
110
|
+
if(param.outmode != DECODE_AUDIO) return open_fake_module();
|
111
|
+
|
112
|
+
modnames = strdup(names);
|
113
|
+
if(modnames == NULL)
|
114
|
+
{
|
115
|
+
error("Error allocating memory for module names.");
|
116
|
+
return NULL;
|
117
|
+
}
|
118
|
+
/* Now loop over the list of possible modules to find one that works. */
|
119
|
+
curname = strtok(modnames, ",");
|
120
|
+
while(curname != NULL)
|
121
|
+
{
|
122
|
+
char* name = curname;
|
123
|
+
curname = strtok(NULL, ",");
|
124
|
+
if(param.verbose > 1) fprintf(stderr, "Trying output module %s.\n", name);
|
125
|
+
/* Open the module, initial check for availability+libraries. */
|
126
|
+
module = open_module( "output", name );
|
127
|
+
if(module == NULL) continue;
|
128
|
+
/* Check if module supports output */
|
129
|
+
if(module->init_output == NULL)
|
130
|
+
{
|
131
|
+
error1("Module '%s' does not support audio output.", name);
|
132
|
+
close_module(module);
|
133
|
+
continue; /* Try next one. */
|
134
|
+
}
|
135
|
+
/* Allocation+initialization of memory for audio output type. */
|
136
|
+
ao = alloc_audio_output();
|
137
|
+
if(ao==NULL)
|
138
|
+
{
|
139
|
+
error("Failed to allocate audio output structure.");
|
140
|
+
close_module(module);
|
141
|
+
break; /* This is fatal. */
|
142
|
+
}
|
143
|
+
|
144
|
+
/* Call the init function */
|
145
|
+
ao->device = param.output_device;
|
146
|
+
ao->flags = param.output_flags;
|
147
|
+
/* Should I do funny stuff with stderr file descriptor instead? */
|
148
|
+
if(curname == NULL)
|
149
|
+
{
|
150
|
+
if(param.verbose > 1)
|
151
|
+
fprintf(stderr, "Note: %s is the last output option... showing you any error messages now.\n", name);
|
152
|
+
}
|
153
|
+
else ao->auxflags |= MPG123_OUT_QUIET; /* Probing, so don't spill stderr with errors. */
|
154
|
+
ao->is_open = FALSE;
|
155
|
+
ao->module = module; /* Need that to close module later. */
|
156
|
+
result = module->init_output(ao);
|
157
|
+
if(result == 0)
|
158
|
+
{ /* Try to open the device. I'm only interested in actually working modules. */
|
159
|
+
result = open_output(ao);
|
160
|
+
close_output(ao);
|
161
|
+
}
|
162
|
+
else error2("Module '%s' init failed: %i", name, result);
|
163
|
+
|
164
|
+
if(result!=0)
|
165
|
+
{ /* Try next one... */
|
166
|
+
close_module(module);
|
167
|
+
free(ao);
|
168
|
+
ao = NULL;
|
169
|
+
}
|
170
|
+
else
|
171
|
+
{ /* All good, leave the loop. */
|
172
|
+
if(param.verbose > 1) fprintf(stderr, "Output module '%s' chosen.\n", name);
|
173
|
+
|
174
|
+
ao->auxflags &= ~MPG123_OUT_QUIET;
|
175
|
+
break;
|
176
|
+
}
|
177
|
+
}
|
178
|
+
|
179
|
+
free(modnames);
|
180
|
+
if(ao==NULL) error1("Unable to find a working output module in this list: %s", names);
|
181
|
+
|
182
|
+
return ao;
|
183
|
+
}
|
184
|
+
|
185
|
+
|
186
|
+
|
187
|
+
/* Close the audio output and close the module */
|
188
|
+
void close_output_module( audio_output_t* ao )
|
189
|
+
{
|
190
|
+
if (!ao) return; /* That covers buffer mode, too (ao == NULL there). */
|
191
|
+
|
192
|
+
debug("closing output module");
|
193
|
+
/* Close the audio output */
|
194
|
+
if(ao->is_open && ao->close != NULL) ao->close(ao);
|
195
|
+
|
196
|
+
/* Deinitialise the audio output */
|
197
|
+
if (ao->deinit) ao->deinit( ao );
|
198
|
+
|
199
|
+
/* Unload the module */
|
200
|
+
if (ao->module) close_module( ao->module );
|
201
|
+
|
202
|
+
/* Free up memory */
|
203
|
+
free( ao );
|
204
|
+
}
|
205
|
+
|
206
|
+
|
207
|
+
|
208
|
+
/* allocate and initialise memory */
|
209
|
+
audio_output_t* alloc_audio_output()
|
210
|
+
{
|
211
|
+
audio_output_t* ao = malloc( sizeof( audio_output_t ) );
|
212
|
+
if (ao==NULL) error( "Failed to allocate memory for audio_output_t." );
|
213
|
+
|
214
|
+
/* Initialise variables */
|
215
|
+
ao->fn = -1;
|
216
|
+
ao->rate = -1;
|
217
|
+
ao->gain = param.gain;
|
218
|
+
ao->userptr = NULL;
|
219
|
+
ao->device = NULL;
|
220
|
+
ao->channels = -1;
|
221
|
+
ao->format = -1;
|
222
|
+
ao->flags = 0;
|
223
|
+
ao->auxflags = 0;
|
224
|
+
|
225
|
+
/*ao->module = NULL;*/
|
226
|
+
|
227
|
+
/* Set the callbacks to NULL */
|
228
|
+
ao->open = NULL;
|
229
|
+
ao->get_formats = NULL;
|
230
|
+
ao->write = NULL;
|
231
|
+
ao->flush = NULL;
|
232
|
+
ao->close = NULL;
|
233
|
+
ao->deinit = NULL;
|
234
|
+
|
235
|
+
return ao;
|
236
|
+
}
|
237
|
+
|
238
|
+
/*
|
239
|
+
static void audio_output_dump(audio_output_t *ao)
|
240
|
+
{
|
241
|
+
fprintf(stderr, "ao->fn=%d\n", ao->fn);
|
242
|
+
fprintf(stderr, "ao->userptr=%p\n", ao->userptr);
|
243
|
+
fprintf(stderr, "ao->rate=%ld\n", ao->rate);
|
244
|
+
fprintf(stderr, "ao->gain=%ld\n", ao->gain);
|
245
|
+
fprintf(stderr, "ao->device='%s'\n", ao->device);
|
246
|
+
fprintf(stderr, "ao->channels=%d\n", ao->channels);
|
247
|
+
fprintf(stderr, "ao->format=%d\n", ao->format);
|
248
|
+
}
|
249
|
+
*/
|
250
|
+
|
251
|
+
struct enc_desc
|
252
|
+
{
|
253
|
+
int code; /* MPG123_ENC_SOMETHING */
|
254
|
+
const char *longname; /* signed bla bla */
|
255
|
+
const char *name; /* sXX, short name */
|
256
|
+
const unsigned char nlen; /* significant characters in short name */
|
257
|
+
};
|
258
|
+
|
259
|
+
static const struct enc_desc encdesc[] =
|
260
|
+
{
|
261
|
+
{ MPG123_ENC_SIGNED_16, "signed 16 bit", "s16 ", 3 },
|
262
|
+
{ MPG123_ENC_UNSIGNED_16, "unsigned 16 bit", "u16 ", 3 },
|
263
|
+
{ MPG123_ENC_UNSIGNED_8, "unsigned 8 bit", "u8 ", 2 },
|
264
|
+
{ MPG123_ENC_SIGNED_8, "signed 8 bit", "s8 ", 2 },
|
265
|
+
{ MPG123_ENC_ULAW_8, "mu-law (8 bit)", "ulaw ", 4 },
|
266
|
+
{ MPG123_ENC_ALAW_8, "a-law (8 bit)", "alaw ", 4 },
|
267
|
+
{ MPG123_ENC_FLOAT_32, "float (32 bit)", "f32 ", 3 },
|
268
|
+
{ MPG123_ENC_SIGNED_32, "signed 32 bit", "s32 ", 3 },
|
269
|
+
{ MPG123_ENC_UNSIGNED_32, "unsigned 32 bit", "u32 ", 3 },
|
270
|
+
{ MPG123_ENC_SIGNED_24, "signed 24 bit", "s24 ", 3 },
|
271
|
+
{ MPG123_ENC_UNSIGNED_24, "unsigned 24 bit", "u24 ", 3 }
|
272
|
+
};
|
273
|
+
#define KNOWN_ENCS (sizeof(encdesc)/sizeof(struct enc_desc))
|
274
|
+
|
275
|
+
void audio_enclist(char** list)
|
276
|
+
{
|
277
|
+
size_t length = 0;
|
278
|
+
int i;
|
279
|
+
*list = NULL;
|
280
|
+
for(i=0;i<KNOWN_ENCS;++i) length += encdesc[i].nlen;
|
281
|
+
|
282
|
+
length += KNOWN_ENCS-1; /* spaces between the encodings */
|
283
|
+
*list = malloc(length+1); /* plus zero */
|
284
|
+
if(*list != NULL)
|
285
|
+
{
|
286
|
+
size_t off = 0;
|
287
|
+
(*list)[length] = 0;
|
288
|
+
for(i=0;i<KNOWN_ENCS;++i)
|
289
|
+
{
|
290
|
+
if(i>0) (*list)[off++] = ' ';
|
291
|
+
memcpy(*list+off, encdesc[i].name, encdesc[i].nlen);
|
292
|
+
off += encdesc[i].nlen;
|
293
|
+
}
|
294
|
+
}
|
295
|
+
}
|
296
|
+
|
297
|
+
/* Safer as function... */
|
298
|
+
const char* audio_encoding_name(const int encoding, const int longer)
|
299
|
+
{
|
300
|
+
const char *name = longer ? "unknown" : "???";
|
301
|
+
int i;
|
302
|
+
for(i=0;i<KNOWN_ENCS;++i)
|
303
|
+
if(encdesc[i].code == encoding)
|
304
|
+
name = longer ? encdesc[i].longname : encdesc[i].name;
|
305
|
+
|
306
|
+
return name;
|
307
|
+
}
|
308
|
+
|
309
|
+
static void capline(mpg123_handle *mh, long rate)
|
310
|
+
{
|
311
|
+
int enci;
|
312
|
+
const int *encs;
|
313
|
+
size_t num_encs;
|
314
|
+
mpg123_encodings(&encs, &num_encs);
|
315
|
+
fprintf(stderr," %5ld |", pitch_rate(rate));
|
316
|
+
for(enci=0; enci<num_encs; ++enci)
|
317
|
+
{
|
318
|
+
switch(mpg123_format_support(mh, rate, encs[enci]))
|
319
|
+
{
|
320
|
+
case MPG123_MONO: fprintf(stderr, " M |"); break;
|
321
|
+
case MPG123_STEREO: fprintf(stderr, " S |"); break;
|
322
|
+
case MPG123_MONO|MPG123_STEREO: fprintf(stderr, " M/S |"); break;
|
323
|
+
default: fprintf(stderr, " |");
|
324
|
+
}
|
325
|
+
}
|
326
|
+
fprintf(stderr, "\n");
|
327
|
+
}
|
328
|
+
|
329
|
+
void print_capabilities(audio_output_t *ao, mpg123_handle *mh)
|
330
|
+
{
|
331
|
+
int r,e;
|
332
|
+
const long *rates;
|
333
|
+
size_t num_rates;
|
334
|
+
const int *encs;
|
335
|
+
size_t num_encs;
|
336
|
+
const char *name = "<buffer>";
|
337
|
+
const char *dev = "<none>";
|
338
|
+
if(!param.usebuffer)
|
339
|
+
{
|
340
|
+
name = ao->module ? ao->module->name : "file/raw/test";
|
341
|
+
if(ao->device != NULL) dev = ao->device;
|
342
|
+
}
|
343
|
+
mpg123_rates(&rates, &num_rates);
|
344
|
+
mpg123_encodings(&encs, &num_encs);
|
345
|
+
fprintf(stderr,"\nAudio driver: %s\nAudio device: %s\nAudio capabilities:\n(matrix of [S]tereo or [M]ono support for sample format and rate in Hz)\n |", name, dev);
|
346
|
+
for(e=0;e<num_encs;e++) fprintf(stderr," %5s |",audio_encoding_name(encs[e], 0));
|
347
|
+
|
348
|
+
fprintf(stderr,"\n ------|");
|
349
|
+
for(e=0;e<num_encs;e++) fprintf(stderr,"-------|");
|
350
|
+
|
351
|
+
fprintf(stderr, "\n");
|
352
|
+
for(r=0; r<num_rates; ++r) capline(mh, rates[r]);
|
353
|
+
|
354
|
+
if(param.force_rate) capline(mh, param.force_rate);
|
355
|
+
|
356
|
+
fprintf(stderr,"\n");
|
357
|
+
}
|
358
|
+
|
359
|
+
/* This uses the currently opened audio device, queries its caps.
|
360
|
+
In case of buffered playback, this works _once_ by querying the buffer for the caps before entering the main loop. */
|
361
|
+
void audio_capabilities(audio_output_t *ao, mpg123_handle *mh)
|
362
|
+
{
|
363
|
+
int force_fmt = 0;
|
364
|
+
int fmts;
|
365
|
+
size_t ri;
|
366
|
+
/* Pitching introduces a difference between decoder rate and playback rate. */
|
367
|
+
long rate, decode_rate;
|
368
|
+
int channels;
|
369
|
+
const long *rates;
|
370
|
+
size_t num_rates, rlimit;
|
371
|
+
debug("audio_capabilities");
|
372
|
+
mpg123_rates(&rates, &num_rates);
|
373
|
+
mpg123_format_none(mh); /* Start with nothing. */
|
374
|
+
if(param.force_encoding != NULL)
|
375
|
+
{
|
376
|
+
int i;
|
377
|
+
if(!param.quiet) fprintf(stderr, "Note: forcing output encoding %s\n", param.force_encoding);
|
378
|
+
|
379
|
+
for(i=0;i<KNOWN_ENCS;++i)
|
380
|
+
if(!strncasecmp(encdesc[i].name, param.force_encoding, encdesc[i].nlen))
|
381
|
+
{
|
382
|
+
force_fmt = encdesc[i].code;
|
383
|
+
break;
|
384
|
+
}
|
385
|
+
|
386
|
+
if(i==KNOWN_ENCS)
|
387
|
+
{
|
388
|
+
error1("Failed to find an encoding to match requested \"%s\"!\n", param.force_encoding);
|
389
|
+
return; /* No capabilities at all... */
|
390
|
+
}
|
391
|
+
else if(param.verbose > 2) fprintf(stderr, "Note: forcing encoding code 0x%x\n", force_fmt);
|
392
|
+
}
|
393
|
+
rlimit = param.force_rate > 0 ? num_rates+1 : num_rates;
|
394
|
+
for(channels=1; channels<=2; channels++)
|
395
|
+
for(ri = 0;ri<rlimit;ri++)
|
396
|
+
{
|
397
|
+
decode_rate = ri < num_rates ? rates[ri] : param.force_rate;
|
398
|
+
rate = pitch_rate(decode_rate);
|
399
|
+
if(param.verbose > 2) fprintf(stderr, "Note: checking support for %liHz/%ich.\n", rate, channels);
|
400
|
+
#ifndef NOXFERMEM
|
401
|
+
if(param.usebuffer)
|
402
|
+
{ /* Ask the buffer process. It is waiting for this. */
|
403
|
+
buffermem->rate = rate;
|
404
|
+
buffermem->channels = channels;
|
405
|
+
buffermem->format = 0; /* Just have it initialized safely. */
|
406
|
+
debug2("asking for formats for %liHz/%ich", rate, channels);
|
407
|
+
xfermem_putcmd(buffermem->fd[XF_WRITER], XF_CMD_AUDIOCAP);
|
408
|
+
xfermem_getcmd(buffermem->fd[XF_WRITER], TRUE);
|
409
|
+
fmts = buffermem->format;
|
410
|
+
}
|
411
|
+
else
|
412
|
+
#endif
|
413
|
+
{ /* Check myself. */
|
414
|
+
ao->rate = rate;
|
415
|
+
ao->channels = channels;
|
416
|
+
fmts = ao->get_formats(ao);
|
417
|
+
}
|
418
|
+
if(param.verbose > 2) fprintf(stderr, "Note: result 0x%x\n", fmts);
|
419
|
+
if(force_fmt)
|
420
|
+
{ /* Filter for forced encoding. */
|
421
|
+
if((fmts & force_fmt) == force_fmt) fmts = force_fmt;
|
422
|
+
else fmts = 0; /* Nothing else! */
|
423
|
+
|
424
|
+
if(param.verbose > 2) fprintf(stderr, "Note: after forcing 0x%x\n", fmts);
|
425
|
+
}
|
426
|
+
|
427
|
+
if(fmts < 0) continue;
|
428
|
+
else mpg123_format(mh, decode_rate, channels, fmts);
|
429
|
+
}
|
430
|
+
|
431
|
+
#ifndef NOXFERMEM
|
432
|
+
/* Buffer loop shall start normal operation now. */
|
433
|
+
if(param.usebuffer)
|
434
|
+
{
|
435
|
+
xfermem_putcmd(buffermem->fd[XF_WRITER], XF_CMD_WAKEUP);
|
436
|
+
xfermem_getcmd(buffermem->fd[XF_WRITER], TRUE);
|
437
|
+
}
|
438
|
+
#endif
|
439
|
+
|
440
|
+
if(param.verbose > 1) print_capabilities(ao, mh);
|
441
|
+
}
|
442
|
+
|
443
|
+
#if !defined(WIN32) && !defined(GENERIC)
|
444
|
+
#ifndef NOXFERMEM
|
445
|
+
static void catch_child(void)
|
446
|
+
{
|
447
|
+
while (waitpid(-1, NULL, WNOHANG) > 0);
|
448
|
+
}
|
449
|
+
#endif
|
450
|
+
#endif
|
451
|
+
|
452
|
+
|
453
|
+
/* FIXME: Old output initialization code that needs updating */
|
454
|
+
|
455
|
+
int init_output(audio_output_t **ao)
|
456
|
+
{
|
457
|
+
static int init_done = FALSE;
|
458
|
+
|
459
|
+
if (init_done) return 1;
|
460
|
+
init_done = TRUE;
|
461
|
+
|
462
|
+
#ifndef NOXFERMEM
|
463
|
+
if (param.usebuffer)
|
464
|
+
{
|
465
|
+
unsigned int bufferbytes;
|
466
|
+
sigset_t newsigset, oldsigset;
|
467
|
+
bufferbytes = (param.usebuffer * 1024);
|
468
|
+
if (bufferbytes < bufferblock)
|
469
|
+
{
|
470
|
+
bufferbytes = 2*bufferblock;
|
471
|
+
if(!param.quiet) fprintf(stderr, "Note: raising buffer to minimal size %liKiB\n", (unsigned long) bufferbytes>>10);
|
472
|
+
}
|
473
|
+
bufferbytes -= bufferbytes % bufferblock;
|
474
|
+
/* No +1024 for NtoM rounding problems anymore! */
|
475
|
+
xfermem_init (&buffermem, bufferbytes ,0,0);
|
476
|
+
sigemptyset (&newsigset);
|
477
|
+
/* ThOr: I'm not quite sure why we need to block that signal here. */
|
478
|
+
sigaddset (&newsigset, SIGUSR1);
|
479
|
+
sigprocmask (SIG_BLOCK, &newsigset, &oldsigset);
|
480
|
+
#if !defined(WIN32) && !defined(GENERIC)
|
481
|
+
catchsignal (SIGCHLD, catch_child);
|
482
|
+
#endif
|
483
|
+
switch ((buffer_pid = fork()))
|
484
|
+
{
|
485
|
+
case -1: /* error */
|
486
|
+
error("cannot fork!");
|
487
|
+
return -1;
|
488
|
+
case 0: /* child */
|
489
|
+
{
|
490
|
+
/* Buffer process handles all audio stuff itself. */
|
491
|
+
audio_output_t *bao = NULL; /* To be clear: That's the buffer's pointer. */
|
492
|
+
param.usebuffer = 0; /* The buffer doesn't use the buffer. */
|
493
|
+
/* Open audio output module */
|
494
|
+
bao = open_output_module(param.output_module);
|
495
|
+
if(!bao)
|
496
|
+
{
|
497
|
+
error("Failed to open audio output module.");
|
498
|
+
exit(1); /* communicate failure? */
|
499
|
+
}
|
500
|
+
if(open_output(bao) < 0)
|
501
|
+
{
|
502
|
+
error("Unable to open audio output.");
|
503
|
+
close_output_module(bao);
|
504
|
+
exit(2);
|
505
|
+
}
|
506
|
+
xfermem_init_reader (buffermem);
|
507
|
+
buffer_loop(bao, &oldsigset); /* Here the work happens. */
|
508
|
+
xfermem_done_reader (buffermem);
|
509
|
+
xfermem_done (buffermem);
|
510
|
+
close_output(bao);
|
511
|
+
close_output_module(bao);
|
512
|
+
exit(0);
|
513
|
+
}
|
514
|
+
default: /* parent */
|
515
|
+
xfermem_init_writer (buffermem);
|
516
|
+
}
|
517
|
+
/* ThOr: I want that USR1 signal back for control. */
|
518
|
+
sigprocmask(SIG_UNBLOCK, &newsigset, NULL);
|
519
|
+
}
|
520
|
+
#else
|
521
|
+
if(param.usebuffer)
|
522
|
+
{
|
523
|
+
error("Buffer not available in this build!");
|
524
|
+
return -1;
|
525
|
+
}
|
526
|
+
#endif
|
527
|
+
if(!param.usebuffer)
|
528
|
+
{ /* Only if I handle audio device output: Get that module. */
|
529
|
+
*ao = open_output_module(param.output_module);
|
530
|
+
if(!(*ao))
|
531
|
+
{
|
532
|
+
error("Failed to open audio output module");
|
533
|
+
return -1;
|
534
|
+
}
|
535
|
+
}
|
536
|
+
else *ao = NULL; /* That ensures we won't try to free it later... */
|
537
|
+
#ifndef NOXFERMEM
|
538
|
+
if(param.usebuffer)
|
539
|
+
{ /* Check if buffer is alive. */
|
540
|
+
int res = xfermem_getcmd(buffermem->fd[XF_WRITER], TRUE);
|
541
|
+
if(res < 0)
|
542
|
+
{
|
543
|
+
error("Buffer process didn't initialize!");
|
544
|
+
return -1;
|
545
|
+
}
|
546
|
+
}
|
547
|
+
#endif
|
548
|
+
/* This has internal protection for buffer mode. */
|
549
|
+
if(open_output(*ao) < 0) return -1;
|
550
|
+
|
551
|
+
return 0;
|
552
|
+
}
|
553
|
+
|
554
|
+
void exit_output(audio_output_t *ao, int rude)
|
555
|
+
{
|
556
|
+
debug("exit output");
|
557
|
+
#ifndef NOXFERMEM
|
558
|
+
if (param.usebuffer)
|
559
|
+
{
|
560
|
+
debug("ending buffer");
|
561
|
+
buffer_stop(); /* Puts buffer into waiting-for-command mode. */
|
562
|
+
buffer_end(rude); /* Gives command to end operation. */
|
563
|
+
xfermem_done_writer(buffermem);
|
564
|
+
waitpid (buffer_pid, NULL, 0);
|
565
|
+
xfermem_done (buffermem);
|
566
|
+
}
|
567
|
+
#endif
|
568
|
+
/* Close the output... doesn't matter if buffer handled it, that's taken care of. */
|
569
|
+
close_output(ao);
|
570
|
+
close_output_module(ao);
|
571
|
+
}
|
572
|
+
|
573
|
+
void output_pause(audio_output_t *ao)
|
574
|
+
{
|
575
|
+
if(param.usebuffer) buffer_stop();
|
576
|
+
else ao->flush(ao);
|
577
|
+
}
|
578
|
+
|
579
|
+
void output_unpause(audio_output_t *ao)
|
580
|
+
{
|
581
|
+
if(param.usebuffer) buffer_start();
|
582
|
+
}
|
583
|
+
|
584
|
+
int flush_output(audio_output_t *ao, unsigned char *bytes, size_t count)
|
585
|
+
{
|
586
|
+
if(count)
|
587
|
+
{
|
588
|
+
/* Error checks? */
|
589
|
+
#ifndef NOXFERMEM
|
590
|
+
if(param.usebuffer){ if(xfermem_write(buffermem, bytes, count)) return -1; }
|
591
|
+
else
|
592
|
+
#endif
|
593
|
+
if(param.outmode != DECODE_TEST)
|
594
|
+
{
|
595
|
+
int sum = 0;
|
596
|
+
int written;
|
597
|
+
do
|
598
|
+
{ /* Be in a loop for SIGSTOP/CONT */
|
599
|
+
written = ao->write(ao, bytes, (int)count);
|
600
|
+
if(written >= 0){ sum+=written; count -= written; }
|
601
|
+
else error1("Error in writing audio (%s?)!", strerror(errno));
|
602
|
+
} while(count>0 && written>=0);
|
603
|
+
return sum;
|
604
|
+
}
|
605
|
+
}
|
606
|
+
return (int)count; /* That is for DECODE_TEST */
|
607
|
+
}
|
608
|
+
|
609
|
+
int open_output(audio_output_t *ao)
|
610
|
+
{
|
611
|
+
if(param.usebuffer) return 0;
|
612
|
+
|
613
|
+
if(ao == NULL)
|
614
|
+
{
|
615
|
+
error("ao should not be NULL here!");
|
616
|
+
exit(110);
|
617
|
+
}
|
618
|
+
|
619
|
+
switch(param.outmode)
|
620
|
+
{
|
621
|
+
case DECODE_AUDIO:
|
622
|
+
case DECODE_WAV:
|
623
|
+
case DECODE_AU:
|
624
|
+
case DECODE_CDR:
|
625
|
+
case DECODE_FILE:
|
626
|
+
debug("opening normal audio/file");
|
627
|
+
ao->is_open = ao->open(ao) < 0 ? FALSE : TRUE;
|
628
|
+
if(!ao->is_open)
|
629
|
+
{
|
630
|
+
if(!AOQUIET) error("failed to open audio device");
|
631
|
+
return -1;
|
632
|
+
}
|
633
|
+
else return 0;
|
634
|
+
break;
|
635
|
+
case DECODE_TEST:
|
636
|
+
debug("decoding to nowhere");
|
637
|
+
return 0;
|
638
|
+
break;
|
639
|
+
}
|
640
|
+
debug("nothing");
|
641
|
+
return -1; /* That's an error ... unknown outmode? */
|
642
|
+
}
|
643
|
+
|
644
|
+
/* is this used? */
|
645
|
+
void close_output(audio_output_t *ao)
|
646
|
+
{
|
647
|
+
if(param.usebuffer) return;
|
648
|
+
|
649
|
+
debug("closing output");
|
650
|
+
switch(param.outmode)
|
651
|
+
{
|
652
|
+
case DECODE_AUDIO:
|
653
|
+
case DECODE_WAV:
|
654
|
+
case DECODE_AU:
|
655
|
+
case DECODE_CDR:
|
656
|
+
/* Guard that close call; could be nasty. */
|
657
|
+
if(ao->is_open)
|
658
|
+
{
|
659
|
+
ao->is_open = FALSE;
|
660
|
+
if(ao->close != NULL) ao->close(ao);
|
661
|
+
}
|
662
|
+
break;
|
663
|
+
}
|
664
|
+
}
|
665
|
+
|
666
|
+
/* Also for WAV decoding? */
|
667
|
+
int reset_output(audio_output_t *ao)
|
668
|
+
{
|
669
|
+
if(!param.usebuffer)
|
670
|
+
{
|
671
|
+
close_output(ao);
|
672
|
+
return open_output(ao);
|
673
|
+
}
|
674
|
+
else return 0;
|
675
|
+
}
|
676
|
+
|
677
|
+
int set_pitch(mpg123_handle *fr, audio_output_t *ao, double new_pitch)
|
678
|
+
{
|
679
|
+
int ret = 1;
|
680
|
+
double old_pitch = param.pitch;
|
681
|
+
long rate;
|
682
|
+
int channels, format;
|
683
|
+
int smode = 0;
|
684
|
+
|
685
|
+
/* Be safe, check support. */
|
686
|
+
if(mpg123_getformat(fr, &rate, &channels, &format) != MPG123_OK)
|
687
|
+
{
|
688
|
+
/* We might just not have a track handy. */
|
689
|
+
error("There is no current audio format, cannot apply pitch. This might get fixed in future.");
|
690
|
+
return 0;
|
691
|
+
}
|
692
|
+
|
693
|
+
if(param.usebuffer)
|
694
|
+
{
|
695
|
+
error("No runtime pitch change with output buffer, sorry.");
|
696
|
+
return 0;
|
697
|
+
}
|
698
|
+
|
699
|
+
param.pitch = new_pitch;
|
700
|
+
if(param.pitch < -0.99) param.pitch = -0.99;
|
701
|
+
|
702
|
+
if(channels == 1) smode = MPG123_MONO;
|
703
|
+
if(channels == 2) smode = MPG123_STEREO;
|
704
|
+
|
705
|
+
output_pause(ao);
|
706
|
+
/* Remember: This takes param.pitch into account. */
|
707
|
+
audio_capabilities(ao, fr);
|
708
|
+
if(!(mpg123_format_support(fr, rate, format) & smode))
|
709
|
+
{
|
710
|
+
/* Note: When using --pitch command line parameter, you can go higher
|
711
|
+
because a lower decoder sample rate is automagically chosen.
|
712
|
+
Here, we'd need to switch decoder rate during track... good? */
|
713
|
+
error("Reached a hardware limit there with pitch!");
|
714
|
+
param.pitch = old_pitch;
|
715
|
+
audio_capabilities(ao, fr);
|
716
|
+
ret = 0;
|
717
|
+
}
|
718
|
+
ao->format = format;
|
719
|
+
ao->channels = channels;
|
720
|
+
ao->rate = pitch_rate(rate);
|
721
|
+
reset_output(ao);
|
722
|
+
output_unpause(ao);
|
723
|
+
return ret;
|
724
|
+
}
|
725
|
+
|