libtritonus-java-20070428/0000755000175000017500000000000010621573070015216 5ustar twernertwernerlibtritonus-java-20070428/doc/0000755000175000017500000000000010621572313015762 5ustar twernertwernerlibtritonus-java-20070428/doc/bindists/0000755000175000017500000000000010621572324017603 5ustar twernertwernerlibtritonus-java-20070428/doc/bindists/alsa/0000755000175000017500000000000010621572313020521 5ustar twernertwernerlibtritonus-java-20070428/doc/bindists/alsa/readme.txt0000644000175000017500000000032207553220253022517 0ustar twernertwernerreadme.txt ---------- Preliminary install instructions: - copy *.jar to .../jre/lib/ext/ - copy libtritonusalsa.so* to.../jre/lib/ext/i386/ - copy libtritonuscommon.so* to /usr/lib/ (or maybe /usr/local/lib/) libtritonus-java-20070428/doc/bindists/cdda/0000755000175000017500000000000010621572317020500 5ustar twernertwernerlibtritonus-java-20070428/doc/bindists/cdda/readme.txt0000644000175000017500000000702607754651773022524 0ustar twernertwernerCDDA support for Java Sound =========================== Version: 2002-03-30 Overview -------- This package contains a plug-in for the Java 2 platform, which enables you to read/rip/grab/digitally extract the audio data from audio CDs (CDDA -> Compact Disc Digital Audio). Included are compiled libraries for Linux/i386. All files are part of Tritonus, an open source implementation of the Java Sound API. Tritonus is under the GNU Library General Public License. The source code of the plug-in is contained in the tritonus distribution. Features -------- The plugin enables you to digitally read audio CDs. This is very useful when you want to archive CD's in highest quality. Requirements ------------ - A Java 2 platform. It should work with JDK1.2.x (then you need a full installation of tritonus), but Version 1.3 or higher is recommended. You can download a JDK or JRE from http://java.sun.com . This documentation assumes a Sun JDK1.4 installation. - The library tritonus_share.jar. You can download it from http://www.tritonus.org/plugins.html or compile tritonus. - On Linux/i386: The plugin needs the shared libraries of cdparanoia III version 9.8, which you can download from http://www.xiph.org/paranoia/ cdparanoia is included in most modern Linux distributions as a package. Installation of the cdda plugin on Linux/i386 --------------------------------------------- 1. Copy tritonus_cdda.jar, and tritonus_share.jar in the Extension Directory (see below). 2. Copy libtritonuscdparanoia.so in the Binary Extension Directory. 3. If necessary, install cdparanoia . It may be necessary (as root) to include /usr/local/lib to /etc/ld.so.conf and then run "ldconfig". Linux directories ----------------- You can find out the installation directory of the JDK by issuing "which java". I get the follwing result: /usr/local/java2/bin/java which means that JDK home is /usr/local/java2. The existence of the "jre" directory in JDK home usually means that you have installed the JDK (rather than JRE). Extension Directory: For JDK: jre/lib/ext in JDK home, e.g. /usr/local/java2/jre/lib/ext For JRE: lib/ext in JRE home, e.g. /usr/local/jre1.3.0_02/lib/ext Alternatively, you may also place the jars in the classpath. Then you can place them where ever you want: export CLASSPATH=tritonus_share.jar:tritonus_mp3.jar:$CLASSPATH Binary Extension Directory: For JDK: jre/lib/i386 in JDK home, e.g. ls /usr/local/java2/jre/lib/i386 For JRE: bin in JRE home, e.g. ls /usr/local/jre1.3.0_02/lib/i386 Test ---- At the moment, no real documentation exists, except the talk that Matthias and I gave at the JavaOne 2002 conference. The session slides and the demo program can be downloaded from http://www.jsresources.org/apps/ripper/ Contact ------- When you encounter problems or want to tell me that it works, feel free to contact me at florian@tritonus.org. You can also subscribe to a Tritonus mailing list at http://lists.sourceforge.net/lists/listinfo/tritonus-user and write your email to the list. Download -------- The latest version of this plug-in can be downloaded from http://www.tritonus.org in the plugins section. Copyright --------- This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. The GNU Library General Public License is included in the file "LGPL". (c) 2002 by Matthias Pfisterer and Florian Bomers libtritonus-java-20070428/doc/bindists/esd/0000755000175000017500000000000010621572322020354 5ustar twernertwernerlibtritonus-java-20070428/doc/bindists/esd/readme.txt0000644000175000017500000000032107553220253022351 0ustar twernertwernerreadme.txt ---------- Preliminary install instructions: - copy *.jar to .../jre/lib/ext/ - copy libtritonusesd.so* to.../jre/lib/ext/i386/ - copy libtritonuscommon.so* to /usr/lib/ (or maybe /usr/local/lib/) libtritonus-java-20070428/doc/bindists/vorbis/0000755000175000017500000000000010621572324021107 5ustar twernertwernerlibtritonus-java-20070428/doc/bindists/vorbis/readme.txt0000644000175000017500000000040210163751055023102 0ustar twernertwernerreadme.txt ---------- Preliminary install instructions: - copy *.jar to .../jre/lib/ext/ - copy libtritonusvorbis.so* to .../jre/lib/ext/i386/ Test with AudioEncoder from jsresources.org: java AudioEncoder -e VORBIS -t Vorbis -T ogg inputfile outputfile libtritonus-java-20070428/doc/.cvsignore0000644000175000017500000000002007472111442017754 0ustar twernertwernerMakefile apidoc libtritonus-java-20070428/doc/ALSA_ports.txt0000644000175000017500000000142207533232031020467 0ustar twernertwernerThis file describes the mapping of ALSA mixer element's properties to sets of Controls of the Port line that abstracts the mixer element. L/R channels (mono false) common volume false (playback) vol true (not joined) common switch false (pb) switch true (joined) Example: Master --> boolean MUTE float VOLUME (or MASTER_GAIN) float BALANCE (or PAN) -- alternative: boolean MUTE compound [ float VOLUME (left) float VOLUME (right) // can order be guaranteed? ] ------------------------------------------------------- pb channels: L (mono true) common vol false pb vol true (joined) common switch: false playback switch: true (joined) Example: Master Mono --> float VOLUME boolean MUTE ------------------------------------------------------ pb channels: L/R (mono false) Example: Tone libtritonus-java-20070428/doc/AlsaMidiDevice0000644000175000017500000001040407305136156020515 0ustar twernertwerner][s6} ą P5dnfMZBn)%)%9-QDә4 ~ǿ&ٝ(M^S(ə]O/??&<,Ҍєavgggn0|mjXYt=-YN̋pMN|b(._qbG65m'i%ŗۥ%fbUn%7/{% {DID2̄A0S؞kkkQ~ufEF24MN'ʺwE /5,VT9rq]GױY飤hm/ o=O7|ӏTib{KOӌD~1b>3^\oBz_3*/g~m'cE#÷8E#R؆T^̤%xWhɬ>[}mf/rR"Hsz|Bv'T}ba:.^bU'wdrG&)*t5J/|A(F-Ҳ}E˯>*&NVh ۓYjj*ɭT%|~ܼI:)p~7-b ??&3j$ (_%>C+̌5WPRA~& 0_%E8/65SXn[h+#3+ͯBb\zee~\f.Lo_d}}-nSnùVxW8:J(WFb¸kTD{J$$$$0qؐ""ƾ d@=UA=`7J>{a[`'o\|6F@l#`mtcצ =S@bPiJLn@yF R9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h0W`۪{[ bY!?!i!wBGrM P  `B-1ޟh.A"͞QK8O #:Dɫ'Cs phVJ"V.vq%pA#NSDKWE>NbaQv ,}؂*kbXq[6(|4^ .i kk~zM߮ܧ;<Y+xLd.MOmi>)m<}&J2F38]4UqZ>F_y1;XUoǝ #j2|Ii+AaM#HzS G$~a} _¾CJ@TVοRmr.J| H0s@: JYUaA Kiӌ6mٔ8 f鎇}0NFD0AX`Ʊsѿ IL=dvevJ~vjyÌv);e㩙0C̞-,7c'.0J6d*f0vAVz';v "1$ul:(I7KLq-VJF@q=e .aV](XZ1=騄֔V0bC rf[(.;J&S;FL{Ɉ>W5HV(#Ԛb/9~YePwn\"kpSOM-p(g.!:XvHs~R-m_̖aԓmC؜>|a):#]gn3ج:caf"snי"OȌl1gtw絑qYe~ vD9:t_YBα&56PdζNSQ~WT} }$%:O3 5]eR9oT.| e (+ 90@TK#H;UTP@UTcF.FJWOr2 3#槥W0ul:2Zξ 5"KwLw2 C |`usițGAef@Hɺ+@e [za<^Iݽ^Z CzniI#V&:w \Xȅ=ye'ȄX*UZ d($H9' `!Yd?~ A&}MJGȱ}D{xsZf޷߅'Q8+kdwA) Y+xRW>.1y*Kd]jPK}'I0Nlibtritonus-java-20070428/doc/Makefile.in0000644000175000017500000000310707417512472020041 0ustar twernertwerner # compilation and packing for the sinfonia library # LIBNAME=tritonus JAVAC=javac # JAVAC=guavac %.class: %.java $(JAVAC) -d $(DESTDIR) $< SRCDIR=src/javax/media/sound SRCDIR2=src/org/gnu/$(LIBNAME) DESTDIR=. OBJDIR=$(DESTDIR)/javax/media/sound OBJDIR2=$(DESTDIR)/org/gnu/$(LIBNAME) PACKSRCDIR=javax/media/sound org/gnu/$(LIBNAME) LIBDEST=$(LIBNAME).jar vpath %.class $(OBJDIR)/midi vpath %.class $(OBJDIR)/midi/spi vpath %.class $(OBJDIR)/sampled vpath %.class $(OBJDIR)/sampled/spi vpath %.class $(OBJDIR2) vpath %.class $(OBJDIR2)/nas vpath %.java $(SRCDIR)/midi vpath %.java $(SRCDIR)/midi/spi vpath %.java $(SRCDIR)/sampled vpath %.java $(SRCDIR)/sampled/spi vpath %.java $(SRCDIR2) vpath %.java $(SRCDIR2)/nas SRCTMP:=$(wildcard \ $(SRCDIR)/midi/*.java \ $(SRCDIR)/midi/spi/*.java \ $(SRCDIR)/sampled/*.java \ $(SRCDIR)/sampled/spi/*.java \ $(SRCDIR2)/*.java \ $(SRCDIR2)/nas/*.java \ ) SRC:=$(notdir $(SRCTMP)) OBJ:=$(SRC:.java=.class) # !!! TODO: use ant for apidoc? !!! # documentation generation DOCDESTDIR=./apidoc DOCSRCPATH=./src PACKAGES=javax.media.sound.midi \ javax.media.sound.midi.spi \ javax.media.sound.sampled \ javax.media.sound.sampled.spi \ org.gnu.$(LIBNAME) # compilation for the mvp tests TESTSRCDIR=src/mvptest TESTDESTDIR=. TESTSRC:=$(wildcard $(TESTSRCDIR)/*.java) #----------------- rules ------------------- .PHONY: all all: apidoc .PHONY: apidoc apidoc: $(SRC) -mkdir $(DOCDESTDIR) javadoc -author -splitindex -windowtitle "Sinfonia Documentation" -d $(DOCDESTDIR) -sourcepath $(DOCSRCPATH) $(PACKAGES) .PHONY: clean clean: rm -rf apidoc *~ libtritonus-java-20070428/doc/TODO0000644000175000017500000000051007452536245016462 0ustar twernertwernersequencer: - clean up test directory - make test suite - track mute/solo (ALSA, also JavaSeq.) - recording - synchronization - reorganize JavaSequencer to have a loader thread and a player thread - clean up AlsaSeq - why is tritonus_remaining.jar in the classpath attribute in the manifest of, for instance, tritonus_mp3.jar? libtritonus-java-20070428/doc/TODO-matthias.txt0000644000175000017500000002000107612035245021075 0ustar twernertwernerdoc/TODO-matthias.txt --------------------- IDEAS ----- - publish TConversionTool in some way. Binary? Packaged with example programs? - use speex (open source speech compression, http://speex.sourceforge.net/) - use FLAC (free lossless audio codec)? - check to shadow META-INF/services/javax.sound.* by means of prepending to boot class path. - remove midishare and mp3 stuff? - use libiiwusynth? - support ADPCM? - use TSE3 (portable sequencer engine written in C++) - support TSE3MDL file format? TODO (1 - important, 3 - nice to have) ---- general 2 - use aspectj!!! 3 - add "formatted for 80 cols" header to all files 3 - check freetts/Tritonus interaction lowlevel, native 2 - initialize all variables 3 - use libtritonuscommon in all native libs 3 - rename DEBUG to debug_flag for all native libs 3 - separate static inner classes in all native/lowlevel classes 3 - in src/lib/alsa, change constants_check.h to constants_check.c and include it into the object list of in Makefile.in. This is to isolate its effects. 3 - change library building to using libtool 3 - re-check ALSA seq constants (constants_check.h) documentation, distibution 1 - some documentation "how to use Tritonus", explaining general options (precompiled, compile yourself from cvs) 1 - make a note in INSTALL that for hand-installation only desired components should be installed. For automatic install, anyway. (see midishare exception) 1 - binary dists: esd, alsa, SRC, AOS 3 - cleanup web pages: contemporary doctype, weblint, ... 3 - Separate into tritonus_midi_alsa.jar and tritonus_sampled_alsa.jar 3 - review cdda distribution README misc 1 - integrate ogg/vorbis 1 - test suite for classes (not necessarily interfaces) in javax.sound 1 - implement available() for lines 1 - fix start()/stop()/active behaviour for lines 2 - fix bug in AlsaMixer.readControlList() 2 - rework sample rate converter 3 - change provider search order to be exactely compatible with Sun TEST ---- javax.sound.midi Interfaces ControllerEventListener MetaEventListener MidiChannel MidiDevice Receiver Sequencer Soundbank Synthesizer Transmitter Classes Instrument MetaMessage MidiDevice.Info MidiEvent MidiFileFormat MidiMessage MidiSystem Patch Sequence Sequencer.SyncMode ShortMessage SoundbankResource SysexMessage Track VoiceStatus Exceptions InvalidMidiDataException MidiUnavailableException javax.sound.midi.spi Classes MidiDeviceProvider MidiFileReader MidiFileWriter SoundbankReader javax.sound.sampled Interfaces Clip DataLine Line LineListener Mixer Port SourceDataLine TargetDataLine Classes AudioFileFormat AudioFileFormat.Type AudioFormat AudioFormat.Encoding AudioInputStream AudioPermission AudioSystem BooleanControl BooleanControl.Type CompoundControl CompoundControl.Type Control tested in ControlTestCase Control.Type tested in ControlTypeTestCase DataLine.Info EnumControl EnumControl.Type FloatControl FloatControl.Type Line.Info LineEvent LineEvent.Type Mixer.Info Port.Info ReverbType Exceptions LineUnavailableException UnsupportedAudioFileException javax.sound.sampled.spi Classes AudioFileReader AudioFileWriter FormatConversionProvider MixerProvider ------------------------------------------------------------------- SAOL ---- grammar: - tables (s/r conflict) - floats - associativity of '?' - make unicode-clean (but check if saol allows unicode chars in identifiers) Tests mit JSInfo, Converter Test ================================ Es wird immer ber die Funktion AudioSystem.isConversionPossible(AudioFormat, AudioFormat) getestet. -------- source format: PCM_SIGNED, 1 channel(s), 16 bit samples, 2 byte frames, 44100.0 Hz, 44100.0 frames/second, little endian target format: ALAW, 1 channel(s), 8 bit samples, 1 byte frames, 44100.0 Hz, 44100.0 frames/second, little endian AudioSystem.doFormatConversionProviderIteration(): handling FormatConversionProvider: org.tritonus.sampled.convert.MpegFormatConversionProvider@ed1976dd AudioSystem.doFormatConversionProviderIteration(): handling FormatConversionProvider: org.tritonus.sampled.convert.UlawFormatConversionProvider@f91976dd possible: true - possible solutions: - cancel alaw <-> ulaw completely (let smart converter do it) - seperate it into an own converter - derive Alaw-/UlawFCP from TMatrixFormatConversionProvider --- source format: PCM_SIGNED, 1 channel(s), 8 bit samples, 1 byte frames, 48000.0 Hz, 48000.0 frames/second, little endian target format: PCM_SIGNED, 1 channel(s), 24 bit samples, 3 byte frames, 48000.0 Hz, 48000.0 frames/second, little endian AudioSystem.doFormatConversionProviderIteration(): handling FormatConversionProvider: org.tritonus.sampled.convert.MpegFormatConversionProvider@ed1a7a60 AudioSystem.doFormatConversionProviderIteration(): handling FormatConversionProvider: org.tritonus.sampled.convert.UlawFormatConversionProvider@f91a7a60 AudioSystem.doFormatConversionProviderIteration(): handling FormatConversionProvider: org.tritonus.sampled.convert.AlawFormatConversionProvider@fdd27a60 AudioSystem.doFormatConversionProviderIteration(): handling FormatConversionProvider: org.tritonus.sampled.convert.PCM2PCMConversionProvider@fcae7a60 possible: false - solution: In PCM2PCM FCP., add 24 and 32 bit formats to set of I/O formats passed to super class constructor additional suggestions: a) remove duplicate lines in OUTPUT_FORMATS b) rename OUTPUT_FORMATS to INOUT_FORMATS --- source format: PCM_SIGNED, 1 channel(s), 8 bit samples, 1 byte frames, 44100.0 Hz, 44100.0 frames/second, little endian target format: PCM_SIGNED, 2 channel(s), 8 bit samples, 2 byte frames, 44100.0 Hz, 44100.0 frames/second, little endian AudioSystem.doFormatConversionProviderIteration(): handling FormatConversionProvider: org.tritonus.sampled.convert.MpegFormatConversionProvider@ed1a7a60 AudioSystem.doFormatConversionProviderIteration(): handling FormatConversionProvider: org.tritonus.sampled.convert.UlawFormatConversionProvider@f91a7a60 AudioSystem.doFormatConversionProviderIteration(): handling FormatConversionProvider: org.tritonus.sampled.convert.AlawFormatConversionProvider@fdd27a60 AudioSystem.doFormatConversionProviderIteration(): handling FormatConversionProvider: org.tritonus.sampled.convert.PCM2PCMConversionProvider@fcae7a60 possible: false - solution: ?? (this is presumably a fundamental solution of TEncodingProvider) --- source format: PCM_SIGNED, 2 channel(s), 16 bit samples, 4 byte frames, 44100.0 Hz, 44100.0 frames/second, little endian target format: PCM_UNSIGNED, 2 channel(s), 16 bit samples, 4 byte frames, 44100.0 Hz, 44100.0 frames/second, little endian AudioSystem.doFormatConversionProviderIteration(): handling FormatConversionProvider: org.tritonus.sampled.convert.MpegFormatConversionProvider@ed1a7a60 AudioSystem.doFormatConversionProviderIteration(): handling FormatConversionProvider: org.tritonus.sampled.convert.UlawFormatConversionProvider@f91a7a60 AudioSystem.doFormatConversionProviderIteration(): handling FormatConversionProvider: org.tritonus.sampled.convert.AlawFormatConversionProvider@fdd27a60 AudioSystem.doFormatConversionProviderIteration(): handling FormatConversionProvider: org.tritonus.sampled.convert.PCM2PCMConversionProvider@fcae7a60 possible: false - solution: discuss whether 16 bit unsigned is important --- source format: PCM_SIGNED, 2 channel(s), 16 bit samples, 4 byte frames, 48000.0 Hz, 48000.0 frames/second, little endian target format: PCM_SIGNED, 2 channel(s), 16 bit samples, 4 byte frames, 44100.0 Hz, 44100.0 frames/second, little endian AudioSystem.doFormatConversionProviderIteration(): handling FormatConversionProvider: org.tritonus.sampled.convert.MpegFormatConversionProvider@d06e6b3f AudioSystem.doFormatConversionProviderIteration(): handling FormatConversionProvider: org.tritonus.sampled.convert.UlawFormatConversionProvider@c46e6b3f AudioSystem.doFormatConversionProviderIteration(): handling FormatConversionProvider: org.tritonus.sampled.convert.AlawFormatConversionProvider@c1566b3f AudioSystem.doFormatConversionProviderIteration(): handling FormatConversionProvider: org.tritonus.sampled.convert.PCM2PCMConversionProvider@c0226b3f possible: false - solution: mal hinmachen! --- libtritonus-java-20070428/doc/cdda.txt0000644000175000017500000000555207421773624017441 0ustar twernertwernercdda.txt Usage ===== For reading CDs digitally, a special URLHandler is used to provide a high-level interface. For programs to work seamlessly, you have to execute the following statement once: [import org.tritonus.sampled.cdda.CddaURLStreamHandlerFactory;] URL.setURLStreamHandlerFactory(new CddaURLStreamHandlerFactory()); (It doesn't harm if it's executed more than once. However, the recommended method is to do this in a static initializer.) The URL forms ============= cdda: cdda:// returns a list of CDROM drives. For now, a simple list with one line per drive is provided. The names returned should all start with '/' (It's not yet clear if it is possible to drop this requirement). Idea for the future: return a chunk of XML data that also contain status information for the drives. cdda:[drive] returns the table of content of the drive that is given as a name. The has to be one of the lines returned by 'cdda:'. The information is returned as a chunk of XML data. It contains length, start sector and other data specific to the tracks. examples: cdda:/dev/hdc cdda:///dev/hdc returns the table of content for the drive /dev/hdc cdda:[drive]#[track] Returns the digital data of the given track on the given drive. The data is in 16 bit linear PCM, stereo. examples: cdda:/dev/hdc#4 cdda:///dev/cdrom#4 reads track 4 of the drive /dev/hdc cdda:#4 cdda://#4 reads track 4 of the default drive Examples ======== There are two examples in the Java Sound Examples' cvs: CddaPlayer and CddaRipper. Internal architecture ===================== The implementation is divided into low-level, mid-level and high-level parts. The low-level part is intended to handle native calls to access operating system specific APIs. The interface can be chosen freely by the implementor. It typically closely resemble the structure of the underlying API. Currently, there are two implementations: One based on cdparanoia (http://www.xiph.org/paranoia/). The other is based on Linux' "cooked ioctl" interface. Code is under src/org/tritonus/lowlevel/cdda/[cdparanoia,cooked_ioctl]/ and src/lib/[cdparanoia/cooked_ioctl]/. The mid-level part brings together the different operating-specific interfaces to a common interface. The common interface is org.tritonus.lowlevel.cdda.CddaMidLevel. For each low-level part there should be a corresponding wrapper implementing the mid-level interface. The implementations are typically in src/org/tritonus/lowlevel/cdda/*/*MidLevel.java. The high-level part provides the facilities of the low- and mid-level parts as an URL. Te form of the URLs is described above. The implementation is in src/org/tritonus/sampled/cdda/. -- open questions: - url to read the TOC of the default drive? Reset of AudioInputStream possible? Restrictions on simultaneous reading of multiple tracks? Byte order? -- set format of returned ais after endianess that the drive reports? libtritonus-java-20070428/doc/compression.txt0000644000175000017500000000062707322674220021075 0ustar twernertwernerG.711: A-law, -qaw, 64 kbps G.721: ADPCM, 32 kbps G.722: 48/56/64 kbps G.723: ADPCM? 24/40 kbps G.723.1: ADPCM? 5.3/6.4 kbps G.728: hyprid/CELP, 16 kbps (computing intensive, only slightly better than GSM) G.729: H.261: video compression >= 64 kbps H.263: video compression < 64 kbps H.323: Multimedia conferencing over packet switched networks (video/audio conferencing). Often used for Voice over IP. libtritonus-java-20070428/doc/fluidsynth-proposal.txt0000644000175000017500000000624610372202637022563 0ustar twernertwernerJava files ========== I suggest to rename the files and/or use new package names as follows. All java files reside in the directory .../tritonus/src/classes fluidsynth.FluidException -> [I see no necessity for this class and suggest to remove it] fluidsynth.Synth -> org.tritonus.midi.device.fluidsynth.FluidSynth fluidsynth.TMidiChannel -> org.tritonus.midi.file.fluidsynth.FluidMidiChannel [Note: may be reworked so that FluidMidiChannel and AlsaMidiChannel take advantage of a common base class org.tritonus.share.midi.device.TMidiChannel] (future new file) -> org.tritonus.midi.device.fluidsynth.FluidMidiDeviceProvider fluidsynth.FluidSoundbank -> org.tritonus.midi.sb.fluidsynth.FluidSoundbank (future new file) -> org.tritonus.midi.sb.fluidsynth.FluidSoundbankReader native files ============ - I suggest to not check in source code of the core fluidsynth distribution into the tritonus CVS. This is generally uncommon, and would raise synchronization problems. In general, I think a build should be possible with the compiled fluidsynth libraries and the public headers installed on a system. This is currently a problem because fluidsynt_jni.c uses two internal headers, fluid_midi.h and fluid_sfont.h. This is something that needs to be worked out. - Because I had linkage problems with fluidsynth_jni.cpp and fluidsynth_Synth.cpp, I changed them from C++ to C, renaming them to *.c and changing 'env->function(...' to '(*env)->function(env, ...'. Since this makes the code more portable and the benefits from using C++ here seem minimal anyway, I suggest to keep it this way. - One major limitation is that in fluidsynth_jni.c the native handle to the synthesizer is kept in a static variable. This makes it impossible to use more than one instance of the synthesizer at the same time. However, fixing this is not a big deal, we have a standard solution for this in Tritonus, and I want to get to code in the CVS first. - I do not see a compelling reason for splitting the code between the files fluidsynth_jni.c and fluidsynth_Synth.c. Since they have to be reworked anyway, we may decide to merge them. - build process: the usual build for native part of tritonus is with autoconf and makefiles. This is possible on Windows too, if the respective tools are installed. I'm not sure how familiar you (Henri) are with these tools. If you think you want the VC project files in the CVS, we can put them into the same directory as the (native) source files (.../tritonus/src/lib/fluidsynth), the root directory (.../tritonus) or something like ..../tritonus/winbuild. Please make up your mind and tell us about your opinion. file locations: fluidsynth_jni.h -> .../tritonus/src/lib/fluidsynth/fluidsynth_jni.h [Note: see the note above about merging] fluidsynth_jni.c -> .../tritonus/src/lib/fluidsynth/fluidsynth_jni.c [Note: see the note above about merging] fluidsynth_Synth.h -> .../tritonus/src/lib/fluidsynth/org_tritonus_midi_device_fluidsynth_FluidSynth.h [Note: In the tritonus build system, this file would be generated automatically. We need to check whether this fits into the Win build process.] fluidsynth_Synth.c -> .../tritonus/src/lib/fluidsynth/org_tritonus_midi_device_fluidsynth_FluidSynth.c libtritonus-java-20070428/doc/kaffe-debug.txt0000644000175000017500000000044707615320135020672 0ustar twernertwernerThe following explains how to deploy a debug version of tritonus with kaffe. 1. remove the Tritonus/Java Sound components from kaffe's rt.jar. 2. build a debug version of Tritonus: > ant clean > ant -f build-debug.xml 3. Put the resulting .jars in kaffe's classpath:[modify .kafferc; example]libtritonus-java-20070428/doc/midicomments.txt0000644000175000017500000002273007075416206021226 0ustar twernertwernerFirst, thank you for this piece of documentation! Very helpful for adapting Tritonus to the newest API. However, running the JMF2.0FCS version of JS with jdk1.3beta still gives me headaches. It looks like a problem with the initialisation of service providers. General remarks --------------- * There should be real, working examples, closing the gap between the code framents included and complex examples like JavaSoundDemo. * Some important information on the behaviour of objects given here are missing in the javadoc. They should be added. * There should be more figures. Chapter 8 --------- I've read this only briefly, so I can't say much. As an online resource for the MIDI standards, I found this more complete and more readable than the material presented on www.midi.org: http://crystal.apana.org.au/ghansper/midi_introduction/contents.html Especially in this chapters, some instructive figures would be helpful. Chapter 9 --------- Obtaining a desired device: The method of retrieving a device to know if it's a sequencer, synthesizer or represents a midi port is not very elegant. This is information that should be part of the info object. An alternative is to have methods AudioSystem.getSynthesizerInfo(), AudioSystem.getSequencerInfo() with AudioSystem.getMidiDeviceInfo() returning only midi devices that are not Synthesizers or Sequencers. Chapter 10 ---------- Let me say that I higly like the new model of Receivers and Transmitters! With timestamps, I see some problems. - An application deciding to use the facility of a MidiDevice to compensate for latencies should know the maximum amount of time difference handled by the device, so that the app can calculate timestamps that it is sure are handled correctly by the device. - There is a problem when a device A sends events to a device B with a different timebase. Device A timestamps the events with its current notation of time. It passes the message including th timestamp to a device B which is required to send the message. Now, let's say device B is capable of correcting for latencies, i.e. it will honour A's timestamps. All works well if A and B have the same notation of current time or if B has a later time, in which case it will consider all events to be in the past and try to send them immediately. However, if, say, B is 500 ms earlier than A it will delay all event by this amount, which is undesirable. The problem can be solved by having the transmitter correct the timestamp according to the difference in time between the two devices. This is currently not possible, because there is no way for a transmitter to retrieve the MidiDevice the Receiver it has to send to belongs to. Even if this is possible, the implementation is not very easy: since time must never go backwards and should not jump forewards, maintaining the time difference needs a sophisticated clock synchronization algorithm. If the current time difference differs from a previously measured time difference, it is not appropriate to just set the new amount. Instead, systematic drift has to be introduced to the time difference. Is it woth that effort? Perhaps the work should go into implementations that deliver messages as fast as possible. Connecting Transmitters to Receivers: Having a single object as both sequencer and synthesizer doesn't harm, but an implicit connection does. Getting the same object on calls to getSequencer() and getSynthesizer() to make a connection between them is no problem -- applications will not even notice that there are not two different object. However, assume that an application wants to use a sequencer to play a midi file via a midi port on an external synthesizer. Having the same file played on an internal synthesizer with no way to untie the implicit connection to shut down the boxes, not even a way to detect that situation is not acceptable for professional applications, e.g. sequencer applications. Additionally, assuming that they are the same object (with an implicit connections) leads to non-portable programming techniques. Connecting more that one device: It is not clear what a MidiDevice should return on getMaxTransmitters() and getMaxReceivers() if the device doesn't impose a restriction on the number of R/T. Chapter 11 ---------- In the introductory part, some figures would be nice (and perhaps helpful). p 101: "It [the duration of a tick] can vary[...], and its value is stored in the header of a standard midi file." While not wrong, here the talk goes about Sequence objects. So, the sentence should state that the tick duration is stored as global data of a Sequence object. Recording and Saving Sequences: There is a sentence that sounds like MidiSystem.getSequencer() returns a different Sequencer object each time it is called. I also noticed this behaviour in JS 0.90. But there is no statement exactely describing this behaviour. Is there a maximum number of instances? Are they managed as a pool or something like that? In Tritonus, the situation will be like this: each (active) Sequencer object needs a queue of the underlying ALSA sequencer (a module running inside the kernel). The queue is allocated on calls to open() and released with close(). There is a fixed number of queues, currently 8. So in Tritonus, there can be an unlimited number of Sequencer objects, but only 8 opened, if no other application in the system has allocated a queue. If the behaviour of the Sun implementation differs much, there is a chance of non-portable programming techniques. The semantics of recordEnable() is not clear. Is it possible to record all channels to the same track by calling recordEnable multiple times with different values for the channel? What happens if it is called again with the same channel value, but another track? Does the later call take precedence or is the event routed to both tracks? By the way, my feeling is that the method should be named enableRecording() of setRecordingEnabled(). [I have no practical midi experience, so I do not know whether the following situation is realistic] The current method of recording requires that all recorded data is kept in memory and only written to a file after the recording is completed. This may be a problem with long recordings: main memory might not be big enough to hold all data. Perhaps there should be a way to write directely to a file. This is definitely a problem in the audio area, where one minute of CD-quality recording consumes 11 MB. There, I have an idea of how to solve this in an elegant way, to be discussed on another opportunity. Editing a sequence: The Track's tick() method should be named getTicks() or getLengthInTicks(). An interesting question is how this method behaves on unordered tracks (it's also a question how the sequencer behaves). If the events in a track are ordered by tick value, calculating the length is trivial: take the difference between the first and the last event's tick values. However, this method sucks if the events are not in timely order. Another interesting point is how the sequencer behaves if the sequence is modified while it is played. I noticed that in JS0.90 it doesn't behave at all because the whole sequence is downloaded to the engine before it is started. Being able to modify sequences under play is desirable, as it would allow to stream midi event over the network. Moving to an arbitrary position: Is it legal to call the methods setTicKPosition() and setMicrosecondPosition() while playing is active? If so, is the implementation required to quarantee that currently played notes are shut down correctely (means inserting note off events if they are skipped)? Does calling stop() guarantee this behaviour? Muting and soloing: Is it legal to call these methods during play? Perhaps it's a good idea to throw an IllegalArgumentException if and invalid track number is passed to setTrackMute(). Synchronizing with other midi devices: There is some confusion in that sometimes the term "synchronizing to a Master/Slave" is used and other times "acting as a M/S", which have opposite directions of thought. ------ Other remarks: * MidiDevice: It is unclear what value getMaxReceivers() and getMaxTransmitters() should return if the maximum number of Receivers/Transmitters is unlimited. If a device cannot provide microsecond resolution, but milliseconresolution, should getMicroSecondPosition() return -1 or (milliseconds * 1000) ? * ControllerEventListener and MetaEventListener should be renamed to ControllerMessageListener and MetaMessageListener for consistency. * ShortMessage: What happens if getData2() is called on a message with only one data byte? The choices are returning 0 or throwing an exception. Tritonus currently throws an ArrayIndexOutOfBoundsException. * MidiSystem.getMidiDevice(): there is an inconsistency in possible exceptions between this method and MidiDeviceProvider.getDevice(). * There is a naming inconsistency between getMidiFileTypes() and isFileTypeSupported(). * MidiDeviceProvider should be an interface, not an abstract class. This would leave the implementor more freedom about the class hierarchy. There is no problem in using a non-public class like AbstractMidiDeviceProvider to provide an implementation for isDeviceSupported(). * MidiFileReader should be an interface. Since there are only abstract methods, I see no reason why this should be a class. * MidiFileWriter: same as MidiDeviceProvider. * SoundbankReader: same as MidiFileReader. * There should be a way to register und unregister service providers at runtime and in a portable way. In JavaSound 0.86, there was a class MidiConfig which did exactely this. Why was it abandoned? libtritonus-java-20070428/doc/package-structure-proposal.txt0000644000175000017500000000251207075416206024020 0ustar twernertwernerThis is a proposal for a new package structure of Tritonus. It assumes that we get the domain tritonus.org. org.tritonus -- all of Tritonus org.tritonus.lowlevel -- classes for native or networked device access org.tritonus.lowlevel.esd -- enlightened sound daemon org.tritonus.lowlevel.alsa -- advanced linux sound architecture org.tritonus.lowlevel. ... org.tritonus.sampled -- everything that has to do with javax.sound.sampled org.tritonus.sampled.file -- AudioFileReaders & AudioFileWriters & their base and utility classes org.tritonus.sampled.convert -- FormatConversionProviders & their base and utility classes org.tritonus.sampled.mixer -- Mixers, MixerProviders, their lines, their base and utility classes org.tritonus.sampled.mixer.esd -- mixer using the enlightened sound daemon org.tritonus.sampled.mixer.alsa -- mixer using the ALSA directely org.tritonus.sampled.mixer. ... org.tritonus.midi -- everything that has to do with javax.sound.midi ("structured" would be a better name as opposed to "sampled") org.tritonus.midi.file -- SequenceProviders and MidiFileProviders org.tritonus.midi.device org.tritonus.midi.device.alsa -- implementation utilizing the ALSA sequencer org.tritonus.midi.device.midishare -- for example org.tritonus.midi.device. ... org.tritonus.util -- general, configuration (or direct under org.tritonus?) libtritonus-java-20070428/doc/spec_TODO.txt0000644000175000017500000000036207444345216020314 0ustar twernertwerner behaviour of Sequencer.setMaster/SlaveSyncMode() if the passed mode is not allowed Synthesizer.getLatency() == -1 should be documented to be 'unknown'. Sequencer.setSequence() : if sequencer not opened, jdk1.3 throws IllegalStateException libtritonus-java-20070428/doc/tritonus_jdk1.3.txt0000644000175000017500000000216307444345216021477 0ustar twernertwerner I installed Tritonus on a Sun jdk1.3.0 and I still get the behaviour of Sun's Java Sound implementation. Using Tritonus under jdk1.3.0 is a bit tricky. The point is that installing Tritonus you are just adding Tritonus' mixers, converters and other service providers to ones of Sun's Java Sound implementation. Especially, Sun's mixing engine is still the default mixer. To use Tritonus' mixers, you have to select the mixer in your program manually: get the respective Mixer object from AudioSystem, and allocate the lines from this Mixer object. The same is true for MidiDevices. It's possible to use Tritonus' javax.sound.* classes by putting them into the boot classpath *before* rt.jar. But this still leaves you with Sun's service providers. Getting rid of them required to change the service provider configuration files inside rt.jar or other, even more fancy measures. The alternative way out of the hell is to use a jdk1.2.X, where Tritonus is the only Java Sound implementation. (Matthias) libtritonus-java-20070428/doc/tritonus_mod_proposal.txt0000644000175000017500000001025407165077335023207 0ustar twernertwernerTritonus modularization proposal -------------------------------- This document proposes to break up the tritonus.jar file into several pieces. The goal of it is to enhance the maintainability of Tritonus. For instance, on systems that don't have ALSA, it is now possible to just not install tritonus_mixer_alsa and tritonus_midi_alsa. It is no longer required to edit the configuration files in (formerly) tritonus.jar (and rebuild it). The second goal is to ease seperation of parts of Tritonus for use with other implementations of JS. We have already done this with the mp3 decoder. In the future, we will do this for additional converters and the entire MIDI implementation. The preferred solution would be to have the same packaging into jar files for Tritonus itself and for external usage. - tritonus_core: javax.sound.* org.tritonus.core.TInit (formerly: org.tritonus.TInit) org.tritonus.core.TMidiConfig (formerly: org.tritonus.midi.TMidiConfig) org.tritonus.core.TAudioConfig (formerly: org.tritonus.sampled.TAudioConfig) org.tritonus.core.Service (formerly: org.tritonus.util.Service) - tritonus_share.jar: org.tritonus.share.TDebug (formerly: org.tritonus.TDebug) org.tritonus.share.TNotifier (formerly: org.tritonus.TNotifier) org.tritonus.share.ArraySet (formerly: org.tritonus.util.ArraySet) org.tritonus.share.GlobalInfo (formerly: org.tritonus.util.GlobalInfo) org.tritonus.share.TCircularBuffer ?? (only used by AsyncFilteredAIS) (formerly: org.tritonus.util.TCircularBuffer) org.tritonus.share.midi.MidiUtils ?? (only used in AlsaMidiChannel) (formerly: org.tritonus.midi.MidiUtils) org.tritonus.share.midi.TMidiFileFormat ?? (only used by StandardMidiFileReader) (formerly: org.tritonus.midi.file.TMidiFileFormat) org.tritonus.share.midi.TMidiDevice (formerly: org.tritonus.midi.device.TSequencer) org.tritonus.share.midi.TSequencer (formerly: org.tritonus.midi.device.TSequencer) org.tritonus.share.sampled.AudioFileTypes (formerly: org.tritonus.sampled.AudioFileTypes) org.tritonus.share.sampled.AudioFormats (formerly: org.tritonus.sampled.AudioFormats) org.tritonus.share.sampled.AudioUtils (formerly: org.tritonus.sampled.AudioUtils) org.tritonus.share.sampled.Encodings (formerly: org.tritonus.sampled.Encodings) org.tritonus.share.sampled.FloatSampleBuffer (formerly: org.tritonus.sampled.FloatSampleBuffer) org.tritonus.share.sampled.TConversionTool (formerly: org.tritonus.sampled.TConversionTool) org.tritonus.share.sampled.TVolumeUtils ?? (formerly: org.tritonus.sampled.TVolumeUtils) org.tritonus.share.sampled.convert.* (without subdirs) (formerly: org.tritonus.sampled.convert.*) org.tritonus.share.sampled.mixer.* (without subdirs) (formerly: org.tritonus.mixer.file.*) - tritonus_midi_alsa: org.tritonus.midi.device.alsa.* org.tritonus.lowlevel.alsa.ASequencer org.tritonus.lowlevel.alsa.ASequencer0 - tritonus_midi_midishare: org.tritonus.midi.device.midishare.* ?? lowlevel classes ?? (grame.midishare.*) - tritonus_convert_standard: org.tritonus.sampled.convert.standard.* - tritonus_sampled_file_standard: org.tritonus.sampled.file.standard.* - tritonus_mp3: org.tritonus.sampled.convert.mp3.* org.tritonus.sampled.file.mp3.* ?? low-level classes for encoder ?? - tritonus_gsm: org.tritonus.sampled.convert.gsm.* org.tritonus.sampled.file.gsm.* org.tritonus.lowlevel.gsm.* - javalayer: javazoom.jl.decoder.* - tritonus_mixer_alsa: org.tritonus.sampled.mixer.alsa.* org.tritonus.lowlevel.alsa.Alsa org.tritonus.lowlevel.alsa.AlsaCtl org.tritonus.lowlevel.alsa.AlsaPcm - tritonus_mixer_esd: org.tritonus.sampled.mixer.esd.* org.tritonus.lowlevel.esd.* Package structure changes: - many classes go to core or share (see above) - MpegFormatConversionProvider goes to org.tritonus.sampled.convert.mp3 - PCM2PCMConversionProvider, SmartFormatConversionProvider, AlawFormatConversionProvider and UlawFormatConversionProvider go to org.tritonus.sampled.convert.standard - MpegAudioFileReader, MpegEncodings and MpegFileFormatType go to org.tritonus.sampled.file.mp3 - Aiff*, Au* and Wave* go to org.tritonus.sampled.file.standard - org.tritonus.TConfiguration is no longer needed and will be removed. Notes: - javalayer is seperated from tritonus_mp3 for legal reasons. libtritonus-java-20070428/doc/tritonusfaq.sgml0000644000175000017500000010401707262277004021236 0ustar twernertwerner ]>
Tritonus FAQ General configure fails. What should I do? After configure run, there is a file 'config.log in the directory where you run configure. It contains detailed information on failed tests If you want to ask on a mailing list, include the content of this file. (Matthias) I can't get the ALSA mixer. There are three possibilities: Use a jdk1.3. Use an older jdk (e.g. jdk1.2.2) and install JMF 2.0 performance pack. Use an older jdk and install an alternative Java Sound implementation (e.g. jdk1.2.2 and Tritonus). (Matthias) I am new to Java Sound and want to program a telephony application. Is this possible, and if yes, how do I do that? It is possible. We cannot provide all concepts of digital audio in this FAQ. There are many good books on this subject. I recommend "the computer music tutorial" from Curtis Roads, from MIT press. For simple examples how to do streaming audio with Java Sound, see Matthias' Java Sound Examples. (Florian) How is the JMF related to Java Sound? JMF is a high-level API, designed mainly for easy playback of multimedia files, video as well as audio. Java Sound, on the other hand, is a rather low-level API, designed for detailed control of the audio hardware. (Matthias) I want a specific feature in future versions of the Java Sound API You can make specification requests to Sun. To read how to do that, go to http://java.sun.com/aboutJava/communityprocess/submit.html. You may want to discuss the feature before hand on the mailing list. (Florian) The Java Sound API seems fine to me, but many things do not seem to be implemented. This is a matter of time. Sun will improve the Java Sound implementation (and also the API). Other people will provide service providers to extend Java Sound. The Tritonus team will release parts of Tritonus as service providers so that everybody can take advantage of Tritonus' achievements. A native port of Tritonus to Windows is planned, too. (Florian) I discovered a bug in a Java Sound implementation For the Sun implementation, you can submit it as a bug on http://java.sun.com/cgi-bin/bugreport.cgi (needs a registration to the developer connection). For Tritonus, use their bug reporting system on http://sourceforge.net/bugs/?group_id=1390. (Florian) Audio Programming I want to convert a byte[] array to short samples or vice versa. Look at the Tritonus source code, class org.tritonus.sampled.TConversionTool. You have to look it up in the cvs repository in the subdirectory src/org/tritonus/sampled. For that, go to http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/tritonus/src/org/tritonus/sampled/?cvsroot=tritonus and click on the version number of "TConversionTool.java". It contains many methods for converting byte arrays. (Florian) Playback of audio data with Java Sound is significantly quieter than with a compared player on the native OS. There was the issue that Sun's implementation of Java Sound (at least up to version 0.99) lowers the level of output in order to avoid clippings when several lines are mixed. Probably this "feature" is the problem. I find this "feature" quite doubtful. A Java Sound programmer should use GainControls attached to single lines to lower the volume, if wanted. Many applications won't profit of this "feature": e.g. they only play one line at a time. Or the mixed sounds don't create clippings. This is not unusual, as even "normalized" sounds leave most of the time enough room - there must coincide peaks to create a clipping. The case that the soft synth AND audio are playing simultaneously can be expected in "quality" programs which provide a way to lower the gain of the lines - or do the gain decrease automatically. As Java Sound is supposed to be a low-level engine, such an approach would not be suitable. The problem of the feature is a general decrease of signal-to-noise ratio of all Java Sound programs. Automatic lowering of volume prevents the use in "serious" or professional environments... (Florian) I cannot retrieve any Port instances It seems that no implementation of Java Sound provides Port instances, yet. (Florian) I want to save audio data to a file, like wav or aiff Have look at Matthias' Java Sound Examples. (todo: link - maybe put them, too, on tritonus.org) I want to be notified when data is available for write/read in a SourceDataLine/TargetDataLine You have to use SourceDataLine/TargetDataLine.available(). The usual implementation for streaming audio (in Java Sound) is a dedicated thread for that - look at the Java Sound demo which you can download from sun or at Matthias' JS examples. (Florian) I want to do some processing on an alaw stream (like amplifing it) It is much easier to change gain with linear encoding (PCM). I would strongly suggest that - especially when you have the data in linear format at first. You'd have to convert it back to alaw after processing. (Florian) I want to implement a real-time AudioInputStream, but cannot give a length for it, as it is not known in advance You should use "AudioSystem.NOT_SPECIFIED" as length. This approach seems logical to me and it works fine in my program. (Florian) I want to add special chunks to wave or aiff files (like for a descriptive text or copyright) The Java Sound API does not support this currently. Future versions are likely to, because this is indeed quite important. For the moment, you will need to implement your own class for writing wave or aiff files. Or make meaningful filenames... (Florian) It fails to open any line with 16KHz sample rate Apparently, most Java Sound implementations do not provide that, even if the sound card supports it. Future implementations will support that. (Florian) I have a byte array and want to write these data to an audio file. Create a ByteArrayInputStream object from the byte array, create an AudioInputStream from it, then call AudioSystem.write(...). [TODO: code example, alternative approach via AudioOutputStream] (Matthias) I want to get a SourceDataLine or TargetDataLine in -law format TargetDataLines are supposed to act as a "direct" way to communicate with the audio hardware device, i.e. your soundcard. When your soundcard does not support ulaw directly, the TargetDataLine won't either. The way to go is to open a TargetDataLine in pcm format and route it through a format converter. See doc of AudioSystem to get converted Streams. The converted stream you get provides ulaw samples then. There is no drawback in this approach: all PC soundcards that I know of deliver only PCM, so it has to be rendered to ulaw anyway in software. Whether in the soundcard's driver, the operating system layer or in the application (your java program) doesn't matter. You get maximum portability when only using pcm for TargetDataLines. (Florian) Simultaneous recording and playback only works when first opening the playback line (SourceDataLine) This depends on the soundcard and its driver to the native operating system. E.g. Soundblaster 16 or 64 do not provide real full duplex, only a kind of pseudo full duplex. I experienced under Windows that you can only use this pseudo full duplex when you have a certain order in opening record/playback lines. (Florian) I want to detect the level of sound while I am recording it First of all, you should have the data in PCM format (preferable in signed PCM). Then you can look at the samples to detect the amplitude (level). Some statistics are suitable, too, like taking the average of the absolute values or RMS. (Florian) I want to use multi-channel sound. This is currently not possible. It will be supported in Tritonus in the future. (Matthias) I'm trying to do sample rate conversion with Java Sound, but it doesn't work. Currently, no Java Sound implementation supports this. Tritonus will do so in the near future, and this will be made available as a plug-in for other Java Sound implementations. Also, JMF supports sample rate conversion. (Matthias) I want to do equalizing/noise reduction/fft/... with Java Sound. Java Sound is an API concerned with basic sound input and output. It does not contain digital signal processing algorithms. Nevertheless, you can do this with Java; you just have to code it on your own. The book "Digital Audio with Java" by Craig Lindley contains some DSP algorithm. Also, it is often easy to transform C or C++ code found on the net to Java. For code that does fft, have a look at the Peruna Project. (Matthias) I do recording with a TargetDataLine and I want a volume control for it. The obvious solution would be to get a Control object of type VOLUME or GAIN for the TargetDataLine and manipulate the volume via this object. However, this is not possible, since neither the Sun jdk1.3 nor Tritonus implement any controls for TargetDataLines. What you can do is to use the system mixer to control the recording volume---it affects hardware settings in the soundcard. There is an API to manipulate the system mixer from java: the mysterious Ports. But again, this is not implemented in any known Java Sound implementation (it is planned to implement Ports in future versions of Tritonus). The remaining possibility is to implement a volume control digitally: multiplying each single sample of the sound data with a certain value that lowers or raises the level proportionally. (Matthias) I want to use an audio clip on a 5 MB audio file, but I get an out of memory exception. For files of this size, you should stream the audio. Like that you treat buffers of small size and feed them successively into the the audio device. Look at Matthias' Java Sound examples, there are some streaming audio players to take as a start. Java Sound Examples: http://rupert.informatik.uni-stuttgart.de/~pfistere/jsexamples/. (Florian) I want to calculate the number of bytes to skip from the length in seconds. Use one of the following formulas: bytes = seconds * sample rate * channels * (bits per sample / 8) or bytes = seconds * sample rate * frame size. You can get the sample rate, number of channels, bits per sample and frame size from an AudioFormat object. (Matthias) Encodings and file types I want to play back mp3 files There is a pure Java decoder of the javazoom project. Tritonus, the open source implementation of Java Sound incorporates it. There is a plug in available which runs under any JVM. (Florian) I want to encode mp3 files with my Java program Java is free, this collides with the (enforced) licences for mp3 encoders. I have studied very carefully the mp3 licencing model and also asked at Fraunhofer (inventors of mp3) for additional information: it won't be possible to deliver a free mp3 encoder legally. (If anyone knows a "hole", please let me know. (not the available source code - this is not appropriate: the encoders available as source code - most of them based on the ISO reference implementation - create bad quality mp3's and the licence doesn't allow the use of such encoders!)) The Tritonus team is working on an interface to the open source encoder LAME. Like that people who do not fear licence problems can download LAME as a separate package and link it to Java Sound. (Florian) I want to convert a PCM encoded byte[] to a uLaw byte[] When you are processing streams, read the documentation of javax.sound.sampled.AudioSystem. There are functions like getAudioInputStream(AudioFormat, AudioInputStream) that do the conversion for you. In case you absolutely want to do the conversion "by hand", look at how Tritonus is doing it: have a look at the file TConversionTool.java. (Florian) Is there support for RealAudio in Java Sound? There isn't, and it doesn't look like there will be in the near future. RealAudio is a proprietary format; there is no specification available to the public. Due to that, it's hard to implement support for it. If you want to change this situation, bug RealNetworks to publish specs (politely, please). (Matthias) Is there support for GSM in Java Sound? Yes, you can download a service provider plug-in for GSM from Java Sound Plugins. Since this implementation is pure-java, it can be used with any Java Sound implementation on any platform. For examples of using the GSM plug-in, see the section "dealing with encodings" in the Java Sound Examples. (Matthias) Java Sound supports a format called RMF. Where can I get documentation about this format? You can't. RMF (Rich Music Format) is a proprietary format designed by beatnik (www.beatnik.com). They don't release any specs to the public. By the way, it's not true for all Java Sound implementations to support RMF. Tritonus doesn't for the above reason. Instead, it will support MPEG-4 Structured Audio. I want to read in a vox file and save it as wav file Probably it's simplest to do all by yourself: use a RandomAccessFile or similar to open the vox file, parse the headers, etc. You need to know the vox file format, you can find many documents specifying it on the Internet. To create a wave file from that, create a AudioFileFormat instance with the format read from the vox-header and supply an InputStream with the audi data of the vox file. You can then use AudioSystem.write to write a wav file. (Florian) MIDI MIDI input seems not to work with the Sun jdk1.3. The Sun jdk1.3 does not implement MIDI IN. Alternatives are: JavaMIDI by Robert Marsanyi Wire by Niels Gorisse MidiPort by Jrg Prante. [TODO: URL] Each of this is a simple library written for Windows. Tritonus has an almost complete MIDI implementation. If you are running Linux, just install Tritonus. I you are using Windows95/98, there is an experimental add-on to the Sun jdk1.3 that can be installed with the Sun jdk1.3. Download it. (Matthias) I have unstable timing when playing back MIDI notes Java Sounds synthesizer is a virtual synthesizer - it uses your soundcard's audio out and creates the sounds in software. That is why there is a delay: audio data is quite huge compared to midi data (e.g. 5 bytes compared to 88200 bytes for one note). Audio data is put in blocks of a number of samples to the soundcard. When the blocks are 23ms long, you have at least 23 ms delay. Another source of delay comes from moving these data to the soundcard. Better soundcards, and especially PCI soundcards can do the memory transfer very fast. There is also more software overhead for audio data - obviously it takes more time to calculate and treat audio data than MIDI data. I cannot give an authoritative answer to the problem, why the delay changes. It may be due to a block-wise implementation of the internal Java Sound synthesizer: as the audio data is always pushed in blocks to the soundcard, it may be that MIDI events are always synthesized from the start of a block. (I just wrote (for testing purposes) a drum machine that works like this). This results in unequal delay. I am not sure about this "theory", as playing a midi file seems to have perfect timing (i.e. midi notes may start inside a block). Let's see whether the programmers of the synthesizer engine respond. (Florian) Java Sound in Applets I heared that signing applets is needed to record sound. Is this true? Almost true. Performance issues Is it possible to apply an FFT transform in real time under Java ? At least for JIT compilers, Java is very fast (under certain conditions it reaches or tops C++ performance!) - and I think even on no-JIT compilers, FFT analysis is no problem in real time, of course depending on available processor power and resources. (Florian) How do I reduce latency - or- I want to record sound and simultaneously play it back without delay You'll never be able to completely remove latency. Digital audio on computers is processed in "chunks", i.e. a small number of samples. When recording, you have to wait until one chunk is filled, then it gets passed to your application. So there is a minimum delay of the time of a chunk latency for recording. For playback the same "problem": the soundcard gets chunks from the application, so when one chunk is passed, the soundcard starts playing with the first sample of the chunk and it takes the time of the chunk that the last samples has been played. So, for playback you'll get the same delay. Added to that, the software (i.e. the different hardware layers copying chunks, etc.) and the hardware (hardware latency) add to the total delay. There are approaches like DirectSound, ASIO or Alsa that all try to minimize the software part's latency and to allow very small chunks. When used efficiently on high-quality soundcards, an audio loop is possible with a barely noticeable delay (e.g. 20ms). Java Sound (and therefore also JMF) actually adds one layer to the software part, so latency is slightly increased compared to native audio applications. You control the chunk size with the buffer size argument when constructing a SourceDataLine or TargetDataLine in Java Sound. I don't know about JMF's concepts. I also experienced some problems with Java Sound recording when using small buffers (like 1024 samples at 44KHz). (Florian) I want to provide successive multi track recording: I record new channels while playing back all previously recorded channels. However, I get synchronization problems, there are different delays The delay, of when the data arrives regarded to when you started recording, should be quite fixed. However, recording and playback may have different delays. The delays depend on the soundcard, the operating system (including the sound card drivers) and the implementation of Java Sound you use (and also a bit on what JDK you use). Also, the Java Sound API does not provide means for querying the device's latency. This would be quite difficult anyway for the Java Sound subsystem. However, normal soundcards have very little hardware delay (even the cheap ones), so once they receive the command to start recording, they really start it in a matter of some milliseconds - typically 20-30ms. Using the soundcard via Java Sound, there are many layers until the data arrives in your program, so some delay is added. However, I haven't noticed a relevant delay when recording. I haven't tried to do your approach of measuring the delay, though. So what you should is, is to call the start() method both on TargetDataLine and SourceDataLine "at once" with the minimum overhead possible. Notice that the buffers of the recording line arrive when they have been finished recording (i.e. when the amount of time has been elapsed), while playback lines need a buffer prior that they are played. This may not be obvious at first. So when you do record and playback at once, the first received block from the recording line corresponds in time to the first played buffer (which has been submitted right with "start"). For playback of the 2 files, you should not use 2 playback lines, but mix them from your program. Like that, you can at least control the exact sample-delay of the 2 playback lines and adjust it (probably only possible by ear). These are handmade solutions. The "real" solution is to make use of Mixer.synchronize. This is the proposed solution to your problem from the Java Sound API. Like that you can synchronize the recording line and the playback line - or the 2 playback lines. However, it seems that it isn't implemented in current versions of Java Sound (although I haven't tested it). (Florian) Other resources I'm looking for books on Java Sound. There are currently no books on Java Sound. There is a book covering some DSP algorithms in Java: 'Digital Audio with Java' by Craig A. Lindley [TODO: JMF books] (Matthias) Where can I find information on the Java Sound API? Look at http://java.sun.com/products/java-media/sound/. (Matthias) Where can I find information on JMF (the Java Media Framework)? Look at http://java.sun.com/products/java-media/jmf. (Matthias) What mail lists are relevent to Java Sound? JAVASOUND-INTEREST@JAVA.SUN.COM To subscribe, send email to listserv@java.sun.com containing the following line in the message body (NOT in the subject line!): signon javasound-interest What newsgroups are relevent to Java Sound? There is no newsgroup devoted to Java Sound, but these might help: comp.lang.java comp.lang.java.programmer comp.music.midi comp.sys.ibm.pc.soundcard.music comp.sys.ibm.pc.soundcard.tech comp.sys.ibm.pc.soundcard.* where '*' is your favorite soundcard maker Digital audio basics What is endianess/big endian/little endian? Most common computers have their memory organized in units of 8 bits, called a byte. The bytes can be adressed by ordinal numbers, starting with zero. (The harware organization of the memory is often in rows of 16, 32, 64, 128 or even more bits. But the instruction set of the processor still gives you the view of the byte-organized memory.) If you want to store a value that needs more than 8 bits, the question arises how the bits of the value are divided in bytes and stored in memory. If you have have a value with 16 bits, there is not much discussion that it has to be divided into two groups: bit 0 to 7 and bits 8 to 15. But then, the fight starts. Some CPUs store the first group (bit 0 to 7) in the byte with the lower address and the second group (bits 8 to 15) in the byte with the higher address. This schema is called little-endian. As an example, all Intel CPUs are little-endian. Other types of CPUs do it the other way round, which is called big-endian. Sparc and PowerPC (Motorola) CPUs are big-endian. (Matthias) Misc My Java Sound program does not exit when leaving the main() method By default, the java virtual machine terminates when all threads have terminated and the main function has also been exited. It seems that Java Sound's audio subsystem creates threads which remain, so you have to call explicitely System.exit(int). (Florian) I installed Tritonus on a Sun jdk1.3.0 and I still get the behaviour of Sun's Java Sound implementation. Using Tritonus under jdk1.3.0 is a bit tricky. The point is that by installing Tritonus you are just adding Tritonus' mixers, converters and other service providers to the ones of Sun's Java Sound implementation. Especially, Sun's mixing engine is still the default mixer. To use Tritonus' mixers, you have to select the mixer in your program manually: get the respective Mixer object from AudioSystem, and allocate the lines from this Mixer object. The same is true for MidiDevices. It's possible to use Tritonus' javax.sound.* classes by putting them into the boot classpath *before* rt.jar. But this still leaves you with Sun's service providers. Getting rid of them required to change the service provider configuration files inside rt.jar or other, even more fancy measures. The alternative way out of the hell is to use a jdk1.2.X, where Tritonus is the only Java Sound implementation. (Matthias) I tried to compile AudioPlayer (or another program from the Java Sound Examples). I get errors about gnu.getopt.Getopt not being available. Download GNU getopt and install it. Alternatively, there are simplified versions of some examples that do not use GNU getopt (For instance, SimpleAudioPlayer instead of AudioPlayer). (Matthias) I want to have a simple test if Java Sound is available Try that:
public static boolean JavaSoundInstalled() {
    boolean result=false;
    try
 {
        result = javax.sound.sampled.AudioSystem.getMixerInfo().length > 0;
    } catch (Throwable t) {}
}
(Florian) I want to use com.sun.* classes. Is there any documentation ? No, and it is strongly advised to not use them: these are internal classes of the specific implementation, and in other JVM's or even in future JVM's from Sun they may not be present. (Florian) I want to play a wave file in an JDK1.1.x applet First of all, JDK1.1 generally only provides -law, 8000Hz mono playback. It does not provide wave file playback directly. And for playback of audio data of the application, there are only the "unofficial" sun.audio.* classes. So you'd need to write your own classes that read in the wave files, convert the sound data to ulaw and then use the sun.audio.* classes to play them. For code that parses wav files and does ulaw conversion look at tritonus' source code: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/tritonus/src/org/tritonus/sampled/file/?cvsroot=tritonus (WaveAudioFileReader.java) and http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/tritonus/src/org/tritonus/sampled/?cvsroot=tritonus (TConversionTool.java). Click on the version number to see the source code. Tritonus classes are under the LGPL licence. Regarding sun.audio.* classes: it is discouraged to use them. I heard that they don't work anymore as expected in jdk1.3. My applets using them work well from jdk1.0 to jdk1.1 and in all browsers that I could put my hand on. (Florian) When I call AudioSystem.getAudioFileTypes(), I receive an empty array. What's wrong? This is a bug in the Sun jdk1.3.0. It always returns an empty array if there are no service provider plug-ins. If you have service provider plug-ins installed, it returns only the types supported by the plugins, not the "built-in" ones. The Tritonus implementation of this method works as expected. (Matthias) I want to use Mixer.synchronize(), but it seems to have no effect. Synchronization isn't implemented in any known Java Sound implementation. It is on my TODO list for Tritonus. (Matthias)
libtritonus-java-20070428/src/0000755000175000017500000000000010621572726016014 5ustar twernertwernerlibtritonus-java-20070428/src/classes/0000755000175000017500000000000010621572377017453 5ustar twernertwernerlibtritonus-java-20070428/src/classes/javax/0000755000175000017500000000000010621572361020555 5ustar twernertwernerlibtritonus-java-20070428/src/classes/javax/sound/0000755000175000017500000000000010621572371021706 5ustar twernertwernerlibtritonus-java-20070428/src/classes/javax/sound/midi/0000755000175000017500000000000010621572366022634 5ustar twernertwernerlibtritonus-java-20070428/src/classes/javax/sound/midi/spi/0000755000175000017500000000000010621572367023430 5ustar twernertwernerlibtritonus-java-20070428/src/classes/javax/sound/midi/spi/MidiDeviceProvider.java0000644000175000017500000000274210172422337030005 0ustar twernertwerner/* * MidiDeviceProvider.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package javax.sound.midi.spi; import javax.sound.midi.MidiDevice; public abstract class MidiDeviceProvider { public boolean isDeviceSupported(MidiDevice.Info info) { MidiDevice.Info[] deviceInfos = getDeviceInfo(); for (int i = 0; i < deviceInfos.length; i++) { if (deviceInfos[i].equals(info)) { return true; } } return false; } public abstract MidiDevice.Info[] getDeviceInfo(); public abstract MidiDevice getDevice(MidiDevice.Info info); } /*** MidiDeviceProvider.java ***/ libtritonus-java-20070428/src/classes/javax/sound/midi/spi/MidiFileReader.java0000644000175000017500000000366510172422337027102 0ustar twernertwerner/* * MidiFileReader.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package javax.sound.midi.spi; import java.io.InputStream; import java.io.IOException; import java.io.File; import java.net.URL; import javax.sound.midi.InvalidMidiDataException; import javax.sound.midi.MidiFileFormat; import javax.sound.midi.Sequence; public abstract class MidiFileReader { public abstract MidiFileFormat getMidiFileFormat(InputStream inputStream) throws InvalidMidiDataException, IOException; public abstract MidiFileFormat getMidiFileFormat(URL url) throws InvalidMidiDataException, IOException; public abstract MidiFileFormat getMidiFileFormat(File file) throws InvalidMidiDataException, IOException; public abstract Sequence getSequence(InputStream inputStream) throws InvalidMidiDataException, IOException; public abstract Sequence getSequence(URL url) throws InvalidMidiDataException, IOException; public abstract Sequence getSequence(File file) throws InvalidMidiDataException, IOException; } /*** MidiFileReader.java ***/ libtritonus-java-20070428/src/classes/javax/sound/midi/spi/MidiFileWriter.java0000644000175000017500000000377510374074734027166 0ustar twernertwerner/* * MidiFileWriter.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package javax.sound.midi.spi; import java.io.File; import java.io.IOException; import java.io.OutputStream; import javax.sound.midi.Sequence; public abstract class MidiFileWriter { public abstract int[] getMidiFileTypes(); public abstract int[] getMidiFileTypes(Sequence sequence); public boolean isFileTypeSupported(int nFileType) { int[] anFileTypes = getMidiFileTypes(); for (int i = 0; i < anFileTypes.length; i++) { if (anFileTypes[i] == nFileType) { return true; } } return false; } public boolean isFileTypeSupported(int nFileType, Sequence sequence) { int[] anFileTypes = getMidiFileTypes(sequence); for (int i = 0; i < anFileTypes.length; i++) { if (anFileTypes[i] == nFileType) { return true; } } return false; } public abstract int write(Sequence sequence, int nFileType, OutputStream outputStream) throws IOException; public abstract int write(Sequence sequence, int nFileType, File outputFile) throws IOException; } /*** MidiFileWriter.java ***/ libtritonus-java-20070428/src/classes/javax/sound/midi/spi/SoundbankReader.java0000644000175000017500000000310410172422337027330 0ustar twernertwerner/* * SoundbankReader.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package javax.sound.midi.spi; import java.io.File; import java.io.InputStream; import java.io.IOException; import java.net.URL; import javax.sound.midi.Soundbank; import javax.sound.midi.InvalidMidiDataException; public abstract class SoundbankReader { public abstract Soundbank getSoundbank(InputStream inputStream) throws InvalidMidiDataException, IOException; public abstract Soundbank getSoundbank(URL url) throws InvalidMidiDataException, IOException; public abstract Soundbank getSoundbank(File file) throws InvalidMidiDataException, IOException; } /*** SoundbankReader.java ***/ libtritonus-java-20070428/src/classes/javax/sound/midi/ControllerEventListener.java0000644000175000017500000000230010172422322030310 0ustar twernertwerner/* * ControllerEventListener.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package javax.sound.midi; import java.util.EventListener; public interface ControllerEventListener extends EventListener { public void controlChange(ShortMessage message); } /*** ControllerEventListener.java ***/ libtritonus-java-20070428/src/classes/javax/sound/midi/Instrument.java0000644000175000017500000000247210172422337025645 0ustar twernertwerner/* * Instrument.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package javax.sound.midi; public abstract class Instrument extends SoundbankResource { private Patch m_patch; protected Instrument(Soundbank soundbank, Patch patch, String strName, Class dataClass) { super(soundbank, strName, dataClass); m_patch = patch; } public Patch getPatch() { return m_patch; } } /*** Instrument.java ***/ libtritonus-java-20070428/src/classes/javax/sound/midi/InvalidMidiDataException.java0000644000175000017500000000237610172422337030342 0ustar twernertwerner/* * InvalidMidiDataException.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package javax.sound.midi; public class InvalidMidiDataException extends Exception { public InvalidMidiDataException() { super(); } public InvalidMidiDataException(String sMessage) { super(sMessage); } } /*** InvalidMidiDataException.java ***/ libtritonus-java-20070428/src/classes/javax/sound/midi/MetaEventListener.java0000644000175000017500000000224410172422337027070 0ustar twernertwerner/* * MetaEventListener.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package javax.sound.midi; import java.util.EventListener; public interface MetaEventListener extends EventListener { public void meta(MetaMessage message); } /*** MetaEventListener.java ***/ libtritonus-java-20070428/src/classes/javax/sound/midi/MetaMessage.java0000644000175000017500000000637310374142163025674 0ustar twernertwerner/* * MetaMessage.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package javax.sound.midi; import org.tritonus.share.midi.MidiUtils; /** Container for meta messages. This class is used to represent meta events that are commonly stored in MIDI files. Note that normally, meta messages are not meaningful when sent over the wire to a MIDI instrument.

The way these messages are separated into bytes for storing in {@link MidiMessage#data data} is the same as specified in the Standard MIDI File Format, except that no delta time in ticks is stored here. */ public class MetaMessage extends MidiMessage { /** Status byte for meta messages (value 255, 0xff). */ public static final int META = 0xFF; /** TODO: */ private static final byte[] DEFAULT_MESSAGE = {(byte) META, 0x2f, 0}; /** Create a container for a MIDI meta message. This constructor does not create an object containing a legal MIDI message. You have to use one of the setMessage() methods. Before calling one of these methods, calling retrieval methods (getLength(), getMessage(), getStatus(), getType(), getData()) may have undesired results. @see #setMessage(int, byte[], int) */ public MetaMessage() { super(null); } /** TODO: */ protected MetaMessage(byte[] abData) { super(abData); } /** TODO: */ public void setMessage(int nType, byte[] abData, int nDataLength) throws InvalidMidiDataException { if (nType > 127) { throw new InvalidMidiDataException("type must not exceed 127"); } //byte[] abLength = MidiUtils.getVariableLengthQuantity(nDataLength); int nCompleteLength = 2 + nDataLength; byte[] abCompleteData = new byte[nCompleteLength]; abCompleteData[0] = (byte) META; abCompleteData[1] = (byte) nType; System.arraycopy(abData, 0, abCompleteData, 2, nDataLength); super.setMessage(abCompleteData, nCompleteLength); } /** TODO: */ public int getType() { int nType = MidiUtils.getUnsignedInteger(getMessage()[1]); return nType; } /** TODO: */ public byte[] getData() { int nDataLength = getLength() - 2; byte[] abData = new byte[nDataLength]; System.arraycopy(getMessage(), 2, abData, 0, nDataLength); return abData; } /** TODO: */ public Object clone() { // TODO: re-check byte[] abData = getMessage(); MetaMessage message = new MetaMessage(abData); return message; } } /*** MetaMessage.java ***/ libtritonus-java-20070428/src/classes/javax/sound/midi/MidiChannel.java0000644000175000017500000000405210172422337025644 0ustar twernertwerner/* * MidiChannel.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package javax.sound.midi; public interface MidiChannel { public void noteOn(int nNoteNumber, int nVelocity); public void noteOff(int nNoteNumber, int nVelocity); public void noteOff(int nNoteNumber); public void setPolyPressure(int nNoteNumber, int nPressure); public int getPolyPressure(int nNoteNumber); public void setChannelPressure(int nPressure); public int getChannelPressure(); public void controlChange(int nController, int nValue); public int getController(int nController); public void programChange(int nProgram); public void programChange(int nBank, int nProgram); public int getProgram(); public void setPitchBend(int nBend); public int getPitchBend(); public void resetAllControllers(); public void allNotesOff(); public void allSoundOff(); public boolean localControl(boolean bOn); public void setMono(boolean bMono); public boolean getMono(); public void setOmni(boolean bOmni); public boolean getOmni(); public void setMute(boolean bMute); public boolean getMute(); public void setSolo(boolean bSolo); public boolean getSolo(); } /*** MidiChannel.java ***/ libtritonus-java-20070428/src/classes/javax/sound/midi/MidiDevice.java0000644000175000017500000000511710172422337025476 0ustar twernertwerner/* * MidiDevice.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package javax.sound.midi; import java.util.List; public interface MidiDevice { public MidiDevice.Info getDeviceInfo(); public void open() throws MidiUnavailableException; public void close(); public boolean isOpen(); public long getMicrosecondPosition(); public int getMaxReceivers(); public int getMaxTransmitters(); public Receiver getReceiver() throws MidiUnavailableException; public Transmitter getTransmitter() throws MidiUnavailableException; public List getReceivers(); public List getTransmitters(); public static class Info { private String m_strName; private String m_strVendor; private String m_strDescription; private String m_strVersion; protected Info(String strName, String strVendor, String strDescription, String strVersion) { m_strName = strName; m_strVendor = strVendor; m_strDescription = strDescription; m_strVersion = strVersion; } public final boolean equals(Object obj) { return super.equals(obj); } public final int hashCode() { return super.hashCode(); } public final String getName() { return m_strName; } public final String getVendor() { return m_strVendor; } public final String getDescription() { return m_strDescription; } public final String getVersion() { return m_strVersion; } public final String toString() { return super.toString() + "[name=" + getName() + ", vendor=" + getVendor() + ", description=" + getDescription() + ", version=" + getVersion() + "]"; } } } /*** MidiDevice.java ***/ libtritonus-java-20070428/src/classes/javax/sound/midi/MidiEvent.java0000755000175000017500000000270410172422337025362 0ustar twernertwerner/* * MidiEvent.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package javax.sound.midi; // NOTE: sun implementation is not serializable public class MidiEvent implements java.io.Serializable { private MidiMessage m_message; private long m_lTick; public MidiEvent(MidiMessage message, long lTick) { m_message = message; m_lTick = lTick; } public MidiMessage getMessage() { return m_message; } public long getTick() { return m_lTick; } public void setTick(long lTick) { m_lTick = lTick; } } /*** MidiEvent.java ***/ libtritonus-java-20070428/src/classes/javax/sound/midi/MidiFileFormat.java0000644000175000017500000000556210172422337026333 0ustar twernertwerner/* * MidiFileFormat.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999 - 2004 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package javax.sound.midi; import java.util.Collections; import java.util.HashMap; import java.util.Map; public class MidiFileFormat { public static final int UNKNOWN_LENGTH = -1; protected int type; protected float divisionType; protected int resolution; protected int byteLength; protected long microsecondLength; private Map m_properties; private Map m_unmodifiableProperties; public MidiFileFormat(int nType, float fDivisionType, int nResolution, int nByteLength, long lMicrosecondLength) { this(nType, fDivisionType, nResolution, nByteLength, lMicrosecondLength, null); } public MidiFileFormat(int nType, float fDivisionType, int nResolution, int nByteLength, long lMicrosecondLength, Map properties) { type = nType; divisionType = fDivisionType; resolution = nResolution; byteLength = nByteLength; microsecondLength = lMicrosecondLength; /* Here, we make a shallow copy of the map. It's unclear if this is sufficient (or if a deep copy should be made). */ m_properties = new HashMap(); if (properties != null) { m_properties.putAll(properties); } m_unmodifiableProperties = Collections.unmodifiableMap(m_properties); } public int getType() { return type; } public float getDivisionType() { return divisionType; } public int getResolution() { return resolution; } public int getByteLength() { return byteLength; } public long getMicrosecondLength() { return microsecondLength; } public Map properties() { return m_unmodifiableProperties; } public Object getProperty(String key) { return m_properties.get(key); } protected void setProperty(String key, Object value) { m_properties.put(key, value); } } /*** MidiFileFormat.java ***/ libtritonus-java-20070428/src/classes/javax/sound/midi/MidiMessage.java0000644000175000017500000001627410172422337025671 0ustar twernertwerner/* * MidiMessage.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999 - 2002 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package javax.sound.midi; import org.tritonus.share.TDebug; import org.tritonus.share.midi.MidiUtils; /** Base class for MIDI messages. @author Matthias Pfisterer */ public abstract class MidiMessage implements Cloneable { /** The data of the message. This array contains the message separated into bytes. The storage format used for this array follows the way messages are sent via a MIDI cable or stored in a standard MIDI file. See the subclasses of MidiMessage to get more information on the required storage format for each type.

At any time after the execution of this class' constructor, this value must refer to an array with at least one element. Especially, null is not allowed. The array may contain more bytes than used to store the MIDI message. The variable {@link #length length} indicates the number of valid bytes. The content of the additional bytes has to be considered implementation-specific.

In this implementation, the length of data is always equal to the value of {@link #length length}. However, this is not a specification requirement. Accessing this member from subclasses is highly discouraged. Subclasses should use the constructor or {@link #setMessage(byte[], int) setMessage} to modify the content and {@link #getMessage() getMessage()} to retrieve it. @see #setMessage(byte[], int) @see #getMessage() */ protected byte[] data; /** The length of the message. This value represents the number of bytes in the array {@link #data data} that are valid. At any time after the execution of this class' constructor, this value is guaranteed to be greater or equal to one. Additinally, with the exception of while the control flow is inside this class' method {@link #setMessage(byte[], int) setMessage()} the value is guaranteed to be as least as big as the length of {@link #data data}. It may be less than the length of {@link #data data} in cases where {@link #data data} contains additional (invalid) bytes.

Accessing this member from subclasses is highly discouraged. Subclasses should use the constructor or {@link #setMessage(byte[], int) setMessage()} to modify the length and {@link #getLength() getLength()} to retrieve it. @see #getLength() */ protected int length; /** Constructs a MidiMessage. The passed array is used to initialize {@link #data data}. {@link #length length} is initialized to the length of the passed array. Note that a copy of the passed array is made.

This constructor does not use {@link #setMessage(byte[], int) setMessage()}. So it is unaffected by overriding setMessage().

It is unclear if the argument is allowed to be null. This implementation allows it, resulting in {@link #data data} being null, too. @param abData The data to use to construct the MIDI message. */ protected MidiMessage(byte[] abData) { if (abData != null) { copyToData(abData, abData.length); } } /** Initializes the data of the message. This method sets the data of the MIDI message. nLength bytes of abData are copied to a newly created array, which is set as {@link #data data}. {@link #length length} is initialized to the value of nLength.

Open points: should we specify that this class' version of setMessage() (not the ones of derived classes) never throws an exception? Otherwise, we have to specify the cases where exceptions are thrown. For instance: abData == null, abData.length < nLength, ... @param abData The bytes to use as MIDI message. This array may contain trailing invalid bytes. nLength gives the number of valid bytes. This means that the length of abData has to be equal or greater than nLength. @param nLength The length of the MIDI message. This is equal to the number of valid bytes in abData. This value may be less than the length of abData. In this case, the remaining bytes have to be considered invalid. This means that the value of nLength has to be equal or less than the length of abData. */ protected void setMessage(byte[] abData, int nLength) throws InvalidMidiDataException { copyToData(abData, nLength); } /** TODO: */ private void copyToData(byte[] abData, int nLength) { synchronized (this) { data = new byte[nLength]; System.arraycopy(abData, 0, data, 0, nLength); length = nLength; } } /** Return the complete message. This method makes a copy of {@link #data data} and returns a reference to the copy. The returned array contains only the bytes that form the MIDI message, even if {@link #data data} contains additional invalid bytes. This requirement also means that the length of the returned array is equal to {@link #length length} and equal to the value returned by {@link #getLength() getLength()}. @return An array of bytes representing the MIDI message. */ public byte[] getMessage() { byte[] abData = new byte[length]; System.arraycopy(data, 0, abData, 0, length); return abData; } /** Returns the status byte of the message. This method returns the first byte of {@link #data data}, which is always the status byte. @return The status byte of the MIDI message stored in this object. */ public int getStatus() { int nStatus = MidiUtils.getUnsignedInteger(data[0]); return nStatus; } /** Returns the length of the whole message in bytes. This returns the value of the member {@link #length length}. The value returned by this method is always equal to the length of the array returned by {@link #getMessage() getMessage()}. @return The length of the MIDI message in bytes. @see #length @see #getMessage() */ public int getLength() { return length; } /** Create a copy of this MIDI message. @return A new MidiMessage object that is a copy of this one. */ public abstract Object clone(); /** Print content of data[]. This method is used for debugging. */ private void outputData() { String strMessage = "MidiMessage.outputData(): data: ["; for (int i = 0; i < data.length; i++) { strMessage += (data[i] + ", "); } strMessage += "]"; TDebug.out(strMessage); } } /*** MidiMessage.java ***/ libtritonus-java-20070428/src/classes/javax/sound/midi/MidiSystem.java0000644000175000017500000003556610374074734025606 0ustar twernertwerner/* * MidiSystem.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999 - 2004 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package javax.sound.midi; import java.io.File; import java.io.InputStream; import java.io.IOException; import java.io.OutputStream; import java.net.URL; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Set; import java.util.Iterator; import javax.sound.midi.InvalidMidiDataException; import javax.sound.midi.spi.MidiDeviceProvider; import javax.sound.midi.spi.MidiFileReader; import javax.sound.midi.spi.MidiFileWriter; import org.tritonus.core.TMidiConfig; import org.tritonus.share.TDebug; import org.tritonus.share.ArraySet; public class MidiSystem { private static final MidiDevice.Info[] EMPTY_MIDIDEVICE_INFO_ARRAY = new MidiDevice.Info[0]; public static MidiDevice.Info[] getMidiDeviceInfo() { List deviceInfos = new ArrayList(); Iterator providers = TMidiConfig.getMidiDeviceProviders(); while (providers.hasNext()) { MidiDeviceProvider provider = (MidiDeviceProvider) providers.next(); MidiDevice.Info[] infos = provider.getDeviceInfo(); deviceInfos.addAll(Arrays.asList(infos)); } return deviceInfos.toArray(EMPTY_MIDIDEVICE_INFO_ARRAY); } public static MidiDevice getMidiDevice(MidiDevice.Info info) throws MidiUnavailableException { Iterator providers = TMidiConfig.getMidiDeviceProviders(); while (providers.hasNext()) { MidiDeviceProvider provider = (MidiDeviceProvider) providers.next(); if (provider.isDeviceSupported(info)) { return provider.getDevice(info); } } throw new IllegalArgumentException("no device found for " + info); } public static Receiver getReceiver() throws MidiUnavailableException { MidiDevice.Info info = TMidiConfig.getDefaultMidiOutDeviceInfo(); MidiDevice device = getMidiDevice(info); // to florian: try to comment out the following block if (!device.isOpen()) { device.open(); } // end of block to comment out Receiver receiver = device.getReceiver(); return receiver; } public static Transmitter getTransmitter() throws MidiUnavailableException { MidiDevice.Info info = TMidiConfig.getDefaultMidiInDeviceInfo(); MidiDevice device = getMidiDevice(info); // to florian: try to comment out the following block if (!device.isOpen()) { device.open(); } // end of block to comment out Transmitter transmitter = device.getTransmitter(); return transmitter; } public static Synthesizer getSynthesizer() throws MidiUnavailableException { MidiDevice.Info info = TMidiConfig.getDefaultSynthesizerInfo(); if (TDebug.TraceMidiSystem) { TDebug.out("MidiSystem.getSynthesizer(): using default synthesizer info: " + info); } Synthesizer synthesizer = (Synthesizer) getMidiDevice(info); return synthesizer; } public static Sequencer getSequencer() throws MidiUnavailableException { return getSequencer(true); } public static Sequencer getSequencer(boolean bConnected) throws MidiUnavailableException { MidiDevice.Info info = TMidiConfig.getDefaultSequencerInfo(); if (TDebug.TraceMidiSystem) { TDebug.out("MidiSystem.getSequencer(): using: " + info); } Sequencer sequencer = (Sequencer) getMidiDevice(info); if (bConnected) { Synthesizer synth = getSynthesizer(); synth.open(); sequencer.getTransmitter().setReceiver(synth.getReceiver()); } return sequencer; } public static Soundbank getSoundbank(InputStream inputStream) throws InvalidMidiDataException, IOException { return null; //TMidiConfig.getSoundbank(inputStream); } public static Soundbank getSoundbank(URL url) throws InvalidMidiDataException, IOException { return null; //TMidiConfig.getSoundbank(inputStream); } public static Soundbank getSoundbank(File file) throws InvalidMidiDataException, IOException { return null; //TMidiConfig.getSoundbank(inputStream); } public static MidiFileFormat getMidiFileFormat(InputStream inputStream) throws InvalidMidiDataException, IOException { Iterator readers = TMidiConfig.getMidiFileReaders(); while (readers.hasNext()) { MidiFileReader reader = (MidiFileReader) readers.next(); try { return reader.getMidiFileFormat(inputStream); } catch (IllegalArgumentException e) { if (TDebug.TraceAllExceptions) { TDebug.out(e); } } } throw new InvalidMidiDataException(); } public static MidiFileFormat getMidiFileFormat(URL url) throws InvalidMidiDataException, IOException { Iterator readers = TMidiConfig.getMidiFileReaders(); while (readers.hasNext()) { MidiFileReader reader = (MidiFileReader) readers.next(); try { return reader.getMidiFileFormat(url); } catch (IllegalArgumentException e) { if (TDebug.TraceAllExceptions) { TDebug.out(e); } } } throw new InvalidMidiDataException(); } public static MidiFileFormat getMidiFileFormat(File file) throws InvalidMidiDataException, IOException { Iterator readers = TMidiConfig.getMidiFileReaders(); while (readers.hasNext()) { MidiFileReader reader = (MidiFileReader) readers.next(); try { return reader.getMidiFileFormat(file); } catch (IllegalArgumentException e) { if (TDebug.TraceAllExceptions) { TDebug.out(e); } } } throw new InvalidMidiDataException(); } public static Sequence getSequence(InputStream inputStream) throws InvalidMidiDataException, IOException { Iterator readers = TMidiConfig.getMidiFileReaders(); while (readers.hasNext()) { MidiFileReader reader = (MidiFileReader) readers.next(); try { return reader.getSequence(inputStream); } catch (IllegalArgumentException e) { if (TDebug.TraceAllExceptions) { TDebug.out(e); } } } throw new InvalidMidiDataException(); } public static Sequence getSequence(URL url) throws InvalidMidiDataException, IOException { Iterator readers = TMidiConfig.getMidiFileReaders(); while (readers.hasNext()) { MidiFileReader reader = (MidiFileReader) readers.next(); try { return reader.getSequence(url); } catch (IllegalArgumentException e) { if (TDebug.TraceAllExceptions) { TDebug.out(e); } } } throw new InvalidMidiDataException(); } public static Sequence getSequence(File file) throws InvalidMidiDataException, IOException { Iterator readers = TMidiConfig.getMidiFileReaders(); if (TDebug.TraceMidiSystem) { TDebug.out("MidiSystem.getSequence(File): got readers: " + readers); } while (readers.hasNext()) { MidiFileReader reader = (MidiFileReader) readers.next(); if (TDebug.TraceMidiSystem) { TDebug.out("MidiSystem.getSequence(File): Trying MidiFileReader " + reader); } try { return reader.getSequence(file); } catch (IllegalArgumentException e) { if (TDebug.TraceAllExceptions) { TDebug.out(e); } } } if (TDebug.TraceMidiSystem) { TDebug.out("MidiSystem.getSequence(File): no appropriate MidiFileReader found, throwing exception"); } throw new InvalidMidiDataException(); } public static int[] getMidiFileTypes() { Set fileTypes = new ArraySet(); Iterator writers = TMidiConfig.getMidiFileWriters(); while (writers.hasNext()) { MidiFileWriter writer = writers.next(); int[] anTypes = writer.getMidiFileTypes(); for (int i = 0; i < anTypes.length; i++) { fileTypes.add(anTypes[i]); } } int[] anTypes = new int[fileTypes.size()]; Iterator types = fileTypes.iterator(); int nIndex = 0; while (types.hasNext()) { Integer type = types.next(); anTypes[nIndex] = type.intValue(); nIndex++; } return anTypes; } public static boolean isFileTypeSupported(int nFileType) { Iterator writers = TMidiConfig.getMidiFileWriters(); while (writers.hasNext()) { MidiFileWriter writer = writers.next(); boolean bIsSupported = writer.isFileTypeSupported(nFileType); if (bIsSupported) { return true; } } return false; } public static int[] getMidiFileTypes(Sequence sequence) { Set fileTypes = new ArraySet(); Iterator writers = TMidiConfig.getMidiFileWriters(); while (writers.hasNext()) { MidiFileWriter writer = writers.next(); int[] anTypes = writer.getMidiFileTypes(sequence); for (int i = 0; i < anTypes.length; i++) { fileTypes.add(anTypes[i]); } } int[] anTypes = new int[fileTypes.size()]; Iterator types = fileTypes.iterator(); int nIndex = 0; while (types.hasNext()) { Integer type = types.next(); anTypes[nIndex] = type.intValue(); nIndex++; } return anTypes; } public static boolean isFileTypeSupported(int nFileType, Sequence sequence) { Iterator writers = TMidiConfig.getMidiFileWriters(); while (writers.hasNext()) { MidiFileWriter writer = writers.next(); boolean bIsSupported = writer.isFileTypeSupported(nFileType, sequence); if (bIsSupported) { return true; } } return false; } /** MidiFileWriterAction for write(). */ private static class WriteMidiFileWriterAction implements MidiFileWriterAction { private Sequence m_sequence; private int m_fileType; private Object m_destination; private int m_nWritten; public WriteMidiFileWriterAction( Sequence sequence, int fileType, Object destination) { m_sequence = sequence; m_fileType = fileType; m_destination = destination; m_nWritten = -1; } public boolean handleMidiFileWriter( MidiFileWriter midiFileWriter) throws IOException { int nWritten = -1; // $$fb 2000-04-02: need to check whether this audioFileWriter is actually // capable of handling this file type ! if (!midiFileWriter.isFileTypeSupported(m_fileType)) { // do not interrupt the iteration return false; } try { if (m_destination instanceof OutputStream) { nWritten = midiFileWriter.write( m_sequence, m_fileType, (OutputStream) m_destination); } else if (m_destination instanceof File) { nWritten = midiFileWriter.write( m_sequence, m_fileType, (File) m_destination); } else { // TODO: debug message } m_nWritten = nWritten; // interrupt the iteration return true; } catch (IllegalArgumentException e) { if (TDebug.TraceMidiSystem || TDebug.TraceAllExceptions) { TDebug.out(e); } } // continue the iteration return false; } public int getWritten() { return m_nWritten; } } public static int write(Sequence sequence, int fileType, OutputStream outputStream) throws IOException { return writeImpl(sequence, fileType, outputStream); } public static int write(Sequence sequence, int fileType, File file) throws IOException { return writeImpl(sequence, fileType, file); } private static int writeImpl(Sequence sequence, int fileType, Object destination) throws IOException { WriteMidiFileWriterAction action = new WriteMidiFileWriterAction( sequence, fileType, destination); doMidiFileWriterIteration(action); int nWritten = action.getWritten(); if (nWritten == -1) { throw new IllegalArgumentException("format not supported"); } else { return nWritten; } } /* public static int write(Sequence sequence, int nFileType, OutputStream outputStream) throws IOException { Iterator writers = TMidiConfig.getMidiFileWriters(); while (writers.hasNext()) { MidiFileWriter writer = (MidiFileWriter) writers.next(); try { return writer.write(sequence, nFileType, outputStream); } catch (IllegalArgumentException e) { if (TDebug.TraceAllExceptions) { TDebug.out(e); } } } throw new IllegalArgumentException (); } public static int write(Sequence sequence, int nFileType, File file) throws IOException { Iterator writers = TMidiConfig.getMidiFileWriters(); while (writers.hasNext()) { MidiFileWriter writer = (MidiFileWriter) writers.next(); try { return writer.write(sequence, nFileType, file); } catch (IllegalArgumentException e) { if (TDebug.TraceAllExceptions) { TDebug.out(e); } } } throw new IllegalArgumentException (); } */ //---------------------------------------------------------- private static interface MidiFileReaderAction { public boolean handleMidiFileReader(MidiFileReader audioFileReader) throws IOException; } /** Iterates over the available MidiFileReaders. * For each MidiFileReader, the mathod handleMidiFileReader() of * the passed MidiFileReaderAction is called with the MidiFileReader * in question as the only argument. */ private static void doMidiFileReaderIteration( MidiFileReaderAction action) throws IOException { Iterator audioFileReaders = TMidiConfig.getMidiFileReaders(); boolean bCompleted = false; while (audioFileReaders.hasNext() && ! bCompleted) { MidiFileReader audioFileReader = audioFileReaders.next(); if (TDebug.TraceMidiSystem) { TDebug.out("MidiSystem.doMidiFileReaderIteration(): handling MidiFileReader: " + audioFileReader); } bCompleted = action.handleMidiFileReader(audioFileReader); } } private static interface MidiFileWriterAction { public boolean handleMidiFileWriter(MidiFileWriter audioFileWriter) throws IOException; } /** Iterates over the available MidiFileWriters. * For each MidiFileWriter, the mathod handleMidiFileWriter() of * the passed MidiFileWriterAction is called with the MidiFileWriter * in question as the only argument. */ private static void doMidiFileWriterIteration( MidiFileWriterAction action) throws IOException { Iterator audioFileWriters = TMidiConfig.getMidiFileWriters(); boolean bCompleted = false; while (audioFileWriters.hasNext() && ! bCompleted) { MidiFileWriter audioFileWriter = audioFileWriters.next(); if (TDebug.TraceMidiSystem) { TDebug.out("MidiSystem.doMidiFileWriterIteration(): handling MidiFileWriter: " + audioFileWriter); } bCompleted = action.handleMidiFileWriter(audioFileWriter); } } } /*** MidiSystem.java ***/ libtritonus-java-20070428/src/classes/javax/sound/midi/MidiUnavailableException.java0000644000175000017500000000240010172422337030371 0ustar twernertwerner/* * MidiUnavailableException.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package javax.sound.midi; public class MidiUnavailableException extends Exception { public MidiUnavailableException() { super(); } public MidiUnavailableException(String sMessage) { super(sMessage); } } /*** MidiUnavailableException.java ***/ libtritonus-java-20070428/src/classes/javax/sound/midi/Patch.java0000644000175000017500000000242610172422337024533 0ustar twernertwerner/* * Patch.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package javax.sound.midi; public class Patch { private int m_nBank; private int m_nProgram; public Patch(int nBank, int nProgram) { m_nBank = nBank; m_nProgram = nProgram; } public int getBank() { return m_nBank; } public int getProgram() { return m_nProgram; } } /*** Patch.java ***/ libtritonus-java-20070428/src/classes/javax/sound/midi/Receiver.java0000644000175000017500000000217210172422337025236 0ustar twernertwerner/* * Receiver.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package javax.sound.midi; public interface Receiver { public void send(MidiMessage message, long lTimeStamp); public void close(); } /*** Receiver.java ***/ libtritonus-java-20070428/src/classes/javax/sound/midi/Sequence.java0000644000175000017500000000663410374104303025243 0ustar twernertwerner/* * Sequence.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999, 2000 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package javax.sound.midi; import java.util.Iterator; import java.util.Vector; // TODO: some synchronization now obsolete? (after change from ArrayList to Vector) public class Sequence { public static final float PPQ = 0.0F; public static final float SMPTE_24 = 24.0F; public static final float SMPTE_25 = 25.0F; public static final float SMPTE_30DROP = 29.97F; public static final float SMPTE_30 = 30.0F; private static final Track[] EMPTY_TRACK_ARRAY = new Track[0]; protected float divisionType; protected int resolution; protected Vector tracks; public Sequence(float fDivisionType, int nResolution) throws InvalidMidiDataException { this(fDivisionType, nResolution, 0); } public Sequence(float fDivisionType, int nResolution, int nNumTracks) throws InvalidMidiDataException { if (fDivisionType == PPQ || fDivisionType == SMPTE_24 || fDivisionType == SMPTE_25 || fDivisionType == SMPTE_30DROP || fDivisionType == SMPTE_30) { divisionType = fDivisionType; } else { throw new InvalidMidiDataException("Invalid division type: " + fDivisionType); } resolution = nResolution; tracks = new Vector(); for (int i = 0; i < nNumTracks; i++) { createTrack(); } } public float getDivisionType() { return divisionType; } public int getResolution() { return resolution; } @SuppressWarnings("unchecked") public Track createTrack() { Track track = new Track(); synchronized (tracks) { tracks.add(track); } return track; } public boolean deleteTrack(Track track) { synchronized (tracks) { return tracks.remove(track); } } @SuppressWarnings("unchecked") public Track[] getTracks() { synchronized (tracks) { return (Track[]) tracks.toArray(EMPTY_TRACK_ARRAY); } } public long getMicrosecondLength() { if (getDivisionType() != PPQ) { return (long) (getTickLength() * 1000000 / (getDivisionType() * getResolution())); } else { // TODO: find all tempo change events and calculate length according to them. return -1; } } public long getTickLength() { long lLength = 0; Iterator tracksIterator = tracks.iterator(); while (tracksIterator.hasNext()) { Track track = (Track) tracksIterator.next(); lLength = Math.max(lLength, track.ticks()); } return lLength; } // make abstract ?? public Patch[] getPatchList() { // TODO: // not implemented in sun version, too return new Patch[0]; } } /*** Sequence.java ***/ libtritonus-java-20070428/src/classes/javax/sound/midi/Sequencer.java0000644000175000017500000001000210172422337025413 0ustar twernertwerner/* * Sequencer.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999 - 2004 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package javax.sound.midi; import java.io.InputStream; import java.io.IOException; public interface Sequencer extends MidiDevice { public static final int LOOP_CONTINUOUSLY = -1; public void setSequence(Sequence sequence) throws InvalidMidiDataException; public void setSequence(InputStream inputStream) throws InvalidMidiDataException, IOException; public Sequence getSequence(); public void start(); public void setLoopStartPoint(long lTick); public long getLoopStartPoint(); public void setLoopEndPoint(long lTick); public long getLoopEndPoint(); public void setLoopCount(int nLoopCount); public int getLoopCount(); public void stop(); public boolean isRunning(); public void startRecording(); public void stopRecording(); public boolean isRecording(); // name should be: enableRecording public void recordEnable(Track track, int nChannel); // name should be: disableRecording public void recordDisable(Track track); public float getTempoInBPM(); public void setTempoInBPM(float fBPM); public float getTempoInMPQ(); public void setTempoInMPQ(float fMPQ); public float getTempoFactor(); public void setTempoFactor(float fFactor); public long getTickLength(); public long getTickPosition(); public void setTickPosition(long lTick); public long getMicrosecondLength(); public long getMicrosecondPosition(); public void setMicrosecondPosition(long lMicroseconds); public Sequencer.SyncMode getMasterSyncMode(); public void setMasterSyncMode(Sequencer.SyncMode syncMode); public Sequencer.SyncMode[] getMasterSyncModes(); public Sequencer.SyncMode getSlaveSyncMode(); public void setSlaveSyncMode(Sequencer.SyncMode syncMode); public Sequencer.SyncMode[] getSlaveSyncModes(); public void setTrackMute(int nTrack, boolean bMute); public boolean getTrackMute(int nTrack); public void setTrackSolo(int nTrack, boolean bSolo); public boolean getTrackSolo(int nTrack); public boolean addMetaEventListener(MetaEventListener listener); public void removeMetaEventListener(MetaEventListener listener); public int[] addControllerEventListener(ControllerEventListener listener, int[] anControllers); public int[] removeControllerEventListener(ControllerEventListener listener, int[] anControllers); ////////////////////////// INNER CLASSES ////////////////////////////// public static class SyncMode { public static final SyncMode INTERNAL_CLOCK = new SyncMode("Internal Clock"); public static final SyncMode MIDI_SYNC = new SyncMode("MIDI Sync"); public static final SyncMode MIDI_TIME_CODE = new SyncMode("MIDI Time Code"); public static final SyncMode NO_SYNC = new SyncMode("No Timing"); private String m_strName; protected SyncMode(String strName) { m_strName = strName; } public final boolean equals(Object obj) { return super.equals(obj); } public final int hashCode() { return super.hashCode(); } public final String toString() { return super.toString() + "[name=" + m_strName + "]"; } } } /*** Sequencer.java ***/ libtritonus-java-20070428/src/classes/javax/sound/midi/ShortMessage.java0000644000175000017500000002100310172422337026070 0ustar twernertwerner/* * ShortMessage.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999 -2002 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package javax.sound.midi; /** Simple MIDI message. This class is used to represent channel voice, control change, channel mode, system real time and system common messages. These are the messages that can be represented in at most three bytes (the status byte plus two data bytes). System exclusive and meta messages are stored in {@link SysexMessage SysexMessage} and {@link MetaMessage MetaMessage}, respective.

The way these messages are separated into bytes for storing in {@link MidiMessage#data data} is the same as specified in the MIDI wire protocol. */ public class ShortMessage extends MidiMessage { /** If true, for messages with one data byte it is checked that the second one is zero. This is some kind of debugging flag. */ private static final boolean CHECK_SECOND_BYTE = false; /** Status byte for note off messages (value 128, 0x80). */ public static final int NOTE_OFF = 0x80; /** Status byte for note on messages (value 144, 0x90). */ public static final int NOTE_ON = 0x90; /** Status byte for polyphonic key pressure (aftertouch) messages (value 160, 0xA0). */ public static final int POLY_PRESSURE = 0xA0; /** Status byte for controller cange messages (value 176, 0xB0). */ public static final int CONTROL_CHANGE = 0xB0; /** Status byte for program change messages (value 192, 0xC0). */ public static final int PROGRAM_CHANGE = 0xC0; /** Status byte for channel key pressure (aftertouch) messages (value 208, 0xD0). */ public static final int CHANNEL_PRESSURE = 0xD0; /** Status byte for pitch bend messages (value 224, 0xE0). */ public static final int PITCH_BEND = 0xE0; // system // in class SysexMessage: // public static final int SYSTEM_EXCLUSIVE = 0xF0; /** Status byte for MIDI time code quarter frame messages (value 241, 0xF1). */ public static final int MIDI_TIME_CODE = 0xF1; /** Status byte for song position pointer messages (value 242, 0xF2). */ public static final int SONG_POSITION_POINTER = 0xF2; /** Status byte for song select messages (value 243, 0xF3). */ public static final int SONG_SELECT = 0xF3; // not defined: 0xF4 // not defined: 0xF5 /** Status byte for tune request messages (value 246, 0xF6). */ public static final int TUNE_REQUEST = 0xF6; /** Status byte for end of system excusive messages (value 247, 0xF7). */ public static final int END_OF_EXCLUSIVE = 0xF7; // real-time messages /** Status byte for timing clock messages (value 248, 0xF8). */ public static final int TIMING_CLOCK = 0xF8; // not defined: 0xF9 /** Status byte for start messages (value 250, 0xFA). */ public static final int START = 0xFA; /** Status byte for continue messages (value 251, 0xFB). */ public static final int CONTINUE = 0xFB; /** Status byte for stop messages (value 252, 0xFC). */ public static final int STOP = 0xFC; // not defined: 0xFD /** Status byte for active sensing messages (value 254, 0xFE). */ public static final int ACTIVE_SENSING = 0xFE; /** Status byte for system reset messages (value 255, 0xFF). */ public static final int SYSTEM_RESET = 0xFF; /** Table for length of channel messages. This table is used by {@link #getDataLength() getDataLength()} to calculate the length of messages. The table is indexed with the high nibble of the status byte, if the status byte is < 0xF0. The values in the table are the number of data bytes (not including the status byte) or -1 if the index does not represent a status byte that is usable for ShortMessages. @see #getDataLength() */ private static final int sm_anChannelMessageLength[] = { -1, -1, -1, -1, -1, -1, -1, -1, 2, 2, 2, 2, 1, 1, 2 }; /* 8x 9x Ax Bx Cx Dx Ex */ /** Table for length of system messages. This table is used by {@link #getDataLength() getDataLength()} to calculate the length of messages. The table is indexed with the low nibble of the status byte, if the status byte is >= 0xF0. The values in the table are the number of data bytes (not including the status byte) or -1 if the index does not represent a status byte that is usable for ShortMessages. @see #getDataLength() */ private static final int sm_anSystemMessageLength[] = { -1, 2, 3, 2, -1, -1, 1, 0, 1, -1, 1, 1, 1, -1, 1, 1 }; /* F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF */ // /** Default ShortMessage. // This are the data bytes used to construct a ShortMessage // with the default constructor. // The message is chosen arbitrarily. Actually, it // not so much arbitrary: it is the same as in the Sun // implementation. // */ // private static final byte[] DEFAULT_MESSAGE = new byte[]{(byte) 144, (byte) 255, 0}; /** Create a container for a "short" MIDI message. This constructor does not create an object containing a legal MIDI message. You have to use one of the setMessage() methods. Before calling one of these methods, calling retrieval methods (getLength(), getMessage(), getStatus(), getChannel(), getCommand(), getData1(), getData2()) may have undesired results. @see #setMessage(int) @see #setMessage(int, int, int) @see #setMessage(int, int, int, int) */ public ShortMessage() { this(null); } /** Constructs a ShortMessage with a message set. does not check content of passed array!! TODO: */ protected ShortMessage(byte[] abData) { super(abData); } /** TODO: */ public Object clone() { byte[] abData = getMessage(); ShortMessage message = new ShortMessage(abData); return message; } /** TODO: */ public void setMessage(int nStatus) throws InvalidMidiDataException { if (getDataLength(nStatus) != 0) { throw new InvalidMidiDataException("not a one-byte command"); } byte[] abData = new byte[1]; abData[0] = (byte) nStatus; setMessage(abData, 1); } /** TODO: */ public void setMessage(int nStatus, int nData1, int nData2) throws InvalidMidiDataException { int nDataLength = getDataLength(nStatus); if (nDataLength < 1) { throw new InvalidMidiDataException("not a two- or three-byte command"); } byte[] abData = new byte[nDataLength + 1]; abData[0] = (byte) nStatus; abData[1] = (byte) nData1; if (nDataLength == 2) { abData[2] = (byte) nData2; } else if (nData2 != 0 && CHECK_SECOND_BYTE) { throw new InvalidMidiDataException("data2 should be 0 for a two-byte command"); } setMessage(abData, nDataLength + 1); } /** TODO: */ public void setMessage(int nCommand, int nChannel, int nData1, int nData2) throws InvalidMidiDataException { setMessage((nCommand & 0xF0) | (nChannel & 0x0F), nData1, nData2); } /** TODO: */ public int getChannel() { return (getStatus() & 0xF); } /** TODO: */ public int getCommand() { return getStatus() & 0xF0; } /** TODO: */ public int getData1() { return getDataByte(1); } /** TODO: */ public int getData2() { return getDataByte(2); } /** TODO: */ private int getDataByte(int nNumber) { int nDataByte = 0; if (getLength() >= nNumber) { nDataByte = getMessage()[nNumber]; } return nDataByte; } /** TODO: */ protected final int getDataLength(int nStatus) throws InvalidMidiDataException { int nDataLength = 0; if (nStatus < 0xF0) // channel voice message { nDataLength = sm_anChannelMessageLength[(nStatus >> 4) & 0xF]; } else { nDataLength = sm_anSystemMessageLength[nStatus & 0xF]; } if (nDataLength == -1) { throw new InvalidMidiDataException("status byte not usable for ShortMessage"); } return nDataLength; } } /*** ShortMessage.java ***/ libtritonus-java-20070428/src/classes/javax/sound/midi/Soundbank.java0000644000175000017500000000245210172422337025417 0ustar twernertwerner/* * Soundbank.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package javax.sound.midi; public interface Soundbank { public String getName(); public String getVersion(); public String getVendor(); public String getDescription(); public SoundbankResource[] getResources(); public Instrument[] getInstruments(); public Instrument getInstrument(Patch patch); } /*** Soundbank.java ***/ libtritonus-java-20070428/src/classes/javax/sound/midi/SoundbankResource.java0000644000175000017500000000303010172422337027120 0ustar twernertwerner/* * SoundbankResource.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2000 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package javax.sound.midi; public abstract class SoundbankResource { private Soundbank m_soundbank; private String m_strName; private Class m_dataClass; protected SoundbankResource(Soundbank soundbank, String strName, Class dataClass) { m_soundbank = soundbank; m_strName = strName; } public Soundbank getSoundbank() { return m_soundbank; } public String getName() { return m_strName; } public Class getDataClass() { return m_dataClass; } public abstract Object getData(); } /*** SoundbankResource.java ***/ libtritonus-java-20070428/src/classes/javax/sound/midi/Synthesizer.java0000644000175000017500000000351310172422337026021 0ustar twernertwerner/* * Synthesizer.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package javax.sound.midi; public interface Synthesizer extends MidiDevice { public int getMaxPolyphony(); public long getLatency(); public MidiChannel[] getChannels(); public VoiceStatus[] getVoiceStatus(); public boolean isSoundbankSupported(Soundbank soundbank); public boolean loadInstrument(Instrument instrument); public void unloadInstrument(Instrument instrument); public boolean remapInstrument(Instrument from, Instrument to); public Soundbank getDefaultSoundbank(); public Instrument[] getAvailableInstruments(); public Instrument[] getLoadedInstruments(); public boolean loadAllInstruments(Soundbank soundbank); public void unloadAllInstruments(Soundbank soundbank); public boolean loadInstruments(Soundbank soundbank, Patch[] aPatches); public void unloadInstruments(Soundbank soundbank, Patch[] aPatches); } /*** Synthesizer.java ***/ libtritonus-java-20070428/src/classes/javax/sound/midi/SysexMessage.java0000644000175000017500000000525010172422337026112 0ustar twernertwerner/* * SysexMessage.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package javax.sound.midi; /** Holds the data of a MIDI System Exclusive event. Sysex event are tricking me over and over again. I give my understanding of the expected behaviour for review: */ public class SysexMessage extends MidiMessage { /** TODO: */ public static final int SYSTEM_EXCLUSIVE = 0xF0; /** TODO: */ public static final int SPECIAL_SYSTEM_EXCLUSIVE = 0xF7; /** Create a container for a MIDI system exclusive message. This constructor does not create an object containing a legal MIDI message. You have to use one of the setMessage() methods. Before calling one of these methods, calling retrieval methods (getStatus(), getLength(), getMessage(), getData()) may have undesired results. @see #setMessage(byte[], int) @see #setMessage(int, byte[], int) */ public SysexMessage() { this(null); } /** TODO: */ protected SysexMessage(byte[] abData) { super(abData); } /** TODO: */ public void setMessage(byte[] abData, int nLength) throws InvalidMidiDataException { super.setMessage(abData, nLength); } /** TODO: */ public void setMessage(int nStatus, byte[] abData, int nLength) throws InvalidMidiDataException { byte[] abCompleteData = new byte[nLength + 1]; abCompleteData[0] = (byte) nStatus; System.arraycopy(abData, 0, abCompleteData, 1, nLength); setMessage(abCompleteData, abCompleteData.length); } /** TODO: */ public byte[] getData() { byte[] abData = new byte[getLength() - 1]; System.arraycopy(getMessage(), 1, abData, 0, abData.length); return abData; } /** TODO: */ public Object clone() { byte[] abData = getMessage(); SysexMessage message = new SysexMessage(abData); return message; } } /*** SysexMessage.java ***/ libtritonus-java-20070428/src/classes/javax/sound/midi/Track.java0000644000175000017500000000415710172422337024543 0ustar twernertwerner/* * Track.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999, 2000 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package javax.sound.midi; import java.util.ArrayList; import java.util.List; import java.util.Vector; public class Track { // not used; only to confirm with official API protected Vector events; // this is the actual store private List m_events; public Track() { m_events = new ArrayList(); } public synchronized boolean add(MidiEvent event) { if (!m_events.contains(event)) { int nIndex = size() - 1; for (nIndex = size() - 1; nIndex >= 0 && get(nIndex).getTick() > event.getTick(); nIndex--) { } m_events.add(nIndex + 1, event); return true; } else { return false; } } public synchronized boolean remove(MidiEvent event) { return m_events.remove(event); } public synchronized MidiEvent get(int nIndex) throws ArrayIndexOutOfBoundsException { return m_events.get(nIndex); } public synchronized int size() { return m_events.size(); } public long ticks() { /* * Since ordering by tick value is guaranteed, we can * simply pick the last event and return its tick value. */ return get(size() - 1).getTick(); } } /*** Track.java ***/ libtritonus-java-20070428/src/classes/javax/sound/midi/Transmitter.java0000644000175000017500000000222710172422337026007 0ustar twernertwerner/* * Transmitter.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package javax.sound.midi; public interface Transmitter { public void setReceiver(Receiver receiver); public Receiver getReceiver(); public void close(); } /*** Transmitter.java ***/ libtritonus-java-20070428/src/classes/javax/sound/midi/VoiceStatus.java0000644000175000017500000000230010172422337025734 0ustar twernertwerner/* * VoiceStatus.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package javax.sound.midi; public class VoiceStatus { public boolean active; public int channel; public int bank; public int program; public int note; public int volume; } /*** VoiceStatus.java ***/ libtritonus-java-20070428/src/classes/javax/sound/sampled/0000755000175000017500000000000010621572374023336 5ustar twernertwernerlibtritonus-java-20070428/src/classes/javax/sound/sampled/spi/0000755000175000017500000000000010621572374024131 5ustar twernertwernerlibtritonus-java-20070428/src/classes/javax/sound/sampled/spi/AudioFileReader.java0000644000175000017500000000405010172422340027743 0ustar twernertwerner/* * AudioFileReader.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package javax.sound.sampled.spi; import java.io.File; import java.io.InputStream; import java.io.IOException; import java.net.URL; import javax.sound.sampled.AudioFileFormat; import javax.sound.sampled.AudioInputStream; import javax.sound.sampled.UnsupportedAudioFileException; public abstract class AudioFileReader { public abstract AudioFileFormat getAudioFileFormat(InputStream inputStream) throws UnsupportedAudioFileException, IOException; public abstract AudioFileFormat getAudioFileFormat(URL url) throws UnsupportedAudioFileException, IOException; public abstract AudioFileFormat getAudioFileFormat(File file) throws UnsupportedAudioFileException, IOException; public abstract AudioInputStream getAudioInputStream(InputStream inputStream) throws UnsupportedAudioFileException, IOException; public abstract AudioInputStream getAudioInputStream(URL url) throws UnsupportedAudioFileException, IOException; public abstract AudioInputStream getAudioInputStream(File file) throws UnsupportedAudioFileException, IOException; } /*** AudioFileReader.java ***/ libtritonus-java-20070428/src/classes/javax/sound/sampled/spi/AudioFileWriter.java0000644000175000017500000000455510374074734030045 0ustar twernertwerner/* * AudioFileWriter.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package javax.sound.sampled.spi; import java.io.File; import java.io.IOException; import java.io.OutputStream; import javax.sound.sampled.AudioFileFormat; import javax.sound.sampled.AudioInputStream; public abstract class AudioFileWriter { public abstract AudioFileFormat.Type[] getAudioFileTypes(); public boolean isFileTypeSupported(AudioFileFormat.Type fileType) { AudioFileFormat.Type[] aFileTypes = getAudioFileTypes(); return isFileTypeSupportedImpl(aFileTypes, fileType); } public abstract AudioFileFormat.Type[] getAudioFileTypes(AudioInputStream audioInputStream); public boolean isFileTypeSupported( AudioFileFormat.Type fileType, AudioInputStream audioInputStream) { AudioFileFormat.Type[] aFileTypes = getAudioFileTypes(audioInputStream); return isFileTypeSupportedImpl(aFileTypes, fileType); } public abstract int write(AudioInputStream audioInputStream, AudioFileFormat.Type fileType, OutputStream outputStream) throws IOException; public abstract int write(AudioInputStream audioInputStream, AudioFileFormat.Type fileType, File file) throws IOException; private boolean isFileTypeSupportedImpl(AudioFileFormat.Type[] aFileTypes, AudioFileFormat.Type fileType) { for (int i = 0; i < aFileTypes.length; i++) { if (aFileTypes[i].equals(fileType)) { return true; } } return false; } } /*** AudioFileWriter.java ***/ libtritonus-java-20070428/src/classes/javax/sound/sampled/spi/FormatConversionProvider.java0000644000175000017500000001063310172422340031774 0ustar twernertwerner/* * FormatConversionProvider.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package javax.sound.sampled.spi; import javax.sound.sampled.AudioFormat; import javax.sound.sampled.AudioInputStream; import org.tritonus.share.TDebug; public abstract class FormatConversionProvider { public abstract AudioFormat.Encoding[] getSourceEncodings(); public abstract AudioFormat.Encoding[] getTargetEncodings(); public boolean isSourceEncodingSupported( AudioFormat.Encoding sourceEncoding) { AudioFormat.Encoding[] aSourceEncodings = getSourceEncodings(); return arrayContains(aSourceEncodings, sourceEncoding); } public boolean isTargetEncodingSupported( AudioFormat.Encoding targetEncoding) { AudioFormat.Encoding[] aTargetEncodings = getTargetEncodings(); return arrayContains(aTargetEncodings, targetEncoding); } public abstract AudioFormat.Encoding[] getTargetEncodings( AudioFormat sourceFormat); /** * WARNING: this method uses getTargetEncodings(AudioFormat); * which may create infinite loops if the latter is overwritten. */ public boolean isConversionSupported( AudioFormat.Encoding targetEncoding, AudioFormat sourceFormat) { if (TDebug.TraceAudioConverter) { TDebug.out(">FormatConversionProvider.isConversionSupported(AudioFormat.Encoding, AudioFormat):"); TDebug.out("class: "+getClass().getName()); TDebug.out("checking if conversion possible"); TDebug.out("from: " + sourceFormat); TDebug.out("to: " + targetEncoding); } AudioFormat.Encoding[] aTargetEncodings = getTargetEncodings(sourceFormat); boolean res = arrayContains(aTargetEncodings, targetEncoding); if (TDebug.TraceAudioConverter) { TDebug.out("< result="+res); } return res; } public abstract AudioFormat[] getTargetFormats( AudioFormat.Encoding targetEncoding, AudioFormat sourceFormat); /** * WARNING: this method uses getTargetFormats(AudioFormat.Encoding, AudioFormat) * which may create infinite loops if the latter is overwritten. */ public boolean isConversionSupported( AudioFormat targetFormat, AudioFormat sourceFormat) { if (TDebug.TraceAudioConverter) { TDebug.out(">FormatConversionProvider.isConversionSupported(AudioFormat, AudioFormat):"); TDebug.out("class: "+getClass().getName()); TDebug.out("checking if conversion possible"); TDebug.out("from: " + sourceFormat); TDebug.out("to: " + targetFormat); } AudioFormat[] aTargetFormats = getTargetFormats(targetFormat.getEncoding(), sourceFormat); for (int i = 0; i < aTargetFormats.length; i++) { if (TDebug.TraceAudioConverter) { TDebug.out("checking against possible target format: " + aTargetFormats[i]); } if (aTargetFormats[i] != null && aTargetFormats[i].matches(targetFormat)) { if (TDebug.TraceAudioConverter) { TDebug.out("| */ package javax.sound.sampled.spi; import javax.sound.sampled.Mixer; public abstract class MixerProvider { // TODO: check if jdk uses getMixerInfo() or getMixer() to // implement this functionality (and document this officially). // $$mp 2003/01/11: bug filed. public boolean isMixerSupported(Mixer.Info info) { return false; } public abstract Mixer.Info[] getMixerInfo(); public abstract Mixer getMixer(Mixer.Info info); } /*** MixerProvider.java ***/ libtritonus-java-20070428/src/classes/javax/sound/sampled/AudioFileFormat.java0000644000175000017500000001124610172422337027211 0ustar twernertwerner/* * AudioFileFormat.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999 - 2004 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package javax.sound.sampled; import java.util.Collections; import java.util.HashMap; import java.util.Map; public class AudioFileFormat { private Type m_type; private AudioFormat m_audioFormat; private int m_nLengthInFrames; private int m_nLengthInBytes; private Map m_properties; private Map m_unmodifiableProperties; public AudioFileFormat(Type type, AudioFormat audioFormat, int nLengthInFrames) { this(type, audioFormat, nLengthInFrames, null); } public AudioFileFormat(Type type, AudioFormat audioFormat, int nLengthInFrames, Map properties) { this(type, AudioSystem.NOT_SPECIFIED, audioFormat, nLengthInFrames); initProperties(properties); } protected AudioFileFormat(Type type, int nLengthInBytes, AudioFormat audioFormat, int nLengthInFrames) { m_type = type; m_audioFormat = audioFormat; m_nLengthInFrames = nLengthInFrames; m_nLengthInBytes = nLengthInBytes; initProperties(null); } private void initProperties(Map properties) { /* Here, we make a shallow copy of the map. It's unclear if this is sufficient (or if a deep copy should be made). */ m_properties = new HashMap(); if (properties != null) { m_properties.putAll(properties); } m_unmodifiableProperties = Collections.unmodifiableMap(m_properties); } public Type getType() { return m_type; } public int getByteLength() { return m_nLengthInBytes; } public AudioFormat getFormat() { return m_audioFormat; } public int getFrameLength() { return m_nLengthInFrames; } // IDEA: output "not specified" of length == AudioSystem.NOT_SPECIFIED public String toString() { return super.toString() + "[type=" + getType() + ", format=" + getFormat() + ", lengthInFrames=" + getByteLength() + ", lengthInBytes=" + getFrameLength() + "]"; } public Map properties() { return m_unmodifiableProperties; } public Object getProperty(String key) { return m_properties.get(key); } protected void setProperty(String key, Object value) { m_properties.put(key, value); } public static class Type { // $$fb 2000-03-31: extension without dot public static final Type AIFC = new Type("AIFC", "aifc"); public static final Type AIFF = new Type("AIFF", "aiff"); public static final Type AU = new Type("AU", "au"); public static final Type SND = new Type("SND", "snd"); public static final Type WAVE = new Type("WAVE", "wav"); private String m_strName; private String m_strExtension; public Type(String strName, String strExtension) { m_strName = strName; m_strExtension = strExtension; } public String getExtension() { return m_strExtension; } /* */ public final boolean equals(Object obj) { if (obj == this) { return true; } else if (obj == null || (obj.getClass() != this.getClass())) { return false; } else { Type t = (Type) obj; return toString().equals(t.toString()) && getExtension().equals(t.getExtension()); } } /* TODO: we have to make sure that the strings aren't null. Otherwise, we get a NullPointerException here. */ public final int hashCode() { int nHash = 11; nHash = 31 * nHash + toString().hashCode(); nHash = 31 * nHash + getExtension().hashCode(); // solution if we can't otherwise assure that the strings aren't null: // nHash = 31 * nHash + (null == data ? 0 : data.hashCode()); return nHash; } public final String toString() { return m_strName; } } } /*** AudioFileFormat.java ***/ libtritonus-java-20070428/src/classes/javax/sound/sampled/AudioFormat.java0000644000175000017500000001617610172422337026420 0ustar twernertwerner/* * AudioFormat.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999,2000 by Matthias Pfisterer * Copyright (c) 1999 by Florian Bomers * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package javax.sound.sampled; import java.util.Collections; import java.util.HashMap; import java.util.Map; public class AudioFormat { protected Encoding encoding; protected float sampleRate; protected int sampleSizeInBits; protected int channels; protected int frameSize; protected float frameRate; protected boolean bigEndian; private Map m_properties; private Map m_unmodifiableProperties; public AudioFormat(Encoding encoding, float fSampleRate, int nSampleSizeInBits, int nChannels, int nFrameSize, float fFrameRate, boolean bBigEndian) { this(encoding, fSampleRate, nSampleSizeInBits, nChannels, nFrameSize, fFrameRate, bBigEndian, null); } public AudioFormat(Encoding encoding, float fSampleRate, int nSampleSizeInBits, int nChannels, int nFrameSize, float fFrameRate, boolean bBigEndian, Map properties) { this.encoding = encoding; this.sampleRate = fSampleRate; this.sampleSizeInBits = nSampleSizeInBits; this.channels = nChannels; this.frameSize = nFrameSize; this.frameRate = fFrameRate; this.bigEndian = bBigEndian; initMaps(properties); } public AudioFormat(float fSampleRate, int nSampleSizeInBits, int nChannels, boolean bSigned, boolean bBigEndian) { this(bSigned ? Encoding.PCM_SIGNED : Encoding.PCM_UNSIGNED, fSampleRate, nSampleSizeInBits, nChannels, ((nChannels != AudioSystem.NOT_SPECIFIED) && (nSampleSizeInBits != AudioSystem.NOT_SPECIFIED))? (nChannels * nSampleSizeInBits) / 8:AudioSystem.NOT_SPECIFIED, fSampleRate, bBigEndian); } private void initMaps(Map properties) { /* Here, we make a shallow copy of the map. It's unclear if this is sufficient (of if a deep copy should be made). */ m_properties = new HashMap(); if (properties != null) { m_properties.putAll(properties); } m_unmodifiableProperties = Collections.unmodifiableMap(m_properties); } public Map properties() { return m_unmodifiableProperties; } public Object getProperty(String key) { return m_properties.get(key); } protected void setProperty(String key, Object value) { m_properties.put(key, value); } public Encoding getEncoding() { return encoding; } public float getSampleRate() { return sampleRate; } public int getSampleSizeInBits() { return sampleSizeInBits; } public int getChannels() { return channels; } public int getFrameSize() { return frameSize; } public float getFrameRate() { return frameRate; } public boolean isBigEndian() { return bigEndian; } //$$fb 19 Dec 99: added //$$fb ohh, I just read the documentation - it must indeed match exactly. //I think it would be much better that a pair of values also matches //when at least one is NOT_SPECIFIED. // support for NOT_SPECIFIED should be consistent in JavaSound... // As a "workaround" I implemented it like this in TFormatConversionProvider private static boolean doMatch(int i1, int i2) { return i1 == AudioSystem.NOT_SPECIFIED || i2 == AudioSystem.NOT_SPECIFIED || i1 == i2; } private static boolean doMatch(float f1, float f2) { return f1 == AudioSystem.NOT_SPECIFIED || f2 == AudioSystem.NOT_SPECIFIED || Math.abs(f1 - f2) < 1.0e-9; } public boolean matches(AudioFormat format) { //$$fb 19 Dec 99: endian must be checked, too. // // we do have a problem with redundant elements: // e.g. // encoding=ALAW || ULAW -> bigEndian and samplesizeinbits don't matter // sample size in bits == 8 -> bigEndian doesn't matter // sample size in bits > 8 -> PCM is always signed. // This is an overall issue in JavaSound, I think. // At present, it is not consistently implemented to support these // redundancies and implicit definitions // // As a workaround of this issue I return in the converters // all combinations, e.g. for ULAW I return bigEndian and !bigEndian formats. /* old version return getEncoding().equals(format.getEncoding()) && getChannels() == format.getChannels() && getSampleSizeInBits() == format.getSampleSizeInBits() && getFrameSize() == format.getFrameSize() && (Math.abs(getSampleRate() - format.getSampleRate()) < 1.0e-9 || format.getSampleRate() == AudioSystem.NOT_SPECIFIED) && (Math.abs(getFrameRate() - format.getFrameRate()) < 1.0e-9 || format.getFrameRate() == AudioSystem.NOT_SPECIFIED); */ // as proposed by florian return getEncoding().equals(format.getEncoding()) && (format.getSampleSizeInBits()<=8 || format.getSampleSizeInBits()==AudioSystem.NOT_SPECIFIED || isBigEndian()==format.isBigEndian()) && doMatch(getChannels(),format.getChannels()) && doMatch(getSampleSizeInBits(), format.getSampleSizeInBits()) && doMatch(getFrameSize(), format.getFrameSize()) && doMatch(getSampleRate(), format.getSampleRate()) && doMatch(getFrameRate(),format.getFrameRate()); } public String toString() { return getEncoding() + ", " + getChannels() + " channel(s), " + getSampleSizeInBits() + " bit samples, " + getFrameSize() + " byte frames, " + getSampleRate() + " Hz, " + getFrameRate() + " frames/second, " + (isBigEndian() ? "big endian" : "little endian"); } public static class Encoding { public static final Encoding PCM_SIGNED = new Encoding("PCM_SIGNED"); public static final Encoding PCM_UNSIGNED = new Encoding("PCM_UNSIGNED"); public static final Encoding ULAW = new Encoding("ULAW"); public static final Encoding ALAW = new Encoding("ALAW"); private String m_strName; public Encoding(String strName) { m_strName = strName; } public final boolean equals(Object obj) { if (obj == this) { return true; } else if (obj == null) { return false; } else { return toString().equals(obj.toString()); } } public final int hashCode() { return toString().hashCode(); } public final String toString() { return m_strName; } } } /*** AudioFormat.java ***/ libtritonus-java-20070428/src/classes/javax/sound/sampled/AudioInputStream.java0000644000175000017500000002116310172422337027433 0ustar twernertwerner/* * AudioInputStream.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999, 2000 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package javax.sound.sampled; import java.io.InputStream; import java.io.IOException; import org.tritonus.share.TDebug; import org.tritonus.share.sampled.AudioUtils; public class AudioInputStream extends InputStream { /** Says whether we check lengths. * If true, lengths in bytes are asserted to be multiples * of the frame size. */ private static final boolean CHECK_LENGTHS = true; /** The stream that is backing the AudioInputStream. * Accessing this property, especially writing, is discouraged. */ protected InputStream stream; /** The format of this stream. * Accessing this property, especially writing, is discouraged. * You should use the method getFormat(). */ protected AudioFormat format; /** The length of the audio data. * * This value is in frames. May have the value * AudioSystem.NOT_SPECIFIED to express that the length in frames * is unknown. Accessing this property, especially writing, is * strongly discouraged. You should use the method * getFrameLength(). */ protected long frameLength; /** The size of an frame of audio data. * * This value is in bytes. May have the value * AudioSystem.NOT_SPECIFIED to express that the size of frames * is unknown. Accessing this property, especially writing, is * strongly discouraged. Its semantics is not clearly defined. */ protected int frameSize; /** The size of an frame of audio data. * * This value is used internally to check whether the number of * bytes requested in read() or skip() is a multiple of the frame * size. This value is in bytes. In contrary to frameSize, * which may be AudioSystem.NOT_SPECIFIED, this variable always * has a value >= 1. If the length in frames or the frame size of * the audio data is unknown, this value is set to 1. */ private int m_nCheckFrameSize; /** The read position in the stream. * * This value is in frames. NOTE: this property only has a * useful value if the encoding of the stream is PCM. Accessing * this property, especially writing, is strongly * discouraged. Its semantics is not clearly defined. */ protected long framePos; /** The read position in the stream. * * This value is in bytes. */ private long m_lPosition; /** The length of the audio data. * * This value is in bytes. May have the value * AudioSystem.NOT_SPECIFIED to express that the length is * unknown. */ private long m_lLengthInBytes; /** Position where the mark was set in the stream. * * This value is in bytes. */ private long m_lMarkedPosition; public AudioInputStream(InputStream inputStream, AudioFormat audioFormat, long lLengthInFrames) { if (TDebug.TraceAudioInputStream) { TDebug.out("AudioInputStream.: inputStream: " + inputStream); } stream = inputStream; format = audioFormat; frameLength = lLengthInFrames; m_nCheckFrameSize = frameSize = audioFormat.getFrameSize(); if (m_nCheckFrameSize < 1) { m_nCheckFrameSize = 1; } m_lLengthInBytes = AudioUtils.getLengthInBytes( audioFormat, lLengthInFrames); m_lPosition = 0; updateFramePosition(); } public AudioInputStream(TargetDataLine targetDataLine) { this(new TargetDataLineInputStream(targetDataLine), targetDataLine.getFormat(), AudioSystem.NOT_SPECIFIED); } public AudioFormat getFormat() { return format; } public long getFrameLength() { return frameLength; } public int read() throws IOException { if (CHECK_LENGTHS) { if (getCheckFrameSize() != 1) { throw new IOException("frame size must be 1 to read a single byte"); } } if (isEndReached()) { return -1; } int nByte = stream.read(); if (nByte != -1) { m_lPosition++; updateFramePosition(); } return nByte; } public int read(byte[] abData) throws IOException { return read(abData, 0, abData.length); } public int read(byte[] abData, int nOffset, int nLength) throws IOException { //$$fb better to first check if end is reached. //otherwise, on un-aligned nLength, it will lead to a misleading exception // (as it occurs with DataInputStream.readFully) if (isEndReached()) { return -1; } if (CHECK_LENGTHS) { if (nLength % getCheckFrameSize() != 0) { throw new IOException("length must be a multiple of the frame size (length="+nLength+", frameSize="+getCheckFrameSize()+")"); } } if (m_lLengthInBytes != AudioSystem.NOT_SPECIFIED) { nLength = (int) Math.min(nLength, m_lLengthInBytes - m_lPosition); } //$$fb try to read frame-aligned (when stream returns unaligned data) //$$fb e.g. SequenceInputStream int nBytesRead=0; int thisRead; do { thisRead = stream.read(abData, nOffset, nLength); if (thisRead > 0) { nBytesRead += thisRead; nLength -= thisRead; nOffset += thisRead; } } while (thisRead > 0 && nLength > 0); if (nBytesRead <= 0 && thisRead == -1) { nBytesRead =- 1; } else { m_lPosition += nBytesRead; updateFramePosition(); } return nBytesRead; } public long skip(long nSkip) throws IOException { if (CHECK_LENGTHS) { if (nSkip % getCheckFrameSize() != 0) { throw new IOException("skip must be a multiple of the frame size"); } } if (m_lLengthInBytes != AudioSystem.NOT_SPECIFIED) { nSkip = (int) Math.min(nSkip, m_lLengthInBytes - m_lPosition); } long nSkipped = stream.skip(nSkip); m_lPosition += nSkipped; updateFramePosition(); return nSkipped; } public int available() throws IOException { if (m_lLengthInBytes == AudioSystem.NOT_SPECIFIED) { return stream.available(); } else { return (int) Math.min(stream.available(), m_lLengthInBytes - m_lPosition); } } public void close() throws IOException { stream.close(); } public void mark(int readlimit) { stream.mark(readlimit); m_lMarkedPosition = m_lPosition; } public void reset() throws IOException { stream.reset(); m_lPosition = m_lMarkedPosition; updateFramePosition(); } public boolean markSupported() { return stream.markSupported(); } /** Returns the frame size for internal checks. * * This number is is bytes. */ private int getCheckFrameSize() { return m_nCheckFrameSize; } private boolean isEndReached() { return m_lPosition >= m_lLengthInBytes && m_lLengthInBytes != AudioSystem.NOT_SPECIFIED; } /** Calculates the position in frames from the position in bytes. * * This only produces meaningful values if the encoding is PCM. * Maintaining framePos is only done for backwards compatibility * with really badly designed programs that directely access the * protected member framePos. */ private void updateFramePosition() { this.framePos = m_lPosition / getCheckFrameSize(); } /** Helper class to enable AudioInputStream to read from a TargetDataLine. */ private static class TargetDataLineInputStream extends InputStream { /** The TargetDataLine from which to read. */ private TargetDataLine m_targetDataLine; /** A buffer used for reading single bytes. * * It is allocated and used in read(). */ private byte[] m_abSingleByteBuffer = null; public TargetDataLineInputStream(TargetDataLine targetDataLine) { m_targetDataLine = targetDataLine; } public int read() { if (m_abSingleByteBuffer == null) { m_abSingleByteBuffer = new byte[1]; } int nReturn = read(m_abSingleByteBuffer, 0, 1); if (nReturn < 0) { return -1; } else { return m_abSingleByteBuffer[0]; } } public int read(byte[] abData, int nOffset, int nLength) { return m_targetDataLine.read(abData, nOffset, nLength); } } } /*** AudioInputStream.java ***/ libtritonus-java-20070428/src/classes/javax/sound/sampled/AudioPermission.java0000644000175000017500000000253010172422337027305 0ustar twernertwerner/* * AudioPermission.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2000 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package javax.sound.sampled; import java.security.BasicPermission; /** TODO: */ public class AudioPermission extends BasicPermission { /** TODO: */ public AudioPermission(String strName) { super(strName); } /** TODO: */ public AudioPermission(String strName, String strActions) { super(strName, strActions); } } /*** AudioPermission.java ***/ libtritonus-java-20070428/src/classes/javax/sound/sampled/AudioSystem.java0000644000175000017500000010750510374160730026451 0ustar twernertwerner/* * AudioSystem.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999 - 2002 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package javax.sound.sampled; import java.io.File; import java.io.InputStream; import java.io.IOException; import java.io.OutputStream; import java.net.URL; import java.util.Arrays; import java.util.Collection; import java.util.ArrayList; import java.util.HashSet; import java.util.Set; import java.util.Iterator; import javax.sound.sampled.spi.AudioFileReader; import javax.sound.sampled.spi.AudioFileWriter; import javax.sound.sampled.spi.FormatConversionProvider; import javax.sound.sampled.spi.MixerProvider; import org.tritonus.core.TAudioConfig; import org.tritonus.share.TDebug; import org.tritonus.share.ArraySet; public class AudioSystem { public static final int NOT_SPECIFIED = -1; private static final AudioFormat.Encoding[] EMPTY_ENCODING_ARRAY = new AudioFormat.Encoding[0]; private static final AudioFileFormat.Type[] EMPTY_TYPE_ARRAY = new AudioFileFormat.Type[0]; private static final Mixer.Info[] EMPTY_MIXER_INFO_ARRAY = new Mixer.Info[0]; private static final Line.Info[] EMPTY_LINE_INFO_ARRAY = new Line.Info[0]; /** MixerProviderAction for getMixerInfo(). */ private static class GetMixerInfoMixerProviderAction implements MixerProviderAction { private Collection m_mixerInfos = new ArrayList(); public GetMixerInfoMixerProviderAction() { } public boolean handleMixerProvider( MixerProvider mixerProvider) { Mixer.Info[] aMixerInfos = mixerProvider.getMixerInfo(); if (aMixerInfos != null) { // TODO: is this if needed? if (aMixerInfos.length > 0) { if (TDebug.TraceAudioSystem) { TDebug.out("AudioSystem.getMixerInfo(): MixerProvider returns array:"); for (int i = 0; i < aMixerInfos.length; i++) { TDebug.out("" + aMixerInfos[i]); } } } else if (TDebug.TraceAudioSystem) { TDebug.out("AudioSystem.getMixerInfo(): MixerProvider returns empty array."); } m_mixerInfos.addAll(Arrays.asList(aMixerInfos)); } else if (TDebug.TraceAudioSystem) { TDebug.out("AudioSystem.getMixerInfo(): MixerProvider returns null."); } // always continue return false; } public Mixer.Info[] getMixerInfos() { return m_mixerInfos.toArray(EMPTY_MIXER_INFO_ARRAY); } } public static Mixer.Info[] getMixerInfo() { GetMixerInfoMixerProviderAction action = new GetMixerInfoMixerProviderAction(); doMixerProviderIteration(action); Mixer.Info[] infos = action.getMixerInfos(); // TDebug.out("MI length: " + infos.length); return infos; } /** MixerProviderAction for getMixer(). */ private static class GetMixerMixerProviderAction implements MixerProviderAction { private Mixer.Info m_info = null; private Mixer m_mixer = null; public GetMixerMixerProviderAction(Mixer.Info info) { m_info = info; } public boolean handleMixerProvider( MixerProvider mixerProvider) { try { Mixer mixer = mixerProvider.getMixer(m_info); if (m_mixer == null) { m_mixer = mixer; // now interrupt the iteration return true; } } catch (IllegalArgumentException e) { if (TDebug.TraceAudioSystem || TDebug.TraceAllExceptions) { TDebug.out(e); } } // continue the iteration return false; } public Mixer getMixer() { return m_mixer; } } public static Mixer getMixer(Mixer.Info info) { if (info == null) { // TODO: this currently always yields null!!! // but default mixers are handled by some magic in // TMixerProvider info = TAudioConfig.getDefaultMixerInfo(); } GetMixerMixerProviderAction action = new GetMixerMixerProviderAction(info); doMixerProviderIteration(action); Mixer mixer = action.getMixer(); if (mixer != null) { return mixer; } else { throw new IllegalArgumentException("no mixer found for " + info); } } /** MixerAction for getSourceLineInfo(). */ private static class GetSourceLineInfoMixerAction implements MixerAction { private Line.Info m_info = null; private Set m_infos; public GetSourceLineInfoMixerAction(Line.Info info) { m_info = info; m_infos = new ArraySet(); } public boolean handleMixer( Mixer mixer) { Line.Info[] infos = mixer.getSourceLineInfo(m_info); m_infos.addAll(Arrays.asList(infos)); // always continue the iteration return false; } public Line.Info[] getInfos() { return m_infos.toArray(EMPTY_LINE_INFO_ARRAY); } } public static Line.Info[] getSourceLineInfo(Line.Info info) { GetSourceLineInfoMixerAction action = new GetSourceLineInfoMixerAction(info); doMixerIteration(action); return action.getInfos(); } /** MixerAction for getTargetLineInfo(). */ private static class GetTargetLineInfoMixerAction implements MixerAction { private Line.Info m_info = null; private Set m_infos; public GetTargetLineInfoMixerAction(Line.Info info) { m_info = info; m_infos = new ArraySet(); } public boolean handleMixer( Mixer mixer) { Line.Info[] infos = mixer.getTargetLineInfo(m_info); m_infos.addAll(Arrays.asList(infos)); // always continue the iteration return false; } public Line.Info[] getInfos() { return m_infos.toArray(EMPTY_LINE_INFO_ARRAY); } } public static Line.Info[] getTargetLineInfo(Line.Info info) { GetTargetLineInfoMixerAction action = new GetTargetLineInfoMixerAction(info); doMixerIteration(action); return action.getInfos(); } /** MixerAction for isLineSupported(). */ private static class IsLineSupportedMixerAction implements MixerAction { private Line.Info m_info = null; private boolean m_bSupported = false; public IsLineSupportedMixerAction(Line.Info info) { m_info = info; } public boolean handleMixer( Mixer mixer) { boolean bSupported = mixer.isLineSupported(m_info); m_bSupported |= bSupported; // interrupt the iteration depending on the result return bSupported; } public boolean isSupported() { return m_bSupported; } } public static boolean isLineSupported(Line.Info info) { IsLineSupportedMixerAction action = new IsLineSupportedMixerAction(info); doMixerIteration(action); return action.isSupported(); } /** MixerAction for getLine(). */ private static class GetLineMixerAction implements MixerAction { private Line.Info m_info = null; private Line m_line = null; private boolean m_bLineTypeSupported = false; public GetLineMixerAction(Line.Info info) { m_info = info; } public boolean handleMixer( Mixer mixer) { try { Line line = mixer.getLine(m_info); if (m_line == null) { m_line = line; // interrupt the iteration return true; } } catch (LineUnavailableException e) { m_bLineTypeSupported = true; if (TDebug.TraceAudioSystem || TDebug.TraceAllExceptions) { TDebug.out(e); } } catch (IllegalArgumentException e) { if (TDebug.TraceAudioSystem || TDebug.TraceAllExceptions) { TDebug.out(e); } } // continue the iteration return false; } public Line getLine() { return m_line; } public boolean isLineTypeSupported() { return m_bLineTypeSupported; } } public static Line getLine(Line.Info info) throws LineUnavailableException { GetLineMixerAction action = new GetLineMixerAction(info); doMixerIteration(action); Line line = action.getLine(); if (line != null) { return line; } else if (action.isLineTypeSupported()) { throw new LineUnavailableException("currently no line available due to resource restrictions"); } else { throw new IllegalArgumentException("no mixer supporting this type of line: " + info); } } /** FormatConversionProviderAction for getTargetEncodings(). */ private static class GetTargetEncodingsFormatConversionProviderAction implements FormatConversionProviderAction { private Object m_sourceDescription; private Collection m_targetEncodings; //$$fb 2000-08-15: added for workaround below public GetTargetEncodingsFormatConversionProviderAction() { this(null); } public GetTargetEncodingsFormatConversionProviderAction( Object sourceDescription) { m_sourceDescription = sourceDescription; m_targetEncodings = new ArraySet(); } public boolean handleFormatConversionProvider( FormatConversionProvider formatConversionProvider) { // $$fb 2000-03-30 default to empty array AudioFormat.Encoding[] encodings = EMPTY_ENCODING_ARRAY; if (m_sourceDescription instanceof AudioFormat.Encoding) { // TODO: not directely implementable. Contact Sun. //$$fb 2000-08-15: see workaround below /* encodings = formatConversionProvider.getTargetEncodings( (AudioFormat.Encoding) m_sourceDescription); */ } else if (m_sourceDescription instanceof AudioFormat) { encodings = formatConversionProvider.getTargetEncodings( (AudioFormat) m_sourceDescription); } else { // TODO: debug message } m_targetEncodings.addAll(Arrays.asList(encodings)); // continue the iteration return false; } public AudioFormat.Encoding[] getEncodings() { return m_targetEncodings.toArray(EMPTY_ENCODING_ARRAY); } //$$fb 2000-08-15: added for workaround below public void setSourceDescription(Object sourceDescription) { m_sourceDescription = sourceDescription; } } //$$fb 2000-08-15: added for workaround below private static void doEncodingActionWorkaround(boolean bigEndian, AudioFormat.Encoding encoding, GetTargetEncodingsFormatConversionProviderAction action) { AudioFormat format=new AudioFormat( encoding, NOT_SPECIFIED, // sample rate NOT_SPECIFIED, // sample size in bits NOT_SPECIFIED, // channels NOT_SPECIFIED, // frame size NOT_SPECIFIED, // frame rate, bigEndian); action.setSourceDescription(format); doFormatConversionProviderIteration(action); } public static AudioFormat.Encoding[] getTargetEncodings( AudioFormat.Encoding sourceEncoding) { //$$fb 2000-08-15: workaround //return getTargetEncodings((Object) sourceEncoding); GetTargetEncodingsFormatConversionProviderAction action = new GetTargetEncodingsFormatConversionProviderAction(); doEncodingActionWorkaround(false, sourceEncoding, action); doEncodingActionWorkaround(true, sourceEncoding, action); return action.getEncodings(); } public static AudioFormat.Encoding[] getTargetEncodings( AudioFormat sourceFormat) { return getTargetEncodings((Object) sourceFormat); } private static AudioFormat.Encoding[] getTargetEncodings( Object sourceDescription) { GetTargetEncodingsFormatConversionProviderAction action = new GetTargetEncodingsFormatConversionProviderAction(sourceDescription); doFormatConversionProviderIteration(action); return action.getEncodings(); } /** FormatConversionProviderAction for isConversionSupported(). */ private static class IsConversionSupportedFormatConversionProviderAction implements FormatConversionProviderAction { private AudioFormat m_sourceFormat; /* * May be AudioFormat or AudioFormat.Encoding. */ private Object m_targetDescription; private boolean m_bSupported; public IsConversionSupportedFormatConversionProviderAction( AudioFormat sourceFormat, Object targetDescription) { m_sourceFormat = sourceFormat; m_targetDescription = targetDescription; m_bSupported = false; } public boolean handleFormatConversionProvider( FormatConversionProvider formatConversionProvider) { boolean bSupported = false; if (m_targetDescription instanceof AudioFormat.Encoding) { bSupported = formatConversionProvider.isConversionSupported( (AudioFormat.Encoding) m_targetDescription, m_sourceFormat); } else if (m_targetDescription instanceof AudioFormat) { bSupported = formatConversionProvider.isConversionSupported( (AudioFormat) m_targetDescription, m_sourceFormat); } else { // TODO: debug message } m_bSupported |= bSupported; // interrupt the iteration depending on the result return bSupported; } public boolean isSupported() { return m_bSupported; } } public static boolean isConversionSupported( AudioFormat.Encoding targetEncoding, AudioFormat sourceFormat) { IsConversionSupportedFormatConversionProviderAction action = new IsConversionSupportedFormatConversionProviderAction(sourceFormat, targetEncoding); doFormatConversionProviderIteration(action); return action.isSupported(); } /** FormatConversionProviderAction for getAudioInputStream(). */ private static class GetAudioInputStreamFormatConversionProviderAction implements FormatConversionProviderAction { private AudioInputStream m_sourceAudioInputStream; private Object m_targetDescription; private AudioInputStream m_targetAudioInputStream; public GetAudioInputStreamFormatConversionProviderAction( AudioInputStream audioInputStream, Object targetDescription) { m_sourceAudioInputStream = audioInputStream; m_targetDescription = targetDescription; m_targetAudioInputStream = null; } public boolean handleFormatConversionProvider( FormatConversionProvider formatConversionProvider) { AudioInputStream audioInputStream = null; try { if (m_targetDescription instanceof AudioFormat.Encoding) { audioInputStream = formatConversionProvider.getAudioInputStream( (AudioFormat.Encoding) m_targetDescription, m_sourceAudioInputStream); } else if (m_targetDescription instanceof AudioFormat) { audioInputStream = formatConversionProvider.getAudioInputStream( (AudioFormat) m_targetDescription, m_sourceAudioInputStream); } else { // TODO: debug message } m_targetAudioInputStream = audioInputStream; // interrupt the iteration return true; } catch (IllegalArgumentException e) { if (TDebug.TraceAudioSystem || TDebug.TraceAllExceptions) { TDebug.out(e); } } // continue the iteration return false; } public AudioInputStream getAudioInputStream() { return m_targetAudioInputStream; } } public static AudioInputStream getAudioInputStream( AudioFormat.Encoding targetEncoding, AudioInputStream sourceStream) { return getAudioInputStreamImpl(targetEncoding, sourceStream); } private static AudioInputStream getAudioInputStreamImpl( Object targetDescription, AudioInputStream sourceStream) { GetAudioInputStreamFormatConversionProviderAction action = new GetAudioInputStreamFormatConversionProviderAction(sourceStream, targetDescription); doFormatConversionProviderIteration(action); AudioInputStream audioInputStream = action.getAudioInputStream(); if (audioInputStream != null) { return audioInputStream; } else { throw new IllegalArgumentException("conversion not supported"); } } public static AudioFormat[] getTargetFormats( AudioFormat.Encoding targetEncoding, AudioFormat sourceFormat) { // TODO: return null; } public static boolean isConversionSupported( AudioFormat targetFormat, AudioFormat sourceFormat) { IsConversionSupportedFormatConversionProviderAction action = new IsConversionSupportedFormatConversionProviderAction(sourceFormat, targetFormat); doFormatConversionProviderIteration(action); return action.isSupported(); } public static AudioInputStream getAudioInputStream( AudioFormat targetFormat, AudioInputStream sourceStream) { return getAudioInputStreamImpl(targetFormat, sourceStream); } // $$fb 19 Dec 99: what about cascaded conversions ? // we'll never have an alround-converter doing all possible conversions. // we could implement an algorithm that, if no conversion is available, // in a second step a conversion to PCM is tried, followed by a conversion from // PCM to the requested target format. // we might even introduce a third level for inter-PCM-conversion. // e.g. we want to convert from aLaw 8000Hz to uLaw 44100Hz. // 1. the first round we won't find a direct converter // 2. try to find a converter from aLaw 8000 to PCM 44100 // we won't find it. // 3. third level: try to find a converter from alaw 8000 to PCM 8000 // we'll find one. // then find a converter from PCM 8000 to PCM 44100 // let's say we have that already. // then find a converter from PCM 44100 to ulaw 44100. // I think that sounds more impossible than it is, when // we have a powerful PCM-PCM converter. /* public static AudioInputStream getAudioInputStream(AudioFormat audioFormat, AudioInputStream audioInputStream) { Iterator formatConversionProviders = TAudioConfig.getFormatConversionProviders(); while (formatConversionProviders.hasNext()) { FormatConversionProvider formatConversionProvider = (FormatConversionProvider) formatConversionProviders.next(); if (TDebug.TraceAudioSystem) { System.out.print("AudioSystem.getAudioInputStream(AudioFormat, AudioInputStream): asking FormatConversionProvider: " + formatConversionProvider + "..."); } try { AudioInputStream outputStream = formatConversionProvider.getConvertedStream(audioFormat, audioInputStream); if (TDebug.TraceAudioSystem) { TDebug.out("ok"); } return outputStream; } catch (IllegalArgumentException e) { if (TDebug.TraceAudioSystem || TDebug.TraceAllExceptions) { TDebug.out("failed"); TDebug.out(e); } } } if (TDebug.TraceAudioSystem) { TDebug.out("AudioSystem.getAudioInputStream(AudioFormat, AudioInputStream): no suitable FormatConversionProvider found. Returning null."); } return null; } */ /* public static AudioInputStream getAudioInputStream(Type encoding, AudioInputStream audioInputStream) { AudioFormat inputFormat = audioInputStream.getFormat(); // $$fb 19 Dec 99: Here I think, sample size in bits and framesize should // be set to NOT_SPECIFIED, as we cannot assume that it stays // the same with the new encoding. */ /* $$mp19991220: Yes, possible optimisation: find all formats with the given encoding that can be generated by conversion from the stream. Then pick the one nearest to the original format. */ /* AudioFormat outputFormat = new AudioFormat(encoding, inputFormat.getSampleRate(), inputFormat.getSampleSizeInBits(), inputFormat.getChannels(), inputFormat.getFrameSize(), inputFormat.getFrameRate(), inputFormat.isBigEndian()); return getAudioInputStream(outputFormat, audioInputStream); } */ /** AudioFileReaderAction for getAudioFileFormat(). */ private static class GetAudioFileFormatAudioFileReaderAction implements AudioFileReaderAction { private Object m_source = null; private AudioFileFormat m_audioFileFormat = null; public GetAudioFileFormatAudioFileReaderAction(Object source) { m_source = source; } public boolean handleAudioFileReader( AudioFileReader audioFileReader) throws IOException { AudioFileFormat audioFileFormat = null; try { if (m_source instanceof InputStream) { audioFileFormat = audioFileReader.getAudioFileFormat((InputStream) m_source); } else if (m_source instanceof File) { audioFileFormat = audioFileReader.getAudioFileFormat((File) m_source); } else if (m_source instanceof URL) { audioFileFormat = audioFileReader.getAudioFileFormat((URL) m_source); } else { // TODO: debug message } if (m_audioFileFormat == null) { m_audioFileFormat = audioFileFormat; // interrupt the iteration return true; } } catch (UnsupportedAudioFileException e) { if (TDebug.TraceAudioSystem || TDebug.TraceAllExceptions) { TDebug.out(e); } } // continue the iteration return false; } public AudioFileFormat getAudioFileFormat() { return m_audioFileFormat; } } public static AudioFileFormat getAudioFileFormat( InputStream inputStream) throws UnsupportedAudioFileException, IOException { return getAudioFileFormatImpl(inputStream); } public static AudioFileFormat getAudioFileFormat(URL url) throws UnsupportedAudioFileException, IOException { return getAudioFileFormatImpl(url); } public static AudioFileFormat getAudioFileFormat(File file) throws UnsupportedAudioFileException, IOException { return getAudioFileFormatImpl(file); } private static AudioFileFormat getAudioFileFormatImpl( Object source) throws UnsupportedAudioFileException, IOException { GetAudioFileFormatAudioFileReaderAction action = new GetAudioFileFormatAudioFileReaderAction(source); doAudioFileReaderIteration(action); AudioFileFormat audioFileFormat = action.getAudioFileFormat(); if (audioFileFormat != null) { return audioFileFormat; } else { throw new UnsupportedAudioFileException("format not supported"); } } /** AudioFileReaderAction for getAudioInputStream(). */ private static class GetAudioInputStreamAudioFileReaderAction implements AudioFileReaderAction { private Object m_source = null; private AudioInputStream m_audioInputStream = null; public GetAudioInputStreamAudioFileReaderAction(Object source) { m_source = source; } public boolean handleAudioFileReader( AudioFileReader audioFileReader) throws IOException { AudioInputStream audioInputStream = null; try { if (m_source instanceof InputStream) { audioInputStream = audioFileReader.getAudioInputStream((InputStream) m_source); } else if (m_source instanceof File) { audioInputStream = audioFileReader.getAudioInputStream((File) m_source); } else if (m_source instanceof URL) { audioInputStream = audioFileReader.getAudioInputStream((URL) m_source); } else { // TODO: debug message } if (m_audioInputStream == null) { m_audioInputStream = audioInputStream; // interrupt the iteration return true; } } catch (UnsupportedAudioFileException e) { if (TDebug.TraceAudioSystem || TDebug.TraceAllExceptions) { TDebug.out(e); } } // continue the iteration return false; } public AudioInputStream getAudioInputStream() { return m_audioInputStream; } } public static AudioInputStream getAudioInputStream(InputStream inputStream) throws UnsupportedAudioFileException, IOException { return getAudioInputStreamImpl(inputStream); } public static AudioInputStream getAudioInputStream(URL url) throws UnsupportedAudioFileException, IOException { return getAudioInputStreamImpl(url); } public static AudioInputStream getAudioInputStream(File file) throws UnsupportedAudioFileException, IOException { return getAudioInputStreamImpl(file); } private static AudioInputStream getAudioInputStreamImpl( Object source) throws UnsupportedAudioFileException, IOException { GetAudioInputStreamAudioFileReaderAction action = new GetAudioInputStreamAudioFileReaderAction(source); doAudioFileReaderIteration(action); AudioInputStream audioInputStream = action.getAudioInputStream(); if (audioInputStream != null) { return audioInputStream; } else { throw new UnsupportedAudioFileException("format not supported"); } } public static AudioFileFormat.Type[] getAudioFileTypes() { Set supportedTypes = new HashSet(); Iterator audioFileWriters = TAudioConfig.getAudioFileWriters(); if (TDebug.TraceAudioSystem) { TDebug.out(">AudioSystem.getAudioFileTypes()"); } while (audioFileWriters.hasNext()) { AudioFileWriter audioFileProvider = (AudioFileWriter) audioFileWriters.next(); if (TDebug.TraceAudioSystem) { TDebug.out("trying AudioFileWriter: " + audioFileProvider); } AudioFileFormat.Type[] aSupportedTypes = audioFileProvider.getAudioFileTypes(); if (TDebug.TraceAudioSystem) { TDebug.out("this AudioFileWriter supports the following Types:"); } for (int i = 0; i < aSupportedTypes.length; i++) { if (TDebug.TraceAudioSystem) { TDebug.out(aSupportedTypes[i].toString()); } supportedTypes.add(aSupportedTypes[i]); } } if (TDebug.TraceAudioSystem) { TDebug.out("< returning " + supportedTypes.size() + " types."); } return supportedTypes.toArray(EMPTY_TYPE_ARRAY); } /** AudioFileWriterAction for isFileTypeSupported(). */ private static class IsFileTypeSupportedAudioFileWriterAction implements AudioFileWriterAction { private AudioFileFormat.Type m_fileType; private AudioInputStream m_audioInputStream; private boolean m_bSupported; public IsFileTypeSupportedAudioFileWriterAction( AudioFileFormat.Type fileType, AudioInputStream audioInputStream) { m_fileType = fileType; m_audioInputStream = audioInputStream; m_bSupported = false; } public boolean handleAudioFileWriter( AudioFileWriter mixer) { boolean bSupported = false; if (m_audioInputStream == null) { bSupported = mixer.isFileTypeSupported( m_fileType); } else { bSupported = mixer.isFileTypeSupported( m_fileType, m_audioInputStream); } m_bSupported |= bSupported; // interrupt the iteration depending on the result return bSupported; } public boolean isSupported() { return m_bSupported; } } public static boolean isFileTypeSupported( AudioFileFormat.Type fileType) { return isFileTypeSupported(fileType, null); } public static AudioFileFormat.Type[] getAudioFileTypes( AudioInputStream audioInputStream) { Set supportedTypes = new HashSet(); Iterator audioFileWriters = TAudioConfig.getAudioFileWriters(); if (TDebug.TraceAudioSystem) { TDebug.out(">AudioSystem.getAudioFileTypes()"); } while (audioFileWriters.hasNext()) { AudioFileWriter audioFileProvider = (AudioFileWriter) audioFileWriters.next(); if (TDebug.TraceAudioSystem) { TDebug.out("trying AudioFileWriter: " + audioFileProvider); } AudioFileFormat.Type[] aSupportedTypes = audioFileProvider.getAudioFileTypes(audioInputStream); if (TDebug.TraceAudioSystem) { TDebug.out("this AudioFileWriter supports the following Types:"); } for (int i = 0; i < aSupportedTypes.length; i++) { if (TDebug.TraceAudioSystem) { TDebug.out(aSupportedTypes[i].toString()); } supportedTypes.add(aSupportedTypes[i]); } } if (TDebug.TraceAudioSystem) { TDebug.out("< returning " + supportedTypes.size() + " types."); } return supportedTypes.toArray(EMPTY_TYPE_ARRAY); } public static boolean isFileTypeSupported( AudioFileFormat.Type fileType, AudioInputStream audioInputStream) { IsFileTypeSupportedAudioFileWriterAction action = new IsFileTypeSupportedAudioFileWriterAction( fileType, audioInputStream); try { doAudioFileWriterIteration(action); } catch (IOException e) { if (TDebug.TraceAllExceptions) { TDebug.out(e); } } return action.isSupported(); } /** AudioFileWriterAction for write(). */ private static class WriteAudioFileWriterAction implements AudioFileWriterAction { private AudioInputStream m_audioInputStream; private AudioFileFormat.Type m_fileType; private Object m_destination; private int m_nWritten; public WriteAudioFileWriterAction( AudioInputStream audioInputStream, AudioFileFormat.Type fileType, Object destination) { m_audioInputStream = audioInputStream; m_fileType = fileType; m_destination = destination; m_nWritten = -1; } // $$fb 2000-04-02: variable should be called "audioFileWriter" (too much copy&paste :) public boolean handleAudioFileWriter( AudioFileWriter audioFileWriter) throws IOException { int nWritten = -1; // $$fb 2000-04-02: need to check whether this audioFileWriter is actually // capable of handling this file type ! if (TDebug.TraceAudioSystem) { TDebug.out(">AudioSystem.handleAudioFileWriter("+audioFileWriter.getClass().getName()+") checking for type "+m_fileType); } if (!audioFileWriter.isFileTypeSupported(m_fileType)) { if (TDebug.TraceAudioSystem) { TDebug.out("< is not capable of handling this file type"); } return false; } try { if (m_destination instanceof OutputStream) { // $$fb 2000-04-02: s.a. nWritten = audioFileWriter.write( m_audioInputStream, m_fileType, (OutputStream) m_destination); } else if (m_destination instanceof File) { // $$fb 2000-04-02: s.a. nWritten = audioFileWriter.write( m_audioInputStream, m_fileType, (File) m_destination); } else { // TODO: debug message } m_nWritten = nWritten; if (TDebug.TraceAudioSystem) { TDebug.out("< wrote "+nWritten+" bytes"); } // interrupt the iteration return true; } catch (IllegalArgumentException e) { if (TDebug.TraceAudioSystem || TDebug.TraceAllExceptions) { TDebug.out(e); } } if (TDebug.TraceAudioSystem) { TDebug.out("< does not support this file type."); } // continue the iteration return false; } public int getWritten() { return m_nWritten; } } public static int write(AudioInputStream inputStream, AudioFileFormat.Type fileType, OutputStream outputStream) throws IOException { return writeImpl(inputStream, fileType, outputStream); } public static int write(AudioInputStream inputStream, AudioFileFormat.Type fileType, File file) throws IOException { return writeImpl(inputStream, fileType, file); } private static int writeImpl(AudioInputStream audioInputStream, AudioFileFormat.Type fileType, Object destination) throws IOException { WriteAudioFileWriterAction action = new WriteAudioFileWriterAction( audioInputStream, fileType, destination); doAudioFileWriterIteration(action); int nWritten = action.getWritten(); if (nWritten == -1) { throw new IllegalArgumentException("format not supported"); } else { return nWritten; } } ////////////////////////////////////////////////////////////// // // auxiliary methods and interfaces // ////////////////////////////////////////////////////////////// private static interface MixerProviderAction { public boolean handleMixerProvider(MixerProvider mixerProvider); } /** Iterates over the available MixerProviders. * For each MixerProvider, the mathod handleMixerProvider() of * the passed MixerProviderAction is called with the MixerProvider * in question as the only argument. */ private static void doMixerProviderIteration( MixerProviderAction action) { Iterator mixerProviders = TAudioConfig.getMixerProviders(); boolean bCompleted = false; if (TDebug.TraceAudioSystem) { TDebug.out(">AudioSystem.doMixerProviderIteration()"); } while (mixerProviders.hasNext() && ! bCompleted) { MixerProvider mixerProvider = (MixerProvider) mixerProviders.next(); if (TDebug.TraceAudioSystem) { TDebug.out("handling MixerProvider: " + mixerProvider); } bCompleted = action.handleMixerProvider(mixerProvider); } if (TDebug.TraceAudioSystem) { TDebug.out("< completed="+bCompleted); } } private static interface MixerAction { public boolean handleMixer(Mixer mixer); } /** Iterates over the available MixerProviders. * For each MixerProvider, the mathod handleMixerProvider() of * the passed MixerProviderAction is called with the MixerProvider * in question as the only argument. */ private static void doMixerIteration( MixerAction action) { Mixer.Info[] mixerInfos = getMixerInfo(); boolean bCompleted = false; if (TDebug.TraceAudioSystem) { TDebug.out(">AudioSystem.doMixerIteration()"); } for (int nMixer = 0; nMixer < mixerInfos.length && ! bCompleted; nMixer++) { Mixer mixer = getMixer(mixerInfos[nMixer]); if (TDebug.TraceAudioSystem) { TDebug.out("handling Mixer: " + mixer); } bCompleted = action.handleMixer(mixer); } if (TDebug.TraceAudioSystem) { TDebug.out("< completed="+bCompleted); } } private static interface FormatConversionProviderAction { public boolean handleFormatConversionProvider(FormatConversionProvider formatConversionProvider); // throws IOException; } /** Iterates over the available FormatConversionProviders. * For each FormatConversionProvider, the mathod handleFormatConversionProvider() of * the passed FormatConversionProviderAction is called with the FormatConversionProvider * in question as the only argument. */ private static void doFormatConversionProviderIteration( FormatConversionProviderAction action) // throws IOException { Iterator formatConversionProviders = TAudioConfig.getFormatConversionProviders(); boolean bCompleted = false; if (TDebug.TraceAudioSystem) { TDebug.out(">AudioSystem.doFormatConversionProviderIteration()"); } while (formatConversionProviders.hasNext() && ! bCompleted) { FormatConversionProvider formatConversionProvider = (FormatConversionProvider) formatConversionProviders.next(); if (TDebug.TraceAudioSystem) { TDebug.out("handling FormatConversionProvider: " + formatConversionProvider); } bCompleted = action.handleFormatConversionProvider(formatConversionProvider); } if (TDebug.TraceAudioSystem) { TDebug.out("< completed="+bCompleted); } } private static interface AudioFileReaderAction { public boolean handleAudioFileReader(AudioFileReader audioFileReader) throws IOException; } /** Iterates over the available AudioFileReaders. * For each AudioFileReader, the mathod handleAudioFileReader() of * the passed AudioFileReaderAction is called with the AudioFileReader * in question as the only argument. */ private static void doAudioFileReaderIteration( AudioFileReaderAction action) throws IOException { Iterator audioFileReaders = TAudioConfig.getAudioFileReaders(); boolean bCompleted = false; if (TDebug.TraceAudioSystem) { TDebug.out(">AudioSystem.doAudioFileReaderIteration()"); } while (audioFileReaders.hasNext() && ! bCompleted) { AudioFileReader audioFileReader = (AudioFileReader) audioFileReaders.next(); if (TDebug.TraceAudioSystem) { TDebug.out("handling AudioFileReader: " + audioFileReader); } bCompleted = action.handleAudioFileReader(audioFileReader); } if (TDebug.TraceAudioSystem) { TDebug.out("< completed="+bCompleted); } } private static interface AudioFileWriterAction { public boolean handleAudioFileWriter(AudioFileWriter audioFileWriter) throws IOException; } /** Iterates over the available AudioFileWriters. * For each AudioFileWriter, the mathod handleAudioFileWriter() of * the passed AudioFileWriterAction is called with the AudioFileWriter * in question as the only argument. */ private static void doAudioFileWriterIteration( AudioFileWriterAction action) throws IOException { Iterator audioFileWriters = TAudioConfig.getAudioFileWriters(); boolean bCompleted = false; if (TDebug.TraceAudioSystem) { TDebug.out(">AudioSystem.doAudioFileWriterIteration()"); } while (audioFileWriters.hasNext() && ! bCompleted) { AudioFileWriter audioFileWriter = (AudioFileWriter) audioFileWriters.next(); if (TDebug.TraceAudioSystem) { TDebug.out("handling AudioFileWriter: " + audioFileWriter); } bCompleted = action.handleAudioFileWriter(audioFileWriter); } if (TDebug.TraceAudioSystem) { TDebug.out("< completed="+bCompleted); } } } /*** AudioSystem.java ***/ libtritonus-java-20070428/src/classes/javax/sound/sampled/BooleanControl.java0000644000175000017500000000520510172422337027115 0ustar twernertwerner/* * BooleanControl.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package javax.sound.sampled; import org.tritonus.share.TDebug; public abstract class BooleanControl extends Control { private static final String DEFAULT_TRUE_LABEL = "true"; private static final String DEFAULT_FALSE_LABEL = "false"; private boolean m_bValue; private String m_strTrueLabel; private String m_strFalseLabel; protected BooleanControl(Type type, boolean bInitialValue, String strTrueLabel, String strFalseLabel) { super(type); if (TDebug.TraceControl) { TDebug.out("BooleanControl.: begin"); } /* $$mp 2001-02-06: TODO: what's the matter with this? */ //$$fb 2000-12-02: incompatible with Sun implementation... //setValue(bInitialValue); m_bValue = bInitialValue; m_strTrueLabel = strTrueLabel; m_strFalseLabel = strFalseLabel; if (TDebug.TraceControl) { TDebug.out("BooleanControl.: end"); } } protected BooleanControl(Type type, boolean bInitialValue) { this(type, bInitialValue, DEFAULT_TRUE_LABEL, DEFAULT_FALSE_LABEL); } public void setValue(boolean bValue) { m_bValue = bValue; } public boolean getValue() { return m_bValue; } public String getStateLabel(boolean bState) { if (bState) { return m_strTrueLabel; } else { return m_strFalseLabel; } } public String toString() { return super.toString() + " state = " + getStateLabel(getValue()); } public static class Type extends Control.Type { public static final Type MUTE = new Type("MUTE"); public static final Type APPLY_REVERB = new Type("APPLY_REVERB"); protected Type(String strName) { super(strName); } } } /*** BooleanControl.java ***/ libtritonus-java-20070428/src/classes/javax/sound/sampled/Clip.java0000644000175000017500000000325110172422337025063 0ustar twernertwerner/* * Clip.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package javax.sound.sampled; import java.io.IOException; public interface Clip extends DataLine { // TODO: check value against sun implementation public static final int LOOP_CONTINUOUSLY = -1; public void open(AudioFormat audioFormat, byte[] abData, int nOffset, int nBufferSize) throws LineUnavailableException; public void open(AudioInputStream audioInputStream) throws LineUnavailableException, IOException; public int getFrameLength(); public long getMicrosecondLength(); public void setFramePosition(int nFrames); public void setMicrosecondPosition(long lMicroseconds); public void setLoopPoints(int nStart, int nEnd); public void loop(int nCount); } /*** Clip.java ***/ libtritonus-java-20070428/src/classes/javax/sound/sampled/CompoundControl.java0000644000175000017500000000361510172422337027325 0ustar twernertwerner/* * CompoundControl.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999 - 2004 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package javax.sound.sampled; import java.util.Arrays; import java.util.Collection; import org.tritonus.share.TDebug; public abstract class CompoundControl extends Control { private static final Control[] EMPTY_CONTROL_ARRAY = new Control[0]; private Collection m_memberControls; protected CompoundControl(Type type, Control[] aMemberControls) { super(type); if (TDebug.TraceControl) TDebug.out("CompoundControl.: begin"); m_memberControls = Arrays.asList(aMemberControls); if (TDebug.TraceControl) TDebug.out("CompoundControl.: end"); } public Control[] getMemberControls() { return m_memberControls.toArray(EMPTY_CONTROL_ARRAY); } public String toString() { // TODO: return super.toString() + " components: " + ""; } public static class Type extends Control.Type { protected Type(String strName) { super(strName); } } } /*** CompoundControl.java ***/ libtritonus-java-20070428/src/classes/javax/sound/sampled/Control.java0000644000175000017500000000343610172422337025621 0ustar twernertwerner/* * Control.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package javax.sound.sampled; import org.tritonus.share.TDebug; public abstract class Control { private Type m_type; protected Control(Type type) { if (TDebug.TraceControl) { TDebug.out("Control.: begin"); } m_type = type; if (TDebug.TraceControl) { TDebug.out("Control.: end"); } } public Type getType() { return m_type; } public String toString() { return super.toString() + "[type = " + getType() + "]"; } public static class Type { private String m_strName; protected Type(String strName) { m_strName = strName; } public final boolean equals(Object obj) { return super.equals(obj); } public final int hashCode() { return super.hashCode(); } public final String toString() { return m_strName; } } } /*** Control.java ***/ libtritonus-java-20070428/src/classes/javax/sound/sampled/DataLine.java0000644000175000017500000001267410172422337025666 0ustar twernertwerner/* * DataLine.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package javax.sound.sampled; import java.util.List; import java.util.Arrays; import java.util.Iterator; import org.tritonus.share.TDebug; import org.tritonus.share.sampled.AudioFormats; public interface DataLine extends Line { public void drain(); public void flush(); public void start(); public void stop(); public boolean isRunning(); public boolean isActive(); public AudioFormat getFormat(); public int getBufferSize(); public int available(); public int getFramePosition(); public long getMicrosecondPosition(); public float getLevel(); public static class Info extends Line.Info { private AudioFormat[] EMPTY_AUDIO_FORMAT_ARRAY = new AudioFormat[0]; private List m_audioFormats; private int m_nMinBufferSize; private int m_nMaxBufferSize; public Info(Class lineClass, AudioFormat[] aAudioFormats, int nMinBufferSize, int nMaxBufferSize) { super(lineClass); m_audioFormats = Arrays.asList(aAudioFormats); m_nMinBufferSize = nMinBufferSize; m_nMaxBufferSize = nMaxBufferSize; } public Info(Class lineClass, AudioFormat audioFormat, int nBufferSize) { this(lineClass, new AudioFormat[]{audioFormat}, nBufferSize, nBufferSize); } public Info(Class lineClass, AudioFormat audioFormat) { this(lineClass, audioFormat, AudioSystem.NOT_SPECIFIED); } public AudioFormat[] getFormats() { return m_audioFormats.toArray(EMPTY_AUDIO_FORMAT_ARRAY); } public boolean isFormatSupported(AudioFormat audioFormat) { Iterator formats = m_audioFormats.iterator(); while (formats.hasNext()) { AudioFormat format = formats.next(); if (AudioFormats.matches(format, audioFormat)) { return true; } } return false; } public int getMinBufferSize() { return m_nMinBufferSize; } public int getMaxBufferSize() { return m_nMaxBufferSize; } public boolean matches(Line.Info info) { if (TDebug.TraceDataLine) { TDebug.out(">DataLine.Info.matches(): called"); TDebug.out("DataLine.Info.matches(): own info: " + this.toString()); TDebug.out("DataLine.Info.matches(): test info: " + info.toString()); } if (!super.matches(info)) { if (TDebug.TraceDataLine) TDebug.out(" dataLineInfo.getMaxBufferSize()) ) { if (TDebug.TraceDataLine) TDebug.out(" formats = m_audioFormats.iterator(); while (formats.hasNext()) { AudioFormat format = formats.next(); if (TDebug.TraceDataLine) TDebug.out("checking if supported: " + format); if (!dataLineInfo.isFormatSupported(format)) { if (TDebug.TraceDataLine) TDebug.out("< format doesn't match"); return false; } } /* AudioFormat[] infoFormats = dataLineInfo.getFormats(); for (int i = 0; i < infoFormats.length; i++) { if (TDebug.TraceDataLine) { TDebug.out("checking if supported: " + infoFormats[i]); } if (!isFormatSupported(infoFormats[i])) { if (TDebug.TraceDataLine) { TDebug.out("< formats do not match"); } return false; } } */ if (TDebug.TraceDataLine) { TDebug.out("< matches: true"); } return true; } public String toString() { AudioFormat[] aFormats = getFormats(); String strFormats = "formats:\n"; for (int i = 0; i < aFormats.length; i++) { strFormats += aFormats[i].toString() + "\n"; } return super.toString() + strFormats + "minBufferSize=" + getMinBufferSize() + " maxBufferSize=" + getMaxBufferSize(); } } } /*** DataLine.java ***/ libtritonus-java-20070428/src/classes/javax/sound/sampled/EnumControl.java0000644000175000017500000000430010172422337026435 0ustar twernertwerner/* * EnumControl.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package javax.sound.sampled; import java.util.Collection; import java.util.Arrays; import org.tritonus.share.TDebug; public abstract class EnumControl extends Control { private static final Object[] EMPTY_OBJECT_ARRAY = new Object[0]; private Object m_value; private Collection m_values; protected EnumControl(Type type, Object[] aValues, Object value) { super(type); if (TDebug.TraceControl) { TDebug.out("EnumControl.: begin"); } m_values = Arrays.asList(aValues); setValue(value); if (TDebug.TraceControl) { TDebug.out("EnumControl.: end"); } } public void setValue(Object value) { if (m_values.contains(value)) { m_value = value; } else { throw new IllegalArgumentException("illegal value " + value); } } public Object getValue() { return m_value; } public Object[] getValues() { return m_values.toArray(EMPTY_OBJECT_ARRAY); } public String toString() { return super.toString() + " [value = " + getValue() + "]"; } public static class Type extends Control.Type { public static final Type REVERB = new Type("REVERB"); protected Type(String strName) { super(strName); } } } /*** EnumControl.java ***/ libtritonus-java-20070428/src/classes/javax/sound/sampled/FloatControl.java0000644000175000017500000001050210374160730026577 0ustar twernertwerner/* * FloatControl.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package javax.sound.sampled; import org.tritonus.share.TDebug; public abstract class FloatControl extends Control { private float m_fValue; private float m_fMinimum; private float m_fMaximum; private float m_fPrecision; private int m_nUpdatePeriod; private String m_strUnits; private String m_strMinLabel; private String m_strMidLabel; private String m_strMaxLabel; protected FloatControl(Type type, float fMinimum, float fMaximum, float fPrecision, int nUpdatePeriod, float fInitialValue, String strUnits, String strMinLabel, String strMidLabel, String strMaxLabel) { super(type); if (TDebug.TraceControl) { TDebug.out("FloatControl.: begin"); } m_fMinimum = fMinimum; m_fMaximum = fMaximum; m_fPrecision = fPrecision; m_nUpdatePeriod = nUpdatePeriod; //$$fb 2000-12-02: incompatible with Sun implementation... //setValue(fInitialValue); m_fValue = fInitialValue; m_nUpdatePeriod = nUpdatePeriod; m_strMinLabel = strMinLabel; m_strMidLabel = strMidLabel; m_strMaxLabel = strMaxLabel; if (TDebug.TraceControl) { TDebug.out("FloatControl.: end"); } } protected FloatControl(Type type, float fMinimum, float fMaximum, float fPrecision, int nUpdatePeriod, float fInitialValue, String strUnits) { this(type, fMinimum, fMaximum, fPrecision, nUpdatePeriod, fInitialValue, strUnits, "Left", "Center", "Right"); } /** Set the value of the control. If subclasses need to override this method, super.setValue() should be called at the beginning of the overriding implementation. */ public void setValue(float fValue) { m_fValue = fValue; } public float getValue() { return m_fValue; } public float getMaximum() { return m_fMaximum; } public float getMinimum() { return m_fMinimum; } public String getUnits() { return m_strUnits; } public String getMinLabel() { return m_strMinLabel; } public String getMidLabel() { return m_strMidLabel; } public String getMaxLabel() { return m_strMaxLabel; } public float getPrecision() { return m_fPrecision; } public int getUpdatePeriod() { return m_nUpdatePeriod; } public void shift(float fFrom, float fTo, int nMicroseconds) { /* This default implementation is required by the specification. */ setValue(fTo); } public String toString() { return super.toString() + " [value = " + getValue() + "]"; } public static class Type extends Control.Type { public static final Type MASTER_GAIN = new Type("MASTER_GAIN"); public static final Type AUX_SEND = new Type("AUX_SEND"); public static final Type AUX_RETURN = new Type("AUX_RETURN"); public static final Type REVERB_SEND = new Type("REVERB_SEND"); public static final Type REVERB_RETURN = new Type("REVERB_RETURN"); public static final Type VOLUME = new Type("VOLUME"); public static final Type PAN = new Type("PAN"); public static final Type BALANCE = new Type("BALANCE"); //$$fb 2000-12-02: SAMPLE_RATE had been missing public static final Type SAMPLE_RATE = new Type("SAMPLE RATE"); protected Type(String strName) { super(strName); } } } /*** FloatControl.java ***/ libtritonus-java-20070428/src/classes/javax/sound/sampled/Line.java0000644000175000017500000000353710172422337025072 0ustar twernertwerner/* * Line.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package javax.sound.sampled; public interface Line { public Line.Info getLineInfo(); public void open() throws LineUnavailableException; public void close(); public boolean isOpen(); public Control[] getControls(); public boolean isControlSupported(Control.Type controlType); public Control getControl(Control.Type controlType); public void addLineListener(LineListener listener); public void removeLineListener(LineListener listener); public static class Info { private Class m_lineClass; public Info(Class lineClass) { m_lineClass = lineClass; } public Class getLineClass() { return m_lineClass; } public boolean matches(Line.Info info) { return this.getLineClass() == info.getLineClass(); } public String toString() { return super.toString() + "[lineClass=" + getLineClass() + "]"; } } } /*** Line.java ***/ libtritonus-java-20070428/src/classes/javax/sound/sampled/LineEvent.java0000644000175000017500000000425610172422337026073 0ustar twernertwerner/* * LineEvent.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package javax.sound.sampled; import java.util.EventObject; public class LineEvent extends EventObject { static final long serialVersionUID = -1274246333383880410L; private Type m_type; private long m_lPosition; public LineEvent(Line line, Type type, long lPosition) { super(line); m_type = type; m_lPosition = lPosition; } public Line getLine() { return (Line) getSource(); } public Type getType() { return m_type; } public long getFramePosition() { return m_lPosition; } public String toString() { return super.toString() + "[type=" + getType() + ", framePosition=" + getFramePosition() + "]"; } public static class Type { public static final Type OPEN = new Type("OPEN"); public static final Type CLOSE = new Type("CLOSE"); public static final Type START = new Type("START"); public static final Type STOP = new Type("STOP"); private String m_strName; public Type(String strName) { m_strName = strName; } public final boolean equals(Object obj) { return super.equals(obj); } public final int hashCode() { return super.hashCode(); } public String toString() { return m_strName; } } } /*** LineEvent.java ***/ libtritonus-java-20070428/src/classes/javax/sound/sampled/LineListener.java0000644000175000017500000000223510172422337026572 0ustar twernertwerner/* * LineListener.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package javax.sound.sampled; import java.util.EventListener; public interface LineListener extends EventListener { public void update(LineEvent event); } /*** LineListener.java ***/ libtritonus-java-20070428/src/classes/javax/sound/sampled/LineUnavailableException.java0000644000175000017500000000234610172422337031112 0ustar twernertwerner/* * LineUnavailableException.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package javax.sound.sampled; public class LineUnavailableException extends Exception { public LineUnavailableException() { } public LineUnavailableException(String strMessage) { super(strMessage); } } /*** LineUnavailableException.java ***/ libtritonus-java-20070428/src/classes/javax/sound/sampled/Mixer.java0000644000175000017500000000511310172422337025257 0ustar twernertwerner/* * Mixer.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999, 2000 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package javax.sound.sampled; public interface Mixer extends Line { public Mixer.Info getMixerInfo(); public Line.Info[] getSourceLineInfo(); public Line.Info[] getTargetLineInfo(); public Line.Info[] getSourceLineInfo(Line.Info info); public Line.Info[] getTargetLineInfo(Line.Info info); public boolean isLineSupported(Line.Info info); public Line getLine(Line.Info info) throws LineUnavailableException; public int getMaxLines(Line.Info info); public Line[] getSourceLines(); public Line[] getTargetLines(); public void synchronize(Line[] aLines, boolean bMaintainSync); public void unsynchronize(Line[] aLines); public boolean isSynchronizationSupported(Line[] aLines, boolean bMaintainSync); public static class Info { private String m_strName; private String m_strVendor; private String m_strDescription; private String m_strVersion; protected Info(String strName, String strVendor, String strDescription, String strVersion) { m_strName = strName; m_strVendor = strVendor; m_strDescription = strDescription; m_strVersion = strVersion; } public boolean equals(Object obj) { return super.equals(obj); } public int hashCode() { return super.hashCode(); } public String getName() { return m_strName; } public String getVendor() { return m_strVendor; } public String getDescription() { return m_strDescription; } public String getVersion() { return m_strVersion; } public String toString() { return super.toString() /* + TODO: .... */; } } } /*** Mixer.java ***/ libtritonus-java-20070428/src/classes/javax/sound/sampled/Port.java0000644000175000017500000000527010172422337025123 0ustar twernertwerner/* * Port.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999, 2000 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package javax.sound.sampled; import org.tritonus.share.TDebug; public interface Port extends Line { public static class Info extends Line.Info { public static Class getPortClass() { try { return Class.forName("javax.sound.sampled.Port"); } catch (ClassNotFoundException e) { if (TDebug.TraceAllExceptions) { TDebug.out(e); } } return null; } public static final Info MICROPHONE = new Info(getPortClass(), "MICROPHONE", true); public static final Info LINE_IN = new Info(getPortClass(), "LINE_IN", true); public static final Info COMPACT_DISC = new Info(getPortClass(), "COMPACT_DISC", true); public static final Info SPEAKER = new Info(getPortClass(), "SPEAKER", false); public static final Info HEADPHONE = new Info(getPortClass(), "HEADPHONE", false); public static final Info LINE_OUT = new Info(getPortClass(), "LINE_OUT", false); private String m_strName; private boolean m_bIsSource; public Info(Class lineClass, String strName, boolean bIsSource) { super(lineClass); m_strName = strName; m_bIsSource = bIsSource; } public String getName() { return m_strName; } public boolean isSource() { return m_bIsSource; } public boolean matches(Line.Info info) { return super.matches(info) && this.getName().equals(((Port.Info) info).getName()) && this.isSource() == ((Port.Info) info).isSource(); } public final boolean equals(Object obj) { return super.equals(obj); } public final int hashCode() { return super.hashCode(); } public final String toString() { return super.toString() + "[name=" + getName() + ", source = " + isSource() + "]"; } } } /*** Port.java ***/ libtritonus-java-20070428/src/classes/javax/sound/sampled/ReverbType.java0000644000175000017500000000532610172422337026270 0ustar twernertwerner/* * ReverbType.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2000 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package javax.sound.sampled; public class ReverbType { private String m_strName; private int m_nEarlyReflectionDelay; private float m_fEarlyReflectionIntensity; private int m_nLateReflectionDelay; private float m_fLateReflectionIntensity; private int m_nDecayTime; protected ReverbType(String strName, int nEarlyReflectionDelay, float fEarlyReflectionIntensity, int nLateReflectionDelay, float fLateReflectionIntensity, int nDecayTime) { m_strName = strName; m_nEarlyReflectionDelay = nEarlyReflectionDelay; m_fEarlyReflectionIntensity = fEarlyReflectionIntensity; m_nLateReflectionDelay = nLateReflectionDelay; m_fLateReflectionIntensity = fLateReflectionIntensity; m_nDecayTime = nDecayTime; } public String getName() { return m_strName; } public int getEarlyReflectionDelay() { return m_nEarlyReflectionDelay; } public float getEarlyReflectionIntensity() { return m_fEarlyReflectionIntensity; } public int getLateReflectionDelay() { return m_nLateReflectionDelay; } public float getLateReflectionIntensity() { return m_fLateReflectionIntensity; } public int getDecayTime() { return m_nDecayTime; } public final boolean equals(Object obj) { return super.equals(obj); } public final int hashCode() { return super.hashCode(); } public final String toString() { return super.toString() + "[name=" + getName() + ", earlyReflectionDelay = " + getEarlyReflectionDelay() + ", earlyReflectionIntensity = " + getEarlyReflectionIntensity() + ", lateReflectionDelay = " + getLateReflectionDelay() + ", lateReflectionIntensity = " + getLateReflectionIntensity() + ", decayTime = " + getDecayTime() + "]"; } } /*** ReverbType.java ***/ libtritonus-java-20070428/src/classes/javax/sound/sampled/SourceDataLine.java0000644000175000017500000000311610172422337027036 0ustar twernertwerner/* * SourceDataLine.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package javax.sound.sampled; public interface SourceDataLine extends DataLine { public void open(AudioFormat audioFormat, int nBufferSize) throws LineUnavailableException; public void open(AudioFormat audioFormat) throws LineUnavailableException; /** Write data to the line. @param abData The buffer to use. @param nOffset @param nLength The length of the data that should be written, in bytes. Can be less that the length of abData. @return The number of bytes written. May be less than nLength. */ public int write(byte[] abData, int nOffset, int nLength); } /*** SourceDataLine.java ***/ libtritonus-java-20070428/src/classes/javax/sound/sampled/TargetDataLine.java0000644000175000017500000000251010172422337027021 0ustar twernertwerner/* * TargetDataLine.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package javax.sound.sampled; public interface TargetDataLine extends DataLine { public void open(AudioFormat audioFormat, int nBufferSize) throws LineUnavailableException; public void open(AudioFormat audioFormat) throws LineUnavailableException; public int read(byte[] abData, int nOffset, int nLength); } /*** TargetDataLine.java ***/ libtritonus-java-20070428/src/classes/javax/sound/sampled/UnsupportedAudioFileException.java0000644000175000017500000000242410172422337032166 0ustar twernertwerner/* * UnsupportedAudioFileException.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package javax.sound.sampled; public class UnsupportedAudioFileException extends Exception { public UnsupportedAudioFileException() { } public UnsupportedAudioFileException(String strMessage) { super(strMessage); } } /*** UnsupportedAudioFileException.java ***/ libtritonus-java-20070428/src/classes/org/0000755000175000017500000000000010621572377020242 5ustar twernertwernerlibtritonus-java-20070428/src/classes/org/tritonus/0000755000175000017500000000000010621572510022116 5ustar twernertwernerlibtritonus-java-20070428/src/classes/org/tritonus/core/0000755000175000017500000000000010621572400023044 5ustar twernertwernerlibtritonus-java-20070428/src/classes/org/tritonus/core/Service.java0000644000175000017500000001323110374074734025323 0ustar twernertwerner/* * Service.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2000 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.core; import java.util.ArrayList; import java.util.Enumeration; import java.util.Iterator; import java.util.List; import java.util.Set; import java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader; import java.io.IOException; import java.net.URL; import org.tritonus.share.TDebug; import org.tritonus.share.ArraySet; public class Service { private static final String BASE_NAME = "META-INF/services/"; /** Determines if the order of service providers is reversed. If this is true, the Iterator returned by providers(Class) iterates through the service provider classes backwards. This means that service providers that are in the user class path are first, then service providers in the extension class path, then those in the boot class path. This behaviour has the advantage that 'built-in' providers (those in the boot class path) can be 'shadowed' by providers in the extension and user class path. */ private static final boolean REVERSE_ORDER = true; public static Iterator providers(Class cls) { if (TDebug.TraceService) { TDebug.out("Service.providers(): begin"); } String strFullName = BASE_NAME + cls.getName(); if (TDebug.TraceService) { TDebug.out("Service.providers(): full name: " + strFullName); } List instancesList = createInstancesList(strFullName); Iterator iterator = instancesList.iterator(); if (TDebug.TraceService) { TDebug.out("Service.providers(): end"); } return iterator; } private static List createInstancesList(String strFullName) { if (TDebug.TraceService) { TDebug.out("Service.createInstancesList(): begin"); } List providers = new ArrayList(); Iterator classNames = createClassNames(strFullName); if (classNames != null) { while (classNames.hasNext()) { String strClassName = (String) classNames.next(); if (TDebug.TraceService) { TDebug.out("Service.createInstancesList(): Class name: " + strClassName); } try { ClassLoader systemClassLoader = ClassLoader.getSystemClassLoader(); Class cls = Class.forName(strClassName, true, systemClassLoader); if (TDebug.TraceService) { TDebug.out("Service.createInstancesList(): now creating instance of " + cls); } Object instance = cls.newInstance(); if (REVERSE_ORDER) { providers.add(0, instance); } else { providers.add(instance); } } catch (ClassNotFoundException e) { if (TDebug.TraceService || TDebug.TraceAllExceptions) { TDebug.out(e); } } catch (InstantiationException e) { if (TDebug.TraceService || TDebug.TraceAllExceptions) { TDebug.out(e); } } catch (IllegalAccessException e) { if (TDebug.TraceService || TDebug.TraceAllExceptions) { TDebug.out(e); } } catch (Throwable e) { if (TDebug.TraceService || TDebug.TraceAllExceptions) { TDebug.out(e); } } } } if (TDebug.TraceService) { TDebug.out("Service.createInstancesList(): end"); } return providers; } private static Iterator createClassNames(String strFullName) { if (TDebug.TraceService) TDebug.out("Service.createClassNames(): begin"); Set providers = new ArraySet(); Enumeration configs = null; try { configs = ClassLoader.getSystemResources(strFullName); } catch (IOException e) { if (TDebug.TraceService || TDebug.TraceAllExceptions) { TDebug.out(e); } } if (configs != null) { while (configs.hasMoreElements()) { URL configFileUrl = (URL) configs.nextElement(); if (TDebug.TraceService) { TDebug.out("Service.createClassNames(): config: " + configFileUrl); } InputStream input = null; try { input = configFileUrl.openStream(); } catch (IOException e) { if (TDebug.TraceService || TDebug.TraceAllExceptions) { TDebug.out(e); } } if (input != null) { BufferedReader reader = new BufferedReader(new InputStreamReader(input)); try { String strLine = reader.readLine(); while (strLine != null) { strLine = strLine.trim(); int nPos = strLine.indexOf('#'); if (nPos >= 0) { strLine = strLine.substring(0, nPos); } if (strLine.length() > 0) { providers.add(strLine); if (TDebug.TraceService) { TDebug.out("Service.createClassNames(): adding class name: " + strLine); } } strLine = reader.readLine(); } } catch (IOException e) { if (TDebug.TraceService || TDebug.TraceAllExceptions) { TDebug.out(e); } } } } } Iterator iterator = providers.iterator(); if (TDebug.TraceService) TDebug.out("Service.createClassNames(): end"); return iterator; } } /*** Service.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/core/TAudioConfig.java0000644000175000017500000001420110374074734026234 0ustar twernertwerner/* * TAudioConfig.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999 - 2004 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ package org.tritonus.core; import java.util.Set; import java.util.Iterator; import javax.sound.sampled.Mixer; import javax.sound.sampled.spi.AudioFileWriter; import javax.sound.sampled.spi.AudioFileReader; import javax.sound.sampled.spi.FormatConversionProvider; import javax.sound.sampled.spi.MixerProvider; import org.tritonus.share.ArraySet; import org.tritonus.core.TInit.ProviderRegistrationAction; /** TODO: */ public class TAudioConfig { private static Set sm_audioFileWriters = null; private static Set sm_audioFileReaders = null; private static Set sm_formatConversionProviders = null; private static Set sm_mixerProviders = null; private static Mixer.Info sm_defaultMixerInfo; /** Constructor to prevent instantiation. */ private TAudioConfig() { } private static void registerAudioFileReaders() { ProviderRegistrationAction action = null; action = new ProviderRegistrationAction() { public void register(Object obj) throws Exception { AudioFileReader provider = (AudioFileReader) obj; TAudioConfig.addAudioFileReader(provider); } }; TInit.registerClasses(AudioFileReader.class, action); } private static void registerAudioFileWriters() { ProviderRegistrationAction action = null; action = new ProviderRegistrationAction() { public void register(Object obj) throws Exception { AudioFileWriter provider = (AudioFileWriter) obj; TAudioConfig.addAudioFileWriter(provider); } }; TInit.registerClasses(AudioFileWriter.class, action); } private static void registerFormatConversionProviders() { ProviderRegistrationAction action = null; action = new ProviderRegistrationAction() { public void register(Object obj) throws Exception { FormatConversionProvider provider = (FormatConversionProvider) obj; TAudioConfig.addFormatConversionProvider(provider); } }; TInit.registerClasses(FormatConversionProvider.class, action); } private static void registerMixerProviders() { ProviderRegistrationAction action = null; action = new ProviderRegistrationAction() { public void register(Object obj) throws Exception { MixerProvider provider = (MixerProvider) obj; TAudioConfig.addMixerProvider(provider); } }; TInit.registerClasses(MixerProvider.class, action); } //////////////////////////////////////////////////////////////// public static synchronized void addAudioFileReader(AudioFileReader provider) { getAudioFileReadersImpl().add(provider); } public static synchronized void removeAudioFileReader(AudioFileReader provider) { getAudioFileReadersImpl().remove(provider); } public static synchronized Iterator getAudioFileReaders() { return getAudioFileReadersImpl().iterator(); } private static synchronized Set getAudioFileReadersImpl() { if (sm_audioFileReaders == null) { sm_audioFileReaders = new ArraySet(); registerAudioFileReaders(); } return sm_audioFileReaders; } public static synchronized void addAudioFileWriter(AudioFileWriter provider) { getAudioFileWritersImpl().add(provider); } public static synchronized void removeAudioFileWriter(AudioFileWriter provider) { getAudioFileWritersImpl().remove(provider); } public static synchronized Iterator getAudioFileWriters() { return getAudioFileWritersImpl().iterator(); } private static synchronized Set getAudioFileWritersImpl() { if (sm_audioFileWriters == null) { sm_audioFileWriters = new ArraySet(); registerAudioFileWriters(); } return sm_audioFileWriters; } public static synchronized void addFormatConversionProvider(FormatConversionProvider provider) { getFormatConversionProvidersImpl().add(provider); } public static synchronized void removeFormatConversionProvider(FormatConversionProvider provider) { getFormatConversionProvidersImpl().remove(provider); } public static synchronized Iterator getFormatConversionProviders() { return getFormatConversionProvidersImpl().iterator(); } private static synchronized Set getFormatConversionProvidersImpl() { if (sm_formatConversionProviders == null) { sm_formatConversionProviders = new ArraySet(); registerFormatConversionProviders(); } return sm_formatConversionProviders; } public static synchronized void addMixerProvider(MixerProvider provider) { getMixerProvidersImpl().add(provider); } public static synchronized void removeMixerProvider(MixerProvider provider) { getMixerProvidersImpl().remove(provider); } public static synchronized Iterator getMixerProviders() { return getMixerProvidersImpl().iterator(); } private static synchronized Set getMixerProvidersImpl() { if (sm_mixerProviders == null) { sm_mixerProviders = new ArraySet(); registerMixerProviders(); } return sm_mixerProviders; } // TODO: a way to set the default mixer public static Mixer.Info getDefaultMixerInfo() { return sm_defaultMixerInfo; } } /*** TAudioConfig.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/core/TInit.java0000644000175000017500000000557710172434622024760 0ustar twernertwerner/* * TInit.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999 - 2001 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.core; import java.util.Iterator; import org.tritonus.core.Service; import org.tritonus.share.TDebug; /** Helper methods for provider registration. */ public class TInit { /** Constructor to prevent instantiation. */ private TInit() { } /** Register all service providers of a certain type. This method retrieves instances of all service providers of the type given as providerClass. It registers them by calling action with the provider instance as actual parameter. @param providerClass Type of the service providers that should be registered. For instance, this could be the class object for javax.sound.sampled.spi.MixerProvider. However, the mechanism is not restricted to the Java Sound types of service providers. @param action A ProviderRegistrationAction that should to be called to register the service providers. Typically, this is something like adding the provider to a collection, but in theorie, could be anything. */ public static void registerClasses(Class providerClass, ProviderRegistrationAction action) { if (TDebug.TraceInit) { TDebug.out("TInit.registerClasses(): registering for: " + providerClass); } Iterator providers = Service.providers(providerClass); if (providers != null) { while (providers.hasNext()) { Object provider = providers.next(); try { action.register(provider); } catch (Throwable e) { if (TDebug.TraceInit || TDebug.TraceAllExceptions) { TDebug.out(e); } } } } } /** Action to be taken on registration of a provider. Strategy objects of this type has to be passed to {@link #registerClasses registerClasses}. The implementation is called for each provider that has to be registered. */ public static interface ProviderRegistrationAction { public void register(Object provider) throws Exception; } } /*** TInit.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/core/TMidiConfig.java0000644000175000017500000002100410172434622026044 0ustar twernertwerner/* * TMidiConfig.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999 - 2004 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.core; import java.util.Iterator; import java.util.Set; import javax.sound.midi.MidiDevice; import javax.sound.midi.Sequencer; import javax.sound.midi.Synthesizer; import javax.sound.midi.spi.MidiDeviceProvider; import javax.sound.midi.spi.MidiFileReader; import javax.sound.midi.spi.MidiFileWriter; import javax.sound.midi.spi.SoundbankReader; import org.tritonus.share.TDebug; import org.tritonus.share.ArraySet; import org.tritonus.core.TInit.ProviderRegistrationAction; /** TODO: */ public class TMidiConfig { private static Set sm_midiDeviceProviders = null; private static Set sm_midiFileReaders = null; private static Set sm_midiFileWriters = null; private static Set sm_soundbankReaders = null; private static MidiDevice.Info sm_defaultMidiInDeviceInfo = null; private static MidiDevice.Info sm_defaultMidiOutDeviceInfo = null; private static MidiDevice.Info sm_defaultSequencerInfo = null; private static MidiDevice.Info sm_defaultSynthesizerInfo = null; static { init(); } /** Constructor to prevent instantiation. */ private TMidiConfig() { } /** Initialize the collections of providers and the default devices. */ private static void init() { // init providers from scanning the class path // note: this already sets the default devices getMidiDeviceProvidersImpl(); getMidiFileReadersImpl(); getMidiFileWritersImpl(); getSoundbankReadersImpl(); // now check properties for default devices // ... TODO: } private static void registerMidiDeviceProviders() { ProviderRegistrationAction action = null; action = new ProviderRegistrationAction() { public void register(Object obj) throws Exception { MidiDeviceProvider midiDeviceProvider = (MidiDeviceProvider) obj; TMidiConfig.addMidiDeviceProvider(midiDeviceProvider); } }; TInit.registerClasses(MidiDeviceProvider.class, action); } private static void registerMidiFileReaders() { ProviderRegistrationAction action = null; action = new ProviderRegistrationAction() { public void register(Object obj) throws Exception { MidiFileReader provider = (MidiFileReader) obj; TMidiConfig.addMidiFileReader(provider); } }; TInit.registerClasses(MidiFileReader.class, action); } private static void registerMidiFileWriters() { ProviderRegistrationAction action = null; action = new ProviderRegistrationAction() { public void register(Object obj) throws Exception { MidiFileWriter provider = (MidiFileWriter) obj; TMidiConfig.addMidiFileWriter(provider); } }; TInit.registerClasses(MidiFileWriter.class, action); } private static void registerSoundbankReaders() { ProviderRegistrationAction action = null; action = new ProviderRegistrationAction() { public void register(Object obj) throws Exception { SoundbankReader provider = (SoundbankReader) obj; TMidiConfig.addSoundbankReader(provider); } }; TInit.registerClasses(SoundbankReader.class, action); } ////////////////////////////////////////////////////////////////// public static synchronized void addMidiDeviceProvider(MidiDeviceProvider provider) { // TDebug.out("MidiDeviceProvider: " + provider); getMidiDeviceProvidersImpl().add(provider); if (getDefaultMidiInDeviceInfo() == null || getDefaultMidiOutDeviceInfo() == null || getDefaultSynthesizerInfo() == null || getDefaultSequencerInfo() == null) { MidiDevice.Info[] infos = provider.getDeviceInfo(); // TDebug.out("#infos: " + infos.length); for (int i = 0; i < infos.length; i++) { MidiDevice.Info info = infos[i]; MidiDevice device = null; try { device = provider.getDevice(info); } catch (IllegalArgumentException e) { if (TDebug.TraceAllExceptions) { TDebug.out(e); } } if (device instanceof Synthesizer) { if (getDefaultSynthesizerInfo() == null) { sm_defaultSynthesizerInfo = info; } } else if (device instanceof Sequencer) { if (getDefaultSequencerInfo() == null) { sm_defaultSequencerInfo = info; } } else if (device.getMaxTransmitters() != 0) { if (getDefaultMidiInDeviceInfo() == null) { sm_defaultMidiInDeviceInfo = info; } } else if (device.getMaxReceivers() != 0) { if (getDefaultMidiOutDeviceInfo() == null) { sm_defaultMidiOutDeviceInfo = info; } } } } } public static synchronized void removeMidiDeviceProvider(MidiDeviceProvider provider) { getMidiDeviceProvidersImpl().remove(provider); // TODO: change default infos } public static synchronized Iterator getMidiDeviceProviders() { return getMidiDeviceProvidersImpl().iterator(); } private static synchronized Set getMidiDeviceProvidersImpl() { if (sm_midiDeviceProviders == null) { sm_midiDeviceProviders = new ArraySet(); registerMidiDeviceProviders(); } return sm_midiDeviceProviders; } public static synchronized void addMidiFileReader(MidiFileReader reader) { if (TDebug.TraceMidiConfig) TDebug.out("TMidiConfig.addMidiFileReader(): adding " + reader); getMidiFileReadersImpl().add(reader); if (TDebug.TraceMidiConfig) TDebug.out("TMidiConfig.addMidiFileReader(): size " + sm_midiFileReaders.size()); } public static synchronized void removeMidiFileReader(MidiFileReader reader) { getMidiFileReadersImpl().remove(reader); } public static synchronized Iterator getMidiFileReaders() { return getMidiFileReadersImpl().iterator(); } private static synchronized Set getMidiFileReadersImpl() { if (sm_midiFileReaders == null) { sm_midiFileReaders = new ArraySet(); registerMidiFileReaders(); } return sm_midiFileReaders; } public static synchronized void addMidiFileWriter(MidiFileWriter reader) { getMidiFileWritersImpl().add(reader); } public static synchronized void removeMidiFileWriter(MidiFileWriter reader) { getMidiFileWritersImpl().remove(reader); } public static synchronized Iterator getMidiFileWriters() { return getMidiFileWritersImpl().iterator(); } private static synchronized Set getMidiFileWritersImpl() { if (sm_midiFileWriters == null) { sm_midiFileWriters = new ArraySet(); registerMidiFileWriters(); } return sm_midiFileWriters; } public static synchronized void addSoundbankReader(SoundbankReader reader) { getSoundbankReadersImpl().add(reader); } public static synchronized void removeSoundbankReader(SoundbankReader reader) { getSoundbankReadersImpl().remove(reader); } public static synchronized Iterator getSoundbankReaders() { return getSoundbankReadersImpl().iterator(); } private static synchronized Set getSoundbankReadersImpl() { if (sm_soundbankReaders == null) { sm_soundbankReaders = new ArraySet(); registerSoundbankReaders(); } return sm_soundbankReaders; } public static MidiDevice.Info getDefaultMidiInDeviceInfo() { return sm_defaultMidiInDeviceInfo; } public static MidiDevice.Info getDefaultMidiOutDeviceInfo() { return sm_defaultMidiOutDeviceInfo; } public static MidiDevice.Info getDefaultSynthesizerInfo() { return sm_defaultSynthesizerInfo; } public static MidiDevice.Info getDefaultSequencerInfo() { return sm_defaultSequencerInfo; } } /*** TMidiConfig.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/core/package.html0000644000175000017500000000106610172434622025334 0ustar twernertwerner

Initialization and Plug-in loading infrastructure. The classes provided here are used to load available plug-ins (AudioFileReader, AudioFileWriter, FormatConversionProvider, MixerProvider, MidiDeviceProvider, MidiFileReader, MidiFileWriter, SoundbankReader) and maintain lists of them. These classes are needed by Tritonus only if it is used as a stand-alone Java Sound implementation. They are called by AudioSystem and MidiSystem.

libtritonus-java-20070428/src/classes/org/tritonus/README0000644000175000017500000000127010172434622023000 0ustar twernertwernercore/ Classes that are needed by Tritonus only if it is used as a stand-alone Java Sound implementation. (Classes needed by plug-ins are under share/) lowlevel/ Classes that access hardware or operating system facilities. They typically include the usage of native methods. midi/ Classes that are related to the implementation of javax.sound.midi. sampled/ Classes that are related to the implementation of javax.sound.sampled. share/ Base and auxiliary classes that are used by implemantations in midi/ and share/. As a rule of thumb, classes go here if they are needed by more than one plug-in or if they are used generally. However, classes that are not used by plug-ins go to core/. libtritonus-java-20070428/src/classes/org/tritonus/debug/0000755000175000017500000000000010621572401023203 5ustar twernertwernerlibtritonus-java-20070428/src/classes/org/tritonus/debug/AJDebug.java0000644000175000017500000001435710172434622025324 0ustar twernertwerner/* * AJDebug.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999 - 2002 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.debug; import org.aspectj.lang.JoinPoint; import javax.sound.midi.MidiSystem; import javax.sound.midi.Synthesizer; import javax.sound.sampled.AudioSystem; import javax.sound.sampled.SourceDataLine; import org.tritonus.core.TMidiConfig; import org.tritonus.core.TInit; import org.tritonus.share.TDebug; import org.tritonus.share.midi.TSequencer; import org.tritonus.midi.device.alsa.AlsaSequencer; import org.tritonus.midi.device.alsa.AlsaSequencer.PlaybackAlsaMidiInListener; import org.tritonus.midi.device.alsa.AlsaSequencer.RecordingAlsaMidiInListener; import org.tritonus.midi.device.alsa.AlsaSequencer.AlsaSequencerReceiver; import org.tritonus.midi.device.alsa.AlsaSequencer.AlsaSequencerTransmitter; import org.tritonus.midi.device.alsa.AlsaSequencer.LoaderThread; import org.tritonus.midi.device.alsa.AlsaSequencer.MasterSynchronizer; import org.tritonus.share.sampled.convert.TAsynchronousFilteredAudioInputStream; /** Debugging output aspect. */ public aspect AJDebug extends Utils { pointcut allExceptions(): handler(Throwable+); // TAudioConfig, TMidiConfig, TInit pointcut TMidiConfigCalls(): execution(* TMidiConfig.*(..)); pointcut TInitCalls(): execution(* TInit.*(..)); // share // midi pointcut MidiSystemCalls(): execution(* MidiSystem.*(..)); pointcut Sequencer(): execution(TSequencer+.new(..)) || execution(* TSequencer+.*(..)) || execution(* PlaybackAlsaMidiInListener.*(..)) || execution(* RecordingAlsaMidiInListener.*(..)) || execution(* AlsaSequencerReceiver.*(..)) || execution(* AlsaSequencerTransmitter.*(..)) || execution(LoaderThread.new(..)) || execution(* LoaderThread.*(..)) || execution(MasterSynchronizer.new(..)) || execution(* MasterSynchronizer.*(..)); // audio pointcut AudioSystemCalls(): execution(* AudioSystem.*(..)); pointcut sourceDataLine(): call(* SourceDataLine+.*(..)); // OLD // pointcut playerStates(): // execution(private void TPlayer.setState(int)); // currently not used pointcut printVelocity(): execution(* JavaSoundToneGenerator.playTone(..)) && call(JavaSoundToneGenerator.ToneThread.new(..)); // pointcut tracedCall(): execution(protected void JavaSoundAudioPlayer.doRealize() throws Exception); /////////////////////////////////////////////////////// // // ACTIONS // /////////////////////////////////////////////////////// before(): MidiSystemCalls() { if (TDebug.TraceMidiSystem) outEnteringJoinPoint(thisJoinPoint); } after(): MidiSystemCalls() { if (TDebug.TraceSequencer) outLeavingJoinPoint(thisJoinPoint); } before(): Sequencer() { if (TDebug.TraceSequencer) outEnteringJoinPoint(thisJoinPoint); } after(): Sequencer() { if (TDebug.TraceSequencer) outLeavingJoinPoint(thisJoinPoint); } before(): TInitCalls() { if (TDebug.TraceInit) outEnteringJoinPoint(thisJoinPoint); } after(): TInitCalls() { if (TDebug.TraceInit) outLeavingJoinPoint(thisJoinPoint); } before(): TMidiConfigCalls() { if (TDebug.TraceMidiConfig) outEnteringJoinPoint(thisJoinPoint); } after(): TMidiConfigCalls() { if (TDebug.TraceMidiConfig) outLeavingJoinPoint(thisJoinPoint); } // execution(* TAsynchronousFilteredAudioInputStream.read(..)) before(): execution(* TAsynchronousFilteredAudioInputStream.read()) { if (TDebug.TraceAudioConverter) outEnteringJoinPoint(thisJoinPoint); } after(): execution(* TAsynchronousFilteredAudioInputStream.read()) { if (TDebug.TraceAudioConverter) outLeavingJoinPoint(thisJoinPoint); } before(): execution(* TAsynchronousFilteredAudioInputStream.read(byte[])) { if (TDebug.TraceAudioConverter) outEnteringJoinPoint(thisJoinPoint); } after(): execution(* TAsynchronousFilteredAudioInputStream.read(byte[])) { if (TDebug.TraceAudioConverter) outLeavingJoinPoint(thisJoinPoint); } before(): execution(* TAsynchronousFilteredAudioInputStream.read(byte[], int, int)) { if (TDebug.TraceAudioConverter) outEnteringJoinPoint(thisJoinPoint); } after(): execution(* TAsynchronousFilteredAudioInputStream.read(byte[], int, int)) { if (TDebug.TraceAudioConverter) outLeavingJoinPoint(thisJoinPoint); } after() returning(int nBytes): call(* TAsynchronousFilteredAudioInputStream.read(byte[], int, int)) { if (TDebug.TraceAudioConverter) TDebug.out("returning bytes: " + nBytes); } // before(int nState): playerStates() && args(nState) // { // // if (TDebug.TracePlayerStates) // // { // // TDebug.out("TPlayer.setState(): " + nState); // // } // } // before(): playerStateTransitions() // { // // if (TDebug.TracePlayerStateTransitions) // // { // // TDebug.out("Entering: " + thisJoinPoint); // // } // } // Synthesizer around(): call(* MidiSystem.getSynthesizer()) // { // // Synthesizer s = proceed(); // // if (TDebug.TraceToneGenerator) // // { // // TDebug.out("MidiSystem.getSynthesizer() gives: " + s); // // } // // return s; // // only to get no compilation errors // return null; // } // TODO: v gives an error; find out what to do // before(int v): printVelocity() && args(nVelocity) // { // if (TDebug.TraceToneGenerator) // { // TDebug.out("velocity: " + v); // } // } before(Throwable t): allExceptions() && args(t) { if (TDebug.TraceAllExceptions) TDebug.out(t); } } /*** AJDebug.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/debug/AJDebugVorbis.java0000644000175000017500000000472110172434622026503 0ustar twernertwerner/* * AJDebug.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999 - 2002 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.debug; import org.aspectj.lang.JoinPoint; import org.tritonus.share.TDebug; import org.tritonus.sampled.convert.vorbis.VorbisFormatConversionProvider; import org.tritonus.sampled.convert.vorbis.VorbisFormatConversionProvider.DecodedVorbisAudioInputStream; /** Debugging output aspect. */ privileged aspect AJDebugVorbis extends Utils { pointcut allExceptions(): handler(Throwable+); pointcut AudioConverterCalls(): execution(JorbisFormatConversionProvider.new(..)) || execution(* JorbisFormatConversionProvider.*(..)) || execution(DecodedJorbisAudioInputStream.new(..)) || execution(* DecodedJorbisAudioInputStream.*(..)); // pointcut sourceDataLine(): // call(* SourceDataLine+.*(..)); // currently not used // pointcut printVelocity(): execution(* JavaSoundToneGenerator.playTone(..)) && call(JavaSoundToneGenerator.ToneThread.new(..)); // pointcut tracedCall(): execution(protected void JavaSoundAudioPlayer.doRealize() throws Exception); /////////////////////////////////////////////////////// // // ACTIONS // /////////////////////////////////////////////////////// before(): AudioConverterCalls() { if (TDebug.TraceAudioConverter) { outEnteringJoinPoint(thisJoinPoint); } } after(): AudioConverterCalls() { if (TDebug.TraceAudioConverter) { outLeavingJoinPoint(thisJoinPoint); } } before(Throwable t): allExceptions() && args(t) { if (TDebug.TraceAllExceptions) { TDebug.out(t); } } } /*** AJDebug.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/debug/Utils.java0000644000175000017500000000533310172434622025155 0ustar twernertwerner/* * Utils.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999 - 2002 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.debug; import org.aspectj.lang.JoinPoint; import org.tritonus.share.TDebug; /** Utility methods for the debugging aspects. */ public class Utils { /** Indentation step. This value determines how many spaces are added/removed for each step of indantation. */ private static final int INDENTATION_STEP = 2; /** Indentation string. This string is used to generate the appropriate number of spaces. */ private static final String INDENTATION_STRING = " "; /** Current indentation. This holds the current number of blanks to add before each line. The value starts with -INDENTATION_STEP because the first call to outSteppingIn will increase this value prior to printing. */ private static int sm_nIndentation = -INDENTATION_STEP; public static void outEnteringJoinPoint(JoinPoint joinPoint) { outSteppingIn("-> " + getSignature(joinPoint)); } public static void outLeavingJoinPoint(JoinPoint joinPoint) { outSteppingOut("<- " + getSignature(joinPoint)); } private static String getSignature(JoinPoint joinPoint) { return joinPoint.getStaticPart().getSignature().toShortString(); } /** Print message, increasing the indentation. */ public static void outSteppingIn(String strMessage) { sm_nIndentation += INDENTATION_STEP; out(strMessage); } /** Print message, decreasing the indentation. */ public static void outSteppingOut(String strMessage) { out(strMessage); sm_nIndentation -= INDENTATION_STEP; } /** Print message with the current indentation. */ public static void out(String strMessage) { TDebug.out(INDENTATION_STRING.substring(0, sm_nIndentation) + strMessage); } } /*** Utils.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/dsp/0000755000175000017500000000000010621572405022707 5ustar twernertwernerlibtritonus-java-20070428/src/classes/org/tritonus/dsp/ais/0000755000175000017500000000000010621572403023461 5ustar twernertwernerlibtritonus-java-20070428/src/classes/org/tritonus/dsp/ais/AmplitudeAudioInputStream.java0000644000175000017500000000543310421454740031434 0ustar twernertwerner/* * AmplitudeAudioInputStream.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2003 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.dsp.ais; import javax.sound.sampled.AudioFormat; import javax.sound.sampled.AudioInputStream; import org.tritonus.dsp.processor.AmplitudeProcessor; import org.tritonus.share.sampled.FloatSampleBuffer; /** Change amplitude of audio data. */ public class AmplitudeAudioInputStream extends FloatAudioInputStream { /** The processor that does the work. */ private AmplitudeProcessor m_processor; public AmplitudeAudioInputStream(AudioInputStream sourceStream) { this(sourceStream, sourceStream.getFormat()); } public AmplitudeAudioInputStream(AudioInputStream sourceStream, AudioFormat targetFormat) { super (sourceStream, targetFormat); m_processor = new AmplitudeProcessor(); } /** Set the amplitude. The value passed here is the value the samples are multiplied with. So 1.0F means no change in amplitude. 2.0F doubles the amplitude. 0.5F cuts it to half, and so on. This is in contrast to {@link #setAmplitudeLog() setAmplitudeLog}, where you can pass the amplitude change as dB values. */ public void setAmplitudeLinear(float fAmplitude) { m_processor.setAmplitudeLinear(fAmplitude); } /** Set the amplitude. The value passed here is in dB. So 0.0F means no change in amplitude. +6.0F doubles the amplitude. -6.0F cuts it to half, and so on. This is in contrast to {@link #setAmplitudeLinear setAmplitudeLinear()}, where you can pass the amplitude change linear values. */ public void setAmplitudeLog(float fAmplitude) { m_processor.setAmplitudeLog(fAmplitude); } /** Do the amplifying. Here, simply each sample in each channel is multiplied with the amplitude value. */ protected void convert(FloatSampleBuffer buffer) { m_processor.process(buffer); } } /*** AmplitudeAudioInputStream.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/dsp/ais/FloatAudioInputStream.java0000644000175000017500000000612210421454740030551 0ustar twernertwerner/* * FloatAudioInputStream.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2000 by Florian Bomers * Copyright (c) 2003 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.dsp.ais; import javax.sound.sampled.AudioFormat; import javax.sound.sampled.AudioInputStream; import org.tritonus.share.sampled.FloatSampleBuffer; import org.tritonus.share.sampled.convert.TSynchronousFilteredAudioInputStream; /** Base class for ... . */ public abstract class FloatAudioInputStream extends TSynchronousFilteredAudioInputStream { private AudioFormat intermediateFloatBufferFormat; private FloatSampleBuffer m_floatBuffer = null; public FloatAudioInputStream(AudioInputStream sourceStream, AudioFormat targetFormat) { // transform the targetFormat so that // FrameRate, and SampleRate match the sourceFormat super (sourceStream, new AudioFormat( targetFormat.getEncoding(), sourceStream.getFormat().getSampleRate(), targetFormat.getSampleSizeInBits(), targetFormat.getChannels(), targetFormat.getChannels()*targetFormat.getSampleSizeInBits()/8, sourceStream.getFormat().getFrameRate(), targetFormat.isBigEndian())); int floatChannels = targetFormat.getChannels(); intermediateFloatBufferFormat = new AudioFormat( targetFormat.getEncoding(), sourceStream.getFormat().getSampleRate(), targetFormat.getSampleSizeInBits(), floatChannels, floatChannels*targetFormat.getSampleSizeInBits()/8, sourceStream.getFormat().getFrameRate(), targetFormat.isBigEndian()); } protected int convert(byte[] inBuffer, byte[] outBuffer, int outByteOffset, int inFrameCount) { int sampleCount = inFrameCount * getOriginalStream().getFormat().getChannels(); int byteCount = sampleCount * (getOriginalStream().getFormat().getSampleSizeInBits()/8); if (m_floatBuffer == null) { m_floatBuffer = new FloatSampleBuffer(); } m_floatBuffer.initFromByteArray(inBuffer, 0, byteCount, getOriginalStream().getFormat()); convert(m_floatBuffer); m_floatBuffer.convertToByteArray(outBuffer, outByteOffset, intermediateFloatBufferFormat); return inFrameCount; } protected abstract void convert(FloatSampleBuffer buffer); } /*** FloatAudioInputStream.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/dsp/interfaces/0000755000175000017500000000000010621572404025031 5ustar twernertwernerlibtritonus-java-20070428/src/classes/org/tritonus/dsp/interfaces/FloatSampleProcessor.java0000644000175000017500000000227110421454740032005 0ustar twernertwerner/* * FloatSampleProcessor.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2003 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.dsp.interfaces; import org.tritonus.share.sampled.FloatSampleBuffer; public interface FloatSampleProcessor { public void process(FloatSampleBuffer buffer); } /*** FloatSampleProcessor.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/dsp/interfaces/FloatSampleReader.java0000644000175000017500000000225510421454740031232 0ustar twernertwerner/* * FloatSampleReader.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2003 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.dsp.interfaces; import org.tritonus.share.sampled.FloatSampleBuffer; public interface FloatSampleReader { public void read(FloatSampleBuffer buffer); } /*** FloatSampleReader.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/dsp/interfaces/FloatSampleWriter.java0000644000175000017500000000225610421454740031305 0ustar twernertwerner/* * FloatSampleWriter.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2003 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.dsp.interfaces; import org.tritonus.share.sampled.FloatSampleBuffer; public interface FloatSampleWriter { public void write(FloatSampleBuffer buffer); } /*** FloatSampleWriter.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/dsp/processor/0000755000175000017500000000000010621572405024726 5ustar twernertwernerlibtritonus-java-20070428/src/classes/org/tritonus/dsp/processor/AmplitudeProcessor.java0000644000175000017500000000625310421454740031422 0ustar twernertwerner/* * AmplitudeProcessor.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2003 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.dsp.processor; import org.tritonus.share.sampled.FloatSampleBuffer; import org.tritonus.dsp.interfaces.FloatSampleProcessor; /** Change amplitude of audio data. */ public class AmplitudeProcessor implements FloatSampleProcessor { /** The amplitude to use if none is set explicitly. This amplitude is used before the first call to {@link #setAmplitudeLinear() setAmplitudeLinear} or {@link #setAmplitudeLog() setAmplitudeLog}. It is given as a linear value. */ private static final float DEFAULT_AMPLITUDE = 1.0F; /** The amplitude to use during the conversion. This value is used to multiply the samples with. It is given as a linear value. @see #setAmplitudeLinear() @see #setAmplitudeLog() */ private float m_fAmplitude; public AmplitudeProcessor() { setAmplitudeLinear(DEFAULT_AMPLITUDE); } /** Set the amplitude. The value passed here is the value the samples are multiplied with. So 1.0F means no change in amplitude. 2.0F doubles the amplitude. 0.5F cuts it to half, and so on. This is in contrast to {@link #setAmplitudeLog() setAmplitudeLog}, where you can pass the amplitude change as dB values. */ public void setAmplitudeLinear(float fAmplitude) { m_fAmplitude = fAmplitude; } /** Set the amplitude. The value passed here is in dB. So 0.0F means no change in amplitude. +6.0F doubles the amplitude. -6.0F cuts it to half, and so on. This is in contrast to {@link #setAmplitudeLinear setAmplitudeLinear()}, where you can pass the amplitude change linear values. */ public void setAmplitudeLog(float fAmplitude) { float fAmplitudeLinear = (float) Math.pow(10.0, fAmplitude/20.0); setAmplitudeLinear(fAmplitudeLinear); } /** Do the amplifying. Here, simply each sample in each channel is multiplied with the amplitude value. */ public void process(FloatSampleBuffer buffer) { for (int nChannel = 0; nChannel < buffer.getChannelCount(); nChannel++) { float[] afBuffer = buffer.getChannel(nChannel); for (int nSample = 0; nSample < buffer.getSampleCount(); nSample++) { afBuffer[nSample] *= m_fAmplitude; } } } } /*** AmplitudeProcessor.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/lowlevel/0000755000175000017500000000000010621572447023760 5ustar twernertwernerlibtritonus-java-20070428/src/classes/org/tritonus/lowlevel/alsa/0000755000175000017500000000000010621572413024671 5ustar twernertwernerlibtritonus-java-20070428/src/classes/org/tritonus/lowlevel/alsa/Alsa.java0000644000175000017500000000512510172434622026417 0ustar twernertwerner/* * Alsa.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2000 - 2001 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.lowlevel.alsa; import org.tritonus.share.TDebug; /** Common ALSA functions. Used only for the functions that do neither belong to the ctl sections nor to any specific interface section (like pcm, rawmidi, etc.). Currently, there is only one function remaining. */ public class Alsa { private static boolean sm_bIsLibraryAvailable = false; static { Alsa.loadNativeLibrary(); } public static void loadNativeLibrary() { if (TDebug.TraceAlsaNative) { TDebug.out("Alsa.loadNativeLibrary(): begin"); } if (! isLibraryAvailable()) { loadNativeLibraryImpl(); } if (TDebug.TraceAlsaNative) { TDebug.out("Alsa.loadNativeLibrary(): end"); } } /** Load the native library for alsa. This method actually does the loading of the library. Unlike {@link loadNativeLibrary() loadNativeLibrary()}, it does not check if the library is already loaded. */ private static void loadNativeLibraryImpl() { if (TDebug.TraceAlsaNative) { TDebug.out("Alsa.loadNativeLibraryImpl(): loading native library tritonusalsa"); } try { System.loadLibrary("tritonusalsa"); // only reached if no exception occures sm_bIsLibraryAvailable = true; } catch (Error e) { if (TDebug.TraceAlsaNative || TDebug.TraceAllExceptions) { TDebug.out(e); } // throw e; } if (TDebug.TraceAlsaNative) { TDebug.out("Alsa.loadNativeLibraryImpl(): loaded"); } } /** Returns whether the libraries are installed correctly. */ public static boolean isLibraryAvailable() { return sm_bIsLibraryAvailable; } public static native String getStringError(int nErrnum); } /*** Alsa.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/lowlevel/alsa/AlsaCtl.java0000644000175000017500000000576110374160730027070 0ustar twernertwerner/* * AlsaCtl.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2000 - 2001 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.lowlevel.alsa; import org.tritonus.share.TDebug; /** TODO: */ public class AlsaCtl { /** Contains a pointer to snd_ctl_t. */ @SuppressWarnings("unused") private long m_lNativeHandle; static { Alsa.loadNativeLibrary(); if (TDebug.TraceAlsaCtlNative) { setTrace(true); } } public static native int loadCard(int nCard); // this encapsulates snd_card_next() public static native int[] getCards(); public static native int getCardIndex(String strName); public static native String getCardName(int nCard); public static native String getCardLongName(int nCard); /** Open a ctl. Objects created with this constructor have to be closed by calling {@link #close() close()}. This is necessary to free native resources. @param strName The name of the sound card. For instance, "hw:0", or an identifier you gave the card ("CARD1"). @param nMode Special modes for the low-level opening like SND_CTL_NONBLOCK, SND_CTL_ASYNC. Normally, set this to 0. */ public AlsaCtl(String strName, int nMode) throws Exception { if (open(strName, nMode) < 0) { throw new Exception(); } } public AlsaCtl(int nCard) throws Exception { this("hw:" + nCard, 0); } /** Calls snd_ctl_open(). */ private native int open(String strName, int nMode); /** Calls snd_ctl_close(). */ public native int close(); /** Calls snd_ctl_card_info(). */ public native int getCardInfo(AlsaCtlCardInfo cardInfo); // TODO: ?? public native int[] getPcmDevices(); // TODO: remove /** * anValues[0] device (inout) * anValues[1] subdevice (inout) * anValues[2] stream (inout) * anValues[3] card (out) * anValues[4] class (out) * anValues[5] subclass (out) * anValues[6] subdevice count (out) * anValues[7] subdevice available (out) * * astrValues[0] id (out) * astrValues[1] name (out) * astrValues[2] subdevice name (out) */ public native int getPcmInfo(int[] anValues, String[] astrValues); private static native void setTrace(boolean bTrace); } /*** AlsaCtl.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/lowlevel/alsa/AlsaCtlCardInfo.java0000644000175000017500000000512010172434622030463 0ustar twernertwerner/* * AlsaCtlCardInfo.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2000 - 2002 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.lowlevel.alsa; import org.tritonus.share.TDebug; /** TODO: */ public class AlsaCtlCardInfo { /** Holds the pointer to snd_ctl_card_info_t. for the native code. This must be long to be 64bit-clean. The access modifier is not private because this variable has to be accessed from AlsaCtl. */ long m_lNativeHandle; public AlsaCtlCardInfo() { if (TDebug.TraceAlsaCtlNative) { TDebug.out("AlsaPcm.CardInfo.(): begin"); } int nReturn = malloc(); if (nReturn < 0) { throw new RuntimeException("malloc of card_info failed"); } if (TDebug.TraceAlsaCtlNative) { TDebug.out("AlsaPcm.CardInfo.(): end"); } } public void finalize() { // TODO: call free() // call super.finalize() first or last? // and introduce a flag if free() has already been called? } /** Calls snd_ctl_card_info_malloc(). */ private native int malloc(); /** Calls snd_ctl_card_info_free(). */ public native void free(); /** Calls snd_ctl_card_info_get_card(). */ public native int getCard(); /** Calls snd_ctl_card_info_get_id(). */ public native String getId(); /** Calls snd_ctl_card_info_get_driver(). */ public native String getDriver(); /** Calls snd_ctl_card_info_get_name(). */ public native String getName(); /** Calls snd_ctl_card_info_get_longname(). */ public native String getLongname(); /** Calls snd_ctl_card_info_get_mixername(). */ public native String getMixername(); /** Calls snd_ctl_card_info_get_components(). */ public native String getComponents(); private static native void setTrace(boolean bTrace); } /*** AlsaCtlCardInfo.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/lowlevel/alsa/AlsaMixer.java0000644000175000017500000000542410374074734027436 0ustar twernertwerner/* * AlsaMixer.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2001 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.lowlevel.alsa; import org.tritonus.share.TDebug; /** Object carrying a snd_mixer_t. */ public class AlsaMixer { /* not private because needed to be accessed by AlsaMixerElement. (Better solution: inner classes) */ /*private*/ long m_lNativeHandle; static { Alsa.loadNativeLibrary(); if (TDebug.TraceAlsaMixerNative) { setTrace(true); } } public AlsaMixer(String strMixerName) throws Exception { if (open(0) < 0) { throw new Exception(); } if (attach(strMixerName) < 0) { close(); throw new Exception(); } if (register() < 0) { close(); throw new Exception(); } if (load() < 0) { close(); throw new Exception(); } } /** Calls snd_mixer_open(). */ private native int open(int nMode); /** Calls snd_mixer_attach(). */ private native int attach(String strCardName); /** Calls snd_mixer_selem_register(.., NULL, NULL). This is a hack, taken over from alsamixer. */ private native int register(); /** Calls snd_mixer_load(). */ private native int load(); /** Calls snd_mixer_free(). */ private native int free(); /** Calls snd_mixer_close(). */ public native int close(); // getCount() ?? /** The caller has to allocate the indices and names arrays big enough to hold information on all controls. If the retrieving of controls is successful, a positive number (the number of controls) is returned. If the arrays are not big enough, -1 is returned. In this case, it's the task of the caller to allocate bigger arrays and try again. Both arrays must be of the same size. Calls snd_mixer_first_elem() and snd_mixer_elem_next(). */ public native int readControlList(int[] anIndices, String[] astrNames); public static native void setTrace(boolean bTrace); } /*** AlsaMixer.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/lowlevel/alsa/AlsaMixerElement.java0000644000175000017500000001501110374160730030731 0ustar twernertwerner/* * AlsaMixerElement.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2001 - 2002 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.lowlevel.alsa; import org.tritonus.share.TDebug; /** TODO: */ public class AlsaMixerElement { /* Channel type constants. They mirror the values of snd_mixer_selem_channel_id_t. */ /** Unknown */ public static final int SND_MIXER_SCHN_UNKNOWN = -1; /** Front left */ public static final int SND_MIXER_SCHN_FRONT_LEFT = 0; /** Front right */ public static final int SND_MIXER_SCHN_FRONT_RIGHT = 1; /** Front center */ public static final int SND_MIXER_SCHN_FRONT_CENTER = 2; /** Rear left */ public static final int SND_MIXER_SCHN_REAR_LEFT = 3; /** Rear right */ public static final int SND_MIXER_SCHN_REAR_RIGHT = 4; /** Woofer */ public static final int SND_MIXER_SCHN_WOOFER = 5; public static final int SND_MIXER_SCHN_LAST = 31; /** Mono (Front left alias) */ public static final int SND_MIXER_SCHN_MONO = SND_MIXER_SCHN_FRONT_LEFT; private AlsaMixer m_mixer; @SuppressWarnings("unused") private long m_lNativeHandle; static { Alsa.loadNativeLibrary(); if (TDebug.TraceAlsaMixerNative) { setTrace(true); } } public AlsaMixerElement(AlsaMixer mixer, int nIndex, String strName) { m_mixer = mixer; int nReturn; nReturn = open(getMixer(), nIndex, strName); { if (nReturn < 0) { throw new RuntimeException("cannot open"); } } } /** Calls snd_mixer_find_selem(). */ private native int open(AlsaMixer mixer, int nIndex, String strName); private AlsaMixer getMixer() { return m_mixer; } // TODO: getId() /** Calls snd_mixer_selem_get_name(). */ public native String getName(); /** Calls snd_mixer_selem_get_index(). */ public native int getIndex(); /** Calls snd_mixer_selem_is_active(). */ public native boolean isActive(); /** Calls snd_mixer_selem_is_playback_mono(). */ public native boolean isPlaybackMono(); /** Calls snd_mixer_selem_has_playback_channel(). */ public native boolean hasPlaybackChannel(int nChannelType); /** Calls snd_mixer_selem_is_capture_mono(). */ public native boolean isCaptureMono(); /** Calls snd_mixer_selem_has_capture_channel(). */ public native boolean hasCaptureChannel(int nChannelType); /** Calls snd_mixer_selem_get_capture_group(). */ public native int getCaptureGroup(); /** Calls snd_mixer_selem_has_common_volume(). */ public native boolean hasCommonVolume(); /** Calls snd_mixer_selem_has_playback_volume(). */ public native boolean hasPlaybackVolume(); /** Calls snd_mixer_selem_has_playback_volume_joined(). */ public native boolean hasPlaybackVolumeJoined(); /** Calls snd_mixer_selem_has_capture_volume(). */ public native boolean hasCaptureVolume(); /** Calls snd_mixer_selem_has_capture_volume_joined(). */ public native boolean hasCaptureVolumeJoined(); /** Calls snd_mixer_selem_has_common_switch(). */ public native boolean hasCommonSwitch(); /** Calls snd_mixer_selem_has_playback_switch(). */ public native boolean hasPlaybackSwitch(); /** Calls snd_mixer_selem_has_playback_switch_joined(). */ public native boolean hasPlaybackSwitchJoined(); /** Calls snd_mixer_selem_has_capture_switch(). */ public native boolean hasCaptureSwitch(); /** Calls snd_mixer_selem_has_capture_switch_joined(). */ public native boolean hasCaptureSwitchJoinded(); /** Calls snd_mixer_selem_has_capture_switch_exclusive(). */ public native boolean hasCaptureSwitchExclusive(); /** Calls snd_mixer_selem_get_playback_volume(). */ public native int getPlaybackVolume(int nChannelType); /** Calls snd_mixer_selem_get_capture_volume(). */ public native int getCaptureVolume(int nChannelType); /** Calls snd_mixer_selem_get_playback_switch(). */ public native boolean getPlaybackSwitch(int nChannelType); /** Calls snd_mixer_selem_get_capture_switch(). */ public native boolean getCaptureSwitch(int nChannelType); /** Calls snd_mixer_selem_set_playback_volume(). */ public native void setPlaybackVolume(int nChannelType, int nValue); /** Calls snd_mixer_selem_set_capture_volume(). */ public native void setCaptureVolume(int nChannelType, int nValue); /** Calls snd_mixer_selem_set_playback_volume_all(). */ public native void setPlaybackVolumeAll(int nValue); /** Calls snd_mixer_selem_set_capture_volume_all(). */ public native void setCaptureVolumeAll(int nValue); /** Calls snd_mixer_selem_set_playback_switch(). */ public native void setPlaybackSwitch(int nChannelType, boolean bValue); /** Calls snd_mixer_selem_set_capture_switch(). */ public native void setCaptureSwitch(int nChannelType, boolean bValue); /** Calls snd_mixer_selem_set_playback_switch_all(). */ public native void setPlaybackSwitchAll(boolean bValue); /** Calls snd_mixer_selem_set_capture_switch_all(). */ public native void setCaptureSwitchAll(boolean bValue); /** Calls snd_mixer_selem_get_playback_volume_range(). anValues[0]: minimum anValues[1]: maximum */ public native void getPlaybackVolumeRange(int[] anValues); /** Calls snd_mixer_selem_get_capture_volume_range(). anValues[0]: minimum anValues[1]: maximum */ public native void getCaptureVolumeRange(int[] anValues); /** Calls snd_mixer_selem_set_playback_volume_range(). */ public native void setPlaybackVolumeRange(int nMin, int nMax); /** Calls snd_mixer_selem_set_capture_volume_range(). */ public native void setCaptureVolumeRange(int nMin, int nMax); /** Calls snd_mixer_selem_channel_name(). */ public static native String getChannelName(int nChannelType); /** TODO: */ private static native void setTrace(boolean bTrace); } /*** AlsaMixerElement.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/lowlevel/alsa/AlsaPcm.java0000644000175000017500000002554610374160730027070 0ustar twernertwerner/* * AlsaPcm.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2000 - 2001 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.lowlevel.alsa; import org.tritonus.share.TDebug; /** TODO: */ public class AlsaPcm { public static final int SND_PCM_STREAM_PLAYBACK = 0; /** Capture stream */ public static final int SND_PCM_STREAM_CAPTURE = 1; /** PCM access type */ /* snd_pcm_access_t */ /** mmap access with simple interleaved channels */ public static final int SND_PCM_ACCESS_MMAP_INTERLEAVED = 0; /** mmap access with simple non interleaved channels */ public static final int SND_PCM_ACCESS_MMAP_NONINTERLEAVED = 1; /** mmap access with complex placement */ public static final int SND_PCM_ACCESS_MMAP_COMPLEX = 2; /** snd_pcm_readi/snd_pcm_writei access */ public static final int SND_PCM_ACCESS_RW_INTERLEAVED = 3; /** snd_pcm_readn/snd_pcm_writen access */ public static final int SND_PCM_ACCESS_RW_NONINTERLEAVED = 4; public static final int SND_PCM_FORMAT_UNKNOWN = -1; public static final int SND_PCM_FORMAT_S8 = 0; public static final int SND_PCM_FORMAT_U8 = 1; public static final int SND_PCM_FORMAT_S16_LE = 2; public static final int SND_PCM_FORMAT_S16_BE = 3; public static final int SND_PCM_FORMAT_U16_LE = 4; public static final int SND_PCM_FORMAT_U16_BE = 5; public static final int SND_PCM_FORMAT_S24_LE = 6; /* low three bytes */ public static final int SND_PCM_FORMAT_S24_BE = 7; /* low three bytes */ public static final int SND_PCM_FORMAT_U24_LE = 8; /* low three bytes */ public static final int SND_PCM_FORMAT_U24_BE = 9; /* low three bytes */ public static final int SND_PCM_FORMAT_S32_LE = 10; public static final int SND_PCM_FORMAT_S32_BE = 11; public static final int SND_PCM_FORMAT_U32_LE = 12; public static final int SND_PCM_FORMAT_U32_BE = 13; public static final int SND_PCM_FORMAT_FLOAT_LE = 14; /* 4-byte float, IEEE-754 32-bit */ public static final int SND_PCM_FORMAT_FLOAT_BE = 15; /* 4-byte float, IEEE-754 32-bit */ public static final int SND_PCM_FORMAT_FLOAT64_LE = 16; /* 8-byte float, IEEE-754 64-bit */ public static final int SND_PCM_FORMAT_FLOAT64_BE = 17; /* 8-byte float, IEEE-754 64-bit */ public static final int SND_PCM_FORMAT_IEC958_SUBFRAME_LE = 18; /* IEC-958 subframe, Little Endian */ public static final int SND_PCM_FORMAT_IEC958_SUBFRAME_BE = 19; /* IEC-958 subframe, Big Endian */ public static final int SND_PCM_FORMAT_MU_LAW = 20; public static final int SND_PCM_FORMAT_A_LAW = 21; public static final int SND_PCM_FORMAT_IMA_ADPCM = 22; public static final int SND_PCM_FORMAT_MPEG = 23; public static final int SND_PCM_FORMAT_GSM = 24; public static final int SND_PCM_FORMAT_SPECIAL = 31; // currently missing: cpu endianedd formats /* #ifdef SND_LITTLE_ENDIAN public static final int SND_PCM_SFMT_S16 = SND_PCM_SFMT_S16_LE public static final int SND_PCM_SFMT_U16 SND_PCM_SFMT_U16_LE public static final int SND_PCM_SFMT_S24 SND_PCM_SFMT_S24_LE public static final int SND_PCM_SFMT_U24 SND_PCM_SFMT_U24_LE public static final int SND_PCM_SFMT_S32 SND_PCM_SFMT_S32_LE public static final int SND_PCM_SFMT_U32 SND_PCM_SFMT_U32_LE public static final int SND_PCM_SFMT_FLOAT SND_PCM_SFMT_FLOAT_LE public static final int SND_PCM_SFMT_FLOAT64 SND_PCM_SFMT_FLOAT64_LE public static final int SND_PCM_SFMT_IEC958_SUBFRAME SND_PCM_SFMT_IEC958_SUBFRAME_LE #endif #ifdef SND_BIG_ENDIAN public static final int SND_PCM_SFMT_S16 SND_PCM_SFMT_S16_BE public static final int SND_PCM_SFMT_U16 SND_PCM_SFMT_U16_BE public static final int SND_PCM_SFMT_S24 SND_PCM_SFMT_S24_BE public static final int SND_PCM_SFMT_U24 SND_PCM_SFMT_U24_BE public static final int SND_PCM_SFMT_S32 SND_PCM_SFMT_S32_BE public static final int SND_PCM_SFMT_U32 SND_PCM_SFMT_U32_BE public static final int SND_PCM_SFMT_FLOAT SND_PCM_SFMT_FLOAT_BE public static final int SND_PCM_SFMT_FLOAT64 SND_PCM_SFMT_FLOAT64_BE public static final int SND_PCM_SFMT_IEC958_SUBFRAME SND_PCM_SFMT_IEC958_SUBFRAME_BE #endif */ /* #ifdef SND_LITTLE_ENDIAN public static final int SND_PCM_FMT_S16 = SND_PCM_FMT_S16_LE public static final int SND_PCM_FMT_U16 SND_PCM_FMT_U16_LE public static final int SND_PCM_FMT_S24 SND_PCM_FMT_S24_LE public static final int SND_PCM_FMT_U24 SND_PCM_FMT_U24_LE public static final int SND_PCM_FMT_S32 SND_PCM_FMT_S32_LE public static final int SND_PCM_FMT_U32 SND_PCM_FMT_U32_LE public static final int SND_PCM_FMT_FLOAT SND_PCM_FMT_FLOAT_LE public static final int SND_PCM_FMT_FLOAT64 SND_PCM_FMT_FLOAT64_LE public static final int SND_PCM_FMT_IEC958_SUBFRAME SND_PCM_FMT_IEC958_SUBFRAME_LE #endif #ifdef SND_BIG_ENDIAN public static final int SND_PCM_FMT_S16 SND_PCM_FMT_S16_BE public static final int SND_PCM_FMT_U16 SND_PCM_FMT_U16_BE public static final int SND_PCM_FMT_S24 SND_PCM_FMT_S24_BE public static final int SND_PCM_FMT_U24 SND_PCM_FMT_U24_BE public static final int SND_PCM_FMT_S32 SND_PCM_FMT_S32_BE public static final int SND_PCM_FMT_U32 SND_PCM_FMT_U32_BE public static final int SND_PCM_FMT_FLOAT SND_PCM_FMT_FLOAT_BE public static final int SND_PCM_FMT_FLOAT64 SND_PCM_FMT_FLOAT64_BE public static final int SND_PCM_FMT_IEC958_SUBFRAME SND_PCM_FMT_IEC958_SUBFRAME_BE #endif */ /** PCM state (snd_pcm_state_t) */ /** Open */ public static final int SND_PCM_STATE_OPEN = 0; /** Setup installed */ public static final int SND_PCM_STATE_SETUP = 1; /** Ready to start */ public static final int SND_PCM_STATE_PREPARED = 2; /** Running */ public static final int SND_PCM_STATE_RUNNING = 3; /** Stopped: underrun (playback) or overrun (capture) detected */ public static final int SND_PCM_STATE_XRUN = 4; /** Draining: running (playback) or stopped (capture) */ public static final int SND_PCM_STATE_DRAINING = 5; /** Paused */ public static final int SND_PCM_STATE_PAUSED = 6; /** PCM start mode (snd_pcm_start_t) */ /** Automatic start on data read/write */ public static final int SND_PCM_START_DATA = 0; /** Explicit start */ public static final int SND_PCM_START_EXPLICIT = 1; /** PCM xrun mode (snd_pcm_xrun_t) */ /** Xrun detection disabled */ public static final int SND_PCM_XRUN_NONE = 0; /** Stop on xrun detection */ public static final int SND_PCM_XRUN_STOP = 1; /** PCM timestamp mode (snd_pcm_tstamp_t) */ /** No timestamp */ public static final int SND_PCM_TSTAMP_NONE = 0; /** Update mmap'ed timestamp */ public static final int SND_PCM_TSTAMP_MMAP = 1; static { Alsa.loadNativeLibrary(); if (TDebug.TraceAlsaPcmNative) { setTrace(true); } } /** * Holds the pointer to snd_pcm_t for the native code. * This must be long to be 64bit-clean. */ @SuppressWarnings("unused") private long m_lNativeHandle; /** * For parameter documentation, see open(). */ public AlsaPcm(String strPcmName, int nDirection, int nMode) throws Exception { int nReturn; nReturn = open(strPcmName, nDirection, nMode); if (nReturn < 0) { throw new Exception(Alsa.getStringError(nReturn)); } } /** * Calls snd_pcm_open(). * * @param strPcmName An ALSA pcm name, e.g. 'hw:0,0'. * * @param nDirection one of SND_PCM_STREAM_PLAYBACK, SND_PCM_STREAM_CAPTURE. * * @param nMode optional file open modes (non-blocking,...) */ private native int open(String strPcmName, int nDirection, int nMode); /** * Calls snd_pcm_close(). */ public native int close(); /** * Calls snd_pcm_hw_params_any(). */ public native int getAnyHWParams(AlsaPcmHWParams hwParams); /** * Calls snd_pcm_hw_params_set_access(). */ public native int setHWParamsAccess(AlsaPcmHWParams hwParams, int nAccess); /** * Calls snd_pcm_hw_params_set_format(). */ public native int setHWParamsFormat(AlsaPcmHWParams hwParams, int nFormat); /** * Calls snd_pcm_hw_params_set_format_mask(). */ public native int setHWParamsFormatMask(AlsaPcmHWParams hwParams, AlsaPcmHWParamsFormatMask mask); /** * Calls snd_pcm_hw_params_set_channels(). */ public native int setHWParamsChannels(AlsaPcmHWParams hwParams, int nChannels); /** * Calls snd_pcm_hw_params_set_rate_near(). */ public native int setHWParamsRateNear(AlsaPcmHWParams hwParams, int nRate /* missing: out parameter direction? */); /** * Calls snd_pcm_hw_params_set_buffer_time_near(). */ public native int setHWParamsBufferTimeNear(AlsaPcmHWParams hwParams, int nBufferTime /* missing: out parameter direction? */); /** * Calls snd_pcm_hw_params_set_period_time_near(). */ public native int setHWParamsPeriodTimeNear(AlsaPcmHWParams hwParams, int nPeriodTime /* missing: out parameter direction? */); /** * Calls snd_pcm_hw_params(). */ public native int setHWParams(AlsaPcmHWParams hwParams); public native int getSWParams(AlsaPcmSWParams swParams); public native int setSWParamsStartMode(AlsaPcmSWParams swParams, int n); public native int setSWParamsXrunMode(AlsaPcmSWParams swParams, int n); public native int setSWParamsTStampMode(AlsaPcmSWParams swParams, int n); public native int setSWParamsSleepMin(AlsaPcmSWParams swParams, int n); public native int setSWParamsAvailMin(AlsaPcmSWParams swParams, int n); public native int setSWParamsXferAlign(AlsaPcmSWParams swParams, int n); // TODO: should be long (snd_pcm_uframes_t) public native int setSWParamsStartThreshold(AlsaPcmSWParams swParams, int n); public native int setSWParamsStopThreshold(AlsaPcmSWParams swParams, int n); public native int setSWParamsSilenceThreshold(AlsaPcmSWParams swParams, int n); public native int setSWParamsSilenceSize(AlsaPcmSWParams swParams, int n); public native int setSWParams(AlsaPcmSWParams swParams); /** @param lOffset Offset where the data should be read from the buffer, in bytes. @param lFrameCount Length of the data to write, in number of PCM frames. */ public native long writei(byte[] abBuffer, long lOffset, long lFrameCount); public native long readi(byte[] abBuffer, long lOffset, long lFrameCount); public static native void setTrace(boolean bTrace); } /*** AlsaPcm.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/lowlevel/alsa/AlsaPcmHWParams.java0000644000175000017500000001642510374160730030467 0ustar twernertwerner/* * AlsaPcmHWParams.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2000 - 2001 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.lowlevel.alsa; import org.tritonus.share.TDebug; /** TODO: */ public class AlsaPcmHWParams { /** * Holds the pointer to snd_pcm_hw_params_t * for the native code. * This must be long to be 64bit-clean. */ @SuppressWarnings("unused") private long m_lNativeHandle; public AlsaPcmHWParams() { if (TDebug.TraceAlsaPcmNative) { TDebug.out("AlsaPcmHWParams.(): begin"); } int nReturn = malloc(); if (nReturn < 0) { throw new RuntimeException("malloc of hw_params failed"); } if (TDebug.TraceAlsaPcmNative) { TDebug.out("AlsaPcmHWParams.(): end"); } } public void finalize() { // TODO: call free() // call super.finalize() first or last? // and introduce a flag if free() has already been called? } private native int malloc(); public native void free(); /** * Calls snd_pcm_hw_params_get_rate_numden(). * * alValues[0]: numerator * alValues[1]: denominator */ public native int getRate(long[] alValues); public double getRate() { long[] alValues = new long[2]; int nReturn; nReturn = getRate(alValues); double dRate = -1; if (nReturn >= 0) { dRate = (double) alValues[0] / (double) alValues[1]; } return dRate; } public native int getSBits(); public native int getFifoSize(); public native int getAccess(); public native int getFormat(); public native void getFormatMask(AlsaPcmHWParamsFormatMask mask); public native int getSubformat(); public native int getChannels(); public native int getChannelsMin(); public native int getChannelsMax(); /** Gets approximate rate. * Calls snd_pcm_hw_params_get_rate(). * anValues[0]: -1, 0 or +1, depending on the direction the exact rate differs from the returned value. */ public native int getRate(int[] anValues); /** Gets approximate minimum rate. * Calls snd_pcm_hw_params_get_rate_min(). * anValues[0]: -1, 0 or +1, depending on the direction the exact rate differs from the returned value. */ public native int getRateMin(int[] anValues); /** Gets approximate maximum rate. * Calls snd_pcm_hw_params_get_rate_max(). * anValues[0]: -1, 0 or +1, depending on the direction the exact rate differs from the returned value. */ public native int getRateMax(int[] anValues); /** Gets approximate period time. * Calls snd_pcm_hw_params_get_period_time(). * anValues[0]: -1, 0 or +1, depending on the direction the exact rate differs from the returned value. */ public native int getPeriodTime(int[] anValues); /** Gets approximate minimum period time. * Calls snd_pcm_hw_params_get_period_time_min(). * anValues[0]: -1, 0 or +1, depending on the direction the exact rate differs from the returned value. */ public native int getPeriodTimeMin(int[] anValues); /** Gets approximate maximum period time. * Calls snd_pcm_hw_params_get_period_time_max(). * anValues[0]: -1, 0 or +1, depending on the direction the exact rate differs from the returned value. */ public native int getPeriodTimeMax(int[] anValues); /** Gets approximate period size. * Calls snd_pcm_hw_params_get_period_size(). * anValues[0]: -1, 0 or +1, depending on the direction the exact rate differs from the returned value. */ public native int getPeriodSize(int[] anValues); /** Gets approximate minimum period size. * Calls snd_pcm_hw_params_get_period_size_min(). * anValues[0]: -1, 0 or +1, depending on the direction the exact rate differs from the returned value. */ public native int getPeriodSizeMin(int[] anValues); /** Gets approximate maximum period size. * Calls snd_pcm_hw_params_get_period_size_max(). * anValues[0]: -1, 0 or +1, depending on the direction the exact rate differs from the returned value. */ public native int getPeriodSizeMax(int[] anValues); /** Gets approximate periods. * Calls snd_pcm_hw_params_get_periods(). * anValues[0]: -1, 0 or +1, depending on the direction the exact rate differs from the returned value. */ public native int getPeriods(int[] anValues); /** Gets approximate minimum periods. * Calls snd_pcm_hw_params_get_periods_min(). * anValues[0]: -1, 0 or +1, depending on the direction the exact rate differs from the returned value. */ public native int getPeriodsMin(int[] anValues); /** Gets approximate maximum periods. * Calls snd_pcm_hw_params_get_periods_max(). * anValues[0]: -1, 0 or +1, depending on the direction the exact rate differs from the returned value. */ public native int getPeriodsMax(int[] anValues); /** Gets approximate buffer time. * Calls snd_pcm_hw_params_get_buffer_time(). * anValues[0]: -1, 0 or +1, depending on the direction the exact rate differs from the returned value. */ public native int getBufferTime(int[] anValues); /** Gets approximate minimum buffer time. * Calls snd_pcm_hw_params_get_buffer_time_min(). * anValues[0]: -1, 0 or +1, depending on the direction the exact rate differs from the returned value. */ public native int getBufferTimeMin(int[] anValues); /** Gets approximate maximum buffer time. * Calls snd_pcm_hw_params_get_buffer_time_max(). * anValues[0]: -1, 0 or +1, depending on the direction the exact rate differs from the returned value. */ public native int getBufferTimeMax(int[] anValues); /** Gets approximate buffer size. * Calls snd_pcm_hw_params_get_buffer_size(). */ public native int getBufferSize(); /** Gets approximate minimum buffer size. * Calls snd_pcm_hw_params_get_buffer_size_min(). */ public native int getBufferSizeMin(); /** Gets approximate maximum buffer size. * Calls snd_pcm_hw_params_get_buffer_size_max(). */ public native int getBufferSizeMax(); /** Gets approximate tick time. * Calls snd_pcm_hw_params_get_tick_time(). * anValues[0]: -1, 0 or +1, depending on the direction the exact rate differs from the returned value. */ public native int getTickTime(int[] anValues); /** Gets approximate minimum tick time. * Calls snd_pcm_hw_params_get_tick_time_min(). * anValues[0]: -1, 0 or +1, depending on the direction the exact rate differs from the returned value. */ public native int getTickTimeMin(int[] anValues); /** Gets approximate maximum tick time. * Calls snd_pcm_hw_params_get_tick_time_max(). * anValues[0]: -1, 0 or +1, depending on the direction the exact rate differs from the returned value. */ public native int getTickTimeMax(int[] anValues); } /*** AlsaPcmHWParams.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/lowlevel/alsa/AlsaPcmHWParamsFormatMask.java0000644000175000017500000000461610374160730032453 0ustar twernertwerner/* * AlsaPcmHWParamsFormatMask.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2000 - 2001 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.lowlevel.alsa; import org.tritonus.share.TDebug; /** TODO: */ public class AlsaPcmHWParamsFormatMask { /** * Holds the pointer to snd_pcm_format_mask_t * for the native code. * This must be long to be 64bit-clean. */ @SuppressWarnings("unused") private long m_lNativeHandle; public AlsaPcmHWParamsFormatMask() { if (TDebug.TraceAlsaPcmNative) { TDebug.out("AlsaPcmHWParamsFormatMask.(): begin"); } int nReturn = malloc(); if (nReturn < 0) { throw new RuntimeException("malloc of format_mask failed"); } if (TDebug.TraceAlsaPcmNative) { TDebug.out("AlsaPcmHWParamsFormatMask.(): end"); } } public void finalize() { // TODO: call free() // call super.finalize() first or last? // and introduce a flag if free() has already been called? } /** * Calls snd_pcm_format_mask_malloc(). */ private native int malloc(); /** * Calls snd_pcm_format_mask_free(). */ public native void free(); /** * Calls snd_pcm_format_mask_none(). */ public native void none(); /** * Calls snd_pcm_format_mask_any(). */ public native void any(); /** * Calls snd_pcm_format_mask_test(). */ public native boolean test(int nFormat); /** * Calls snd_pcm_format_mask_set(). */ public native void set(int nFormat); /** * Calls snd_pcm_format_mask_reset(). */ public native void reset(int nFormat); } /*** AlsaPcmHWParamsFormatMask.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/lowlevel/alsa/AlsaPcmSWParams.java0000644000175000017500000000426110374160730030475 0ustar twernertwerner/* * AlsaPcmSWParams.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2000 - 2001 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.lowlevel.alsa; import org.tritonus.share.TDebug; /** TODO: */ public class AlsaPcmSWParams { /** * Holds the pointer to snd_pcm_sw_params_t * for the native code. * This must be long to be 64bit-clean. */ @SuppressWarnings("unused") private long m_lNativeHandle; public AlsaPcmSWParams() { if (TDebug.TraceAlsaPcmNative) { TDebug.out("AlsaPcmSWParams.(): begin"); } int nReturn = malloc(); if (nReturn < 0) { throw new RuntimeException("malloc of hw_params failed"); } if (TDebug.TraceAlsaPcmNative) { TDebug.out("AlsaPcmSWParams.(): end"); } } public void finalize() { // TODO: call free() // call super.finalize() first or last? // and introduce a flag if free() has already been called? } private native int malloc(); public native void free(); public native int getStartMode(); public native int getXrunMode(); public native int getTStampMode(); public native int getSleepMin(); public native int getAvailMin(); public native int getXferAlign(); public native int getStartThreshold(); public native int getStopThreshold(); public native int getSilenceThreshold(); public native int getSilenceSize(); } /*** AlsaPcmSWParams.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/lowlevel/alsa/AlsaSeq.java0000644000175000017500000012723510374160730027077 0ustar twernertwerner/* * AlsaSeq.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999 - 2001 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.lowlevel.alsa; import java.lang.UnsupportedOperationException; import java.util.Iterator; import org.tritonus.share.TDebug; public class AlsaSeq { /* */ /* definition of sequencer event types */ /* */ // TODO: recheck numbers; enable automatic check /* 0-4: system messages * event data type = snd_seq_result_t */ public static final int SND_SEQ_EVENT_SYSTEM = 0; public static final int SND_SEQ_EVENT_RESULT = 1; /* 2-4: reserved */ /* 5-9: note messages (channel specific) * event data type = snd_seq_ev_note */ public static final int SND_SEQ_EVENT_NOTE = 5; public static final int SND_SEQ_EVENT_NOTEON = 6; public static final int SND_SEQ_EVENT_NOTEOFF = 7; public static final int SND_SEQ_EVENT_KEYPRESS = 8; /* 9-10: reserved */ /* 10-19: control messages (channel specific) * event data type = snd_seq_ev_ctrl */ public static final int SND_SEQ_EVENT_CONTROLLER = 10; public static final int SND_SEQ_EVENT_PGMCHANGE = 11; public static final int SND_SEQ_EVENT_CHANPRESS = 12; public static final int SND_SEQ_EVENT_PITCHBEND = 13; /* from -8192 to 8191 */ public static final int SND_SEQ_EVENT_CONTROL14 = 14; /* 14 bit controller value */ public static final int SND_SEQ_EVENT_NONREGPARAM = 15; /* 14 bit NRPN */ public static final int SND_SEQ_EVENT_REGPARAM = 16; /* 14 bit RPN */ /* 18-19: reserved */ /* 20-29: synchronisation messages * event data type = snd_seq_ev_ctrl */ public static final int SND_SEQ_EVENT_SONGPOS = 20; /* Song Position Pointer with LSB and MSB values */ public static final int SND_SEQ_EVENT_SONGSEL = 21; /* Song Select with song ID number */ public static final int SND_SEQ_EVENT_QFRAME = 22; /* midi time code quarter frame */ public static final int SND_SEQ_EVENT_TIMESIGN = 23; /* SMF Time Signature event */ public static final int SND_SEQ_EVENT_KEYSIGN = 24; /* SMF Key Signature event */ /* 25-29: reserved */ /* 30-39: timer messages * event data type = snd_seq_ev_queue_control_t */ public static final int SND_SEQ_EVENT_START = 30; /* midi Real Time Start message */ public static final int SND_SEQ_EVENT_CONTINUE = 31; /* midi Real Time Continue message */ public static final int SND_SEQ_EVENT_STOP = 32; /* midi Real Time Stop message */ public static final int SND_SEQ_EVENT_SETPOS_TICK = 33; /* set tick queue position */ public static final int SND_SEQ_EVENT_SETPOS_TIME = 34; /* set realtime queue position */ public static final int SND_SEQ_EVENT_TEMPO = 35; /* (SMF) Tempo event */ public static final int SND_SEQ_EVENT_CLOCK = 36; /* midi Real Time Clock message */ public static final int SND_SEQ_EVENT_TICK = 37; /* midi Real Time Tick message */ /* 38-39: sync */ public static final int SND_SEQ_EVENT_SYNC = 38; public static final int SND_SEQ_EVENT_SYNC_POS = 39; /* 40-49: others * event data type = none */ public static final int SND_SEQ_EVENT_TUNE_REQUEST = 40; /* tune request */ public static final int SND_SEQ_EVENT_RESET = 41; /* reset to power-on state */ public static final int SND_SEQ_EVENT_SENSING = 42; /* "active sensing" event */ /* 43-49: reserved */ /* 50-59: echo back, kernel private messages * event data type = any type */ public static final int SND_SEQ_EVENT_ECHO = 50; /* echo event */ public static final int SND_SEQ_EVENT_OSS = 51; /* OSS raw event */ /* 52-59: reserved */ /* 60-69: system status messages (broadcast for subscribers) * event data type = snd_seq_addr_t */ public static final int SND_SEQ_EVENT_CLIENT_START = 60; /* new client has connected */ public static final int SND_SEQ_EVENT_CLIENT_EXIT = 61; /* client has left the system */ public static final int SND_SEQ_EVENT_CLIENT_CHANGE = 62; /* client status/info has changed */ public static final int SND_SEQ_EVENT_PORT_START = 63; /* new port was created */ public static final int SND_SEQ_EVENT_PORT_EXIT = 64; /* port was deleted from system */ public static final int SND_SEQ_EVENT_PORT_CHANGE = 65; /* port status/info has changed */ public static final int SND_SEQ_EVENT_PORT_SUBSCRIBED = 66; /* read port is subscribed */ public static final int SND_SEQ_EVENT_PORT_UNSUBSCRIBED = 67; /* read port is released */ /* 70-79: synthesizer events * event data type = snd_seq_eve_sample_control_t */ public static final int SND_SEQ_EVENT_SAMPLE = 70; /* sample select */ public static final int SND_SEQ_EVENT_SAMPLE_CLUSTER = 71; /* sample cluster select */ public static final int SND_SEQ_EVENT_SAMPLE_START = 72; /* voice start */ public static final int SND_SEQ_EVENT_SAMPLE_STOP = 73; /* voice stop */ public static final int SND_SEQ_EVENT_SAMPLE_FREQ = 74; /* playback frequency */ public static final int SND_SEQ_EVENT_SAMPLE_VOLUME = 75; /* volume and balance */ public static final int SND_SEQ_EVENT_SAMPLE_LOOP = 76; /* sample loop */ public static final int SND_SEQ_EVENT_SAMPLE_POSITION = 77; /* sample position */ public static final int SND_SEQ_EVENT_SAMPLE_PRIVATE1 = 78; /* private (hardware dependent) event */ /* 80-89: reserved */ /* 90-99: user-defined events with fixed length * event data type = any */ public static final int SND_SEQ_EVENT_USR0 = 90; public static final int SND_SEQ_EVENT_USR1 = 91; public static final int SND_SEQ_EVENT_USR2 = 92; public static final int SND_SEQ_EVENT_USR3 = 93; public static final int SND_SEQ_EVENT_USR4 = 94; public static final int SND_SEQ_EVENT_USR5 = 95; public static final int SND_SEQ_EVENT_USR6 = 96; public static final int SND_SEQ_EVENT_USR7 = 97; public static final int SND_SEQ_EVENT_USR8 = 98; public static final int SND_SEQ_EVENT_USR9 = 99; /* 100-129: instrument layer * variable length data can be passed directly to the driver */ public static final int SND_SEQ_EVENT_INSTR_BEGIN = 100; /* begin of instrument management */ public static final int SND_SEQ_EVENT_INSTR_END = 101; /* end of instrument management */ public static final int SND_SEQ_EVENT_INSTR_INFO = 102; /* instrument interface info */ public static final int SND_SEQ_EVENT_INSTR_INFO_RESULT = 103; /* result */ public static final int SND_SEQ_EVENT_INSTR_FINFO = 104; /* get format info */ public static final int SND_SEQ_EVENT_INSTR_FINFO_RESULT = 105; /* get format info */ public static final int SND_SEQ_EVENT_INSTR_RESET = 106; /* reset instrument memory */ public static final int SND_SEQ_EVENT_INSTR_STATUS = 107; /* instrument interface status */ public static final int SND_SEQ_EVENT_INSTR_STATUS_RESULT = 108; /* result */ public static final int SND_SEQ_EVENT_INSTR_PUT = 109; /* put instrument to port */ public static final int SND_SEQ_EVENT_INSTR_GET = 110; /* get instrument from port */ public static final int SND_SEQ_EVENT_INSTR_GET_RESULT = 111; /* result */ public static final int SND_SEQ_EVENT_INSTR_FREE = 112; /* free instrument(s) */ public static final int SND_SEQ_EVENT_INSTR_LIST = 113; /* instrument list */ public static final int SND_SEQ_EVENT_INSTR_LIST_RESULT = 114; /* result */ public static final int SND_SEQ_EVENT_INSTR_CLUSTER = 115; /* cluster parameters */ public static final int SND_SEQ_EVENT_INSTR_CLUSTER_GET = 116; /* get cluster parameters */ public static final int SND_SEQ_EVENT_INSTR_CLUSTER_RESULT = 117; /* result */ public static final int SND_SEQ_EVENT_INSTR_CHANGE = 118; /* instrument change */ /* 119-129: reserved */ /* 130-139: variable length events * event data type = snd_seq_ev_ext * (SND_SEQ_EVENT_LENGTH_VARIABLE must be set) */ public static final int SND_SEQ_EVENT_SYSEX = 130; /* system exclusive data (variable length) */ public static final int SND_SEQ_EVENT_BOUNCE = 131; /* error event */ /* 132-134: reserved */ public static final int SND_SEQ_EVENT_USR_VAR0 = 135; public static final int SND_SEQ_EVENT_USR_VAR1 = 136; public static final int SND_SEQ_EVENT_USR_VAR2 = 137; public static final int SND_SEQ_EVENT_USR_VAR3 = 138; public static final int SND_SEQ_EVENT_USR_VAR4 = 139; /* 255: special event */ public static final int SND_SEQ_EVENT_NONE = 255; public static final int SND_SEQ_ADDRESS_UNKNOWN = 253; /* unknown source */ public static final int SND_SEQ_ADDRESS_SUBSCRIBERS = 254; /* send event to all subscribed ports */ public static final int SND_SEQ_ADDRESS_BROADCAST = 255; /* send event to all queues/clients/ports/channels */ public static final int SND_SEQ_QUEUE_DIRECT = 253; /* direct dispatch */ /* event mode flag - NOTE: only 8 bits available! */ public static final int SND_SEQ_TIME_STAMP_TICK = (0<<0); /* timestamp in clock ticks */ public static final int SND_SEQ_TIME_STAMP_REAL = (1<<0); /* timestamp in real time */ public static final int SND_SEQ_TIME_STAMP_MASK = (1<<0); public static final int SND_SEQ_TIME_MODE_ABS = (0<<1); /* absolute timestamp */ public static final int SND_SEQ_TIME_MODE_REL = (1<<1); /* relative to current time */ public static final int SND_SEQ_TIME_MODE_MASK = (1<<1); public static final int SND_SEQ_EVENT_LENGTH_FIXED = (0<<2); /* fixed event size */ public static final int SND_SEQ_EVENT_LENGTH_VARIABLE = (1<<2); /* variable event size */ public static final int SND_SEQ_EVENT_LENGTH_VARUSR = (2<<2); /* variable event size - user memory space */ public static final int SND_SEQ_EVENT_LENGTH_VARIPC = (3<<2); /* variable event size - IPC */ public static final int SND_SEQ_EVENT_LENGTH_MASK = (3<<2); public static final int SND_SEQ_PRIORITY_NORMAL = (0<<4); /* normal priority */ public static final int SND_SEQ_PRIORITY_HIGH = (1<<4); /* event should be processed before others */ public static final int SND_SEQ_PRIORITY_MASK = (1<<4); /* known client numbers */ public static final int SND_SEQ_CLIENT_SYSTEM = 0; public static final int SND_SEQ_CLIENT_DUMMY = 62; /* dummy ports */ public static final int SND_SEQ_CLIENT_OSS = 63; /* oss sequencer emulator */ /* event filter flags */ public static final int SND_SEQ_FILTER_BROADCAST = (1<<0); /* accept broadcast messages */ public static final int SND_SEQ_FILTER_MULTICAST = (1<<1); /* accept multicast messages */ public static final int SND_SEQ_FILTER_BOUNCE = (1<<2); /* accept bounce event in error */ public static final long SND_SEQ_FILTER_USE_EVENT = (1L<<31); /* use event filter */ /* Flush mode flags */ public static final int SND_SEQ_REMOVE_INPUT = (1<<0); /* Restrict by destination q:client:port */ public static final int SND_SEQ_REMOVE_OUTPUT = (1<<1); /* Restrict by channel */ public static final int SND_SEQ_REMOVE_DEST = (1<<2); /* Restrict by destination q:client:port */ public static final int SND_SEQ_REMOVE_DEST_CHANNEL = (1<<3); /* Restrict by channel */ public static final int SND_SEQ_REMOVE_TIME_BEFORE = (1<<4); /* Restrict to before time */ public static final int SND_SEQ_REMOVE_TIME_AFTER = (1<<5); /* Restrict to time or after */ public static final int SND_SEQ_REMOVE_TIME_TICK = (1<<6); /* Restrict to time or after */ public static final int SND_SEQ_REMOVE_EVENT_TYPE = (1<<7); /* Restrict to event type */ public static final int SND_SEQ_REMOVE_IGNORE_OFF = (1<<8); /* Do not flush off events */ public static final int SND_SEQ_REMOVE_TAG_MATCH = (1<<9); /* Restrict to events with given tag */ /* known port numbers */ public static final int SND_SEQ_PORT_SYSTEM_TIMER = 0; public static final int SND_SEQ_PORT_SYSTEM_ANNOUNCE = 1; /* port capabilities (32 bits) */ public static final int SND_SEQ_PORT_CAP_READ = (1<<0); /* readable from this port */ public static final int SND_SEQ_PORT_CAP_WRITE = (1<<1); /* writable to this port */ public static final int SND_SEQ_PORT_CAP_SYNC_READ = (1<<2); public static final int SND_SEQ_PORT_CAP_SYNC_WRITE = (1<<3); public static final int SND_SEQ_PORT_CAP_DUPLEX = (1<<4); public static final int SND_SEQ_PORT_CAP_SUBS_READ = (1<<5); /* allow read subscription */ public static final int SND_SEQ_PORT_CAP_SUBS_WRITE = (1<<6); /* allow write subscription */ public static final int SND_SEQ_PORT_CAP_NO_EXPORT = (1<<7); /* routing not allowed */ /* port type */ public static final int SND_SEQ_PORT_TYPE_SPECIFIC = (1<<0); /* hardware specific */ public static final int SND_SEQ_PORT_TYPE_MIDI_GENERIC =(1<<1); /* generic MIDI device */ public static final int SND_SEQ_PORT_TYPE_MIDI_GM = (1<<2); /* General MIDI compatible device */ public static final int SND_SEQ_PORT_TYPE_MIDI_GS = (1<<3); /* GS compatible device */ public static final int SND_SEQ_PORT_TYPE_MIDI_XG = (1<<4); /* XG compatible device */ public static final int SND_SEQ_PORT_TYPE_MIDI_MT32 = (1<<5); /* MT-32 compatible device */ /* other standards...*/ public static final int SND_SEQ_PORT_TYPE_SYNTH = (1<<10); /* Synth device */ public static final int SND_SEQ_PORT_TYPE_DIRECT_SAMPLE =(1<<11); /* Sampling device (support sample download) */ public static final int SND_SEQ_PORT_TYPE_SAMPLE = (1<<12); /* Sampling device (sample can be downloaded at any time) */ /*...*/ public static final int SND_SEQ_PORT_TYPE_APPLICATION = (1<<20); /* application (sequencer/editor) */ /* standard group names */ public static final String SND_SEQ_GROUP_SYSTEM = "system"; public static final String SND_SEQ_GROUP_DEVICE = "device"; public static final String SND_SEQ_GROUP_APPLICATION = "application"; /* misc. conditioning flags */ public static final int SND_SEQ_PORT_FLG_GIVEN_PORT = (1<<0); /* queue flags */ public static final int SND_SEQ_QUEUE_FLG_SYNC = (1<<0); /* sync enabled */ /* queue status flag */ public static final int SND_SEQ_QUEUE_FLG_SYNC_LOST = 1; /* synchronization types */ /* mode */ public static final int SND_SEQ_SYNC_TICK = 0x80; public static final int SND_SEQ_SYNC_TIME = 0x40; public static final int SND_SEQ_SYNC_MODE = 0xc0; /* mask */ /* private format */ public static final int SND_SEQ_SYNC_FMT_PRIVATE_CLOCK = (SND_SEQ_SYNC_TICK|0); public static final int SND_SEQ_SYNC_FMT_PRIVATE_TIME = (SND_SEQ_SYNC_TIME|0); /* pre-defined format */ public static final int SND_SEQ_SYNC_FMT_MIDI_CLOCK = (SND_SEQ_SYNC_TICK|1); public static final int SND_SEQ_SYNC_FMT_MTC = (SND_SEQ_SYNC_TIME|1); public static final int SND_SEQ_SYNC_FMT_DTL = (SND_SEQ_SYNC_TIME|2); public static final int SND_SEQ_SYNC_FMT_SMPTE = (SND_SEQ_SYNC_TIME|3); public static final int SND_SEQ_SYNC_FMT_MIDI_TICK = (SND_SEQ_SYNC_TIME|4); /* time format */ public static final int SND_SEQ_SYNC_FPS_24 = 0; public static final int SND_SEQ_SYNC_FPS_25 = 1; public static final int SND_SEQ_SYNC_FPS_30_DP = 2; public static final int SND_SEQ_SYNC_FPS_30_NDP = 3; /* sequencer timer sources */ public static final int SND_SEQ_TIMER_ALSA = 0; /* ALSA timer */ public static final int SND_SEQ_TIMER_MIDI_CLOCK = 1; /* Midi Clock (CLOCK event) */ public static final int SND_SEQ_TIMER_MIDI_TICK = 2; /* Midi Timer Tick (TICK event) */ /* type of query subscription */ public static final int SND_SEQ_QUERY_SUBS_READ = 0; public static final int SND_SEQ_QUERY_SUBS_WRITE = 1; /* instrument types */ public static final int SND_SEQ_INSTR_ATYPE_DATA = 0; /* instrument data */ public static final int SND_SEQ_INSTR_ATYPE_ALIAS = 1; /* instrument alias */ /* instrument ASCII identifiers */ public static final String SND_SEQ_INSTR_ID_DLS1 = "DLS1"; public static final String SND_SEQ_INSTR_ID_DLS2 = "DLS2"; public static final String SND_SEQ_INSTR_ID_SIMPLE = "Simple Wave"; public static final String SND_SEQ_INSTR_ID_SOUNDFONT = "SoundFont"; public static final String SND_SEQ_INSTR_ID_GUS_PATCH = "GUS Patch"; public static final String SND_SEQ_INSTR_ID_INTERWAVE = "InterWave FFFF"; public static final String SND_SEQ_INSTR_ID_OPL2_3 = "OPL2/3 FM"; public static final String SND_SEQ_INSTR_ID_OPL4 = "OPL4"; /* instrument types */ public static final int SND_SEQ_INSTR_TYPE0_DLS1 = (1<<0); /* MIDI DLS v1 */ public static final int SND_SEQ_INSTR_TYPE0_DLS2 = (1<<1); /* MIDI DLS v2 */ public static final int SND_SEQ_INSTR_TYPE1_SIMPLE = (1<<0); /* Simple Wave */ public static final int SND_SEQ_INSTR_TYPE1_SOUNDFONT = (1<<1); /* EMU SoundFont */ public static final int SND_SEQ_INSTR_TYPE1_GUS_PATCH = (1<<2); /* Gravis UltraSound Patch */ public static final int SND_SEQ_INSTR_TYPE1_INTERWAVE = (1<<3); /* InterWave FFFF */ public static final int SND_SEQ_INSTR_TYPE2_OPL2_3 = (1<<0); /* Yamaha OPL2/3 FM */ public static final int SND_SEQ_INSTR_TYPE2_OPL4 = (1<<1); /* Yamaha OPL4 */ /* put commands */ public static final int SND_SEQ_INSTR_PUT_CMD_CREATE = 0; public static final int SND_SEQ_INSTR_PUT_CMD_REPLACE = 1; public static final int SND_SEQ_INSTR_PUT_CMD_MODIFY = 2; public static final int SND_SEQ_INSTR_PUT_CMD_ADD = 3; public static final int SND_SEQ_INSTR_PUT_CMD_REMOVE = 4; /* get commands */ public static final int SND_SEQ_INSTR_GET_CMD_FULL = 0; public static final int SND_SEQ_INSTR_GET_CMD_PARTIAL = 1; /* query flags */ public static final int SND_SEQ_INSTR_QUERY_FOLLOW_ALIAS = (1<<0); /* free commands */ public static final int SND_SEQ_INSTR_FREE_CMD_ALL = 0; public static final int SND_SEQ_INSTR_FREE_CMD_PRIVATE = 1; public static final int SND_SEQ_INSTR_FREE_CMD_CLUSTER = 2; public static final int SND_SEQ_INSTR_FREE_CMD_SINGLE = 3; static { Alsa.loadNativeLibrary(); if (TDebug.TraceAlsaSeqNative) { setTrace(true); } } /* * This holds a pointer for the native code - do not touch! */ @SuppressWarnings("unused") private long m_lNativeHandle; public AlsaSeq() { super(); if (TDebug.TraceAlsaSeq) { TDebug.out("AlsaSeq.(): begin"); } int nSuccess = open(); if (nSuccess < 0) { throw new RuntimeException("open failed"); } if (TDebug.TraceAlsaSeq) { TDebug.out("AlsaSeq.(): end"); } } public AlsaSeq(String strClientName) { this(); if (TDebug.TraceAlsaSeq) { TDebug.out("AlsaSeq.(String): begin"); } setClientName(strClientName); if (TDebug.TraceAlsaSeq) { TDebug.out("AlsaSeq.(String): end"); } } /** Opens the sequencer. * This method is intended to be called by the constructor. * Calls snd_seq_open(). */ private native int open(); /** Closes the sequencer. * Calls snd_seq_close(). */ public native void close(); public native String getName(); public native int getType(); public native int setNonblock(boolean bNonblock); public native int getClientId(); public native int getOutputBufferSize(); public native int getInputBufferSize(); public native int setOutputBufferSize(int nSize); public native int setInputBufferSize(int nSize); public native int getSystemInfo(AlsaSeqSystemInfo systemInfo); public int getClientInfo(AlsaSeqClientInfo clientInfo) { return getClientInfo(-1, clientInfo); } public native int getClientInfo(int nClient, AlsaSeqClientInfo clientInfo); public native int setClientInfo(AlsaSeqClientInfo clientInfo); /** Gets information about the next client. * Calls snd_seq_query_next_client(). * and puts the returned values * into the passed arrays. * * nClient has to be -1 to start, or a client id returned by * a previous call to this method. * * anValues[0] client id * * Returns 0 if successful. */ public native int getNextClient(int nClient, int[] anValues); public void setClientName(String strName) { if (TDebug.TraceAlsaSeq) { TDebug.out("AlsaSeq.setClientName(): begin"); } AlsaSeqClientInfo clientInfo = new AlsaSeqClientInfo(); // TODO: error check getClientInfo(clientInfo); clientInfo.setName(strName); setClientInfo(clientInfo); if (TDebug.TraceAlsaSeq) { TDebug.out("AlsaSeq.setClientName(): end"); } } public int getPortInfo(int nPort, AlsaSeqPortInfo portInfo) { return getPortInfo(-1, nPort, portInfo); } public native int getPortInfo(int nClient, int nPort, AlsaSeqPortInfo portInfo); /** Gets the next port. * Calls snd_seq_query_next_port(). * and put the returned values * into the passed arrays. * * nClient has to be a valid client. * nPort has to be -1 to start, or a port returned by * a previous call to this method. * * anValues[0] client * anValues[1] port * * Returns 0 if successful. */ public native int getNextPort(int nClient, int nPort, int[] anValues); // TODO: use structure public native int createPort(String strName, int nCapabilities, int nGroupPermissions, int nType, int nMidiChannels, int nMidiVoices, int nSynthVoices); /** Allocates (reserves) a sequencing queue. Calls snd_seq_alloc_queue(). @return the queue number (>= 0), if successful. A negative value otherwise. */ public native int allocQueue(); /** Frees a sequencing queue. Calls snd_seq_free_queue(). @param nQueue a queue number that has previously been allocated with allocQueue(). @return 0 if successful. A negative value otherwise. */ public native int freeQueue(int nQueue); /** Get the queue usage flag. Calls snd_seq_get_queue_usage(). @param nQueue a queue number that has previously been allocated with allocQueue(). @return true if the client is allowed to access the queue. false otherwise. */ public native boolean getQueueUsage(int nQueue); /** Set the queue usage flag. Calls snd_seq_set_queue_usage(). @param nQueue a queue number that has previously been allocated with allocQueue(). @param bUsageAllowed true to allow the client access to this queue. false to deny it. @return 0 if successful. A negative value otherwise. */ public native int setQueueUsage(int nQueue, boolean bUsageAllowed); /** Get the queue information. This method fills a QueueInfo instance with information from the given queue. Internally, snd_seq_get_queue_info() is called. @return returns 0 on success, otherwise a negative value. */ public native int getQueueInfo(int nQueue, AlsaSeqQueueInfo queueInfo); /** Set the queue information. This method sets the information for the given queue from the QueueInfo instance. Internally, snd_seq_set_queue_info() is called. @return returns 0 on success, otherwise a negative value. */ public native int setQueueInfo(int nQueue, AlsaSeqQueueInfo queueInfo); /** Get the queue status. This method fills a QueueStatus instance with information from the given queue. Internally, snd_seq_get_queue_status() is called. @return returns 0 on success, otherwise a negative value. */ public native int getQueueStatus(int nQueue, AlsaSeqQueueStatus queueStatus); /** Get the queue tempo. This method fills a QueueTempo instance with information from the given queue. Internally, snd_seq_get_queue_tempo() is called. @return returns 0 on success, otherwise a negative value. */ public native int getQueueTempo(int nQueue, AlsaSeqQueueTempo queueTempo); /** Set the queue tempo. This method sets the information for the given queue from the QueueTempo instance. Internally, snd_seq_set_queue_tempo() is called. @return returns 0 on success, otherwise a negative value. */ public native int setQueueTempo(int nQueue, AlsaSeqQueueTempo queueTempo); /** Get the queue timer. This method fills a QueueTimer instance with information from the given queue. Internally, snd_seq_get_queue_timer() is called. @return returns 0 on success, otherwise a negative value. */ public native int getQueueTimer(int nQueue, AlsaSeqQueueTimer queueTimer); /** Set the queue timer. This method sets the timer for the given queue from the QueueTimer instance. Internally, snd_seq_set_queue_timer() is called. @return returns 0 on success, otherwise a negative value. */ public native int setQueueTimer(int nQueue, AlsaSeqQueueTimer queueTimer); public native int getPortSubscription(AlsaSeqPortSubscribe portSubscribe); public native int subscribePort(AlsaSeqPortSubscribe portSubscribe); public native int unsubscribePort(AlsaSeqPortSubscribe portSubscribe); private static native void setTrace(boolean bTrace); public Iterator getClientInfos() { return new ClientInfoIterator(); } public Iterator getPortInfos(int nClient) { return new PortInfoIterator(nClient); } //////////////////////////////////////////////////////////////// // // Events // //////////////////////////////////////////////////////////////// public native int eventOutput(AlsaSeqEvent event); public native int eventOutputBuffer(AlsaSeqEvent event); public native int eventOutputDirect(AlsaSeqEvent event); public native int eventInput(AlsaSeqEvent event); public native int eventInputPending(int nFetchSequencer); public native int drainOutput(); public native int eventOutputPending(); public native int extractOutput(AlsaSeqEvent event); public native int dropOutput(); public native int dropOutputBuffer(); public native int dropInput(); public native int dropInputBuffer(); /////////////////////////////////////////////////////////// // /** Event for the sequencer. // * This class encapsulates an instance of // * snd_seq_event_t. // */ // public static class Event // { // /** // * Holds the pointer to snd_seq_event_t // * for the native code. // * This must be long to be 64bit-clean. // */ // /*private*/ long m_lNativeHandle; // public Event() // { // if (TDebug.TraceAlsaSeqNative) { TDebug.out("AlsaSeq.Event.(): begin"); } // int nReturn = malloc(); // if (nReturn < 0) // { // throw new RuntimeException("malloc of event failed"); // } // if (TDebug.TraceAlsaSeqNative) { TDebug.out("AlsaSeq.Event.(): end"); } // } // public void finalize() // { // // TODO: call free() // // call super.finalize() first or last? // // and introduce a flag if free() has already been called? // } // /** Allocates memory for a snd_seq_event_t. // The native part of this method uses calloc() to // allocate the memory (so the allocated memory is // zero'ed). The memory reference is stored in {@link // #m_lNativeHandle m_lNativeHandle}. Memory allocated // with this call should be freed by calling {@link // #free() free()}. // */ // private native int malloc(); // /** Frees memory for a snd_seq_event_t. // */ // public native void free(); // // TODO: implement natively // public native int getLength(); // public native int getType(); // public native int getFlags(); // public native int getTag(); // public native int getQueue(); // public native long getTimestamp(); // public native int getSourceClient(); // public native int getSourcePort(); // public native int getDestClient(); // public native int getDestPort(); // /* Retrieves the parameters of a note event. // * This method is suitable for the following event types: // * SND_SEQ_EVENT_NOTE // * SND_SEQ_EVENT_NOTEON // * SND_SEQ_EVENT_NOTEOFF // * SND_SEQ_EVENT_KEYPRESS // * // * After return, the array will contain: // * anValues[0] channel // * anValues[1] note // * anValues[2] velocity // * anValues[3] off_velocity // * anValues[4] duration // */ // public native void getNote(int[] anValues); // /* Retrieves the parameters of a control event. // * This method is suitable for the following event types: // * SND_SEQ_EVENT_CONTROLLER // * SND_SEQ_EVENT_PGMCHANGE // * SND_SEQ_EVENT_CHANPRESS // * SND_SEQ_EVENT_PITCHBEND // * SND_SEQ_EVENT_CONTROL14 // * SND_SEQ_EVENT_NONREGPARAM // * SND_SEQ_EVENT_REGPARAM // * SND_SEQ_EVENT_SONGPOS // * SND_SEQ_EVENT_SONGSEL // * SND_SEQ_EVENT_QFRAME // * SND_SEQ_EVENT_TIMESIGN // * SND_SEQ_EVENT_KEYSIGN // * // * After return, the array will contain: // * anValues[0] channel // * anValues[1] param // * anValues[2] value // */ // public native void getControl(int[] anValues); // /* Retrieves the parameters of a queue control event. // * This method is suitable for the following event types: // * SND_SEQ_EVENT_START // * SND_SEQ_EVENT_CONTINUE // * SND_SEQ_EVENT_STOP // * SND_SEQ_EVENT_SETPOS_TICK // * SND_SEQ_EVENT_SETPOS_TIME // * SND_SEQ_EVENT_TEMPO // * SND_SEQ_EVENT_CLOCK // * SND_SEQ_EVENT_TICK // * SND_SEQ_EVENT_SYNC // * SND_SEQ_EVENT_SYNC_POS // * // * After return, the array will contain: // * anValues[0] queue // * anValues[1] value // * alValues[0] time // */ // public native void getQueueControl(int[] anValues, long[] alValues); // /* Retrieves the parameters of a variable-length event. // * This method is suitable for the following event types: // * SND_SEQ_EVENT_SYSEX // * SND_SEQ_EVENT_BOUNCE // * SND_SEQ_EVENT_USR_VAR0 // * SND_SEQ_EVENT_USR_VAR1 // * SND_SEQ_EVENT_USR_VAR2 // * SND_SEQ_EVENT_USR_VAR3 // * SND_SEQ_EVENT_USR_VAR4 // * // */ // public native byte[] getVar(); // public native void setCommon(int nType, int nFlags, int nTag, int nQueue, long lTimestamp, int nSourceClient, int nSourcePort, int nDestClient, int nDestPort); // public native void setTimestamp(long lTimestamp); // public native void setNote(int nChannel, int nKey, int nVelocity, int nOffVelocity, int nDuration); // public native void setControl(int nChannel, int nParam, int nValue); // public native void setQueueControl(int nControlQueue, int nControlValue, long lControlTime); // public native void setVar(byte[] abData, int nOffset, int nLength); // } // /** General information about the sequencer. // * This class encapsulates the information of // * snd_seq_system_info_t. // */ // public static class SystemInfo // { // /** // * Holds the pointer to snd_seq_system_info_t // * for the native code. // * This must be long to be 64bit-clean. // */ // /*private*/ long m_lNativeHandle; // public SystemInfo() // { // if (TDebug.TraceAlsaSeqNative) { TDebug.out("AlsaSeq.SystemInfo.(): begin"); } // int nReturn = malloc(); // if (nReturn < 0) // { // throw new RuntimeException("malloc of system_info failed"); // } // if (TDebug.TraceAlsaSeqNative) { TDebug.out("AlsaSeq.SystemInfo.(): end"); } // } // public void finalize() // { // // TODO: call free() // // call super.finalize() first or last? // // and introduce a flag if free() has already been called? // } // private native int malloc(); // public native void free(); // public native int getQueues(); // public native int getClients(); // public native int getPorts(); // public native int getChannels(); // public native int getCurrentClients(); // public native int getCurrentQueues(); // } // public static class ClientInfo // { // /** // * Holds the pointer to snd_seq_port_info_t // * for the native code. // * This must be long to be 64bit-clean. // */ // /*private*/ long m_lNativeHandle; // public ClientInfo() // { // if (TDebug.TraceAlsaSeqNative) { TDebug.out("AlsaSeq.ClientInfo.(): begin"); } // int nReturn = malloc(); // if (TDebug.TraceAlsaSeqNative) { TDebug.out("AlsaSeq.ClientInfo.(): malloc() returns: " + nReturn); } // if (nReturn < 0) // { // throw new RuntimeException("malloc of client_info failed"); // } // if (TDebug.TraceAlsaSeqNative) { TDebug.out("AlsaSeq.ClientInfo.(): end"); } // } // public void finalize() // { // // TODO: call free() // // call super.finalize() first or last? // // and introduce a flag if free() has already been called? // } // private native int malloc(); // public native void free(); // public native int getClient(); // public native int getType(); // public native String getName(); // public native int getBroadcastFilter(); // public native int getErrorBounce(); // // TODO: event filter // public native int getNumPorts(); // public native int getEventLost(); // public native void setClient(int nClient); // public native void setName(String strName); // public native void setBroadcastFilter(int nBroadcastFilter); // public native void setErrorBounce(int nErrorBounce); // // TODO: event filter // } // public static class PortInfo // { // /** // * Holds the pointer to snd_seq_port_info_t // * for the native code. // * This must be long to be 64bit-clean. // */ // /*private*/ long m_lNativeHandle; // public PortInfo() // { // if (TDebug.TraceAlsaSeqNative) { TDebug.out("AlsaSeq.PortInfo.(): begin"); } // int nReturn = malloc(); // if (nReturn < 0) // { // throw new RuntimeException("malloc of port_info failed"); // } // if (TDebug.TraceAlsaSeqNative) { TDebug.out("AlsaSeq.PortInfo.(): end"); } // } // public void finalize() // { // // TODO: call free() // // call super.finalize() first or last? // // and introduce a flag if free() has already been called? // } // private native int malloc(); // public native void free(); // public native int getClient(); // public native int getPort(); // /** Returns the name of the port. // Calls snd_seq_port_info_get_name(). // */ // public native String getName(); // public native int getCapability(); // public native int getType(); // public native int getMidiChannels(); // public native int getMidiVoices(); // public native int getSynthVoices(); // public native int getReadUse(); // public native int getWriteUse(); // public native int getPortSpecified(); // } // public static class PortSubscribe // { // /** // * Holds the pointer to snd_seq_port_info_t // * for the native code. // * This must be long to be 64bit-clean. // */ // /*private*/ long m_lNativeHandle; // public PortSubscribe() // { // if (TDebug.TraceAlsaSeqNative) { TDebug.out("AlsaSeq.PortSubscribe.(): begin"); } // int nReturn = malloc(); // if (nReturn < 0) // { // throw new RuntimeException("malloc of port_info failed"); // } // if (TDebug.TraceAlsaSeqNative) { TDebug.out("AlsaSeq.PortSubscribe.(): end"); } // } // public void finalize() // { // // TODO: call free() // // call super.finalize() first or last? // // and introduce a flag if free() has already been called? // } // private native int malloc(); // public native void free(); // public native int getSenderClient(); // public native int getSenderPort(); // public native int getDestClient(); // public native int getDestPort(); // public native int getQueue(); // public native boolean getExclusive(); // public native boolean getTimeUpdate(); // public native boolean getTimeReal(); // public native void setSender(int nClient, int nPort); // public native void setDest(int nClient, int nPort); // public native void setQueue(int nQueue); // public native void setExclusive(boolean bExclusive); // public native void setTimeUpdate(boolean bUpdate); // public native void setTimeReal(boolean bReal); // } // public static class QueueInfo // { // /** // * Holds the pointer to snd_seq_queue_info_t // * for the native code. // * This must be long to be 64bit-clean. // */ // /*private*/ long m_lNativeHandle; // public QueueInfo() // { // if (TDebug.TraceAlsaSeqNative) { TDebug.out("AlsaSeq.QueueInfo.(): begin"); } // int nReturn = malloc(); // if (nReturn < 0) // { // throw new RuntimeException("malloc of port_info failed"); // } // if (TDebug.TraceAlsaSeqNative) { TDebug.out("AlsaSeq.QueueInfo.(): end"); } // } // public void finalize() // { // // TODO: call free() // // call super.finalize() first or last? // // and introduce a flag if free() has already been called? // } // private native int malloc(); // public native void free(); // public native int getQueue(); // public native String getName(); // public native int getOwner(); // public native boolean getLocked(); // public native int getFlags(); // public native void setName(String strName); // public native void setOwner(int nOwner); // public native void setLocked(boolean bLocked); // public native void setFlags(int nFlags); // } // public static class QueueStatus // { // /** // * Holds the pointer to snd_seq_queue_status_t // * for the native code. // * This must be long to be 64bit-clean. // */ // /*private*/ long m_lNativeHandle; // public QueueStatus() // { // if (TDebug.TraceAlsaSeqNative) { TDebug.out("AlsaSeq.QueueStatus.(): begin"); } // int nReturn = malloc(); // if (nReturn < 0) // { // throw new RuntimeException("malloc of port_info failed"); // } // if (TDebug.TraceAlsaSeqNative) { TDebug.out("AlsaSeq.QueueStatus.(): end"); } // } // public void finalize() // { // // TODO: call free() // // call super.finalize() first or last? // // and introduce a flag if free() has already been called? // } // private native int malloc(); // public native void free(); // public native int getQueue(); // public native int getEvents(); // public native long getTickTime(); // public native long getRealTime(); // public native int getStatus(); // } // public static class QueueTempo // { // /** // * Holds the pointer to snd_seq_queue_tempo_t // * for the native code. // * This must be long to be 64bit-clean. // */ // /*private*/ long m_lNativeHandle; // public QueueTempo() // { // if (TDebug.TraceAlsaSeqNative) { TDebug.out("AlsaSeq.QueueTempo.(): begin"); } // int nReturn = malloc(); // if (nReturn < 0) // { // throw new RuntimeException("malloc of port_info failed"); // } // if (TDebug.TraceAlsaSeqNative) { TDebug.out("AlsaSeq.QueueTempo.(): end"); } // } // public void finalize() // { // // TODO: call free() // // call super.finalize() first or last? // // and introduce a flag if free() has already been called? // } // private native int malloc(); // public native void free(); // public native int getQueue(); // public native int getTempo(); // public native int getPpq(); // public native void setTempo(int nTempo); // public native void setPpq(int nPpq); // } // public static class QueueTimer // { // /** // * Holds the pointer to snd_seq_queue_timer_t // * for the native code. // * This must be long to be 64bit-clean. // */ // /*private*/ long m_lNativeHandle; // public QueueTimer() // { // if (TDebug.TraceAlsaSeqNative) { TDebug.out("AlsaSeq.QueueTimer.(): begin"); } // int nReturn = malloc(); // if (nReturn < 0) // { // throw new RuntimeException("malloc of port_info failed"); // } // if (TDebug.TraceAlsaSeqNative) { TDebug.out("AlsaSeq.QueueTimer.(): end"); } // } // public void finalize() // { // // TODO: call free() // // call super.finalize() first or last? // // and introduce a flag if free() has already been called? // } // private native int malloc(); // public native void free(); // public native int getQueue(); // public native int getType(); // // TODO: // // public native ?? getTimerId(); // public native int getResolution(); // public native void setType(int nType); // // TODO: // // public native void setId(???); // public native void setResolution(int nResolution); // } // public static class RemoveEvents // { // /** // * Holds the pointer to snd_seq_queue_timer_t // * for the native code. // * This must be long to be 64bit-clean. // */ // /*private*/ long m_lNativeHandle; // public RemoveEvents() // { // if (TDebug.TraceAlsaSeqNative) { TDebug.out("AlsaSeq.RemoveEvents.(): begin"); } // int nReturn = malloc(); // if (nReturn < 0) // { // throw new RuntimeException("malloc of port_info failed"); // } // if (TDebug.TraceAlsaSeqNative) { TDebug.out("AlsaSeq.RemoveEvents.(): end"); } // } // public void finalize() // { // // TODO: call free() // // call super.finalize() first or last? // // and introduce a flag if free() has already been called? // } // private native int malloc(); // public native void free(); // public native int getCondition(); // public native int getQueue(); // public native long getTime(); // public native int getDestClient(); // public native int getDestPort(); // public native int getChannel(); // public native int getEventType(); // public native int getTag(); // public native void setCondition(int nCondition); // public native void setQueue(int nQueue); // public native void setTime(long lTime); // public native void setDest(int nClient, int nPort); // public native void setChannel(int nChannel); // public native void setEventType(int nEventType); // public native void setTag(int nTag); // } private class ClientInfoIterator implements Iterator { private int m_nClient; private AlsaSeqClientInfo m_clientInfo; public ClientInfoIterator() { m_nClient = -1; m_clientInfo = createNextClientInfo(); } public boolean hasNext() { // TDebug.out("hasNext(): clientInfo: " + m_clientInfo); return m_clientInfo != null; } public Object next() { Object next = m_clientInfo; m_clientInfo = createNextClientInfo(); return next; } public void remove() { throw new UnsupportedOperationException(); } private AlsaSeqClientInfo createNextClientInfo() { if (TDebug.TraceAlsaSeq) { TDebug.out("AlsaSeq.createNextClientInfo(): begin"); } AlsaSeqClientInfo clientInfo = null; int[] anValues = new int[1]; int nSuccess = getNextClient(m_nClient, anValues); if (TDebug.TraceAlsaSeq) { TDebug.out("succ: " + nSuccess); } if (nSuccess == 0) { // TDebug.out("AlsaSeq.createNextClientInfo(): getNextClientInfo successful"); m_nClient = anValues[0]; clientInfo = new AlsaSeqClientInfo(); // TODO: error check getClientInfo(m_nClient, clientInfo); } if (TDebug.TraceAlsaSeq) { TDebug.out("AlsaSeq.createNextClientInfo(): end"); } return clientInfo; } } private class PortInfoIterator implements Iterator { private int m_nClient; private int m_nPort; private AlsaSeqPortInfo m_portInfo; public PortInfoIterator(int nClient) { if (TDebug.TraceAlsaSeq) { TDebug.out("AlsaSeq.PortInfoIterator.(): begin"); } m_nClient = nClient; m_nPort = -1; m_portInfo = createNextPortInfo(); if (TDebug.TraceAlsaSeq) { TDebug.out("AlsaSeq.PortInfoIterator.(): end"); } } public boolean hasNext() { return m_portInfo != null; } public Object next() { Object next = m_portInfo; m_portInfo = createNextPortInfo(); return next; } public void remove() { throw new UnsupportedOperationException(); } private AlsaSeqPortInfo createNextPortInfo() { if (TDebug.TraceAlsaSeq) { TDebug.out("AlsaSeq.PortInfoIterator.createNextPortInfo(): begin"); } AlsaSeqPortInfo portInfo = null; int[] anValues = new int[2]; int nSuccess = getNextPort(m_nClient, m_nPort, anValues); if (TDebug.TraceAlsaSeq) { TDebug.out("AlsaSeq.PortInfoIterator.createNextPortInfo(): getNextPort() returns: " + nSuccess); } if (nSuccess == 0) { m_nPort = anValues[1]; portInfo = new AlsaSeqPortInfo(); // TODO: error check getPortInfo(m_nClient, m_nPort, portInfo); } if (TDebug.TraceAlsaSeq) { TDebug.out("AlsaSeq.PortInfoIterator.createNextPortInfo(): end"); } return portInfo; } } } /*** AlsaSeq.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/lowlevel/alsa/AlsaSeqClientInfo.java0000644000175000017500000000507110172434622031043 0ustar twernertwerner/* * AlsaSeqClientInfo.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999 - 2001 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.lowlevel.alsa; import org.tritonus.share.TDebug; public class AlsaSeqClientInfo { static { Alsa.loadNativeLibrary(); if (TDebug.TraceAlsaSeqNative) { setTrace(true); } } /** * Holds the pointer to snd_seq_port_info_t * for the native code. * This must be long to be 64bit-clean. */ /*private*/ long m_lNativeHandle; public AlsaSeqClientInfo() { if (TDebug.TraceAlsaSeqNative) { TDebug.out("AlsaSeq.ClientInfo.(): begin"); } int nReturn = malloc(); if (TDebug.TraceAlsaSeqNative) { TDebug.out("AlsaSeq.ClientInfo.(): malloc() returns: " + nReturn); } if (nReturn < 0) { throw new RuntimeException("malloc of client_info failed"); } if (TDebug.TraceAlsaSeqNative) { TDebug.out("AlsaSeq.ClientInfo.(): end"); } } public void finalize() { // TODO: call free() // call super.finalize() first or last? // and introduce a flag if free() has already been called? } private native int malloc(); public native void free(); public native int getClient(); public native int getType(); public native String getName(); public native int getBroadcastFilter(); public native int getErrorBounce(); // TODO: event filter public native int getNumPorts(); public native int getEventLost(); public native void setClient(int nClient); public native void setName(String strName); public native void setBroadcastFilter(int nBroadcastFilter); public native void setErrorBounce(int nErrorBounce); private static native void setTrace(boolean bTrace); // TODO: event filter } /*** AlsaSeqClientInfo.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/lowlevel/alsa/AlsaSeqEvent.java0000644000175000017500000001223610172434622030073 0ustar twernertwerner/* * AlsaSeqEvent.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999 - 2001 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.lowlevel.alsa; import org.tritonus.share.TDebug; /** Event for the sequencer. * This class encapsulates an instance of * snd_seq_event_t. */ public class AlsaSeqEvent { static { Alsa.loadNativeLibrary(); if (TDebug.TraceAlsaSeqNative) { setTrace(true); } } /** * Holds the pointer to snd_seq_event_t * for the native code. * This must be long to be 64bit-clean. */ /*private*/ long m_lNativeHandle; public AlsaSeqEvent() { if (TDebug.TraceAlsaSeqNative) { TDebug.out("AlsaSeq.Event.(): begin"); } int nReturn = malloc(); if (nReturn < 0) { throw new RuntimeException("malloc of event failed"); } if (TDebug.TraceAlsaSeqNative) { TDebug.out("AlsaSeq.Event.(): end"); } } public void finalize() { // TODO: call free() // call super.finalize() first or last? // and introduce a flag if free() has already been called? } /** Allocates memory for a snd_seq_event_t. The native part of this method uses calloc() to allocate the memory (so the allocated memory is zero'ed). The memory reference is stored in {@link #m_lNativeHandle m_lNativeHandle}. Memory allocated with this call should be freed by calling {@link #free() free()}. */ private native int malloc(); /** Frees memory for a snd_seq_event_t. */ public native void free(); // TODO: implement natively public native int getLength(); public native int getType(); public native int getFlags(); public native int getTag(); public native int getQueue(); public native long getTimestamp(); public native int getSourceClient(); public native int getSourcePort(); public native int getDestClient(); public native int getDestPort(); /* Retrieves the parameters of a note event. * This method is suitable for the following event types: * SND_SEQ_EVENT_NOTE * SND_SEQ_EVENT_NOTEON * SND_SEQ_EVENT_NOTEOFF * SND_SEQ_EVENT_KEYPRESS * * After return, the array will contain: * anValues[0] channel * anValues[1] note * anValues[2] velocity * anValues[3] off_velocity * anValues[4] duration */ public native void getNote(int[] anValues); /* Retrieves the parameters of a control event. * This method is suitable for the following event types: * SND_SEQ_EVENT_CONTROLLER * SND_SEQ_EVENT_PGMCHANGE * SND_SEQ_EVENT_CHANPRESS * SND_SEQ_EVENT_PITCHBEND * SND_SEQ_EVENT_CONTROL14 * SND_SEQ_EVENT_NONREGPARAM * SND_SEQ_EVENT_REGPARAM * SND_SEQ_EVENT_SONGPOS * SND_SEQ_EVENT_SONGSEL * SND_SEQ_EVENT_QFRAME * SND_SEQ_EVENT_TIMESIGN * SND_SEQ_EVENT_KEYSIGN * * After return, the array will contain: * anValues[0] channel * anValues[1] param * anValues[2] value */ public native void getControl(int[] anValues); /* Retrieves the parameters of a queue control event. * This method is suitable for the following event types: * SND_SEQ_EVENT_START * SND_SEQ_EVENT_CONTINUE * SND_SEQ_EVENT_STOP * SND_SEQ_EVENT_SETPOS_TICK * SND_SEQ_EVENT_SETPOS_TIME * SND_SEQ_EVENT_TEMPO * SND_SEQ_EVENT_CLOCK * SND_SEQ_EVENT_TICK * SND_SEQ_EVENT_SYNC * SND_SEQ_EVENT_SYNC_POS * * After return, the array will contain: * anValues[0] queue * anValues[1] value * alValues[0] time */ public native void getQueueControl(int[] anValues, long[] alValues); /* Retrieves the parameters of a variable-length event. * This method is suitable for the following event types: * SND_SEQ_EVENT_SYSEX * SND_SEQ_EVENT_BOUNCE * SND_SEQ_EVENT_USR_VAR0 * SND_SEQ_EVENT_USR_VAR1 * SND_SEQ_EVENT_USR_VAR2 * SND_SEQ_EVENT_USR_VAR3 * SND_SEQ_EVENT_USR_VAR4 * */ public native byte[] getVar(); public native void setCommon(int nType, int nFlags, int nTag, int nQueue, long lTimestamp, int nSourceClient, int nSourcePort, int nDestClient, int nDestPort); public native void setTimestamp(long lTimestamp); public native void setNote(int nChannel, int nKey, int nVelocity, int nOffVelocity, int nDuration); public native void setControl(int nChannel, int nParam, int nValue); public native void setQueueControl(int nControlQueue, int nControlValue, long lControlTime); public native void setVar(byte[] abData, int nOffset, int nLength); private static native void setTrace(boolean bTrace); } /*** AlsaSeqEvent.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/lowlevel/alsa/AlsaSeqPortInfo.java0000644000175000017500000000465110172434622030554 0ustar twernertwerner/* * AlsaSeqPortInfo.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999 - 2001 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.lowlevel.alsa; import org.tritonus.share.TDebug; public class AlsaSeqPortInfo { static { Alsa.loadNativeLibrary(); if (TDebug.TraceAlsaSeqNative) { setTrace(true); } } /** * Holds the pointer to snd_seq_port_info_t * for the native code. * This must be long to be 64bit-clean. */ /*private*/ long m_lNativeHandle; public AlsaSeqPortInfo() { if (TDebug.TraceAlsaSeqNative) { TDebug.out("AlsaSeq.PortInfo.(): begin"); } int nReturn = malloc(); if (nReturn < 0) { throw new RuntimeException("malloc of port_info failed"); } if (TDebug.TraceAlsaSeqNative) { TDebug.out("AlsaSeq.PortInfo.(): end"); } } public void finalize() { // TODO: call free() // call super.finalize() first or last? // and introduce a flag if free() has already been called? } private native int malloc(); public native void free(); public native int getClient(); public native int getPort(); /** Returns the name of the port. Calls snd_seq_port_info_get_name(). */ public native String getName(); public native int getCapability(); public native int getType(); public native int getMidiChannels(); public native int getMidiVoices(); public native int getSynthVoices(); public native int getReadUse(); public native int getWriteUse(); public native int getPortSpecified(); private static native void setTrace(boolean bTrace); } /*** AlsaSeqPortInfo.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/lowlevel/alsa/AlsaSeqPortSubscribe.java0000644000175000017500000000507410172434622031602 0ustar twernertwerner/* * AlsaSeqPortSubscribe.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999 - 2001 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.lowlevel.alsa; import org.tritonus.share.TDebug; public class AlsaSeqPortSubscribe { static { Alsa.loadNativeLibrary(); if (TDebug.TraceAlsaSeqNative) { setTrace(true); } } /** * Holds the pointer to snd_seq_port_info_t * for the native code. * This must be long to be 64bit-clean. */ /*private*/ long m_lNativeHandle; public AlsaSeqPortSubscribe() { if (TDebug.TraceAlsaSeqNative) { TDebug.out("AlsaSeq.PortSubscribe.(): begin"); } int nReturn = malloc(); if (nReturn < 0) { throw new RuntimeException("malloc of port_info failed"); } if (TDebug.TraceAlsaSeqNative) { TDebug.out("AlsaSeq.PortSubscribe.(): end"); } } public void finalize() { // TODO: call free() // call super.finalize() first or last? // and introduce a flag if free() has already been called? } private native int malloc(); public native void free(); public native int getSenderClient(); public native int getSenderPort(); public native int getDestClient(); public native int getDestPort(); public native int getQueue(); public native boolean getExclusive(); public native boolean getTimeUpdate(); public native boolean getTimeReal(); public native void setSender(int nClient, int nPort); public native void setDest(int nClient, int nPort); public native void setQueue(int nQueue); public native void setExclusive(boolean bExclusive); public native void setTimeUpdate(boolean bUpdate); public native void setTimeReal(boolean bReal); private static native void setTrace(boolean bTrace); } /*** AlsaSeqPortSubscribe.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/lowlevel/alsa/AlsaSeqQueueInfo.java0000644000175000017500000000443710172434622030716 0ustar twernertwerner/* * AlsaSeqQueueInfo.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999 - 2001 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.lowlevel.alsa; import org.tritonus.share.TDebug; public class AlsaSeqQueueInfo { static { Alsa.loadNativeLibrary(); if (TDebug.TraceAlsaSeqNative) { setTrace(true); } } /** * Holds the pointer to snd_seq_queue_info_t * for the native code. * This must be long to be 64bit-clean. */ /*private*/ long m_lNativeHandle; public AlsaSeqQueueInfo() { if (TDebug.TraceAlsaSeqNative) { TDebug.out("AlsaSeq.QueueInfo.(): begin"); } int nReturn = malloc(); if (nReturn < 0) { throw new RuntimeException("malloc of port_info failed"); } if (TDebug.TraceAlsaSeqNative) { TDebug.out("AlsaSeq.QueueInfo.(): end"); } } public void finalize() { // TODO: call free() // call super.finalize() first or last? // and introduce a flag if free() has already been called? } private native int malloc(); public native void free(); public native int getQueue(); public native String getName(); public native int getOwner(); public native boolean getLocked(); public native int getFlags(); public native void setName(String strName); public native void setOwner(int nOwner); public native void setLocked(boolean bLocked); public native void setFlags(int nFlags); private static native void setTrace(boolean bTrace); } /*** AlsaSeqQueueInfo.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/lowlevel/alsa/AlsaSeqQueueStatus.java0000644000175000017500000000417410172434622031304 0ustar twernertwerner/* * AlsaSeqQueueStatus.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999 - 2001 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.lowlevel.alsa; import org.tritonus.share.TDebug; public class AlsaSeqQueueStatus { static { Alsa.loadNativeLibrary(); if (TDebug.TraceAlsaSeqNative) { setTrace(true); } } /** * Holds the pointer to snd_seq_queue_status_t * for the native code. * This must be long to be 64bit-clean. */ /*private*/ long m_lNativeHandle; public AlsaSeqQueueStatus() { if (TDebug.TraceAlsaSeqNative) { TDebug.out("AlsaSeq.QueueStatus.(): begin"); } int nReturn = malloc(); if (nReturn < 0) { throw new RuntimeException("malloc of port_info failed"); } if (TDebug.TraceAlsaSeqNative) { TDebug.out("AlsaSeq.QueueStatus.(): end"); } } public void finalize() { // TODO: call free() // call super.finalize() first or last? // and introduce a flag if free() has already been called? } private native int malloc(); public native void free(); public native int getQueue(); public native int getEvents(); public native long getTickTime(); public native long getRealTime(); public native int getStatus(); private static native void setTrace(boolean bTrace); } /*** AlsaSeqQueueStatus.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/lowlevel/alsa/AlsaSeqQueueTempo.java0000644000175000017500000000417410172434622031105 0ustar twernertwerner/* * AlsaSeqQueueTempo.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999 - 2001 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.lowlevel.alsa; import org.tritonus.share.TDebug; public class AlsaSeqQueueTempo { static { Alsa.loadNativeLibrary(); if (TDebug.TraceAlsaSeqNative) { setTrace(true); } } /** * Holds the pointer to snd_seq_queue_tempo_t * for the native code. * This must be long to be 64bit-clean. */ /*private*/ long m_lNativeHandle; public AlsaSeqQueueTempo() { if (TDebug.TraceAlsaSeqNative) { TDebug.out("AlsaSeq.QueueTempo.(): begin"); } int nReturn = malloc(); if (nReturn < 0) { throw new RuntimeException("malloc of port_info failed"); } if (TDebug.TraceAlsaSeqNative) { TDebug.out("AlsaSeq.QueueTempo.(): end"); } } public void finalize() { // TODO: call free() // call super.finalize() first or last? // and introduce a flag if free() has already been called? } private native int malloc(); public native void free(); public native int getQueue(); public native int getTempo(); public native int getPpq(); public native void setTempo(int nTempo); public native void setPpq(int nPpq); private static native void setTrace(boolean bTrace); } /*** AlsaSeqQueueTempo.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/lowlevel/alsa/AlsaSeqQueueTimer.java0000644000175000017500000000435210172434622031077 0ustar twernertwerner/* * AlsaSeqQueueTimer.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999 - 2001 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.lowlevel.alsa; import org.tritonus.share.TDebug; public class AlsaSeqQueueTimer { static { Alsa.loadNativeLibrary(); if (TDebug.TraceAlsaSeqNative) { setTrace(true); } } /** * Holds the pointer to snd_seq_queue_timer_t * for the native code. * This must be long to be 64bit-clean. */ /*private*/ long m_lNativeHandle; public AlsaSeqQueueTimer() { if (TDebug.TraceAlsaSeqNative) { TDebug.out("AlsaSeq.QueueTimer.(): begin"); } int nReturn = malloc(); if (nReturn < 0) { throw new RuntimeException("malloc of port_info failed"); } if (TDebug.TraceAlsaSeqNative) { TDebug.out("AlsaSeq.QueueTimer.(): end"); } } public void finalize() { // TODO: call free() // call super.finalize() first or last? // and introduce a flag if free() has already been called? } private native int malloc(); public native void free(); public native int getQueue(); public native int getType(); // TODO: // public native ?? getTimerId(); public native int getResolution(); public native void setType(int nType); // TODO: // public native void setId(???); public native void setResolution(int nResolution); private static native void setTrace(boolean bTrace); } /*** AlsaSeqQueueTimer.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/lowlevel/alsa/AlsaSeqRemoveEvents.java0000644000175000017500000000523210172434622031432 0ustar twernertwerner/* * AlsaSeqRemoveEvents.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999 - 2002 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.lowlevel.alsa; import org.tritonus.share.TDebug; /** TODO: */ public class AlsaSeqRemoveEvents { static { Alsa.loadNativeLibrary(); if (TDebug.TraceAlsaSeqNative) { setTrace(true); } } /** * Holds the pointer to snd_seq_queue_timer_t * for the native code. * This must be long to be 64bit-clean. */ /*private*/ long m_lNativeHandle; static { Alsa.loadNativeLibrary(); if (TDebug.TraceAlsaSeqNative) { setTrace(true); } } public AlsaSeqRemoveEvents() { if (TDebug.TraceAlsaSeqNative) { TDebug.out("AlsaSeqRemoveEvents.(): begin"); } int nReturn = malloc(); if (nReturn < 0) { throw new RuntimeException("malloc of port_info failed"); } if (TDebug.TraceAlsaSeqNative) { TDebug.out("AlsaSeqRemoveEvents.(): end"); } } public void finalize() { // TODO: call free() // call super.finalize() first or last? // and introduce a flag if free() has already been called? } private native int malloc(); public native void free(); public native int getCondition(); public native int getQueue(); public native long getTime(); public native int getDestClient(); public native int getDestPort(); public native int getChannel(); public native int getEventType(); public native int getTag(); public native void setCondition(int nCondition); public native void setQueue(int nQueue); public native void setTime(long lTime); public native void setDest(int nClient, int nPort); public native void setChannel(int nChannel); public native void setEventType(int nEventType); public native void setTag(int nTag); private static native void setTrace(boolean bTrace); } /*** AlsaSeqRemoveEvents.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/lowlevel/alsa/AlsaSeqSystemInfo.java0000644000175000017500000000445610172434622031117 0ustar twernertwerner/* * AlsaSeqSystemInfo.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999 - 2001 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.lowlevel.alsa; import org.tritonus.share.TDebug; /** General information about the sequencer. * This class encapsulates the information of * snd_seq_system_info_t. */ public class AlsaSeqSystemInfo { static { Alsa.loadNativeLibrary(); if (TDebug.TraceAlsaSeqNative) { setTrace(true); } } /** * Holds the pointer to snd_seq_system_info_t * for the native code. * This must be long to be 64bit-clean. */ /*private*/ long m_lNativeHandle; public AlsaSeqSystemInfo() { if (TDebug.TraceAlsaSeqNative) { TDebug.out("AlsaSeq.SystemInfo.(): begin"); } int nReturn = malloc(); if (nReturn < 0) { throw new RuntimeException("malloc of system_info failed"); } if (TDebug.TraceAlsaSeqNative) { TDebug.out("AlsaSeq.SystemInfo.(): end"); } } public void finalize() { // TODO: call free() // call super.finalize() first or last? // and introduce a flag if free() has already been called? } private native int malloc(); public native void free(); public native int getQueues(); public native int getClients(); public native int getPorts(); public native int getChannels(); public native int getCurrentClients(); public native int getCurrentQueues(); private static native void setTrace(boolean bTrace); } /*** AlsaSeqSystemInfo.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/lowlevel/alsa/package.html0000644000175000017500000000061410172434622027153 0ustar twernertwerner

Access to native ALSA library. The classes here provide an interface to the ALSA library layer.

Related Documentation

ALSA home page

@see org.tritonus.midi.device.alsa @see org.tritonus.sampled.mixer.alsa libtritonus-java-20070428/src/classes/org/tritonus/lowlevel/cdda/0000755000175000017500000000000010621572420024642 5ustar twernertwernerlibtritonus-java-20070428/src/classes/org/tritonus/lowlevel/cdda/cdparanoia/0000755000175000017500000000000010621572415026747 5ustar twernertwernerlibtritonus-java-20070428/src/classes/org/tritonus/lowlevel/cdda/cdparanoia/Cdparanoia.java0000644000175000017500000000744310374160730031661 0ustar twernertwerner/* * Cdparanoia.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2001 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.lowlevel.cdda.cdparanoia; import org.tritonus.share.TDebug; /** Reading audio CDs using libcdparanoia. */ public class Cdparanoia { static { if (TDebug.TraceCdda) { TDebug.out("Cdparanoia.(): loading native library tritonuscdparanoia"); } System.loadLibrary("tritonuscdparanoia"); if (TDebug.TraceCdda) { TDebug.out("Cdparanoia.(): loaded"); } setTrace(TDebug.TraceCddaNative); if (Boolean.getBoolean("tritonus.DisableParanoia")) { setParanoiaMode(false); } } /* * This holds a pointer for the native code - * do not touch! */ @SuppressWarnings("unused") private long m_lNativeHandle; public Cdparanoia(String strDevice) { if (TDebug.TraceCdda) { TDebug.out("Cdparanoia.: begin"); } int nResult = open(strDevice); if (nResult < 0) { throw new RuntimeException("cannot open device '" + strDevice + "'"); } if (TDebug.TraceCdda) { TDebug.out("Cdparanoia.: end"); } } /** Searches the device. Calls cdda_identify(). @return 0 on success, negative values on error. */ private native int find(String strDevice); /** Opens and initializes the device. Calls cdda_open(), paranoia_init() and paranoia_modeset(). @return 0 on success, negative values on error. */ private native int open(String strDevice); /** Closes the device. * Calls cdda_close(). */ public native void close(); /* Read the table of contents. anValues[0] first track anValues[1] last track anStartTrack[x] start sector of the track x. anType[x] type of track x. */ public native int readTOC(int[] anValues, int[] anStartFrame, int[] anLength, int[] anType, boolean[] abAudio, boolean[] abCopy, boolean[] abPre, int[] anChannels); public native int prepareTrack(int nTrack); /** Reads one or more raw frames from the CD. This call reads nCount frames from the track that has been set by prepareTrack(). abData has to be big enough to hold the amount of data requested (2352 * nCount bytes). */ public native int readNextFrame(int nCount, byte[] abData); private static native void setTrace(boolean bTrace); /** Set the paranoia level. This setting influences the value that is used in the call 'paranoia_modeset(cdrom_paranoia*, int [mode])'. If set to true a hard-coded default value will be used. (Currently 'PARANOIA_MODE_FULL ^ PARANOIA_MODE_NEVERSKIP', but for definitive answers, look it up in src/lib/cdparanoia/org_tritonus_lowlevel_cdda_cdparanoia_Cdparanoia.c). If set to false, 'PARANOIA_MODE_DISABLE' will be used. Note that currently, changing this value only has an effect prior to opening the device. */ private static native void setParanoiaMode(boolean bPoranoiaMode); } /*** Cdparanoia.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/lowlevel/cdda/cdparanoia/CdparanoiaMidLevel.java0000644000175000017500000002127310374160730033300 0ustar twernertwerner/* * CdparanoiaMidLevel.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2001 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.lowlevel.cdda.cdparanoia; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.InputStream; import java.io.IOException; import java.io.PrintStream; import java.util.Arrays; import java.util.Iterator; import java.util.List; import javax.sound.sampled.AudioFormat; import javax.sound.sampled.AudioInputStream; import javax.sound.sampled.AudioSystem; import org.tritonus.share.TDebug; import org.tritonus.lowlevel.cdda.CddaMidLevel; import org.tritonus.share.sampled.convert.TAsynchronousFilteredAudioInputStream; public class CdparanoiaMidLevel implements CddaMidLevel { private static int PCM_FRAMES_PER_CDDA_FRAME = 588; private static AudioFormat CDDA_FORMAT = new AudioFormat( AudioFormat.Encoding.PCM_SIGNED, 44100.0F, 16, 2, 4, 44100.0F, false); public CdparanoiaMidLevel() { if (TDebug.TraceCdda) { TDebug.out("CdparanoiaMidLevel.(): begin"); } if (TDebug.TraceCdda) { TDebug.out("CdparanoiaMidLevel.(): end"); } } public Iterator getDevices() { if (TDebug.TraceCdda) { TDebug.out("CdparanoiaMidLevel.getDevices(): begin"); } // TODO: hack!! should be replaced by a real search String[] astrDevices = {"/dev/cdrom"}; // TODO: should make list immutable List devicesList = Arrays.asList(astrDevices); Iterator iterator = devicesList.iterator(); if (TDebug.TraceCdda) { TDebug.out("CdparanoiaMidLevel.getDevices(): end"); } return iterator; } public String getDefaultDevice() { return "/dev/cdrom"; } public InputStream getTocAsXml(String strDevice) throws IOException { if (TDebug.TraceCdda) { TDebug.out("CdparanoiaMidLevel.getTocAsXML(): begin"); } ByteArrayOutputStream baos = new ByteArrayOutputStream(); PrintStream out = new PrintStream(baos); int[] anValues = new int[2]; int[] anStartFrame = new int[100]; int[] anLength = new int[100]; int[] anType = new int[100]; boolean[] abAudio = new boolean[100]; boolean[] abCopy = new boolean[100]; boolean[] abPre = new boolean[100]; int[] anChannels = new int[100]; Cdparanoia cdparanoia = new Cdparanoia(strDevice); cdparanoia.readTOC(anValues, anStartFrame, anLength, anType, abAudio, abCopy, abPre, anChannels); int nTracks = anValues[1] - anValues[0] + 1; out.println(""); for (int i = 0; i < nTracks; i++) { out.print("\n"); } out.println(""); byte[] abData = baos.toByteArray(); ByteArrayInputStream bais = new ByteArrayInputStream(abData); cdparanoia.close(); if (TDebug.TraceCdda) { TDebug.out("CdparanoiaMidLevel.getTocAsXML(): end"); } return bais; } public AudioInputStream getTrack(String strDevice, int nTrack) throws IOException { if (TDebug.TraceCdda) { TDebug.out("CdparanoiaMidLevel.getInputStream(): begin"); } AudioInputStream audioInputStream = new CddaAudioInputStream(strDevice, nTrack); if (TDebug.TraceCdda) { TDebug.out("CdparanoiaMidLevel.getInputStream(): end"); } return audioInputStream; } private class CddaAudioInputStream extends TAsynchronousFilteredAudioInputStream { private static final int BUFFER_SIZE = CddaMidLevel.FRAME_SIZE; /** */ private Cdparanoia m_cdparanoia; /** This variable gets initialized to the total number of cdda frames for the respective track. On reading of a frame, it decremented untill zero. */ private int m_nCddaFrameCount; /** This variable contains the number of the cdda frame where the current track begins. */ private int m_nStartFrame; /** This variable contains the number of the cdda frame where the current track begins. */ private int m_nEndFrame; private int m_nLengthCount; /** Buffer for reading cdda frames. */ private byte[] m_abData; /** Track number. */ private int m_nTrack; public CddaAudioInputStream(String strDevice, int nTrack) { super(CDDA_FORMAT, AudioSystem.NOT_SPECIFIED /*getTrackLengthInPcmFrames()*/); if (TDebug.TraceCdda) { TDebug.out("CddaAudioInputStream.(): begin"); } m_nTrack = nTrack; int[] anValues = new int[2]; int[] anStartFrame = new int[100]; int[] anLength = new int[100]; int[] anType = new int[100]; boolean[] abAudio = new boolean[100]; boolean[] abCopy = new boolean[100]; boolean[] abPre = new boolean[100]; int[] anChannels = new int[100]; m_cdparanoia = new Cdparanoia(strDevice); m_cdparanoia.readTOC(anValues, anStartFrame, anLength, anType, abAudio, abCopy, abPre, anChannels); m_nCddaFrameCount = 0; int nTrackIndex = getTrack() - anValues[0]; m_nStartFrame = anStartFrame[nTrackIndex]; m_abData = new byte[BUFFER_SIZE]; m_nLengthCount = anLength[nTrackIndex]; // !!! writing to protected superclass variable !!! frameLength = m_nLengthCount * PCM_FRAMES_PER_CDDA_FRAME; if (TDebug.TraceCdda) { TDebug.out("CddaAudioInputStream.(): track length in cdda frames: " + m_nLengthCount); } m_cdparanoia.prepareTrack(getTrack()); if (TDebug.TraceCdda) { TDebug.out("CddaAudioInputStream.(): end"); } } private long getTrackLengthInPcmFrames() { int nCddaFrames = getTrackLengthInCddaFrames(); long lLength = nCddaFrames * PCM_FRAMES_PER_CDDA_FRAME; return lLength; } private int getTrackLengthInCddaFrames() { int nLength = getEndFrame() - getStartFrame() + 1; return nLength; } private int getStartFrame() { return m_nStartFrame; } private int getEndFrame() { return m_nEndFrame; } private int getTrack() { return m_nTrack; } private int getCurrentFrameNumber() { return m_nCddaFrameCount + m_nStartFrame; } private void increaseCurrentFrameNumber() { m_nCddaFrameCount++; } // private boolean isEndOfTrackReached() // { // return m_nCddaFrameCount >= getTrackLengthInCddaFrames(); // } private boolean isEndOfTrackReached() { return m_nLengthCount == 0; } public void execute() { if (TDebug.TraceCdda) { TDebug.out("CddaAudioInputStream.execute(): begin"); } if (! isEndOfTrackReached()) { if (TDebug.TraceCdda) { TDebug.out("CddaAudioInputStream.execute(): begin"); } while (getCircularBuffer().availableWrite() >= BUFFER_SIZE && ! isEndOfTrackReached()) { if (TDebug.TraceCdda) { TDebug.out("CddaAudioInputStream.execute(): before readFrame()"); } m_cdparanoia.readNextFrame(1, m_abData); m_nLengthCount--; if (TDebug.TraceCdda) { TDebug.out("CddaAudioInputStream.execute(): length count now: " + m_nLengthCount); } if (TDebug.TraceCdda) { TDebug.out("CddaAudioInputStream.execute(): after readFrame(), before cb.write()"); } getCircularBuffer().write(m_abData, 0, BUFFER_SIZE); if (TDebug.TraceCdda) { TDebug.out("CddaAudioInputStream.execute(): after cb.write()"); } increaseCurrentFrameNumber(); } } else { if (TDebug.TraceCdda) { TDebug.out("CddaAudioInputStream.execute(): end of cdda track"); } getCircularBuffer().close(); } if (TDebug.TraceCdda) { TDebug.out("CddaAudioInputStream.execute(): end"); } } public void close() throws IOException { m_cdparanoia.close(); super.close(); // TODO: close cdda? // m_encodedStream.close(); } } } /*** CdparanoiaMidLevel.java ****/ libtritonus-java-20070428/src/classes/org/tritonus/lowlevel/cdda/cdparanoia/package.html0000644000175000017500000000031010172435460031221 0ustar twernertwerner

Access to native cdparanoia library. The classes provided here .

libtritonus-java-20070428/src/classes/org/tritonus/lowlevel/cdda/CddaMidLevel.java0000644000175000017500000000444110172434623027770 0ustar twernertwerner/* * CddaMidLevel.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2001 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.lowlevel.cdda; import java.io.InputStream; import java.io.IOException; import java.util.Iterator; import javax.sound.sampled.AudioInputStream; /** Mid-level interface definition for reading CDs */ public interface CddaMidLevel { /** Size of a cdda frame in bytes. */ public static final int FRAME_SIZE = 2352; // TODO: document!! /** Gives the available CDROM devices. The returned iteration should contain a list of Strings. Each String represents an internal name of a CDROM drive. This String should be considered implementation-specific. It may contain no useful information (however, most time it does). Currently, it is required that the String starts with exactely one '/'. Should only those drives returned that have an audio CD in? */ public Iterator getDevices(); /** Gives the default drive. A String should be returned that represents the default drive. The String has to follow the conventions described in getDevices(). The String returned by this method should also appear as one of the elements in the iteration returned by getDevices(). */ public String getDefaultDevice(); public InputStream getTocAsXml(String strDevice) throws IOException; public AudioInputStream getTrack(String strDevice, int nTrack) throws IOException; } /*** CddaMidLevel.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/lowlevel/cdda/CddaUtils.java0000644000175000017500000000270310374074735027376 0ustar twernertwerner/* * CddaUtils.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2001 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.lowlevel.cdda; import org.tritonus.lowlevel.cdda.CddaMidLevel; import org.tritonus.lowlevel.cdda.cdparanoia.CdparanoiaMidLevel; /** Gets the preferred CDDA implementation. */ public class CddaUtils { // TODO: use some automatic lookup mechanism. public static CddaMidLevel getCddaMidLevel() { CddaMidLevel cddaMidLevel = new CdparanoiaMidLevel(); // CddaMidLevel cddaMidLevel = new CookedIoctlMidLevel(); return cddaMidLevel; } } /*** CddaUtils.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/lowlevel/cdda/package.html0000644000175000017500000000031410172434623027124 0ustar twernertwerner

The "mid-level" CDDA API. The classes provided here

@see org.tritonus.sampled.cdda libtritonus-java-20070428/src/classes/org/tritonus/lowlevel/cdda/cooked_ioctl/0000755000175000017500000000000010621572420027300 5ustar twernertwernerlibtritonus-java-20070428/src/classes/org/tritonus/lowlevel/cdda/cooked_ioctl/CookedIoctl.java0000644000175000017500000000547010374160730032352 0ustar twernertwerner/* * CookedIoctl.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2001 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.lowlevel.cdda.cooked_ioctl; import org.tritonus.share.TDebug; /** Reading audio CDs using the 'cooked ioctl' interface. */ public class CookedIoctl { static { if (TDebug.TraceCdda) { TDebug.out("CookedIoctl.(): loading native library tritonuscooked_ioctl"); } System.loadLibrary("tritonuscooked_ioctl"); if (TDebug.TraceCdda) { TDebug.out("CookedIoctl.(): loaded"); } // TODO: ???? setTrace(TDebug.TraceCddaNative); } /* * This holds a file descriptor for the native code - * do not touch! */ @SuppressWarnings("unused") private long m_lNativeHandle; // TODO: parameter strDevicename (or something else sensible) public CookedIoctl(String strDevice) { if (TDebug.TraceCdda) { System.out.println("CookedIoctl.: begin"); } int nResult = open(strDevice); if (nResult < 0) { throw new RuntimeException("cannot open" + strDevice); } if (TDebug.TraceCdda) { System.out.println("CookedIoctl.: end"); } } /** Opens the device. */ private native int open(String strDevice); /** Closes the device. */ public native void close(); /* * anValues[0] first track * anValues[1] last track * * anStartTrack[x] start sector of the track x. * anType[x] type of track x. */ public native int readTOC(int[] anValues, int[] anStartFrame, int[] anLength, int[] anType, boolean[] abCopy, boolean[] abPre, int[] anChannels); /** Reads one or more raw frames from the CD. This call reads nCount frames starting at lba position nFrame. abData has to be big enough to hold the amount of data requested (2352 * nCount bytes). */ public native int readFrame(int nFrame, int nCount, byte[] abData); private static native void setTrace(boolean bTrace); } /*** CookedIoctl.java ***/ ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootlibtritonus-java-20070428/src/classes/org/tritonus/lowlevel/cdda/cooked_ioctl/CookedIoctlMidLevel.javalibtritonus-java-20070428/src/classes/org/tritonus/lowlevel/cdda/cooked_ioctl/CookedIoctlMidLevel.ja0000644000175000017500000001721710374160730033447 0ustar twernertwerner/* * CookedIoctlMidLevel.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2001 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.lowlevel.cdda.cooked_ioctl; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.InputStream; import java.io.IOException; import java.io.PrintStream; import java.util.Arrays; import java.util.Iterator; import java.util.List; import javax.sound.sampled.AudioFormat; import javax.sound.sampled.AudioInputStream; import javax.sound.sampled.AudioSystem; import org.tritonus.share.TDebug; import org.tritonus.lowlevel.cdda.CddaMidLevel; import org.tritonus.share.sampled.convert.TAsynchronousFilteredAudioInputStream; public class CookedIoctlMidLevel implements CddaMidLevel { private static int PCM_FRAMES_PER_CDDA_FRAME = 588; private static AudioFormat CDDA_FORMAT = new AudioFormat( AudioFormat.Encoding.PCM_SIGNED, 44100.0F, 16, 2, 4, 44100.0F, false); public CookedIoctlMidLevel() { if (TDebug.TraceCdda) { TDebug.out("CookedIoctlMidLevel.(): begin"); } if (TDebug.TraceCdda) { TDebug.out("CookedIoctlMidLevel.(): end"); } } public Iterator getDevices() { // TODO: hack!! should be replaced by a real search String[] astrDevices = {"/dev/cdrom"}; // TODO: should make list immutable List devicesList = Arrays.asList(astrDevices); Iterator iterator = devicesList.iterator(); return iterator; } public String getDefaultDevice() { return "/dev/cdrom"; } public InputStream getTocAsXml(String strDevice) throws IOException { if (TDebug.TraceCdda) { TDebug.out("CookedIoctlMidLevel.getTocAsXML(): begin"); } ByteArrayOutputStream baos = new ByteArrayOutputStream(); PrintStream out = new PrintStream(baos); int[] anValues = new int[2]; int[] anStartFrame = new int[100]; int[] anLength = new int[100]; int[] anType = new int[100]; boolean[] abCopy = new boolean[100]; boolean[] abPre = new boolean[100]; int[] anChannels = new int[100]; CookedIoctl cookedIoctl = new CookedIoctl(strDevice); cookedIoctl.readTOC(anValues, anStartFrame, anLength, anType, abCopy, abPre, anChannels); int nTracks = anValues[1] - anValues[0] + 1; for (int i = 0; i <= nTracks; i++) { out.print("\n"); } byte[] abData = baos.toByteArray(); ByteArrayInputStream bais = new ByteArrayInputStream(abData); cookedIoctl.close(); if (TDebug.TraceCdda) { TDebug.out("CookedIoctlMidLevel.getTocAsXML(): end"); } return bais; } public AudioInputStream getTrack(String strDevice, int nTrack) throws IOException { if (TDebug.TraceCdda) { TDebug.out("CookedIoctlMidLevel.getInputStream(): begin"); } AudioInputStream audioInputStream = new CddaAudioInputStream(strDevice, nTrack); if (TDebug.TraceCdda) { TDebug.out("CookedIoctlMidLevel.getInputStream(): end"); } return audioInputStream; } private class CddaAudioInputStream extends TAsynchronousFilteredAudioInputStream { private static final int BUFFER_SIZE = CddaMidLevel.FRAME_SIZE; /** */ private CookedIoctl m_cookedIoctl; /** This variable gets initialized to the total number of cdda frames for the respective track. On reading of a frame, it decremented untill zero. */ private int m_nCddaFrameCount; /** This variable contains the number of the cdda frame where the current track begins. */ private int m_nStartFrame; /** This variable contains the number of the cdda frame where the current track begins. */ private int m_nEndFrame; /** Buffer for reading cdda frames. */ private byte[] m_abData; /** Track number. */ private int m_nTrack; public CddaAudioInputStream(String strDevice, int nTrack) { super(CDDA_FORMAT, AudioSystem.NOT_SPECIFIED /*getTrackLengthInPcmFrames()*/); if (TDebug.TraceCdda) { TDebug.out("CddaAudioInputStream.(): begin"); } m_nTrack = nTrack; int[] anValues = new int[2]; int[] anStartFrame = new int[100]; int[] anLength = new int[100]; int[] anType = new int[100]; boolean[] abCopy = new boolean[100]; boolean[] abPre = new boolean[100]; int[] anChannels = new int[100]; m_cookedIoctl = new CookedIoctl(strDevice); m_cookedIoctl.readTOC(anValues, anStartFrame, anLength, anType, abCopy, abPre, anChannels); m_nCddaFrameCount = 0; m_nStartFrame = anStartFrame[getTrack()]; // !!! writing to protected superclass variable !!! frameLength = getTrackLengthInPcmFrames(); m_abData = new byte[BUFFER_SIZE]; if (TDebug.TraceCdda) { TDebug.out("CddaAudioInputStream.(): end"); } } private long getTrackLengthInPcmFrames() { int nCddaFrames = getTrackLengthInCddaFrames(); long lLength = nCddaFrames * PCM_FRAMES_PER_CDDA_FRAME; return lLength; } private int getTrackLengthInCddaFrames() { int nLength = getEndFrame() - getStartFrame() + 1; return nLength; } private int getStartFrame() { return m_nStartFrame; } private int getEndFrame() { return m_nEndFrame; } private int getTrack() { return m_nTrack; } private int getCurrentFrameNumber() { return m_nCddaFrameCount + m_nStartFrame; } private void increaseCurrentFrameNumber() { m_nCddaFrameCount++; } private boolean isEndOfTrackReached() { return m_nCddaFrameCount >= getTrackLengthInCddaFrames(); } public void execute() { if (TDebug.TraceCdda) { TDebug.out("CddaAudioInputStream.execute(): begin"); } if (! isEndOfTrackReached()) { if (TDebug.TraceCdda) { TDebug.out("CddaAudioInputStream.execute(): begin"); } while (getCircularBuffer().availableWrite() >= BUFFER_SIZE && ! isEndOfTrackReached()) { if (TDebug.TraceCdda) { TDebug.out("CddaAudioInputStream.execute(): before readFrame()"); } m_cookedIoctl.readFrame(getCurrentFrameNumber(), 1, m_abData); if (TDebug.TraceCdda) { TDebug.out("CddaAudioInputStream.execute(): after readFrame(), before cb.write()"); } getCircularBuffer().write(m_abData, 0, BUFFER_SIZE); if (TDebug.TraceCdda) { TDebug.out("CddaAudioInputStream.execute(): after cb.write()"); } increaseCurrentFrameNumber(); } } else { if (TDebug.TraceCdda) { TDebug.out("CddaAudioInputStream.execute(): end of cdda track"); } getCircularBuffer().close(); } if (TDebug.TraceCdda) { TDebug.out("CddaAudioInputStream.execute(): end"); } } public void close() throws IOException { m_cookedIoctl.close(); super.close(); // TODO: close cdda? // m_encodedStream.close(); } } } /*** CookedIoctlMidLevel.java ****/ libtritonus-java-20070428/src/classes/org/tritonus/lowlevel/cdda/cooked_ioctl/package.html0000644000175000017500000000033510172435460031565 0ustar twernertwerner

Access to the native Linux "cooked ioctl" CDDA interface. The classes provided here .

libtritonus-java-20070428/src/classes/org/tritonus/lowlevel/dsp/0000755000175000017500000000000010621572422024537 5ustar twernertwernerlibtritonus-java-20070428/src/classes/org/tritonus/lowlevel/dsp/Complex.java0000644000175000017500000010657110374142163027023 0ustar twernertwerner/* * ------------------------------------------------------------------------- * $Id: Complex.java,v 1.3 2006/02/13 17:40:03 pfisterer Exp $ * ------------------------------------------------------------------------- * Copyright (c) 1997 - 1998 by Visual Numerics, Inc. All rights reserved. * * Permission to use, copy, modify, and distribute this software is freely * granted by Visual Numerics, Inc., provided that the copyright notice * above and the following warranty disclaimer are preserved in human * readable form. * * Because this software is licenses free of charge, it is provided * "AS IS", with NO WARRANTY. TO THE EXTENT PERMITTED BY LAW, VNI * DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED * TO ITS PERFORMANCE, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. * VNI WILL NOT BE LIABLE FOR ANY DAMAGES WHATSOEVER ARISING OUT OF THE USE * OF OR INABILITY TO USE THIS SOFTWARE, INCLUDING BUT NOT LIMITED TO DIRECT, * INDIRECT, SPECIAL, CONSEQUENTIAL, PUNITIVE, AND EXEMPLARY DAMAGES, EVEN * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. * * ------------------------------------------------------------------------- */ package org.tritonus.lowlevel.dsp; /** * This class implements complex numbers. It provides the basic operations * (addition, subtraction, multiplication, division) as well as a set of * complex functions. * * The binary operations have the form, where op is plus, * minus, times or over. *
  *	public static Complex op(Complex x, Complex y)   // x op y
  *	public static Complex op(Complex x, double y)    // x op y
  *	public static Complex op(double x, Complex y)    // x op y
  *	public Complex op(Complex y)                     // this op y
  *	public Complex op(double y)                      // this op y
  *	public Complex opReverse(double x)               // x op this
  * 
* * The functions in this class follow the rules for complex arithmetic * as defined C9x Annex G:"IEC 559-compatible complex arithmetic." * The API is not the same, but handling of infinities, NaNs, and positive * and negative zeros is intended to follow the same rules. * * This class depends on the standard java.lang.Math class following * certain rules, as defined in the C9x Annex F, for the handling of * infinities, NaNs, and positive and negative zeros. Sun's specification * is that java.lang.Math should reproduce the results in the Sun's fdlibm * C library. This library appears to follow the Annex F specification. * At least on Windows, Sun's JDK 1.0 and 1.1 do NOT follow this specification. * Sun's JDK 1.2(RC2) does follow the Annex F specification. Thesefore, * this class will not give the expected results for edge cases with * JDK 1.0 and 1.1. */ public class Complex implements java.io.Serializable, Cloneable { /** * @serial Real part of the Complex. */ private double m_re; /** * @serial Imaginary part of the Complex. */ private double m_im; /** * Serialization ID */ static final long serialVersionUID = -633126172485117692L; /** * String used in converting Complex to String. * Default is "i", but sometimes "j" is desired. * Note that this is set for the class, not for * a particular instance of a Complex. */ public static String suffix = "i"; private final static long negZeroBits = Double.doubleToLongBits(1.0/Double.NEGATIVE_INFINITY); /** * Constructs a Complex equal to the argument. * @param z A Complex object * If z is null then a NullPointerException is thrown. */ public Complex(Complex z) { m_re = z.m_re; m_im = z.m_im; } /** * Constructs a Complex with real and imaginary parts given * by the input arguments. * @param re A double value equal to the real part of the Complex object. * @param im A double value equal to the imaginary part of the Complex object. */ public Complex(double re, double im) { this.m_re = re; this.m_im = im; } /** * Constructs a Complex with a zero imaginary part. * @param re A double value equal to the real part of the Complex object. */ public Complex(double re) { this.m_re = re; this.m_im = 0.0; } /** * Constructs a Complex equal to zero. */ public Complex() { m_re = 0.0; m_im = 0.0; } /** * Tests if this is a complex Not-a-Number (NaN) value. * @return True if either component of the Complex object is NaN; * false, otherwise. */ private boolean isNaN() { return (Double.isNaN(m_re) || Double.isNaN(m_im)); } /** * Compares with another Complex. *

Note: To be useful in hashtables this method * considers two NaN double values to be equal. This * is not according to IEEE specification. * @param z A Complex object. * @return True if the real and imaginary parts of this object * are equal to their counterparts in the argument; false, otherwise. */ public boolean equals(Complex z) { if (isNaN() && z.isNaN()) { return true; } else { return (m_re == z.m_re && m_im == z.m_im); } } /** * Compares this object against the specified object. *

Note: To be useful in hashtables this method * considers two NaN double values to be equal. This * is not according to IEEE specification * @param obj The object to compare with. * @return True if the objects are the same; false otherwise. */ public boolean equals(Object obj) { if (obj == null) { return false; } else if (obj instanceof Complex) { return equals((Complex)obj); } else { return false; } } /** * Returns a hashcode for this Complex. * @return A hash code value for this object. */ public int hashCode() { long re_bits = Double.doubleToLongBits(m_re); long im_bits = Double.doubleToLongBits(m_im); return (int)((re_bits^im_bits)^((re_bits^im_bits)>>32)); } /** * Returns the real part of a Complex object. * @return The real part of z. */ public double real() { return m_re; } /** * Returns the imaginary part of a Complex object. * @param z A Complex object. * @return The imaginary part of z. */ public double imag() { return m_im; } /** * Returns the real part of a Complex object. * @param z A Complex object. * @return The real part of z. */ public static double real(Complex z) { return z.m_re; } /** * Returns the imaginary part of a Complex object. * @param z A Complex object. * @return The imaginary part of z. */ public static double imag(Complex z) { return z.m_im; } /** * Returns the negative of a Complex object, -z. * @param z A Complex object. * @return A newly constructed Complex initialized to * the negative of the argument. */ public static Complex negative(Complex z) { return new Complex(-z.m_re, -z.m_im); } /** * Returns the complex conjugate of a Complex object. * @param z A Complex object. * @return A newly constructed Complex initialized to complex conjugate of z. */ public static Complex conjugate(Complex z) { return new Complex(z.m_re, -z.m_im); } /** * Returns the sum of two Complex objects, x+y. * @param x A Complex object. * @param y A Complex object. * @return A newly constructed Complex initialized to x+y. */ public static Complex plus(Complex x, Complex y) { return new Complex(x.m_re+y.m_re, x.m_im+y.m_im); } /** * Returns the sum of a Complex and a double, x+y. * @param x A Complex object. * @param y A double value. * @return A newly constructed Complex initialized to x+y. */ public static Complex plus(Complex x, double y) { return new Complex(x.m_re+y, x.m_im); } /** * Returns the sum of a double and a Complex, x+y. * @param x A double value. * @param y A Complex object. * @return A newly constructed Complex initialized to x+y. */ public static Complex plus(double x, Complex y) { return new Complex(x+y.m_re, y.m_im); } /** * Returns the sum of this Complex and another Complex, this+y. * @param y A Complex object. * @return A newly constructed Complex initialized to this+y. */ public Complex plus(Complex y) { return new Complex(m_re+y.m_re, m_im+y.m_im); } /** * Returns the sum of this Complex a double, this+y. * @param y A double value. * @return A newly constructed Complex initialized to this+y. */ public Complex plus(double y) { return new Complex(m_re+y, m_im); } /** * Returns the sum of this Complex and a double, x+this. * @param x A double value. * @return A newly constructed Complex initialized to x+this. */ public Complex plusReverse(double x) { return new Complex(m_re+x, m_im); } /** * Returns the difference of two Complex objects, x-y. * @param x A Complex object. * @param y A Complex object. * @return A newly constructed Complex initialized to x-y. */ public static Complex minus(Complex x, Complex y) { return new Complex(x.m_re-y.m_re, x.m_im-y.m_im); } /** * Returns the difference of a Complex object and a double, x-y. * @param x A Complex object. * @param y A double value. * @return A newly constructed Complex initialized to x-y. */ public static Complex minus(Complex x, double y) { return new Complex(x.m_re-y, x.m_im); } /** * Returns the difference of a double and a Complex object, x-y. * @param x A double value. * @param y A Complex object. * @return A newly constructed Complex initialized to x-y.. */ public static Complex minus(double x, Complex y) { return new Complex(x-y.m_re, -y.m_im); } /** * Returns the difference of this Complex object and * another Complex object, this-y. * @param y A Complex object. * @return A newly constructed Complex initialized to this-y. */ public Complex minus(Complex y) { return new Complex(m_re-y.m_re, m_im-y.m_im); } /** * Subtracts a double from this Complex and returns the difference, this-y. * @param y A double value. * @return A newly constructed Complex initialized to this-y. */ public Complex minus(double y) { return new Complex(m_re-y, m_im); } /** * Returns the difference of this Complex object and a double, this-y. * @param y A double value. * @return A newly constructed Complex initialized to x-this. */ public Complex minusReverse(double x) { return new Complex(x-m_re, -m_im); } /** * Returns the product of two Complex objects, x*y. * @param x A Complex object. * @param y A Complex object. * @return A newly constructed Complex initialized to x*y. */ public static Complex times(Complex x, Complex y) { Complex t = new Complex(x.m_re*y.m_re-x.m_im*y.m_im, x.m_re*y.m_im+x.m_im*y.m_re); if (Double.isNaN(t.m_re) && Double.isNaN(t.m_im)) timesNaN(x, y, t); return t; } /* * Returns sign(b)*|a|. */ private static double copysign(double a, double b) { double abs = Math.abs(a); return ((b < 0) ? -abs : abs); } /** * Recovers infinities when computed x*y = NaN+i*NaN. * This code is not part of times(), so that times * could be inlined by an optimizing compiler. *

* This algorithm is adapted from the C9x Annex G: * "IEC 559-compatible complex arithmetic." * @param x First Complex operand. * @param y Second Complex operand. * @param t The product x*y, computed without regard to NaN. * The real and/or the imaginary part of t is * expected to be NaN. * @return The corrected product of x*y. */ private static void timesNaN(Complex x, Complex y, Complex t) { boolean recalc = false; double a = x.m_re; double b = x.m_im; double c = y.m_re; double d = y.m_im; if (Double.isInfinite(a) || Double.isInfinite(b)) { // x is infinite a = copysign(Double.isInfinite(a)?1.0:0.0, a); b = copysign(Double.isInfinite(b)?1.0:0.0, b); if (Double.isNaN(c)) c = copysign(0.0, c); if (Double.isNaN(d)) d = copysign(0.0, d); recalc = true; } if (Double.isInfinite(c) || Double.isInfinite(d)) { // x is infinite a = copysign(Double.isInfinite(c)?1.0:0.0, c); b = copysign(Double.isInfinite(d)?1.0:0.0, d); if (Double.isNaN(a)) a = copysign(0.0, a); if (Double.isNaN(b)) b = copysign(0.0, b); recalc = true; } if (!recalc) { if (Double.isInfinite(a*c) || Double.isInfinite(b*d) || Double.isInfinite(a*d) || Double.isInfinite(b*c)) { // Change all NaNs to 0 if (Double.isNaN(a)) a = copysign(0.0, a); if (Double.isNaN(b)) b = copysign(0.0, b); if (Double.isNaN(c)) c = copysign(0.0, c); if (Double.isNaN(d)) d = copysign(0.0, d); recalc = true; } } if (recalc) { t.m_re = Double.POSITIVE_INFINITY * (a*c - b*d); t.m_im = Double.POSITIVE_INFINITY * (a*d + b*c); } } /** * Returns the product of a Complex object and a double, x*y. * @param x A Complex object. * @param y A double value. * @return A newly constructed Complex initialized to x*y. */ public static Complex times(Complex x, double y) { return new Complex(x.m_re*y, x.m_im*y); } /** * Returns the product of a double and a Complex object, x*y. * @param x A double value. * @param y A Complex object. * @return A newly constructed Complex initialized to x*y. */ public static Complex times(double x, Complex y) { return new Complex(x*y.m_re, x*y.m_im); } /** * Returns the product of this Complex object and another Complex object, this*y. * @param y A Complex object. * @return A newly constructed Complex initialized to this*y. */ public Complex times(Complex y) { return times(this,y); } /** * Returns the product of this Complex object and a double, this*y. * @param y A double value. * @return A newly constructed Complex initialized to this*y. */ public Complex times(double y) { return new Complex(m_re*y, m_im*y); } /** * Returns the product of a double and this Complex, x*this. * @param y A double value. * @return A newly constructed Complex initialized to x*this. */ public Complex timesReverse(double x) { return new Complex(x*m_re, x*m_im); } private static boolean isFinite(double x) { return !(Double.isInfinite(x) || Double.isNaN(x)); } /** * Returns Complex object divided by a Complex object, x/y. * @param x The numerator, a Complex object. * @param y The denominator, a Complex object. * @return A newly constructed Complex initialized to x/y. */ public static Complex over(Complex x, Complex y) { double a = x.m_re; double b = x.m_im; double c = y.m_re; double d = y.m_im; double scale = Math.max(Math.abs(c), Math.abs(d)); boolean isScaleFinite = isFinite(scale); if (isScaleFinite) { c /= scale; d /= scale; } double den = c*c + d*d; Complex z = new Complex((a*c+b*d)/den, (b*c-a*d)/den); if (isScaleFinite) { z.m_re /= scale; z.m_im /= scale; } // Recover infinities and zeros computed as NaN+iNaN. if (Double.isNaN(z.m_re) && Double.isNaN(z.m_im)) { if (den == 0.0 && (!Double.isNaN(a) || !Double.isNaN(b))) { double s = copysign(Double.POSITIVE_INFINITY, c); z.m_re = s * a; z.m_im = s * b; } else if ((Double.isInfinite(a) || Double.isInfinite(b)) && isFinite(c) && isFinite(d)) { a = copysign(Double.isInfinite(a)?1.0:0.0, a); b = copysign(Double.isInfinite(b)?1.0:0.0, b); z.m_re = Double.POSITIVE_INFINITY * (a*c + b*d); z.m_im = Double.POSITIVE_INFINITY * (b*c - a*d); } else if (Double.isInfinite(scale) && isFinite(a) && isFinite(b)) { c = copysign(Double.isInfinite(c)?1.0:0.0, c); d = copysign(Double.isInfinite(d)?1.0:0.0, d); z.m_re = 0.0 * (a*c + b*d); z.m_im = 0.0 * (b*c - a*d); } } return z; } /** * Returns Complex object divided by a double, x/y. * @param x The numerator, a Complex object. * @param y The denominator, a double. * @return A newly constructed Complex initialized to x/y. */ public static Complex over(Complex x, double y) { return new Complex(x.m_re/y, x.m_im/y); } /** * Returns a double divided by a Complex object, x/y. * @param x A double value. * @param y The denominator, a Complex object. * @return A newly constructed Complex initialized to x/y. */ public static Complex over(double x, Complex y) { return y.overReverse(x); } /** * Returns this Complex object divided by another Complex object, this/y. * @param y The denominator, a Complex object. * @return A newly constructed Complex initialized to x/y. */ public Complex over(Complex y) { return over(this, y); } /** * Returns this Complex object divided by double, this/y. * @param y The denominator, a double. * @return A newly constructed Complex initialized to x/y. */ public Complex over(double y) { return over(this, y); } /** * Returns a double dividied by this Complex object, x/this. * @param x The numerator, a double. * @return A newly constructed Complex initialized to x/this. */ public Complex overReverse(double x) { double den, t; Complex z; if (Math.abs(m_re) > Math.abs(m_im)) { t = m_im / m_re; den = m_re + m_im*t; z = new Complex(x/den, -x*t/den); } else { t = m_re / m_im; den = m_im + m_re*t; z = new Complex(x*t/den, -x/den); } return z; } /** * Returns the absolute value (modulus) of a Complex, |z|. * @param z A Complex object. * @return A double value equal to the absolute value of the argument. */ public static double abs(Complex z) { double x = Math.abs(z.m_re); double y = Math.abs(z.m_im); if (Double.isInfinite(x) || Double.isInfinite(y)) return Double.POSITIVE_INFINITY; if (x + y == 0.0) { return 0.0; } else if (x > y) { y /= x; return x*Math.sqrt(1.0+y*y); } else { x /= y; return y*Math.sqrt(x*x+1.0); } } /** * Returns the argument (phase) of a Complex, in radians, * with a branch cut along the negative real axis. * @param z A Complex object. * @return A double value equal to the argument (or phase) of a Complex. * It is in the interval [-pi,pi]. */ public static double argument(Complex z) { return Math.atan2(z.m_im, z.m_re); } /** * Returns the square root of a Complex, * with a branch cut along the negative real axis. * @param z A Complex object. * @return A newly constructed Complex initialized * to square root of z. Its real part is * non-negative. */ public static Complex sqrt(Complex z) { Complex result = new Complex(); if (Double.isInfinite(z.m_im)) { result.m_re = Double.POSITIVE_INFINITY; result.m_im = z.m_im; } else if (Double.isNaN(z.m_re)) { result.m_re = result.m_im = Double.NaN; } else if (Double.isNaN(z.m_im)) { if (Double.isInfinite(z.m_re)) { if (z.m_re > 0) { result.m_re = z.m_re; result.m_im = z.m_im; } else { result.m_re = z.m_im; result.m_im = Double.POSITIVE_INFINITY; } } else { result.m_re = result.m_im = Double.NaN; } } else { // Numerically correct version of formula 3.7.27 // in the NBS Hanbook, as suggested by Pete Stewart. double t = abs(z); if (Math.abs(z.m_re) <= Math.abs(z.m_im)) { // No cancellation in these formulas result.m_re = Math.sqrt(0.5*(t+z.m_re)); result.m_im = Math.sqrt(0.5*(t-z.m_re)); } else { // Stable computation of the above formulas if (z.m_re > 0) { result.m_re = t + z.m_re; result.m_im = Math.abs(z.m_im)*Math.sqrt(0.5/result.m_re); result.m_re = Math.sqrt(0.5*result.m_re); } else { result.m_im = t - z.m_re; result.m_re = Math.abs(z.m_im)*Math.sqrt(0.5/result.m_im); result.m_im = Math.sqrt(0.5*result.m_im); } } if (z.m_im < 0) result.m_im = -result.m_im; } return result; } /** * Returns the exponential of a Complex z, exp(z). * @param z A Complex object. * @return A newly constructed Complex initialized to exponential * of the argument. */ public static Complex exp(Complex z) { Complex result = new Complex(); double r = Math.exp(z.m_re); double cosa = Math.cos(z.m_im); double sina = Math.sin(z.m_im); if (Double.isInfinite(z.m_im) || Double.isNaN(z.m_im) || Math.abs(cosa)>1) { cosa = sina = Double.NaN; } if (Double.isInfinite(z.m_re) || Double.isInfinite(r)) { if (z.m_re < 0) { r = 0; if (Double.isInfinite(z.m_im) || Double.isNaN(z.m_im)) { cosa = sina = 0; } else { cosa /= Double.POSITIVE_INFINITY; sina /= Double.POSITIVE_INFINITY; } } else { r = z.m_re; if (Double.isNaN(z.m_im)) cosa = 1; } } if (z.m_im == 0.0) { result.m_re = r; result.m_im = z.m_im; } else { result.m_re = r*cosa; result.m_im = r*sina; } return result; } /** * Returns the logarithm of a Complex z, * with a branch cut along the negative real axis. * @param z A Complex object. * @return A newly constructed Complex initialized to logarithm * of the argument. Its imaginary part is in the * interval [-i*pi,i*pi]. */ public static Complex log(Complex z) { Complex result = new Complex(); if (Double.isNaN(z.m_re)) { result.m_re = result.m_im = z.m_re; if (Double.isInfinite(z.m_im)) result.m_re = Double.POSITIVE_INFINITY; } else if (Double.isNaN(z.m_im)) { result.m_re = result.m_im = z.m_im; if (Double.isInfinite(z.m_re)) result.m_re = Double.POSITIVE_INFINITY; } else { result.m_re = Math.log(abs(z)); result.m_im = argument(z); } return result; } /** * Returns the sine of a Complex. * @param z A Complex object. * @return A newly constructed Complex initialized to sine of the argument. */ public static Complex sin(Complex z) { // sin(z) = -i*sinh(i*z) Complex iz = new Complex(-z.m_im,z.m_re); Complex s = sinh(iz); double re = s.m_im; s.m_im = -s.m_re; s.m_re = re; return s; } /** * Returns the cosine of a Complex. * @param z A Complex object. * @return A newly constructed Complex initialized to cosine of the argument. */ public static Complex cos(Complex z) { // cos(z) = cosh(i*z) return cosh(new Complex(-z.m_im,z.m_re)); } /** * Returns the tangent of a Complex. * @param z A Complex object. * @return A newly constructed Complex initialized * to tangent of the argument. */ public static Complex tan(Complex z) { // tan = -i*tanh(i*z) Complex iz = new Complex(-z.m_im,z.m_re); Complex s = tanh(iz); double re = s.m_im; s.m_im = -s.m_re; s.m_re = re; return s; } /** * Returns the inverse sine (arc sine) of a Complex, * with branch cuts outside the interval [-1,1] along the * real axis. * @param z A Complex object. * @return A newly constructed Complex initialized to inverse * (arc) sine of the argument. The real part of the * result is in the interval [-pi/2,+pi/2]. */ public static Complex asin(Complex z) { Complex result = new Complex(); double r = abs(z); if (Double.isInfinite(r)) { boolean infiniteX = Double.isInfinite(z.m_re); boolean infiniteY = Double.isInfinite(z.m_im); if (infiniteX) { double pi2 = 0.5*Math.PI; result.m_re = (z.m_re>0 ? pi2 : -pi2); if (infiniteY) result.m_re /= 2; } else if (infiniteY) { result.m_re = z.m_re/Double.POSITIVE_INFINITY; } if (Double.isNaN(z.m_im)) { result.m_im = -z.m_re; result.m_re = z.m_im; } else { result.m_im = z.m_im*Double.POSITIVE_INFINITY; } return result; } else if (Double.isNaN(r)) { result.m_re = result.m_im = Double.NaN; if (z.m_re == 0) result.m_re = z.m_re; } else if (r < 2.58095e-08) { // sqrt(6.0*dmach(3)) = 2.58095e-08 result.m_re = z.m_re; result.m_im = z.m_im; } else if (z.m_re == 0) { result.m_re = 0; result.m_im = Sfun.asinh(z.m_im); } else if (r <= 0.1) { Complex z2 = times(z,z); //log(eps)/log(rmax) = 8 where rmax = 0.1 for (int i = 1; i <= 8; i++) { double twoi = 2*(8-i) + 1; result = times(times(result,z2),twoi/(twoi+1.0)); result.m_re += 1.0/twoi; } result = result.times(z); } else { // A&S 4.4.26 // asin(z) = -i*log(z+sqrt(1-z)*sqrt(1+z)) // or, since log(iz) = log(z) +i*pi/2, // asin(z) = pi/2 - i*log(z+sqrt(z+1)*sqrt(z-1)) Complex w = ((z.m_im < 0) ? negative(z) : z); Complex sqzp1 = sqrt(plus(w,1.0)); if (sqzp1.m_im < 0.0) sqzp1 = negative(sqzp1); Complex sqzm1 = sqrt(minus(w,1.0)); result = log(plus(w,times(sqzp1,sqzm1))); double rx = result.m_re; result.m_re = 0.5*Math.PI + result.m_im; result.m_im = -rx; } if (result.m_re > 0.5*Math.PI) { result.m_re = Math.PI - result.m_re; result.m_im = -result.m_im; } if (result.m_re < -0.5*Math.PI) { result.m_re = -Math.PI - result.m_re; result.m_im = -result.m_im; } if (z.m_im < 0) { result.m_re = -result.m_re; result.m_im = -result.m_im; } return result; } /** * Returns the inverse cosine (arc cosine) of a Complex, * with branch cuts outside the interval [-1,1] along the * real axis. * @param z A Complex object. * @return A newly constructed Complex initialized to * inverse (arc) cosine of the argument. * The real part of the result is in the interval [0,pi]. */ public static Complex acos(Complex z) { Complex result = new Complex(); double r = abs(z); if (Double.isInfinite(z.m_re) && Double.isNaN(z.m_im)) { result.m_re = Double.NaN; result.m_im = Double.NEGATIVE_INFINITY; } else if (Double.isInfinite(r)) { result.m_re = Math.atan2(Math.abs(z.m_im),z.m_re); result.m_im = z.m_im*Double.NEGATIVE_INFINITY; } else if (r == 0) { result.m_re = Math.PI/2; result.m_im = -z.m_im; } else { result = minus(Math.PI/2,asin(z)); } return result; } /** * Returns the inverse tangent (arc tangent) of a Complex, * with branch cuts outside the interval [-i,i] along the * imaginary axis. * @param z A Complex object. * @return A newly constructed Complex initialized to * inverse (arc) tangent of the argument. * Its real part is in the interval [-pi/2,pi/2]. */ public static Complex atan(Complex z) { Complex result = new Complex(); double r = abs(z); if (Double.isInfinite(r)) { double pi2 = 0.5*Math.PI; double im = (Double.isNaN(z.m_im) ? 0 : z.m_im); result.m_re = (z.m_re<0 ? -pi2 : pi2); result.m_im = (im<0 ? -1 : 1)/Double.POSITIVE_INFINITY; if (Double.isNaN(z.m_re)) result.m_re = z.m_re; } else if (Double.isNaN(r)) { result.m_re = result.m_im = Double.NaN; if (z.m_im == 0) result.m_im = z.m_im; } else if (r < 1.82501e-08) { // sqrt(3.0*dmach(3)) = 1.82501e-08 result.m_re = z.m_re; result.m_im = z.m_im; } else if (r < 0.1) { Complex z2 = times(z,z); // -0.4343*log(dmach(3))+1 = 17 for (int k = 0; k < 17; k++) { Complex temp = times(z2,result); int twoi = 2*(17-k) - 1; result.m_re = 1.0/twoi - temp.m_re; result.m_im = -temp.m_im; } result = result.times(z); } else if (r < 9.0072e+15) { // 1.0/dmach(3) = 9.0072e+15 double r2 = r*r; result.m_re = 0.5*Math.atan2(2*z.m_re,1.0-r2); result.m_im = 0.25*Math.log((r2+2*z.m_im+1)/(r2-2*z.m_im+1)); } else { result.m_re = ((z.m_re < 0.0) ? -0.5*Math.PI : 0.5*Math.PI); } return result; } /** * Returns the hyperbolic sine of a Complex. * @param z A Complex object. * @return A newly constructed Complex initialized to hyperbolic * sine of the argument. */ public static Complex sinh(Complex z) { double coshx = Sfun.cosh(z.m_re); double sinhx = Sfun.sinh(z.m_re); double cosy = Math.cos(z.m_im); double siny = Math.sin(z.m_im); boolean infiniteX = Double.isInfinite(coshx); boolean infiniteY = Double.isInfinite(z.m_im); Complex result; if (z.m_im == 0) { result = new Complex(Sfun.sinh(z.m_re)); } else { // A&S 4.5.49 result = new Complex(sinhx*cosy, coshx*siny); if (infiniteY) { result.m_im = Double.NaN; if (z.m_re == 0) result.m_re = 0; } if (infiniteX) { result.m_re = z.m_re*cosy; result.m_im = z.m_re*siny; if (z.m_im == 0) result.m_im = 0; if (infiniteY) result.m_re = z.m_im; } } return result; } /** * Returns the hyperbolic cosh of a Complex. * @param z A Complex object. * @return A newly constructed Complex initialized to * the hyperbolic cosine of the argument. */ public static Complex cosh(Complex z) { if (z.m_im == 0) { return new Complex(Sfun.cosh(z.m_re)); } double coshx = Sfun.cosh(z.m_re); double sinhx = Sfun.sinh(z.m_re); double cosy = Math.cos(z.m_im); double siny = Math.sin(z.m_im); boolean infiniteX = Double.isInfinite(coshx); boolean infiniteY = Double.isInfinite(z.m_im); // A&S 4.5.50 Complex result = new Complex(coshx*cosy, sinhx*siny); if (infiniteY) result.m_re = Double.NaN; if (z.m_re == 0) { result.m_im = 0; } else if (infiniteX) { result.m_re = z.m_re*cosy; result.m_im = z.m_re*siny; if (z.m_im == 0) result.m_im = 0; if (Double.isNaN(z.m_im)) { result.m_re = z.m_re; } else if (infiniteY) { result.m_re = z.m_im; } } return result; } /** * Returns the hyperbolic tanh of a Complex. * @param z A Complex object. * @return A newly constructed Complex initialized to * the hyperbolic tangent of the argument. */ public static Complex tanh(Complex z) { double sinh2x = Sfun.sinh(2*z.m_re); if (z.m_im == 0) { return new Complex(Sfun.tanh(z.m_re)); } else if (sinh2x == 0) { return new Complex(0,Math.tan(z.m_im)); } double cosh2x = Sfun.cosh(2*z.m_re); double cos2y = Math.cos(2*z.m_im); double sin2y = Math.sin(2*z.m_im); boolean infiniteX = Double.isInfinite(cosh2x); // Workaround for bug in JDK 1.2beta4 if (Double.isInfinite(z.m_im) || Double.isNaN(z.m_im)) { cos2y = sin2y = Double.NaN; } if (infiniteX) return new Complex(z.m_re > 0 ? 1 : -1); // A&S 4.5.51 double den = (cosh2x + cos2y); return new Complex(sinh2x/den, sin2y/den); } /** * Returns the Complex z raised to the x power, * with a branch cut for the first parameter (z) along the * negative real axis. * @param z A Complex object. * @param x A double value. * @return A newly constructed Complex initialized to z to the power x. */ public static Complex pow(Complex z, double x) { double absz = abs(z); Complex result = new Complex(); if (absz == 0.0) { result = z; } else { double a = argument(z); double e = Math.pow(absz, x); result.m_re = e*Math.cos(x*a); result.m_im = e*Math.sin(x*a); } return result; } /** * Returns the inverse hyperbolic sine (arc sinh) of a Complex, * with a branch cuts outside the interval [-i,i]. * @param z A Complex object. * @return A newly constructed Complex initialized to * inverse (arc) hyperbolic sine of the argument. * Its imaginary part is in the interval [-i*pi/2,i*pi/2]. */ public static Complex asinh(Complex z) { // asinh(z) = i*asin(-i*z) Complex miz = new Complex(z.m_im,-z.m_re); Complex result = asin(miz); double rx = result.m_im; result.m_im = result.m_re; result.m_re = -rx; return result; } /** * Returns the inverse hyperbolic cosine (arc cosh) of a Complex, * with a branch cut at values less than one along the real axis. * @param z A Complex object. * @return A newly constructed Complex initialized to * inverse (arc) hyperbolic cosine of the argument. * The real part of the result is non-negative and its * imaginary part is in the interval [-i*pi,i*pi]. */ public static Complex acosh(Complex z) { Complex result = acos(z); double rx = -result.m_im; result.m_im = result.m_re; result.m_re = rx; if (result.m_re < 0 || isNegZero(result.m_re)) { result.m_re = -result.m_re; result.m_im = -result.m_im; } return result; } /** * Returns true is x is a negative zero. */ private static boolean isNegZero(double x) { return (Double.doubleToLongBits(x) == negZeroBits); } /** * Returns the inverse hyperbolic tangent (arc tanh) of a Complex, * with a branch cuts outside the interval [-1,1] on the real axis. * @param z A Complex object. * @return A newly constructed Complex initialized to * inverse (arc) hyperbolic tangent of the argument. * The imaginary part of the result is in the interval * [-i*pi/2,i*pi/2]. */ public static Complex atanh(Complex z) { // atanh(z) = i*atan(-i*z) Complex miz = new Complex(z.m_im,-z.m_re); Complex result = atan(miz); double rx = result.m_im; result.m_im = result.m_re; result.m_re = -rx; return result; } /** * Returns the Complex x raised to the Complex y power. * @param x A Complex object. * @param y A Complex object. * @return A newly constructed Complex initialized * to xy. */ public static Complex pow(Complex x, Complex y) { return exp(times(y,log(x))); } /** * Returns a String representation for the specified Complex. * @return A String representation for this object. */ public String toString() { if (m_im == 0.0) return String.valueOf(m_re); if (m_re == 0.0) return String.valueOf(m_im) + suffix; String sign = (m_im < 0.0) ? "" : "+"; return (String.valueOf(m_re) + sign + String.valueOf(m_im) + suffix); } /** * Parses a string into a Complex. * @param s The string to be parsed. * @return A newly constructed Complex initialized to the value represented * by the string argument. * @exception NumberFormatException If the string does not contain a parsable Complex number. * @exception NullPointerException If the input argument is null. */ public static Complex valueOf(String s) throws NumberFormatException { String input = s.trim(); int iBeginNumber = 0; Complex z = new Complex(); int state = 0; int sign = 1; boolean haveRealPart = false; /* * state values * 0 Initial State * 1 After Initial Sign * 2 In integer part * 3 In fractional part * 4 In exponential part (after 'e' but fore sign or digits) * 5 In exponential digits */ for (int k = 0; k < input.length(); k++) { char ch = input.charAt(k); switch (ch) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': if (state == 0 || state == 1) { state = 2; } else if (state == 4) { state = 5; } break; case '-': case '+': sign = ((ch=='+') ? 1 : -1); if (state == 0) { state = 1; } else if (state == 4) { state = 5; } else { if (!haveRealPart) { // have the real part of the number z.m_re = Double.valueOf(input.substring(iBeginNumber,k)).doubleValue(); haveRealPart = true; // perpare to part the imaginary part iBeginNumber = k; state = 1; } else { throw new NumberFormatException(input); } } break; case '.': if (state == 0 || state == 1 || state == 2) state = 3; else throw new NumberFormatException(input); break; case 'i': case 'I': case 'j': case 'J': if (k+1 != input.length()) { throw new NumberFormatException(input); } else if (state == 0 || state == 1) { z.m_im = sign; return z; } else if (state == 2 || state == 3 || state == 5) { z.m_im = Double.valueOf(input.substring(iBeginNumber,k)).doubleValue(); return z; } else { throw new NumberFormatException(input); } case 'e': case 'E': case 'd': case 'D': if (state == 2 || state == 3) { state = 4; } else { throw new NumberFormatException(input); } break; default: throw new NumberFormatException(input); } } if (!haveRealPart) { z.m_re = Double.valueOf(input).doubleValue(); return z; } else { throw new NumberFormatException(input); } } } libtritonus-java-20070428/src/classes/org/tritonus/lowlevel/dsp/FIR.java0000644000175000017500000001072510150707540026025 0ustar twernertwerner/* * FIR.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2002 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.lowlevel.dsp; /** A Finite Impulse Response (FIR) filter. */ public class FIR implements Filter { /** The length of the filter (number of coefficients). */ private int m_nLength; /** The filter coefficients. */ private float[] m_afCoefficients; /** The buffer for past input values. This stores the input values needed for convolution. The buffer is used as a circular buffer. */ private float[] m_afBuffer; /** The index into m_afBuffer. Since m_afBuffer is used as a circular buffer, a buffer pointer is needed. */ private int m_nBufferIndex; /** Init a FIR filter with coefficients. @param afCoefficients The array of filter coefficients. */ public FIR(float[] afCoefficients) { m_nLength = afCoefficients.length; m_afCoefficients = new float[m_nLength]; System.arraycopy(afCoefficients, 0, m_afCoefficients, 0, m_nLength); m_afBuffer = new float[m_nLength]; m_nBufferIndex = 0; } /** Process an input sample and calculate an output sample. Call this method to use the filter. */ public float process(float fInput) { m_nBufferIndex = (m_nBufferIndex + 1) % m_nLength; m_afBuffer[m_nBufferIndex] = fInput; int nBufferIndex = m_nBufferIndex; float fOutput = 0.0F; for (int i = 0; i < m_nLength; i++) { fOutput += m_afCoefficients[i] * m_afBuffer[nBufferIndex]; nBufferIndex--; if (nBufferIndex < 0) { nBufferIndex += m_nLength; } } return fOutput; } /** Returns the length of the filter. This returns the length of the filter (the number of coefficients). Note that this is not the same as the order of the filter. Commonly, the 'order' of a FIR filter is said to be the number of coefficients minus 1: Since a single coefficient is only an amplifier/attenuator, this is considered order zero. @return The length of the filter (the number of coefficients). */ private int getLength() { return m_nLength; } /** Get the frequency response of the filter at a specified frequency. This method calculates the frequency response of the filter for a specified frequency. Calling this method is allowed at any time, even while the filter is operating. It does not affect the operation of the filter. @param dOmega The frequency for which the frequency response should be calculated. Has to be given as omega values ([-PI .. +PI]). @return The calculated frequency response. */ public double getFrequencyResponse(double dOmega) { double dReal = 0.0; double dImag = 0.0; for (int i = 0; i < getLength(); i++) { dReal += m_afCoefficients[i] * Math.cos(i * dOmega); dImag += m_afCoefficients[i] * Math.sin(i * dOmega); } double dResult = Math.sqrt(dReal * dReal + dImag * dImag); return dResult; } /** Get the phase response of the filter at a specified frequency. This method calculates the phase response of the filter for a specified frequency. Calling this method is allowed at any time, even while the filter is operating. It does not affect the operation of the filter. @param dOmega The frequency for which the phase response should be calculated. Has to be given as omega values ([-PI .. +PI]). @return The calculated phase response. */ public double getPhaseResponse(double dOmega) { double dReal = 0.0; double dImag = 0.0; for (int i = 0; i < getLength(); i++) { dReal += m_afCoefficients[i] * Math.cos(i * dOmega); dImag += m_afCoefficients[i] * Math.sin(i * dOmega); } double dResult = Math.atan2(dImag, dReal); return dResult; } } /*** FIR.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/lowlevel/dsp/Filter.java0000644000175000017500000000464410150707541026636 0ustar twernertwerner/* * Filter.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2002 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.lowlevel.dsp; /** Common interface for all types of filters. This is intended for filters that consume samples the same rate they output them. Examples of such filters are common FIR and IIR filters. */ public interface Filter { /** Process one sample through the filter. Input and output samples are normally in the range [-1.0 .. +1.0]. */ public float process(float fSample); /** Get the frequency response of the filter at a specified frequency. This method calculates the frequency response of the filter for a specified frequency. Calling this method is allowed at any time, even while the filter is operating. It does not affect the operation of the filter. @param dOmega The frequency for which the frequency response should be calculated. Has to be given as omega values ([-PI .. +PI]). @return The calculated frequency response. */ public double getFrequencyResponse(double dOmega); /** Get the phase response of the filter at a specified frequency. This method calculates the phase response of the filter for a specified frequency. Calling this method is allowed at any time, even while the filter is operating. It does not affect the operation of the filter. @param dOmega The frequency for which the phase response should be calculated. Has to be given as omega values ([-PI .. +PI]). @return The calculated phase response. */ public double getPhaseResponse(double dOmega); } /*** Filter.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/lowlevel/dsp/FilterDesign.java0000644000175000017500000001531610374142163027767 0ustar twernertwerner/* * FilterDesign.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2002 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.lowlevel.dsp; import org.tritonus.share.TDebug; /** Several methods to design digital filters. This is a design method for FIR filters. */ public class FilterDesign { public static final int WINDOW_UNKNOWN = -1; public static final int WINDOW_RECTANGULAR = 0; public static final int WINDOW_HAMMING = 1; private static final Window[] WINDOWS = { new RectangularWindow(), new HammingWindow(), }; private static final boolean DEBUG = false; /** Filter design by frequency sampling. This is a design method for FIR filters. It allows to design filters with arbitrary frequency response. */ public static double[] designFrequencySampling(double[] adFrequencyResponse) { int nHalfLength = adFrequencyResponse.length; int nFullLength = nHalfLength * 2; Complex[] aFrequencyResponse = new Complex[nFullLength]; //double dScaleFactor = (double) (nFullLength - 1) / (double) nFullLength; for (int k = 0; k < nHalfLength; k++) { //double dPhase = -Math.PI * k * dScaleFactor; } // TODO: middle point has to be 0 // TOO: check loop bounds for (int k = nHalfLength; k < nFullLength; k++) { //double dPhase = Math.PI - Math.PI * k * dScaleFactor; } Complex[] aComplexCoefficients = Util.IDFT(aFrequencyResponse); double[] aRealCoefficients = new double[nFullLength]; for (int i = 0; i < nFullLength; i++) { aRealCoefficients[i] = aComplexCoefficients[i].real(); if (DEBUG) { TDebug.out("FilterDesign.designFrequencySampling(): coefficient, imaginary part: " + aComplexCoefficients[i].imag()); } } return aRealCoefficients; } /////////////////////////////////////////////////// // // Rectangular Window methods // /////////////////////////////////////////////////// /** nOrder should be odd. */ public static double[] designRectangularLowPass(int nOrder, double dCornerOmega) { double[] adH = new double[nOrder]; int nMiddle = nOrder / 2; for (int n = 0; n < nOrder; n++) { adH[n] = Math.sin(dCornerOmega * (n - nMiddle)) / (Math.PI * (n - nMiddle)); } return adH; } /** nOrder should be odd. */ public static double[] designRectangularHighPass(int nOrder, double dCornerOmega) { double[] adH = new double[nOrder]; int nMiddle = nOrder / 2; for (int n = 0; n < nOrder; n++) { adH[n] = 1.0 - Math.sin(dCornerOmega * (n - nMiddle)) / (Math.PI * (n - nMiddle)); } return adH; } /** nOrder should be odd. o1 < o2 required */ public static double[] designRectangularBandPass(int nOrder, double dCornerOmega1, double dCornerOmega2) { double[] adH = new double[nOrder]; int nMiddle = nOrder / 2; for (int n = 0; n < nOrder; n++) { adH[n] = (Math.sin(dCornerOmega2 * (n - nMiddle)) - Math.sin(dCornerOmega1 * (n - nMiddle))) / (Math.PI * (n - nMiddle)); } return adH; } /** nOrder should be odd. */ public static double[] designRectangularBandStop(int nOrder, double dCornerOmega1, double dCornerOmega2) { double[] adH = new double[nOrder]; int nMiddle = nOrder / 2; for (int n = 0; n < nOrder; n++) { adH[n] = 1.0 - (Math.sin(dCornerOmega2 * (n - nMiddle)) - Math.sin(dCornerOmega1 * (n - nMiddle))) / (Math.PI * (n - nMiddle)); } return adH; } /////////////////////////////////////////////////// // // Window methods // /////////////////////////////////////////////////// public static double[] designWindowLowPass(int nOrder, double dCornerOmega, int nWindow) { Window window = WINDOWS[nWindow]; return designWindowLowPass(nOrder, dCornerOmega, window); } public static double[] designWindowHighPass(int nOrder, double dCornerOmega, int nWindow) { Window window = WINDOWS[nWindow]; return designWindowHighPass(nOrder, dCornerOmega, window); } public static double[] designWindowBandPass(int nOrder, double dCornerOmega1, double dCornerOmega2, int nWindow) { Window window = WINDOWS[nWindow]; return designWindowBandPass(nOrder, dCornerOmega1, dCornerOmega2, window); } public static double[] designWindowBandStop(int nOrder, double dCornerOmega1, double dCornerOmega2, int nWindow) { Window window = WINDOWS[nWindow]; return designWindowBandStop(nOrder, dCornerOmega1, dCornerOmega2, window); } public static double[] designWindowLowPass(int nOrder, double dCornerOmega, Window window) { double[] adRectangular = designRectangularLowPass(nOrder, dCornerOmega); double[] adWindow = window.getWindow(nOrder); double[] adH = Util.multiply(adRectangular, adWindow); return adH; } public static double[] designWindowHighPass(int nOrder, double dCornerOmega, Window window) { double[] adRectangular = designRectangularHighPass( nOrder, dCornerOmega); double[] adWindow = window.getWindow(nOrder); double[] adH = Util.multiply(adRectangular, adWindow); return adH; } public static double[] designWindowBandPass(int nOrder, double dCornerOmega1, double dCornerOmega2, Window window) { double[] adRectangular = designRectangularBandPass( nOrder, dCornerOmega1, dCornerOmega2); double[] adWindow = window.getWindow(nOrder); double[] adH = Util.multiply(adRectangular, adWindow); return adH; } public static double[] designWindowBandStop(int nOrder, double dCornerOmega1, double dCornerOmega2, Window window) { double[] adRectangular = designRectangularBandStop( nOrder, dCornerOmega1, dCornerOmega2); double[] adWindow = window.getWindow(nOrder); double[] adH = Util.multiply(adRectangular, adWindow); return adH; } } /*** FilterDesign.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/lowlevel/dsp/HammingWindow.java0000644000175000017500000000274610150707541030162 0ustar twernertwerner/* * HammingWindow.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2002 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.lowlevel.dsp; /** An implementation of the Hamming window. */ public class HammingWindow implements Window { /** Get an array containing the window coefficients. @param nOrder The number of elements that the returned array should have. */ public double[] getWindow(int nOrder) { double[] adWindow = new double[nOrder]; for (int n = 0; n < nOrder; n++) { adWindow[n] = 0.54 - 0.46 * Math.cos((2.0 * Math.PI * n) / (nOrder - 1)); } return adWindow; } } /*** HammingWindow.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/lowlevel/dsp/KaiserWindow.java0000644000175000017500000000351310150707541030011 0ustar twernertwerner/* * KaiserWindow.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2002 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.lowlevel.dsp; /** An implementation of the Kaiser window. */ public class KaiserWindow implements Window { /** The alpha parameter of the Kaiser window. */ private double m_dAlpha; /** Constructor taking alpha. @param dAlpha The alpha parameter of the Kaiser window. */ public KaiserWindow(double dAlpha) { m_dAlpha = dAlpha; } /** Returns alpha. @return alpha. */ public double getAlpha() { return m_dAlpha; } /** Get an array containing the window coefficients. @param nOrder The number of elements that the returned array should have. */ public double[] getWindow(int nOrder) { double[] adWindow = new double[nOrder]; for (int n = 0; n < nOrder; n++) { adWindow[n] = Util.I0(getAlpha() * Math.sqrt(n * (2.0 * nOrder - n)) / nOrder) / Util.I0(getAlpha()); } return adWindow; } } /*** KaiserWindow.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/lowlevel/dsp/PinkNoise.java0000644000175000017500000000533610150707541027307 0ustar twernertwerner/* * PinkNoise.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2002 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.lowlevel.dsp; import java.util.Random; // for 44.1 kHz only !!!! /* [0.05 dB ripple:] b0 = 0.99886 * b0 + white * 0.0555179; b1 = 0.99332 * b1 + white * 0.0750759; b2 = 0.96900 * b2 + white * 0.1538520; b3 = 0.86650 * b3 + white * 0.3104856; b4 = 0.55000 * b4 + white * 0.5329522; b5 = -0.7616 * b5 - white * 0.0168980; pink = b0 + b1 + b2 + b3 + b4 + b5 + b6 + white * 0.5362; b6 = white * 0.115926; An 'economy' version with accuracy of +/-0.5dB is also available. b0 = 0.99765 * b0 + white * 0.0990460; b1 = 0.96300 * b1 + white * 0.2965164; b2 = 0.57000 * b2 + white * 1.0526913; pink = b0 + b1 + b2 + white * 0.1848; --- paul.kellett@maxim.abel.co.uk http://www.abel.co.uk/~maxim/ */ public class PinkNoise implements Source { private static final boolean DEBUG = false; private Source m_whiteNoiseSource; private float m_b0, m_b1, m_b2, m_b3, m_b4, m_b5, m_b6; public PinkNoise(float fSampleRate) { this(fSampleRate, new WhiteNoise()); } public PinkNoise(float fSampleRate, Random random) { this(fSampleRate, new WhiteNoise(random)); } private PinkNoise(float fSampleRate, Source whiteNoiseSource) { // TODO: scale filter for sample rate m_whiteNoiseSource = whiteNoiseSource; } public float process() { float fWhite = m_whiteNoiseSource.process(); m_b0 = 0.99886F * m_b0 + fWhite * 0.0555179F; m_b1 = 0.99332F * m_b1 + fWhite * 0.0750759F; m_b2 = 0.96900F * m_b2 + fWhite * 0.1538520F; m_b3 = 0.86650F * m_b3 + fWhite * 0.3104856F; m_b4 = 0.55000F * m_b4 + fWhite * 0.5329522F; m_b5 = -0.7616F * m_b5 - fWhite * 0.0168980F; float fPink = m_b0 + m_b1 + m_b2 + m_b3 + m_b4 + m_b5 + m_b6 + fWhite * 0.5362F; m_b6 = fWhite * 0.115926F; return fPink; } } /*** PinkNoise.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/lowlevel/dsp/RectangularWindow.java0000644000175000017500000000267710150707541031054 0ustar twernertwerner/* * RectangularWindow.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2002 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.lowlevel.dsp; /** An implementation of the Rectangular window. */ public class RectangularWindow implements Window { /** Get an array containing the window coefficients. @param nOrder The number of elements that the returned array should have. */ public double[] getWindow(int nOrder) { double[] adWindow = new double[nOrder]; for (int n = 0; n < nOrder; n++) { adWindow[n] = 1.0; } return adWindow; } } /*** RectangularWindow.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/lowlevel/dsp/Sfun.java0000644000175000017500000005446110150423457026327 0ustar twernertwerner/* * ------------------------------------------------------------------------- * $Id: Sfun.java,v 1.2 2004/11/22 17:51:43 pfisterer Exp $ * ------------------------------------------------------------------------- * Copyright (c) 1997 - 1998 by Visual Numerics, Inc. All rights reserved. * * Permission to use, copy, modify, and distribute this software is freely * granted by Visual Numerics, Inc., provided that the copyright notice * above and the following warranty disclaimer are preserved in human * readable form. * * Because this software is licenses free of charge, it is provided * "AS IS", with NO WARRANTY. TO THE EXTENT PERMITTED BY LAW, VNI * DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED * TO ITS PERFORMANCE, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. * VNI WILL NOT BE LIABLE FOR ANY DAMAGES WHATSOEVER ARISING OUT OF THE USE * OF OR INABILITY TO USE THIS SOFTWARE, INCLUDING BUT NOT LIMITED TO DIRECT, * INDIRECT, SPECIAL, CONSEQUENTIAL, PUNITIVE, AND EXEMPLARY DAMAGES, EVEN * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. * * ------------------------------------------------------------------------- */ package org.tritonus.lowlevel.dsp; /** * Collection of special functions. */ public class Sfun { /** The smallest relative spacing for doubles.*/ public final static double EPSILON_SMALL = 1.1102230246252e-16; /** The largest relative spacing for doubles. */ public final static double EPSILON_LARGE = 2.2204460492503e-16; /** * Private contructor, so nobody can make an instance of this class. */ private Sfun() { } /* * Evaluate a Chebyschev series */ static double csevl(double x, double coef[]) { double b0, b1, b2, twox; int i; b1 = 0.0; b0 = 0.0; b2 = 0.0; twox = 2.0*x; for (i = coef.length-1; i >= 0; i--) { b2 = b1; b1 = b0; b0 = twox*b1 - b2 + coef[i]; } return 0.5*(b0-b2); } // Series on [0,0.0625] private static final double COT_COEF[] = { .240259160982956302509553617744970e+0, -.165330316015002278454746025255758e-1, -.429983919317240189356476228239895e-4, -.159283223327541046023490851122445e-6, -.619109313512934872588620579343187e-9, -.243019741507264604331702590579575e-11, -.956093675880008098427062083100000e-14, -.376353798194580580416291539706666e-16, -.148166574646746578852176794666666e-18 }; /** * Returns the cotangent of a double. * @param x A double value. * @return The cotangent of x. * If x is NaN, the result is NaN. */ static public double cot(double x) { double ans, ainty, ainty2, prodbg, y, yrem; double pi2rec = 0.011619772367581343075535053490057; // 2/PI - 0.625 y = Math.abs(x); if (y > 4.5036e+15) { // 4.5036e+15 = 1.0/EPSILON_LARGE return Double.NaN; } // Carefully compute // Y * (2/PI) = (AINT(Y) + REM(Y)) * (.625 + PI2REC) // = AINT(.625*Y) + REM(.625*Y) + Y*PI2REC = AINT(.625*Y) + Z // = AINT(.625*Y) + AINT(Z) + REM(Z) ainty = (int)y; yrem = y - ainty; prodbg = 0.625*ainty; ainty = (int)prodbg; y = (prodbg-ainty) + 0.625*yrem + y*pi2rec; ainty2 = (int)y; ainty = ainty + ainty2; y = y - ainty2; int ifn = (int)(ainty%2.0); if (ifn == 1) y = 1.0 - y; if (y == 0.0) { ans = Double.POSITIVE_INFINITY; } else if (y <= 1.82501e-08) { // 1.82501e-08 = Math.sqrt(3.0*EPSILON_SMALL) ans = 1.0/y; } else if (y <= 0.25) { ans = (0.5+csevl(32.0*y*y-1.0,COT_COEF))/y; } else if (y <= 0.5) { ans = (0.5+csevl(8.0*y*y-1.0,COT_COEF))/(0.5*y); ans = (ans*ans-1.0)*0.5/ans; } else { ans = (0.5+csevl(2.0*y*y-1.0,COT_COEF))/(0.25*y); ans = (ans*ans-1.0)*0.5/ans; ans = (ans*ans-1.0)*0.5/ans; } if (x != 0.0) ans = sign(ans,x); if (ifn == 1) ans = -ans; return ans; } /** * Returns the common (base 10) logarithm of a double. * @param x A double value. * @return The common logarithm of x. */ static public double log10(double x) { //if (Double.isNaN(x)) return Double.NaN; return 0.43429448190325182765*Math.log(x); } /* * Returns the value of x with the sign of y. */ static private double sign(double x, double y) { double abs_x = ((x < 0) ? -x : x); return (y < 0.0) ? -abs_x : abs_x; } // Series on the interval [0,1] private static final double SINH_COEF[] = { 0.1730421940471796, 0.08759422192276048, 0.00107947777456713, 0.00000637484926075, 0.00000002202366404, 0.00000000004987940, 0.00000000000007973, 0.00000000000000009}; /** * Returns the inverse (arc) hyperbolic sine of a double. * @param x A double value. * @return The arc hyperbolic sine of x. * If x is NaN or less than one, the result is NaN. */ static public double sinh(double x) { double ans; double y = Math.abs(x); if (Double.isNaN(x)) { ans = Double.NaN; } else if (Double.isInfinite(y)) { return x; } else if (y < 2.58096e-08) { // 2.58096e-08 = Math.sqrt(6.0*EPSILON_SMALL) ans = x; } else if (y <= 1.0) { ans = x*(1.0+csevl(2.0*x*x-1.0,SINH_COEF)); } else { y = Math.exp(y); if (y >= 94906265.62) { // 94906265.62 = 1.0/Math.sqrt(EPSILON_SMALL) ans = sign(0.5*y,x); } else { ans = sign(0.5*(y-1.0/y),x); } } return ans; } /** * Returns the hyperbolic cosine of a double. * @param x A double value. * @return The hyperbolic cosine of x. * If x is NaN, the result is NaN. */ static public double cosh(double x) { double ans; double y = Math.exp(Math.abs(x)); if (Double.isNaN(x)) { ans = Double.NaN; } else if (Double.isInfinite(x)) { ans = x; } else if (y < 94906265.62) { // 94906265.62 = 1.0/Math.sqrt(EPSILON_SMALL) ans = 0.5*(y+1.0/y); } else { ans = 0.5*y; } return ans; } // Series on [0,1] private static final double TANH_COEF[] = { -.25828756643634710, -.11836106330053497, .009869442648006398, -.000835798662344582, .000070904321198943, -.000006016424318120, .000000510524190800, -.000000043320729077, .000000003675999055, -.000000000311928496, .000000000026468828, -.000000000002246023, .000000000000190587, -.000000000000016172, .000000000000001372, -.000000000000000116, .000000000000000009}; /** * Returns the hyperbolic tangent of a double. * @param x A double value. * @return The hyperbolic tangent of x. */ static public double tanh(double x) { double ans, y; y = Math.abs(x); if (Double.isNaN(x)) { ans = Double.NaN; } else if (y < 1.82501e-08) { // 1.82501e-08 = Math.sqrt(3.0*EPSILON_SMALL) ans = x; } else if (y <= 1.0) { ans = x*(1.0+csevl(2.0*x*x-1.0,TANH_COEF)); } else if (y < 7.977294885) { // 7.977294885 = -0.5*Math.log(EPSILON_SMALL) y = Math.exp(y); ans = sign((y-1.0/y)/(y+1.0/y),x); } else { ans = sign(1.0,x); } return ans; } // Series on the interval [0,1] private static final double ASINH_COEF[] = { -.12820039911738186343372127359268e+0, -.58811761189951767565211757138362e-1, .47274654322124815640725249756029e-2, -.49383631626536172101360174790273e-3, .58506207058557412287494835259321e-4, -.74669983289313681354755069217188e-5, .10011693583558199265966192015812e-5, -.13903543858708333608616472258886e-6, .19823169483172793547317360237148e-7, -.28847468417848843612747272800317e-8, .42672965467159937953457514995907e-9, -.63976084654366357868752632309681e-10, .96991686089064704147878293131179e-11, -.14844276972043770830246658365696e-11, .22903737939027447988040184378983e-12, -.35588395132732645159978942651310e-13, .55639694080056789953374539088554e-14, -.87462509599624678045666593520162e-15, .13815248844526692155868802298129e-15, -.21916688282900363984955142264149e-16, .34904658524827565638313923706880e-17 }; /** * Returns the inverse (arc) hyperbolic sine of a double. * @param x A double value. * @return The arc hyperbolic sine of x. * If x is NaN, the result is NaN. */ static public double asinh(double x) { double ans; double y = Math.abs(x); if (Double.isNaN(x)) { ans = Double.NaN; } else if (y <= 1.05367e-08) { // 1.05367e-08 = Math.sqrt(EPSILON_SMALL) ans = x; } else if (y <= 1.0) { ans = x*(1.0+csevl(2.0*x*x-1.0,ASINH_COEF)); } else if (y < 94906265.62) { // 94906265.62 = 1/Math.sqrt(EPSILON_SMALL) ans = Math.log(y+Math.sqrt(y*y+1.0)); } else { ans = 0.69314718055994530941723212145818 + Math.log(y); } if (x < 0.0) ans = -ans; return ans; } /** * Returns the inverse (arc) hyperbolic cosine of a double. * @param x A double value. * @return The arc hyperbolic cosine of x. * If x is NaN or less than one, the result is NaN. */ static public double acosh(double x) { double ans; if (Double.isNaN(x) || x < 1) { ans = Double.NaN; } else if (x < 94906265.62) { // 94906265.62 = 1.0/Math.sqrt(EPSILON_SMALL) ans = Math.log(x+Math.sqrt(x*x-1.0)); } else { ans = 0.69314718055994530941723212145818 + Math.log(x); } return ans; } // Series on the interval [0,0.25] private static final double ATANH_COEF[] = { .9439510239319549230842892218633e-1, .4919843705578615947200034576668e-1, .2102593522455432763479327331752e-2, .1073554449776116584640731045276e-3, .5978267249293031478642787517872e-5, .3505062030889134845966834886200e-6, .2126374343765340350896219314431e-7, .1321694535715527192129801723055e-8, .8365875501178070364623604052959e-10, .5370503749311002163881434587772e-11, .3486659470157107922971245784290e-12, .2284549509603433015524024119722e-13, .1508407105944793044874229067558e-14, .1002418816804109126136995722837e-15, .6698674738165069539715526882986e-17, .4497954546494931083083327624533e-18 }; /** * Returns the inverse (arc) hyperbolic tangent of a double. * @param x A double value. * @return The arc hyperbolic tangent of x. * If x is NaN or |x|>1, the result is NaN. */ static public double atanh(double x) { double y = Math.abs(x); double ans; if (Double.isNaN(x)) { ans = Double.NaN; } else if (y < 1.82501e-08) { // 1.82501e-08 = Math.sqrt(3.0*EPSILON_SMALL) ans = x; } else if (y <= 0.5) { ans = x*(1.0+csevl(8.0*x*x-1.0,ATANH_COEF)); } else if (y < 1.0) { ans = 0.5*Math.log((1.0+x)/(1.0-x)); } else if (y == 1.0) { ans = x*Double.POSITIVE_INFINITY; } else { ans = Double.NaN; } return ans; } /** * Returns the factorial of an integer. * @param n An integer value. * @return The factorial of n, n!. * If x is negative, the result is NaN. */ static public double fact(int n) { double ans = 1; if (Double.isNaN(n) || n < 0) { ans = Double.NaN; } else if (n > 170) { // The 171! is too large to fit in a double. ans = Double.POSITIVE_INFINITY; } else { for (int k = 2; k <= n; k++) ans *= k; } return ans; } // Series on the interval [0,1] private static final double GAMMA_COEF[] = { .8571195590989331421920062399942e-2, .4415381324841006757191315771652e-2, .5685043681599363378632664588789e-1, -.4219835396418560501012500186624e-2, .1326808181212460220584006796352e-2, -.1893024529798880432523947023886e-3, .3606925327441245256578082217225e-4, -.6056761904460864218485548290365e-5, .1055829546302283344731823509093e-5, -.1811967365542384048291855891166e-6, .3117724964715322277790254593169e-7, -.5354219639019687140874081024347e-8, .9193275519859588946887786825940e-9, -.1577941280288339761767423273953e-9, .2707980622934954543266540433089e-10, -.4646818653825730144081661058933e-11, .7973350192007419656460767175359e-12, -.1368078209830916025799499172309e-12, .2347319486563800657233471771688e-13, -.4027432614949066932766570534699e-14, .6910051747372100912138336975257e-15, -.1185584500221992907052387126192e-15, .2034148542496373955201026051932e-16, -.3490054341717405849274012949108e-17, .5987993856485305567135051066026e-18, -.1027378057872228074490069778431e-18 }; /** * Returns the Gamma function of a double. * @param x A double value. * @return The Gamma function of x. * If x is a negative integer, the result is NaN. */ static public double gamma(double x) { double ans; double y = Math.abs(x); if (y <= 10.0) { /* * Compute gamma(x) for |x|<=10. * First reduce the interval and find gamma(1+y) for 0 <= y < 1. */ int n = (int)x; if (x < 0.0) n--; y = x - n; n--; ans = 0.9375 + csevl(2.0*y-1.0, GAMMA_COEF); if (n == 0) { } else if (n < 0) { // Compute gamma(x) for x < 1 n = -n; if (x == 0.0) { ans = Double.NaN; } else if (y < 1.0/Double.MAX_VALUE) { ans = Double.POSITIVE_INFINITY; } else { double xn = n - 2; if (x < 0.0 && x + xn == 0.0) { ans = Double.NaN; } else { for (int i = 0; i < n; i++) { ans /= x + i; } } } } else { // gamma(x) for x >= 2.0 for (int i = 1; i <= n; i++) { ans *= y + i; } } } else { // gamma(x) for |x| > 10 if (x > 171.614) { ans = Double.POSITIVE_INFINITY; } else if (x < -170.56) { ans = 0.0; // underflows } else { // 0.9189385332046727 = 0.5*log(2*PI) ans = Math.exp((y-0.5)*Math.log(y)-y+0.9189385332046727+r9lgmc(y)); if (x < 0.0) { double sinpiy = Math.sin(Math.PI * y); if (sinpiy == 0 || Math.round(y) == y) { ans = Double.NaN; } else { ans = -Math.PI / (y * sinpiy * ans); } } } } return ans; } /** * Returns the logarithm of the Gamma function of a double. * @param x A double value. * @return The natural logarithm of the Gamma function of x. * If x is a negative integer, the result is NaN. */ static public double logGamma(double x) { double ans, sinpiy, y; y = Math.abs(x); if (y <= 10) { ans = Math.log(Math.abs(gamma(x))); } else if (x > 0) { // A&S 6.1.40 // 0.9189385332046727 = 0.5*log(2*PI) ans = 0.9189385332046727 + (x-0.5)*Math.log(x) - x + r9lgmc(y); } else { sinpiy = Math.abs(Math.sin(Math.PI * y)); if (sinpiy == 0 || Math.round(y) == y) { // The argument for the function can not be a negative integer. ans = Double.NaN; } else { ans = 0.22579135264472743236 + (x-0.5)*Math.log(y) - x - Math.log(sinpiy) - r9lgmc(y); } } return ans; } // Series for the interval [0,0.01] private static final double R9LGMC_COEF[] = { .166638948045186324720572965082e0, -.138494817606756384073298605914e-4, .981082564692472942615717154749e-8, -.180912947557249419426330626672e-10, .622109804189260522712601554342e-13, -.339961500541772194430333059967e-15, .268318199848269874895753884667e-17 }; /* * Returns the log gamma correction term for argument * values greater than or equal to 10.0. */ static double r9lgmc(double x) { double ans; if (x < 10.0) { ans = Double.NaN; } else if (x < 9.490626562e+07) { // 9.490626562e+07 = 1/Math.sqrt(EPSILON_SMALL) double y = 10.0/x; ans = csevl(2.0*y*y-1.0, R9LGMC_COEF) / x; } else if (x < 1.39118e+11) { // 1.39118e+11 = exp(min(log(amach(2) / 12.0), -log(12.0 * amach(1)))); // See A&S 6.1.41 ans = 1.0/(12.0*x); } else { ans = 0.0; // underflows } return ans; } /** * Returns the logarithm of the Beta function. * @param a A double value. * @param b A double value. * @return The natural logarithm of the Beta function. */ static public double logBeta(double a, double b) { double corr, ans; double p = Math.min(a, b); double q = Math.max(a, b); if (p <= 0.0) { ans = Double.NaN; } else if (p >= 10.0) { // P and Q are large; corr = r9lgmc(p) + r9lgmc(q) - r9lgmc(p+q); double temp = dlnrel(-p/(p+q)); ans = -0.5*Math.log(q) + 0.918938533204672741780329736406 + corr + (p-0.5)*Math.log(p/(p+q)) + q*temp; } else if (q >= 10.0) { // P is small, but Q is large corr = Sfun.r9lgmc(q) - r9lgmc(p+q); // Check from underflow from r9lgmc ans = logGamma(p) + corr + p - p*Math.log(p+q) + (q-0.5)*dlnrel(-p/(p+q)); } else { // P and Q are small; ans = Math.log(gamma(p)*(gamma(q)/gamma(p+q))); } return ans; } // Series on [-0.375,0.375] final private static double ALNRCS_COEF[] = { .103786935627437698006862677191e1, -.133643015049089180987660415531, .194082491355205633579261993748e-1, -.301075511275357776903765377766e-2, .486946147971548500904563665091e-3, -.810548818931753560668099430086e-4, .137788477995595247829382514961e-4, -.238022108943589702513699929149e-5, .41640416213865183476391859902e-6, -.73595828378075994984266837032e-7, .13117611876241674949152294345e-7, -.235467093177424251366960923302e-8, .425227732760349977756380529626e-9, -.771908941348407968261081074933e-10, .140757464813590699092153564722e-10, -.257690720580246806275370786276e-11, .473424066662944218491543950059e-12, -.872490126747426417453012632927e-13, .161246149027405514657398331191e-13, -.298756520156657730067107924168e-14, .554807012090828879830413216973e-15, -.103246191582715695951413339619e-15, .192502392030498511778785032449e-16, -.359550734652651500111897078443e-17, .672645425378768578921945742268e-18, -.126026241687352192520824256376e-18 }; /* * Correction term used by logBeta. */ private static double dlnrel(double x) { double ans; if (x <= -1.0) { ans = Double.NaN; } else if (Math.abs(x) <= 0.375) { ans = x*(1.0 - x*Sfun.csevl(x/.375, ALNRCS_COEF)); } else { ans = Math.log(1.0 + x); } return ans; } // Series on [0,1] private static final double ERFC_COEF[] = { -.490461212346918080399845440334e-1, -.142261205103713642378247418996e0, .100355821875997955757546767129e-1, -.576876469976748476508270255092e-3, .274199312521960610344221607915e-4, -.110431755073445076041353812959e-5, .384887554203450369499613114982e-7, -.118085825338754669696317518016e-8, .323342158260509096464029309534e-10, -.799101594700454875816073747086e-12, .179907251139614556119672454866e-13, -.371863548781869263823168282095e-15, .710359900371425297116899083947e-17, -.126124551191552258324954248533e-18 }; // Series on [0.25,1.00] private static final double ERFC2_COEF[] = { -.69601346602309501127391508262e-1, -.411013393626208934898221208467e-1, .391449586668962688156114370524e-2, -.490639565054897916128093545077e-3, .715747900137703638076089414183e-4, -.115307163413123283380823284791e-4, .199467059020199763505231486771e-5, -.364266647159922287393611843071e-6, .694437261000501258993127721463e-7, -.137122090210436601953460514121e-7, .278838966100713713196386034809e-8, -.581416472433116155186479105032e-9, .123892049175275318118016881795e-9, -.269063914530674343239042493789e-10, .594261435084791098244470968384e-11, -.133238673575811957928775442057e-11, .30280468061771320171736972433e-12, -.696664881494103258879586758895e-13, .162085454105392296981289322763e-13, -.380993446525049199987691305773e-14, .904048781597883114936897101298e-15, -.2164006195089607347809812047e-15, .522210223399585498460798024417e-16, -.126972960236455533637241552778e-16, .310914550427619758383622741295e-17, -.766376292032038552400956671481e-18, .190081925136274520253692973329e-18 }; // Series on [0,0.25] private static final double ERFCC_COEF[] = { .715179310202924774503697709496e-1, -.265324343376067157558893386681e-1, .171115397792085588332699194606e-2, -.163751663458517884163746404749e-3, .198712935005520364995974806758e-4, -.284371241276655508750175183152e-5, .460616130896313036969379968464e-6, -.822775302587920842057766536366e-7, .159214187277090112989358340826e-7, -.329507136225284321486631665072e-8, .72234397604005554658126115389e-9, -.166485581339872959344695966886e-9, .401039258823766482077671768814e-10, -.100481621442573113272170176283e-10, .260827591330033380859341009439e-11, -.699111056040402486557697812476e-12, .192949233326170708624205749803e-12, -.547013118875433106490125085271e-13, .158966330976269744839084032762e-13, -.47268939801975548392036958429e-14, .14358733767849847867287399784e-14, -.444951056181735839417250062829e-15, .140481088476823343737305537466e-15, -.451381838776421089625963281623e-16, .147452154104513307787018713262e-16, -.489262140694577615436841552532e-17, .164761214141064673895301522827e-17, -.562681717632940809299928521323e-18, .194744338223207851429197867821e-18 }; /** * Returns the error function of a double. * @param x A double value. * @return The error function of x. */ static public double erf(double x) { double ans; double y = Math.abs(x); if (y <= 1.49012e-08) { // 1.49012e-08 = Math.sqrt(2*EPSILON_SMALL) ans = 2 * x / 1.77245385090551602729816748334; } else if (y <= 1) { ans = x * (1 + csevl(2 * x * x - 1, ERFC_COEF)); } else if (y < 6.013687357) { // 6.013687357 = Math.sqrt(-Math.log(1.77245385090551602729816748334 * EPSILON_SMALL)) ans = sign(1 - erfc(y), x); } else { ans = sign(1, x); } return ans; } /** * Returns the complementary error function of a double. * @param x A double value. * @return The complementary error function of x. */ static public double erfc(double x) { double ans; double y = Math.abs(x); if (x <= -6.013687357) { // -6.013687357 = -Math.sqrt(-Math.log(1.77245385090551602729816748334 * EPSILON_SMALL)) ans = 2; } else if (y < 1.49012e-08) { // 1.49012e-08 = Math.sqrt(2*EPSILON_SMALL) ans = 1 - 2*x/1.77245385090551602729816748334; } else { double ysq = y*y; if (y < 1) { ans = 1 - x*(1+csevl(2*ysq-1,ERFC_COEF)); } else if (y <= 4.0) { ans = Math.exp(-ysq)/y*(0.5+csevl((8.0/ysq-5.0)/3.0,ERFC2_COEF)); if (x < 0) ans = 2.0 - ans;if (x < 0) ans = 2.0 - ans; if (x < 0) ans = 2.0 - ans; } else { ans = Math.exp(-ysq)/y*(0.5+csevl(8.0/ysq-1,ERFCC_COEF)); if (x < 0) ans = 2.0 - ans; } } return ans; } } libtritonus-java-20070428/src/classes/org/tritonus/lowlevel/dsp/Source.java0000644000175000017500000000244410150707541026645 0ustar twernertwerner/* * Source.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2002 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.lowlevel.dsp; /** Common interface for all types of audio data sources. Examples of such sources are noise generators and waveform generators. */ public interface Source { /** Returns one sample of the source. Samples are normally in the range [-1.0 .. +1.0]. */ public float process(); } /*** Source.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/lowlevel/dsp/Util.java0000644000175000017500000001133110150707541026315 0ustar twernertwerner/* * Util.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2002 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.lowlevel.dsp; /** Helper methods used for filter design. */ public class Util { /** Modified Bessel function of first kind and 0th order. */ public static double I0(double x) { double eps = 10E-9; int n = 1; double S = 1.0; double D = 1.0; while (D > eps * S) { double T = x / (2.0 * n); n++; D *= (T * T); S += D; } return S; } /** Compute an inverse discrete fourier transform (IDFT). This implementation works fully complex. It is not optimized for speed. I.e., it does not use a 'fast' algorithm. @param aFrequencyDomain The array containing the frequency domain factors. @return The reconstructed time domain values (returned as complex numbers for full generality). */ public static Complex[] IDFT(Complex[] aFrequencyDomain) { int N = aFrequencyDomain.length; Complex[] aTimeDomain = new Complex[N]; double dOneOverN = 1.0 / N; for (int n = 0; n < N; n++) { aTimeDomain[n] = new Complex(0.0, 0.0); for (int k = 0; k < N; k++) { Complex exponent = new Complex(0.0, 2.0 * Math.PI * k * n * dOneOverN); Complex term = Complex.times(aFrequencyDomain[k], Complex.exp(exponent)); aTimeDomain[n] = Complex.plus(aTimeDomain[n], term); } aTimeDomain[n] = Complex.times(aTimeDomain[n], dOneOverN); } return aTimeDomain; } /** Multiplication of two arrays. */ public static double[] multiply(double[] ad1, double[] ad2) { int nLength = Math.min(ad1.length, ad2.length); double[] adResult = new double[nLength]; for (int i = 0; i < nLength; i++) { adResult[i] = ad1[i] * ad2[i]; } return adResult; } /** Converts frequency representation from omega to relative. This method converts a frequency represented in omega ([-PI .. +PI]) to relative (f/fs). @param dOmega The frequency represented in omega ([-PI .. +PI]). @return The frequency represented relative to the sample rate (f/fs). */ public static double omega2relative(double dOmega) { double dRelative = dOmega / (2.0 * Math.PI); return dRelative; } /** Converts frequency representation from relative to omega. This method converts a frequency represented relative to the sample rate (f/fs) to omega ([-PI .. +PI]). @param dRelative The frequency represented relative to the sample rate (f/fs). @return The frequency represented in omega ([-PI .. +PI]). */ public static double relative2omega(double dRelative) { double dOmega = dRelative * 2.0 * Math.PI; return dOmega; } /** Converts frequency representation from omega to absolute. This method converts a frequency represented in omega ([-PI .. +PI]) to absolute frequency (f). @param dOmega The frequency represented in omega ([-PI .. +PI]). @param dSampleRate The sample rate (fs). @return The absolute frequency represented in Hz (f). */ public static double omega2absolute(double dOmega, double dSampleRate) { double dAbsolute = omega2relative(dOmega) * dSampleRate; return dAbsolute; } /** Converts frequency representation from absolute to omega. This method converts a frequency represented relative to the sample rate (f/fs) to omega ([-PI .. +PI]). @param dAbsolute The absolute frequency expressed in Hz (f). @param dSampleRate The sample rate (fs). @return The frequency represented in omega ([-PI .. +PI]). */ public static double absolute2omega(double dAbsolute, double dSampleRate) { double dOmega = relative2omega(dAbsolute / dSampleRate); return dOmega; } /** Quantize constants from double to float. */ public static float[] quantizeToFloat(double[] adConstants) { float[] afConstants = new float[adConstants.length]; for (int i = 0; i < adConstants.length; i++) { afConstants[i] = (float) adConstants[i]; } return afConstants; } } /*** Util.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/lowlevel/dsp/WhiteNoise.java0000644000175000017500000000260010150707541027455 0ustar twernertwerner/* * WhiteNoise.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2002 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.lowlevel.dsp; import java.util.Random; public class WhiteNoise implements Source { private static final boolean DEBUG = false; private Random m_random; public WhiteNoise() { this(new Random()); } public WhiteNoise(Random random) { m_random = random; } public float process() { float fOutput = m_random.nextFloat() * 2.0F - 1.0F; return fOutput; } } /*** WhiteNoise.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/lowlevel/dsp/Window.java0000644000175000017500000000241210150707541026647 0ustar twernertwerner/* * Window.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2002 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.lowlevel.dsp; /** Common interface for all types of windows. */ public interface Window { /** Get an array containing the window coefficients. @param nOrder The number of elements that the returned array should have. */ public double[] getWindow(int nOrder); } /*** Window.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/lowlevel/esd/0000755000175000017500000000000010621572424024526 5ustar twernertwernerlibtritonus-java-20070428/src/classes/org/tritonus/lowlevel/esd/Esd.java0000644000175000017500000000401210172434623026100 0ustar twernertwerner/* * Esd.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999 - 2002 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.lowlevel.esd; import org.tritonus.share.TDebug; public class Esd { public static final int ESD_STREAM = 0x0000; public static final int ESD_PLAY = 0x1000; public static final int ESD_BITS8 = 0x0000; public static final int ESD_BITS16 = 0x0001; public static final int ESD_MONO = 0x0010; public static final int ESD_STEREO = 0x0020; private static boolean sm_bIsLibraryAvailable = false; static { Esd.loadNativeLibrary(); } public static void loadNativeLibrary() { if (TDebug.TraceEsdNative) { TDebug.out("Esd.loadNativeLibrary(): loading native library tritonusesd"); } try { System.loadLibrary("tritonusesd"); sm_bIsLibraryAvailable = true; } catch (Throwable t) { if (TDebug.TraceEsdNative || TDebug.TraceAllExceptions) { TDebug.out(t); } } if (TDebug.TraceEsdNative) { TDebug.out("Esd.loadNativeLibrary(): loaded"); } } /** Returns whether the libraries are installed correctly. */ public static boolean isLibraryAvailable() { return sm_bIsLibraryAvailable; } } /*** Esd.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/lowlevel/esd/EsdRecordingStream.java0000644000175000017500000000430510374160730031115 0ustar twernertwerner/* * EsdRecordingStream.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.lowlevel.esd; import org.tritonus.share.TDebug; public class EsdRecordingStream extends Esd { /** Holds socket fd to EsounD. * This field is long because on 64 bit architectures, the native * size of ints may be 64 bit. */ @SuppressWarnings("unused") private long m_lNativeHandle; static { Esd.loadNativeLibrary(); if (TDebug.TraceEsdRecordingStreamNative) { setTrace(true); } } public EsdRecordingStream() { } /** Opens the connection to esd and initiates a stream. * */ public native void open(int nFormat, int nSampleRate); /** Reads a block of data to esd. * Before using this method, you have to open a connection * to esd with open(). After being done, call close() to * release native and server-side resources. * * @return the number of bytes read */ public native int read(byte[] abData, int nOffset, int nLength); /** Closes the connection to esd. * With this call, all resources inside esd associated with * this stream are freed.??? * Calls to the read() method are no longer allowed after * return from this call. */ public native void close(); private static native void setTrace(boolean bTrace); } /*** EsdRecordingStream.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/lowlevel/esd/EsdSample.java0000644000175000017500000000627210374160730027253 0ustar twernertwerner/* * EsdSample.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.lowlevel.esd; public class EsdSample extends Esd { /** Holds socket fd to EsounD. * This variable is only used by native code. * This field is long because on 64 bit architectures, the native * size of ints may be 64 bit. */ @SuppressWarnings("unused") private long m_lNativeFd; /** Holds the sample id. * This variable is only used by native code. * This field is long because on 64 bit architectures, the native * size of ints may be 64 bit. */ @SuppressWarnings("unused") private long m_lNativeId; static { Esd.loadNativeLibrary(); } public EsdSample() { } /** Opens the connection to esd and starts uploading the sample data. * After this call, you can upload the sample data with * calls to write() (multiple calls allowed). Then you can * play or loop the sample. * To free native resources, call close() if you're done with * the sample (not after you've uploaded all data). */ public native void open(int nFormat, int nSampleRate, int nLength); // throws IOException; /** Uploads a piece of data for the sample. * You have to open a connection to esd with open() before * calling this method. Multiple calls to this (write()) * method are allowed. The data uploaded in consequtive * calls are simply concatenated. * * @return the number of bytes written */ public native int write(byte[] abData, int nOffset, int nLength); //throws IOException; /** Closes the connection to esd. * Use only if you are completely done with this sample. */ public native void close(); /** Play the sample once. */ public native void play(); /** Play the sample indefinitely. */ public native void loop(); /** Stop a looping sample at end. */ public native void stop(); /** Stop a playing sample immediately. */ public native void kill(); /** Uncache a sample from the server. * This call frees resources in the server associated with * the sample and invalidated the internal id. * Calls to play() and loop() are no longer allowed after * return from this method. */ public native void free(); /** Sets the volume for the sample. * */ public native void setVolume(int nLeftVolume, int nRightVolume); } /*** EsdSample.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/lowlevel/esd/EsdStream.java0000644000175000017500000000423510374160730027262 0ustar twernertwerner/* * EsdStream.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.lowlevel.esd; import org.tritonus.share.TDebug; public class EsdStream extends Esd { /** Holds socket fd to EsounD. * This field is long because on 64 bit architectures, the native * size of ints may be 64 bit. */ @SuppressWarnings("unused") private long m_lNativeHandle; static { Esd.loadNativeLibrary(); if (TDebug.TraceEsdStreamNative) { setTrace(true); } } public EsdStream() { } /** Opens the connection to esd and initiates a stream. * */ public native void open(int nFormat, int nSampleRate); /** Writes a block of data to esd. * Before using this method, you have to open a connection * to esd with open(). After being done, call close() to * release native and server-side resources. * * @return the number of bytes written */ public native int write(byte[] abData, int nOffset, int nLength); /** Closes the connection to esd. * With this call, all resources inside esd associated with * this stream are freed.??? * Calls to the write() method are no longer allowed after * return from this call. */ public native void close(); private static native void setTrace(boolean bTrace); } /*** EsdStream.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/lowlevel/esd/package.html0000644000175000017500000000036110172434623027006 0ustar twernertwerner

Access to the native Esound library. The classes provided here .

@see org.tritonus.sampled.mixer.esd libtritonus-java-20070428/src/classes/org/tritonus/lowlevel/gsm/0000755000175000017500000000000010621572427024544 5ustar twernertwernerlibtritonus-java-20070428/src/classes/org/tritonus/lowlevel/gsm/Add.java0000644000175000017500000001422510172434623026077 0ustar twernertwerner/* * Mathmatical methods. * Copyright (C) 1999 Christopher Edwards * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * */ package org.tritonus.lowlevel.gsm; public class Add { public static short saturate(int x) { return (short) ((x) < Gsm_Def.MIN_WORD ? Gsm_Def.MIN_WORD : (x) > Gsm_Def.MAX_WORD ? Gsm_Def.MAX_WORD: (x)); } public static short saturate(long x) { return (short) ((x) < Gsm_Def.MIN_WORD ? Gsm_Def.MIN_WORD : (x) > Gsm_Def.MAX_WORD ? Gsm_Def.MAX_WORD: (x)); } public static short SASR(int x, int by) { return (short) ((x) >> (by)); } public static short GSM_ADD(short a, short b) { /* * This converts a and b to int implicitely, because * '+' is not defined for short. */ int sum = a + b; return saturate(sum); } public static short GSM_SUB(short a, short b) { /* * This converts a and b to int implicitely, because * '-' is not defined for short. */ int diff = a - b; return saturate(diff); } public static short GSM_MULT(short a, short b) { if (a == Gsm_Def.MIN_WORD && b == Gsm_Def.MIN_WORD) { return Gsm_Def.MAX_WORD; } else { return SASR( ((int)(a)) * ((int)(b)), 15 ); } } public static short GSM_MULT_R(short a, short b) { if (a == Gsm_Def.MIN_WORD && b == Gsm_Def.MIN_WORD) { return Gsm_Def.MAX_WORD; } else { int prod = (int) (((int)(a)) * ((int)(b)) + 16384); prod >>= 15; return (short) (prod & 0xFFFF); } } public static short GSM_ABS(short a) { int b = a < 0 ? (a == Gsm_Def.MIN_WORD ? Gsm_Def.MAX_WORD : -a) : a; return ((short)(b)); } public static int GSM_L_MULT(short a, short b) throws IllegalArgumentException { if( a != Short.MIN_VALUE || b != Short.MIN_VALUE ) { throw new IllegalArgumentException( "One of the aruments must equal " + Short.MIN_VALUE); } return ((int)a * (int)b) << 1; } public static int GSM_L_ADD(int a, int b) { if (a <= 0) { if (b >= 0) { return a + b; } else { long A = (long)-(a + 1) + (long)-(b + 1); return A >= Gsm_Def.MAX_LONGWORD ? Gsm_Def.MIN_LONGWORD :-(int)A-2; } } else if (b <= 0) { return a + b; } else { long A = (long)a + (long) b; return (int)(A > Gsm_Def.MAX_LONGWORD ? Gsm_Def.MAX_LONGWORD : A); } } /* * the number of left shifts needed to normalize the 32 bit * variable L_var1 for positive values on the interval * * with minimum of * minimum of 1073741824 (01000000000000000000000000000000) and * maximum of 2147483647 (01111111111111111111111111111111) * * * and for negative values on the interval with * minimum of -2147483648 (-10000000000000000000000000000000) and * maximum of -1073741824 ( -1000000000000000000000000000000). * * in order to normalize the result, the following * operation must be done: L_norm_var1 = L_var1 << norm( L_var1 ); * * (That's 'ffs', only from the left, not the right..) */ public static short gsm_norm( int a ) throws IllegalArgumentException { if(a == 0) { throw new IllegalArgumentException ("gsm_norm: a cannot = 0."); } if (a < 0) { if (a <= -1073741824) { return 0; } a = ~a; } return (short) ( ((a & 0xffff0000) != 0) ? ( ((a & 0xff000000) != 0) ? -1 + bitoff[ (int)(0xFF & (a >> 24)) ] : 7 + bitoff[ (int)(0xFF & (a >> 16)) ] ) : ( ((a & 0xff00) != 0) ? 15 + bitoff[ (int)(0xFF & (a >> 8)) ] : 23 + bitoff[ (int)(0xFF & a) ] )); } public static short gsm_asl(short a, int n) { if (n >= 16) return ((short) 0); if (n <= -16) if(a<0) return (short) -1; else return (short) -0; if (n < 0) return gsm_asr(a, -n); return ((short)( a << n )); } public static short gsm_asr(short a, int n) { if (n >= 16) if(a<0) return (short) -1; else return (short) -0; if (n <= -16) return ((short) 0); if (n < 0) return ((short)( a << -n )); return ((short)( a >> n )); } public static short gsm_div(short num, short denum) throws IllegalArgumentException { int L_num = num; int L_denum = denum; short div = 0; int k = 15; /* The parameter num sometimes becomes zero. * Although this is explicitly guarded against in 4.2.5, * we assume that the result should then be zero as well. */ /* assert(num != 0); */ if( ! (num >= 0 && denum >= num) ) { throw new IllegalArgumentException ("gsm_div: num >= 0 && denum >= num"); } if (num == 0) return 0; while (k != 0) { k--; div <<= 1; L_num <<= 1; if (L_num >= L_denum) { L_num -= L_denum; div++; } } return div; } private static final short bitoff[] = { 8, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; } libtritonus-java-20070428/src/classes/org/tritonus/lowlevel/gsm/Encoder.java0000644000175000017500000004104010374160731026761 0ustar twernertwerner/* * Encoder is the base class for all GSM encoding. * Copyright (C) 1999 Christopher Edwards * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * */ package org.tritonus.lowlevel.gsm; import java.io.*; public class Encoder { /* Every Encoder has a state through completion */ private Gsm_State g_s = new Gsm_State(); private Long_term lg_term_Obj = new Long_term(); private Lpc lpc_Obj = new Lpc(); private Rpe rpe_Obj = new Rpe(); private Short_term sh_term_Obj = new Short_term(); /* [0..7] LAR coefficients OUT */ private short LARc[] = new short[8]; /* [0..3] LTP lag OUT */ private short Nc[] = new short[4]; /* [0..3] coded LTP gain OUT */ private short Mc[] = new short[4]; /* [0..3] RPE grid selection OUT */ private short bc[] = new short[4]; /* [0..3] Coded maximum amplitude OUT */ private short xmaxc[] = new short[4]; /* [13*4] normalized RPE samples OUT */ private short xmc[] = new short[13*4]; /* Reads 160 bytes */ private int[] input_signal = new int[160]; /* [0..159] OUT */ /* Writes 33 bytes */ private byte[] frame = new byte[Gsm_Def.FRAME_SIZE]; /** * Encoder class constructor. */ public Encoder() { } /** * Remove the header info from the stream and verifies the file type. * As defined by the NeXT/Sun audio file format U-law (.au). * For more info see the README file.

* Note: Most of this info is not needed to reproduce the sound file * after encoding. All that is needed is the magic number and the sampling rate * to reproduce the sound file during decoding. * * @param in Strip the header from a Sun/Next formated sound stream. */ public static void stripAUHeader(InputStream in) throws Exception { DataInputStream input = new DataInputStream(in ); /* Just read these bits from the stream and do nothing with them */ int magic = input.readInt(); /* magic number SND_MAGIC ((int)0x2e736e64), * which equals ".snd".) */ input.readInt(); /* offset or pointer to the data */ input.readInt(); /* number of bytes of data */ int dataFormat = input.readInt(); /* the data format code */ int sampleRate = input.readInt(); /* the sampling rate = ~8000 samples/sec. */ input.readInt(); /* the number of channels */ input.readChar(); /* optional text information - 4 chars */ input.readChar(); input.readChar(); input.readChar(); if( magic != 0x2E736E64) // ".snd" in ASCII { // throw new GsmException("AuFile wrong Magic Number"); } else if( dataFormat != 1 ) // 8-Bit mu-Law { // throw new GsmException("AuFile not 8-bit Mu-Law"); } else if( sampleRate != 8000) // 8kHz { // throw new GsmException("AuFile not 8kHz"); } } /** * Encode the specified file. *
This method calls the stripAUHeader method for you.
* stripAUHeader will verify file type. * * @param input_file The name of the file to encode. * @param output_file The name of the GSM encoded file. */ public void encode(String input_file, String output_file) throws Exception { File arg1 = new File(input_file); if(!arg1.exists() || !arg1.isFile() || !arg1.canRead()) { throw new IOException("File : " + input_file + "\ndoes not exist or cannot be read."); } FileInputStream from = null; FileOutputStream to = null; try { from = new FileInputStream(input_file); to = new FileOutputStream(output_file); // Remove the header. It gets mangled by the encoding. stripAUHeader(from); // Read bytes till EOF. while(ulaw_input(from) > 0) { //System.out.println("Entering Native method."); gsm_encode(); // Need to do some error check here. Update ulaw_output. ulaw_output(to); // Write bytes. } } catch (Exception e) { throw new Exception("Encoder: " + e.getMessage()); } finally { if (from != null) { try { from.close(); } catch (IOException e) { throw new IOException("Encoder: " + e.getMessage()); } } if (to != null) { try { to.close(); } catch (IOException e) { throw new IOException("Encoder: " + e.getMessage()); } } } } /** * Encode the specified InputStream. * * @param input The stream to encode. * @param output_file The name of the GSM encoded file. */ public void encode(InputStream input, String output_file) throws IOException { FileOutputStream to = null; try { to = new FileOutputStream(output_file); // Read bytes till EOF. while(ulaw_input(input) > 0) { gsm_encode(); // Need to do some error check here. Update ulaw_output. ulaw_output(to); // Write bytes. } } catch (IOException e) { throw new IOException( "Encoder: " + e.getMessage()); } finally { if (to != null) { try { to.close(); } catch (IOException e) { throw new IOException("Encoder: " + e.getMessage()); } } } } /** Encodes a block of data. * * @param asBuffer an 160-element array with the data to encode * int PCM 16 bit format. * * @param abFrame the encoded GSM frame (33 bytes). */ public void encode(short[] asBuffer, byte[] abFrame) { for (int i = 0; i < 160; i++) { input_signal[i] = asBuffer[i]; } gsm_encode(); System.arraycopy(frame, 0, abFrame, 0, frame.length); } /** * Read 160 bytes from a U-law stream and set up the input_signal array. */ private int ulaw_input(InputStream in) throws IOException { int c = 0; int i = 0; for (i = 0; i < input_signal.length && ((c = in.read()) != -1); i++) { if (c < 0) { throw new IOException("Encoder ulaw_input: Corrupt InputStream."); } else { input_signal[i] = u2s[c]; } } return (i); } private void gsm_encode() { int index = 0; Gsm_Coder_java(); frame[index++] = (byte) (((0xD) << 4) /* 1 */ | ((LARc[0] >> 2) & 0xF)); frame[index++] = (byte) (((LARc[0] & 0x3) << 6) /* 2 */ | (LARc[1] & 0x3F)); frame[index++] = (byte) (((LARc[2] & 0x1F) << 3) /* 3 */ | ((LARc[3] >> 2) & 0x7)); frame[index++] = (byte) (((LARc[3] & 0x3) << 6) /* 4 */ | ((LARc[4] & 0xF) << 2) | ((LARc[5] >> 2) & 0x3)); frame[index++] = (byte) (((LARc[5] & 0x3) << 6) /* 5 */ | ((LARc[6] & 0x7) << 3) | (LARc[7] & 0x7)); frame[index++] = (byte) (((Nc[0] & 0x7F) << 1) /* 6 */ | ((bc[0] >> 1) & 0x1)); frame[index++] = (byte) (((bc[0] & 0x1) << 7) /* 7 */ | ((Mc[0] & 0x3) << 5) | ((xmaxc[0] >> 1) & 0x1F)); frame[index++] = (byte) (((xmaxc[0] & 0x1) << 7) /* 8 */ | ((xmc[0] & 0x7) << 4) | ((xmc[1] & 0x7) << 1) | ((xmc[2] >> 2) & 0x1)); frame[index++] = (byte) (((xmc[2] & 0x3) << 6) /* 9 */ | ((xmc[3] & 0x7) << 3) | (xmc[4] & 0x7)); frame[index++] = (byte) (((xmc[5] & 0x7) << 5) /* 10 */ | ((xmc[6] & 0x7) << 2) | ((xmc[7] >> 1) & 0x3)); frame[index++] = (byte) (((xmc[7] & 0x1) << 7) /* 11 */ | ((xmc[8] & 0x7) << 4) | ((xmc[9] & 0x7) << 1) | ((xmc[10] >> 2) & 0x1)); frame[index++] = (byte) ((((xmc[10] & 0x3) << 6) /* 12 */ | ((xmc[11] & 0x7) << 3) | (xmc[12] & 0x7))); frame[index++] = (byte) (((Nc[1] & 0x7F) << 1) /* 13 */ | ((bc[1] >> 1) & 0x1)); frame[index++] = (byte) (((bc[1] & 0x1) << 7) /* 14 */ | ((Mc[1] & 0x3) << 5) | ((xmaxc[1] >> 1) & 0x1F)); frame[index++] = (byte) (((xmaxc[1] & 0x1) << 7) /* 15 */ | ((xmc[13] & 0x7) << 4) | ((xmc[14] & 0x7) << 1) | ((xmc[15] >> 2) & 0x1)); frame[index++] = (byte) (((xmc[15] & 0x3) << 6) | ((xmc[16] & 0x7) << 3) | (xmc[17] & 0x7)); frame[index++] = (byte) (((xmc[18] & 0x7) << 5) | ((xmc[19] & 0x7) << 2) | ((xmc[20] >> 1) & 0x3)); frame[index++] = (byte) (((xmc[20] & 0x1) << 7) | ((xmc[21] & 0x7) << 4) | ((xmc[22] & 0x7) << 1) | ((xmc[23] >> 2) & 0x1)); frame[index++] = (byte) (((xmc[23] & 0x3) << 6) | ((xmc[24] & 0x7) << 3) | (xmc[25] & 0x7)); frame[index++] = (byte) (((Nc[2] & 0x7F) << 1) /* 20 */ | ((bc[2] >> 1) & 0x1)); frame[index++] = (byte) (((bc[2] & 0x1) << 7) | ((Mc[2] & 0x3) << 5) | ((xmaxc[2] >> 1) & 0x1F)); frame[index++] = (byte) (((xmaxc[2] & 0x1) << 7) | ((xmc[26] & 0x7) << 4) | ((xmc[27] & 0x7) << 1) | ((xmc[28] >> 2) & 0x1)); frame[index++] = (byte) (((xmc[28] & 0x3) << 6) | ((xmc[29] & 0x7) << 3) | (xmc[30] & 0x7)); frame[index++] = (byte) (((xmc[31] & 0x7) << 5) | ((xmc[32] & 0x7) << 2) | ((xmc[33] >> 1) & 0x3)); frame[index++] = (byte) (((xmc[33] & 0x1) << 7) | ((xmc[34] & 0x7) << 4) | ((xmc[35] & 0x7) << 1) | ((xmc[36] >> 2) & 0x1)); frame[index++] = (byte) (((xmc[36] & 0x3) << 6) | ((xmc[37] & 0x7) << 3) | (xmc[38] & 0x7)); frame[index++] = (byte) (((Nc[3] & 0x7F) << 1) | ((bc[3] >> 1) & 0x1)); frame[index++] = (byte) (((bc[3] & 0x1) << 7) | ((Mc[3] & 0x3) << 5) | ((xmaxc[3] >> 1) & 0x1F)); frame[index++] = (byte) (((xmaxc[3] & 0x1) << 7) | ((xmc[39] & 0x7) << 4) | ((xmc[40] & 0x7) << 1) | ((xmc[41] >> 2) & 0x1)); frame[index++] = (byte) (((xmc[41] & 0x3) << 6) /* 30 */ | ((xmc[42] & 0x7) << 3) | (xmc[43] & 0x7)); frame[index++] = (byte) (((xmc[44] & 0x7) << 5) /* 31 */ | ((xmc[45] & 0x7) << 2) | ((xmc[46] >> 1) & 0x3)); frame[index++] = (byte) (((xmc[46] & 0x1) << 7) /* 32 */ | ((xmc[47] & 0x7) << 4) | ((xmc[48] & 0x7) << 1) | ((xmc[49] >> 2) & 0x1)); frame[index++] = (byte) (((xmc[49] & 0x3) << 6) /* 33 */ | ((xmc[50] & 0x7) << 3) | (xmc[51] & 0x7)); } private void Gsm_Coder_java() { int xmc_point = 0; int Nc_bc_index = 0; int xmaxc_Mc_index = 0; int dp_dpp_point_dp0 = 120; //short[] ep = new short[40]; short[] e = new short[50]; short[] so = new short[160]; Gsm_Preprocess(so); lpc_Obj.Gsm_LPC_Analysis(so, LARc); sh_term_Obj.Gsm_Short_Term_Analysis_Filter(g_s, LARc, so); short[] dp = g_s.getDp0(); short[] dpp = dp; for( int k = 0; k <= 3; k++, xmc_point += 13 ) { lg_term_Obj.Gsm_Long_Term_Predictor( so, /* d [0..39] IN */ k*40, /* so entry point */ e, /* e+5 [0..39] OUT */ dp, /* Referance to Gsm_State dp0 */ dpp, /* Referance to Gsm_State dp0 */ dp_dpp_point_dp0, /* Where to start the dp0 ref */ Nc, /* [0..3] coded LTP gain OUT */ bc, /* [0..3] RPE grid selection OUT */ Nc_bc_index++ /* The current referance point for Nc & bc */ ); rpe_Obj.Gsm_RPE_Encoding (e, /* e + 5 ][0..39][ IN/OUT */ xmaxc, /* [0..3] Coded maximum amplitude OUT */ Mc, /* [0..3] coded LTP gain OUT */ xmaxc_Mc_index++, /* The current referance point */ xmc, /* [13*4] normalized RPE samples OUT */ xmc_point /* The current referance point for xmc */ ); for( int i = 0; i <= 39; i++ ) { dp[ i + dp_dpp_point_dp0 ] = Add.GSM_ADD( e[5 + i], dpp[i + dp_dpp_point_dp0] ); } g_s.setDp0(dp); dp_dpp_point_dp0 += 40; } for( int i = 0; i < 120; i++ ) { g_s.setDp0Indexed(i, g_s.getDp0Indexed( (160 + i) )); } } private void Gsm_Preprocess(short[] so) /* [0..159] IN/OUT */ throws IllegalArgumentException { int index = 0, so_index = 0; short z1 = g_s.getZ1(); int L_z2 = g_s.getL_z2(); int mp = g_s.getMp(); short s1 = 0, msp = 0, lsp = 0, SO = 0; int L_s2 = 0, L_temp = 0; int k = 160; while (k != 0) { k--; /* 4.2.1 Downscaling of the input signal */ SO = (short)(Add.SASR((short)input_signal[index++], (short)3) << 2); if ( ! (SO >= -0x4000) ) { /* downscaled by */ throw new IllegalArgumentException ("Gsm_Preprocess: SO = " +SO+" is out of range. Sould be >= -0x4000 "); } if ( ! (SO <= 0x3FFC) ) { /* previous routine. */ throw new IllegalArgumentException ("Gsm_Preprocess: SO = " +SO+" is out of range. Sould be <= 0x3FFC "); } /* 4.2.2 Offset compensation * * This part implements a high-pass filter and requires extended * arithmetic precision for the recursive part of this filter. * The input of this procedure is the array so[0...159] and the * output the array sof[ 0...159 ]. */ /* Compute the non-recursive part */ s1 = (short) (SO - z1); /* s1 = gsm_sub( *so, z1 ); */ z1 = SO; if(s1 == Gsm_Def.MIN_WORD) { throw new IllegalArgumentException ("Gsm_Preprocess: s1 = " +s1+" is out of range. "); } /* Compute the recursive part */ L_s2 = s1; L_s2 <<= 15; /* Execution of a 31 bv 16 bits multiplication */ msp = Add.SASR( L_z2, 15 ); /* gsm_L_sub(L_z2,(msp<<15)); */ lsp = (short) (L_z2 - ((int) (msp << 15))); L_s2 += Add.GSM_MULT_R( lsp, (short) 32735 ); L_temp = (int)msp * 32735; /* GSM_L_MULT(msp,32735) >> 1;*/ L_z2 = Add.GSM_L_ADD( L_temp, L_s2 ); /* Compute sof[k] with rounding */ L_temp = Add.GSM_L_ADD( L_z2, 16384 ); /* 4.2.3 Preemphasis */ msp = Add.GSM_MULT_R( (short) mp, (short) -28180 ); mp = Add.SASR( L_temp, 15 ); so[so_index++] = Add.GSM_ADD( (short) mp, msp ); } g_s.setZ1(z1); g_s.setL_z2(L_z2); g_s.setMp(mp); } /* Write the encoded bytes to the stream. */ private void ulaw_output(FileOutputStream out) throws IOException { int i = 0; for (i = 0; i < frame.length; i++) { out.write(frame[i]); } } /** * Used for debugging. * * @param state The Gsm_State object to be viewed. */ private void dump_Gsm_State(Gsm_State state) { state.dump_Gsm_State(); } /* * This is the encoding matrix. * * Java does not have an unsigned short, ie. 16 bits, so * I will use the upper 16 bits of the integer. This wastes * a little memory although I do not think it will cause a * problem. */ private static final int u2s[] = { 33280, 34308, 35336, 36364, 37393, 38421, 39449, 40477, 41505, 42534, 43562, 44590, 45618, 46647, 47675, 48703, 49474, 49988, 50503, 51017, 51531, 52045, 52559, 53073, 53587, 54101, 54616, 55130, 55644, 56158, 56672, 57186, 57572, 57829, 58086, 58343, 58600, 58857, 59114, 59371, 59628, 59885, 60142, 60399, 60656, 60913, 61171, 61428, 61620, 61749, 61877, 62006, 62134, 62263, 62392, 62520, 62649, 62777, 62906, 63034, 63163, 63291, 63420, 63548, 63645, 63709, 63773, 63838, 63902, 63966, 64030, 64095, 64159, 64223, 64287, 64352, 64416, 64480, 64544, 64609, 64657, 64689, 64721, 64753, 64785, 64818, 64850, 64882, 64914, 64946, 64978, 65010, 65042, 65075, 65107, 65139, 65163, 65179, 65195, 65211, 65227, 65243, 65259, 65275, 65291, 65308, 65324, 65340, 65356, 65372, 65388, 65404, 65416, 65424, 65432, 65440, 65448, 65456, 65464, 65472, 65480, 65488, 65496, 65504, 65512, 65520, 65528, 0, 32256, 31228, 30200, 29172, 28143, 27115, 26087, 25059, 24031, 23002, 21974, 20946, 19918, 18889, 17861, 16833, 16062, 15548, 15033, 14519, 14005, 13491, 12977, 12463, 11949, 11435, 10920, 10406, 9892, 9378, 8864, 8350, 7964, 7707, 7450, 7193, 6936, 6679, 6422, 6165, 5908, 5651, 5394, 5137, 4880, 4623, 4365, 4108, 3916, 3787, 3659, 3530, 3402, 3273, 3144, 3016, 2887, 2759, 2630, 2502, 2373, 2245, 2116, 1988, 1891, 1827, 1763, 1698, 1634, 1570, 1506, 1441, 1377, 1313, 1249, 1184, 1120, 1056, 992, 927, 879, 847, 815, 783, 751, 718, 686, 654, 622, 590, 558, 526, 494, 461, 429, 397, 373, 357, 341, 325, 309, 293, 277, 261, 245, 228, 212, 196, 180, 164, 148, 132, 120, 112, 104, 96, 88, 80, 72, 64, 56, 48, 40, 32, 24, 16, 8, 0 }; } libtritonus-java-20070428/src/classes/org/tritonus/lowlevel/gsm/GSMDecoder.java0000644000175000017500000004125210374142164027323 0ustar twernertwerner// $Id: GSMDecoder.java,v 1.3 2006/02/13 17:40:04 pfisterer Exp $ // This file is part of the GSM 6.10 audio decoder library for Java // Copyright (C) 1998 Steven Pickles (pix@test.at) // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Library General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Library General Public License for more details. // You should have received a copy of the GNU Library General Public // License along with this library; if not, write to the Free // Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // This software is a port of the GSM Library provided by // Jutta Degener (jutta@cs.tu-berlin.de) and // Carsten Bormann (cabo@cs.tu-berlin.de), // Technische Universitaet Berlin package org.tritonus.lowlevel.gsm; import org.tritonus.share.sampled.TConversionTool; public final class GSMDecoder { private static final byte GSM_MAGIC = 0x0d; private static final int[] FAC = { 18431, 20479, 22527, 24575, 26623, 28671, 30719, 32767 }; private static final int[] QLB = { 3277, 11469, 21299, 32767 }; // TODO: can be replaced by Short.MIN_VALUE and Short.MAX_VALUE ? private static final int MIN_WORD = -32767 - 1; private static final int MAX_WORD = 32767; private int[] m_dp0 = new int[280]; private int[] u = new int[8]; private int[][] LARpp = new int[2][8]; private int m_j; private int nrp; private int[] v = new int[9]; private int msr; // hack used for adapting calling conventions private byte[] m_abFrame; // only to reduce memory allocations // (formerly allocated once for each frame to decode) private int[] m_LARc = new int[8]; private int[] m_Nc = new int[4]; private int[] m_Mc = new int[4]; private int[] m_bc = new int[4]; private int[] m_xmaxc = new int[4]; private int[] m_xmc = new int[13 * 4]; private int[] m_erp = new int[40]; private int[] m_wt = new int[160]; private int[] m_xMp = new int[13]; private int[] m_result = new int[2]; private int[] m_LARp = new int[8]; private int[] m_s = new int[160]; public void GSM() { nrp = 40; } /* This is how the method call should look like. @param abFrame the array that contains the GSM frame (encoded data) @param nFrameStart that number of the byte that should be used as starting point for the GSM frame inside abFrame @param abBuffer the array where the decoded data should be written to. The data are written as 16 bit linear samples (actually using the lowest 13 bit), either big or little endian, depending on the value of bBigEndian. @param nBufferStart the byte number where the data should be written. @param bBigEndian whether the decoded data should be written big endian or little endian. */ public void decode(byte[] abFrame, int nFrameStart, byte[] abBuffer, int nBufferStart, boolean bBigEndian) throws InvalidGSMFrameException { if (m_abFrame == null) { m_abFrame = new byte[33]; } System.arraycopy(abFrame, nFrameStart, m_abFrame, 0, 33); int[] anDecodedData = decode(m_abFrame); for (int i = 0; i < 160; i++) { TConversionTool.intToBytes16(anDecodedData[i], abBuffer, i * 2 + nBufferStart, bBigEndian); } } private final int[] decode(byte[] c) throws InvalidGSMFrameException { if (c.length != 33) { throw new InvalidGSMFrameException(); } int i=0; if (((c[i]>>4) & 0xf) != GSM_MAGIC) { throw new InvalidGSMFrameException(); } m_LARc[0] = ((c[i++] & 0xF) << 2); /* 1 */ m_LARc[0] |= ((c[i] >> 6) & 0x3); m_LARc[1] = (c[i++] & 0x3F); m_LARc[2] = ((c[i] >> 3) & 0x1F); m_LARc[3] = ((c[i++] & 0x7) << 2); m_LARc[3] |= ((c[i] >> 6) & 0x3); m_LARc[4] = ((c[i] >> 2) & 0xF); m_LARc[5] = ((c[i++] & 0x3) << 2); m_LARc[5] |= ((c[i] >> 6) & 0x3); m_LARc[6] = ((c[i] >> 3) & 0x7); m_LARc[7] = (c[i++] & 0x7); m_Nc[0] = ((c[i] >> 1) & 0x7F); m_bc[0] = ((c[i++] & 0x1) << 1); m_bc[0] |= ((c[i] >> 7) & 0x1); m_Mc[0] = ((c[i] >> 5) & 0x3); m_xmaxc[0] = ((c[i++] & 0x1F) << 1); m_xmaxc[0] |= ((c[i] >> 7) & 0x1); m_xmc[0] = ((c[i] >> 4) & 0x7); m_xmc[1] = ((c[i] >> 1) & 0x7); m_xmc[2] = ((c[i++] & 0x1) << 2); m_xmc[2] |= ((c[i] >> 6) & 0x3); m_xmc[3] = ((c[i] >> 3) & 0x7); m_xmc[4] = (c[i++] & 0x7); m_xmc[5] = ((c[i] >> 5) & 0x7); m_xmc[6] = ((c[i] >> 2) & 0x7); m_xmc[7] = ((c[i++] & 0x3) << 1); /* 10 */ m_xmc[7] |= ((c[i] >> 7) & 0x1); m_xmc[8] = ((c[i] >> 4) & 0x7); m_xmc[9] = ((c[i] >> 1) & 0x7); m_xmc[10] = ((c[i++] & 0x1) << 2); m_xmc[10] |= ((c[i] >> 6) & 0x3); m_xmc[11] = ((c[i] >> 3) & 0x7); m_xmc[12] = (c[i++] & 0x7); m_Nc[1] = ((c[i] >> 1) & 0x7F); m_bc[1] = ((c[i++] & 0x1) << 1); m_bc[1] |= ((c[i] >> 7) & 0x1); m_Mc[1] = ((c[i] >> 5) & 0x3); m_xmaxc[1] = ((c[i++] & 0x1F) << 1); m_xmaxc[1] |= ((c[i] >> 7) & 0x1); m_xmc[13] = ((c[i] >> 4) & 0x7); m_xmc[14] = ((c[i] >> 1) & 0x7); m_xmc[15] = ((c[i++] & 0x1) << 2); m_xmc[15] |= ((c[i] >> 6) & 0x3); m_xmc[16] = ((c[i] >> 3) & 0x7); m_xmc[17] = (c[i++] & 0x7); m_xmc[18] = ((c[i] >> 5) & 0x7); m_xmc[19] = ((c[i] >> 2) & 0x7); m_xmc[20] = ((c[i++] & 0x3) << 1); m_xmc[20] |= ((c[i] >> 7) & 0x1); m_xmc[21] = ((c[i] >> 4) & 0x7); m_xmc[22] = ((c[i] >> 1) & 0x7); m_xmc[23] = ((c[i++] & 0x1) << 2); m_xmc[23] |= ((c[i] >> 6) & 0x3); m_xmc[24] = ((c[i] >> 3) & 0x7); m_xmc[25] = (c[i++] & 0x7); m_Nc[2] = ((c[i] >> 1) & 0x7F); m_bc[2] = ((c[i++] & 0x1) << 1); /* 20 */ m_bc[2] |= ((c[i] >> 7) & 0x1); m_Mc[2] = ((c[i] >> 5) & 0x3); m_xmaxc[2] = ((c[i++] & 0x1F) << 1); m_xmaxc[2] |= ((c[i] >> 7) & 0x1); m_xmc[26] = ((c[i] >> 4) & 0x7); m_xmc[27] = ((c[i] >> 1) & 0x7); m_xmc[28] = ((c[i++] & 0x1) << 2); m_xmc[28] |= ((c[i] >> 6) & 0x3); m_xmc[29] = ((c[i] >> 3) & 0x7); m_xmc[30] = (c[i++] & 0x7); m_xmc[31] = ((c[i] >> 5) & 0x7); m_xmc[32] = ((c[i] >> 2) & 0x7); m_xmc[33] = ((c[i++] & 0x3) << 1); m_xmc[33] |= ((c[i] >> 7) & 0x1); m_xmc[34] = ((c[i] >> 4) & 0x7); m_xmc[35] = ((c[i] >> 1) & 0x7); m_xmc[36] = ((c[i++] & 0x1) << 2); m_xmc[36] |= ((c[i] >> 6) & 0x3); m_xmc[37] = ((c[i] >> 3) & 0x7); m_xmc[38] = (c[i++] & 0x7); m_Nc[3] = ((c[i] >> 1) & 0x7F); m_bc[3] = ((c[i++] & 0x1) << 1); m_bc[3] |= ((c[i] >> 7) & 0x1); m_Mc[3] = ((c[i] >> 5) & 0x3); m_xmaxc[3] = ((c[i++] & 0x1F) << 1); m_xmaxc[3] |= ((c[i] >> 7) & 0x1); m_xmc[39] = ((c[i] >> 4) & 0x7); m_xmc[40] = ((c[i] >> 1) & 0x7); m_xmc[41] = ((c[i++] & 0x1) << 2); m_xmc[41] |= ((c[i] >> 6) & 0x3); m_xmc[42] = ((c[i] >> 3) & 0x7); m_xmc[43] = (c[i++] & 0x7); /* 30 */ m_xmc[44] = ((c[i] >> 5) & 0x7); m_xmc[45] = ((c[i] >> 2) & 0x7); m_xmc[46] = ((c[i++] & 0x3) << 1); m_xmc[46] |= ((c[i] >> 7) & 0x1); m_xmc[47] = ((c[i] >> 4) & 0x7); m_xmc[48] = ((c[i] >> 1) & 0x7); m_xmc[49] = ((c[i++] & 0x1) << 2); m_xmc[49] |= ((c[i] >> 6) & 0x3); m_xmc[50] = ((c[i] >> 3) & 0x7); m_xmc[51] = (c[i] & 0x7); /* 33 */ return decoder(m_LARc, m_Nc, m_bc, m_Mc, m_xmaxc, m_xmc); } public final static void print(String name, int[] data) { System.out.print("["+name+":"); for(int i=0;i15) { exp = ((xmaxc>>3)-1); } mant=(xmaxc-(exp<<3)); if (mant==0) { exp = -4; mant = 7; } else { while (mant <= 7) { mant = (mant << 1 | 1); exp--; } mant -= 8; } //assert(exp>=-4 && exp <= 6); //assert(mant>=0 && mant<=7); m_result[0] = exp; m_result[1] = mant; return m_result; } //private void assert(boolean test) { // if (!test) { // System.out.println("assertion error"); // } //} private final void APCMInverseQuantization(int[] xMc, int xMcOffset, int exp, int mant, int[] xMp) { int i,p; int temp, temp1, temp2, temp3; //assert(mant >0 && mant <= 7 ); temp1 = FAC[mant]; temp2 = sub(6,exp); temp3 = asl(1,sub(temp2,1)); //System.out.println("temp1="+temp1); //System.out.println("temp2="+temp2); //System.out.println("temp3="+temp3); p = 0; for (i=13;i-->0;) { //assert(xMc[xMcOffset] <= 7 && xMc[xMcOffset] >= 0); temp = ((xMc[xMcOffset++] << 1) - 7); //System.out.println("s1:temp="+temp); //assert(temp<=7 && temp >= -7); temp = (temp<<12);//&0xffff; //System.out.println("s2:temp="+temp); temp = mult_r(temp1, temp); //System.out.println("s3:temp="+temp); temp = add(temp, temp3); //System.out.println("s4:temp="+temp); xMp[p++] = asr(temp, temp2); } } private final static int saturate(int x) { return (x < MIN_WORD ? MIN_WORD : (x > MAX_WORD ? MAX_WORD: x)); } private final static int sub(int a, int b) { int diff = a - b; return saturate(diff); } private final static int add(int a, int b) { int sum = a + b; return saturate(sum); } private final static int asl(int a, int n) { if (n>= 16) return 0; if (n<= -16) return (a<0?-1:0); if (n<0) return asr(a,-n); return (a << n); } private final static int asr(int a, int n) { if (n>=16) return (a<0?-1:0); if (n<=-16) return 0; if (n<0) return (a<<-n);//&0xffff; return (a>>n); } private final static int mult_r(int a, int b) { if (b == MIN_WORD && a == MIN_WORD) return MAX_WORD; else { int prod = a * b + 16384; //prod >>= 15; return saturate(prod>>15);//&0xffff; //return (prod & 0xffff); } } private final void longTermSynthesisFiltering(int Ncr, int bcr, int[] erp, int[] dp0) { int brp, drpp, Nr; Nr = Ncr < 40 || Ncr > 120 ? nrp : Ncr; nrp = Nr; brp = QLB[bcr]; for (int k = 0; k <= 39; k++) { drpp = mult_r(brp,dp0[120 + (k - Nr)]); dp0[120 + k] = add(erp[k], drpp); } for (int k = 0; k <= 119; k++) { dp0[k] = dp0[40 + k]; } } private final int[] shortTermSynthesisFilter(int[] LARcr, int[] wt) { //print("wt",wt); int[] LARpp_j = LARpp[m_j]; int[] LARpp_j_1 = LARpp[m_j^=1]; decodingOfTheCodedLogAreaRatios(LARcr,LARpp_j); //print("LARpp_j",LARpp_j); Coefficients_0_12(LARpp_j_1,LARpp_j, m_LARp); LARp_to_rp(m_LARp); shortTermSynthesisFiltering(m_LARp, 13, wt, m_s, 0); Coefficients_13_26( LARpp_j_1, LARpp_j, m_LARp); LARp_to_rp(m_LARp); shortTermSynthesisFiltering( m_LARp, 14, wt, m_s, 13); Coefficients_27_39( LARpp_j_1, LARpp_j, m_LARp); LARp_to_rp( m_LARp ); shortTermSynthesisFiltering( m_LARp, 13, wt, m_s, 27 ); Coefficients_40_159( LARpp_j, m_LARp ); LARp_to_rp( m_LARp ); shortTermSynthesisFiltering( m_LARp, 120, wt, m_s, 40); return m_s; } public final static void decodingOfTheCodedLogAreaRatios(int[] LARc, int[] LARpp) { int temp1; // STEP( 0, -32, 13107 ); temp1 = (add(LARc[0],-32)<<10); //temp1 = (sub(temp1, 0)); temp1 = (mult_r(13107,temp1)); LARpp[0] = (add(temp1, temp1)); // STEP( 0, -32, 13107 ); temp1 = (add(LARc[1],-32)<<10); //temp1 = (sub(temp1, 0)); temp1 = (mult_r(13107,temp1)); LARpp[1] = (add(temp1, temp1)); // STEP( 2048, -16, 13107 ); temp1 = (add(LARc[2],-16)<<10); temp1 = (sub(temp1, 4096)); temp1 = (mult_r(13107,temp1)); LARpp[2] = (add(temp1, temp1)); // STEP( -2560, -16, 13107 ); temp1 = (add(LARc[3],(-16))<<10); temp1 = (sub(temp1, -5120)); temp1 = (mult_r(13107,temp1)); LARpp[3] = (add(temp1, temp1)); // STEP( 94, -8, 19223 ); temp1 = (add(LARc[4],-8)<<10); temp1 = (sub(temp1, 188)); temp1 = (mult_r(19223,temp1)); LARpp[4] = (add(temp1, temp1)); // STEP( -1792, -8, 17476 ); temp1 = (add(LARc[5],(-8))<<10); temp1 = (sub(temp1, -3584)); temp1 = (mult_r(17476,temp1)); LARpp[5] = (add(temp1, temp1)); // STEP( -341, -4, 31454 ); temp1 = (add(LARc[6],(-4))<<10); temp1 = (sub(temp1, -682)); temp1 = (mult_r(31454,temp1)); LARpp[6] = (add(temp1, temp1)); // STEP( -1144, -4, 29708 ); temp1 = (add(LARc[7],-4)<<10); temp1 = (sub(temp1, -2288)); temp1 = (mult_r(29708,temp1)); LARpp[7] = (add(temp1, temp1)); } private final static void Coefficients_0_12(int[] LARpp_j_1, int[] LARpp_j, int[] LARp) { for(int i = 0; i < 8; i++) { LARp[i] = add((LARpp_j_1[i]>>2),(LARpp_j[i]>>2)); LARp[i] = add(LARp[i],(LARpp_j_1[i]>>1)); } } private final static void Coefficients_13_26(int[] LARpp_j_1, int[] LARpp_j, int[] LARp) { for(int i = 0; i < 8; i++) { LARp[i] = add((LARpp_j_1[i]>>1),(LARpp_j[i]>>1)); } } private final static void Coefficients_27_39(int[] LARpp_j_1, int[] LARpp_j, int[] LARp) { for(int i = 0; i < 8; i++) { LARp[i] = add((LARpp_j_1[i]>>2),(LARpp_j[i]>>2)); LARp[i] = add(LARp[i],(LARpp_j[i]>>1)); } } private final static void Coefficients_40_159(int[] LARpp_j, int[] LARp) { for(int i = 0; i < 8; i++) { LARp[i] = LARpp_j[i]; } } private final static void LARp_to_rp(int[] LARp) { int temp; for(int i = 0; i < 8; i++) { if(LARp[i] < 0) { temp = ((LARp[i]==MIN_WORD)?MAX_WORD:-LARp[i]); LARp[i] = (- ((temp < 11059) ? temp << 1 : ((temp < 20070) ? temp + 11059 : add((temp>>2),26112)))); } else { temp = LARp[i]; LARp[i] = ((temp<11059)?temp<<1 : ((temp<20070)?temp+11059 :add((temp>>2),26112))); } } } // shortTermSynthesisFiltering(LARp,13,wt,s,0); private final void shortTermSynthesisFiltering(int[] rrp, int k, int[] wt, int[] sr, int off) { int sri, tmp1, tmp2; int woff = off; int soff = off; while (k-- > 0) { sri = wt[woff++]; for (int i = 8; i-- > 0;) { tmp1 = rrp[i]; tmp2 = v[i]; tmp2 = ((tmp1 == MIN_WORD && tmp2 == MIN_WORD ? MAX_WORD : saturate((tmp1 * tmp2 + 16384) >> 15))); sri = sub(sri,tmp2); tmp1 = ((tmp1 == MIN_WORD && sri == MIN_WORD ? MAX_WORD : saturate( (tmp1 * sri + 16384) >> 15))); v[i + 1] = add(v[i], tmp1); } sr[soff++] = v[0] = sri; } } private final void postprocessing(int[] s) { int soff=0; int tmp; for(int k = 160; k-- > 0; soff++) { tmp = mult_r(msr, (28180)); msr = add(s[soff], tmp); //s[soff]=(add(msr,msr) & 0xfff8); s[soff] = saturate(add(msr, msr) & ~0x7); } } private final static void RPE_grid_positioning(int Mc, int[] xMp, int[] ep) { int i = 13; int epo = 0; int po = 0; switch(Mc) { case 3: ep[epo++] = 0; case 2: ep[epo++] = 0; case 1: ep[epo++] = 0; case 0: ep[epo++] = xMp[po++]; i--; }; do { ep[epo++] = 0; ep[epo++] = 0; ep[epo++] = xMp[po++]; } while (--i>0); while (++Mc < 4) { ep[epo++] = 0; } } } /*** GSMDecoder.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/lowlevel/gsm/Gsm_Def.java0000644000175000017500000000642310172434623026714 0ustar twernertwerner/* * Static defines. * Copyright (C) 1999 Christopher Edwards * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * */ package org.tritonus.lowlevel.gsm; public abstract class Gsm_Def { // TODO: remove // Define the magic number for audio files public static final int AUDIO_FILE_MAGIC = 0x2e736e64; // TODO: remove // The encoding key for type: 8-bit ISDN u-law public static final int AUDIO_FILE_ENCODING_MULAW_8 = 1; public static final short FRAME_SIZE = 33; public static final short MAX_FRAME_READ = 1000; // TODO: use Short.MIN/MAX_VALUE public static final short MIN_WORD = -32768; public static final short MAX_WORD = 32767; // TODO: use Integer.MIN/MAX_VALUE public static final int MIN_LONGWORD = -2147483648; public static final int MAX_LONGWORD = 2147483647; /* Table 4.1 Quantization of the Log.-Area Ratios */ /* i 1 2 3 4 5 6 7 8 */ public static final short gsm_A[] = { 20480, 20480, 20480, 20480, 13964, 15360, 8534, 9036 }; public static final short gsm_B[] = { 0, 0, 2048, -2560, 94, -1792, -341, -1144 }; public static final short gsm_MIC[] = { -32, -32, -16, -16, -8, -8, -4, -4 }; public static final short gsm_MAC[] = { 31, 31, 15, 15, 7, 7, 3, 3 }; /* Table 4.2 Tabulation of 1/A[1..8] */ public static final short gsm_INVA[] = { 13107, 13107, 13107, 13107, 19223, 17476, 31454, 29708 }; /* Table 4.3a Decision level of the LTP gain quantizer */ /* bc 0 1 2 3 */ public static final short gsm_DLB[] = { 6554, 16384, 26214, 32767 }; /* Table 4.3b Quantization levels of the LTP gain quantizer */ /* bc 0 1 2 3 */ public static final short gsm_QLB[] = { 3277, 11469, 21299, 32767 }; /* Table 4.4 Coefficients of the weighting filter */ /* i 0 1 2 3 4 5 6 7 8 9 10 */ public static final short gsm_H[] = { -134, -374, 0, 2054, 5741, 8192, 5741, 2054, 0, -374, -134 }; /* Table 4.5 Normalized inverse mantissa used to compute xM/xmax */ /* i 0 1 2 3 4 5 6 7 */ public static final short gsm_NRFAC[] = { 29128, 26215, 23832, 21846, 20165, 18725, 17476, 16384 }; /* Table 4.6 Normalized direct mantissa used to compute xM/xmax */ /* i 0 1 2 3 4 5 6 7 */ public static final short gsm_FAC[] = { 18431, 20479, 22527, 24575, 26623, 28671, 30719, 32767 }; } libtritonus-java-20070428/src/classes/org/tritonus/lowlevel/gsm/Gsm_State.java0000644000175000017500000001120310374105261027263 0ustar twernertwerner/* * State control for encoding. * Copyright (C) 1999 Christopher Edwards * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * */ package org.tritonus.lowlevel.gsm; public class Gsm_State { private short[] m_dp0; private short z1; /* preprocessing, Offset_com. */ private int L_z2; /* Offset_com. */ private int mp; /* Preemphasis */ private short[] u; /* short_term.java */ private short[][] m_LARpp; /* */ private short m_j; /* */ private short nrp; /* long_term.java, synthesis */ private short[] v; /* short_term.java, synthesis */ private short msr; /* Gsm_Decoder.java, Postprocessing */ public Gsm_State() { short Dp0[] = new short[280]; short U[] = new short[8]; short LARpp[][] = new short[2][8]; short V[] = new short[9]; this.setDp0(Dp0); this.setZ1( (short) 0); this.setL_z2(0); this.setMp(0); this.setU(U); this.setLARpp(LARpp); this.setJ( (short) 0); this.setNrp( (short) 40); this.setV(V); this.setMsr( (short) 0); } public void dump_Gsm_State() { int i, col; System.out.println("\ndp0[]: "); /*for(i = 0; i < dp0.length; ++i) { System.out.print("["+i+"] "+dp0[i]); if (i < dp0.length - 1) System.out.print(", "); }*/ System.out.println("\nz1: " + z1); System.out.println("\nL_z2: " + L_z2); System.out.println("\nmp: " + mp); System.out.println("\nu[]: "); for(i = 0; i < u.length; ++i) { System.out.print("["+i+"] "+u[i]); if (i < u.length - 1) System.out.print(", "); } System.out.print("\n"); System.out.println("\nLARpp[]: "); for(i = 0; i < 2; ++i) { for(col = 0; col < 8; ++col) { System.out.print("["+i+"]["+col+"] " +m_LARpp[i][col]); System.out.print(", "); } System.out.print("\n"); } System.out.print("\n"); System.out.println("\nj: " + m_j); System.out.println("\nnrp: " + nrp); System.out.println("\nv[]: "); for(i = 0; i < v.length; ++i) { System.out.print("["+i+"] "+v[i]); if (i < v.length - 1) System.out.print(", "); } System.out.print("\n"); System.out.println("\nmsr: " + msr); //System.out.println("\nverbose: " + verbose); //System.out.println("\nfast: " + fast); } public String toString() { return String.valueOf(nrp); } public void setDp0(short[] lcl_arg0) { m_dp0 = lcl_arg0; } public void setDp0Indexed(int ix,short lcl_arg0) { m_dp0[ix] = lcl_arg0; } public short[] getDp0() { return m_dp0; } public short getDp0Indexed(int ix) { return m_dp0[ix]; } public void setZ1(short lcl_arg0) { z1 = lcl_arg0; } public short getZ1() { return z1; } public void setL_z2(int lcl_arg0) { L_z2 = lcl_arg0; } public int getL_z2() { return L_z2; } public void setMp(int lcl_arg0) { mp = lcl_arg0; } public int getMp() { return mp; } public void setU(short[] lcl_arg0) { u = lcl_arg0; } public void setUIndexed(int ix,short lcl_arg0) { u[ix] = lcl_arg0; } public short[] getU() { return u; } public short getUIndexed(int ix) { return u[ix]; } public void setLARpp(short[][] lcl_arg0) { m_LARpp = lcl_arg0; } public void setLARppIndexed(int ix,short[] lcl_arg0) { m_LARpp[ix] = lcl_arg0; } public short[][] getLARpp() { return m_LARpp; } public short[] getLARppIndexed(int ix) { return m_LARpp[ix]; } public void setJ(short lcl_arg0) { m_j = lcl_arg0; } public short getJ() { return m_j; } public void setNrp(short lcl_arg0) { nrp = lcl_arg0; } public short getNrp() { return nrp; } public void setV(short[] lcl_arg0) { v = lcl_arg0; } public void setVIndexed(int ix, short lcl_arg0) { v[ix] = lcl_arg0; } public short[] getV() { return v; } public short getVIndexed(int ix) { return v[ix]; } public void setMsr(short lcl_arg0) { msr = lcl_arg0; } public short getMsr() { return msr; } } libtritonus-java-20070428/src/classes/org/tritonus/lowlevel/gsm/InvalidGSMFrameException.java0000644000175000017500000000241410172434623032173 0ustar twernertwerner// $Id: InvalidGSMFrameException.java,v 1.1 2005/01/16 09:53:23 pfisterer Exp $ // This file is part of the GSM 6.10 audio decoder library for Java // Copyright (C) 1998 Steven Pickles (pix@test.at) // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Library General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Library General Public License for more details. // You should have received a copy of the GNU Library General Public // License along with this library; if not, write to the Free // Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // This software is a port of the GSM Library provided by // Jutta Degener (jutta@cs.tu-berlin.de) and // Carsten Bormann (cabo@cs.tu-berlin.de), // Technische Universitaet Berlin package org.tritonus.lowlevel.gsm; public class InvalidGSMFrameException extends Exception { } /*** InvalidGSMFrameException.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/lowlevel/gsm/Long_term.java0000644000175000017500000002506510374142165027342 0ustar twernertwerner/* * Long term port to Java. * Copyright (C) 1999 Christopher Edwards * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * */ package org.tritonus.lowlevel.gsm; public class Long_term { public void Gsm_Long_Term_Predictor( short[] d, /* [0..39] residual signal IN */ int k, /* d entry point, which 40 */ short[] e, /* [0..39] add 5 to index OUT */ short[] dp, short[] dpp, int dp_dpp_point_dp0, short[] Nc, /* correlation lag OUT */ short[] bc, /* gain factor OUT */ int Nc_bc_index) { Calculation_of_the_LTP_parameters( d, k, dp, dp_dpp_point_dp0, bc, Nc, Nc_bc_index ); Long_term_analysis_filtering( bc[Nc_bc_index], Nc[Nc_bc_index], dp, d, k, dpp, e, dp_dpp_point_dp0 ); } private void Calculation_of_the_LTP_parameters( short[] d, /* [0..39] IN */ int d_index, short[] dp, /* [-120..-1] IN */ int dp_start, short[] bc_out, /* OUT */ short[] Nc_out, /* OUT */ int Nc_bc_index) throws IllegalArgumentException { int lambda = 0; short Nc = 0; short[] wt = new short[40]; int L_max = 0, L_power = 0; short R = 0, S = 0, dmax = 0, scal = 0; short temp = 0; /* Search of the optimum scaling of d[0..39]. */ for (int k = 0; k <= 39; k++) { temp = d[ k + d_index ]; temp = Add.GSM_ABS( temp ); if (temp > dmax) { dmax = temp; } } temp = 0; if (dmax == 0) { scal = 0; } else { if( ! (dmax > 0) ) { throw new IllegalArgumentException ("Calculation_of_the_LTP_parameters: dmax = " +dmax+" should be > 0."); } temp = Add.gsm_norm( dmax << 16 ); } if (temp > 6) { scal = 0; } else { scal = (short) (6 - temp); } if( ! (scal >= 0) ) { throw new IllegalArgumentException ("Calculation_of_the_LTP_parameters: scal = " +scal+" should be >= 0."); } /* Initialization of a working array wt */ for (int k = 0; k <= 39; k++) { wt[k] = Add.SASR( d[ k + d_index ], scal ); } /* Search for the maximum cross-correlation and coding of the LTP lag */ L_max = 0; Nc = 40; /* index for the maximum cross-correlation */ for (lambda = 40; lambda <= 120; lambda++) { int L_result = 0; int step = 1; L_result = STEP(0, wt, dp, dp_start - lambda ) ; L_result += STEP(1, wt, dp, step + dp_start - lambda ); step++; L_result += STEP(2, wt, dp, step + dp_start - lambda ); step++; L_result += STEP(3, wt, dp, step + dp_start - lambda ); step++; L_result += STEP(4, wt, dp, step + dp_start - lambda ); step++; L_result += STEP(5, wt, dp, step + dp_start - lambda ); step++; L_result += STEP(6, wt, dp, step + dp_start - lambda ); step++; L_result += STEP(7, wt, dp, step + dp_start - lambda ); step++; L_result += STEP(8, wt, dp, step + dp_start - lambda ); step++; L_result += STEP(9, wt, dp, step + dp_start - lambda ); step++; L_result += STEP(10, wt, dp, step + dp_start - lambda ); step++; L_result += STEP(11, wt, dp, step + dp_start - lambda ); step++; L_result += STEP(12, wt, dp, step + dp_start - lambda ); step++; L_result += STEP(13, wt, dp, step + dp_start - lambda ); step++; L_result += STEP(14, wt, dp, step + dp_start - lambda ); step++; L_result += STEP(15, wt, dp, step + dp_start - lambda ); step++; L_result += STEP(16, wt, dp, step + dp_start - lambda ); step++; L_result += STEP(17, wt, dp, step + dp_start - lambda ); step++; L_result += STEP(18, wt, dp, step + dp_start - lambda ); step++; L_result += STEP(19, wt, dp, step + dp_start - lambda ); step++; L_result += STEP(20, wt, dp, step + dp_start - lambda ); step++; L_result += STEP(21, wt, dp, step + dp_start - lambda ); step++; L_result += STEP(22, wt, dp, step + dp_start - lambda ); step++; L_result += STEP(23, wt, dp, step + dp_start - lambda ); step++; L_result += STEP(24, wt, dp, step + dp_start - lambda ); step++; L_result += STEP(25, wt, dp, step + dp_start - lambda ); step++; L_result += STEP(26, wt, dp, step + dp_start - lambda ); step++; L_result += STEP(27, wt, dp, step + dp_start - lambda ); step++; L_result += STEP(28, wt, dp, step + dp_start - lambda ); step++; L_result += STEP(29, wt, dp, step + dp_start - lambda ); step++; L_result += STEP(30, wt, dp, step + dp_start - lambda ); step++; L_result += STEP(31, wt, dp, step + dp_start - lambda ); step++; L_result += STEP(32, wt, dp, step + dp_start - lambda ); step++; L_result += STEP(33, wt, dp, step + dp_start - lambda ); step++; L_result += STEP(34, wt, dp, step + dp_start - lambda ); step++; L_result += STEP(35, wt, dp, step + dp_start - lambda ); step++; L_result += STEP(36, wt, dp, step + dp_start - lambda ); step++; L_result += STEP(37, wt, dp, step + dp_start - lambda ); step++; L_result += STEP(38, wt, dp, step + dp_start - lambda ); step++; L_result += STEP(39, wt, dp, step + dp_start - lambda ); step++; if (L_result > L_max) { Nc = (short) lambda; L_max = L_result; } } Nc_out[Nc_bc_index] = Nc; L_max <<= 1; /* Rescaling of L_max */ if( ! (scal <= 100 && scal >= -100) ) { throw new IllegalArgumentException ("Calculation_of_the_LTP_parameters: scal = " +scal+" should be >= -100 and <= 100."); } L_max = L_max >> (6 - scal); /* sub(6, scal) */ if( ! (Nc <= 120 && Nc >= 40) ) { throw new IllegalArgumentException ("Calculation_of_the_LTP_parameters: Nc = " +Nc+" should be >= 40 and <= 120."); } /* Compute the power of the reconstructed short term residual * signal dp[..] */ L_power = 0; for (int k = 0; k <= 39; k++) { int L_temp; L_temp = Add.SASR( dp[k - Nc + dp_start], 3 ); L_power += L_temp * L_temp; } L_power <<= 1; /* from L_MULT */ /* Normalization of L_max and L_power */ if (L_max <= 0) { bc_out[Nc_bc_index] = 0; return; } if (L_max >= L_power) { bc_out[Nc_bc_index] = 3; return; } temp = Add.gsm_norm( L_power ); R = Add.SASR( L_max << temp, 16 ); S = Add.SASR( L_power << temp, 16 ); /* Coding of the LTP gain */ /* Table 4.3a must be used to obtain the level DLB[i] for the * quantization of the LTP gain b to get the coded version bc. */ for (int bc = 0; bc <= 2; bc++) { if (R <= Add.GSM_MULT(S, Gsm_Def.gsm_DLB[bc])) { break; } bc_out[Nc_bc_index] = (short) bc; } } private int STEP(int k, short[] wt, short[] dp, int dp_i) { return( wt[k] * dp[ dp_i ] ); } /* * In this part, we have to decode the bc parameter to compute * the samples of the estimate dpp[0..39]. The decoding of bc * needs the use of table 4.3b. The long term residual signal * e[0..39] is then calculated to be fed to the RPE encoding * section. */ static void Long_term_analysis_filtering( short bc, /* IN */ short Nc, /* IN */ short[] dp, /* previous d [-120..-1] IN */ short[] d, /* d [0..39] IN */ int d_index, short[] dpp, /* estimate [0..39] OUT */ short[] e, /* long term res. signal [0..39] OUT */ int dp_dpp_index) { short BP = 0; switch (bc) { case 0: BP = (short) 3277; for (int k = 0; k <= 39; k++) { dpp[k + dp_dpp_index] = Add.GSM_MULT_R( BP, dp[k - Nc + dp_dpp_index]); e[k + 5] = Add.GSM_SUB( d[k + d_index], dpp[k + dp_dpp_index] ); } break; case 1: BP = (short) 11469; for (int k = 0; k <= 39; k++) { dpp[k + dp_dpp_index] = Add.GSM_MULT_R( BP, dp[k - Nc + dp_dpp_index]); e[k + 5] = Add.GSM_SUB( d[k + d_index], dpp[k + dp_dpp_index] ); } break; case 2: BP = (short) 21299; for (int k = 0; k <= 39; k++) { dpp[k + dp_dpp_index] = Add.GSM_MULT_R( BP, dp[k - Nc + dp_dpp_index]); e[k + 5] = Add.GSM_SUB( d[k + d_index], dpp[k + dp_dpp_index] ); } break; case 3: BP = (short) 32767; for (int k = 0; k <= 39; k++) { dpp[k + dp_dpp_index] = Add.GSM_MULT_R( BP, dp[k - Nc + dp_dpp_index]); e[k + 5] = Add.GSM_SUB( d[k + d_index], dpp[k + dp_dpp_index] ); } break; } } /* * This procedure uses the bcr and Ncr parameter to realize the * long term synthesis filtering. The decoding of bcr needs * table 4.3b. */ public void Gsm_Long_Term_Synthesis_Filtering( Gsm_State S, short Ncr, short bcr, short[] erp, /* [0..39] IN */ int dp0_index_start_drp /* [-120..-1] IN, [0..40] OUT */ /* drp is a pointer into the Gsm_State * dp0 short array. */ ) throws IllegalArgumentException { short brp, drpp, Nr; short[] drp = S.getDp0(); /* Check the limits of Nr. */ Nr = Ncr < 40 || Ncr > 120 ? S.getNrp() : Ncr; S.setNrp(Nr); if( ! (Nr >= 40 && Nr <= 120) ) { throw new IllegalArgumentException ("Gsm_Long_Term_Synthesis_Filtering Nr = " +Nr+" is out of range. Should be >= 40 and <= 120"); } /* Decoding of the LTP gain bcr */ brp = Gsm_Def.gsm_QLB[ bcr ]; /* Computation of the reconstructed short term residual * signal drp[0..39] */ if(brp == Gsm_Def.MIN_WORD) { throw new IllegalArgumentException ("Gsm_Long_Term_Synthesis_Filtering brp = " +brp+" is out of range. Should be = " +Gsm_Def.MIN_WORD); } for (int k = 0; k <= 39; k++) { drpp = Add.GSM_MULT_R( brp, drp[ k - Nr + dp0_index_start_drp ] ); drp[ k + dp0_index_start_drp ] = Add.GSM_ADD( erp[k], drpp ); } /* * Update of the reconstructed short term residual signal * drp[ -1..-120 ] */ System.arraycopy( drp, (dp0_index_start_drp - 80), drp, (dp0_index_start_drp - 120), 120 ); S.setDp0(drp); } } libtritonus-java-20070428/src/classes/org/tritonus/lowlevel/gsm/Lpc.java0000644000175000017500000002447510374142165026136 0ustar twernertwerner/* * Lpc port to Java. * Copyright (C) 1999 Christopher Edwards * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * */ package org.tritonus.lowlevel.gsm; public class Lpc { private int L_ACF[] = new int[9]; public void Gsm_LPC_Analysis( short[] so, /* 0..159 signals IN/OUT */ short[] LARc) /* 0..7 LARc's OUT */ { Autocorrelation (so); Reflection_coefficients (LARc); Transformation_to_Log_Area_Ratios (LARc); Quantization_and_coding (LARc); } private void Autocorrelation(short[] so) /* [0..159] IN/OUT */ throws IllegalArgumentException { int i = 0, sp_index = 0; short temp = 0, smax = 0, scalauto = 0; /* Dynamic scaling of the array s[0..159] */ /* Search for the maximum. */ for (int k = 0; k <= 159; k++) { temp = Add.GSM_ADD( so[k], (short) 0 ); if (temp > smax) smax = temp; } /* Computation of the scaling factor. */ if (smax == 0) { scalauto = 0; } else { if ( ! (smax > 0) ) { throw new IllegalArgumentException ("Autocorrelation: smax = " +smax+" should be > 0."); } scalauto = (short) (4 - Add.gsm_norm((int)(smax << 16))); /* sub(4,..) */ } /* Scaling of the array s[0...159] */ if (scalauto > 0) { if( ! (scalauto <= 4) ) { throw new IllegalArgumentException ("Autocorrelation: scalauto = " +scalauto+" should be <= 4."); } switch (scalauto) { case 1: for (int k = 0; k <= 159; k++) { so[k] = Add.GSM_MULT_R( so[k], (short)16384 ); } break; case 2: for (int k = 0; k <= 159; k++) { so[k] = Add.GSM_MULT_R( so[k], (short) (16384 >> 1) ); } break; case 3: for (int k = 0; k <= 159; k++) { so[k] = Add.GSM_MULT_R( so[k], (short) (16384 >> 2) ); } break; case 4: for (int k = 0; k <= 159; k++) { so[k] = Add.GSM_MULT_R( so[k], (short) (16384 >> 3) ); } break; } } /* Compute the L_ACF[..]. */ short[] sp = so; short sl = sp[sp_index]; // Zero out L_ACF int[] temp_arr = {0, 0, 0, 0, 0, 0, 0, 0, 0}; System.arraycopy(temp_arr , 0, L_ACF, 0, L_ACF.length); L_ACF[0] += (int)(sl * sp[ (sp_index - 0) ]); sl = sp[++sp_index]; L_ACF[0] += (int)(sl * sp[ (sp_index - 0) ]); L_ACF[1] += (int)(sl * sp[ (sp_index - 1) ]); sl = sp[++sp_index]; L_ACF[0] += (int)(sl * sp[ (sp_index - 0) ]); L_ACF[1] += (int)(sl * sp[ (sp_index - 1) ]); L_ACF[2] += (int)(sl * sp[ (sp_index - 2) ]); sl = sp[++sp_index]; L_ACF[0] += (int)(sl * sp[ (sp_index - 0) ]); L_ACF[1] += (int)(sl * sp[ (sp_index - 1) ]); L_ACF[2] += (int)(sl * sp[ (sp_index - 2) ]); L_ACF[3] += (int)(sl * sp[ (sp_index - 3) ]); sl = sp[++sp_index]; L_ACF[0] += (int)(sl * sp[ (sp_index - 0) ]); L_ACF[1] += (int)(sl * sp[ (sp_index - 1) ]); L_ACF[2] += (int)(sl * sp[ (sp_index - 2) ]); L_ACF[3] += (int)(sl * sp[ (sp_index - 3) ]); L_ACF[4] += (int)(sl * sp[ (sp_index - 4) ]); sl = sp[++sp_index]; L_ACF[0] += (int)(sl * sp[ (sp_index - 0) ]); L_ACF[1] += (int)(sl * sp[ (sp_index - 1) ]); L_ACF[2] += (int)(sl * sp[ (sp_index - 2) ]); L_ACF[3] += (int)(sl * sp[ (sp_index - 3) ]); L_ACF[4] += (int)(sl * sp[ (sp_index - 4) ]); L_ACF[5] += (int)(sl * sp[ (sp_index - 5) ]); sl = sp[++sp_index]; L_ACF[0] += (int)(sl * sp[ (sp_index - 0) ]); L_ACF[1] += (int)(sl * sp[ (sp_index - 1) ]); L_ACF[2] += (int)(sl * sp[ (sp_index - 2) ]); L_ACF[3] += (int)(sl * sp[ (sp_index - 3) ]); L_ACF[4] += (int)(sl * sp[ (sp_index - 4) ]); L_ACF[5] += (int)(sl * sp[ (sp_index - 5) ]); L_ACF[6] += (int)(sl * sp[ (sp_index - 6) ]); sl = sp[++sp_index]; L_ACF[0] += (int)(sl * sp[ (sp_index - 0) ]); L_ACF[1] += (int)(sl * sp[ (sp_index - 1) ]); L_ACF[2] += (int)(sl * sp[ (sp_index - 2) ]); L_ACF[3] += (int)(sl * sp[ (sp_index - 3) ]); L_ACF[4] += (int)(sl * sp[ (sp_index - 4) ]); L_ACF[5] += (int)(sl * sp[ (sp_index - 5) ]); L_ACF[6] += (int)(sl * sp[ (sp_index - 6) ]); L_ACF[7] += (int)(sl * sp[ (sp_index - 7) ]); sl = sp[++sp_index]; for (i = sp_index; i < 160; ++i) { sl = sp[i]; L_ACF[0] += (int)(sl * sp[ (i - 0) ]); L_ACF[1] += (int)(sl * sp[ (i - 1) ]); L_ACF[2] += (int)(sl * sp[ (i - 2) ]); L_ACF[3] += (int)(sl * sp[ (i - 3) ]); L_ACF[4] += (int)(sl * sp[ (i - 4) ]); L_ACF[5] += (int)(sl * sp[ (i - 5) ]); L_ACF[6] += (int)(sl * sp[ (i - 6) ]); L_ACF[7] += (int)(sl * sp[ (i - 7) ]); L_ACF[8] += (int)(sl * sp[ (i - 8) ]); } for (int k = 0; k < 9; k++) { L_ACF[k] <<= 1; } /* Rescaling of the array s[0..159] */ if (scalauto > 0) { if( ! (scalauto <= 4) ) { throw new IllegalArgumentException ("Autocorrelation: scalauto = " +scalauto+" should be <= 4."); } for (int k = 0; k < 160; k++) { so[k] <<= scalauto; } } } private void Reflection_coefficients(short[] r /* 0...7 OUT */) throws IllegalArgumentException { short temp = 0; int r_index = 0; short[] ACF = new short[9]; /* 0..8 */ short[] P = new short[9]; /* 0..8 */ short[] K = new short[9]; /* 2..8 */ /* Schur recursion with 16 bits arithmetic. */ if (L_ACF[0] == 0) { /* everything is the same. */ for (int i = 0; i < 8; i++) { r[i] = 0; } return; } if( L_ACF[0] == 0 ) { throw new IllegalArgumentException ("Reflection_coefficients: L_ACF[0] = " +L_ACF[0]+" should not = 0."); } temp = Add.gsm_norm( L_ACF[0] ); if ( ! (temp >= 0 && temp < 32) ) { throw new IllegalArgumentException ("Reflection_coefficients: temp = " +temp+" should be >= 0 and < 32."); } /* ? overflow ? */ for (int i = 0; i <= 8; i++) { ACF[i] = Add.SASR( L_ACF[i] << temp, 16 ); } /* Initialize array P[..] and K[..] for the recursion. */ System.arraycopy(ACF , 0, K, 0, 7); System.arraycopy(ACF , 0, P, 0, 8); /* Compute reflection coefficients */ for (int n = 1; n <= 8; n++, r_index++) { temp = P[1]; temp = Add.GSM_ABS(temp); if (P[0] < temp) { for (int i = n; i < 8; i++) { r[i] = 0; } return; } r[r_index] = Add.gsm_div( temp, P[0] ); if ( ! (r[r_index] >= 0) ) { throw new IllegalArgumentException ("Reflection_coefficients: r["+r_index+"] = " +r[r_index]+" should be >= 0"); } if (P[1] > 0) { /* r[n] = sub(0, r[n]) */ r[r_index] = (short) (-(r[r_index])); } if ( r[r_index] == Gsm_Def.MIN_WORD ) { throw new IllegalArgumentException ("Reflection_coefficients: r["+r_index+"] = " +r[r_index]+" should not be "+ Gsm_Def.MIN_WORD ); } if (n == 8) return; /* Schur recursion */ temp = Add.GSM_MULT_R( P[1], r[r_index] ); P[0] = Add.GSM_ADD( P[0], temp ); for (int m = 1; m <= 8 - n; m++) { temp = Add.GSM_MULT_R( K[ m ], r[r_index] ); P[m] = Add.GSM_ADD( P[ m+1 ], temp ); temp = Add.GSM_MULT_R( P[ m+1 ], r[r_index] ); K[m] = Add.GSM_ADD( K[ m ], temp ); } } } /* 4.2.6 */ /* * The following scaling for r[..] and LAR[..] has been used: * * r[..] = integer( real_r[..]*32768. ); -1 <= real_r < 1. * LAR[..] = integer( real_LAR[..] * 16384 ); * with -1.625 <= real_LAR <= 1.625 */ private void Transformation_to_Log_Area_Ratios(short[] r /* 0..7 IN/OUT */) throws IllegalArgumentException { short temp; /* Computation of the LAR[0..7] from the r[0..7] */ for (int i = 0; i < 8; i++) { temp = r[i]; temp = Add.GSM_ABS(temp); if( ! (temp >= 0) ) { throw new IllegalArgumentException ("Transformation_to_Log_Area_Ratios: temp = " +temp+" should be >= 0 "); } if (temp < 22118) { temp >>= 1; } else if (temp < 31130) { if( ! (temp >= 11059) ) { throw new IllegalArgumentException ("Transformation_to_Log_Area_Ratios: temp = " +temp+" should be >= 11059 "); } temp -= 11059; } else { if( ! (temp >= 26112) ) { throw new IllegalArgumentException ("Transformation_to_Log_Area_Ratios: temp = " +temp+" should be >= 26112 "); } temp -= 26112; temp <<= 2; } r[i] = (short) (r[i] < 0 ? -temp : temp); if( r[i] == Gsm_Def.MIN_WORD ) { throw new IllegalArgumentException ("Transformation_to_Log_Area_Ratios: r["+i+"] = " +r[i]+" should not be = " +Gsm_Def.MIN_WORD); } } } /* 4.2.7 */ /* This procedure needs four tables; the following equations * give the optimum scaling for the constants: * * A[0..7] = integer( real_A[0..7] * 1024 ) * B[0..7] = integer( real_B[0..7] * 512 ) * MAC[0..7] = maximum of the LARc[0..7] * MIC[0..7] = minimum of the LARc[0..7] */ private void Quantization_and_coding(short[] LAR /* [0..7] IN/OUT */) { int index = 0; STEP2( 20480, 0, 31, -32, LAR, index++ ); STEP2( 20480, 0, 31, -32, LAR, index++ ); STEP2( 20480, 2048, 15, -16, LAR, index++ ); STEP2( 20480, -2560, 15, -16, LAR, index++ ); STEP2( 13964, 94, 7, -8, LAR, index++ ); STEP2( 15360, -1792, 7, -8, LAR, index++ ); STEP2( 8534, -341, 3, -4, LAR, index++ ); STEP2( 9036, -1144, 3, -4, LAR, index++ ); } private void STEP2(int A, int B, int MAC, int MIC, short[] LAR, int index) { short temp = 0; temp = Add.GSM_MULT( (short)A, LAR[index] ); temp = Add.GSM_ADD( temp, (short)B ); temp = Add.GSM_ADD( temp, (short) 256 ); temp = Add.SASR( temp, 9 ); LAR[index] = (short) (temp > MAC ? MAC - MIC : (temp < MIC ? 0 : temp - MIC)); } } libtritonus-java-20070428/src/classes/org/tritonus/lowlevel/gsm/Rpe.java0000644000175000017500000003266710374142165026150 0ustar twernertwerner/* * Rpe port to Java. * Copyright (C) 1999 Christopher Edwards * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * */ package org.tritonus.lowlevel.gsm; public class Rpe { private short exp_in; /* IN */ private short mant_in; /* IN */ private short exp_out; /* OUT */ private short mant_out; /* OUT */ private int xMp_point = 0; private static final int ENCODE = 0; private static final int DECODE = 1; private short[] x = new short[40]; /* signal [0..39] OUT */ public void Gsm_RPE_Encoding( short[] e, /* -5..-1][0..39][40..44 IN/OUT */ short[] xmaxc, /* [0..3] Coded maximum amplitude OUT */ short[] Mc, /* [0..3] RPE grid selection OUT */ int xmaxc_Mc_index, /* Ref. point for xmaxc and Mc */ short[] xMc, /* [0..12] OUT */ int xMc_index /* Ref. for xmc, '+=13' */ ) { short[] xM = new short[13]; short[] xMp = new short[13]; Weighting_filter( e ); /* Sets up the private data member 'x[40]' */ RPE_grid_selection( xM, Mc, xmaxc_Mc_index ); /* Sets up xM[13] */ /* Sets up xmc (13 array locations starting from xMc_index), * xmaxc (one array location at xmaxc_Mc_index), * exp_in and mant_in */ APCM_quantization( xM, xMc, xMc_index, xmaxc, xmaxc_Mc_index ); /* Sets up xMp[13] */ APCM_inverse_quantization( xMc, xMp, xMc_index, ENCODE ); RPE_grid_positioning( Mc[xmaxc_Mc_index], xMp, e, ENCODE ); } /* * The coefficients of the weighting filter are stored in a table * (see table 4.4). The following scaling is used: * * H[0..10] = integer( real_H[ 0..10] * 8192 ); */ private void Weighting_filter( short[] e) /* signal [-5..0.39.44] IN */ { int L_result = 0; /* * (e[-5..-1] and e[40..44] are allocated by the caller, * are initially zero and are not written anywhere.) * * e -= 5; * * The above case is true with the C code, although java * does not have pointers so e[0..49] is all set for this * method. */ /* Compute the signal x[0..39] */ for (int k = 0; k <= 39; k++) { L_result = 8192 >> 1; /* Every one of these multiplications is done twice -- * but I don't see an elegant way to optimize this. * Do you? */ /* #define STEP( i, H ) (e[ k + i ] * H) */ L_result +=( e[ k + 0 ] * -134 ) + ( e[ k + 1 ] * -374 ) /* + STEP( 2, 0 ) no sense in adding zero */ + ( e[ k + 3 ] * 2054 ) + ( e[ k + 4 ] * 5741 ) + ( e[ k + 5 ] * 8192 ) + ( e[ k + 6 ] * 5741 ) + ( e[ k + 7 ] * 2054 ) /* + STEP( 8, 0 ) no sense in adding zero */ + ( e[ k + 9 ] * -374 ) + ( e[ k + 10 ] * -134 ); /* 2 adds vs. >>16 => 14, minus one shift to compensate for * those we lost when replacing L_MULT by '*'. */ L_result = Add.SASR( L_result, 13 ); x[k] = (short) ((L_result < Gsm_Def.MIN_WORD ? Gsm_Def.MIN_WORD : (L_result > Gsm_Def.MAX_WORD ? Gsm_Def.MAX_WORD : L_result ))); } } /* * The signal x[0..39] is used to select the RPE grid which is * represented by Mc. */ private void RPE_grid_selection( short[] xM, /* [0..12] OUT */ short[] Mc_out, /* OUT */ int Mc_index) { int L_result = 0; int EM = 0; /* xxx should be L_EM? */ short Mc = 0; int L_common_0_3; /* common part of 0 and 3 */ L_result = 0; L_result += STEP( 0, 1 ) + STEP( 0, 2 ) + STEP( 0, 3 ) + STEP( 0, 4 ) + STEP( 0, 5 ) + STEP( 0, 6 ) + STEP( 0, 7 ) + STEP( 0, 8 ) + STEP( 0, 9 ) + STEP( 0, 10) + STEP( 0, 11) + STEP( 0, 12); L_common_0_3 = L_result; /* i = 0 */ L_result += STEP( 0, 0 ); L_result <<= 1; /* implicit in L_MULT */ EM = L_result; /* i = 1 */ L_result = 0; L_result += STEP( 1, 0 ) + STEP( 1, 1 ) + STEP( 1, 2 ) + STEP( 1, 3 ) + STEP( 1, 4 ) + STEP( 1, 5 ) + STEP( 1, 6 ) + STEP( 1, 7 ) + STEP( 1, 8 ) + STEP( 1, 9 ) + STEP( 1, 10) + STEP( 1, 11) + STEP( 1, 12); L_result <<= 1; if (L_result > EM) { Mc = 1; EM = L_result; } /* i = 2 */ L_result = 0; L_result += STEP( 2, 0 ) + STEP( 2, 1 ) + STEP( 2, 2 ) + STEP( 2, 3 ) + STEP( 2, 4 ) + STEP( 2, 5 ) + STEP( 2, 6 ) + STEP( 2, 7 ) + STEP( 2, 8 ) + STEP( 2, 9 ) + STEP( 2, 10) + STEP( 2, 11) + STEP( 2, 12); L_result <<= 1; if (L_result > EM) { Mc = 2; EM = L_result; } /* i = 3 */ L_result = L_common_0_3; L_result += STEP( 3, 12 ); L_result <<= 1; if (L_result > EM) { Mc = 3; EM = L_result; } /* Down-sampling by a factor 3 to get the selected xM[0..12] * RPE sequence. */ for (int i = 0; i <= 12; i ++) { xM[i] = x[Mc + 3*i]; } Mc_out[Mc_index] = Mc; } private int STEP(int m, int i ) { int L_temp; L_temp = Add.SASR( x[m + 3 * i], 2 ); return ( L_temp * L_temp ); } private void APCM_quantization ( short[] xM, /* [0..12] IN */ short[] xMc, /* [0..12] OUT */ int xMc_index, short[] xmaxc_out, /* OUT */ int xmaxc_index) throws IllegalArgumentException { int itest = 0; short xmax = 0, xmaxc = 0, temp = 0, temp1 = 0, temp2 = 0; short exp = 0, mant = 0; /* Find the maximum absolute value xmax of xM[0..12]. */ for (int i = 0; i <= 12; i++) { temp = xM[i]; temp = Add.GSM_ABS(temp); if (temp > xmax) { xmax = temp; } } /* Qantizing and coding of xmax to get xmaxc. */ exp = 0; temp = Add.SASR( xmax, 9 ); itest = 0; for (int i = 0; i <= 5; i++) { if(temp <= 0) { itest |= 1; } else { itest |= 0; } temp = Add.SASR( temp, 1 ); if( ! (exp <= 5)) { throw new IllegalArgumentException ("APCM_quantization: exp = " +exp+" is out of range. Should be <= 5"); } if (itest == 0) { exp++; /* exp = add (exp, 1) */ } } if( ! (exp <= 6 && exp >= 0)) { throw new IllegalArgumentException ("APCM_quantization: exp = " +exp+" is out of range. Should be >= -4 and <= 6"); } temp = (short) (exp + 5); if( ! (temp <= 11 && temp >= 0)) { throw new IllegalArgumentException ("APCM_quantization: temp = " +temp+" is out of range. Should be >= 0 and <= 11"); } xmaxc = Add.GSM_ADD( Add.SASR(xmax, temp), (short) (exp << 3) ); /* Quantizing and coding of the xM[0..12] RPE sequence * to get the xMc[0..12] */ APCM_quantization_xmaxc_to_exp_mant( xmaxc, ENCODE ); exp = exp_in; mant = mant_in; /* This computation uses the fact that the decoded version of xmaxc * can be calculated by using the exponent and the mantissa part of * xmaxc (logarithmic table). * So, this method avoids any division and uses only a scaling * of the RPE samples by a function of the exponent. A direct * multiplication by the inverse of the mantissa (NRFAC[0..7] * found in table 4.5) gives the 3 bit coded version xMc[0..12] * of the RPE samples. */ /* Direct computation of xMc[0..12] using table 4.5 */ if( ! (exp <= 4096 && exp >= -4096)) { throw new IllegalArgumentException ("APCM_quantization: exp = " +exp+" is out of range. Should be >= -4096 and <= 4096"); } if( ! (mant >= 0 && mant <= 7 )) { throw new IllegalArgumentException ("APCM_quantization: mant = " +mant+" is out of range. Should be >= 0 and <= 7"); } temp1 = (short) (6 - exp); /* normalization by the exponent */ temp2 = Gsm_Def.gsm_NRFAC[ mant ]; /* inverse mantissa */ for (int i = 0; i <= 12; i++) { if( ! (temp1 >= 0 && temp1 < 16)) { throw new IllegalArgumentException ("APCM_quantization: temp = " +temp+" is out of range. Should be >= 0 and < 16"); } temp = (short) (xM[i] << temp1); temp = Add.GSM_MULT( temp, temp2 ); temp = Add.SASR(temp, 12); xMc[i + xMc_index] = (short) (temp + 4); /* see note below */ } /* NOTE: This equation is used to make all the xMc[i] positive. */ mant_in = mant; exp_in = exp; xmaxc_out[xmaxc_index] = xmaxc; } public void APCM_quantization_xmaxc_to_exp_mant( short xmaxc_elem, int METHOD_ID) throws IllegalArgumentException { short exp = 0, mant = 0; /* Compute exponent and mantissa of the decoded version of xmaxc */ if (xmaxc_elem > 15) { exp = (short) (Add.SASR(xmaxc_elem, 3) - 1); } mant = (short) (xmaxc_elem - (exp << 3)); if (mant == 0) { exp = (short) -4; mant = (short) 7; } else { while (mant <= 7) { mant = (short) (mant << 1 | 1); exp--; } mant -= (short) 8; } if( exp < -4 || exp > 6 ) { throw new IllegalArgumentException ("APCM_quantization_xmaxc_to_exp_mant: exp = " +exp+" is out of range. Should be >= -4 and <= 6"); } if( mant < 0 || mant > 7 ) { throw new IllegalArgumentException ("APCM_quantization_xmaxc_to_exp_mant: mant = " +mant+" is out of range. Should be >= 0 and <= 7"); } if ( METHOD_ID == ENCODE ) { exp_in = exp; mant_in = mant; } else { /* DECODE */ exp_out = exp; mant_out = mant; } } public void Gsm_RPE_Decoding_java( short xmaxc_elem, /* From Gsm_Decoder xmaxc short array */ short Mc_elem, /* From Gsm_Decoder Mc short array */ int xmc_start, /* Starting point for the three bit part of xmc */ short[] xmc, /* [0..12], 3 bits IN */ short[] erp /* [0..39] OUT */ ) { short xMp[] = new short[13]; /* exp_out and mant_out are modified in this method */ APCM_quantization_xmaxc_to_exp_mant(xmaxc_elem, DECODE); APCM_inverse_quantization(xmc, xMp, xmc_start, DECODE); RPE_grid_positioning(Mc_elem, xMp, erp, DECODE); } /* * This part is for decoding the RPE sequence of coded xMc[0..12] * samples to obtain the xMp[0..12] array. Table 4.6 is used to get * the mantissa of xmaxc (FAC[0..7]). */ public void APCM_inverse_quantization( short[] xmc, /* [0..12] IN */ short[] xMp, /* [0..12] OUT */ int xmc_start, int METHOD_ID) throws IllegalArgumentException { short temp, temp1, temp2, temp3; if ( METHOD_ID == ENCODE ) { temp1 = Gsm_Def.gsm_FAC[ mant_in ]; temp2 = Add.GSM_SUB( (short)6, exp_in ); } else { /* DECODE */ temp1 = Gsm_Def.gsm_FAC[ mant_out ]; temp2 = Add.GSM_SUB( (short)6, exp_out ); } temp3 = Add.gsm_asl( (short)1, Add.GSM_SUB( temp2, (short)1 )); xMp_point = 0; for (int i = 0; i < 13; i++) { /* restore sign */ temp = (short) ((xmc[xmc_start++] << 1) - 7); if( ! (temp <= 7 && temp >= -7) ) { /* 4 bit signed */ throw new IllegalArgumentException ("APCM_inverse_quantization: temp = " +temp+" is out of range. Should be >= -7 and <= 7"); } temp <<= 12; /* 16 bit signed */ temp = Add.GSM_MULT_R( temp1, temp ); temp = Add.GSM_ADD( temp, temp3 ); xMp[ xMp_point++ ] = Add.gsm_asr( temp, temp2 ); } } /* * This method computes the reconstructed long term residual signal * ep[0..39] for the LTP analysis filter. The inputs are the Mc * which is the grid position selection and the xMp[0..12] decoded * RPE samples which are upsampled by a factor of 3 by inserting zero * values. */ public static void RPE_grid_positioning( short Mc, /* grid position IN */ short[] xMp, /* [0..12] IN */ short[] ep, /* [0..39] OUT */ int METHOD_ID) throws IllegalArgumentException { int i = 13; int xMp_index = 0; int ep_index; if (METHOD_ID == ENCODE) { ep_index = 5; } else { /* Decode */ ep_index = 0; } if( ! (0 <= Mc && Mc <= 3) ) { throw new IllegalArgumentException ("RPE_grid_positioning: Mc = " +Mc+" is out of range. Should be >= 0 and <= 3"); } switch (Mc) { case 3: ep[ep_index++] = 0; do { ep[ep_index++] = 0; ep[ep_index++] = 0; ep[ep_index++] = xMp[xMp_index++]; --i; } while (i != 0); break; case 2: do { ep[ep_index++] = 0; ep[ep_index++] = 0; ep[ep_index++] = xMp[xMp_index++]; --i; } while (i != 0); break; case 1: do { ep[ep_index++] = 0; ep[ep_index++] = xMp[xMp_index++]; ep[ep_index++] = 0; --i; } while (i != 0); break; case 0: do { ep[ep_index++] = xMp[xMp_index++]; ep[ep_index++] = 0; ep[ep_index++] = 0; --i; } while (i != 0); break; } if (METHOD_ID == ENCODE) { ep[ep_index++] = 0; } } } libtritonus-java-20070428/src/classes/org/tritonus/lowlevel/gsm/Short_term.java0000644000175000017500000002341510374142165027537 0ustar twernertwerner/* * Short term port to Java. * Copyright (C) 1999 Christopher Edwards * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * */ package org.tritonus.lowlevel.gsm; public class Short_term { public void Gsm_Short_Term_Analysis_Filter( Gsm_State S, short[] LARc, /* coded log area ratio [0..7] IN */ short[] s /* signal [0..159] IN/OUT */ ) throws ArrayIndexOutOfBoundsException { short[] LARp = new short[8]; int array_index0 = S.getJ(); int array_index1 = array_index0; array_index1 ^= 1; S.setJ( (short) array_index1); if( array_index0 < 0 || array_index0 > 1 || array_index1 < 0 || array_index1 > 1 ) { throw new ArrayIndexOutOfBoundsException ("Gsm_Short_Term_Synthesis_Filter: Indexing LARpp " +"incorrectly. Should be >= 0 and <= 1"); } short[] LARpp_j = S.getLARppIndexed( array_index0 ); short[] LARpp_j_1 = S.getLARppIndexed( array_index1 ); Decoding_of_the_coded_Log_Area_Ratios( LARc, LARpp_j ); Coefficients_0_12( LARpp_j_1, LARpp_j, LARp ); LARp_to_rp( LARp ); Short_term_analysis_filtering( S, LARp, 13, s, 0 ); Coefficients_13_26( LARpp_j_1, LARpp_j, LARp); LARp_to_rp( LARp ); Short_term_analysis_filtering( S, LARp, 14, s, 13); Coefficients_27_39( LARpp_j_1, LARpp_j, LARp); LARp_to_rp( LARp ); Short_term_analysis_filtering( S, LARp, 13, s, 27); Coefficients_40_159( LARpp_j, LARp); LARp_to_rp( LARp ); Short_term_analysis_filtering( S, LARp, 120, s, 40); } public void Gsm_Short_Term_Synthesis_Filter( Gsm_State S, short[] LARcr, /* received log area ratios [0..7] IN */ short[] wt, /* received d [0..159] IN */ int[] s /* signal s [0..159] OUT */ ) throws ArrayIndexOutOfBoundsException { short[] LARp = new short[8]; int array_index0 = S.getJ(); int array_index1 = array_index0; array_index1 ^= 1; S.setJ( (short) array_index1); if( array_index0 < 0 || array_index0 > 1 || array_index1 < 0 || array_index1 > 1 ) { throw new ArrayIndexOutOfBoundsException ("Gsm_Short_Term_Synthesis_Filter: Indexing LARpp " +"incorrectly. Should be >= 0 and <= 1"); } short[] LARpp_j = S.getLARppIndexed( array_index0 ); short[] LARpp_j_1 = S.getLARppIndexed( array_index1 ); Decoding_of_the_coded_Log_Area_Ratios( LARcr, LARpp_j ); Coefficients_0_12( LARpp_j_1, LARpp_j, LARp ); LARp_to_rp( LARp ); Short_term_synthesis_filtering( S, LARp, 13, wt, s, 0 ); Coefficients_13_26( LARpp_j_1, LARpp_j, LARp); LARp_to_rp( LARp ); Short_term_synthesis_filtering( S, LARp, 14, wt, s, 13 ); Coefficients_27_39( LARpp_j_1, LARpp_j, LARp); LARp_to_rp( LARp ); Short_term_synthesis_filtering( S, LARp, 13, wt, s, 27 ); Coefficients_40_159( LARpp_j, LARp ); LARp_to_rp( LARp ); Short_term_synthesis_filtering(S, LARp, 120, wt, s, 40); S.setLARppIndexed(array_index0, LARpp_j); S.setLARppIndexed(array_index1, LARpp_j_1); } public static void Decoding_of_the_coded_Log_Area_Ratios( short[] LARc, /* coded log area ratio [0..7] IN */ short[] LARpp) /* out: decoded .. */ { short temp1 = 0; int index = 0; /* This procedure requires for efficient implementation * two tables. * * INVA[1..8] = integer( (32768 * 8) / real_A[1..8]) * MIC[1..8] = minimum value of the LARc[1..8] */ /* Compute the LARpp[1..8] */ STEP(LARc, LARpp, index++, temp1, (short)0, (short) -32, (short) 13107); STEP(LARc, LARpp, index++, temp1, (short)0, (short) -32, (short) 13107); STEP(LARc, LARpp, index++, temp1, (short)2048, (short)-16, (short)13107); STEP(LARc, LARpp, index++, temp1, (short)-2560, (short)-16, (short)13107); STEP(LARc, LARpp, index++, temp1, (short) 94, (short) -8, (short) 19223); STEP(LARc, LARpp, index++, temp1, (short) -1792, (short)-8, (short)17476); STEP(LARc, LARpp, index++, temp1, (short) -341, (short)-4, (short)31454); STEP(LARc, LARpp, index++, temp1, (short) -1144, (short)-4, (short)29708); /* NOTE: the addition of *MIC is used to restore * the sign of *LARc. */ } public static void STEP(short[] LARc, short[] LARpp, int index, short temp1, short B, short MIC, short INVA) { temp1 = (short) (Add.GSM_ADD( LARc[index], MIC ) << 10); temp1 = Add.GSM_SUB( temp1, (short) (B << 1) ); temp1 = Add.GSM_MULT_R( INVA, temp1 ); LARpp[index] = Add.GSM_ADD( temp1, temp1 ); } /* 4.2.9 */ /* Computation of the quantized reflection coefficients */ /* 4.2.9.1 Interpolation of the LARpp[1..8] to get the LARp[1..8] */ /* * Within each frame of 160 analyzed speech samples the short term * analysis and synthesis filters operate with four different sets of * coefficients, derived from the previous set of decoded LARs(LARpp(j-1)) * and the actual set of decoded LARs (LARpp(j)) * * (Initial value: LARpp(j-1)[1..8] = 0.) */ public static void Coefficients_0_12( short[] LARpp_j_1, short[] LARpp_j, short[] LARp) { for (int i = 0; i < 8; i++) { LARp[i] = Add.GSM_ADD(Add.SASR(LARpp_j_1[i], 2 ), Add.SASR(LARpp_j[i], 2 )); LARp[i] = Add.GSM_ADD(LARp[i], Add.SASR(LARpp_j_1[i], 1)); } } public static void Coefficients_13_26( short[] LARpp_j_1, short[] LARpp_j, short[] LARp) { for (int i = 0; i < 8; i++) { LARp[i] = Add.GSM_ADD(Add.SASR(LARpp_j_1[i], 1), Add.SASR(LARpp_j[i], 1 )); } } public static void Coefficients_27_39( short[] LARpp_j_1, short[] LARpp_j, short[] LARp) { for (int i = 0; i < 8; i++) { LARp[i] = Add.GSM_ADD(Add.SASR(LARpp_j_1[i], 2 ), Add.SASR(LARpp_j[i], 2 )); LARp[i] = Add.GSM_ADD(LARp[i], Add.SASR(LARpp_j[i], 1 )); } } public static void Coefficients_40_159( short[] LARpp_j, short[] LARp) { for (int i = 0; i < 8; i++) LARp[i] = LARpp_j[i]; } /* 4.2.9.2 */ /* * The input of this method is the interpolated LARp[0..7] array. * The reflection coefficients, rp[i], are used in the analysis * filter and in the synthesis filter. */ public static void LARp_to_rp( short[] LARp) /* [0..7] IN/OUT */ { short temp; for (int i = 0; i < 8; i++) { if (LARp[i] < 0) { temp = (short) (LARp[i] == Gsm_Def.MIN_WORD ? Gsm_Def.MAX_WORD : -(LARp[i])); LARp[i] = (short) (- ((temp < 11059) ? temp << 1 : ((temp < 20070) ? temp + 11059 : Add.GSM_ADD( (short) (temp >> 2), (short) 26112 )))); } else { temp = LARp[i]; LARp[i] = (short) ((temp < 11059) ? temp << 1 : ((temp < 20070) ? temp + 11059 : Add.GSM_ADD( (short) (temp >> 2), (short) 26112 ))); } } } /* * This procedure computes the short term residual signal d[..] to be fed * to the RPE-LTP loop from the s[..] signal and from the local rp[..] * array (quantized reflection coefficients). As the call of this * procedure can be done in many ways (see the interpolation of the LAR * coefficient), it is assumed that the computation begins with index * k_start (for arrays d[..] and s[..]) and stops with index k_end * (k_start and k_end are defined in 4.2.9.1). This procedure also * needs to keep the array u[0..7] in memory for each call. */ private void Short_term_analysis_filtering( Gsm_State S, short[] rp, /* [0..7] IN */ int k_n, /* k_end - k_start */ short[] s, /* [0..n-1] IN/OUT */ int s_index) { short[] u = S.getU(); short di = 0, zzz = 0, ui = 0, sav = 0, rpi = 0; while (k_n != 0) { k_n--; di = sav = s[s_index]; for (int i = 0; i < 8; i++) { /* YYY */ ui = u[i]; rpi = rp[i]; u[i] = sav; zzz = Add.GSM_MULT_R(rpi, di); sav = Add.GSM_ADD( ui, zzz); zzz = Add.GSM_MULT_R(rpi, ui); di = Add.GSM_ADD( di, zzz ); } s[s_index++] = di; } S.setU(u); } public static void Short_term_synthesis_filtering( Gsm_State S, short[] rrp, /* [0..7] IN */ int k, /* k_end - k_start */ short[] wt, /* [0..k-1] IN */ int[] sr, /* [0..k-1] OUT */ int wt_sr_index_start) { short[] v_temp = S.getV(); short sri = 0, tmp1 = 0, tmp2 = 0; int index = wt_sr_index_start; while (k != 0) { k--; sri = wt[index]; for (int i = 7; i >= 0; i--) { /* sri = GSM_SUB( sri, gsm_mult_r( rrp[i], * v_temp[i] ) ); */ tmp1 = rrp[i]; tmp2 = v_temp[i]; tmp2 = (short) ( tmp1 == Gsm_Def.MIN_WORD && tmp2 == Gsm_Def.MIN_WORD ? Gsm_Def.MAX_WORD : 0x0FFFF & (( (int)tmp1 * (int)tmp2 + 16384) >> 15)) ; sri = Add.GSM_SUB( sri, tmp2 ); /* v[i+1] = GSM_ADD( v_temp[i], * gsm_mult_r( rrp[i], sri ) ); */ tmp1 = (short) ( tmp1 == Gsm_Def.MIN_WORD && sri == Gsm_Def.MIN_WORD ? Gsm_Def.MAX_WORD : 0x0FFFF & (( (int)tmp1 * (int)sri + 16384) >> 15)) ; v_temp[i+1] = Add.GSM_ADD( v_temp[i], tmp1); } sr[index++] = v_temp[0] = sri; } S.setV(v_temp); } } libtritonus-java-20070428/src/classes/org/tritonus/lowlevel/gsm/package.html0000644000175000017500000000057710172434623027032 0ustar twernertwerner

GSM 06.10 encoder and decoder. The classes provided here .

Related Documentation

GSM 06.10 lossy speech compression

@see org.tritonus.sampled.convert.gsm libtritonus-java-20070428/src/classes/org/tritonus/lowlevel/lame/0000755000175000017500000000000010621572431024667 5ustar twernertwernerlibtritonus-java-20070428/src/classes/org/tritonus/lowlevel/lame/Lame.java0000644000175000017500000003507010374160732026417 0ustar twernertwerner/* * Lame.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2000,2001 by Florian Bomers * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.lowlevel.lame; import java.io.UnsupportedEncodingException; import javax.sound.sampled.AudioFormat; import org.tritonus.share.TDebug; public class Lame { // constants from lame.h private static final int MPEG_VERSION_2 = 0; // MPEG-2 private static final int MPEG_VERSION_1 = 1; // MPEG-1 private static final int MPEG_VERSION_2DOT5 = 2; // MPEG-2.5 public static final int QUALITY_LOWEST = 9; // low mean bitrate in VBR mode public static final int QUALITY_LOW = 7; public static final int QUALITY_MIDDLE = 5; public static final int QUALITY_HIGH = 2; // quality==0 not yet coded in LAME (3.83alpha) public static final int QUALITY_HIGHEST = 1; // high mean bitrate in VBR mode public static final int CHANNEL_MODE_STEREO = 0; public static final int CHANNEL_MODE_JOINT_STEREO = 1; public static final int CHANNEL_MODE_DUAL_CHANNEL = 2; public static final int CHANNEL_MODE_MONO = 3; // channel mode has no influence on mono files. public static final int CHANNEL_MODE_AUTO = -1; public static final int BITRATE_AUTO = -1; // suggested maximum buffer size for an mpeg frame private static final int DEFAULT_PCM_BUFFER_SIZE=2048*16; // frame size=576 for MPEG2 and MPEG2.5 // =576*2 for MPEG1 private static boolean libAvailable=false; private static String linkError=""; private static int DEFAULT_QUALITY = QUALITY_MIDDLE; private static int DEFAULT_BITRATE = BITRATE_AUTO; private static int DEFAULT_CHANNEL_MODE = CHANNEL_MODE_AUTO; // in VBR mode, bitrate is ignored. private static boolean DEFAULT_VBR = false; private static final int OUT_OF_MEMORY = -300; private static final int NOT_INITIALIZED = -301; private static final int LAME_ENC_NOT_FOUND = -302; private static final String PROPERTY_PREFIX = "tritonus.lame."; static { try { System.loadLibrary("lametritonus"); libAvailable=true; } catch (UnsatisfiedLinkError e) { if (TDebug.TraceAllExceptions) { TDebug.out(e); } linkError=e.getMessage(); } } /** * Holds LameConf * This field is long because on 64 bit architectures, the native * size of ints may be 64 bit. */ @SuppressWarnings("unused") private long m_lNativeGlobalFlags; // these fields are set upon successful initialization to show effective values. private int effQuality; private int effBitRate; private int effVbr; private int effChMode; private int effSampleRate; private int effEncoding; private void handleNativeException(int resultCode) { close(); if (resultCode==OUT_OF_MEMORY) { throw new OutOfMemoryError("out of memory"); } else if (resultCode==NOT_INITIALIZED) { throw new RuntimeException("not initialized"); } else if (resultCode==LAME_ENC_NOT_FOUND) { libAvailable=false; linkError="lame_enc.dll not found"; throw new IllegalArgumentException(linkError); } } /** * Initializes the decoder with * DEFAULT_BITRATE, DEFAULT_CHANNEL_MODE, DEFAULT_QUALITY, and DEFAULT_VBR * Throws IllegalArgumentException when parameters are not supported * by LAME. */ public Lame(AudioFormat sourceFormat) { initParams(sourceFormat); } /** * Initializes the decoder. * Throws IllegalArgumentException when parameters are not supported * by LAME. */ public Lame(AudioFormat sourceFormat, int bitRate, int channelMode, int quality, boolean VBR) { initParams(sourceFormat, bitRate, channelMode, quality, VBR); } private void initParams(AudioFormat sourceFormat) { readParameters(); initParams(sourceFormat, DEFAULT_BITRATE, DEFAULT_CHANNEL_MODE, DEFAULT_QUALITY, DEFAULT_VBR); } private void initParams(AudioFormat sourceFormat, int bitRate, int channelMode, int quality, boolean VBR) { // simple check that bitrate is not too high for MPEG2 and MPEG2.5 // todo: exception ? if (sourceFormat.getSampleRate()<32000 && bitRate>160) { bitRate=160; } if (TDebug.TraceAudioConverter) { TDebug.out("LAME parameters: channels="+sourceFormat.getChannels() +" sample rate="+(Math.round(sourceFormat.getSampleRate())+"Hz") +" bitrate="+bitRate+"KBit/s"); TDebug.out(" channelMode="+chmode2string(channelMode) +" quality="+quality2string(quality) +" VBR="+VBR+" bigEndian="+sourceFormat.isBigEndian()); } int result=nInitParams(sourceFormat.getChannels(), Math.round(sourceFormat.getSampleRate()), bitRate, channelMode, quality, VBR, sourceFormat.isBigEndian()); if (result<0) { handleNativeException(result); throw new IllegalArgumentException( "parameters not supported by LAME (returned "+result+")"); } // provide effective parameters to user-space try { System.setProperty(PROPERTY_PREFIX + "effective.quality", quality2string(getEffectiveQuality())); System.setProperty(PROPERTY_PREFIX + "effective.bitrate", String.valueOf(getEffectiveBitRate())); System.setProperty(PROPERTY_PREFIX + "effective.chmode", chmode2string(getEffectiveChannelMode())); System.setProperty(PROPERTY_PREFIX + "effective.vbr", String.valueOf(getEffectiveVBR())); System.setProperty(PROPERTY_PREFIX + "effective.samplerate", String.valueOf(getEffectiveSampleRate())); System.setProperty(PROPERTY_PREFIX + "effective.encoding", getEffectiveEncoding().toString()); System.setProperty(PROPERTY_PREFIX + "encoder.version", getEncoderVersion()); } catch (Throwable t) { if (TDebug.TraceAllExceptions) { TDebug.out(t); } } } /** * Initializes the lame encoder. * Throws IllegalArgumentException when parameters are not supported * by LAME. */ private native int nInitParams(int channels, int sampleRate, int bitrate, int mode, int quality, boolean VBR, boolean bigEndian); /** * returns -1 if string is too short * or returns one of the exception constants * if everything OK, returns the length of the string */ private native int nGetEncoderVersion(byte[] string); public String getEncoderVersion() { byte[] string=new byte[300]; int res=nGetEncoderVersion(string); if (res<0) { if (res==-1) { throw new RuntimeException("Unexpected error in Lame.getEncoderVersion()"); } handleNativeException(res); } String sRes=""; if (res>0) { try { sRes=new String(string, 0, res, "ISO-8859-1"); } catch (UnsupportedEncodingException uee) { if (TDebug.TraceAllExceptions) { TDebug.out(uee); } sRes=new String(string, 0, res); } } return sRes; } private native int nGetPCMBufferSize(int suggested); /** * Returns the buffer needed pcm buffer size. * The passed parameter is a wished buffer size. * The implementation of the encoder may return * a lower or higher buffer size. * The encoder must be initalized (i.e. not closed) at this point. * A return value of <0 denotes an error. */ public int getPCMBufferSize() { int ret=nGetPCMBufferSize(DEFAULT_PCM_BUFFER_SIZE); if (ret<0) { handleNativeException(ret); throw new RuntimeException("Unknown error in Lame.nGetPCMBufferSize(). Resultcode="+ret); } return ret; } public int getMP3BufferSize() { // bad estimate :) return getPCMBufferSize()/2+1024; } private native int nEncodeBuffer(byte[] pcm, int offset, int length, byte[] encoded); /** * Encode a block of data. Throws IllegalArgumentException when parameters * are wrong. * When the encoded array is too small, * an ArrayIndexOutOfBoundsException is thrown. * length should be the value returned by getPCMBufferSize. * @return the number of bytes written to encoded. May be 0. */ public int encodeBuffer(byte[] pcm, int offset, int length, byte[] encoded) throws ArrayIndexOutOfBoundsException { if (length<0 || (offset+length)>pcm.length) { throw new IllegalArgumentException("inconsistent parameters"); } int result=nEncodeBuffer(pcm, offset, length, encoded); if (result<0) { if (result==-1) { throw new ArrayIndexOutOfBoundsException("Encode buffer too small"); } handleNativeException(result); throw new RuntimeException("crucial error in encodeBuffer."); } return result; } /** * Has to be called to finish encoding. encoded may be null. * * @return the number of bytes written to encoded */ private native int nEncodeFinish(byte[] encoded); public int encodeFinish(byte[] encoded) { return nEncodeFinish(encoded); } /* * Deallocates resources used by the native library. * *MUST* be called ! */ private native void nClose(); public void close() { nClose(); } /* * Returns whether the libraries are installed correctly. */ public static boolean isLibAvailable() { return libAvailable; } public static String getLinkError() { return linkError; } public int getEffectiveQuality() { if (effQuality>=QUALITY_LOWEST) { return QUALITY_LOWEST; } else if (effQuality>=QUALITY_LOW) { return QUALITY_LOW; } else if (effQuality>=QUALITY_MIDDLE) { return QUALITY_MIDDLE; } else if (effQuality>=QUALITY_HIGH) { return QUALITY_HIGH; } return QUALITY_HIGHEST; } public int getEffectiveBitRate() { return effBitRate; } public int getEffectiveChannelMode() { return effChMode; } public boolean getEffectiveVBR() { return effVbr!=0; } public int getEffectiveSampleRate() { return effSampleRate; } public AudioFormat.Encoding getEffectiveEncoding() { if (effEncoding==MPEG_VERSION_2) { if (getEffectiveSampleRate()<16000) { return new AudioFormat.Encoding("MPEG2DOT5L3"); } return new AudioFormat.Encoding("MPEG2L3"); } else if (effEncoding==MPEG_VERSION_2DOT5) { return new AudioFormat.Encoding("MPEG2DOT5L3"); } return new AudioFormat.Encoding("MPEG1L3"); } /** * workaround for missing paramtrization possibilities * for FormatConversionProviders */ private void readParameters() { String v=getStringProperty("quality", quality2string(DEFAULT_QUALITY)); DEFAULT_QUALITY=string2quality(v.toLowerCase(), DEFAULT_QUALITY); DEFAULT_BITRATE=getIntProperty("bitrate", DEFAULT_BITRATE); v=getStringProperty("chmode", chmode2string(DEFAULT_CHANNEL_MODE)); DEFAULT_CHANNEL_MODE=string2chmode(v.toLowerCase(), DEFAULT_CHANNEL_MODE); DEFAULT_VBR = getBooleanProperty("vbr", DEFAULT_VBR); // set the parameters back so that user program can verify them try { System.setProperty(PROPERTY_PREFIX + "quality", quality2string(DEFAULT_QUALITY)); System.setProperty(PROPERTY_PREFIX + "bitrate", String.valueOf(DEFAULT_BITRATE)); System.setProperty(PROPERTY_PREFIX + "chmode", chmode2string(DEFAULT_CHANNEL_MODE)); System.setProperty(PROPERTY_PREFIX + "vbr", String.valueOf(DEFAULT_VBR)); } catch (Throwable t) { if (TDebug.TraceAllExceptions) { TDebug.out(t); } } } private String quality2string(int quality) { if (quality>=QUALITY_LOWEST) { return "lowest"; } else if (quality>=QUALITY_LOW) { return "low"; } else if (quality>=QUALITY_MIDDLE) { return "middle"; } else if (quality>=QUALITY_HIGH) { return "high"; } return "highest"; } private int string2quality(String quality, int def) { if (quality.equals("lowest")) { return QUALITY_LOWEST; } else if (quality.equals("low")) { return QUALITY_LOW; } else if (quality.equals("middle")) { return QUALITY_MIDDLE; } else if (quality.equals("high")) { return QUALITY_HIGH; } else if (quality.equals("highest")) { return QUALITY_HIGHEST; } return def; } private String chmode2string(int chmode) { if (chmode==CHANNEL_MODE_STEREO) { return "stereo"; } else if (chmode==CHANNEL_MODE_JOINT_STEREO) { return "jointstereo"; } else if (chmode==CHANNEL_MODE_DUAL_CHANNEL) { return "dual"; } else if (chmode==CHANNEL_MODE_MONO) { return "mono"; } else if (chmode==CHANNEL_MODE_AUTO) { return "auto"; } return "auto"; } private int string2chmode(String chmode, int def) { if (chmode.equals("stereo")) { return CHANNEL_MODE_STEREO; } else if (chmode.equals("jointstereo")) { return CHANNEL_MODE_JOINT_STEREO; } else if (chmode.equals("dual")) { return CHANNEL_MODE_DUAL_CHANNEL; } else if (chmode.equals("mono")) { return CHANNEL_MODE_MONO; } else if (chmode.equals("auto")) { return CHANNEL_MODE_AUTO; } return def; } private static boolean getBooleanProperty(String strName, boolean def) { String strPropertyName = PROPERTY_PREFIX + strName; String strValue = def ? "true":"false"; try { strValue = System.getProperty(strPropertyName, strValue); } catch (Throwable t) { if (TDebug.TraceAllExceptions) { TDebug.out(t); } } strValue=strValue.toLowerCase(); boolean bValue=false; if (strValue.length()>0) { if (def) { bValue=(strValue.charAt(0)!='f') // false && (strValue.charAt(0)!='n') // no && (!strValue.equals("off")); } else { bValue=(strValue.charAt(0)=='t') // true || (strValue.charAt(0)=='y') // yes || (strValue.equals("on")); } } return bValue; } private static String getStringProperty(String strName, String def) { String strPropertyName = PROPERTY_PREFIX + strName; String strValue = def; try { strValue = System.getProperty(strPropertyName, def); } catch (Throwable t) { if (TDebug.TraceAllExceptions) { TDebug.out(t); } } return strValue; } private static int getIntProperty(String strName, int def) { String strPropertyName = PROPERTY_PREFIX + strName; int value = def; try { String strValue = System.getProperty(strPropertyName, String.valueOf(def)); value=new Integer(strValue).intValue(); } catch (Throwable e) { if (TDebug.TraceAllExceptions) { TDebug.out(e); } } return value; } } /*** Lame.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/lowlevel/lame/package.html0000644000175000017500000000054710172434623027157 0ustar twernertwerner

Access to the native LAME library. The classes provided here .

Related Documentation

LAME Ain't an MP3 Encoder

@see org.tritonus.sampled.convert.lame libtritonus-java-20070428/src/classes/org/tritonus/lowlevel/ogg/0000755000175000017500000000000010621572434024530 5ustar twernertwernerlibtritonus-java-20070428/src/classes/org/tritonus/lowlevel/ogg/Buffer.java0000644000175000017500000000635310374160732026612 0ustar twernertwerner/* * Buffer.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2000 - 2001 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.lowlevel.ogg; import org.tritonus.share.TDebug; /** Wrapper for oggpack_buffer. */ public class Buffer { static { Ogg.loadNativeLibrary(); if (TDebug.TraceOggNative) { setTrace(true); } } /** * Holds the pointer to oggpack_buffer * for the native code. * This must be long to be 64bit-clean. */ @SuppressWarnings("unused") private long m_lNativeHandle; public Buffer() { if (TDebug.TraceOggNative) { TDebug.out("Buffer.(): begin"); } int nReturn = malloc(); if (nReturn < 0) { throw new RuntimeException("malloc of ogg_page failed"); } if (TDebug.TraceOggNative) { TDebug.out("Buffer.(): end"); } } public void finalize() { // TODO: call free() // call super.finalize() first or last? // and introduce a flag if free() has already been called? } private native int malloc(); public native void free(); /** Calls oggpack_writeinit(). */ public native void writeInit(); /** Calls oggpack_writetrunc(). */ public native void writeTrunc(int nBits); /** Calls oggpack_writealign(). */ public native void writeAlign(); /** Calls oggpack_writecopy(). */ public native void writeCopy(byte[] abSource, int nBits); /** Calls oggpack_reset(). */ public native void reset(); /** Calls oggpack_writeclear(). */ public native void writeClear(); /** Calls oggpack_readinit(). */ public native void readInit(byte[] abBuffer, int nBytes); /** Calls oggpack_write(). */ public native void write(int nValue, int nBits); /** Calls oggpack_look(). */ public native int look(int nBits); /** Calls oggpack_look1(). */ public native int look1(); /** Calls oggpack_adv(). */ public native void adv(int nBits); /** Calls oggpack_adv1(). */ public native void adv1(); /** Calls oggpack_read(). */ public native int read(int nBits); /** Calls oggpack_read1(). */ public native int read1(); /** Calls oggpack_bytes(). */ public native int bytes(); /** Calls oggpack_bits(). */ public native int bits(); /** Calls oggpack_get_buffer(). */ public native byte[] getBuffer(); private static native void setTrace(boolean bTrace); } /*** Buffer.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/lowlevel/ogg/Ogg.java0000644000175000017500000000451710172434623026114 0ustar twernertwerner/* * Ogg.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2000 - 2001 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.lowlevel.ogg; import org.tritonus.share.TDebug; /** libogg loading. */ public class Ogg { private static boolean sm_bIsLibraryAvailable = false; static { Ogg.loadNativeLibrary(); } public static void loadNativeLibrary() { if (TDebug.TraceOggNative) { TDebug.out("Ogg.loadNativeLibrary(): begin"); } if (! isLibraryAvailable()) { loadNativeLibraryImpl(); } if (TDebug.TraceOggNative) { TDebug.out("Ogg.loadNativeLibrary(): end"); } } /** Load the native library for ogg vorbis. This method actually does the loading of the library. Unlike {@link loadNativeLibrary() loadNativeLibrary()}, it does not check if the library is already loaded. */ private static void loadNativeLibraryImpl() { if (TDebug.TraceOggNative) { TDebug.out("Ogg.loadNativeLibraryImpl(): loading native library tritonusvorbis"); } try { System.loadLibrary("tritonusvorbis"); // only reached if no exception occures sm_bIsLibraryAvailable = true; } catch (Error e) { if (TDebug.TraceOggNative || TDebug.TraceAllExceptions) { TDebug.out(e); } // throw e; } if (TDebug.TraceOggNative) { TDebug.out("Ogg.loadNativeLibraryImpl(): loaded"); } } /** Returns whether the libraries are installed correctly. */ public static boolean isLibraryAvailable() { return sm_bIsLibraryAvailable; } } /*** Ogg.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/lowlevel/ogg/Packet.java0000644000175000017500000000454210374160732026606 0ustar twernertwerner/* * Packet.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2000 - 2001 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.lowlevel.ogg; import org.tritonus.share.TDebug; /** Wrapper for ogg_packet. */ public class Packet { static { Ogg.loadNativeLibrary(); if (TDebug.TraceOggNative) { setTrace(true); } } /** * Holds the pointer to ogg_packet * for the native code. * This must be long to be 64bit-clean. */ @SuppressWarnings("unused") private long m_lNativeHandle; public Packet() { if (TDebug.TraceOggNative) { TDebug.out("Packet.(): begin"); } int nReturn = malloc(); if (nReturn < 0) { throw new RuntimeException("malloc of ogg_packet failed"); } if (TDebug.TraceOggNative) { TDebug.out("Packet.(): end"); } } public void finalize() { // TODO: call free() // call super.finalize() first or last? // and introduce a flag if free() has already been called? } private native int malloc(); public native void free(); /** Calls ogg_packet_clear(). */ public native void clear(); /** Accesses packet and bytes. */ public native byte[] getData(); /** Accesses b_o_s. */ public native boolean isBos(); /** Accesses e_o_s. */ public native boolean isEos(); private static native void setTrace(boolean bTrace); } /*** Packet.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/lowlevel/ogg/Page.java0000644000175000017500000000530210374160732026246 0ustar twernertwerner/* * Page.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2000 - 2001 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.lowlevel.ogg; import org.tritonus.share.TDebug; /** Wrapper for ogg_page. */ public class Page { static { Ogg.loadNativeLibrary(); if (TDebug.TraceOggNative) { setTrace(true); } } /** * Holds the pointer to ogg_page * for the native code. * This must be long to be 64bit-clean. */ @SuppressWarnings("unused") private long m_lNativeHandle; public Page() { if (TDebug.TraceOggNative) { TDebug.out("Page.(): begin"); } int nReturn = malloc(); if (nReturn < 0) { throw new RuntimeException("malloc of ogg_page failed"); } if (TDebug.TraceOggNative) { TDebug.out("Page.(): end"); } } public void finalize() { // TODO: call free() // call super.finalize() first or last? // and introduce a flag if free() has already been called? } private native int malloc(); public native void free(); /** Calls ogg_page_version(). */ public native int getVersion(); /** Calls ogg_page_continued(). */ public native boolean isContinued(); /** Calls ogg_page_packets(). */ public native int getPackets(); /** Calls ogg_page_bos(). */ public native boolean isBos(); /** Calls ogg_page_eos(). */ public native boolean isEos(); /** Calls ogg_page_granulepos(). */ public native long getGranulePos(); /** Calls ogg_page_serialno(). */ public native int getSerialNo(); /** Calls ogg_page_pageno(). */ public native int getPageNo(); /** Calls ogg_page_checksum_set(). */ public native void setChecksum(); public native byte[] getHeader(); public native byte[] getBody(); private static native void setTrace(boolean bTrace); } /*** Page.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/lowlevel/ogg/StreamState.java0000644000175000017500000000561010374160732027630 0ustar twernertwerner/* * StreamState.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2000 - 2001 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.lowlevel.ogg; import org.tritonus.share.TDebug; /** Wrapper for ogg_stream_state. */ public class StreamState { static { Ogg.loadNativeLibrary(); if (TDebug.TraceOggNative) { setTrace(true); } } /** * Holds the pointer to ogg_stream_state * for the native code. * This must be long to be 64bit-clean. */ @SuppressWarnings("unused") private long m_lNativeHandle; public StreamState() { if (TDebug.TraceOggNative) { TDebug.out("StreamState.(): begin"); } int nReturn = malloc(); if (nReturn < 0) { throw new RuntimeException("malloc of ogg_stream_state failed"); } if (TDebug.TraceOggNative) { TDebug.out("StreamState.(): end"); } } public void finalize() { // TODO: call free() // call super.finalize() first or last? // and introduce a flag if free() has already been called? } private native int malloc(); public native void free(); /** Calls ogg_stream_init(). */ public native int init(int nSerialNo); /** Calls ogg_stream_clear(). */ public native int clear(); /** Calls ogg_stream_reset(). */ public native int reset(); /** Calls ogg_stream_destroy(). */ public native int destroy(); /** Calls ogg_stream_eos(). */ public native boolean isEOSReached(); /** Calls ogg_stream_packetin(). */ public native int packetIn(Packet packet); /** Calls ogg_stream_pageout(). */ public native int pageOut(Page page); /** Calls ogg_stream_flush(). */ public native int flush(Page page); /** Calls ogg_stream_pagein(). */ public native int pageIn(Page page); /** Calls ogg_stream_packetout(). */ public native int packetOut(Packet packet); /** Calls ogg_stream_packetpeek(). */ public native int packetPeek(Packet packet); private static native void setTrace(boolean bTrace); } /*** StreamState.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/lowlevel/ogg/SyncState.java0000644000175000017500000000510210374160732027305 0ustar twernertwerner/* * SyncState.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2000 - 2001 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.lowlevel.ogg; import org.tritonus.share.TDebug; /** Wrapper for ogg_sync_state. */ public class SyncState { static { Ogg.loadNativeLibrary(); if (TDebug.TraceOggNative) { setTrace(true); } } /** * Holds the pointer to ogg_sync_state * for the native code. * This must be long to be 64bit-clean. */ @SuppressWarnings("unused") private long m_lNativeHandle; public SyncState() { if (TDebug.TraceOggNative) { TDebug.out("SyncState.(): begin"); } int nReturn = malloc(); if (nReturn < 0) { throw new RuntimeException("malloc of ogg_sync_state failed"); } if (TDebug.TraceOggNative) { TDebug.out("SyncState.(): end"); } } public void finalize() { // TODO: call free() // call super.finalize() first or last? // and introduce a flag if free() has already been called? } private native int malloc(); public native void free(); /** Calls ogg_sync_init(). */ public native void init(); /** Calls ogg_sync_clear(). */ public native void clear(); /** Calls ogg_sync_reset(). */ public native void reset(); /** Calls ogg_sync_destroy(). */ public native void destroy(); /** Calls ogg_sync_buffer() and ogg_sync_wrote(). */ public native int write(byte[] abBuffer, int nBytes); /** Calls ogg_sync_pageseek(). */ public native int pageseek(Page page); /** Calls ogg_sync_pageout(). */ public native int pageOut(Page page); private static native void setTrace(boolean bTrace); } /*** SyncState.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/lowlevel/ogg/package.html0000644000175000017500000000036310172434623027011 0ustar twernertwerner

Access to the native ogg library. The classes provided here .

@see org.tritonus.sampled.convert.vorbis libtritonus-java-20070428/src/classes/org/tritonus/lowlevel/pogg/0000755000175000017500000000000010621572436024712 5ustar twernertwernerlibtritonus-java-20070428/src/classes/org/tritonus/lowlevel/pogg/Buffer.java0000644000175000017500000001276710374160732027000 0ustar twernertwerner/* * Buffer.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2000 - 2005 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.lowlevel.pogg; import java.io.UnsupportedEncodingException; import org.tritonus.share.TDebug; /** Wrapper for oggpack_buffer. */ public class Buffer { static { Ogg.loadNativeLibrary(); if (TDebug.TraceOggNative) { setTrace(true); } } /** * Holds the pointer to oggpack_buffer * for the native code. * This must be long to be 64bit-clean. */ @SuppressWarnings("unused") private long m_lNativeHandle; public Buffer() { if (TDebug.TraceOggNative) { TDebug.out("Buffer.(): begin"); } int nReturn = malloc(); if (nReturn < 0) { throw new RuntimeException("malloc of ogg_page failed"); } if (TDebug.TraceOggNative) { TDebug.out("Buffer.(): end"); } } public void finalize() { // TODO: call free() // call super.finalize() first or last? // and introduce a flag if free() has already been called? } private native int malloc(); public native void free(); /** Calls oggpack_writeinit(). */ public native void writeInit(); /** Calls oggpack_writetrunc(). */ public native void writeTrunc(int nBits); /** Calls oggpack_writealign(). */ public native void writeAlign(); /** Calls oggpack_writecopy(). */ public native void writeCopy(byte[] abSource, int nBits); /** Calls oggpack_reset(). */ public native void reset(); /** Calls oggpack_writeclear(). */ public native void writeClear(); /** Calls oggpack_readinit(). */ public native void readInit(byte[] abBuffer, int nBytes); /** Calls oggpack_write(). */ public native void write(int nValue, int nBits); /** Calls oggpack_look(). */ public native int look(int nBits); /** Calls oggpack_look1(). */ public native int look1(); /** Calls oggpack_adv(). */ public native void adv(int nBits); /** Calls oggpack_adv1(). */ public native void adv1(); /** Calls oggpack_read(). */ public native int read(int nBits); /** Calls oggpack_read1(). */ public native int read1(); /** Calls oggpack_bytes(). */ public native int bytes(); /** Calls oggpack_bits(). */ public native int bits(); /** Calls oggpack_get_buffer(). */ public native byte[] getBuffer(); /** Writes a string as UTF-8. Note: no length coding and no end byte are written, just the pure string! */ public void write(String str) { write(str, false); } /** Writes a string as UTF-8, including a length coding. In front of the string, the length in bytes is written as a 32 bit integer. No end byte is written. */ public void writeWithLength(String str) { write(str, true); } /** Writes a string as UTF-8, with or without a length coding. If a length coding is requested, the length in (UTF8-)bytes is written as a 32 bit integer in front of the string. No end byte is written. */ private void write(String str, boolean bWithLength) { byte[] aBytes = null; try { aBytes = str.getBytes("UTF-8"); } catch (UnsupportedEncodingException e) { if (TDebug.TraceAllExceptions) TDebug.out(e); } if (bWithLength) { write(aBytes.length, 32); } for (int i = 0; i < aBytes.length; i++) { write(aBytes[i], 8); } } /** Reads a UTF-8 coded string with length coding. It is expected that at the current read position, there is a 32 bit integer containing the length in (UTF8-)bytes, followed by the specified number of bytes in UTF-8 coding. @return the string read from the buffer or null if an error occurs. */ public String readString() { int length = read(32); if (length < 0) { return null; } return readString(length); } /** Reads a UTF-8 coded string without length coding. It is expected that at the current read position, there is string in UTF-8 coding. @return the string read from the buffer or null if an error occurs. */ public String readString(int nLength) { byte[] aBytes = new byte[nLength]; for (int i = 0; i < nLength; i++) { aBytes[i] = (byte) read(8); } String s = null; try { s = new String(aBytes, "UTF-8"); } catch (UnsupportedEncodingException e) { if (TDebug.TraceAllExceptions) TDebug.out(e); } return s; } /** Reads a single bit. */ public boolean readFlag() { return (read(1) != 0); } private static native void setTrace(boolean bTrace); // for debugging public static void outBuffer(byte[] buffer) { String s = ""; for (int i = 0; i < buffer.length; i++) { s += "" + buffer[i] + ", "; } TDebug.out("buffer: " + s); } } /*** Buffer.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/lowlevel/pogg/Ogg.java0000644000175000017500000000452210167047647026302 0ustar twernertwerner/* * Ogg.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2000 - 2001 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.lowlevel.pogg; import org.tritonus.share.TDebug; /** libogg loading. */ public class Ogg { private static boolean sm_bIsLibraryAvailable = false; static { Ogg.loadNativeLibrary(); } public static void loadNativeLibrary() { if (TDebug.TraceOggNative) { TDebug.out("Ogg.loadNativeLibrary(): begin"); } if (! isLibraryAvailable()) { loadNativeLibraryImpl(); } if (TDebug.TraceOggNative) { TDebug.out("Ogg.loadNativeLibrary(): end"); } } /** Load the native library for ogg vorbis. This method actually does the loading of the library. Unlike {@link loadNativeLibrary() loadNativeLibrary()}, it does not check if the library is already loaded. */ private static void loadNativeLibraryImpl() { if (TDebug.TraceOggNative) { TDebug.out("Ogg.loadNativeLibraryImpl(): loading native library tritonuspvorbis"); } try { System.loadLibrary("tritonuspvorbis"); // only reached if no exception occures sm_bIsLibraryAvailable = true; } catch (Error e) { if (TDebug.TraceOggNative || TDebug.TraceAllExceptions) { TDebug.out(e); } // throw e; } if (TDebug.TraceOggNative) { TDebug.out("Ogg.loadNativeLibraryImpl(): loaded"); } } /** Returns whether the libraries are installed correctly. */ public static boolean isLibraryAvailable() { return sm_bIsLibraryAvailable; } } /*** Ogg.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/lowlevel/pogg/Packet.java0000644000175000017500000000536710374160732026774 0ustar twernertwerner/* * Packet.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2000 - 2001 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.lowlevel.pogg; import org.tritonus.share.TDebug; /** Wrapper for ogg_packet. */ public class Packet { static { Ogg.loadNativeLibrary(); if (TDebug.TraceOggNative) { setTrace(true); } } /** * Holds the pointer to ogg_packet * for the native code. * This must be long to be 64bit-clean. */ @SuppressWarnings("unused") private long m_lNativeHandle; public Packet() { if (TDebug.TraceOggNative) { TDebug.out("Packet.(): begin"); } int nReturn = malloc(); if (nReturn < 0) { throw new RuntimeException("malloc of ogg_packet failed"); } if (TDebug.TraceOggNative) { TDebug.out("Packet.(): end"); } } public void finalize() { // TODO: call free() // call super.finalize() first or last? // and introduce a flag if free() has already been called? } private native int malloc(); public native void free(); /** Calls ogg_packet_clear(). */ public native void clear(); /** Accesses packet and bytes. */ public native byte[] getData(); /** Accesses b_o_s. */ public native boolean isBos(); /** Accesses e_o_s. */ public native boolean isEos(); public native long getGranulePos(); public native long getPacketNo(); /** Sets the data in the packet. */ public native void setData(byte[] abData, int nOffset, int nLength); public native void setFlags(boolean bBos, boolean bEos, long lGranulePos, long lPacketNo); public void setFlags(boolean bBos, boolean bEos, long lGranulePos) { setFlags(bBos, bEos, lGranulePos, 0); } private static native void setTrace(boolean bTrace); } /*** Packet.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/lowlevel/pogg/Page.java0000644000175000017500000002174510374074735026446 0ustar twernertwerner/* * Page.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2000 - 2001 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.lowlevel.pogg; /** Wrapper for ogg_page. */ public class Page { private static final int[] crc_lookup = { 0x00000000, 0x04c11db7, 0x09823b6e, 0x0d4326d9, 0x130476dc, 0x17c56b6b, 0x1a864db2, 0x1e475005, 0x2608edb8, 0x22c9f00f, 0x2f8ad6d6, 0x2b4bcb61, 0x350c9b64, 0x31cd86d3, 0x3c8ea00a, 0x384fbdbd, 0x4c11db70, 0x48d0c6c7, 0x4593e01e, 0x4152fda9, 0x5f15adac, 0x5bd4b01b, 0x569796c2, 0x52568b75, 0x6a1936c8, 0x6ed82b7f, 0x639b0da6, 0x675a1011, 0x791d4014, 0x7ddc5da3, 0x709f7b7a, 0x745e66cd, 0x9823b6e0, 0x9ce2ab57, 0x91a18d8e, 0x95609039, 0x8b27c03c, 0x8fe6dd8b, 0x82a5fb52, 0x8664e6e5, 0xbe2b5b58, 0xbaea46ef, 0xb7a96036, 0xb3687d81, 0xad2f2d84, 0xa9ee3033, 0xa4ad16ea, 0xa06c0b5d, 0xd4326d90, 0xd0f37027, 0xddb056fe, 0xd9714b49, 0xc7361b4c, 0xc3f706fb, 0xceb42022, 0xca753d95, 0xf23a8028, 0xf6fb9d9f, 0xfbb8bb46, 0xff79a6f1, 0xe13ef6f4, 0xe5ffeb43, 0xe8bccd9a, 0xec7dd02d, 0x34867077, 0x30476dc0, 0x3d044b19, 0x39c556ae, 0x278206ab, 0x23431b1c, 0x2e003dc5, 0x2ac12072, 0x128e9dcf, 0x164f8078, 0x1b0ca6a1, 0x1fcdbb16, 0x018aeb13, 0x054bf6a4, 0x0808d07d, 0x0cc9cdca, 0x7897ab07, 0x7c56b6b0, 0x71159069, 0x75d48dde, 0x6b93dddb, 0x6f52c06c, 0x6211e6b5, 0x66d0fb02, 0x5e9f46bf, 0x5a5e5b08, 0x571d7dd1, 0x53dc6066, 0x4d9b3063, 0x495a2dd4, 0x44190b0d, 0x40d816ba, 0xaca5c697, 0xa864db20, 0xa527fdf9, 0xa1e6e04e, 0xbfa1b04b, 0xbb60adfc, 0xb6238b25, 0xb2e29692, 0x8aad2b2f, 0x8e6c3698, 0x832f1041, 0x87ee0df6, 0x99a95df3, 0x9d684044, 0x902b669d, 0x94ea7b2a, 0xe0b41de7, 0xe4750050, 0xe9362689, 0xedf73b3e, 0xf3b06b3b, 0xf771768c, 0xfa325055, 0xfef34de2, 0xc6bcf05f, 0xc27dede8, 0xcf3ecb31, 0xcbffd686, 0xd5b88683, 0xd1799b34, 0xdc3abded, 0xd8fba05a, 0x690ce0ee, 0x6dcdfd59, 0x608edb80, 0x644fc637, 0x7a089632, 0x7ec98b85, 0x738aad5c, 0x774bb0eb, 0x4f040d56, 0x4bc510e1, 0x46863638, 0x42472b8f, 0x5c007b8a, 0x58c1663d, 0x558240e4, 0x51435d53, 0x251d3b9e, 0x21dc2629, 0x2c9f00f0, 0x285e1d47, 0x36194d42, 0x32d850f5, 0x3f9b762c, 0x3b5a6b9b, 0x0315d626, 0x07d4cb91, 0x0a97ed48, 0x0e56f0ff, 0x1011a0fa, 0x14d0bd4d, 0x19939b94, 0x1d528623, 0xf12f560e, 0xf5ee4bb9, 0xf8ad6d60, 0xfc6c70d7, 0xe22b20d2, 0xe6ea3d65, 0xeba91bbc, 0xef68060b, 0xd727bbb6, 0xd3e6a601, 0xdea580d8, 0xda649d6f, 0xc423cd6a, 0xc0e2d0dd, 0xcda1f604, 0xc960ebb3, 0xbd3e8d7e, 0xb9ff90c9, 0xb4bcb610, 0xb07daba7, 0xae3afba2, 0xaafbe615, 0xa7b8c0cc, 0xa379dd7b, 0x9b3660c6, 0x9ff77d71, 0x92b45ba8, 0x9675461f, 0x8832161a, 0x8cf30bad, 0x81b02d74, 0x857130c3, 0x5d8a9099, 0x594b8d2e, 0x5408abf7, 0x50c9b640, 0x4e8ee645, 0x4a4ffbf2, 0x470cdd2b, 0x43cdc09c, 0x7b827d21, 0x7f436096, 0x7200464f, 0x76c15bf8, 0x68860bfd, 0x6c47164a, 0x61043093, 0x65c52d24, 0x119b4be9, 0x155a565e, 0x18197087, 0x1cd86d30, 0x029f3d35, 0x065e2082, 0x0b1d065b, 0x0fdc1bec, 0x3793a651, 0x3352bbe6, 0x3e119d3f, 0x3ad08088, 0x2497d08d, 0x2056cd3a, 0x2d15ebe3, 0x29d4f654, 0xc5a92679, 0xc1683bce, 0xcc2b1d17, 0xc8ea00a0, 0xd6ad50a5, 0xd26c4d12, 0xdf2f6bcb, 0xdbee767c, 0xe3a1cbc1, 0xe760d676, 0xea23f0af, 0xeee2ed18, 0xf0a5bd1d, 0xf464a0aa, 0xf9278673, 0xfde69bc4, 0x89b8fd09, 0x8d79e0be, 0x803ac667, 0x84fbdbd0, 0x9abc8bd5, 0x9e7d9662, 0x933eb0bb, 0x97ffad0c, 0xafb010b1, 0xab710d06, 0xa6322bdf, 0xa2f33668, 0xbcb4666d, 0xb8757bda, 0xb5365d03, 0xb1f740b4 }; private byte[] m_abHeader; private int m_nHeaderLength; private byte[] m_abBody; private int m_nBodyLength; public Page() { } /** Obtains the stream structure version. This method returns the stream structure version this page is encoded in. For the current ogg version, this is always zero. @return the stream structure version */ public int getVersion() { return m_abHeader[4] & 0xFF; } /** Returns if the page is continued. This method returns whether this page starts with a packet that is continued from the previous page. @return true if the page starts with a continued packet. */ public boolean isContinued() { return (m_abHeader[5] & 0x01) != 0; } /** Calls ogg_page_packets(). */ /* returns the number of packets that are completed on this page (if the leading packet is begun on a previous page, but ends on this page, it's counted */ /* NOTE: If a page consists of a packet begun on a previous page, and a new packet begun (but not completed) on this page, the return will be: ogg_page_packets(page) ==1, ogg_page_continued(page) !=0 If a page happens to be a single packet that was begun on a previous page, and spans to the next page (in the case of a three or more page packet), the return will be: ogg_page_packets(page) ==0, ogg_page_continued(page) !=0 */ public int getPackets() { int n = m_abHeader[26] & 0xFF; int count = 0; for (int i = 0; i < n; i++) if ((m_abHeader[27 + i] & 0xFF) < 255) count++; return count; } /** Returns the "begin of stream" property of the page. This method returns true if the page is the first page of the stream. @return true if the page is the first in the stream, false otherwise */ public boolean isBos() { return (m_abHeader[5] & 0x02) != 0; } /** Returns the "end of stream" property of the page. This method returns true if the page is the last page of the stream. @return true if the page is the last in the stream, false otherwise */ public boolean isEos() { return (m_abHeader[5] & 0x04) != 0; } /** Obtains the granule position property of the page. This method returns the granule position of the page as stored in the page header. @return the granule position of the page */ public long getGranulePos() { long granulepos = m_abHeader[13]&(0xff); granulepos = (granulepos<<8)|(m_abHeader[12] & 0xFF); granulepos = (granulepos<<8)|(m_abHeader[11] & 0xFF); granulepos = (granulepos<<8)|(m_abHeader[10] & 0xFF); granulepos = (granulepos<<8)|(m_abHeader[9] & 0xFF); granulepos = (granulepos<<8)|(m_abHeader[8] & 0xFF); granulepos = (granulepos<<8)|(m_abHeader[7] & 0xFF); granulepos = (granulepos<<8)|(m_abHeader[6] & 0xFF); return granulepos; } /** Obtain the serial number of the stream the page belongs to. This method returns the stream serial number stored in the page header. @return the stream serial number */ public int getSerialNo() { return m_abHeader[14] | (m_abHeader[15] << 8) | (m_abHeader[16] << 16) | (m_abHeader[17] << 24); } /** Calls ogg_page_pageno(). */ public int getPageNo() { return m_abHeader[18] | (m_abHeader[19] << 8) | (m_abHeader[20] << 16) | (m_abHeader[21] << 24); } /** Calculate and set the checksum of the page. */ public void setChecksum() { int crc_reg = 0; /* safety; needed for API behavior, but not framing code */ m_abHeader[22] = 0; m_abHeader[23] = 0; m_abHeader[24] = 0; m_abHeader[25] = 0; for(int i = 0; i < m_nHeaderLength; i++) crc_reg = (crc_reg << 8) ^ crc_lookup[((crc_reg >>> 24) & 0xff) ^ (m_abHeader[i] & 0xFF)]; for(int i = 0; i < m_nBodyLength; i++) crc_reg = (crc_reg << 8) ^ crc_lookup[((crc_reg >>> 24) & 0xff) ^ (m_abBody[i] & 0xFF)]; m_abHeader[22] = (byte) (crc_reg & 0xff); m_abHeader[23] = (byte) ((crc_reg >> 8) & 0xff); m_abHeader[24] = (byte) ((crc_reg >> 16) & 0xff); m_abHeader[25] = (byte) ((crc_reg >> 24) & 0xff); } /** Obtain the header of the page. */ public byte[] getHeader() { byte[] abHeader = new byte[m_nHeaderLength]; System.arraycopy(m_abHeader, 0, abHeader, 0, m_nHeaderLength); return abHeader; } /** Obtain the body of the page. */ public byte[] getBody() { byte[] abBody = new byte[m_nBodyLength]; System.arraycopy(m_abBody, 0, abBody, 0, m_nBodyLength); return abBody; } public void setData(byte[] abHeader, int nHeaderOffset, int nHeaderLength, byte[] abBody, int nBodyOffset, int nBodyLength) { m_abHeader = new byte[nHeaderLength]; System.arraycopy(abHeader, nHeaderOffset, m_abHeader, 0, nHeaderLength); m_nHeaderLength = nHeaderLength; m_abBody = new byte[nBodyLength]; System.arraycopy(abBody, nBodyOffset, m_abBody, 0, nBodyLength); m_nBodyLength = nBodyLength; } } /*** Page.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/lowlevel/pogg/StreamState.java0000644000175000017500000004117010201213473027777 0ustar twernertwerner/* * StreamState.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2000 - 2005 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.lowlevel.pogg; import org.tritonus.share.TDebug; /** Wrapper for ogg_stream_state. */ public class StreamState { private static final int INITIAL_BODY_DATA_SIZE = 16 * 1024; private static final int INITIAL_LACING_VALUES_SIZE = 1024; /** The serial number of the stream. This is set by init(). */ private int m_nSerialNo; /** Storage for packet bodies. */ private byte[] m_abBodyData; /** Number of bytes used in te body storage. */ private int m_nBodyFill; /** Number of bytes aready returned (as pages) from the body storage. */ private int m_nBodyReturned; /** Lacing values. Bit 0 to 7 contain the lacing value (mask 0xFF). Bit 8 is set if the segment belongs to the first packet of the stream (mask 0x100). Bit 9 is set ig the segment belongs to the last packet of the stream (mask 0x200). */ private int[] m_anLacingValues; /** Granule values. */ private long[] m_alGranuleValues; /** Number of elements used in m_anLacingValues and m_alGranuleValues. The elements with the index m_nLacingFill is the first free element. */ private int m_nLacingFill; /** Pointer to the index in m_anLacingValues where the lacing values of the last decoded packet start (??) */ private int m_nLacingPacket; /** */ private int m_nLacingReturned; private byte[] m_abHeader; private int m_nHeaderFill; private boolean m_bBos; private boolean m_bEos; private int m_nPageNo; private long m_lPacketNo; private long m_lGranulePos; public StreamState() { if (TDebug.TraceOggNative) { TDebug.out("StreamState.(): begin"); } if (TDebug.TraceOggNative) { TDebug.out("StreamState.(): end"); } } public void free() { } /** Calls ogg_stream_init(). */ public int init(int nSerialNo) { m_nSerialNo = nSerialNo; m_abBodyData = new byte[INITIAL_BODY_DATA_SIZE]; m_nBodyFill = 0; m_nBodyReturned = 0; m_anLacingValues = new int[INITIAL_LACING_VALUES_SIZE]; m_alGranuleValues = new long[INITIAL_LACING_VALUES_SIZE]; m_nLacingFill = 0; m_nLacingPacket = 0; m_nLacingReturned = 0; m_abHeader = new byte[282]; m_nHeaderFill = 0; m_bBos = false; m_bEos = false; m_nPageNo = 0; m_lPacketNo = 0; m_lGranulePos = 0; // TODO: necessary? for (int i = 0; i < m_abBodyData.length; i++) m_abBodyData[i] = 0; for (int i = 0; i < m_anLacingValues.length; i++) m_anLacingValues[i] = 0; for (int i = 0; i < m_alGranuleValues.length; i++) m_alGranuleValues[i] = 0; // TODO: remove return value return 0; } /** Calls ogg_stream_clear(). */ public int clear() { m_nSerialNo = 0; m_abBodyData = null; m_nBodyFill = 0; m_nBodyReturned = 0; m_anLacingValues = null; m_alGranuleValues = null; m_nLacingFill = 0; m_nLacingPacket = 0; m_nLacingReturned = 0; m_abHeader = null; m_nHeaderFill = 0; m_bBos = false; m_bEos = false; m_nPageNo = 0; m_lPacketNo = 0; m_lGranulePos = 0; // TODO: remove return value return 0; } /** Calls ogg_stream_reset(). */ public int reset() { m_nBodyFill = 0; m_nBodyReturned = 0; m_nLacingFill = 0; m_nLacingPacket = 0; m_nLacingReturned = 0; m_nHeaderFill = 0; m_bBos = false; m_bEos = false; m_nPageNo = -1; m_lPacketNo = 0; m_lGranulePos = 0; // TODO: remove return value return 0; } /** Calls ogg_stream_eos(). */ public boolean isEOSReached() { return m_bEos; } /** Calls ogg_stream_packetin(). */ /* submit data to the internal buffer of the framing engine */ public int packetIn(Packet packet) { int i; byte[] abPacketData = packet.getData(); int lacing_vals = abPacketData.length / 255 + 1; if (m_nBodyReturned > 0) { /* advance packet data according to the body_returned pointer. We had to keep it around to return a pointer into the buffer last call */ m_nBodyFill -= m_nBodyReturned; if (m_nBodyFill > 0) { System.arraycopy(m_abBodyData, m_nBodyReturned, m_abBodyData, 0, m_nBodyFill); } m_nBodyReturned = 0; } /* make sure we have the buffer storage */ assureBodyDataCapacity(abPacketData.length); assureLacingValuesCapacity(lacing_vals); /* Copy in the submitted packet. Yes, the copy is a waste; this is the liability of overly clean abstraction for the time being. It will actually be fairly easy to eliminate the extra copy in the future */ System.arraycopy(abPacketData, 0, m_abBodyData, m_nBodyFill, abPacketData.length); m_nBodyFill += abPacketData.length; /* Store lacing vals for this packet */ for (i = 0; i < lacing_vals - 1; i++) { m_anLacingValues[m_nLacingFill + i] = 255; m_alGranuleValues[m_nLacingFill + i] = m_lGranulePos; } m_anLacingValues[m_nLacingFill + i] = abPacketData.length % 255; m_alGranuleValues[m_nLacingFill + i] = packet.getGranulePos(); m_lGranulePos = packet.getGranulePos(); /* flag the first segment as the beginning of the packet */ m_anLacingValues[m_nLacingFill] |= 0x100; m_nLacingFill += lacing_vals; /* for the sake of completeness */ m_lPacketNo++; if (packet.isEos()) m_bEos = true; return 0; } /** Calls ogg_stream_pageout(). */ /* This constructs pages from buffered packet segments. The pointers returned are to static buffers; do not free. The returned buffers are good only until the next call (using the same ogg_stream_state) */ public int pageOut(Page page) { if ((m_bEos && m_nLacingFill > 0) || /* 'were done, now flush' */ m_nBodyFill - m_nBodyReturned > 4096 || /* 'page nominal size' */ m_nLacingFill >= 255 || /* 'segment table full' */ (m_nLacingFill > 0 && ! m_bBos)) /* 'initial header page' */ { return flush(page); } /* not enough data to construct a page and not end of stream */ return 0; } /** Calls ogg_stream_flush(). */ /* This will flush remaining packets into a page (returning nonzero), even if there is not enough data to trigger a flush normally (undersized page). If there are no packets or partial packets to flush, ogg_stream_flush returns 0. Note that ogg_stream_flush will try to flush a normal sized page like ogg_stream_pageout; a call to ogg_stream_flush does not guarantee that all packets have flushed. Only a return value of 0 from ogg_stream_flush indicates all packet data is flushed into pages. since ogg_stream_flush will flush the last page in a stream even if it's undersized, you almost certainly want to use ogg_stream_pageout (and *not* ogg_stream_flush) unless you specifically need to flush an page regardless of size in the middle of a stream. */ public int flush(Page page) { int i; int vals = 0; int maxvals = Math.min(m_nLacingFill, 255); int bytes = 0; int acc = 0; long granule_pos = m_alGranuleValues[0]; if (maxvals == 0) { return 0; } /* construct a page */ /* decide how many segments to include */ /* If this is the initial header case, the first page must only include the initial header packet */ if (! m_bBos) { /* 'initial header page' case */ granule_pos = 0; for (vals = 0; vals < maxvals; vals++) { if ((m_anLacingValues[vals] & 0x0FF) < 255) { vals++; break; } } } else { for (vals = 0; vals < maxvals; vals++) { if (acc > 4096) break; acc += (m_anLacingValues[vals] & 0x0FF); granule_pos = m_alGranuleValues[vals]; } } /* construct the header in temp storage */ m_abHeader[0] = (byte) 'O'; m_abHeader[1] = (byte) 'g'; m_abHeader[2] = (byte) 'g'; m_abHeader[3] = (byte) 'S'; /* stream structure version */ m_abHeader[4] = 0; m_abHeader[5] = 0x00; /* continued packet flag? */ if ((m_anLacingValues[0] & 0x100) == 0) m_abHeader[5] |= 0x01; /* first page flag? */ if (! m_bBos) m_abHeader[5] |= 0x02; /* last page flag? */ if (m_bEos && m_nLacingFill == vals) m_abHeader[5] |= 0x04; m_bBos = true; /* 64 bits of PCM position */ for (i = 6; i < 14; i++) { m_abHeader[i] = (byte) (granule_pos & 0xFF); granule_pos >>>= 8; } /* 32 bits of stream serial number */ int serialno = m_nSerialNo; for (i = 14; i < 18; i++) { m_abHeader[i] = (byte) (serialno & 0xFF); serialno >>>= 8; } /* 32 bits of page counter (we have both counter and page header because this val can roll over) */ if (m_nPageNo == -1) { m_nPageNo = 0; /* because someone called stream_reset; this would be a strange thing to do in an encode stream, but it has plausible uses */ } int pageno = m_nPageNo++; for (i = 18; i < 22; i++) { m_abHeader[i] = (byte) (pageno & 0xFF); pageno >>>= 8; } /* zero for computation; filled in later */ m_abHeader[22] = 0; m_abHeader[23] = 0; m_abHeader[24] = 0; m_abHeader[25] = 0; /* segment table */ m_abHeader[26] = (byte) (vals & 0xFF); for (i = 0; i < vals; i++) { m_abHeader[i + 27] = (byte) (m_anLacingValues[i] & 0xFF); bytes += (m_anLacingValues[i] & 0xFF); } /* set pointers in the ogg_page struct */ page.setData(m_abHeader, 0, vals + 27, m_abBodyData, m_nBodyReturned, bytes); m_nHeaderFill = vals + 27; /* advance the lacing data and set the body_returned pointer */ m_nLacingFill -= vals; System.arraycopy(m_anLacingValues, vals, m_anLacingValues, 0, m_nLacingFill); System.arraycopy(m_alGranuleValues, vals, m_alGranuleValues, 0, m_nLacingFill); m_nBodyReturned += bytes; /* calculate the checksum */ page.setChecksum(); /* done */ return 1; } /** add the incoming page to the stream state; we decompose the page into packet segments here as well. @return 0 on success, -1 if the stream serial number stored in the page does not match the one stored in the stream state or if the protocol version stored in the page is greater than 0. */ public int pageIn(Page page) { byte[] header = page.getHeader(); byte[] body = page.getBody(); int nBodyOffset = 0; int bodysize = body.length; int segptr = 0; int version = page.getVersion(); boolean continued = page.isContinued(); boolean bos = page.isBos(); boolean eos = page.isEos(); long granulepos = page.getGranulePos(); int serialno = page.getSerialNo(); int pageno = page.getPageNo(); int segments = header[26] & 0xFF; /* clean up 'returned data' */ int lr = m_nLacingReturned; int br = m_nBodyReturned; /* body data */ if (br > 0) { m_nBodyFill -= br; if (m_nBodyFill > 0) { System.arraycopy(m_abBodyData, br, m_abBodyData, 0, m_nBodyFill); } m_nBodyReturned = 0; } if (lr > 0) { /* segment table */ if (m_nLacingFill - lr > 0) { System.arraycopy(m_anLacingValues, lr, m_anLacingValues, 0, m_nLacingFill - lr); System.arraycopy(m_alGranuleValues, lr, m_alGranuleValues, 0, m_nLacingFill - lr); } m_nLacingFill -= lr; m_nLacingPacket -= lr; m_nLacingReturned = 0; } /* check the serial number */ if (serialno != m_nSerialNo) return -1; if (version > 0) return -1; assureLacingValuesCapacity(segments + 1); /* are we in sequence? */ if (pageno != m_nPageNo) { int i; /* unroll previous partial packet (if any) */ for (i = m_nLacingPacket; i < m_nLacingFill; i++) m_nBodyFill -= (m_anLacingValues[i] & 0xFF); m_nLacingFill = m_nLacingPacket; /* make a note of dropped data in segment table */ if (m_nPageNo != -1) { m_anLacingValues[m_nLacingFill] = 0x400; m_nLacingFill++; m_nLacingPacket++; } /* are we a 'continued packet' page? If so, we'll need to skip some segments */ if (continued) { bos = false; for (; segptr < segments; segptr++) { int val = header[27 + segptr] & 0xFF; nBodyOffset += val; bodysize -= val; if (val < 255) { segptr++; break; } } } } if (bodysize > 0) { assureBodyDataCapacity(bodysize); System.arraycopy(body, nBodyOffset, m_abBodyData, m_nBodyFill, bodysize); m_nBodyFill += bodysize; } int saved = -1; while (segptr < segments) { int val = header[27 + segptr] & 0xFF; m_anLacingValues[m_nLacingFill] = val; m_alGranuleValues[m_nLacingFill] = -1; if (bos) { m_anLacingValues[m_nLacingFill] |= 0x100; bos = false; } if (val < 255) saved = m_nLacingFill; m_nLacingFill++; segptr++; if (val < 255) m_nLacingPacket = m_nLacingFill; } /* set the granulepos on the last granuleval of the last full packet */ if (saved != -1) { m_alGranuleValues[saved] = granulepos; } if (eos) { m_bEos = true; if (m_nLacingFill > 0) m_anLacingValues[m_nLacingFill - 1] |= 0x200; } m_nPageNo = pageno + 1; return 0; } /** Calls ogg_stream_packetout(). */ public int packetOut(Packet packet) { return packetOutInternal(packet, true); } /** Calls ogg_stream_packetpeek(). */ public int packetPeek(Packet packet) { return packetOutInternal(packet, false); } /** Retrieves a packet from the internal storage for emission. This method is called by packetOut and packetPeek. @param packet the Packet object to store the retrieved packet data in. May be null if bAdvance is false. @param bAdvance should the internal pointers to the packet data storage be advanced to the next packet after retrieving this one? Called with a value of true for ordinary packet out and with a value of false for packet peek. @return */ private int packetOutInternal(Packet packet, boolean bAdvance) { /* The last part of decode. We have the stream broken into packet segments. Now we need to group them into packets (or return the out of sync markers) */ int ptr = m_nLacingReturned; if (m_nLacingPacket <= ptr) return 0; if ((m_anLacingValues[ptr] & 0x400) != 0) { /* we need to tell the codec there's a gap; it might need to handle previous packet dependencies. */ m_nLacingReturned++; m_lPacketNo++; return -1; } if (packet == null && ! bAdvance) return 1; /* just using peek as an inexpensive way to ask if there's a whole packet waiting */ /* Gather the whole packet. We'll have no holes or a partial * packet */ int size = m_anLacingValues[ptr] & 0xFF; int bytes = size; /* last packet of the stream? */ boolean eos = (m_anLacingValues[ptr] & 0x200) != 0; /* first packet of the stream? */ boolean bos = (m_anLacingValues[ptr] & 0x100) != 0; while (size == 255) { int val = m_anLacingValues[++ptr]; size = val & 0xff; if ((val & 0x200) != 0) eos = true; bytes += size; } if (packet != null) { packet.setData(m_abBodyData, m_nBodyReturned, bytes); packet.setFlags(bos, eos, m_alGranuleValues[ptr], m_lPacketNo); } if (bAdvance) { m_nBodyReturned += bytes; m_nLacingReturned = ptr + 1; m_lPacketNo++; } return 1; } private void assureBodyDataCapacity(int needed) { if (m_abBodyData.length <= m_nBodyFill + needed) { int nNewSize = m_abBodyData.length + needed + 1024; byte[] abNewBodyData = new byte[nNewSize]; System.arraycopy(m_abBodyData, 0, abNewBodyData, 0, m_abBodyData.length); m_abBodyData = abNewBodyData; } } private void assureLacingValuesCapacity(int needed) { if (m_anLacingValues.length <= m_nLacingFill + needed) { int nNewSize = m_anLacingValues.length + needed + 32; int[] anNewLacingValues = new int[nNewSize]; System.arraycopy(m_anLacingValues, 0, anNewLacingValues, 0, m_anLacingValues.length); m_anLacingValues = anNewLacingValues; long[] alNewGranuleValues = new long[nNewSize]; System.arraycopy(m_alGranuleValues, 0, alNewGranuleValues, 0, m_alGranuleValues.length); m_alGranuleValues = alNewGranuleValues; } } } /*** StreamState.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/lowlevel/pogg/SyncState.java0000644000175000017500000002056410174205413027470 0ustar twernertwerner/* * SyncState.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2000 - 2005 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.lowlevel.pogg; import org.tritonus.share.TDebug; /** Wrapper for ogg_sync_state. */ public class SyncState { /** The stream buffer. This points to a buffer that holds the incoming data from a stream until the data is emitted in form of a page. */ private byte[] m_abData; /** The number of bytes in the stream buffer that are used. This always counts from the beginning of the buffer. So m_abData[m_nFill] is the first free byte in the buffer. */ private int m_nFill; /** Number of bytes that have been used to construct a returned page. This is counted from the beginning of the buffer. m_abData[m_nReturned] is the first valid byte in the buffer. */ private int m_nReturned; /** */ private boolean m_bUnsynced; /** */ private int m_nHeaderBytes; /** */ private int m_nBodyBytes; /** Page object for re-calculating the checksum. */ private Page m_tmpPage; /** Storage for the checksum saved from the page. */ private byte[] m_abChecksum; public SyncState() { if (TDebug.TraceOggNative) { TDebug.out("SyncState.(): begin"); } m_tmpPage = new Page(); m_abChecksum = new byte[4]; if (TDebug.TraceOggNative) { TDebug.out("SyncState.(): end"); } } // TODO: remove calls to this method public void free() { } /** Calls ogg_sync_init(). */ public void init() { m_abData = null; m_nFill = 0; m_nReturned = 0; m_bUnsynced = false; m_nHeaderBytes = 0; m_nBodyBytes = 0; } /** Calls ogg_sync_clear(). */ public void clear() { init(); } /** Calls ogg_sync_reset(). */ public void reset() { m_nFill = 0; m_nReturned = 0; m_bUnsynced = false; m_nHeaderBytes = 0; m_nBodyBytes = 0; } /** Writes to the stream buffer. */ public int write(byte[] abBuffer, int nBytes) { /* Clear out space that has been previously returned. */ if (m_nReturned > 0) { m_nFill -= m_nReturned; if (m_nFill > 0) { System.arraycopy(m_abData, m_nReturned, m_abData, 0, m_nFill); } m_nReturned = 0; } /* Check for enough space in the stream buffer and if it is * allocated at all. If there isn't sufficient space, extend * the buffer. */ if (m_abData == null || nBytes > m_abData.length - m_nFill) { int nNewSize = nBytes + m_nFill + 4096; byte[] abOldBuffer = m_abData; m_abData = new byte[nNewSize]; if (abOldBuffer != null) { System.arraycopy(abOldBuffer, 0, m_abData, 0, m_nFill); } } /* Now finally fill with the new data. */ System.arraycopy(abBuffer, 0, m_abData, m_nFill, nBytes); m_nFill += nBytes; return 0; } /** Synchronizes the stream. This method looks if there is a complete, valid page in the stream buffer. If a page is found, it is returned in the passed Page object. @param page The Page to store the result of the page search in. The content is only changed if the return value is > 0. @return if a page has been found at the current location, the length of the page in bytes is returned. If not enough data for a page is available in the stream buffer, 0 is returned. If data in the stream buffer has been skipped because there is no page at the current position, the skip amount in bytes is returned as a negative number. */ public int pageseek(Page page) { int nPage = m_nReturned; int nBytes = m_nFill - m_nReturned; if (m_nHeaderBytes == 0) { if (nBytes < 27) { /* Not enough data for a header. */ return 0; } /* Verify capture pattern. */ if (m_abData[nPage] != (byte) 'O' || m_abData[nPage + 1] != (byte) 'g' || m_abData[nPage + 2] != (byte) 'g' || m_abData[nPage + 3] != (byte) 'S') { TDebug.out("wrong capture pattern"); return syncFailure(); } int nHeaderBytes = (m_abData[nPage + 26] & 0xFF) + 27; if (nBytes < nHeaderBytes) { /* Not enough data for header + segment table. */ return 0; } /* Count up body length in the segment table. */ for (int i = 0; i < (m_abData[nPage + 26] & 0xFF); i++) { m_nBodyBytes += (m_abData[nPage + 27 + i] & 0xFF); } m_nHeaderBytes = nHeaderBytes; } if (m_nBodyBytes + m_nHeaderBytes > nBytes) { /* Not enough data for the whole packet. */ return 0; } /* Save the original checksum, set it to zero and recalculate it. */ System.arraycopy(m_abData, nPage + 22, m_abChecksum, 0, 4); m_abData[nPage + 22] = 0; m_abData[nPage + 23] = 0; m_abData[nPage + 24] = 0; m_abData[nPage + 25] = 0; m_tmpPage.setData(m_abData, nPage, m_nHeaderBytes, m_abData, nPage + m_nHeaderBytes, m_nBodyBytes); // TDebug.out("temporary page:"); // byte[] abHeader = m_tmpPage.getHeader(); // TDebug.out("H0:" + m_abData[nPage + 0] + " - " + abHeader[0]); // TDebug.out("H1:" + m_abData[nPage + 1] + " - " + abHeader[1]); // TDebug.out("H2:" + m_abData[nPage + 2] + " - " + abHeader[2]); // TDebug.out("H3:" + m_abData[nPage + 3] + " - " + abHeader[3]); // TDebug.out("" + m_abChecksum[0] + " - " + abHeader[22]); // TDebug.out("" + m_abChecksum[1] + " - " + abHeader[23]); // TDebug.out("" + m_abChecksum[2] + " - " + abHeader[24]); // TDebug.out("" + m_abChecksum[3] + " - " + abHeader[25]); m_tmpPage.setChecksum(); byte[] abHeader = m_tmpPage.getHeader(); //m_tmpPage.free(); if (abHeader[22] != m_abChecksum[0] || abHeader[23] != m_abChecksum[1] || abHeader[24] != m_abChecksum[2] || abHeader[25] != m_abChecksum[3]) { TDebug.out("wrong checksum"); TDebug.out("" + m_abChecksum[0] + " - " + abHeader[22]); TDebug.out("" + m_abChecksum[1] + " - " + abHeader[23]); TDebug.out("" + m_abChecksum[2] + " - " + abHeader[24]); TDebug.out("" + m_abChecksum[3] + " - " + abHeader[25]); /* Copy back the saved checksum. */ System.arraycopy(m_abChecksum, 0, m_abData, nPage + 22, 4); return syncFailure(); } /* Ok, we have a correct page to emit. */ page.setData(m_abData, nPage, m_nHeaderBytes, m_abData, nPage + m_nHeaderBytes, m_nBodyBytes); m_bUnsynced = false; nBytes = m_nHeaderBytes + m_nBodyBytes; m_nReturned += nBytes; m_nHeaderBytes = 0; m_nBodyBytes = 0; return nBytes; } /** Auxiliary method for pageseek(). */ private int syncFailure() { int nPage = m_nReturned; int nBytes = m_nFill - m_nReturned; m_nHeaderBytes = 0; m_nBodyBytes = 0; int nNext = -1; for (int i = 0; i < nBytes - 1; i++) { if (m_abData[nPage + 1 + i] == (byte) 'O') { nNext = nPage + 1 + i; break; } } if (nNext == -1) { nNext = m_nFill; } m_nReturned = nNext; return -(nNext - nPage); } /** Returns a page from the stream buffer, if possible. This method searches the current data in the stream buffer for the beginning of a page. If there is one, it is returned in the passed Page object. A synchronization error is signaled by a return value of -1. However, only the first synchronization error is reported. Consecutive sync errors are suppressed. @param page The Page to store the result of the page search in. The content is only changed if the return value is 1. @return 1 if a page has been found, 0 if there is not enough data, -1 if a synchronization error occured. */ public int pageOut(Page page) { while (true) { int nReturn = pageseek(page); if (nReturn > 0) { return 1; } else if (nReturn == 0) { return 0; } else // nReturn < 0 { if (! m_bUnsynced) { m_bUnsynced = true; return -1; } } } } } /*** SyncState.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/lowlevel/pogg/package.html0000644000175000017500000000041310167047647027177 0ustar twernertwerner

Alternative pure java implementation of the ogg library. The classes provided here .

@see org.tritonus.sampled.convert.pvorbis libtritonus-java-20070428/src/classes/org/tritonus/lowlevel/pvorbis/0000755000175000017500000000000010621572445025442 5ustar twernertwernerlibtritonus-java-20070428/src/classes/org/tritonus/lowlevel/pvorbis/Block.java0000644000175000017500000000605410374160732027341 0ustar twernertwerner/* * Block.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2000 - 2005 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.lowlevel.pvorbis; import org.tritonus.lowlevel.pogg.Ogg; import org.tritonus.lowlevel.pogg.Packet; import org.tritonus.share.TDebug; /** Wrapper for vorbis_block. */ public class Block { static { Ogg.loadNativeLibrary(); if (TDebug.TraceVorbisNative) { setTrace(true); } } /** * Holds the pointer to vorbis_block * for the native code. * This must be long to be 64bit-clean. */ @SuppressWarnings("unused") private long m_lNativeHandle; public Block() { if (TDebug.TraceVorbisNative) { TDebug.out("Block.(): begin"); } int nReturn = malloc(); if (nReturn < 0) { throw new RuntimeException("malloc of vorbis_block failed"); } if (TDebug.TraceVorbisNative) { TDebug.out("Block.(): end"); } } public void finalize() { // TODO: call free() // call super.finalize() first or last? // and introduce a flag if free() has already been called? } private native int malloc(); public native void free(); /** Calls vorbis_block_init(). */ public int init(DspState dspState) { return init_native(dspState); } /** Calls vorbis_block_init(). */ public native int init_native(DspState dspState); /** Calls vorbis_bitrate_addblock(). */ public int addBlock() { return addBlock_native(); } /** Calls vorbis_bitrate_addblock(). */ public native int addBlock_native(); /** Calls vorbis_analysis(). */ public int analysis(Packet packet) { return analysis_native(packet); } /** Calls vorbis_analysis(). */ public native int analysis_native(Packet packet); /** Calls vorbis_synthesis(). */ public int synthesis(Packet packet) { return synthesis_native(packet); } /** Calls vorbis_synthesis(). */ public native int synthesis_native(Packet packet); /** Calls vorbis_block_clear(). */ public int clear() { return clear_native(); } /** Calls vorbis_block_clear(). */ public native int clear_native(); private static native void setTrace(boolean bTrace); } /*** Block.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/lowlevel/pvorbis/Comment.java0000644000175000017500000001036210374142165027706 0ustar twernertwerner/* * Comment.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2000 - 2005 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.lowlevel.pvorbis; import java.util.ArrayList; import java.util.List; import org.tritonus.lowlevel.pogg.Buffer; import org.tritonus.share.TDebug; /** Wrapper for vorbis_comment. */ public class Comment implements VorbisConstants { private String m_vendor; private List m_comments; public Comment() { if (TDebug.TraceVorbisNative) { TDebug.out("Comment.(): begin"); } if (TDebug.TraceVorbisNative) { TDebug.out("Comment.(): end"); } } public void finalize() { // TODO: call free() // call super.finalize() first or last? // and introduce a flag if free() has already been called? } // TODO: since this is now a no-op, remove calls to this method. public void free() { } /** Initializes the comment object. Sets the vendor string to null and removes all comments. */ public void init() { m_vendor = null; m_comments = new ArrayList(); } /** Adds a comment to the list of comments. The passed string is added to the list of comments as it is. The string should have the format 'TAG=content'. */ public void addComment(String strComment) { m_comments.add(strComment); } /** Adds a comment with a specific tag */ public void addTag(String strTag, String strContents) { addComment(strTag + "=" + strContents); } /** Calls vorbis_comment_query_count(). */ public int queryCount(String strTag) { String strFullTag = strTag + "="; int nCount = 0; for (int i = 0; i < m_comments.size(); i++) { if (m_comments.get(i).startsWith(strFullTag)) { nCount++; } } return nCount; } /** Calls vorbis_comment_query(). */ public String query(String strTag, int nIndex) { int nCount = 0; for (int i = 0; i < m_comments.size(); i++) { if (i == nIndex) { return m_comments.get(i).substring(strTag.length() + 1); } nCount++; } return null; } /** Accesses user_comments, comment_lengths and comments. */ public String[] getUserComments() { return m_comments.toArray(new String[m_comments.size()]); } /** Accesses vendor. */ public String getVendor() { return m_vendor; } /** Calls vorbis_comment_clear(). */ public void clear() { m_comments.clear(); m_vendor = null; } public int pack(Buffer buffer) { String strVendor = "tritonus.org pvorbis library"; //String strVendor = "Xiph.Org libVorbis I 20030909"; /* preamble */ buffer.write(0x03, 8); buffer.write("vorbis"); /* vendor */ buffer.writeWithLength(strVendor); /* comments */ buffer.write(m_comments.size(), 32); if(m_comments.size() > 0) { for(int i = 0; i < m_comments.size(); i++) { buffer.writeWithLength(m_comments.get(i)); } } buffer.write(1, 1); return 0; } public int unpack(Buffer buffer) { String s = buffer.readString(); if (s == null) { clear(); return OV_EBADHEADER; } m_vendor = s; int nNumComments = buffer.read(32); if (nNumComments < 0) { clear(); return OV_EBADHEADER; } for (int i = 0; i < nNumComments; i++) { s = buffer.readString(); if (s == null) { clear(); return OV_EBADHEADER; } m_comments.add(s); } /* EOP check */ if (buffer.read(1) != 1) { clear(); return OV_EBADHEADER; } // everything ok. return 0; } } /*** Comment.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/lowlevel/pvorbis/DspState.java0000644000175000017500000001322510374160732030034 0ustar twernertwerner/* * DspState.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2000 - 2005 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.lowlevel.pvorbis; import org.tritonus.lowlevel.pogg.Ogg; import org.tritonus.lowlevel.pogg.Packet; import org.tritonus.lowlevel.pogg.Buffer; import org.tritonus.share.TDebug; /** Wrapper for vorbis_dsp_state. */ public class DspState { static { Ogg.loadNativeLibrary(); if (TDebug.TraceVorbisNative) { setTrace(true); } } /** * Holds the pointer to vorbis_dsp_state * for the native code. * This must be long to be 64bit-clean. */ @SuppressWarnings("unused") private long m_lNativeHandle; private Info m_info; public DspState() { if (TDebug.TraceVorbisNative) { TDebug.out("DspState.(): begin"); } int nReturn = malloc(); if (nReturn < 0) { throw new RuntimeException("malloc of vorbis_dsp_state failed"); } if (TDebug.TraceVorbisNative) { TDebug.out("DspState.(): end"); } } public void finalize() { // TODO: call free() // call super.finalize() first or last? // and introduce a flag if free() has already been called? } private native int malloc(); public native void free(); /** Initialize for encoding. */ public int initAnalysis(Info info) { m_info = info; return initAnalysis_native(info); } /** Initialize for encoding. Calls vorbis_analysis_init(). */ public native int initAnalysis_native(Info info); private Info getInfo() { return m_info; } /** Calls vorbis_analysis_headerout(). */ public int headerOut( Comment comment, Packet infoPacket, Packet commentPacket, Packet codePacket) { // for testing, write the info header here, too //Packet testInfoPacket = new Packet(); Buffer buffer = new Buffer(); buffer.writeInit(); getInfo().pack(buffer); infoPacket.setData(buffer.getBuffer(), 0, buffer.bytes()); infoPacket.setFlags(true, false, 0); buffer.reset(); comment.pack(buffer); commentPacket.setData(buffer.getBuffer(), 0, buffer.bytes()); commentPacket.setFlags(false, false, 0); int nReturn = headerOut_native(codePacket); /* byte[] buffer1 = infoPacket.getData(); byte[] buffer2 = testInfoPacket.getData(); TDebug.out("comment buffers: " + buffer1.length + ", " + buffer2.length); String s = ""; for (int i = 0; i < buffer1.length; i++) { s += "" + buffer1[i] + ", "; } TDebug.out("buffer1: " + s); s = ""; for (int i = 0; i < buffer2.length; i++) { s += "" + buffer2[i] + ", "; } TDebug.out("buffer2: " + s); testInfoPacket.free(); */ buffer.writeClear(); buffer.free(); return nReturn; } /** Calls vorbis_analysis_headerout(). */ public native int headerOut_native(Packet codePacket); /** Calls vorbis_analysis_buffer() and vorbis_analysis_wrote(). */ public int write(float[][] values, int nValues) { return write_native(values, nValues); } /** Calls vorbis_analysis_buffer() and vorbis_analysis_wrote(). */ public native int write_native(float[][] values, int nValues); /** Calls vorbis_analysis_blockout(). */ public int blockOut(Block block) { return blockOut_native(block); } /** Calls vorbis_analysis_blockout(). */ public native int blockOut_native(Block block); /** Calls vorbis_bitrate_flushpacket(). */ public int flushPacket(Packet packet) { return flushPacket_native(packet); } /** Calls vorbis_bitrate_flushpacket(). */ public native int flushPacket_native(Packet packet); /** Initialize for decoding. Calls vorbis_synthesis_init(). */ public int initSynthesis(Info info) { return initSynthesis_native(info); } /** Initialize for decoding. Calls vorbis_synthesis_init(). */ public native int initSynthesis_native(Info info); /** Calls vorbis_synthesis_blockin(). */ public int blockIn(Block block) { return blockIn_native(block); } /** Calls vorbis_synthesis_blockin(). */ public native int blockIn_native(Block block); /** Calls vorbis_synthesis_pcmout(). */ public int pcmOut(float[][] afPcm) { return pcmOut_native(afPcm); } /** Calls vorbis_synthesis_pcmout(). */ public native int pcmOut_native(float[][] afPcm); /** Calls vorbis_synthesis_read(). */ public int read(int nSamples) { return read_native(nSamples); } /** Calls vorbis_synthesis_read(). */ public native int read_native(int nSamples); /** Accesses sequence. */ public long getSequence() { return getSequence_native(); } /** Accesses sequence. */ public native long getSequence_native(); /** Calls vorbis_dsp_clear(). */ public void clear() { clear_native(); } /** Calls vorbis_dsp_clear(). */ public native void clear_native(); private static native void setTrace(boolean bTrace); } /*** DspState.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/lowlevel/pvorbis/Info.java0000644000175000017500000002156110374160732027202 0ustar twernertwerner/* * Info.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2000 - 2005 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.lowlevel.pvorbis; import org.tritonus.lowlevel.pogg.Ogg; import org.tritonus.lowlevel.pogg.Packet; import org.tritonus.lowlevel.pogg.Buffer; import org.tritonus.share.TDebug; /** Wrapper for vorbis_info. */ public class Info implements VorbisConstants { static { Ogg.loadNativeLibrary(); if (TDebug.TraceVorbisNative) { setTrace(true); } } /** * Holds the pointer to vorbis_info * for the native code. * This must be long to be 64bit-clean. */ @SuppressWarnings("unused") private long m_lNativeHandle; private int m_nVersion; private int m_nChannels; private int m_nRate; private int m_nBitrateUpper; private int m_nBitrateNominal; private int m_nBitrateLower; public Info() { if (TDebug.TraceVorbisNative) { TDebug.out("Info.(): begin"); } int nReturn = malloc(); if (nReturn < 0) { throw new RuntimeException("malloc of vorbis_info failed"); } if (TDebug.TraceVorbisNative) { TDebug.out("Info.(): end"); } } public void finalize() { // TODO: call free() // call super.finalize() first or last? // and introduce a flag if free() has already been called? } private native int malloc(); public native void free(); /** Calls vorbis_info_init(). */ public void init() { m_nVersion = 0; m_nChannels = 0; m_nRate = 0; m_nBitrateUpper = 0; m_nBitrateNominal = 0; m_nBitrateLower = 0; // TODO: allocate codec_setup_info init_native(); } /** Calls vorbis_info_init(). */ public native void init_native(); /** Calls vorbis_info_clear(). */ public void clear() { // TODO: lots of stuff in codec_setup_info m_nVersion = 0; m_nChannels = 0; m_nRate = 0; m_nBitrateUpper = 0; m_nBitrateNominal = 0; m_nBitrateLower = 0; clear_native(); } /** Calls vorbis_info_clear(). */ public native void clear_native(); public int getVersion() { return getVersion_native(); } private native int getVersion_native(); public void setValues(int nVersion, int nChannels, int nRate, int nBitrateUpper, int nBitrateNominal, int nBitrateLower, int nBlocksize0, int nBlocksize1) { m_nVersion = nVersion; m_nChannels = nChannels; m_nRate = nRate; m_nBitrateUpper = nBitrateUpper; m_nBitrateNominal = nBitrateNominal; m_nBitrateLower = nBitrateLower; setValues_native(nVersion, nChannels, nRate, nBitrateUpper, nBitrateNominal, nBitrateLower, nBlocksize0, nBlocksize1); } private native void setValues_native(int nVersion, int nChannels, int nRate, int nBitrateUpper, int nBitrateNominal, int nBitrateLower, int nBlocksize0, int nBlocksize1); public int getBlocksize0() { return getBlocksize_native(0); } public int getBlocksize1() { return getBlocksize_native(1); } /** @param nIndex which blocksize is desired. Has to be either 0 or 1. */ private native int getBlocksize_native(int nIndex); /** Accesses channels. */ public int getChannels() { // return m_nChannels; return getChannels_native(); } /** Accesses channels. */ private native int getChannels_native(); /** Accesses rate. */ public int getRate() { //return m_nRate; return getRate_native(); } /** Accesses rate. */ private native int getRate_native(); public int getBitrateUpper() { //return m_nBitrateUpper; return getBitrateUpper_native(); } private native int getBitrateUpper_native(); public int getBitrateNominal() { //return m_nBitrateNominal; return getBitrateNominal_native(); } private native int getBitrateNominal_native(); public int getBitrateLower() { //return m_nBitrateLower; return getBitrateLower_native(); } private native int getBitrateLower_native(); /** Calls vorbis_encode_init(). */ public int encodeInit( int nChannels, int nRate, int nMaxBitrate, int nNominalBitrate, int nMinBitrate) { return encodeInit_native( nChannels, nRate, nMaxBitrate, nNominalBitrate, nMinBitrate); } /** Calls vorbis_encode_init(). */ private native int encodeInit_native( int nChannels, int nRate, int nMaxBitrate, int nNominalBitrate, int nMinBitrate); /** Calls vorbis_encode_init_vbr(). */ public int encodeInitVBR( int nChannels, int nRate, float fQuality) { return encodeInitVBR_native( nChannels, nRate, fQuality); } /** Calls vorbis_encode_init_vbr(). */ private native int encodeInitVBR_native( int nChannels, int nRate, float fQuality); /** Calls vorbis_synthesis_headerin(). */ public int headerIn(Comment comment, Packet packet) { if(packet == null) { return OV_EBADHEADER; } Buffer buffer = new Buffer(); byte[] abData = packet.getData(); //Buffer.outBuffer(abData); buffer.readInit(abData, abData.length); /* Which of the three types of header is this? */ /* Also verify header-ness, vorbis */ int packtype = buffer.read(8); //TDebug.out("packtype: " + packtype); String s = buffer.readString(6); if(! "vorbis".equals(s)) { /* not a vorbis header */ buffer.free(); return OV_ENOTVORBIS; } int r; switch (packtype) { case 0x01: /* least significant *bit* is read first */ if(! packet.isBos()) { /* Not the initial packet */ buffer.free(); return OV_EBADHEADER; } if (getRate() != 0) { /* previously initialized info header */ buffer.free(); return OV_EBADHEADER; } r = unpack(buffer); buffer.free(); return r; case 0x03: /* least significant *bit* is read first */ if (getRate() == 0) { /* um... we didn't get the initial header */ buffer.free(); return OV_EBADHEADER; } r = comment.unpack(buffer); buffer.free(); return r; case 0x05: /* least significant *bit* is read first */ if (getRate() == 0 || comment.getVendor() == null) { /* um... we didn;t get the initial header or comments yet */ buffer.free(); return OV_EBADHEADER; } r = headerIn_native(buffer, packtype, packet); buffer.free(); return r; //return(_vorbis_unpack_books(vi,&buffer)); default: /* Not a valid vorbis header type */ buffer.free(); return OV_EBADHEADER; } } /** Calls vorbis_synthesis_headerin(). */ private native int headerIn_native(Buffer buffer, int nPacketType, Packet packet); public int pack(Buffer buffer) { /* preamble */ buffer.write(0x01, 8); buffer.write("vorbis"); buffer.write(0x00, 32); // version buffer.write(getChannels(), 8); buffer.write(getRate(), 32); buffer.write(getBitrateUpper(), 32); buffer.write(getBitrateNominal(), 32); buffer.write(getBitrateLower(), 32); buffer.write(ilog2(getBlocksize0()), 4); buffer.write(ilog2(getBlocksize1()), 4); /* end of packet */ buffer.write(1, 1); return 0; } public int unpack(Buffer buffer) { int nVersion = buffer.read(32); if (nVersion != 0) { return OV_EVERSION; } int nChannels = buffer.read(8); int nRate = buffer.read(32); int nBitrateUpper = buffer.read(32); int nBitrateNominal = buffer.read(32); int nBitrateLower = buffer.read(32); int nBlocksize0 = 1 << buffer.read(4); int nBlocksize1 = 1 << buffer.read(4); if (nChannels < 1 || nRate < 1 || nBlocksize0 < 8 || nBlocksize1 < nBlocksize0) { clear(); return OV_EBADHEADER; } /* EOP check */ if (buffer.read(1) != 1) { clear(); return OV_EBADHEADER; } setValues(nVersion, nChannels, nRate, nBitrateUpper, nBitrateNominal, nBitrateLower, nBlocksize0, nBlocksize1); // everything ok. return 0; } private static native void setTrace(boolean bTrace); private static int ilog2(int v) { int ret = 0; if (v != 0) --v; while (v != 0) { ret++; v >>= 1; } return ret; } } /*** Info.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/lowlevel/pvorbis/StaticCodebook.java0000644000175000017500000001274110374160732031204 0ustar twernertwerner/* * StaticCodebook.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2005 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.lowlevel.pvorbis; import org.tritonus.lowlevel.pogg.Buffer; import org.tritonus.share.TDebug; /** Holds the static part of a codebook. */ public class StaticCodebook implements VorbisConstants { private int m_nDimensions; private int m_nEntries; private int[] m_anLengths; private int m_nMaptype; private int m_nQMin; private int m_nQDelta; private int m_nQQuant; private int m_nQSequencep; private int[] m_anQuants; public StaticCodebook() { if (TDebug.TraceVorbisNative) { TDebug.out("StaticCodebook.(): begin"); } if (TDebug.TraceVorbisNative) { TDebug.out("StaticCodebook.(): end"); } } /** */ public void clear() { m_nDimensions = 0; m_nEntries = 0; m_anLengths = null; m_nMaptype = 0; m_nQMin = 0; m_nQDelta = 0; m_nQQuant = 0; m_nQSequencep = 0; m_anQuants = null; } /** Initializes the comment object. Sets the vendor string to null and removes all comments. */ public void init() { // m_vendor = null; // m_comments = new ArrayList(); } public int pack(Buffer buffer) { // String strVendor = "tritonus.org pvorbis library"; // //String strVendor = "Xiph.Org libVorbis I 20030909"; // /* preamble */ // buffer.write(0x03, 8); // buffer.write("vorbis"); // /* vendor */ // buffer.writeWithLength(strVendor); // /* comments */ // buffer.write(m_comments.size(), 32); // if(m_comments.size() > 0) // { // for(int i = 0; i < m_comments.size(); i++) // { // buffer.writeWithLength(m_comments.get(i)); // } // } // buffer.write(1, 1); return 0; } public int unpack(Buffer buffer) { int nMagic = buffer.read(24); if (nMagic != 0x564342) { clear(); return -1; } m_nDimensions = buffer.read(16); m_nEntries = buffer.read(24); if (m_nEntries == -1) { clear(); return -1; } m_anLengths = new int[m_nEntries]; /* are the lengths ordered or not? */ if (! buffer.readFlag()) // unordered { /* sparse? */ if (buffer.readFlag()) // yes, sparse { for (int i = 0; i < m_nEntries; i++) { if (buffer.readFlag()) // value present { int nLength = buffer.read(5); if (nLength == -1) { clear(); return -1; } m_anLengths[i] = nLength + 1; } else { m_anLengths[i] = 0; } } } else // not sparse { for (int i = 0; i < m_nEntries; i++) { int nLength = buffer.read(5); if (nLength == -1) { clear(); return -1; } m_anLengths[i] = nLength + 1; } } } else // lengths ordered { int nLength = buffer.read(5) + 1; for (int i = 0; i < m_nEntries;) { int nCount = buffer.read(ilog(m_nEntries - i)); if (nCount == -1) { clear(); return -1; } for (int j = 0; j < nCount; j++, i++) { m_anLengths[i] = nLength; } nLength++; } } m_nMaptype = buffer.read(4); if (m_nMaptype == 1 || m_nMaptype == 2) { m_nQMin = buffer.read(32); m_nQDelta = buffer.read(32); m_nQQuant = buffer.read(4) + 1; m_nQSequencep = buffer.read(1); int nQuantVals = 0; if (m_nMaptype == 1) { nQuantVals = calculateMaptype1Quantvals(); } else if (m_nMaptype == 2) { nQuantVals = m_nEntries * m_nDimensions; } m_anQuants = new int[nQuantVals]; for (int i = 0; i < nQuantVals; i++) { m_anQuants[i] = buffer.read(m_nQQuant); } if (nQuantVals != 0 && m_anQuants[nQuantVals - 1] == -1) { clear(); return -1; } } else if (m_nMaptype > 2) { clear(); return -1; } // everything ok. return 0; } /** Calculate the number of quants in a maptype 1 codebook. */ private int calculateMaptype1Quantvals() { int vals = (int) Math.floor(Math.pow(m_nEntries, 1.0f / m_nDimensions)); /* the above *should* be reliable, but we'll not assume that FP is ever reliable when bitstream sync is at stake; verify via integer means that vals really is the greatest value of dim for which vals^b->bim <= b->entries */ /* treat the above as an initial guess */ while (true) { int acc = 1; int acc1 = 1; int i; for (i = 0; i < m_nDimensions; i++) { acc *= vals; acc1 *= vals + 1; } if (acc <= m_nEntries && acc1 > m_nEntries) { return vals; } else { if (acc > m_nEntries) { vals--; } else { vals++; } } } } private static int ilog(int v) { int ret = 0; while (v != 0) { ret++; v >>= 1; } return ret; } } /*** StaticCodebook.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/lowlevel/pvorbis/VorbisConstants.java0000644000175000017500000000342110170743267031447 0ustar twernertwerner/* * VorbisConstants.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2005 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.lowlevel.pvorbis; /** Constants, especially error codes from vorbis/codec.h. */ public interface VorbisConstants { public static final int OV_FALSE = -1; public static final int OV_EOF = -2; public static final int OV_HOLE = -3; public static final int OV_EREAD = -128; public static final int OV_EFAULT = -129; public static final int OV_EIMPL = -130; public static final int OV_EINVAL = -131; public static final int OV_ENOTVORBIS = -132; public static final int OV_EBADHEADER = -133; public static final int OV_EVERSION = -134; public static final int OV_ENOTAUDIO = -135; public static final int OV_EBADPACKET = -136; public static final int OV_EBADLINK = -137; public static final int OV_ENOSEEK = -138; } /*** VorbisConstants.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/lowlevel/pvorbis/package.html0000644000175000017500000000054310167047647027733 0ustar twernertwerner

Alternative pure java implementation of the vorbis library. The classes provided here . This package is used by the package {@link org.tritonus.sampled.convert.pvorbis}.

@see org.tritonus.sampled.convert.pvorbis libtritonus-java-20070428/src/classes/org/tritonus/lowlevel/vorbis/0000755000175000017500000000000010621572447025264 5ustar twernertwernerlibtritonus-java-20070428/src/classes/org/tritonus/lowlevel/vorbis/Block.java0000644000175000017500000000475610374160732027170 0ustar twernertwerner/* * Block.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2000 - 2001 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.lowlevel.vorbis; import org.tritonus.lowlevel.ogg.Ogg; import org.tritonus.lowlevel.ogg.Packet; import org.tritonus.share.TDebug; /** Wrapper for vorbis_block. */ public class Block { static { Ogg.loadNativeLibrary(); if (TDebug.TraceVorbisNative) { setTrace(true); } } /** * Holds the pointer to vorbis_block * for the native code. * This must be long to be 64bit-clean. */ @SuppressWarnings("unused") private long m_lNativeHandle; public Block() { if (TDebug.TraceVorbisNative) { TDebug.out("Block.(): begin"); } int nReturn = malloc(); if (nReturn < 0) { throw new RuntimeException("malloc of vorbis_block failed"); } if (TDebug.TraceVorbisNative) { TDebug.out("Block.(): end"); } } public void finalize() { // TODO: call free() // call super.finalize() first or last? // and introduce a flag if free() has already been called? } private native int malloc(); public native void free(); /** Calls vorbis_block_init(). */ public native int init(DspState dspState); /** Calls vorbis_bitrate_addblock(). */ public native int addBlock(); /** Calls vorbis_analysis(). */ public native int analysis(Packet packet); /** Calls vorbis_synthesis(). */ public native int synthesis(Packet packet); /** Calls vorbis_block_clear(). */ public native int clear(); private static native void setTrace(boolean bTrace); } /*** Block.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/lowlevel/vorbis/Comment.java0000644000175000017500000000555710374160732027540 0ustar twernertwerner/* * Comment.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2000 - 2001 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.lowlevel.vorbis; import org.tritonus.lowlevel.ogg.Ogg; import org.tritonus.share.TDebug; /** Wrapper for vorbis_info. */ public class Comment { static { Ogg.loadNativeLibrary(); if (TDebug.TraceVorbisNative) { setTrace(true); } } /** * Holds the pointer to vorbis_info * for the native code. * This must be long to be 64bit-clean. */ @SuppressWarnings("unused") private long m_lNativeHandle; public Comment() { if (TDebug.TraceVorbisNative) { TDebug.out("Comment.(): begin"); } int nReturn = malloc(); if (nReturn < 0) { throw new RuntimeException("malloc of vorbis_comment failed"); } if (TDebug.TraceVorbisNative) { TDebug.out("Comment.(): end"); } } public void finalize() { // TODO: call free() // call super.finalize() first or last? // and introduce a flag if free() has already been called? } private native int malloc(); public native void free(); /** Calls vorbis_comment_init(). */ public native void init(); /** Calls vorbis_comment_add(). */ public native void addComment(String strComment); /** Calls vorbis_comment_add_tag(). */ public native void addTag(String strTag, String strComment); /** Calls vorbis_comment_query_count(). */ public native int queryCount(String strTag); /** Calls vorbis_comment_query(). */ public native String query(String strTag, int nIndex); /** Accesses user_comments, comment_lengths and comments. */ public native String[] getUserComments(); /** Accesses vendor. */ public native String getVendor(); /** Calls vorbis_comment_clear(). */ public native void clear(); // /** Calls vorbis_commentheader_out(). // */ // public native void headerOut(Packet packet); private static native void setTrace(boolean bTrace); } /*** Comment.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/lowlevel/vorbis/DspState.java0000644000175000017500000000632210374160732027654 0ustar twernertwerner/* * DspState.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2000 - 2001 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.lowlevel.vorbis; import org.tritonus.lowlevel.ogg.Ogg; import org.tritonus.lowlevel.ogg.Packet; import org.tritonus.share.TDebug; /** Wrapper for vorbis_dsp_state. */ public class DspState { static { Ogg.loadNativeLibrary(); if (TDebug.TraceVorbisNative) { setTrace(true); } } /** * Holds the pointer to vorbis_dsp_state * for the native code. * This must be long to be 64bit-clean. */ @SuppressWarnings("unused") private long m_lNativeHandle; public DspState() { if (TDebug.TraceVorbisNative) { TDebug.out("DspState.(): begin"); } int nReturn = malloc(); if (nReturn < 0) { throw new RuntimeException("malloc of vorbis_dsp_state failed"); } if (TDebug.TraceVorbisNative) { TDebug.out("DspState.(): end"); } } public void finalize() { // TODO: call free() // call super.finalize() first or last? // and introduce a flag if free() has already been called? } private native int malloc(); public native void free(); /** Initialize for encoding. Calls vorbis_analysis_init(). */ public native int initAnalysis(Info info); /** Calls vorbis_analysis_headerout(). */ public native int headerOut( Comment comment, Packet packet, Packet commentPacket, Packet codePacket); /** Calls vorbis_analysis_buffer() and vorbis_analysis_wrote(). */ public native int write(float[][] values, int nValues); /** Calls vorbis_analysis_blockout(). */ public native int blockOut(Block block); /** Calls vorbis_bitrate_flushpacket(). */ public native int flushPacket(Packet packet); /** Initialize for decoding. Calls vorbis_synthesis_init(). */ public native int initSynthesis(Info info); /** Calls vorbis_synthesis_blockin(). */ public native int blockIn(Block block); /** Calls vorbis_synthesis_pcmout(). */ public native int pcmOut(float[][] afPcm); /** Calls vorbis_synthesis_read(). */ public native int read(int nSamples); /** Accesses sequence. */ public native long getSequence(); /** Calls vorbis_dsp_clear(). */ public native void clear(); private static native void setTrace(boolean bTrace); } /*** DspState.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/lowlevel/vorbis/Info.java0000644000175000017500000000540010374160732027014 0ustar twernertwerner/* * Info.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2000 - 2001 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.lowlevel.vorbis; import org.tritonus.lowlevel.ogg.Ogg; import org.tritonus.lowlevel.ogg.Packet; import org.tritonus.share.TDebug; /** Wrapper for vorbis_info. */ public class Info { static { Ogg.loadNativeLibrary(); if (TDebug.TraceVorbisNative) { setTrace(true); } } /** * Holds the pointer to vorbis_info * for the native code. * This must be long to be 64bit-clean. */ @SuppressWarnings("unused") private long m_lNativeHandle; public Info() { if (TDebug.TraceVorbisNative) { TDebug.out("Info.(): begin"); } int nReturn = malloc(); if (nReturn < 0) { throw new RuntimeException("malloc of vorbis_info failed"); } if (TDebug.TraceVorbisNative) { TDebug.out("Info.(): end"); } } public void finalize() { // TODO: call free() // call super.finalize() first or last? // and introduce a flag if free() has already been called? } private native int malloc(); public native void free(); /** Calls vorbis_info_init(). */ public native void init(); /** Calls vorbis_info_clear(). */ public native void clear(); // blocksize? /** Accesses channels. */ public native int getChannels(); /** Accesses rate. */ public native int getRate(); /** Calls vorbis_encode_init(). */ public native int encodeInit( int nChannels, int nRate, int nMaxBitrate, int nNominalBitrate, int nMinBitrate); /** Calls vorbis_encode_init_vbr(). */ public native int encodeInitVBR( int nChannels, int nRate, float fQuality); /** Calls vorbis_synthesis_headerin(). */ public native int headerIn(Comment comment, Packet packet); private static native void setTrace(boolean bTrace); } /*** Info.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/lowlevel/vorbis/package.html0000644000175000017500000000051310172434623027536 0ustar twernertwerner

Access to the native vorbis library. The classes provided here . This package is used by the package {@link org.tritonus.sampled.convert.vorbis}.

@see org.tritonus.sampled.convert.vorbis libtritonus-java-20070428/src/classes/org/tritonus/midi/0000755000175000017500000000000010621572462023046 5ustar twernertwernerlibtritonus-java-20070428/src/classes/org/tritonus/midi/device/0000755000175000017500000000000010621572455024307 5ustar twernertwernerlibtritonus-java-20070428/src/classes/org/tritonus/midi/device/alsa/0000755000175000017500000000000010621572454025226 5ustar twernertwernerlibtritonus-java-20070428/src/classes/org/tritonus/midi/device/alsa/AlsaMidiChannel.java0000644000175000017500000001347110374074735031057 0ustar twernertwerner/* * AlsaMidiChannel.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.midi.device.alsa; import javax.sound.midi.MidiChannel; import javax.sound.midi.MidiMessage; import javax.sound.midi.ShortMessage; import javax.sound.midi.InvalidMidiDataException; import javax.sound.midi.Receiver; import org.tritonus.share.TDebug; import org.tritonus.share.midi.MidiUtils; // idea: put things that can implemented with "pure MIDI" into a base class TMidiChannel public class AlsaMidiChannel implements MidiChannel { private Receiver m_receiver; private int m_nChannel; public AlsaMidiChannel(Receiver receiver, int nChannel) { m_receiver = receiver; m_nChannel = nChannel; } protected int getChannel() { return m_nChannel; } protected void sendMessage(MidiMessage message) { m_receiver.send(message, -1); } public void noteOn(int nNoteNumber, int nVelocity) { ShortMessage message = new ShortMessage(); try { message.setMessage(ShortMessage.NOTE_ON, getChannel(), nNoteNumber, nVelocity); } catch (InvalidMidiDataException e) { if (TDebug.TraceAlsaMidiChannel || TDebug.TraceAllExceptions) { TDebug.out(e); } } sendMessage(message); } public void noteOff(int nNoteNumber, int nVelocity) { ShortMessage message = new ShortMessage(); try { message.setMessage(ShortMessage.NOTE_OFF, getChannel(), nNoteNumber, nVelocity); } catch (InvalidMidiDataException e) { if (TDebug.TraceAlsaMidiChannel || TDebug.TraceAllExceptions) { TDebug.out(e); } } sendMessage(message); } public void noteOff(int nNoteNumber) { ShortMessage message = new ShortMessage(); try { message.setMessage(ShortMessage.NOTE_OFF, getChannel(), nNoteNumber, 0); } catch (InvalidMidiDataException e) { if (TDebug.TraceAlsaMidiChannel || TDebug.TraceAllExceptions) { TDebug.out(e); } } sendMessage(message); } public void setPolyPressure(int nNoteNumber, int nPressure) { ShortMessage message = new ShortMessage(); try { message.setMessage(ShortMessage.POLY_PRESSURE, nPressure, 0); } catch (InvalidMidiDataException e) { if (TDebug.TraceAlsaMidiChannel || TDebug.TraceAllExceptions) { TDebug.out(e); } } sendMessage(message); } public int getPolyPressure(int nNoteNumber) { return -1; } public void setChannelPressure(int nPressure) { ShortMessage message = new ShortMessage(); try { message.setMessage(ShortMessage.CHANNEL_PRESSURE, getChannel(), nPressure, 0); } catch (InvalidMidiDataException e) { if (TDebug.TraceAlsaMidiChannel || TDebug.TraceAllExceptions) { TDebug.out(e); } } sendMessage(message); } public int getChannelPressure() { return -1; } public void controlChange(int nController, int nValue) { ShortMessage message = new ShortMessage(); try { message.setMessage(ShortMessage.CONTROL_CHANGE, getChannel(), nController, nValue); } catch (InvalidMidiDataException e) { if (TDebug.TraceAlsaMidiChannel || TDebug.TraceAllExceptions) { TDebug.out(e); } } sendMessage(message); } public int getController(int nController) { return -1; } public void programChange(int nProgram) { ShortMessage message = new ShortMessage(); try { message.setMessage(ShortMessage.PROGRAM_CHANGE, getChannel(), nProgram, 0); } catch (InvalidMidiDataException e) { if (TDebug.TraceAlsaMidiChannel || TDebug.TraceAllExceptions) { TDebug.out(e); } } sendMessage(message); } public void programChange(int nBank, int nProgram) { ShortMessage message = new ShortMessage(); try { // TODO: what about the bank? message.setMessage(ShortMessage.PROGRAM_CHANGE, getChannel(), nProgram, 0); } catch (InvalidMidiDataException e) { if (TDebug.TraceAlsaMidiChannel || TDebug.TraceAllExceptions) { TDebug.out(e); } } sendMessage(message); } public int getProgram() { return -1; } public void setPitchBend(int nBend) { ShortMessage message = new ShortMessage(); try { message.setMessage(ShortMessage.PITCH_BEND, MidiUtils.get14bitLSB(nBend), MidiUtils.get14bitMSB(nBend)); } catch (InvalidMidiDataException e) { if (TDebug.TraceAlsaMidiChannel || TDebug.TraceAllExceptions) { TDebug.out(e); } } sendMessage(message); } public int getPitchBend() { return -1; } public void resetAllControllers() { } public void allNotesOff() { } public void allSoundOff() { } public boolean localControl(boolean bOn) { return false; } public void setMono(boolean bMono) { } public boolean getMono() { return false; } public void setOmni(boolean bOmni) { } public boolean getOmni() { return false; } public void setMute(boolean bMute) { } public boolean getMute() { return false; } public void setSolo(boolean bSolo) { } public boolean getSolo() { return false; } } /*** AlsaMidiChannel.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/midi/device/alsa/AlsaMidiDevice.java0000644000175000017500000002323010375041025030663 0ustar twernertwerner/* * AlsaMidiDevice.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999 - 2001 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.midi.device.alsa; import javax.sound.midi.MidiDevice; import javax.sound.midi.MidiMessage; import javax.sound.midi.MidiUnavailableException; import javax.sound.midi.Receiver; import javax.sound.midi.Transmitter; import org.tritonus.share.TDebug; import org.tritonus.lowlevel.alsa.AlsaSeq; import org.tritonus.lowlevel.alsa.AlsaSeqPortSubscribe; import org.tritonus.lowlevel.alsa.AlsaSeqEvent; import org.tritonus.lowlevel.alsa.AlsaSeqQueueStatus; import org.tritonus.share.midi.TMidiDevice; import org.tritonus.share.GlobalInfo; /** A representation of a physical MIDI port based on the ALSA sequencer. */ public class AlsaMidiDevice extends TMidiDevice implements AlsaMidiIn.AlsaMidiInListener { /** ALSA client id of the physical port. */ private int m_nPhysicalClient; /** ALSA port id of the physical port. */ private int m_nPhysicalPort; /** The object interfacing to the ALSA sequencer. */ private AlsaSeq m_alsaSeq; /** The object used for getting timestamps. */ private AlsaSeqQueueStatus m_queueStatus; /** The ALSA port id of the handler. * This is used by m_alsaSeq. */ private int m_nOwnPort; /** Handler for input from the physical MIDI port. */ private AlsaMidiIn m_alsaMidiIn; /** Handler for output to the physical MIDI port. */ private AlsaMidiOut m_alsaMidiOut; /** ALSA queue number used to timestamp incoming events. */ private int m_nTimestampingQueue; /** The event used for starting and stopping the queue. */ private AlsaSeqEvent m_event = new AlsaSeqEvent(); public AlsaMidiDevice(int nClient, int nPort, boolean bUseIn, boolean bUseOut) { this(new TMidiDevice.Info("ALSA MIDI port (" + nClient + ":" + nPort + ")", GlobalInfo.getVendor(), "ALSA MIDI port (" + nClient + ":" + nPort + ")", GlobalInfo.getVersion()), nClient, nPort, bUseIn, bUseOut); } protected AlsaMidiDevice(MidiDevice.Info info, int nClient, int nPort, boolean bUseIn, boolean bUseOut) { super(info, bUseIn, bUseOut); if (TDebug.TraceMidiDevice) { TDebug.out("AlsaMidiDevice.(): begin"); } m_nPhysicalClient = nClient; m_nPhysicalPort = nPort; if (TDebug.TraceMidiDevice) { TDebug.out("AlsaMidiDevice.(): end"); } } protected AlsaSeq getAlsaSeq() { return m_alsaSeq; } protected int getOwnPort() { return m_nOwnPort; } protected int getPhysicalClient() { return m_nPhysicalClient; } protected int getPhysicalPort() { return m_nPhysicalPort; } private AlsaSeqQueueStatus getQueueStatus() { return m_queueStatus; } protected void openImpl() { if (TDebug.TraceMidiDevice) { TDebug.out("AlsaMidiDevice.openImpl(): begin"); } // create an ALSA client... m_alsaSeq = new AlsaSeq("Tritonus Midi port handler"); // ...and an ALSA port m_nOwnPort = getAlsaSeq().createPort( "handler port", AlsaSeq.SND_SEQ_PORT_CAP_WRITE | AlsaSeq.SND_SEQ_PORT_CAP_SUBS_WRITE | AlsaSeq.SND_SEQ_PORT_CAP_READ | AlsaSeq.SND_SEQ_PORT_CAP_SUBS_READ, 0, AlsaSeq.SND_SEQ_PORT_TYPE_APPLICATION, 0, 0, 0); if (getUseTransmitter()) { /* * AlsaMidiIn listens to incoming event on the * MIDI port. * It calls this.dequeueEvent() if * it receives an event. */ m_nTimestampingQueue = getAlsaSeq().allocQueue(); m_queueStatus = new AlsaSeqQueueStatus(); // TODO: stop queue startQueue(); m_alsaMidiIn = new AlsaMidiIn( getAlsaSeq(), getOwnPort(), getPhysicalClient(), getPhysicalPort(), getTimestampingQueue(), true, this); m_alsaMidiIn.start(); } if (getUseReceiver()) { // uses subscribers, immediately m_alsaMidiOut = new AlsaMidiOut(getAlsaSeq(), getOwnPort()); AlsaSeqPortSubscribe portSubscribe = new AlsaSeqPortSubscribe(); portSubscribe.setSender(getAlsaSeq().getClientId(), getOwnPort()); portSubscribe.setDest(getPhysicalClient(), getPhysicalPort()); getAlsaSeq().subscribePort(portSubscribe); portSubscribe.free(); } if (TDebug.TraceMidiDevice) { TDebug.out("AlsaMidiDevice.openImpl(): end"); } } protected void closeImpl() { if (TDebug.TraceMidiDevice) { TDebug.out("AlsaMidiDevice.closeImpl(): begin"); } if (getUseTransmitter()) { m_alsaMidiIn.interrupt(); m_alsaMidiIn = null; stopQueue(); // TODO: release timestamping queue m_queueStatus.free(); m_queueStatus = null; } // TODO: // getAlsaSeq().destroyPort(getOwnPort()); getAlsaSeq().close(); m_alsaSeq = null; if (TDebug.TraceMidiDevice) { TDebug.out("AlsaMidiDevice.closeImpl(): end"); } } public long getMicroSecondPosition() { if (TDebug.TraceMidiDevice) { TDebug.out("AlsaMidiDevice.getMicroSecondPosition(): begin"); } long lPosition = 0; if (m_queueStatus != null) { getAlsaSeq().getQueueStatus(getTimestampingQueue(), getQueueStatus()); long lNanoSeconds = getQueueStatus().getRealTime(); lPosition = lNanoSeconds / 1000; } if (TDebug.TraceMidiDevice) { TDebug.out("AlsaMidiDevice.getMicroSecondPosition(): end"); } return lPosition; } private void startQueue() { controlQueue(AlsaSeq.SND_SEQ_EVENT_START); } private void stopQueue() { controlQueue(AlsaSeq.SND_SEQ_EVENT_STOP); } private void controlQueue(int nType) { m_event.setCommon(nType, AlsaSeq.SND_SEQ_TIME_STAMP_REAL | AlsaSeq.SND_SEQ_TIME_MODE_REL, 0, AlsaSeq.SND_SEQ_QUEUE_DIRECT, 0L, 0, getOwnPort(), AlsaSeq.SND_SEQ_CLIENT_SYSTEM, AlsaSeq.SND_SEQ_PORT_SYSTEM_TIMER); m_event.setQueueControl(getTimestampingQueue(), 0, 0); getAlsaSeq().eventOutputDirect(m_event); } /** Pass MidiMessage from Receivers to physical MIDI port. */ protected void receive(MidiMessage message, long lTimeStamp) { if (isOpen()) { m_alsaMidiOut.enqueueMessage(message, lTimeStamp); } } // for AlsaMidiInListener // passes events read from the device to the Transmitters public void dequeueEvent(MidiMessage message, long lTimestamp) { if (TDebug.TraceMidiDevice) { TDebug.out("AlsaMidiDevice.dequeueEvent(): message: " + message); } if (TDebug.TraceMidiDevice) { TDebug.out("AlsaMidiDevice.dequeueEvent(): tick: " + lTimestamp); } // send via superclass method sendImpl(message, lTimestamp); } private int getTimestampingQueue() { return m_nTimestampingQueue; } public Receiver getReceiver() throws MidiUnavailableException { if (! getUseReceiver()) { throw new MidiUnavailableException("Receivers are not supported by this device"); } return new AlsaMidiDeviceReceiver(); } public Transmitter getTransmitter() throws MidiUnavailableException { if (! getUseTransmitter()) { throw new MidiUnavailableException("Transmitters are not supported by this device"); } return new AlsaMidiDeviceTransmitter(); } /////////////////// INNER CLASSES ////////////////////////////////////// private class AlsaMidiDeviceReceiver extends TReceiver implements AlsaReceiver { public AlsaMidiDeviceReceiver() { super(); } /** Subscribe to the passed port. * This establishes a subscription in the ALSA sequencer * so that the device this Receiver belongs to receives * event from the client:port passed as parameters. * * @return true if subscription was established, * false otherwise */ public boolean subscribeTo(int nClient, int nPort) { try { AlsaSeqPortSubscribe portSubscribe = new AlsaSeqPortSubscribe(); portSubscribe.setSender(nClient, nPort); portSubscribe.setDest(AlsaMidiDevice.this.getPhysicalClient(), AlsaMidiDevice.this.getPhysicalPort()); AlsaMidiDevice.this.getAlsaSeq().subscribePort(portSubscribe); portSubscribe.free(); return true; } catch (RuntimeException e) { if (TDebug.TraceAllExceptions) { TDebug.out(e); } return false; } } } private class AlsaMidiDeviceTransmitter extends TTransmitter { private boolean m_bReceiverSubscribed; public AlsaMidiDeviceTransmitter() { super(); m_bReceiverSubscribed = false; } public void setReceiver(Receiver receiver) { super.setReceiver(receiver); /* * Try to establish a subscription of the Receiver * to the ALSA seqencer client of the device this * Transmitter belongs to. */ if (receiver instanceof AlsaReceiver) { m_bReceiverSubscribed = ((AlsaReceiver) receiver).subscribeTo(getPhysicalClient(), getPhysicalPort()); } } public void send(MidiMessage message, long lTimeStamp) { /* * Send message via Java methods only if no * subscription was established. If there is a * subscription, the message is routed inside of * the ALSA sequencer. */ if (! m_bReceiverSubscribed) { super.send(message, lTimeStamp); } } public void close() { super.close(); // TODO: remove subscription } } } /*** AlsaMidiDevice.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/midi/device/alsa/AlsaMidiDeviceProvider.java0000644000175000017500000001525610173301315032404 0ustar twernertwerner/* * AlsaMidiDeviceProvider.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999 - 2001 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.midi.device.alsa; import java.util.ArrayList; import java.util.List; import java.util.Iterator; import javax.sound.midi.MidiDevice; import javax.sound.midi.spi.MidiDeviceProvider; import org.tritonus.lowlevel.alsa.AlsaSeq; import org.tritonus.lowlevel.alsa.AlsaSeqClientInfo; import org.tritonus.lowlevel.alsa.AlsaSeqPortInfo; import org.tritonus.share.TDebug; public class AlsaMidiDeviceProvider extends MidiDeviceProvider { // perhaps move to superclass private static final MidiDevice.Info[] EMPTY_INFO_ARRAY = new MidiDevice.Info[0]; private static final int READ_CAPABILITY = AlsaSeq.SND_SEQ_PORT_CAP_READ | AlsaSeq.SND_SEQ_PORT_CAP_SUBS_READ; private static final int WRITE_CAPABILITY = AlsaSeq.SND_SEQ_PORT_CAP_WRITE | AlsaSeq.SND_SEQ_PORT_CAP_SUBS_WRITE; private static List m_devices; private static AlsaSeq m_alsaSeq; public AlsaMidiDeviceProvider() { if (TDebug.TraceMidiDeviceProvider) { TDebug.out("AlsaMidiDeviceProvider.(): begin"); } synchronized (AlsaMidiDeviceProvider.class) { if (m_devices == null) { m_devices = new ArrayList(); if (TDebug.TraceMidiDeviceProvider) { TDebug.out("AlsaMidiDeviceProvider.(): creating AlsaSeq..."); } // try{ m_alsaSeq = new AlsaSeq("Tritonus ALSA device manager"); // }catch (Throwable t) { TDebug.out(t); } if (TDebug.TraceMidiDeviceProvider) { TDebug.out("AlsaMidiDeviceProvider.(): ...done"); } scanPorts(); } } if (TDebug.TraceMidiDeviceProvider) { TDebug.out("AlsaMidiDeviceProvider.(): end"); } } public MidiDevice.Info[] getDeviceInfo() { if (TDebug.TraceMidiDeviceProvider) { TDebug.out("AlsaMidiDeviceProvider.getDeviceInfo(): begin"); } List infoList = new ArrayList(); Iterator iterator = m_devices.iterator(); while (iterator.hasNext()) { MidiDevice device = iterator.next(); MidiDevice.Info info = device.getDeviceInfo(); infoList.add(info); } MidiDevice.Info[] infos = infoList.toArray(EMPTY_INFO_ARRAY); if (TDebug.TraceMidiDeviceProvider) { TDebug.out("AlsaMidiDeviceProvider.getDeviceInfo(): end"); } return infos; } public MidiDevice getDevice(MidiDevice.Info info) { if (TDebug.TraceMidiDeviceProvider) { TDebug.out("AlsaMidiDeviceProvider.getDevice(): begin"); } MidiDevice returnedDevice = null; Iterator iterator = m_devices.iterator(); while (iterator.hasNext()) { MidiDevice device = iterator.next(); MidiDevice.Info info2 = device.getDeviceInfo(); if (info != null && info.equals(info2)) { returnedDevice = device; break; } } if (returnedDevice == null) { throw new IllegalArgumentException("no device for " + info); } if (TDebug.TraceMidiDeviceProvider) { TDebug.out("AlsaMidiDeviceProvider.getDevice(): end"); } return returnedDevice; } private void scanPorts() { if (TDebug.TraceMidiDeviceProvider || TDebug.TracePortScan) { TDebug.out("AlsaMidiDeviceProvider.scanPorts(): begin"); } Iterator clients = m_alsaSeq.getClientInfos(); while (clients.hasNext()) { AlsaSeqClientInfo clientInfo = (AlsaSeqClientInfo) clients.next(); int nClient = clientInfo.getClient(); if (TDebug.TracePortScan) { TDebug.out("AlsaMidiDeviceProvider.scanPorts(): client: " + nClient); } Iterator ports = m_alsaSeq.getPortInfos(nClient); while (ports.hasNext()) { AlsaSeqPortInfo portInfo = (AlsaSeqPortInfo) ports.next(); handlePort(clientInfo, portInfo); } } if (TDebug.TraceMidiDeviceProvider || TDebug.TracePortScan) { TDebug.out("AlsaMidiDeviceProvider.scanPorts(): end"); } } private void handlePort(AlsaSeqClientInfo clientInfo, AlsaSeqPortInfo portInfo) { int nClient = clientInfo.getClient(); int nPort = portInfo.getPort(); int nType = portInfo.getType(); int nCapability = portInfo.getCapability(); int nSynthVoices = portInfo.getSynthVoices(); if (TDebug.TracePortScan) { TDebug.out("AlsaMidiDeviceProvider.scanPorts(): port: " + nPort); TDebug.out("AlsaMidiDeviceProvider.scanPorts(): type: " + nType); TDebug.out("AlsaMidiDeviceProvider.scanPorts(): cap: " + nCapability); TDebug.out("AlsaMidiDeviceProvider.scanPorts(): midi channels: " + portInfo.getMidiChannels()); TDebug.out("AlsaMidiDeviceProvider.scanPorts(): midi voices: " + portInfo.getMidiVoices()); TDebug.out("AlsaMidiDeviceProvider.scanPorts(): synth voices: " + portInfo.getSynthVoices()); } if ((nType & AlsaSeq.SND_SEQ_PORT_TYPE_MIDI_GENERIC) != 0) { // TDebug.out("generic midi"); MidiDevice device = null; if ((nType & (AlsaSeq.SND_SEQ_PORT_TYPE_SYNTH | AlsaSeq.SND_SEQ_PORT_TYPE_DIRECT_SAMPLE | AlsaSeq.SND_SEQ_PORT_TYPE_SAMPLE)) != 0) { boolean bWriteSubscriptionAllowed = (nCapability & WRITE_CAPABILITY) == WRITE_CAPABILITY; if (bWriteSubscriptionAllowed) { device = new AlsaSynthesizer(nClient, nPort, nSynthVoices); } else { if (TDebug.TraceMidiDeviceProvider) { TDebug.out("AlsaMidiDeviceProvider.getDevice(): port does not allows write subscription, not used"); } } } else // ordinary midi port { boolean bReadSubscriptionAllowed = (nCapability & READ_CAPABILITY) == READ_CAPABILITY; boolean bWriteSubscriptionAllowed = (nCapability & WRITE_CAPABILITY) == WRITE_CAPABILITY; if (bReadSubscriptionAllowed || bWriteSubscriptionAllowed) { device = new AlsaMidiDevice(nClient, nPort, bReadSubscriptionAllowed, bWriteSubscriptionAllowed); } else { if (TDebug.TraceMidiDeviceProvider) { TDebug.out("AlsaMidiDeviceProvider.getDevice(): port allows neither read nor write subscription, not used"); } } } if (device != null) { m_devices.add(device); } } } } /*** AlsaMidiDeviceProvider.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/midi/device/alsa/AlsaMidiIn.java0000644000175000017500000003114310374074735030051 0ustar twernertwerner/* * AlsaMidiIn.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999 - 2001 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.midi.device.alsa; import javax.sound.midi.InvalidMidiDataException; import javax.sound.midi.MetaMessage; import javax.sound.midi.MidiEvent; import javax.sound.midi.MidiMessage; import javax.sound.midi.ShortMessage; import javax.sound.midi.SysexMessage; import org.tritonus.share.TDebug; import org.tritonus.lowlevel.alsa.AlsaSeq; import org.tritonus.lowlevel.alsa.AlsaSeqEvent; import org.tritonus.lowlevel.alsa.AlsaSeqPortSubscribe; /** Handles input from an ALSA port. */ public class AlsaMidiIn extends Thread { /** ALSA client used to receive events. */ private AlsaSeq m_alsaSeq; /** ALSA port number (belonging to the client represented be m_alsaSeq) used to receive events. */ private int m_nDestPort; /** ALSA client number to subscribe to to receive events. */ private int m_nSourceClient; /** ALSA port number (belonging to m_nSourceClient) to subscribe to to receive events. */ private int m_nSourcePort; private AlsaMidiInListener m_listener; private AlsaSeqEvent m_event = new AlsaSeqEvent(); // used to query event for detailed information private int[] m_anValues = new int[5]; private long[] m_alValues = new long[1]; /** Receives events without timestamping them. Does establish a subscription where events are routed directely (not getting a timestamp). @param alsaSeq The client that should be used to receive events. @param nDestPort The port number that should be used to receive events. This port has to exist on the client represented by alsaSeq. @param nSourceClient The client number that should be listened to. This and nSourcePort must exist prior to calling this constructor. The port has to allow read subscriptions. @param nSourcePort The port number that should be listened to. This and nSourceClient must exist prior to calling this constructor. The port has to allow read subscriptions. @param listener The listener that should receive the MidiMessage objects created here from received events. */ public AlsaMidiIn(AlsaSeq alsaSeq, int nDestPort, int nSourceClient, int nSourcePort, AlsaMidiInListener listener) { this(alsaSeq, nDestPort, nSourceClient, nSourcePort, -1, false, // signals: do not do timestamping listener); } /** Does establish a subscription where events are routed through a queue to get a timestamp. */ public AlsaMidiIn(AlsaSeq alsaSeq, int nDestPort, int nSourceClient, int nSourcePort, int nTimestampingQueue, boolean bRealtime, AlsaMidiInListener listener) { m_nSourceClient = nSourceClient; m_nSourcePort = nSourcePort; m_listener = listener; m_alsaSeq = alsaSeq; m_nDestPort = nDestPort; if (nTimestampingQueue >= 0) { AlsaSeqPortSubscribe portSubscribe = new AlsaSeqPortSubscribe(); portSubscribe.setSender(nSourceClient, nSourcePort); portSubscribe.setDest(getAlsaSeq().getClientId(), nDestPort); portSubscribe.setQueue(nTimestampingQueue); portSubscribe.setExclusive(false); portSubscribe.setTimeUpdate(true); portSubscribe.setTimeReal(bRealtime); getAlsaSeq().subscribePort(portSubscribe); portSubscribe.free(); } else { AlsaSeqPortSubscribe portSubscribe = new AlsaSeqPortSubscribe(); portSubscribe.setSender(nSourceClient, nSourcePort); portSubscribe.setDest(getAlsaSeq().getClientId(), nDestPort); getAlsaSeq().subscribePort(portSubscribe); portSubscribe.free(); } setDaemon(true); } private AlsaSeq getAlsaSeq() { return m_alsaSeq; } /** The working part of the class. Here, the thread repeats in blocking in a call to getEvent() and calling the listener's dequeueEvent() method. */ public void run() { // TODO: recheck interupt mechanism while (!interrupted()) { MidiEvent event = getEvent(); if (TDebug.TraceAlsaMidiIn) { TDebug.out("AlsaMidiIn.run(): got event: " + event); } if (event != null) { MidiMessage message = event.getMessage(); long lTimestamp = event.getTick(); if (message instanceof MetaMessage) { MetaMessage me = (MetaMessage) message; if (TDebug.TraceAlsaMidiIn) { TDebug.out("AlsaMidiIn.run(): MetaMessage.getData().length: " + me.getData().length); } } m_listener.dequeueEvent(message, lTimestamp); } else { if (TDebug.TraceAlsaMidiIn || TDebug.TraceAllWarnings) { TDebug.out("AlsaMidiIn.run(): received null from getEvent()"); } } } } private MidiEvent getEvent() { if (TDebug.TraceAlsaMidiIn) { TDebug.out("AlsaMidiIn.getEvent(): before eventInput()"); } while (true) { int nReturn = getAlsaSeq().eventInput(m_event); if (nReturn >= 0) { break; } /* * Sleep for 1 ms to enable scheduling. */ if (TDebug.TraceAlsaMidiIn || TDebug.TraceAllWarnings) { TDebug.out("AlsaMidiIn.getEvent(): sleeping because got no event"); } try { Thread.sleep(1); } catch (InterruptedException e) { if (TDebug.TraceAllExceptions) { TDebug.out(e); } } } MidiMessage message = null; int nType = m_event.getType(); switch (nType) { case AlsaSeq.SND_SEQ_EVENT_NOTEON: case AlsaSeq.SND_SEQ_EVENT_NOTEOFF: case AlsaSeq.SND_SEQ_EVENT_KEYPRESS: { if (TDebug.TraceAlsaMidiIn) { TDebug.out("AlsaMidiIn.getEvent(): note/aftertouch event"); } m_event.getNote(m_anValues); ShortMessage shortMessage = new ShortMessage(); int nCommand = -1; switch (nType) { case AlsaSeq.SND_SEQ_EVENT_NOTEON: nCommand = ShortMessage.NOTE_ON; break; case AlsaSeq.SND_SEQ_EVENT_NOTEOFF: nCommand = ShortMessage.NOTE_OFF; break; case AlsaSeq.SND_SEQ_EVENT_KEYPRESS: nCommand = ShortMessage.POLY_PRESSURE; break; } int nChannel = m_anValues[0] & 0xF; int nKey = m_anValues[1] & 0x7F; int nVelocity = m_anValues[2] & 0x7F; try { shortMessage.setMessage(nCommand, nChannel, nKey, nVelocity); } catch (InvalidMidiDataException e) { if (TDebug.TraceAlsaMidiIn || TDebug.TraceAllExceptions) { TDebug.out(e); } } message = shortMessage; break; } // all event types that use snd_seq_ev_ctrl_t // TODO: more case AlsaSeq.SND_SEQ_EVENT_CONTROLLER: case AlsaSeq.SND_SEQ_EVENT_PGMCHANGE: case AlsaSeq.SND_SEQ_EVENT_CHANPRESS: case AlsaSeq.SND_SEQ_EVENT_PITCHBEND: case AlsaSeq.SND_SEQ_EVENT_QFRAME: case AlsaSeq.SND_SEQ_EVENT_SONGPOS: case AlsaSeq.SND_SEQ_EVENT_SONGSEL: { m_event.getControl(m_anValues); int nCommand = -1; int nChannel = m_anValues[0] & 0xF; int nData1 = -1; int nData2 = -1; switch (nType) { case AlsaSeq.SND_SEQ_EVENT_CONTROLLER: if (TDebug.TraceAlsaMidiIn) { TDebug.out("AlsaMidiIn.getEvent(): controller event"); } nCommand = ShortMessage.CONTROL_CHANGE; nData1 = m_anValues[1] & 0x7F; nData2 = m_anValues[2] & 0x7F; break; case AlsaSeq.SND_SEQ_EVENT_PGMCHANGE: if (TDebug.TraceAlsaMidiIn) { TDebug.out("AlsaMidiIn.getEvent(): program change event"); } nCommand = ShortMessage.PROGRAM_CHANGE; nData1 = m_anValues[2] & 0x7F; nData2 = 0; break; case AlsaSeq.SND_SEQ_EVENT_CHANPRESS: if (TDebug.TraceAlsaMidiIn) { TDebug.out("AlsaMidiIn.getEvent(): channel pressure event"); } nCommand = ShortMessage.CHANNEL_PRESSURE; nData1 = m_anValues[2] & 0x7F; nData2 = 0; break; case AlsaSeq.SND_SEQ_EVENT_PITCHBEND: if (TDebug.TraceAlsaMidiIn) { TDebug.out("AlsaMidiIn.getEvent(): pitchbend event"); } nCommand = ShortMessage.PITCH_BEND; nData1 = m_anValues[2] & 0x7F; nData2 = (m_anValues[2] >> 7) & 0x7F; break; case AlsaSeq.SND_SEQ_EVENT_QFRAME: if (TDebug.TraceAlsaMidiIn) { TDebug.out("AlsaMidiIn.getEvent(): MTC event"); } nCommand = ShortMessage.MIDI_TIME_CODE; nData1 = m_anValues[2] & 0x7F; nData2 = 0; break; case AlsaSeq.SND_SEQ_EVENT_SONGPOS: if (TDebug.TraceAlsaMidiIn) { TDebug.out("AlsaMidiIn.getEvent(): song position event"); } nCommand = ShortMessage.SONG_POSITION_POINTER; nData1 = m_anValues[2] & 0x7F; nData2 = (m_anValues[2] >> 7) & 0x7F; break; case AlsaSeq.SND_SEQ_EVENT_SONGSEL: if (TDebug.TraceAlsaMidiIn) { TDebug.out("AlsaMidiIn.getEvent(): song select event"); } nCommand = ShortMessage.SONG_SELECT; nData1 = m_anValues[2] & 0x7F; nData2 = 0; break; } ShortMessage shortMessage = new ShortMessage(); try { shortMessage.setMessage(nCommand, nChannel, nData1, nData2); } catch (InvalidMidiDataException e) { if (TDebug.TraceAlsaMidiIn || TDebug.TraceAllExceptions) { TDebug.out(e); } } message = shortMessage; } break; // status-only events case AlsaSeq.SND_SEQ_EVENT_TUNE_REQUEST: case AlsaSeq.SND_SEQ_EVENT_CLOCK: case AlsaSeq.SND_SEQ_EVENT_START: case AlsaSeq.SND_SEQ_EVENT_CONTINUE: case AlsaSeq.SND_SEQ_EVENT_STOP: case AlsaSeq.SND_SEQ_EVENT_SENSING: case AlsaSeq.SND_SEQ_EVENT_RESET: { int nStatus = -1; switch (nType) { case AlsaSeq.SND_SEQ_EVENT_TUNE_REQUEST: nStatus = ShortMessage.TUNE_REQUEST; break; case AlsaSeq.SND_SEQ_EVENT_CLOCK: if (TDebug.TraceAlsaMidiIn) { TDebug.out("AlsaMidiIn.getEvent(): clock event"); } nStatus = ShortMessage.TIMING_CLOCK; break; case AlsaSeq.SND_SEQ_EVENT_START: nStatus = ShortMessage.START; break; case AlsaSeq.SND_SEQ_EVENT_CONTINUE: nStatus = ShortMessage.CONTINUE; break; case AlsaSeq.SND_SEQ_EVENT_STOP: nStatus = ShortMessage.STOP; break; case AlsaSeq.SND_SEQ_EVENT_SENSING: nStatus = ShortMessage.ACTIVE_SENSING; break; case AlsaSeq.SND_SEQ_EVENT_RESET: nStatus = ShortMessage.SYSTEM_RESET; break; } ShortMessage shortMessage = new ShortMessage(); try { shortMessage.setMessage(nStatus); } catch (InvalidMidiDataException e) { if (TDebug.TraceAlsaMidiIn || TDebug.TraceAllExceptions) { TDebug.out(e); } } message = shortMessage; break; } case AlsaSeq.SND_SEQ_EVENT_USR_VAR4: { if (TDebug.TraceAlsaMidiIn) { TDebug.out("AlsaMidiIn.getEvent(): meta event"); } MetaMessage metaMessage = new MetaMessage(); byte[] abTransferData = m_event.getVar(); int nMetaType = abTransferData[0]; byte[] abData = new byte[abTransferData.length - 1]; System.arraycopy(abTransferData, 1, abData, 0, abTransferData.length - 1); try { metaMessage.setMessage(nMetaType, abData, abData.length); } catch (InvalidMidiDataException e) { if (TDebug.TraceAlsaMidiIn || TDebug.TraceAllExceptions) { TDebug.out(e); } } message = metaMessage; break; } case AlsaSeq.SND_SEQ_EVENT_SYSEX: { if (TDebug.TraceAlsaMidiIn) { TDebug.out("AlsaMidiIn.getEvent(): sysex event"); } SysexMessage sysexMessage = new SysexMessage(); byte[] abData = m_event.getVar(); try { sysexMessage.setMessage(abData, abData.length); } catch (InvalidMidiDataException e) { if (TDebug.TraceAlsaMidiIn || TDebug.TraceAllExceptions) { TDebug.out(e); } } message = sysexMessage; break; } default: if (TDebug.TraceAlsaMidiIn || TDebug.TraceAllWarnings) { TDebug.out("AlsaMidiIn.getEvent(): unknown event"); } } if (message != null) { /* If the timestamp is in ticks, ticks in the MidiEvent gets this value. Otherwise, if the timestamp is in realtime (ns), we put us in the tick value. */ long lTimestamp = m_event.getTimestamp(); if ((m_event.getFlags() & AlsaSeq.SND_SEQ_TIME_STAMP_MASK) == AlsaSeq.SND_SEQ_TIME_STAMP_REAL) { // ns -> us lTimestamp /= 1000; } MidiEvent event = new MidiEvent(message, lTimestamp); return event; } else { return null; } } /** */ public static interface AlsaMidiInListener { public void dequeueEvent(MidiMessage message, long lTimestamp); } } /*** AlsaMidiIn.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/midi/device/alsa/AlsaMidiOut.java0000644000175000017500000002732210374074735030256 0ustar twernertwerner/* * AlsaMidiOut.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999 - 2001 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ package org.tritonus.midi.device.alsa; import javax.sound.midi.MidiMessage; import javax.sound.midi.ShortMessage; import javax.sound.midi.SysexMessage; import javax.sound.midi.MetaMessage; import org.tritonus.share.TDebug; import org.tritonus.lowlevel.alsa.AlsaSeq; import org.tritonus.lowlevel.alsa.AlsaSeqEvent; /** This class sends events always to clients that have subscribed to the client passed as AlsaSeq object and the source port number passed. This class doesn't establish any subscriptions. They have to be established elsewhere. */ public class AlsaMidiOut { /** The low-level object to interface to the ALSA sequencer. */ private AlsaSeq m_alsaSeq; /** The source port to use for sending messages via the ALSA sequencer. */ private int m_nSourcePort; /** The sequencer queue to use inside the ALSA sequencer. * This value is only used (and valid) if m_bImmediately * false. Otherwise, events are sent directely to the destination * client, circumventing queues. */ private int m_nQueue; private boolean m_bImmediately; private boolean m_bHandleMetaMessages; private AlsaSeqEvent m_event = new AlsaSeqEvent(); /* * Sends to all subscribers via queue. */ public AlsaMidiOut(AlsaSeq aSequencer, int nSourcePort, int nQueue) { this(aSequencer, nSourcePort, nQueue, false); } /* * Sends to all subscribers immediately. */ public AlsaMidiOut(AlsaSeq aSequencer, int nSourcePort) { this(aSequencer, nSourcePort, -1, true); } private AlsaMidiOut(AlsaSeq aSequencer, int nSourcePort, int nQueue, boolean bImmediately) { if (TDebug.TraceAlsaMidiOut) { TDebug.out("AlsaMidiOut.(AlsaSeq, int, int, boolean): begin"); } m_alsaSeq = aSequencer; m_nSourcePort = nSourcePort; m_nQueue = nQueue; m_bImmediately = bImmediately; m_bHandleMetaMessages = false; if (TDebug.TraceAlsaMidiOut) { TDebug.out("AlsaMidiOut.(AlsaSeq, int, int, boolean): end"); } } private AlsaSeq getAlsaSeq() { return m_alsaSeq; } private int getSourcePort() { return m_nSourcePort; } private int getQueue() { return m_nQueue; } private boolean getImmediately() { return m_bImmediately; } public boolean getHandleMetaMessages() { return m_bHandleMetaMessages; } public void setHandleMetaMessages(boolean bHandleMetaMessages) { m_bHandleMetaMessages = bHandleMetaMessages; } public synchronized void enqueueMessage(MidiMessage event, long lTick) { if (TDebug.TraceAlsaMidiOut) { TDebug.out("AlsaMidiOut.enqueueMessage(): begin"); } if (event instanceof ShortMessage) { enqueueShortMessage((ShortMessage) event, lTick); } else if (event instanceof SysexMessage) { enqueueSysexMessage((SysexMessage) event, lTick); } else if (event instanceof MetaMessage && getHandleMetaMessages()) { enqueueMetaMessage((MetaMessage) event, lTick); } else { // Ignore it. } if (TDebug.TraceAlsaMidiOut) { TDebug.out("AlsaMidiOut.enqueueMessage(): end"); } } private void enqueueShortMessage(ShortMessage shortMessage, long lTime) { int nChannel = shortMessage.getChannel(); switch (shortMessage.getCommand()) { case ShortMessage.NOTE_OFF: sendNoteOffEvent(lTime, nChannel, shortMessage.getData1(), shortMessage.getData2()); break; case ShortMessage.NOTE_ON: sendNoteOnEvent(lTime, nChannel, shortMessage.getData1(), shortMessage.getData2()); break; case ShortMessage.POLY_PRESSURE: sendKeyPressureEvent(lTime, nChannel, shortMessage.getData1(), shortMessage.getData2()); break; case ShortMessage.CONTROL_CHANGE: sendControlChangeEvent(lTime, nChannel, shortMessage.getData1(), shortMessage.getData2()); break; case ShortMessage.PROGRAM_CHANGE: sendProgramChangeEvent(lTime, nChannel, shortMessage.getData1()); break; case ShortMessage.CHANNEL_PRESSURE: sendChannelPressureEvent(lTime, nChannel, shortMessage.getData1()); break; case ShortMessage.PITCH_BEND: sendPitchBendEvent(lTime, nChannel, get14bitValue(shortMessage.getData1(), shortMessage.getData2())); break; case 0xF0: switch (shortMessage.getStatus()) { case ShortMessage.MIDI_TIME_CODE: sendMTCEvent(lTime, shortMessage.getData1()); break; case ShortMessage.SONG_POSITION_POINTER: sendSongPositionPointerEvent(lTime, get14bitValue(shortMessage.getData1(), shortMessage.getData2())); break; case ShortMessage.SONG_SELECT: sendSongSelectEvent(lTime, shortMessage.getData1()); break; case ShortMessage.TUNE_REQUEST: sendTuneRequestEvent(lTime); break; case ShortMessage.TIMING_CLOCK: sendMidiClockEvent(lTime); break; case ShortMessage.START: sendStartEvent(lTime); break; case ShortMessage.CONTINUE: sendContinueEvent(lTime); break; case ShortMessage.STOP: sendStopEvent(lTime); break; case ShortMessage.ACTIVE_SENSING: sendActiveSensingEvent(lTime); break; case ShortMessage.SYSTEM_RESET: sendSystemResetEvent(lTime); break; default: TDebug.out("AlsaMidiOut.enqueueShortMessage(): UNKNOWN EVENT TYPE: " +shortMessage.getStatus() ); } break; default: TDebug.out("AlsaMidiOut.enqueueShortMessage(): UNKNOWN EVENT TYPE: " +shortMessage.getStatus() ); } } private static int get14bitValue(int nLSB, int nMSB) { return (nLSB & 0x7F) | ((nMSB & 0x7F) << 7); } private void sendNoteOffEvent(long lTime, int nChannel, int nNote, int nVelocity) { sendNoteEvent(AlsaSeq.SND_SEQ_EVENT_NOTEOFF, lTime, nChannel, nNote, nVelocity); } private void sendNoteOnEvent(long lTime, int nChannel, int nNote, int nVelocity) { sendNoteEvent(AlsaSeq.SND_SEQ_EVENT_NOTEON, lTime, nChannel, nNote, nVelocity); } private void sendNoteEvent(int nType, long lTime, int nChannel, int nNote, int nVelocity) { setCommon(nType, 0, lTime); m_event.setNote(nChannel, nNote, nVelocity, 0, 0); sendEvent(); } private void sendKeyPressureEvent(long lTime, int nChannel, int nNote, int nPressure) { sendControlEvent(AlsaSeq.SND_SEQ_EVENT_KEYPRESS, lTime, nChannel, nNote, nPressure); } private void sendControlChangeEvent(long lTime, int nChannel, int nControl, int nValue) { sendControlEvent(AlsaSeq.SND_SEQ_EVENT_CONTROLLER, lTime, nChannel, nControl, nValue); } private void sendProgramChangeEvent(long lTime, int nChannel, int nProgram) { sendControlEvent(AlsaSeq.SND_SEQ_EVENT_PGMCHANGE, lTime, nChannel, 0, nProgram); } private void sendChannelPressureEvent(long lTime, int nChannel, int nPressure) { sendControlEvent(AlsaSeq.SND_SEQ_EVENT_CHANPRESS, lTime, nChannel, 0, nPressure); } // TODO: recheck!!!! private void sendPitchBendEvent(long lTime, int nChannel, int nPitch) { sendControlEvent(AlsaSeq.SND_SEQ_EVENT_PITCHBEND, lTime, nChannel, 0, nPitch); } private void sendControlEvent(int nType, long lTime, int nChannel, int nParam, int nValue) { setCommon(nType, 0, lTime); m_event.setControl(nChannel, nParam, nValue); sendEvent(); } private void sendMTCEvent(long lTime, int nData) { sendControlEvent(AlsaSeq.SND_SEQ_EVENT_QFRAME, lTime, 0, 0, nData); } private void sendSongPositionPointerEvent(long lTime, int nPosition) { sendControlEvent(AlsaSeq.SND_SEQ_EVENT_SONGPOS, lTime, 0, 0, nPosition); } private void sendSongSelectEvent(long lTime, int nSong) { sendControlEvent(AlsaSeq.SND_SEQ_EVENT_SONGSEL, lTime, 0, 0, nSong); } private void sendTuneRequestEvent(long lTime) { sendEvent(AlsaSeq.SND_SEQ_EVENT_TUNE_REQUEST, lTime); } private void sendMidiClockEvent(long lTime) { sendQueueControlEvent(AlsaSeq.SND_SEQ_EVENT_CLOCK, lTime, 0, 0, 0); } private void sendStartEvent(long lTime) { sendQueueControlEvent(AlsaSeq.SND_SEQ_EVENT_START, lTime, 0, 0, 0); } private void sendContinueEvent(long lTime) { sendQueueControlEvent(AlsaSeq.SND_SEQ_EVENT_CONTINUE, lTime, 0, 0, 0); } private void sendStopEvent(long lTime) { sendQueueControlEvent(AlsaSeq.SND_SEQ_EVENT_STOP, lTime, 0, 0, 0); } private void sendActiveSensingEvent(long lTime) { sendEvent(AlsaSeq.SND_SEQ_EVENT_SENSING, lTime); } private void sendSystemResetEvent(long lTime) { sendEvent(AlsaSeq.SND_SEQ_EVENT_RESET, lTime); } private void sendQueueControlEvent(int nType, long lTime, int nQueue, int nValue, long lControlTime) { setCommon(nType, 0, lTime); m_event.setQueueControl(nQueue, nValue, lControlTime); sendEvent(); } private void sendEvent(int nType, long lTime) { setCommon(nType, 0, lTime); sendEvent(); } private void enqueueSysexMessage(SysexMessage message, long lTick) { // TDebug.out("enqueueSysexMessage()"); byte[] abData = message.getMessage(); int nLength = message.getLength(); // TDebug.out("sysex len:" + nLength); // TDebug.out("abData[0]:" + (abData[0] & 255)); if ((abData[0] & 0xFF) == SysexMessage.SYSTEM_EXCLUSIVE) { // TDebug.out("standard sysex branch"); sendVarEvent(AlsaSeq.SND_SEQ_EVENT_SYSEX, lTick, abData, 0, nLength); } else // SysexMessage.SPECIAL_SYSTEM_EXCLUSIVE { // TDebug.out("special sysex branch"); sendVarEvent(AlsaSeq.SND_SEQ_EVENT_SYSEX, lTick, abData, 1, nLength - 1); } } private void enqueueMetaMessage(MetaMessage message, long lTick) { /* * We pack the type byte in front of the data bytes. */ byte[] abData = message.getData(); byte[] abTransferData = new byte[abData.length + 1]; abTransferData[0] = (byte) message.getType(); System.arraycopy(abData, 0, abTransferData, 1, abData.length); // TDebug.out("message data length: " + abTransferData.length); // TDebug.out("message length: " + message.getLength()); sendVarEvent(AlsaSeq.SND_SEQ_EVENT_USR_VAR4, lTick, abTransferData, 0, abTransferData.length); } private void sendVarEvent(int nType, long lTime, byte[] abData, int nOffset, int nLength) { setCommon(nType, AlsaSeq.SND_SEQ_EVENT_LENGTH_VARIABLE, lTime); m_event.setVar(abData, 0, nLength); sendEvent(); } private void setCommon(int nType, int nAdditionalFlags, long lTime) { if (getImmediately()) { if (TDebug.TraceAlsaMidiOut) { TDebug.out("AlsaMidiOut.enqueueShortMessage(): sending noteoff message (immediately)"); } m_event.setCommon(nType, AlsaSeq.SND_SEQ_TIME_STAMP_REAL | AlsaSeq.SND_SEQ_TIME_MODE_REL | nAdditionalFlags, 0, AlsaSeq.SND_SEQ_QUEUE_DIRECT, 0L, 0, getSourcePort(), AlsaSeq.SND_SEQ_ADDRESS_SUBSCRIBERS, AlsaSeq.SND_SEQ_ADDRESS_UNKNOWN); } else // send via queue { if (TDebug.TraceAlsaMidiOut) { TDebug.out("AlsaMidiOut.enqueueShortMessage(): sending noteoff message (timed)"); } m_event.setCommon(nType, AlsaSeq.SND_SEQ_TIME_STAMP_TICK | AlsaSeq.SND_SEQ_TIME_MODE_ABS | nAdditionalFlags, 0, getQueue(), lTime, 0, getSourcePort(), AlsaSeq.SND_SEQ_ADDRESS_SUBSCRIBERS, AlsaSeq.SND_SEQ_ADDRESS_UNKNOWN); } } /** Puts the event into the queue. */ private void sendEvent() { getAlsaSeq().eventOutput(m_event); getAlsaSeq().drainOutput(); } } /*** AlsaMidiOut.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/midi/device/alsa/AlsaQueueHolder.java0000644000175000017500000000346110374074735031124 0ustar twernertwerner/* * AlsaQueueHolder.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2001 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.midi.device.alsa; import org.tritonus.lowlevel.alsa.AlsaSeq; /** A representation of a physical MIDI port based on the ALSA sequencer. */ public class AlsaQueueHolder { /** The object interfacing to the ALSA sequencer. */ private AlsaSeq m_aSequencer; /** ALSA queue number. */ private int m_nQueue; /** */ public AlsaQueueHolder(AlsaSeq aSequencer) { m_aSequencer = aSequencer; m_nQueue = m_aSequencer.allocQueue(); if (m_nQueue < 0) { throw new RuntimeException("can't get ALSA sequencer queue"); } } /** Returns the allocated queue @return the queue number. */ public int getQueue() { return m_nQueue; } /** Frees the queue. */ public void close() { m_aSequencer.freeQueue(getQueue()); } public void finalize() { close(); } } /*** AlsaQueueHolder.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/midi/device/alsa/AlsaReceiver.java0000644000175000017500000000402010173301315030416 0ustar twernertwerner/* * AlsaReceiver.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.midi.device.alsa; import javax.sound.midi.Receiver; /** A Receiver that is based on an ALSA client. This interface is used to facilitate subscriptions between Transmitters and Receivers. This subscription is used to transfer events directely inside the ALSA sequencer, instead of passing them by Java. */ public interface AlsaReceiver extends Receiver { /** Establish the subscription. Calling this method establishes a subscription between a AlsaTransmitters' ALSA client and port, which are passed as parameters here, and this Receiver's ALSA client and port. This method is typically called by an AlsaTransmitter that got an AlsaReceiver as its Receiver. @param nClient The ALSA client number of the Transmitter that a read subscription should established to. @param nPort The ALSA port number of the Transmitter that a read subscription should established to. @return true, if the subscription was established, false otherwise. */ public boolean subscribeTo(int nClient, int nPort); } /*** AlsaReceiver.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/midi/device/alsa/AlsaSequencer.java0000644000175000017500000006707010375041025030625 0ustar twernertwerner/* * AlsaSequencer.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999 - 2003 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.midi.device.alsa; import java.util.Arrays; import javax.sound.midi.InvalidMidiDataException; import javax.sound.midi.MetaMessage; import javax.sound.midi.MidiDevice; import javax.sound.midi.MidiEvent; import javax.sound.midi.MidiMessage; import javax.sound.midi.MidiUnavailableException; import javax.sound.midi.Receiver; import javax.sound.midi.Sequence; import javax.sound.midi.Sequencer; import javax.sound.midi.Track; import javax.sound.midi.Transmitter; import org.tritonus.lowlevel.alsa.AlsaSeq; import org.tritonus.lowlevel.alsa.AlsaSeqPortSubscribe; import org.tritonus.lowlevel.alsa.AlsaSeqQueueInfo; import org.tritonus.lowlevel.alsa.AlsaSeqEvent; import org.tritonus.lowlevel.alsa.AlsaSeqQueueStatus; import org.tritonus.lowlevel.alsa.AlsaSeqQueueTempo; import org.tritonus.share.TDebug; import org.tritonus.share.midi.MidiUtils; import org.tritonus.share.midi.TSequencer; public class AlsaSequencer // TODO: derive from TPreloadingSequencer extends TSequencer { /** The syncronization modes the sequencer can sync to. */ private static final SyncMode[] MASTER_SYNC_MODES = {SyncMode.INTERNAL_CLOCK}; /** The syncronization modes the sequencer can send. */ private static final SyncMode[] SLAVE_SYNC_MODES = {SyncMode.NO_SYNC, SyncMode.MIDI_SYNC}; /** The ALSA event tag used for MIDI clock events */ private static final int CLOCK_EVENT_TAG = 255; private AlsaSeq m_playbackAlsaSeq; private AlsaSeq m_recordingAlsaSeq; private int m_nRecordingPort; private int m_nPlaybackPort; private int m_nQueue; private AlsaSeqQueueInfo m_queueInfo; private AlsaSeqQueueStatus m_queueStatus; private AlsaSeqQueueTempo m_queueTempo; private AlsaMidiIn m_playbackAlsaMidiIn; private AlsaMidiOut m_playbackAlsaMidiOut; private AlsaMidiIn m_recordingAlsaMidiIn; protected LoaderThread m_loaderThread; private Thread m_syncThread; private AlsaSeqEvent m_queueControlEvent; protected AlsaSeqEvent m_clockEvent; private boolean m_bRecording; private Track m_track; private AlsaSeqEvent m_allNotesOffEvent; private Sequencer.SyncMode m_oldSlaveSyncMode; private float m_fCachedRealMPQ; public AlsaSequencer(MidiDevice.Info info) { super(info, Arrays.asList(MASTER_SYNC_MODES), Arrays.asList(SLAVE_SYNC_MODES)); // TODO: fetch from base class instead m_fCachedRealMPQ = -1.0F; } protected int getPlaybackClient() { int nClient = getPlaybackAlsaSeq().getClientId(); return nClient; } protected int getPlaybackPort() { return m_nPlaybackPort; } protected int getRecordingClient() { int nClient = getRecordingAlsaSeq().getClientId(); return nClient; } protected int getRecordingPort() { return m_nRecordingPort; } protected int getQueue() { return m_nQueue; } private AlsaSeqQueueStatus getQueueStatus() { return m_queueStatus; } private AlsaSeqQueueTempo getQueueTempo() { return m_queueTempo; } private AlsaSeq getPlaybackAlsaSeq() { return m_playbackAlsaSeq; } protected AlsaSeq getRecordingAlsaSeq() { return m_recordingAlsaSeq; } private void updateQueueStatus() { // TODO: error handling // getRecordingAlsaSeq().getQueueStatus(getQueue(), getQueueStatus()); getPlaybackAlsaSeq().getQueueStatus(getQueue(), getQueueStatus()); } protected void openImpl() { m_recordingAlsaSeq = new AlsaSeq("Tritonus ALSA Sequencer (recording/synchronization)"); m_nRecordingPort = getRecordingAlsaSeq().createPort("recording/synchronization port", AlsaSeq.SND_SEQ_PORT_CAP_WRITE | AlsaSeq.SND_SEQ_PORT_CAP_SUBS_WRITE | AlsaSeq.SND_SEQ_PORT_CAP_READ | AlsaSeq.SND_SEQ_PORT_CAP_SUBS_READ, 0, AlsaSeq.SND_SEQ_PORT_TYPE_APPLICATION, 0, 0, 0); m_playbackAlsaSeq = new AlsaSeq("Tritonus ALSA Sequencer (playback)"); m_nPlaybackPort = getPlaybackAlsaSeq().createPort("playback port", AlsaSeq.SND_SEQ_PORT_CAP_WRITE | AlsaSeq.SND_SEQ_PORT_CAP_SUBS_WRITE | AlsaSeq.SND_SEQ_PORT_CAP_READ | AlsaSeq.SND_SEQ_PORT_CAP_SUBS_READ, 0, AlsaSeq.SND_SEQ_PORT_TYPE_APPLICATION, 0, 0, 0); m_nQueue = getPlaybackAlsaSeq().allocQueue(); m_queueInfo = new AlsaSeqQueueInfo(); m_queueStatus = new AlsaSeqQueueStatus(); m_queueTempo = new AlsaSeqQueueTempo(); getPlaybackAlsaSeq().getQueueInfo(getQueue(), m_queueInfo); m_queueInfo.setLocked(false); getPlaybackAlsaSeq().setQueueInfo(getQueue(), m_queueInfo); m_playbackAlsaMidiOut = new AlsaMidiOut(getPlaybackAlsaSeq(), getPlaybackPort(), getQueue()); m_playbackAlsaMidiOut.setHandleMetaMessages(true); getRecordingAlsaSeq().setQueueUsage(getQueue(), true); // this establishes the subscription, too AlsaMidiIn.AlsaMidiInListener playbackListener = new PlaybackAlsaMidiInListener(); m_playbackAlsaMidiIn = new AlsaMidiIn(getPlaybackAlsaSeq(), getPlaybackPort(), getPlaybackClient(), getPlaybackPort(), playbackListener); // start the receiving thread m_playbackAlsaMidiIn.start(); m_queueControlEvent = new AlsaSeqEvent(); m_clockEvent = new AlsaSeqEvent(); m_clockEvent.setCommon( AlsaSeq.SND_SEQ_EVENT_CLOCK, // type AlsaSeq.SND_SEQ_TIME_STAMP_TICK | AlsaSeq.SND_SEQ_TIME_MODE_ABS, CLOCK_EVENT_TAG, // tag getQueue(), 0L, // timestamp; not yet known 0, // source client getRecordingPort(), // source port AlsaSeq.SND_SEQ_ADDRESS_SUBSCRIBERS, // dest client AlsaSeq.SND_SEQ_ADDRESS_UNKNOWN); // dest port m_allNotesOffEvent = new AlsaSeqEvent(); m_oldSlaveSyncMode = getSlaveSyncMode(); if (m_fCachedRealMPQ != -1.0F) { setTempoImpl(m_fCachedRealMPQ); m_fCachedRealMPQ = -1.0F; } m_loaderThread = new LoaderThread(); m_loaderThread.start(); // this is for sending clock events // m_syncThread = new MasterSynchronizer(); // m_syncThread.start(); } protected void closeImpl() { m_playbackAlsaMidiIn.interrupt(); m_playbackAlsaMidiIn = null; getQueueStatus().free(); m_queueStatus = null; getQueueTempo().free(); m_queueTempo = null; // TODO: // m_aSequencer.releaseQueue(getQueue()); // m_aSequencer.destroyPort(getPort()); getRecordingAlsaSeq().close(); m_recordingAlsaSeq = null; getPlaybackAlsaSeq().close(); m_playbackAlsaSeq = null; m_queueControlEvent.free(); m_queueControlEvent = null; m_clockEvent.free(); m_clockEvent = null; m_allNotesOffEvent.free(); m_allNotesOffEvent = null; } protected void startImpl() { if (getTickPosition() == 0) { startQueue(); } else { continueQueue(); } synchronized (m_loaderThread) { if (TDebug.TraceSequencer) TDebug.out("AlsaSequencer.startImpl(): notifying loader thread"); m_loaderThread.notify(); } // TODO: should depend on sync mode // synchronized (m_syncThread) // { // if (TDebug.TraceSequencer) TDebug.out("AlsaSequencer.startImpl(): notifying synchronizer thread"); // m_syncThread.notify(); // } if (! getSlaveSyncMode(). equals(Sequencer.SyncMode.NO_SYNC)) { sendStartEvent(); } } protected void stopImpl() { stopQueue(); sendAllNotesOff(); // should be in base class? stopRecording(); if (! getSlaveSyncMode(). equals(Sequencer.SyncMode.NO_SYNC)) { sendStopEvent(); } } protected void setSequenceImpl() { if (m_loaderThread != null) { m_loaderThread.setLoading(getSequence() != null); } } /* TODO: can be implemented just with a flag? */ public boolean isRunning() { boolean bRunning = false; if (isOpen()) { updateQueueStatus(); int nStatus = getQueueStatus().getStatus(); if (TDebug.TraceSequencer) { TDebug.out("AlsaSequencer.isRunning(): queue status: " + nStatus); } bRunning = (nStatus != 0); } return bRunning; } public void startRecording() { checkOpen(); // may throw IllegalStateException m_bRecording = true; start(); } public void stopRecording() { checkOpen(); // may throw IllegalStateException m_bRecording = false; } public boolean isRecording() { return m_bRecording; } // name should be: enableRecording public void recordEnable(Track track, int nChannel) { // TODO: hacky m_track = track; } // name should be: disableRecording public void recordDisable(Track track) { // TODO: } protected void setTempoImpl(float fRealMPQ) { if (isOpen()) { if (TDebug.TraceSequencer) { TDebug.out("AlsaSequencer.setTempoImpl(): setting tempo to " + (int) fRealMPQ); } getQueueTempo().setTempo((int) fRealMPQ); getQueueTempo().setPpq(getResolution()); getPlaybackAlsaSeq().setQueueTempo(getQueue(), getQueueTempo()); } else { if (TDebug.TraceSequencer) { TDebug.out("AlsaSequencer.setTempoImpl(): ignoring because sequencer is not open"); } m_fCachedRealMPQ = fRealMPQ; } } public long getTickPosition() { long lPosition; if (isOpen()) { updateQueueStatus(); lPosition = getQueueStatus().getTickTime(); } else { if (TDebug.TraceSequencer) { TDebug.out("AlsaSequencer.getTickPosition(): sequencer not open, returning 0"); } lPosition = 0; } return lPosition; } public void setTickPosition(long lTick) { if (isOpen()) { int nSourcePort = getRecordingPort(); int nQueue = getQueue(); long lTime = lTick; sendQueueControlEvent( AlsaSeq.SND_SEQ_EVENT_SETPOS_TICK, AlsaSeq.SND_SEQ_TIME_STAMP_REAL | AlsaSeq.SND_SEQ_TIME_MODE_REL, 0, AlsaSeq.SND_SEQ_QUEUE_DIRECT, 0L, nSourcePort, AlsaSeq.SND_SEQ_CLIENT_SYSTEM, AlsaSeq.SND_SEQ_PORT_SYSTEM_TIMER, nQueue, 0, lTime); } else { if (TDebug.TraceSequencer) { TDebug.out("AlsaSequencer.setTickPosition(): ignored because sequencer is not open"); } } } public long getMicrosecondPosition() { long lPosition; if (isOpen()) { updateQueueStatus(); long lNanoSeconds = getQueueStatus().getRealTime(); lPosition = lNanoSeconds / 1000; } else { if (TDebug.TraceSequencer) { TDebug.out("AlsaSequencer.getMicrosecondPosition(): sequencer not open, returning 0"); } lPosition = 0; } return lPosition; } public void setMicrosecondPosition(long lMicroseconds) { if (isOpen()) { long lNanoSeconds = lMicroseconds * 1000; int nSourcePort = getRecordingPort(); int nQueue = getQueue(); long lTime = lNanoSeconds; sendQueueControlEvent( AlsaSeq.SND_SEQ_EVENT_SETPOS_TIME, AlsaSeq.SND_SEQ_TIME_STAMP_REAL | AlsaSeq.SND_SEQ_TIME_MODE_REL, 0, AlsaSeq.SND_SEQ_QUEUE_DIRECT, 0L, nSourcePort, AlsaSeq.SND_SEQ_CLIENT_SYSTEM, AlsaSeq.SND_SEQ_PORT_SYSTEM_TIMER, nQueue, 0, lTime); } else { if (TDebug.TraceSequencer) { TDebug.out("AlsaSequencer.setMicrosecondPosition(): ignoring because sequencer is not open"); } } } protected void setMasterSyncModeImpl(SyncMode syncMode) { // TODO: } protected void setSlaveSyncModeImpl(SyncMode syncMode) { if (isRunning()) { if (m_oldSlaveSyncMode.equals(Sequencer.SyncMode.NO_SYNC) && (syncMode.equals(Sequencer.SyncMode.MIDI_SYNC) || syncMode.equals(Sequencer.SyncMode.MIDI_TIME_CODE)) ) { sendStartEvent(); // TODO: notify sync thread } else if ((m_oldSlaveSyncMode.equals(Sequencer.SyncMode.MIDI_SYNC) || m_oldSlaveSyncMode.equals(Sequencer.SyncMode.MIDI_TIME_CODE)) && syncMode.equals(Sequencer.SyncMode.NO_SYNC) ) { sendStopEvent(); // TODO: remove enqueued messages from queue (and buffer). perhaps do this by putting the code to do so after the main loop of the sync thread. } } } protected void setTrackEnabledImpl(int nTrack, boolean bEnabled) { /** If the enabled state changes to true, the events between the current playback position and the current loading position are enqueued. If the enabled state of a track changed to false, the events belonging to this track are removed from the queue, besides the 'off'-events. */ if (bEnabled) { // TODO: reload events } else { // TODO: remove events } } /* This method has to be synchronized because it is called from sendMessageTick() as well as from loadSequenceToNative(). */ protected synchronized void enqueueMessage(MidiMessage message, long lTick) { m_playbackAlsaMidiOut.enqueueMessage(message, lTick); } /** Put a message into the queue. This is Claus-Dieter's special method: it puts the message to the ALSA queue for delivery at the specified time. The time has to be given in ticks according to the resolution of the currently active Sequence. For this method to work, the Sequencer has to be started. The message is delivered the same way as messages from a Sequence, i.e. to all registered Transmitters. If the current queue position (as returned by getTickPosition()) is already behind the desired schedule time, the message is ignored. @param message the MidiMessage to put into the queue. @param lTick the desired schedule time in ticks. */ public void sendMessageTick(MidiMessage message, long lTick) { enqueueMessage(message, lTick); } private void startQueue() { controlQueue(AlsaSeq.SND_SEQ_EVENT_START); } private void continueQueue() { controlQueue(AlsaSeq.SND_SEQ_EVENT_CONTINUE); } private void stopQueue() { controlQueue(AlsaSeq.SND_SEQ_EVENT_STOP); } private void controlQueue(int nType) { int nSourcePort = getPlaybackPort(); int nQueue = getQueue(); sendQueueControlEvent( nType, AlsaSeq.SND_SEQ_TIME_STAMP_REAL | AlsaSeq.SND_SEQ_TIME_MODE_REL, 0, AlsaSeq.SND_SEQ_QUEUE_DIRECT, 0L, nSourcePort, AlsaSeq.SND_SEQ_CLIENT_SYSTEM, AlsaSeq.SND_SEQ_PORT_SYSTEM_TIMER, nQueue, 0, 0); } /** Send a real time START event to the subscribers immediately. */ private void sendStartEvent() { sendRealtimeEvent(AlsaSeq.SND_SEQ_EVENT_START); } /** Send a real time STOP event to the subscribers immediately. */ private void sendStopEvent() { sendRealtimeEvent(AlsaSeq.SND_SEQ_EVENT_STOP); } private void sendRealtimeEvent(int nType) { sendQueueControlEvent( nType, AlsaSeq.SND_SEQ_TIME_STAMP_REAL | AlsaSeq.SND_SEQ_TIME_MODE_REL, 0, // tag AlsaSeq.SND_SEQ_QUEUE_DIRECT, // queue 0L, // time getPlaybackPort(), // source AlsaSeq.SND_SEQ_ADDRESS_SUBSCRIBERS, // dest client AlsaSeq.SND_SEQ_ADDRESS_UNKNOWN, // dest port 0, 0, 0); } // NOTE: also used for setting position and start/stop RT private void sendQueueControlEvent( int nType, int nFlags, int nTag, int nQueue, long lTime, int nSourcePort, int nDestClient, int nDestPort, int nControlQueue, int nControlValue, long lControlTime) { m_queueControlEvent.setCommon(nType, nFlags, nTag, nQueue, lTime, 0, nSourcePort, nDestClient, nDestPort); m_queueControlEvent.setQueueControl(nControlQueue, nControlValue, lControlTime); getPlaybackAlsaSeq().eventOutputDirect(m_queueControlEvent); } private void sendAllNotesOffEvent(int nChannel) { int nSourcePort = getPlaybackPort(); m_allNotesOffEvent.setCommon( AlsaSeq.SND_SEQ_EVENT_CONTROLLER, AlsaSeq.SND_SEQ_TIME_STAMP_REAL | AlsaSeq.SND_SEQ_TIME_MODE_REL, 0, // tag AlsaSeq.SND_SEQ_QUEUE_DIRECT, // queue 0L, // time 0, nSourcePort, // source AlsaSeq.SND_SEQ_ADDRESS_SUBSCRIBERS, // dest client AlsaSeq.SND_SEQ_ADDRESS_UNKNOWN); // dest port m_allNotesOffEvent.setControl(nChannel, 0x78, 0); getPlaybackAlsaSeq().eventOutputDirect(m_allNotesOffEvent); } private void sendAllNotesOff() { // TODO: check if [0..15] or [1..16] for (int nChannel = 0; nChannel < 16; nChannel++) { sendAllNotesOffEvent(nChannel); } } /** Receive a correctely timestamped event. This method expects that the timestamp is in ticks, appropriate for the Sequence currently running. */ protected void receiveTimestamped(MidiMessage message, long lTimestamp) { if (isRecording()) { // TODO: this is hacky; should implement correct track mapping Track track = m_track; MidiEvent event = new MidiEvent(message, lTimestamp); track.add(event); } // TODO: entering an event into the sequence } /** Receive an event from a Receiver. This method is called by AlsaSequencer.AlsaSequencerReceiver on receipt of a MidiMessage. */ protected void receive(MidiMessage message, long lTimestamp) { lTimestamp = getTickPosition(); receiveTimestamped(message, lTimestamp); } /////////////////////////////////////////////////// public Receiver getReceiver() throws MidiUnavailableException { return new AlsaSequencerReceiver(); } public Transmitter getTransmitter() throws MidiUnavailableException { return new AlsaSequencerTransmitter(); } /////////////////// INNER CLASSES ////////////////////////////////////// /*private*/ public class PlaybackAlsaMidiInListener implements AlsaMidiIn.AlsaMidiInListener { public void dequeueEvent(MidiMessage message, long lTimestamp) { if (TDebug.TraceSequencer) { TDebug.out("AlsaSequencer.PlaybackAlsaMidiInListener.dequeueEvent(): message: " + message); } if (message instanceof MetaMessage) { MetaMessage metaMessage = (MetaMessage) message; byte[] abData = metaMessage.getData(); switch (metaMessage.getType()) { case 6: // marker String strMarkerText = new String(abData); if (strMarkerText.equals("loopend")) { setTickPosition(getLoopStartPoint()); m_loaderThread.setStartPosition(getLoopStartPoint()); m_loaderThread.setLoading(true); } break; case 0x51: // set tempo int nTempo = MidiUtils.getUnsignedInteger(abData[0]) * 65536 + MidiUtils.getUnsignedInteger(abData[1]) * 256 + MidiUtils.getUnsignedInteger(abData[2]); setTempoInMPQ(nTempo); break; } } // passes events to the receivers sendImpl(message, -1L); // calls control and meta listeners notifyListeners(message); } } /*private*/ public class RecordingAlsaMidiInListener implements AlsaMidiIn.AlsaMidiInListener { public void dequeueEvent(MidiMessage message, long lTimestamp) { if (TDebug.TraceSequencer) { TDebug.out("AlsaSequencer.RecordingAlsaMidiInListener.dequeueEvent(): message: " + message); } AlsaSequencer.this.receiveTimestamped(message, lTimestamp); } } /*private*/ public class AlsaSequencerReceiver extends TReceiver implements AlsaReceiver { /** Subscribe to the passed port. * This establishes a subscription in the ALSA sequencer * so that the device this Receiver belongs to receives * event from the client:port passed as parameters. * * @return true if subscription was established, * false otherwise */ public boolean subscribeTo(int nClient, int nPort) { try { AlsaSeqPortSubscribe portSubscribe = new AlsaSeqPortSubscribe(); portSubscribe.setSender(nClient, nPort); portSubscribe.setDest(AlsaSequencer.this.getRecordingClient(), AlsaSequencer.this.getRecordingPort()); portSubscribe.setQueue(AlsaSequencer.this.getQueue()); portSubscribe.setExclusive(false); portSubscribe.setTimeUpdate(true); portSubscribe.setTimeReal(false); AlsaSequencer.this.getRecordingAlsaSeq().subscribePort(portSubscribe); portSubscribe.free(); return true; } catch (RuntimeException e) { return false; } } } /*private*/ public class AlsaSequencerTransmitter extends TTransmitter { private boolean m_bReceiverSubscribed; public AlsaSequencerTransmitter() { super(); m_bReceiverSubscribed = false; } public void setReceiver(Receiver receiver) { super.setReceiver(receiver); /* * Try to establish a subscription of the Receiver * to the ALSA seqencer client of the device this * Transmitter belongs to. */ if (receiver instanceof AlsaReceiver) { // TDebug.out("AlsaSequencer.AlsaSequencerTransmitter.setReceiver(): trying to establish subscription"); m_bReceiverSubscribed = ((AlsaReceiver) receiver).subscribeTo(getPlaybackClient(), getPlaybackPort()); // TODO: similar subscription for the sequencer's own midi in listener!! // this is necessary because sync messages are sent via the recording port m_bReceiverSubscribed = ((AlsaReceiver) receiver).subscribeTo(getRecordingClient(), getRecordingPort()); // TDebug.out("AlsaSequencer.AlsaSequencerTransmitter.setReceiver(): subscription established: " + m_bReceiverSubscribed); } } public void send(MidiMessage message, long lTimeStamp) { /* * Send message via Java methods only if no * subscription was established. If there is a * subscription, the message is routed inside of * the ALSA sequencer. */ if (! m_bReceiverSubscribed) { super.send(message, lTimeStamp); } } public void close() { super.close(); // TODO: remove subscription } } /** Pre-loading events to the sequencer queue. */ /*private*/ public class LoaderThread extends Thread { /** Current position of loading in Ticks. This is used to get a useful tick value for the end of track message. */ private long m_lLoadingPosition; /** Position to start loading in Ticks. This is used for Sequencer.seq[Tick|]Position(). */ private long m_lStartPosition; /** Loading activity. This flag shows if the LoaderThread is currently loading events to the native queue. Loading may be temporarily stopped if a position change in the sequencer is executed, especially in case of a position change for looping. This variable is only valid if isRunning() is true. If the sequencer is stopped, it has no significance (since loading is stopped anyway). */ private boolean m_bLoading; private Track[] m_aTracks; private int[] m_anTrackPositions; public LoaderThread() { // TODO: monitor changes in the number of tracks m_lLoadingPosition = 0; initTracks(); /* If no sequence is set, we remain idle. We only start loading if there is something to load. If sequence has been set before open(), we set loading here (LoaderThread is created in openImpl()). If sequence is set after open, we do not set loading here, but in setSequenceImpl(). */ setLoading(getSequence() != null); } private void initTracks() { Sequence sequence = getSequence(); // TODO: reallocate if number of tracks has been changed. if (m_aTracks == null && sequence != null) { m_aTracks = sequence.getTracks(); m_anTrackPositions = new int[m_aTracks.length]; } } public void setLoading(boolean bLoading) { if (TDebug.TraceSequencer) TDebug.out("LoaderThread.setLoading(): new value: " + bLoading); m_bLoading = bLoading; synchronized (this) { this.notify(); } } private boolean isLoading() { return m_bLoading; } public void setStartPosition(long lTicks) { // only to make sure... setLoading(false); m_lStartPosition = lTicks; } public void run() { while (isOpen()) { do { synchronized (this) { try { this.wait(); } catch (InterruptedException e) { } } } while ( ! (isRunning() && isLoading()) ); if (isOpen()) { loadSequenceToNative(); } } } private void loadSequenceToNative() { initTracks(); /* For non-0 start positions, this works in conjunction with the 'continue' clause below. Not very efficient... setStartPostion() shoult adapt m_anTrackPositions[]. */ for (int i = 0; i < m_aTracks.length; i++) { m_anTrackPositions[i] = 0; } while (isRunning() && isLoading()) { boolean bTrackPresent = false; long lBestTick = Long.MAX_VALUE; int nBestTrack = -1; for (int nTrack = 0; nTrack < m_aTracks.length; nTrack++) { if (m_anTrackPositions[nTrack] < m_aTracks[nTrack].size()) { bTrackPresent = true; MidiEvent event = m_aTracks[nTrack].get(m_anTrackPositions[nTrack]); long lTick = event.getTick(); if (lTick < m_lStartPosition) { // consider next event continue; } if (lTick < lBestTick) { lBestTick = lTick; nBestTrack = nTrack; } } } if (!bTrackPresent) { /* No more events; send end-of-track event. */ MetaMessage metaMessage = new MetaMessage(); try { metaMessage.setMessage(0x2F, new byte[0], 0); } catch (InvalidMidiDataException e) { } enqueueMessage(metaMessage, m_lLoadingPosition + 1); // leave the while (isRunning() && isLoading())-loop setLoading(false); } /** The normal case: deliver the event found to be the next. */ MidiEvent event = m_aTracks[nBestTrack].get(m_anTrackPositions[nBestTrack]); m_anTrackPositions[nBestTrack]++; long lTick = event.getTick(); m_lLoadingPosition = Math.max(m_lLoadingPosition, lTick); MidiMessage message = event.getMessage(); processMessage(message, lTick); } } private void processMessage(MidiMessage message, long lTick) { boolean bMessageConsumed = false; if (message instanceof MetaMessage) { MetaMessage metaMessage = (MetaMessage) message; int nType = metaMessage.getType(); if (nType == 0x2F) // E.O.T. { bMessageConsumed = true; if (TDebug.TraceSequencer) { TDebug.out("LoaderThread.loadSequenceToNative(): ignoring End of Track message with tick " + lTick); } } else if (nType == 6) // marker { String strMarkerText = new String(metaMessage.getData()); if (strMarkerText.equals("loopstart")) { setLoopStartPoint(lTick); bMessageConsumed = true; } else if (strMarkerText.equals("loopend")) { setLoopEndPoint(lTick); setLoopCount(-1 /*TODO: Sequencer.LOOP_CONTINUOUSLY */); /* This one needs to be enqueued, because we do a setPosition() once it is delivered. */ bMessageConsumed = false; setLoading(false); } } } if (! bMessageConsumed) { if (TDebug.TraceSequencer) { TDebug.out("LoaderThread.loadSequenceToNative(): enqueueing event with tick " + lTick); } enqueueMessage(message, lTick); } } } // TODO: start/stop; on/off /*private*/ public class MasterSynchronizer extends Thread { public void run() { while (isOpen()) { do { synchronized (this) { try { this.wait(); } catch (InterruptedException e) { } } } while (! isRunning()); double dTickMin = getTickPosition(); double dTickMax = getSequence().getTickLength(); double dTickStep = getSequence().getResolution() / 24.0; if (TDebug.TraceSequencer) { TDebug.out("MasterSynchronizer.run(): tick step: " + dTickStep); } double dTick = dTickMin; // TODO: ... && getS.Mode().equals(...) while (dTick < dTickMax && isRunning()) { long lTick = Math.round(dTick); if (TDebug.TraceSequencer) { TDebug.out("MasterSynchronizer.run(): sending clock event with tick " + lTick); } m_clockEvent.setTimestamp(lTick); getRecordingAlsaSeq().eventOutput(m_clockEvent); getRecordingAlsaSeq().drainOutput(); dTick += dTickStep; } } } } } /*** AlsaSequencer.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/midi/device/alsa/AlsaSequencerProvider.java0000644000175000017500000000522110374074735032343 0ustar twernertwerner/* * AlsaSequencerProvider.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.midi.device.alsa; import javax.sound.midi.MidiDevice; import javax.sound.midi.spi.MidiDeviceProvider; import org.tritonus.share.TDebug; import org.tritonus.share.GlobalInfo; import org.tritonus.share.midi.TMidiDevice; public class AlsaSequencerProvider extends MidiDeviceProvider { private static MidiDevice.Info sm_info; public AlsaSequencerProvider() { if (TDebug.TraceMidiDeviceProvider) { TDebug.out("AlsaSequencerProvider.(): begin"); } synchronized (AlsaSequencerProvider.class) { if (sm_info == null) { sm_info = new TMidiDevice.Info( "Tritonus ALSA Sequencer", GlobalInfo.getVendor(), "this sequencer uses the ALSA sequencer", GlobalInfo.getVersion()); } } if (TDebug.TraceMidiDeviceProvider) { TDebug.out("AlsaSequencerProvider.(): end"); } } public MidiDevice.Info[] getDeviceInfo() { if (TDebug.TraceMidiDeviceProvider) { TDebug.out("AlsaSequencerProvider.getDeviceInfo(): begin"); } MidiDevice.Info[] infos = new MidiDevice.Info[1]; infos[0] = sm_info; if (TDebug.TraceMidiDeviceProvider) { TDebug.out("AlsaSequencerProvider.getDeviceInfo(): end"); } return infos; } public MidiDevice getDevice(MidiDevice.Info info) { if (TDebug.TraceMidiDeviceProvider) { TDebug.out("AlsaSequencerProvider.getDevice(): begin"); } MidiDevice device = null; if (info != null && info.equals(sm_info)) { device = new AlsaSequencer(sm_info); } if (device == null) { throw new IllegalArgumentException("no device for " + info); } if (TDebug.TraceMidiDeviceProvider) { TDebug.out("AlsaSequencerProvider.getDevice(): end"); } return device; } } /*** AlsaSequencerProvider.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/midi/device/alsa/AlsaSequencerReceiver.java0000644000175000017500000000222410374074735032315 0ustar twernertwerner/* * AlsaSequencerReceiver.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.midi.device.alsa; public interface AlsaSequencerReceiver { public boolean subscribeTo(int nClient, int nPort); } /*** AlsaSequencerReceiver.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/midi/device/alsa/AlsaSynthesizer.java0000644000175000017500000000743710374074735031240 0ustar twernertwerner/* * AlsaSynthesizer.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.midi.device.alsa; import java.util.ArrayList; import java.util.List; import javax.sound.midi.MidiChannel; import javax.sound.midi.MidiUnavailableException; import javax.sound.midi.Receiver; import javax.sound.midi.Synthesizer; import javax.sound.midi.Instrument; import javax.sound.midi.Soundbank; import javax.sound.midi.VoiceStatus; import javax.sound.midi.Patch; import org.tritonus.share.GlobalInfo; import org.tritonus.share.TDebug; import org.tritonus.share.midi.TMidiDevice; public class AlsaSynthesizer extends AlsaMidiDevice implements Synthesizer { private static final MidiChannel[] EMPTY_MIDICHANNEL_ARRAY = new MidiChannel[0]; private static final VoiceStatus[] EMPTY_VOICESTATUS_ARRAY = new VoiceStatus[0]; private List m_channels; private int m_nVoices; public AlsaSynthesizer(int nClient, int nPort, int nVoices) { super( new TMidiDevice.Info( "ALSA Synthesizer (" + nClient + ":" + nPort + ")", GlobalInfo.getVendor(), "Synthesizer based on the ALSA sequencer", GlobalInfo.getVersion()), nClient, nPort, false, true); m_nVoices = nVoices; m_channels = new ArrayList(); } protected void openImpl() { super.openImpl(); // TDebug.out("AlsaSynthesizer.openImpl(): called"); // necessary? thread-safe? m_channels.clear(); Receiver receiver = null; try { receiver = this.getReceiver(); } catch (MidiUnavailableException e) { if (TDebug.TraceAllExceptions) { TDebug.out(e); } } for (int i = 0; i < 16; i++) { MidiChannel channel = new AlsaMidiChannel( receiver, i); m_channels.add(channel); } } protected void closeImpl() { super.closeImpl(); } public int getMaxPolyphony() { return m_nVoices; } public long getLatency() { return -1L; } public MidiChannel[] getChannels() { return m_channels.toArray(EMPTY_MIDICHANNEL_ARRAY); } public VoiceStatus[] getVoiceStatus() { return EMPTY_VOICESTATUS_ARRAY; } public boolean isSoundbankSupported(Soundbank soundbank) { return false; } public boolean loadInstrument(Instrument instrument) { return false; } public void unloadInstrument(Instrument instrument) { } public boolean remapInstrument(Instrument from, Instrument to) { return false; } public Soundbank getDefaultSoundbank() { return null; } public Instrument[] getAvailableInstruments() { return null; } public Instrument[] getLoadedInstruments() { return null; } public boolean loadAllInstruments(Soundbank soundbank) { return false; } public void unloadAllInstruments(Soundbank soundbank) { } public boolean loadInstruments(Soundbank soundbank, Patch[] aPatches) { return false; } public void unloadInstruments(Soundbank soundbank, Patch[] aPatches) { } } /*** AlsaSynthesizer.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/midi/device/alsa/package.html0000644000175000017500000000036610173301316027501 0ustar twernertwerner

Sequencer and MIDI device access based on ALSA. The classes provided here .

@see org.tritonus.lowlevel.alsa libtritonus-java-20070428/src/classes/org/tritonus/midi/device/fluidsynth/0000755000175000017500000000000010621572454026477 5ustar twernertwernerlibtritonus-java-20070428/src/classes/org/tritonus/midi/device/fluidsynth/FluidSynthesizer.java0000644000175000017500000002660410376704303032662 0ustar twernertwerner/* * FluidSynthesizer.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2006 by Henri Manson * Copyright (c) 2006 by Matthias Pfisterer * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * - Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * - Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.midi.device.fluidsynth; import javax.sound.midi.*; import org.tritonus.share.TDebug; import org.tritonus.share.midi.TMidiChannel; import org.tritonus.share.midi.TDirectSynthesizer; import org.tritonus.midi.sb.fluidsynth.FluidSoundbank; public class FluidSynthesizer extends TDirectSynthesizer implements Synthesizer { private MidiChannel channels[]; private FluidSoundbank defaultSoundbank; private int defaultbankSfontID; // native pointers 64 bit maximum private long settingsPtr; private long synthPtr; private long audioDriverPtr; static { loadNativeLibrary(); } /** Load the native library for fluidsynth. */ private static void loadNativeLibrary() { if (TDebug.TraceFluidNative) TDebug.out("FluidSynthesizer.loadNativeLibrary(): loading native library tritonusfluid"); try { System.loadLibrary("tritonusfluid"); // only reached if no exception occures setTrace(TDebug.TraceFluidNative); } catch (Error e) { if (TDebug.TraceFluidNative || TDebug.TraceAllExceptions) { TDebug.out(e); } // throw e; } if (TDebug.TraceFluidNative) TDebug.out("FluidSynthesizer.loadNativeLibrary(): loaded"); } /** * Constructor. */ public FluidSynthesizer(MidiDevice.Info info) throws Exception { super(info); } protected void openImpl() throws MidiUnavailableException { if (newSynth() < 0) { throw new MidiUnavailableException("Low-level initialization of the synthesizer failed"); } if (TDebug.TraceSynthesizer) TDebug.out("FluidSynthesizer: " + Long.toHexString(synthPtr)); channels = new MidiChannel[16]; for (int i = 0; i < 16; i++) { channels[i] = new NewFluidMidiChannel(i); } String sfontFile = System.getProperty("tritonus.fluidsynth.defaultsoundbank"); if (sfontFile != null && ! sfontFile.equals("")) { int sfontID = loadSoundFont(sfontFile); setDefaultSoundBank(sfontID); String strBankOffset = System.getProperty("tritonus.fluidsynth.defaultsoundbankoffset"); if (strBankOffset != null && ! strBankOffset.equals("")) { setBankOffset(sfontID, Integer.parseInt(strBankOffset)); } } } protected void closeImpl() { if (TDebug.TraceSynthesizer) TDebug.out("FluidSynthesizer.closeImpl(): " + Long.toHexString(synthPtr)); deleteSynth(); super.closeImpl(); } public void setDefaultSoundBank(int sfontID) { defaultSoundbank = new FluidSoundbank(this, sfontID); defaultbankSfontID = sfontID; } protected void finalize(){ if (TDebug.TraceSynthesizer) TDebug.out("finalize: " + Long.toHexString(synthPtr)); close(); } public native int loadSoundFont(String filename); public native void setBankOffset(int sfontID, int offset); public native void setGain(float gain); /* $$mp: currently not functional because fluid_synth_set_reverb_preset() * is not present in fluidsynth 1.0.6. */ public native void setReverbPreset(int reverbPreset); public native int getMaxPolyphony(); protected native int newSynth(); protected native void deleteSynth(); /** * Turns a note on. * * The implementation calls fluid_synth_noteoff(). * * @param nChannel the channel * @param nNoteNumber the note * @param nVelocity the velocity */ native void noteOn(int nChannel, int nNoteNumber, int nVelocity); /** * Turns a note off. * * The implementation calls fluid_synth_noteon(). * * @param nChannel the channel * @param nNoteNumber the note * @param nVelocity the velocity */ native void noteOff(int nChannel, int nNoteNumber, int nVelocity); /** * Changes a controller on the synthesizer. * * The implementation calls fluid_synth_cc(). * * @param nChannel the channel * @param nController the controller number * @param nValue the controller value */ native void controlChange(int nChannel, int nController, int nValue); /** * Obtains the value of a controller. * * The implementation calls fluid_synth_get_cc(). * * @param nChannel the channel * @param nController the controller number * @return the controller value */ native int getController(int nChannel, int nController); /** * Sets the program for a channel. * * The implementation calls fluid_synth_program_change(). * * @param nChannel the channel * @param nProgram the program number */ native void programChange(int nChannel, int nProgram); /** * Obtains the program set for a channel. * * The implementation calls fluid_synth_get_program(). * * @param nChannel the channel * @return the program number set for this channel */ native int getProgram(int nChannel); /** * Sets the pitch bend for a channel. * * The implementation calls fluid_synth_pitch_bend(). * * @param nChannel the channel * @param nBend the pitch bend value */ native void setPitchBend(int nChannel, int nBend); /** * Obtains the pitch bend for a channel. * * The implementations calls fluid_synth_get_pitch_bend(). * * @param nChannel the channel * @return the pitch bend value. */ native int getPitchBend(int nChannel); /** Sets tracing in the native code. * Note that this method can either be called directly or (recommended) * the system property "tritonus.TraceFluidNative" can be set to true. * * @see org.tritonus.share.TDebug */ public static native void setTrace(boolean bTrace); public boolean isSoundbankSupported(Soundbank soundbank) { return (soundbank instanceof FluidSoundbank); } public boolean loadAllInstruments(Soundbank soundbank) { checkSoundbank(soundbank); return true; } public void unloadAllInstruments(Soundbank soundbank) { checkSoundbank(soundbank); } public void unloadInstruments(Soundbank soundbank, Patch[] patchList) { checkSoundbank(soundbank); } public boolean loadInstruments(Soundbank soundbank, Patch[] patchList) { checkSoundbank(soundbank); return true; } public void unloadInstrument(Instrument instrument) { checkInstrument(instrument); } public boolean loadInstrument(Instrument instrument) { checkInstrument(instrument); return true; } public Instrument[] getAvailableInstruments() { return null; } public MidiChannel[] getChannels() { return channels; } public Soundbank getDefaultSoundbank() { return defaultSoundbank; } public long getLatency() { return 0L; } public Instrument[] getLoadedInstruments() { return null; } public VoiceStatus[] getVoiceStatus() { return new VoiceStatus[0]; } public boolean remapInstrument(Instrument from, Instrument to) { checkInstrument(from); checkInstrument(to); return true; } /** Checks if the soundbank is supported by this synthesizer implementation. * * @param sb the soundbank to check * @throws IllegalArgumentException if the soundbank is not supported */ private void checkSoundbank(Soundbank sb) { if (! isSoundbankSupported(sb)) throw new IllegalArgumentException("soundbank is not supported"); } /** * Checks if the instrument belongs to a soundbank that is supported by this * synthesizer implementation. * * @param instr the instrument to check * @throws IllegalArgumentException if the instrument's soundbank * is not supported */ private void checkInstrument(Instrument instr) { checkSoundbank(instr.getSoundbank()); } private class NewFluidMidiChannel extends TMidiChannel { public NewFluidMidiChannel(int nChannel) { super(nChannel); } public void noteOn(int nNoteNumber, int nVelocity) { FluidSynthesizer.this.noteOn(getChannel(), nNoteNumber, nVelocity); } public void noteOff(int nNoteNumber, int nVelocity) { FluidSynthesizer.this.noteOff(getChannel(), nNoteNumber, nVelocity); } public void noteOff(int nNoteNumber) { noteOff(nNoteNumber, 0); } /** * Fluidsynth does not implement poly pressure (aftertouch). Therefore, * this method does nothing. */ public void setPolyPressure(int nNoteNumber, int nPressure) { } /** * Fluidsynth does not implement poly pressure (aftertouch). Therefore, * this method always return 0. */ public int getPolyPressure(int nNoteNumber) { return 0; } /** * Fluidsynth does not implement channel pressure. Therefore, * this method does nothing. */ public void setChannelPressure(int nPressure) { } /** * Fluidsynth does not implement channel pressure. Therefore, * this method always returns 0. */ public int getChannelPressure() { return 0; } public void controlChange(int nController, int nValue) { FluidSynthesizer.this.controlChange(getChannel(), nController, nValue); } public int getController(int nController) { return FluidSynthesizer.this.getController(getChannel(), nController); } public void programChange(int nProgram) { FluidSynthesizer.this.programChange(getChannel(), nProgram); } public int getProgram() { return FluidSynthesizer.this.getProgram(getChannel()); } public void setPitchBend(int nBend) { FluidSynthesizer.this.setPitchBend(getChannel(), nBend); } public int getPitchBend() { return FluidSynthesizer.this.getPitchBend(getChannel()); } // TODO: emulate by manipulating volume public void setMute(boolean bMute) { } public boolean getMute() { return false; } public void setSolo(boolean bSolo) { } public boolean getSolo() { return false; } } } /* FluidSynthesizer.java */ ././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootlibtritonus-java-20070428/src/classes/org/tritonus/midi/device/fluidsynth/FluidSynthesizerProvider.javalibtritonus-java-20070428/src/classes/org/tritonus/midi/device/fluidsynth/FluidSynthesizerProvider.j0000644000175000017500000000544710374114143033702 0ustar twernertwerner/* * FluidSynthesizerProvider.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999 - 2006 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.midi.device.fluidsynth; import javax.sound.midi.MidiDevice; import javax.sound.midi.spi.MidiDeviceProvider; import org.tritonus.share.TDebug; import org.tritonus.share.GlobalInfo; import org.tritonus.share.midi.TMidiDevice; public class FluidSynthesizerProvider extends MidiDeviceProvider { private static MidiDevice.Info sm_info; public FluidSynthesizerProvider() { if (TDebug.TraceMidiDeviceProvider) TDebug.out("FluidSynthesizerProvider.(): begin"); synchronized (FluidSynthesizerProvider.class) { if (sm_info == null) { sm_info = new TMidiDevice.Info( "Tritonus fluidsynth Synthesizer", GlobalInfo.getVendor(), "a synthesizer based on fluidsynth", GlobalInfo.getVersion()); } } if (TDebug.TraceMidiDeviceProvider) TDebug.out("FluidSynthesizerProvider.(): end"); } public MidiDevice.Info[] getDeviceInfo() { if (TDebug.TraceMidiDeviceProvider) TDebug.out("FluidSynthesizerProvider.getDeviceInfo(): begin"); MidiDevice.Info[] infos = new MidiDevice.Info[1]; infos[0] = sm_info; if (TDebug.TraceMidiDeviceProvider) TDebug.out("FluidSynthesizerProvider.getDeviceInfo(): end"); return infos; } public MidiDevice getDevice(MidiDevice.Info info) { if (TDebug.TraceMidiDeviceProvider) TDebug.out("FluidSynthesizerProvider.getDevice(): begin"); MidiDevice device = null; if (info != null && info.equals(sm_info)) { try { device = new FluidSynthesizer(sm_info); } catch (Exception e) { throw new IllegalArgumentException("unable to create device for " + info, e); } } else { throw new IllegalArgumentException("no device for " + info); } if (TDebug.TraceMidiDeviceProvider) TDebug.out("FluidSynthesizerProvider.getDevice(): end"); return device; } } /*** FluidSynthesizerProvider.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/midi/device/fluidsynth/package.html0000644000175000017500000000031210372120350030737 0ustar twernertwerner

Synthesizer based on fluidsynth

libtritonus-java-20070428/src/classes/org/tritonus/midi/device/java/0000755000175000017500000000000010621572455025230 5ustar twernertwernerlibtritonus-java-20070428/src/classes/org/tritonus/midi/device/java/JavaSequencer.java0000644000175000017500000003474710374160733030643 0ustar twernertwerner/* * JavaSequencer.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2000 - 2003 by Matthias Pfisterer * Copyright (c) 2003 by Gabriele Mondada * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.midi.device.java; import java.util.Arrays; import javax.sound.midi.MidiDevice; import javax.sound.midi.MidiEvent; import javax.sound.midi.MidiMessage; import javax.sound.midi.MetaMessage; import javax.sound.midi.Sequence; import javax.sound.midi.Track; import javax.sound.midi.InvalidMidiDataException; import org.tritonus.share.TDebug; import org.tritonus.share.midi.MidiUtils; import org.tritonus.share.midi.TSequencer; /** Sequencer implementation in pure Java. */ public class JavaSequencer extends TSequencer implements Runnable { private static final SyncMode[] MASTER_SYNC_MODES = {SyncMode.INTERNAL_CLOCK}; private static final SyncMode[] SLAVE_SYNC_MODES = {SyncMode.NO_SYNC}; // internal states /** not running */ private static final int STATE_STOPPED = 0; /** starting, awake thread */ private static final int STATE_STARTING = 1; /** running */ private static final int STATE_STARTED = 2; /** stopping */ private static final int STATE_STOPPING = 3; /** closing, terminate thread */ private static final int STATE_CLOSING = 4; private Thread m_thread; private long m_lMicroSecondsPerTick; private int[] m_anTrackPositions; private long m_lTickPosition; private long m_lStartTime; /** Internal state of the sequencer. As values, the symbolic constants STATE_* are used. */ private int m_nPhase; private boolean m_bTempoChanged; /** The clock to use as time base for this sequencer. This is commonly intialized in the constructor, but can also be set with {@link #setClock}. */ private Clock m_clock; /** How long to sleep in the main loop. The value is initialized in the constructor by reading a system property. */ private long m_lSleepInterval; public JavaSequencer(MidiDevice.Info info) { super(info, Arrays.asList(MASTER_SYNC_MODES), Arrays.asList(SLAVE_SYNC_MODES)); if (TDebug.TraceSequencer) { TDebug.out("JavaSequencer.(): begin"); } String strVersion = System.getProperty("java.version"); if (strVersion.indexOf("1.4.2") != -1) { setClock(new SunMiscPerfClock()); } else { setClock(new SystemCurrentTimeMillisClock()); } String strOS = System.getProperty("os.name"); if (strOS.equals("Linux")) { m_lSleepInterval = 0; } else { m_lSleepInterval = 1; } if (TDebug.TraceSequencer) { TDebug.out("JavaSequencer.(): end"); } } protected void openImpl() { if (TDebug.TraceSequencer) { TDebug.out("JavaSequencer.openImpl(): begin"); } m_nPhase = STATE_STOPPED; m_thread = new Thread(this); m_thread.setPriority(Thread.MAX_PRIORITY); if (TDebug.TraceSequencer) { TDebug.out("JavaSequencer.openImpl(): starting thread"); } m_thread.start(); if (TDebug.TraceSequencer) { TDebug.out("JavaSequencer.openImpl(): end"); } } protected void closeImpl() { if (TDebug.TraceSequencer) { TDebug.out("JavaSequencer.closeImpl(): begin"); } stop(); // terminate the thread synchronized (this) { m_nPhase = STATE_CLOSING; // ask end of thread this.notifyAll(); } // now the thread should terminate m_thread = null; if (TDebug.TraceSequencer) { TDebug.out("JavaSequencer.closeImpl(): end"); } } protected void startImpl() { if (TDebug.TraceSequencer) { TDebug.out("JavaSequencer.startImpl(): begin"); } synchronized (this) { if (m_nPhase == STATE_STOPPED) { // unlock thread waiting for start m_nPhase = STATE_STARTING; // ask for start this.notifyAll(); // wait until m_lStartTime is set while (m_nPhase == STATE_STARTING) { try { this.wait(); } catch (InterruptedException e) { if (TDebug.TraceAllExceptions) { TDebug.out(e); } } } } } if (TDebug.TraceSequencer) { TDebug.out("JavaSequencer.startImpl(): end"); } } protected void stopImpl() { if (TDebug.TraceSequencer) { TDebug.out("JavaSequencer.stopImpl(): begin"); } synchronized (this) { // condition true if called from own run() method if (Thread.currentThread() == m_thread) { if (m_nPhase != STATE_STOPPED) { m_nPhase = STATE_STOPPED; notifyAll(); } } else { if (m_nPhase == STATE_STARTED) { m_nPhase = STATE_STOPPING; // ask for stop while (m_nPhase == STATE_STOPPING) { try { this.wait(); } catch (InterruptedException e) { if (TDebug.TraceAllExceptions) { TDebug.out(e); } } } } } } if (TDebug.TraceSequencer) { TDebug.out("JavaSequencer.stopImpl(): end"); } } public void run() { if (TDebug.TraceSequencer) { TDebug.out("JavaSequencer.run(): begin"); } while (true) { synchronized (this) { while (m_nPhase == STATE_STOPPED) { if (TDebug.TraceSequencer) { TDebug.out("JavaSequencer.run(): waiting to become running"); } try { this.wait(); } catch (InterruptedException e) { if (TDebug.TraceAllExceptions) { TDebug.out(e); } } } if (m_nPhase == STATE_CLOSING) { if (TDebug.TraceSequencer) { TDebug.out("JavaSequencer.run(): end"); } return; } if (TDebug.TraceSequencer) { TDebug.out("JavaSequencer.run(): now running"); } //NOTE: all time calculations are done in microseconds m_lStartTime = getTimeInMicroseconds() - m_lTickPosition * m_lMicroSecondsPerTick; m_nPhase = STATE_STARTED; this.notifyAll(); } Sequence sequence = getSequence(); if (sequence == null) { stop(); continue; } Track[] aTracks = sequence.getTracks(); // this is used to get a useful time value for the end of track message //long lHighestTime = 0; while (m_nPhase == STATE_STARTED) { // searching for the next event boolean bTrackPresent = false; long lBestTick = Long.MAX_VALUE; int nBestTrack = -1; for (int nTrack = 0; nTrack < aTracks.length; nTrack++) { // TDebug.out("track " + nTrack); // Track track = aTracks[nTrack]; if (m_anTrackPositions[nTrack] < aTracks[nTrack].size() && isTrackEnabled(nTrack)) { bTrackPresent = true; MidiEvent event = aTracks[nTrack].get(m_anTrackPositions[nTrack]); long lTick = event.getTick(); if (lTick < lBestTick) { lBestTick = lTick; nBestTrack = nTrack; } } } if (!bTrackPresent) { MetaMessage metaMessage = new MetaMessage(); try { metaMessage.setMessage(0x2F, new byte[0], 0); } catch (InvalidMidiDataException e) { if (TDebug.TraceAllExceptions) { TDebug.out(e); } } if (TDebug.TraceSequencer) { TDebug.out("JavaSequencer.run(): sending End of Track message with tick " + (m_lTickPosition + 1)); } // TODO: calulate us deliverEvent(metaMessage, m_lTickPosition + 1); stop(); break; } MidiEvent event = aTracks[nBestTrack].get(m_anTrackPositions[nBestTrack]); MidiMessage message = event.getMessage(); long lTick = event.getTick(); if (message instanceof MetaMessage && ((MetaMessage) message).getType() == 0x2F) { if (TDebug.TraceSequencer) { TDebug.out("JavaSequencer.run(): ignoring End of Track message with tick " + lTick); } m_anTrackPositions[nBestTrack]++; synchronized (this) { m_lTickPosition = lTick; } } else { if (deliverEvent(message, lTick)) { m_anTrackPositions[nBestTrack]++; synchronized(this) { m_lTickPosition = lTick; } } else { // be sure that the current position is before the next event synchronized(this) { m_lTickPosition = Math.min(lTick, (getTimeInMicroseconds() - m_lStartTime) / m_lMicroSecondsPerTick); } } } } // while (m_nPhase == STATE_STARTED) stop(); } // while (true) } /** Deliver a message at a certain time. @param lScheduledTick when to deliver the message in ticks @return true if the event was sent, false otherwise */ private boolean deliverEvent(MidiMessage message, long lScheduledTick) { if (TDebug.TraceSequencer) { TDebug.out("JavaSequencer.deliverEvent(): begin"); } long lScheduledTime; synchronized(this) { lScheduledTime = lScheduledTick * m_lMicroSecondsPerTick + m_lStartTime; } // wait for scheduled time while (getTimeInMicroseconds() < lScheduledTime) { if (m_nPhase != STATE_STARTED) return false; if (m_bTempoChanged) { synchronized(this) { lScheduledTime = lScheduledTick * m_lMicroSecondsPerTick + m_lStartTime; m_bTempoChanged = false; } } try { Thread.sleep(m_lSleepInterval); } catch (InterruptedException e) { if (TDebug.TraceAllExceptions) { TDebug.out(e); } } } // send midi message if (message instanceof MetaMessage) { MetaMessage metaMessage = (MetaMessage) message; if (metaMessage.getType() == 0x51) // set tempo { byte[] abData = metaMessage.getData(); int nTempo = MidiUtils.getUnsignedInteger(abData[0]) * 65536 + MidiUtils.getUnsignedInteger(abData[1]) * 256 + MidiUtils.getUnsignedInteger(abData[2]); // TDebug.out("tempo (us/quarter note): " + nTempo); setTempoInMPQ(nTempo); // TODO: setTempoInMPQ() seems to be not thread-safe } } if (TDebug.TraceSequencer) { TDebug.out("JavaSequencer.deliverEvent(): sending message: " + message + " at: " + lScheduledTime); } // sendImpl(message, event.getTick()); sendImpl(message, -1); // TODO: sendImpl() seems to be not thread-safe notifyListeners(message); // TODO: notifyListeners() seems to be not thread-safe if (TDebug.TraceSequencer) { TDebug.out("JavaSequencer.deliverEvent(): end"); } return true; // success } protected void setMasterSyncModeImpl(SyncMode syncMode) { // DO NOTHING } protected void setSlaveSyncModeImpl(SyncMode syncMode) { // DO NOTHING } public void setSequence(Sequence sequence) throws InvalidMidiDataException { boolean bWasRunning = isRunning(); if (bWasRunning) { stop(); } super.setSequence(sequence); m_lTickPosition = 0; m_anTrackPositions = new int[sequence.getTracks().length]; for (int i = 0; i < m_anTrackPositions.length; i++) { m_anTrackPositions[i] = 0; } if (bWasRunning) { start(); } } public void setMicrosecondPosition(long lPosition) { setTickPosition(lPosition / m_lMicroSecondsPerTick); } public void setTickPosition(long lPosition) { if (getSequence() == null || m_anTrackPositions == null) { return; } boolean bWasRunning = isRunning(); if (bWasRunning) stop(); if (lPosition > getSequence().getTickLength()) { m_lTickPosition = getSequence().getTickLength(); } else { m_lTickPosition = lPosition; } for (int i = 0; i < m_anTrackPositions.length; i++) { m_anTrackPositions[i] = getTrackPosition(getSequence().getTracks()[i], lPosition); } if (bWasRunning) start(); } public synchronized long getTickPosition() { if (m_nPhase == STATE_STARTED) { return Math.max(m_lTickPosition, (getTimeInMicroseconds() - m_lStartTime) / m_lMicroSecondsPerTick); } else { return m_lTickPosition; } } public void recordDisable(Track track) { } public void recordEnable(Track track) { } public void recordEnable(Track track, int nChannel) { } public boolean isRecording() { return false; } public void stopRecording() { checkOpen(); } public void startRecording() { checkOpen(); } protected synchronized void setTempoImpl(float fMPQ) { if (TDebug.TraceSequencer) { TDebug.out("JavaSequencer.setTempoImpl(): begin"); } int nResolution = getResolution(); long currentTime = getTimeInMicroseconds(); long currentTickPosition = 0; if (m_lMicroSecondsPerTick!= 0) currentTickPosition = (currentTime - m_lStartTime) / m_lMicroSecondsPerTick; m_lMicroSecondsPerTick = (long) fMPQ / nResolution; m_lStartTime = currentTime - currentTickPosition * m_lMicroSecondsPerTick; m_bTempoChanged = true; // TODO: update m_lMicroSecondsPerTick and m_lStartTime only after the next event because the the event now waiting for its schedule is not updated if (TDebug.TraceSequencer) { TDebug.out("JavaSequencer.setTempoImpl(): end"); } } /** Obtain the index of the event with the closest tick value. */ private int getTrackPosition(Track track, long tickPosition) { // check params if (track.size() == 0 || tickPosition <= track.get(0).getTick()) return 0; if (tickPosition > track.get(track.size()-1).getTick()) return track.size(); // index out of track // quick search int idx1 = 0; int idx2 = track.size() - 1; for (;;) { if ((idx2 - idx1) == 1) return idx1; int idx3 = (int)(((long)idx1 + (long)idx2) / 2L); if (tickPosition > track.get(idx3).getTick()) idx1 = idx3; else idx2 = idx3; } } /** Retrieve system time in microseconds. This method uses the clock as set with {@link #setClock}. @return the system time in microseconds */ protected long getTimeInMicroseconds() { // temporary hack if (getClock() == null) { return 0; } // end hack return getClock().getMicroseconds(); } /** Set the clock this sequencer should use. @param clock the Clock to be used @throws IllegalStateException if the sequencer is not closed */ public void setClock(Clock clock) { if (isOpen()) { throw new IllegalStateException("closed state required to set the clock"); } m_clock = clock; } /** Obtain the clock used by this sequencer. @return the clock currently set for this sequencer */ public Clock getClock() { return m_clock; } /** Interface for sequencer clocks. */ public static interface Clock { public long getMicroseconds(); } } /*** JavaSequencer.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/midi/device/java/JavaSequencerProvider.java0000644000175000017500000000521010374074735032343 0ustar twernertwerner/* * JavaSequencerProvider.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.midi.device.java; import javax.sound.midi.MidiDevice; import javax.sound.midi.spi.MidiDeviceProvider; import org.tritonus.share.TDebug; import org.tritonus.share.GlobalInfo; import org.tritonus.share.midi.TMidiDevice; public class JavaSequencerProvider extends MidiDeviceProvider { private static MidiDevice.Info sm_info; public JavaSequencerProvider() { if (TDebug.TraceMidiDeviceProvider) { TDebug.out("JavaSequencerProvider.(): begin"); } synchronized (JavaSequencerProvider.class) { if (sm_info == null) { sm_info = new TMidiDevice.Info( "Tritonus Java Sequencer", GlobalInfo.getVendor(), "this is a pure-java sequencer", GlobalInfo.getVersion()); } } if (TDebug.TraceMidiDeviceProvider) { TDebug.out("JavaSequencerProvider.(): end"); } } public MidiDevice.Info[] getDeviceInfo() { if (TDebug.TraceMidiDeviceProvider) { TDebug.out("JavaSequencerProvider.getDeviceInfo(): begin"); } MidiDevice.Info[] infos = new MidiDevice.Info[1]; infos[0] = sm_info; if (TDebug.TraceMidiDeviceProvider) { TDebug.out("JavaSequencerProvider.getDeviceInfo(): end"); } return infos; } public MidiDevice getDevice(MidiDevice.Info info) { if (TDebug.TraceMidiDeviceProvider) { TDebug.out("JavaSequencerProvider.getDevice(): begin"); } MidiDevice device = null; if (info != null && info.equals(sm_info)) { device = new JavaSequencer(sm_info); } if (device == null) { throw new IllegalArgumentException("no device for " + info); } if (TDebug.TraceMidiDeviceProvider) { TDebug.out("JavaSequencerProvider.getDevice(): end"); } return device; } } /*** JavaSequencerProvider.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/midi/device/java/SunMiscPerfClock.java0000644000175000017500000000326210172456544031251 0ustar twernertwerner/* * SunMiscPerfClock.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2003 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.midi.device.java; import sun.misc.Perf; /** Sequencer clock based on sun.misc.Perf. Sun JDK 1.4.2 or later is required to compile this class. */ public class SunMiscPerfClock implements JavaSequencer.Clock { private Perf m_perf; private long m_lTicksPerSecond; public SunMiscPerfClock() { m_perf = Perf.getPerf(); // may throw SecurityException m_lTicksPerSecond = m_perf.highResFrequency(); } /** Retrieve system time in microseconds. This method retrieves the time by calling {@link sun.misc.Perf}. @return the system time in microseconds */ public long getMicroseconds() { return (m_perf.highResCounter() * 1000000) / m_lTicksPerSecond; } } /*** SunMiscPerfClock.java ***/ ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootlibtritonus-java-20070428/src/classes/org/tritonus/midi/device/java/SystemCurrentTimeMillisClock.javalibtritonus-java-20070428/src/classes/org/tritonus/midi/device/java/SystemCurrentTimeMillisClock.jav0000644000175000017500000000271210172456544033531 0ustar twernertwerner/* * SystemCurrentTimeMillisClock.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2003 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.midi.device.java; /** Sequencer clock based on System.currentTimeMillis(). */ public class SystemCurrentTimeMillisClock implements JavaSequencer.Clock { /** Retrieve system time in microseconds. This method retrieves the time by calling {@link java.lang.System#currentTimeMillis}. @return the system time in microseconds */ public long getMicroseconds() { return System.currentTimeMillis() * 1000; } } /*** SystemCurrentTimeMillisClock.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/midi/device/java/package.html0000644000175000017500000000030710172456544027512 0ustar twernertwerner

Sequencer implemented in pure java. The classes provided here .

libtritonus-java-20070428/src/classes/org/tritonus/midi/file/0000755000175000017500000000000010621572457023771 5ustar twernertwernerlibtritonus-java-20070428/src/classes/org/tritonus/midi/file/MidiConstants.java0000644000175000017500000000252210172456545027414 0ustar twernertwerner/* * MidiConstants.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2002 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.midi.file; /** Constants for Standard Midi Files reading and writing. */ public interface MidiConstants { /** Header magic constant. Has the value "MThd". */ public static final int HEADER_MAGIC = 0x4d546864; /** Track magic constant. Has the value "MTrk". */ public static final int TRACK_MAGIC = 0x4d54726b; } /*** MidiConstants.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/midi/file/StandardMidiFileReader.java0000644000175000017500000002752310374074735031134 0ustar twernertwerner/* * StandardMidiFileReader.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999, 2000 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.midi.file; import java.io.FileInputStream; import java.io.InputStream; import java.io.DataInputStream; import java.io.IOException; import java.io.File; import java.net.URL; import javax.sound.midi.InvalidMidiDataException; import javax.sound.midi.MetaMessage; import javax.sound.midi.MidiFileFormat; import javax.sound.midi.MidiEvent; import javax.sound.midi.MidiMessage; import javax.sound.midi.Sequence; import javax.sound.midi.ShortMessage; import javax.sound.midi.SysexMessage; import javax.sound.midi.Track; import javax.sound.midi.spi.MidiFileReader; import org.tritonus.share.TDebug; import org.tritonus.share.midi.TMidiFileFormat; /** TODO: */ public class StandardMidiFileReader extends MidiFileReader { /** TODO: */ public static boolean CANCEL_RUNNING_STATUS_ON_META_AND_SYSEX = true; private static final int STATUS_NONE = 0; private static final int STATUS_ONE_BYTE = 1; private static final int STATUS_TWO_BYTES = 2; private static final int STATUS_SYSEX = 3; private static final int STATUS_META = 4; /** TODO: */ public MidiFileFormat getMidiFileFormat(InputStream inputStream) throws InvalidMidiDataException, IOException { DataInputStream dataInputStream = new DataInputStream(inputStream); int nHeaderMagic = dataInputStream.readInt(); if (nHeaderMagic != MidiConstants.HEADER_MAGIC) { throw new InvalidMidiDataException("not a MIDI file: wrong header magic"); } int nHeaderLength = dataInputStream.readInt(); if (nHeaderLength < 6) { throw new InvalidMidiDataException("corrupt MIDI file: wrong header length"); } int nType = dataInputStream.readShort(); if (nType < 0 || nType > 2) { throw new InvalidMidiDataException("corrupt MIDI file: illegal type"); } if (nType == 2) { throw new InvalidMidiDataException("this implementation doesn't support type 2 MIDI files"); } int nNumTracks = dataInputStream.readShort(); if (nNumTracks <= 0) { throw new InvalidMidiDataException("corrupt MIDI file: number of tracks must be positive"); } if (nType == 0 && nNumTracks != 1) { throw new InvalidMidiDataException("corrupt MIDI file: type 0 files must contain exactely one track"); } int nDivision = dataInputStream.readUnsignedShort(); float fDivisionType = -1.0F; int nResolution = -1; if ((nDivision & 0x8000) != 0) //frame division { // TODO: int nFrameType = -((nDivision >>> 8) & 0xFF); switch (nFrameType) { case 24: fDivisionType = Sequence.SMPTE_24; break; case 25: fDivisionType = Sequence.SMPTE_25; break; case 29: fDivisionType = Sequence.SMPTE_30DROP; break; case 30: fDivisionType = Sequence.SMPTE_30; break; default: throw new InvalidMidiDataException("corrupt MIDI file: illegal frame division type"); } nResolution = nDivision & 0xff; } else // BPM division { fDivisionType = Sequence.PPQ; nResolution = nDivision & 0x7fff; } // skip additional bytes in the header dataInputStream.skip(nHeaderLength - 6); MidiFileFormat midiFileFormat = new TMidiFileFormat( nType, fDivisionType, nResolution, MidiFileFormat.UNKNOWN_LENGTH, MidiFileFormat.UNKNOWN_LENGTH, nNumTracks); return midiFileFormat; } /** TODO: */ public MidiFileFormat getMidiFileFormat(URL url) throws InvalidMidiDataException, IOException { InputStream inputStream = url.openStream(); try { return getMidiFileFormat(inputStream); } finally { inputStream.close(); } } /** TODO: */ public MidiFileFormat getMidiFileFormat(File file) throws InvalidMidiDataException, IOException { InputStream inputStream = new FileInputStream(file); //inputStream = new BufferedInputStream(inputStream, 1024); try { return getMidiFileFormat(inputStream); } finally { inputStream.close(); } } /** TODO: */ public Sequence getSequence(URL url) throws InvalidMidiDataException, IOException { InputStream inputStream = url.openStream(); try { return getSequence(inputStream); } catch (InvalidMidiDataException e) { if (TDebug.TraceAllExceptions) { TDebug.out(e); } inputStream.close(); throw e; } catch (IOException e) { if (TDebug.TraceAllExceptions) { TDebug.out(e); } inputStream.close(); throw e; } } /** TODO: */ public Sequence getSequence(File file) throws InvalidMidiDataException, IOException { InputStream inputStream = new FileInputStream(file); // inputStream = new BufferedInputStream(inputStream, 1024); try { return getSequence(inputStream); } catch (InvalidMidiDataException e) { if (TDebug.TraceAllExceptions) { TDebug.out(e); } inputStream.close(); throw e; } catch (IOException e) { if (TDebug.TraceAllExceptions) { TDebug.out(e); } inputStream.close(); throw e; } } /** TODO: */ public Sequence getSequence(InputStream inputStream) throws InvalidMidiDataException, IOException { MidiFileFormat midiFileFormat = getMidiFileFormat(inputStream); Sequence sequence = new Sequence( midiFileFormat.getDivisionType(), midiFileFormat.getResolution()); DataInputStream dataInputStream = new DataInputStream(inputStream); int nNumTracks = ((TMidiFileFormat) midiFileFormat).getTrackCount(); for (int nTrack = 0; nTrack < nNumTracks; nTrack++) { Track track = sequence.createTrack(); readTrack(dataInputStream, track); } return sequence; } /** TODO: */ private void readTrack(DataInputStream dataInputStream, Track track) throws InvalidMidiDataException, IOException { // search for a "MTrk" chunk while (true) { int nMagic = dataInputStream.readInt(); if (nMagic == MidiConstants.TRACK_MAGIC) { break; } int nChunkLength = dataInputStream.readInt(); if (nChunkLength % 2 != 0) { nChunkLength++; } dataInputStream.skip(nChunkLength); } int nTrackChunkLength = dataInputStream.readInt(); long lTicks = 0; long[] alRemainingBytes = new long[1]; alRemainingBytes[0] = nTrackChunkLength; int[] anRunningStatusByte = new int[1]; // indicates no running status in effect anRunningStatusByte[0] = -1; while (alRemainingBytes[0] > 0) { long lDeltaTicks = readVariableLengthQuantity(dataInputStream, alRemainingBytes); // TDebug.out("delta ticks: " + lDeltaTicks); lTicks += lDeltaTicks; MidiEvent event = readEvent(dataInputStream, alRemainingBytes, anRunningStatusByte, lTicks); track.add(event); } } /** TODO: */ private static MidiEvent readEvent(DataInputStream dataInputStream, long[] alRemainingBytes, int[] anRunningStatusByte, long lTicks) throws InvalidMidiDataException, IOException { int nStatusByte = readUnsignedByte(dataInputStream, alRemainingBytes); // TDebug.out("status byte: " + nStatusByte); MidiMessage message = null; boolean bRunningStatusApplies = false; int nSavedByte = 0; if (nStatusByte < 0x80) { if (anRunningStatusByte[0] != -1) { bRunningStatusApplies = true; nSavedByte = nStatusByte; nStatusByte = anRunningStatusByte[0]; } else { throw new InvalidMidiDataException("corrupt MIDI file: status byte missing"); } } switch (getType(nStatusByte)) { case STATUS_ONE_BYTE: int nByte = 0; if (bRunningStatusApplies) { nByte = nSavedByte; } else { nByte = readUnsignedByte(dataInputStream, alRemainingBytes); anRunningStatusByte[0] = nStatusByte; } ShortMessage shortMessage1 = new ShortMessage(); shortMessage1.setMessage(nStatusByte, nByte, 0); message = shortMessage1; break; case STATUS_TWO_BYTES: int nByte1 = 0; if (bRunningStatusApplies) { nByte1 = nSavedByte; } else { nByte1 = readUnsignedByte(dataInputStream, alRemainingBytes); anRunningStatusByte[0] = nStatusByte; } int nByte2 = readUnsignedByte(dataInputStream, alRemainingBytes); ShortMessage shortMessage2 = new ShortMessage(); shortMessage2.setMessage(nStatusByte, nByte1, nByte2); message = shortMessage2; break; case STATUS_SYSEX: if (CANCEL_RUNNING_STATUS_ON_META_AND_SYSEX) { anRunningStatusByte[0] = -1; } int nSysexDataLength = (int) readVariableLengthQuantity(dataInputStream, alRemainingBytes); byte[] abSysexData = new byte[nSysexDataLength]; for (int i = 0; i < nSysexDataLength; i++) { int nDataByte = readUnsignedByte(dataInputStream, alRemainingBytes); abSysexData[i] = (byte) nDataByte; } SysexMessage sysexMessage = new SysexMessage(); sysexMessage.setMessage(nStatusByte, abSysexData, nSysexDataLength); message = sysexMessage; break; case STATUS_META: if (CANCEL_RUNNING_STATUS_ON_META_AND_SYSEX) { anRunningStatusByte[0] = -1; } int nTypeByte = readUnsignedByte(dataInputStream, alRemainingBytes); int nMetaDataLength = (int) readVariableLengthQuantity(dataInputStream, alRemainingBytes); byte[] abMetaData = new byte[nMetaDataLength]; for (int i = 0; i < nMetaDataLength; i++) { int nDataByte = readUnsignedByte(dataInputStream, alRemainingBytes); abMetaData[i] = (byte) nDataByte; } MetaMessage metaMessage = new MetaMessage(); metaMessage.setMessage(nTypeByte, abMetaData, nMetaDataLength); message = metaMessage; break; default: } MidiEvent event = new MidiEvent(message, lTicks); return event; } // TODO: use table /** TODO: */ private static int getType(int nStatusByte) { if (nStatusByte < 0xf0) // channel voice or mode command { int nCommand = nStatusByte & 0xf0; switch (nCommand) { case 0x80: // note off case 0x90: // note on case 0xa0: // polyphonic key pressure case 0xb0: // control change case 0xe0: // pitch wheel change return STATUS_TWO_BYTES; case 0xc0: // program change case 0xd0: // channel pressure return STATUS_ONE_BYTE; default: return STATUS_NONE; } } else if (nStatusByte == 0xf0 || nStatusByte == 0xf7) { return STATUS_SYSEX; } else if (nStatusByte == 0xff) { return STATUS_META; } else { return STATUS_NONE; } } /** TODO: */ public static long readVariableLengthQuantity(DataInputStream dataInputStream, long[] alRemainingBytes) throws InvalidMidiDataException, IOException { long lValue = 0; int nByteCount = 0; while (nByteCount < 4) { int nByte = readUnsignedByte(dataInputStream, alRemainingBytes); nByteCount++; lValue <<= 7; lValue |= (nByte & 0x7f); if (nByte < 128) // MSB is 0: last byte { return lValue; } } throw new InvalidMidiDataException("not a MIDI file: unterminated variable-length quantity"); } /** TODO: */ public static int readUnsignedByte(DataInputStream dataInputStream, long[] alRemainingBytes) throws IOException { int nByte = dataInputStream.readUnsignedByte(); // already done in DataInputStream.readUnsignedByte(); // if (nByte < 0) // { // throw new EOFException(); // } alRemainingBytes[0]--; return nByte; } } /*** StandardMidiFileReader.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/midi/file/StandardMidiFileWriter.java0000644000175000017500000002451610172456545031204 0ustar twernertwerner/* * StandardMidiFileReader.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999, 2000 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.midi.file; import java.io.DataOutputStream; import java.io.FileOutputStream; import java.io.OutputStream; import java.io.IOException; import java.io.File; import javax.sound.midi.MidiEvent; import javax.sound.midi.MidiMessage; import javax.sound.midi.ShortMessage; import javax.sound.midi.SysexMessage; import javax.sound.midi.MetaMessage; import javax.sound.midi.Sequence; import javax.sound.midi.Track; import javax.sound.midi.spi.MidiFileWriter; import org.tritonus.share.TDebug; /** Writer for Standard Midi Files. This writer can write type 0 and type 1 files. It cannot write type 2 files. */ public class StandardMidiFileWriter extends MidiFileWriter { /** TODO: */ public static boolean USE_RUNNING_STATUS = true; /** TODO: */ public static boolean CANCEL_RUNNING_STATUS_ON_META_AND_SYSEX = true; /** Return supported MIDI file types. This writer supports Standard MIDI File (SMF) types 0 and 1. So these numbers are returned here. @return an array of supported SMF types. */ public int[] getMidiFileTypes() { return new int[]{0, 1}; } /** Return the supported MIDI file types for a given Sequence. This writer supports Standard MIDI File (SMF) types 0 and 1. Depending on the Sequence, either 0 or 1 is returned. @return and array of supported SMF types. It contains 0 if the Sequence has one track, 1 otherwise. */ public int[] getMidiFileTypes(Sequence sequence) { Track[] tracks = sequence.getTracks(); if (tracks.length == 1) { return new int[]{0}; } else { return new int[]{1}; } } /** Write a Sequence as Standard MIDI File (SMF) to an OutputStream. A byte stream representing the passed Sequence is written to the output stream in the given file type. @return The number of bytes written to the output stream. */ public int write(Sequence sequence, int nFileType, OutputStream outputStream) throws IOException { if (! isFileTypeSupported(nFileType, sequence)) { throw new IllegalArgumentException("file type is not supported for this sequence"); } Track[] aTracks = sequence.getTracks(); DataOutputStream dataOutputStream = new DataOutputStream(outputStream); dataOutputStream.writeInt(MidiConstants.HEADER_MAGIC); dataOutputStream.writeInt(6); // header length dataOutputStream.writeShort(nFileType); dataOutputStream.writeShort(aTracks.length); float fDivisionType = sequence.getDivisionType(); int nResolution = sequence.getResolution(); int nDivision = 0; if (fDivisionType == Sequence.PPQ) { nDivision = nResolution & 0x7fff; } else { // TODO: } dataOutputStream.writeShort(nDivision); // unsigned? int nBytesWritten = 14; for (int nTrack = 0; nTrack < aTracks.length; nTrack++) { nBytesWritten += writeTrack(aTracks[nTrack], dataOutputStream); } return nBytesWritten; } /** Write a Sequence as Standard MIDI File (SMF) to a File. A byte stream representing the passed Sequence is written to the file in the given file type. @return The number of bytes written to the file. */ public int write(Sequence sequence, int nFileType, File file) throws IOException { OutputStream outputStream = new FileOutputStream(file); int nBytes = write(sequence, nFileType, outputStream); outputStream.close(); return nBytes; } /** Write a Track to a DataOutputStream. @return The number of bytes written. */ private static int writeTrack(Track track, DataOutputStream dataOutputStream) throws IOException { /** The number of bytes written. This is used as return value for this method. */ int nLength = 0; if (dataOutputStream != null) { dataOutputStream.writeInt(MidiConstants.TRACK_MAGIC); } /* * This is a recursive call! * It is to find out the length of the track without * actually writing. Having the second parameter as * null tells writeTrack() and its subordinate * methods to not write out data bytes. */ int nTrackLength = 0; if (dataOutputStream != null) { nTrackLength = writeTrack(track, null); } if (dataOutputStream != null) { dataOutputStream.writeInt(nTrackLength); } MidiEvent previousEvent = null; int[] anRunningStatusByte = new int[1]; anRunningStatusByte[0] = -1; for (int nEvent = 0; nEvent < track.size(); nEvent++) { MidiEvent event = track.get(nEvent); nLength += writeEvent(event, previousEvent, anRunningStatusByte, dataOutputStream); previousEvent = event; } return nLength; } /** TODO: */ private static int writeEvent(MidiEvent event, MidiEvent previousEvent, int[] anRunningStatusByte, DataOutputStream dataOutputStream) throws IOException { /** The number of bytes written. This is used as return value for this method. */ int nLength = 0; long lTickDelta = 0; if (previousEvent != null) { lTickDelta = event.getTick() - previousEvent.getTick(); } if (lTickDelta < 0) { TDebug.out("StandardMidiFileWriter.writeEvent(): warning: events not in order"); } // add bytes according to coded length of delta nLength += writeVariableLengthQuantity(lTickDelta, dataOutputStream); MidiMessage message = event.getMessage(); // int nDataLength = message.getLength(); if (message instanceof ShortMessage) { nLength += writeShortMessage((ShortMessage) message, anRunningStatusByte, dataOutputStream); } else if (message instanceof SysexMessage) { nLength += writeSysexMessage((SysexMessage) message, anRunningStatusByte, dataOutputStream); } else if (message instanceof MetaMessage) { nLength += writeMetaMessage((MetaMessage) message, anRunningStatusByte, dataOutputStream); } else { TDebug.out("StandardMidiFileWriter.writeEvent(): warning: unknown message class"); } return nLength; } /** TODO: */ private static int writeShortMessage(ShortMessage message, int[] anRunningStatusByte, DataOutputStream dataOutputStream) throws IOException { /** The number of bytes written. This is used as return value for this method. */ int nLength = 0; int nDataLength = message.getLength(); if (USE_RUNNING_STATUS && anRunningStatusByte[0] == message.getStatus()) { /* * Write without status byte. */ if (dataOutputStream != null) { dataOutputStream.write( message.getMessage(), 1, nDataLength - 1); } nLength += nDataLength - 1; } else { /* * Write with status byte. */ if (dataOutputStream != null) { dataOutputStream.write( message.getMessage(), 0, nDataLength); } nLength += nDataLength; anRunningStatusByte[0] = message.getStatus(); } return nLength; } /** TODO: */ private static int writeSysexMessage(SysexMessage message, int[] anRunningStatusByte, DataOutputStream dataOutputStream) throws IOException { /** The number of bytes written. This is used as return value for this method. */ int nLength = 0; int nDataLength = message.getLength(); if (CANCEL_RUNNING_STATUS_ON_META_AND_SYSEX) { anRunningStatusByte[0] = -1; } if (dataOutputStream != null) { dataOutputStream.write(message.getStatus()); } nLength++; nLength += writeVariableLengthQuantity( nDataLength - 1, dataOutputStream); if (dataOutputStream != null) { dataOutputStream.write( message.getData(), 0, nDataLength - 1); } nLength += nDataLength - 1; return nLength; } /** TODO: */ private static int writeMetaMessage(MetaMessage message, int[] anRunningStatusByte, DataOutputStream dataOutputStream) throws IOException { /** The number of bytes written. This is used as return value for this method. */ int nLength = 0; byte[] abData = message.getData(); int nDataLength = abData.length; if (CANCEL_RUNNING_STATUS_ON_META_AND_SYSEX) { anRunningStatusByte[0] = -1; } if (dataOutputStream != null) { dataOutputStream.write(message.getStatus()); dataOutputStream.write(message.getType()); } nLength += 2; nLength += writeVariableLengthQuantity( nDataLength, dataOutputStream); if (dataOutputStream != null) { dataOutputStream.write(abData); } nLength += nDataLength; return nLength; } /** TODO: outputStream == 0 signals to only calculate the number of needed to represent the value. */ private static int writeVariableLengthQuantity(long lValue, OutputStream outputStream) throws IOException { /** The number of bytes written. This is used as return value for this method. */ int nLength = 0; // IDEA: use a loop boolean bWritingStarted = false; int nByte = (int) ((lValue >> 21) & 0x7f); if (nByte != 0) { if (outputStream != null) { outputStream.write(nByte | 0x80); } nLength++; bWritingStarted = true; } nByte = (int) ((lValue >> 14) & 0x7f); if (nByte != 0 || bWritingStarted) { if (outputStream != null) { outputStream.write(nByte | 0x80); } nLength++; bWritingStarted = true; } nByte = (int) ((lValue >> 7) & 0x7f); if (nByte != 0 || bWritingStarted) { if (outputStream != null) { outputStream.write(nByte | 0x80); } nLength++; } nByte = (int) (lValue & 0x7f); if (outputStream != null) { outputStream.write(nByte); } nLength++; return nLength; } } /*** StandardMidiFileWriter.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/midi/file/package.html0000644000175000017500000000031310172456545026247 0ustar twernertwerner

Standard MIDI file reading and writing. The classes provided here .

libtritonus-java-20070428/src/classes/org/tritonus/midi/sb/0000755000175000017500000000000010621572462023452 5ustar twernertwernerlibtritonus-java-20070428/src/classes/org/tritonus/midi/sb/fluidsynth/0000755000175000017500000000000010621572462025643 5ustar twernertwernerlibtritonus-java-20070428/src/classes/org/tritonus/midi/sb/fluidsynth/FluidSoundbank.java0000644000175000017500000000645710376636712031440 0ustar twernertwerner/* * FluidSoundbank.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2006 by Henri Manson * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * - Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * - Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.midi.sb.fluidsynth; import javax.sound.midi.Instrument; import javax.sound.midi.Patch; import javax.sound.midi.Soundbank; import javax.sound.midi.SoundbankResource; import org.tritonus.midi.device.fluidsynth.FluidSynthesizer; /** * * @author Manson */ public class FluidSoundbank implements Soundbank { private FluidSynthesizer synth; private int sfontID; private FluidInstrument[] instruments; // $$mp: needs to be public for native code now public class FluidInstrument extends Instrument { public FluidInstrument(int bank, int program, String name) { super(FluidSoundbank.this, new Patch(bank, program), name, null); } public String toString() { return "Instrument " + getName() + " (bank " + getPatch().getBank() + " program " + getPatch().getProgram() + ")"; } public Object getData() { return null; } } public FluidSoundbank(FluidSynthesizer synth, int sfontID) { this.synth = synth; this.sfontID = sfontID; //TDebug.out("1"); instruments = nGetInstruments(sfontID); //TDebug.out("2"); } public native FluidInstrument[] nGetInstruments(int sfontID); public Instrument getInstrument(Patch patch) { return null; } public String getVersion() { return "1.0"; } public String getVendor() { return "Mansoft"; } public SoundbankResource[] getResources() { return null; } public String getName() { return "Mansoft"; } public Instrument[] getInstruments() { return instruments; } public String getDescription() { return "Mansoft"; } } /* FluidSoundbank.java */ libtritonus-java-20070428/src/classes/org/tritonus/sampled/0000755000175000017500000000000010621572500023542 5ustar twernertwernerlibtritonus-java-20070428/src/classes/org/tritonus/sampled/convert/0000755000175000017500000000000010621572470025230 5ustar twernertwernerlibtritonus-java-20070428/src/classes/org/tritonus/sampled/convert/gsm/0000755000175000017500000000000010621572466026023 5ustar twernertwerner././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootlibtritonus-java-20070428/src/classes/org/tritonus/sampled/convert/gsm/GSMFormatConversionProvider.javalibtritonus-java-20070428/src/classes/org/tritonus/sampled/convert/gsm/GSMFormatConversionProvider.j0000644000175000017500000002631310374074735033564 0ustar twernertwerner/* * GSMFormatConversionProvider.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999 - 2001 by Matthias Pfisterer * Copyright (c) 2001 by Florian Bomers * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.sampled.convert.gsm; import java.io.DataInputStream; import java.io.IOException; import java.util.Arrays; import java.util.Iterator; import javax.sound.sampled.AudioFormat; import javax.sound.sampled.AudioInputStream; import javax.sound.sampled.AudioSystem; import org.tritonus.share.TDebug; import org.tritonus.lowlevel.gsm.InvalidGSMFrameException; import org.tritonus.lowlevel.gsm.GSMDecoder; import org.tritonus.lowlevel.gsm.Encoder; import org.tritonus.share.sampled.TConversionTool; import org.tritonus.share.sampled.convert.TAsynchronousFilteredAudioInputStream; import org.tritonus.share.sampled.convert.TSimpleFormatConversionProvider; import org.tritonus.share.sampled.AudioFormats; /** ConversionProvider for GSM files. @author Matthias Pfisterer */ public class GSMFormatConversionProvider extends TSimpleFormatConversionProvider // extends TEncodingFormatConversionProvider { /* Debugging (profiling) hack. */ private static final boolean MEASURE_DECODING_TIME = false; private static final AudioFormat[] FORMATS1 = { new AudioFormat(new AudioFormat.Encoding("GSM0610"), 8000.0F, -1, 1, 33, 50.0F, false), new AudioFormat(new AudioFormat.Encoding("GSM0610"), 8000.0F, -1, 1, 33, 50.0F, true), // temporary only new AudioFormat(new AudioFormat.Encoding("PCM_SIGNED"), 8000.0F, 16, 1, 2, 8000.0F, false), new AudioFormat(new AudioFormat.Encoding("PCM_SIGNED"), 8000.0F, 16, 1, 2, 8000.0F, true), }; /* private static final AudioFormat[] FORMATS2 = { new AudioFormat(8000.0F, 16, 1, true, false), new AudioFormat(8000.0F, 16, 1, true, true), }; */ private static final AudioFormat[] FORMATS2 = FORMATS1; /** This is the size of the circular buffer. * This value is in bytes. It is * chosen so that one (decoded) GSM frame fits into the buffer. * GSM frames contain 160 samples. */ private static final int BUFFER_SIZE = 320; private static final int ENCODED_GSM_FRAME_SIZE = 33; /** Constructor. */ public GSMFormatConversionProvider() { super(Arrays.asList(FORMATS1), Arrays.asList(FORMATS2)); if (TDebug.TraceAudioConverter) { TDebug.out("GSMFormatConversionProvider.(): begin"); } if (TDebug.TraceAudioConverter) { TDebug.out("GSMFormatConversionProvider.(): end"); } } public AudioInputStream getAudioInputStream(AudioFormat targetFormat, AudioInputStream audioInputStream) { if (TDebug.TraceAudioConverter) { TDebug.out("GSMFormatConversionProvider.getAudioInputStream(): begin"); TDebug.out("GSMFormatConversionProvider.getAudioInputStream():"); TDebug.out("checking if conversion supported"); TDebug.out("from: " + audioInputStream.getFormat()); TDebug.out("to: " + targetFormat); } targetFormat=getDefaultTargetFormat(targetFormat, audioInputStream.getFormat()); if (isConversionSupported(targetFormat, audioInputStream.getFormat())) { if (targetFormat.getEncoding().equals(new AudioFormat.Encoding("PCM_SIGNED"))) { if (TDebug.TraceAudioConverter) { TDebug.out("GSMFormatConversionProvider.getAudioInputStream():"); TDebug.out("conversion supported; trying to create DecodedGSMAudioInputStream"); } return new DecodedGSMAudioInputStream( targetFormat, audioInputStream); } else { if (TDebug.TraceAudioConverter) { TDebug.out("GSMFormatConversionProvider.getAudioInputStream():"); TDebug.out("conversion supported; trying to create EncodedGSMAudioInputStream"); } return new EncodedGSMAudioInputStream( targetFormat, audioInputStream); } } else { if (TDebug.TraceAudioConverter) { TDebug.out("GSMFormatConversionProvider.getAudioInputStream():"); TDebug.out("conversion not supported; throwing IllegalArgumentException"); } throw new IllegalArgumentException("conversion not supported"); } // TODO: this is unreachable // if (TDebug.TraceAudioConverter) { TDebug.out("GSMFormatConversionProvider.getAudioInputStream(): end"); } } protected AudioFormat getDefaultTargetFormat(AudioFormat targetFormat, AudioFormat sourceFormat) { // return first of the matching formats // pre-condition: the predefined target formats (FORMATS2) must be well-defined ! Iterator iterator=getCollectionTargetFormats().iterator(); while (iterator.hasNext()) { AudioFormat format=(AudioFormat) iterator.next(); if (AudioFormats.matches(targetFormat, format)) { return format; } } throw new IllegalArgumentException("conversion not supported"); } /** AudioInputStream returned on decoding of GSM. An instance of this class is returned if you call AudioSystem.getAudioInputStream(AudioFormat, AudioInputStream) to decode a GSM stream. This class contains the logic of maintaining buffers and calling the decoder. */ public static class DecodedGSMAudioInputStream extends TAsynchronousFilteredAudioInputStream { /* Seems like DataInputStream (opposite to InputStream) is only needed for readFully(). readFully-behavious should perhaps be implemented in AudioInputStream anyway (so this construct may become obsolete). */ private DataInputStream m_encodedStream; private GSMDecoder m_decoder; /* * Holds one encoded GSM frame. */ private byte[] m_abFrameBuffer; private byte[] m_abBuffer; public DecodedGSMAudioInputStream(AudioFormat outputFormat, AudioInputStream inputStream) { super(outputFormat, inputStream.getFrameLength() == AudioSystem.NOT_SPECIFIED ? AudioSystem.NOT_SPECIFIED : inputStream.getFrameLength() * 160); if (TDebug.TraceAudioConverter) { TDebug.out("DecodedGSMAudioInputStream.(): begin"); } m_encodedStream = new DataInputStream(inputStream); m_decoder = new GSMDecoder(); m_abFrameBuffer = new byte[ENCODED_GSM_FRAME_SIZE]; m_abBuffer = new byte[BUFFER_SIZE]; if (TDebug.TraceAudioConverter) { TDebug.out("DecodedGSMAudioInputStream.(): end"); } } public void execute() { if (TDebug.TraceAudioConverter) { TDebug.out("DecodedGSMAudioInputStream.execute(): begin"); } try { m_encodedStream.readFully(m_abFrameBuffer); } catch (IOException e) { /* Not only errors, but also EOF is caught here. */ if (TDebug.TraceAllExceptions) { TDebug.out(e); } getCircularBuffer().close(); return; } try { long lTimestamp1; long lTimestamp2; if (MEASURE_DECODING_TIME) { lTimestamp1 = System.currentTimeMillis(); } m_decoder.decode(m_abFrameBuffer, 0, m_abBuffer, 0, isBigEndian()); // testing test hack // m_abBuffer[0] = 0; if (MEASURE_DECODING_TIME) { lTimestamp2 = System.currentTimeMillis(); System.out.println("GSM decode (ms): " + (lTimestamp2 - lTimestamp1)); } } catch (InvalidGSMFrameException e) { if (TDebug.TraceAllExceptions) { TDebug.out(e); } getCircularBuffer().close(); return; } /// end new version getCircularBuffer().write(m_abBuffer); if (TDebug.TraceAudioConverter) { TDebug.out("DecodedGSMAudioInputStream.execute(): decoded GSM frame written"); } if (TDebug.TraceAudioConverter) { TDebug.out("DecodedGSMAudioInputStream.execute(): end"); } } private boolean isBigEndian() { return getFormat().isBigEndian(); } public void close() throws IOException { super.close(); m_encodedStream.close(); } } /** AudioInputStream returned on encoding of GSM. An instance of this class is returned if you call AudioSystem.getAudioInputStream(AudioFormat, AudioInputStream) to encode data to GSM. This class contains the logic of maintaining buffers and calling the encoder. */ public static class EncodedGSMAudioInputStream extends TAsynchronousFilteredAudioInputStream { private AudioInputStream m_decodedStream; private Encoder m_encoder; /* * Holds one block of decoded data. */ private byte[] m_abBuffer; /* * Holds one block of decoded data. */ private short[] m_asBuffer; /* * Holds one encoded GSM frame. */ private byte[] m_abFrameBuffer; public EncodedGSMAudioInputStream(AudioFormat outputFormat, AudioInputStream inputStream) { super(outputFormat, //$$fb 2001-04-16: FrameLength gives the number of 33-byte blocks ! //inputStream.getFrameLength() == AudioSystem.NOT_SPECIFIED ? AudioSystem.NOT_SPECIFIED : inputStream.getFrameLength() / 160 * 33); inputStream.getFrameLength() == AudioSystem.NOT_SPECIFIED ? AudioSystem.NOT_SPECIFIED : inputStream.getFrameLength() / 160); if (TDebug.TraceAudioConverter) { TDebug.out("EncodedGSMAudioInputStream.(): begin"); } m_decodedStream = inputStream; m_encoder = new Encoder(); m_abBuffer = new byte[BUFFER_SIZE]; m_asBuffer = new short[160]; m_abFrameBuffer = new byte[ENCODED_GSM_FRAME_SIZE]; if (TDebug.TraceAudioConverter) { TDebug.out("EncodedGSMAudioInputStream.(): end"); } } public void execute() { if (TDebug.TraceAudioConverter) { TDebug.out(">EncodedGSMAudioInputStream.execute(): begin"); } try { int nRead = m_decodedStream.read(m_abBuffer); /* * Currently, we take all kinds of errors * as end of stream. */ if (nRead != m_abBuffer.length) { if (TDebug.TraceAudioConverter) { TDebug.out("EncodedGSMAudioInputStream.execute(): end"); } } private boolean isBigEndian() { return m_decodedStream.getFormat().isBigEndian(); } public void close() throws IOException { super.close(); m_decodedStream.close(); } } } /*** GSMFormatConversionProvider.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/sampled/convert/gsm/package.html0000644000175000017500000000034310172460776030305 0ustar twernertwerner

GSM 06.10 format converter. The classes provided here .

@see org.tritonus.lowlevel.gsm libtritonus-java-20070428/src/classes/org/tritonus/sampled/convert/lame/0000755000175000017500000000000010621572467026154 5ustar twernertwerner././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootlibtritonus-java-20070428/src/classes/org/tritonus/sampled/convert/lame/Mp3LameFormatConversionProvider.javalibtritonus-java-20070428/src/classes/org/tritonus/sampled/convert/lame/Mp3LameFormatConversionProvi0000644000175000017500000004025410374074735033601 0ustar twernertwerner/* * Mp3LameFormatConversionProvider.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2000 by Florian Bomers * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.sampled.convert.lame; import java.io.InputStream; import java.io.IOException; import java.util.Arrays; import java.util.Iterator; import javax.sound.sampled.AudioSystem; import javax.sound.sampled.AudioFormat; import javax.sound.sampled.AudioInputStream; import org.tritonus.share.TDebug; import org.tritonus.share.sampled.AudioFormatSet; import org.tritonus.share.sampled.convert.TSimpleFormatConversionProvider; import org.tritonus.share.sampled.convert.TAsynchronousFilteredAudioInputStream; import org.tritonus.lowlevel.lame.Lame; /** * ConversionProvider for encoding MP3 audio files with the lame lib. *

* It uses a sloppy implementation of the MPEG1L3 encoding: * It is used as a common denominator. So users can always ask for * MPEG1L3 encoding but may get in fact an MPEG2L3 or MPEG2.5L3 encoded * stream. * * @author Florian Bomers */ //TODO: - fill frame rate, frame size. Use frame rate for bit rate ? // - add decoding ? more work on LAME itself... // - byte swapping support in LAME ? public class Mp3LameFormatConversionProvider extends TSimpleFormatConversionProvider { private static final int ALL=AudioSystem.NOT_SPECIFIED; private static final int MPEG_BITS_PER_SAMPLE=ALL; // TODO! should be 0... private static final int MPEG_FRAME_RATE=ALL; // TODO private static final int MPEG_FRAME_SIZE=ALL; // TODO public static final AudioFormat.Encoding MPEG1L3 = new AudioFormat.Encoding("MPEG1L3"); // Lame converts automagically to MPEG2 or MPEG2.5, if necessary. public static final AudioFormat.Encoding MPEG2L3 = new AudioFormat.Encoding("MPEG2L3"); public static final AudioFormat.Encoding MPEG2DOT5L3 = new AudioFormat.Encoding("MPEG2DOT5L3"); /* * Lame provides these formats: * MPEG1 layer III samplerates(kHz): 32 44.1 48 * bitrates(kbs): 32 40 48 56 64 80 96 112 128 160 192 224 256 320 * * MPEG2 layer III samplerates(kHz): 16 22.05 24 * bitrates(kbs): 8 16 24 32 40 48 56 64 80 96 112 128 144 160 * * MPEG2.5 layer III samplerates(kHz): 8 11.025 12 * bitrates(kbs): 8 16 24 32 40 48 56 64 80 96 112 128 144 160 */ private static final AudioFormat[] OUTPUT_FORMATS = { new AudioFormat(MPEG2DOT5L3, 8000, ALL, 1, ALL, ALL, false), new AudioFormat(MPEG2DOT5L3, 8000, ALL, 2, ALL, ALL, false), new AudioFormat(MPEG2DOT5L3, 8000, ALL, 1, ALL, ALL, true), new AudioFormat(MPEG2DOT5L3, 8000, ALL, 2, ALL, ALL, true), new AudioFormat(MPEG2DOT5L3, 11025, ALL, 1, ALL, ALL, false), new AudioFormat(MPEG2DOT5L3, 11025, ALL, 2, ALL, ALL, false), new AudioFormat(MPEG2DOT5L3, 11025, ALL, 1, ALL, ALL, true), new AudioFormat(MPEG2DOT5L3, 11025, ALL, 2, ALL, ALL, true), new AudioFormat(MPEG2DOT5L3, 12000, ALL, 1, ALL, ALL, false), new AudioFormat(MPEG2DOT5L3, 12000, ALL, 2, ALL, ALL, false), new AudioFormat(MPEG2DOT5L3, 12000, ALL, 1, ALL, ALL, true), new AudioFormat(MPEG2DOT5L3, 12000, ALL, 2, ALL, ALL, true), new AudioFormat(MPEG2L3, 16000, ALL, 1, ALL, ALL, false), new AudioFormat(MPEG2L3, 16000, ALL, 2, ALL, ALL, false), new AudioFormat(MPEG2L3, 16000, ALL, 1, ALL, ALL, true), new AudioFormat(MPEG2L3, 16000, ALL, 2, ALL, ALL, true), new AudioFormat(MPEG2L3, 22050, ALL, 1, ALL, ALL, false), new AudioFormat(MPEG2L3, 22050, ALL, 2, ALL, ALL, false), new AudioFormat(MPEG2L3, 22050, ALL, 1, ALL, ALL, true), new AudioFormat(MPEG2L3, 22050, ALL, 2, ALL, ALL, true), new AudioFormat(MPEG2L3, 24000, ALL, 1, ALL, ALL, false), new AudioFormat(MPEG2L3, 24000, ALL, 2, ALL, ALL, false), new AudioFormat(MPEG2L3, 24000, ALL, 1, ALL, ALL, true), new AudioFormat(MPEG2L3, 24000, ALL, 2, ALL, ALL, true), new AudioFormat(MPEG1L3, 8000, ALL, 1, ALL, ALL, false), //MPEG2DOT5L3 new AudioFormat(MPEG1L3, 8000, ALL, 2, ALL, ALL, false), //MPEG2DOT5L3 new AudioFormat(MPEG1L3, 8000, ALL, 1, ALL, ALL, true), //MPEG2DOT5L3 new AudioFormat(MPEG1L3, 8000, ALL, 2, ALL, ALL, true), //MPEG2DOT5L3 new AudioFormat(MPEG1L3, 11025, ALL, 1, ALL, ALL, false),//MPEG2DOT5L3 new AudioFormat(MPEG1L3, 11025, ALL, 2, ALL, ALL, false),//MPEG2DOT5L3 new AudioFormat(MPEG1L3, 11025, ALL, 1, ALL, ALL, true), //MPEG2DOT5L3 new AudioFormat(MPEG1L3, 11025, ALL, 2, ALL, ALL, true), //MPEG2DOT5L3 new AudioFormat(MPEG1L3, 12000, ALL, 1, ALL, ALL, false),//MPEG2DOT5L3 new AudioFormat(MPEG1L3, 12000, ALL, 2, ALL, ALL, false),//MPEG2DOT5L3 new AudioFormat(MPEG1L3, 12000, ALL, 1, ALL, ALL, true), //MPEG2DOT5L3 new AudioFormat(MPEG1L3, 12000, ALL, 2, ALL, ALL, true), //MPEG2DOT5L3 new AudioFormat(MPEG1L3, 16000, ALL, 1, ALL, ALL, false), //MPEG2L3 new AudioFormat(MPEG1L3, 16000, ALL, 2, ALL, ALL, false), //MPEG2L3 new AudioFormat(MPEG1L3, 16000, ALL, 1, ALL, ALL, true), //MPEG2L3 new AudioFormat(MPEG1L3, 16000, ALL, 2, ALL, ALL, true), //MPEG2L3 new AudioFormat(MPEG1L3, 22050, ALL, 1, ALL, ALL, false), //MPEG2L3 new AudioFormat(MPEG1L3, 22050, ALL, 2, ALL, ALL, false), //MPEG2L3 new AudioFormat(MPEG1L3, 22050, ALL, 1, ALL, ALL, true), //MPEG2L3 new AudioFormat(MPEG1L3, 22050, ALL, 2, ALL, ALL, true), //MPEG2L3 new AudioFormat(MPEG1L3, 24000, ALL, 1, ALL, ALL, false), //MPEG2L3 new AudioFormat(MPEG1L3, 24000, ALL, 2, ALL, ALL, false), //MPEG2L3 new AudioFormat(MPEG1L3, 24000, ALL, 1, ALL, ALL, true), //MPEG2L3 new AudioFormat(MPEG1L3, 24000, ALL, 2, ALL, ALL, true), //MPEG2L3 new AudioFormat(MPEG1L3, 32000, ALL, 1, ALL, ALL, false), new AudioFormat(MPEG1L3, 32000, ALL, 2, ALL, ALL, false), new AudioFormat(MPEG1L3, 32000, ALL, 1, ALL, ALL, true), new AudioFormat(MPEG1L3, 32000, ALL, 2, ALL, ALL, true), new AudioFormat(MPEG1L3, 44100, ALL, 1, ALL, ALL, false), new AudioFormat(MPEG1L3, 44100, ALL, 2, ALL, ALL, false), new AudioFormat(MPEG1L3, 44100, ALL, 1, ALL, ALL, true), new AudioFormat(MPEG1L3, 44100, ALL, 2, ALL, ALL, true), new AudioFormat(MPEG1L3, 48000, ALL, 1, ALL, ALL, false), new AudioFormat(MPEG1L3, 48000, ALL, 2, ALL, ALL, false), new AudioFormat(MPEG1L3, 48000, ALL, 1, ALL, ALL, true), new AudioFormat(MPEG1L3, 48000, ALL, 2, ALL, ALL, true), }; private static final AudioFormat[] INPUT_FORMATS = { new AudioFormat(8000, 16, 1, true, false), new AudioFormat(8000, 16, 1, true, true), new AudioFormat(11025, 16, 1, true, false), new AudioFormat(11025, 16, 1, true, true), new AudioFormat(12000, 16, 1, true, false), new AudioFormat(12000, 16, 1, true, true), new AudioFormat(16000, 16, 1, true, false), new AudioFormat(16000, 16, 1, true, true), new AudioFormat(22050, 16, 1, true, false), new AudioFormat(22050, 16, 1, true, true), new AudioFormat(24000, 16, 1, true, false), new AudioFormat(24000, 16, 1, true, true), new AudioFormat(32000, 16, 1, true, false), new AudioFormat(32000, 16, 1, true, true), new AudioFormat(44100, 16, 1, true, false), new AudioFormat(44100, 16, 1, true, true), new AudioFormat(48000, 16, 1, true, false), new AudioFormat(48000, 16, 1, true, true), new AudioFormat(8000, 16, 2, true, false), new AudioFormat(8000, 16, 2, true, true), new AudioFormat(11025, 16, 2, true, false), new AudioFormat(11025, 16, 2, true, true), new AudioFormat(12000, 16, 2, true, false), new AudioFormat(12000, 16, 2, true, true), new AudioFormat(16000, 16, 2, true, false), new AudioFormat(16000, 16, 2, true, true), new AudioFormat(22050, 16, 2, true, false), new AudioFormat(22050, 16, 2, true, true), new AudioFormat(24000, 16, 2, true, false), new AudioFormat(24000, 16, 2, true, true), new AudioFormat(32000, 16, 2, true, false), new AudioFormat(32000, 16, 2, true, true), new AudioFormat(44100, 16, 2, true, false), new AudioFormat(44100, 16, 2, true, true), new AudioFormat(48000, 16, 2, true, false), new AudioFormat(48000, 16, 2, true, true), }; /** * Constructor. */ public Mp3LameFormatConversionProvider() { super(Arrays.asList(INPUT_FORMATS), Arrays.asList(OUTPUT_FORMATS)); if (!Lame.isLibAvailable()) { disable(); if (TDebug.TraceAudioConverter) { TDebug.out("******* Error initializing LAME mp3 encoder: "+Lame.getLinkError()); } } } public AudioInputStream getAudioInputStream(AudioFormat targetFormat, AudioInputStream audioInputStream) { if (isConversionSupported(targetFormat, audioInputStream.getFormat())) { return new EncodedMpegAudioInputStream( getDefaultTargetFormat(targetFormat, audioInputStream.getFormat(), false), audioInputStream); } else { throw new IllegalArgumentException("conversion not supported"); } } public AudioFormat[] getTargetFormats(AudioFormat.Encoding targetEncoding, AudioFormat sourceFormat) { if (TDebug.TraceAudioConverter) { TDebug.out(">MP3Lame getTargetFormats(AudioFormat.Encoding, AudioFormat):"); TDebug.out("checking out possible target formats"); TDebug.out("from: " + sourceFormat); TDebug.out("to : " + targetEncoding); } if (isConversionSupported(targetEncoding, sourceFormat)) { AudioFormatSet result=new AudioFormatSet(); Iterator iterator=getCollectionTargetFormats().iterator(); while (iterator.hasNext()) { AudioFormat targetFormat = (AudioFormat) iterator.next(); //if (TDebug.TraceAudioConverter) { //TDebug.out("-checking target format "+targetFormat); //} if (doMatch(targetFormat.getSampleRate(), sourceFormat.getSampleRate()) && targetFormat.getEncoding().equals(targetEncoding) && doMatch(targetFormat.getChannels(), sourceFormat.getChannels())) { targetFormat=getDefaultTargetFormat(targetFormat, sourceFormat, true); //if (TDebug.TraceAudioConverter) { //TDebug.out("-yes. added "+targetFormat); //} result.add(targetFormat); } //else { //if (TDebug.TraceAudioConverter) { //boolean e=targetFormat.getEncoding().equals(targetEncoding); //TDebug.out("-no. \""+targetFormat.getEncoding()+"\"==\""+targetEncoding+"\" ? "+e); //} //} } if (TDebug.TraceAudioConverter) { TDebug.out("0) { encodedBytes=encoder.encodeBuffer(pcmBuffer, 0, readBytes, encodedBuffer); buffer=encodedBuffer; } else { // take the larger buffer for the remaining frame(s) buffer=encodedBuffer.length>pcmBuffer.length?encodedBuffer:pcmBuffer; encodedBytes=encoder.encodeFinish(buffer); encoder.close(); encoder=null; } } if (encodedBytes>0) { getCircularBuffer().write(buffer, 0, encodedBytes); } if (encoder==null) { getCircularBuffer().close(); } } catch (ArrayIndexOutOfBoundsException e) { if (TDebug.TraceAudioConverter || TDebug.TraceAllExceptions) { TDebug.out(e); } } catch (IOException e) { if (TDebug.TraceAudioConverter || TDebug.TraceAllExceptions) { TDebug.out(e); } } } private boolean isBigEndian() { return getFormat().isBigEndian(); } public void close() throws IOException { super.close(); pcmStream.close(); if (encoder!=null) { encoder.encodeFinish(null); encoder.close(); encoder=null; } } } } /*** Mp3LameFormatConversionProvider.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/sampled/convert/lame/package.html0000644000175000017500000000027610174005433030425 0ustar twernertwerner

Mp3 encoder based on LAME. The classes provided here .

././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootlibtritonus-java-20070428/src/classes/org/tritonus/sampled/convert/AlawFormatConversionProvider.javalibtritonus-java-20070428/src/classes/org/tritonus/sampled/convert/AlawFormatConversionProvider.java0000644000175000017500000002515510540342103033705 0ustar twernertwerner/* * AlawFormatConversionProvider.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2000 by Florian Bomers * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.sampled.convert; import java.util.Arrays; import javax.sound.sampled.AudioSystem; import javax.sound.sampled.AudioFormat; import javax.sound.sampled.AudioInputStream; import org.tritonus.share.sampled.AudioFormats; import org.tritonus.share.sampled.TConversionTool; import org.tritonus.share.sampled.convert.TEncodingFormatConversionProvider; import org.tritonus.share.sampled.convert.TSynchronousFilteredAudioInputStream; /** * This provider (currently) supports these conversions: *
  • PCM 8 Signed -> alaw *
  • PCM 8 Unsigned -> alaw *
  • PCM 16 signed big endian -> alaw *
  • PCM 16 signed little endian -> alaw *
  • ulaw -> alaw *
* and vice versa. *

FrameRate, SampleRate, Channels CANNOT be converted. * * @author Florian Bomers */ public class AlawFormatConversionProvider extends TEncodingFormatConversionProvider { private static final int ALL=AudioSystem.NOT_SPECIFIED; public static AudioFormat.Encoding ENC_PCM_SIGNED=new AudioFormat.Encoding("PCM_SIGNED"); public static AudioFormat.Encoding ENC_PCM_UNSIGNED=new AudioFormat.Encoding("PCM_UNSIGNED"); public static AudioFormat.Encoding ENC_ULAW=new AudioFormat.Encoding("ULAW"); public static AudioFormat.Encoding ENC_ALAW=new AudioFormat.Encoding("ALAW"); // TODO: // see UlawFormatConversionProvider private static final AudioFormat[] OUTPUT_FORMATS = { new AudioFormat(ENC_PCM_SIGNED, ALL, 8, ALL, ALL, ALL, false), new AudioFormat(ENC_PCM_SIGNED, ALL, 8, ALL, ALL, ALL, false), new AudioFormat(ENC_PCM_UNSIGNED, ALL, 8, ALL, ALL, ALL, false), new AudioFormat(ENC_PCM_UNSIGNED, ALL, 8, ALL, ALL, ALL, false), new AudioFormat(ENC_PCM_SIGNED, ALL, 8, ALL, ALL, ALL, true), new AudioFormat(ENC_PCM_SIGNED, ALL, 8, ALL, ALL, ALL, true), new AudioFormat(ENC_PCM_UNSIGNED, ALL, 8, ALL, ALL, ALL, true), new AudioFormat(ENC_PCM_UNSIGNED, ALL, 8, ALL, ALL, ALL, true), new AudioFormat(ENC_PCM_SIGNED, ALL, 16, ALL, ALL, ALL, false), new AudioFormat(ENC_PCM_SIGNED, ALL, 16, ALL, ALL, ALL, false), new AudioFormat(ENC_PCM_SIGNED, ALL, 16, ALL, ALL, ALL, true), new AudioFormat(ENC_PCM_SIGNED, ALL, 16, ALL, ALL, ALL, true), new AudioFormat(ENC_ULAW, ALL, 8, ALL, ALL, ALL, false), new AudioFormat(ENC_ULAW, ALL, 8, ALL, ALL, ALL, true), new AudioFormat(ENC_ALAW, ALL, 8, ALL, ALL, ALL, false), new AudioFormat(ENC_ALAW, ALL, 8, ALL, ALL, ALL, true) }; /** Constructor. */ public AlawFormatConversionProvider() { super(Arrays.asList(OUTPUT_FORMATS), Arrays.asList(OUTPUT_FORMATS)); } public AudioInputStream getAudioInputStream(AudioFormat targetFormat, AudioInputStream sourceStream) { AudioFormat sourceFormat=sourceStream.getFormat(); // the non-conversion case // TODO: does this work OK when some fields are AudioSystem.NOT_SPECIFIED ? if (AudioFormats.matches(sourceFormat, targetFormat)) { return sourceStream; } if (doMatch(targetFormat.getFrameRate(), sourceFormat.getFrameRate()) && doMatch(targetFormat.getChannels(), sourceFormat.getChannels())) { if (doMatch(targetFormat.getSampleSizeInBits(),8) && targetFormat.getEncoding()==ENC_ALAW) { // OK, the targetFormat seems fine, so we convert it to ALAW // let the remaining checks be done by ToAlawStream return new ToAlawStream(sourceStream); } else if (doMatch(sourceFormat.getSampleSizeInBits(),8) && sourceFormat.getEncoding()==ENC_ALAW) { // convert ALAW to the target format return new FromAlawStream(sourceStream, targetFormat); } } throw new IllegalArgumentException("format conversion not supported"); } private static final int UNSIGNED8=1; private static final int SIGNED8=2; private static final int BIG_ENDIAN16=3; private static final int LITTLE_ENDIAN16=4; private static final int ULAW=5; protected boolean isSupportedFormat(AudioFormat format) { return getConvertType(format)!=0; } protected int getConvertType(AudioFormat af) { int result=0; AudioFormat.Encoding encoding=af.getEncoding(); boolean bigEndian=af.isBigEndian(); int ssib=af.getSampleSizeInBits(); // now set up the convert type if (encoding.equals(ENC_PCM_SIGNED)) { if (ssib==16) { if (bigEndian) { result=BIG_ENDIAN16; } else { result=LITTLE_ENDIAN16; } } else if (ssib==8) { result=SIGNED8; } } else if (encoding.equals(ENC_PCM_UNSIGNED)) { if (ssib==8) { result=UNSIGNED8; } } else if (encoding.equals(ENC_ULAW)) { result=ULAW; } return result; } class ToAlawStream extends TSynchronousFilteredAudioInputStream { private int convertType; public ToAlawStream(AudioInputStream sourceStream) { // transform the targetFormat so that // FrameRate, SampleRate, and Channels match the sourceFormat // we only retain encoding, samplesize and endian of targetFormat. super (sourceStream, new AudioFormat( ENC_ALAW, sourceStream.getFormat().getSampleRate(), 8, sourceStream.getFormat().getChannels(), sourceStream.getFormat().getChannels(), // sampleSize sourceStream.getFormat().getFrameRate(), sourceStream.getFormat().isBigEndian())); convertType=getConvertType(sourceStream.getFormat()); if (sourceStream.getFormat().getSampleSizeInBits() == 8) { enableConvertInPlace(); } if (convertType==0) throw new IllegalArgumentException("format conversion not supported"); } protected int convert(byte[] inBuffer, byte[] outBuffer, int outByteOffset, int inFrameCount) { int sampleCount=inFrameCount*getFormat().getChannels(); switch (convertType) { case UNSIGNED8: TConversionTool.pcm82alaw(inBuffer, 0, outBuffer, outByteOffset, sampleCount, false); break; case SIGNED8: TConversionTool.pcm82alaw(inBuffer, 0, outBuffer, outByteOffset, sampleCount, true); break; case BIG_ENDIAN16: TConversionTool.pcm162alaw(inBuffer, 0, outBuffer, outByteOffset, sampleCount, true); break; case LITTLE_ENDIAN16: TConversionTool.pcm162alaw(inBuffer, 0, outBuffer, outByteOffset, sampleCount, false); break; case ULAW: TConversionTool.ulaw2alaw(inBuffer, 0, outBuffer, outByteOffset, sampleCount); break; } return inFrameCount; } protected void convertInPlace(byte[] buffer, int byteOffset, int frameCount) { int sampleCount=frameCount*getFormat().getChannels(); switch (convertType) { case UNSIGNED8: TConversionTool.pcm82alaw( buffer, byteOffset, sampleCount, false); break; case SIGNED8: TConversionTool.pcm82alaw( buffer, byteOffset, sampleCount, true); break; case ULAW: TConversionTool.ulaw2alaw( buffer, byteOffset, sampleCount); break; default: throw new RuntimeException( "ToAlawStream: Call to convertInPlace, but it cannot convert in place."); } } } class FromAlawStream extends TSynchronousFilteredAudioInputStream { private int convertType; public FromAlawStream(AudioInputStream sourceStream, AudioFormat targetFormat) { // transform the targetFormat so that // FrameRate, SampleRate, and Channels match the sourceFormat // we only retain encoding, samplesize and endian of targetFormat. super (sourceStream, new AudioFormat( targetFormat.getEncoding(), sourceStream.getFormat().getSampleRate(), targetFormat.getSampleSizeInBits(), sourceStream.getFormat().getChannels(), targetFormat.getSampleSizeInBits()*sourceStream.getFormat().getChannels()/8, sourceStream.getFormat().getFrameRate(), targetFormat.isBigEndian())); convertType=getConvertType(getFormat()); if (targetFormat.getSampleSizeInBits() == 8) { enableConvertInPlace(); } if (convertType==0) throw new IllegalArgumentException("format conversion not supported"); } protected int convert(byte[] inBuffer, byte[] outBuffer, int outByteOffset, int inFrameCount) { int sampleCount=inFrameCount*getFormat().getChannels(); switch (convertType) { case UNSIGNED8: TConversionTool.alaw2pcm8(inBuffer, 0, outBuffer, outByteOffset, sampleCount, false); break; case SIGNED8: TConversionTool.alaw2pcm8(inBuffer, 0, outBuffer, outByteOffset, sampleCount, true); break; case BIG_ENDIAN16: TConversionTool.alaw2pcm16(inBuffer, 0, outBuffer, outByteOffset, sampleCount, true); break; case LITTLE_ENDIAN16: TConversionTool.alaw2pcm16(inBuffer, 0, outBuffer, outByteOffset, sampleCount, false); break; case ULAW: TConversionTool.alaw2ulaw(inBuffer, 0, outBuffer, outByteOffset, sampleCount); break; } return inFrameCount; } protected void convertInPlace(byte[] buffer, int byteOffset, int frameCount) { int sampleCount=frameCount*format.getChannels(); switch (convertType) { case UNSIGNED8: TConversionTool.alaw2pcm8( buffer, byteOffset, sampleCount, false); break; case SIGNED8: TConversionTool.alaw2pcm8( buffer, byteOffset, sampleCount, true); break; case ULAW: TConversionTool.alaw2ulaw( buffer, byteOffset, sampleCount); break; default: throw new RuntimeException( "FromAlawStream: Call to convertInPlace, but it cannot convert in place."); } } } } /*** AlawFormatConversionProvider.java ***/ ././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootlibtritonus-java-20070428/src/classes/org/tritonus/sampled/convert/ImaAdpcmFormatConversionProvider.javalibtritonus-java-20070428/src/classes/org/tritonus/sampled/convert/ImaAdpcmFormatConversionProvider.0000644000175000017500000003762010540343375033646 0ustar twernertwerner/* * ImaAdpcmFormatConversionProvider.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2003 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* The code doing the encoding and decoding is based on C code with the following copyright: *********************************************************** Copyright 1992 by Stichting Mathematisch Centrum, Amsterdam, The Netherlands. All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the names of Stichting Mathematisch Centrum or CWI not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.sampled.convert; import java.util.Arrays; import java.util.Iterator; import javax.sound.sampled.AudioFormat; import javax.sound.sampled.AudioInputStream; import org.tritonus.share.TDebug; import org.tritonus.share.sampled.AudioFormats; import org.tritonus.share.sampled.convert.TSynchronousFilteredAudioInputStream; import org.tritonus.share.sampled.convert.TEncodingFormatConversionProvider; /** IMA ADPCM encoder and decoder. @author Matthias Pfisterer */ public class ImaAdpcmFormatConversionProvider extends TEncodingFormatConversionProvider { // only used as abbreviation private static final AudioFormat.Encoding IMA_ADPCM = new AudioFormat.Encoding("IMA_ADPCM"); private static final AudioFormat.Encoding PCM_SIGNED = new AudioFormat.Encoding("PCM_SIGNED"); private static final AudioFormat[] INPUT_FORMATS = { // mono new AudioFormat(IMA_ADPCM, -1.0F, 4, 1, -1, -1.0F, false), new AudioFormat(IMA_ADPCM, -1.0F, 4, 1, -1, -1.0F, true), // mono, 16 bit signed new AudioFormat(PCM_SIGNED, -1.0F, 16, 1, 2, -1.0F, false), new AudioFormat(PCM_SIGNED, -1.0F, 16, 1, 2, -1.0F, true), }; // private static final AudioFormat[] OUTPUT_FORMATS = // { // // mono, 16 bit signed // new AudioFormat(PCM_SIGNED, -1.0F, 16, 1, 2, -1.0F, false), // new AudioFormat(PCM_SIGNED, -1.0F, 16, 1, 2, -1.0F, true), // }; static final int[] indexTable = { -1, -1, -1, -1, 2, 4, 6, 8, -1, -1, -1, -1, 2, 4, 6, 8, }; static final int[] stepsizeTable = { 7, 8, 9, 10, 11, 12, 13, 14, 16, 17, 19, 21, 23, 25, 28, 31, 34, 37, 41, 45, 50, 55, 60, 66, 73, 80, 88, 97, 107, 118, 130, 143, 157, 173, 190, 209, 230, 253, 279, 307, 337, 371, 408, 449, 494, 544, 598, 658, 724, 796, 876, 963, 1060, 1166, 1282, 1411, 1552, 1707, 1878, 2066, 2272, 2499, 2749, 3024, 3327, 3660, 4026, 4428, 4871, 5358, 5894, 6484, 7132, 7845, 8630, 9493, 10442, 11487, 12635, 13899, 15289, 16818, 18500, 20350, 22385, 24623, 27086, 29794, 32767 }; /** Constructor. */ public ImaAdpcmFormatConversionProvider() { super(Arrays.asList(INPUT_FORMATS), Arrays.asList(INPUT_FORMATS)/*, true, // new behaviour false*/); // bidirectional .. constants UNIDIR../BIDIR..? } public AudioInputStream getAudioInputStream(AudioFormat targetFormat, AudioInputStream audioInputStream) { /** The AudioInputStream to return. */ AudioInputStream convertedAudioInputStream = null; if (TDebug.TraceAudioConverter) { TDebug.out(">ImaAdpcmFormatConversionProvider.getAudioInputStream(): begin"); TDebug.out("checking if conversion supported"); TDebug.out("from: " + audioInputStream.getFormat()); TDebug.out("to: " + targetFormat); } // what is this ??? targetFormat = getDefaultTargetFormat(targetFormat, audioInputStream.getFormat()); if (isConversionSupported(targetFormat, audioInputStream.getFormat())) { if (targetFormat.getEncoding().equals(IMA_ADPCM)) { if (TDebug.TraceAudioConverter) { TDebug.out("conversion supported; trying to create EncodedImaAdpcmAudioInputStream"); } convertedAudioInputStream = new EncodedImaAdpcmAudioInputStream( audioInputStream, targetFormat); } else { if (TDebug.TraceAudioConverter) { TDebug.out("conversion supported; trying to create DecodedImaAdpcmAudioInputStream"); } convertedAudioInputStream = new DecodedImaAdpcmAudioInputStream( audioInputStream, targetFormat); } } else { if (TDebug.TraceAudioConverter) { TDebug.out("(): begin"); } m_state = new ImaAdpcmState(); if (TDebug.TraceAudioConverter) { TDebug.out("DecodedImaAdpcmAudioInputStream.(): end"); } } protected int convert(byte[] inBuffer, byte[] outBuffer, int outByteOffset, int inFrameCount) { if (TDebug.TraceAudioConverter) { TDebug.out("DecodedImaAdpcmAudioInputStream.convert(): begin"); } int inp; /* Input buffer pointer */ int outp; /* output buffer pointer */ int sign; /* Current adpcm sign bit */ int delta; /* Current adpcm output value */ int step; /* Stepsize */ int valpred; /* Predicted value */ int vpdiff; /* Current change to valpred */ int index; /* Current step change index */ int inputbuffer = 0; /* place to keep next 4-bit value */ boolean bufferstep; /* toggle between inputbuffer/input */ int len = inFrameCount; inp = 0; outp = outByteOffset; valpred = m_state.valprev; index = m_state.index; step = stepsizeTable[index]; bufferstep = false; for ( ; len > 0 ; len-- ) { /* Step 1 - get the delta value */ if ( bufferstep ) { delta = inputbuffer & 0xf; } else { inputbuffer = inBuffer[inp]; inp++; delta = (inputbuffer >> 4) & 0xf; } bufferstep = ! bufferstep; /* Step 2 - Find new index value (for later) */ index += indexTable[delta]; if ( index < 0 ) index = 0; if ( index > 88 ) index = 88; /* Step 3 - Separate sign and magnitude */ sign = delta & 8; delta = delta & 7; /* Step 4 - Compute difference and new predicted value */ /* ** Computes 'vpdiff = (delta+0.5)*step/4', but see comment ** in adpcm_coder. */ vpdiff = step >> 3; if ( (delta & 4) != 0 ) vpdiff += step; if ( (delta & 2) != 0 ) vpdiff += step>>1; if ( (delta & 1) != 0 ) vpdiff += step>>2; if ( sign != 0 ) valpred -= vpdiff; else valpred += vpdiff; /* Step 5 - clamp output value */ if ( valpred > 32767 ) valpred = 32767; else if ( valpred < -32768 ) valpred = -32768; /* Step 6 - Update step value */ step = stepsizeTable[index]; /* Step 7 - Output value */ // *outp++ = valpred; if (isBigEndian()) { outBuffer[outp++] = (byte) (valpred >> 8); outBuffer[outp++] = (byte) (valpred & 0xFF); } else { outBuffer[outp++] = (byte) (valpred & 0xFF); outBuffer[outp++] = (byte) (valpred >> 8); } } m_state.valprev = valpred; m_state.index = index; if (TDebug.TraceAudioConverter) { TDebug.out("DecodedImaAdpcmAudioInputStream.convert(): end"); } return inFrameCount; } /** */ protected int getSampleSizeInBytes() { return getFormat().getFrameSize() / getFormat().getChannels(); } /** . @return . */ protected int getFrameSize() { return getFormat().getFrameSize(); } /** Returns if this stream (the decoded one) is big endian. @return true if this stream is big endian. */ private boolean isBigEndian() { return getFormat().isBigEndian(); } } /** AudioInputStream returned on encoding to IMA ADPCM. An instance of this class is returned if you call AudioSystem.getAudioInputStream(AudioFormat, AudioInputStream) to encode to a IMA ADPCM stream. */ /* Class should be private, but is public due to a bug (?) in the aspectj compiler. */ /*private*/public static class EncodedImaAdpcmAudioInputStream extends TSynchronousFilteredAudioInputStream { private ImaAdpcmState m_state; /** * Constructor. */ public EncodedImaAdpcmAudioInputStream(AudioInputStream decodedStream, AudioFormat outputFormat) { super(decodedStream, outputFormat); if (TDebug.TraceAudioConverter) { TDebug.out("EncodedImaAdpcmAudioInputStream.(): begin"); } m_state = new ImaAdpcmState(); if (TDebug.TraceAudioConverter) { TDebug.out("EncodedImaAdpcmAudioInputStream.(): end"); } } protected int convert(byte[] inBuffer, byte[] outBuffer, int outByteOffset, int inFrameCount) { if (TDebug.TraceAudioConverter) { TDebug.out("EncodedImaAdpcmAudioInputStream.convert(): begin"); } int inp; /* Input buffer pointer */ int outp; /* output buffer pointer */ int val; /* Current input sample value */ int sign; /* Current adpcm sign bit */ int delta; /* Current adpcm output value */ int diff; /* Difference between val and valprev */ int step; /* Stepsize */ int valpred; /* Predicted output value */ int vpdiff; /* Current change to valpred */ int index; /* Current step change index */ int outputbuffer = 0; /* place to keep previous 4-bit value */ boolean bufferstep; /* toggle between outputbuffer/output */ int len = inFrameCount; inp = 0; outp = outByteOffset; valpred = m_state.valprev; index = m_state.index; step = stepsizeTable[index]; bufferstep = true; for ( ; len > 0 ; len-- ) { //val = *inp++; val = isBigEndian() ? ((inBuffer[inp]<<8) | (inBuffer[inp+1] & 0xFF)): ((inBuffer[inp+1]<<8) | (inBuffer[inp] & 0xFF)); inp += 2; /* Step 1 - compute difference with previous value */ diff = val - valpred; sign = (diff < 0) ? 8 : 0; if ( sign != 0 ) diff = (-diff); /* Step 2 - Divide and clamp */ /* Note: ** This code *approximately* computes: ** delta = diff*4/step; ** vpdiff = (delta+0.5)*step/4; ** but in shift step bits are dropped. The net result of this is ** that even if you have fast mul/div hardware you cannot put it to ** good use since the fixup would be too expensive. */ delta = 0; vpdiff = (step >> 3); if ( diff >= step ) { delta = 4; diff -= step; vpdiff += step; } step >>= 1; if ( diff >= step ) { delta |= 2; diff -= step; vpdiff += step; } step >>= 1; if ( diff >= step ) { delta |= 1; vpdiff += step; } /* Step 3 - Update previous value */ if ( sign != 0 ) valpred -= vpdiff; else valpred += vpdiff; /* Step 4 - Clamp previous value to 16 bits */ if ( valpred > 32767 ) valpred = 32767; else if ( valpred < -32768 ) valpred = -32768; /* Step 5 - Assemble value, update index and step values */ delta |= sign; index += indexTable[delta]; if ( index < 0 ) index = 0; if ( index > 88 ) index = 88; step = stepsizeTable[index]; /* Step 6 - Output value */ if ( bufferstep ) { outputbuffer = (delta << 4) & 0xf0; } else { outBuffer[outp++] = (byte) ((delta & 0x0f) | outputbuffer); } bufferstep = ! bufferstep; } /* Output last step, if needed */ if ( ! bufferstep ) outBuffer[outp++] = (byte) outputbuffer; m_state.valprev = valpred; m_state.index = index; if (TDebug.TraceAudioConverter) { TDebug.out("EncodedImaAdpcmAudioInputStream.convert(): end"); } return inFrameCount; } /** */ protected int getSampleSizeInBytes() { return getFormat().getFrameSize() / getFormat().getChannels(); } /** . @return . */ protected int getFrameSize() { return getFormat().getFrameSize(); } /** Returns if this stream (the decoded one) is big endian. @return true if this stream is big endian. */ private boolean isBigEndian() { return getFormat().isBigEndian(); } } /** persistent state of a IMA ADPCM decoder. This state class contains the information that has to be passed between two blocks that are encoded or decoded. */ private static class ImaAdpcmState { public int valprev; public int index; } } /*** ImaAdpcmFormatConversionProvider.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/sampled/convert/PCM2PCMConversionProvider.java0000644000175000017500000006137110540342253032717 0ustar twernertwerner/* * PCM2PCMConversionProvider.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2000,2006 by Florian Bomers * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.sampled.convert; import java.util.Arrays; import java.util.Iterator; import javax.sound.sampled.AudioSystem; import javax.sound.sampled.AudioFormat; import javax.sound.sampled.AudioInputStream; import org.tritonus.share.TDebug; import org.tritonus.share.sampled.AudioFormats; import org.tritonus.share.sampled.TConversionTool; import org.tritonus.share.sampled.FloatSampleBuffer; import org.tritonus.share.sampled.convert.TSimpleFormatConversionProvider; import org.tritonus.share.sampled.convert.TSynchronousFilteredAudioInputStream; import org.tritonus.share.ArraySet; /** * This provider supports these PCM conversions (<--> meaning both directions): *

  • 8 Signed <-> 8 unsigned *
  • 16/24/32 Signed little endian <-> 16/24/32 Signed big endian *
  • arbitrary conversion between 8/16/24/32 bit sample width
    * (up-conversion is done by adding low-byte zero(s)). *
  • 1 channel <-> x channels *
* The class uses 2 different approaches for conversion: *
  1. Simple, often used conversions with performance-optimized methods.
    * These are the following conversions:
    *
    • 8 Signed <-> 8 unsigned *
    • 16 signed little endian <--> 16 signed big endian *
    • 24 signed little endian <--> 24 signed big endian *
    • 32 signed little endian <--> 32 signed big endian *
    • 16 signed little endian <--> 8 signed *
    • 16 signed big endian <--> 8 signed *
    • 16 signed little endian <--> 8 unsigned *
    • 16 signed big endian <--> 8 unsigned *

    * Downsampling from 16bit to 8bit is currently done * using the float conversion (see next point), in order * to profit of dithering. *
  2. All other conversions are done using the FloatSampleBuffer.
    * Mixdown of channels (x channels -> 1 channel) is done by * plainly adding all channels together. * Thus, up mixing and down mixing will not result in the same audio, * as downmixing does NOT lower the volume and clippings are very * probable. To avoid that, the volume of the channels * should be lowered before using this converter for down mixing. *
  3. All conversions support upmixing of channels: * 1 channel -> x channels. This is done by * copying the channel to the other channels after * conversion of the format (if necessary). *
*

SampleRate CANNOT be converted. * * @author Florian Bomers * @see org.tritonus.share.sampled.FloatSampleBuffer * @see org.tritonus.share.sampled.TConversionTool */ public class PCM2PCMConversionProvider extends TSimpleFormatConversionProvider { // if true, always use FloatSampleBuffer private static final boolean ONLY_FLOAT_CONVERSION = false; public static AudioFormat.Encoding PCM_SIGNED=new AudioFormat.Encoding("PCM_SIGNED"); public static AudioFormat.Encoding PCM_UNSIGNED=new AudioFormat.Encoding("PCM_UNSIGNED"); private static final int ALL=AudioSystem.NOT_SPECIFIED; private static final AudioFormat[] OUTPUT_FORMATS = { // Encoding, SampleRate, sampleSizeInBits, channels, frameSize, frameRate, bigEndian new AudioFormat(PCM_SIGNED, ALL, 8, ALL, ALL, ALL, false), new AudioFormat(PCM_SIGNED, ALL, 8, ALL, ALL, ALL, true), new AudioFormat(PCM_UNSIGNED, ALL, 8, ALL, ALL, ALL, false), new AudioFormat(PCM_UNSIGNED, ALL, 8, ALL, ALL, ALL, true), new AudioFormat(PCM_SIGNED, ALL, 16, ALL, ALL, ALL, false), new AudioFormat(PCM_SIGNED, ALL, 16, ALL, ALL, ALL, true), new AudioFormat(PCM_SIGNED, ALL, 24, ALL, ALL, ALL, false), new AudioFormat(PCM_SIGNED, ALL, 24, ALL, ALL, ALL, true), new AudioFormat(PCM_SIGNED, ALL, 32, ALL, ALL, ALL, false), new AudioFormat(PCM_SIGNED, ALL, 32, ALL, ALL, ALL, true), }; /** Constructor. */ public PCM2PCMConversionProvider() { super(Arrays.asList(OUTPUT_FORMATS), Arrays.asList(OUTPUT_FORMATS)); } // formatType constants private static final int UNSIGNED8=1; private static final int SIGNED8=2; private static final int BIG_ENDIAN16=3; private static final int LITTLE_ENDIAN16=4; private static final int BIG_ENDIAN24=5; private static final int LITTLE_ENDIAN24=6; private static final int BIG_ENDIAN32=7; private static final int LITTLE_ENDIAN32=8; // conversionType private static final int CONVERT_NOT_POSSIBLE=0; private static final int CONVERT_SIGN=1; private static final int CONVERT_BYTE_ORDER16=2; private static final int CONVERT_BYTE_ORDER24=3; private static final int CONVERT_BYTE_ORDER32=4; private static final int CONVERT_16LTO8S=5; private static final int CONVERT_16LTO8U=6; private static final int CONVERT_16BTO8S=7; private static final int CONVERT_16BTO8U=8; private static final int CONVERT_8STO16L=9; private static final int CONVERT_8STO16B=10; private static final int CONVERT_8UTO16L=11; private static final int CONVERT_8UTO16B=12; private static final int CONVERT_ONLY_EXPAND_CHANNELS=13; private static final int CONVERT_FLOAT=100; // all other conversions private static final int CONVERT_NONE=101; // no conversion necessary public AudioInputStream getAudioInputStream(AudioFormat targetFormat, AudioInputStream sourceStream) { AudioFormat sourceFormat=sourceStream.getFormat(); // the non-conversion case if (AudioFormats.matches(sourceFormat, targetFormat)) { return sourceStream; } if (doMatch(targetFormat.getFrameRate(), sourceFormat.getFrameRate()) && doMatch(targetFormat.getSampleRate(), sourceFormat.getSampleRate())) { targetFormat=replaceNotSpecified(sourceFormat, targetFormat); int sourceType=getFormatType(sourceFormat); int targetType=getFormatType(targetFormat); int conversionType=getConversionType(sourceType, sourceFormat.getChannels(), targetType, targetFormat.getChannels()); if (TDebug.TraceAudioConverter) { TDebug.out("PCM2PCM: sourceType="+formatType2Str(sourceType)+", " +sourceFormat.getChannels()+"ch" +" targetType="+formatType2Str(targetType)+", " +targetFormat.getChannels()+"ch" +" conversionType="+conversionType2Str(conversionType)); } if (conversionType==CONVERT_NOT_POSSIBLE) { throw new IllegalArgumentException("format conversion not supported"); } return new PCM2PCMStream(sourceStream, targetFormat, conversionType); } throw new IllegalArgumentException("format conversion not supported"); } public AudioFormat[] getTargetFormats(AudioFormat.Encoding targetEncoding, AudioFormat sourceFormat) { if (TDebug.TraceAudioConverter) { TDebug.out(">PCM2PCMFormatConversionProvider.getTargetFormats(AudioFormat.Encoding, AudioFormat):"); TDebug.out("checking out possible target formats"); TDebug.out("from: " + sourceFormat); TDebug.out("to : " + targetEncoding); } if (isConversionSupported(targetEncoding, sourceFormat)) { // TODO: check that no duplicates may occur... ArraySet result=new ArraySet(); Iterator iterator=getCollectionTargetFormats().iterator(); while (iterator.hasNext()) { AudioFormat targetFormat = iterator.next(); targetFormat=replaceNotSpecified(sourceFormat, targetFormat); if (isConversionSupported(targetFormat, sourceFormat)) { result.add(targetFormat); } } if (TDebug.TraceAudioConverter) { TDebug.out("PCM2PCM: isConversionSupported(AudioFormat, AudioFormat):"); TDebug.out("checking if conversion possible"); TDebug.out("from: " + sourceFormat); TDebug.out("to : " + targetFormat); TDebug.out("< result : " + res); } return res; } private int getFormatType(AudioFormat af) { int result=0; AudioFormat.Encoding encoding=af.getEncoding(); boolean bigEndian=af.isBigEndian(); int ssib=af.getSampleSizeInBits(); // now set up the convert type if (encoding.equals(PCM_SIGNED)) { if (ssib==32) { if (bigEndian) { result=BIG_ENDIAN32; } else { result=LITTLE_ENDIAN32; } } else if (ssib==24) { if (bigEndian) { result=BIG_ENDIAN24; } else { result=LITTLE_ENDIAN24; } } else if (ssib==16) { if (bigEndian) { result=BIG_ENDIAN16; } else { result=LITTLE_ENDIAN16; } } else if (ssib==8) { result=SIGNED8; } } else if (encoding.equals(PCM_UNSIGNED)) { if (ssib==8) { result=UNSIGNED8; } } return result; } private int getConversionType(int sourceType, int sourceChannels, int targetType, int targetChannels) { if (sourceType==0 || targetType==0 || (sourceChannels!=1 && targetChannels!=1 && targetChannels!=sourceChannels)) { return CONVERT_NOT_POSSIBLE; } if (sourceType==targetType) { if (sourceChannels==targetChannels) { return CONVERT_NONE; } else if (sourceChannels==1 && targetChannels>1) { return CONVERT_ONLY_EXPAND_CHANNELS; } } if (!ONLY_FLOAT_CONVERSION && (sourceChannels==1 && targetChannels>=1 || sourceChannels==targetChannels)) { // when channels only have to be duplicated, direct conversions can be done if ((sourceType==UNSIGNED8 && targetType==SIGNED8) || (sourceType==SIGNED8 && targetType==UNSIGNED8)) { return CONVERT_SIGN; } else if ((sourceType==BIG_ENDIAN16 && targetType==LITTLE_ENDIAN16) || (sourceType==LITTLE_ENDIAN16 && targetType==BIG_ENDIAN16)) { return CONVERT_BYTE_ORDER16; } else if ((sourceType==BIG_ENDIAN24 && targetType==LITTLE_ENDIAN24) || (sourceType==LITTLE_ENDIAN24 && targetType==BIG_ENDIAN24)) { return CONVERT_BYTE_ORDER24; } else if ((sourceType==BIG_ENDIAN32 && targetType==LITTLE_ENDIAN32) || (sourceType==LITTLE_ENDIAN32 && targetType==BIG_ENDIAN32)) { return CONVERT_BYTE_ORDER32; /* downsampling is better handled with Float conversion -> dithering } else if (sourceType==LITTLE_ENDIAN16 && targetType==SIGNED8) { return CONVERT_16LTO8S; } else if (sourceType==LITTLE_ENDIAN16 && targetType==UNSIGNED8) { return CONVERT_16LTO8U; } else if (sourceType==BIG_ENDIAN16 && targetType==SIGNED8) { return CONVERT_16BTO8S; } else if (sourceType==BIG_ENDIAN16 && targetType==UNSIGNED8) { return CONVERT_16BTO8U; */ } else if (sourceType==SIGNED8 && targetType==LITTLE_ENDIAN16) { return CONVERT_8STO16L; } else if (sourceType==SIGNED8 && targetType==BIG_ENDIAN16) { return CONVERT_8STO16B; } else if (sourceType==UNSIGNED8 && targetType==LITTLE_ENDIAN16) { return CONVERT_8UTO16L; } else if (sourceType==UNSIGNED8 && targetType==BIG_ENDIAN16) { return CONVERT_8UTO16B; } } return CONVERT_FLOAT; } /** * Debugging functions */ private static String formatType2Str(int formatType) { switch (formatType) { case 0: return "unsupported"; case UNSIGNED8: return "UNSIGNED8"; case SIGNED8: return "SIGNED8"; case BIG_ENDIAN16: return "BIG_ENDIAN16"; case LITTLE_ENDIAN16: return "LITTLE_ENDIAN16"; case BIG_ENDIAN24: return "BIG_ENDIAN24"; case LITTLE_ENDIAN24: return "LITTLE_ENDIAN24"; case BIG_ENDIAN32: return "BIG_ENDIAN32"; case LITTLE_ENDIAN32: return "LITTLE_ENDIAN32"; } return "unknown"; } protected static String conversionType2Str(int conversionType) { switch (conversionType) { case CONVERT_NOT_POSSIBLE: return "CONVERT_NOT_POSSIBLE"; case CONVERT_SIGN: return "CONVERT_SIGN"; case CONVERT_BYTE_ORDER16: return "CONVERT_BYTE_ORDER16"; case CONVERT_BYTE_ORDER24: return "CONVERT_BYTE_ORDER24"; case CONVERT_BYTE_ORDER32: return "CONVERT_BYTE_ORDER32"; case CONVERT_16LTO8S: return "CONVERT_16LTO8S"; case CONVERT_16LTO8U: return "CONVERT_16LTO8U"; case CONVERT_16BTO8S: return "CONVERT_16BTO8S"; case CONVERT_16BTO8U: return "CONVERT_16BTO8U"; case CONVERT_8STO16L: return "CONVERT_8STO16L"; case CONVERT_8STO16B: return "CONVERT_8STO16B"; case CONVERT_8UTO16L: return "CONVERT_8UTO16L"; case CONVERT_8UTO16B: return "CONVERT_8UTO16B"; case CONVERT_ONLY_EXPAND_CHANNELS: return "CONVERT_ONLY_EXPAND_CHANNELS"; case CONVERT_FLOAT: return "CONVERT_FLOAT"; case CONVERT_NONE: return "CONVERT_NONE"; } return "unknown"; } /** * PCM2PCMStream * Provides direct conversion of some selected formats and rxpanding of channels. */ class PCM2PCMStream extends TSynchronousFilteredAudioInputStream { private int conversionType; private boolean needExpandChannels; private boolean needMixDown; private AudioFormat intermediateFloatBufferFormat; private FloatSampleBuffer floatBuffer=null; public PCM2PCMStream(AudioInputStream sourceStream, AudioFormat targetFormat, int conversionType) { // transform the targetFormat so that // FrameRate, and SampleRate match the sourceFormat super (sourceStream, new AudioFormat( targetFormat.getEncoding(), sourceStream.getFormat().getSampleRate(), targetFormat.getSampleSizeInBits(), targetFormat.getChannels(), targetFormat.getChannels()*targetFormat.getSampleSizeInBits()/8, sourceStream.getFormat().getFrameRate(), targetFormat.isBigEndian())); if (TDebug.TraceAudioConverter) { TDebug.out("PCM2PCMStream: constructor. ConversionType=" +conversionType2Str(conversionType)); } this.conversionType=conversionType; needExpandChannels=sourceStream.getFormat().getChannels()targetFormat.getChannels(); // some sanity tests. These can be dropped when this converter has been tested enough... if (needMixDown && conversionType!=CONVERT_FLOAT) { throw new IllegalArgumentException( "PCM2PCMStream: MixDown only possible with CONVERT_FLOAT"); } if (needMixDown && targetFormat.getChannels()!=1) { throw new IllegalArgumentException( "PCM2PCMStream: MixDown only possible with target channel count=1"); } if (needExpandChannels && sourceStream.getFormat().getChannels()!=1) { throw new IllegalArgumentException( "PCM2PCMStream: Expanding channels only possible with source channel count=1"); } // end sanity if (conversionType==CONVERT_FLOAT) { int floatChannels=needExpandChannels?1:targetFormat.getChannels(); intermediateFloatBufferFormat=new AudioFormat( targetFormat.getEncoding(), sourceStream.getFormat().getSampleRate(), targetFormat.getSampleSizeInBits(), floatChannels, floatChannels*targetFormat.getSampleSizeInBits()/8, sourceStream.getFormat().getFrameRate(), targetFormat.isBigEndian()); // with floatBuffer we need to copy anyway, so enable in-place conversion enableConvertInPlace(); } if (!needExpandChannels && (conversionType==CONVERT_SIGN || conversionType==CONVERT_BYTE_ORDER16 || conversionType==CONVERT_BYTE_ORDER24 || conversionType==CONVERT_BYTE_ORDER32)) { enableConvertInPlace(); } } // these functions only treat the highbyte of 16bit samples // obsolete: is handled with FloatBuffer because of dithering private void do16BTO8S(byte[] inBuffer, int inCounter, byte[] outBuffer, int outByteOffset, int sampleCount) { for (; sampleCount>0; sampleCount--, inCounter++) { outBuffer[outByteOffset++]=inBuffer[inCounter++]; } } // obsolete: is handled with FloatBuffer because of dithering private void do16BTO8U(byte[] inBuffer, int inCounter, byte[] outBuffer, int outByteOffset, int sampleCount) { for (; sampleCount>0; sampleCount--, inCounter++) { outBuffer[outByteOffset++]=(byte)(inBuffer[inCounter++]+128); } } private void do8STO16L(byte[] inBuffer, byte[] outBuffer, int outByteOffset, int sampleCount) { for (int inCounter=0; sampleCount>0; sampleCount--) { outBuffer[outByteOffset++]=0; outBuffer[outByteOffset++]=inBuffer[inCounter++]; } } private void do8UTO16L(byte[] inBuffer, byte[] outBuffer, int outByteOffset, int sampleCount) { for (int inCounter=0; sampleCount>0; sampleCount--) { outBuffer[outByteOffset++]=0; outBuffer[outByteOffset++]=(byte)(inBuffer[inCounter++]+128); } } private void do8STO16B(byte[] inBuffer, byte[] outBuffer, int outByteOffset, int sampleCount) { for (int inCounter=0; sampleCount>0; sampleCount--) { outBuffer[outByteOffset++]=inBuffer[inCounter++]; outBuffer[outByteOffset++]=0; } } private void do8UTO16B(byte[] inBuffer, byte[] outBuffer, int outByteOffset, int sampleCount) { for (int inCounter=0; sampleCount>0; sampleCount--) { outBuffer[outByteOffset++]=(byte)(inBuffer[inCounter++]+128); outBuffer[outByteOffset++]=0; } } // copies the channels: in the buffer there is only one channel private void expandChannels(byte[] buffer, int offset, int frameCount, int bytesPerFrame, int channels) { int inOffset=offset+bytesPerFrame*frameCount; int outOffset=offset+bytesPerFrame*channels*frameCount; switch (bytesPerFrame) { case 1: if (channels==2) { for (;frameCount>0; frameCount--) { buffer[--outOffset]=buffer[--inOffset]; buffer[--outOffset]=buffer[inOffset]; } } else { for (;frameCount>0; frameCount--) { inOffset--; for (int channel=0; channel0; frameCount--) { buffer[--outOffset]=buffer[--inOffset]; buffer[--outOffset]=buffer[inOffset-1]; buffer[--outOffset]=buffer[inOffset]; buffer[--outOffset]=buffer[--inOffset]; } } else { for (;frameCount>0; frameCount--) { inOffset--; for (int channel=0; channel0; frameCount--) { for (int channel=0; channel * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.sampled.convert; import java.io.ByteArrayInputStream; import java.io.IOException; import java.util.Arrays; import java.util.Iterator; import javax.sound.sampled.AudioSystem; import javax.sound.sampled.AudioFormat; import javax.sound.sampled.AudioInputStream; import org.tritonus.share.TDebug; import org.tritonus.share.sampled.AudioFormats; import org.tritonus.share.sampled.FloatSampleBuffer; import org.tritonus.share.sampled.FloatSampleInput; import org.tritonus.share.sampled.AudioUtils; import org.tritonus.share.sampled.convert.TSimpleFormatConversionProvider; import org.tritonus.share.ArraySet; /** * This provider converts sample rate of 2 PCM streams.
* It does: *

  • conversion of different sample rates *
  • conversion of unsigned/signed (only 8bit unsigned supported) *
  • conversion of big/small endian *
  • 8,16,24,32 bit conversion *
* It does NOT: *
  • change channel count *
  • accept a stream where the sample rates are equal. This case should be handled * by the PCM2PCM converter *
* * @author Florian Bomers */ public class SampleRateConversionProvider extends TSimpleFormatConversionProvider { // only used as abbreviation public static AudioFormat.Encoding PCM_SIGNED=AudioFormat.Encoding.PCM_SIGNED; public static AudioFormat.Encoding PCM_UNSIGNED=AudioFormat.Encoding.PCM_UNSIGNED; private static final boolean DEBUG_STREAM=false; private static final boolean DEBUG_STREAM_PROBLEMS=false; private static final int ALL=AudioSystem.NOT_SPECIFIED; private static final AudioFormat[] OUTPUT_FORMATS = { // Encoding, SampleRate, sampleSizeInBits, channels, frameSize, frameRate, bigEndian new AudioFormat(PCM_SIGNED, ALL, 8, ALL, ALL, ALL, false), new AudioFormat(PCM_SIGNED, ALL, 8, ALL, ALL, ALL, true), new AudioFormat(PCM_UNSIGNED, ALL, 8, ALL, ALL, ALL, false), new AudioFormat(PCM_UNSIGNED, ALL, 8, ALL, ALL, ALL, true), new AudioFormat(PCM_SIGNED, ALL, 16, ALL, ALL, ALL, false), new AudioFormat(PCM_SIGNED, ALL, 16, ALL, ALL, ALL, true), new AudioFormat(PCM_SIGNED, ALL, 24, ALL, ALL, ALL, false), new AudioFormat(PCM_SIGNED, ALL, 24, ALL, ALL, ALL, true), new AudioFormat(PCM_SIGNED, ALL, 32, ALL, ALL, ALL, false), new AudioFormat(PCM_SIGNED, ALL, 32, ALL, ALL, ALL, true), }; /** Constructor. */ public SampleRateConversionProvider() { super(Arrays.asList(OUTPUT_FORMATS), Arrays.asList(OUTPUT_FORMATS)); } public AudioInputStream getAudioInputStream(AudioFormat targetFormat, AudioInputStream sourceStream) { AudioFormat sourceFormat=sourceStream.getFormat(); // the non-conversion case if (AudioFormats.matches(sourceFormat, targetFormat)) { return sourceStream; } targetFormat=replaceNotSpecified(sourceFormat, targetFormat); // do not support NOT_SPECIFIED as sample rates if (targetFormat.getSampleRate()!=AudioSystem.NOT_SPECIFIED && sourceFormat.getSampleRate()!=AudioSystem.NOT_SPECIFIED && targetFormat.getChannels()!=AudioSystem.NOT_SPECIFIED && sourceFormat.getChannels()!=AudioSystem.NOT_SPECIFIED && targetFormat.getSampleSizeInBits()!=AudioSystem.NOT_SPECIFIED && sourceFormat.getSampleSizeInBits()!=AudioSystem.NOT_SPECIFIED && isConversionSupported(sourceFormat, targetFormat)) { return new SampleRateConverterStream(sourceStream, targetFormat); } throw new IllegalArgumentException("format conversion not supported"); } // replaces the sample rate and frame rate. // Should only be used with PCM_SIGNED or PCM_UNSIGNED private static AudioFormat replaceSampleRate(AudioFormat format, float newSampleRate) { if (format.getSampleRate()==newSampleRate) { return format; } return new AudioFormat(format.getEncoding(), newSampleRate, format.getSampleSizeInBits(), format.getChannels(), format.getFrameSize(), newSampleRate, format.isBigEndian()); } private static final float[] commonSampleRates={ 8000, 11025, 12000, 16000, 22050, 24000, 32000, 44100, 48000, 56000, 64000, 88200, 96000, 192000 }; public AudioFormat[] getTargetFormats(AudioFormat.Encoding targetEncoding, AudioFormat sourceFormat) { if (TDebug.TraceAudioConverter) { TDebug.out(">SampleRateConversionProvider.getTargetFormats(AudioFormat.Encoding, AudioFormat):"); TDebug.out("checking out possible target formats"); TDebug.out("from: " + sourceFormat); TDebug.out("to : " + targetEncoding); } float sourceSampleRate=sourceFormat.getSampleRate(); // a trick: set sourceFormat's sample rate to -1 so that // replaceNotSpecified does not replace the sample rate. // we want to convert that ! sourceFormat=replaceSampleRate(sourceFormat, AudioSystem.NOT_SPECIFIED); if (isConversionSupported(targetEncoding, sourceFormat)) { ArraySet result=new ArraySet(); Iterator iterator=getCollectionTargetFormats().iterator(); while (iterator.hasNext()) { AudioFormat targetFormat = iterator.next(); targetFormat=replaceNotSpecified(sourceFormat, targetFormat); if (isConversionSupported(targetFormat, sourceFormat)) { result.add(targetFormat); } } // for convenience, add some often used sample rates as output // this may help applications that do not handle NOT_SPECIFIED if (result.size()>0 && sourceSampleRate!=AudioSystem.NOT_SPECIFIED) { int count=result.size(); for (int i=0; iSampleRateConverter: isConversionSupported(AudioFormat, AudioFormat):"); TDebug.out("checking if conversion possible"); TDebug.out("from: " + sourceFormat); TDebug.out("to : " + targetFormat); TDebug.out("< result : " + result); } return result; } protected static long convertLength(AudioFormat sourceFormat, AudioFormat targetFormat, long sourceLength) { if (sourceLength==AudioSystem.NOT_SPECIFIED) { return sourceLength; } return Math.round(targetFormat.getSampleRate()/sourceFormat.getSampleRate()*sourceLength); } protected static long convertLength(float sourceSR, float targetSR, long sourceLength) { if (sourceLength==AudioSystem.NOT_SPECIFIED) { return sourceLength; } return Math.round(targetSR/sourceSR*sourceLength); //return (long) (targetFormat.getSampleRate()/sourceFormat.getSampleRate()*sourceLength); } /** * SampleRateConverterStream */ // at the moment, there are so many special things to care // about, and new things in an AIS, that I derive directly from // AudioInputStream. // I cannot use TAsynchronousFilteredAudioInputStream because // - it doesn't allow convenient use of a history. The history will be needed // especially when performing filtering // - it doesn't work on FloatSampleBuffer (yet) // - each sample must be calculated one-by-one. The asynchronous // difficulty isn't overcome by using a TCircularBuffer // I cannot use TSynchronousFilteredAudioInputStream because // - it doesn't handle different sample rates // Later we can make a base class for this, e.g. THistoryAudioInputStream // TODO: when target sample rate is < source sample rate (or only slightly above), // this stream calculates ONE sample too much. public static class SampleRateConverterStream extends AudioInputStream implements FloatSampleInput { /** the current working buffer with samples of the sourceStream */ private FloatSampleBuffer thisBuffer=null; /** used when read(byte[],int,int) is called */ private FloatSampleBuffer writeBuffer=null; private byte[] byteBuffer; // used for reading samples of sourceStream private AudioInputStream sourceStream; private FloatSampleInput sourceInput; private float sourceSampleRate; private float targetSampleRate; private long sourceFrameLength; /** index in thisBuffer */ private double dPos; /** Conversion algorithm */ public static final int SAMPLE_AND_HOLD=1; /** Conversion algorithm */ public static final int LINEAR_INTERPOLATION=2; /** Conversion algorithm */ public static final int RESAMPLE=3; private boolean eofReached = false; /** source stream is read in buffers of this size - in milliseconds */ private int sourceBufferTime; /** the current conversion algorithm */ private int conversionAlgorithm=LINEAR_INTERPOLATION; //private int conversionAlgorithm=SAMPLE_AND_HOLD; // History support /** the buffer with history samples */ private FloatSampleBuffer historyBuffer=null; /** the minimum number of samples that must be present in the history buffer */ private int minimumSamplesInHistory=1; /** force to discard current contents in thisBuffer if true */ private boolean thisBufferValid=false; public SampleRateConverterStream(AudioInputStream sourceStream, AudioFormat targetFormat) { // clean up targetFormat: // - ignore frame rate totally // - recalculate frame size super (sourceStream, new SRCAudioFormat(targetFormat), convertLength(sourceStream.getFormat(), targetFormat, sourceStream.getFrameLength())); if (TDebug.TraceAudioConverter) { TDebug.out("SampleRateConverterStream: "); } this.sourceStream=sourceStream; if (sourceStream instanceof FloatSampleInput) { sourceInput = (FloatSampleInput) sourceStream; } else { this.sourceInput = null; } sourceSampleRate=sourceStream.getFormat().getSampleRate(); targetSampleRate=targetFormat.getSampleRate(); sourceFrameLength = sourceStream.getFrameLength(); dPos=0; // use a buffer size of 100ms sourceBufferTime=100; resizeBuffers(); flush(); // force read of source stream next time read is called } public SampleRateConverterStream(FloatSampleInput sourceInput, AudioFormat targetFormat, long frameLength) { // clean up targetFormat: // - ignore frame rate totally // - recalculate frame size super (new ByteArrayInputStream(new byte[0]), new SRCAudioFormat(targetFormat), convertLength(sourceInput.getSampleRate(), targetFormat.getSampleRate(), frameLength)); if (TDebug.TraceAudioConverter) { TDebug.out("SampleRateConverterStream: "); } this.sourceStream = null; this.sourceInput = sourceInput;; sourceSampleRate = sourceInput.getSampleRate(); targetSampleRate = targetFormat.getSampleRate(); sourceFrameLength = frameLength; dPos=0; // use a buffer size of 100ms sourceBufferTime=100; resizeBuffers(); flush(); // force read of source stream next time read is called } /** * Assures that both historyBuffer and working buffer *
  • exist *
  • have about sourceBufferTime ms samples *
  • that both have at least minimumSamplesInHistory * samples *
* This method must be called when anything is changed that * may change the size of the buffers. */ private void resizeBuffers() { int bufferSize=(int) AudioUtils.millis2Frames( (long) sourceBufferTime, sourceSampleRate); if (bufferSize 0) { bytesRead += thisRead; } } while (bytesRead < byteCount && thisRead > 0); if (bytesRead==0) { // sourceStream is closed. We don't accept 0 bytes read from source stream close(); } else { thisBuffer.initFromByteArray(byteBuffer, 0, bytesRead, sourceStream.getFormat()); } } /** pre-condition: sourceInput != null */ private void readFromSourceInput() { sourceInput.read(thisBuffer); if (sourceInput.isDone()) { close(); } } private long testInFramesRead=0; private long testOutFramesReturned=0; /** * fills thisBuffer with new samples. * It sets the history buffer to the last buffer. * thisBuffer's sampleCount will be the number of samples read. * Calling methods MUST check whether this stream is closed upon * completion of this method. If the stream is closed, the contents * of thisBuffer are not valid. */ private void readFromSourceStream() { if (isClosed()) { return; } int oldSampleCount=thisBuffer.getSampleCount(); // reuse history buffer FloatSampleBuffer newBuffer=historyBuffer; historyBuffer=thisBuffer; thisBuffer=newBuffer; if (sourceFrameLength!=AudioSystem.NOT_SPECIFIED && thisBuffer.getSampleCount()+testInFramesRead>sourceFrameLength) { if (sourceFrameLength-testInFramesRead<=0) { close(); return; } thisBuffer.changeSampleCount((int) (sourceFrameLength-testInFramesRead), false); } if (sourceInput != null) { readFromSourceInput(); } else { readFromByteSourceStream(); } if (TDebug.TraceAudioConverter) { testInFramesRead+=thisBuffer.getSampleCount(); if (DEBUG_STREAM) { TDebug.out("Read "+thisBuffer.getSampleCount()+" frames from source stream. Total="+testInFramesRead); } } double inc=outSamples2inSamples(1.0); if (!thisBufferValid) { thisBufferValid=true; dPos=0.0; } else { double temp = dPos; dPos -= (double) oldSampleCount; if (DEBUG_STREAM) { TDebug.out("new dPos: "+temp+" - "+oldSampleCount+" = "+dPos); } if ((dPos>inc || dPos<-inc) && ((int) dPos)!=0) { // hard-reset dPos if - why ever - it got out of bounds if (DEBUG_STREAM_PROBLEMS) { TDebug.out("Need to hard reset dPos="+dPos+" !"); } dPos=0.0; } } } protected void convertSampleAndHold1( float[] inSamples, double inSampleOffset, int inSampleCount, double increment, float[] outSamples, int outSampleOffset, int outSampleCount, float[] history, int historyLength) { if (DEBUG_STREAM) { TDebug.out("convertSampleAndHold1(inSamples["+inSamples.length+"], " +((int) inSampleOffset)+" to "+((int) (inSampleOffset+increment*(outSampleCount-1)))+", " +"outSamples["+outSamples.length+"], "+outSampleOffset+" to "+(outSampleOffset+outSampleCount-1)+")"); System.out.flush(); } for (int i=0; i=inSampleCount) { // we clearly need more samples ! if (DEBUG_STREAM_PROBLEMS) { TDebug.out("linear interpolation: INDEX OUT OF BOUNDS iInIndex="+iInIndex+" inSampleCount="+inSampleCount); } } else if (iInIndex<0) { int histIndex=iInIndex+historyLength; if (histIndex>=0) { value+=history[histIndex]*factor; if (DEBUG_STREAM) { TDebug.out("linear interpolation: using history["+iInIndex+"]"); } } else if (DEBUG_STREAM_PROBLEMS) { TDebug.out("linear interpolation: history INDEX OUT OF BOUNDS iInIndex="+iInIndex+" histIndex="+histIndex+" history length="+historyLength); } } else { value+=inSamples[iInIndex]*factor; } factor=1-factor; iInIndex++; } outSamples[i+outSampleOffset]=value; //outSamples[i]=inSamples[roundDown(inSampleOffset)]; } catch (ArrayIndexOutOfBoundsException aioobe) { if (DEBUG_STREAM_PROBLEMS) { TDebug.out("**** REAL INDEX OUT OF BOUNDS ****** outSamples["+i+"]=inSamples[roundDown("+inSampleOffset+")="+((int) inSampleOffset)+"];"); } //throw aioobe; } //inSampleOffset+=increment; <- this produces too much rounding errors... } } /** * optimized version of the linear interpolator * @param inSamples * @param inSampleOffset * @param inSampleCount * @param increment * @param outSamples * @param outSampleOffset * @param outSampleCount * @param history * @param historyLength */ private void convertLinearInterpolation2(float[] inSamples, double inSampleOffset, int inSampleCount, double increment, float[] outSamples, int outSampleOffset, int outSampleCount, float[] history, int historyLength) { // cast results: // (int) -1.7d=-1 (int) -1.5d=-1 (int) -1.2d=-1 (int) -1.0d=-1 (int) // -0.7d=0 (int) -0.5d=0 (int) -0.2d=0 if (DEBUG_STREAM) { TDebug.out("convertLinearInterpolate2(inSamples[" + inSamples.length + "], " +((int) inSampleOffset)+" to "+((int) (inSampleOffset+increment*(outSampleCount-1)))+", " + "outSamples[" + outSamples.length + "], " + outSampleOffset + " to " + (outSampleOffset + outSampleCount - 1) + ")"); System.out.flush(); } try { int endSampleOffset = outSampleOffset + outSampleCount; // first go through the history double dHistoryLength = (double) historyLength; while (inSampleOffset < 0.0d && outSampleOffset < endSampleOffset) { double dInIndex = (inSampleOffset + dHistoryLength); int histIndex = (int) dInIndex; float factor = (float) (dInIndex - histIndex); outSamples[outSampleOffset] = (history[histIndex - 1] * (1.0f - factor)) + (history[histIndex] * factor); inSampleOffset += increment; outSampleOffset++; } // then the transition area: last sample is in history, new sample in inSamples while (inSampleOffset < 1.0d && outSampleOffset < endSampleOffset) { float factor = (float) inSampleOffset; outSamples[outSampleOffset] = (history[historyLength - 1] * (1.0f - factor)) + (inSamples[0] * factor); inSampleOffset += increment; outSampleOffset++; } // then go through the remaining new samples while (outSampleOffset < endSampleOffset) { int iInIndex = (int) inSampleOffset; float factor = (float) (inSampleOffset - iInIndex); outSamples[outSampleOffset] = (inSamples[iInIndex-1] * (1.0f - factor)) + (inSamples[iInIndex] * factor); inSampleOffset += increment; outSampleOffset++; } } catch (ArrayIndexOutOfBoundsException aioobe) { if (DEBUG_STREAM_PROBLEMS) { TDebug.out("**** INDEX OUT OF BOUNDS ****** inSampleOffset=" + inSampleOffset + " inSamples.length=" + inSamples.length + " outSampleOffset=" + outSampleOffset + " outSamples.length=" + outSamples.length); } //throw aioobe; } } private double inSamples2outSamples(double inSamples) { return inSamples*targetSampleRate/sourceSampleRate; } private double outSamples2inSamples(double outSamples) { return outSamples*sourceSampleRate/targetSampleRate; } // interface FloatSampleInput /* * (non-Javadoc) * * @see org.tritonus.share.sampled.FloatSampleInput#getChannels() */ public int getChannels() { return getFormat().getChannels(); } /* * (non-Javadoc) * * @see org.tritonus.share.sampled.FloatSampleInput#getSampleRate() */ public float getSampleRate() { return getFormat().getSampleRate(); } /* * (non-Javadoc) * * @see org.tritonus.share.sampled.FloatSampleInput#isDone() */ public boolean isDone() { return isClosed(); } public void read(FloatSampleBuffer outBuffer) { read(outBuffer, 0, outBuffer.getSampleCount()); } /** * Main read method. It blocks until all samples are converted or * the source stream is at its end or closed.
* The sourceStream's sample rate is converted following * the current setting of conversionAlgorithm. * At most outBuffer.getSampleCount() are converted. In general, * if outBuffer.getSampleCount()) is less * after processing this function, then it is an indicator * that it was the last block to be processed. * * @see #setConversionAlgorithm(int) * @param outBuffer the buffer that the converted samples will be written to. * @throws IllegalArgumentException when outBuffer's channel count does not match */ public void read(FloatSampleBuffer outBuffer, int offset, int count) { if (isClosed() || count == 0) { outBuffer.setSampleCount(offset, true); return; } if (outBuffer.getChannelCount()!=thisBuffer.getChannelCount()) { throw new IllegalArgumentException("passed buffer has different channel count"); } if (TDebug.TraceAudioConverter) { TDebug.out(">SamplerateConverterStream.read("+count+" samples)"); } float[] outSamples; float[] inSamples; float[] history; double increment=outSamples2inSamples(1.0); int writtenSamples=0; do { // check thisBuffer with samples of source stream int inSampleCount=thisBuffer.getSampleCount(); if (((int) dPos) >= inSampleCount || !thisBufferValid) { // need to load new data of sourceStream readFromSourceStream(); if (isClosed()) { break; } inSampleCount=thisBuffer.getSampleCount(); } // calculate number of samples to write int writeCount=count-writtenSamples; // check whether this exceeds the current in-buffer if (((int) (outSamples2inSamples((double) writeCount)+dPos))>=inSampleCount) { int lastOutIndex=((int) (inSamples2outSamples(((double) inSampleCount)-dPos)))+1; // normally, the above formula gives the exact writeCount. // but due to rounding issues, sometimes it has to be decremented once. // so we need to iterate to get the last index and then increment it once to make // it the writeCount (=the number of samples to write) while ((int) (outSamples2inSamples((double) lastOutIndex)+dPos)>=inSampleCount) { lastOutIndex--; if (DEBUG_STREAM) { TDebug.out("--------- Decremented lastOutIndex="+lastOutIndex); } } if (DEBUG_STREAM_PROBLEMS) { int testLastOutIndex=writeCount-1; if (DEBUG_STREAM_PROBLEMS) { while ((int) (outSamples2inSamples((double) testLastOutIndex)+dPos)>=inSampleCount) { testLastOutIndex--; } } if (testLastOutIndex!=lastOutIndex) { TDebug.out("lastOutIndex wrong: lastOutIndex="+lastOutIndex+" testLastOutIndex="+testLastOutIndex+" !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); } } writeCount=lastOutIndex+1; } // finally do the actual conversion - separated per channel for (int channel=0; channel0) { targetSampleRate=sr; //((SRCAudioFormat) getFormat()).setSampleRate(sr); resizeBuffers(); } } public synchronized void setConversionAlgorithm(int algo) { if ((algo==SAMPLE_AND_HOLD || algo==LINEAR_INTERPOLATION) && (algo!=conversionAlgorithm)) { conversionAlgorithm=algo; resizeBuffers(); } } public synchronized float getTargetSampleRate() { return targetSampleRate; } public synchronized int getConversionAlgorithm() { return conversionAlgorithm; } } /** Obviously, this class is used to be able to set the frame rate/sample rate after the AudioFormat object has been created. It assumes the PCM case where the frame rate is always in sync with the sample rate. (MP) */ public static class SRCAudioFormat extends AudioFormat { private float sampleRate; public SRCAudioFormat(AudioFormat targetFormat) { super(targetFormat.getEncoding(), targetFormat.getSampleRate(), targetFormat.getSampleSizeInBits(), targetFormat.getChannels(), targetFormat.getChannels()*targetFormat.getSampleSizeInBits()/8, targetFormat.getSampleRate(), targetFormat.isBigEndian()); this.sampleRate=targetFormat.getSampleRate(); } public void setSampleRate(float sr) { if (sr>0) { this.sampleRate=sr; } } public float getSampleRate() { return this.sampleRate; } public float getFrameRate() { return this.sampleRate; } } } /*** SampleRateConversionProvider.java ***/ ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootlibtritonus-java-20070428/src/classes/org/tritonus/sampled/convert/SmartFormatConversionProvider.javalibtritonus-java-20070428/src/classes/org/tritonus/sampled/convert/SmartFormatConversionProvider.jav0000644000175000017500000002162710540343375033762 0ustar twernertwerner/* * SmartFormatConversionProvider.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2000 - 2004 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.sampled.convert; import java.util.HashSet; import java.util.Set; import javax.sound.sampled.AudioFormat; import javax.sound.sampled.AudioInputStream; import javax.sound.sampled.AudioSystem; import org.tritonus.share.sampled.convert.TFormatConversionProvider; // Name suggested by Florian: MetaFormatConversionProvider /* Additinal explanation: > Ich hab mal kurz in den SmartConverter reingeguckt, warum machst Du das mit den > Threads ? In Rekursion wird doch nicht ein neuer Thread benutzt ? Und sonst > koennte man das doch mit synchronized bzw. einem echten lock machen ? Bei der Rekursion bezu"glich der selben Konvertersuche befindet man sich im gleichen Thread; diese Eigenschaft nutze ich ja gerade aus. Es kann aber das Anwendungsprogramm von mehreren Threads aus gleichzeitig einen Konverter anfordern. Diese Aufrufe gehen alle in das gleiche SmartF.C.P. Objekt (es gibt nur eins). Die Methoden des Konverters (das gilt fu"r alle) mu"ssen also reentrant sein. Die Alternative wa"re ein globaler Lock. Das halte ich aber fu"r nicht akzeptabel. Bei meiner Soundmachine zum Beispiel wu"rde das zu Problemen fu"hren: da ist es no"tig, da? beim Abspielen mehrere Kana"le on the fly konvertiert wird. Ein globaler Lock wu"rde zu Verzo"gerungen im Abspielen fu"hren. Die "einfache" Variante der Rekursionserkennung (ohne Beru"cksichtigung von Threads) braucht nur ein einfaches Flag, das gesetzt wird, wenn keine Rekursion mehr stattfinden soll. Dieses Flag wird bei meiner Implementierung mit der Hashtabelle realisiert; sie simuliert ein thread-lokales Verhalten dieses Flags. Alles klar? Ich seh' ein, man braucht zwei Knoten im Hirn, um das zu verstehen... */ /** "Smart" formatConversionProvider. * This FormatConversionProvider tries to find combinations of other * FormatConversionProviders so that the chain of these providers fulfill the request for a * format conversion given to this provider. * * @author Matthias Pfisterer */ public class SmartFormatConversionProvider extends TFormatConversionProvider { /** Stores the threads currently blocked. * To avoid recursion, this class stores which threads have already "passed" * methods of this class once. On entry of a method prone to recursion, it is * checked if the current thread is in the set. If so, this indicates a recursion * and the method will return immediately. If not, the current thread is entered * this data structure, so that further invocations can detect a recursion. On * exit of this method, it is removed from this data structure to indicate it is * "free". */ private Set m_blockedThreads; public SmartFormatConversionProvider() { m_blockedThreads = new HashSet(); } // TODO: can use AudioSystem to return all source encodings? (don't forget to block!) public AudioFormat.Encoding[] getSourceEncodings() { return EMPTY_ENCODING_ARRAY; } // TODO: can use AudioSystem to return all target encodings? (don't forget to block!) public AudioFormat.Encoding[] getTargetEncodings() { return EMPTY_ENCODING_ARRAY; } public AudioFormat.Encoding[] getTargetEncodings( AudioFormat sourceFormat) { // TODO: return null; } public boolean isConversionSupported( AudioFormat.Encoding targetEncoding, AudioFormat sourceFormat) { return false; } public AudioFormat[] getTargetFormats( AudioFormat.Encoding targetEncoding, AudioFormat sourceFormat) { return null; } public boolean isConversionSupported( AudioFormat targetFormat, AudioFormat sourceFormat) { if (isCurrentThreadBlocked()) { return false; } AudioFormat[] aIntermediateFormats = getIntermediateFormats(sourceFormat, targetFormat); return aIntermediateFormats != null; } public AudioInputStream getAudioInputStream( AudioFormat.Encoding targetEncoding, AudioInputStream audioInputStream) { return null; } public AudioInputStream getAudioInputStream( AudioFormat targetFormat, AudioInputStream audioInputStream) { return null; } /* * Search for converter chain. */ /* * * @return an array of intermediate formats (possibly of length 0 if it's possible * to do the conversion in one step) or null if the conversion is not * possible. */ private AudioFormat[] getIntermediateFormats(AudioFormat sourceFormat, AudioFormat targetFormat) { AudioFormat.Encoding sourceEncoding = sourceFormat.getEncoding(); AudioFormat.Encoding targetEncoding = targetFormat.getEncoding(); blockCurrentThread(); boolean bDirectConversionPossible = AudioSystem.isConversionSupported(targetFormat, sourceFormat); unblockCurrentThread(); if (bDirectConversionPossible) { return EMPTY_FORMAT_ARRAY; } else if (isPCM(sourceEncoding) && isPCM(targetEncoding)) { /* * The SR converter is not yet implemented. The PCM2PCM converter * should handle all other cases. */ return null; /* eventually block */ } else if (!isPCM(sourceEncoding)) { AudioFormat intermediateFormat = new AudioFormat( AudioFormat.Encoding.PCM_SIGNED, sourceFormat.getSampleRate(), sourceFormat.getSampleSizeInBits(), sourceFormat.getChannels(), AudioSystem.NOT_SPECIFIED, sourceFormat.getSampleRate(), true); blockCurrentThread(); AudioFormat[] aPreIntermediateFormats = getIntermediateFormats(sourceFormat, intermediateFormat); unblockCurrentThread(); AudioFormat[] aPostIntermediateFormats = getIntermediateFormats(intermediateFormat, targetFormat); if (aPreIntermediateFormats != null && aPostIntermediateFormats != null) { AudioFormat[] aIntermediateFormats = new AudioFormat[aPreIntermediateFormats.length + 1 + aPostIntermediateFormats.length]; System.arraycopy(aPreIntermediateFormats, 0, aIntermediateFormats, 0, aPreIntermediateFormats.length); aIntermediateFormats[aPreIntermediateFormats.length] = intermediateFormat; System.arraycopy(aPostIntermediateFormats, 0, aIntermediateFormats, aPreIntermediateFormats.length, aPostIntermediateFormats.length); return aIntermediateFormats; } else { return null; } } else if (!isPCM(targetEncoding)) { AudioFormat intermediateFormat = new AudioFormat( AudioFormat.Encoding.PCM_SIGNED, targetFormat.getSampleRate(), targetFormat.getSampleSizeInBits(), targetFormat.getChannels(), AudioSystem.NOT_SPECIFIED, targetFormat.getSampleRate(), true); AudioFormat[] aPreIntermediateFormats = getIntermediateFormats(sourceFormat, intermediateFormat); blockCurrentThread(); AudioFormat[] aPostIntermediateFormats = getIntermediateFormats(intermediateFormat, targetFormat); unblockCurrentThread(); if (aPreIntermediateFormats != null && aPostIntermediateFormats != null) { AudioFormat[] aIntermediateFormats = new AudioFormat[aPreIntermediateFormats.length + 1 + aPostIntermediateFormats.length]; System.arraycopy(aPreIntermediateFormats, 0, aIntermediateFormats, 0, aPreIntermediateFormats.length); aIntermediateFormats[aPreIntermediateFormats.length] = intermediateFormat; System.arraycopy(aPostIntermediateFormats, 0, aIntermediateFormats, aPreIntermediateFormats.length, aPostIntermediateFormats.length); return aIntermediateFormats; } else { return null; } } else { return null; } } /* * General helper methods. */ private static boolean isPCM(AudioFormat.Encoding encoding) { return encoding.equals(AudioFormat.Encoding.PCM_SIGNED) || encoding.equals(AudioFormat.Encoding.PCM_SIGNED); } protected static boolean isSignedPCM(AudioFormat.Encoding encoding) { return encoding.equals(AudioFormat.Encoding.PCM_SIGNED); } /* * Methods for recursion detection/blocking. */ private boolean isCurrentThreadBlocked() { return m_blockedThreads.contains(Thread.currentThread()); } private void blockCurrentThread() { m_blockedThreads.add(Thread.currentThread()); } private void unblockCurrentThread() { m_blockedThreads.remove(Thread.currentThread()); } } /*** SmartFormatConversionProvider.java ***/ ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootlibtritonus-java-20070428/src/classes/org/tritonus/sampled/convert/UlawFormatConversionProvider.javalibtritonus-java-20070428/src/classes/org/tritonus/sampled/convert/UlawFormatConversionProvider.java0000644000175000017500000002532410540342625033740 0ustar twernertwerner/* * UlawFormatConversionProvider.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999,2000 by Florian Bomers * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.sampled.convert; import java.util.Arrays; import javax.sound.sampled.AudioSystem; import javax.sound.sampled.AudioFormat; import javax.sound.sampled.AudioInputStream; import org.tritonus.share.sampled.AudioFormats; import org.tritonus.share.sampled.TConversionTool; import org.tritonus.share.sampled.convert.TEncodingFormatConversionProvider; import org.tritonus.share.sampled.convert.TSynchronousFilteredAudioInputStream; /** * This provider (currently) supports these conversions: *
  • PCM 8 Signed -> ulaw *
  • PCM 8 Unsigned -> ulaw *
  • PCM 16 signed big endian -> ulaw *
  • PCM 16 signed little endian -> ulaw *
  • alaw -> ulaw *
* and vice versa. *

FrameRate, SampleRate, Channels CANNOT be converted. * * @author Florian Bomers */ public class UlawFormatConversionProvider extends TEncodingFormatConversionProvider { private static final int ALL=AudioSystem.NOT_SPECIFIED; public static AudioFormat.Encoding ENC_PCM_SIGNED=new AudioFormat.Encoding("PCM_SIGNED"); public static AudioFormat.Encoding ENC_PCM_UNSIGNED=new AudioFormat.Encoding("PCM_UNSIGNED"); public static AudioFormat.Encoding ENC_ULAW=new AudioFormat.Encoding("ULAW"); public static AudioFormat.Encoding ENC_ALAW=new AudioFormat.Encoding("ALAW"); // TODO: // make a superclass that takes 2 arrays in the constructor // then, it checks whether conversion from the first array to the second // or vice versa is possible. // in the current implementation, isConversionSupported also returns true // for e.g. source=ALAW and target=PCM_SIGNED // when the converted stream is actually requested, an exception occurs for these cases // this new superclass wouldn't distinguish between source and target formats. private static final AudioFormat[] OUTPUT_FORMATS = { new AudioFormat(ENC_PCM_SIGNED, ALL, 8, ALL, ALL, ALL, false), new AudioFormat(ENC_PCM_SIGNED, ALL, 8, ALL, ALL, ALL, false), new AudioFormat(ENC_PCM_UNSIGNED, ALL, 8, ALL, ALL, ALL, false), new AudioFormat(ENC_PCM_UNSIGNED, ALL, 8, ALL, ALL, ALL, false), new AudioFormat(ENC_PCM_SIGNED, ALL, 8, ALL, ALL, ALL, true), new AudioFormat(ENC_PCM_SIGNED, ALL, 8, ALL, ALL, ALL, true), new AudioFormat(ENC_PCM_UNSIGNED, ALL, 8, ALL, ALL, ALL, true), new AudioFormat(ENC_PCM_UNSIGNED, ALL, 8, ALL, ALL, ALL, true), new AudioFormat(ENC_PCM_SIGNED, ALL, 16, ALL, ALL, ALL, false), new AudioFormat(ENC_PCM_SIGNED, ALL, 16, ALL, ALL, ALL, false), new AudioFormat(ENC_PCM_SIGNED, ALL, 16, ALL, ALL, ALL, true), new AudioFormat(ENC_PCM_SIGNED, ALL, 16, ALL, ALL, ALL, true), new AudioFormat(ENC_ALAW, ALL, 8, ALL, ALL, ALL, false), new AudioFormat(ENC_ALAW, ALL, 8, ALL, ALL, ALL, true), new AudioFormat(ENC_ULAW, ALL, 8, ALL, ALL, ALL, false), new AudioFormat(ENC_ULAW, ALL, 8, ALL, ALL, ALL, true) }; /** Constructor. */ public UlawFormatConversionProvider() { super(Arrays.asList(OUTPUT_FORMATS), Arrays.asList(OUTPUT_FORMATS)); } public AudioInputStream getAudioInputStream(AudioFormat targetFormat, AudioInputStream sourceStream) { AudioFormat sourceFormat=sourceStream.getFormat(); // the non-conversion case // TODO: does this work OK when some fields are AudioSystem.NOT_SPECIFIED ? if (AudioFormats.matches(sourceFormat, targetFormat)) { return sourceStream; } if (doMatch(targetFormat.getFrameRate(), sourceFormat.getFrameRate()) && doMatch(targetFormat.getChannels(), sourceFormat.getChannels())) { if (doMatch(targetFormat.getSampleSizeInBits(),8) && targetFormat.getEncoding().equals(ENC_ULAW)) { // OK, the targetFormat seems fine, so we convert it to ULAW // let the remaining checks be done by ToUlawStream return new ToUlawStream(sourceStream); } else if (doMatch(sourceFormat.getSampleSizeInBits(),8) && sourceFormat.getEncoding().equals(ENC_ULAW)) { // convert ULAW to the target format return new FromUlawStream(sourceStream, targetFormat); } } throw new IllegalArgumentException("format conversion not supported"); } private static final int UNSIGNED8=1; private static final int SIGNED8=2; private static final int BIG_ENDIAN16=3; private static final int LITTLE_ENDIAN16=4; private static final int ALAW=5; protected boolean isSupportedFormat(AudioFormat format) { return getConvertType(format)!=0; } protected int getConvertType(AudioFormat af) { int result=0; AudioFormat.Encoding encoding=af.getEncoding(); boolean bigEndian=af.isBigEndian(); int ssib=af.getSampleSizeInBits(); // now set up the convert type if (encoding.equals(ENC_PCM_SIGNED)) { if (ssib==16) { if (bigEndian) { result=BIG_ENDIAN16; } else { result=LITTLE_ENDIAN16; } } else if (ssib==8) { result=SIGNED8; } } else if (encoding.equals(ENC_PCM_UNSIGNED)) { if (ssib==8) { result=UNSIGNED8; } } else if (encoding.equals(ENC_ALAW)) { result=ALAW; } return result; } class ToUlawStream extends TSynchronousFilteredAudioInputStream { private int convertType; public ToUlawStream(AudioInputStream sourceStream) { // transform the targetFormat so that // FrameRate, SampleRate, and Channels match the sourceFormat // we only retain encoding, samplesize and endian of targetFormat. super (sourceStream, new AudioFormat( ENC_ULAW, sourceStream.getFormat().getSampleRate(), 8, sourceStream.getFormat().getChannels(), sourceStream.getFormat().getChannels(), // sampleSize sourceStream.getFormat().getFrameRate(), sourceStream.getFormat().isBigEndian())); convertType=getConvertType(sourceStream.getFormat()); if (sourceStream.getFormat().getSampleSizeInBits() == 8) { enableConvertInPlace(); } if (convertType==0) throw new IllegalArgumentException("format conversion not supported"); } protected int convert(byte[] inBuffer, byte[] outBuffer, int outByteOffset, int inFrameCount) { int sampleCount=inFrameCount*getFormat().getChannels(); switch (convertType) { case UNSIGNED8: TConversionTool.pcm82ulaw (inBuffer, 0, outBuffer, outByteOffset, sampleCount, false); break; case SIGNED8: TConversionTool.pcm82ulaw (inBuffer, 0, outBuffer, outByteOffset, sampleCount, true); break; case BIG_ENDIAN16: TConversionTool.pcm162ulaw (inBuffer, 0, outBuffer, outByteOffset, sampleCount, true); break; case LITTLE_ENDIAN16: TConversionTool.pcm162ulaw (inBuffer, 0, outBuffer, outByteOffset, sampleCount, false); break; case ALAW: TConversionTool.alaw2ulaw (inBuffer, 0, outBuffer, outByteOffset, sampleCount); break; } return inFrameCount; } protected void convertInPlace(byte[] buffer, int byteOffset, int frameCount) { int sampleCount=frameCount*getFormat().getChannels(); switch (convertType) { case UNSIGNED8: TConversionTool.pcm82ulaw (buffer, byteOffset, sampleCount, false); break; case SIGNED8: TConversionTool.pcm82ulaw (buffer, byteOffset, sampleCount, true); break; case ALAW: TConversionTool.alaw2ulaw (buffer, byteOffset, sampleCount); break; default: throw new RuntimeException ("ToUlawStream: Call to convertInPlace, but it cannot convert in place."); } } } class FromUlawStream extends TSynchronousFilteredAudioInputStream { private int convertType; public FromUlawStream(AudioInputStream sourceStream, AudioFormat targetFormat) { // transform the targetFormat so that // FrameRate, SampleRate, and Channels match the sourceFormat // we only retain encoding, samplesize and endian of targetFormat. super (sourceStream, new AudioFormat( targetFormat.getEncoding(), sourceStream.getFormat().getSampleRate(), targetFormat.getSampleSizeInBits(), sourceStream.getFormat().getChannels(), targetFormat.getSampleSizeInBits()*sourceStream.getFormat().getChannels()/8, sourceStream.getFormat().getFrameRate(), targetFormat.isBigEndian())); convertType=getConvertType(getFormat()); if (targetFormat.getSampleSizeInBits() == 8) { enableConvertInPlace(); } if (convertType==0) throw new IllegalArgumentException("format conversion not supported"); } protected int convert(byte[] inBuffer, byte[] outBuffer, int outByteOffset, int inFrameCount) { int sampleCount=inFrameCount*getFormat().getChannels(); switch (convertType) { case UNSIGNED8: TConversionTool.ulaw2pcm8 (inBuffer, 0, outBuffer, outByteOffset, sampleCount, false); break; case SIGNED8: TConversionTool.ulaw2pcm8 (inBuffer, 0, outBuffer, outByteOffset, sampleCount, true); break; case BIG_ENDIAN16: TConversionTool.ulaw2pcm16 (inBuffer, 0, outBuffer, outByteOffset, sampleCount, true); break; case LITTLE_ENDIAN16: TConversionTool.ulaw2pcm16 (inBuffer, 0, outBuffer, outByteOffset, sampleCount, false); break; case ALAW: TConversionTool.ulaw2alaw (inBuffer, 0, outBuffer, outByteOffset, sampleCount); break; } return inFrameCount; } protected void convertInPlace(byte[] buffer, int byteOffset, int frameCount) { int sampleCount=frameCount*format.getChannels(); switch (convertType) { case UNSIGNED8: TConversionTool.ulaw2pcm8 (buffer, byteOffset, sampleCount, false); break; case SIGNED8: TConversionTool.ulaw2pcm8 (buffer, byteOffset, sampleCount, true); break; case ALAW: TConversionTool.ulaw2alaw (buffer, byteOffset, sampleCount); break; default: throw new RuntimeException ("FromUlawStream: Call to convertInPlace, but it cannot convert in place."); } } } } /*** UlawFormatConversionProvider.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/sampled/convert/package.html0000644000175000017500000000034310172460775027516 0ustar twernertwerner

Standard format converters (A-law, μ-law, PCM, sample rate). The classes provided here .

libtritonus-java-20070428/src/classes/org/tritonus/sampled/convert/jorbis/0000755000175000017500000000000010621572467026526 5ustar twernertwerner././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootlibtritonus-java-20070428/src/classes/org/tritonus/sampled/convert/jorbis/JorbisFormatConversionProvider.javalibtritonus-java-20070428/src/classes/org/tritonus/sampled/convert/jorbis/JorbisFormatConversionProv0000644000175000017500000004664310374142165033775 0ustar twernertwerner/* * JorbisFormatConversionProvider.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999 - 2003 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.sampled.convert.jorbis; import java.io.EOFException; import java.io.InputStream; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.Iterator; import java.util.List; import javax.sound.sampled.AudioFormat; import javax.sound.sampled.AudioInputStream; import javax.sound.sampled.AudioSystem; import org.tritonus.share.TDebug; import org.tritonus.share.sampled.AudioFormats; import org.tritonus.share.sampled.convert.TAsynchronousFilteredAudioInputStream; import org.tritonus.share.sampled.convert.TEncodingFormatConversionProvider; import com.jcraft.jogg.SyncState; import com.jcraft.jogg.StreamState; import com.jcraft.jogg.Page; import com.jcraft.jogg.Packet; import com.jcraft.jorbis.Info; import com.jcraft.jorbis.Comment; import com.jcraft.jorbis.DspState; import com.jcraft.jorbis.Block; /** Pure-java decoder for ogg vorbis streams. The FormatConversionProvider uses the pure-java ogg vorbis decoder from www.jcraft.com/jorbis/. @author Matthias Pfisterer */ public class JorbisFormatConversionProvider extends TEncodingFormatConversionProvider { // only used as abbreviation private static final AudioFormat.Encoding VORBIS = new AudioFormat.Encoding("VORBIS"); private static final AudioFormat.Encoding PCM_SIGNED = new AudioFormat.Encoding("PCM_SIGNED"); private static final AudioFormat[] INPUT_FORMATS = { // mono // TODO: mechanism to make the double specification with // different endianess obsolete. new AudioFormat(VORBIS, -1.0F, -1, 1, -1, -1.0F, false), new AudioFormat(VORBIS, -1.0F, -1, 1, -1, -1.0F, true), // stereo new AudioFormat(VORBIS, -1.0F, -1, 2, -1, -1.0F, false), new AudioFormat(VORBIS, -1.0F, -1, 2, -1, -1.0F, true), // TODO: other channel configurations }; private static final AudioFormat[] OUTPUT_FORMATS = { // mono, 16 bit signed new AudioFormat(PCM_SIGNED, -1.0F, 16, 1, 2, -1.0F, false), new AudioFormat(PCM_SIGNED, -1.0F, 16, 1, 2, -1.0F, true), // stereo, 16 bit signed new AudioFormat(PCM_SIGNED, -1.0F, 16, 2, 4, -1.0F, false), new AudioFormat(PCM_SIGNED, -1.0F, 16, 2, 4, -1.0F, true), // TODO: other channel configurations }; /** Constructor. */ // TODO: check interaction with base class public JorbisFormatConversionProvider() { super(Arrays.asList(INPUT_FORMATS), Arrays.asList(OUTPUT_FORMATS)/*, true, // new behaviour false*/); // bidirectional .. constants UNIDIR../BIDIR..? } public AudioInputStream getAudioInputStream(AudioFormat targetFormat, AudioInputStream audioInputStream) { /** The AudioInputStream to return. */ AudioInputStream convertedAudioInputStream = null; if (TDebug.TraceAudioConverter) { TDebug.out(">JorbisFormatConversionProvider.getAudioInputStream(): begin"); TDebug.out("checking if conversion supported"); TDebug.out("from: " + audioInputStream.getFormat()); TDebug.out("to: " + targetFormat); } // what is this ??? targetFormat=getDefaultTargetFormat(targetFormat, audioInputStream.getFormat()); if (isConversionSupported(targetFormat, audioInputStream.getFormat())) { if (TDebug.TraceAudioConverter) { TDebug.out("conversion supported; trying to create DecodedJorbisAudioInputStream"); } convertedAudioInputStream = new DecodedJorbisAudioInputStream( targetFormat, audioInputStream); } else { if (TDebug.TraceAudioConverter) { TDebug.out("conversion not supported; throwing IllegalArgumentException"); TDebug.out("<"); } throw new IllegalArgumentException("conversion not supported"); } if (TDebug.TraceAudioConverter) { TDebug.out(" m_songComments = new ArrayList(); // is altered later in a dubious way private int convsize = -1; // BUFFER_SIZE * 2; // TODO: further checking private byte[] convbuffer = new byte[CONVSIZE]; private float[][][] _pcmf = null; private int[] _index = null; // TODO: introduce state variable private boolean m_bHeadersExpected; /** * Constructor. */ public DecodedJorbisAudioInputStream(AudioFormat outputFormat, AudioInputStream bitStream) { super(outputFormat, AudioSystem.NOT_SPECIFIED); if (TDebug.TraceAudioConverter) { TDebug.out("DecodedJorbisAudioInputStream.(): begin"); } m_oggBitStream = bitStream; m_bHeadersExpected = true; init_jorbis(); if (TDebug.TraceAudioConverter) { TDebug.out("DecodedJorbisAudioInputStream.(): end"); } } /** * Initializes all the jOrbis and jOgg vars that are used for song playback. */ private void init_jorbis() { m_oggSyncState = new SyncState(); m_oggStreamState = new StreamState(); m_oggPage = new Page(); m_oggPacket = new Packet(); m_vorbisInfo = new Info(); m_vorbisComment = new Comment(); m_vorbisDspState = new DspState(); m_vorbisBlock = new Block(m_vorbisDspState); m_oggSyncState.init(); } /** Callback from circular buffer. */ public void execute() { if (TDebug.TraceAudioConverter) TDebug.out(">DecodedJorbisAudioInputStream.execute(): begin"); if (m_bHeadersExpected) { if (TDebug.TraceAudioConverter) TDebug.out("reading headers..."); // Headers (+ Comments). try { readHeaders(); } catch (IOException e) { if (TDebug.TraceAllExceptions) { TDebug.out(e); } closePhysicalStream(); if (TDebug.TraceAudioConverter) TDebug.out(" 0) { float[][] pcmf = _pcmf[0]; int bout = (samples < convsize ? samples : convsize); // convert floats to signed ints and // interleave for (int nChannel = 0; nChannel < m_vorbisInfo.channels; nChannel++) { int pointer = nChannel * getSampleSizeInBytes(); int mono = _index[nChannel]; for (int j = 0; j < bout; j++) { float fVal = pcmf[nChannel][mono + j]; clipAndWriteSample(fVal, pointer); pointer += getFrameSize(); } } m_vorbisDspState.synthesis_read(bout); getCircularBuffer().write(convbuffer, 0, getFrameSize() * bout); } } /** Scale and clip the sample and write it to convbuffer. */ private void clipAndWriteSample(float fSample, int nPointer) { int nSample; // TODO: check if clipping is necessary if (fSample > 1.0F) { fSample = 1.0F; } if (fSample < -1.0F) { fSample = -1.0F; } switch (getFormat().getSampleSizeInBits()) { case 16: nSample = (int) (fSample * 32767.0F); if (isBigEndian()) { convbuffer[nPointer++] = (byte) (nSample >> 8); convbuffer[nPointer] = (byte) (nSample & 0xFF); } else { convbuffer[nPointer++] = (byte) (nSample & 0xFF); convbuffer[nPointer] = (byte) (nSample >> 8); } break; case 24: nSample = (int) (fSample * 8388607.0F); if (isBigEndian()) { convbuffer[nPointer++] = (byte) (nSample >> 16); convbuffer[nPointer++] = (byte) ((nSample >>> 8) & 0xFF); convbuffer[nPointer] = (byte) (nSample & 0xFF); } else { convbuffer[nPointer++] = (byte) (nSample & 0xFF); convbuffer[nPointer++] = (byte) ((nSample >>> 8) & 0xFF); convbuffer[nPointer] = (byte) (nSample >> 16); } break; case 32: nSample = (int) (fSample * 2147483647.0F); if (isBigEndian()) { convbuffer[nPointer++] = (byte) (nSample >> 24); convbuffer[nPointer++] = (byte) ((nSample >>> 16) & 0xFF); convbuffer[nPointer++] = (byte) ((nSample >>> 8) & 0xFF); convbuffer[nPointer] = (byte) (nSample & 0xFF); } else { convbuffer[nPointer++] = (byte) (nSample & 0xFF); convbuffer[nPointer++] = (byte) ((nSample >>> 8) & 0xFF); convbuffer[nPointer++] = (byte) ((nSample >>> 16) & 0xFF); convbuffer[nPointer] = (byte) (nSample >> 24); } break; } } /** Read an ogg packet. This method does everything necessary to read an ogg packet. If needed, it calls {@link #readOggPage readOggPage()}, which, in turn, may read more data from the stream. The resulting packet is placed in {@link #m_oggPacket m_oggPacket} (for which the reference is not altered; is has to be initialized before). */ private void readOggPacket() throws IOException { while (true) { int result = m_oggStreamState.packetout(m_oggPacket); if (result == 1) { return; } if (result == -1) { throw new IOException("can't read packet"); } readOggPage(); if (m_oggStreamState.pagein(m_oggPage) < 0) { throw new IOException("can't read page of Ogg bitstream data"); } } } /** Read an ogg page. This method does everything necessary to read an ogg page. If needed, it reads more data from the stream. The resulting page is placed in {@link #m_oggPage m_oggPage} (for which the reference is not altered; is has to be initialized before). Note: this method doesn't deliver the page read to a StreamState object (which assembles pages to packets). This has to be done by the caller. */ private void readOggPage() throws IOException { while (true) { int result = m_oggSyncState.pageout(m_oggPage); if (result == 1) { return; } // we need more data from the stream int nIndex = m_oggSyncState.buffer(BUFFER_SIZE); // TODO: call stream.read() directly int nBytes = readFromStream(m_oggSyncState.data, nIndex, BUFFER_SIZE); // TODO: This clause should become obsolete; readFromStream() should // propagate exceptions directly. if (nBytes == -1) { throw new EOFException(); } m_oggSyncState.wrote(nBytes); } } /** Read raw data from to ogg bitstream. Reads from {@ #m_oggBitStream m_oggBitStream} a specified number of bytes into a buffer, starting at a specified buffer index. @param buffer the where the read data should be put into. Its length has to be at least nStart + nLength. @param nStart @param nLength the number of bytes to read @return the number of bytes read (maybe 0) or -1 if there is no more data in the stream. */ private int readFromStream(byte[] buffer, int nStart, int nLength) throws IOException { return m_oggBitStream.read(buffer, nStart, nLength); } /** */ private int getSampleSizeInBytes() { return getFormat().getFrameSize() / getFormat().getChannels(); } /** . @return . */ private int getFrameSize() { return getFormat().getFrameSize(); } /** Returns if this stream (the decoded one) is big endian. @return true if this stream is big endian. */ private boolean isBigEndian() { return getFormat().isBigEndian(); } /** * */ public void close() throws IOException { super.close(); m_oggBitStream.close(); } } } /*** JorbisFormatConversionProvider.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/sampled/convert/jorbis/package.html0000644000175000017500000000032310172460776031005 0ustar twernertwerner

Ogg vorbis decoder based on the jorbis library. The classes provided here .

libtritonus-java-20070428/src/classes/org/tritonus/sampled/convert/pvorbis/0000755000175000017500000000000010621572470026714 5ustar twernertwerner././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootlibtritonus-java-20070428/src/classes/org/tritonus/sampled/convert/pvorbis/VorbisFormatConversionProvider.javalibtritonus-java-20070428/src/classes/org/tritonus/sampled/convert/pvorbis/VorbisFormatConversionPro0000644000175000017500000007243010375317546034020 0ustar twernertwerner/* * VorbisFormatConversionProvider.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999 - 2004 by Matthias Pfisterer * Copyright (c) 2001 by Florian Bomers * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.sampled.convert.pvorbis; import java.io.EOFException; import java.io.InputStream; import java.io.IOException; import java.util.Arrays; import java.util.Iterator; import java.util.List; import java.util.Random; import javax.sound.sampled.AudioFormat; import javax.sound.sampled.AudioInputStream; import javax.sound.sampled.AudioSystem; import org.tritonus.lowlevel.pogg.Packet; import org.tritonus.lowlevel.pogg.Page; import org.tritonus.lowlevel.pogg.StreamState; import org.tritonus.lowlevel.pogg.SyncState; import org.tritonus.lowlevel.pvorbis.Block; import org.tritonus.lowlevel.pvorbis.Comment; import org.tritonus.lowlevel.pvorbis.DspState; import org.tritonus.lowlevel.pvorbis.Info; import org.tritonus.share.TDebug; import org.tritonus.share.sampled.AudioFormats; import org.tritonus.share.sampled.convert.TAsynchronousFilteredAudioInputStream; import org.tritonus.share.sampled.convert.TEncodingFormatConversionProvider; /** ConversionProvider for ogg vorbis encoding. This FormatConversionProvider uses the native libraries libogg, libvorbis and libvorbisenc to implement encoding to ogg vorbis. @author Matthias Pfisterer */ public class VorbisFormatConversionProvider extends TEncodingFormatConversionProvider { // only used as abbreviation private static final AudioFormat.Encoding VORBIS = new AudioFormat.Encoding("VORBIS"); private static final AudioFormat.Encoding PCM_SIGNED = new AudioFormat.Encoding("PCM_SIGNED"); private static final AudioFormat[] INPUT_FORMATS = { // mono, 16 bit signed new AudioFormat(PCM_SIGNED, -1.0F, 16, 1, 2, -1.0F, false), new AudioFormat(PCM_SIGNED, -1.0F, 16, 1, 2, -1.0F, true), // stereo, 16 bit signed new AudioFormat(PCM_SIGNED, -1.0F, 16, 2, 4, -1.0F, false), new AudioFormat(PCM_SIGNED, -1.0F, 16, 2, 4, -1.0F, true), // TODO: other channel configurations // mono // TODO: mechanism to make the double specification with // different endianess obsolete. new AudioFormat(VORBIS, -1.0F, -1, 1, -1, -1.0F, false), new AudioFormat(VORBIS, -1.0F, -1, 1, -1, -1.0F, true), // stereo new AudioFormat(VORBIS, -1.0F, -1, 2, -1, -1.0F, false), new AudioFormat(VORBIS, -1.0F, -1, 2, -1, -1.0F, true), // TODO: other channel configurations }; // private static final AudioFormat[] OUTPUT_FORMATS = // { // // mono // // TODO: mechanism to make the double specification with // // different endianess obsolete. // new AudioFormat(VORBIS, -1.0F, -1, 1, -1, -1.0F, false), // new AudioFormat(VORBIS, -1.0F, -1, 1, -1, -1.0F, true), // // stereo // new AudioFormat(VORBIS, -1.0F, -1, 2, -1, -1.0F, false), // new AudioFormat(VORBIS, -1.0F, -1, 2, -1, -1.0F, true), // // TODO: other channel configurations // }; /* Default settings for encoding. */ private static final boolean DEFAULT_VBR = true; private static final float DEFAULT_QUALITY = 0.5F; private static final int DEFAULT_MAX_BITRATE = 256; private static final int DEFAULT_NOM_BITRATE = 128; private static final int DEFAULT_MIN_BITRATE = 32; /** Constructor. */ public VorbisFormatConversionProvider() { super(Arrays.asList(INPUT_FORMATS), Arrays.asList(INPUT_FORMATS)//, //Arrays.asList(OUTPUT_FORMATS), /* true, // new behaviour false*/); // bidirectional .. constants UNIDIR../BIDIR..? if (TDebug.TraceAudioConverter) { TDebug.out("VorbisFormatConversionProvider.(): begin"); } if (TDebug.TraceAudioConverter) { TDebug.out("VorbisFormatConversionProvider.(): end"); } } public AudioInputStream getAudioInputStream(AudioFormat targetFormat, AudioInputStream audioInputStream) { if (TDebug.TraceAudioConverter) { TDebug.out(">VorbisFormatConversionProvider.getAudioInputStream(): begin"); } /** The AudioInputStream to return. */ AudioInputStream convertedAudioInputStream = null; if (TDebug.TraceAudioConverter) { TDebug.out("checking if conversion supported"); TDebug.out("from: " + audioInputStream.getFormat()); TDebug.out("to: " + targetFormat); } // what is this ??? targetFormat = getDefaultTargetFormat(targetFormat, audioInputStream.getFormat()); if (isConversionSupported(targetFormat, audioInputStream.getFormat())) { if (targetFormat.getEncoding().equals(VORBIS)) { if (TDebug.TraceAudioConverter) TDebug.out("conversion supported; trying to create EncodedVorbisAudioInputStream"); convertedAudioInputStream = new EncodedVorbisAudioInputStream( targetFormat, audioInputStream); } else { if (TDebug.TraceAudioConverter) { TDebug.out("conversion supported; trying to create DecodedVorbisAudioInputStream"); } convertedAudioInputStream = new DecodedVorbisAudioInputStream( targetFormat, audioInputStream); } } else { if (TDebug.TraceAudioConverter) { TDebug.out("EncodedVorbisAudioInputStream.(): begin"); } m_decodedStream = inputStream; m_abReadbuffer = new byte[READ * getFrameSize()]; Object property = null; property = outputFormat.getProperty("vbr"); boolean bUseVBR = DEFAULT_VBR; if (property instanceof Boolean) { bUseVBR = ((Boolean) property).booleanValue(); } property = outputFormat.getProperty("quality"); float fQuality = DEFAULT_QUALITY; if (property instanceof Integer) { fQuality = ((Integer) property).intValue() / 10.0F; } property = outputFormat.getProperty("bitrate"); int nNominalBitrate = DEFAULT_NOM_BITRATE; if (property instanceof Integer) { nNominalBitrate = ((Integer) property).intValue() / 1024; } property = outputFormat.getProperty("vorbis.min_bitrate"); int nMinBitrate = DEFAULT_MIN_BITRATE; if (property instanceof Integer) { nMinBitrate = ((Integer) property).intValue() / 1024; } property = outputFormat.getProperty("vorbis.max_bitrate"); int nMaxBitrate = DEFAULT_MAX_BITRATE; if (property instanceof Integer) { nMaxBitrate = ((Integer) property).intValue() / 1024; } m_streamState = new StreamState(); m_page = new Page(); m_packet = new Packet(); m_info = new Info(); m_comment = new Comment(); m_dspState = new DspState(); m_block = new Block(); m_info.init(); int nSampleRate = (int) inputStream.getFormat().getSampleRate(); if (TDebug.TraceAudioConverter) { TDebug.out("sample rate: " + nSampleRate); } if (TDebug.TraceAudioConverter) { TDebug.out("channels: " + getChannels()); } if (bUseVBR) { m_info.encodeInitVBR(getChannels(), nSampleRate, fQuality); } else { m_info.encodeInit(getChannels(), nSampleRate, nMaxBitrate, nNominalBitrate, nMinBitrate); } m_comment.init(); m_comment.addTag("ENCODER","Tritonus libvorbis wrapper"); property = outputFormat.getProperty("vorbis.comments"); if (property instanceof List) { if (TDebug.TraceAudioConverter) { TDebug.out("VorbisFormatConversionProvider.(): comments present in target format"); } List comments = (List) property; for (int i = 0; i < comments.size(); i++) { Object comm = comments.get(i); if (comm instanceof String) { m_comment.addComment((String) comm); } } } m_dspState.initAnalysis(m_info); m_block.init(m_dspState); Random random = new Random(System.currentTimeMillis()); m_streamState.init(random.nextInt()); Packet header = new Packet(); Packet header_comm = new Packet(); Packet header_code = new Packet(); m_dspState.headerOut(m_comment, header, header_comm, header_code); m_streamState.packetIn(header); m_streamState.packetIn(header_comm); m_streamState.packetIn(header_code); while (true) { int result = m_streamState.flush(m_page); if(result == 0) { break; } getCircularBuffer().write(m_page.getHeader()); getCircularBuffer().write(m_page.getBody()); } if (TDebug.TraceAudioConverter) { TDebug.out("(): end"); } } public void execute() { if (TDebug.TraceAudioConverter) { TDebug.out(">EncodedVorbisAudioInputStream.execute(): begin"); } int nFrameSize = getFrameSize(); int nChannels = getChannels(); boolean bBigEndian = isBigEndian(); int nBytesPerSample = nFrameSize / nChannels; int nSampleSizeInBits = nBytesPerSample * 8; float fScale = (float) Math.pow(2.0, nSampleSizeInBits - 1); if (TDebug.TraceAudioConverter) { TDebug.out("frame size: " + nFrameSize); TDebug.out("channels: " + nChannels); TDebug.out("big endian: " + bBigEndian); TDebug.out("sample size (bits): " + nSampleSizeInBits); TDebug.out("bytes per sample: " + nBytesPerSample); TDebug.out("scale: " + fScale); } while (!eos && writeMore()) { if (TDebug.TraceAudioConverter) { TDebug.out("writeMore(): " + writeMore()); } int bytes; try { bytes = m_decodedStream.read(m_abReadbuffer); if (TDebug.TraceAudioConverter) { TDebug.out("read from PCM stream: " + bytes); } } catch (IOException e) { if (TDebug.TraceAllExceptions || TDebug.TraceAudioConverter) { TDebug.out(e); } m_streamState.clear(); m_block.clear(); m_dspState.clear(); m_comment.clear(); m_info.clear(); try { close(); } catch (IOException e1) { if (TDebug.TraceAllExceptions || TDebug.TraceAudioConverter) { TDebug.out(e1); } } if (TDebug.TraceAudioConverter) { TDebug.out("<"); } return; } if (bytes == 0 || bytes == -1) { if (TDebug.TraceAudioConverter) { TDebug.out("EOS reached; calling DspState.write(0)"); } m_dspState.write(null, 0); } else { int nFrames = bytes / nFrameSize; if (TDebug.TraceAudioConverter) { TDebug.out("processing frames: " + nFrames); } float[][] buffer = new float[nChannels][READ]; /* uninterleave samples */ for (int i = 0; i < nFrames; i++) { for (int nChannel = 0; nChannel < nChannels; nChannel++) { int nSample; nSample = bytesToInt16(m_abReadbuffer, i * nFrameSize + nChannel * nBytesPerSample, bBigEndian); buffer[nChannel][i] = nSample / fScale; } } m_dspState.write(buffer, nFrames); } while (m_dspState.blockOut(m_block) == 1) { m_block.analysis(null); m_block.addBlock(); while (m_dspState.flushPacket(m_packet) != 0) { m_streamState.packetIn(m_packet); while (!eos /*&& writeMore()*/) { int result = m_streamState.pageOut(m_page); if(result == 0) { break; } getCircularBuffer().write(m_page.getHeader()); getCircularBuffer().write(m_page.getBody()); if (m_page.isEos()) { eos = true; if (TDebug.TraceAudioConverter) { TDebug.out("page has detected EOS"); } } } } } } if (eos) { if (TDebug.TraceAudioConverter) { TDebug.out("EOS; shutting down encoder"); } m_streamState.clear(); m_block.clear(); m_dspState.clear(); m_comment.clear(); m_info.clear(); getCircularBuffer().close(); try { close(); } catch (IOException e) { if (TDebug.TraceAllExceptions || TDebug.TraceAudioConverter) { TDebug.out(e); } } } if (TDebug.TraceAudioConverter) { TDebug.out("(): begin"); } m_oggBitStream = bitStream; m_bHeadersExpected = true; init_jorbis(); if (TDebug.TraceAudioConverter) { TDebug.out("DecodedVorbisAudioInputStream.(): end"); } } /** * Initializes all the jOrbis and jOgg vars that are used for song playback. */ private void init_jorbis() { m_abInputBuffer = new byte[INPUT_BUFFER_SIZE]; m_oggSyncState = new SyncState(); m_oggStreamState = new StreamState(); m_oggPage = new Page(); m_oggPacket = new Packet(); m_vorbisInfo = new Info(); m_vorbisComment = new Comment(); m_vorbisDspState = new DspState(); m_vorbisBlock = new Block(); m_vorbisBlock.init(m_vorbisDspState); m_oggSyncState.init(); } /** Callback from circular buffer. */ public void execute() { if (TDebug.TraceAudioConverter) TDebug.out(">DecodedVorbisAudioInputStream.execute(): begin"); if (m_bHeadersExpected) { if (TDebug.TraceAudioConverter) TDebug.out("reading headers..."); // Headers (+ Comments). try { readHeaders(); } catch (IOException e) { if (TDebug.TraceAllExceptions) { TDebug.out(e); } closePhysicalStream(); if (TDebug.TraceAudioConverter) TDebug.out(" 0) { // convert floats to signed ints and // interleave for (int nChannel = 0; nChannel < m_vorbisInfo.getChannels(); nChannel++) { int pointer = nChannel * getSampleSizeInBytes(); for (int j = 0; j < nSamples; j++) { float fVal = m_aPcmOut[nChannel][j]; clipAndWriteSample(fVal, pointer); pointer += getFrameSize(); } } m_vorbisDspState.read(nSamples); getCircularBuffer().write(convbuffer, 0, getFrameSize() * nSamples); } } /** Scale and clip the sample and write it to convbuffer. */ private void clipAndWriteSample(float fSample, int nPointer) { int nSample; // TODO: check if clipping is necessary if (fSample > 1.0F) { fSample = 1.0F; } if (fSample < -1.0F) { fSample = -1.0F; } switch (getFormat().getSampleSizeInBits()) { case 16: nSample = (int) (fSample * 32767.0F); if (isBigEndian()) { convbuffer[nPointer++] = (byte) (nSample >> 8); convbuffer[nPointer] = (byte) (nSample & 0xFF); } else { convbuffer[nPointer++] = (byte) (nSample & 0xFF); convbuffer[nPointer] = (byte) (nSample >> 8); } break; case 24: nSample = (int) (fSample * 8388607.0F); if (isBigEndian()) { convbuffer[nPointer++] = (byte) (nSample >> 16); convbuffer[nPointer++] = (byte) ((nSample >>> 8) & 0xFF); convbuffer[nPointer] = (byte) (nSample & 0xFF); } else { convbuffer[nPointer++] = (byte) (nSample & 0xFF); convbuffer[nPointer++] = (byte) ((nSample >>> 8) & 0xFF); convbuffer[nPointer] = (byte) (nSample >> 16); } break; case 32: nSample = (int) (fSample * 2147483647.0F); if (isBigEndian()) { convbuffer[nPointer++] = (byte) (nSample >> 24); convbuffer[nPointer++] = (byte) ((nSample >>> 16) & 0xFF); convbuffer[nPointer++] = (byte) ((nSample >>> 8) & 0xFF); convbuffer[nPointer] = (byte) (nSample & 0xFF); } else { convbuffer[nPointer++] = (byte) (nSample & 0xFF); convbuffer[nPointer++] = (byte) ((nSample >>> 8) & 0xFF); convbuffer[nPointer++] = (byte) ((nSample >>> 16) & 0xFF); convbuffer[nPointer] = (byte) (nSample >> 24); } break; } } /** Read an ogg packet. This method does everything necessary to read an ogg packet. If needed, it calls {@link #readOggPage readOggPage()}, which, in turn, may read more data from the stream. The resulting packet is placed in {@link #m_oggPacket m_oggPacket} (for which the reference is not altered; is has to be initialized before). */ private void readOggPacket() throws IOException { while (true) { int result = m_oggStreamState.packetOut(m_oggPacket); if (result == 1) { return; } if (result == -1) { throw new IOException("can't read packet"); } readOggPage(); if (m_oggStreamState.pageIn(m_oggPage) < 0) { throw new IOException("can't read page of Ogg bitstream data"); } } } /** Read an ogg page. This method does everything necessary to read an ogg page. If needed, it reads more data from the stream. The resulting page is placed in {@link #m_oggPage m_oggPage} (for which the reference is not altered; is has to be initialized before). Note: this method doesn't deliver the page read to a StreamState object (which assembles pages to packets). This has to be done by the caller. */ private void readOggPage() throws IOException { while (true) { int result = m_oggSyncState.pageOut(m_oggPage); if (result == 1) { return; } // we need more data from the stream // TODO: call stream.read() directly int nBytes = readFromStream(m_abInputBuffer, 0, m_abInputBuffer.length); // TODO: This clause should become obsolete; readFromStream() should // propagate exceptions directly. if (nBytes == -1) { throw new EOFException(); } m_oggSyncState.write(m_abInputBuffer, nBytes); } } /** Read raw data from to ogg bitstream. Reads from {@ #m_oggBitStream m_oggBitStream} a specified number of bytes into a buffer, starting at a specified buffer index. @param buffer the where the read data should be put into. Its length has to be at least nStart + nLength. @param nStart @param nLength the number of bytes to read @return the number of bytes read (maybe 0) or -1 if there is no more data in the stream. */ private int readFromStream(byte[] buffer, int nStart, int nLength) throws IOException { return m_oggBitStream.read(buffer, nStart, nLength); } /** */ private int getSampleSizeInBytes() { return getFormat().getFrameSize() / getFormat().getChannels(); } /** . @return . */ private int getFrameSize() { return getFormat().getFrameSize(); } /** Returns if this stream (the decoded one) is big endian. @return true if this stream is big endian. */ private boolean isBigEndian() { return getFormat().isBigEndian(); } /** */ public void close() throws IOException { super.close(); m_oggBitStream.close(); } } } /*** VorbisFormatConversionProvider.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/sampled/convert/pvorbis/package.html0000644000175000017500000000046010167050104031163 0ustar twernertwerner

Ogg vorbis encoder and decoder based on the pure java libraries. The classes provided here .

@see org.tritonus.lowlevel.pogg @see org.tritonus.lowlevel.pvorbis libtritonus-java-20070428/src/classes/org/tritonus/sampled/convert/vorbis/0000755000175000017500000000000010621572471026535 5ustar twernertwerner././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootlibtritonus-java-20070428/src/classes/org/tritonus/sampled/convert/vorbis/VorbisFormatConversionProvider.javalibtritonus-java-20070428/src/classes/org/tritonus/sampled/convert/vorbis/VorbisFormatConversionProv0000644000175000017500000007176610374065716034037 0ustar twernertwerner/* * VorbisFormatConversionProvider.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999 - 2003 by Matthias Pfisterer * Copyright (c) 2001 by Florian Bomers * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.sampled.convert.vorbis; import java.io.EOFException; import java.io.InputStream; import java.io.IOException; import java.util.Arrays; import java.util.Iterator; import java.util.Random; import javax.sound.sampled.AudioFormat; import javax.sound.sampled.AudioInputStream; import javax.sound.sampled.AudioSystem; import org.tritonus.lowlevel.ogg.Packet; import org.tritonus.lowlevel.ogg.Page; import org.tritonus.lowlevel.ogg.StreamState; import org.tritonus.lowlevel.ogg.SyncState; import org.tritonus.lowlevel.vorbis.Block; import org.tritonus.lowlevel.vorbis.Comment; import org.tritonus.lowlevel.vorbis.DspState; import org.tritonus.lowlevel.vorbis.Info; import org.tritonus.share.TDebug; import org.tritonus.share.sampled.AudioFormats; import org.tritonus.share.sampled.convert.TAsynchronousFilteredAudioInputStream; import org.tritonus.share.sampled.convert.TEncodingFormatConversionProvider; /** ConversionProvider for ogg vorbis encoding. This FormatConversionProvider uses the native libraries libogg, libvorbis and libvorbisenc to implement encoding to ogg vorbis. @author Matthias Pfisterer */ public class VorbisFormatConversionProvider extends TEncodingFormatConversionProvider { // only used as abbreviation private static final AudioFormat.Encoding VORBIS = new AudioFormat.Encoding("VORBIS"); private static final AudioFormat.Encoding PCM_SIGNED = new AudioFormat.Encoding("PCM_SIGNED"); private static final AudioFormat[] INPUT_FORMATS = { // mono, 16 bit signed new AudioFormat(PCM_SIGNED, -1.0F, 16, 1, 2, -1.0F, false), new AudioFormat(PCM_SIGNED, -1.0F, 16, 1, 2, -1.0F, true), // stereo, 16 bit signed new AudioFormat(PCM_SIGNED, -1.0F, 16, 2, 4, -1.0F, false), new AudioFormat(PCM_SIGNED, -1.0F, 16, 2, 4, -1.0F, true), // TODO: other channel configurations // mono // TODO: mechanism to make the double specification with // different endianess obsolete. new AudioFormat(VORBIS, -1.0F, -1, 1, -1, -1.0F, false), new AudioFormat(VORBIS, -1.0F, -1, 1, -1, -1.0F, true), // stereo new AudioFormat(VORBIS, -1.0F, -1, 2, -1, -1.0F, false), new AudioFormat(VORBIS, -1.0F, -1, 2, -1, -1.0F, true), // TODO: other channel configurations }; // private static final AudioFormat[] OUTPUT_FORMATS = // { // // mono // // TODO: mechanism to make the double specification with // // different endianess obsolete. // new AudioFormat(VORBIS, -1.0F, -1, 1, -1, -1.0F, false), // new AudioFormat(VORBIS, -1.0F, -1, 1, -1, -1.0F, true), // // stereo // new AudioFormat(VORBIS, -1.0F, -1, 2, -1, -1.0F, false), // new AudioFormat(VORBIS, -1.0F, -1, 2, -1, -1.0F, true), // // TODO: other channel configurations // }; /* Default settings for encoding. */ private static final boolean DEFAULT_VBR = true; private static final float DEFAULT_QUALITY = 0.5F; private static final int DEFAULT_MAX_BITRATE = 256; private static final int DEFAULT_NOM_BITRATE = 128; private static final int DEFAULT_MIN_BITRATE = 32; /** Constructor. */ public VorbisFormatConversionProvider() { super(Arrays.asList(INPUT_FORMATS), Arrays.asList(INPUT_FORMATS)//, //Arrays.asList(OUTPUT_FORMATS), /* true, // new behaviour false*/); // bidirectional .. constants UNIDIR../BIDIR..? if (TDebug.TraceAudioConverter) { TDebug.out("VorbisFormatConversionProvider.(): begin"); } if (TDebug.TraceAudioConverter) { TDebug.out("VorbisFormatConversionProvider.(): end"); } } public AudioInputStream getAudioInputStream(AudioFormat targetFormat, AudioInputStream audioInputStream) { if (TDebug.TraceAudioConverter) { TDebug.out(">VorbisFormatConversionProvider.getAudioInputStream(): begin"); } /** The AudioInputStream to return. */ AudioInputStream convertedAudioInputStream = null; if (TDebug.TraceAudioConverter) { TDebug.out("checking if conversion supported"); TDebug.out("from: " + audioInputStream.getFormat()); TDebug.out("to: " + targetFormat); } // what is this ??? targetFormat = getDefaultTargetFormat(targetFormat, audioInputStream.getFormat()); if (isConversionSupported(targetFormat, audioInputStream.getFormat())) { if (targetFormat.getEncoding().equals(VORBIS)) { if (TDebug.TraceAudioConverter) TDebug.out("conversion supported; trying to create EncodedVorbisAudioInputStream"); convertedAudioInputStream = new EncodedVorbisAudioInputStream( targetFormat, audioInputStream); } else { if (TDebug.TraceAudioConverter) { TDebug.out("conversion supported; trying to create DecodedVorbisAudioInputStream"); } convertedAudioInputStream = new DecodedVorbisAudioInputStream( targetFormat, audioInputStream); } } else { if (TDebug.TraceAudioConverter) { TDebug.out("EncodedVorbisAudioInputStream.(): begin"); m_decodedStream = inputStream; m_abReadbuffer = new byte[READ * getFrameSize()]; Object property = null; property = outputFormat.getProperty("vbr"); boolean bUseVBR = DEFAULT_VBR; if (property instanceof Boolean) { bUseVBR = ((Boolean) property).booleanValue(); if (TDebug.TraceAudioConverter) TDebug.out("using VBR: " + bUseVBR); } property = outputFormat.getProperty("quality"); float fQuality = DEFAULT_QUALITY; if (property instanceof Integer) { fQuality = ((Integer) property).intValue() / 10.0F; bUseVBR = true; if (TDebug.TraceAudioConverter) TDebug.out("using quality (automatically switching VBR on): " + fQuality); } int nNominalBitrate = DEFAULT_NOM_BITRATE; int nMinBitrate = DEFAULT_MIN_BITRATE; int nMaxBitrate = DEFAULT_MAX_BITRATE; property = outputFormat.getProperty("bitrate"); if (property instanceof Integer) { nNominalBitrate = ((Integer) property).intValue() /*/ 1024*/; nMinBitrate = nNominalBitrate; nMaxBitrate = nNominalBitrate; bUseVBR = false; if (TDebug.TraceAudioConverter) TDebug.out("using nominal bitrate (automatically switching VBR off): " + nNominalBitrate); } property = outputFormat.getProperty("vorbis.min_bitrate"); if (property instanceof Integer) { nMinBitrate = ((Integer) property).intValue() /*/ 1024*/; } property = outputFormat.getProperty("vorbis.max_bitrate"); if (property instanceof Integer) { nMaxBitrate = ((Integer) property).intValue() / 1024; } m_streamState = new StreamState(); m_page = new Page(); m_packet = new Packet(); m_info = new Info(); m_comment = new Comment(); m_dspState = new DspState(); m_block = new Block(); m_info.init(); int nSampleRate = (int) inputStream.getFormat().getSampleRate(); if (TDebug.TraceAudioConverter) TDebug.out("sample rate: " + nSampleRate); if (TDebug.TraceAudioConverter) TDebug.out("channels: " + getChannels()); if (bUseVBR) { if (TDebug.TraceAudioConverter) TDebug.out("using VBR with quality: " + fQuality); m_info.encodeInitVBR(getChannels(), nSampleRate, fQuality); } else { if (TDebug.TraceAudioConverter) TDebug.out("using fixed bitrate(max/nom/min): " + nMaxBitrate + "/" + nNominalBitrate + "/" + nMinBitrate); m_info.encodeInit(getChannels(), nSampleRate, nMaxBitrate, nNominalBitrate, nMinBitrate); } m_comment.init(); m_comment.addTag("ENCODER","Tritonus libvorbis wrapper"); m_dspState.initAnalysis(m_info); m_block.init(m_dspState); Random random = new Random(System.currentTimeMillis()); m_streamState.init(random.nextInt()); Packet header = new Packet(); Packet header_comm = new Packet(); Packet header_code = new Packet(); m_dspState.headerOut(m_comment, header, header_comm, header_code); m_streamState.packetIn(header); m_streamState.packetIn(header_comm); m_streamState.packetIn(header_code); while (true) { int result = m_streamState.flush(m_page); if(result == 0) { break; } getCircularBuffer().write(m_page.getHeader()); getCircularBuffer().write(m_page.getBody()); } if (TDebug.TraceAudioConverter) { TDebug.out("(): end"); } } public void execute() { if (TDebug.TraceAudioConverter) { TDebug.out(">EncodedVorbisAudioInputStream.execute(): begin"); } int nFrameSize = getFrameSize(); int nChannels = getChannels(); boolean bBigEndian = isBigEndian(); int nBytesPerSample = nFrameSize / nChannels; int nSampleSizeInBits = nBytesPerSample * 8; float fScale = (float) Math.pow(2.0, nSampleSizeInBits - 1); if (TDebug.TraceAudioConverter) { TDebug.out("frame size: " + nFrameSize); TDebug.out("channels: " + nChannels); TDebug.out("big endian: " + bBigEndian); TDebug.out("sample size (bits): " + nSampleSizeInBits); TDebug.out("bytes per sample: " + nBytesPerSample); TDebug.out("scale: " + fScale); } while (!eos && writeMore()) { if (TDebug.TraceAudioConverter) { TDebug.out("writeMore(): " + writeMore()); } int bytes; try { bytes = m_decodedStream.read(m_abReadbuffer); if (TDebug.TraceAudioConverter) { TDebug.out("read from PCM stream: " + bytes); } } catch (IOException e) { if (TDebug.TraceAllExceptions || TDebug.TraceAudioConverter) { TDebug.out(e); } m_streamState.clear(); m_block.clear(); m_dspState.clear(); m_comment.clear(); m_info.clear(); try { close(); } catch (IOException e1) { if (TDebug.TraceAllExceptions || TDebug.TraceAudioConverter) { TDebug.out(e1); } } if (TDebug.TraceAudioConverter) { TDebug.out("<"); } return; } if (bytes == 0 || bytes == -1) { if (TDebug.TraceAudioConverter) { TDebug.out("EOS reached; calling DspState.write(0)"); } m_dspState.write(null, 0); } else { int nFrames = bytes / nFrameSize; if (TDebug.TraceAudioConverter) { TDebug.out("processing frames: " + nFrames); } float[][] buffer = new float[nChannels][READ]; /* uninterleave samples */ for (int i = 0; i < nFrames; i++) { for (int nChannel = 0; nChannel < nChannels; nChannel++) { int nSample; nSample = bytesToInt16(m_abReadbuffer, i * nFrameSize + nChannel * nBytesPerSample, bBigEndian); buffer[nChannel][i] = nSample / fScale; } } m_dspState.write(buffer, nFrames); } while (m_dspState.blockOut(m_block) == 1) { m_block.analysis(null); m_block.addBlock(); while (m_dspState.flushPacket(m_packet) != 0) { m_streamState.packetIn(m_packet); while (!eos /*&& writeMore()*/) { int result = m_streamState.pageOut(m_page); if(result == 0) { break; } getCircularBuffer().write(m_page.getHeader()); getCircularBuffer().write(m_page.getBody()); if (m_page.isEos()) { eos = true; if (TDebug.TraceAudioConverter) { TDebug.out("page has detected EOS"); } } } } } } if (eos) { if (TDebug.TraceAudioConverter) { TDebug.out("EOS; shutting down encoder"); } m_streamState.clear(); m_block.clear(); m_dspState.clear(); m_comment.clear(); m_info.clear(); getCircularBuffer().close(); try { close(); } catch (IOException e) { if (TDebug.TraceAllExceptions || TDebug.TraceAudioConverter) { TDebug.out(e); } } } if (TDebug.TraceAudioConverter) { TDebug.out("(): begin"); } m_oggBitStream = bitStream; m_bHeadersExpected = true; init_jorbis(); if (TDebug.TraceAudioConverter) { TDebug.out("DecodedVorbisAudioInputStream.(): end"); } } /** * Initializes all the jOrbis and jOgg vars that are used for song playback. */ private void init_jorbis() { m_abInputBuffer = new byte[INPUT_BUFFER_SIZE]; m_oggSyncState = new SyncState(); m_oggStreamState = new StreamState(); m_oggPage = new Page(); m_oggPacket = new Packet(); m_vorbisInfo = new Info(); m_vorbisComment = new Comment(); m_vorbisDspState = new DspState(); m_vorbisBlock = new Block(); m_vorbisBlock.init(m_vorbisDspState); m_oggSyncState.init(); } /** Callback from circular buffer. */ public void execute() { if (TDebug.TraceAudioConverter) TDebug.out(">DecodedVorbisAudioInputStream.execute(): begin"); if (m_bHeadersExpected) { if (TDebug.TraceAudioConverter) TDebug.out("reading headers..."); // Headers (+ Comments). try { readHeaders(); } catch (IOException e) { if (TDebug.TraceAllExceptions) { TDebug.out(e); } closePhysicalStream(); if (TDebug.TraceAudioConverter) TDebug.out(" 0) { // convert floats to signed ints and // interleave for (int nChannel = 0; nChannel < m_vorbisInfo.getChannels(); nChannel++) { int pointer = nChannel * getSampleSizeInBytes(); for (int j = 0; j < nSamples; j++) { float fVal = m_aPcmOut[nChannel][j]; clipAndWriteSample(fVal, pointer); pointer += getFrameSize(); } } m_vorbisDspState.read(nSamples); getCircularBuffer().write(convbuffer, 0, getFrameSize() * nSamples); } } /** Scale and clip the sample and write it to convbuffer. */ private void clipAndWriteSample(float fSample, int nPointer) { int nSample; // TODO: check if clipping is necessary if (fSample > 1.0F) { fSample = 1.0F; } if (fSample < -1.0F) { fSample = -1.0F; } switch (getFormat().getSampleSizeInBits()) { case 16: nSample = (int) (fSample * 32767.0F); if (isBigEndian()) { convbuffer[nPointer++] = (byte) (nSample >> 8); convbuffer[nPointer] = (byte) (nSample & 0xFF); } else { convbuffer[nPointer++] = (byte) (nSample & 0xFF); convbuffer[nPointer] = (byte) (nSample >> 8); } break; case 24: nSample = (int) (fSample * 8388607.0F); if (isBigEndian()) { convbuffer[nPointer++] = (byte) (nSample >> 16); convbuffer[nPointer++] = (byte) ((nSample >>> 8) & 0xFF); convbuffer[nPointer] = (byte) (nSample & 0xFF); } else { convbuffer[nPointer++] = (byte) (nSample & 0xFF); convbuffer[nPointer++] = (byte) ((nSample >>> 8) & 0xFF); convbuffer[nPointer] = (byte) (nSample >> 16); } break; case 32: nSample = (int) (fSample * 2147483647.0F); if (isBigEndian()) { convbuffer[nPointer++] = (byte) (nSample >> 24); convbuffer[nPointer++] = (byte) ((nSample >>> 16) & 0xFF); convbuffer[nPointer++] = (byte) ((nSample >>> 8) & 0xFF); convbuffer[nPointer] = (byte) (nSample & 0xFF); } else { convbuffer[nPointer++] = (byte) (nSample & 0xFF); convbuffer[nPointer++] = (byte) ((nSample >>> 8) & 0xFF); convbuffer[nPointer++] = (byte) ((nSample >>> 16) & 0xFF); convbuffer[nPointer] = (byte) (nSample >> 24); } break; } } /** Read an ogg packet. This method does everything necessary to read an ogg packet. If needed, it calls {@link #readOggPage readOggPage()}, which, in turn, may read more data from the stream. The resulting packet is placed in {@link #m_oggPacket m_oggPacket} (for which the reference is not altered; is has to be initialized before). */ private void readOggPacket() throws IOException { while (true) { int result = m_oggStreamState.packetOut(m_oggPacket); if (result == 1) { return; } if (result == -1) { throw new IOException("can't read packet"); } readOggPage(); if (m_oggStreamState.pageIn(m_oggPage) < 0) { throw new IOException("can't read page of Ogg bitstream data"); } } } /** Read an ogg page. This method does everything necessary to read an ogg page. If needed, it reads more data from the stream. The resulting page is placed in {@link #m_oggPage m_oggPage} (for which the reference is not altered; is has to be initialized before). Note: this method doesn't deliver the page read to a StreamState object (which assembles pages to packets). This has to be done by the caller. */ private void readOggPage() throws IOException { while (true) { int result = m_oggSyncState.pageOut(m_oggPage); if (result == 1) { return; } // we need more data from the stream // TODO: call stream.read() directly int nBytes = readFromStream(m_abInputBuffer, 0, m_abInputBuffer.length); // TODO: This clause should become obsolete; readFromStream() should // propagate exceptions directly. if (nBytes == -1) { throw new EOFException(); } m_oggSyncState.write(m_abInputBuffer, nBytes); } } /** Read raw data from to ogg bitstream. Reads from {@ #m_oggBitStream m_oggBitStream} a specified number of bytes into a buffer, starting at a specified buffer index. @param buffer the where the read data should be put into. Its length has to be at least nStart + nLength. @param nStart @param nLength the number of bytes to read @return the number of bytes read (maybe 0) or -1 if there is no more data in the stream. */ private int readFromStream(byte[] buffer, int nStart, int nLength) throws IOException { return m_oggBitStream.read(buffer, nStart, nLength); } /** */ private int getSampleSizeInBytes() { return getFormat().getFrameSize() / getFormat().getChannels(); } /** . @return . */ private int getFrameSize() { return getFormat().getFrameSize(); } /** Returns if this stream (the decoded one) is big endian. @return true if this stream is big endian. */ private boolean isBigEndian() { return getFormat().isBigEndian(); } /** */ public void close() throws IOException { super.close(); m_oggBitStream.close(); } } } /*** VorbisFormatConversionProvider.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/sampled/convert/vorbis/package.html0000644000175000017500000000044710172460776031030 0ustar twernertwerner

Ogg vorbis encoder and decoder based on native libraries. The classes provided here .

@see org.tritonus.lowlevel.ogg @see org.tritonus.lowlevel.vorbis libtritonus-java-20070428/src/classes/org/tritonus/sampled/file/0000755000175000017500000000000010621572477024476 5ustar twernertwernerlibtritonus-java-20070428/src/classes/org/tritonus/sampled/file/gsm/0000755000175000017500000000000010621572475025262 5ustar twernertwernerlibtritonus-java-20070428/src/classes/org/tritonus/sampled/file/gsm/GSMAudioFileReader.java0000644000175000017500000000757110374074736031474 0ustar twernertwerner/* * GSMAudioFileReader.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999 - 2004 by Matthias Pfisterer * Copyright (c) 2001 by Florian Bomers * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.sampled.file.gsm; import java.io.InputStream; import java.io.IOException; import java.io.EOFException; import java.util.HashMap; import java.util.Map; import javax.sound.sampled.AudioSystem; import javax.sound.sampled.AudioFormat; import javax.sound.sampled.AudioFileFormat; import javax.sound.sampled.UnsupportedAudioFileException; import org.tritonus.share.TDebug; import org.tritonus.share.sampled.file.TAudioFileFormat; import org.tritonus.share.sampled.file.TAudioFileReader; /** AudioFileReader class for GSM 06.10 data. @author Matthias Pfisterer */ public class GSMAudioFileReader extends TAudioFileReader { private static final int GSM_MAGIC = 0xD0; private static final int GSM_MAGIC_MASK = 0xF0; private static final int MARK_LIMIT = 1; public GSMAudioFileReader() { super(MARK_LIMIT, true); } protected AudioFileFormat getAudioFileFormat(InputStream inputStream, long lFileSizeInBytes) throws UnsupportedAudioFileException, IOException { if (TDebug.TraceAudioFileReader) { TDebug.out("GSMAudioFileReader.getAudioFileFormat(): begin"); } int b0 = inputStream.read(); if (b0 < 0) { throw new EOFException(); } /* * Check for magic number. */ if ((b0 & GSM_MAGIC_MASK) != GSM_MAGIC) { throw new UnsupportedAudioFileException("not a GSM stream: wrong magic number"); } /* If the file size is known, we derive the number of frames ('frame size') from it. If the values don't fit into integers, we leave them at NOT_SPECIFIED. 'Unknown' is considered less incorrect than a wrong value. */ // [fb] not specifying it causes Sun's Wave file writer to write rubbish int nByteSize = AudioSystem.NOT_SPECIFIED; int nFrameSize = AudioSystem.NOT_SPECIFIED; Map properties = new HashMap(); if (lFileSizeInBytes != AudioSystem.NOT_SPECIFIED) { // the number of GSM frames long lFrameSize = lFileSizeInBytes / 33; // duration in microseconds long lDuration = lFrameSize * 20000; properties.put("duration", lDuration); if (lFileSizeInBytes <= Integer.MAX_VALUE) { nByteSize = (int) lFileSizeInBytes; nFrameSize = (int) (lFileSizeInBytes / 33); } } Map afProperties = new HashMap(); afProperties.put("bitrate", 13200L); AudioFormat format = new AudioFormat( new AudioFormat.Encoding("GSM0610"), 8000.0F, AudioSystem.NOT_SPECIFIED /* ??? [sample size in bits] */, 1, 33, 50.0F, true, // this value is chosen arbitrarily afProperties); AudioFileFormat audioFileFormat = new TAudioFileFormat( new AudioFileFormat.Type("GSM","gsm"), format, nFrameSize, nByteSize, properties); if (TDebug.TraceAudioFileReader) { TDebug.out("GSMAudioFileReader.getAudioFileFormat(): end"); } return audioFileFormat; } } /*** GSMAudioFileReader.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/sampled/file/gsm/GSMAudioFileWriter.java0000644000175000017500000000414510374074736031540 0ustar twernertwerner/* * GSMAudioFileWriter.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2000 by Florian Bomers * Copyright (c) 2000 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.sampled.file.gsm; import java.util.Arrays; import javax.sound.sampled.AudioFileFormat; import javax.sound.sampled.AudioFormat; import org.tritonus.share.TDebug; import org.tritonus.share.sampled.file.THeaderlessAudioFileWriter; /** Class for writing GSM streams * * @author Florian Bomers * @author Matthias Pfisterer */ public class GSMAudioFileWriter extends THeaderlessAudioFileWriter { private static final AudioFileFormat.Type[] FILE_TYPES = { new AudioFileFormat.Type("GSM", "gsm") }; private static final AudioFormat[] AUDIO_FORMATS = { new AudioFormat(new AudioFormat.Encoding("GSM0610"), 8000.0F, ALL, 1, 33, 50.0F, false), new AudioFormat(new AudioFormat.Encoding("GSM0610"), 8000.0F, ALL, 1, 33, 50.0F, true), }; public GSMAudioFileWriter() { super(Arrays.asList(FILE_TYPES), Arrays.asList(AUDIO_FORMATS)); if (TDebug.TraceAudioFileWriter) { TDebug.out("GSMAudioFileWriter.(): begin"); } if (TDebug.TraceAudioFileWriter) { TDebug.out("GSMAudioFileWriter.(): end"); } } } /*** GSMAudioFileWriter.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/sampled/file/gsm/package.html0000644000175000017500000000031310172460777027542 0ustar twernertwerner

GSM 06.10 audio file reader and writer. The classes provided here .

libtritonus-java-20070428/src/classes/org/tritonus/sampled/file/mpeg/0000755000175000017500000000000010621572476025425 5ustar twernertwernerlibtritonus-java-20070428/src/classes/org/tritonus/sampled/file/mpeg/MpegAudioFileWriter.java0000644000175000017500000000454510174006354032135 0ustar twernertwerner/* * MpegAudioFileWriter.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2000 by Florian Bomers * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.sampled.file.mpeg; import java.util.Arrays; import javax.sound.sampled.AudioFileFormat; import javax.sound.sampled.AudioFormat; import org.tritonus.share.TDebug; import org.tritonus.share.sampled.file.THeaderlessAudioFileWriter; /** Class for writing mpeg files * * @author Florian Bomers */ public class MpegAudioFileWriter extends THeaderlessAudioFileWriter { private static final AudioFileFormat.Type[] FILE_TYPES = { //new AudioFileFormat.Type("MPEG", "mpeg"), // workaround for the fixed extension problem in AudioFileFormat.Type // see org.tritonus.share.sampled.AudioFileTypes.java new AudioFileFormat.Type("MP3", "mp3") }; public static AudioFormat.Encoding MPEG1L3=new AudioFormat.Encoding("MPEG1L3"); private static final AudioFormat[] AUDIO_FORMATS = { new AudioFormat(MPEG1L3, ALL, ALL, 1, ALL, ALL, false), new AudioFormat(MPEG1L3, ALL, ALL, 1, ALL, ALL, true), new AudioFormat(MPEG1L3, ALL, ALL, 2, ALL, ALL, false), new AudioFormat(MPEG1L3, ALL, ALL, 2, ALL, ALL, true), }; public MpegAudioFileWriter() { super(Arrays.asList(FILE_TYPES), Arrays.asList(AUDIO_FORMATS)); if (TDebug.TraceAudioFileWriter) { TDebug.out("MpegAudioFileWriter.(): begin"); } if (TDebug.TraceAudioFileWriter) { TDebug.out("MpegAudioFileWriter.(): end"); } } } /*** MpegAudioFileWriter.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/sampled/file/mpeg/package.html0000644000175000017500000000030510174006354027672 0ustar twernertwerner

Mp3 audio file reader and writer. The classes provided here .

libtritonus-java-20070428/src/classes/org/tritonus/sampled/file/AiffAudioFileReader.java0000644000175000017500000001717110374074736031122 0ustar twernertwerner/* * AiffAudioFileReader.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2000 by Florian Bomers * Copyright (c) 1999 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.sampled.file; import java.io.DataInputStream; import java.io.InputStream; import java.io.IOException; import javax.sound.sampled.AudioFormat; import javax.sound.sampled.AudioFileFormat; import javax.sound.sampled.AudioSystem; import javax.sound.sampled.UnsupportedAudioFileException; import org.tritonus.share.sampled.file.TAudioFileFormat; import org.tritonus.share.sampled.file.TAudioFileReader; import org.tritonus.share.TDebug; /** Class for reading AIFF and AIFF-C files. * * @author Florian Bomers * @author Matthias Pfisterer */ public class AiffAudioFileReader extends TAudioFileReader { private static final int READ_LIMIT = 1000; public AiffAudioFileReader() { super(READ_LIMIT); } private void skipChunk(DataInputStream dataInputStream, int chunkLength, int chunkRead) throws IOException { chunkLength-=chunkRead; if (chunkLength>0) { dataInputStream.skip(chunkLength + (chunkLength % 2)); } } private AudioFormat readCommChunk(DataInputStream dataInputStream, int chunkLength) throws IOException, UnsupportedAudioFileException { int nNumChannels = dataInputStream.readShort(); if (nNumChannels <= 0) { throw new UnsupportedAudioFileException( "not an AIFF file: number of channels must be positive"); } if (TDebug.TraceAudioFileReader) { TDebug.out("Found "+nNumChannels+" channels."); } // ignored: frame count dataInputStream.readInt(); int nSampleSize = dataInputStream.readShort(); float fSampleRate = (float) readIeeeExtended(dataInputStream); if (fSampleRate <= 0.0) { throw new UnsupportedAudioFileException( "not an AIFF file: sample rate must be positive"); } if (TDebug.TraceAudioFileReader) { TDebug.out("Found framerate "+fSampleRate); } AudioFormat.Encoding encoding = AudioFormat.Encoding.PCM_SIGNED; int nRead=18; if (chunkLength>nRead) { int nEncoding=dataInputStream.readInt(); nRead+=4; if (nEncoding==AiffTool.AIFF_COMM_PCM) { // PCM - nothing to do } else if (nEncoding==AiffTool.AIFF_COMM_ULAW) { // ULAW encoding=AudioFormat.Encoding.ULAW; nSampleSize=8; } else if (nEncoding==AiffTool.AIFF_COMM_IMA_ADPCM) { encoding = new AudioFormat.Encoding("IMA_ADPCM"); nSampleSize=4; } else { throw new UnsupportedAudioFileException( "Encoding 0x"+Integer.toHexString(nEncoding) +" of AIFF file not supported"); } } /* In case of IMA ADPCM, frame size is 0.5 bytes (since it is always mono). A value of 1 as frame size would be wrong. Handling of frame size 0 in defined nowhere. So the best solution is to set the frame size to unspecified (-1). */ int nFrameSize = (nSampleSize == 4) ? AudioSystem.NOT_SPECIFIED : calculateFrameSize(nSampleSize, nNumChannels); if (TDebug.TraceAudioFileReader) { TDebug.out("calculated frame size: " + nFrameSize); } skipChunk(dataInputStream, chunkLength, nRead); AudioFormat format = new AudioFormat(encoding, fSampleRate, nSampleSize, nNumChannels, nFrameSize, fSampleRate, true); return format; } private void readVerChunk(DataInputStream dataInputStream, int chunkLength) throws IOException, UnsupportedAudioFileException { if (chunkLength<4) { throw new UnsupportedAudioFileException( "Corrput AIFF file: FVER chunk too small."); } int nVer=dataInputStream.readInt(); if (nVer!=AiffTool.AIFF_FVER_TIME_STAMP) { throw new UnsupportedAudioFileException( "Unsupported AIFF file: version not known."); } skipChunk(dataInputStream, chunkLength, 4); } protected AudioFileFormat getAudioFileFormat(InputStream inputStream, long lFileSizeInBytes) throws UnsupportedAudioFileException, IOException { if (TDebug.TraceAudioFileReader) {TDebug.out("AiffAudioFileReader.getAudioFileFormat(InputStream, long): begin"); } DataInputStream dataInputStream = new DataInputStream(inputStream); int nMagic = dataInputStream.readInt(); if (nMagic != AiffTool.AIFF_FORM_MAGIC) { throw new UnsupportedAudioFileException( "not an AIFF file: header magic is not FORM"); } int nTotalLength = dataInputStream.readInt(); nMagic = dataInputStream.readInt(); boolean bIsAifc; if (nMagic == AiffTool.AIFF_AIFF_MAGIC) { bIsAifc = false; } else if (nMagic == AiffTool.AIFF_AIFC_MAGIC) { bIsAifc = true; } else { throw new UnsupportedAudioFileException( "unsupported IFF file: header magic neither AIFF nor AIFC"); } boolean bFVerFound=!bIsAifc; boolean bCommFound=false; boolean bSSndFound=false; AudioFormat format=null; int nDataChunkLength=0; // walk through the chunks // chunks may be in any order. However, in this implementation, SSND must be last while (!bFVerFound || !bCommFound || !bSSndFound) { nMagic = dataInputStream.readInt(); int nChunkLength = dataInputStream.readInt(); switch (nMagic) { case AiffTool.AIFF_COMM_MAGIC: format=readCommChunk(dataInputStream, nChunkLength); if (TDebug.TraceAudioFileReader) { TDebug.out("Read COMM chunk with length "+nChunkLength); } bCommFound=true; break; case AiffTool.AIFF_FVER_MAGIC: if (!bFVerFound) { readVerChunk(dataInputStream, nChunkLength); if (TDebug.TraceAudioFileReader) { TDebug.out("Read FVER chunk with length "+nChunkLength); } bFVerFound=true; } else { skipChunk(dataInputStream, nChunkLength, 0); } break; case AiffTool.AIFF_SSND_MAGIC: if (!bCommFound || !bFVerFound) { throw new UnsupportedAudioFileException( "cannot handle AIFF file: SSND not last chunk"); } bSSndFound=true; nDataChunkLength=nChunkLength-8; // 8 information bytes of no interest dataInputStream.skip(8); if (TDebug.TraceAudioFileReader) { TDebug.out("Found SSND chunk with length "+nChunkLength); } break; default: if (TDebug.TraceAudioFileReader) { TDebug.out("Skipping unknown chunk: " +Integer.toHexString(nMagic)); } skipChunk(dataInputStream, nChunkLength, 0); break; } } // TODO: length argument has to be in frames AudioFileFormat audioFileFormat = new TAudioFileFormat( bIsAifc ? AudioFileFormat.Type.AIFC : AudioFileFormat.Type.AIFF, format, nDataChunkLength / format.getFrameSize(), nTotalLength + 8); if (TDebug.TraceAudioFileReader) {TDebug.out("AiffAudioFileReader.getAudioFileFormat(InputStream, long): end"); } return audioFileFormat; } } /*** AiffAudioFileReader.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/sampled/file/AiffAudioFileWriter.java0000644000175000017500000000646010374104304031154 0ustar twernertwerner/* * AiffAudioFileWriter.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2000 by Florian Bomers * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.sampled.file; import java.io.IOException; import java.util.Arrays; import javax.sound.sampled.AudioFileFormat; import javax.sound.sampled.AudioFormat; import org.tritonus.share.sampled.file.AudioOutputStream; import org.tritonus.share.sampled.file.TAudioFileWriter; import org.tritonus.share.sampled.file.TDataOutputStream; /** * Class for writing AIFF and AIFF-C files. * * @author Florian Bomers */ public class AiffAudioFileWriter extends TAudioFileWriter { private static final AudioFileFormat.Type[] FILE_TYPES = { AudioFileFormat.Type.AIFF, AudioFileFormat.Type.AIFC }; private static final AudioFormat.Encoding ULAW = AudioFormat.Encoding.ULAW; private static final AudioFormat.Encoding IMA_ADPCM = new AudioFormat.Encoding("IMA_ADPCM"); // IMPORTANT: this array depends on the AudioFormat.match() algorithm which takes // AudioSystem.NOT_SPECIFIED into account ! private static final AudioFormat[] AUDIO_FORMATS = { new AudioFormat(PCM_SIGNED, ALL, 8, ALL, ALL, ALL, true), new AudioFormat(PCM_SIGNED, ALL, 8, ALL, ALL, ALL, false), new AudioFormat(ULAW, ALL, 8, ALL, ALL, ALL, false), new AudioFormat(ULAW, ALL, 8, ALL, ALL, ALL, true), new AudioFormat(PCM_SIGNED, ALL, 16, ALL, ALL, ALL, true), new AudioFormat(PCM_SIGNED, ALL, 24, ALL, ALL, ALL, true), new AudioFormat(PCM_SIGNED, ALL, 32, ALL, ALL, ALL, true), new AudioFormat(IMA_ADPCM, ALL, 4, ALL, ALL, ALL, true), new AudioFormat(IMA_ADPCM, ALL, 4, ALL, ALL, ALL, false), }; public AiffAudioFileWriter() { super(Arrays.asList(FILE_TYPES), Arrays.asList(AUDIO_FORMATS)); } protected boolean isAudioFormatSupportedImpl(AudioFormat format, AudioFileFormat.Type fileType) { return AiffTool.getFormatCode(format)!=AiffTool.AIFF_COMM_UNSPECIFIED; } protected AudioOutputStream getAudioOutputStream(AudioFormat audioFormat, long lLengthInBytes, AudioFileFormat.Type fileType, TDataOutputStream dataOutputStream) throws IOException { return new AiffAudioOutputStream(audioFormat, fileType, lLengthInBytes, dataOutputStream); } } /*** AiffAudioFileWriter.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/sampled/file/AiffAudioOutputStream.java0000644000175000017500000001460210172460777031570 0ustar twernertwerner/* * AiffAudioOutputStream.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2000 by Florian Bomers * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.sampled.file; import java.io.IOException; import javax.sound.sampled.AudioFormat; import javax.sound.sampled.AudioFileFormat; import javax.sound.sampled.AudioSystem; import org.tritonus.share.TDebug; import org.tritonus.share.sampled.file.TAudioOutputStream; import org.tritonus.share.sampled.file.TDataOutputStream; /** * AudioOutputStream for AIFF and AIFF-C files. * * @author Florian Bomers */ public class AiffAudioOutputStream extends TAudioOutputStream { // this constant is used for chunk lengths when the length is not known yet private static final int LENGTH_NOT_KNOWN=-1; private AudioFileFormat.Type m_FileType; public AiffAudioOutputStream(AudioFormat audioFormat, AudioFileFormat.Type fileType, long lLength, TDataOutputStream dataOutputStream) { super(audioFormat, lLength, dataOutputStream, lLength == AudioSystem.NOT_SPECIFIED && dataOutputStream.supportsSeek()); // AIFF files cannot exceed 2GB if (lLength != AudioSystem.NOT_SPECIFIED && lLength>0x7FFFFFFFl) { throw new IllegalArgumentException( "AIFF files cannot be larger than 2GB."); } // IDEA: write AIFF file instead of AIFC when encoding=PCM ? m_FileType=fileType; if (!audioFormat.getEncoding().equals(AudioFormat.Encoding.PCM_SIGNED) && !audioFormat.getEncoding().equals(AudioFormat.Encoding.PCM_UNSIGNED)) { // only AIFC files can handle non-pcm data m_FileType=AudioFileFormat.Type.AIFC; } } protected void writeHeader() throws IOException { if (TDebug.TraceAudioOutputStream) { TDebug.out("AiffAudioOutputStream.writeHeader(): called."); } AudioFormat format = getFormat(); boolean bIsAifc = m_FileType.equals(AudioFileFormat.Type.AIFC); long lLength = getLength(); TDataOutputStream dos = getDataOutputStream(); int nCommChunkSize=18; int nFormatCode=AiffTool.getFormatCode(format); if (bIsAifc) { // encoding takes 4 bytes // encoding name takes at minimum 2 bytes nCommChunkSize+=6; } int nHeaderSize=4 // magic +8+nCommChunkSize // COMM chunk +8; // header of SSND chunk if (bIsAifc) { // add length for FVER chunk nHeaderSize+=12; } // if patching the header, and the length has not been known at first // writing of the header, just truncate the size fields, don't throw an exception if (lLength != AudioSystem.NOT_SPECIFIED && lLength+nHeaderSize>0x7FFFFFFFl) { lLength=0x7FFFFFFFl-nHeaderSize; } // chunks must be on word-boundaries long lSSndChunkSize=(lLength!=AudioSystem.NOT_SPECIFIED)? (lLength+(lLength%2)+8):AudioSystem.NOT_SPECIFIED; // write IFF container chunk dos.writeInt(AiffTool.AIFF_FORM_MAGIC); dos.writeInt((lLength!=AudioSystem.NOT_SPECIFIED)? ((int) (lSSndChunkSize+nHeaderSize)):LENGTH_NOT_KNOWN); if (bIsAifc) { dos.writeInt(AiffTool.AIFF_AIFC_MAGIC); // write FVER chunk dos.writeInt(AiffTool.AIFF_FVER_MAGIC); dos.writeInt(4); dos.writeInt(AiffTool.AIFF_FVER_TIME_STAMP); } else { dos.writeInt(AiffTool.AIFF_AIFF_MAGIC); } // write COMM chunk dos.writeInt(AiffTool.AIFF_COMM_MAGIC); dos.writeInt(nCommChunkSize); dos.writeShort((short) format.getChannels()); dos.writeInt((lLength!=AudioSystem.NOT_SPECIFIED)? ((int) (lLength / format.getFrameSize())):LENGTH_NOT_KNOWN); if (nFormatCode==AiffTool.AIFF_COMM_ULAW) { // AIFF ulaw states 16 bits for ulaw data dos.writeShort(16); } else { dos.writeShort((short) format.getSampleSizeInBits()); } writeIeeeExtended(dos, format.getSampleRate()); if (bIsAifc) { dos.writeInt(nFormatCode); dos.writeShort(0); // no encoding name // TODO: write encoding.toString() ?? } // write header of SSND chunk dos.writeInt(AiffTool.AIFF_SSND_MAGIC); // don't use lSSndChunkSize here ! dos.writeInt((lLength!=AudioSystem.NOT_SPECIFIED) ?((int) (lLength+8)):LENGTH_NOT_KNOWN); // 8 information bytes of no interest dos.writeInt(0); // offset dos.writeInt(0); // blocksize } protected void patchHeader() throws IOException { TDataOutputStream tdos = getDataOutputStream(); tdos.seek(0); setLengthFromCalculatedLength(); writeHeader(); } public void close() throws IOException { long nBytesWritten=getCalculatedLength(); if ((nBytesWritten % 2)==1) { if (TDebug.TraceAudioOutputStream) { TDebug.out("AiffOutputStream.close(): adding padding byte"); } // extra byte for to align on word boundaries TDataOutputStream tdos = getDataOutputStream(); tdos.writeByte(0); // DON'T adjust calculated length ! } super.close(); } public void writeIeeeExtended(TDataOutputStream dos, float sampleRate) throws IOException { // currently, only integer sample rates are written // TODO: real conversion // I don't know exactly how much I have to shift left the mantisse for normalisation // now I do it so that there are any bits set in the first 5 bits int nSampleRate=(int) sampleRate; short ieeeExponent=0; while ((nSampleRate!=0) && (nSampleRate & 0x80000000)==0) { ieeeExponent++; nSampleRate<<=1; } dos.writeShort(16414-ieeeExponent); // exponent dos.writeInt(nSampleRate); // mantisse high double word dos.writeInt(0); // mantisse low double word } } /*** AiffAudioOutputStream.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/sampled/file/AiffTool.java0000644000175000017500000000560310374074736027050 0ustar twernertwerner/* * AiffTool.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2000 by Florian Bomers * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.sampled.file; import javax.sound.sampled.AudioFormat; import javax.sound.sampled.AudioSystem; /** * Common constants and methods for handling aiff and aiff-c files. * * @author Florian Bomers */ public class AiffTool { public static final int AIFF_FORM_MAGIC = 0x464F524D; public static final int AIFF_AIFF_MAGIC = 0x41494646; public static final int AIFF_AIFC_MAGIC = 0x41494643; public static final int AIFF_COMM_MAGIC = 0x434F4D4D; public static final int AIFF_SSND_MAGIC = 0x53534E44; public static final int AIFF_FVER_MAGIC = 0x46564552; public static final int AIFF_COMM_UNSPECIFIED = 0x00000000; // "0000" public static final int AIFF_COMM_PCM = 0x4E4F4E45; // "NONE" public static final int AIFF_COMM_ULAW = 0x756C6177; // "ulaw" public static final int AIFF_COMM_IMA_ADPCM = 0x696D6134; // "ima4" public static final int AIFF_FVER_TIME_STAMP = 0xA2805140; // May 23, 1990, 2:40pm public static int getFormatCode(AudioFormat format) { AudioFormat.Encoding encoding = format.getEncoding(); int nSampleSize = format.getSampleSizeInBits(); boolean bigEndian = format.isBigEndian(); // $$fb 2000-08-16: check the frame size, too. boolean frameSizeOK=format.getFrameSize()==AudioSystem.NOT_SPECIFIED || format.getChannels()!=AudioSystem.NOT_SPECIFIED || format.getFrameSize()==nSampleSize/8*format.getChannels(); if ((encoding.equals(AudioFormat.Encoding.PCM_SIGNED)) && ((bigEndian && nSampleSize>=16 && nSampleSize<=32) || (nSampleSize==8)) && frameSizeOK) { return AIFF_COMM_PCM; } else if (encoding.equals(AudioFormat.Encoding.ULAW) && nSampleSize == 8 && frameSizeOK) { return AIFF_COMM_ULAW; } else if (encoding.equals(new AudioFormat.Encoding("IMA_ADPCM")) && nSampleSize == 4) { return AIFF_COMM_IMA_ADPCM; } else { return AIFF_COMM_UNSPECIFIED; } } } /*** AiffTool.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/sampled/file/AuAudioFileReader.java0000644000175000017500000001342610540342725030610 0ustar twernertwerner/* * AuAudioFileReader.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999,2000,2001 by Florian Bomers * Copyright (c) 1999 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.sampled.file; import java.io.DataInputStream; import java.io.InputStream; import java.io.IOException; import java.util.*; import javax.sound.sampled.AudioFormat; import javax.sound.sampled.AudioFileFormat; import javax.sound.sampled.AudioSystem; import javax.sound.sampled.UnsupportedAudioFileException; import org.tritonus.share.TDebug; import org.tritonus.share.sampled.file.TAudioFileFormat; import org.tritonus.share.sampled.file.TAudioFileReader; /** Class for reading Sun/Next AU files. * * @author Florian Bomers * @author Matthias Pfisterer */ public class AuAudioFileReader extends TAudioFileReader { private static final int READ_LIMIT = 1000; public AuAudioFileReader() { super(READ_LIMIT); } private static String readDescription(DataInputStream dis, int len) throws IOException { byte c=-1; String ret=""; while (len>0 && (c=dis.readByte())!=0) { ret=ret+(char) c; len--; } if (len>1 && c==0) { dis.skip(len-1); } return ret; } protected AudioFileFormat getAudioFileFormat(InputStream inputStream, long lFileSizeInBytes) throws UnsupportedAudioFileException, IOException { if (TDebug.TraceAudioFileReader) {TDebug.out("AuAudioFileReader.getAudioFileFormat(InputStream, long): begin"); } DataInputStream dataInputStream = new DataInputStream(inputStream); int nMagic = dataInputStream.readInt(); if (nMagic != AuTool.AU_HEADER_MAGIC) { throw new UnsupportedAudioFileException( "not an AU file: wrong header magic"); } int nDataOffset = dataInputStream.readInt(); if (TDebug.TraceAudioFileReader) { TDebug.out("AuAudioFileReader.getAudioFileFormat(): data offset: " + nDataOffset); } if (nDataOffset < AuTool.DATA_OFFSET) { throw new UnsupportedAudioFileException( "not an AU file: data offset must be 24 or greater"); } int nDataLength = dataInputStream.readInt(); if (TDebug.TraceAudioFileReader) { TDebug.out("AuAudioFileReader.getAudioFileFormat(): data length: " + nDataLength); } if (nDataLength < 0 && nDataLength!=AuTool.AUDIO_UNKNOWN_SIZE) { throw new UnsupportedAudioFileException( "not an AU file: data length must be positive, 0 or -1 for unknown"); } AudioFormat.Encoding encoding = null; int nSampleSize = 0; int nEncoding = dataInputStream.readInt(); switch (nEncoding) { case AuTool.SND_FORMAT_MULAW_8: // 8-bit uLaw G.711 encoding = AudioFormat.Encoding.ULAW; nSampleSize = 8; break; case AuTool.SND_FORMAT_LINEAR_8: encoding = AudioFormat.Encoding.PCM_SIGNED; nSampleSize = 8; break; case AuTool.SND_FORMAT_LINEAR_16: encoding = AudioFormat.Encoding.PCM_SIGNED; nSampleSize = 16; break; case AuTool.SND_FORMAT_LINEAR_24: encoding = AudioFormat.Encoding.PCM_SIGNED; nSampleSize = 24; break; case AuTool.SND_FORMAT_LINEAR_32: encoding = AudioFormat.Encoding.PCM_SIGNED; nSampleSize = 32; break; case AuTool.SND_FORMAT_ALAW_8: // 8-bit aLaw G.711 encoding = AudioFormat.Encoding.ALAW; nSampleSize = 8; break; } if (nSampleSize == 0) { throw new UnsupportedAudioFileException( "unsupported AU file: unknown encoding " + nEncoding); } int nSampleRate = dataInputStream.readInt(); if (nSampleRate <= 0) { throw new UnsupportedAudioFileException( "corrupt AU file: sample rate must be positive"); } int nNumChannels = dataInputStream.readInt(); if (nNumChannels <= 0) { throw new UnsupportedAudioFileException( "corrupt AU file: number of channels must be positive"); } // skip header information field //inputStream.skip(nDataOffset - AuTool.DATA_OFFSET); // read header info field String desc = readDescription(dataInputStream, nDataOffset - AuTool.DATA_OFFSET); // add the description to the file format's properties Map properties = new HashMap(); if (desc!="") { properties.put("title", desc); } AudioFormat format = new AudioFormat(encoding, nSampleRate, nSampleSize, nNumChannels, calculateFrameSize(nSampleSize, nNumChannels), nSampleRate, true); AudioFileFormat audioFileFormat = new TAudioFileFormat( AudioFileFormat.Type.AU, format, (nDataLength==AuTool.AUDIO_UNKNOWN_SIZE)? AudioSystem.NOT_SPECIFIED:(nDataLength / format.getFrameSize()), (nDataLength==AuTool.AUDIO_UNKNOWN_SIZE)? AudioSystem.NOT_SPECIFIED:(nDataLength + nDataOffset), properties); if (TDebug.TraceAudioFileReader) { TDebug.out("AuAudioFileReader.getAudioFileFormat(InputStream, long): begin"); } return audioFileFormat; } } /*** AuAudioFileReader.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/sampled/file/AuAudioFileWriter.java0000644000175000017500000000651410374104304030654 0ustar twernertwerner/* * AuAudioFileWriter.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999,2000,2001 by Florian Bomers * Copyright (c) 1999 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.sampled.file; import java.io.IOException; import java.util.Arrays; import javax.sound.sampled.AudioFileFormat; import javax.sound.sampled.AudioFormat; import org.tritonus.share.sampled.file.AudioOutputStream; import org.tritonus.share.sampled.file.TAudioFileWriter; import org.tritonus.share.sampled.file.TDataOutputStream; /** * AudioFileWriter for Sun/Next AU files. * * @author Florian Bomers * @author Matthias Pfisterer */ public class AuAudioFileWriter extends TAudioFileWriter { private static final AudioFileFormat.Type[] FILE_TYPES = { AudioFileFormat.Type.AU }; // IMPORTANT: this array depends on the AudioFormat.match() algorithm which takes // AudioSystem.NOT_SPECIFIED into account ! private static final AudioFormat[] AUDIO_FORMATS = { new AudioFormat(AudioFormat.Encoding.PCM_SIGNED, ALL, 8, ALL, ALL, ALL, true), new AudioFormat(AudioFormat.Encoding.PCM_SIGNED, ALL, 8, ALL, ALL, ALL, false), new AudioFormat(AudioFormat.Encoding.ULAW, ALL, 8, ALL, ALL, ALL, false), new AudioFormat(AudioFormat.Encoding.ULAW, ALL, 8, ALL, ALL, ALL, true), new AudioFormat(AudioFormat.Encoding.ALAW, ALL, 8, ALL, ALL, ALL, false), new AudioFormat(AudioFormat.Encoding.ALAW, ALL, 8, ALL, ALL, ALL, true), new AudioFormat(AudioFormat.Encoding.PCM_SIGNED, ALL, 16, ALL, ALL, ALL, true), new AudioFormat(AudioFormat.Encoding.PCM_SIGNED, ALL, 24, ALL, ALL, ALL, true), new AudioFormat(AudioFormat.Encoding.PCM_SIGNED, ALL, 32, ALL, ALL, ALL, true), }; public AuAudioFileWriter() { super(Arrays.asList(FILE_TYPES), Arrays.asList(AUDIO_FORMATS)); } protected boolean isAudioFormatSupportedImpl(AudioFormat format, AudioFileFormat.Type fileType) { return AuTool.getFormatCode(format)!=AuTool.SND_FORMAT_UNSPECIFIED; } protected AudioOutputStream getAudioOutputStream(AudioFormat audioFormat, long lLengthInBytes, AudioFileFormat.Type fileType, TDataOutputStream dataOutputStream) throws IOException { return new AuAudioOutputStream(audioFormat, lLengthInBytes, dataOutputStream); } } /*** AuAudioFileWriter.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/sampled/file/AuAudioOutputStream.java0000644000175000017500000000723410374074736031273 0ustar twernertwerner/* * AuAudioOutputStream.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2000,2001 by Florian Bomers * Copyright (c) 1999 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.sampled.file; import java.io.IOException; import javax.sound.sampled.AudioFormat; import javax.sound.sampled.AudioSystem; import org.tritonus.share.TDebug; import org.tritonus.share.sampled.file.TAudioOutputStream; import org.tritonus.share.sampled.file.TDataOutputStream; /** * AudioOutputStream for AU files. * * @author Florian Bomers * @author Matthias Pfisterer */ public class AuAudioOutputStream extends TAudioOutputStream { private static String description="Created by Tritonus"; /** * Writes a null-terminated ascii string s to f. * The total number of bytes written is aligned on a 2byte boundary. * @exception IOException Write error. */ protected static void writeText(TDataOutputStream dos, String s) throws IOException { if (s.length()>0) { dos.writeBytes(s); dos.writeByte(0); // pour terminer le texte if ((s.length() % 2)==0) { // ajout d'un zero pour faire la longeur pair dos.writeByte(0); } } } /** * Returns number of bytes that have to written for string s (with alignment) */ protected static int getTextLength(String s) { if (s.length()==0) { return 0; } else { return (s.length()+2) & 0xFFFFFFFE; } } public AuAudioOutputStream(AudioFormat audioFormat, long lLength, TDataOutputStream dataOutputStream) { // if length exceeds 2GB, set the length field to NOT_SPECIFIED super(audioFormat, lLength>0x7FFFFFFFl?AudioSystem.NOT_SPECIFIED:lLength, dataOutputStream, lLength == AudioSystem.NOT_SPECIFIED && dataOutputStream.supportsSeek()); } protected void writeHeader() throws IOException { if (TDebug.TraceAudioOutputStream) { TDebug.out("AuAudioOutputStream.writeHeader(): called."); } AudioFormat format = getFormat(); long lLength = getLength(); TDataOutputStream dos = getDataOutputStream(); if (TDebug.TraceAudioOutputStream) { TDebug.out("AuAudioOutputStream.writeHeader(): AudioFormat: " + format); TDebug.out("AuAudioOutputStream.writeHeader(): length: " + lLength); } dos.writeInt(AuTool.AU_HEADER_MAGIC); dos.writeInt(AuTool.DATA_OFFSET+getTextLength(description)); dos.writeInt((lLength!=AudioSystem.NOT_SPECIFIED)?((int) lLength):AuTool.AUDIO_UNKNOWN_SIZE); dos.writeInt(AuTool.getFormatCode(format)); dos.writeInt((int) format.getSampleRate()); dos.writeInt(format.getChannels()); writeText(dos, description); } protected void patchHeader() throws IOException { TDataOutputStream tdos = getDataOutputStream(); tdos.seek(0); setLengthFromCalculatedLength(); writeHeader(); } } /*** AuAudioOutputStream.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/sampled/file/AuTool.java0000644000175000017500000000640710374074736026553 0ustar twernertwerner/* * AuTool.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2000,2001 by Florian Bomers * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.sampled.file; import javax.sound.sampled.AudioFormat; import javax.sound.sampled.AudioSystem; /** Common constants and methods for handling au files. * * @author Florian Bomers */ public class AuTool { public static final int AU_HEADER_MAGIC = 0x2e736e64; public static final int AUDIO_UNKNOWN_SIZE = -1; // length of header in bytes public static final int DATA_OFFSET = 24; public static final int SND_FORMAT_UNSPECIFIED = 0; public static final int SND_FORMAT_MULAW_8 = 1; public static final int SND_FORMAT_LINEAR_8 = 2; public static final int SND_FORMAT_LINEAR_16 = 3; public static final int SND_FORMAT_LINEAR_24 = 4; public static final int SND_FORMAT_LINEAR_32 = 5; public static final int SND_FORMAT_FLOAT = 6; public static final int SND_FORMAT_DOUBLE = 7; public static final int SND_FORMAT_ADPCM_G721 = 23; public static final int SND_FORMAT_ADPCM_G722 = 24; public static final int SND_FORMAT_ADPCM_G723_3 = 25; public static final int SND_FORMAT_ADPCM_G723_5 = 26; public static final int SND_FORMAT_ALAW_8 = 27; public static int getFormatCode(AudioFormat format) { AudioFormat.Encoding encoding = format.getEncoding(); int nSampleSize = format.getSampleSizeInBits(); // must be big endian for >8 bit formats boolean bigEndian = format.isBigEndian(); // $$fb 2000-08-16: check the frame size, too. boolean frameSizeOK=( format.getFrameSize()==AudioSystem.NOT_SPECIFIED || format.getChannels()!=AudioSystem.NOT_SPECIFIED || format.getFrameSize()==nSampleSize/8*format.getChannels()); if (encoding.equals(AudioFormat.Encoding.ULAW) && nSampleSize == 8 && frameSizeOK) { return SND_FORMAT_MULAW_8; } else if (encoding.equals(AudioFormat.Encoding.PCM_SIGNED) && frameSizeOK) { if (nSampleSize == 8) { return SND_FORMAT_LINEAR_8; } else if (nSampleSize == 16 && bigEndian) { return SND_FORMAT_LINEAR_16; } else if (nSampleSize == 24 && bigEndian) { return SND_FORMAT_LINEAR_24; } else if (nSampleSize == 32 && bigEndian) { return SND_FORMAT_LINEAR_32; } } else if (encoding.equals(AudioFormat.Encoding.ALAW) && nSampleSize == 8 && frameSizeOK) { return SND_FORMAT_ALAW_8; } return SND_FORMAT_UNSPECIFIED; } } /*** AuTool.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/sampled/file/WaveAudioFileReader.java0000644000175000017500000002252510374160733031147 0ustar twernertwerner/* * WaveAudioFileReader.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999,2000 by Florian Bomers * Copyright (c) 1999 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.sampled.file; import java.io.DataInputStream; import java.io.InputStream; import java.io.IOException; import javax.sound.sampled.AudioSystem; import javax.sound.sampled.AudioFormat; import javax.sound.sampled.AudioFileFormat; import javax.sound.sampled.UnsupportedAudioFileException; import org.tritonus.share.TDebug; import org.tritonus.share.sampled.file.TAudioFileFormat; import org.tritonus.share.sampled.file.TAudioFileReader; /** * Class for reading wave files. * * @author Florian Bomers * @author Matthias Pfisterer */ public class WaveAudioFileReader extends TAudioFileReader { private static final int READ_LIMIT = 1000; public WaveAudioFileReader() { super(READ_LIMIT); } protected void advanceChunk(DataInputStream dis, long prevLength, long prevRead) throws IOException { if (prevLength>0) { dis.skip(((prevLength+1) & 0xFFFFFFFE)-prevRead); } } protected long findChunk(DataInputStream dis, int key) throws UnsupportedAudioFileException, IOException { // $$fb 1999-12-18: we should take care that we don't exceed // the mark of this stream. When we exceeded the mark and // we notice that we don't support this wave file, // other potential wave file readers have no chance. int thisKey; long chunkLength=0; do { advanceChunk(dis, chunkLength, 0); try { thisKey = dis.readInt(); } catch (IOException e) { if (TDebug.TraceAllExceptions) { TDebug.out(e); } // $$fb: when we come here, we skipped past the end of the wave file // without finding the chunk. // IMHO, this is not an IOException, as there are incarnations // of WAVE files which store data in different chunks. // maybe we can find a nice description of the "required chunk" ? throw new UnsupportedAudioFileException( "unsupported WAVE file: required chunk not found."); } chunkLength = readLittleEndianInt(dis) & 0xFFFFFFFF; // unsigned } while (thisKey != key); return chunkLength; } protected AudioFormat readFormatChunk(DataInputStream dis, long chunkLength) throws UnsupportedAudioFileException, IOException { String debugAdd=""; int read=WaveTool.MIN_FMT_CHUNK_LENGTH; if (chunkLength0xFFFFFFFFl) { lLength=0xFFFFFFFFl-dataOffset; } // chunks must be on word-boundaries long lDataChunkSize=lLength+(lLength%2); TDataOutputStream dos = getDataOutputStream(); // write RIFF container chunk dos.writeInt(WaveTool.WAVE_RIFF_MAGIC); dos.writeLittleEndian32((int) ((lDataChunkSize+dataOffset-WaveTool.CHUNK_HEADER_SIZE) & 0xFFFFFFFF)); dos.writeInt(WaveTool.WAVE_WAVE_MAGIC); // write fmt_ chunk int formatChunkSize=WaveTool.FMT_CHUNK_SIZE+formatChunkAdd; short sampleSizeInBits=(short) format.getSampleSizeInBits(); int decodedSamplesPerBlock=1; if (formatCode==WaveTool.WAVE_FORMAT_GSM610) { if (format.getFrameSize()==33) { decodedSamplesPerBlock=320; } else if (format.getFrameSize()==65) { decodedSamplesPerBlock=320; } else { // how to retrieve this value here ? decodedSamplesPerBlock=(int) (format.getFrameSize()*(320.0f/65.0f)); } sampleSizeInBits=0; // MS standard } int avgBytesPerSec=((int) format.getSampleRate())/decodedSamplesPerBlock*format.getFrameSize(); dos.writeInt(WaveTool.WAVE_FMT_MAGIC); dos.writeLittleEndian32(formatChunkSize); dos.writeLittleEndian16((short) formatCode); // wFormatTag dos.writeLittleEndian16((short) format.getChannels()); // nChannels dos.writeLittleEndian32((int) format.getSampleRate()); // nSamplesPerSec dos.writeLittleEndian32(avgBytesPerSec); // nAvgBytesPerSec dos.writeLittleEndian16((short) format.getFrameSize()); // nBlockalign dos.writeLittleEndian16(sampleSizeInBits); // wBitsPerSample dos.writeLittleEndian16((short) formatChunkAdd); // cbSize if (formatCode==WaveTool.WAVE_FORMAT_GSM610) { dos.writeLittleEndian16((short) decodedSamplesPerBlock); // wSamplesPerBlock } // write fact chunk if (formatCode!=WaveTool.WAVE_FORMAT_PCM) { // write "fact" chunk: number of samples // todo: add this as an attribute or property // in AudioOutputStream or AudioInputStream long samples=0; if (lLength!=AudioSystem.NOT_SPECIFIED) { samples=lLength/format.getFrameSize()*decodedSamplesPerBlock; } // saturate sample count if (samples>0xFFFFFFFFl) { samples=(0xFFFFFFFFl/decodedSamplesPerBlock)*decodedSamplesPerBlock; } dos.writeInt(WaveTool.WAVE_FACT_MAGIC); dos.writeLittleEndian32(4); dos.writeLittleEndian32((int) (samples & 0xFFFFFFFF)); } // write header of data chunk dos.writeInt(WaveTool.WAVE_DATA_MAGIC); dos.writeLittleEndian32((lLength!=AudioSystem.NOT_SPECIFIED)?((int) lLength):LENGTH_NOT_KNOWN); } protected void patchHeader() throws IOException { TDataOutputStream tdos = getDataOutputStream(); tdos.seek(0); setLengthFromCalculatedLength(); writeHeader(); } public void close() throws IOException { long nBytesWritten=getCalculatedLength(); if ((nBytesWritten % 2)==1) { if (TDebug.TraceAudioOutputStream) { TDebug.out("WaveOutputStream.close(): adding padding byte"); } // extra byte for to align on word boundaries TDataOutputStream tdos = getDataOutputStream(); tdos.writeByte(0); // DON'T adjust calculated length ! } super.close(); } } /*** WaveAudioOutputStream.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/sampled/file/WaveTool.java0000644000175000017500000001043110374074736027100 0ustar twernertwerner/* * WaveTool.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2000 by Florian Bomers * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.sampled.file; import javax.sound.sampled.AudioSystem; import javax.sound.sampled.AudioFormat; /** * Common constants and methods for handling wave files. * * @author Florian Bomers */ public class WaveTool { public static final int WAVE_RIFF_MAGIC = 0x52494646; // "RIFF" public static final int WAVE_WAVE_MAGIC = 0x57415645; // "WAVE" public static final int WAVE_FMT_MAGIC = 0x666D7420; // "fmt " public static final int WAVE_DATA_MAGIC = 0x64617461; // "DATA" public static final int WAVE_FACT_MAGIC = 0x66616374; // "fact" public static final short WAVE_FORMAT_UNSPECIFIED = 0; public static final short WAVE_FORMAT_PCM = 1; public static final short WAVE_FORMAT_MS_ADPCM = 2; public static final short WAVE_FORMAT_ALAW = 6; public static final short WAVE_FORMAT_ULAW = 7; public static final short WAVE_FORMAT_IMA_ADPCM = 17; // same as DVI_ADPCM public static final short WAVE_FORMAT_G723_ADPCM = 20; public static final short WAVE_FORMAT_GSM610 = 49; public static final short WAVE_FORMAT_G721_ADPCM = 64; public static final short WAVE_FORMAT_MPEG = 80; public static final int MIN_FMT_CHUNK_LENGTH=14; public static final int MIN_DATA_OFFSET=12+8+MIN_FMT_CHUNK_LENGTH+8; public static final int MIN_FACT_CHUNK_LENGTH = 4; // we always write the sample size in bits and the length of extra bytes. // There are programs (CoolEdit) that rely on the // additional entry for sample size in bits. public static final int FMT_CHUNK_SIZE=18; public static final int RIFF_CONTAINER_CHUNK_SIZE=12; public static final int CHUNK_HEADER_SIZE=8; public static final int DATA_OFFSET=RIFF_CONTAINER_CHUNK_SIZE +CHUNK_HEADER_SIZE+FMT_CHUNK_SIZE+CHUNK_HEADER_SIZE; public static AudioFormat.Encoding GSM0610 = new AudioFormat.Encoding("GSM0610"); public static AudioFormat.Encoding IMA_ADPCM = new AudioFormat.Encoding("IMA_ADPCM"); public static short getFormatCode(AudioFormat format) { AudioFormat.Encoding encoding = format.getEncoding(); int nSampleSize = format.getSampleSizeInBits(); boolean littleEndian = !format.isBigEndian(); boolean frameSizeOK=format.getFrameSize()==AudioSystem.NOT_SPECIFIED || format.getChannels()!=AudioSystem.NOT_SPECIFIED || format.getFrameSize()==nSampleSize/8*format.getChannels(); if (nSampleSize==8 && frameSizeOK && (encoding.equals(AudioFormat.Encoding.PCM_SIGNED) || encoding.equals(AudioFormat.Encoding.PCM_UNSIGNED))) { return WAVE_FORMAT_PCM; } else if (nSampleSize>8 && frameSizeOK && littleEndian && encoding.equals(AudioFormat.Encoding.PCM_SIGNED)) { return WAVE_FORMAT_PCM; } else if (encoding.equals(AudioFormat.Encoding.ULAW) && (nSampleSize==AudioSystem.NOT_SPECIFIED || nSampleSize == 8) && frameSizeOK) { return WAVE_FORMAT_ULAW; } else if (encoding.equals(AudioFormat.Encoding.ALAW) && (nSampleSize==AudioSystem.NOT_SPECIFIED || nSampleSize == 8) && frameSizeOK) { return WAVE_FORMAT_ALAW; } else if (encoding.equals(new AudioFormat.Encoding("IMA_ADPCM")) && nSampleSize == 4) { return WAVE_FORMAT_IMA_ADPCM; } else if (encoding.equals(GSM0610)) { return WAVE_FORMAT_GSM610; } return WAVE_FORMAT_UNSPECIFIED; } } /*** WaveTool.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/sampled/file/package.html0000644000175000017500000000033710172460777026762 0ustar twernertwerner

Standard audio file readers and writers (.aiff, .au, .wav). The classes provided here .

libtritonus-java-20070428/src/classes/org/tritonus/sampled/file/jorbis/0000755000175000017500000000000010621572476025765 5ustar twernertwernerlibtritonus-java-20070428/src/classes/org/tritonus/sampled/file/jorbis/JorbisAudioFileReader.java0000644000175000017500000001671710374142165032772 0ustar twernertwerner/* * JorbisAudioFileReader.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2001 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.sampled.file.jorbis; import java.io.InputStream; import java.io.IOException; import javax.sound.sampled.AudioSystem; import javax.sound.sampled.AudioFormat; import javax.sound.sampled.AudioFileFormat; import javax.sound.sampled.UnsupportedAudioFileException; import org.tritonus.share.TDebug; import org.tritonus.share.sampled.file.TAudioFileFormat; import org.tritonus.share.sampled.file.TAudioFileReader; import com.jcraft.jogg.Buffer; import com.jcraft.jogg.SyncState; import com.jcraft.jogg.StreamState; import com.jcraft.jogg.Page; import com.jcraft.jogg.Packet; /** * @author Matthias Pfisterer */ public class JorbisAudioFileReader extends TAudioFileReader { private static final int INITAL_READ_LENGTH = 4096; private static final int MARK_LIMIT = INITAL_READ_LENGTH + 1; public JorbisAudioFileReader() { super(MARK_LIMIT, true); } protected AudioFileFormat getAudioFileFormat(InputStream inputStream, long lFileSizeInBytes) throws UnsupportedAudioFileException, IOException { // sync and verify incoming physical bitstream SyncState oggSyncState = new SyncState(); // take physical pages, weld into a logical stream of packets StreamState oggStreamState = new StreamState(); // one Ogg bitstream page. Vorbis packets are inside Page oggPage = new Page(); // one raw packet of data for decode Packet oggPacket = new Packet(); int bytes = 0; // Decode setup oggSyncState.init(); // Now we can read pages // grab some data at the head of the stream. We want the first page // (which is guaranteed to be small and only contain the Vorbis // stream initial header) We need the first page to get the stream // serialno. // submit a 4k block to libvorbis' Ogg layer int index = oggSyncState.buffer(INITAL_READ_LENGTH); bytes = inputStream.read(oggSyncState.data, index, INITAL_READ_LENGTH); oggSyncState.wrote(bytes); // Get the first page. if (oggSyncState.pageout(oggPage) != 1) { // have we simply run out of data? If so, we're done. if (bytes < 4096) { // IDEA: throw EOFException? throw new UnsupportedAudioFileException("not a Vorbis stream: ended prematurely"); } throw new UnsupportedAudioFileException("not a Vorbis stream: not in Ogg bitstream format"); } // Get the serial number and set up the rest of decode. // serialno first; use it to set up a logical stream oggStreamState.init(oggPage.serialno()); // extract the initial header from the first page and verify that the // Ogg bitstream is in fact Vorbis data // I handle the initial header first instead of just having the code // read all three Vorbis headers at once because reading the initial // header is an easy way to identify a Vorbis bitstream and it's // useful to see that functionality seperated out. if (oggStreamState.pagein(oggPage) < 0) { // error; stream version mismatch perhaps throw new UnsupportedAudioFileException("not a Vorbis stream: can't read first page of Ogg bitstream data"); } if (oggStreamState.packetout(oggPacket) != 1) { // no page? must not be vorbis throw new UnsupportedAudioFileException("not a Vorbis stream: can't read initial header packet"); } Buffer oggPacketBuffer = new Buffer(); oggPacketBuffer.readinit(oggPacket.packet_base, oggPacket.packet, oggPacket.bytes); int nPacketType = oggPacketBuffer.read(8); byte[] buf = new byte[6]; oggPacketBuffer.read(buf, 6); if(buf[0]!='v' || buf[1]!='o' || buf[2]!='r' || buf[3]!='b' || buf[4]!='i' || buf[5]!='s') { throw new UnsupportedAudioFileException("not a Vorbis stream: not a vorbis header packet"); } if (nPacketType != 1) { throw new UnsupportedAudioFileException("not a Vorbis stream: first packet is not the identification header"); } if(oggPacket.b_o_s == 0) { throw new UnsupportedAudioFileException("not a Vorbis stream: initial packet not marked as beginning of stream"); } int nVersion = oggPacketBuffer.read(32); if (nVersion != 0) { throw new UnsupportedAudioFileException("not a Vorbis stream: wrong vorbis version"); } int nChannels = oggPacketBuffer.read(8); float fSampleRate = oggPacketBuffer.read(32); // These are only used for error checking. /*int bitrate_upper =*/ oggPacketBuffer.read(32); /*int bitrate_nominal =*/ oggPacketBuffer.read(32); /*int bitrate_lower =*/ oggPacketBuffer.read(32); int[] blocksizes = new int[2]; blocksizes[0] = 1 << oggPacketBuffer.read(4); blocksizes[1] = 1 << oggPacketBuffer.read(4); if (fSampleRate < 1.0F || nChannels < 1 || blocksizes[0] < 8|| blocksizes[1] < blocksizes[0] || oggPacketBuffer.read(1) != 1) { throw new UnsupportedAudioFileException("not a Vorbis stream: illegal values in initial header"); } if (TDebug.TraceAudioFileReader) { TDebug.out("JorbisAudioFileReader.getAudioFileFormat(): channels: " + nChannels); } if (TDebug.TraceAudioFileReader) { TDebug.out("JorbisAudioFileReader.getAudioFileFormat(): rate: " + fSampleRate); } /* If the file size is known, we derive the number of frames ('frame size') from it. If the values don't fit into integers, we leave them at NOT_SPECIFIED. 'Unknown' is considered less incorrect than a wrong value. */ // [fb] not specifying it causes Sun's Wave file writer to write rubbish int nByteSize = AudioSystem.NOT_SPECIFIED; if (lFileSizeInBytes != AudioSystem.NOT_SPECIFIED && lFileSizeInBytes <= Integer.MAX_VALUE) { nByteSize = (int) lFileSizeInBytes; } int nFrameSize = AudioSystem.NOT_SPECIFIED; /* Can we calculate a useful size? Peeking into ogginfo gives the insight that the only way seems to be reading through the file. This is something we do not want, at least not by default. */ // nFrameSize = (int) (lFileSizeInBytes / ...; AudioFormat format = new AudioFormat( new AudioFormat.Encoding("VORBIS"), fSampleRate, AudioSystem.NOT_SPECIFIED, nChannels, AudioSystem.NOT_SPECIFIED, AudioSystem.NOT_SPECIFIED, true); // this value is chosen arbitrarily if (TDebug.TraceAudioFileReader) { TDebug.out("JorbisAudioFileReader.getAudioFileFormat(): AudioFormat: " + format); } AudioFileFormat.Type type = new AudioFileFormat.Type("Ogg","ogg"); AudioFileFormat audioFileFormat = new TAudioFileFormat( type, format, nFrameSize, nByteSize); if (TDebug.TraceAudioFileReader) { TDebug.out("JorbisAudioFileReader.getAudioFileFormat(): AudioFileFormat: " + audioFileFormat); } return audioFileFormat; } } /*** JorbisAudioFileReader.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/sampled/file/jorbis/package.html0000644000175000017500000000033510172460777030250 0ustar twernertwerner

Ogg vorbis audio file reader based on the jorbis library. The classes provided here .

libtritonus-java-20070428/src/classes/org/tritonus/sampled/file/pvorbis/0000755000175000017500000000000010621572476026161 5ustar twernertwernerlibtritonus-java-20070428/src/classes/org/tritonus/sampled/file/pvorbis/VorbisAudioFileReader.java0000644000175000017500000002550210374142166033173 0ustar twernertwerner/* * VorbisAudioFileReader.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2001 - 2004 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.sampled.file.pvorbis; import java.io.InputStream; import java.io.IOException; import javax.sound.sampled.AudioSystem; import javax.sound.sampled.AudioFormat; import javax.sound.sampled.AudioFileFormat; import javax.sound.sampled.UnsupportedAudioFileException; import org.tritonus.share.TDebug; import org.tritonus.share.sampled.file.TAudioFileFormat; import org.tritonus.share.sampled.file.TAudioFileReader; import org.tritonus.lowlevel.pogg.Page; import org.tritonus.lowlevel.pogg.Packet; import org.tritonus.lowlevel.pogg.SyncState; import org.tritonus.lowlevel.pogg.StreamState; /** * @author Matthias Pfisterer */ public class VorbisAudioFileReader extends TAudioFileReader { private static final int INITAL_READ_LENGTH = 4096; private static final int MARK_LIMIT = INITAL_READ_LENGTH + 1; public VorbisAudioFileReader() { super(MARK_LIMIT, true); } protected AudioFileFormat getAudioFileFormat(InputStream inputStream, long lFileSizeInBytes) throws UnsupportedAudioFileException, IOException { if (TDebug.TraceAudioFileReader) { TDebug.out(">VorbisAudioFileReader.getAudioFileFormat(): begin"); } SyncState oggSyncState = new SyncState(); StreamState oggStreamState = new StreamState(); Page oggPage = new Page(); Packet oggPacket = new Packet(); int bytes = 0; // Decode setup oggSyncState.init(); // Now we can read pages // grab some data at the head of the stream. We want the first page // (which is guaranteed to be small and only contain the Vorbis // stream initial header) We need the first page to get the stream // serialno. // submit a 4k block to libvorbis' Ogg layer byte[] abBuffer = new byte[INITAL_READ_LENGTH]; bytes = inputStream.read(abBuffer); if (TDebug.TraceAudioFileReader) { TDebug.out("read bytes from input stream: " + bytes); } int nResult = oggSyncState.write(abBuffer, bytes); if (TDebug.TraceAudioFileReader) { TDebug.out("SyncState.write() returned " + nResult); } // Get the first page. if (oggSyncState.pageOut(oggPage) != 1) { // have we simply run out of data? If so, we're done. if (bytes < INITAL_READ_LENGTH) { if (TDebug.TraceAudioFileReader) { TDebug.out("stream ended prematurely"); } if (TDebug.TraceAudioFileReader) { TDebug.out(">> 4) & 0xF); if (TDebug.TraceAudioFileReader) { TDebug.out("blocksizes[0]: " + blocksizes[0]); } if (TDebug.TraceAudioFileReader) { TDebug.out("blocksizes[1]: " + blocksizes[1]); } if (fSampleRate < 1.0F || nChannels < 1 || blocksizes[0] < 8 || blocksizes[1] < blocksizes[0] || (abData[29] & 0x1) != 1) { if (TDebug.TraceAudioFileReader) { TDebug.out("illegal values in initial header"); } if (TDebug.TraceAudioFileReader) { TDebug.out(" * Copyright (c) 2000 -2004 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.sampled.file.pvorbis; import java.util.Arrays; import javax.sound.sampled.AudioFileFormat; import javax.sound.sampled.AudioFormat; import org.tritonus.share.TDebug; import org.tritonus.share.sampled.file.THeaderlessAudioFileWriter; /** Class for writing Vorbis streams * * @author Florian Bomers * @author Matthias Pfisterer */ public class VorbisAudioFileWriter extends THeaderlessAudioFileWriter { private static final AudioFileFormat.Type[] FILE_TYPES = { new AudioFileFormat.Type("Vorbis", "ogg") }; private static final AudioFormat[] AUDIO_FORMATS = { new AudioFormat(new AudioFormat.Encoding("VORBIS"), ALL, ALL, ALL, ALL, ALL, false), new AudioFormat(new AudioFormat.Encoding("VORBIS"), ALL, ALL, ALL, ALL, ALL, true), }; public VorbisAudioFileWriter() { super(Arrays.asList(FILE_TYPES), Arrays.asList(AUDIO_FORMATS)); if (TDebug.TraceAudioFileWriter) { TDebug.out("VorbisAudioFileWriter.(): begin"); } if (TDebug.TraceAudioFileWriter) { TDebug.out("VorbisAudioFileWriter.(): end"); } } } /*** VorbisAudioFileWriter.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/sampled/file/pvorbis/package.html0000644000175000017500000000042110167457147030441 0ustar twernertwerner

Ogg vorbis audio file reader and writer based on the pure java libraries. The classes provided here .

@see org.tritonus.lowlevel.ogg libtritonus-java-20070428/src/classes/org/tritonus/sampled/file/vorbis/0000755000175000017500000000000010621572477026002 5ustar twernertwernerlibtritonus-java-20070428/src/classes/org/tritonus/sampled/file/vorbis/VorbisAudioFileReader.java0000644000175000017500000002576310374142166033024 0ustar twernertwerner/* * VorbisAudioFileReader.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2001 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.sampled.file.vorbis; import java.io.InputStream; import java.io.IOException; import javax.sound.sampled.AudioSystem; import javax.sound.sampled.AudioFormat; import javax.sound.sampled.AudioFileFormat; import javax.sound.sampled.UnsupportedAudioFileException; import org.tritonus.share.TDebug; import org.tritonus.share.sampled.file.TAudioFileFormat; import org.tritonus.share.sampled.file.TAudioFileReader; import org.tritonus.lowlevel.ogg.Page; import org.tritonus.lowlevel.ogg.Packet; import org.tritonus.lowlevel.ogg.SyncState; import org.tritonus.lowlevel.ogg.StreamState; /** * @author Matthias Pfisterer */ public class VorbisAudioFileReader extends TAudioFileReader { private static final int INITAL_READ_LENGTH = 4096; private static final int MARK_LIMIT = INITAL_READ_LENGTH + 1; public VorbisAudioFileReader() { super(MARK_LIMIT, true); } protected AudioFileFormat getAudioFileFormat(InputStream inputStream, long lFileSizeInBytes) throws UnsupportedAudioFileException, IOException { if (TDebug.TraceAudioFileReader) { TDebug.out(">VorbisAudioFileReader.getAudioFileFormat(): begin"); } SyncState oggSyncState = new SyncState(); StreamState oggStreamState = new StreamState(); Page oggPage = new Page(); Packet oggPacket = new Packet(); int bytes = 0; // Decode setup oggSyncState.init(); // Now we can read pages // grab some data at the head of the stream. We want the first page // (which is guaranteed to be small and only contain the Vorbis // stream initial header) We need the first page to get the stream // serialno. // submit a 4k block to libvorbis' Ogg layer byte[] abBuffer = new byte[INITAL_READ_LENGTH]; bytes = inputStream.read(abBuffer); if (TDebug.TraceAudioFileReader) { TDebug.out("read bytes from input stream: " + bytes); } int nResult = oggSyncState.write(abBuffer, bytes); if (TDebug.TraceAudioFileReader) { TDebug.out("SyncState.write() returned " + nResult); } // Get the first page. if (oggSyncState.pageOut(oggPage) != 1) { // have we simply run out of data? If so, we're done. if (bytes < INITAL_READ_LENGTH) { if (TDebug.TraceAudioFileReader) { TDebug.out("stream ended prematurely"); } if (TDebug.TraceAudioFileReader) { TDebug.out(">> 4) & 0xF); if (TDebug.TraceAudioFileReader) { TDebug.out("blocksizes[0]: " + blocksizes[0]); } if (TDebug.TraceAudioFileReader) { TDebug.out("blocksizes[1]: " + blocksizes[1]); } if (fSampleRate < 1.0F || nChannels < 1 || blocksizes[0] < 8|| blocksizes[1] < blocksizes[0] || (abData[29] & 0x1) != 1) { if (TDebug.TraceAudioFileReader) { TDebug.out("illegal values in initial header"); } if (TDebug.TraceAudioFileReader) { TDebug.out(" * Copyright (c) 2000 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.sampled.file.vorbis; import java.util.Arrays; import javax.sound.sampled.AudioFileFormat; import javax.sound.sampled.AudioFormat; import org.tritonus.share.TDebug; import org.tritonus.share.sampled.file.THeaderlessAudioFileWriter; /** Class for writing Vorbis streams * * @author Florian Bomers * @author Matthias Pfisterer */ public class VorbisAudioFileWriter extends THeaderlessAudioFileWriter { private static final AudioFileFormat.Type[] FILE_TYPES = { new AudioFileFormat.Type("Vorbis", "ogg") }; private static final AudioFormat[] AUDIO_FORMATS = { new AudioFormat(new AudioFormat.Encoding("VORBIS"), ALL, ALL, ALL, ALL, ALL, false), new AudioFormat(new AudioFormat.Encoding("VORBIS"), ALL, ALL, ALL, ALL, ALL, true), }; public VorbisAudioFileWriter() { super(Arrays.asList(FILE_TYPES), Arrays.asList(AUDIO_FORMATS)); if (TDebug.TraceAudioFileWriter) { TDebug.out("VorbisAudioFileWriter.(): begin"); } if (TDebug.TraceAudioFileWriter) { TDebug.out("VorbisAudioFileWriter.(): end"); } } } /*** VorbisAudioFileWriter.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/sampled/file/vorbis/package.html0000644000175000017500000000041210172461000030234 0ustar twernertwerner

Ogg vorbis audio file reader and writer based on native libraries. The classes provided here .

@see org.tritonus.lowlevel.ogg libtritonus-java-20070428/src/classes/org/tritonus/sampled/mixer/0000755000175000017500000000000010621572500024666 5ustar twernertwernerlibtritonus-java-20070428/src/classes/org/tritonus/sampled/mixer/alsa/0000755000175000017500000000000010621572500025606 5ustar twernertwernerlibtritonus-java-20070428/src/classes/org/tritonus/sampled/mixer/alsa/AlsaBaseDataLine.java0000644000175000017500000003037410375041157031542 0ustar twernertwerner/* * AlsaBaseDataLine.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999 - 2001 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.sampled.mixer.alsa; import java.util.Collection; import javax.sound.sampled.AudioFormat; import javax.sound.sampled.DataLine; import javax.sound.sampled.FloatControl; import javax.sound.sampled.LineUnavailableException; import org.tritonus.share.TDebug; import org.tritonus.lowlevel.alsa.Alsa; import org.tritonus.lowlevel.alsa.AlsaPcm; import org.tritonus.lowlevel.alsa.AlsaPcmHWParams; import org.tritonus.lowlevel.alsa.AlsaPcmSWParams; import org.tritonus.share.sampled.mixer.TBaseDataLine; public abstract class AlsaBaseDataLine extends TBaseDataLine { // private static final Class[] CONTROL_CLASSES = {GainControl.class}; private AlsaPcm m_alsaPcm; private boolean m_bSwapBytes; /* * Only used if m_bSwapBytes is true. */ private int m_nBytesPerSample; public AlsaBaseDataLine(AlsaDataLineMixer mixer, DataLine.Info info) throws LineUnavailableException { super(mixer, info); if (TDebug.TraceSourceDataLine) { TDebug.out("AlsaBaseDataLine.(): begin"); } if (TDebug.TraceSourceDataLine) { TDebug.out("AlsaBaseDataLine.(): end"); } } public AlsaBaseDataLine(AlsaDataLineMixer mixer, DataLine.Info info, Collection controls) throws LineUnavailableException { super(mixer, info); if (TDebug.TraceSourceDataLine) { TDebug.out("AlsaBaseDataLine.(): begin"); } if (TDebug.TraceSourceDataLine) { TDebug.out("AlsaBaseDataLine.(): end"); } } protected AlsaDataLineMixer getAlsaDataLineMixer() { return (AlsaDataLineMixer) getMixer(); } protected AlsaPcm getAlsaPcm() { return m_alsaPcm; } /** Returns the ALSA stream type of this line. Subclasses must implement this method to return either AlsaPcm.SND_PCM_STREAM_PLAYBACK or AlsaPcm.SND_PCM_STREAM_CAPTURE. The return value is used by this class to decide if it has to deal with a source (PLAYBACK) or target (CAPTURE) data line. */ protected abstract int getAlsaStreamType(); protected boolean getSwapBytes() { return m_bSwapBytes; } protected int getBytesPerSample() { return m_nBytesPerSample; } protected void openImpl() throws LineUnavailableException { if (TDebug.TraceSourceDataLine) { TDebug.out("AlsaBaseDataLine.openImpl(): begin"); } /* * Checks that a format is set. * Sets the buffer size to a default value if not * already set. */ checkOpen(); AudioFormat format = getFormat(); if (TDebug.TraceSourceDataLine) { TDebug.out("AlsaBaseDataLine.openImpl(): input format: " + format); } // hack, only true for pmac boolean bHWBigEndian = false; AudioFormat.Encoding encoding = format.getEncoding(); boolean bBigEndian = format.isBigEndian(); m_bSwapBytes = false; if (format.getSampleSizeInBits() == 16 && bBigEndian != bHWBigEndian) { m_bSwapBytes = true; bBigEndian = bHWBigEndian; } else if (format.getSampleSizeInBits() == 8 && encoding.equals(AudioFormat.Encoding.PCM_SIGNED)) { m_bSwapBytes = true; encoding = AudioFormat.Encoding.PCM_UNSIGNED; } if (getSwapBytes()) { format = new AudioFormat(encoding, format.getSampleRate(), format.getSampleSizeInBits(), format.getChannels(), format.getFrameSize(), format.getFrameRate(), bBigEndian); if (TDebug.TraceSourceDataLine) { TDebug.out("AlsaBaseDataLine.openImpl(): output format: " + format); } m_nBytesPerSample = format.getFrameSize() / format.getChannels(); } int nAlsaOutFormat = AlsaUtils.getAlsaFormat(format); if (TDebug.TraceSourceDataLine) { TDebug.out("AlsaBaseDataLine.openImpl(): ALSA output format: " + nAlsaOutFormat); } if (nAlsaOutFormat == AlsaPcm.SND_PCM_FORMAT_UNKNOWN) { throw new IllegalArgumentException("unsupported format"); } try { m_alsaPcm = new AlsaPcm( getAlsaDataLineMixer().getPcmName(), getAlsaStreamType(), 0); // no special mode } catch (Exception e) { if (TDebug.TraceAllExceptions) { TDebug.out(e); } throw new LineUnavailableException(); } int nReturn; AlsaPcmHWParams hwParams = new AlsaPcmHWParams(); nReturn = m_alsaPcm.getAnyHWParams(hwParams); if (nReturn != 0) { TDebug.out("AlsaBaseDataLine.openImpl(): getAnyHWParams(): " + Alsa.getStringError(nReturn)); throw new LineUnavailableException(Alsa.getStringError(nReturn)); } nReturn = m_alsaPcm.setHWParamsAccess(hwParams, AlsaPcm.SND_PCM_ACCESS_RW_INTERLEAVED); if (nReturn != 0) { TDebug.out("AlsaBaseDataLine.openImpl(): setHWParamsFormat(): " + Alsa.getStringError(nReturn)); throw new LineUnavailableException(Alsa.getStringError(nReturn)); } nReturn = m_alsaPcm.setHWParamsFormat(hwParams, nAlsaOutFormat); if (nReturn != 0) { TDebug.out("AlsaBaseDataLine.openImpl(): setHWParamsFormat(): " + Alsa.getStringError(nReturn)); throw new LineUnavailableException(Alsa.getStringError(nReturn)); } nReturn = m_alsaPcm.setHWParamsChannels(hwParams, format.getChannels()); if (nReturn != 0) { TDebug.out("AlsaBaseDataLine.openImpl(): setHWParamsChannels(): " + Alsa.getStringError(nReturn)); throw new LineUnavailableException(Alsa.getStringError(nReturn)); } nReturn = m_alsaPcm.setHWParamsRateNear(hwParams, (int) format.getSampleRate()); // int nRate = nReturn; if (nReturn < 0) { TDebug.out("AlsaBaseDataLine.openImpl(): setHWParamsRateNear(): " + Alsa.getStringError(nReturn)); throw new LineUnavailableException(Alsa.getStringError(nReturn)); } nReturn = m_alsaPcm.setHWParamsBufferTimeNear(hwParams, 500000); int nBufferTime = nReturn; if (nReturn < 0) { TDebug.out("AlsaBaseDataLine.openImpl(): setHWParamsBufferTimeNear(): " + Alsa.getStringError(nReturn)); throw new LineUnavailableException(Alsa.getStringError(nReturn)); } nReturn = m_alsaPcm.setHWParamsPeriodTimeNear(hwParams, nBufferTime / 4); // int nPeriodTime = nReturn; if (nReturn < 0) { TDebug.out("AlsaBaseDataLine.openImpl(): setHWParamsPeriodTimeNear(): " + Alsa.getStringError(nReturn)); throw new LineUnavailableException(Alsa.getStringError(nReturn)); } nReturn = m_alsaPcm.setHWParams(hwParams); if (nReturn < 0) { TDebug.out("AlsaBaseDataLine.openImpl(): setHWParams(): " + Alsa.getStringError(nReturn)); throw new LineUnavailableException(Alsa.getStringError(nReturn)); } int nChunkSize = hwParams.getPeriodSize(null); int nBufferSize = hwParams.getBufferSize(); if (nChunkSize == nBufferSize) { throw new LineUnavailableException("period size is equal to buffer size"); } AlsaPcmSWParams swParams = new AlsaPcmSWParams(); nReturn = m_alsaPcm.getSWParams(swParams); if (nReturn != 0) { TDebug.out("AlsaBaseDataLine.openImpl(): getSWParams(): " + Alsa.getStringError(nReturn)); throw new LineUnavailableException(Alsa.getStringError(nReturn)); } nReturn = m_alsaPcm.setSWParamsSleepMin(swParams, 0); if (nReturn != 0) { TDebug.out("AlsaBaseDataLine.openImpl(): setSWParamsSleepMin(): " + Alsa.getStringError(nReturn)); throw new LineUnavailableException(Alsa.getStringError(nReturn)); } nReturn = m_alsaPcm.setSWParamsXrunMode(swParams, AlsaPcm.SND_PCM_XRUN_NONE); if (nReturn != 0) { TDebug.out("AlsaBaseDataLine.openImpl(): setSWParamsXrunMode(): " + Alsa.getStringError(nReturn)); throw new LineUnavailableException(Alsa.getStringError(nReturn)); } nReturn = m_alsaPcm.setSWParamsAvailMin(swParams, nChunkSize); if (nReturn != 0) { TDebug.out("AlsaBaseDataLine.openImpl(): setSWParamsAvailMin(): " + Alsa.getStringError(nReturn)); throw new LineUnavailableException(Alsa.getStringError(nReturn)); } long lStartThreshold = (long) ((double) format.getFrameRate() * 1 / 1000000); nReturn = m_alsaPcm.setSWParamsStartThreshold(swParams, (int) lStartThreshold); if (nReturn != 0) { TDebug.out("AlsaBaseDataLine.openImpl(): setSWParamsStartThreshold(): " + Alsa.getStringError(nReturn)); throw new LineUnavailableException(Alsa.getStringError(nReturn)); } long lStopThreshold = (long) (nBufferSize + (double) format.getFrameRate() * 0 / 1000000); nReturn = m_alsaPcm.setSWParamsStopThreshold(swParams, (int) lStopThreshold); if (nReturn != 0) { TDebug.out("AlsaBaseDataLine.openImpl(): setSWParamsStopThreshold(): " + Alsa.getStringError(nReturn)); throw new LineUnavailableException(Alsa.getStringError(nReturn)); } // omitted: xfer_align nReturn = m_alsaPcm.setSWParams(swParams); if (nReturn != 0) { TDebug.out("AlsaBaseDataLine.openImpl(): setSWParams(): " + Alsa.getStringError(nReturn)); throw new LineUnavailableException(Alsa.getStringError(nReturn)); } if (TDebug.TraceSourceDataLine) { TDebug.out("AlsaBaseDataLine.openImpl(): end"); } } protected void closeImpl() { if (TDebug.TraceSourceDataLine) { TDebug.out("AlsaBaseDataLine.closeImpl(): begin"); } m_alsaPcm.close(); if (TDebug.TraceSourceDataLine) { TDebug.out("AlsaBaseDataLine.closeImpl(): end"); } } /* public void start() { setStarted(true); setActive(true); if (TDebug.TraceSourceDataLine) { TDebug.out("AlsaBaseDataLine.start(): channel started."); } } */ protected void stopImpl() { if (TDebug.TraceSourceDataLine) { TDebug.out("AlsaBaseDataLine.stopImpl(): called"); } int nReturn = 0; // int nReturn = m_alsaPcm.flushChannel(AlsaPcm.SND_PCM_CHANNEL_PLAYBACK); if (nReturn != 0) { TDebug.out("flushChannel: " + Alsa.getStringError(nReturn)); } // setStarted(false); } public int available() { // TODO: return -1; } public void drain() { // TODO: } public void flush() { // TODO: } /** * dGain is logarithmic!! */ protected void setGain(float dGain) { } // IDEA: move inner classes to TBaseDataLine public class AlsaBaseDataLineGainControl extends FloatControl { /* * These variables should be static. However, Java 1.1 * doesn't allow this. So they aren't. */ private /*static*/ final float MAX_GAIN = 90.0F; private /*static*/ final float MIN_GAIN = -96.0F; // TODO: recheck this value private /*static*/ final int GAIN_INCREMENTS = 1000; // private float m_fGain; // private boolean m_bMuted; /*package*/ AlsaBaseDataLineGainControl() { super(FloatControl.Type.VOLUME, // or MASTER_GAIN ? -96.0F, // MIN_GAIN, 24.0F, // MAX_GAIN, 0.01F, // precision 0, // update period? 0.0F, // initial value "dB", "-96.0", "", "+24.0"); // m_bMuted = false; // should be included in a compund control? } public void setValue(float fGain) { fGain = Math.max(Math.min(fGain, getMaximum()), getMinimum()); if (Math.abs(fGain - getValue()) > 1.0E9) { super.setValue(fGain); // if (!getMute()) // { AlsaBaseDataLine.this.setGain(getValue()); // } } } /* public float getMaximum() { return MAX_GAIN; } public float getMinimum() { return MIN_GAIN; } public int getIncrements() { // TODO: check this value return GAIN_INCREMENTS; } public void fade(float fInitialGain, float fFinalGain, int nFrames) { // TODO: } public int getFadePrecision() { //TODO: return -1; } public boolean getMute() { return m_bMuted; } public void setMute(boolean bMuted) { if (bMuted != getMute()) { m_bMuted = bMuted; if (getMute()) { AlsaBaseDataLine.this.setGain(getMinimum()); } else { AlsaBaseDataLine.this.setGain(getGain()); } } } */ } } /*** AlsaBaseDataLine.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/sampled/mixer/alsa/AlsaDataLineMixer.java0000644000175000017500000002446010374160733031754 0ustar twernertwerner/* * AlsaDataLineMixer.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999 - 2004 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.sampled.mixer.alsa; import java.util.ArrayList; import java.util.Collection; import java.util.List; import javax.sound.sampled.AudioFormat; import javax.sound.sampled.AudioSystem; import javax.sound.sampled.Clip; import javax.sound.sampled.DataLine; import javax.sound.sampled.SourceDataLine; import javax.sound.sampled.TargetDataLine; import javax.sound.sampled.LineUnavailableException; import javax.sound.sampled.Line; import javax.sound.sampled.Mixer; import org.tritonus.share.TDebug; import org.tritonus.share.TSettings; import org.tritonus.share.sampled.mixer.TMixer; import org.tritonus.share.sampled.mixer.TMixerInfo; import org.tritonus.share.sampled.mixer.TSoftClip; import org.tritonus.share.GlobalInfo; import org.tritonus.lowlevel.alsa.Alsa; import org.tritonus.lowlevel.alsa.AlsaPcm; import org.tritonus.lowlevel.alsa.AlsaPcmHWParams; import org.tritonus.lowlevel.alsa.AlsaPcmHWParamsFormatMask; public class AlsaDataLineMixer extends TMixer { private static final AudioFormat[] EMPTY_AUDIOFORMAT_ARRAY = new AudioFormat[0]; private static final int CHANNELS_LIMIT = 32; // default buffer size in bytes. private static final int DEFAULT_BUFFER_SIZE = 32768; /* The name of the sound card this mixer is representing. */ private String m_strPcmName; public static String getDeviceNamePrefix() { if (TSettings.AlsaUsePlughw) { return "plughw"; } else { return "hw"; } } public static String getPcmName(int nCard) { String strPcmName = getDeviceNamePrefix() + ":" + nCard; if (TSettings.AlsaUsePlughw) { // strPcmName += ",0"; } return strPcmName; } public AlsaDataLineMixer() { this(0); } public AlsaDataLineMixer(int nCard) { this(getPcmName(nCard)); } public AlsaDataLineMixer(String strPcmName) { super(new TMixerInfo( "Alsa DataLine Mixer (" + strPcmName + ")", GlobalInfo.getVendor(), "Mixer for the Advanced Linux Sound Architecture (card " + strPcmName + ")", GlobalInfo.getVersion()), new Line.Info(Mixer.class)); if (TDebug.TraceMixer) { TDebug.out("AlsaDataLineMixer.(String): begin."); } m_strPcmName = strPcmName; List sourceFormats = getSupportedFormats(AlsaPcm.SND_PCM_STREAM_PLAYBACK); List targetFormats = getSupportedFormats(AlsaPcm.SND_PCM_STREAM_CAPTURE); List sourceLineInfos = new ArrayList(); Line.Info sourceLineInfo = new DataLine.Info( SourceDataLine.class, sourceFormats.toArray(EMPTY_AUDIOFORMAT_ARRAY), AudioSystem.NOT_SPECIFIED, AudioSystem.NOT_SPECIFIED); sourceLineInfos.add(sourceLineInfo); List targetLineInfos = new ArrayList(); Line.Info targetLineInfo = new DataLine.Info( TargetDataLine.class, targetFormats.toArray(EMPTY_AUDIOFORMAT_ARRAY), AudioSystem.NOT_SPECIFIED, AudioSystem.NOT_SPECIFIED); targetLineInfos.add(targetLineInfo); setSupportInformation(sourceFormats, targetFormats, sourceLineInfos, targetLineInfos); if (TDebug.TraceMixer) { TDebug.out("AlsaDataLineMixer.(String): end."); } } public String getPcmName() { return m_strPcmName; } //////////////// Line ////////////////////////////////////// // TODO: allow real close and reopen of mixer public void open() { if (TDebug.TraceMixer) { TDebug.out("AlsaDataLineMixer.open(): begin"); } // currently does nothing if (TDebug.TraceMixer) { TDebug.out("AlsaDataLineMixer.open(): end"); } } public void close() { if (TDebug.TraceMixer) { TDebug.out("AlsaDataLineMixer.close(): begin"); } // currently does nothing if (TDebug.TraceMixer) { TDebug.out("AlsaDataLineMixer.close(): end"); } } //////////////// Mixer ////////////////////////////////////// public int getMaxLines(Line.Info info) { if (TDebug.TraceMixer) { TDebug.out("AlsaDataLineMixer.getMaxLines(): begin"); } // TODO: if (TDebug.TraceMixer) { TDebug.out("AlsaDataLineMixer.getMaxLines(): end"); } return 0; } //////////////// private ////////////////////////////////////// // nBufferSize is in bytes! protected SourceDataLine getSourceDataLine(AudioFormat format, int nBufferSize) throws LineUnavailableException { if (TDebug.TraceMixer) { TDebug.out("AlsaDataLineMixer.getSourceDataLine(): begin"); } if (TDebug.TraceMixer) { TDebug.out("AlsaDataLineMixer.getSourceDataLine(): format: " + format); TDebug.out("AlsaDataLineMixer.getSourceDataLine(): buffer size: " + nBufferSize); } if (nBufferSize < 1) { nBufferSize = DEFAULT_BUFFER_SIZE; } AlsaSourceDataLine sourceDataLine = new AlsaSourceDataLine(this, format, nBufferSize); // sourceDataLine.start(); if (TDebug.TraceMixer) { TDebug.out("AlsaDataLineMixer.getSourceDataLine(): returning: " + sourceDataLine); } if (TDebug.TraceMixer) { TDebug.out("AlsaDataLineMixer.getSourceDataLine(): end"); } return sourceDataLine; } // nBufferSize is in bytes! protected TargetDataLine getTargetDataLine(AudioFormat format, int nBufferSize) throws LineUnavailableException { if (TDebug.TraceMixer) { TDebug.out("AlsaDataLineMixer.getTargetDataLine(): begin"); } int nBufferSizeInBytes = nBufferSize * format.getFrameSize(); AlsaTargetDataLine targetDataLine = new AlsaTargetDataLine(this, format, nBufferSizeInBytes); // targetDataLine.start(); if (TDebug.TraceMixer) { TDebug.out("AlsaDataLineMixer.getTargetDataLine(): returning: " + targetDataLine); } if (TDebug.TraceMixer) { TDebug.out("AlsaDataLineMixer.getTargetDataLine(): end"); } return targetDataLine; } protected Clip getClip(AudioFormat format) throws LineUnavailableException { if (TDebug.TraceMixer) { TDebug.out("AlsaDataLineMixer.getClip(): begin"); } Clip clip = new TSoftClip(this, format); if (TDebug.TraceMixer) { TDebug.out("AlsaDataLineMixer.getClip(): end"); } return clip; } /* nDirection: should be AlsaPcm.SND_PCM_STREAM_PLAYBACK or AlsaPcm.SND_PCM_STREAM_CAPTURE. */ private List getSupportedFormats(int nDirection) { if (TDebug.TraceMixer) { TDebug.out("AlsaDataLineMixer.getSupportedFormats(): begin"); } if (TDebug.TraceMixer) { TDebug.out("AlsaDataLineMixer.getSupportedFormats(): direction: " + nDirection); } List supportedFormats = new ArrayList(); AlsaPcm alsaPcm = null; try { alsaPcm = new AlsaPcm( getPcmName(), nDirection, 0); // no special mode } catch (Exception e) { if (TDebug.TraceAllExceptions) { TDebug.out(e); } throw new RuntimeException("cannot open pcm"); } int nReturn; AlsaPcmHWParams hwParams = new AlsaPcmHWParams(); nReturn = alsaPcm.getAnyHWParams(hwParams); if (nReturn != 0) { TDebug.out("AlsaDataLineMixer.getSupportedFormats(): getAnyHWParams(): " + Alsa.getStringError(nReturn)); throw new RuntimeException(Alsa.getStringError(nReturn)); } AlsaPcmHWParamsFormatMask formatMask = new AlsaPcmHWParamsFormatMask(); int nMinChannels = hwParams.getChannelsMin(); if (TDebug.TraceMixer) { TDebug.out("AlsaDataLineMixer.getSupportedFormats(): min channels: " + nMinChannels); } int nMaxChannels = hwParams.getChannelsMax(); nMaxChannels = Math.min(nMaxChannels, CHANNELS_LIMIT); if (TDebug.TraceMixer) { TDebug.out("AlsaDataLineMixer.getSupportedFormats(): max channels: " + nMaxChannels); } hwParams.getFormatMask(formatMask); for (int i = 0; i < 32; i++) { if (TDebug.TraceMixer) { TDebug.out("AlsaDataLineMixer.getSupportedFormats(): checking ALSA format index: " + i); } if (formatMask.test(i)) { if (TDebug.TraceMixer) { TDebug.out("AlsaDataLineMixer.getSupportedFormats(): ...supported"); } AudioFormat audioFormat = AlsaUtils.getAlsaFormat(i); if (TDebug.TraceMixer) { TDebug.out("AlsaDataLineMixer.getSupportedFormats(): adding AudioFormat: " + audioFormat); } addChanneledAudioFormats(supportedFormats, audioFormat, nMinChannels, nMaxChannels); // supportedFormats.add(audioFormat); } else { if (TDebug.TraceMixer) { TDebug.out("AlsaDataLineMixer.getSupportedFormats(): ...not supported"); } } } // TODO: close/free mask & hwParams? alsaPcm.close(); if (TDebug.TraceMixer) { TDebug.out("AlsaDataLineMixer.getSupportedFormats(): end"); } return supportedFormats; } private static void addChanneledAudioFormats( Collection collection, AudioFormat protoAudioFormat, int nMinChannels, int nMaxChannels) { if (TDebug.TraceMixer) { TDebug.out("AlsaDataLineMixer.addChanneledAudioFormats(): begin"); } for (int nChannels = nMinChannels; nChannels <= nMaxChannels; nChannels++) { AudioFormat channeledAudioFormat = getChanneledAudioFormat(protoAudioFormat, nChannels); if (TDebug.TraceMixer) { TDebug.out("AlsaDataLineMixer.addChanneledAudioFormats(): adding AudioFormat: " + channeledAudioFormat); } collection.add(channeledAudioFormat); } if (TDebug.TraceMixer) { TDebug.out("AlsaDataLineMixer.addChanneledAudioFormats(): end"); } } // TODO: better name // TODO: calculation of frame size is not perfect private static AudioFormat getChanneledAudioFormat(AudioFormat audioFormat, int nChannels) { AudioFormat channeledAudioFormat = new AudioFormat( audioFormat.getEncoding(), audioFormat.getSampleRate(), audioFormat.getSampleSizeInBits(), nChannels, (audioFormat.getSampleSizeInBits() / 8) * nChannels, audioFormat.getFrameRate(), audioFormat.isBigEndian()); return channeledAudioFormat; } } /*** AlsaDataLineMixer.java ***/ ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootlibtritonus-java-20070428/src/classes/org/tritonus/sampled/mixer/alsa/AlsaDataLineMixerProvider.javalibtritonus-java-20070428/src/classes/org/tritonus/sampled/mixer/alsa/AlsaDataLineMixerProvider.java0000644000175000017500000001020210374074736033463 0ustar twernertwerner/* * AlsaDataLineMixerProvider.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999 - 2002 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.sampled.mixer.alsa; import org.tritonus.lowlevel.alsa.Alsa; import org.tritonus.lowlevel.alsa.AlsaCtl; import org.tritonus.lowlevel.alsa.AlsaCtlCardInfo; import org.tritonus.share.TDebug; import org.tritonus.share.sampled.mixer.TMixerProvider; public class AlsaDataLineMixerProvider extends TMixerProvider { private static boolean sm_bInitialized = false; public AlsaDataLineMixerProvider() { super(); if (TDebug.TraceMixerProvider) { TDebug.out("AlsaDataLineMixerProvider.(): begin"); } if (! sm_bInitialized && ! isDisabled()) { if (! Alsa.isLibraryAvailable()) { disable(); } else { staticInit(); sm_bInitialized = true; } } else { if (TDebug.TraceMixerProvider) { TDebug.out("AlsaDataLineMixerProvider.(): already initialized or disabled"); } } if (TDebug.TraceMixerProvider) { TDebug.out("AlsaDataLineMixerProvider.(): end"); } } protected void staticInit() { if (TDebug.TraceMixerProvider) { TDebug.out("AlsaDataLineMixerProvider.staticInit(): begin"); } int[] anCards = AlsaCtl.getCards(); if (TDebug.TraceMixerProvider) { TDebug.out("AlsaDataLineMixerProvider.staticInit(): num cards: " + anCards.length); } for (int i = 0; i < anCards.length; i++) { if (TDebug.TraceMixerProvider) { TDebug.out("AlsaDataLineMixerProvider.staticInit():card #" + i + ": " + anCards[i]); } if (TDebug.TraceMixerProvider) { TDebug.out("AlsaDataLineMixerProvider.staticInit(): creating Ctl object..."); } String strPcmName = "hw:" + anCards[i]; // String strPcmName = AlsaDataLineMixer.getPcmName(anCards[i]); AlsaCtl ctl = null; try { ctl = new AlsaCtl(strPcmName, 0); } catch (Exception e) { if (TDebug.TraceMixerProvider || TDebug.TraceAllExceptions) { TDebug.out(e); } continue; } if (TDebug.TraceMixerProvider) { TDebug.out("AlsaDataLineMixerProvider.staticInit(): calling getCardInfo()..."); } AlsaCtlCardInfo cardInfo = new AlsaCtlCardInfo(); ctl.getCardInfo(cardInfo); if (TDebug.TraceMixerProvider) { TDebug.out("AlsaDataLineMixerProvider.staticInit(): ALSA sound card:"); TDebug.out("AlsaDataLineMixerProvider.staticInit(): card: " + cardInfo.getCard()); TDebug.out("AlsaDataLineMixerProvider.staticInit(): id: " + cardInfo.getId()); } int[] anDevices = ctl.getPcmDevices(); if (TDebug.TraceMixerProvider) { TDebug.out("AlsaDataLineMixerProvider.staticInit(): num devices: " + anDevices.length); } // TODO: combine devices into one AlsaDataLineMixer? // pass device number to AlsaDataLineMixer constructor? for (int nDevice = 0; nDevice < anDevices.length; nDevice++) { if (TDebug.TraceMixerProvider) { TDebug.out("AlsaDataLineMixerProvider.staticInit(): device #" + nDevice + ": " + anDevices[nDevice]); } } // ctl.close(); /* We do not use strPcmName because the mixer may choose to open as 'plughw', while for ctl, the device name always has to be 'hw'. */ AlsaDataLineMixer mixer = new AlsaDataLineMixer(anCards[i]); super.addMixer(mixer); } if (TDebug.TraceMixerProvider) { TDebug.out("AlsaDataLineMixerProvider.staticInit(): end"); } } } /*** AlsaDataLineMixerProvider.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/sampled/mixer/alsa/AlsaPortMixer.java0000644000175000017500000003543410374142166031222 0ustar twernertwerner/* * AlsaPortMixer.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999 - 2004 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.sampled.mixer.alsa; import java.util.ArrayList; import java.util.HashMap; import java.util.Map; import java.util.List; import javax.sound.sampled.AudioFormat; import javax.sound.sampled.BooleanControl; import javax.sound.sampled.CompoundControl; import javax.sound.sampled.Control; import javax.sound.sampled.FloatControl; import javax.sound.sampled.LineUnavailableException; import javax.sound.sampled.Line; import javax.sound.sampled.Mixer; import javax.sound.sampled.Port; import org.tritonus.share.GlobalInfo; import org.tritonus.share.TDebug; import org.tritonus.share.sampled.mixer.TMixer; import org.tritonus.share.sampled.mixer.TMixerInfo; import org.tritonus.share.sampled.mixer.TPort; import org.tritonus.share.sampled.mixer.TCompoundControlType; import org.tritonus.lowlevel.alsa.AlsaMixer; import org.tritonus.lowlevel.alsa.AlsaMixerElement; /** TODO: */ public class AlsaPortMixer extends TMixer { /** Used to signal an illegal value for direction. */ public static final int DIRECTION_NONE = -1; /** Used to signal common volume or common switch. */ public static final int DIRECTION_COMMON = 0; /** Used to signal playback volume or playback switch. */ public static final int DIRECTION_PLAYBACK = 1; /** Used to signal capture volume or capture switch. */ public static final int DIRECTION_CAPTURE = 2; /** For the first shot, we try to create one port line per mixer element. For now, the following two lists should have the same size and related elements at the same index position. */ private List m_mixerElements; /** Port.Infos are keys, Port instances are values. */ private Map m_portMap; /** Port.Infos are keys, AlsaMixerElement instances are values. */ private Map m_mixerElementMap; public AlsaPortMixer(int nCard) { this("hw:" + nCard); } public AlsaPortMixer(String strDeviceName) { super(new TMixerInfo( "Alsa Port Mixer (" + strDeviceName + ")", GlobalInfo.getVendor(), "System Mixer for the Advanced Linux Sound System (card " + strDeviceName + ")", GlobalInfo.getVersion()), new Line.Info(Mixer.class)); if (TDebug.TraceMixer) { TDebug.out("AlsaPortMixer.: begin"); } m_mixerElements = new ArrayList(); m_mixerElementMap = new HashMap(); m_portMap = new HashMap(); AlsaMixer alsaMixer = null; try { alsaMixer = new AlsaMixer(strDeviceName); if (TDebug.TraceMixer) { TDebug.out("AlsaPortMixer.: successfully created AlsaMixer instance"); } } catch (Exception e) { if (TDebug.TraceMixer || TDebug.TraceAllExceptions) { TDebug.out(e); } } int nArraySize = 150; // TODO: original value: 128. With this value, a vm crash occurs int[] anIndices = null; String[] astrNames = null; int nControlCount = 0; while (true) { anIndices = new int[nArraySize]; astrNames = new String[nArraySize]; nControlCount = alsaMixer.readControlList(anIndices, astrNames); if (nControlCount >= 0) { break; } if (TDebug.TraceMixer) { TDebug.out("AlsaPortMixer.: increasing array size for AlsaMixer.readControlList(): now " + nArraySize * 2); } nArraySize *= 2; } List sourcePortInfos = new ArrayList(); List targetPortInfos = new ArrayList(); for (int i = 0; i < nControlCount; i++) { if (TDebug.TraceMixer) { TDebug.out("AlsaPortMixer.(): control " + i + ": " + anIndices[i] + " " + astrNames[i]); } AlsaMixerElement element = new AlsaMixerElement(alsaMixer, anIndices[i], astrNames[i]); if (element.isActive()) { m_mixerElements.add(element); if (hasPlaybackChannels(element)) { Port.Info info = new Port.Info(Port.class, element.getName(), true); sourcePortInfos.add(info); m_mixerElementMap.put(info, element); } if (hasCaptureChannels(element)) { Port.Info info = new Port.Info(Port.class, element.getName(), false); targetPortInfos.add(info); m_mixerElementMap.put(info, element); } } } setSupportInformation( new ArrayList(), new ArrayList(), sourcePortInfos, targetPortInfos); if (TDebug.TraceMixer) { TDebug.out("AlsaPortMixer.: end."); } } private static boolean hasPlaybackChannels(AlsaMixerElement element) { boolean bHasChannels = false; for (int nChannel = AlsaMixerElement.SND_MIXER_SCHN_FRONT_LEFT; nChannel <= AlsaMixerElement.SND_MIXER_SCHN_WOOFER; nChannel++) { bHasChannels |= element.hasPlaybackChannel(nChannel); } return bHasChannels; } private static boolean hasCaptureChannels(AlsaMixerElement element) { boolean bHasChannels = false; for (int nChannel = AlsaMixerElement.SND_MIXER_SCHN_FRONT_LEFT; nChannel <= AlsaMixerElement.SND_MIXER_SCHN_WOOFER; nChannel++) { bHasChannels |= element.hasCaptureChannel(nChannel); } return bHasChannels; } //////////////// Line ////////////////////////////////////// // TODO: allow real close and reopen of mixer public void open() { if (TDebug.TraceMixer) { TDebug.out("AlsaPortMixer.open(): begin"); } // currently does nothing if (TDebug.TraceMixer) { TDebug.out("AlsaPortMixer.open(): end"); } } public void close() { if (TDebug.TraceMixer) { TDebug.out("AlsaPortMixer.close(): begin"); } // currently does nothing if (TDebug.TraceMixer) { TDebug.out("AlsaPortMixer.close(): end"); } } //////////////// Mixer ////////////////////////////////////// /* public Line.Info getLineInfo(Line.Info info) { // TODO: return null; } */ // TODO: public int getMaxLines(Line.Info info) { // TODO: return 0; } protected Port getPort(Port.Info info) throws LineUnavailableException { if (TDebug.TraceMixer) { TDebug.out("AlsaPortMixer.getPort(): begin"); } Port port = m_portMap.get(info); if (port == null) { port = createPort(info); m_portMap.put(info, port); } if (TDebug.TraceMixer) { TDebug.out("AlsaPortMixer.getPort(): end"); } return port; } private Port createPort(Port.Info info) { if (TDebug.TraceMixer) { TDebug.out("AlsaPortMixer.createPort(): begin"); } AlsaMixerElement element = m_mixerElementMap.get(info); if (element == null) { throw new IllegalArgumentException("no port for this info"); } List controls; //Control c; //int nDirection; if (info.isSource()) { controls = createSourcePortControls(element); } else { //nDirection = DIRECTION_CAPTURE; // controls = createTargetPortControls(element); controls = new ArrayList(); } Port port = new TPort(this, info, controls); if (TDebug.TraceMixer) { TDebug.out("AlsaPortMixer.createPort(): end"); } return port; } /** TODO: */ private List createSourcePortControls(AlsaMixerElement element) { int nDirection = DIRECTION_PLAYBACK; List controls = new ArrayList(); Control c; if (element.hasPlaybackVolume() || element.hasCommonVolume()) { if (element.isPlaybackMono() || element.hasPlaybackVolumeJoined()) { c = createVolumeControl(element, AlsaMixerElement.SND_MIXER_SCHN_FRONT_LEFT, nDirection); controls.add(c); } else { List volumeControls = new ArrayList(); for (int nChannel = AlsaMixerElement.SND_MIXER_SCHN_FRONT_LEFT; nChannel < AlsaMixerElement.SND_MIXER_SCHN_LAST; nChannel++) { if (element.hasPlaybackChannel(nChannel)) { // TDebug.out("adding channel " + nChannel); c = createVolumeControl(element, nChannel, nDirection); // System.out.println("control to add: " + c); volumeControls.add(c); } } // list should not be empty CompoundControl.Type type = new TCompoundControlType("test"); Control[] aMemberControls = volumeControls.toArray(new Control[0]); // System.out.println("member controls: " + aMemberControls); // System.out.println("# member controls: " + aMemberControls.length); c = new AlsaCompoundControl(type, aMemberControls); controls.add(c); } } if (element.hasPlaybackSwitch() || element.hasCommonSwitch()) { if (element.isPlaybackMono() || element.hasPlaybackSwitchJoined()) { c = createSwitchControl(element, AlsaMixerElement.SND_MIXER_SCHN_FRONT_LEFT, nDirection); controls.add(c); } else { List volumeControls = new ArrayList(); for (int nChannel = AlsaMixerElement.SND_MIXER_SCHN_FRONT_LEFT; nChannel < AlsaMixerElement.SND_MIXER_SCHN_LAST; nChannel++) { if (element.hasPlaybackChannel(nChannel)) { // TDebug.out("adding channel " + nChannel); c = createSwitchControl(element, nChannel, nDirection); // System.out.println("control to add: " + c); volumeControls.add(c); } } // list should not be empty CompoundControl.Type type = new TCompoundControlType("test"); Control[] aMemberControls = volumeControls.toArray(new Control[0]); // System.out.println("member controls: " + aMemberControls); // System.out.println("# member controls: " + aMemberControls.length); c = new AlsaCompoundControl(type, aMemberControls); controls.add(c); } } return controls; } /** TODO: */ private FloatControl createVolumeControl(AlsaMixerElement element, int nChannel, int nDirection) { int[] anValues = new int[2]; switch (nDirection) { case DIRECTION_COMMON: case DIRECTION_PLAYBACK: element.getPlaybackVolumeRange(anValues); break; case DIRECTION_CAPTURE: element.getCaptureVolumeRange(anValues); break; } FloatControl control = new AlsaVolumeControl( FloatControl.Type.VOLUME, anValues[0], anValues[1], 1.0F, -1, anValues[0], "", "", "", "", element, nChannel, nDirection); return control; } /** TODO: */ private BooleanControl createSwitchControl(AlsaMixerElement element, int nChannel, int nDirection) { BooleanControl control = new AlsaSwitchControl( BooleanControl.Type.MUTE, false, "", "", element, nChannel, nDirection); return control; } //////////////// inner classes ////////////////////////////////////// private class AlsaVolumeControl extends FloatControl { private AlsaMixerElement m_element; private int m_nChannel; /** One of the constants DIRECTION_*. */ private int m_nDirection; /** @param nDirection One of the constants DIRECTION_*. */ public AlsaVolumeControl(Type type, float fMinimum, float fMaximum, float fPrecision, int nUpdatePeriod, float fInitialValue, String strUnits, String strMinLabel, String strMidLabel, String strMaxLabel, AlsaMixerElement element, int nChannel, int nDirection) { super(type, fMinimum, fMaximum, fPrecision, nUpdatePeriod, fInitialValue, strUnits, strMinLabel, strMidLabel, strMaxLabel); if (TDebug.TraceMixer) { TDebug.out("AlsaPortMixer.AlsaFloatControl.(): begin"); } m_element = element; m_nChannel = nChannel; m_nDirection = nDirection; setValue(getValueImpl()); if (TDebug.TraceMixer) { TDebug.out("AlsaPortMixer.AlsaFloatControl.(): end"); } } private AlsaMixerElement getElement() { return m_element; } private int getChannel() { return m_nChannel; } private int getDirection() { return m_nDirection; } // TODO: respect channels public void setValue(float fValue) { super.setValue(fValue); int nValue = (int) fValue; switch (getDirection()) { case DIRECTION_COMMON: case DIRECTION_PLAYBACK: getElement().setPlaybackVolumeAll(nValue); break; case DIRECTION_CAPTURE: getElement().setCaptureVolumeAll(nValue); break; } } private float getValueImpl() { int nChannel = getChannel(); float fValue = 0.0F; switch (getDirection()) { case DIRECTION_COMMON: case DIRECTION_PLAYBACK: fValue = getElement().getPlaybackVolume(nChannel); break; case DIRECTION_CAPTURE: fValue = getElement().getCaptureVolume(nChannel); break; } return fValue; } } private class AlsaSwitchControl extends BooleanControl { private AlsaMixerElement m_element; private int m_nChannel; /** One of the constants DIRECTION_*. */ private int m_nDirection; /** @param nDirection One of the constants DIRECTION_*. */ public AlsaSwitchControl(Type type, boolean bInitialValue, String strTrueLabel, String strFalseLabel, AlsaMixerElement element, int nChannel, int nDirection) { super(type, bInitialValue, strTrueLabel, strFalseLabel); if (TDebug.TraceMixer) { TDebug.out("AlsaPortMixer.AlsaFloatControl.(): begin"); } m_element = element; m_nChannel = nChannel; m_nDirection = nDirection; if (TDebug.TraceMixer) { TDebug.out("AlsaPortMixer.AlsaFloatControl.(): end"); } } private AlsaMixerElement getElement() { return m_element; } private int getChannel() { return m_nChannel; } private int getDirection() { return m_nDirection; } // TODO: respect channels public void setValue(boolean bValue) { super.setValue(bValue); switch (getDirection()) { case DIRECTION_COMMON: case DIRECTION_PLAYBACK: getElement().setPlaybackSwitchAll(bValue); break; case DIRECTION_CAPTURE: getElement().setCaptureSwitchAll(bValue); break; } } } /** CompoundControl class. This class is only needed to provide a public constructor. */ public class AlsaCompoundControl extends CompoundControl { public AlsaCompoundControl(CompoundControl.Type type, Control[] aMemberControls) { super(type, aMemberControls); } } } /*** AlsaPortMixer.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/sampled/mixer/alsa/AlsaPortMixerProvider.java0000644000175000017500000000456410172461361032732 0ustar twernertwerner/* * AlsaPortMixerProvider.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2001 - 2002 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.sampled.mixer.alsa; import org.tritonus.share.TDebug; import org.tritonus.lowlevel.alsa.Alsa; import org.tritonus.lowlevel.alsa.AlsaCtl; import org.tritonus.share.sampled.mixer.TMixerProvider; public class AlsaPortMixerProvider extends TMixerProvider { private static boolean sm_bInitialized = false; public AlsaPortMixerProvider() { super(); if (TDebug.TraceMixerProvider) { TDebug.out("AlsaPortMixerProvider.(): begin"); } if (! sm_bInitialized && ! isDisabled()) { if (! Alsa.isLibraryAvailable()) { disable(); } else { staticInit(); sm_bInitialized = true; } } else { if (TDebug.TraceMixerProvider) { TDebug.out("AlsaDataLineMixerProvider.(): already initialized or disabled"); } } if (TDebug.TraceMixerProvider) { TDebug.out("AlsaPortMixerProvider.(): end"); } } protected void staticInit() { if (TDebug.TraceMixerProvider) { TDebug.out("AlsaPortMixerProvider.staticInit(): begin"); } int[] anCards = AlsaCtl.getCards(); if (TDebug.TraceMixerProvider) { System.out.println("AlsaPortMixerProvider.staticInit(): num cards: " + anCards.length); } for (int i = 0; i < anCards.length; i++) { AlsaPortMixer mixer = new AlsaPortMixer(anCards[i]); addMixer(mixer); } if (TDebug.TraceMixerProvider) { TDebug.out("AlsaPortMixerProvider.staticInit(): end"); } } } /*** AlsaPortMixerProvider.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/sampled/mixer/alsa/AlsaSourceDataLine.java0000644000175000017500000001655710375041157032137 0ustar twernertwerner/* * AlsaSourceDataLine.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999 - 2001 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.sampled.mixer.alsa; import javax.sound.sampled.AudioFormat; import javax.sound.sampled.DataLine; import javax.sound.sampled.FloatControl; import javax.sound.sampled.LineUnavailableException; import javax.sound.sampled.SourceDataLine; import org.tritonus.share.TDebug; import org.tritonus.lowlevel.alsa.Alsa; import org.tritonus.lowlevel.alsa.AlsaPcm; import org.tritonus.share.sampled.TConversionTool; public class AlsaSourceDataLine extends AlsaBaseDataLine implements SourceDataLine { // private static final Class[] CONTROL_CLASSES = {GainControl.class}; private byte[] m_abSwapBuffer; // TODO: has info object to change if format or buffer size are changed later? // no, but it has to represent the mixer's capabilities. So a fixed info per mixer. public AlsaSourceDataLine(AlsaDataLineMixer mixer, AudioFormat format, int nBufferSize) throws LineUnavailableException { super(mixer, new DataLine.Info(SourceDataLine.class, format, nBufferSize)); if (TDebug.TraceSourceDataLine) { TDebug.out("AlsaSourceDataLine.(): begin"); } if (TDebug.TraceSourceDataLine) { TDebug.out("AlsaSourceDataLine.(): buffer size: " + nBufferSize); } if (TDebug.TraceSourceDataLine) { TDebug.out("AlsaSourceDataLine.(): end"); } } protected int getAlsaStreamType() { return AlsaPcm.SND_PCM_STREAM_PLAYBACK; } /* public void start() { setStarted(true); setActive(true); if (TDebug.TraceSourceDataLine) { TDebug.out("AlsaSourceDataLine.start(): channel started."); } } */ protected void stopImpl() { if (TDebug.TraceSourceDataLine) { TDebug.out("AlsaSourceDataLine.stopImpl(): called"); } int nReturn = 0; // int nReturn = getAlsaPcm().flushChannel(AlsaPcm.SND_PCM_CHANNEL_PLAYBACK); if (nReturn != 0) { TDebug.out("flushChannel: " + Alsa.getStringError(nReturn)); } // setStarted(false); } public int available() { // TODO: throwNYIException(); return -1; } // TODO: check if should block public int write(byte[] abData, int nOffset, int nLength) { if (TDebug.TraceSourceDataLine) { TDebug.out("AlsaSourceDataLine.write(): begin"); } if (getSwapBytes()) { if (m_abSwapBuffer == null || m_abSwapBuffer.length < nOffset + nLength) { m_abSwapBuffer = new byte[nOffset + nLength]; } TConversionTool.changeOrderOrSign( abData, nOffset, m_abSwapBuffer, nOffset, nLength, getBytesPerSample()); abData = m_abSwapBuffer; } int nReturn = writeImpl(abData, nOffset, nLength); if (TDebug.TraceSourceDataLine) { TDebug.out("AlsaSourceDataLine.write(): end"); } return nReturn; } /** Write data to the line. @param abData The buffer to use. @param nOffset @param nLength The length of the data that should be written, in bytes. Can be less that the length of abData. @return The number of bytes written. May be less than nLength. */ // TODO: check if should block private int writeImpl(byte[] abData, int nOffset, int nLength) { if (TDebug.TraceSourceDataLine) { TDebug.out("AlsaSourceDataLine.writeImpl(): begin"); } if (nLength > 0 && !isActive()) { start(); } int nFrameSize = getFormat().getFrameSize(); int nRemaining = nLength; while (nRemaining > 0 && isOpen()) { synchronized (this) { if (!isOpen()) { return nLength - nRemaining; } if (TDebug.TraceSourceDataLine) { TDebug.out("AlsaSourceDataLine.writeImpl(): trying to write (bytes): " + nRemaining); } int nRemainingFrames = nRemaining / nFrameSize; if (TDebug.TraceSourceDataLine) { TDebug.out("AlsaSourceDataLine.writeImpl(): trying to write (frames): " + nRemainingFrames); } int nWrittenFrames = (int) getAlsaPcm().writei(abData, nOffset, nRemainingFrames); if (nWrittenFrames < 0) { TDebug.out("AlsaSourceDataLine.writeImpl(): " + Alsa.getStringError(nWrittenFrames)); return nLength - nRemaining; } if (TDebug.TraceSourceDataLine) { TDebug.out("AlsaSourceDataLine.writeImpl(): written (frames): " + nWrittenFrames); } int nWrittenBytes = nWrittenFrames * nFrameSize; if (TDebug.TraceSourceDataLine) { TDebug.out("AlsaSourceDataLine.writeImpl(): written (bytes): " + nWrittenBytes); } nOffset += nWrittenBytes; nRemaining -= nWrittenBytes; } } return nLength; } public void drain() { // TODO: } public void flush() { // TODO: } /** * dGain is logarithmic!! */ protected void setGain(float dGain) { } /** Throw a RuntimeException saying "not yet implemented". */ private void throwNYIException() { throw new RuntimeException("sorry, this feature is not yet implemented"); } // IDEA: move inner classes to TBaseDataLine public class AlsaSourceDataLineGainControl extends FloatControl { /* * These variables should be static. However, Java 1.1 * doesn't allow this. So they aren't. */ private /*static*/ final float MAX_GAIN = 90.0F; private /*static*/ final float MIN_GAIN = -96.0F; // TODO: recheck this value private /*static*/ final int GAIN_INCREMENTS = 1000; // private float m_fGain; // private boolean m_bMuted; /*package*/ AlsaSourceDataLineGainControl() { super(FloatControl.Type.VOLUME, // or MASTER_GAIN ? -96.0F, // MIN_GAIN, 24.0F, // MAX_GAIN, 0.01F, // precision 0, // update period? 0.0F, // initial value "dB", "-96.0", "", "+24.0"); // m_bMuted = false; // should be included in a compund control? } public void setValue(float fGain) { fGain = Math.max(Math.min(fGain, getMaximum()), getMinimum()); if (Math.abs(fGain - getValue()) > 1.0E9) { super.setValue(fGain); // if (!getMute()) // { AlsaSourceDataLine.this.setGain(getValue()); // } } } /* public float getMaximum() { return MAX_GAIN; } public float getMinimum() { return MIN_GAIN; } public int getIncrements() { // TODO: check this value return GAIN_INCREMENTS; } public void fade(float fInitialGain, float fFinalGain, int nFrames) { // TODO: } public int getFadePrecision() { //TODO: return -1; } public boolean getMute() { return m_bMuted; } public void setMute(boolean bMuted) { if (bMuted != getMute()) { m_bMuted = bMuted; if (getMute()) { AlsaSourceDataLine.this.setGain(getMinimum()); } else { AlsaSourceDataLine.this.setGain(getGain()); } } } */ } } /*** AlsaSourceDataLine.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/sampled/mixer/alsa/AlsaTargetDataLine.java0000644000175000017500000001444410375041157032116 0ustar twernertwerner/* * AlsaTargetDataLine.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999 - 2001 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.sampled.mixer.alsa; import javax.sound.sampled.AudioFormat; import javax.sound.sampled.DataLine; import javax.sound.sampled.FloatControl; import javax.sound.sampled.LineUnavailableException; import javax.sound.sampled.TargetDataLine; import org.tritonus.share.TDebug; import org.tritonus.lowlevel.alsa.Alsa; import org.tritonus.lowlevel.alsa.AlsaPcm; import org.tritonus.share.sampled.TConversionTool; public class AlsaTargetDataLine extends AlsaBaseDataLine implements TargetDataLine { private byte[] m_abSwapBuffer; public AlsaTargetDataLine(AlsaDataLineMixer mixer, AudioFormat format, int nBufferSize) throws LineUnavailableException { // TODO: use an info object that represents the mixer's capabilities (all possible formats for the line) super(mixer, new DataLine.Info(TargetDataLine.class, format, nBufferSize)/*, // TODO: has info object to change if format or buffer size are changed later? format, nBufferSize*/); } protected int getAlsaStreamType() { return AlsaPcm.SND_PCM_STREAM_CAPTURE; } /* public void start() { // getAlsaPcm().goCapture(); setStarted(true); setActive(true); if (TDebug.TraceSourceDataLine) { TDebug.out("AlsaTargetDataLine.start(): channel started."); } } */ protected void stopImpl() { if (TDebug.TraceTargetDataLine) { TDebug.out("AlsaTargetDataLine.stopImpl(): called."); } int nReturn = 0; //getAlsaPcm().flushChannel(AlsaPcm.SND_PCM_CHANNEL_CAPTURE); if (nReturn != 0) { TDebug.out("flushChannel: " + Alsa.getStringError(nReturn)); } } public int available() { // TODO: return -1; } // TODO: check if should block public int read(byte[] abData, int nOffset, int nLength) { if (TDebug.TraceTargetDataLine) { TDebug.out("AlsaTargetDataLine.read(): called."); TDebug.out("AlsaTargetDataLine.read(): wanted length: " + nLength); } int nOriginalOffset = nOffset; if (nLength > 0 && !isActive()) { start(); } if (!isOpen()) { if (TDebug.TraceTargetDataLine) { TDebug.out("AlsaTargetDataLine.read(): stream closed"); } } int nBytesRead = readImpl(abData, nOffset, nLength); if (TDebug.TraceTargetDataLine) { TDebug.out("AlsaTargetDataLine.read(): read (bytes): " + nBytesRead); } if (getSwapBytes() && nBytesRead > 0) { TConversionTool.swapOrder16(abData, nOriginalOffset, nBytesRead / 2); } return nBytesRead; } // TODO: check if should block public int readImpl(byte[] abData, int nOffset, int nLength) { if (TDebug.TraceTargetDataLine) { TDebug.out("AlsaTargetDataLine.readImpl(): called."); TDebug.out("AlsaTargetDataLine.readImpl(): wanted length: " + nLength); } int nFrameSize = getFormat().getFrameSize(); int nFramesToRead = nLength / nFrameSize; if (nLength > 0 && !isActive()) { start(); } if (!isOpen()) { if (TDebug.TraceTargetDataLine) { TDebug.out("AlsaTargetDataLine.readImpl(): stream closed"); } } int nFramesRead = (int) getAlsaPcm().readi(abData, nOffset, nFramesToRead); if (nFramesRead < 0) { TDebug.out("AlsaTargetDataLine.readImpl(): " + Alsa.getStringError(nFramesRead)); } int nBytesRead = nFramesRead * nFrameSize; if (TDebug.TraceTargetDataLine) { TDebug.out("AlsaTargetDataLine.readImpl(): read (bytes): " + nBytesRead); } return nBytesRead; } public void drain() { // TODO: } public void flush() { // TODO: } public long getPosition() { // TODO: return 0; } /** * fGain is logarithmic!! */ protected void setGain(float fGain) { } public class AlsaTargetDataLineGainControl extends FloatControl { /* * These variables should be static. However, Java 1.1 * doesn't allow this. So they aren't. */ private /*static*/ final float MAX_GAIN = 90.0F; private /*static*/ final float MIN_GAIN = -96.0F; // TODO: recheck this value private /*static*/ final int GAIN_INCREMENTS = 1000; // private float m_fGain; // private boolean m_bMuted; /*package*/ AlsaTargetDataLineGainControl() { super(FloatControl.Type.VOLUME, // or MASTER_GAIN ? -96.0F, // MIN_GAIN, 24.0F, // MAX_GAIN, 0.01F, // precision 0, // update period? 0.0F, // initial value "dB", "-96.0", "", "+24.0"); // m_bMuted = false; // should be included in a compund control? } public void setValue(float fGain) { fGain = Math.max(Math.min(fGain, getMaximum()), getMinimum()); if (Math.abs(fGain - getValue()) > 1.0E9) { super.setValue(fGain); // if (!getMute()) // { AlsaTargetDataLine.this.setGain(getValue()); // } } } /* public float getMaximum() { return MAX_GAIN; } public float getMinimum() { return MIN_GAIN; } public int getIncrements() { // TODO: check this value return GAIN_INCREMENTS; } public void fade(float fInitialGain, float fFinalGain, int nFrames) { // TODO: } public int getFadePrecision() { //TODO: return -1; } public boolean getMute() { return m_bMuted; } public void setMute(boolean bMuted) { if (bMuted != getMute()) { m_bMuted = bMuted; if (getMute()) { AlsaTargetDataLine.this.setGain(getMinimum()); } else { AlsaTargetDataLine.this.setGain(getGain()); } } } */ } } /*** AlsaTargetDataLine.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/sampled/mixer/alsa/AlsaUtils.java0000644000175000017500000001276510374142167030374 0ustar twernertwerner/* * AlsaUtils.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999 - 2001 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.sampled.mixer.alsa; import javax.sound.sampled.AudioFormat; import javax.sound.sampled.AudioSystem; import org.tritonus.share.sampled.AudioFormats; import org.tritonus.lowlevel.alsa.AlsaPcm; public class AlsaUtils { private static AudioFormat[] sm_aFormatTable = new AudioFormat[32]; static { sm_aFormatTable[AlsaPcm.SND_PCM_FORMAT_S8] = new AudioFormat( AudioFormat.Encoding.PCM_SIGNED, AudioSystem.NOT_SPECIFIED, 8, AudioSystem.NOT_SPECIFIED, AudioSystem.NOT_SPECIFIED, AudioSystem.NOT_SPECIFIED, true); sm_aFormatTable[AlsaPcm.SND_PCM_FORMAT_U8] = new AudioFormat( AudioFormat.Encoding.PCM_UNSIGNED, AudioSystem.NOT_SPECIFIED, 8, AudioSystem.NOT_SPECIFIED, AudioSystem.NOT_SPECIFIED, AudioSystem.NOT_SPECIFIED, true); sm_aFormatTable[AlsaPcm.SND_PCM_FORMAT_S16_LE] = new AudioFormat( AudioFormat.Encoding.PCM_SIGNED, AudioSystem.NOT_SPECIFIED, 16, AudioSystem.NOT_SPECIFIED, AudioSystem.NOT_SPECIFIED, AudioSystem.NOT_SPECIFIED, false); sm_aFormatTable[AlsaPcm.SND_PCM_FORMAT_S16_BE] = new AudioFormat( AudioFormat.Encoding.PCM_SIGNED, AudioSystem.NOT_SPECIFIED, 16, AudioSystem.NOT_SPECIFIED, AudioSystem.NOT_SPECIFIED, AudioSystem.NOT_SPECIFIED, true); sm_aFormatTable[AlsaPcm.SND_PCM_FORMAT_U16_LE] = new AudioFormat( AudioFormat.Encoding.PCM_UNSIGNED, AudioSystem.NOT_SPECIFIED, 16, AudioSystem.NOT_SPECIFIED, AudioSystem.NOT_SPECIFIED, AudioSystem.NOT_SPECIFIED, false); sm_aFormatTable[AlsaPcm.SND_PCM_FORMAT_U16_BE] = new AudioFormat( AudioFormat.Encoding.PCM_UNSIGNED, AudioSystem.NOT_SPECIFIED, 16, AudioSystem.NOT_SPECIFIED, AudioSystem.NOT_SPECIFIED, AudioSystem.NOT_SPECIFIED, true); sm_aFormatTable[AlsaPcm.SND_PCM_FORMAT_S24_LE] = new AudioFormat( AudioFormat.Encoding.PCM_SIGNED, AudioSystem.NOT_SPECIFIED, 24, AudioSystem.NOT_SPECIFIED, AudioSystem.NOT_SPECIFIED, AudioSystem.NOT_SPECIFIED, false); sm_aFormatTable[AlsaPcm.SND_PCM_FORMAT_S24_BE] = new AudioFormat( AudioFormat.Encoding.PCM_SIGNED, AudioSystem.NOT_SPECIFIED, 24, AudioSystem.NOT_SPECIFIED, AudioSystem.NOT_SPECIFIED, AudioSystem.NOT_SPECIFIED, true); sm_aFormatTable[AlsaPcm.SND_PCM_FORMAT_U24_LE] = new AudioFormat( AudioFormat.Encoding.PCM_UNSIGNED, AudioSystem.NOT_SPECIFIED, 24, AudioSystem.NOT_SPECIFIED, AudioSystem.NOT_SPECIFIED, AudioSystem.NOT_SPECIFIED, false); sm_aFormatTable[AlsaPcm.SND_PCM_FORMAT_U24_BE] = new AudioFormat( AudioFormat.Encoding.PCM_UNSIGNED, AudioSystem.NOT_SPECIFIED, 24, AudioSystem.NOT_SPECIFIED, AudioSystem.NOT_SPECIFIED, AudioSystem.NOT_SPECIFIED, true); sm_aFormatTable[AlsaPcm.SND_PCM_FORMAT_S32_LE] = new AudioFormat( AudioFormat.Encoding.PCM_SIGNED, AudioSystem.NOT_SPECIFIED, 32, AudioSystem.NOT_SPECIFIED, AudioSystem.NOT_SPECIFIED, AudioSystem.NOT_SPECIFIED, false); sm_aFormatTable[AlsaPcm.SND_PCM_FORMAT_S32_BE] = new AudioFormat( AudioFormat.Encoding.PCM_SIGNED, AudioSystem.NOT_SPECIFIED, 32, AudioSystem.NOT_SPECIFIED, AudioSystem.NOT_SPECIFIED, AudioSystem.NOT_SPECIFIED, true); sm_aFormatTable[AlsaPcm.SND_PCM_FORMAT_U32_LE] = new AudioFormat( AudioFormat.Encoding.PCM_UNSIGNED, AudioSystem.NOT_SPECIFIED, 32, AudioSystem.NOT_SPECIFIED, AudioSystem.NOT_SPECIFIED, AudioSystem.NOT_SPECIFIED, false); sm_aFormatTable[AlsaPcm.SND_PCM_FORMAT_U32_BE] = new AudioFormat( AudioFormat.Encoding.PCM_UNSIGNED, AudioSystem.NOT_SPECIFIED, 32, AudioSystem.NOT_SPECIFIED, AudioSystem.NOT_SPECIFIED, AudioSystem.NOT_SPECIFIED, true); sm_aFormatTable[AlsaPcm.SND_PCM_FORMAT_MU_LAW] = new AudioFormat( AudioFormat.Encoding.ULAW, AudioSystem.NOT_SPECIFIED, 8, AudioSystem.NOT_SPECIFIED, AudioSystem.NOT_SPECIFIED, AudioSystem.NOT_SPECIFIED, true); sm_aFormatTable[AlsaPcm.SND_PCM_FORMAT_A_LAW] = new AudioFormat( AudioFormat.Encoding.ALAW, AudioSystem.NOT_SPECIFIED, 8, AudioSystem.NOT_SPECIFIED, AudioSystem.NOT_SPECIFIED, AudioSystem.NOT_SPECIFIED, true); } public static AudioFormat getAlsaFormat(int nAudioFormat) { return sm_aFormatTable[nAudioFormat]; } public static int getAlsaFormat(AudioFormat audioFormat) { for (int nFormat = 0; nFormat < sm_aFormatTable.length; nFormat++) { if (sm_aFormatTable[nFormat] != null && AudioFormats.matches(sm_aFormatTable[nFormat], audioFormat)) { return nFormat; } } return AlsaPcm.SND_PCM_FORMAT_UNKNOWN; } } /*** AlsaUtils.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/sampled/mixer/alsa/package.html0000644000175000017500000000035410172461361030074 0ustar twernertwerner

A Mixer implementation based on ALSA. The classes provided here .

@see org.tritonus.lowlevel.alsa libtritonus-java-20070428/src/classes/org/tritonus/sampled/mixer/esd/0000755000175000017500000000000010621572501025442 5ustar twernertwernerlibtritonus-java-20070428/src/classes/org/tritonus/sampled/mixer/esd/EsdClip.java0000644000175000017500000001426210172461361027637 0ustar twernertwerner/* * EsdClip.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.sampled.mixer.esd; import java.io.IOException; import java.io.ByteArrayInputStream; import javax.sound.sampled.AudioFormat; import javax.sound.sampled.Clip; import javax.sound.sampled.DataLine; import javax.sound.sampled.AudioInputStream; import javax.sound.sampled.LineUnavailableException; import javax.sound.sampled.Mixer; import org.tritonus.share.TDebug; import org.tritonus.lowlevel.esd.EsdSample; import org.tritonus.lowlevel.esd.Esd; import org.tritonus.share.sampled.mixer.TDataLine; import org.tritonus.share.sampled.mixer.TMixer; public class EsdClip extends TDataLine implements Clip { private static final Class[] CONTROL_CLASSES = {/*GainControl.class*/}; private static final int BUFFER_FRAMES = 16384; private Mixer m_mixer; private EsdSample m_esdSample; public EsdClip(TMixer mixer) { super(mixer, null); m_mixer = mixer; m_esdSample = new EsdSample(); } // interface Clip public void open(AudioFormat audioFormat, byte[] abData, int nOffset, int nNumFrames) throws LineUnavailableException { int nBufferLength = nNumFrames * audioFormat.getFrameSize(); // TODO: check if nOffset + nBufferLength <= abData.length // perhaps truncate automatically ByteArrayInputStream bais = new ByteArrayInputStream(abData, nOffset, nBufferLength); try { AudioInputStream audioInputStream = new AudioInputStream(bais, audioFormat, nNumFrames); open(audioInputStream); } catch (IOException e) { if (TDebug.TraceAllExceptions) { TDebug.out(e); } throw new LineUnavailableException(); } } public void open(AudioInputStream audioInputStream) throws LineUnavailableException, IOException { AudioFormat audioFormat = audioInputStream.getFormat(); // TOOD: DataLine.Info info = new DataLine.Info(Clip.class, audioFormat, -1/*nBufferSize*/); setLineInfo(info); int nFrameSize = audioFormat.getFrameSize(); long lTotalLength = audioInputStream.getFrameLength() * nFrameSize; int nFormat = Esd.ESD_STREAM | Esd.ESD_PLAY | EsdUtils.getEsdFormat(audioFormat); if (TDebug.TraceClip) { TDebug.out("format: " + nFormat); TDebug.out("sample rate: " + audioFormat.getSampleRate()); } m_esdSample.open(nFormat, (int) audioFormat.getSampleRate(), (int) lTotalLength); if (TDebug.TraceClip) { TDebug.out("size in esd: " + audioInputStream.getFrameLength() * nFrameSize); } int nBufferLength = BUFFER_FRAMES * nFrameSize; byte[] abData = new byte[nBufferLength]; int nBytesRead = 0; int nTotalBytes = 0; while (nBytesRead != -1) { try { nBytesRead = audioInputStream.read(abData, 0, abData.length); } catch (IOException e) { if (TDebug.TraceClip || TDebug.TraceAllExceptions) { TDebug.out(e); } } if (nBytesRead >= 0) { nTotalBytes += nBytesRead; if (TDebug.TraceClip) { TDebug.out("EsdClip.open(): total bytes: " + nTotalBytes); TDebug.out("EsdClip.open(): Trying to write: " + nBytesRead); } int nBytesWritten = m_esdSample.write(abData, 0, nBytesRead); if (TDebug.TraceClip) { TDebug.out("EsdClip.open(): Written: " + nBytesWritten); } } } // to trigger the events open(); } public int getFrameLength() { // TODO: return -1; } public long getMicrosecondLength() { // TODO: return -1; } public void setFramePosition(int nPosition) { // TOOD: } public void setMicrosecondPosition(long lPosition) { // TOOD: } public int getFramePosition() { // TOOD: return -1; } public long getMicrosecondPosition() { // TOOD: return -1; } public void setLoopPoints(int nStart, int nEnd) { // TOOD: } public void loop(int nCount) { if (TDebug.TraceClip) { TDebug.out("EsdClip.loop(int): called; count = " + nCount); } if (false/*isStarted()*/) { /* * only allow zero count to stop the looping * at the end of an iteration. */ if (nCount == 0) { if (TDebug.TraceClip) { TDebug.out("EsdClip.loop(int): stopping sample"); } m_esdSample.stop(); } } else { if (nCount == 0) { if (TDebug.TraceClip) { TDebug.out("EsdClip.loop(int): starting sample (once)"); } m_esdSample.play(); } else { /* * we're ignoring the count, because esd * cannot loop for a fixed number of * times. */ // TDebug.out("hallo"); if (TDebug.TraceClip) { TDebug.out("EsdClip.loop(int): starting sample (forever)"); } m_esdSample.loop(); } } // TOOD: } public void flush() { // TOOD: } public void drain() { // TOOD: } public void close() { m_esdSample.free(); m_esdSample.close(); // TOOD: } public void open() { // TODO: } public void start() { if (TDebug.TraceClip) { TDebug.out("EsdClip.start(): called"); } /* * This is a hack. What start() really should do is * start playing at the position playback was stopped. */ if (TDebug.TraceClip) { TDebug.out("EsdClip.start(): calling 'loop(0)' [hack]"); } loop(0); } public void stop() { // TODO: m_esdSample.kill(); } /* * This method is enforced by DataLine, but doesn't make any * sense for Clips. */ public int available() { return -1; } } /*** EsdClip.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/sampled/mixer/esd/EsdMixer.java0000644000175000017500000001713010374074736030043 0ustar twernertwerner/* * EsdMixer.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999, 2000 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.sampled.mixer.esd; import java.util.Arrays; import javax.sound.sampled.AudioFormat; import javax.sound.sampled.AudioSystem; import javax.sound.sampled.Clip; import javax.sound.sampled.DataLine; import javax.sound.sampled.SourceDataLine; import javax.sound.sampled.TargetDataLine; import javax.sound.sampled.LineUnavailableException; import javax.sound.sampled.Line; import javax.sound.sampled.Mixer; import org.tritonus.share.TDebug; import org.tritonus.share.sampled.mixer.TMixer; import org.tritonus.share.sampled.mixer.TMixerInfo; import org.tritonus.share.sampled.mixer.TSoftClip; import org.tritonus.share.GlobalInfo; public class EsdMixer extends TMixer { // default buffer size in bytes. private static final int DEFAULT_BUFFER_SIZE = 32768; private static AudioFormat[] FORMATS = { // hack for testing. // new AudioFormat(AudioFormat.Encoding.PCM_SIGNED, 11025/*AudioSystem.NOT_SPECIFIED*/, 16, 1, 2, 11025/*AudioSystem.NOT_SPECIFIED*/, false), // Formats supported directely by esd. new AudioFormat(AudioFormat.Encoding.PCM_UNSIGNED, AudioSystem.NOT_SPECIFIED, 8, 1, 1, AudioSystem.NOT_SPECIFIED, true), new AudioFormat(AudioFormat.Encoding.PCM_UNSIGNED, AudioSystem.NOT_SPECIFIED, 8, 1, 1, AudioSystem.NOT_SPECIFIED, false), new AudioFormat(AudioFormat.Encoding.PCM_UNSIGNED, AudioSystem.NOT_SPECIFIED, 8, 2, 2, AudioSystem.NOT_SPECIFIED, true), new AudioFormat(AudioFormat.Encoding.PCM_UNSIGNED, AudioSystem.NOT_SPECIFIED, 8, 2, 2, AudioSystem.NOT_SPECIFIED, false), new AudioFormat(AudioFormat.Encoding.PCM_SIGNED, AudioSystem.NOT_SPECIFIED, 16, 1, 2, AudioSystem.NOT_SPECIFIED, false), new AudioFormat(AudioFormat.Encoding.PCM_SIGNED, AudioSystem.NOT_SPECIFIED, 16, 2, 4, AudioSystem.NOT_SPECIFIED, false), /* * Format supported through "simple" conversions. * "Simple" conversions are changes in the byte order * and changing signed/unsigned for 8 bit. */ new AudioFormat(AudioFormat.Encoding.PCM_SIGNED, AudioSystem.NOT_SPECIFIED, 8, 1, 1, AudioSystem.NOT_SPECIFIED, true), new AudioFormat(AudioFormat.Encoding.PCM_SIGNED, AudioSystem.NOT_SPECIFIED, 8, 1, 1, AudioSystem.NOT_SPECIFIED, false), new AudioFormat(AudioFormat.Encoding.PCM_SIGNED, AudioSystem.NOT_SPECIFIED, 8, 2, 2, AudioSystem.NOT_SPECIFIED, true), new AudioFormat(AudioFormat.Encoding.PCM_SIGNED, AudioSystem.NOT_SPECIFIED, 8, 2, 2, AudioSystem.NOT_SPECIFIED, false), new AudioFormat(AudioFormat.Encoding.PCM_SIGNED, AudioSystem.NOT_SPECIFIED, 16, 1, 2, AudioSystem.NOT_SPECIFIED, true), new AudioFormat(AudioFormat.Encoding.PCM_SIGNED, AudioSystem.NOT_SPECIFIED, 16, 2, 4, AudioSystem.NOT_SPECIFIED, true), }; private static Line.Info[] SOURCE_LINE_INFOS = { new DataLine.Info(SourceDataLine.class, FORMATS, AudioSystem.NOT_SPECIFIED, AudioSystem.NOT_SPECIFIED), }; private static Line.Info[] TARGET_LINE_INFOS = { new DataLine.Info(TargetDataLine.class, FORMATS, AudioSystem.NOT_SPECIFIED, AudioSystem.NOT_SPECIFIED), }; public EsdMixer() { super(new TMixerInfo( "Esd Mixer", GlobalInfo.getVendor(), "Mixer for the Enlightened Sound Daemon (esd) running on the local machine", GlobalInfo.getVersion()), new Line.Info(Mixer.class), Arrays.asList(FORMATS), Arrays.asList(FORMATS), Arrays.asList(SOURCE_LINE_INFOS), Arrays.asList(TARGET_LINE_INFOS)); if (TDebug.TraceMixer) { TDebug.out("EsdMixer.: begin"); } if (TDebug.TraceMixer) { TDebug.out("EsdMixer.: end"); } } //////////////// Line ////////////////////////////////////// // TODO: allow real close and reopen of mixer public void open() { if (TDebug.TraceMixer) { TDebug.out("EsdMixer.open(): begin"); } // currently does nothing if (TDebug.TraceMixer) { TDebug.out("EsdMixer.open(): end"); } } public void close() { if (TDebug.TraceMixer) { TDebug.out("EsdMixer.close(): begin"); } // currently does nothing if (TDebug.TraceMixer) { TDebug.out("EsdMixer.close(): end"); } } //////////////// Mixer ////////////////////////////////////// public int getMaxLines(Line.Info info) { if (TDebug.TraceMixer) { TDebug.out("EsdMixer.getMaxLines(): begin"); } int nMaxLines = 0; if (info instanceof DataLine.Info) { Class lineClass = info.getLineClass(); if (lineClass == SourceDataLine.class) { nMaxLines = 32; } else if (lineClass == TargetDataLine.class) { nMaxLines = 1; } else { /* DO NOTHING; only source and target lines are supported. */ } } else { /* DO NOTHING; only data lines are supported. */ } if (TDebug.TraceMixer) { TDebug.out("EsdMixer.getMaxLines(): end"); } return nMaxLines; } //////////////// private ////////////////////////////////////// // nBufferSize is in bytes! protected SourceDataLine getSourceDataLine(AudioFormat format, int nBufferSize) throws LineUnavailableException { if (TDebug.TraceMixer) { TDebug.out("EsdMixer.getSourceDataLine(): begin"); } if (TDebug.TraceMixer) { TDebug.out("EsdMixer.getSourceDataLine(): format: " + format); TDebug.out("EsdMixer.getSourceDataLine(): buffer size: " + nBufferSize); } if (nBufferSize < 1) { nBufferSize = DEFAULT_BUFFER_SIZE; } // int nBufferSizeInBytes = nBufferSize * format.getFrameSize(); EsdSourceDataLine sourceDataLine = new EsdSourceDataLine(this, format, nBufferSize); sourceDataLine.start(); if (TDebug.TraceMixer) { TDebug.out("EsdMixer.getSourceDataLine(): returning: " + sourceDataLine); } if (TDebug.TraceMixer) { TDebug.out("EsdMixer.getSourceDataLine(): end"); } return sourceDataLine; } // nBufferSize is in bytes! protected TargetDataLine getTargetDataLine(AudioFormat format, int nBufferSize) throws LineUnavailableException { if (TDebug.TraceMixer) { TDebug.out("EsdMixer.getTargetDataLine(): begin"); } int nBufferSizeInBytes = nBufferSize * format.getFrameSize(); EsdTargetDataLine targetDataLine = new EsdTargetDataLine(this, format, nBufferSizeInBytes); // registerChannel(sourceDataLine); targetDataLine.start(); if (TDebug.TraceMixer) { TDebug.out("EsdMixer.getTargetDataLine(): returning: " + targetDataLine); } if (TDebug.TraceMixer) { TDebug.out("EsdMixer.getTargetDataLine(): end"); } return targetDataLine; } protected Clip getClip(AudioFormat format) throws LineUnavailableException { if (TDebug.TraceMixer) { TDebug.out("EsdMixer.getClip(): begin"); } Clip clip = new TSoftClip(this, format); if (TDebug.TraceMixer) { TDebug.out("EsdMixer.getClip(): end"); } return clip; } // ------------------------------------------------------------- } /*** EsdMixer.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/sampled/mixer/esd/EsdMixerProvider.java0000644000175000017500000000405010374074736031553 0ustar twernertwerner/* * EsdMixerProvider.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999 - 2002 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.sampled.mixer.esd; import org.tritonus.lowlevel.esd.Esd; import org.tritonus.share.TDebug; import org.tritonus.share.sampled.mixer.TMixerProvider; public class EsdMixerProvider extends TMixerProvider { private static boolean sm_bInitialized = false; public EsdMixerProvider() { super(); if (TDebug.TraceMixerProvider) { TDebug.out("EsdMixerProvider.(): begin"); } if (! sm_bInitialized && ! isDisabled()) { /// TODO: adapt! if (! Esd.isLibraryAvailable()) { disable(); } else { staticInit(); sm_bInitialized = true; } } else { if (TDebug.TraceMixerProvider) { TDebug.out("EsdMixerProvider.(): already initialized or disabled"); } } if (TDebug.TraceMixerProvider) { TDebug.out("EsdMixerProvider.(): end"); } } protected void staticInit() { if (TDebug.TraceMixerProvider) { TDebug.out("EsdMixerProvider.staticInit(): begin"); } addMixer(new EsdMixer()); if (TDebug.TraceMixerProvider) { TDebug.out("EsdMixerProvider.staticInit(): end"); } } } /*** EsdMixerProvider.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/sampled/mixer/esd/EsdSourceDataLine.java0000644000175000017500000002425010375041157031612 0ustar twernertwerner/* * EsdSourceDataLine.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999, 2000 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.sampled.mixer.esd; import javax.sound.sampled.AudioFormat; import javax.sound.sampled.BooleanControl; import javax.sound.sampled.DataLine; import javax.sound.sampled.FloatControl; import javax.sound.sampled.LineUnavailableException; import javax.sound.sampled.SourceDataLine; import org.tritonus.share.TDebug; import org.tritonus.lowlevel.esd.Esd; import org.tritonus.lowlevel.esd.EsdStream; import org.tritonus.share.sampled.TConversionTool; import org.tritonus.share.sampled.mixer.TMixer; import org.tritonus.share.sampled.mixer.TBaseDataLine; public class EsdSourceDataLine extends TBaseDataLine implements SourceDataLine { private EsdStream m_esdStream; private boolean m_bSwapBytes; private byte[] m_abSwapBuffer; /* * Only used if m_bSwapBytes is true. */ private int m_nBytesPerSample; /* * Used to store the muted state. */ private boolean m_bMuted; /* * Used to store the gain while the channel is muted. */ private float m_fGain; /* * Used to store the pan while the channel is muted. */ private float m_fPan; // TODO: has info object to change if format or buffer size are changed later? // no, but it has to represent the mixer's capabilities. So a fixed info per mixer. public EsdSourceDataLine(TMixer mixer, AudioFormat format, int nBufferSize) throws LineUnavailableException { super(mixer, new DataLine.Info(SourceDataLine.class, format, nBufferSize)); addControl(new EsdSourceDataLineGainControl()); addControl(new EsdSourceDataLinePanControl()); addControl(new EsdSourceDataLineMuteControl()); /* if (TDebug.TraceSourceDataLine) { TDebug.out("EsdSourceDataLine.(): buffer size: " + nBufferSize); } */ } protected void openImpl() { if (TDebug.TraceSourceDataLine) { TDebug.out("EsdSourceDataLine.openImpl(): called."); } /* * Checks that a format is set. * Sets the buffer size to a default value if not * already set. */ checkOpen(); AudioFormat format = getFormat(); AudioFormat.Encoding encoding = format.getEncoding(); boolean bBigEndian = format.isBigEndian(); m_bSwapBytes = false; if (format.getSampleSizeInBits() == 16 && bBigEndian) { m_bSwapBytes = true; bBigEndian = false; } else if (format.getSampleSizeInBits() == 8 && encoding.equals(AudioFormat.Encoding.PCM_SIGNED)) { m_bSwapBytes = true; encoding = AudioFormat.Encoding.PCM_UNSIGNED; } /* * Ugly hack, should fade as soon as possible. * IDEA: if swapping IS necessary here, isolate the "detection" of * big-endian architectures into a seperate class. Perhaps have a * property with a list of big-endian architecture names, so that * support can be extended to other architectures without changes * in the source code. */ // TODO: does 8 bit work? (perhaps problem inside esd?) if (System.getProperty("os.arch").equals("ppc") && format.getSampleSizeInBits() == 16) { m_bSwapBytes ^= true; } if (m_bSwapBytes) { format = new AudioFormat(encoding, format.getSampleRate(), format.getSampleSizeInBits(), format.getChannels(), format.getFrameSize(), format.getFrameRate(), bBigEndian); m_nBytesPerSample = format.getFrameSize() / format.getChannels(); } int nOutFormat = Esd.ESD_STREAM | Esd.ESD_PLAY | EsdUtils.getEsdFormat(format); m_esdStream = new EsdStream(); m_esdStream.open(nOutFormat, (int) format.getSampleRate()); } public int available() { // TODO: return -1; } // TODO: check if should block public int write(byte[] abData, int nOffset, int nLength) { if (TDebug.TraceSourceDataLine) { TDebug.out("EsdSourceDataLine.write(): called."); } if (m_bSwapBytes) { if (m_abSwapBuffer == null || m_abSwapBuffer.length < nOffset + nLength) { m_abSwapBuffer = new byte[nOffset + nLength]; } TConversionTool.changeOrderOrSign( abData, nOffset, m_abSwapBuffer, nOffset, nLength, m_nBytesPerSample); abData = m_abSwapBuffer; } if (nLength > 0 && !isActive()) { start(); } int nRemaining = nLength; while (nRemaining > 0 && isOpen()) { synchronized (this) { /* while ((availableWrite() == 0 || isPaused()) && isOpen()) { try { wait(); } catch (InterruptedException e) { if (TDebug.TraceAllExceptions) { TDebug.out(e); } } } */ if (!isOpen()) { return nLength - nRemaining; } // TODO: check return int nWritten = m_esdStream.write(abData, nOffset, nRemaining); nOffset += nWritten; nRemaining -= nWritten; } } return nLength; } protected void closeImpl() { if (TDebug.TraceSourceDataLine) { TDebug.out("EsdSourceDataLine.closeImpl(): called."); } m_esdStream.close(); } public void drain() { if (TDebug.TraceSourceDataLine) { TDebug.out("EsdSourceDataLine.drain(): called."); } // TODO: } public void flush() { if (TDebug.TraceSourceDataLine) { TDebug.out("EsdSourceDataLine.flush(): called."); } // TODO: } /** * fGain is logarithmic!! */ protected void setGain(float fGain) { if (TDebug.TraceSourceDataLine) { TDebug.out("EsdSourceDataLine.setGain(): gain: " + fGain); } m_fGain = fGain; if (! m_bMuted) { setGainImpl(); } } /** */ protected void setPan(float fPan) { if (TDebug.TraceSourceDataLine) { TDebug.out("EsdSourceDataLine.setPan(): pan: " + fPan); } m_fPan = fPan; if (! m_bMuted) { setGainImpl(); } } /** */ protected void setMuted(boolean bMuted) { if (TDebug.TraceSourceDataLine) { TDebug.out("EsdSourceDataLine.setMuted(): muted: " + bMuted); } m_bMuted = bMuted; if (m_bMuted) { // m_esdStream.setVolume(0, 0); } else { setGainImpl(); } } /** */ private void setGainImpl() { if (TDebug.TraceSourceDataLine) { TDebug.out("EsdSourceDataLine.setGainImpl(): called: "); } /* float fLeftDb = m_fGain + m_fPan * 15.0F; float fRightDb = m_fGain - m_fPan * 15.0F; float fLeftLinear = (float) TVolumeUtils.log2lin(fLeftDb); float fRightLinear = (float) TVolumeUtils.log2lin(fRightDb); */ // m_esdStream.setVolume((int) (fLeftLinear * 256), // (int) (fRightLinear * 256)); } // IDEA: move inner classes to TBaseDataLine public class EsdSourceDataLineGainControl extends FloatControl { /* * These variables should be static. However, Java 1.1 * doesn't allow this. So they aren't. */ private /*static*/ final float MAX_GAIN = 24.0F; private /*static*/ final float MIN_GAIN = -96.0F; /*package*/ EsdSourceDataLineGainControl() { super(FloatControl.Type.MASTER_GAIN, // or VOLUME ? -96.0F, // MIN_GAIN, 24.0F, // MAX_GAIN, 0.01F, // precision 0, // update period? 0.0F, // initial value "dB", "-96.0", "", "+24.0"); // m_bMuted = false; // should be included in a compund control? } public void setValue(float fGain) { if (TDebug.TraceSourceDataLine) { TDebug.out("EsdSourceDataLineGainControl.setValue(): gain: " + fGain); } float fOldGain = getValue(); super.setValue(fGain); if (Math.abs(fOldGain - getValue()) > 1.0E-9) { if (TDebug.TraceSourceDataLine) { TDebug.out("EsdSourceDataLineGainControl.setValue(): really changing gain"); } EsdSourceDataLine.this.setGain(getValue()); } } } // IDEA: move inner classes to TBaseDataLine public class EsdSourceDataLinePanControl extends FloatControl { /*package*/ EsdSourceDataLinePanControl() { super(FloatControl.Type.PAN, -1.0F, // MIN_GAIN, 1.0F, // MAX_GAIN, 0.01F, // precision 0, // update period? 0.0F, // initial value "??", "left", "center", "right"); } public void setValue(float fPan) { if (TDebug.TraceSourceDataLine) { TDebug.out("EsdSourceDataLinePanControl.setValue(): pan: " + fPan); } float fOldPan = getValue(); super.setValue(fPan); if (Math.abs(fOldPan - getValue()) > 1.0E-9) { if (TDebug.TraceSourceDataLine) { TDebug.out("EsdSourceDataLinePanControl.setValue(): really changing pan"); } EsdSourceDataLine.this.setPan(getValue()); } } } public class EsdSourceDataLineMuteControl extends BooleanControl { /*package*/ EsdSourceDataLineMuteControl() { super(BooleanControl.Type.MUTE, false, "muted", "unmuted"); } public void setValue(boolean bMuted) { if (TDebug.TraceSourceDataLine) { TDebug.out("EsdSourceDataLineMuteControl.setValue(): muted: " + bMuted); } if (bMuted != getValue()) { if (TDebug.TraceSourceDataLine) { TDebug.out("EsdSourceDataLineMuteControl.setValue(): really changing mute status"); } super.setValue(bMuted); EsdSourceDataLine.this.setMuted(getValue()); } } /* public boolean getMute() { return m_bMuted; } public void setMute(boolean bMuted) { if (bMuted != getMute()) { m_bMuted = bMuted; if (getMute()) { EsdSourceDataLine.this.setGain(getMinimum()); } else { EsdSourceDataLine.this.setGain(getGain()); } } } */ } } /*** EsdSourceDataLine.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/sampled/mixer/esd/EsdTargetDataLine.java0000644000175000017500000001515110375041157031600 0ustar twernertwerner/* * EsdTargetDataLine.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999, 2000 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.sampled.mixer.esd; import javax.sound.sampled.AudioFormat; import javax.sound.sampled.DataLine; import javax.sound.sampled.FloatControl; import javax.sound.sampled.LineUnavailableException; import javax.sound.sampled.TargetDataLine; import org.tritonus.share.TDebug; import org.tritonus.lowlevel.esd.Esd; import org.tritonus.lowlevel.esd.EsdRecordingStream; import org.tritonus.share.sampled.TConversionTool; import org.tritonus.share.sampled.mixer.TMixer; import org.tritonus.share.sampled.mixer.TBaseDataLine; public class EsdTargetDataLine extends TBaseDataLine implements TargetDataLine { // private static final Class[] CONTROL_CLASSES = {GainControl.class}; private EsdRecordingStream m_esdStream; private boolean m_bSwapBytes; private byte[] m_abSwapBuffer; /* * Only used if m_bSwapBytes is true. */ private int m_nBytesPerSample; public EsdTargetDataLine(TMixer mixer, AudioFormat format, int nBufferSize) throws LineUnavailableException { // TODO: use an info object that represents the mixer's capabilities (all possible formats for the line) super(mixer, new DataLine.Info(TargetDataLine.class, format, nBufferSize)/*, // TODO: has info object to change if format or buffer size are changed later? format, nBufferSize*/); } protected void openImpl() { if (TDebug.TraceTargetDataLine) { TDebug.out("EsdTargetDataLine.openImpl(): called."); } /* * Checks that a format is set. * Sets the buffer size to a default value if not * already set. */ checkOpen(); AudioFormat format = getFormat(); AudioFormat.Encoding encoding = format.getEncoding(); boolean bBigEndian = format.isBigEndian(); m_bSwapBytes = false; if (format.getSampleSizeInBits() == 16 && bBigEndian) { m_bSwapBytes = true; bBigEndian = false; } else if (format.getSampleSizeInBits() == 8 && encoding.equals(AudioFormat.Encoding.PCM_SIGNED)) { m_bSwapBytes = true; encoding = AudioFormat.Encoding.PCM_UNSIGNED; } if (m_bSwapBytes) { format = new AudioFormat(encoding, format.getSampleRate(), format.getSampleSizeInBits(), format.getChannels(), format.getFrameSize(), format.getFrameRate(), bBigEndian); m_nBytesPerSample = format.getFrameSize() / format.getChannels(); } int nOutFormat = Esd.ESD_STREAM | Esd.ESD_PLAY | EsdUtils.getEsdFormat(format); m_esdStream = new EsdRecordingStream(); m_esdStream.open(nOutFormat, (int) format.getSampleRate()); } /* public void start() { setStarted(true); setActive(true); if (TDebug.TraceSourceDataLine) { TDebug.out("EsdTargetDataLine.start(): channel started."); } } public void stop() { setStarted(false); } */ public int available() { // TODO: return -1; // return m_nAvailable; } // TODO: check if should block public int read(byte[] abData, int nOffset, int nLength) { if (TDebug.TraceTargetDataLine) { TDebug.out("EsdTargetDataLine.read(): called."); TDebug.out("EsdTargetDataLine.read(): wanted length: " + nLength); } int nOriginalOffset = nOffset; if (nLength > 0 && !isActive()) { start(); } if (!isOpen()) { if (TDebug.TraceTargetDataLine) { TDebug.out("EsdTargetDataLine.read(): stream closed"); } } int nBytesRead = m_esdStream.read(abData, nOffset, nLength); if (TDebug.TraceTargetDataLine) { TDebug.out("EsdTargetDataLine.read(): read (bytes): " + nBytesRead); } if (m_bSwapBytes && nBytesRead > 0) { TConversionTool.swapOrder16(abData, nOriginalOffset, nBytesRead / 2); } return nBytesRead; } public void closeImpl() { m_esdStream.close(); } public void drain() { // TODO: } public void flush() { // TODO: } public long getPosition() { // TODO: return 0; } /** * fGain is logarithmic!! */ protected void setGain(float fGain) { } public class EsdTargetDataLineGainControl extends FloatControl { /* * These variables should be static. However, Java 1.1 * doesn't allow this. So they aren't. */ private /*static*/ final float MAX_GAIN = 90.0F; private /*static*/ final float MIN_GAIN = -96.0F; // TODO: recheck this value private /*static*/ final int GAIN_INCREMENTS = 1000; // private float m_fGain; // private boolean m_bMuted; /*package*/ EsdTargetDataLineGainControl() { super(FloatControl.Type.VOLUME, // or MASTER_GAIN ? -96.0F, // MIN_GAIN, 24.0F, // MAX_GAIN, 0.01F, // precision 0, // update period? 0.0F, // initial value "dB", "-96.0", "", "+24.0"); // m_bMuted = false; // should be included in a compund control? } public void setValue(float fGain) { fGain = Math.max(Math.min(fGain, getMaximum()), getMinimum()); if (Math.abs(fGain - getValue()) > 1.0E9) { super.setValue(fGain); // if (!getMute()) // { EsdTargetDataLine.this.setGain(getValue()); // } } } /* public float getMaximum() { return MAX_GAIN; } public float getMinimum() { return MIN_GAIN; } public int getIncrements() { // TODO: check this value return GAIN_INCREMENTS; } public void fade(float fInitialGain, float fFinalGain, int nFrames) { // TODO: } public int getFadePrecision() { //TODO: return -1; } public boolean getMute() { return m_bMuted; } public void setMute(boolean bMuted) { if (bMuted != getMute()) { m_bMuted = bMuted; if (getMute()) { EsdTargetDataLine.this.setGain(getMinimum()); } else { EsdTargetDataLine.this.setGain(getGain()); } } } */ } } /*** EsdTargetDataLine.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/sampled/mixer/esd/EsdUtils.java0000644000175000017500000000421210374074736030054 0ustar twernertwerner/* * EsdUtils.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999, 2000 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.sampled.mixer.esd; import javax.sound.sampled.AudioFormat; import org.tritonus.lowlevel.esd.Esd; public class EsdUtils { public static int getEsdFormat(AudioFormat audioFormat) { int nChannels = audioFormat.getChannels(); AudioFormat.Encoding encoding = audioFormat.getEncoding(); int nSampleSize = audioFormat.getSampleSizeInBits(); int nFormat = 0; if (nSampleSize == 8) { if (! encoding.equals(AudioFormat.Encoding.PCM_UNSIGNED)) { throw new IllegalArgumentException("encoding must be PCM_UNSIGNED for 8 bit data"); } nFormat |= Esd.ESD_BITS8; } else if (nSampleSize == 16) { if (! encoding.equals(AudioFormat.Encoding.PCM_SIGNED)) { throw new IllegalArgumentException("encoding must be PCM_SIGNED for 16 bit data"); } nFormat |= Esd.ESD_BITS16; } else { throw new IllegalArgumentException("only 8 bit and 16 bit samples are supported"); } if (nChannels == 1) { nFormat |= Esd.ESD_MONO; } else if (nChannels == 2) { nFormat |= Esd.ESD_STEREO; } else { throw new IllegalArgumentException("only mono and stereo are supported"); } return nFormat; } } /*** EsdUtils.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/sampled/mixer/esd/package.html0000644000175000017500000000035510172461361027730 0ustar twernertwerner

A Mixer implementation based on Esound. The classes provided here .

@see org.tritonus.lowlevel.esd libtritonus-java-20070428/src/classes/org/tritonus/saol/0000755000175000017500000000000010621572506023061 5ustar twernertwernerlibtritonus-java-20070428/src/classes/org/tritonus/saol/compiler/0000755000175000017500000000000010621572505024672 5ustar twernertwernerlibtritonus-java-20070428/src/classes/org/tritonus/saol/compiler/Compiler.java0000644000175000017500000001315310150707542027310 0ustar twernertwerner/* * Compiler.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2002 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.saol.compiler; import java.io.File; import java.io.Reader; import java.io.FileReader; import java.io.BufferedReader; import java.io.PushbackReader; import java.io.IOException; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import org.tritonus.share.TDebug; import org.tritonus.saol.sablecc.parser.*; import org.tritonus.saol.sablecc.lexer.*; import org.tritonus.saol.sablecc.node.*; public class Compiler { private static final boolean DEBUG = false; private static final int ACTION_DUMP_TREE = 0; private static final int ACTION_COMPILE_INSTRUMENTS = 1; private static final int ACTION_GENERATE_MP4 = 2; private File m_saolFile; private int m_nAction; private Map m_instrumentMap; public Compiler(File saolFile) { this(saolFile, ACTION_COMPILE_INSTRUMENTS); } public Compiler(File saolFile, int nAction) { m_saolFile = saolFile; m_nAction = nAction; } public void compile() throws Exception { Reader reader = new FileReader(m_saolFile); reader = new BufferedReader(reader); PushbackReader pbReader = new PushbackReader(reader, 1024); Lexer lexer = new Lexer(pbReader); Parser parser = new Parser(lexer); Start tree = parser.parse(); switch (m_nAction) { case ACTION_DUMP_TREE: dumpTree(tree); break; case ACTION_COMPILE_INSTRUMENTS: TDebug.out("compiling instruments..."); m_instrumentMap = compileInstruments(tree); TDebug.out("IM: " + m_instrumentMap); break; } } /** Prints the tree of the given AST on standard output. */ private static void dumpTree(Start tree) { PrintWalker printWalker = new PrintWalker(); tree.apply(printWalker); } /** Returns a Map: instrument names (String) -> instrument classes (Class) */ private static Map compileInstruments(Start tree) { InstrumentTable instrumentTable = new InstrumentTable(); UserOpcodeTable opcodeTable = new UserOpcodeTable(); TemplateTable templateTable = new TemplateTable(); Map instrumentMap = new HashMap(); NodeSemanticsTable nodeSemanticsTable = new NodeSemanticsTable(); /* Divide the AST into sections. There is one section for global, and one for each instrument, opcode or template. */ TreeDivider treeDivider = new TreeDivider(instrumentTable, opcodeTable, templateTable); tree.apply(treeDivider); AGlobaldeclGlobaldecl globalNode = treeDivider.getGlobalNode(); /* Process the global section. */ SAOLGlobals saolGlobals = new SAOLGlobals(); if (globalNode != null) { GlobalsSearcher gsearcher = new GlobalsSearcher(saolGlobals); globalNode.apply(gsearcher); } if (DEBUG) { TDebug.out("a-rate: " + saolGlobals.getARate()); TDebug.out("k-rate: " + saolGlobals.getKRate()); TDebug.out("inchannels: " + saolGlobals.getInChannels()); TDebug.out("outchannels: " + saolGlobals.getOutChannels()); TDebug.out("interp: " + saolGlobals.getInterp()); } VariableTable globalVariableTable = new VariableTable(); /* Semantic check on instruments. */ Iterator instruments = instrumentTable.values().iterator(); while (instruments.hasNext()) { InstrumentEntry entry = (InstrumentEntry) instruments.next(); AInstrdeclInstrdecl startNode = entry.getStartNode(); VariableTable localVariableTable = entry.getLocalVariableTable(); InstrumentSemanticsCheck isc = new InstrumentSemanticsCheck(globalVariableTable, localVariableTable, nodeSemanticsTable); startNode.apply(isc); } // TODO: collection of variable tables, semantic checks /* Compiling the instruments. */ InstrumentCompilation ic = new InstrumentCompilation(saolGlobals, instrumentMap); instruments = instrumentTable.values().iterator(); while (instruments.hasNext()) { InstrumentEntry entry = (InstrumentEntry) instruments.next(); AInstrdeclInstrdecl node = entry.getStartNode(); node.apply(ic); } if (DEBUG) { Iterator it = instrumentMap.keySet().iterator(); while (it.hasNext()) { TDebug.out("" + it.next()); } } return instrumentMap; } public Map getInstrumentMap() { if (m_nAction != ACTION_COMPILE_INSTRUMENTS) { TDebug.out("I.M.: returning null"); return null; } TDebug.out("I.M.: " + m_instrumentMap); return m_instrumentMap; } public static void main(String[] arguments) { int nAction = ACTION_COMPILE_INSTRUMENTS; String strSaolFilename = arguments[0]; if (arguments[0].equals("-d")) { nAction = ACTION_DUMP_TREE; strSaolFilename = arguments[1]; } File saolFile = new File(strSaolFilename); Compiler compiler = new Compiler(saolFile, nAction); try { compiler.compile(); } catch(Exception e) { e.printStackTrace(); } } } /*** Compiler.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/saol/compiler/GlobalSemanticsCheck.java0000644000175000017500000000620510150707542031543 0ustar twernertwerner/* * GlobalSemanticsCheck.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2002 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.saol.compiler; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import org.tritonus.saol.sablecc.analysis.*; import org.tritonus.saol.sablecc.node.*; public class GlobalSemanticsCheck extends IOGTCommonSemanticsCheck { private static final boolean DEBUG = true; private static final int[] LEGAL_VARIABLE_TYPES = new int[] { WidthAndRate.RATE_I, WidthAndRate.RATE_K, WidthAndRate.RATE_A, WidthAndRate.RATE_OPARRAY, }; private VariableTable m_globalVariableTable; public GlobalSemanticsCheck(VariableTable globalVariableTable, NodeSemanticsTable nodeSemanticsTable) { super(nodeSemanticsTable); m_globalVariableTable = globalVariableTable; } //////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////// public void inAGlobaldeclGlobaldecl(AGlobaldeclGlobaldecl node) { } public void outAGlobaldeclGlobaldecl(AGlobaldeclGlobaldecl node) { } public void inARtparamGlobaldef(ARtparamGlobaldef node) { } public void outARtparamGlobaldef(ARtparamGlobaldef node) { } public void inARoutedefGlobaldef(ARoutedefGlobaldef node) { } public void outARoutedefGlobaldef(ARoutedefGlobaldef node) { } public void inASenddefGlobaldef(ASenddefGlobaldef node) { } public void outASenddefGlobaldef(ASenddefGlobaldef node) { } public void inASeqdefGlobaldef(ASeqdefGlobaldef node) { } public void outASeqdefGlobaldef(ASeqdefGlobaldef node) { } //////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////// protected VariableTable getOwnVariableTable() { return m_globalVariableTable; } protected VariableTable getGlobalVariableTable() { return null; } protected int[] getLegalVariableTypes() { return LEGAL_VARIABLE_TYPES; } } /*** GlobalSemanticsCheck.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/saol/compiler/GlobalsSearcher.java0000644000175000017500000000471510150707542030602 0ustar twernertwerner/* * GlobalsSearcher.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2002 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.saol.compiler; import org.tritonus.saol.sablecc.analysis.*; import org.tritonus.saol.sablecc.node.*; public class GlobalsSearcher extends DepthFirstAdapter { private SAOLGlobals m_saolGlobals; public GlobalsSearcher(SAOLGlobals saolGlobals) { m_saolGlobals = saolGlobals; } public SAOLGlobals getSAOLGlobals() { return m_saolGlobals; } public void outASrateRtparam(ASrateRtparam node) { TInteger integer = node.getInteger(); String strInt = integer.getText(); int nARate = Integer.parseInt(strInt); getSAOLGlobals().setARate(nARate); } // public void caseTNumber(TNumber node) // {// When we see a number, we print it. // System.out.print(node); // } // public void outAPlusExpr(APlusExpr node) // {// out of alternative {plus} in Expr, we print the plus. // System.out.print(node.getPlus()); // } // public void outAMinusExpr(AMinusExpr node) // {// out of alternative {minus} in Expr, we print the minus. // System.out.print(node.getMinus()); // } // public void outAMultFactor(AMultFactor node) // {// out of alternative {mult} in Factor, we print the mult. // System.out.print(node.getMult()); // } // public void outADivFactor(ADivFactor node) // {// out of alternative {div} in Factor, we print the div. // System.out.print(node.getDiv()); // } // public void outAModFactor(AModFactor node) // {// out of alternative {mod} in Factor, we print the mod. // System.out.print(node.getMod()); // } } /*** GlobalsSearcher.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/saol/compiler/IOGTCommonSemanticsCheck.java0000644000175000017500000003700510150707542032260 0ustar twernertwerner/* * IOGTCommonSemanticsCheck.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2002 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.saol.compiler; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import org.tritonus.saol.sablecc.analysis.*; import org.tritonus.saol.sablecc.node.*; public abstract class IOGTCommonSemanticsCheck extends DepthFirstAdapter { private static final boolean DEBUG = true; private NodeSemanticsTable m_nodeSemanticsTable; public IOGTCommonSemanticsCheck(NodeSemanticsTable nodeSemanticsTable) { m_nodeSemanticsTable = nodeSemanticsTable; } //////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////// public void inAIdentlistIdentlist(AIdentlistIdentlist node) { } public void outAIdentlistIdentlist(AIdentlistIdentlist node) { } public void inAIdentlistTailIdentlistTail(AIdentlistTailIdentlistTail node) { } public void outAIdentlistTailIdentlistTail(AIdentlistTailIdentlistTail node) { } public void inAParamlistParamlist(AParamlistParamlist node) { } public void outAParamlistParamlist(AParamlistParamlist node) { } public void inAParamlistTailParamlistTail(AParamlistTailParamlistTail node) { } public void outAParamlistTailParamlistTail(AParamlistTailParamlistTail node) { } public void inATablemapVardecl(ATablemapVardecl node) { } public void outATablemapVardecl(ATablemapVardecl node) { } public void outASigvarOpvardecl(ASigvarOpvardecl node) { boolean bImports = false; boolean bExports = false; if (node.getTaglist() != null) { NodeSemantics taglistSemantics = getNodeSemantics(node.getTaglist()); String strImEx = (String) taglistSemantics.getAux(); if (strImEx.indexOf('I') >= 0) { bImports = true; } if (strImEx.indexOf('E') >= 0) { bExports = true; } // TODO: check if matching global variable exists } int nRate = getNodeSemantics(node.getStype()).getRate(); if (! isLegalVariableType(nRate)) { throw new RuntimeException("illegal variable type used"); } List instruments = (List) getNodeSemantics(node.getNamelist()).getAux(); Iterator it = instruments.iterator(); while (it.hasNext()) { VariableEntry variable = (VariableEntry) it.next(); variable = new VariableEntry(variable.getVariableName(), variable.getWidth(), nRate, bImports, bExports); getOwnVariableTable().add(variable); } } public void outATablevarOpvardecl(ATablevarOpvardecl node) { boolean bImports = false; boolean bExports = false; // for tables, this is not optional NodeSemantics taglistSemantics = getNodeSemantics(node.getTaglist()); String strImEx = (String) taglistSemantics.getAux(); if (strImEx.indexOf('I') >= 0) { bImports = true; } if (strImEx.indexOf('E') >= 0) { bExports = true; } // TODO: check if matching global variable exists int nRate = WidthAndRate.RATE_TABLE; List instruments = (List) getNodeSemantics(node.getNamelist()).getAux(); Iterator it = instruments.iterator(); while (it.hasNext()) { VariableEntry variable = (VariableEntry) it.next(); variable = new VariableEntry(variable.getVariableName(), variable.getWidth(), nRate, bImports, bExports); getOwnVariableTable().add(variable); } } public void inATableOpvardecl(ATableOpvardecl node) { } public void outATableOpvardecl(ATableOpvardecl node) { } public void inAParamdeclParamdecl(AParamdeclParamdecl node) { } public void outAParamdeclParamdecl(AParamdeclParamdecl node) { } public void inANamelistNamelist(ANamelistNamelist node) { List list = new ArrayList(); NodeSemantics nodeSemantics = new NodeSemantics(list); setNodeSemantics(node, nodeSemantics); } public void outANamelistNamelist(ANamelistNamelist node) { VariableEntry variableEntry = (VariableEntry) getNodeSemantics(node.getName()).getAux(); NodeSemantics nodeSemantics = getNodeSemantics(node); List list = (List) nodeSemantics.getAux(); list.add(variableEntry); } public void outANamelistTailNamelistTail(ANamelistTailNamelistTail node) { VariableEntry variableEntry = (VariableEntry) getNodeSemantics(node.getName()).getAux(); NodeSemantics nodeSemantics = getNodeSemantics(node.parent()); List list = (List) nodeSemantics.getAux(); list.add(variableEntry); } public void outASimpleName(ASimpleName node) { String strVariableName = node.getIdentifier().getText(); handleName(node, strVariableName, 1); } public void outAIndexedName(AIndexedName node) { String strVariableName = node.getIdentifier().getText(); String strInteger = node.getInteger().getText(); int nInteger = Integer.parseInt(strInteger); handleName(node, strVariableName, nInteger); } public void outAInchannelsName(AInchannelsName node) { String strVariableName = node.getIdentifier().getText(); handleName(node, strVariableName, WidthAndRate.WIDTH_INCHANNELS); } public void outAOutchannelsName(AOutchannelsName node) { String strVariableName = node.getIdentifier().getText(); handleName(node, strVariableName, WidthAndRate.WIDTH_OUTCHANNELS); } // TODO: check if gathering of variable name can be generalized private void handleName(Node node, String strVariableName, int nWidth) { VariableEntry variableEntry = new VariableEntry(strVariableName, nWidth, WidthAndRate.RATE_UNKNOWN, false, false); NodeSemantics nodeSemantics = new NodeSemantics(variableEntry); setNodeSemantics(node, nodeSemantics); } public void outAIvarStype(AIvarStype node) { NodeSemantics nodeSemantics = new NodeSemantics(WidthAndRate.WIDTH_UNKNOWN, WidthAndRate.RATE_I); setNodeSemantics(node, nodeSemantics); } public void outAKsigStype(AKsigStype node) { NodeSemantics nodeSemantics = new NodeSemantics(WidthAndRate.WIDTH_UNKNOWN, WidthAndRate.RATE_K); setNodeSemantics(node, nodeSemantics); } public void outAAsigStype(AAsigStype node) { NodeSemantics nodeSemantics = new NodeSemantics(WidthAndRate.WIDTH_UNKNOWN, WidthAndRate.RATE_A); setNodeSemantics(node, nodeSemantics); } public void outATableStype(ATableStype node) { NodeSemantics nodeSemantics = new NodeSemantics(WidthAndRate.WIDTH_UNKNOWN, WidthAndRate.RATE_TABLE); setNodeSemantics(node, nodeSemantics); } public void outAOparrayStype(AOparrayStype node) { NodeSemantics nodeSemantics = new NodeSemantics(WidthAndRate.WIDTH_UNKNOWN, WidthAndRate.RATE_OPARRAY); setNodeSemantics(node, nodeSemantics); } public void outAXsigOtype(AXsigOtype node) { NodeSemantics nodeSemantics = new NodeSemantics(WidthAndRate.WIDTH_UNKNOWN, WidthAndRate.RATE_X); setNodeSemantics(node, nodeSemantics); } public void outAStypeOtype(AStypeOtype node) { NodeSemantics nodeSemantics = getNodeSemantics(node.getStype()); setNodeSemantics(node, nodeSemantics); } public void inATabledeclTabledecl(ATabledeclTabledecl node) { } public void outATabledeclTabledecl(ATabledeclTabledecl node) { } public void outAImportsTaglist(AImportsTaglist node) { NodeSemantics nodeSemantics = new NodeSemantics("I"); setNodeSemantics(node, nodeSemantics); } public void outAExportsTaglist(AExportsTaglist node) { NodeSemantics nodeSemantics = new NodeSemantics("E"); setNodeSemantics(node, nodeSemantics); } public void outAImportsexportsTaglist(AImportsexportsTaglist node) { NodeSemantics nodeSemantics = new NodeSemantics("IE"); setNodeSemantics(node, nodeSemantics); } public void outAExportsimportsTaglist(AExportsimportsTaglist node) { NodeSemantics nodeSemantics = new NodeSemantics("IE"); setNodeSemantics(node, nodeSemantics); } public void inAAopcodeOptype(AAopcodeOptype node) { } public void outAAopcodeOptype(AAopcodeOptype node) { } public void inAKopcodeOptype(AKopcodeOptype node) { } public void outAKopcodeOptype(AKopcodeOptype node) { } public void inAIopcodeOptype(AIopcodeOptype node) { } public void outAIopcodeOptype(AIopcodeOptype node) { } public void inAOpcodeOptype(AOpcodeOptype node) { } public void outAOpcodeOptype(AOpcodeOptype node) { } public void inAAltExpr(AAltExpr node) { // TODO: } public void outAAltExpr(AAltExpr node) { // TODO: } public void outAOrOrexpr(AOrOrexpr node) { // TODO: } public void outAAndAndexpr(AAndAndexpr node) { // TODO: } public void outANeqEqualityexpr(ANeqEqualityexpr node) { // BranchInstruction branch = new IFNE(null); // m_aMethods[METHOD_A].appendRelationalOperation(branch); } public void outAEqEqualityexpr(AEqEqualityexpr node) { // BranchInstruction branch = new IFEQ(null); // m_aMethods[METHOD_A].appendRelationalOperation(branch); } public void inAGtRelationalexpr(AGtRelationalexpr node) { } public void outAGtRelationalexpr(AGtRelationalexpr node) { // BranchInstruction branch = new IFGT(null); // m_aMethods[METHOD_A].appendRelationalOperation(branch); } public void outALtRelationalexpr(ALtRelationalexpr node) { // BranchInstruction branch = new IFLT(null); // m_aMethods[METHOD_A].appendRelationalOperation(branch); } public void outALteqRelationalexpr(ALteqRelationalexpr node) { // BranchInstruction branch = new IFLE(null); // m_aMethods[METHOD_A].appendRelationalOperation(branch); } public void outAGteqRelationalexpr(AGteqRelationalexpr node) { // BranchInstruction branch = new IFGE(null); // m_aMethods[METHOD_A].appendRelationalOperation(branch); } public void outAPlusAddexpr(APlusAddexpr node) { // m_aMethods[METHOD_A].appendInstruction(InstructionConstants.FADD); } public void outAMinusAddexpr(AMinusAddexpr node) { // m_aMethods[METHOD_A].appendInstruction(InstructionConstants.FSUB); } public void outAMultFactor(AMultFactor node) { // m_aMethods[METHOD_A].appendInstruction(InstructionConstants.FMUL); } public void outADivFactor(ADivFactor node) { // m_aMethods[METHOD_A].appendInstruction(InstructionConstants.FDIV); } public void outANotUnaryminusterm(ANotUnaryminusterm node) { // m_aMethods[METHOD_A].appendInstruction(InstructionConstants.FNEG); } public void outANotNotterm(ANotNotterm node) { // m_aMethods[METHOD_A].appendInstruction(InstructionConstants.FCONST_0); // m_aMethods[METHOD_A].appendInstruction(InstructionConstants.FCMPL); // BranchInstruction branch0 = new IFNE(null); // m_aMethods[METHOD_A].appendInstruction(branch0); // m_aMethods[METHOD_A].appendInstruction(InstructionConstants.FCONST_1); // BranchInstruction branch1 = new GOTO(null); // m_aMethods[METHOD_A].appendInstruction(branch1); // m_aMethods[METHOD_A].setPendingBranchInstruction(branch0); // m_aMethods[METHOD_A].appendInstruction(InstructionConstants.FCONST_0); // m_aMethods[METHOD_A].setPendingBranchInstruction(branch1); } public void outAIdentifierTerm(AIdentifierTerm node) { // String strVariableName = node.getIdentifier().getText(); // m_aMethods[METHOD_A].appendGetField(strVariableName); } public void outAConstantTerm(AConstantTerm node) { // Object constant = getNodeAttribute(node.getConst()); // if (constant instanceof Integer || // constant instanceof Float) // { // float fValue = ((Number) constant).floatValue(); // m_aMethods[METHOD_A].appendFloatConstant(fValue); // } // else // { // throw new RuntimeException("constant is neither int nor float"); // } } public void inAIndexedTerm(AIndexedTerm node) { // // push the array reference onto the stack // String strVariableName = node.getIdentifier().getText(); // m_aMethods[METHOD_A].appendGetField(strVariableName); } public void outAIndexedTerm(AIndexedTerm node) { // /* The array reference still is on the stack. Now, // also the array index (as a float) is on the stack. // It has to be transformed to integer. // */ // // TODO: correct rounding (1.5 -> 2.0) // m_aMethods[METHOD_A].appendInstruction(InstructionConstants.F2I); // // and now fetch the value from the array // setNodeAttribute(node, InstructionConstants.FALOAD); } public void inASasbfTerm(ASasbfTerm node) { } public void outASasbfTerm(ASasbfTerm node) { } public void inAFunctionTerm(AFunctionTerm node) { } public void outAFunctionTerm(AFunctionTerm node) { } public void inAIndexedfunctionTerm(AIndexedfunctionTerm node) { } public void outAIndexedfunctionTerm(AIndexedfunctionTerm node) { } public void inAExprlistExprlist(AExprlistExprlist node) { } public void outAExprlistExprlist(AExprlistExprlist node) { } public void inAExprlistTailExprlistTail(AExprlistTailExprlistTail node) { } public void outAExprlistTailExprlistTail(AExprlistTailExprlistTail node) { } public void inAExprstrlistExprstrlist(AExprstrlistExprstrlist node) { } public void outAExprstrlistExprstrlist(AExprstrlistExprstrlist node) { } public void inAExprstrlistTailExprstrlistTail(AExprstrlistTailExprstrlistTail node) { } public void outAExprstrlistTailExprstrlistTail(AExprstrlistTailExprstrlistTail node) { } public void inAExprExprOrString(AExprExprOrString node) { } public void outAExprExprOrString(AExprExprOrString node) { } public void inAStringExprOrString(AStringExprOrString node) { } public void outAStringExprOrString(AStringExprOrString node) { } public void inAIntegerConst(AIntegerConst node) { } public void outAIntegerConst(AIntegerConst node) { // String strInteger = node.getInteger().getText(); // Integer integer = new Integer(strInteger); // setNodeAttribute(node, integer); } // public void inANumberConst(ANumberConst node) // { // } public void outANumberConst(ANumberConst node) { // String strNumber = node.getNumber().getText(); // Float number = new Float(strNumber); // setNodeAttribute(node, number); } //////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////// protected abstract VariableTable getOwnVariableTable(); protected abstract VariableTable getGlobalVariableTable(); protected abstract int[] getLegalVariableTypes(); protected boolean isLegalVariableType(int nType) { int[] anLegalTypes = getLegalVariableTypes(); for (int i = 0; i < anLegalTypes.length; i++) { if (anLegalTypes[i] == nType) { return true; } } return false; } protected void setNodeSemantics(Node node, NodeSemantics nodeSemantics) { m_nodeSemanticsTable.setNodeSemantics(node, nodeSemantics); } protected NodeSemantics getNodeSemantics(Node node) { return m_nodeSemanticsTable.getNodeSemantics(node); } } /*** IOGTCommonSemanticsCheck.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/saol/compiler/IOTCommonSemanticsCheck.java0000644000175000017500000003545210150707542032155 0ustar twernertwerner/* * IOTCommonSemanticsCheck.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2002 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.saol.compiler; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import org.tritonus.saol.sablecc.analysis.*; import org.tritonus.saol.sablecc.node.*; public abstract class IOTCommonSemanticsCheck extends IOGTCommonSemanticsCheck { private static final boolean DEBUG = true; public IOTCommonSemanticsCheck(NodeSemanticsTable nodeSemanticsTable) { super(nodeSemanticsTable); } //////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////// public void inAIdentlistIdentlist(AIdentlistIdentlist node) { } public void outAIdentlistIdentlist(AIdentlistIdentlist node) { } public void inAIdentlistTailIdentlistTail(AIdentlistTailIdentlistTail node) { } public void outAIdentlistTailIdentlistTail(AIdentlistTailIdentlistTail node) { } public void inAParamlistParamlist(AParamlistParamlist node) { } public void outAParamlistParamlist(AParamlistParamlist node) { } public void inAParamlistTailParamlistTail(AParamlistTailParamlistTail node) { } public void outAParamlistTailParamlistTail(AParamlistTailParamlistTail node) { } public void inATablemapVardecl(ATablemapVardecl node) { } public void outATablemapVardecl(ATablemapVardecl node) { } public void outASigvarOpvardecl(ASigvarOpvardecl node) { boolean bImports = false; boolean bExports = false; if (node.getTaglist() != null) { NodeSemantics taglistSemantics = getNodeSemantics(node.getTaglist()); String strImEx = (String) taglistSemantics.getAux(); if (strImEx.indexOf('I') >= 0) { bImports = true; } if (strImEx.indexOf('E') >= 0) { bExports = true; } // TODO: check if matching global variable exists } int nRate = getNodeSemantics(node.getStype()).getRate(); if (! isLegalVariableType(nRate)) { throw new RuntimeException("illegal variable type used"); } List instruments = (List) getNodeSemantics(node.getNamelist()).getAux(); Iterator it = instruments.iterator(); while (it.hasNext()) { VariableEntry variable = (VariableEntry) it.next(); variable = new VariableEntry(variable.getVariableName(), variable.getWidth(), nRate, bImports, bExports); getOwnVariableTable().add(variable); } } public void outATablevarOpvardecl(ATablevarOpvardecl node) { boolean bImports = false; boolean bExports = false; // for tables, this is not optional NodeSemantics taglistSemantics = getNodeSemantics(node.getTaglist()); String strImEx = (String) taglistSemantics.getAux(); if (strImEx.indexOf('I') >= 0) { bImports = true; } if (strImEx.indexOf('E') >= 0) { bExports = true; } // TODO: check if matching global variable exists int nRate = WidthAndRate.RATE_TABLE; List instruments = (List) getNodeSemantics(node.getNamelist()).getAux(); Iterator it = instruments.iterator(); while (it.hasNext()) { VariableEntry variable = (VariableEntry) it.next(); variable = new VariableEntry(variable.getVariableName(), variable.getWidth(), nRate, bImports, bExports); getOwnVariableTable().add(variable); } } public void inATableOpvardecl(ATableOpvardecl node) { } public void outATableOpvardecl(ATableOpvardecl node) { } public void inAParamdeclParamdecl(AParamdeclParamdecl node) { } public void outAParamdeclParamdecl(AParamdeclParamdecl node) { } public void inANamelistNamelist(ANamelistNamelist node) { List list = new ArrayList(); NodeSemantics nodeSemantics = new NodeSemantics(list); setNodeSemantics(node, nodeSemantics); } public void outANamelistNamelist(ANamelistNamelist node) { VariableEntry variableEntry = (VariableEntry) getNodeSemantics(node.getName()).getAux(); NodeSemantics nodeSemantics = getNodeSemantics(node); List list = (List) nodeSemantics.getAux(); list.add(variableEntry); } public void outANamelistTailNamelistTail(ANamelistTailNamelistTail node) { VariableEntry variableEntry = (VariableEntry) getNodeSemantics(node.getName()).getAux(); NodeSemantics nodeSemantics = getNodeSemantics(node.parent()); List list = (List) nodeSemantics.getAux(); list.add(variableEntry); } public void outASimpleName(ASimpleName node) { String strVariableName = node.getIdentifier().getText(); handleName(node, strVariableName, 1); } public void outAIndexedName(AIndexedName node) { String strVariableName = node.getIdentifier().getText(); String strInteger = node.getInteger().getText(); int nInteger = Integer.parseInt(strInteger); handleName(node, strVariableName, nInteger); } public void outAInchannelsName(AInchannelsName node) { String strVariableName = node.getIdentifier().getText(); handleName(node, strVariableName, WidthAndRate.WIDTH_INCHANNELS); } public void outAOutchannelsName(AOutchannelsName node) { String strVariableName = node.getIdentifier().getText(); handleName(node, strVariableName, WidthAndRate.WIDTH_OUTCHANNELS); } // TODO: check if gathering of variable name can be generalized private void handleName(Node node, String strVariableName, int nWidth) { VariableEntry variableEntry = new VariableEntry(strVariableName, nWidth, WidthAndRate.RATE_UNKNOWN, false, false); NodeSemantics nodeSemantics = new NodeSemantics(variableEntry); setNodeSemantics(node, nodeSemantics); } public void outAIvarStype(AIvarStype node) { NodeSemantics nodeSemantics = new NodeSemantics(WidthAndRate.WIDTH_UNKNOWN, WidthAndRate.RATE_I); setNodeSemantics(node, nodeSemantics); } public void outAKsigStype(AKsigStype node) { NodeSemantics nodeSemantics = new NodeSemantics(WidthAndRate.WIDTH_UNKNOWN, WidthAndRate.RATE_K); setNodeSemantics(node, nodeSemantics); } public void outAAsigStype(AAsigStype node) { NodeSemantics nodeSemantics = new NodeSemantics(WidthAndRate.WIDTH_UNKNOWN, WidthAndRate.RATE_A); setNodeSemantics(node, nodeSemantics); } public void outATableStype(ATableStype node) { NodeSemantics nodeSemantics = new NodeSemantics(WidthAndRate.WIDTH_UNKNOWN, WidthAndRate.RATE_TABLE); setNodeSemantics(node, nodeSemantics); } public void outAOparrayStype(AOparrayStype node) { NodeSemantics nodeSemantics = new NodeSemantics(WidthAndRate.WIDTH_UNKNOWN, WidthAndRate.RATE_OPARRAY); setNodeSemantics(node, nodeSemantics); } public void outAXsigOtype(AXsigOtype node) { NodeSemantics nodeSemantics = new NodeSemantics(WidthAndRate.WIDTH_UNKNOWN, WidthAndRate.RATE_X); setNodeSemantics(node, nodeSemantics); } public void outAStypeOtype(AStypeOtype node) { NodeSemantics nodeSemantics = getNodeSemantics(node.getStype()); setNodeSemantics(node, nodeSemantics); } public void inATabledeclTabledecl(ATabledeclTabledecl node) { } public void outATabledeclTabledecl(ATabledeclTabledecl node) { } public void outAImportsTaglist(AImportsTaglist node) { NodeSemantics nodeSemantics = new NodeSemantics("I"); setNodeSemantics(node, nodeSemantics); } public void outAExportsTaglist(AExportsTaglist node) { NodeSemantics nodeSemantics = new NodeSemantics("E"); setNodeSemantics(node, nodeSemantics); } public void outAImportsexportsTaglist(AImportsexportsTaglist node) { NodeSemantics nodeSemantics = new NodeSemantics("IE"); setNodeSemantics(node, nodeSemantics); } public void outAExportsimportsTaglist(AExportsimportsTaglist node) { NodeSemantics nodeSemantics = new NodeSemantics("IE"); setNodeSemantics(node, nodeSemantics); } public void inAAopcodeOptype(AAopcodeOptype node) { } public void outAAopcodeOptype(AAopcodeOptype node) { } public void inAKopcodeOptype(AKopcodeOptype node) { } public void outAKopcodeOptype(AKopcodeOptype node) { } public void inAIopcodeOptype(AIopcodeOptype node) { } public void outAIopcodeOptype(AIopcodeOptype node) { } public void inAOpcodeOptype(AOpcodeOptype node) { } public void outAOpcodeOptype(AOpcodeOptype node) { } public void inAAltExpr(AAltExpr node) { // TODO: } public void outAAltExpr(AAltExpr node) { // TODO: } public void outAOrOrexpr(AOrOrexpr node) { // TODO: } public void outAAndAndexpr(AAndAndexpr node) { // TODO: } public void outANeqEqualityexpr(ANeqEqualityexpr node) { // BranchInstruction branch = new IFNE(null); // m_aMethods[METHOD_A].appendRelationalOperation(branch); } public void outAEqEqualityexpr(AEqEqualityexpr node) { // BranchInstruction branch = new IFEQ(null); // m_aMethods[METHOD_A].appendRelationalOperation(branch); } public void inAGtRelationalexpr(AGtRelationalexpr node) { } public void outAGtRelationalexpr(AGtRelationalexpr node) { // BranchInstruction branch = new IFGT(null); // m_aMethods[METHOD_A].appendRelationalOperation(branch); } public void outALtRelationalexpr(ALtRelationalexpr node) { // BranchInstruction branch = new IFLT(null); // m_aMethods[METHOD_A].appendRelationalOperation(branch); } public void outALteqRelationalexpr(ALteqRelationalexpr node) { // BranchInstruction branch = new IFLE(null); // m_aMethods[METHOD_A].appendRelationalOperation(branch); } public void outAGteqRelationalexpr(AGteqRelationalexpr node) { // BranchInstruction branch = new IFGE(null); // m_aMethods[METHOD_A].appendRelationalOperation(branch); } public void outAPlusAddexpr(APlusAddexpr node) { // m_aMethods[METHOD_A].appendInstruction(InstructionConstants.FADD); } public void outAMinusAddexpr(AMinusAddexpr node) { // m_aMethods[METHOD_A].appendInstruction(InstructionConstants.FSUB); } public void outAMultFactor(AMultFactor node) { // m_aMethods[METHOD_A].appendInstruction(InstructionConstants.FMUL); } public void outADivFactor(ADivFactor node) { // m_aMethods[METHOD_A].appendInstruction(InstructionConstants.FDIV); } public void outANotUnaryminusterm(ANotUnaryminusterm node) { // m_aMethods[METHOD_A].appendInstruction(InstructionConstants.FNEG); } public void outANotNotterm(ANotNotterm node) { // m_aMethods[METHOD_A].appendInstruction(InstructionConstants.FCONST_0); // m_aMethods[METHOD_A].appendInstruction(InstructionConstants.FCMPL); // BranchInstruction branch0 = new IFNE(null); // m_aMethods[METHOD_A].appendInstruction(branch0); // m_aMethods[METHOD_A].appendInstruction(InstructionConstants.FCONST_1); // BranchInstruction branch1 = new GOTO(null); // m_aMethods[METHOD_A].appendInstruction(branch1); // m_aMethods[METHOD_A].setPendingBranchInstruction(branch0); // m_aMethods[METHOD_A].appendInstruction(InstructionConstants.FCONST_0); // m_aMethods[METHOD_A].setPendingBranchInstruction(branch1); } public void outAIdentifierTerm(AIdentifierTerm node) { // String strVariableName = node.getIdentifier().getText(); // m_aMethods[METHOD_A].appendGetField(strVariableName); } public void outAConstantTerm(AConstantTerm node) { // Object constant = getNodeAttribute(node.getConst()); // if (constant instanceof Integer || // constant instanceof Float) // { // float fValue = ((Number) constant).floatValue(); // m_aMethods[METHOD_A].appendFloatConstant(fValue); // } // else // { // throw new RuntimeException("constant is neither int nor float"); // } } public void inAIndexedTerm(AIndexedTerm node) { // // push the array reference onto the stack // String strVariableName = node.getIdentifier().getText(); // m_aMethods[METHOD_A].appendGetField(strVariableName); } public void outAIndexedTerm(AIndexedTerm node) { // /* The array reference still is on the stack. Now, // also the array index (as a float) is on the stack. // It has to be transformed to integer. // */ // // TODO: correct rounding (1.5 -> 2.0) // m_aMethods[METHOD_A].appendInstruction(InstructionConstants.F2I); // // and now fetch the value from the array // setNodeAttribute(node, InstructionConstants.FALOAD); } public void inASasbfTerm(ASasbfTerm node) { } public void outASasbfTerm(ASasbfTerm node) { } public void inAFunctionTerm(AFunctionTerm node) { } public void outAFunctionTerm(AFunctionTerm node) { } public void inAIndexedfunctionTerm(AIndexedfunctionTerm node) { } public void outAIndexedfunctionTerm(AIndexedfunctionTerm node) { } public void inAExprlistExprlist(AExprlistExprlist node) { } public void outAExprlistExprlist(AExprlistExprlist node) { } public void inAExprlistTailExprlistTail(AExprlistTailExprlistTail node) { } public void outAExprlistTailExprlistTail(AExprlistTailExprlistTail node) { } public void inAExprstrlistExprstrlist(AExprstrlistExprstrlist node) { } public void outAExprstrlistExprstrlist(AExprstrlistExprstrlist node) { } public void inAExprstrlistTailExprstrlistTail(AExprstrlistTailExprstrlistTail node) { } public void outAExprstrlistTailExprstrlistTail(AExprstrlistTailExprstrlistTail node) { } public void inAExprExprOrString(AExprExprOrString node) { } public void outAExprExprOrString(AExprExprOrString node) { } public void inAStringExprOrString(AStringExprOrString node) { } public void outAStringExprOrString(AStringExprOrString node) { } public void inAIntegerConst(AIntegerConst node) { } public void outAIntegerConst(AIntegerConst node) { // String strInteger = node.getInteger().getText(); // Integer integer = new Integer(strInteger); // setNodeAttribute(node, integer); } // public void inANumberConst(ANumberConst node) // { // } public void outANumberConst(ANumberConst node) { // String strNumber = node.getNumber().getText(); // Float number = new Float(strNumber); // setNodeAttribute(node, number); } //////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////// } /*** IOTCommonSemanticsCheck.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/saol/compiler/InstrumentCompilation.java0000644000175000017500000014052610150707542032112 0ustar twernertwerner/* * InstrumentCompilation.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2002 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.saol.compiler; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.HashMap; import java.util.Map; import org.apache.bcel.Constants; import org.apache.bcel.classfile.Field; import org.apache.bcel.classfile.JavaClass; import org.apache.bcel.generic.*; import org.tritonus.saol.sablecc.analysis.*; import org.tritonus.saol.sablecc.node.*; public class InstrumentCompilation extends DepthFirstAdapter { private static final boolean DEBUG = true; // may become "org.tritonus.saol.generated." private static final String PACKAGE_PREFIX = ""; private static final String CLASSFILENAME_PREFIX = "src/"; private static final String CLASSFILENAME_SUFFIX = ".class"; private static final String SUPERCLASS_NAME = "org.tritonus.saol.engine.AbstractInstrument"; private static final String SUPERCLASS_CONSTRUCTOR_NAME = "AbstractInstrument"; private static final int METHOD_CONSTR = WidthAndRate.RATE_UNKNOWN; private static final int METHOD_I = WidthAndRate.RATE_I; private static final int METHOD_K = WidthAndRate.RATE_K; private static final int METHOD_A = WidthAndRate.RATE_A; private static final Type FLOAT_ARRAY = new ArrayType(Type.FLOAT, 1); private SAOLGlobals m_saolGlobals; // maps instrument names (String) to classes (Class) private Map m_instrumentMap; private Map m_nodeAttributes; private String m_strClassName; private ClassGen m_classGen; private ConstantPoolGen m_constantPoolGen; // private MethodGen m_methodGen; // private InstructionList m_instructionList; private InstructionFactory m_instructionFactory; // private BranchInstruction m_pendingBranchInstruction; // TODO: should be made obsolete by using node attributes private boolean m_bOpvardecls; private MemoryClassLoader m_classLoader = new MemoryClassLoader(); // 0: constructor // 1: doIPass() // 2: doKPass() // 3: doAPass() private InstrumentMethod[] m_aMethods; public InstrumentCompilation(SAOLGlobals saolGlobals, Map instrumentMap) { m_saolGlobals = saolGlobals; m_instrumentMap = instrumentMap; m_nodeAttributes = new HashMap(); m_aMethods = new InstrumentMethod[4]; } public void inAInstrdeclInstrdecl(AInstrdeclInstrdecl node) { String strInstrumentName = node.getIdentifier().getText(); m_strClassName = PACKAGE_PREFIX + strInstrumentName; m_classGen = new ClassGen(m_strClassName, SUPERCLASS_NAME, "", Constants.ACC_PUBLIC | Constants.ACC_SUPER, null); m_constantPoolGen = m_classGen.getConstantPool(); m_instructionFactory = new InstructionFactory(m_constantPoolGen); m_aMethods[METHOD_CONSTR] = new InstrumentMethod(m_classGen, ""); m_aMethods[METHOD_I] = new InstrumentMethod(m_classGen, "doIPass"); m_aMethods[METHOD_K] = new InstrumentMethod(m_classGen, "doKPass"); m_aMethods[METHOD_A] = new InstrumentMethod(m_classGen, "doAPass"); m_aMethods[METHOD_CONSTR].appendInstruction(InstructionConstants.ALOAD_0); Instruction invokeSuperInstruction = m_instructionFactory.createInvoke(SUPERCLASS_NAME, "", Type.VOID, Type.NO_ARGS, Constants.INVOKESPECIAL); // Instruction invokeSuperInstruction = m_instructionFactory.createInvoke(SUPERCLASS_NAME, SUPERCLASS_CONSTRUCTOR_NAME, Type.VOID, Type.NO_ARGS, Constants.INVOKESPECIAL); m_aMethods[METHOD_CONSTR].appendInstruction(invokeSuperInstruction); } public void outAInstrdeclInstrdecl(AInstrdeclInstrdecl node) { for (int i = 0; i < m_aMethods.length; i++) { m_aMethods[i].finish(); } JavaClass javaClass = m_classGen.getJavaClass(); try { ByteArrayOutputStream baos = new ByteArrayOutputStream(); javaClass.dump(baos); byte[] abData = baos.toByteArray(); Class instrumentClass = m_classLoader.findClass(m_strClassName, abData); m_instrumentMap.put(m_strClassName, instrumentClass); if (DEBUG) { javaClass.dump(m_strClassName + CLASSFILENAME_SUFFIX); } } catch (IOException e) { e.printStackTrace(); } } // public void caseAInstrdeclInstrdecl(AInstrdeclInstrdecl node) // { // inAInstrdeclInstrdecl(node); // if(node.getInstr() != null) // { // node.getInstr().apply(this); // } // if(node.getIdentifier() != null) // { // node.getIdentifier().apply(this); // } // if(node.getLPar() != null) // { // node.getLPar().apply(this); // } // if(node.getIdentlist() != null) // { // node.getIdentlist().apply(this); // } // if(node.getRPar() != null) // { // node.getRPar().apply(this); // } // if(node.getLBrace() != null) // { // node.getLBrace().apply(this); // } // { // Object temp[] = node.getOpvardecl().toArray(); // for(int i = 0; i < temp.length; i++) // { // ((POpvardecl) temp[i]).apply(this); // } // } // if(node.getBlock() != null) // { // node.getBlock().apply(this); // } // if(node.getRBrace() != null) // { // node.getRBrace().apply(this); // } // outAInstrdeclInstrdecl(node); // } public void inABlockBlock(ABlockBlock node) { } public void outABlockBlock(ABlockBlock node) { } // public void caseABlockBlock(ABlockBlock node) // { // inABlockBlock(node); // { // Object temp[] = node.getStatement().toArray(); // for(int i = 0; i < temp.length; i++) // { // ((PStatement) temp[i]).apply(this); // } // } // outABlockBlock(node); // } // public void inAAssignmentStatement(AAssignmentStatement node) // { // } public void outAAssignmentStatement(AAssignmentStatement node) { Instruction instruction = (Instruction) getNodeAttribute(node.getLvalue()); m_aMethods[METHOD_A].appendInstruction(instruction); } public void inAExpressionStatement(AExpressionStatement node) { } public void outAExpressionStatement(AExpressionStatement node) { } // public void caseAExpressionStatement(AExpressionStatement node) // { // inAExpressionStatement(node); // if(node.getExpr() != null) // { // node.getExpr().apply(this); // } // if(node.getSemicolon() != null) // { // node.getSemicolon().apply(this); // } // outAExpressionStatement(node); // } public void inAIfStatement(AIfStatement node) { } public void outAIfStatement(AIfStatement node) { } public void caseAIfStatement(AIfStatement node) { inAIfStatement(node); if(node.getIf() != null) { node.getIf().apply(this); } if(node.getLPar() != null) { node.getLPar().apply(this); } if(node.getExpr() != null) { node.getExpr().apply(this); } if(node.getRPar() != null) { node.getRPar().apply(this); } m_aMethods[METHOD_A].appendInstruction(InstructionConstants.FCONST_0); m_aMethods[METHOD_A].appendInstruction(InstructionConstants.FCMPL); BranchInstruction ifeq = new IFEQ(null); m_aMethods[METHOD_A].appendInstruction(ifeq); if(node.getLBrace() != null) { node.getLBrace().apply(this); } if(node.getBlock() != null) { node.getBlock().apply(this); } if(node.getRBrace() != null) { node.getRBrace().apply(this); } m_aMethods[METHOD_A].setPendingBranchInstruction(ifeq); outAIfStatement(node); } public void inAIfElseStatement(AIfElseStatement node) { } public void outAIfElseStatement(AIfElseStatement node) { } // public void caseAIfElseStatement(AIfElseStatement node) // { // inAIfElseStatement(node); // if(node.getIf() != null) // { // node.getIf().apply(this); // } // if(node.getLPar() != null) // { // node.getLPar().apply(this); // } // if(node.getExpr() != null) // { // node.getExpr().apply(this); // } // if(node.getRPar() != null) // { // node.getRPar().apply(this); // } // if(node.getLBrace1() != null) // { // node.getLBrace1().apply(this); // } // if(node.getBlock1() != null) // { // node.getBlock1().apply(this); // } // if(node.getRBrace1() != null) // { // node.getRBrace1().apply(this); // } // if(node.getElse() != null) // { // node.getElse().apply(this); // } // if(node.getLBrace2() != null) // { // node.getLBrace2().apply(this); // } // if(node.getBlock2() != null) // { // node.getBlock2().apply(this); // } // if(node.getRBrace2() != null) // { // node.getRBrace2().apply(this); // } // outAIfElseStatement(node); // } public void inAWhileStatement(AWhileStatement node) { } public void outAWhileStatement(AWhileStatement node) { } // public void caseAWhileStatement(AWhileStatement node) // { // inAWhileStatement(node); // if(node.getWhile() != null) // { // node.getWhile().apply(this); // } // if(node.getLPar() != null) // { // node.getLPar().apply(this); // } // if(node.getExpr() != null) // { // node.getExpr().apply(this); // } // if(node.getRPar() != null) // { // node.getRPar().apply(this); // } // if(node.getLBrace() != null) // { // node.getLBrace().apply(this); // } // if(node.getBlock() != null) // { // node.getBlock().apply(this); // } // if(node.getRBrace() != null) // { // node.getRBrace().apply(this); // } // outAWhileStatement(node); // } public void inAInstrumentStatement(AInstrumentStatement node) { } public void outAInstrumentStatement(AInstrumentStatement node) { } // public void caseAInstrumentStatement(AInstrumentStatement node) // { // inAInstrumentStatement(node); // if(node.getInstr() != null) // { // node.getInstr().apply(this); // } // if(node.getIdentifier() != null) // { // node.getIdentifier().apply(this); // } // if(node.getLPar() != null) // { // node.getLPar().apply(this); // } // if(node.getExprlist() != null) // { // node.getExprlist().apply(this); // } // if(node.getRPar() != null) // { // node.getRPar().apply(this); // } // if(node.getSemicolon() != null) // { // node.getSemicolon().apply(this); // } // outAInstrumentStatement(node); // } public void inAOutputStatement(AOutputStatement node) { } public void outAOutputStatement(AOutputStatement node) { } // public void caseAOutputStatement(AOutputStatement node) // { // inAOutputStatement(node); // if(node.getOutput() != null) // { // node.getOutput().apply(this); // } // if(node.getLPar() != null) // { // node.getLPar().apply(this); // } // if(node.getExprlist() != null) // { // node.getExprlist().apply(this); // } // if(node.getRPar() != null) // { // node.getRPar().apply(this); // } // if(node.getSemicolon() != null) // { // node.getSemicolon().apply(this); // } // outAOutputStatement(node); // } public void inASpatializeStatement(ASpatializeStatement node) { } public void outASpatializeStatement(ASpatializeStatement node) { } // public void caseASpatializeStatement(ASpatializeStatement node) // { // inASpatializeStatement(node); // if(node.getSpatialize() != null) // { // node.getSpatialize().apply(this); // } // if(node.getLPar() != null) // { // node.getLPar().apply(this); // } // if(node.getExprlist() != null) // { // node.getExprlist().apply(this); // } // if(node.getRPar() != null) // { // node.getRPar().apply(this); // } // if(node.getSemicolon() != null) // { // node.getSemicolon().apply(this); // } // outASpatializeStatement(node); // } public void inAOutbusStatement(AOutbusStatement node) { } public void outAOutbusStatement(AOutbusStatement node) { } // public void caseAOutbusStatement(AOutbusStatement node) // { // inAOutbusStatement(node); // if(node.getOutbus() != null) // { // node.getOutbus().apply(this); // } // if(node.getLPar() != null) // { // node.getLPar().apply(this); // } // if(node.getIdentifier() != null) // { // node.getIdentifier().apply(this); // } // if(node.getComma() != null) // { // node.getComma().apply(this); // } // if(node.getExprlist() != null) // { // node.getExprlist().apply(this); // } // if(node.getRPar() != null) // { // node.getRPar().apply(this); // } // if(node.getSemicolon() != null) // { // node.getSemicolon().apply(this); // } // outAOutbusStatement(node); // } public void inAExtendStatement(AExtendStatement node) { } public void outAExtendStatement(AExtendStatement node) { } // public void caseAExtendStatement(AExtendStatement node) // { // inAExtendStatement(node); // if(node.getExtend() != null) // { // node.getExtend().apply(this); // } // if(node.getLPar() != null) // { // node.getLPar().apply(this); // } // if(node.getExpr() != null) // { // node.getExpr().apply(this); // } // if(node.getRPar() != null) // { // node.getRPar().apply(this); // } // if(node.getSemicolon() != null) // { // node.getSemicolon().apply(this); // } // outAExtendStatement(node); // } public void inATurnoffStatement(ATurnoffStatement node) { } public void outATurnoffStatement(ATurnoffStatement node) { } // public void caseATurnoffStatement(ATurnoffStatement node) // { // inATurnoffStatement(node); // if(node.getTurnoff() != null) // { // node.getTurnoff().apply(this); // } // if(node.getSemicolon() != null) // { // node.getSemicolon().apply(this); // } // outATurnoffStatement(node); // } public void inAReturnStatement(AReturnStatement node) { } public void outAReturnStatement(AReturnStatement node) { } // public void caseAReturnStatement(AReturnStatement node) // { // inAReturnStatement(node); // if(node.getReturn() != null) // { // node.getReturn().apply(this); // } // if(node.getLPar() != null) // { // node.getLPar().apply(this); // } // if(node.getExpr() != null) // { // node.getExpr().apply(this); // } // if(node.getRPar() != null) // { // node.getRPar().apply(this); // } // if(node.getSemicolon() != null) // { // node.getSemicolon().apply(this); // } // outAReturnStatement(node); // } // public void inASimpleLvalue(ASimpleLvalue node) // { // } public void outASimpleLvalue(ASimpleLvalue node) { /* This is needed at the very end, when the putfield instruction is executed. */ m_aMethods[METHOD_A].appendInstruction(InstructionConstants.ALOAD_0); String strVariableName = node.getIdentifier().getText(); // TODO: use getClassName() // set the instruction to be executed after the rvalue is calculated Instruction instruction = getInstructionFactory().createPutField(m_strClassName, strVariableName, Type.FLOAT); setNodeAttribute(node, instruction); } public void inAIndexedLvalue(AIndexedLvalue node) { // push the array reference onto the stack String strVariableName = node.getIdentifier().getText(); m_aMethods[METHOD_A].appendGetField(strVariableName); } public void outAIndexedLvalue(AIndexedLvalue node) { /* The array reference still is on the stack. Now, also the array index (as a float) is on the stack. It has to be transformed to integer. */ // TODO: correct rounding (1.5 -> 2.0) m_aMethods[METHOD_A].appendInstruction(InstructionConstants.F2I); // set the instruction to be executed after the rvalue is calculated setNodeAttribute(node, InstructionConstants.FASTORE); } // public void caseAIndexedLvalue(AIndexedLvalue node) // { // inAIndexedLvalue(node); // if(node.getIdentifier() != null) // { // node.getIdentifier().apply(this); // } // if(node.getLBracket() != null) // { // node.getLBracket().apply(this); // } // if(node.getExpr() != null) // { // node.getExpr().apply(this); // } // if(node.getRBracket() != null) // { // node.getRBracket().apply(this); // } // outAIndexedLvalue(node); // } public void inAIdentlistIdentlist(AIdentlistIdentlist node) { } public void outAIdentlistIdentlist(AIdentlistIdentlist node) { } // public void caseAIdentlistIdentlist(AIdentlistIdentlist node) // { // inAIdentlistIdentlist(node); // if(node.getIdentifier() != null) // { // node.getIdentifier().apply(this); // } // { // Object temp[] = node.getIdentlistTail().toArray(); // for(int i = 0; i < temp.length; i++) // { // ((PIdentlistTail) temp[i]).apply(this); // } // } // outAIdentlistIdentlist(node); // } public void inAIdentlistTailIdentlistTail(AIdentlistTailIdentlistTail node) { } public void outAIdentlistTailIdentlistTail(AIdentlistTailIdentlistTail node) { } // public void caseAIdentlistTailIdentlistTail(AIdentlistTailIdentlistTail node) // { // inAIdentlistTailIdentlistTail(node); // if(node.getComma() != null) // { // node.getComma().apply(this); // } // if(node.getIdentifier() != null) // { // node.getIdentifier().apply(this); // } // outAIdentlistTailIdentlistTail(node); // } public void inAParamlistParamlist(AParamlistParamlist node) { } public void outAParamlistParamlist(AParamlistParamlist node) { } // public void caseAParamlistParamlist(AParamlistParamlist node) // { // inAParamlistParamlist(node); // if(node.getParamdecl() != null) // { // node.getParamdecl().apply(this); // } // { // Object temp[] = node.getParamlistTail().toArray(); // for(int i = 0; i < temp.length; i++) // { // ((PParamlistTail) temp[i]).apply(this); // } // } // outAParamlistParamlist(node); // } public void inAParamlistTailParamlistTail(AParamlistTailParamlistTail node) { } public void outAParamlistTailParamlistTail(AParamlistTailParamlistTail node) { } // public void caseAParamlistTailParamlistTail(AParamlistTailParamlistTail node) // { // inAParamlistTailParamlistTail(node); // if(node.getComma() != null) // { // node.getComma().apply(this); // } // if(node.getParamdecl() != null) // { // node.getParamdecl().apply(this); // } // outAParamlistTailParamlistTail(node); // } public void inASigvarVardecl(ASigvarVardecl node) { } public void outASigvarVardecl(ASigvarVardecl node) { } // public void caseASigvarVardecl(ASigvarVardecl node) // { // inASigvarVardecl(node); // if(node.getTaglist() != null) // { // node.getTaglist().apply(this); // } // if(node.getStype() != null) // { // node.getStype().apply(this); // } // if(node.getNamelist() != null) // { // node.getNamelist().apply(this); // } // if(node.getSemicolon() != null) // { // node.getSemicolon().apply(this); // } // outASigvarVardecl(node); // } public void inATablemapVardecl(ATablemapVardecl node) { } public void outATablemapVardecl(ATablemapVardecl node) { } // public void caseATablemapVardecl(ATablemapVardecl node) // { // inATablemapVardecl(node); // if(node.getTablemap() != null) // { // node.getTablemap().apply(this); // } // if(node.getIdentifier() != null) // { // node.getIdentifier().apply(this); // } // if(node.getLPar() != null) // { // node.getLPar().apply(this); // } // if(node.getIdentlist() != null) // { // node.getIdentlist().apply(this); // } // if(node.getRPar() != null) // { // node.getRPar().apply(this); // } // if(node.getSemicolon() != null) // { // node.getSemicolon().apply(this); // } // outATablemapVardecl(node); // } public void inASigvarOpvardecl(ASigvarOpvardecl node) { m_bOpvardecls = true; } public void outASigvarOpvardecl(ASigvarOpvardecl node) { m_bOpvardecls = false; } // public void caseASigvarOpvardecl(ASigvarOpvardecl node) // { // inASigvarOpvardecl(node); // if(node.getTaglist() != null) // { // node.getTaglist().apply(this); // } // if(node.getOtype() != null) // { // node.getOtype().apply(this); // } // if(node.getNamelist() != null) // { // node.getNamelist().apply(this); // } // if(node.getSemicolon() != null) // { // node.getSemicolon().apply(this); // } // outASigvarOpvardecl(node); // } public void inAParamdeclParamdecl(AParamdeclParamdecl node) { } public void outAParamdeclParamdecl(AParamdeclParamdecl node) { } // public void caseAParamdeclParamdecl(AParamdeclParamdecl node) // { // inAParamdeclParamdecl(node); // if(node.getOtype() != null) // { // node.getOtype().apply(this); // } // if(node.getName() != null) // { // node.getName().apply(this); // } // outAParamdeclParamdecl(node); // } public void inANamelistNamelist(ANamelistNamelist node) { } public void outANamelistNamelist(ANamelistNamelist node) { } // public void caseANamelistNamelist(ANamelistNamelist node) // { // inANamelistNamelist(node); // if(node.getName() != null) // { // node.getName().apply(this); // } // { // Object temp[] = node.getNamelistTail().toArray(); // for(int i = 0; i < temp.length; i++) // { // ((PNamelistTail) temp[i]).apply(this); // } // } // outANamelistNamelist(node); // } public void inANamelistTailNamelistTail(ANamelistTailNamelistTail node) { } public void outANamelistTailNamelistTail(ANamelistTailNamelistTail node) { } // public void caseANamelistTailNamelistTail(ANamelistTailNamelistTail node) // { // inANamelistTailNamelistTail(node); // if(node.getComma() != null) // { // node.getComma().apply(this); // } // if(node.getName() != null) // { // node.getName().apply(this); // } // outANamelistTailNamelistTail(node); // } public void outASimpleName(ASimpleName node) { if (m_bOpvardecls) { String strVariableName = node.getIdentifier().getText(); addLocalVariable(strVariableName); } } public void outAIndexedName(AIndexedName node) { if (m_bOpvardecls) { String strVariableName = node.getIdentifier().getText(); String strInteger = node.getInteger().getText(); int nInteger = Integer.parseInt(strInteger); addLocalArray(strVariableName); // code to allocate array in constructor m_aMethods[METHOD_CONSTR].appendInstruction(InstructionConstants.ALOAD_0); Instruction instruction = (Instruction) getInstructionFactory().createNewArray(Type.FLOAT, (short) nInteger); m_aMethods[METHOD_CONSTR].appendInstruction(instruction); m_aMethods[METHOD_CONSTR].appendPutField(strVariableName); } } public void outAInchannelsName(AInchannelsName node) { // TODO: } public void outAOutchannelsName(AOutchannelsName node) { // TODO: } public void outAIvarStype(AIvarStype node) { setNodeAttribute(node, new WidthAndRate(WidthAndRate.WIDTH_UNKNOWN, WidthAndRate.RATE_I)); } public void outAKsigStype(AKsigStype node) { setNodeAttribute(node, new WidthAndRate(WidthAndRate.WIDTH_UNKNOWN, WidthAndRate.RATE_K)); } public void outAAsigStype(AAsigStype node) { setNodeAttribute(node, new WidthAndRate(WidthAndRate.WIDTH_UNKNOWN, WidthAndRate.RATE_A)); } public void outATableStype(ATableStype node) { // TODO: } public void outAOparrayStype(AOparrayStype node) { // TODO: } public void outAXsigOtype(AXsigOtype node) { // TODO: } public void outAStypeOtype(AStypeOtype node) { setNodeAttribute(node, getNodeAttribute(node.getStype())); } public void inATabledeclTabledecl(ATabledeclTabledecl node) { } public void outATabledeclTabledecl(ATabledeclTabledecl node) { } // public void caseATabledeclTabledecl(ATabledeclTabledecl node) // { // inATabledeclTabledecl(node); // if(node.getTable() != null) // { // node.getTable().apply(this); // } // if(node.getIdentifier1() != null) // { // node.getIdentifier1().apply(this); // } // if(node.getLPar() != null) // { // node.getLPar().apply(this); // } // if(node.getIdentifier2() != null) // { // node.getIdentifier2().apply(this); // } // if(node.getComma() != null) // { // node.getComma().apply(this); // } // if(node.getExprstrlist() != null) // { // node.getExprstrlist().apply(this); // } // if(node.getRPar() != null) // { // node.getRPar().apply(this); // } // outATabledeclTabledecl(node); // } public void inAImportsTaglist(AImportsTaglist node) { } public void outAImportsTaglist(AImportsTaglist node) { } // public void caseAImportsTaglist(AImportsTaglist node) // { // inAImportsTaglist(node); // if(node.getImports() != null) // { // node.getImports().apply(this); // } // outAImportsTaglist(node); // } public void inAExportsTaglist(AExportsTaglist node) { } public void outAExportsTaglist(AExportsTaglist node) { } // public void caseAExportsTaglist(AExportsTaglist node) // { // inAExportsTaglist(node); // if(node.getExports() != null) // { // node.getExports().apply(this); // } // outAExportsTaglist(node); // } public void inAImportsexportsTaglist(AImportsexportsTaglist node) { } public void outAImportsexportsTaglist(AImportsexportsTaglist node) { } // public void caseAImportsexportsTaglist(AImportsexportsTaglist node) // { // inAImportsexportsTaglist(node); // if(node.getImports() != null) // { // node.getImports().apply(this); // } // if(node.getExports() != null) // { // node.getExports().apply(this); // } // outAImportsexportsTaglist(node); // } public void inAExportsimportsTaglist(AExportsimportsTaglist node) { } public void outAExportsimportsTaglist(AExportsimportsTaglist node) { } // public void caseAExportsimportsTaglist(AExportsimportsTaglist node) // { // inAExportsimportsTaglist(node); // if(node.getExports() != null) // { // node.getExports().apply(this); // } // if(node.getImports() != null) // { // node.getImports().apply(this); // } // outAExportsimportsTaglist(node); // } public void inAAopcodeOptype(AAopcodeOptype node) { } public void outAAopcodeOptype(AAopcodeOptype node) { } // public void caseAAopcodeOptype(AAopcodeOptype node) // { // inAAopcodeOptype(node); // if(node.getAopcode() != null) // { // node.getAopcode().apply(this); // } // outAAopcodeOptype(node); // } public void inAKopcodeOptype(AKopcodeOptype node) { } public void outAKopcodeOptype(AKopcodeOptype node) { } // public void caseAKopcodeOptype(AKopcodeOptype node) // { // inAKopcodeOptype(node); // if(node.getKopcode() != null) // { // node.getKopcode().apply(this); // } // outAKopcodeOptype(node); // } public void inAIopcodeOptype(AIopcodeOptype node) { } public void outAIopcodeOptype(AIopcodeOptype node) { } // public void caseAIopcodeOptype(AIopcodeOptype node) // { // inAIopcodeOptype(node); // if(node.getIopcode() != null) // { // node.getIopcode().apply(this); // } // outAIopcodeOptype(node); // } public void inAOpcodeOptype(AOpcodeOptype node) { } public void outAOpcodeOptype(AOpcodeOptype node) { } // public void caseAOpcodeOptype(AOpcodeOptype node) // { // inAOpcodeOptype(node); // if(node.getOpcode() != null) // { // node.getOpcode().apply(this); // } // outAOpcodeOptype(node); // } public void inAAltExpr(AAltExpr node) { // TODO: } public void outAAltExpr(AAltExpr node) { // TODO: } // public void caseAAltExpr(AAltExpr node) // { // inAAltExpr(node); // if(node.getOrexpr1() != null) // { // node.getOrexpr1().apply(this); // } // if(node.getQuestMark() != null) // { // node.getQuestMark().apply(this); // } // if(node.getOrexpr2() != null) // { // node.getOrexpr2().apply(this); // } // if(node.getColon() != null) // { // node.getColon().apply(this); // } // if(node.getOrexpr3() != null) // { // node.getOrexpr3().apply(this); // } // outAAltExpr(node); // } public void outAOrOrexpr(AOrOrexpr node) { // TODO: } public void outAAndAndexpr(AAndAndexpr node) { // TODO: } public void outANeqEqualityexpr(ANeqEqualityexpr node) { BranchInstruction branch = new IFNE(null); m_aMethods[METHOD_A].appendRelationalOperation(branch); } public void outAEqEqualityexpr(AEqEqualityexpr node) { BranchInstruction branch = new IFEQ(null); m_aMethods[METHOD_A].appendRelationalOperation(branch); } public void inAGtRelationalexpr(AGtRelationalexpr node) { } public void outAGtRelationalexpr(AGtRelationalexpr node) { BranchInstruction branch = new IFGT(null); m_aMethods[METHOD_A].appendRelationalOperation(branch); } public void outALtRelationalexpr(ALtRelationalexpr node) { BranchInstruction branch = new IFLT(null); m_aMethods[METHOD_A].appendRelationalOperation(branch); } public void outALteqRelationalexpr(ALteqRelationalexpr node) { BranchInstruction branch = new IFLE(null); m_aMethods[METHOD_A].appendRelationalOperation(branch); } public void outAGteqRelationalexpr(AGteqRelationalexpr node) { BranchInstruction branch = new IFGE(null); m_aMethods[METHOD_A].appendRelationalOperation(branch); } public void outAPlusAddexpr(APlusAddexpr node) { m_aMethods[METHOD_A].appendInstruction(InstructionConstants.FADD); } public void outAMinusAddexpr(AMinusAddexpr node) { m_aMethods[METHOD_A].appendInstruction(InstructionConstants.FSUB); } public void outAMultFactor(AMultFactor node) { m_aMethods[METHOD_A].appendInstruction(InstructionConstants.FMUL); } public void outADivFactor(ADivFactor node) { m_aMethods[METHOD_A].appendInstruction(InstructionConstants.FDIV); } public void outANotUnaryminusterm(ANotUnaryminusterm node) { m_aMethods[METHOD_A].appendInstruction(InstructionConstants.FNEG); } public void outANotNotterm(ANotNotterm node) { m_aMethods[METHOD_A].appendInstruction(InstructionConstants.FCONST_0); m_aMethods[METHOD_A].appendInstruction(InstructionConstants.FCMPL); BranchInstruction branch0 = new IFNE(null); m_aMethods[METHOD_A].appendInstruction(branch0); m_aMethods[METHOD_A].appendInstruction(InstructionConstants.FCONST_1); BranchInstruction branch1 = new GOTO(null); m_aMethods[METHOD_A].appendInstruction(branch1); m_aMethods[METHOD_A].setPendingBranchInstruction(branch0); m_aMethods[METHOD_A].appendInstruction(InstructionConstants.FCONST_0); m_aMethods[METHOD_A].setPendingBranchInstruction(branch1); } public void outAIdentifierTerm(AIdentifierTerm node) { String strVariableName = node.getIdentifier().getText(); m_aMethods[METHOD_A].appendGetField(strVariableName); } public void outAConstantTerm(AConstantTerm node) { Object constant = getNodeAttribute(node.getConst()); if (constant instanceof Integer || constant instanceof Float) { float fValue = ((Number) constant).floatValue(); m_aMethods[METHOD_A].appendFloatConstant(fValue); } else { throw new RuntimeException("constant is neither int nor float"); } } public void inAIndexedTerm(AIndexedTerm node) { // push the array reference onto the stack String strVariableName = node.getIdentifier().getText(); m_aMethods[METHOD_A].appendGetField(strVariableName); } public void outAIndexedTerm(AIndexedTerm node) { /* The array reference still is on the stack. Now, also the array index (as a float) is on the stack. It has to be transformed to integer. */ // TODO: correct rounding (1.5 -> 2.0) m_aMethods[METHOD_A].appendInstruction(InstructionConstants.F2I); // and now fetch the value from the array setNodeAttribute(node, InstructionConstants.FALOAD); } public void inASasbfTerm(ASasbfTerm node) { } public void outASasbfTerm(ASasbfTerm node) { } // public void caseASasbfTerm(ASasbfTerm node) // { // inASasbfTerm(node); // if(node.getSasbf() != null) // { // node.getSasbf().apply(this); // } // if(node.getLPar() != null) // { // node.getLPar().apply(this); // } // if(node.getExprlist() != null) // { // node.getExprlist().apply(this); // } // if(node.getRPar() != null) // { // node.getRPar().apply(this); // } // outASasbfTerm(node); // } public void inAFunctionTerm(AFunctionTerm node) { } public void outAFunctionTerm(AFunctionTerm node) { } // public void caseAFunctionTerm(AFunctionTerm node) // { // inAFunctionTerm(node); // if(node.getIdentifier() != null) // { // node.getIdentifier().apply(this); // } // if(node.getLPar() != null) // { // node.getLPar().apply(this); // } // if(node.getExprlist() != null) // { // node.getExprlist().apply(this); // } // if(node.getRPar() != null) // { // node.getRPar().apply(this); // } // outAFunctionTerm(node); // } public void inAIndexedfunctionTerm(AIndexedfunctionTerm node) { } public void outAIndexedfunctionTerm(AIndexedfunctionTerm node) { } // public void caseAIndexedfunctionTerm(AIndexedfunctionTerm node) // { // inAIndexedfunctionTerm(node); // if(node.getIdentifier() != null) // { // node.getIdentifier().apply(this); // } // if(node.getLBracket() != null) // { // node.getLBracket().apply(this); // } // if(node.getExpr() != null) // { // node.getExpr().apply(this); // } // if(node.getRBracket() != null) // { // node.getRBracket().apply(this); // } // if(node.getLPar() != null) // { // node.getLPar().apply(this); // } // if(node.getExprlist() != null) // { // node.getExprlist().apply(this); // } // if(node.getRPar() != null) // { // node.getRPar().apply(this); // } // outAIndexedfunctionTerm(node); // } public void inAExprlistExprlist(AExprlistExprlist node) { } public void outAExprlistExprlist(AExprlistExprlist node) { } // public void caseAExprlistExprlist(AExprlistExprlist node) // { // inAExprlistExprlist(node); // if(node.getExpr() != null) // { // node.getExpr().apply(this); // } // { // Object temp[] = node.getExprlistTail().toArray(); // for(int i = 0; i < temp.length; i++) // { // ((PExprlistTail) temp[i]).apply(this); // } // } // outAExprlistExprlist(node); // } public void inAExprlistTailExprlistTail(AExprlistTailExprlistTail node) { } public void outAExprlistTailExprlistTail(AExprlistTailExprlistTail node) { } // public void caseAExprlistTailExprlistTail(AExprlistTailExprlistTail node) // { // inAExprlistTailExprlistTail(node); // if(node.getComma() != null) // { // node.getComma().apply(this); // } // if(node.getExpr() != null) // { // node.getExpr().apply(this); // } // outAExprlistTailExprlistTail(node); // } public void inAExprstrlistExprstrlist(AExprstrlistExprstrlist node) { } public void outAExprstrlistExprstrlist(AExprstrlistExprstrlist node) { } // public void caseAExprstrlistExprstrlist(AExprstrlistExprstrlist node) // { // inAExprstrlistExprstrlist(node); // if(node.getExprOrString() != null) // { // node.getExprOrString().apply(this); // } // { // Object temp[] = node.getExprstrlistTail().toArray(); // for(int i = 0; i < temp.length; i++) // { // ((PExprstrlistTail) temp[i]).apply(this); // } // } // outAExprstrlistExprstrlist(node); // } public void inAExprstrlistTailExprstrlistTail(AExprstrlistTailExprstrlistTail node) { } public void outAExprstrlistTailExprstrlistTail(AExprstrlistTailExprstrlistTail node) { } // public void caseAExprstrlistTailExprstrlistTail(AExprstrlistTailExprstrlistTail node) // { // inAExprstrlistTailExprstrlistTail(node); // if(node.getComma() != null) // { // node.getComma().apply(this); // } // if(node.getExprOrString() != null) // { // node.getExprOrString().apply(this); // } // outAExprstrlistTailExprstrlistTail(node); // } public void inAExprExprOrString(AExprExprOrString node) { } public void outAExprExprOrString(AExprExprOrString node) { } // public void caseAExprExprOrString(AExprExprOrString node) // { // inAExprExprOrString(node); // if(node.getExpr() != null) // { // node.getExpr().apply(this); // } // outAExprExprOrString(node); // } public void inAStringExprOrString(AStringExprOrString node) { } public void outAStringExprOrString(AStringExprOrString node) { } // public void caseAStringExprOrString(AStringExprOrString node) // { // inAStringExprOrString(node); // if(node.getString() != null) // { // node.getString().apply(this); // } // outAStringExprOrString(node); // } public void inAIntegerConst(AIntegerConst node) { } public void outAIntegerConst(AIntegerConst node) { String strInteger = node.getInteger().getText(); Integer integer = new Integer(strInteger); setNodeAttribute(node, integer); } // public void caseAIntegerConst(AIntegerConst node) // { // inAIntegerConst(node); // if(node.getInteger() != null) // { // node.getInteger().apply(this); // } // outAIntegerConst(node); // } // public void inANumberConst(ANumberConst node) // { // } public void outANumberConst(ANumberConst node) { String strNumber = node.getNumber().getText(); Float number = new Float(strNumber); setNodeAttribute(node, number); } // public void caseANumberConst(ANumberConst node) // { // inANumberConst(node); // if(node.getNumber() != null) // { // node.getNumber().apply(this); // } // outANumberConst(node); // } //////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////// // helper methods private void setNodeAttribute(Node node, Object attribute) { m_nodeAttributes.put(node, attribute); } private Object getNodeAttribute(Node node) { return m_nodeAttributes.get(node); } private void addLocalVariable(String strVariableName) { FieldGen fieldGen; fieldGen = new FieldGen(Constants.ACC_PRIVATE, Type.FLOAT, strVariableName, m_constantPoolGen); m_classGen.addField(fieldGen.getField()); } private void addLocalArray(String strVariableName) { FieldGen fieldGen; fieldGen = new FieldGen(Constants.ACC_PRIVATE, FLOAT_ARRAY, strVariableName, m_constantPoolGen); m_classGen.addField(fieldGen.getField()); } /** Returns the InstructionFactory. This method is mainly for use by inner classes. A bit dangerous, since that has to be one InstructionFactory per generated class. */ private InstructionFactory getInstructionFactory() { return m_instructionFactory; } private class InstrumentMethod { private ClassGen m_classGen; private MethodGen m_methodGen; private InstructionList m_instructionList; private BranchInstruction m_pendingBranchInstruction; public InstrumentMethod(ClassGen classGen, String strMethodName) { m_classGen = classGen; m_instructionList = new InstructionList(); m_methodGen = new MethodGen( Constants.ACC_PUBLIC, Type.VOID, new Type[]{new ObjectType("org.tritonus.saol.engine.RTSystem")}, new String[]{"rtSystem"}, strMethodName, m_classGen.getClassName(), m_instructionList, m_classGen.getConstantPool()); } /** Append an instruction to the method's Instruction list. If a BranchInstruction is pending, it is targetted here. */ public InstructionHandle appendInstruction(Instruction instruction) { // System.out.println("instruction: " + instruction); InstructionHandle target = null; if (instruction instanceof BranchInstruction) { target = m_instructionList.append((BranchInstruction) instruction); } else if (instruction instanceof CompoundInstruction) { target = m_instructionList.append((CompoundInstruction) instruction); } else { target = m_instructionList.append(instruction); } if (m_pendingBranchInstruction != null) { m_pendingBranchInstruction.setTarget(target); m_pendingBranchInstruction = null; } return target; } /** Set the 'pending' BranchInstruction. This is a mechanism to avoid NOPs. If a BranchInstruction has to be targeted at an instruction that is immediately following, but has not been generated yet, set this BranchInstruction as the pending BranchInstruction. The next instruction added to the method's InstructionList with appendInstruction() will become the target of the pending BranchInstruction. */ public void setPendingBranchInstruction(BranchInstruction branchInstruction) { if (m_pendingBranchInstruction != null) { throw new RuntimeException("pending branch instruction already set"); } m_pendingBranchInstruction = branchInstruction; } public void appendGetField(String strVariableName) { // System.out.println("class name: " + m_strClassName); // System.out.println("var name: " + strVariableName); appendInstruction(InstructionConstants.ALOAD_0); Instruction instruction = getInstructionFactory().createGetField(m_strClassName, strVariableName, Type.FLOAT); appendInstruction(instruction); } /** NOTE: this method does not append an ALOAD_0 instruction! */ public void appendPutField(String strVariableName) { // System.out.println("class name: " + m_strClassName); // System.out.println("var name: " + strVariableName); Instruction instruction = getInstructionFactory().createPutField(m_strClassName, strVariableName, Type.FLOAT); appendInstruction(instruction); } public void appendIntegerConstant(int nValue) { Instruction instruction = null; switch (nValue) { case -1: instruction = InstructionConstants.ICONST_M1; break; case 0: instruction = InstructionConstants.ICONST_0; break; case 1: instruction = InstructionConstants.ICONST_1; break; case 2: instruction = InstructionConstants.ICONST_2; break; case 3: instruction = InstructionConstants.ICONST_3; break; case 4: instruction = InstructionConstants.ICONST_4; break; case 5: instruction = InstructionConstants.ICONST_5; break; default: int nConstantIndex = m_constantPoolGen.addInteger(nValue); instruction = new LDC(nConstantIndex); } appendInstruction(instruction); } public void appendFloatConstant(float fValue) { Instruction instruction = null; if (fValue == 0.0) { instruction = InstructionConstants.FCONST_0; } else if (fValue == 1.0) { instruction = InstructionConstants.FCONST_1; } else if (fValue == 2.0) { instruction = InstructionConstants.FCONST_2; } else { int nConstantIndex = m_constantPoolGen.addFloat(fValue); instruction = new LDC(nConstantIndex); } appendInstruction(instruction); } public void appendRelationalOperation(BranchInstruction branch0) { appendInstruction(InstructionConstants.FCMPL); appendInstruction(branch0); appendInstruction(InstructionConstants.FCONST_0); BranchInstruction branch1 = new GOTO(null); appendInstruction(branch1); setPendingBranchInstruction(branch0); appendInstruction(InstructionConstants.FCONST_1); setPendingBranchInstruction(branch1); } public void finish() { appendInstruction(InstructionConstants.RETURN); m_methodGen.setMaxStack(); m_classGen.addMethod(m_methodGen.getMethod()); } } } /*** InstrumentCompilation.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/saol/compiler/InstrumentEntry.java0000644000175000017500000000326410150707543030733 0ustar twernertwerner/* * InstrumentEntry.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2002 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.saol.compiler; import org.tritonus.saol.sablecc.node.AInstrdeclInstrdecl; public class InstrumentEntry { private String m_strInstrumentName; private AInstrdeclInstrdecl m_startNode; VariableTable m_localVariableTable; public InstrumentEntry(String strInstrumentName, AInstrdeclInstrdecl startNode) { m_strInstrumentName = strInstrumentName; m_startNode = startNode; m_localVariableTable = new VariableTable(); } public String getInstrumentName() { return m_strInstrumentName; } public AInstrdeclInstrdecl getStartNode() { return m_startNode; } public VariableTable getLocalVariableTable() { return m_localVariableTable; } } /*** InstrumentEntry.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/saol/compiler/InstrumentSemanticsCheck.java0000644000175000017500000001131310150707543032510 0ustar twernertwerner/* * InstrumentSemanticsCheck.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2002 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.saol.compiler; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import org.tritonus.saol.sablecc.analysis.*; import org.tritonus.saol.sablecc.node.*; public class InstrumentSemanticsCheck extends IOTCommonSemanticsCheck { private static final boolean DEBUG = true; private static final int[] LEGAL_VARIABLE_TYPES = new int[] { WidthAndRate.RATE_I, WidthAndRate.RATE_K, WidthAndRate.RATE_A, WidthAndRate.RATE_OPARRAY, }; private VariableTable m_globalVariableTable; private VariableTable m_localVariableTable; public InstrumentSemanticsCheck(VariableTable globalVariableTable, VariableTable localVariableTable, NodeSemanticsTable nodeSemanticsTable) { super(nodeSemanticsTable); m_globalVariableTable = globalVariableTable; m_localVariableTable = localVariableTable; } //////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////// public void inAInstrdeclInstrdecl(AInstrdeclInstrdecl node) { // String strInstrumentName = node.getIdentifier().getText(); // m_strClassName = PACKAGE_PREFIX + strInstrumentName; // m_classGen = new ClassGen(m_strClassName, // SUPERCLASS_NAME, // "", // Constants.ACC_PUBLIC | Constants.ACC_SUPER, // null); // m_constantPoolGen = m_classGen.getConstantPool(); // m_instructionFactory = new InstructionFactory(m_constantPoolGen); // m_aMethods[METHOD_CONSTR] = new InstrumentMethod(m_classGen, ""); // m_aMethods[METHOD_I] = new InstrumentMethod(m_classGen, "doIPass"); // m_aMethods[METHOD_K] = new InstrumentMethod(m_classGen, "doKPass"); // m_aMethods[METHOD_A] = new InstrumentMethod(m_classGen, "doAPass"); // m_aMethods[METHOD_CONSTR].appendInstruction(InstructionConstants.ALOAD_0); // Instruction invokeSuperInstruction = m_instructionFactory.createInvoke(SUPERCLASS_NAME, "", Type.VOID, Type.NO_ARGS, Constants.INVOKESPECIAL); // // Instruction invokeSuperInstruction = m_instructionFactory.createInvoke(SUPERCLASS_NAME, SUPERCLASS_CONSTRUCTOR_NAME, Type.VOID, Type.NO_ARGS, Constants.INVOKESPECIAL); // m_aMethods[METHOD_CONSTR].appendInstruction(invokeSuperInstruction); } public void outAInstrdeclInstrdecl(AInstrdeclInstrdecl node) { // for (int i = 0; i < m_aMethods.length; i++) // { // m_aMethods[i].finish(); // } // JavaClass javaClass = m_classGen.getJavaClass(); // try // { // ByteArrayOutputStream baos = new ByteArrayOutputStream(); // javaClass.dump(baos); // byte[] abData = baos.toByteArray(); // Class instrumentClass = m_classLoader.findClass(m_strClassName, abData); // m_instrumentMap.put(m_strClassName, instrumentClass); // if (DEBUG) // { // javaClass.dump(m_strClassName + CLASSFILENAME_SUFFIX); // } // } // catch (IOException e) // { // e.printStackTrace(); // } } public void inAMiditagMiditag(AMiditagMiditag node) { } public void outAMiditagMiditag(AMiditagMiditag node) { } public void inAIntListIntList(AIntListIntList node) { } public void outAIntListIntList(AIntListIntList node) { } //////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////// protected VariableTable getOwnVariableTable() { return m_localVariableTable; } protected VariableTable getGlobalVariableTable() { return m_globalVariableTable; } protected int[] getLegalVariableTypes() { return LEGAL_VARIABLE_TYPES; } } /*** InstrumentSemanticsCheck.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/saol/compiler/InstrumentTable.java0000644000175000017500000000260710150707543030661 0ustar twernertwerner/* * InstrumentTable.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2002 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.saol.compiler; import java.util.HashMap; /** The instrument table. TODO: use generics */ public class InstrumentTable extends HashMap { public void add(InstrumentEntry instrumentEntry) { put(instrumentEntry.getInstrumentName(), instrumentEntry); } public InstrumentEntry getEntry(String strInstrumentName) { return (InstrumentEntry) get(strInstrumentName); } } /*** InstrumentTable.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/saol/compiler/MemoryClassLoader.java0000644000175000017500000000373110150707543031125 0ustar twernertwerner/* * MemoryClassLoader.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2002 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.saol.compiler; import java.io.File; import java.io.FileInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; public class MemoryClassLoader extends ClassLoader { public Class findClass(String strName, byte[] classData) { Class cls = defineClass(strName, classData, 0, classData.length); return cls; } /* For testing */ public static void main(String[] args) { try { FileInputStream fis = new FileInputStream(new File("Instrument.class")); ByteArrayOutputStream baos = new ByteArrayOutputStream(); byte[] buffer = new byte[4096]; while (true) { int nRead = fis.read(buffer); if (nRead == -1) { break; } baos.write(buffer, 0, nRead); } MemoryClassLoader mcl = new MemoryClassLoader(); Class cls = mcl.findClass("Instrument", baos.toByteArray()); System.out.println("class loaded: " + cls.getName()); } catch (Exception e) { e.printStackTrace(); } } } /*** MemoryClassLoader.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/saol/compiler/NodeSemantics.java0000644000175000017500000000274310150707543030276 0ustar twernertwerner/* * NodeSemantics.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2002 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.saol.compiler; public class NodeSemantics extends WidthAndRate { /** Auxiliary information. */ private Object m_aux; public NodeSemantics(int nWidth, int nRate) { this(nWidth, nRate, null); } public NodeSemantics(Object aux) { this(WidthAndRate.WIDTH_UNKNOWN, WidthAndRate.RATE_UNKNOWN, aux); } public NodeSemantics(int nWidth, int nRate, Object aux) { super(nWidth, nRate); m_aux = aux; } public Object getAux() { return m_aux; } } /*** NodeSemantics.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/saol/compiler/NodeSemanticsTable.java0000644000175000017500000000263010150707543031241 0ustar twernertwerner/* * NodeSemanticsTable.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2002 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.saol.compiler; import java.util.HashMap; import org.tritonus.saol.sablecc.node.Node; /** The instrument table. TODO: use generics */ public class NodeSemanticsTable extends HashMap { public void setNodeSemantics(Node node, NodeSemantics nodeSemantics) { put(node, nodeSemantics); } public NodeSemantics getNodeSemantics(Node node) { return (NodeSemantics) get(node); } } /*** NodeSemanticsTable.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/saol/compiler/OpcodeSemanticsCheck.java0000644000175000017500000000731410150707543031557 0ustar twernertwerner/* * OpcodeSemanticsCheck.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2002 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.saol.compiler; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import org.tritonus.saol.sablecc.analysis.*; import org.tritonus.saol.sablecc.node.*; public class OpcodeSemanticsCheck extends IOTCommonSemanticsCheck { private static final boolean DEBUG = true; private static final int[] LEGAL_VARIABLE_TYPES = new int[] { WidthAndRate.RATE_I, WidthAndRate.RATE_K, WidthAndRate.RATE_A, WidthAndRate.RATE_X, WidthAndRate.RATE_OPARRAY, }; private VariableTable m_globalVariableTable; private VariableTable m_localVariableTable; public OpcodeSemanticsCheck(VariableTable globalVariableTable, VariableTable localVariableTable, NodeSemanticsTable nodeSemanticsTable) { super(nodeSemanticsTable); m_globalVariableTable = globalVariableTable; m_localVariableTable = localVariableTable; } //////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////// public void inAOpcodedeclOpcodedecl(AOpcodedeclOpcodedecl node) { } public void outAOpcodedeclOpcodedecl(AOpcodedeclOpcodedecl node) { } public void inAAopcodeOptype(AAopcodeOptype node) { } public void outAAopcodeOptype(AAopcodeOptype node) { } public void inAKopcodeOptype(AKopcodeOptype node) { } public void outAKopcodeOptype(AKopcodeOptype node) { } public void inAIopcodeOptype(AIopcodeOptype node) { } public void outAIopcodeOptype(AIopcodeOptype node) { } public void inAOpcodeOptype(AOpcodeOptype node) { } public void outAOpcodeOptype(AOpcodeOptype node) { } public void inAParamlistParamlist(AParamlistParamlist node) { } public void outAParamlistParamlist(AParamlistParamlist node) { } public void inAParamlistTailParamlistTail(AParamlistTailParamlistTail node) { } public void outAParamlistTailParamlistTail(AParamlistTailParamlistTail node) { } public void inAParamdeclParamdecl(AParamdeclParamdecl node) { } public void outAParamdeclParamdecl(AParamdeclParamdecl node) { } //////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////// protected VariableTable getOwnVariableTable() { return m_localVariableTable; } protected VariableTable getGlobalVariableTable() { return m_globalVariableTable; } protected int[] getLegalVariableTypes() { return LEGAL_VARIABLE_TYPES; } } /*** OpcodeSemanticsCheck.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/saol/compiler/PrintWalker.java0000644000175000017500000000527010150707543030002 0ustar twernertwerner/* This file was generated by SableCC (http://www.sablecc.org/). */ /* * PrintWalker.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2002 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.saol.compiler; import org.tritonus.saol.sablecc.analysis.DepthFirstAdapter; import org.tritonus.saol.sablecc.node.*; /** * Simple AST walker. This is simple Abstract Syntax Tree walker * which will visit each of the nodes and print on standard output the * name of particular node visited. This class can be very usefull while * testing the tree structure for a given input. Check PrintTree class. *@author Mariusz Nowostawski */ public class PrintWalker extends DepthFirstAdapter { private static final int INDENT_STEP = 3; private int indent = 0; void indent() { String s = new String (""); for (int i = 0; i < indent; i++) { s += " "; } System.out.print(s); } public void defaultIn(Node node) { indent(); System.out.print( "in "); String str = getStrippedClassName(node); System.out.println(str); indent += INDENT_STEP; } public void defaultOut(Node node) { indent -= INDENT_STEP; indent(); System.out.print( "out "); String str = getStrippedClassName(node); System.out.println(str); } public void defaultCase(Node node) { indent(); System.out.print( "case "); String str = getStrippedClassName(node) + ": " + ((Token) node).getText(); System.out.println(str); } private static String getStrippedClassName(Node node) { String strClassName = node.getClass().getName(); return stripClassName(strClassName); } private static String stripClassName(String strClassName) { int nLastDotPosition = strClassName.lastIndexOf("."); if (nLastDotPosition >= 0) { strClassName = strClassName.substring(nLastDotPosition + 1); } return strClassName; } } /*** PrintWalker.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/saol/compiler/SAOLGlobals.java0000644000175000017500000000504410150707543027601 0ustar twernertwerner/* * SAOLGlobals.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2002 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.saol.compiler; public class SAOLGlobals { private static final int DEFAULT_ARATE = 32000; private static final int DEFAULT_KRATE = 100; private static final int DEFAULT_INCHANNELS = 0; /*?? TODO: */ private static final int DEFAULT_OUTCHANNELS = 1; private static final int DEFAULT_INTERP = 0; private int m_nARate; private int m_nKRate; private int m_nInChannels; private int m_nOutChannels; private int m_nInterp; public SAOLGlobals() { this(DEFAULT_ARATE, DEFAULT_KRATE, DEFAULT_INCHANNELS, DEFAULT_OUTCHANNELS, DEFAULT_INTERP); } private SAOLGlobals(int nDefaultARate, int nDefaultKRate, int nDefaultInChannels, int nDefaultOutChannels, int nDefaultInterp) { m_nARate = nDefaultARate; m_nKRate = nDefaultKRate; m_nInChannels = nDefaultInChannels; m_nOutChannels = nDefaultOutChannels; m_nInterp = nDefaultInterp; } public void setARate(int nARate) { m_nARate = nARate; } public int getARate() { return m_nARate; } public void setKRate(int nKRate) { m_nKRate = nKRate; } public int getKRate() { return m_nKRate; } public void setInChannels(int nInChannels) { m_nInChannels = nInChannels; } public int getInChannels() { return m_nInChannels; } public void setOutChannels(int nOutChannels) { m_nOutChannels = nOutChannels; } public int getOutChannels() { return m_nOutChannels; } public void setInterp(int nInterp) { m_nInterp = nInterp; } public int getInterp() { return m_nInterp; } } /*** SAOLGlobals.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/saol/compiler/TemplateEntry.java0000644000175000017500000000301710150707543030332 0ustar twernertwerner/* * TemplateEntry.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2002 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.saol.compiler; import org.tritonus.saol.sablecc.node.ATemplatedeclTemplatedecl; public class TemplateEntry { private String m_strTemplateName; private ATemplatedeclTemplatedecl m_startNode; public TemplateEntry(String strTemplateName, ATemplatedeclTemplatedecl startNode) { m_strTemplateName = strTemplateName; m_startNode = startNode; } public String getTemplateName() { return m_strTemplateName; } public ATemplatedeclTemplatedecl getStartNode() { return m_startNode; } } /*** TemplateEntry.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/saol/compiler/TemplateSemanticsCheck.java0000644000175000017500000000511110150707543032112 0ustar twernertwerner/* * TemplateSemanticsCheck.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2002 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.saol.compiler; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import org.tritonus.saol.sablecc.analysis.*; import org.tritonus.saol.sablecc.node.*; public class TemplateSemanticsCheck extends IOTCommonSemanticsCheck { private static final boolean DEBUG = true; // TODO: verify private static final int[] LEGAL_VARIABLE_TYPES = new int[] { WidthAndRate.RATE_I, WidthAndRate.RATE_K, WidthAndRate.RATE_A, WidthAndRate.RATE_OPARRAY, }; private VariableTable m_globalVariableTable; private VariableTable m_localVariableTable; public TemplateSemanticsCheck(VariableTable globalVariableTable, VariableTable localVariableTable, NodeSemanticsTable nodeSemanticsTable) { super(nodeSemanticsTable); m_globalVariableTable = globalVariableTable; m_localVariableTable = localVariableTable; } //////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////// protected VariableTable getOwnVariableTable() { return m_localVariableTable; } protected VariableTable getGlobalVariableTable() { return m_globalVariableTable; } protected int[] getLegalVariableTypes() { return LEGAL_VARIABLE_TYPES; } } /*** TemplateSemanticsCheck.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/saol/compiler/TemplateTable.java0000644000175000017500000000313410150707543030260 0ustar twernertwerner/* * TemplateTable.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2002 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.saol.compiler; import java.util.HashMap; import java.util.Map; /** The template table. TODO: use generics */ public class TemplateTable { /** Map that holds the template entries. Key: the name of the template. Value: a TemplateEntry instance. */ private Map m_templateMap; public TemplateTable() { m_templateMap = new HashMap(); } public void add(TemplateEntry templateEntry) { m_templateMap.put(templateEntry.getTemplateName(), templateEntry); } public TemplateEntry get(String strTemplateName) { return (TemplateEntry) m_templateMap.get(strTemplateName); } } /*** TemplateTable.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/saol/compiler/TreeDivider.java0000644000175000017500000000523210150707543027744 0ustar twernertwerner/* * TreeDivider.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2002 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.saol.compiler; import org.tritonus.share.TDebug; import org.tritonus.saol.sablecc.analysis.*; import org.tritonus.saol.sablecc.node.*; public class TreeDivider extends DepthFirstAdapter { private static final boolean DEBUG = true; private InstrumentTable m_instrumentTable; private UserOpcodeTable m_opcodeTable; private TemplateTable m_templateTable; private AGlobaldeclGlobaldecl m_globalNode; public TreeDivider(InstrumentTable instrumentTable, UserOpcodeTable opcodeTable, TemplateTable templateTable) { m_instrumentTable = instrumentTable; m_opcodeTable = opcodeTable; m_templateTable = templateTable; m_globalNode = null; } public AGlobaldeclGlobaldecl getGlobalNode() { return m_globalNode; } public void inAInstrdeclInstrdecl(AInstrdeclInstrdecl node) { String strInstrumentName = node.getIdentifier().getText(); InstrumentEntry instrument = new InstrumentEntry(strInstrumentName, node); m_instrumentTable.add(instrument); } public void inAOpcodedeclOpcodedecl(AOpcodedeclOpcodedecl node) { String strOpcodeName = node.getIdentifier().getText(); UserOpcodeEntry opcode = new UserOpcodeEntry(strOpcodeName, node); m_opcodeTable.add(opcode); } public void inAGlobaldeclGlobaldecl(AGlobaldeclGlobaldecl node) { TDebug.out("TreeDivider.inAGlobaldeclGlobaldecl()"); m_globalNode = node; } public void inATemplatedeclTemplatedecl(ATemplatedeclTemplatedecl node) { // hack to make compile String strTemplateName = "---"; // String strTemplateName = node.getIdentifier().getText(); TemplateEntry template = new TemplateEntry(strTemplateName, node); m_templateTable.add(template); } } /*** TreeDivider.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/saol/compiler/UserOpcodeEntry.java0000644000175000017500000000314410150707543030630 0ustar twernertwerner/* * UserOpcodeEntry.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2002 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.saol.compiler; import org.tritonus.saol.sablecc.node.AOpcodedeclOpcodedecl; /** Representation of one opcode implementation. This class is used for entries in the opcode table. */ public class UserOpcodeEntry { private String m_strOpcodeName; private AOpcodedeclOpcodedecl m_startNode; public UserOpcodeEntry(String strOpcodeName, AOpcodedeclOpcodedecl startNode) { m_strOpcodeName = strOpcodeName; m_startNode = startNode; } public String getOpcodeName() { return m_strOpcodeName; } public AOpcodedeclOpcodedecl getStartNode() { return m_startNode; } } /*** UserOpcodeEntry.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/saol/compiler/UserOpcodeTable.java0000644000175000017500000000312210150707543030552 0ustar twernertwerner/* * UserOpcodeTable.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2002 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.saol.compiler; import java.util.HashMap; import java.util.Map; /** The opcode table. TODO: use generics */ public class UserOpcodeTable { /** Map that holds the opcode entries. Key: the name of the opcode. Value: a UserOpcodeEntry instance. */ private Map m_opcodeMap; public UserOpcodeTable() { m_opcodeMap = new HashMap(); } public void add(UserOpcodeEntry opcodeEntry) { m_opcodeMap.put(opcodeEntry.getOpcodeName(), opcodeEntry); } public UserOpcodeEntry get(String strOpcodeName) { return (UserOpcodeEntry) m_opcodeMap.get(strOpcodeName); } } /*** UserOpcodeTable.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/saol/compiler/VariableEntry.java0000644000175000017500000000325310150707543030306 0ustar twernertwerner/* * VariableEntry.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2002 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.saol.compiler; import org.tritonus.saol.sablecc.node.AInstrdeclInstrdecl; public class VariableEntry extends WidthAndRate { private String m_strVariableName; private boolean m_bImports; private boolean m_bExports; public VariableEntry(String strVariableName, int nWidth, int nRate, boolean bImports, boolean bExports) { super(nWidth, nRate); m_strVariableName = strVariableName; m_bImports = bImports; m_bExports = bExports; } public String getVariableName() { return m_strVariableName; } public boolean getImports() { return m_bImports; } public boolean getExports() { return m_bExports; } } /*** VariableEntry.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/saol/compiler/VariableTable.java0000644000175000017500000000255510150707543030240 0ustar twernertwerner/* * VariableTable.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2002 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.saol.compiler; import java.util.HashMap; /** The variable table. TODO: use generics */ public class VariableTable extends HashMap { public void add(VariableEntry variableEntry) { put(variableEntry.getVariableName(), variableEntry); } public VariableEntry getEntry(String strVariableName) { return (VariableEntry) get(strVariableName); } } /*** VariableTable.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/saol/compiler/WidthAndRate.java0000644000175000017500000000346110150707543030056 0ustar twernertwerner/* * WidthAndRate.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2002 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.saol.compiler; public class WidthAndRate { public static final int WIDTH_UNKNOWN = -1; public static final int WIDTH_INCHANNELS = -2; public static final int WIDTH_OUTCHANNELS = -3; // do not change arbitrarily; InstrumentCompilation depends on it! public static final int RATE_UNKNOWN = 0; public static final int RATE_I = 1; public static final int RATE_K = 2; public static final int RATE_A = 3; public static final int RATE_X = 4; // not really rates... public static final int RATE_TABLE = 5; public static final int RATE_OPARRAY = 6; private int m_nWidth; private int m_nRate; public WidthAndRate(int nWidth, int nRate) { m_nWidth = nWidth; m_nRate = nRate; } public int getWidth() { return m_nWidth; } public int getRate() { return m_nRate; } } /*** WidthAndRate.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/saol/.cvsignore0000644000175000017500000000001007460616657025065 0ustar twernertwernersablecc libtritonus-java-20070428/src/classes/org/tritonus/saol/engine/0000755000175000017500000000000010621572507024327 5ustar twernertwernerlibtritonus-java-20070428/src/classes/org/tritonus/saol/engine/opcodes/0000755000175000017500000000000010621572510025755 5ustar twernertwernerlibtritonus-java-20070428/src/classes/org/tritonus/saol/engine/opcodes/MathOpcodes.java0000644000175000017500000001177410150707543031043 0ustar twernertwerner/* * MathOpcodes.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2002 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.saol.engine.opcodes; import org.tritonus.saol.compiler.WidthAndRate; /** The Math Opcodes (Section 5.9.4). */ public class MathOpcodes { private static final float LOG_10 = (float) Math.log(10.0); public static void buildOpcodeTable(OpcodeTable opcodeTable) { OpcodeClass opcodeClass = new OpcodeClass("org.tritonus.saol.engine.opcodes.MathOpcodes", OpcodeClass.TYPE_STATIC); opcodeTable.addEntry(new OpcodeEntry("int", opcodeClass, "_int", WidthAndRate.RATE_X)); opcodeTable.addEntry(new OpcodeEntry("frac", opcodeClass, WidthAndRate.RATE_X)); opcodeTable.addEntry(new OpcodeEntry("dbamp", opcodeClass, WidthAndRate.RATE_X)); opcodeTable.addEntry(new OpcodeEntry("ampdb", opcodeClass, WidthAndRate.RATE_X)); opcodeTable.addEntry(new OpcodeEntry("abs", opcodeClass, WidthAndRate.RATE_X)); opcodeTable.addEntry(new OpcodeEntry("sgn", opcodeClass, WidthAndRate.RATE_X)); opcodeTable.addEntry(new OpcodeEntry("exp", opcodeClass, WidthAndRate.RATE_X)); opcodeTable.addEntry(new OpcodeEntry("log", opcodeClass, WidthAndRate.RATE_X)); opcodeTable.addEntry(new OpcodeEntry("sqrt", opcodeClass, WidthAndRate.RATE_X)); opcodeTable.addEntry(new OpcodeEntry("sin", opcodeClass, WidthAndRate.RATE_X)); opcodeTable.addEntry(new OpcodeEntry("cos", opcodeClass, WidthAndRate.RATE_X)); opcodeTable.addEntry(new OpcodeEntry("atan", opcodeClass, WidthAndRate.RATE_X)); opcodeTable.addEntry(new OpcodeEntry("pow", opcodeClass, WidthAndRate.RATE_X)); opcodeTable.addEntry(new OpcodeEntry("log10", opcodeClass, WidthAndRate.RATE_X)); opcodeTable.addEntry(new OpcodeEntry("asin", opcodeClass, WidthAndRate.RATE_X)); opcodeTable.addEntry(new OpcodeEntry("acos", opcodeClass, WidthAndRate.RATE_X)); opcodeTable.addEntry(new OpcodeEntry("ceil", opcodeClass, WidthAndRate.RATE_X)); opcodeTable.addEntry(new OpcodeEntry("floor", opcodeClass, WidthAndRate.RATE_X)); opcodeTable.addEntry(new OpcodeEntry("min", opcodeClass, WidthAndRate.RATE_X)); opcodeTable.addEntry(new OpcodeEntry("max", opcodeClass, WidthAndRate.RATE_X)); } public static float _int(float x) { return (float) ((long) x); } public static float frac(float x) { return x - _int(x); } public static float dbamp(float x) { return 90.0F + 20.0F * log10(x); } public static float ampdb(float x) { return pow(10.0F, (x - 90.0F) / 20.0F); } public static float abs(float x) { return Math.abs(x); } public static float sgn(float x) { return (x < 0.0F) ? -1.0F : ((x > 0.0F) ? +1.0F : 0.0F); } public static float exp(float x) { return (float) Math.exp(x); } public static float log(float x) { return (float) Math.log(x); } public static float sqrt(float x) { return (float) Math.sqrt(x); } public static float sin(float x) { return (float) Math.sin(x); } public static float cos(float x) { return (float) Math.cos(x); } public static float atan(float x) { return (float) Math.atan(x); } public static float pow(float x, float y) { return (float) Math.pow(x, y); } public static float log10(float x) { /* Uses the formula: log-b (a) = ln (a) / ln (b) (ln: logarithmus naturalis, logarith with base e) */ return (float) Math.log(x) * (1 / LOG_10); } public static float asin(float x) { return (float) Math.asin(x); } public static float acos(float x) { return (float) Math.acos(x); } public static float ceil(float x) { return (float) Math.ceil(x); } public static float floor(float x) { return (float) Math.floor(x); } public static float min(float[] x) { switch (x.length) { case 1: return x[0]; case 2: return Math.min(x[0], x[1]); default: float fMin = x[0]; for (int i = 1; i < x.length; i++) { fMin = Math.min(fMin, x[i]); } return fMin; } } public static float max(float[] x) { switch (x.length) { case 1: return x[0]; case 2: return Math.max(x[0], x[1]); default: float fMax = x[0]; for (int i = 1; i < x.length; i++) { fMax = Math.max(fMax, x[i]); } return fMax; } } } /*** MathOpcodes.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/saol/engine/opcodes/OpcodeClass.java0000644000175000017500000000511410150707543031023 0ustar twernertwerner/* * OpcodeClass.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2002 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.saol.engine.opcodes; /** The Math Opcodes (Section 5.9.4). */ public class OpcodeClass { /** Opcode class type: no instance needed. This means the opcode is implemented as a static method of the class. The Runtime system doesn't need to create an instance of the opcode class. */ public static final int TYPE_STATIC = 0; /** Opcode class type: one instance per renderer instance. */ public static final int TYPE_RUNTIME_INSTANCE = 1; /** Opcode class type: one instance per opcode usage. */ public static final int TYPE_OPCODE_INSTANCE = 2; /** The name of the opcode class. A fully qualified class name (package.class). */ private String m_strName; /** The type of the opcode class. One of TYPE_STATIC, TYPE_RUNTIME_INSTANCE and TYPE_OPCODE_INSTANCE. */ private int m_nType; /** Constructor. @param strName the name of the opcode class. A fully qualified class name is expected (package.class). @param nType the instantiation type of the class. One of TYPE_STATIC, TYPE_RUNTIME_INSTANCE and TYPE_OPCODE_INSTANCE. */ public OpcodeClass(String strName, int nType) { m_strName = strName; m_nType = nType; } /** Retrieves the name of the opcode class. @return the name that was set with the constructor. A fully qualified class name (package.class) */ public String getName() { return m_strName; } /** Retrieves the type of the opcode class. @return the type that was set with the constructor. One of TYPE_STATIC, TYPE_RUNTIME_INSTANCE and TYPE_OPCODE_INSTANCE. */ public int getType() { return m_nType; } } /*** OpcodeClass.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/saol/engine/opcodes/OpcodeEntry.java0000644000175000017500000000404310150707543031057 0ustar twernertwerner/* * OpcodeEntry.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2002 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.saol.engine.opcodes; /** Representation of one opcode implementation. This class is used for entries in the opcode table. */ public class OpcodeEntry { private String m_strOpcodeName; private OpcodeClass m_opcodeClass; private String m_strMethodName; private int m_nRate; // TODO: parameter description, including dummy params // if opcode and method name are the same public OpcodeEntry(String strOpcodeName, OpcodeClass opcodeClass, int nRate) { this(strOpcodeName, opcodeClass, strOpcodeName, nRate); } public OpcodeEntry(String strOpcodeName, OpcodeClass opcodeClass, String strMethodName, int nRate) { m_strOpcodeName = strOpcodeName; m_opcodeClass = opcodeClass; m_strMethodName = strMethodName; m_nRate = nRate; } public String getOpcodeName() { return m_strOpcodeName; } public OpcodeClass getOpcodeClass() { return m_opcodeClass; } public String getMethodName() { return m_strMethodName; } public int getRate() { return m_nRate; } } /*** OpcodeEntry.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/saol/engine/opcodes/OpcodeTable.java0000644000175000017500000000331710150707543031010 0ustar twernertwerner/* * OpcodeTable.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2002 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.saol.engine.opcodes; import java.util.HashMap; import java.util.Map; /** The opcode table. TODO: use generics */ public class OpcodeTable { /** Map that holds the opcode entries. Key: the name of the opcode. Value: a OpcodeEntry instance. */ private Map m_opcodeMap; public OpcodeTable() { m_opcodeMap = new HashMap(); buildOpcodeTable(); } private void buildOpcodeTable() { PitchOpcodes.buildOpcodeTable(this); MathOpcodes.buildOpcodeTable(this); } public void addEntry(OpcodeEntry opcodeEntry) { m_opcodeMap.put(opcodeEntry.getOpcodeName(), opcodeEntry); } public OpcodeEntry getOpcode(String strOpcodeName) { return (OpcodeEntry) m_opcodeMap.get(strOpcodeName); } } /*** OpcodeTable.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/saol/engine/opcodes/PitchOpcodes.java0000644000175000017500000001413710150707543031215 0ustar twernertwerner/* * PitchOpcodes.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2002 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.saol.engine.opcodes; import org.tritonus.saol.compiler.WidthAndRate; /** The tune-related opcodes (Section 5.9.5). These opcodes depend on a tune value. This tune value is global, but only inside the current orchestra. To allow the concurrent rendering of multiple orchestras, the tune value cannot be global (in programming language terms), but has to be encapsulated in class instances. So this class has to be instantiated once per orchestra rendering. */ public final class PitchOpcodes { private static final float DEFAULT_TUNE = 440.0F; private float m_fTune; public PitchOpcodes() { m_fTune = DEFAULT_TUNE; } public static void buildOpcodeTable(OpcodeTable opcodeTable) { OpcodeClass staticClass = new OpcodeClass("org.tritonus.saol.engine.opcodes.PitchOpcodes", OpcodeClass.TYPE_STATIC); OpcodeClass instanceClass = new OpcodeClass("org.tritonus.saol.engine.opcodes.PitchOpcodes", OpcodeClass.TYPE_RUNTIME_INSTANCE); opcodeTable.addEntry(new OpcodeEntry("gettune", instanceClass, WidthAndRate.RATE_X)); opcodeTable.addEntry(new OpcodeEntry("settune", instanceClass, WidthAndRate.RATE_K)); opcodeTable.addEntry(new OpcodeEntry("octpch", staticClass, WidthAndRate.RATE_X)); opcodeTable.addEntry(new OpcodeEntry("pchoct", staticClass, WidthAndRate.RATE_X)); opcodeTable.addEntry(new OpcodeEntry("cpspch", instanceClass, WidthAndRate.RATE_X)); opcodeTable.addEntry(new OpcodeEntry("pchcps", instanceClass, WidthAndRate.RATE_X)); opcodeTable.addEntry(new OpcodeEntry("cpsoct", instanceClass, WidthAndRate.RATE_X)); opcodeTable.addEntry(new OpcodeEntry("octcps", instanceClass, WidthAndRate.RATE_X)); opcodeTable.addEntry(new OpcodeEntry("midipch", staticClass, WidthAndRate.RATE_X)); opcodeTable.addEntry(new OpcodeEntry("pchmidi", staticClass, WidthAndRate.RATE_X)); opcodeTable.addEntry(new OpcodeEntry("midioct", staticClass, WidthAndRate.RATE_X)); opcodeTable.addEntry(new OpcodeEntry("octmidi", staticClass, WidthAndRate.RATE_X)); opcodeTable.addEntry(new OpcodeEntry("midicps", instanceClass, WidthAndRate.RATE_X)); opcodeTable.addEntry(new OpcodeEntry("cpsmidi", instanceClass, WidthAndRate.RATE_X)); } public float gettune() { return m_fTune; } public float settune(float x) { m_fTune = x; return x; } public static float octpch(float x) { return getOctValue(getPchOctave(x), getPchNote(x)); } public static float pchoct(float x) { return getPchValue(getOctOctave(x), getOctNote(x)); } public float cpspch(float x) { return getCpsValue(getPchOctave(x), getPchNote(x)); } public float pchcps(float x) { return getPchValue(getCpsOctave(x), getCpsNote(x)); } public float cpsoct(float x) { return getCpsValue(getOctOctave(x), getOctNote(x)); } public float octcps(float x) { return getOctValue(getCpsOctave(x), getCpsNote(x)); } public static float midipch(float x) { return getMidiValue(getPchOctave(x), getPchNote(x)); } public static float pchmidi(float x) { return getPchValue(getMidiOctave(x), getMidiNote(x)); } public static float midioct(float x) { return getMidiValue(getOctOctave(x), getOctNote(x)); } public static float octmidi(float x) { return getOctValue(getMidiOctave(x), getMidiNote(x)); } public float midicps(float x, float y) { return getMidiValue(getCpsOctave(x), getCpsNote(x)); } public float cpsmidi(float x) { return getCpsValue(getMidiOctave(x), getMidiNote(x)); } /* * helper methds */ /* These methods use the following conventions: octave: ... 6 7 8 octave of middle c 9 10 ... note: 0 C 1 C# 2 D 3 D# 4 E 5 F 6 F# 7 G 8 G# 9 A 10 A# 11 B */ private float getCpsValue(int nOctave, int nNote) { return gettune() * (float) Math.pow(2.0, (nOctave - 8) + (nNote - 9) / 12.0); } private int getCpsOctave(float fCps) { double dRelativePitch = fCps / gettune(); double dTone = Math.log(dRelativePitch) * (1.0 / Math.log(2.0)); return (int) dTone + 8; } private int getCpsNote(float fCps) { double dRelativePitch = fCps / gettune(); double dTone = Math.log(dRelativePitch) * (1.0 / Math.log(2.0)); return (int) ((dTone - (int) dTone) * 12.0); } private static float getMidiValue(int nOctave, int nNote) { return (nOctave - 3) * 12 + nNote; } private static int getMidiOctave(float fMidi) { return (int) fMidi / 12 + 3; } private static int getMidiNote(float fMidi) { return (int) fMidi % 12; } private static float getOctValue(int nOctave, int nNote) { return nOctave + nNote * (1.0F / 12.0F); } private static int getOctOctave(float fOct) { return (int) fOct; } private static int getOctNote(float fOct) { return (int) ((fOct - getOctOctave(fOct)) * 12.0F); } private static float getPchValue(int nOctave, int nNote) { return nOctave + nNote * 0.01F; } private static int getPchOctave(float fPch) { return (int) fPch; } private static int getPchNote(float fPch) { return (int) ((fPch - getPchOctave(fPch)) * 100.0F); } private static float notImplemented() { throw new RuntimeException("opcode not implemented"); } } /*** PitchOpcodes.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/saol/engine/AbstractInstrument.java0000644000175000017500000000550310150707543031026 0ustar twernertwerner/* * AbstractInstrument.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2002 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.saol.engine; public abstract class AbstractInstrument implements Output { private Output m_outputPort; private int m_nStartTime; private int m_nEndTime; protected AbstractInstrument() { } // should be a constructor argument, but is not to simplify instantiation and inheritance public void setOutput(Output output) { m_outputPort = output; } // should be a constructor argument, but is not to simplify instantiation and inheritance public void setStartAndEndTime(int nStartTime, int nEndTime) { m_nStartTime = nStartTime; m_nEndTime = nEndTime; } public int getStartTime() { return m_nStartTime; } public int getEndTime() { return m_nEndTime; } public void doIPass(RTSystem rtSystem) { } public void doKPass(RTSystem rtSystem) { } public void doAPass(RTSystem rtSystem) { } /** Gives the width of the output port. @returns width of the output port (number of channels) */ public int getWidth() { return m_outputPort.getWidth(); } /** Initiate the output port of the instrument. Sets the values of all samples to 0.0. This method must be called in an a-cycle before this instrument's a-cycle code is executed. */ public void clear() { m_outputPort.clear(); } /** Add the sample value of one instrument. This method can be called by instrument's a-cycle code to output the sample value the instrument has calculated for this a-cycle. */ public void output(float fSample) { m_outputPort.output(fSample); } /** Add sample values of one instrument. This method can be called by instrument's a-cycle code to output the sample value the instrument has calculated for this a-cycle. The current hacky version allows only for mono samples. */ public void output(float[] afSamples) { m_outputPort.output(afSamples); } } /*** AbstractInstrument.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/saol/engine/AudioOutputStreamOutput.java0000644000175000017500000000452110150707543032050 0ustar twernertwerner/* * AudioOutputStreamOutput.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2002 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.saol.engine; import java.io.IOException; /* * Tritonus classes. * Using these makes the program not portable to other * Java Sound implementations. */ import org.tritonus.share.TDebug; import org.tritonus.share.sampled.TConversionTool; import org.tritonus.share.sampled.file.AudioOutputStream; public class AudioOutputStreamOutput extends Bus implements SystemOutput { private AudioOutputStream m_audioOutputStream; private byte[] m_abBuffer; public AudioOutputStreamOutput(AudioOutputStream audioOutputStream) { super(audioOutputStream.getFormat().getChannels()); m_audioOutputStream = audioOutputStream; m_abBuffer = new byte[audioOutputStream.getFormat().getFrameSize()]; } public void emit() throws IOException { float[] afValues = getValues(); boolean bBigEndian = m_audioOutputStream.getFormat().isBigEndian(); int nOffset = 0; for (int i = 0; i < afValues.length; i++) { float fOutput = Math.max(Math.min(afValues[i], 1.0F), -1.0F); // assumes 16 bit linear int nOutput = (int) (fOutput * 32767.0F); TConversionTool.shortToBytes16((short) nOutput, m_abBuffer, nOffset, bBigEndian); nOffset += 2; } m_audioOutputStream.write(m_abBuffer, 0, m_abBuffer.length); } public void close() throws IOException { m_audioOutputStream.close(); } } /*** AudioOutputStreamOutput.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/saol/engine/Bus.java0000644000175000017500000000517110150707543025724 0ustar twernertwerner/* * Bus.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2002 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.saol.engine; /** Bus in the SA engine. This interface abstracts the way calculated samples are output from the engine. The engine only calls this interface, while implementations of this interface write the samples to a file, a line, a network socket or whatever else. @author Matthias Pfisterer */ public class Bus implements Output { private float[] m_afValues; public Bus(int nWidth) { m_afValues = new float[nWidth]; } /** Gives the width of this bus. @returns width of the bus (number of channels) */ public int getWidth() { return m_afValues.length; } /** Initiate the cumulation of a sample value. Sets the values of all samples to 0.0. This method must be called in an a-cycle before any instrument's a-cycle code is executed. */ public void clear() { for (int i = 0; i < getWidth(); i++) { m_afValues[i] = 0.0F; } } /** Add the sample value of one instrument. This method can be called by instrument's a-cycle code to output the sample value the instrument has calculated for this a-cycle. The current hacky version allows only for mono samples. */ public void output(float fSample) { for (int i = 0; i < getWidth(); i++) { m_afValues[i] += fSample; } } /** Add sample values of one instrument. This method can be called by instrument's a-cycle code to output the sample value the instrument has calculated for this a-cycle. The current hacky version allows only for mono samples. */ public void output(float[] afSamples) { for (int i = 0; i < getWidth(); i++) { m_afValues[i] += afSamples[i]; } } public float[] getValues() { return m_afValues; } } /*** Bus.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/saol/engine/FileOutput.java0000644000175000017500000000340110150707543027265 0ustar twernertwerner/* * FileOutput.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2002 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.saol.engine; import java.io.IOException; import java.io.File; import javax.sound.sampled.AudioFileFormat; import javax.sound.sampled.AudioFormat; import javax.sound.sampled.AudioSystem; /* * Tritonus classes. * Using these makes the program not portable to other * Java Sound implementations. */ import org.tritonus.share.sampled.AudioSystemShadow; import org.tritonus.share.sampled.file.AudioOutputStream; public class FileOutput extends AudioOutputStreamOutput { public FileOutput(File outputFile, AudioFileFormat.Type targetType, AudioFormat audioFormat) throws IOException { super(AudioSystemShadow.getAudioOutputStream( targetType, audioFormat, AudioSystem.NOT_SPECIFIED, outputFile)); } } /*** FileOutput.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/saol/engine/Main.java0000644000175000017500000000440510150707543026056 0ustar twernertwerner/* * Main.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2002 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.saol.engine; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.util.Map; import javax.sound.sampled.AudioSystem; import javax.sound.sampled.AudioFormat; import javax.sound.sampled.AudioFileFormat; import org.tritonus.share.TDebug; import org.tritonus.saol.compiler.Compiler; public class Main { public static void main(String[] args) throws IOException { File saolFile = new File(args[0]); File saslFile = new File(args[1]); File outputFile = new File(args[2]); Compiler compiler = new Compiler(saolFile); try { compiler.compile(); } catch (Exception e) { e.printStackTrace(); } Map instrumentMap = compiler.getInstrumentMap(); TDebug.out("Main.main(): IM: " + instrumentMap); AudioFileFormat.Type targetType = AudioFileFormat.Type.WAVE; AudioFormat audioFormat = new AudioFormat(AudioFormat.Encoding.PCM_SIGNED, 44100.0F, 16, 2, 4, 44100.0F, false); SystemOutput output = new FileOutput(outputFile, targetType, audioFormat); RTSystem rtSystem = new RTSystem(output, instrumentMap); rtSystem.start(); InputStream saslInputStream = new FileInputStream(saslFile); SaslParser saslParser = new SaslParser(rtSystem, saslInputStream); new Thread(saslParser).start(); } } /*** Main.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/saol/engine/Output.java0000644000175000017500000000432410150707543026472 0ustar twernertwerner/* * Output.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2002 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.saol.engine; /** Output method for the SA engine. This interface abstracts the way calculated samples are output from the engine. The engine only calls this interface, while implementations of this interface write the samples to a file, a line, a network socket or whatever else. @author Matthias Pfisterer */ public interface Output { /** Gives the width of this output. @returns width of the output (number of channels) */ public int getWidth(); /** Initiate the cumulation of a sample value. Sets the values of all samples to 0.0. This method must be called in an a-cycle before any instrument's a-cycle code is executed. */ public void clear(); /** Add the sample value of one instrument. This method can be called by instrument's a-cycle code to output the sample value the instrument has calculated for this a-cycle. The current hacky version allows only for mono samples. */ public void output(float fSample); /** Add sample values of one instrument. This method can be called by instrument's a-cycle code to output the sample value the instrument has calculated for this a-cycle. The current hacky version allows only for mono samples. */ public void output(float[] afSamples); } /*** Output.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/saol/engine/RTSystem.java0000644000175000017500000001352610150707543026730 0ustar twernertwerner/* * RTSystem.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2002 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.saol.engine; import java.io.IOException; import java.lang.reflect.Constructor; import java.util.LinkedList; import java.util.Iterator; import java.util.List; import java.util.Map; import org.tritonus.share.TDebug; public class RTSystem extends Thread { private static final boolean DEBUG = false; private SystemOutput m_output; private Map m_instrumentMap; private boolean m_bRunning; private int m_nTime; private float m_fTimeStep; private int m_nARate; private int m_nKRate; private int m_nAToKRateFactor; private List m_activeInstruments; private List m_scheduledInstruments; private int m_nScheduledEndTime; private float m_fFloatToIntTimeFactor; private float m_fIntToFloatTimeFactor; public RTSystem(SystemOutput output, Map instrumentMap) { m_output = output; m_instrumentMap = instrumentMap; // TODO: setRates(44100, 100); m_activeInstruments = new LinkedList(); m_scheduledInstruments = new LinkedList(); m_nScheduledEndTime = Integer.MAX_VALUE; } private void setRates(int nARate, int nKRate) { m_nARate = nARate; m_nKRate = nKRate; m_nAToKRateFactor = nARate / nKRate; m_fTimeStep = 1.0F / (float) nKRate; // following is only correct for 60 BPM m_fFloatToIntTimeFactor = (float) nKRate; m_fIntToFloatTimeFactor = m_fTimeStep; } public void run() { try { runImpl(); } catch (IOException e) { e.printStackTrace(); } } private void runImpl() throws IOException { m_bRunning = true; m_nTime = 0; while (m_bRunning) { doI(); doK(); for (int i = 0; i < m_nAToKRateFactor; i++) { doA(); } advanceTime(); } m_output.close(); } private void doI() { if (DEBUG) { TDebug.out("doI()"); TDebug.out("time: " + getTime()); } synchronized (m_scheduledInstruments) { Iterator scheduledInstruments = m_scheduledInstruments.iterator(); while (scheduledInstruments.hasNext()) { if (DEBUG) { TDebug.out("scheduled instrument"); } AbstractInstrument instrument = (AbstractInstrument) scheduledInstruments.next(); if (DEBUG) { TDebug.out("instrument start time: " + instrument.getStartTime()); } if (getTime() >= instrument.getStartTime()) { if (DEBUG) { TDebug.out("...activating"); } scheduledInstruments.remove(); instrument.doIPass(this); m_activeInstruments.add(instrument); } } } Iterator activeInstruments = m_activeInstruments.iterator(); while (activeInstruments.hasNext()) { AbstractInstrument instrument = (AbstractInstrument) activeInstruments.next(); if (getTime() > instrument.getEndTime()) { if (DEBUG) { TDebug.out("...DEactivating"); } activeInstruments.remove(); } } if (getTime() >= getScheduledEndTime()) { stopEngine(); } } private void doK() { Iterator activeInstruments = m_activeInstruments.iterator(); while (activeInstruments.hasNext()) { AbstractInstrument instrument = (AbstractInstrument) activeInstruments.next(); instrument.doKPass(this); } } private void doA() throws IOException { // TDebug.out("doA()"); m_output.clear(); Iterator activeInstruments = m_activeInstruments.iterator(); while (activeInstruments.hasNext()) { // TDebug.out("doA(): has active Instrument"); AbstractInstrument instrument = (AbstractInstrument) activeInstruments.next(); instrument.doAPass(this); } m_output.emit(); } public void scheduleInstrument(String strInstrumentName, float fStartTime, float fDuration) { AbstractInstrument instrument = createInstrumentInstance(strInstrumentName); int nStartTime = Math.round(fStartTime * m_fFloatToIntTimeFactor); int nEndTime = Math.round((fStartTime + fDuration) * m_fFloatToIntTimeFactor); instrument.setStartAndEndTime(nStartTime, nEndTime); synchronized (m_scheduledInstruments) { m_scheduledInstruments.add(instrument); if (DEBUG) { TDebug.out("adding instrument"); TDebug.out("start: " + nStartTime); TDebug.out("end: " + nEndTime); } } } public void scheduleEnd(float fEndTime) { m_nScheduledEndTime = Math.round(fEndTime * m_fFloatToIntTimeFactor); // TODO: } public void stopEngine() { m_bRunning = false; } private void advanceTime() { m_nTime++; } public int getTime() { return m_nTime; } public void output(float fValue) { m_output.output(fValue); } private int getScheduledEndTime() { return m_nScheduledEndTime; } private AbstractInstrument createInstrumentInstance(String strInstrumentName) { AbstractInstrument instrument = null; Class instrumentClass = (Class) m_instrumentMap.get(strInstrumentName); try { Constructor constructor = instrumentClass.getConstructor(new Class[]{RTSystem.class}); instrument = (AbstractInstrument) constructor.newInstance(new Object[]{this}); } catch (Exception e) { e.printStackTrace(); } return instrument; } } /*** RTSystem.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/saol/engine/SaslParser.java0000644000175000017500000000560510150707543027254 0ustar twernertwerner/* * SaslParser.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2002 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.saol.engine; import java.io.InputStream; import java.io.IOException; import java.io.InputStreamReader; import java.io.BufferedReader; import java.util.StringTokenizer; import org.tritonus.share.TDebug; public class SaslParser implements Runnable { private RTSystem m_rtSystem; private boolean m_bRunning; private BufferedReader m_bufferedReader; protected SaslParser(RTSystem rtSystem, InputStream inputStream) { m_rtSystem = rtSystem; m_bufferedReader = new BufferedReader(new InputStreamReader(inputStream)); } public void run() { try { runImpl(); } catch (IOException e) { e.printStackTrace(); } } private void runImpl() throws IOException { m_bRunning = true; while (m_bRunning) { String strLine = m_bufferedReader.readLine(); if (strLine == null) { /* EOF signaled. */ break; } strLine = strLine.trim(); if (strLine.equals("")) { continue; } TDebug.out("line: " + strLine); String[] astrParts = splitString(strLine); boolean bHighPriority = false; int nIndex = 0; if (astrParts[nIndex].equals("*")) { bHighPriority = true; nIndex++; } float fTime = Float.parseFloat(astrParts[nIndex]); nIndex++; String strCommandName = astrParts[nIndex]; nIndex++; if (strCommandName.equals("end")) { m_rtSystem.scheduleEnd(fTime); } else { float fDuration = Float.parseFloat(astrParts[nIndex]); m_rtSystem.scheduleInstrument(strCommandName, fTime, fDuration); } } } private static String[] splitString(String str) { // jdk1.4 method: // String[] astrParts = str.split("\\s"); StringTokenizer tokenizer = new StringTokenizer(str); String[] astrParts = new String[tokenizer.countTokens()]; int nIndex = 0; while (tokenizer.hasMoreTokens()) { astrParts[nIndex] = tokenizer.nextToken(); nIndex++; } return astrParts; } } /*** SaslParser.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/saol/engine/SystemOutput.java0000644000175000017500000000407110150707543027676 0ustar twernertwerner/* * SystemOutput.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2002 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.saol.engine; import java.io.IOException; /** Output method for the SA engine. This interface abstracts the way calculated samples are output from the engine. The engine only calls this interface, while implementations of this interface write the samples to a file, a line, a network socket or whatever else. @author Matthias Pfisterer */ public interface SystemOutput extends Output { /** Writes the accumulated sample values to the output media. This method must be called by the engine after all instrument's a-cycle code for this cycle is executed. It is intended to actually write the resulting sample data to the desired location. The desired location may be a file, a line, or somthing else, depending on this interface' implementation. */ public void emit() throws IOException; /** Closes the output destination. This method must be called by the engine after execution, i.e. when there are no further a-cycles. It is intended to close files, lines, or other output destinations. */ public void close() throws IOException; } /*** SystemOutput.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/share/0000755000175000017500000000000010621572513023223 5ustar twernertwernerlibtritonus-java-20070428/src/classes/org/tritonus/share/midi/0000755000175000017500000000000010621572512024144 5ustar twernertwernerlibtritonus-java-20070428/src/classes/org/tritonus/share/midi/MidiUtils.java0000644000175000017500000000537210374160733026724 0ustar twernertwerner/* * MidiUtils.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.share.midi; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.OutputStream; import org.tritonus.share.TDebug; /** Helper methods for reading and writing MIDI files. */ public class MidiUtils { public static int getUnsignedInteger(byte b) { return (b < 0) ? b + 256 : b; } public static int get14bitValue(int nLSB, int nMSB) { return (nLSB & 0x7F) | ((nMSB & 0x7F) << 7); } public static int get14bitMSB(int nValue) { return (nValue >> 7) & 0x7F; } public static int get14bitLSB(int nValue) { return nValue & 0x7F; } public static byte[] getVariableLengthQuantity(long lValue) { ByteArrayOutputStream data = new ByteArrayOutputStream(); try { writeVariableLengthQuantity(lValue, data); } catch (IOException e) { if (TDebug.TraceAllExceptions) { TDebug.out(e); } } return data.toByteArray(); } public static int writeVariableLengthQuantity(long lValue, OutputStream outputStream) throws IOException { int nLength = 0; // IDEA: use a loop boolean bWritingStarted = false; int nByte = (int) ((lValue >> 21) & 0x7f); if (nByte != 0) { if (outputStream != null) { outputStream.write(nByte | 0x80); } nLength++; bWritingStarted = true; } nByte = (int) ((lValue >> 14) & 0x7f); if (nByte != 0 || bWritingStarted) { if (outputStream != null) { outputStream.write(nByte | 0x80); } nLength++; bWritingStarted = true; } nByte = (int) ((lValue >> 7) & 0x7f); if (nByte != 0 || bWritingStarted) { if (outputStream != null) { outputStream.write(nByte | 0x80); } nLength++; } nByte = (int) (lValue & 0x7f); if (outputStream != null) { outputStream.write(nByte); } nLength++; return nLength; } } /*** MidiUtils.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/share/midi/TDirectSynthesizer.java0000644000175000017500000000665410375317213030631 0ustar twernertwerner/* * TDirectSynthesizer.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2004 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.share.midi; import javax.sound.midi.MidiChannel; import javax.sound.midi.MidiDevice; import javax.sound.midi.MidiMessage; import javax.sound.midi.ShortMessage; import javax.sound.midi.Synthesizer; /** * Base class for Synthesizer implementations. * *

* This base class is for Synthesizer implementations that do not itself operate * on MIDI, but instread implement the MidiChannel interface. For these * implementations, MIDI behaviour is simulated on top of MidiChannel. *

* * @see javax.sound.midi.MidiChannel * * @author Matthias Pfisterer */ public abstract class TDirectSynthesizer extends TMidiDevice implements Synthesizer { /** Initialize this class. * This sets the info from the passed one, sets the open status * to false, the number of Receivers to zero and the collection * of Transmitters to be empty. * * @param info The info object that describes this instance. */ public TDirectSynthesizer(MidiDevice.Info info) { // no Transmitters, only Receivers super(info, false, true); } /** * Obtains the MidiChannel with the specified number. * * @param nChannel the requested channel number (0..15) * @return the respective MidiChannel object */ private MidiChannel getChannel(int nChannel) { return getChannels()[nChannel]; } /** * Handles MIDI messages coming in from Receivers. * */ protected void receive(MidiMessage message, long lTimeStamp) { if (message instanceof ShortMessage) { ShortMessage shortMsg = (ShortMessage) message; int nChannel = shortMsg.getChannel(); int nCommand = shortMsg.getCommand(); int nData1 = shortMsg.getData1(); int nData2 = shortMsg.getData2(); switch (nCommand) { case ShortMessage.NOTE_OFF: getChannel(nChannel).noteOff(nData1, nData2); break; case ShortMessage.NOTE_ON: getChannel(nChannel).noteOn(nData1, nData2); break; case ShortMessage.POLY_PRESSURE: getChannel(nChannel).setPolyPressure(nData1, nData2); break; case ShortMessage.CONTROL_CHANGE: getChannel(nChannel).controlChange(nData1, nData2); break; case ShortMessage.PROGRAM_CHANGE: getChannel(nChannel).programChange(nData1); break; case ShortMessage.CHANNEL_PRESSURE: getChannel(nChannel).setChannelPressure(nData1); break; case ShortMessage.PITCH_BEND: getChannel(nChannel).setPitchBend(nData1 | (nData2 << 7)); break; default: } } } } /*** TDirectSynthesizer.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/share/midi/TMidiChannel.java0000644000175000017500000000504410375317304027313 0ustar twernertwerner/* * TMidiChannel.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2006 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.share.midi; import javax.sound.midi.MidiChannel; /** * Base class for MidiChannel implementations. * *

This base class serves two purposes:

* *
    *
  1. It contains a channel number property so that the MidiChannel * object knows its own MIDI channel number.
  2. * *
  3. It maps some of the methods to others.
  4. *
* * @author Matthias Pfisterer */ public abstract class TMidiChannel implements MidiChannel { private int m_nChannel; protected TMidiChannel(int nChannel) { m_nChannel = nChannel; } protected int getChannel() { return m_nChannel; } public void noteOff(int nNoteNumber) { noteOff(nNoteNumber, 0); } public void programChange(int nBank, int nProgram) { int nBankMSB = nBank >> 7; int nBankLSB = nBank & 0x7F; controlChange(0, nBankMSB); controlChange(32, nBankLSB); programChange(nProgram); } public void resetAllControllers() { controlChange(121, 0); } public void allNotesOff() { controlChange(123, 0); } public void allSoundOff() { controlChange(120, 0); } public boolean localControl(boolean bOn) { controlChange(122, bOn ? 127 : 0); return getController(122) >= 64; } public void setMono(boolean bMono) { // TODO: check this controlChange(bMono ? 126 : 127, 0); } public boolean getMono() { // TODO: check this return getController(126) == 0; } public void setOmni(boolean bOmni) { controlChange(bOmni ? 125 : 124, 0); } public boolean getOmni() { // TODO: check this return getController(125) == 0; } } /*** TMidiChannel.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/share/midi/TMidiDevice.java0000644000175000017500000002751510374113707027151 0ustar twernertwerner/* * TMidiDevice.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999 - 2006 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.share.midi; import java.util.ArrayList; import java.util.Collections; import java.util.Iterator; import java.util.List; import javax.sound.midi.InvalidMidiDataException; import javax.sound.midi.MetaMessage; import javax.sound.midi.MidiDevice; import javax.sound.midi.MidiMessage; import javax.sound.midi.MidiUnavailableException; import javax.sound.midi.Receiver; import javax.sound.midi.Transmitter; import org.tritonus.share.TDebug; /** Base class for MidiDevice implementations. * The goal of this class is to supply the common functionality for * classes that implement the interface MidiDevice. */ public abstract class TMidiDevice implements MidiDevice { /** The Info object for a certain instance of MidiDevice. */ private MidiDevice.Info m_info; /** A flag to store whether the device is "open". */ private boolean m_bDeviceOpen; /** Whether to handle input from the physical port and to allow Transmitters. */ private boolean m_bUseTransmitter; /** Whether to handle output to the physical port and to allow Receivers. */ private boolean m_bUseReceiver; /** The list of Receiver objects that belong to this * MidiDevice. * * @see #addReceiver * @see #removeReceiver */ private List m_receivers; /** The list of Transmitter objects that belong to this * MidiDevice. * * @see #addTransmitter * @see #removeTransmitter */ private List m_transmitters; /** Initialize this class. * This sets the info from the passed one, sets the open status * to false, the number of Receivers to zero and the collection * of Transmitters to be empty. * * @param info The info object that describes this instance. */ public TMidiDevice(MidiDevice.Info info) { this(info, true, true); } /** Initialize this class. * This sets the info from the passed one, sets the open status * to false, the number of Receivers to zero and the collection * of Transmitters to be empty. * * @param info The info object that describes this instance. */ public TMidiDevice(MidiDevice.Info info, boolean bUseTransmitter, boolean bUseReceiver) { m_info = info; m_bUseTransmitter = bUseTransmitter; m_bUseReceiver = bUseReceiver; m_bDeviceOpen = false; m_receivers = new ArrayList(); m_transmitters = new ArrayList(); } /** Retrieves a description of this instance. * This returns the info object passed to the constructor. * * @return the description * * @see #TMidiDevice */ public MidiDevice.Info getDeviceInfo() { return m_info; } public synchronized void open() throws MidiUnavailableException { if (TDebug.TraceMidiDevice) { TDebug.out("TMidiDevice.open(): begin"); } if (! isOpen()) { openImpl(); /* If openImpl() throws a MidiUnavailableException, m_bDeviceOpen * remains false. */ m_bDeviceOpen = true; } if (TDebug.TraceMidiDevice) { TDebug.out("TMidiDevice.open(): end"); } } /** * Subclasses have to override this method to be notified of * opening. */ protected void openImpl() throws MidiUnavailableException { if (TDebug.TraceMidiDevice) TDebug.out("TMidiDevice.openImpl(): begin"); if (TDebug.TraceMidiDevice) TDebug.out("TMidiDevice.openImpl(): end"); } public synchronized void close() { if (TDebug.TraceMidiDevice) { TDebug.out("TMidiDevice.close(): begin"); } if (isOpen()) { closeImpl(); // TODO: close all Receivers and Transmitters m_bDeviceOpen = false; } if (TDebug.TraceMidiDevice) { TDebug.out("TMidiDevice.close(): end"); } } /** * Subclasses have to override this method to be notified of * closeing. */ protected void closeImpl() { if (TDebug.TraceMidiDevice) TDebug.out("TMidiDevice.closeImpl(): begin"); if (TDebug.TraceMidiDevice) TDebug.out("TMidiDevice.closeImpl(): end"); } public boolean isOpen() { return m_bDeviceOpen; } /** Returns whether to handle input. If this is true, retrieving Transmitters is possible and input from the physical port is passed to them. @see #getUseOut */ protected boolean getUseTransmitter() { return m_bUseTransmitter; } /** Returns whether to handle output. If this is true, retrieving Receivers is possible and output to them is passed to the physical port. @see #getUseTransmitter */ protected boolean getUseReceiver() { return m_bUseReceiver; } /** Returns the device time in microseconds. This is a default implementation, telling the application program that the device doesn't track time. If a device wants to give timing information, it has to override this method. */ public long getMicrosecondPosition() { return -1; } public int getMaxReceivers() { int nMaxReceivers = 0; if (getUseReceiver()) { /* * The value -1 means unlimited. */ nMaxReceivers = -1; } return nMaxReceivers; } public int getMaxTransmitters() { int nMaxTransmitters = 0; if (getUseTransmitter()) { /* * The value -1 means unlimited. */ nMaxTransmitters = -1; } return nMaxTransmitters; } /** Creates a new Receiver object associated with this instance. * In this implementation, an unlimited number of Receivers * per MidiDevice can be created. */ public Receiver getReceiver() throws MidiUnavailableException { if (! getUseReceiver()) { throw new MidiUnavailableException("Receivers are not supported by this device"); } return new TReceiver(); } /** Creates a new Transmitter object associated with this instance. * In this implementation, an unlimited number of Transmitters * per MidiDevice can be created. */ public Transmitter getTransmitter() throws MidiUnavailableException { if (! getUseTransmitter()) { throw new MidiUnavailableException("Transmitters are not supported by this device"); } return new TTransmitter(); } public List getReceivers() { return Collections.unmodifiableList(m_receivers); } public List getTransmitters() { return Collections.unmodifiableList(m_transmitters); } /* * Intended for overriding by subclasses to receive messages. * This method is called by TMidiDevice.Receiver object on * receipt of a MidiMessage. */ protected void receive(MidiMessage message, long lTimeStamp) { if (TDebug.TraceMidiDevice) { TDebug.out("### [should be overridden] TMidiDevice.receive(): message " + message); } } protected void addReceiver(Receiver receiver) { synchronized (m_receivers) { m_receivers.add(receiver); } } protected void removeReceiver(Receiver receiver) { synchronized (m_receivers) { m_receivers.remove(receiver); } } protected void addTransmitter(Transmitter transmitter) { synchronized (m_transmitters) { m_transmitters.add(transmitter); } } protected void removeTransmitter(Transmitter transmitter) { synchronized (m_transmitters) { m_transmitters.remove(transmitter); } } /** Send a MidiMessage to all Transmitters. * This method should be called by subclasses when they get a * message from a physical MIDI port. */ protected void sendImpl(MidiMessage message, long lTimeStamp) { if (TDebug.TraceMidiDevice) { TDebug.out("TMidiDevice.sendImpl(): begin"); } Iterator transmitters = m_transmitters.iterator(); while (transmitters.hasNext()) { TTransmitter transmitter = (TTransmitter) transmitters.next(); /* due to a bug in the Sun jdk1.3, we cannot use clone() for MetaMessages. So we have to do the equivalent ourselves. */ // MidiMessage copiedMessage = (MidiMessage) message.clone(); MidiMessage copiedMessage = null; if (message instanceof MetaMessage) { MetaMessage origMessage = (MetaMessage) message; MetaMessage metaMessage = new MetaMessage(); try { metaMessage.setMessage(origMessage.getType(), origMessage.getData(), origMessage.getData().length); } catch (InvalidMidiDataException e) { if (TDebug.TraceAllExceptions) { TDebug.out(e); } } copiedMessage = metaMessage; } else { copiedMessage = (MidiMessage) message.clone(); } if (message instanceof MetaMessage) { if (TDebug.TraceMidiDevice) { TDebug.out("TMidiDevice.sendImpl(): MetaMessage.getData().length (original): " + ((MetaMessage) message).getData().length); } if (TDebug.TraceMidiDevice) { TDebug.out("TMidiDevice.sendImpl(): MetaMessage.getData().length (cloned): " + ((MetaMessage) copiedMessage).getData().length); } } transmitter.send(copiedMessage, lTimeStamp); } if (TDebug.TraceMidiDevice) { TDebug.out("TMidiDevice.sendImpl(): end"); } } /////////////////// INNER CLASSES ////////////////////////////////////// /** Receiver proxy class. * This class' objects are handed out on calls to * TMidiDevice.getReceiver(). */ public class TReceiver implements Receiver { private boolean m_bOpen; public TReceiver() { TMidiDevice.this.addReceiver(this); m_bOpen = true; } protected boolean isOpen() { return m_bOpen; } /** Receive a MidiMessage. * */ public void send(MidiMessage message, long lTimeStamp) { if (TDebug.TraceMidiDevice) { TDebug.out("TMidiDevice.TReceiver.send(): message " + message); } if (m_bOpen) { TMidiDevice.this.receive(message, lTimeStamp); } else { throw new IllegalStateException("receiver is not open"); } } /** Closes the receiver. * After a receiver has been closed, it does no longer * propagate MidiMessages to its associated MidiDevice. */ public void close() { TMidiDevice.this.removeReceiver(this); m_bOpen = false; } } public class TTransmitter implements Transmitter { private boolean m_bOpen; private Receiver m_receiver; public TTransmitter() { m_bOpen = true; TMidiDevice.this.addTransmitter(this); } public void setReceiver(Receiver receiver) { synchronized (this) { m_receiver = receiver; } } public Receiver getReceiver() { return m_receiver; } public void send(MidiMessage message, long lTimeStamp) { if (getReceiver() != null && m_bOpen) { getReceiver().send(message, lTimeStamp); } } /** Closes the transmitter. * After a transmitter has been closed, it no longer * passes MidiMessages to a Receiver previously set for * it. */ public void close() { TMidiDevice.this.removeTransmitter(this); m_bOpen = false; /* Previously, this method just set m_receiver to null instead of maintaining an open flag. This allows to exploit the behaviour of calling close(), the setReceiver() again, and the Transmitter is "reopened". TODO: write a test case for this scenario. */ } } /* * This is needed only because MidiDevice.Info's * constructor is protected (in the Sun jdk1.3). */ public static class Info extends MidiDevice.Info { public Info(String a, String b, String c, String d) { super(a, b, c, d); } } } /*** TMidiDevice.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/share/midi/TMidiFileFormat.java0000644000175000017500000000342310173661004027765 0ustar twernertwerner/* * TMidiFileFormat.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2000 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.share.midi; import javax.sound.midi.MidiFileFormat; /** A MidiFileFormat that has information about the number of tracks. * This class is used by org.tritonus.midi.file.StandardMidiFileReader. * Its purpose is to carry the number of tracks from * getMidiFileFormat() to getSequence(). */ public class TMidiFileFormat extends MidiFileFormat { private int m_nTrackCount; public TMidiFileFormat(int nType, float fDivisionType, int nResolution, int nByteLength, long lMicrosecondLength, int nTrackCount) { super(nType, fDivisionType, nResolution, nByteLength, lMicrosecondLength); m_nTrackCount = nTrackCount; } public int getTrackCount() { return m_nTrackCount; } } /*** TMidiFileFormat.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/share/midi/TPreloadingSequencer.java0000644000175000017500000000742710374074736031116 0ustar twernertwerner/* * TPreloadingSequencer.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2003 - 2004 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.share.midi; import java.util.Collection; import javax.sound.midi.MidiMessage; import javax.sound.midi.MidiDevice; import org.tritonus.share.TDebug; /** Base class for sequencers that work with an internal queue. To be more precise, this is the base class for sequencers that do not load the complete Sequence to internal data structures before start, but take single events from the Sequence and put them to the sequencing queue while running. */ public abstract class TPreloadingSequencer extends TSequencer { /** The default value for {@link m_nLatency}. This default value is set in the constructor. */ private static final int DEFAULT_LATENCY = 100; /** */ private int m_nLatency; private Thread m_loaderThread; /** Sets the latency to the default value. */ protected TPreloadingSequencer(MidiDevice.Info info, Collection masterSyncModes, Collection slaveSyncModes) { super(info, masterSyncModes, slaveSyncModes); if (TDebug.TraceSequencer) { TDebug.out("TPreloadingSequencer.(): begin"); } m_nLatency = DEFAULT_LATENCY; if (TDebug.TraceSequencer) { TDebug.out("TPreloadingSequencer.(): end"); } } /** Sets the preloading intervall. This is the time span between preloading events to an internal queue and playing them. This intervall should be kept constant by the implementation. However, this cannot be guaranteed. */ public void setLatency(int nLatency) { // TODO: preload if latency becomes shorter m_nLatency = nLatency; } /** Get the preloading intervall. @return the preloading intervall in milliseconds, or -1 if the sequencer doesn't repond to changes in the Sequence at all. */ public int getLatency() { return m_nLatency; } // currently not called by subclasses. order has to be assured (subclass first) protected void openImpl() { if (TDebug.TraceSequencer) { TDebug.out("AlsaSequencer.openImpl(): begin"); } // m_loaderThread = new LoaderThread(); // m_loaderThread.start(); } /** Put a message into the queue. This is Claus-Dieter's special method: it puts the message to the ALSA queue for delivery at the specified time. The time has to be given in ticks according to the resolution of the currently active Sequence. For this method to work, the Sequencer has to be started. The message is delivered the same way as messages from a Sequence, i.e. to all registered Transmitters. If the current queue position (as returned by getTickPosition()) is already behind the desired schedule time, the message is ignored. @param message the MidiMessage to put into the queue. @param lTick the desired schedule time in ticks. */ public abstract void sendMessageTick(MidiMessage message, long lTick); } /*** TPreloadingSequencer.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/share/midi/TSequencer.java0000644000175000017500000004154410173661004027072 0ustar twernertwerner/* * TSequencer.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999 - 2003 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.share.midi; import java.io.InputStream; import java.io.IOException; import java.util.BitSet; import java.util.Collection; import java.util.Iterator; import java.util.Set; import javax.sound.midi.MidiSystem; import javax.sound.midi.Sequencer; import javax.sound.midi.Sequence; import javax.sound.midi.InvalidMidiDataException; import javax.sound.midi.MetaMessage; import javax.sound.midi.MetaEventListener; import javax.sound.midi.MidiMessage; import javax.sound.midi.ShortMessage; import javax.sound.midi.ControllerEventListener; import javax.sound.midi.MidiDevice; import org.tritonus.share.TDebug; import org.tritonus.share.ArraySet; public abstract class TSequencer extends TMidiDevice implements Sequencer { private static final float MPQ_BPM_FACTOR = 6.0E7F; // This is for use in Collection.toArray(Object[]). private static final SyncMode[] EMPTY_SYNCMODE_ARRAY = new SyncMode[0]; private boolean m_bRunning; /** The Sequence to play or to record to. */ private Sequence m_sequence; /** The listeners that want to be notified of MetaMessages. */ private Set m_metaListeners; /** The listeners that want to be notified of control change events. * They are organized as follows: this array is indexed with * the number of the controller change events listeners are * interested in. If there is any interest, the array element * contains a reference to a Set containing the listeners. * These sets are allocated on demand. */ private Set[] m_aControllerListeners; private float m_fNominalTempoInMPQ; private float m_fTempoFactor; private Collection m_masterSyncModes; private Collection m_slaveSyncModes; private SyncMode m_masterSyncMode; private SyncMode m_slaveSyncMode; private BitSet m_muteBitSet; private BitSet m_soloBitSet; /** Contains the enabled state of the tracks. This BitSet holds the pre-calculated effect of mute and solo status. */ private BitSet m_enabledBitSet; /** Start of the loop in ticks. */ private long m_lLoopStartPoint; /** End of the loop in ticks. */ private long m_lLoopEndPoint; /** Loop count. */ private int m_nLoopCount; /** */ protected TSequencer(MidiDevice.Info info, Collection masterSyncModes, Collection slaveSyncModes) { super(info); m_bRunning = false; m_sequence = null; m_metaListeners = new ArraySet(); m_aControllerListeners = (Set[]) new Set[128]; setTempoFactor(1.0F); setTempoInMPQ(500000); // TODO: make a copy m_masterSyncModes = masterSyncModes; m_slaveSyncModes = slaveSyncModes; if (getMasterSyncModes().length > 0) { m_masterSyncMode = getMasterSyncModes()[0]; } if (getSlaveSyncModes().length > 0) { m_slaveSyncMode = getSlaveSyncModes()[0]; } m_muteBitSet = new BitSet(); m_soloBitSet = new BitSet(); m_enabledBitSet = new BitSet(); updateEnabled(); setLoopStartPoint(0); setLoopEndPoint(-1); setLoopCount(0); } public void setSequence(Sequence sequence) throws InvalidMidiDataException { // TODO: what if playing is in progress? if (getSequence() != sequence) { m_sequence = sequence; setSequenceImpl(); /* Yes, resetting the tempo factor is required by the specification. TODO: can't find this any more in the spec. It is unclear whether this should be executed in any case (even if in fact the sequence didn't change). */ setTempoFactor(1.0F); } } /** Set Sequence. Subclasses that need to be informed when a Sequence is set should override this method. It is called by setSequence(). Subclasses can find out the new Sequence by calling getSequence(). */ // TODO: make abstract protected void setSequenceImpl() { } public void setSequence(InputStream inputStream) throws InvalidMidiDataException, IOException { Sequence sequence = MidiSystem.getSequence(inputStream); setSequence(sequence); } public Sequence getSequence() { return m_sequence; } public void setLoopStartPoint(long lTick) { m_lLoopStartPoint = lTick; } public long getLoopStartPoint() { return m_lLoopStartPoint; } public void setLoopEndPoint(long lTick) { m_lLoopEndPoint = lTick; } public long getLoopEndPoint() { return m_lLoopEndPoint; } public void setLoopCount(int nLoopCount) { m_nLoopCount = nLoopCount; } public int getLoopCount() { return m_nLoopCount; } public synchronized void start() { checkOpen(); if (! isRunning()) { m_bRunning = true; // TODO: perhaps check if sequence present startImpl(); } } /** * Subclasses have to override this method to be notified of * starting. */ protected void startImpl() { } public synchronized void stop() { checkOpen(); if (isRunning()) { stopImpl(); m_bRunning = false; } } /** * Subclasses have to override this method to be notified of * stopping. */ protected void stopImpl() { } public synchronized boolean isRunning() { return m_bRunning; } /** Checks if the Sequencer is open. This method is intended to be called by {@link javax.sound.midi.Sequencer#start start}, {@link javax.sound.midi.Sequencer#stop stop}, {@link javax.sound.midi.Sequencer#startRecording startRecording} and {@link javax.sound.midi.Sequencer#stop stopRecording}. @throws IllegalStateException if the Sequencer is not open */ protected void checkOpen() { if (! isOpen()) { throw new IllegalStateException("Sequencer is not open"); } } /** Returns the resolution (ticks per quarter) of the current sequence. If no sequence is set, a bogus default value != 0 is returned. */ protected int getResolution() { Sequence sequence = getSequence(); int nResolution; if (sequence != null) { nResolution = sequence.getResolution(); } else { nResolution = 1; } return nResolution; } protected void setRealTempo() { float fTempoFactor = getTempoFactor(); if (fTempoFactor == 0.0F) { fTempoFactor = 0.01F; } float fRealTempo = getTempoInMPQ() / fTempoFactor; if (TDebug.TraceSequencer) { TDebug.out("TSequencer.setRealTempo(): real tempo: " + fRealTempo); } setTempoImpl(fRealTempo); } public float getTempoInBPM() { float fBPM = MPQ_BPM_FACTOR / getTempoInMPQ(); return fBPM; } public void setTempoInBPM(float fBPM) { float fMPQ = MPQ_BPM_FACTOR / fBPM; setTempoInMPQ(fMPQ); } public float getTempoInMPQ() { return m_fNominalTempoInMPQ; } /** Sets the tempo. Implementation classes are required to call this method for changing the tempo in reaction to a tempo change event. */ public void setTempoInMPQ(float fMPQ) { m_fNominalTempoInMPQ = fMPQ; setRealTempo(); } public void setTempoFactor(float fFactor) { m_fTempoFactor = fFactor; setRealTempo(); } public float getTempoFactor() { return m_fTempoFactor; } /** Change the tempo of the native sequencer part. * This method has to be defined by subclasses according * to the native facilities they use for sequenceing. * The implementation should not take into account the * tempo factor. This is handled elsewhere. */ protected abstract void setTempoImpl(float fMPQ); // NOTE: has to be redefined if recording is done natively public long getTickLength() { long lLength = 0; if (getSequence() != null) { lLength = getSequence().getTickLength(); } return lLength; } // NOTE: has to be redefined if recording is done natively public long getMicrosecondLength() { long lLength = 0; if (getSequence() != null) { lLength = getSequence().getMicrosecondLength(); } return lLength; } public boolean addMetaEventListener(MetaEventListener listener) { synchronized (m_metaListeners) { return m_metaListeners.add(listener); } } public void removeMetaEventListener(MetaEventListener listener) { synchronized (m_metaListeners) { m_metaListeners.remove(listener); } } protected Iterator getMetaEventListeners() { synchronized (m_metaListeners) { return m_metaListeners.iterator(); } } protected void sendMetaMessage(MetaMessage message) { Iterator iterator = getMetaEventListeners(); while (iterator.hasNext()) { MetaEventListener metaEventListener = iterator.next(); MetaMessage copiedMessage = (MetaMessage) message.clone(); metaEventListener.meta(copiedMessage); } } public int[] addControllerEventListener(ControllerEventListener listener, int[] anControllers) { synchronized (m_aControllerListeners) { if (anControllers == null) { /* * Add to all controllers. NOTE: this * is an implementation-specific * semantic! */ for (int i = 0; i < 128; i++) { addControllerListener(i, listener); } } else { for (int i = 0; i < anControllers.length; i++) { addControllerListener(anControllers[i], listener); } } } return getListenedControllers(listener); } private void addControllerListener(int i, ControllerEventListener listener) { if (m_aControllerListeners[i] == null) { m_aControllerListeners[i] = new ArraySet(); } m_aControllerListeners[i].add(listener); } public int[] removeControllerEventListener(ControllerEventListener listener, int[] anControllers) { synchronized (m_aControllerListeners) { if (anControllers == null) { /* * Remove from all controllers. Unlike * above, this is specified semantics. */ for (int i = 0; i < 128; i++) { removeControllerListener(i, listener); } } else { for (int i = 0; i < anControllers.length; i++) { removeControllerListener(anControllers[i], listener); } } } return getListenedControllers(listener); } private void removeControllerListener(int i, ControllerEventListener listener) { if (m_aControllerListeners[i] != null) { m_aControllerListeners[i].add(listener); } } private int[] getListenedControllers(ControllerEventListener listener) { int[] anControllers = new int[128]; int nIndex = 0; // points to the next position to use. for (int nController = 0; nController < 128; nController++) { if (m_aControllerListeners[nController] != null && m_aControllerListeners[nController].contains(listener)) { anControllers[nIndex] = nController; nIndex++; } } int[] anResultControllers = new int[nIndex]; System.arraycopy(anControllers, 0, anResultControllers, 0, nIndex); return anResultControllers; } protected void sendControllerEvent(ShortMessage message) { int nController = message.getData1(); if (m_aControllerListeners[nController] != null) { Iterator iterator = m_aControllerListeners[nController].iterator(); while (iterator.hasNext()) { ControllerEventListener controllerEventListener = iterator.next(); ShortMessage copiedMessage = (ShortMessage) message.clone(); controllerEventListener.controlChange(copiedMessage); } } } protected void notifyListeners(MidiMessage message) { if (message instanceof MetaMessage) { // IDEA: use extra thread for event delivery sendMetaMessage((MetaMessage) message); } else if (message instanceof ShortMessage && ((ShortMessage) message).getCommand() == ShortMessage.CONTROL_CHANGE) { sendControllerEvent((ShortMessage) message); } } public SyncMode getMasterSyncMode() { return m_masterSyncMode; } public void setMasterSyncMode(SyncMode syncMode) { if (m_masterSyncModes.contains(syncMode)) { if (! getMasterSyncMode().equals(syncMode)) { m_masterSyncMode = syncMode; setMasterSyncModeImpl(syncMode); } } else { throw new IllegalArgumentException("sync mode not allowed: " + syncMode); } } /* This method is guaranteed only to be called if the sync mode really changes. */ protected void setMasterSyncModeImpl(SyncMode syncMode) { // DO NOTHING } public SyncMode[] getMasterSyncModes() { SyncMode[] syncModes = m_masterSyncModes.toArray(EMPTY_SYNCMODE_ARRAY); return syncModes; } public SyncMode getSlaveSyncMode() { return m_slaveSyncMode; } public void setSlaveSyncMode(SyncMode syncMode) { if (m_slaveSyncModes.contains(syncMode)) { if (! getSlaveSyncMode().equals(syncMode)) { m_slaveSyncMode = syncMode; setSlaveSyncModeImpl(syncMode); } } else { throw new IllegalArgumentException("sync mode not allowed: " + syncMode); } } /* This method is guaranteed only to be called if the sync mode really changes. */ protected void setSlaveSyncModeImpl(SyncMode syncMode) { // DO NOTHING } public SyncMode[] getSlaveSyncModes() { SyncMode[] syncModes = m_slaveSyncModes.toArray(EMPTY_SYNCMODE_ARRAY); return syncModes; } public boolean getTrackSolo(int nTrack) { boolean bSoloed = false; if (getSequence() != null) { if (nTrack < getSequence().getTracks().length) { bSoloed = m_soloBitSet.get(nTrack); } } return bSoloed; } public void setTrackSolo(int nTrack, boolean bSolo) { if (getSequence() != null) { if (nTrack < getSequence().getTracks().length) { boolean bOldState = m_soloBitSet.get(nTrack); if (bSolo != bOldState) { if (bSolo) { m_soloBitSet.set(nTrack); } else { m_soloBitSet.clear(nTrack); } updateEnabled(); setTrackSoloImpl(nTrack, bSolo); } } } } protected void setTrackSoloImpl(int nTrack, boolean bSolo) { } public boolean getTrackMute(int nTrack) { boolean bMuted = false; if (getSequence() != null) { if (nTrack < getSequence().getTracks().length) { bMuted = m_muteBitSet.get(nTrack); } } return bMuted; } public void setTrackMute(int nTrack, boolean bMute) { if (getSequence() != null) { if (nTrack < getSequence().getTracks().length) { boolean bOldState = m_muteBitSet.get(nTrack); if (bMute != bOldState) { if (bMute) { m_muteBitSet.set(nTrack); } else { m_muteBitSet.clear(nTrack); } updateEnabled(); setTrackMuteImpl(nTrack, bMute); } } } } protected void setTrackMuteImpl(int nTrack, boolean bMute) { } private void updateEnabled() { BitSet oldEnabledBitSet = (BitSet) m_enabledBitSet.clone(); boolean bSoloExists = m_soloBitSet.length() > 0; if (bSoloExists) { m_enabledBitSet = (BitSet) m_soloBitSet.clone(); } else { for (int i = 0; i < m_muteBitSet.size(); i++) { if (m_muteBitSet.get(i)) { m_enabledBitSet.clear(i); } else { m_enabledBitSet.set(i); } } } oldEnabledBitSet.xor(m_enabledBitSet); /* oldEnabledBitSet now has a bit set if the status for this bit changed. */ for (int i = 0; i < oldEnabledBitSet.size(); i++) { if (oldEnabledBitSet.get(i)) { setTrackEnabledImpl(i, m_enabledBitSet.get(i)); } } } /** Shows that a track state has changed. This method is called for each track where the enabled state (calculated from mute and solo) has changed. The boolean value passed represents the new state. @param nTrack The track number for which the enabled status has changed. @param bEnabled The new enabled state for this track. */ protected void setTrackEnabledImpl(int nTrack, boolean bEnabled) { } protected boolean isTrackEnabled(int nTrack) { return m_enabledBitSet.get(nTrack); } /** Sets the preloading intervall. This is the time span between preloading events to an internal queue and playing them. This intervall should be kept constant by the implementation. However, this cannot be guaranteed. */ public void setLatency(int nMilliseconds) { } /** Get the preloading intervall. @return the preloading intervall in milliseconds, or -1 if the sequencer doesn't repond to changes in the Sequence at all. */ public int getLatency() { return -1; } } /*** TSequencer.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/share/midi/package.html0000644000175000017500000000053010173661004026420 0ustar twernertwerner

Base classes and helper classes for the implementation of MIDI stuff. The classes provided here .

@see org.tritonus.midi.device.alsa @see org.tritonus.midi.device.java @see org.tritonus.midi.file libtritonus-java-20070428/src/classes/org/tritonus/share/ArraySet.java0000644000175000017500000000336110540342761025623 0ustar twernertwerner/* * ArraySet.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999 -2004 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.share; import java.util.ArrayList; import java.util.Collection; import java.util.Set; public class ArraySet extends ArrayList implements Set { private static final long serialVersionUID = 1; public ArraySet() { super(); } public ArraySet(Collection c) { this(); addAll(c); } public boolean add(E element) { if (!contains(element)) { super.add(element); return true; } else { return false; } } public void add(int index, E element) { throw new UnsupportedOperationException("ArraySet.add(int index, Object element) unsupported"); } public E set(int index, E element) { throw new UnsupportedOperationException("ArraySet.set(int index, Object element) unsupported"); } } /*** ArraySet.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/share/GlobalInfo.java0000644000175000017500000000247210374074736026120 0ustar twernertwerner/* * GlobalInfo.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2000 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.share; public class GlobalInfo { private static final String VENDOR = "Tritonus is free software. See http://www.tritonus.org/"; private static final String VERSION = "0.3.1"; public static String getVendor() { return VENDOR; } public static String getVersion() { return VERSION; } } /*** GlobalInfo.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/share/StringHashedSet.java0000644000175000017500000000535210540343006027123 0ustar twernertwerner/* * StringHashedSet.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2000 by Florian Bomers * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.share; import java.util.Collection; import java.util.Iterator; import org.tritonus.share.ArraySet; /** * A set where the elements are uniquely referenced by their * string representation as given by the objects toString() * method. No 2 objects with the same toString() can * be in the set. *

* The contains(Object elem) and get(Object elem) * methods can be called with Strings as elem parameter. * For get(Object elem), the object that has been added * is returned, and not its String representation. *

* Though it's possible to store * Strings as objects in this class, it doesn't make sense * as you could use ArraySet for that equally well. *

* You shouldn't use the ArrayList specific functions * like those that take index parameters. *

* It is not possible to add null elements. */ public class StringHashedSet extends ArraySet { private static final long serialVersionUID = 1; public StringHashedSet() { super(); } public StringHashedSet(Collection c) { super(c); } public boolean add(E elem) { if (elem==null) { return false; } return super.add(elem); } public boolean contains(Object elem) { if (elem==null) { return false; } String comp=elem.toString(); Iterator it=iterator(); while (it.hasNext()) { if (comp.equals(it.next().toString())) { return true; } } return false; } public E get(Object elem) { if (elem==null) { return null; } String comp=elem.toString(); Iterator it=iterator(); while (it.hasNext()) { E thisElem=it.next(); if (comp.equals(thisElem.toString())) { return thisElem; } } return null; } } /*** StringHashedSet.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/share/TCircularBuffer.java0000644000175000017500000001304310173661004027105 0ustar twernertwerner/* * TCircularBuffer.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.share; import org.tritonus.share.TDebug; public class TCircularBuffer { private boolean m_bBlockingRead; private boolean m_bBlockingWrite; private byte[] m_abData; private int m_nSize; private long m_lReadPos; private long m_lWritePos; private Trigger m_trigger; private boolean m_bOpen; public TCircularBuffer(int nSize, boolean bBlockingRead, boolean bBlockingWrite, Trigger trigger) { m_bBlockingRead = bBlockingRead; m_bBlockingWrite = bBlockingWrite; m_nSize = nSize; m_abData = new byte[m_nSize]; m_lReadPos = 0; m_lWritePos = 0; m_trigger = trigger; m_bOpen = true; } public void close() { m_bOpen = false; // TODO: call notify() ? } private boolean isOpen() { return m_bOpen; } public int availableRead() { return (int) (m_lWritePos - m_lReadPos); } public int availableWrite() { return m_nSize - availableRead(); } private int getReadPos() { return (int) (m_lReadPos % m_nSize); } private int getWritePos() { return (int) (m_lWritePos % m_nSize); } public int read(byte[] abData) { return read(abData, 0, abData.length); } public int read(byte[] abData, int nOffset, int nLength) { if (TDebug.TraceCircularBuffer) { TDebug.out(">TCircularBuffer.read(): called."); dumpInternalState(); } if (! isOpen()) { if (availableRead() > 0) { nLength = Math.min(nLength, availableRead()); if (TDebug.TraceCircularBuffer) { TDebug.out("reading rest in closed buffer, length: " + nLength); } } else { if (TDebug.TraceCircularBuffer) { TDebug.out("< not open. returning -1."); } return -1; } } synchronized (this) { if (m_trigger != null && availableRead() < nLength) { if (TDebug.TraceCircularBuffer) { TDebug.out("executing trigger."); } m_trigger.execute(); } if (!m_bBlockingRead) { nLength = Math.min(availableRead(), nLength); } int nRemainingBytes = nLength; while (nRemainingBytes > 0) { while (availableRead() == 0) { try { wait(); } catch (InterruptedException e) { if (TDebug.TraceAllExceptions) { TDebug.out(e); } } } int nAvailable = Math.min(availableRead(), nRemainingBytes); while (nAvailable > 0) { int nToRead = Math.min(nAvailable, m_nSize - getReadPos()); System.arraycopy(m_abData, getReadPos(), abData, nOffset, nToRead); m_lReadPos += nToRead; nOffset += nToRead; nAvailable -= nToRead; nRemainingBytes -= nToRead; } notifyAll(); } if (TDebug.TraceCircularBuffer) { TDebug.out("After read:"); dumpInternalState(); TDebug.out("< completed. Read " + nLength + " bytes"); } return nLength; } } public int write(byte[] abData) { return write(abData, 0, abData.length); } public int write(byte[] abData, int nOffset, int nLength) { if (TDebug.TraceCircularBuffer) { TDebug.out(">TCircularBuffer.write(): called; nLength: " + nLength); dumpInternalState(); } synchronized (this) { if (TDebug.TraceCircularBuffer) { TDebug.out("entered synchronized block."); } if (!m_bBlockingWrite) { nLength = Math.min(availableWrite(), nLength); } int nRemainingBytes = nLength; while (nRemainingBytes > 0) { while (availableWrite() == 0) { try { wait(); } catch (InterruptedException e) { if (TDebug.TraceAllExceptions) { TDebug.out(e); } } } int nAvailable = Math.min(availableWrite(), nRemainingBytes); while (nAvailable > 0) { int nToWrite = Math.min(nAvailable, m_nSize - getWritePos()); //TDebug.out("src buf size= " + abData.length + ", offset = " + nOffset + ", dst buf size=" + m_abData.length + " write pos=" + getWritePos() + " len=" + nToWrite); System.arraycopy(abData, nOffset, m_abData, getWritePos(), nToWrite); m_lWritePos += nToWrite; nOffset += nToWrite; nAvailable -= nToWrite; nRemainingBytes -= nToWrite; } notifyAll(); } if (TDebug.TraceCircularBuffer) { TDebug.out("After write:"); dumpInternalState(); TDebug.out("< completed. Wrote "+nLength+" bytes"); } return nLength; } } private void dumpInternalState() { TDebug.out("m_lReadPos = " + m_lReadPos + " ^= "+getReadPos()); TDebug.out("m_lWritePos = " + m_lWritePos + " ^= "+getWritePos()); TDebug.out("availableRead() = " + availableRead()); TDebug.out("availableWrite() = " + availableWrite()); } public static interface Trigger { public void execute(); } } /*** TCircularBuffer.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/share/TDebug.java0000644000175000017500000001561510540343006025241 0ustar twernertwerner/* * TDebug.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999 - 2002 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.share; import java.io.PrintStream; import java.util.StringTokenizer; import java.security.AccessControlException; public class TDebug { public static boolean SHOW_ACCESS_CONTROL_EXCEPTIONS = false; private static final String PROPERTY_PREFIX = "tritonus."; // The stream we output to public static PrintStream m_printStream = System.out; private static String indent=""; // meta-general public static boolean TraceAllExceptions = getBooleanProperty("TraceAllExceptions"); public static boolean TraceAllWarnings = getBooleanProperty("TraceAllWarnings"); // general public static boolean TraceInit = getBooleanProperty("TraceInit"); public static boolean TraceCircularBuffer = getBooleanProperty("TraceCircularBuffer"); public static boolean TraceService = getBooleanProperty("TraceService"); // sampled common implementation public static boolean TraceAudioSystem = getBooleanProperty("TraceAudioSystem"); public static boolean TraceAudioConfig = getBooleanProperty("TraceAudioConfig"); public static boolean TraceAudioInputStream = getBooleanProperty("TraceAudioInputStream"); public static boolean TraceMixerProvider = getBooleanProperty("TraceMixerProvider"); public static boolean TraceControl = getBooleanProperty("TraceControl"); public static boolean TraceLine = getBooleanProperty("TraceLine"); public static boolean TraceDataLine = getBooleanProperty("TraceDataLine"); public static boolean TraceMixer = getBooleanProperty("TraceMixer"); public static boolean TraceSourceDataLine = getBooleanProperty("TraceSourceDataLine"); public static boolean TraceTargetDataLine = getBooleanProperty("TraceTargetDataLine"); public static boolean TraceClip = getBooleanProperty("TraceClip"); public static boolean TraceAudioFileReader = getBooleanProperty("TraceAudioFileReader"); public static boolean TraceAudioFileWriter = getBooleanProperty("TraceAudioFileWriter"); public static boolean TraceAudioConverter = getBooleanProperty("TraceAudioConverter"); public static boolean TraceAudioOutputStream = getBooleanProperty("TraceAudioOutputStream"); // sampled specific implementation public static boolean TraceEsdNative = getBooleanProperty("TraceEsdNative"); public static boolean TraceEsdStreamNative = getBooleanProperty("TraceEsdStreamNative"); public static boolean TraceEsdRecordingStreamNative = getBooleanProperty("TraceEsdRecordingStreamNative"); public static boolean TraceAlsaNative = getBooleanProperty("TraceAlsaNative"); public static boolean TraceAlsaMixerNative = getBooleanProperty("TraceAlsaMixerNative"); public static boolean TraceAlsaPcmNative = getBooleanProperty("TraceAlsaPcmNative"); public static boolean TraceMixingAudioInputStream = getBooleanProperty("TraceMixingAudioInputStream"); public static boolean TraceOggNative = getBooleanProperty("TraceOggNative"); public static boolean TraceVorbisNative = getBooleanProperty("TraceVorbisNative"); // midi common implementation public static boolean TraceMidiSystem = getBooleanProperty("TraceMidiSystem"); public static boolean TraceMidiConfig = getBooleanProperty("TraceMidiConfig"); public static boolean TraceMidiDeviceProvider = getBooleanProperty("TraceMidiDeviceProvider"); public static boolean TraceSequencer = getBooleanProperty("TraceSequencer"); public static boolean TraceSynthesizer = getBooleanProperty("TraceSynthesizer"); public static boolean TraceMidiDevice = getBooleanProperty("TraceMidiDevice"); // midi specific implementation public static boolean TraceAlsaSeq = getBooleanProperty("TraceAlsaSeq"); public static boolean TraceAlsaSeqDetails = getBooleanProperty("TraceAlsaSeqDetails"); public static boolean TraceAlsaSeqNative = getBooleanProperty("TraceAlsaSeqNative"); public static boolean TracePortScan = getBooleanProperty("TracePortScan"); public static boolean TraceAlsaMidiIn = getBooleanProperty("TraceAlsaMidiIn"); public static boolean TraceAlsaMidiOut = getBooleanProperty("TraceAlsaMidiOut"); public static boolean TraceAlsaMidiChannel = getBooleanProperty("TraceAlsaMidiChannel"); public static boolean TraceFluidNative = getBooleanProperty("TraceFluidNative"); // misc public static boolean TraceAlsaCtlNative = getBooleanProperty("TraceAlsaCtlNative"); public static boolean TraceCdda = getBooleanProperty("TraceCdda"); public static boolean TraceCddaNative = getBooleanProperty("TraceCddaNative"); // make this method configurable to write to file, write to stderr,... public static void out(String strMessage) { if (strMessage.length()>0 && strMessage.charAt(0)=='<') { if (indent.length()>2) { indent=indent.substring(2); } else { indent=""; } } String newMsg=null; if (indent!="" && strMessage.indexOf("\n")>=0) { newMsg=""; StringTokenizer tokenizer=new StringTokenizer(strMessage, "\n"); while (tokenizer.hasMoreTokens()) { newMsg+=indent+tokenizer.nextToken()+"\n"; } } else { newMsg=indent+strMessage; } m_printStream.println(newMsg); if (strMessage.length()>0 && strMessage.charAt(0)=='>') { indent+=" "; } } public static void out(Throwable throwable) { throwable.printStackTrace(m_printStream); } public static void assertion(boolean bAssertion) { if (!bAssertion) { throw new AssertException(); } } public static class AssertException extends RuntimeException { private static final long serialVersionUID = 1; public AssertException() { } public AssertException(String sMessage) { super(sMessage); } } private static boolean getBooleanProperty(String strName) { String strPropertyName = PROPERTY_PREFIX + strName; String strValue = "false"; try { strValue = System.getProperty(strPropertyName, "false"); } catch (AccessControlException e) { if (SHOW_ACCESS_CONTROL_EXCEPTIONS) { out(e); } } // TDebug.out("property: " + strPropertyName + "=" + strValue); boolean bValue = strValue.toLowerCase().equals("true"); // TDebug.out("bValue: " + bValue); return bValue; } } /*** TDebug.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/share/TNotifier.java0000644000175000017500000000555310173661004025775 0ustar twernertwerner/* * TNotifier.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.share; import java.util.EventObject; import java.util.Collection; import java.util.ArrayList; import java.util.List; import java.util.Iterator; import javax.sound.sampled.LineListener; import javax.sound.sampled.LineEvent; public class TNotifier extends Thread { public static class NotifyEntry { private EventObject m_event; private List m_listeners; public NotifyEntry(EventObject event, Collection listeners) { m_event = event; m_listeners = new ArrayList(listeners); } public void deliver() { // TDebug.out("%% TNotifier.NotifyEntry.deliver(): called."); Iterator iterator = m_listeners.iterator(); while (iterator.hasNext()) { LineListener listener = iterator.next(); listener.update((LineEvent) m_event); } } } public static TNotifier notifier = null; static { notifier = new TNotifier(); notifier.setDaemon(true); notifier.start(); } /** The queue of events to deliver. * The entries are of class NotifyEntry. */ private List m_entries; public TNotifier() { super("Tritonus Notifier"); m_entries = new ArrayList(); } public void addEntry(EventObject event, Collection listeners) { // TDebug.out("%% TNotifier.addEntry(): called."); synchronized (m_entries) { m_entries.add(new NotifyEntry(event, listeners)); m_entries.notifyAll(); } // TDebug.out("%% TNotifier.addEntry(): completed."); } public void run() { while (true) { NotifyEntry entry = null; synchronized (m_entries) { while (m_entries.size() == 0) { try { m_entries.wait(); } catch (InterruptedException e) { if (TDebug.TraceAllExceptions) { TDebug.out(e); } } } entry = m_entries.remove(0); } entry.deliver(); } } } /*** TNotifier.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/share/TSettings.java0000644000175000017500000000352110374074736026024 0ustar twernertwerner/* * TSettings.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999 - 2001 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.share; import java.security.AccessControlException; import org.tritonus.share.TDebug; public class TSettings { public static boolean SHOW_ACCESS_CONTROL_EXCEPTIONS = false; private static final String PROPERTY_PREFIX = "tritonus."; public static boolean AlsaUsePlughw = getBooleanProperty("AlsaUsePlughw"); private static boolean getBooleanProperty(String strName) { String strPropertyName = PROPERTY_PREFIX + strName; String strValue = "false"; try { strValue = System.getProperty(strPropertyName, "false"); } catch (AccessControlException e) { if (SHOW_ACCESS_CONTROL_EXCEPTIONS) { TDebug.out(e); } } // TDebug.out("property: " + strPropertyName + "=" + strValue); boolean bValue = strValue.toLowerCase().equals("true"); // TDebug.out("bValue: " + bValue); return bValue; } } /*** TSettings.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/share/package.html0000644000175000017500000000027010173661004025477 0ustar twernertwerner

Misc helper classes. The classes provided here .

libtritonus-java-20070428/src/classes/org/tritonus/share/sampled/0000755000175000017500000000000010621572527024655 5ustar twernertwernerlibtritonus-java-20070428/src/classes/org/tritonus/share/sampled/convert/0000755000175000017500000000000010621572515026332 5ustar twernertwerner././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootlibtritonus-java-20070428/src/classes/org/tritonus/share/sampled/convert/TAsynchronousFilteredAudioInputStream.javalibtritonus-java-20070428/src/classes/org/tritonus/share/sampled/convert/TAsynchronousFilteredAudioI0000644000175000017500000001505210374074736033660 0ustar twernertwerner/* * TAsynchronousFilteredAudioInputStream.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999, 2000 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.share.sampled.convert; import java.io.ByteArrayInputStream; import java.io.IOException; import javax.sound.sampled.AudioFormat; import org.tritonus.share.TDebug; import org.tritonus.share.TCircularBuffer; /** Base class for asynchronus converters. This class serves as base class for converters that do not have a fixed ratio between the size of a block of input data and the size of a block of output data. These types of converters therefore need an internal buffer, which is realized in this class. @author Matthias Pfisterer */ public abstract class TAsynchronousFilteredAudioInputStream extends TAudioInputStream implements TCircularBuffer.Trigger { private static final int DEFAULT_BUFFER_SIZE = 327670; private static final int DEFAULT_MIN_AVAILABLE = 4096; private static final byte[] EMPTY_BYTE_ARRAY = new byte[0]; private TCircularBuffer m_circularBuffer; private int m_nMinAvailable; private byte[] m_abSingleByte; /** Constructor. This constructor uses the default buffer size and the default min available amount. @param lLength length of this stream in frames. May be AudioSystem.NOT_SPECIFIED. */ public TAsynchronousFilteredAudioInputStream(AudioFormat outputFormat, long lLength) { this(outputFormat, lLength, DEFAULT_BUFFER_SIZE, DEFAULT_MIN_AVAILABLE); } /** Constructor. With this constructor, the buffer size and the minimum available amount can be specified as parameters. @param lLength length of this stream in frames. May be AudioSystem.NOT_SPECIFIED. @param nBufferSize size of the circular buffer in bytes. */ public TAsynchronousFilteredAudioInputStream( AudioFormat outputFormat, long lLength, int nBufferSize, int nMinAvailable) { /* The usage of a ByteArrayInputStream is a hack. * (the infamous "JavaOne hack", because I did it on June * 6th 2000 in San Francisco, only hours before a * JavaOne session where I wanted to show mp3 playback * with Java Sound.) It is necessary because in the FCS * version of the Sun jdk1.3, the constructor of * AudioInputStream throws an exception if its first * argument is null. So we have to pass a dummy non-null * value. */ super(new ByteArrayInputStream(EMPTY_BYTE_ARRAY), outputFormat, lLength); if (TDebug.TraceAudioConverter) { TDebug.out("TAsynchronousFilteredAudioInputStream.(): begin"); } m_circularBuffer = new TCircularBuffer( nBufferSize, false, // blocking read true, // blocking write this); // trigger m_nMinAvailable = nMinAvailable; if (TDebug.TraceAudioConverter) { TDebug.out("TAsynchronousFilteredAudioInputStream.(): end"); } } /** Returns the circular buffer. */ protected TCircularBuffer getCircularBuffer() { return m_circularBuffer; } /** Check if writing more data to the circular buffer is recommanded. This checks the available write space in the circular buffer against the minimum available property. If the available write space is greater than th minimum available property, more writing is encouraged, so this method returns true. Note that this is only a hint to subclasses. However, it is an important hint. @return true if more writing to the circular buffer is recommanden. Otherwise, false is returned. */ protected boolean writeMore() { return getCircularBuffer().availableWrite() > m_nMinAvailable; } public int read() throws IOException { // if (TDebug.TraceAudioConverter) { TDebug.out("TAsynchronousFilteredAudioInputStream.read(): begin"); } int nByte = -1; if (m_abSingleByte == null) { m_abSingleByte = new byte[1]; } int nReturn = read(m_abSingleByte); if (nReturn == -1) { nByte = -1; } else { //$$fb 2001-04-14 nobody really knows that... nByte = m_abSingleByte[0] & 0xFF; } // if (TDebug.TraceAudioConverter) { TDebug.out("TAsynchronousFilteredAudioInputStream.read(): end"); } return nByte; } public int read(byte[] abData) throws IOException { if (TDebug.TraceAudioConverter) { TDebug.out("TAsynchronousFilteredAudioInputStream.read(byte[]): begin"); } int nRead = read(abData, 0, abData.length); if (TDebug.TraceAudioConverter) { TDebug.out("TAsynchronousFilteredAudioInputStream.read(byte[]): end"); } return nRead; } public int read(byte[] abData, int nOffset, int nLength) throws IOException { if (TDebug.TraceAudioConverter) { TDebug.out("TAsynchronousFilteredAudioInputStream.read(byte[], int, int): begin"); } //$$fb 2001-04-22: this returns at maximum circular buffer // length. This is not very efficient... //$$fb 2001-04-25: we should check that we do not exceed getFrameLength() ! int nRead = m_circularBuffer.read(abData, nOffset, nLength); if (TDebug.TraceAudioConverter) { TDebug.out("TAsynchronousFilteredAudioInputStream.read(byte[], int, int): end"); } return nRead; } public long skip(long lSkip) throws IOException { // TODO: this is quite inefficient for (long lSkipped = 0; lSkipped < lSkip; lSkipped++) { int nReturn = read(); if (nReturn == -1) { return lSkipped; } } return lSkip; } public int available() throws IOException { return m_circularBuffer.availableRead(); } public void close() throws IOException { m_circularBuffer.close(); } public boolean markSupported() { return false; } public void mark(int nReadLimit) { } public void reset() throws IOException { throw new IOException("mark not supported"); } } /*** TAsynchronousFilteredAudioInputStream.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/share/sampled/convert/TAudioInputStream.java0000644000175000017500000000701410173661004032552 0ustar twernertwerner/* * TAudioInputStream.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2003 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.share.sampled.convert; import java.io.InputStream; import java.util.Collections; import java.util.HashMap; import java.util.Map; import javax.sound.sampled.AudioFormat; import javax.sound.sampled.AudioInputStream; /** AudioInputStream base class. This class implements "dynamic" properties. "Dynamic" properties are properties that may change during the life time of the objects. This is typically used to pass information like the current frame number, volume of subbands and similar values. "Dynamic" properties are different from properties in AudioFormat and AudioFileFormat, which are considered "static", as they aren't allowed to change after creating of the object, thereby maintaining the immutable character of these classes. */ public class TAudioInputStream extends AudioInputStream { private Map m_properties; private Map m_unmodifiableProperties; /** Constructor without properties. Creates an empty properties map. */ public TAudioInputStream(InputStream inputStream, AudioFormat audioFormat, long lLengthInFrames) { super(inputStream, audioFormat, lLengthInFrames); initMaps(new HashMap()); } /** Constructor with properties. The passed properties map is not copied. This allows subclasses to change values in the map after creation, and the changes are reflected in the map the application program can obtain. */ public TAudioInputStream(InputStream inputStream, AudioFormat audioFormat, long lLengthInFrames, Map properties) { super(inputStream, audioFormat, lLengthInFrames); initMaps(properties); } private void initMaps(Map properties) { /* Here, we make a shallow copy of the map. It's unclear if this is sufficient (of if a deep copy should be made). */ m_properties = properties; m_unmodifiableProperties = Collections.unmodifiableMap(m_properties); } /** Obtain a Map containing the properties. This method returns a Map that cannot be modified by the application program, but reflects changes to the map made by the implementation. @return a map containing the properties. */ public Map properties() { return m_unmodifiableProperties; } /** Set a property. Unlike in AudioFormat and AudioFileFormat, this method may be used anywhere by subclasses - it is not restricted to be used in the constructor. */ protected void setProperty(String key, Object value) { m_properties.put(key, value); } } /*** TAudioInputStream.java ***/ ././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootlibtritonus-java-20070428/src/classes/org/tritonus/share/sampled/convert/TEncodingFormatConversionProvider.javalibtritonus-java-20070428/src/classes/org/tritonus/share/sampled/convert/TEncodingFormatConversionPr0000644000175000017500000001163110374074736033661 0ustar twernertwerner/* * TEncodingFormatConversionProvider.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2000 by Florian Bomers * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.share.sampled.convert; import java.util.Collection; import java.util.Iterator; import javax.sound.sampled.AudioFormat; import org.tritonus.share.TDebug; import org.tritonus.share.ArraySet; // this class depends on handling of AudioSystem.NOT_SPECIFIED in AudioFormat.matches() /** * This is a base class for FormatConversionProviders that only * change the encoding, i.e. they never *
    *
  • change the sample size in bits without changing the encoding *
  • change the sample rate *
  • change the number of channels *
*

It is assumed that each source format can be encoded to all * target formats. *

In the sourceFormats and targetFormats collections that are passed to * the constructor of this class, fields may be set to AudioSystem.NOT_SPECIFIED. * This means that it handles all values of that field, but cannot change it. *

This class prevents that a conversion is done (e.g. for sample rates), * because the overriding class specified AudioSystem.NOT_SPECIFIED as sample rate, * meaning it handles all sample rates. *

Overriding classes must implement at least * AudioInputStream getAudioInputStream(AudioFormat targetFormat, AudioInputStream sourceStream) * and provide a constructor that calls the protected constructor of this class. * * @author Florian Bomers */ public abstract class TEncodingFormatConversionProvider extends TSimpleFormatConversionProvider { protected TEncodingFormatConversionProvider( Collection sourceFormats, Collection targetFormats) { super(sourceFormats, targetFormats); } /** * This implementation assumes that the converter can convert * from each of its source formats to each of its target * formats. If this is not the case, the converter has to * override this method. *

When conversion is supported, for every target encoding, * the fields sample size in bits, channels and sample rate are checked: *

    *
  • When a field in both the source and target format is AudioSystem.NOT_SPECIFIED, * one instance of that targetFormat is returned with this field set to AudioSystem.NOT_SPECIFIED. *
  • When a field in sourceFormat is set and it is AudioSystem.NOT_SPECIFIED in the target format, * the value of the field of source format is set in the returned format. *
  • The same applies for the other way round. *
* For this, replaceNotSpecified(sourceFormat, targetFormat) in the base * class TSimpleFormatConversionProvider is used - and accordingly, the frameSize * is recalculated with getFrameSize(...) if a field with AudioSystem.NOT_SPECIFIED * is replaced. Inheriting classes may wish to override this method if the * default mode of calculating the frame size is not appropriate. */ public AudioFormat[] getTargetFormats(AudioFormat.Encoding targetEncoding, AudioFormat sourceFormat) { if (TDebug.TraceAudioConverter) { TDebug.out(">TEncodingFormatConversionProvider.getTargetFormats(AudioFormat.Encoding, AudioFormat):"); TDebug.out("checking if conversion possible"); TDebug.out("from: " + sourceFormat); TDebug.out("to: " + targetEncoding); } if (isConversionSupported(targetEncoding, sourceFormat)) { // TODO: check that no duplicates may occur... ArraySet result=new ArraySet(); Iterator iterator = getCollectionTargetFormats().iterator(); while (iterator.hasNext()) { AudioFormat targetFormat = iterator.next(); targetFormat=replaceNotSpecified(sourceFormat, targetFormat); result.add(targetFormat); } if (TDebug.TraceAudioConverter) { TDebug.out("< returning "+result.size()+" elements."); } return result.toArray(EMPTY_FORMAT_ARRAY); } else { if (TDebug.TraceAudioConverter) { TDebug.out("< returning empty array."); } return EMPTY_FORMAT_ARRAY; } } } /*** TEncodingFormatConversionProvider.java ***/ ././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootlibtritonus-java-20070428/src/classes/org/tritonus/share/sampled/convert/TFormatConversionProvider.javalibtritonus-java-20070428/src/classes/org/tritonus/share/sampled/convert/TFormatConversionProvider.j0000644000175000017500000001256110173661004033641 0ustar twernertwerner/* * TFormatConversionProvider.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999, 2000 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.share.sampled.convert; import javax.sound.sampled.AudioSystem; import javax.sound.sampled.AudioFormat; import javax.sound.sampled.AudioInputStream; import javax.sound.sampled.spi.FormatConversionProvider; import org.tritonus.share.TDebug; import org.tritonus.share.sampled.AudioFormats; /** Base class for all conversion providers of Tritonus. * * @author Matthias Pfisterer */ public abstract class TFormatConversionProvider extends FormatConversionProvider { protected static final AudioFormat.Encoding[] EMPTY_ENCODING_ARRAY = new AudioFormat.Encoding[0]; protected static final AudioFormat[] EMPTY_FORMAT_ARRAY = new AudioFormat[0]; // $$fb2000-10-04: use AudioSystem.NOT_SPECIFIED for all fields. public AudioInputStream getAudioInputStream(AudioFormat.Encoding targetEncoding, AudioInputStream audioInputStream) { AudioFormat sourceFormat = audioInputStream.getFormat(); AudioFormat targetFormat = new AudioFormat( targetEncoding, AudioSystem.NOT_SPECIFIED, // sample rate AudioSystem.NOT_SPECIFIED, // sample size in bits AudioSystem.NOT_SPECIFIED, // channels AudioSystem.NOT_SPECIFIED, // frame size AudioSystem.NOT_SPECIFIED, // frame rate sourceFormat.isBigEndian()); // big endian if (TDebug.TraceAudioConverter) { TDebug.out("TFormatConversionProvider.getAudioInputStream(AudioFormat.Encoding, AudioInputStream):"); TDebug.out("trying to convert to " + targetFormat); } return getAudioInputStream(targetFormat, audioInputStream); } /** * WARNING: this method uses getTargetFormats(AudioFormat.Encoding, AudioFormat) * which may create infinite loops if the latter is overwritten. *

* This method is overwritten here to make use of org.tritonus.share.sampled.AudioFormats.matches * and is considered temporary until AudioFormat.matches is corrected in the JavaSound API. */ /* $$mp: if we decide to use getMatchingFormat(), this method should be implemented by simply calling getMatchingFormat() and comparing the result against null. */ public boolean isConversionSupported( AudioFormat targetFormat, AudioFormat sourceFormat) { if (TDebug.TraceAudioConverter) { TDebug.out(">TFormatConversionProvider.isConversionSupported(AudioFormat, AudioFormat):"); TDebug.out("class: "+getClass().getName()); TDebug.out("checking if conversion possible"); TDebug.out("from: " + sourceFormat); TDebug.out("to: " + targetFormat); } AudioFormat[] aTargetFormats = getTargetFormats(targetFormat.getEncoding(), sourceFormat); for (int i = 0; i < aTargetFormats.length; i++) { if (TDebug.TraceAudioConverter) { TDebug.out("checking against possible target format: " + aTargetFormats[i]); } if (aTargetFormats[i] != null && AudioFormats.matches(aTargetFormats[i], targetFormat)) { if (TDebug.TraceAudioConverter) { TDebug.out("getTargetFormats(AudioFormat.Encoding, AudioFormat) * which may create infinite loops if the latter is overwritten. *

* This method is overwritten here to make use of org.tritonus.share.sampled.AudioFormats.matches * and is considered temporary until AudioFormat.matches is corrected in the JavaSound API. */ public AudioFormat getMatchingFormat( AudioFormat targetFormat, AudioFormat sourceFormat) { if (TDebug.TraceAudioConverter) { TDebug.out(">TFormatConversionProvider.isConversionSupported(AudioFormat, AudioFormat):"); TDebug.out("class: "+getClass().getName()); TDebug.out("checking if conversion possible"); TDebug.out("from: " + sourceFormat); TDebug.out("to: " + targetFormat); } AudioFormat[] aTargetFormats = getTargetFormats(targetFormat.getEncoding(), sourceFormat); for (int i = 0; i < aTargetFormats.length; i++) { if (TDebug.TraceAudioConverter) { TDebug.out("checking against possible target format: " + aTargetFormats[i]); } if (aTargetFormats[i] != null && AudioFormats.matches(aTargetFormats[i], targetFormat)) { if (TDebug.TraceAudioConverter) { TDebug.out("| */ package org.tritonus.share.sampled.convert; import java.util.Collection; import java.util.Iterator; import javax.sound.sampled.AudioFormat; import javax.sound.sampled.AudioSystem; import org.tritonus.share.sampled.AudioFormats; import org.tritonus.share.ArraySet; import org.tritonus.share.TDebug; /** * This is a base class for FormatConversionProviders that can convert * from each source encoding/format to each target encoding/format. * If this is not the case, use TEncodingFormatConversionProvider. * *

Overriding classes must * provide a constructor that calls the protected constructor of this class and override * AudioInputStream getAudioInputStream(AudioFormat targetFormat, AudioInputStream sourceStream). * The latter method should be able to handle the case that all fields are NOT_SPECIFIED * and provide appropriate default values. * * @author Matthias Pfisterer */ // todo: // - declare a constant ALL_BUT_SAME_VALUE (==-2) or so that can be used in format lists // - consistent implementation of replacing NOT_SPECIFIED when not given in conversion public abstract class TSimpleFormatConversionProvider extends TFormatConversionProvider { private Collection m_sourceEncodings; private Collection m_targetEncodings; private Collection m_sourceFormats; private Collection m_targetFormats; protected TSimpleFormatConversionProvider( Collection sourceFormats, Collection targetFormats) { m_sourceEncodings = new ArraySet(); m_targetEncodings = new ArraySet(); m_sourceFormats = sourceFormats; m_targetFormats = targetFormats; collectEncodings(m_sourceFormats, m_sourceEncodings); collectEncodings(m_targetFormats, m_targetEncodings); } /** Disables this FormatConversionProvider. This may be useful when e.g. native libraries are not present. TODO: enable method, better implementation */ protected void disable() { if (TDebug.TraceAudioConverter) { TDebug.out("TSimpleFormatConversionProvider.disable(): disabling " + getClass().getName()); } m_sourceEncodings = new ArraySet(); m_targetEncodings = new ArraySet(); m_sourceFormats = new ArraySet(); m_targetFormats = new ArraySet(); } private static void collectEncodings(Collection formats, Collection encodings) { Iterator iterator = formats.iterator(); while (iterator.hasNext()) { AudioFormat format = iterator.next(); encodings.add(format.getEncoding()); } } public AudioFormat.Encoding[] getSourceEncodings() { return m_sourceEncodings.toArray(EMPTY_ENCODING_ARRAY); } public AudioFormat.Encoding[] getTargetEncodings() { return m_targetEncodings.toArray(EMPTY_ENCODING_ARRAY); } // overwritten of FormatConversionProvider public boolean isSourceEncodingSupported(AudioFormat.Encoding sourceEncoding) { return m_sourceEncodings.contains(sourceEncoding); } // overwritten of FormatConversionProvider public boolean isTargetEncodingSupported(AudioFormat.Encoding targetEncoding) { return m_targetEncodings.contains(targetEncoding); } /** * This implementation assumes that the converter can convert * from each of its source encodings to each of its target * encodings. If this is not the case, the converter has to * override this method. */ public AudioFormat.Encoding[] getTargetEncodings(AudioFormat sourceFormat) { if (isAllowedSourceFormat(sourceFormat)) { return getTargetEncodings(); } else { return EMPTY_ENCODING_ARRAY; } } /** * This implementation assumes that the converter can convert * from each of its source formats to each of its target * formats. If this is not the case, the converter has to * override this method. */ public AudioFormat[] getTargetFormats(AudioFormat.Encoding targetEncoding, AudioFormat sourceFormat) { if (isConversionSupported(targetEncoding, sourceFormat)) { return m_targetFormats.toArray(EMPTY_FORMAT_ARRAY); } else { return EMPTY_FORMAT_ARRAY; } } // TODO: check if necessary protected boolean isAllowedSourceEncoding(AudioFormat.Encoding sourceEncoding) { return m_sourceEncodings.contains(sourceEncoding); } protected boolean isAllowedTargetEncoding(AudioFormat.Encoding targetEncoding) { return m_targetEncodings.contains(targetEncoding); } protected boolean isAllowedSourceFormat(AudioFormat sourceFormat) { Iterator iterator = m_sourceFormats.iterator(); while (iterator.hasNext()) { AudioFormat format = iterator.next(); if (AudioFormats.matches(format, sourceFormat)) { return true; } } return false; } protected boolean isAllowedTargetFormat(AudioFormat targetFormat) { Iterator iterator = m_targetFormats.iterator(); while (iterator.hasNext()) { AudioFormat format = iterator.next(); if (AudioFormats.matches(format, targetFormat)) { return true; } } return false; } // $$fb 2000-04-02 added some convenience methods for overriding classes protected Collection getCollectionSourceEncodings() { return m_sourceEncodings; } protected Collection getCollectionTargetEncodings() { return m_targetEncodings; } protected Collection getCollectionSourceFormats() { return m_sourceFormats; } protected Collection getCollectionTargetFormats() { return m_targetFormats; } /** * Utility method to check whether these values match, * taking into account AudioSystem.NOT_SPECIFIED. * @return true if any of the values is AudioSystem.NOT_SPECIFIED * or both values have the same value. */ //$$fb 2000-08-16: moved from TEncodingFormatConversionProvider protected static boolean doMatch(int i1, int i2) { return i1==AudioSystem.NOT_SPECIFIED || i2==AudioSystem.NOT_SPECIFIED || i1==i2; } /** * @see #doMatch(int,int) */ //$$fb 2000-08-16: moved from TEncodingFormatConversionProvider protected static boolean doMatch(float f1, float f2) { return f1==AudioSystem.NOT_SPECIFIED || f2==AudioSystem.NOT_SPECIFIED || Math.abs(f1 - f2) < 1.0e-9; } /** * Utility method, replaces all occurences of AudioSystem.NOT_SPECIFIED * in targetFormat with the corresponding value in sourceFormat. * If targetFormat does not contain any fields with AudioSystem.NOT_SPECIFIED, * it is returned unmodified. The endian-ness and encoding remain the same in all cases. *

* If any of the fields is AudioSystem.NOT_SPECIFIED in both sourceFormat and * targetFormat, it will remain not specified. *

* This method uses getFrameSize(...) (see below) to set the new frameSize, * if a new AudioFormat instance is created. *

* This method isn't used in TSimpleFormatConversionProvider - it is solely there * for inheriting classes. */ //$$fb 2000-08-16: moved from TEncodingFormatConversionProvider protected AudioFormat replaceNotSpecified(AudioFormat sourceFormat, AudioFormat targetFormat) { boolean bSetSampleSize=false; boolean bSetChannels=false; boolean bSetSampleRate=false; boolean bSetFrameRate=false; if (targetFormat.getSampleSizeInBits()==AudioSystem.NOT_SPECIFIED && sourceFormat.getSampleSizeInBits()!=AudioSystem.NOT_SPECIFIED) { bSetSampleSize=true; } if (targetFormat.getChannels()==AudioSystem.NOT_SPECIFIED && sourceFormat.getChannels()!=AudioSystem.NOT_SPECIFIED) { bSetChannels=true; } if (targetFormat.getSampleRate()==AudioSystem.NOT_SPECIFIED && sourceFormat.getSampleRate()!=AudioSystem.NOT_SPECIFIED) { bSetSampleRate=true; } if (targetFormat.getFrameRate()==AudioSystem.NOT_SPECIFIED && sourceFormat.getFrameRate()!=AudioSystem.NOT_SPECIFIED) { bSetFrameRate=true; } if (bSetSampleSize || bSetChannels || bSetSampleRate || bSetFrameRate || (targetFormat.getFrameSize()==AudioSystem.NOT_SPECIFIED && sourceFormat.getFrameSize()!=AudioSystem.NOT_SPECIFIED)) { // create new format in place of the original target format float sampleRate=bSetSampleRate? sourceFormat.getSampleRate():targetFormat.getSampleRate(); float frameRate=bSetFrameRate? sourceFormat.getFrameRate():targetFormat.getFrameRate(); int sampleSize=bSetSampleSize? sourceFormat.getSampleSizeInBits():targetFormat.getSampleSizeInBits(); int channels=bSetChannels? sourceFormat.getChannels():targetFormat.getChannels(); int frameSize=getFrameSize( targetFormat.getEncoding(), sampleRate, sampleSize, channels, frameRate, targetFormat.isBigEndian(), targetFormat.getFrameSize()); targetFormat= new AudioFormat( targetFormat.getEncoding(), sampleRate, sampleSize, channels, frameSize, frameRate, targetFormat.isBigEndian()); } return targetFormat; } /** * Calculates the frame size for the given format description. * The default implementation returns AudioSystem.NOT_SPECIFIED * if either sampleSize or channels is AudioSystem.NOT_SPECIFIED, * otherwise sampleSize*channels/8 is returned. *

* If this does not reflect the way to calculate the right frame size, * inheriting classes should overwrite this method if they use * replaceNotSpecified(...). It is not used elsewhere in this class. */ //$$fb 2000-08-16: added protected int getFrameSize( AudioFormat.Encoding encoding, float sampleRate, int sampleSize, int channels, float frameRate, boolean bigEndian, int oldFrameSize) { if (sampleSize==AudioSystem.NOT_SPECIFIED || channels==AudioSystem.NOT_SPECIFIED) { return AudioSystem.NOT_SPECIFIED; } return sampleSize*channels/8; } } /*** TSimpleFormatConversionProvider.java ***/ ././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootlibtritonus-java-20070428/src/classes/org/tritonus/share/sampled/convert/TSynchronousFilteredAudioInputStream.javalibtritonus-java-20070428/src/classes/org/tritonus/share/sampled/convert/TSynchronousFilteredAudioIn0000644000175000017500000001732710540343203033663 0ustar twernertwerner/* * TSynchronousFilteredAudioInputStream.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999,2000 by Florian Bomers * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.share.sampled.convert; import java.io.IOException; import javax.sound.sampled.AudioFormat; import javax.sound.sampled.AudioInputStream; import org.tritonus.share.TDebug; import org.tritonus.share.sampled.AudioUtils; /** * Base class for types of audio filter/converter that translate one frame to another frame.
* It provides all the transformation of frame sizes.
* It does NOT handle different sample rates of original stream and this stream ! * * @author Florian Bomers */ public abstract class TSynchronousFilteredAudioInputStream extends TAudioInputStream { private AudioInputStream originalStream; private AudioFormat originalFormat; /** 1 if original format's frame size is NOT_SPECIFIED */ private int originalFrameSize; /** 1 if original format's frame size is NOT_SPECIFIED */ private int newFrameSize; /** * The intermediate buffer used during convert actions * (if not convertInPlace is used). * It remains until this audioStream is closed or destroyed * and grows with the time - it always has the size of the * largest intermediate buffer ever needed. */ protected byte[] m_buffer=null; /** * For use of the more efficient method convertInPlace. * it will be set to true when (frameSizeFactor==1) */ private boolean m_bConvertInPlace = false; public TSynchronousFilteredAudioInputStream(AudioInputStream audioInputStream, AudioFormat newFormat) { // the super class will do nothing... we override everything super(audioInputStream, newFormat, audioInputStream.getFrameLength()); originalStream=audioInputStream; originalFormat=audioInputStream.getFormat(); originalFrameSize=(originalFormat.getFrameSize()<=0) ? 1 : originalFormat.getFrameSize(); newFrameSize=(getFormat().getFrameSize()<=0) ? 1 : getFormat().getFrameSize(); if (TDebug.TraceAudioConverter) { TDebug.out("TSynchronousFilteredAudioInputStream: original format =" +AudioUtils.format2ShortStr(originalFormat)); TDebug.out("TSynchronousFilteredAudioInputStream: converted format=" +AudioUtils.format2ShortStr(getFormat())); } //$$fb 2000-07-17: convert in place has to be enabled explicitly with "enableConvertInPlace" //if (getFormat().getFrameSize() == originalFormat.getFrameSize()) { // m_bConvertInPlace = true; //} m_bConvertInPlace = false; } protected boolean enableConvertInPlace() { if (newFrameSize >= originalFrameSize) { m_bConvertInPlace = true; } return m_bConvertInPlace; } /** * Override this method to do the actual conversion. * inBuffer starts always at index 0 (it is an internal buffer) * You should always override this. * inFrameCount is the number of frames in inBuffer. These * frames are of the format originalFormat. * @return the resulting number of frames converted and put into * outBuffer. The return value is in the format of this stream. */ protected abstract int convert(byte[] inBuffer, byte[] outBuffer, int outByteOffset, int inFrameCount); /** * Override this method to provide in-place conversion of samples. * To use it, call "enableConvertInPlace()". It will only be used when * input bytes per frame >= output bytes per frame. * This method must always convert frameCount frames, so no return value is necessary. */ protected void convertInPlace(byte[] buffer, int byteOffset, int frameCount) { throw new RuntimeException("Illegal call to convertInPlace"); } public int read() throws IOException { if (newFrameSize != 1) { throw new IOException("frame size must be 1 to read a single byte"); } // very ugly, but efficient. Who uses this method anyway ? // TODO: use an instance variable byte[] temp = new byte[1]; int result = read(temp); if (result == -1) { return -1; } if (result == 0) { // what in this case ??? Let's hope it never occurs. return -1; } return temp[0] & 0xFF; } private void clearBuffer() { m_buffer = null; } public AudioInputStream getOriginalStream() { return originalStream; } public AudioFormat getOriginalFormat() { return originalFormat; } /** * Read nLength bytes that will be the converted samples * of the original InputStream. * When nLength is not an integral number of frames, * this method may read less than nLength bytes. */ public int read(byte[] abData, int nOffset, int nLength) throws IOException { // number of frames that we have to read from the underlying stream. int nFrameLength = nLength/newFrameSize; // number of bytes that we need to read from underlying stream. int originalBytes = nFrameLength * originalFrameSize; if (TDebug.TraceAudioConverter) { TDebug.out("> TSynchronousFilteredAIS.read(buffer["+abData.length+"], " +nOffset+" ,"+nLength+" bytes ^="+nFrameLength+" frames)"); } int nFramesConverted = 0; // set up buffer to read byte readBuffer[]; int readOffset; if (m_bConvertInPlace) { readBuffer=abData; readOffset=nOffset; } else { // assert that the buffer fits if (m_buffer == null || m_buffer.length < originalBytes) { m_buffer = new byte[originalBytes]; } readBuffer=m_buffer; readOffset=0; } int nBytesRead = originalStream.read(readBuffer, readOffset, originalBytes); if (nBytesRead == -1) { // end of stream clearBuffer(); return -1; } int nFramesRead = nBytesRead / originalFrameSize; if (TDebug.TraceAudioConverter) { TDebug.out("original.read returned " +nBytesRead+" bytes ^="+nFramesRead+" frames"); } if (m_bConvertInPlace) { convertInPlace(abData, nOffset, nFramesRead); nFramesConverted=nFramesRead; } else { nFramesConverted = convert(m_buffer, abData, nOffset, nFramesRead); } if (TDebug.TraceAudioConverter) { TDebug.out("< converted "+nFramesConverted+" frames"); } return nFramesConverted*newFrameSize; } public long skip(long nSkip) throws IOException { // only returns integral frames long skipFrames = nSkip / newFrameSize; long originalSkippedBytes = originalStream.skip(skipFrames*originalFrameSize); long skippedFrames = originalSkippedBytes/originalFrameSize; return skippedFrames * newFrameSize; } public int available() throws IOException { int origAvailFrames = originalStream.available()/originalFrameSize; return origAvailFrames*newFrameSize; } public void close() throws IOException { originalStream.close(); clearBuffer(); } public void mark(int readlimit) { int readLimitFrames=readlimit/newFrameSize; originalStream.mark(readLimitFrames*originalFrameSize); } public void reset() throws IOException { originalStream.reset(); } public boolean markSupported() { return originalStream.markSupported(); } } /*** TSynchronousFilteredAudioInputStream.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/share/sampled/convert/package.html0000644000175000017500000000076510173661004030615 0ustar twernertwerner

Base classes for the implementation of FormatConversionProviders. The classes provided here .

@see javax.sound.sampled.spi.FormatConversionProvider @see org.tritonus.sampled.convert @see org.tritonus.sampled.convert.gsm @see org.tritonus.sampled.convert.jorbis @see org.tritonus.sampled.convert.lame @see org.tritonus.sampled.convert.vorbis libtritonus-java-20070428/src/classes/org/tritonus/share/sampled/AudioFileTypes.java0000644000175000017500000001261410531070135030376 0ustar twernertwerner/* * AudioFileTypes.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2000 by Florian Bomers * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ package org.tritonus.share.sampled; import javax.sound.sampled.AudioFileFormat; import org.tritonus.share.StringHashedSet; /** * This class is a proposal for generic handling of audio file format types. * The main purpose is to provide a standardized way of * implementing audio file format types. Like this, file types * are only identified by their String name, and not, as currently, * by their object instance. *

* A standard registry of file type names will * be maintained by the Tritonus team. *

* In a specification request to JavaSoft, these static methods * could be integrated intoAudioFileFormat.Type. The static * instances of AIFF, AIFC, AU, SND, and WAVE types in class * AudioFileFormat.Type should be retrieved * using this method, too (internally).
* At best, the protected constructor of that class * should also be replaced to be a private constructor. * Like this it will be prevented that developers create * instances of Type, which causes problems with the * equals method. In fact, the equals method should be redefined anyway * so that it compares the names and not the objects. *

* Also, the file name extension should be deprecated and moved * to AudioFileFormat. There are some file formats * which have varying extensions depending, e.g. on the encoding. * An example for this is MPEG: the special encoding Mpeg 1, layer 3 * has the extension mp3, whereas other Mpeg files use mpeg or mpg.
* This could be implemented with 2 methods in AudioFileFormat: *

  1. String[] getFileExtensions(): returns all usable extensions * for this file. *
  2. String getDefaultFileExtension(): returns the preferred extension. *
* * @author Florian Bomers */ public class AudioFileTypes extends AudioFileFormat.Type { /** contains all known types */ private static StringHashedSet types = new StringHashedSet(); // initially add the standard types static { types.add(AudioFileFormat.Type.AIFF); types.add(AudioFileFormat.Type.AIFC); types.add(AudioFileFormat.Type.AU); types.add(AudioFileFormat.Type.SND); types.add(AudioFileFormat.Type.WAVE); } AudioFileTypes(String name, String ext) { super(name, ext); } /** * Use this method to retrieve an instance of * AudioFileFormat.Type of the specified * name. If no type of this name is in the internally * maintained list, null is returned. *

* This method is supposed to be used by user programs. *

* In order to assure a well-filled internal list, * call AudioSystem.getAudioFileTypes() * at initialization time. * * @see #getType(String, String) */ public static AudioFileFormat.Type getType(String name) { return getType(name, null); } /** * Use this method to retrieve an instance of * AudioFileFormat.Type of the specified * name. If it does not exist in the internal list * of types, a new type is created and returned. * If it a type of that name already exists (regardless * of extension), it is returned. In this case it can * not be guaranteed that the extension is the same as * passed as parameter.
* If extension is null, * this method returns null if the * type of the specified name does not exist in the * internal list. *

* This method is supposed to be used by file providers. * Every file reader and file writer provider should * exclusively use this method for retrieving instances * of AudioFileFormat.Type. */ public static AudioFileFormat.Type getType(String name, String extension) { AudioFileFormat.Type res=(AudioFileFormat.Type) types.get(name); if (res==null) { // it is not already in the string set. if (extension==null) { return null; } // Create a new type instance. res=new AudioFileTypes(name, extension); // and save it for the future types.add(res); } return res; } /** * Tests for equality of 2 file types. They are equal when their names match. *

* This function should be AudioFileFormat.Type.equals and must * be considered as a temporary workaround until it flows into the * JavaSound API. */ // IDEA: create a special "NOT_SPECIFIED" file type // and a AudioFileFormat.Type.matches method. public static boolean equals(AudioFileFormat.Type t1, AudioFileFormat.Type t2) { return t2.toString().equals(t1.toString()); } } /*** AudioFileTypes.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/share/sampled/AudioFormatSet.java0000644000175000017500000000767310540343033030407 0ustar twernertwerner/* * AudioFormatSet.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2000 by Florian Bomers * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.share.sampled; import java.util.Collection; import java.util.Iterator; import javax.sound.sampled.AudioFormat; import org.tritonus.share.ArraySet; import org.tritonus.share.sampled.AudioFormats; /** * A set where the elements are uniquely referenced by * AudioFormats.equals rather than their object reference. * No 2 equal AudioFormats can exist in the set. *

* This class provide convenience methods like * getAudioFormat(AudioFormat) and * matches(AudioFormat). *

* The contains(Object elem) and get(Object elem) * fail, if elem is not an instance of AudioFormat. *

* You shouldn't use the ArrayList specific functions * like those that take index parameters. *

* It is not possible to add null elements. *

* Currently, the methods equals(.,.) and matches(.,.) of * class AudioFormats are used. Let's hope that they will * be integrated into AudioFormat. */ public class AudioFormatSet extends ArraySet { private static final long serialVersionUID = 1; protected static final AudioFormat[] EMPTY_FORMAT_ARRAY = new AudioFormat[0]; public AudioFormatSet() { super(); } public AudioFormatSet(Collection c) { super(c); } public boolean add(AudioFormat elem) { if (elem==null) { return false; } return super.add(elem); } public boolean contains(AudioFormat elem) { if (elem==null) { return false; } AudioFormat comp= elem; Iterator it=iterator(); while (it.hasNext()) { if (AudioFormats.equals(comp, (AudioFormat) it.next())) { return true; } } return false; } public AudioFormat get(AudioFormat elem) { if (elem==null) { return null; } AudioFormat comp= elem; Iterator it=iterator(); while (it.hasNext()) { AudioFormat thisElem=(AudioFormat) it.next(); if (AudioFormats.equals(comp, thisElem)) { return thisElem; } } return null; } public AudioFormat getAudioFormat(AudioFormat elem) { return get(elem); } /** * Checks whether this Set contains an AudioFormat * that matches elem. * The first matching format is returned. If no element * matches elem, null is returned. *

* @see AudioFormats#matches(AudioFormat, AudioFormat) */ public AudioFormat matches(AudioFormat elem) { if (elem==null) { return null; } Iterator it=iterator(); while (it.hasNext()) { AudioFormat thisElem=(AudioFormat) it.next(); if (AudioFormats.matches(elem, thisElem)) { return thisElem; } } return null; } // $$mp: TODO: remove; should be obsolete public AudioFormat[] toAudioFormatArray() { return toArray(EMPTY_FORMAT_ARRAY); } public void add(int index, AudioFormat element) { throw new UnsupportedOperationException("unsupported"); } public AudioFormat set(int index, AudioFormat element) { throw new UnsupportedOperationException("unsupported"); } } /*** AudioFormatSet.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/share/sampled/AudioFormats.java0000644000175000017500000001060610173661004030107 0ustar twernertwerner/* * AudioFormats.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999,2000 by Matthias Pfisterer * Copyright (c) 1999 by Florian Bomers * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.share.sampled; import javax.sound.sampled.AudioFormat; import javax.sound.sampled.AudioSystem; public class AudioFormats { private static boolean doMatch(int i1, int i2) { return i1 == AudioSystem.NOT_SPECIFIED || i2 == AudioSystem.NOT_SPECIFIED || i1 == i2; } private static boolean doMatch(float f1, float f2) { return f1 == AudioSystem.NOT_SPECIFIED || f2 == AudioSystem.NOT_SPECIFIED || Math.abs(f1 - f2) < 1.0e-9; } /** * Tests whether 2 AudioFormats have matching formats. * A field matches when it is AudioSystem.NOT_SPECIFIED in * at least one of the formats or the field is the same * in both formats.
* Exceptions: *

    *
  • Encoding must always be equal for a match. *
  • For a match, endianness must be equal if SampleSizeInBits is not * AudioSystem.NOT_SPECIFIED and greater than 8bit in both formats.
    * In other words: If SampleSizeInBits is AudioSystem.NOT_SPECIFIED * in either format or both formats have a SampleSizeInBits<8, * endianness does not matter. *
* This is a proposition to be used as AudioFormat.matches. * It can therefore be considered as a temporary workaround. */ // IDEA: create a special "NOT_SPECIFIED" encoding // and a AudioFormat.Encoding.matches method. public static boolean matches(AudioFormat format1, AudioFormat format2) { //$$fb 19 Dec 99: endian must be checked, too. // // we do have a problem with redundant elements: // e.g. // encoding=ALAW || ULAW -> bigEndian and samplesizeinbits don't matter // sample size in bits == 8 -> bigEndian doesn't matter // sample size in bits > 8 -> PCM is always signed. // This is an overall issue in JavaSound, I think. // At present, it is not consistently implemented to support these // redundancies and implicit definitions // // As a workaround of this issue I return in the converters // all combinations, e.g. for ULAW I return bigEndian and !bigEndian formats. /* old version */ // as proposed by florian return format1.getEncoding().equals(format2.getEncoding()) && (format2.getSampleSizeInBits()<=8 || format1.getSampleSizeInBits()==AudioSystem.NOT_SPECIFIED || format2.getSampleSizeInBits()==AudioSystem.NOT_SPECIFIED || format1.isBigEndian()==format2.isBigEndian()) && doMatch(format1.getChannels(),format2.getChannels()) && doMatch(format1.getSampleSizeInBits(), format2.getSampleSizeInBits()) && doMatch(format1.getFrameSize(), format2.getFrameSize()) && doMatch(format1.getSampleRate(), format2.getSampleRate()) && doMatch(format1.getFrameRate(),format2.getFrameRate()); } /** * Tests for exact equality of 2 AudioFormats. * This is the behaviour of AudioFormat.matches in JavaSound 1.0. *

* This is a proposition to be used as AudioFormat.equals. * It can therefore be considered as a temporary workaround. */ public static boolean equals(AudioFormat format1, AudioFormat format2) { return format1.getEncoding().equals(format2.getEncoding()) && format1.getChannels() == format2.getChannels() && format1.getSampleSizeInBits() == format2.getSampleSizeInBits() && format1.getFrameSize() == format2.getFrameSize() && (Math.abs(format1.getSampleRate() - format2.getSampleRate()) < 1.0e-9) && (Math.abs(format1.getFrameRate() - format2.getFrameRate()) < 1.0e-9); } } /*** AudioFormats.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/share/sampled/AudioSystemShadow.java0000644000175000017500000000730510173661004031130 0ustar twernertwerner/* * AudioSystemShadow.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999, 2000 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.share.sampled; import java.io.File; import java.io.OutputStream; import java.io.IOException; import javax.sound.sampled.AudioFileFormat; import javax.sound.sampled.AudioFormat; import org.tritonus.share.sampled.file.AudioOutputStream; import org.tritonus.share.sampled.file.TDataOutputStream; import org.tritonus.share.sampled.file.TSeekableDataOutputStream; import org.tritonus.share.sampled.file.TNonSeekableDataOutputStream; import org.tritonus.sampled.file.AiffAudioOutputStream; import org.tritonus.sampled.file.AuAudioOutputStream; import org.tritonus.sampled.file.WaveAudioOutputStream; /** Experminatal area for AudioSystem. * This class is used to host features that may become part of the * Java Sound API (In which case they will be moved to AudioSystem). */ public class AudioSystemShadow { public static TDataOutputStream getDataOutputStream(File file) throws IOException { return new TSeekableDataOutputStream(file); } public static TDataOutputStream getDataOutputStream(OutputStream stream) throws IOException { return new TNonSeekableDataOutputStream(stream); } // TODO: lLengthInBytes actually should be lLengthInFrames (design problem of A.O.S.) public static AudioOutputStream getAudioOutputStream(AudioFileFormat.Type type, AudioFormat audioFormat, long lLengthInBytes, TDataOutputStream dataOutputStream) { AudioOutputStream audioOutputStream = null; if (type.equals(AudioFileFormat.Type.AIFF) || type.equals(AudioFileFormat.Type.AIFF)) { audioOutputStream = new AiffAudioOutputStream(audioFormat, type, lLengthInBytes, dataOutputStream); } else if (type.equals(AudioFileFormat.Type.AU)) { audioOutputStream = new AuAudioOutputStream(audioFormat, lLengthInBytes, dataOutputStream); } else if (type.equals(AudioFileFormat.Type.WAVE)) { audioOutputStream = new WaveAudioOutputStream(audioFormat, lLengthInBytes, dataOutputStream); } return audioOutputStream; } public static AudioOutputStream getAudioOutputStream(AudioFileFormat.Type type, AudioFormat audioFormat, long lLengthInBytes, File file) throws IOException { TDataOutputStream dataOutputStream = getDataOutputStream(file); AudioOutputStream audioOutputStream = getAudioOutputStream(type, audioFormat, lLengthInBytes, dataOutputStream); return audioOutputStream; } public static AudioOutputStream getAudioOutputStream(AudioFileFormat.Type type, AudioFormat audioFormat, long lLengthInBytes, OutputStream outputStream) throws IOException { TDataOutputStream dataOutputStream = getDataOutputStream(outputStream); AudioOutputStream audioOutputStream = getAudioOutputStream(type, audioFormat, lLengthInBytes, dataOutputStream); return audioOutputStream; } } /*** AudioSystemShadow.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/share/sampled/AudioUtils.java0000644000175000017500000001351310531070232027567 0ustar twernertwerner/* * AudioUtils.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2000 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.share.sampled; import java.util.Iterator; import javax.sound.sampled.AudioSystem; import javax.sound.sampled.AudioFormat; import javax.sound.sampled.AudioInputStream; import javax.sound.sampled.Mixer; public class AudioUtils { public static long getLengthInBytes(AudioInputStream audioInputStream) { return getLengthInBytes(audioInputStream.getFormat(), audioInputStream.getFrameLength()); /* long lLengthInFrames = audioInputStream.getFrameLength(); int nFrameSize = audioInputStream.getFormat().getFrameSize(); if (lLengthInFrames >= 0 && nFrameSize >= 1) { return lLengthInFrames * nFrameSize; } else { return AudioSystem.NOT_SPECIFIED; } */ } /** * if the passed value for lLength is * AudioSystem.NOT_SPECIFIED (unknown * length), the length in bytes becomes * AudioSystem.NOT_SPECIFIED, too. */ public static long getLengthInBytes(AudioFormat audioFormat, long lLengthInFrames) { int nFrameSize = audioFormat.getFrameSize(); if (lLengthInFrames >= 0 && nFrameSize >= 1) { return lLengthInFrames * nFrameSize; } else { return AudioSystem.NOT_SPECIFIED; } } public static boolean containsFormat(AudioFormat sourceFormat, Iterator possibleFormats) { while (possibleFormats.hasNext()) { AudioFormat format = (AudioFormat) possibleFormats.next(); if (AudioFormats.matches(format, sourceFormat)) { return true; } } return false; } /** * Conversion milliseconds -> bytes */ public static long millis2Bytes(long ms, AudioFormat format) { return millis2Bytes(ms, format.getFrameRate(), format.getFrameSize()); } public static long millis2Bytes(long ms, double frameRate, int frameSize) { return (long) (ms*frameRate/1000*frameSize); } public static long millis2Bytes(double ms, AudioFormat format) { return millis2Bytes(ms, format.getFrameRate(), format.getFrameSize()); } public static long millis2Bytes(double ms, double frameRate, int frameSize) { return ((long) (ms*frameRate/1000.0))*frameSize; } /** * Conversion milliseconds -> bytes (bytes will be frame-aligned) */ public static long millis2BytesFrameAligned(long ms, AudioFormat format) { return millis2BytesFrameAligned(ms, format.getFrameRate(), format.getFrameSize()); } public static long millis2BytesFrameAligned(long ms, float frameRate, int frameSize) { return ((long) (ms*frameRate/1000))*frameSize; } /** * Conversion milliseconds -> frames */ public static long millis2Frames(long ms, AudioFormat format) { return millis2Frames(ms, format.getFrameRate()); } public static long millis2Frames(long ms, float frameRate) { return (long) (ms*frameRate/1000); } /** * Conversion bytes -> milliseconds */ public static long bytes2Millis(long bytes, AudioFormat format) { return (long) (bytes/format.getFrameRate()*1000/format.getFrameSize()); } /** * Conversion frames -> milliseconds */ public static long frames2Millis(long frames, AudioFormat format) { return (long) (frames/format.getFrameRate()*1000); } /** * * @param sr1 the first sample rate to compare * @param sr2 the second sample rate to compare * @return true if the sample rates are (almost) identical */ public static boolean sampleRateEquals(float sr1, float sr2) { return Math.abs(sr1-sr2)<0.0000001; } /** * @param format the audio format to test * @return true if the format is either PCM_SIGNED or PCM_UNSIGNED */ public static boolean isPCM(AudioFormat format) { return format.getEncoding().equals(AudioFormat.Encoding.PCM_SIGNED) || format.getEncoding().equals(AudioFormat.Encoding.PCM_UNSIGNED); } /** * Return if the passed mixer info is the Java Sound Audio Engine. * @param mixerInfo the mixer info to query * @return true if the mixer info describes the Java Sound Audio Engine */ public static boolean isJavaSoundAudioEngine(Mixer.Info mixerInfo) { return mixerInfo.getName().equals("Java Sound Audio Engine"); } /** * tries to guess if this program is running on a big endian platform * @return */ public static boolean isSystemBigEndian() { return java.nio.ByteOrder.nativeOrder().equals(java.nio.ByteOrder.BIG_ENDIAN); } //$$fb 2000-07-18: added these debugging functions public static String NS_or_number(int number) { return (number==AudioSystem.NOT_SPECIFIED)?"NOT_SPECIFIED":String.valueOf(number); } public static String NS_or_number(float number) { return (number==AudioSystem.NOT_SPECIFIED)?"NOT_SPECIFIED":String.valueOf(number); } /** * For debugging purposes. */ public static String format2ShortStr(AudioFormat format) { return format.getEncoding() + "-" + NS_or_number(format.getChannels()) + "ch-" + NS_or_number(format.getSampleSizeInBits()) + "bit-" + NS_or_number(((int)format.getSampleRate())) + "Hz-"+ (format.isBigEndian() ? "be" : "le"); } } /*** AudioUtils.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/share/sampled/Encodings.java0000644000175000017500000001557610531070323027432 0ustar twernertwerner/* * Encodings.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2000 by Florian Bomers * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ package org.tritonus.share.sampled; import java.util.Iterator; import javax.sound.sampled.AudioSystem; import javax.sound.sampled.AudioFormat; import org.tritonus.share.StringHashedSet; /** * This class is a proposal for generic handling of encodings. * The main purpose is to provide a standardized way of * implementing encoding types. Like this, encodings * are only identified by their String name, and not, as currently, * by their object instance. *

* A registry of standard encoding names will * be maintained by the Tritonus team. *

* In a specification request to JavaSoft, the static method * getEncoding should be integrated into * AudioFormat.Encoding(String name) (possibly * renamed to getInstance(String name).
* The static instances of ULAW, ALAW PCM_UNSIGNED and PCM_SIGNED * encodings in that class should be retrieved using that function, * too (internally).
* At best, the protected constructor of that class * should also be replaced to be a private constructor. * Like this it will be prevented that developers create their own * instances of Encoding, which causes problems with the * equals method. In fact, the equals method should be redefined anyway * so that it compares the names and not the objects. *

* Also, a specification request should be made to integrate * getEncodings() into AudioSystem (this is * especially annoying as the relevant methods already exist * in the provider interfaces of file readers, file writers and * converters). * * @author Florian Bomers */ public class Encodings extends AudioFormat.Encoding { /** contains all known encodings */ private static StringHashedSet encodings = new StringHashedSet(); // initially add the standard encodings static { encodings.add(AudioFormat.Encoding.PCM_SIGNED); encodings.add(AudioFormat.Encoding.PCM_UNSIGNED); encodings.add(AudioFormat.Encoding.ULAW); encodings.add(AudioFormat.Encoding.ALAW); } Encodings(String name) { super(name); } /** * Use this method for retrieving an instance of * AudioFormat.Encoding of the specified * name. A standard registry of encoding names will * be maintained by the Tritonus team. *

* Every file reader, file writer, and format converter * provider should exclusively use this method for * retrieving instances of AudioFormat.Encoding. */ /* MP2000/09/11: perhaps it is not a good idea to allow user programs the creation of new encodings. The problem with it is that a plain typo will produce an encoding object that is not supported. Instead, some indication of an error should be signaled to the user program. And, there should be a second interface for service providers allowing them to register encodings supported by themselves. $$fb2000/09/26: The problem is what you see as second issue: it can never be assured that this class knows all available encodings. So at the moment, there is no choice than to allow users to create any Encoding they wish. The encodings database will simplify things. A problem with an interface to retrieve supported encodings (or API function in spi.FormatConversionProvider) is that this requires loading of all providers very early. Hmmm, maybe this is necessary in any case when the user issues something like AudioSystem.isConversionSupported. */ public static AudioFormat.Encoding getEncoding(String name) { AudioFormat.Encoding res=(AudioFormat.Encoding) encodings.get(name); if (res==null) { // it is not already in the string set. Create a new encoding instance. res=new Encodings(name); // and save it for the future encodings.add(res); } return res; } /** * Tests for equality of 2 encodings. They are equal when their strings match. *

* This function should be AudioFormat.Encoding.equals and must * be considered as a temporary work around until it flows into the * JavaSound API. */ // IDEA: create a special "NOT_SPECIFIED" encoding // and a AudioFormat.Encoding.matches method. public static boolean equals(AudioFormat.Encoding e1, AudioFormat.Encoding e2) { return e2.toString().equals(e1.toString()); } /** * Returns all "supported" encodings. * Supported means that it is possible to read or * write files with this encoding, or that a converter * accepts this encoding as source or target format. *

* Currently, this method returns a best guess and * the search algorithm is far from complete: with standard * methods of AudioSystem, only the target encodings * of the converters can be retrieved - neither * the source encodings of converters nor the encodings * of file readers and file writers cannot be retrieved. */ public static AudioFormat.Encoding[] getEncodings() { StringHashedSet iteratedSources=new StringHashedSet(); StringHashedSet retrievedTargets=new StringHashedSet(); Iterator sourceFormats=encodings.iterator(); while (sourceFormats.hasNext()) { AudioFormat.Encoding source=(AudioFormat.Encoding) sourceFormats.next(); iterateEncodings(source, iteratedSources, retrievedTargets); } return (AudioFormat.Encoding[]) retrievedTargets.toArray( new AudioFormat.Encoding[retrievedTargets.size()]); } private static void iterateEncodings(AudioFormat.Encoding source, StringHashedSet iteratedSources, StringHashedSet retrievedTargets) { if (!iteratedSources.contains(source)) { iteratedSources.add(source); AudioFormat.Encoding[] targets=AudioSystem.getTargetEncodings(source); for (int i=0; i * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * - Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * - Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.share.sampled; import java.io.*; import javax.sound.sampled.*; /** * An implementation of AudioInputStream that implements the FloatSampleInput * interface. This is a convenience class to instantly make any AudioInputStream * capable of fulfilling the FloatSampleInput interface, or vice versa: make an * existing FloatSampleInput class compatible with AudioInputStream. *

* All calls to FloatSampleInput.read() will cause implicit conversion to * FloatSampleBuffer. If the underlying stream implementes FloatSampleInput, the * FloatSampleInput.read method is used for reading. * * @author florian */ public class FloatInputStream extends AudioInputStream implements FloatSampleInput { // set this if we can read from an AudioInputStream private InputStream sourceStream; // set this if we can read from an FloatSampleInput private FloatSampleInput sourceInput; /** * true if the source stream returned eof, or if this stream was closed. */ private boolean eofReached = false; /** * a temporary byte buffer for reading from an underlying input stream */ private byte[] tempBuffer = null; /** * Create a new FloatInputStream that shadows the sourceStream. * * @param sourceStream * @throws IllegalArgumentException if the stream's format is not compatible */ public FloatInputStream(AudioInputStream sourceStream) { super(sourceStream, sourceStream.getFormat(), sourceStream.getFrameLength()); this.sourceStream = sourceStream; init(); } /** * Create a new FloatInputStream that shadows the sourceStream. * * @param sourceStream * @param format the native format of sourceStream * @param frameLength the length in frames of the streams, or * AudioSystem.NOT_SPECIFIED if not known or unlimited. * @throws IllegalArgumentException if the stream's format is not compatible */ public FloatInputStream(InputStream sourceStream, AudioFormat format, long frameLength) { super(sourceStream, format, frameLength); this.sourceStream = sourceStream; init(); } /** * Create a new FloatInputStream that will make the specified * FloatSampleInput a complete AudioInputStream. * * @param sourceInput * @param format the native format for the read(byte[]) method * @param frameLength the length in frames of the stream, or * AudioSystem.NOT_SPECIFIED if not known or unlimited. * @throws IllegalArgumentException if the format is not compatible */ public FloatInputStream(FloatSampleInput sourceInput, AudioFormat format, long frameLength) { super(new ByteArrayInputStream(new byte[0]), format, frameLength); this.sourceStream = null; this.sourceInput = sourceInput; init(); } // interface FloatSampleInput public void read(FloatSampleBuffer outBuffer) { read(outBuffer, 0, outBuffer.getSampleCount()); } private void init() { if (sourceStream != null && (sourceStream instanceof FloatSampleInput)) { sourceInput = (FloatSampleInput) sourceStream; } // make sure format is supported, and remember format code FloatSampleBuffer.checkFormatSupported(format); } public void read(FloatSampleBuffer buffer, int offset, int sampleCount) { if (sampleCount == 0 || isDone()) { buffer.setSampleCount(offset, true); return; } if (buffer.getChannelCount() != getChannels()) { throw new IllegalArgumentException( "read: passed buffer has different channel count"); } if (sourceInput != null) { sourceInput.read(buffer, offset, sampleCount); } else { // read into temporary byte buffer int byteBufferSize = buffer.getSampleCount() * getFormat().getFrameSize(); if (tempBuffer == null || byteBufferSize > tempBuffer.length) { tempBuffer = new byte[byteBufferSize]; } int readBytes; try { readBytes = sourceStream.read(tempBuffer, 0, byteBufferSize); } catch (IOException ioe) { readBytes = -1; } if (readBytes < 0) { eofReached = true; readBytes = 0; } int readSamples = readBytes / getFormat().getFrameSize(); buffer.setSampleCount(offset + readSamples, true); if (readSamples > 0) { // convert buffer.setSamplesFromBytes(tempBuffer, 0, getFormat(), offset, readSamples); } } } /* * (non-Javadoc) * * @see org.tritonus.share.sampled.FloatSampleInput#getChannels() */ public int getChannels() { return getFormat().getChannels(); } /* * (non-Javadoc) * * @see org.tritonus.share.sampled.FloatSampleInput#getSampleRate() */ public float getSampleRate() { return getFormat().getSampleRate(); } /* * (non-Javadoc) * * @see org.tritonus.share.sampled.FloatSampleInput#isDone() */ public boolean isDone() { if (!eofReached && sourceInput != null) { return sourceInput.isDone(); } return eofReached; } // interface AudioInputStream public int read() throws IOException { if (getFormat().getFrameSize() != 1) { throw new IOException("frame size must be 1 to read a single byte"); } // very ugly, but efficient. Who uses this method anyway ? byte[] temp = new byte[1]; int result = read(temp); if (result <= 0) { return -1; } return temp[0] & 0xFF; } /** * @see #read(byte[], int, int) */ public int read(byte[] abData) throws IOException { return read(abData, 0, abData.length); } private FloatSampleBuffer tempFloatBuffer = null; /** * If an underlying InputStream is available, read from it, otherwise read * from an underlying FloatSampleInput stream and convert to a byte array. */ public int read(byte[] abData, int nOffset, int nLength) throws IOException { if (isDone()) { return -1; } // read from sourceStream, if available if (sourceStream != null) { return readBytesFromInputStream(abData, nOffset,nLength); } // otherwise read from sourceInput return readBytesFromFloatInput(abData, nOffset,nLength); } /** * internal method to read from the underlying InputStream.
* Precondition: sourceStream!=null */ protected int readBytesFromInputStream(byte[] abData, int nOffset, int nLength) throws IOException { int readBytes = sourceStream.read(abData, nOffset, nLength); if (readBytes < 0) { eofReached = true; } return readBytes; } /** * internal method to read from the underlying InputStream.
* Precondition: sourceInput!=null * @param abData: the byte array to fill, or null if just skipping */ protected int readBytesFromFloatInput(byte[] abData, int nOffset, int nLength) throws IOException { if (sourceInput.isDone()) { return -1; } int frameCount = nLength / getFormat().getFrameSize(); if (tempFloatBuffer == null) { tempFloatBuffer = new FloatSampleBuffer(getFormat().getChannels(), frameCount, getFormat().getSampleRate()); } else { tempFloatBuffer.setSampleCount(frameCount, false); } sourceInput.read(tempFloatBuffer); if (abData != null) { int writtenBytes = tempFloatBuffer.convertToByteArray(abData, nOffset, getFormat()); return writtenBytes; } // special mode: allow abData to be null for skip() return frameCount * getFormat().getFrameSize(); } public synchronized long skip(long nSkip) throws IOException { // only returns integral frames long skipFrames = nSkip / getFormat().getFrameSize(); if (sourceStream != null) { return sourceStream.skip(skipFrames * getFormat().getFrameSize()); } // for FloatSampleInput, there is no skip() method, so just read into // the tempBuffer if (isDone() || skipFrames <= 0) { // cannot skip backwards return 0; } return readBytesFromFloatInput(null, 0, (int) (skipFrames * getFormat().getFrameSize())); } public int available() throws IOException { if (sourceStream != null) { return sourceStream.available(); } return AudioSystem.NOT_SPECIFIED; } public void mark(int readlimit) { if (sourceStream != null) { sourceStream.mark(readlimit); } else { // what to do? } } public void reset() throws IOException { if (sourceStream != null) { sourceStream.reset(); } else { // what to do? } } public boolean markSupported() { if (sourceStream != null) { return sourceStream.markSupported(); } return false; } public void close() throws IOException { if (eofReached) { return; } eofReached = true; if (sourceStream != null) { sourceStream.close(); } // clean memory, this will also be an indicator that // the stream is closed tempBuffer = null; tempFloatBuffer = null; } } libtritonus-java-20070428/src/classes/org/tritonus/share/sampled/FloatSampleBuffer.java0000644000175000017500000010650410533277112031061 0ustar twernertwerner/* * FloatSampleBuffer.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2000-2006 by Florian Bomers * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.share.sampled; import javax.sound.sampled.AudioFormat; /** * A class for small buffers of samples in linear, 32-bit floating point format. *

* It is supposed to be a replacement of the byte[] stream architecture of * JavaSound, especially for chains of AudioInputStreams. Ideally, all involved * AudioInputStreams handle reading into a FloatSampleBuffer. *

* Specifications: *

    *
  1. Channels are separated, i.e. for stereo there are 2 float arrays with * the samples for the left and right channel *
  2. All data is handled in samples, where one sample means one float value * in each channel *
  3. All samples are normalized to the interval [-1.0...1.0] *
*

* When a cascade of AudioInputStreams use FloatSampleBuffer for processing, * they may implement the interface FloatSampleInput. This signals that this * stream may provide float buffers for reading. The data is not * converted back to bytes, but stays in a single buffer that is passed from * stream to stream. For that serves the read(FloatSampleBuffer) method, which * is then used as replacement for the byte-based read functions of * AudioInputStream.
* However, backwards compatibility must always be retained, so even when an * AudioInputStream implements FloatSampleInput, it must work the same way when * any of the byte-based read methods is called.
* As an example, consider the following set-up:
*

    *
  • auAIS is an AudioInputStream (AIS) that reads from an AU file in 8bit * pcm at 8000Hz. It does not implement FloatSampleInput. *
  • pcmAIS1 is an AIS that reads from auAIS and converts the data to PCM * 16bit. This stream implements FloatSampleInput, i.e. it can generate float * audio data from the ulaw samples. *
  • pcmAIS2 reads from pcmAIS1 and adds a reverb. It operates entirely on * floating point samples. *
  • The method that reads from pcmAIS2 (i.e. AudioSystem.write) does not * handle floating point samples. *
* So, what happens when a block of samples is read from pcmAIS2 ? *
    *
  1. the read(byte[]) method of pcmAIS2 is called *
  2. pcmAIS2 always operates on floating point samples, so it uses an own * instance of FloatSampleBuffer and initializes it with the number of samples * requested in the read(byte[]) method. *
  3. It queries pcmAIS1 for the FloatSampleInput interface. As it implements * it, pcmAIS2 calls the read(FloatSampleBuffer) method of pcmAIS1. *
  4. pcmAIS1 notes that its underlying stream does not support floats, so it * instantiates a byte buffer which can hold the number of samples of the * FloatSampleBuffer passed to it. It calls the read(byte[]) method of auAIS. *
  5. auAIS fills the buffer with the bytes. *
  6. pcmAIS1 calls the initFromByteArray method of the float * buffer to initialize it with the 8 bit data. *
  7. Then pcmAIS1 processes the data: as the float buffer is normalized, it * does nothing with the buffer - and returns control to pcmAIS2. The * SampleSizeInBits field of the AudioFormat of pcmAIS1 defines that it should * be 16 bits. *
  8. pcmAIS2 receives the filled buffer from pcmAIS1 and does its processing * on the buffer - it adds the reverb. *
  9. As pcmAIS2's read(byte[]) method had been called, pcmAIS2 calls the * convertToByteArray method of the float buffer to fill the byte * buffer with the resulting samples. *
*

* To summarize, here are some advantages when using a FloatSampleBuffer for * streaming: *

    *
  • no conversions from/to bytes need to be done during processing *
  • the sample size in bits is irrelevant - normalized range *
  • higher quality for processing *
  • separated channels (easy process/remove/add channels) *
  • potentially less copying of audio data, as processing the float samples * is generally done in-place. The same instance of a FloatSampleBuffer may be * used from the original data source to the final data sink. *
*

* Simple benchmarks showed that the processing requirements for the conversion * to and from float is about the same as when converting it to shorts or ints * without dithering, and significantly higher with dithering. An own * implementation of a random number generator may improve this. *

* "Lazy" deletion of samples and channels:
*

    *
  • When the sample count is reduced, the arrays are not resized, but only * the member variable sampleCount is reduced. A subsequent * increase of the sample count (which will occur frequently), will check that * and eventually reuse the existing array. *
  • When a channel is deleted, it is not removed from memory but only * hidden. Subsequent insertions of a channel will check whether a hidden * channel can be reused. *
* The lazy mechanism can save many array instantiation (and copy-) operations * for the sake of performance. All relevant methods exist in a second version * which allows explicitely to disable lazy deletion. *

* Use the reset functions to clear the memory and remove hidden * samples and channels. *

* Note that the lazy mechanism implies that the arrays returned from * getChannel(int) may have a greater size than getSampleCount(). * Consequently, be sure to never rely on the length field of the sample arrays. *

* As an example, consider a chain of converters that all act on the same * instance of FloatSampleBuffer. Some converters may decrease the sample count * (e.g. sample rate converter) and delete channels (e.g. PCM2PCM converter). * So, processing of one block will decrease both. For the next block, all * starts from the beginning. With the lazy mechanism, all float arrays are only * created once for processing all blocks.
* Having lazy disabled would require for each chunk that is processed *

    *
  1. new instantiation of all channel arrays at the converter chain beginning * as they have been either deleted or decreased in size during processing of * the previous chunk, and *
  2. re-instantiation of all channel arrays for the reduction of the sample * count. *
*

* Dithering:
* By default, this class uses dithering for reduction of sample width (e.g. * original data was 16bit, target data is 8bit). As dithering may be needed in * other cases (especially when the float samples are processed using DSP * algorithms), or it is preferred to switch it off, dithering can be * explicitely switched on or off with the method setDitherMode(int).
* For a discussion about dithering, see here * and * here. * * @author Florian Bomers */ public class FloatSampleBuffer { /** Whether the functions without lazy parameter are lazy or not. */ private static final boolean LAZY_DEFAULT = true; // one float array for each channel private Object[] channels = new Object[2]; private int sampleCount = 0; private int channelCount = 0; private float sampleRate = 0; private int originalFormatType = 0; /** * Constant for setDitherMode: dithering will be enabled if sample size is * decreased */ public static final int DITHER_MODE_AUTOMATIC = 0; /** Constant for setDitherMode: dithering will be done */ public static final int DITHER_MODE_ON = 1; /** Constant for setDitherMode: dithering will not be done */ public static final int DITHER_MODE_OFF = 2; private float ditherBits = FloatSampleTools.DEFAULT_DITHER_BITS; // e.g. the sample rate converter may want to force dithering private int ditherMode = DITHER_MODE_AUTOMATIC; // ////////////////////////////// initialization ////////////////////// /** * Create an instance with initially no channels. */ public FloatSampleBuffer() { this(0, 0, 1); } /** * Create an empty FloatSampleBuffer with the specified number of channels, * samples, and the specified sample rate. */ public FloatSampleBuffer(int channelCount, int sampleCount, float sampleRate) { init(channelCount, sampleCount, sampleRate, LAZY_DEFAULT); } /** * Creates a new instance of FloatSampleBuffer and initializes it with audio * data given in the interleaved byte array buffer. */ public FloatSampleBuffer(byte[] buffer, int offset, int byteCount, AudioFormat format) { this(format.getChannels(), byteCount / (format.getSampleSizeInBits() / 8 * format.getChannels()), format.getSampleRate()); initFromByteArray(buffer, offset, byteCount, format); } /** * Initialize this sample buffer to have the specified channels, sample * count, and sample rate. If LAZY_DEFAULT is true, as much as possible will * existing arrays be reused. Otherwise, any hidden channels are freed. * * @param newChannelCount * @param newSampleCount * @param newSampleRate * @throws IllegalArgumentException if newChannelCount or newSampleCount are * negative, or newSampleRate is not positive. */ public void init(int newChannelCount, int newSampleCount, float newSampleRate) { init(newChannelCount, newSampleCount, newSampleRate, LAZY_DEFAULT); } /** * Initialize this sample buffer to have the specified channels, sample * count, and sample rate. If lazy is true, as much as possible will * existing arrays be reused. Otherwise, any hidden channels are freed. * * @param newChannelCount * @param newSampleCount * @param newSampleRate * @param lazy * @throws IllegalArgumentException if newChannelCount or newSampleCount are * negative, or newSampleRate is not positive. */ public void init(int newChannelCount, int newSampleCount, float newSampleRate, boolean lazy) { if (newChannelCount < 0 || newSampleCount < 0 || newSampleRate <= 0.0f) { throw new IllegalArgumentException( "invalid parameters in initialization of FloatSampleBuffer."); } setSampleRate(newSampleRate); if (this.sampleCount != newSampleCount || this.channelCount != newChannelCount) { createChannels(newChannelCount, newSampleCount, lazy); } } /** * Verify that the specified AudioFormat can be converted to and from. * If the format is not supported, an IllegalArgumentException is thrown. * @throws IllegalArgumentException if the format is not supported */ public static void checkFormatSupported(AudioFormat format) { FloatSampleTools.getFormatType(format); } /** * Grow the channels array to allow at least channelCount elements. If * !lazy, then channels will be resized to be exactly channelCount elements. * The new elements will be null. * * @param newChannelCount * @param lazy */ private final void grow(int newChannelCount, boolean lazy) { if (channels.length < newChannelCount || !lazy) { Object[] newChannels = new Object[newChannelCount]; System.arraycopy(channels, 0, newChannels, 0, (channelCount < newChannelCount) ? channelCount : newChannelCount); this.channels = newChannels; } } private final void createChannels(int newChannelCount, int newSampleCount, boolean lazy) { // shortcut if (lazy && newChannelCount <= channelCount && newSampleCount <= this.sampleCount) { setSampleCountImpl(newSampleCount); setChannelCountImpl(newChannelCount); return; } setSampleCountImpl(newSampleCount); // grow the array, if necessary. Intentionally lazy here! grow(newChannelCount, true); // lazy delete of all channels. Intentionally lazy ! setChannelCountImpl(0); for (int ch = 0; ch < newChannelCount; ch++) { insertChannel(ch, false, lazy); } // if not lazy, remove hidden channels grow(newChannelCount, lazy); } /** * Resets this buffer with the audio data specified in the arguments. This * FloatSampleBuffer's sample count will be set to * byteCount / format.getFrameSize(). If LAZY_DEFAULT is * true, it will use lazy deletion. * * @throws IllegalArgumentException */ public void initFromByteArray(byte[] buffer, int offset, int byteCount, AudioFormat format) { initFromByteArray(buffer, offset, byteCount, format, LAZY_DEFAULT); } /** * Resets this buffer with the audio data specified in the arguments. This * FloatSampleBuffer's sample count will be set to * byteCount / format.getFrameSize(). * * @param lazy if true, then existing channels will be tried to be re-used * to minimize garbage collection. * @throws IllegalArgumentException */ public void initFromByteArray(byte[] buffer, int offset, int byteCount, AudioFormat format, boolean lazy) { if (offset + byteCount > buffer.length) { throw new IllegalArgumentException( "FloatSampleBuffer.initFromByteArray: buffer too small."); } int thisSampleCount = byteCount / format.getFrameSize(); init(format.getChannels(), thisSampleCount, format.getSampleRate(), lazy); // save format for automatic dithering mode originalFormatType = FloatSampleTools.getFormatType(format); FloatSampleTools.byte2float(buffer, offset, channels, 0, sampleCount, format); } /** * Resets this sample buffer with the data in source. */ public void initFromFloatSampleBuffer(FloatSampleBuffer source) { init(source.getChannelCount(), source.getSampleCount(), source.getSampleRate()); for (int ch = 0; ch < getChannelCount(); ch++) { System.arraycopy(source.getChannel(ch), 0, getChannel(ch), 0, sampleCount); } } /** * Deletes all channels, frees memory... This also removes hidden channels * by lazy remove. */ public void reset() { init(0, 0, 1, false); } /** * Destroys any existing data and creates new channels. It also destroys * lazy removed channels and samples. Channels will not be silenced, though. */ public void reset(int newChannels, int newSampleCount, float newSampleRate) { init(newChannels, newSampleCount, newSampleRate, false); } // //////////////////////// conversion back to bytes /////////////////// /** * @return the required size of the buffer for calling * convertToByteArray(..) is called */ public int getByteArrayBufferSize(AudioFormat format) { return getByteArrayBufferSize(format, getSampleCount()); } /** * @param lenInSamples how many samples to be considered * @return the required size of the buffer for the given number of samples * for calling convertToByteArray(..) */ public int getByteArrayBufferSize(AudioFormat format, int lenInSamples) { // make sure this format is supported checkFormatSupported(format); return format.getFrameSize() * lenInSamples; } /** * Writes this sample buffer's audio data to buffer as an * interleaved byte array. buffer must be large enough to * hold all data. * * @throws IllegalArgumentException when buffer is too small or * format doesn't match * @return number of bytes written to buffer */ public int convertToByteArray(byte[] buffer, int offset, AudioFormat format) { return convertToByteArray(0, getSampleCount(), buffer, offset, format); } // cache for performance private AudioFormat lastConvertToByteArrayFormat = null; private int lastConvertToByteArrayFormatCode = 0; /** * Writes this sample buffer's audio data to buffer as an * interleaved byte array. buffer must be large enough to * hold all data. * * @param readOffset the sample offset from where samples are read from this * FloatSampleBuffer * @param lenInSamples how many samples are converted * @param buffer the byte buffer written to * @param writeOffset the byte offset in buffer * @throws IllegalArgumentException when buffer is too small or * format doesn't match * @return number of bytes written to buffer */ public int convertToByteArray(int readOffset, int lenInSamples, byte[] buffer, int writeOffset, AudioFormat format) { int byteCount = format.getFrameSize() * lenInSamples; if (writeOffset + byteCount > buffer.length) { throw new IllegalArgumentException( "FloatSampleBuffer.convertToByteArray: buffer too small."); } if (format != lastConvertToByteArrayFormat) { if (format.getSampleRate() != getSampleRate()) { throw new IllegalArgumentException( "FloatSampleBuffer.convertToByteArray: different samplerates."); } if (format.getChannels() != getChannelCount()) { throw new IllegalArgumentException( "FloatSampleBuffer.convertToByteArray: different channel count."); } lastConvertToByteArrayFormat = format; lastConvertToByteArrayFormatCode = FloatSampleTools.getFormatType(format); } FloatSampleTools.float2byte(channels, readOffset, buffer, writeOffset, lenInSamples, lastConvertToByteArrayFormatCode, format.getChannels(), format.getFrameSize(), getConvertDitherBits(lastConvertToByteArrayFormatCode)); return byteCount; } /** * Creates a new byte[] buffer, fills it with the audio data, and returns * it. * * @throws IllegalArgumentException when sample rate or channels do not * match * @see #convertToByteArray(byte[], int, AudioFormat) */ public byte[] convertToByteArray(AudioFormat format) { // throws exception when sampleRate doesn't match // creates a new byte[] buffer and returns it byte[] res = new byte[getByteArrayBufferSize(format)]; convertToByteArray(res, 0, format); return res; } // ////////////////////////////// actions ///////////////////////////////// /** * Resizes this buffer. *

* If keepOldSamples is true, as much as possible samples are * retained. If the buffer is enlarged, silence is added at the end. If * keepOldSamples is false, existing samples may get * discarded, the buffer may then contain random samples. */ public void changeSampleCount(int newSampleCount, boolean keepOldSamples) { int oldSampleCount = getSampleCount(); // shortcut: if we just make this buffer smaller, just set new // sampleCount if (oldSampleCount >= newSampleCount) { setSampleCountImpl(newSampleCount); return; } // shortcut for one or 2 channels if (channelCount == 1 || channelCount == 2) { float[] ch = getChannel(0); if (ch.length < newSampleCount) { float[] newCh = new float[newSampleCount]; if (keepOldSamples && oldSampleCount > 0) { // copy old samples System.arraycopy(ch, 0, newCh, 0, oldSampleCount); } channels[0] = newCh; } else if (keepOldSamples) { // silence out excess samples (according to the specification) for (int i = oldSampleCount; i < newSampleCount; i++) { ch[i] = 0.0f; } } if (channelCount == 2) { ch = getChannel(1); if (ch.length < newSampleCount) { float[] newCh = new float[newSampleCount]; if (keepOldSamples && oldSampleCount > 0) { // copy old samples System.arraycopy(ch, 0, newCh, 0, oldSampleCount); } channels[1] = newCh; } else if (keepOldSamples) { // silence out excess samples (according to the // specification) for (int i = oldSampleCount; i < newSampleCount; i++) { ch[i] = 0.0f; } } } setSampleCountImpl(newSampleCount); return; } Object[] oldChannels = null; if (keepOldSamples) { oldChannels = getAllChannels(); } init(getChannelCount(), newSampleCount, getSampleRate()); if (keepOldSamples) { // copy old channels and eventually silence out new samples int copyCount = newSampleCount < oldSampleCount ? newSampleCount : oldSampleCount; for (int ch = 0; ch < this.channelCount; ch++) { float[] oldSamples = (float[]) oldChannels[ch]; float[] newSamples = (float[]) channels[ch]; if (oldSamples != newSamples) { // if this sample array was not object of lazy delete System.arraycopy(oldSamples, 0, newSamples, 0, copyCount); } if (oldSampleCount < newSampleCount) { // silence out new samples for (int i = oldSampleCount; i < newSampleCount; i++) { newSamples[i] = 0.0f; } } } } } /** * Silence the entire audio buffer. */ public void makeSilence() { makeSilence(0, getSampleCount()); } /** * Silence the entire buffer in the specified range on all channels. */ public void makeSilence(int offset, int count) { if (offset < 0 || (count + offset) > getSampleCount() || count < 0) { throw new IllegalArgumentException( "offset and/or sampleCount out of bounds"); } // silence all channels int localChannelCount = getChannelCount(); for (int ch = 0; ch < localChannelCount; ch++) { makeSilence(getChannel(ch), offset, count); } } /** * Silence the specified channel */ public void makeSilence(int channel) { makeSilence(channel, 0, getSampleCount()); } /** * Silence the specified channel in the specified range */ public void makeSilence(int channel, int offset, int count) { if (offset < 0 || (count + offset) > getSampleCount() || count < 0) { throw new IllegalArgumentException( "offset and/or sampleCount out of bounds"); } makeSilence(getChannel(channel), offset, count); } private void makeSilence(float[] samples, int offset, int count) { count += offset; for (int i = offset; i < count; i++) { samples[i] = 0.0f; } } public void addChannel(boolean silent) { // creates new, silent channel insertChannel(getChannelCount(), silent); } /** * Insert a (silent) channel at position index. If * LAZY_DEFAULT is true, this is done lazily. */ public void insertChannel(int index, boolean silent) { insertChannel(index, silent, LAZY_DEFAULT); } /** * Inserts a channel at position index. *

* If silent is true, the new channel will be silent. * Otherwise it will contain random data. *

* If lazy is true, hidden channels which have at least * getSampleCount() elements will be examined for reusage as inserted * channel.
* If lazy is false, still hidden channels are reused, but it * is assured that the inserted channel has exactly getSampleCount() * elements, thus not wasting memory. */ public void insertChannel(int index, boolean silent, boolean lazy) { // first grow the array of channels, if necessary. Intentionally lazy grow(this.channelCount + 1, true); int physSize = channels.length; int virtSize = this.channelCount; float[] newChannel = null; if (physSize > virtSize) { // there are hidden channels. Try to use one. for (int ch = virtSize; ch < physSize; ch++) { float[] thisChannel = (float[]) channels[ch]; if (thisChannel != null && ((lazy && thisChannel.length >= getSampleCount()) || (!lazy && thisChannel.length == getSampleCount()))) { // we found a matching channel. Use it ! newChannel = thisChannel; channels[ch] = null; break; } } } if (newChannel == null) { newChannel = new float[getSampleCount()]; } // move channels after index for (int i = index; i < virtSize; i++) { channels[i + 1] = channels[i]; } channels[index] = newChannel; setChannelCountImpl(this.channelCount + 1); if (silent) { makeSilence(index); } // if not lazy, remove old channels grow(this.channelCount, lazy); } /** performs a lazy remove of the channel */ public void removeChannel(int channel) { removeChannel(channel, LAZY_DEFAULT); } /** * Removes a channel. If lazy is true, the channel is not physically * removed, but only hidden. These hidden channels are reused by subsequent * calls to addChannel or insertChannel. */ public void removeChannel(int channel, boolean lazy) { float[] toBeDeleted = (float[]) channels[channel]; // move all channels after it for (int i = channel; i < this.channelCount - 1; i++) { channels[i] = channels[i + 1]; } if (!lazy) { grow(this.channelCount - 1, true); } else { // if not already, insert this channel at the end channels[this.channelCount - 1] = toBeDeleted; } setChannelCountImpl(channelCount - 1); } /** * both source and target channel have to exist. targetChannel will be * overwritten */ public void copyChannel(int sourceChannel, int targetChannel) { float[] source = getChannel(sourceChannel); float[] target = getChannel(targetChannel); System.arraycopy(source, 0, target, 0, getSampleCount()); } /** * Copies data inside all channel. When the 2 regions overlap, the behavior * is not specified. */ public void copy(int sourceIndex, int destIndex, int length) { int count = getChannelCount(); for (int i = 0; i < count; i++) { copy(i, sourceIndex, destIndex, length); } } /** * Copies data inside a channel. When the 2 regions overlap, the behavior is * not specified. */ public void copy(int channel, int sourceIndex, int destIndex, int length) { float[] data = getChannel(channel); int bufferCount = getSampleCount(); if (sourceIndex + length > bufferCount || destIndex + length > bufferCount || sourceIndex < 0 || destIndex < 0 || length < 0) { throw new IndexOutOfBoundsException("parameters exceed buffer size"); } System.arraycopy(data, sourceIndex, data, destIndex, length); } /** * Mix up of 1 channel to n channels.
* It copies the first channel to all newly created channels. * * @param targetChannelCount the number of channels that this sample buffer * will have after expanding. NOT the number of channels to add ! * @exception IllegalArgumentException if this buffer does not have one * channel before calling this method. */ public void expandChannel(int targetChannelCount) { // even more sanity... if (getChannelCount() != 1) { throw new IllegalArgumentException( "FloatSampleBuffer: can only expand channels for mono signals."); } for (int ch = 1; ch < targetChannelCount; ch++) { addChannel(false); copyChannel(0, ch); } } /** * Mix down of n channels to one channel.
* It uses a simple mixdown: all other channels are added to first channel.
* The volume is NOT lowered ! Be aware, this might cause clipping when * converting back to integer samples. */ public void mixDownChannels() { float[] firstChannel = getChannel(0); int localSampleCount = getSampleCount(); for (int ch = getChannelCount() - 1; ch > 0; ch--) { float[] thisChannel = getChannel(ch); for (int i = 0; i < localSampleCount; i++) { firstChannel[i] += thisChannel[i]; } removeChannel(ch); } } /** * Mixes buffer to this buffer by adding all samples. At * most, source's number of samples, number of channels are * mixed. None of the sample count, channel count or sample rate of either * buffer are changed. In particular, the caller needs to assure that the * sample rate of the buffers match. * * @param source the buffer to be mixed to this buffer */ public void mix(FloatSampleBuffer source) { int count = getSampleCount(); if (count > source.getSampleCount()) { count = source.getSampleCount(); } int localChannelCount = getChannelCount(); if (localChannelCount > source.getChannelCount()) { localChannelCount = source.getChannelCount(); } for (int ch = 0; ch < localChannelCount; ch++) { float[] thisChannel = getChannel(ch); float[] otherChannel = source.getChannel(ch); for (int i = 0; i < count; i++) { thisChannel[i] += otherChannel[i]; } } } /** * Copies the contents of this buffer to the destination buffer at the * destOffset. At most, dest's number of samples, number of * channels are copied. None of the sample count, channel count or sample * rate of either buffer are changed. In particular, the caller needs to * assure that the sample rate of the buffers match. * * @param dest the buffer to write to * @param destOffset the position in dest where to start * writing the samples of this buffer * @param count the number of samples to be copied */ public void copyTo(FloatSampleBuffer dest, int destOffset, int count) { if (count > getSampleCount()) { count = getSampleCount(); } if (count + destOffset > dest.getSampleCount()) { count = dest.getSampleCount() - destOffset; } int localChannelCount = getChannelCount(); if (localChannelCount > dest.getChannelCount()) { localChannelCount = dest.getChannelCount(); } for (int ch = 0; ch < localChannelCount; ch++) { System.arraycopy(getChannel(ch), 0, dest.getChannel(ch), destOffset, count); } } /** * Initializes audio data from the provided byte array. The float samples * are written at destOffset. This FloatSampleBuffer must be * big enough to accomodate the samples. *

* srcBuffer is read from index srcOffset to * (srcOffset + (lengthInSamples * format.getFrameSize()))input * @param format input buffer's audio format * @param floatOffset the offset where to write the float samples * @param frameCount number of samples to write to this sample buffer */ public void setSamplesFromBytes(byte[] input, int inByteOffset, AudioFormat format, int floatOffset, int frameCount) { if (floatOffset < 0 || frameCount < 0 || inByteOffset < 0) { throw new IllegalArgumentException( "FloatSampleBuffer.setSamplesFromBytes: negative inByteOffset, floatOffset, or frameCount"); } if (inByteOffset + (frameCount * format.getFrameSize()) > input.length) { throw new IllegalArgumentException( "FloatSampleBuffer.setSamplesFromBytes: input buffer too small."); } if (floatOffset + frameCount > getSampleCount()) { throw new IllegalArgumentException( "FloatSampleBuffer.setSamplesFromBytes: frameCount too large"); } FloatSampleTools.byte2float(input, inByteOffset, channels, floatOffset, frameCount, format, false); } // ////////////////////////////// properties ///////////////////////////// public int getChannelCount() { return channelCount; } public int getSampleCount() { return sampleCount; } public float getSampleRate() { return sampleRate; } /** * internal setter for channel count, just change the variable. From * outside, use addChannel, insertChannel, removeChannel */ protected void setChannelCountImpl(int newChannelCount) { if (channelCount != newChannelCount) { channelCount = newChannelCount; // remove cache this.lastConvertToByteArrayFormat = null; } } /** * internal setter for sample count, just change the variable. From outside, * use changeSampleCount */ protected void setSampleCountImpl(int newSampleCount) { if (sampleCount != newSampleCount) { sampleCount = newSampleCount; } } /** * Alias for changeSampleCount * * @param newSampleCount the new number of samples for this buffer * @param keepOldSamples if true, the new buffer will keep the current * samples in the arrays * @see #changeSampleCount(int, boolean)ngeSampleCount(int, boolean) */ public void setSampleCount(int newSampleCount, boolean keepOldSamples) { changeSampleCount(newSampleCount, keepOldSamples); } /** * Sets the sample rate of this buffer. NOTE: no conversion is done. The * samples are only re-interpreted. */ public void setSampleRate(float sampleRate) { if (sampleRate <= 0) { throw new IllegalArgumentException( "Invalid samplerate for FloatSampleBuffer."); } if (this.sampleRate != sampleRate) { this.sampleRate = sampleRate; // remove cache lastConvertToByteArrayFormat = null; } } /** * NOTE: the returned array may be larger than sampleCount. So in any case, * sampleCount is to be respected. */ public float[] getChannel(int channel) { if (channel >= this.channelCount) { throw new IllegalArgumentException( "FloatSampleBuffer: invalid channel number."); } return (float[]) channels[channel]; } /** * @return all channels as array */ public Object[] getAllChannels() { Object[] res = new Object[getChannelCount()]; for (int ch = 0; ch < getChannelCount(); ch++) { res[ch] = getChannel(ch); } return res; } /** * Set the number of bits for dithering. Typically, a value between 0.2 and * 0.9 gives best results. *

* Note: this value is only used, when dithering is actually performed. */ public void setDitherBits(float ditherBits) { if (ditherBits <= 0) { throw new IllegalArgumentException( "DitherBits must be greater than 0"); } this.ditherBits = ditherBits; } public float getDitherBits() { return ditherBits; } /** * Sets the mode for dithering. This can be one of: *

    *
  • DITHER_MODE_AUTOMATIC: it is decided automatically, whether * dithering is necessary - in general when sample size is decreased. *
  • DITHER_MODE_ON: dithering will be forced *
  • DITHER_MODE_OFF: dithering will not be done. *
*/ public void setDitherMode(int mode) { if (mode != DITHER_MODE_AUTOMATIC && mode != DITHER_MODE_ON && mode != DITHER_MODE_OFF) { throw new IllegalArgumentException("Illegal DitherMode"); } this.ditherMode = mode; } public int getDitherMode() { return ditherMode; } /** * @return the ditherBits parameter for the float2byte functions */ protected float getConvertDitherBits(int newFormatType) { // let's see whether dithering is necessary boolean doDither = false; switch (ditherMode) { case DITHER_MODE_AUTOMATIC: doDither = (originalFormatType & FloatSampleTools.F_SAMPLE_WIDTH_MASK) > (newFormatType & FloatSampleTools.F_SAMPLE_WIDTH_MASK); break; case DITHER_MODE_ON: doDither = true; break; case DITHER_MODE_OFF: doDither = false; break; } return doDither ? ditherBits : 0.0f; } } libtritonus-java-20070428/src/classes/org/tritonus/share/sampled/FloatSampleInput.java0000644000175000017500000000730010531071755030744 0ustar twernertwerner/* * FloatSampleInput.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2006 by Florian Bomers * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * - Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * - Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.share.sampled; /** * Master interface for all classes providing audio data in FloatSampleBuffers. * * @author florian */ public interface FloatSampleInput { /** * Fill the entire buffer with audio data. If fewer samples are read, this * method will use buffer.changeSampleCount() to adjust the size of the * buffer. If no samples can be written to the buffer, the buffer's sample * count will be set to 0. *

* The buffer's channel count and sample rate may not be changed by the * implementation of this method. * * @param buffer the buffer to be filled */ public void read(FloatSampleBuffer buffer); /** * Fill the specified portion of the buffer with the next audio data to be * read. If fewer samples are read, this method will use * buffer.changeSampleCount() to adjust the size of the buffer. If no * samples can be written to the buffer, the buffer's sample count will be * set to offset. *

* The buffer's channel count and sample rate may not be changed by the * implementation of this method. * * @param buffer the buffer to be filled * @param offset the start index, in samples, where to start filling the * buffer * @param sampleCount the number fo samples to fill into the buffer */ public void read(FloatSampleBuffer buffer, int offset, int sampleCount); /** * Determine if this stream has reached its end. If true, subsequent calls * to read() will return 0-sized buffers. * * @return true if this stream reached its end. */ public boolean isDone(); /** * @return the number of audio channels of the audio data that this stream * provides. If it can support a variable number of channels, this * method returns AudioSystem.NOT_SPECIFIED. */ public int getChannels(); /** * @return the sample rate of the audio data that this stream provides. If * it can support different sample rates, this method returns a * negative number, e.g. AudioSystem.NOT_SPECIFIED. */ public float getSampleRate(); } libtritonus-java-20070428/src/classes/org/tritonus/share/sampled/FloatSampleTools.java0000644000175000017500000007424110531072016030744 0ustar twernertwerner/* * FloatSampleTools.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2000-2006 by Florian Bomers * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.share.sampled; import java.util.*; import javax.sound.sampled.*; /** * Utility functions for handling data in normalized float arrays. Each sample * is linear in the range of [-1.0f, +1.0f]. *

* Currently, the following bit sizes are supported: *

    *
  • 8-bit *
  • 16-bit *
  • packed 24-bit (stored in 3 bytes) *
  • unpacked 24-bit (stored in 4 bytes) *
  • 32-bit *
* 8-bit data can be unsigned or signed. All other data is only supported in * signed encoding. * * @see FloatSampleBuffer * @author Florian Bomers */ public class FloatSampleTools { /** default number of bits to be dithered: 0.7f */ public static final float DEFAULT_DITHER_BITS = 0.7f; private static Random random = null; // sample width (must be in order !) static final int F_8 = 1; static final int F_16 = 2; static final int F_24_3 = 3; static final int F_24_4 = 4; static final int F_32 = 5; static final int F_SAMPLE_WIDTH_MASK = F_8 | F_16 | F_24_3 | F_24_4 | F_32; // format bit-flags static final int F_SIGNED = 8; static final int F_BIGENDIAN = 16; // supported formats static final int CT_8S = F_8 | F_SIGNED; static final int CT_8U = F_8; static final int CT_16SB = F_16 | F_SIGNED | F_BIGENDIAN; static final int CT_16SL = F_16 | F_SIGNED; static final int CT_24_3SB = F_24_3 | F_SIGNED | F_BIGENDIAN; static final int CT_24_3SL = F_24_3 | F_SIGNED; static final int CT_24_4SB = F_24_4 | F_SIGNED | F_BIGENDIAN; static final int CT_24_4SL = F_24_4 | F_SIGNED; static final int CT_32SB = F_32 | F_SIGNED | F_BIGENDIAN; static final int CT_32SL = F_32 | F_SIGNED; // ///////////////////////// initialization ////////////////////// // /** prevent instanciation */ private FloatSampleTools() { } // /////////////// FORMAT / FORMAT TYPE /////////////////////////// // /** * only allow "packed" samples -- currently no support for 18, 20 bits -- * except 24 bits stored in 4 bytes. * * @throws IllegalArgumentException */ static void checkSupportedSampleSize(int ssib, int channels, int frameSize) { if (ssib == 24 && frameSize == 4 * channels) { // 24 bits stored in 4 bytes is OK (24_4) return; } if ((ssib * channels) != frameSize * 8) { throw new IllegalArgumentException("unsupported sample size: " + ssib + " bits stored in " + (frameSize / channels) + " bytes."); } } /** * Get the formatType code from the given format. * * @throws IllegalArgumentException */ static int getFormatType(AudioFormat format) { boolean signed = format.getEncoding().equals( AudioFormat.Encoding.PCM_SIGNED); if (!signed && !format.getEncoding().equals( AudioFormat.Encoding.PCM_UNSIGNED)) { throw new IllegalArgumentException( "unsupported encoding: only PCM encoding supported."); } if (!signed && format.getSampleSizeInBits() != 8) { throw new IllegalArgumentException( "unsupported encoding: only 8-bit can be unsigned"); } checkSupportedSampleSize(format.getSampleSizeInBits(), format.getChannels(), format.getFrameSize()); int formatType = getFormatType(format.getSampleSizeInBits(), format.getFrameSize() / format.getChannels(), signed, format.isBigEndian()); return formatType; } /** * @throws IllegalArgumentException */ static int getFormatType(int ssib, int bytesPerSample, boolean signed, boolean bigEndian) { int res = 0; if (ssib == 24 || (bytesPerSample == ssib / 8)) { if (ssib == 8) { res = F_8; } else if (ssib == 16) { res = F_16; } else if (ssib == 24) { if (bytesPerSample == 3) { res = F_24_3; } else if (bytesPerSample == 4) { res = F_24_4; } } else if (ssib == 32) { res = F_32; } } if (res == 0) { throw new IllegalArgumentException( "ConversionTool: unsupported sample size of " + ssib + " bits per sample in " + bytesPerSample + " bytes."); } if (!signed && bytesPerSample > 1) { throw new IllegalArgumentException( "ConversionTool: unsigned samples larger than " + "8 bit are not supported"); } if (signed) { res |= F_SIGNED; } if (bigEndian && (ssib != 8)) { res |= F_BIGENDIAN; } return res; } static int getSampleSize(int formatType) { switch (formatType & F_SAMPLE_WIDTH_MASK) { case F_8: return 1; case F_16: return 2; case F_24_3: return 3; case F_24_4: return 4; case F_32: return 4; } return 0; } /** * Return a string representation of this format */ static String formatType2Str(int formatType) { String res = "" + formatType + ": "; switch (formatType & F_SAMPLE_WIDTH_MASK) { case F_8: res += "8bit"; break; case F_16: res += "16bit"; break; case F_24_3: res += "24_3bit"; break; case F_24_4: res += "24_4bit"; break; case F_32: res += "32bit"; break; } res += ((formatType & F_SIGNED) == F_SIGNED) ? " signed" : " unsigned"; if ((formatType & F_SAMPLE_WIDTH_MASK) != F_8) { res += ((formatType & F_BIGENDIAN) == F_BIGENDIAN) ? " big endian" : " little endian"; } return res; } // /////////////////// BYTE 2 FLOAT /////////////////////////////////// // private static final float twoPower7 = 128.0f; private static final float twoPower15 = 32768.0f; private static final float twoPower23 = 8388608.0f; private static final float twoPower31 = 2147483648.0f; private static final float invTwoPower7 = 1 / twoPower7; private static final float invTwoPower15 = 1 / twoPower15; private static final float invTwoPower23 = 1 / twoPower23; private static final float invTwoPower31 = 1 / twoPower31; /** * @see #byte2float(byte[] input, int inByteOffset, Object[] output, int * outOffset, int frameCount, AudioFormat format, boolean * allowAddChannel) */ public static void byte2float(byte[] input, int inByteOffset, List output, int outOffset, int frameCount, AudioFormat format) { byte2float(input, inByteOffset, output, outOffset, frameCount, format, true); } /** * @param output an array of float[] arrays * @throws ArrayIndexOutOfBoundsException if output does not * format.getChannels() elements * @see #byte2float(byte[] input, int inByteOffset, Object[] output, int * outOffset, int frameCount, AudioFormat format, boolean * allowAddChannel) */ public static void byte2float(byte[] input, int inByteOffset, Object[] output, int outOffset, int frameCount, AudioFormat format) { byte2float(input, inByteOffset, output, outOffset, frameCount, format, true); } /** * @param output an array of float[] arrays * @param allowAddChannel if true, and output has fewer channels than * format, then only output.length channels are filled * @throws ArrayIndexOutOfBoundsException if output does not * format.getChannels() elements * @see #byte2float(byte[] input, int inByteOffset, Object[] output, int * outOffset, int frameCount, AudioFormat format, boolean * allowAddChannel) */ public static void byte2float(byte[] input, int inByteOffset, Object[] output, int outOffset, int frameCount, AudioFormat format, boolean allowAddChannel) { int channels = format.getChannels(); if (!allowAddChannel && channels > output.length) { channels = output.length; } if (output.length < channels) { throw new ArrayIndexOutOfBoundsException( "too few channel output array"); } for (int channel = 0; channel < channels; channel++) { float[] data = (float[]) output[channel]; if (data.length < frameCount + outOffset) { data = new float[frameCount + outOffset]; output[channel] = data; } byte2floatGeneric(input, inByteOffset, format.getFrameSize(), data, outOffset, frameCount, format); inByteOffset += format.getFrameSize() / format.getChannels(); } } /** * Conversion function to convert an interleaved byte array to a List of * interleaved float arrays. The float arrays will contain normalized * samples in the range [-1.0, +1.0]. The input array provides bytes in the * format specified in format. *

* Only PCM formats are accepted. The method will convert all byte values * from input[inByteOffset] to * input[inByteOffset + (frameCount * format.getFrameSize()) - 1] * to floats from output(n)[outOffset] to * output(n)[outOffset + frameCount - 1] * * @param input the audio data in an byte array * @param inByteOffset index in input where to start the conversion * @param output list of float[] arrays which receive the converted audio * data. if the list does not contain enough elements, or * individual float arrays are not large enough, they are * created. * @param outOffset the start offset in output * @param frameCount number of frames to be converted * @param format the input format. Only packed PCM is allowed * @param allowAddChannel if true, channels may be added to * output to match the number of input channels, * otherwise, only the first output.size() channels of input data * are converted. * @throws IllegalArgumentException if one of the parameters is out of * bounds * @see #byte2floatInterleaved(byte[],int,float[],int,int,AudioFormat) */ public static void byte2float(byte[] input, int inByteOffset, List output, int outOffset, int frameCount, AudioFormat format, boolean allowAddChannel) { int channels = format.getChannels(); if (!allowAddChannel && channels > output.size()) { channels = output.size(); } for (int channel = 0; channel < channels; channel++) { float[] data; if (output.size() < channel) { data = new float[frameCount + outOffset]; output.add(data); } else { data = output.get(channel); if (data.length < frameCount + outOffset) { data = new float[frameCount + outOffset]; output.set(channel, data); } } byte2floatGeneric(input, inByteOffset, format.getFrameSize(), data, outOffset, frameCount, format); inByteOffset += format.getFrameSize() / format.getChannels(); } } /** * Conversion function to convert an interleaved byte array to an * interleaved float array. The float array will contain normalized samples * in the range [-1.0f, +1.0f]. The input array provides bytes in the format * specified in format. *

* Only PCM formats are accepted. The method will convert all byte values * from input[inByteOffset] to * input[inByteOffset + (frameCount * format.getFrameSize()) - 1] * to floats from output[outOffset] to * output[outOffset + (frameCount * format.getChannels()) - 1] * * @param input the audio data in an byte array * @param inByteOffset index in input where to start the conversion * @param output the float array that receives the converted audio data * @param outOffset the start offset in output * @param frameCount number of frames to be converted * @param format the input format. Only packed PCM is allowed * @throws IllegalArgumentException if one of the parameters is out of * bounds * @see #byte2float(byte[],int,List,int,int,AudioFormat) */ public static void byte2floatInterleaved(byte[] input, int inByteOffset, float[] output, int outOffset, int frameCount, AudioFormat format) { byte2floatGeneric(input, inByteOffset, format.getFrameSize() / format.getChannels(), output, outOffset, frameCount * format.getChannels(), format); } /** * Generic conversion function to convert a byte array to a float array. *

* Only PCM formats are accepted. The method will convert all bytes from * input[inByteOffset] to * input[inByteOffset + (sampleCount * (inByteStep - 1)] to * samples from output[outOffset] to * output[outOffset+sampleCount-1]. *

* The format's channel count is ignored. *

* For mono data, set inByteOffset to * format.getFrameSize().
* For converting interleaved input data, multiply sampleCount * by the number of channels and set inByteStep to * format.getFrameSize() / format.getChannels(). * * @param sampleCount number of samples to be written to output * @param inByteStep how many bytes advance for each output sample in * output. * @throws IllegalArgumentException if one of the parameters is out of * bounds * @see #byte2floatInterleaved(byte[],int,float[],int,int,AudioFormat) * @see #byte2float(byte[],int,List,int,int,AudioFormat) */ static void byte2floatGeneric(byte[] input, int inByteOffset, int inByteStep, float[] output, int outOffset, int sampleCount, AudioFormat format) { int formatType = getFormatType(format); byte2floatGeneric(input, inByteOffset, inByteStep, output, outOffset, sampleCount, formatType); } /** * Central conversion function from a byte array to a normalized float * array. In order to accomodate interleaved and non-interleaved samples, * this method takes inByteStep as parameter which can be used to flexibly * convert the data. *

* E.g.:
* mono->mono: inByteStep=format.getFrameSize()
* interleaved_stereo->interleaved_stereo: * inByteStep=format.getFrameSize()/2, sampleCount*2
* stereo->2 mono arrays:
* ---inByteOffset=0, outOffset=0, inByteStep=format.getFrameSize()
* ---inByteOffset=format.getFrameSize()/2, outOffset=1, * inByteStep=format.getFrameSize()
*/ static void byte2floatGeneric(byte[] input, int inByteOffset, int inByteStep, float[] output, int outOffset, int sampleCount, int formatType) { // if (TDebug.TraceAudioConverter) { // TDebug.out("FloatSampleTools.byte2floatGeneric, formatType=" // +formatType2Str(formatType)); // } int endCount = outOffset + sampleCount; int inIndex = inByteOffset; for (int outIndex = outOffset; outIndex < endCount; outIndex++, inIndex += inByteStep) { // do conversion switch (formatType) { case CT_8S: output[outIndex] = ((float) input[inIndex]) * invTwoPower7; break; case CT_8U: output[outIndex] = ((float) ((input[inIndex] & 0xFF) - 128)) * invTwoPower7; break; case CT_16SB: output[outIndex] = ((float) ((input[inIndex] << 8) | (input[inIndex + 1] & 0xFF))) * invTwoPower15; break; case CT_16SL: output[outIndex] = ((float) ((input[inIndex + 1] << 8) | (input[inIndex] & 0xFF))) * invTwoPower15; break; case CT_24_3SB: output[outIndex] = ((float) ((input[inIndex] << 16) | ((input[inIndex + 1] & 0xFF) << 8) | (input[inIndex + 2] & 0xFF))) * invTwoPower23; break; case CT_24_3SL: output[outIndex] = ((float) ((input[inIndex + 2] << 16) | ((input[inIndex + 1] & 0xFF) << 8) | (input[inIndex] & 0xFF))) * invTwoPower23; break; case CT_24_4SB: output[outIndex] = ((float) ((input[inIndex + 1] << 16) | ((input[inIndex + 2] & 0xFF) << 8) | (input[inIndex + 3] & 0xFF))) * invTwoPower23; break; case CT_24_4SL: // TODO: verify the indexes output[outIndex] = ((float) ((input[inIndex + 3] << 16) | ((input[inIndex + 2] & 0xFF) << 8) | (input[inIndex + 1] & 0xFF))) * invTwoPower23; break; case CT_32SB: output[outIndex] = ((float) ((input[inIndex] << 24) | ((input[inIndex + 1] & 0xFF) << 16) | ((input[inIndex + 2] & 0xFF) << 8) | (input[inIndex + 3] & 0xFF))) * invTwoPower31; break; case CT_32SL: output[outIndex] = ((float) ((input[inIndex + 3] << 24) | ((input[inIndex + 2] & 0xFF) << 16) | ((input[inIndex + 1] & 0xFF) << 8) | (input[inIndex] & 0xFF))) * invTwoPower31; break; default: throw new IllegalArgumentException("unsupported format=" + formatType2Str(formatType)); } } } // /////////////////// FLOAT 2 BYTE /////////////////////////////////// // private static byte quantize8(float sample, float ditherBits) { if (ditherBits != 0) { sample += random.nextFloat() * ditherBits; } if (sample >= 127.0f) { return (byte) 127; } else if (sample <= -128.0f) { return (byte) -128; } else { return (byte) (sample < 0 ? (sample - 0.5f) : (sample + 0.5f)); } } private static int quantize16(float sample, float ditherBits) { if (ditherBits != 0) { sample += random.nextFloat() * ditherBits; } if (sample >= 32767.0f) { return 32767; } else if (sample <= -32768.0f) { return -32768; } else { return (int) (sample < 0 ? (sample - 0.5f) : (sample + 0.5f)); } } private static int quantize24(float sample, float ditherBits) { if (ditherBits != 0) { sample += random.nextFloat() * ditherBits; } if (sample >= 8388607.0f) { return 8388607; } else if (sample <= -8388608.0f) { return -8388608; } else { return (int) (sample < 0 ? (sample - 0.5f) : (sample + 0.5f)); } } private static int quantize32(float sample, float ditherBits) { if (ditherBits != 0) { sample += random.nextFloat() * ditherBits; } if (sample >= 2147483647.0f) { return 2147483647; } else if (sample <= -2147483648.0f) { return -2147483648; } else { return (int) (sample < 0 ? (sample - 0.5f) : (sample + 0.5f)); } } /** * Conversion function to convert a non-interleaved float audio data to an * interleaved byte array. The float arrays contains normalized samples in * the range [-1.0f, +1.0f]. The output array will receive bytes in the * format specified in format. Exactly * format.getChannels() channels are converted regardless of * the number of elements in input. If input * does not provide enough channels, an IllegalArgumentException * is thrown. *

* Only PCM formats are accepted. The method will convert all samples from * input(n)[inOffset] to * input(n)[inOffset + frameCount - 1] to byte values from * output[outByteOffset] to * output[outByteOffset + (frameCount * format.getFrameSize()) - 1] *

* Dithering should be used when the output resolution is significantly * lower than the original resolution. This includes if the original data * was 16-bit and it is now converted to 8-bit, or if the data was generated * in the float domain. No dithering need to be used if the original sample * data was in e.g. 8-bit and the resulting output data has a higher * resolution. If dithering is used, a sensitive value is * DEFAULT_DITHER_BITS. * * @param input a List of float arrays with the input audio data * @param inOffset index in the input arrays where to start the conversion * @param output the byte array that receives the converted audio data * @param outByteOffset the start offset in output * @param frameCount number of frames to be converted. * @param format the output format. Only packed PCM is allowed * @param ditherBits if 0, do not dither. Otherwise the number of bits to be * dithered * @throws IllegalArgumentException if one of the parameters is out of * bounds * @see #DEFAULT_DITHER_BITS * @see #float2byteInterleaved(float[],int,byte[],int,int,AudioFormat,float) */ public static void float2byte(List input, int inOffset, byte[] output, int outByteOffset, int frameCount, AudioFormat format, float ditherBits) { for (int channel = 0; channel < format.getChannels(); channel++) { float[] data = (float[]) input.get(channel); float2byteGeneric(data, inOffset, output, outByteOffset, format.getFrameSize(), frameCount, format, ditherBits); outByteOffset += format.getFrameSize() / format.getChannels(); } } /** * @param input an array of float[] arrays * @throws ArrayIndexOutOfBoundsException if one of the parameters is out of * bounds * @see #float2byte(List[] input, int inOffset, byte[] output, int * outByteOffset, int frameCount, AudioFormat format, float ditherBits) */ public static void float2byte(Object[] input, int inOffset, byte[] output, int outByteOffset, int frameCount, AudioFormat format, float ditherBits) { int channels = format.getChannels(); for (int channel = 0; channel < channels; channel++) { float[] data = (float[]) input[channel]; float2byteGeneric(data, inOffset, output, outByteOffset, format.getFrameSize(), frameCount, format, ditherBits); outByteOffset += format.getFrameSize() / format.getChannels(); } } /** * @param input an array of float[] arrays * @param channels how many channels to use from the input array * @param frameSize only as optimization, the number of bytes per sample * frame * @throws ArrayIndexOutOfBoundsException if one of the parameters is out of * bounds * @see #float2byte(List[] input, int inOffset, byte[] output, int * outByteOffset, int frameCount, AudioFormat format, float ditherBits) */ static void float2byte(Object[] input, int inOffset, byte[] output, int outByteOffset, int frameCount, int formatCode, int channels, int frameSize, float ditherBits) { int sampleSize = frameSize / channels; for (int channel = 0; channel < channels; channel++) { float[] data = (float[]) input[channel]; float2byteGeneric(data, inOffset, output, outByteOffset, frameSize, frameCount, formatCode, ditherBits); outByteOffset += sampleSize; } } /** * Conversion function to convert an interleaved float array to an * interleaved byte array. The float array contains normalized samples in * the range [-1.0f, +1.0f]. The output array will receive bytes in the * format specified in format. *

* Only PCM formats are accepted. The method will convert all samples from * input[inOffset] to * input[inOffset + (frameCount * format.getChannels()) - 1] * to byte values from output[outByteOffset] to * output[outByteOffset + (frameCount * format.getFrameSize()) - 1] *

* Dithering should be used when the output resolution is significantly * lower than the original resolution. This includes if the original data * was 16-bit and it is now converted to 8-bit, or if the data was generated * in the float domain. No dithering need to be used if the original sample * data was in e.g. 8-bit and the resulting output data has a higher * resolution. If dithering is used, a sensitive value is * DEFAULT_DITHER_BITS. * * @param input the audio data in normalized samples * @param inOffset index in input where to start the conversion * @param output the byte array that receives the converted audio data * @param outByteOffset the start offset in output * @param frameCount number of frames to be converted. * @param format the output format. Only packed PCM is allowed * @param ditherBits if 0, do not dither. Otherwise the number of bits to be * dithered * @throws IllegalArgumentException if one of the parameters is out of * bounds * @see #DEFAULT_DITHER_BITS * @see #float2byte(List,int,byte[],int,int,AudioFormat,float) */ public static void float2byteInterleaved(float[] input, int inOffset, byte[] output, int outByteOffset, int frameCount, AudioFormat format, float ditherBits) { float2byteGeneric(input, inOffset, output, outByteOffset, format.getFrameSize() / format.getChannels(), frameCount * format.getChannels(), format, ditherBits); } /** * Generic conversion function to convert a float array to a byte array. *

* Only PCM formats are accepted. The method will convert all samples from * input[inOffset] to * input[inOffset+sampleCount-1] to byte values from * output[outByteOffset] to * output[outByteOffset + (sampleCount * (outByteStep - 1)]. *

* The format's channel count is ignored. *

* For mono data, set outByteOffset to * format.getFrameSize().
* For converting interleaved input data, multiply sampleCount * by the number of channels and set outByteStep to * format.getFrameSize() / format.getChannels(). * * @param sampleCount number of samples in input to be converted. * @param outByteStep how many bytes advance for each input sample in * input. * @throws IllegalArgumentException if one of the parameters is out of * bounds * @see #float2byteInterleaved(float[],int,byte[],int,int,AudioFormat,float) * @see #float2byte(List,int,byte[],int,int,AudioFormat,float) */ static void float2byteGeneric(float[] input, int inOffset, byte[] output, int outByteOffset, int outByteStep, int sampleCount, AudioFormat format, float ditherBits) { int formatType = getFormatType(format); float2byteGeneric(input, inOffset, output, outByteOffset, outByteStep, sampleCount, formatType, ditherBits); } /** * Central conversion function from normalized float array to a byte array. * In order to accomodate interleaved and non-interleaved samples, this * method takes outByteStep as parameter which can be used to flexibly * convert the data. *

* E.g.:
* mono->mono: outByteStep=format.getFrameSize()
* interleaved stereo->interleaved stereo: * outByteStep=format.getFrameSize()/2, sampleCount*2
* 2 mono arrays->stereo:
* ---inOffset=0, outByteOffset=0, outByteStep=format.getFrameSize()
* ---inOffset=1, outByteOffset=format.getFrameSize()/2, * outByteStep=format.getFrameSize()
*/ static void float2byteGeneric(float[] input, int inOffset, byte[] output, int outByteOffset, int outByteStep, int sampleCount, int formatType, float ditherBits) { // if (TDebug.TraceAudioConverter) { // TDebug.out("FloatSampleBuffer.float2byteGeneric, formatType=" // +"formatType2Str(formatType)); // } if (inOffset < 0 || inOffset + sampleCount > input.length || sampleCount < 0) { throw new IllegalArgumentException("invalid input index: " + "input.length=" + input.length + " inOffset=" + inOffset + " sampleCount=" + sampleCount); } if (outByteOffset < 0 || outByteOffset + (sampleCount * outByteStep) >= (output.length + outByteStep) || outByteStep < getSampleSize(formatType)) { throw new IllegalArgumentException("invalid output index: " + "output.length=" + output.length + " outByteOffset=" + outByteOffset + " outByteStep=" + outByteStep + " sampleCount=" + sampleCount + " format=" + formatType2Str(formatType)); } if (ditherBits != 0.0f && random == null) { // create the random number generator for dithering random = new Random(); } int endSample = inOffset + sampleCount; int iSample; int outIndex = outByteOffset; for (int inIndex = inOffset; inIndex < endSample; inIndex++, outIndex += outByteStep) { // do conversion switch (formatType) { case CT_8S: output[outIndex] = quantize8(input[inIndex] * twoPower7, ditherBits); break; case CT_8U: output[outIndex] = (byte) (quantize8( (input[inIndex] * twoPower7), ditherBits) + 128); break; case CT_16SB: iSample = quantize16(input[inIndex] * twoPower15, ditherBits); output[outIndex] = (byte) (iSample >> 8); output[outIndex + 1] = (byte) (iSample & 0xFF); break; case CT_16SL: iSample = quantize16(input[inIndex] * twoPower15, ditherBits); output[outIndex + 1] = (byte) (iSample >> 8); output[outIndex] = (byte) (iSample & 0xFF); break; case CT_24_3SB: iSample = quantize24(input[inIndex] * twoPower23, ditherBits); output[outIndex] = (byte) (iSample >> 16); output[outIndex + 1] = (byte) ((iSample >>> 8) & 0xFF); output[outIndex + 2] = (byte) (iSample & 0xFF); break; case CT_24_3SL: iSample = quantize24(input[inIndex] * twoPower23, ditherBits); output[outIndex + 2] = (byte) (iSample >> 16); output[outIndex + 1] = (byte) ((iSample >>> 8) & 0xFF); output[outIndex] = (byte) (iSample & 0xFF); break; case CT_24_4SB: // TODO: verify iSample = quantize24(input[inIndex] * twoPower23, ditherBits); output[outIndex + 0] = 0; output[outIndex + 1] = (byte) (iSample >> 16); output[outIndex + 2] = (byte) ((iSample >>> 8) & 0xFF); output[outIndex + 3] = (byte) (iSample & 0xFF); break; case CT_24_4SL: // TODO: verify iSample = quantize24(input[inIndex] * twoPower23, ditherBits); output[outIndex + 3] = (byte) (iSample >> 16); output[outIndex + 2] = (byte) ((iSample >>> 8) & 0xFF); output[outIndex + 1] = (byte) (iSample & 0xFF); output[outIndex + 0] = 0; break; case CT_32SB: iSample = quantize32(input[inIndex] * twoPower31, ditherBits); output[outIndex] = (byte) (iSample >> 24); output[outIndex + 1] = (byte) ((iSample >>> 16) & 0xFF); output[outIndex + 2] = (byte) ((iSample >>> 8) & 0xFF); output[outIndex + 3] = (byte) (iSample & 0xFF); break; case CT_32SL: iSample = quantize32(input[inIndex] * twoPower31, ditherBits); output[outIndex + 3] = (byte) (iSample >> 24); output[outIndex + 2] = (byte) ((iSample >>> 16) & 0xFF); output[outIndex + 1] = (byte) ((iSample >>> 8) & 0xFF); output[outIndex] = (byte) (iSample & 0xFF); break; default: throw new IllegalArgumentException("unsupported format=" + formatType2Str(formatType)); } } } } libtritonus-java-20070428/src/classes/org/tritonus/share/sampled/TAudioFormat.java0000644000175000017500000000472710173661004030057 0ustar twernertwerner/* * TAudioFormat.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2003 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.share.sampled; import java.util.Collections; import java.util.HashMap; import java.util.Map; import javax.sound.sampled.AudioFormat; public class TAudioFormat extends AudioFormat { private Map m_properties; private Map m_unmodifiableProperties; public TAudioFormat(AudioFormat.Encoding encoding, float sampleRate, int sampleSizeInBits, int channels, int frameSize, float frameRate, boolean bigEndian, Map properties) { super(encoding, sampleRate, sampleSizeInBits, channels, frameSize, frameRate, bigEndian); initMaps(properties); } public TAudioFormat(float sampleRate, int sampleSizeInBits, int channels, boolean signed, boolean bigEndian, Map properties) { super(sampleRate, sampleSizeInBits, channels, signed, bigEndian); initMaps(properties); } private void initMaps(Map properties) { /* Here, we make a shallow copy of the map. It's unclear if this is sufficient (or if a deep copy should be made). */ m_properties = new HashMap(); m_properties.putAll(properties); m_unmodifiableProperties = Collections.unmodifiableMap(m_properties); } public Map properties() { return m_unmodifiableProperties; } protected void setProperty(String key, Object value) { m_properties.put(key, value); } } /*** TAudioFormat.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/share/sampled/TConversionTool.java0000644000175000017500000012153110173661004030621 0ustar twernertwerner/* * TConversionTool.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999,2000 by Florian Bomers * Copyright (c) 2000 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.share.sampled; /** * Useful methods for converting audio data. * * @author Florian Bomers * @author Matthias Pfisterer */ /* For convenience, a list of available methods is maintained here. Some hints: - buffers: always byte arrays - offsets: always in bytes - sampleCount: number of SAMPLES to read/write, as opposed to FRAMES or BYTES! - when in buffer and out buffer are given, the data is copied, otherwise it is replaced in the same buffer (buffer size is not checked!) - a number (except "2") gives the number of bits in which format the samples have to be. - >8 bits per sample is always treated signed. - all functions are tried to be optimized - hints welcome ! ** "high level" methods ** changeOrderOrSign(buffer, nOffset, nByteLength, nBytesPerSample) changeOrderOrSign(inBuffer, nInOffset, outBuffer, nOutOffset, nByteLength, nBytesPerSample) ** PCM byte order and sign conversion ** void convertSign8(buffer, byteOffset, sampleCount) void swapOrder16(buffer, byteOffset, sampleCount) void swapOrder24(buffer, byteOffset, sampleCount) void swapOrder32(buffer, byteOffset, sampleCount) void convertSign8(inBuffer, inByteOffset, outBuffer, outByteOffset, sampleCount) void swapOrder16(inBuffer, inByteOffset, outBuffer, outByteOffset, sampleCount) void swapOrder24(inBuffer, inByteOffset, outBuffer, outByteOffset, sampleCount) void swapOrder32(inBuffer, inByteOffset, outBuffer, outByteOffset, sampleCount) ** conversion functions for byte arrays ** ** these are for reference to see how to implement these conversions ** short bytesToShort16(highByte, lowByte) short bytesToShort16(buffer, byteOffset, bigEndian) short bytesToInt16(highByte, lowByte) short bytesToInt16(buffer, byteOffset, bigEndian) short bytesToInt24(buffer, byteOffset, bigEndian) short bytesToInt32(buffer, byteOffset, bigEndian) void shortToBytes16(sample, buffer, byteOffset, bigEndian) void intToBytes24(sample, buffer, byteOffset, bigEndian) void intToBytes32(sample, buffer, byteOffset, bigEndian) ** ULAW <-> PCM ** byte linear2ulaw(int sample) short ulaw2linear(int ulawbyte) void pcm162ulaw(buffer, byteOffset, sampleCount, bigEndian) void pcm162ulaw(inBuffer, inByteOffset, outBuffer, outByteOffset, sampleCount, bigEndian) void pcm82ulaw(buffer, byteOffset, sampleCount, signed) void pcm82ulaw(inBuffer, inByteOffset, outBuffer, outByteOffset, sampleCount, signed) void ulaw2pcm16(inBuffer, inByteOffset, outBuffer, outByteOffset, sampleCount, bigEndian) void ulaw2pcm8(buffer, byteOffset, sampleCount, signed) void ulaw2pcm8(inBuffer, inByteOffset, outBuffer, outByteOffset, sampleCount, signed) ** ALAW <-> PCM ** byte linear2alaw(short pcm_val) short alaw2linear(byte ulawbyte) void pcm162alaw(inBuffer, inByteOffset, outBuffer, outByteOffset, sampleCount, bigEndian) void pcm162alaw(buffer, byteOffset, sampleCount, bigEndian) void pcm82alaw(buffer, byteOffset, sampleCount, signed) void pcm82alaw(inBuffer, inByteOffset, outBuffer, outByteOffset, sampleCount, signed) void alaw2pcm16(inBuffer, inByteOffset, outBuffer, outByteOffset, sampleCount, bigEndian) void alaw2pcm8(buffer, byteOffset, sampleCount, signed) void alaw2pcm8(inBuffer, inByteOffset, outBuffer, outByteOffset, sampleCount, signed) ** ULAW <-> ALAW ** byte ulaw2alaw(byte sample) void ulaw2alaw(buffer, byteOffset, sampleCount) void ulaw2alaw(inBuffer, inByteOffset, outBuffer, outByteOffset, sampleCount) byte alaw2ulaw(byte sample) void alaw2ulaw(buffer, byteOffset, sampleCount) void alaw2ulaw(inBuffer, inByteOffset, outBuffer, outByteOffset, sampleCount) */ public class TConversionTool { ///////////////// sign/byte-order conversion /////////////////////////////////// public static void convertSign8(byte[] buffer, int byteOffset, int sampleCount) { sampleCount+=byteOffset; for (int i=byteOffset; i0) { outBuffer[outByteOffset++]=(byte)(inBuffer[inByteOffset++]+128); sampleCount--; } } public static void swapOrder16(byte[] inBuffer, int inByteOffset, byte[] outBuffer, int outByteOffset, int sampleCount) { while (sampleCount>0) { outBuffer[outByteOffset++]=inBuffer[inByteOffset+1]; outBuffer[outByteOffset++]=inBuffer[inByteOffset++]; inByteOffset++; sampleCount--; } } public static void swapOrder24(byte[] inBuffer, int inByteOffset, byte[] outBuffer, int outByteOffset, int sampleCount) { while (sampleCount>0) { outBuffer[outByteOffset++]=inBuffer[inByteOffset+2]; outByteOffset++; outBuffer[outByteOffset++]=inBuffer[inByteOffset++]; inByteOffset++; inByteOffset++; sampleCount--; } } public static void swapOrder32(byte[] inBuffer, int inByteOffset, byte[] outBuffer, int outByteOffset, int sampleCount) { while (sampleCount>0) { outBuffer[outByteOffset++]=inBuffer[inByteOffset+3]; outBuffer[outByteOffset++]=inBuffer[inByteOffset+2]; outBuffer[outByteOffset++]=inBuffer[inByteOffset+1]; outBuffer[outByteOffset++]=inBuffer[inByteOffset++]; inByteOffset++; inByteOffset++; inByteOffset++; sampleCount--; } } ///////////////// conversion functions for byte arrays //////////////////////////// /** * Converts 2 bytes to a signed sample of type short. *

This is a reference function. */ public static short bytesToShort16(byte highByte, byte lowByte) { return (short) ((highByte<<8) | (lowByte & 0xFF)); } /** * Converts 2 successive bytes starting at byteOffset in * buffer to a signed sample of type short. *

* For little endian, buffer[byteOffset] is interpreted as low byte, * whereas it is interpreted as high byte in big endian. *

This is a reference function. */ public static short bytesToShort16(byte[] buffer, int byteOffset, boolean bigEndian) { return bigEndian? ((short) ((buffer[byteOffset]<<8) | (buffer[byteOffset+1] & 0xFF))): ((short) ((buffer[byteOffset+1]<<8) | (buffer[byteOffset] & 0xFF))); } /** * Converts 2 bytes to a signed integer sample with 16bit range. *

This is a reference function. */ public static int bytesToInt16(byte highByte, byte lowByte) { return (highByte<<8) | (lowByte & 0xFF); } /** * Converts 2 successive bytes starting at byteOffset in * buffer to a signed integer sample with 16bit range. *

* For little endian, buffer[byteOffset] is interpreted as low byte, * whereas it is interpreted as high byte in big endian. *

This is a reference function. */ public static int bytesToInt16(byte[] buffer, int byteOffset, boolean bigEndian) { return bigEndian? ((buffer[byteOffset]<<8) | (buffer[byteOffset+1] & 0xFF)): ((buffer[byteOffset+1]<<8) | (buffer[byteOffset] & 0xFF)); } /** * Converts 3 successive bytes starting at byteOffset in * buffer to a signed integer sample with 24bit range. *

* For little endian, buffer[byteOffset] is interpreted as lowest byte, * whereas it is interpreted as highest byte in big endian. *

This is a reference function. */ public static int bytesToInt24(byte[] buffer, int byteOffset, boolean bigEndian) { return bigEndian? ((buffer[byteOffset]<<16) // let Java handle sign-bit | ((buffer[byteOffset+1] & 0xFF)<<8) // inhibit sign-bit handling | (buffer[byteOffset+2] & 0xFF)): ((buffer[byteOffset+2]<<16) // let Java handle sign-bit | ((buffer[byteOffset+1] & 0xFF)<<8) // inhibit sign-bit handling | (buffer[byteOffset] & 0xFF)); } /** * Converts a 4 successive bytes starting at byteOffset in * buffer to a signed 32bit integer sample. *

* For little endian, buffer[byteOffset] is interpreted as lowest byte, * whereas it is interpreted as highest byte in big endian. *

This is a reference function. */ public static int bytesToInt32(byte[] buffer, int byteOffset, boolean bigEndian) { return bigEndian? ((buffer[byteOffset]<<24) // let Java handle sign-bit | ((buffer[byteOffset+1] & 0xFF)<<16) // inhibit sign-bit handling | ((buffer[byteOffset+2] & 0xFF)<<8) // inhibit sign-bit handling | (buffer[byteOffset+3] & 0xFF)): ((buffer[byteOffset+3]<<24) // let Java handle sign-bit | ((buffer[byteOffset+2] & 0xFF)<<16) // inhibit sign-bit handling | ((buffer[byteOffset+1] & 0xFF)<<8) // inhibit sign-bit handling | (buffer[byteOffset] & 0xFF)); } /** * Converts a sample of type short to 2 bytes in an array. * sample is interpreted as signed (as Java does). *

* For little endian, buffer[byteOffset] is filled with low byte of sample, * and buffer[byteOffset+1] is filled with high byte of sample. *

For big endian, this is reversed. *

This is a reference function. */ public static void shortToBytes16(short sample, byte[] buffer, int byteOffset, boolean bigEndian) { intToBytes16(sample, buffer, byteOffset, bigEndian); } /** * Converts a 16 bit sample of type int to 2 bytes in an array. * sample is interpreted as signed (as Java does). *

* For little endian, buffer[byteOffset] is filled with low byte of sample, * and buffer[byteOffset+1] is filled with high byte of sample + sign bit. *

For big endian, this is reversed. *

Before calling this function, it should be assured that sample * is in the 16bit range - it will not be clipped. *

This is a reference function. */ public static void intToBytes16(int sample, byte[] buffer, int byteOffset, boolean bigEndian) { if (bigEndian) { buffer[byteOffset++]=(byte) (sample >> 8); buffer[byteOffset]=(byte) (sample & 0xFF); } else { buffer[byteOffset++]=(byte) (sample & 0xFF); buffer[byteOffset]=(byte) (sample >> 8); } } /** * Converts a 24 bit sample of type int to 3 bytes in an array. * sample is interpreted as signed (as Java does). *

* For little endian, buffer[byteOffset] is filled with low byte of sample, * and buffer[byteOffset+2] is filled with the high byte of sample + sign bit. *

For big endian, this is reversed. *

Before calling this function, it should be assured that sample * is in the 24bit range - it will not be clipped. *

This is a reference function. */ public static void intToBytes24(int sample, byte[] buffer, int byteOffset, boolean bigEndian) { if (bigEndian) { buffer[byteOffset++]=(byte) (sample >> 16); buffer[byteOffset++]=(byte) ((sample >>> 8) & 0xFF); buffer[byteOffset]=(byte) (sample & 0xFF); } else { buffer[byteOffset++]=(byte) (sample & 0xFF); buffer[byteOffset++]=(byte) ((sample >>> 8) & 0xFF); buffer[byteOffset]=(byte) (sample >> 16); } } /** * Converts a 32 bit sample of type int to 4 bytes in an array. * sample is interpreted as signed (as Java does). *

* For little endian, buffer[byteOffset] is filled with lowest byte of sample, * and buffer[byteOffset+3] is filled with the high byte of sample + sign bit. *

For big endian, this is reversed. *

This is a reference function. */ public static void intToBytes32(int sample, byte[] buffer, int byteOffset, boolean bigEndian) { if (bigEndian) { buffer[byteOffset++]=(byte) (sample >> 24); buffer[byteOffset++]=(byte) ((sample >>> 16) & 0xFF); buffer[byteOffset++]=(byte) ((sample >>> 8) & 0xFF); buffer[byteOffset]=(byte) (sample & 0xFF); } else { buffer[byteOffset++]=(byte) (sample & 0xFF); buffer[byteOffset++]=(byte) ((sample >>> 8) & 0xFF); buffer[byteOffset++]=(byte) ((sample >>> 16) & 0xFF); buffer[byteOffset]=(byte) (sample >> 24); } } /////////////////////// ULAW /////////////////////////////////////////// private static final boolean ZEROTRAP=true; private static final short BIAS=0x84; private static final int CLIP=32635; private static final int exp_lut1[] ={ 0,0,1,1,2,2,2,2,3,3,3,3,3,3,3,3, 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4, 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7 }; /** * Converts a linear signed 16bit sample to a uLaw byte. * Ported to Java by fb. *
Originally by:
* Craig Reese: IDA/Supercomputing Research Center
* Joe Campbell: Department of Defense
* 29 September 1989
*/ public static byte linear2ulaw(int sample) { int sign, exponent, mantissa, ulawbyte; if (sample>32767) sample=32767; else if (sample<-32768) sample=-32768; /* Get the sample into sign-magnitude. */ sign = (sample >> 8) & 0x80; /* set aside the sign */ if (sign != 0) sample = -sample; /* get magnitude */ if (sample > CLIP) sample = CLIP; /* clip the magnitude */ /* Convert from 16 bit linear to ulaw. */ sample = sample + BIAS; exponent = exp_lut1[(sample >> 7) & 0xFF]; mantissa = (sample >> (exponent + 3)) & 0x0F; ulawbyte = ~(sign | (exponent << 4) | mantissa); if (ZEROTRAP) if (ulawbyte == 0) ulawbyte = 0x02; /* optional CCITT trap */ return((byte) ulawbyte); } /* u-law to linear conversion table */ private static short[] u2l = { -32124, -31100, -30076, -29052, -28028, -27004, -25980, -24956, -23932, -22908, -21884, -20860, -19836, -18812, -17788, -16764, -15996, -15484, -14972, -14460, -13948, -13436, -12924, -12412, -11900, -11388, -10876, -10364, -9852, -9340, -8828, -8316, -7932, -7676, -7420, -7164, -6908, -6652, -6396, -6140, -5884, -5628, -5372, -5116, -4860, -4604, -4348, -4092, -3900, -3772, -3644, -3516, -3388, -3260, -3132, -3004, -2876, -2748, -2620, -2492, -2364, -2236, -2108, -1980, -1884, -1820, -1756, -1692, -1628, -1564, -1500, -1436, -1372, -1308, -1244, -1180, -1116, -1052, -988, -924, -876, -844, -812, -780, -748, -716, -684, -652, -620, -588, -556, -524, -492, -460, -428, -396, -372, -356, -340, -324, -308, -292, -276, -260, -244, -228, -212, -196, -180, -164, -148, -132, -120, -112, -104, -96, -88, -80, -72, -64, -56, -48, -40, -32, -24, -16, -8, 0, 32124, 31100, 30076, 29052, 28028, 27004, 25980, 24956, 23932, 22908, 21884, 20860, 19836, 18812, 17788, 16764, 15996, 15484, 14972, 14460, 13948, 13436, 12924, 12412, 11900, 11388, 10876, 10364, 9852, 9340, 8828, 8316, 7932, 7676, 7420, 7164, 6908, 6652, 6396, 6140, 5884, 5628, 5372, 5116, 4860, 4604, 4348, 4092, 3900, 3772, 3644, 3516, 3388, 3260, 3132, 3004, 2876, 2748, 2620, 2492, 2364, 2236, 2108, 1980, 1884, 1820, 1756, 1692, 1628, 1564, 1500, 1436, 1372, 1308, 1244, 1180, 1116, 1052, 988, 924, 876, 844, 812, 780, 748, 716, 684, 652, 620, 588, 556, 524, 492, 460, 428, 396, 372, 356, 340, 324, 308, 292, 276, 260, 244, 228, 212, 196, 180, 164, 148, 132, 120, 112, 104, 96, 88, 80, 72, 64, 56, 48, 40, 32, 24, 16, 8, 0 }; public static short ulaw2linear(byte ulawbyte) { return u2l[ulawbyte & 0xFF]; } /** * Converts a buffer of signed 16bit big endian samples to uLaw. * The uLaw bytes overwrite the original 16 bit values. * The first byte-offset of the uLaw bytes is byteOffset. * It will be written sampleCount/2 bytes. */ public static void pcm162ulaw(byte[] buffer, int byteOffset, int sampleCount, boolean bigEndian) { int shortIndex=byteOffset; int ulawIndex=shortIndex; if (bigEndian) { while (sampleCount>0) { buffer[ulawIndex++]=linear2ulaw (bytesToInt16(buffer[shortIndex], buffer[shortIndex+1])); shortIndex++; shortIndex++; sampleCount--; } } else { while (sampleCount>0) { buffer[ulawIndex++]=linear2ulaw (bytesToInt16(buffer[shortIndex+1], buffer[shortIndex])); shortIndex++; shortIndex++; sampleCount--; } } } /** * Fills outBuffer with ulaw samples. * reading starts from inBuffer[inByteOffset]. * writing starts at outBuffer[outByteOffset]. * There will be sampleCount*2 bytes read from inBuffer; * There will be sampleCount bytes written to outBuffer. */ public static void pcm162ulaw(byte[] inBuffer, int inByteOffset, byte[] outBuffer, int outByteOffset, int sampleCount, boolean bigEndian) { int shortIndex=inByteOffset; int ulawIndex=outByteOffset; if (bigEndian) { while (sampleCount>0) { outBuffer[ulawIndex++]=linear2ulaw (bytesToInt16(inBuffer[shortIndex], inBuffer[shortIndex+1])); shortIndex++; shortIndex++; sampleCount--; } } else { while (sampleCount>0) { outBuffer[ulawIndex++]=linear2ulaw (bytesToInt16(inBuffer[shortIndex+1], inBuffer[shortIndex])); shortIndex++; shortIndex++; sampleCount--; } } } // TODO: either direct 8bit pcm to ulaw, or better conversion from 8bit to 16bit /** * Converts a buffer of 8bit samples to uLaw. * The uLaw bytes overwrite the original 8 bit values. * The first byte-offset of the uLaw bytes is byteOffset. * It will be written sampleCount bytes. */ public static void pcm82ulaw(byte[] buffer, int byteOffset, int sampleCount, boolean signed) { sampleCount+=byteOffset; if (signed) { for (int i=byteOffset; ibytes written to outBuffer. */ public static void pcm82ulaw(byte[] inBuffer, int inByteOffset, byte[] outBuffer, int outByteOffset, int sampleCount, boolean signed) { int ulawIndex=outByteOffset; int pcmIndex=inByteOffset; if (signed) { while (sampleCount>0) { outBuffer[ulawIndex++]=linear2ulaw(inBuffer[pcmIndex++] << 8); sampleCount--; } } else { while (sampleCount>0) { outBuffer[ulawIndex++]=linear2ulaw(((byte) (inBuffer[pcmIndex++]+128)) << 8); sampleCount--; } } } /** * Fills outBuffer with pcm signed 16 bit samples. * reading starts from inBuffer[inByteOffset]. * writing starts at outBuffer[outByteOffset]. * There will be sampleCount bytes read from inBuffer; * There will be sampleCount*2 bytes written to outBuffer. */ public static void ulaw2pcm16(byte[] inBuffer, int inByteOffset, byte[] outBuffer, int outByteOffset, int sampleCount, boolean bigEndian) { int shortIndex=outByteOffset; int ulawIndex=inByteOffset; while (sampleCount>0) { intToBytes16 (u2l[inBuffer[ulawIndex++] & 0xFF], outBuffer, shortIndex++, bigEndian); shortIndex++; sampleCount--; } } // TODO: either direct 8bit pcm to ulaw, or better conversion from 8bit to 16bit /** * Inplace-conversion of a ulaw buffer to 8bit samples. * The 8bit bytes overwrite the original ulaw values. * The first byte-offset of the uLaw bytes is byteOffset. * It will be written sampleCount bytes. */ public static void ulaw2pcm8(byte[] buffer, int byteOffset, int sampleCount, boolean signed) { sampleCount+=byteOffset; if (signed) { for (int i=byteOffset; i> 8) & 0xFF); } } else { for (int i=byteOffset; i>8)+128); } } } /** * Fills outBuffer with ulaw samples. * reading starts from inBuffer[inByteOffset]. * writing starts at outBuffer[outByteOffset]. * There will be sampleCount bytes written to outBuffer. */ public static void ulaw2pcm8(byte[] inBuffer, int inByteOffset, byte[] outBuffer, int outByteOffset, int sampleCount, boolean signed) { int ulawIndex=inByteOffset; int pcmIndex=outByteOffset; if (signed) { while (sampleCount>0) { outBuffer[pcmIndex++]= (byte) ((u2l[inBuffer[ulawIndex++] & 0xFF] >> 8) & 0xFF); sampleCount--; } } else { while (sampleCount>0) { outBuffer[pcmIndex++]= (byte) ((u2l[inBuffer[ulawIndex++] & 0xFF]>>8)+128); sampleCount--; } } } //////////////////// ALAW //////////////////////////// /* * This source code is a product of Sun Microsystems, Inc. and is provided * for unrestricted use. Users may copy or modify this source code without * charge. * * linear2alaw() - Convert a 16-bit linear PCM value to 8-bit A-law * * linear2alaw() accepts an 16-bit integer and encodes it as A-law data. * * Linear Input Code Compressed Code * ------------------------ --------------- * 0000000wxyza 000wxyz * 0000001wxyza 001wxyz * 000001wxyzab 010wxyz * 00001wxyzabc 011wxyz * 0001wxyzabcd 100wxyz * 001wxyzabcde 101wxyz * 01wxyzabcdef 110wxyz * 1wxyzabcdefg 111wxyz * * For further information see John C. Bellamy's Digital Telephony, 1982, * John Wiley & Sons, pps 98-111 and 472-476. */ private static final byte QUANT_MASK = 0xf; /* Quantization field mask. */ private static final byte SEG_SHIFT = 4; /* Left shift for segment number. */ private static final short[] seg_end = { 0xFF, 0x1FF, 0x3FF, 0x7FF, 0xFFF, 0x1FFF, 0x3FFF, 0x7FFF }; public static byte linear2alaw(short pcm_val) /* 2's complement (16-bit range) */ { byte mask; byte seg=8; byte aval; if (pcm_val >= 0) { mask = (byte) 0xD5; /* sign (7th) bit = 1 */ } else { mask = 0x55; /* sign bit = 0 */ pcm_val = (short) (-pcm_val - 8); } /* Convert the scaled magnitude to segment number. */ for (int i = 0; i < 8; i++) { if (pcm_val <= seg_end[i]) { seg=(byte) i; break; } } /* Combine the sign, segment, and quantization bits. */ if (seg >= 8) /* out of range, return maximum value. */ return (byte) ((0x7F ^ mask) & 0xFF); else { aval = (byte) (seg << SEG_SHIFT); if (seg < 2) aval |= (pcm_val >> 4) & QUANT_MASK; else aval |= (pcm_val >> (seg + 3)) & QUANT_MASK; return (byte) ((aval ^ mask) & 0xFF); } } private static short[] a2l = { -5504, -5248, -6016, -5760, -4480, -4224, -4992, -4736, -7552, -7296, -8064, -7808, -6528, -6272, -7040, -6784, -2752, -2624, -3008, -2880, -2240, -2112, -2496, -2368, -3776, -3648, -4032, -3904, -3264, -3136, -3520, -3392, -22016, -20992, -24064, -23040, -17920, -16896, -19968, -18944, -30208, -29184, -32256, -31232, -26112, -25088, -28160, -27136, -11008, -10496, -12032, -11520, -8960, -8448, -9984, -9472, -15104, -14592, -16128, -15616, -13056, -12544, -14080, -13568, -344, -328, -376, -360, -280, -264, -312, -296, -472, -456, -504, -488, -408, -392, -440, -424, -88, -72, -120, -104, -24, -8, -56, -40, -216, -200, -248, -232, -152, -136, -184, -168, -1376, -1312, -1504, -1440, -1120, -1056, -1248, -1184, -1888, -1824, -2016, -1952, -1632, -1568, -1760, -1696, -688, -656, -752, -720, -560, -528, -624, -592, -944, -912, -1008, -976, -816, -784, -880, -848, 5504, 5248, 6016, 5760, 4480, 4224, 4992, 4736, 7552, 7296, 8064, 7808, 6528, 6272, 7040, 6784, 2752, 2624, 3008, 2880, 2240, 2112, 2496, 2368, 3776, 3648, 4032, 3904, 3264, 3136, 3520, 3392, 22016, 20992, 24064, 23040, 17920, 16896, 19968, 18944, 30208, 29184, 32256, 31232, 26112, 25088, 28160, 27136, 11008, 10496, 12032, 11520, 8960, 8448, 9984, 9472, 15104, 14592, 16128, 15616, 13056, 12544, 14080, 13568, 344, 328, 376, 360, 280, 264, 312, 296, 472, 456, 504, 488, 408, 392, 440, 424, 88, 72, 120, 104, 24, 8, 56, 40, 216, 200, 248, 232, 152, 136, 184, 168, 1376, 1312, 1504, 1440, 1120, 1056, 1248, 1184, 1888, 1824, 2016, 1952, 1632, 1568, 1760, 1696, 688, 656, 752, 720, 560, 528, 624, 592, 944, 912, 1008, 976, 816, 784, 880, 848 }; public static short alaw2linear(byte ulawbyte) { return a2l[ulawbyte & 0xFF]; } /** * Converts a buffer of signed 16bit big endian samples to uLaw. * The uLaw bytes overwrite the original 16 bit values. * The first byte-offset of the uLaw bytes is byteOffset. * It will be written sampleCount/2 bytes. */ public static void pcm162alaw(byte[] buffer, int byteOffset, int sampleCount, boolean bigEndian) { int shortIndex=byteOffset; int alawIndex=shortIndex; if (bigEndian) { while (sampleCount>0) { buffer[alawIndex++]= linear2alaw(bytesToShort16 (buffer[shortIndex], buffer[shortIndex+1])); shortIndex++; shortIndex++; sampleCount--; } } else { while (sampleCount>0) { buffer[alawIndex++]= linear2alaw(bytesToShort16 (buffer[shortIndex+1], buffer[shortIndex])); shortIndex++; shortIndex++; sampleCount--; } } } /** * Fills outBuffer with alaw samples. * reading starts from inBuffer[inByteOffset]. * writing starts at outBuffer[outByteOffset]. * There will be sampleCount*2 bytes read from inBuffer; * There will be sampleCount bytes written to outBuffer. */ public static void pcm162alaw(byte[] inBuffer, int inByteOffset, byte[] outBuffer, int outByteOffset, int sampleCount, boolean bigEndian) { int shortIndex=inByteOffset; int alawIndex=outByteOffset; if (bigEndian) { while (sampleCount>0) { outBuffer[alawIndex++]=linear2alaw (bytesToShort16(inBuffer[shortIndex], inBuffer[shortIndex+1])); shortIndex++; shortIndex++; sampleCount--; } } else { while (sampleCount>0) { outBuffer[alawIndex++]=linear2alaw (bytesToShort16(inBuffer[shortIndex+1], inBuffer[shortIndex])); shortIndex++; shortIndex++; sampleCount--; } } } /** * Converts a buffer of 8bit samples to alaw. * The alaw bytes overwrite the original 8 bit values. * The first byte-offset of the aLaw bytes is byteOffset. * It will be written sampleCount bytes. */ public static void pcm82alaw(byte[] buffer, int byteOffset, int sampleCount, boolean signed) { sampleCount+=byteOffset; if (signed) { for (int i=byteOffset; ibytes written to outBuffer. */ public static void pcm82alaw(byte[] inBuffer, int inByteOffset, byte[] outBuffer, int outByteOffset, int sampleCount, boolean signed) { int alawIndex=outByteOffset; int pcmIndex=inByteOffset; if (signed) { while (sampleCount>0) { outBuffer[alawIndex++]= linear2alaw((short) (inBuffer[pcmIndex++] << 8)); sampleCount--; } } else { while (sampleCount>0) { outBuffer[alawIndex++]= linear2alaw((short) (((byte) (inBuffer[pcmIndex++]+128)) << 8)); sampleCount--; } } } /** * Converts an alaw buffer to 8bit pcm samples * The 8bit bytes overwrite the original alaw values. * The first byte-offset of the aLaw bytes is byteOffset. * It will be written sampleCount bytes. */ public static void alaw2pcm8(byte[] buffer, int byteOffset, int sampleCount, boolean signed) { sampleCount+=byteOffset; if (signed) { for (int i=byteOffset; i> 8) & 0xFF); } } else { for (int i=byteOffset; i>8)+128); } } } /** * Fills outBuffer with alaw samples. * reading starts from inBuffer[inByteOffset]. * writing starts at outBuffer[outByteOffset]. * There will be sampleCount bytes written to outBuffer. */ public static void alaw2pcm8(byte[] inBuffer, int inByteOffset, byte[] outBuffer, int outByteOffset, int sampleCount, boolean signed) { int alawIndex=inByteOffset; int pcmIndex=outByteOffset; if (signed) { while (sampleCount>0) { outBuffer[pcmIndex++]= (byte) ((a2l[inBuffer[alawIndex++] & 0xFF] >> 8) & 0xFF); sampleCount--; } } else { while (sampleCount>0) { outBuffer[pcmIndex++]= (byte) ((a2l[inBuffer[alawIndex++] & 0xFF]>>8)+128); sampleCount--; } } } /** * Fills outBuffer with pcm signed 16 bit samples. * reading starts from inBuffer[inByteOffset]. * writing starts at outBuffer[outByteOffset]. * There will be sampleCount bytes read from inBuffer; * There will be sampleCount*2 bytes written to outBuffer. */ public static void alaw2pcm16(byte[] inBuffer, int inByteOffset, byte[] outBuffer, int outByteOffset, int sampleCount, boolean bigEndian) { int shortIndex=outByteOffset; int alawIndex=inByteOffset; while (sampleCount>0) { intToBytes16 (a2l[inBuffer[alawIndex++] & 0xFF], outBuffer, shortIndex++, bigEndian); shortIndex++; sampleCount--; } } //////////////////////// cross conversion alaw <-> ulaw //////////////////////////////////////// private static byte[] u2a = { -86, -85, -88, -87, -82, -81, -84, -83, -94, -93, -96, -95, -90, -89, -92, -91, -70, -69, -72, -71, -66, -65, -68, -67, -78, -77, -80, -79, -74, -73, -76, -75, -118, -117, -120, -119, -114, -113, -116, -115, -126, -125, -128, -127, -122, -121, -124, -123, -101, -104, -103, -98, -97, -100, -99, -110, -109, -112, -111, -106, -105, -108, -107, -22, -24, -23, -18, -17, -20, -19, -30, -29, -32, -31, -26, -25, -28, -27, -6, -8, -2, -1, -4, -3, -14, -13, -16, -15, -10, -9, -12, -11, -53, -55, -49, -51, -62, -61, -64, -63, -58, -57, -60, -59, -38, -37, -40, -39, -34, -33, -36, -35, -46, -46, -45, -45, -48, -48, -47, -47, -42, -42, -41, -41, -44, -44, -43, -43, 42, 43, 40, 41, 46, 47, 44, 45, 34, 35, 32, 33, 38, 39, 36, 37, 58, 59, 56, 57, 62, 63, 60, 61, 50, 51, 48, 49, 54, 55, 52, 53, 10, 11, 8, 9, 14, 15, 12, 13, 2, 3, 0, 1, 6, 7, 4, 5, 27, 24, 25, 30, 31, 28, 29, 18, 19, 16, 17, 22, 23, 20, 21, 106, 104, 105, 110, 111, 108, 109, 98, 99, 96, 97, 102, 103, 100, 101, 122, 120, 126, 127, 124, 125, 114, 115, 112, 113, 118, 119, 116, 117, 75, 73, 79, 77, 66, 67, 64, 65, 70, 71, 68, 69, 90, 91, 88, 89, 94, 95, 92, 93, 82, 82, 83, 83, 80, 80, 81, 81, 86, 86, 87, 87, 84, 84, 85, 85, }; public static byte ulaw2alaw(byte sample) { return u2a[sample & 0xFF]; } /** * Converts a buffer of uLaw samples to aLaw. */ public static void ulaw2alaw(byte[] buffer, int byteOffset, int sampleCount) { sampleCount+=byteOffset; for (int i=byteOffset; i0) { outBuffer[alawIndex++]=u2a[inBuffer[ulawIndex++] & 0xFF]; sampleCount--; } } private static byte[] a2u = { -86, -85, -88, -87, -82, -81, -84, -83, -94, -93, -96, -95, -90, -89, -92, -91, -71, -70, -73, -72, -67, -66, -69, -68, -79, -78, -80, -80, -75, -74, -77, -76, -118, -117, -120, -119, -114, -113, -116, -115, -126, -125, -128, -127, -122, -121, -124, -123, -102, -101, -104, -103, -98, -97, -100, -99, -110, -109, -112, -111, -106, -105, -108, -107, -30, -29, -32, -31, -26, -25, -28, -27, -35, -35, -36, -36, -33, -33, -34, -34, -12, -10, -16, -14, -4, -2, -8, -6, -22, -21, -24, -23, -18, -17, -20, -19, -56, -55, -58, -57, -52, -51, -54, -53, -64, -63, -65, -65, -60, -59, -62, -61, -42, -41, -44, -43, -38, -37, -40, -39, -49, -49, -50, -50, -46, -45, -48, -47, 42, 43, 40, 41, 46, 47, 44, 45, 34, 35, 32, 33, 38, 39, 36, 37, 57, 58, 55, 56, 61, 62, 59, 60, 49, 50, 48, 48, 53, 54, 51, 52, 10, 11, 8, 9, 14, 15, 12, 13, 2, 3, 0, 1, 6, 7, 4, 5, 26, 27, 24, 25, 30, 31, 28, 29, 18, 19, 16, 17, 22, 23, 20, 21, 98, 99, 96, 97, 102, 103, 100, 101, 93, 93, 92, 92, 95, 95, 94, 94, 116, 118, 112, 114, 124, 126, 120, 122, 106, 107, 104, 105, 110, 111, 108, 109, 72, 73, 70, 71, 76, 77, 74, 75, 64, 65, 63, 63, 68, 69, 66, 67, 86, 87, 84, 85, 90, 91, 88, 89, 79, 79, 78, 78, 82, 83, 80, 81, }; public static byte alaw2ulaw(byte sample) { return a2u[sample & 0xFF]; } /** * Converts a buffer of aLaw samples to uLaw. * The uLaw bytes overwrite the original aLaw values. * The first byte-offset of the uLaw bytes is byteOffset. * It will be written sampleCount bytes. */ public static void alaw2ulaw(byte[] buffer, int byteOffset, int sampleCount) { sampleCount+=byteOffset; for (int i=byteOffset; ibytes written to outBuffer. */ public static void alaw2ulaw(byte[] inBuffer, int inByteOffset, byte[] outBuffer, int outByteOffset, int sampleCount) { int ulawIndex=outByteOffset; int alawIndex=inByteOffset; while (sampleCount>0) { outBuffer[ulawIndex++]=a2u[inBuffer[alawIndex++] & 0xFF]; sampleCount--; } } //////////////////////// high level methods ///////////////////////////////////////////////// /* * !! Here, unlike other functions in this class, the length is * in bytes rather than samples !! */ public static void changeOrderOrSign(byte[] buffer, int nOffset, int nByteLength, int nBytesPerSample) { switch (nBytesPerSample) { case 1: convertSign8(buffer, nOffset, nByteLength); break; case 2: swapOrder16(buffer, nOffset, nByteLength / 2); break; case 3: swapOrder24(buffer, nOffset, nByteLength / 3); break; case 4: swapOrder32(buffer, nOffset, nByteLength / 4); break; } } /* * !! Here, unlike other functions in this class, the length is * in bytes rather than samples !! */ public static void changeOrderOrSign( byte[] inBuffer, int nInOffset, byte[] outBuffer, int nOutOffset, int nByteLength, int nBytesPerSample) { switch (nBytesPerSample) { case 1: convertSign8( inBuffer, nInOffset, outBuffer, nOutOffset, nByteLength); break; case 2: swapOrder16( inBuffer, nInOffset, outBuffer, nOutOffset, nByteLength / 2); break; case 3: swapOrder24( inBuffer, nInOffset, outBuffer, nOutOffset, nByteLength / 3); break; case 4: swapOrder32( inBuffer, nInOffset, outBuffer, nOutOffset, nByteLength / 4); break; } } ///////////////// Annexe: how the arrays were created. ////////////////////////////////// /* * Converts a uLaw byte to a linear signed 16bit sample. * Ported to Java by fb. *
Originally by:
* * Craig Reese: IDA/Supercomputing Research Center
* 29 September 1989
* * References:
*

    *
  1. CCITT Recommendation G.711 (very difficult to follow)
  2. *
  3. MIL-STD-188-113,"Interoperability and Performance Standards * for Analog-to_Digital Conversion Techniques," * 17 February 1987
  4. *
*/ /* private static final int exp_lut2[] = { 0,132,396,924,1980,4092,8316,16764 }; public static short _ulaw2linear(int ulawbyte) { int sign, exponent, mantissa, sample; ulawbyte = ~ulawbyte; sign = (ulawbyte & 0x80); exponent = (ulawbyte >> 4) & 0x07; mantissa = ulawbyte & 0x0F; sample = exp_lut2[exponent] + (mantissa << (exponent + 3)); if (sign != 0) sample = -sample; return((short) sample); }*/ /* u- to A-law conversions: copied from CCITT G.711 specifications */ /* private static byte[] _u2a = { 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 27, 29, 31, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 46, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, (byte) 128}; */ /* u-law to A-law conversion */ /* * This source code is a product of Sun Microsystems, Inc. and is provided * for unrestricted use. Users may copy or modify this source code without * charge. */ /* public static byte _ulaw2alaw(byte sample) { sample &= 0xff; return (byte) (((sample & 0x80)!=0) ? (0xD5 ^ (_u2a[(0x7F ^ sample) & 0x7F] - 1)) : (0x55 ^ (_u2a[(0x7F ^ sample) & 0x7F] - 1))); }*/ /* A- to u-law conversions */ /* private static byte[] _a2u = { 1, 3, 5, 7, 9, 11, 13, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 32, 33, 33, 34, 34, 35, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 48, 49, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127}; */ /* * This source code is a product of Sun Microsystems, Inc. and is provided * for unrestricted use. Users may copy or modify this source code without * charge. */ /* public static byte _alaw2ulaw(byte sample) { sample &= 0xff; return (byte) (((sample & 0x80)!=0) ? (0xFF ^ _a2u[(sample ^ 0xD5) & 0x7F]) : (0x7F ^ _a2u[(sample ^ 0x55) & 0x7F])); } public static void print_a2u() { System.out.println("\tprivate static byte[] a2u = {"); for (int i=-128; i<128; i++) { if (((i+128) % 16)==0) { System.out.print("\t\t"); } byte b=(byte) i; System.out.print(_alaw2ulaw(b)+", "); if (((i+128) % 16)==15) { System.out.println(""); } } System.out.println("\t};"); } public static void print_u2a() { System.out.println("\tprivate static byte[] u2a = {"); for (int i=-128; i<128; i++) { if (((i+128) % 16)==0) { System.out.print("\t\t"); } byte b=(byte) i; System.out.print(_ulaw2alaw(b)+", "); if (((i+128) % 16)==15) { System.out.println(""); } } System.out.println("\t};"); } */ } /*** TConversionTool.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/share/sampled/TVolumeUtils.java0000644000175000017500000000256110173661004030127 0ustar twernertwerner/* * TVolumeUtils.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.share.sampled; public class TVolumeUtils { private static final double FACTOR1 = 20.0 / Math.log(10.0); private static final double FACTOR2 = 1 / 20.0; public static double lin2log(double dLinear) { return FACTOR1 * Math.log(dLinear); } public static double log2lin(double dLogarithmic) { return Math.pow(10.0, dLogarithmic * FACTOR2); } } /*** TVolumeUtils.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/share/sampled/package.html0000644000175000017500000000034110173661004027123 0ustar twernertwerner

Helper classes for the implementation of sampled audio stuff. The classes provided here .

libtritonus-java-20070428/src/classes/org/tritonus/share/sampled/file/0000755000175000017500000000000010621572522025567 5ustar twernertwernerlibtritonus-java-20070428/src/classes/org/tritonus/share/sampled/file/AudioOutputStream.java0000644000175000017500000000732310173661005032072 0ustar twernertwerner/* * AudioOutputStream.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2000 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.share.sampled.file; import java.io.IOException; import javax.sound.sampled.AudioFormat; /** Represents a one-time writing of audio data to a destination (file or output stream). * * This interface is the lowest abstraction level of writing audio data. * Implementations of this interface should, when write() is called, never * do buffering and they should never do format conversions. However, * this interface is intended to abstract the file format (how the * headers and data chunks look like) and the way of writing to the * destination object. (implementation note [non-normative]: the last * should be done by using TDataOutputStream implementing classes). * * One reasoning behind this interface was to allow direct, unbuffered * writing of recorded data. * In JS API 0.90, there was no obvious way for this. * Data have had to be recorded to a buffer, then written to a file * from that buffer. * This gave problems with long recordings, where the main * memory of the machine is not big enough to hold all data. There are * two ways so solve this: * * a) Having a special AudioInputStream that fetches its data from a * TargetDataLine. This way, the loop inside the AudioFileWriters reads * directely from the recording line via the special AudioInputStream. * This is the solution Sun adopted for JS 1.0. * * b) The other way is to expose a direct interface to the writing of the * audio file with no loop inside it. This is to enable the application * programmer to write the main loop itself, possibly doing some * additional processing inside it. This is the more flexible way. * The drawback is that it requires a new architecture for writing files. * * This interface is the central part of a proposal for the second * solution. * The idea is now to use the new structure inside the old one to gain * experience with it before proposing to make it a public interface * (public in the sense that it is part of the javax.sound.sampled * package). * * @author Matthias Pfisterer */ public interface AudioOutputStream { /** * Retrieves the AufioFormat of this AudioOutputStream. */ public AudioFormat getFormat(); /** Gives length of the stream. * This value is in bytes. It may be AudioSystem.NOT_SPECIFIED * to express that the length is unknown. */ public long getLength(); /** * Writes a chunk of audio data to the destination (file or output stream). */ // IDEA: use long? public int write(byte[] abData, int nOffset, int nLength) throws IOException; /** Closes the stream. * This does write remaining buffered data to the destination, * backpatch the header, if necessary, and closes the destination. */ public void close() throws IOException; } /*** AudioOutputStream.java ***/ ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootlibtritonus-java-20070428/src/classes/org/tritonus/share/sampled/file/HeaderlessAudioOutputStream.javalibtritonus-java-20070428/src/classes/org/tritonus/share/sampled/file/HeaderlessAudioOutputStream.ja0000644000175000017500000000322710173661005033542 0ustar twernertwerner/* * HeaderlessAudioOutputStream.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2000 by Florian Bomers * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.share.sampled.file; import java.io.IOException; import javax.sound.sampled.AudioFormat; /** * AudioOutputStream for files without a header; the input is written as it is. * * @author Florian Bomers */ // todo: implement directly AudioOutputStream without using TAudioOutputStream public class HeaderlessAudioOutputStream extends TAudioOutputStream { public HeaderlessAudioOutputStream(AudioFormat audioFormat, long lLength, TDataOutputStream dataOutputStream) { super(audioFormat, lLength, dataOutputStream, false); } protected void writeHeader() throws IOException { } } /*** HeaderlessAudioOutputStream.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/share/sampled/file/TAudioFileFormat.java0000644000175000017500000000526510173661005031575 0ustar twernertwerner/* * TAudioFileFormat.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.share.sampled.file; import java.util.Collections; import java.util.HashMap; import java.util.Map; import javax.sound.sampled.AudioFileFormat; import javax.sound.sampled.AudioFormat; /** * This class is just to have a public constructor taking the * number of bytes of the whole file. The public constructor of * AudioFileFormat doesn't take this parameter, the one who takes * it is protected. * * @author Matthias Pfisterer */ public class TAudioFileFormat extends AudioFileFormat { private Map m_properties; private Map m_unmodifiableProperties; /* * Note that the order of the arguments is different from * the one in AudioFileFormat. */ public TAudioFileFormat(Type type, AudioFormat audioFormat, int nLengthInFrames, int nLengthInBytes) { super(type, nLengthInBytes, audioFormat, nLengthInFrames); } public TAudioFileFormat(Type type, AudioFormat audioFormat, int nLengthInFrames, int nLengthInBytes, Map properties) { super(type, nLengthInBytes, audioFormat, nLengthInFrames); initMaps(properties); } private void initMaps(Map properties) { /* Here, we make a shallow copy of the map. It's unclear if this is sufficient (of if a deep copy should be made). */ m_properties = new HashMap(); m_properties.putAll(properties); m_unmodifiableProperties = Collections.unmodifiableMap(m_properties); } public Map properties() { return m_unmodifiableProperties; } protected void setProperty(String key, Object value) { m_properties.put(key, value); } } /*** TAudioFileFormat.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/share/sampled/file/TAudioFileReader.java0000644000175000017500000003526510374074736031566 0ustar twernertwerner/* * TAudioFileReader.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999 by Matthias Pfisterer * Copyright (c) 2001 by Florian Bomers * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.share.sampled.file; import java.io.BufferedInputStream; import java.io.File; import java.io.FileInputStream; import java.io.DataInputStream; import java.io.InputStream; import java.io.IOException; import java.io.EOFException; import java.net.URL; import java.net.URLConnection; import javax.sound.sampled.AudioInputStream; import javax.sound.sampled.AudioFileFormat; import javax.sound.sampled.AudioSystem; import javax.sound.sampled.UnsupportedAudioFileException; import javax.sound.sampled.spi.AudioFileReader; import org.tritonus.share.TDebug; /** Base class for audio file readers. This is Tritonus' base class for classes that provide the facility of detecting an audio file type and reading its header. Classes should be derived from this class or one of its subclasses rather than from javax.sound.sampled.spi.AudioFileReader. @author Matthias Pfisterer @author Florian Bomers */ public abstract class TAudioFileReader extends AudioFileReader { private int m_nMarkLimit = -1; private boolean m_bRereading; protected TAudioFileReader(int nMarkLimit) { this(nMarkLimit, false); } protected TAudioFileReader(int nMarkLimit, boolean bRereading) { m_nMarkLimit = nMarkLimit; m_bRereading = bRereading; } private int getMarkLimit() { return m_nMarkLimit; } private boolean isRereading() { return m_bRereading; } /** Get an AudioFileFormat object for a File. This method calls getAudioFileFormat(InputStream, long). Subclasses should not override this method unless there are really severe reasons. Normally, it is sufficient to implement getAudioFileFormat(InputStream, long). @param file the file to read from. @return an AudioFileFormat instance containing information from the header of the file passed in. */ public AudioFileFormat getAudioFileFormat(File file) throws UnsupportedAudioFileException, IOException { if (TDebug.TraceAudioFileReader) {TDebug.out("TAudioFileReader.getAudioFileFormat(File): begin"); } long lFileLengthInBytes = file.length(); InputStream inputStream = new FileInputStream(file); AudioFileFormat audioFileFormat = null; try { audioFileFormat = getAudioFileFormat(inputStream, lFileLengthInBytes); } finally { inputStream.close(); } if (TDebug.TraceAudioFileReader) {TDebug.out("TAudioFileReader.getAudioFileFormat(File): end"); } return audioFileFormat; } /** Get an AudioFileFormat object for a URL. This method calls getAudioFileFormat(InputStream, long). Subclasses should not override this method unless there are really severe reasons. Normally, it is sufficient to implement getAudioFileFormat(InputStream, long). @param url the URL to read from. @return an AudioFileFormat instance containing information from the header of the URL passed in. */ public AudioFileFormat getAudioFileFormat(URL url) throws UnsupportedAudioFileException, IOException { if (TDebug.TraceAudioFileReader) {TDebug.out("TAudioFileReader.getAudioFileFormat(URL): begin"); } long lFileLengthInBytes = getDataLength(url); InputStream inputStream = url.openStream(); AudioFileFormat audioFileFormat = null; try { audioFileFormat = getAudioFileFormat(inputStream, lFileLengthInBytes); } finally { inputStream.close(); } if (TDebug.TraceAudioFileReader) {TDebug.out("TAudioFileReader.getAudioFileFormat(URL): end"); } return audioFileFormat; } /** Get an AudioFileFormat object for an InputStream. This method calls getAudioFileFormat(InputStream, long). Subclasses should not override this method unless there are really severe reasons. Normally, it is sufficient to implement getAudioFileFormat(InputStream, long). @param inputStream the stream to read from. @return an AudioFileFormat instance containing information from the header of the stream passed in. */ public AudioFileFormat getAudioFileFormat(InputStream inputStream) throws UnsupportedAudioFileException, IOException { if (TDebug.TraceAudioFileReader) {TDebug.out("TAudioFileReader.getAudioFileFormat(InputStream): begin"); } long lFileLengthInBytes = AudioSystem.NOT_SPECIFIED; inputStream.mark(getMarkLimit()); AudioFileFormat audioFileFormat = null; try { audioFileFormat = getAudioFileFormat(inputStream, lFileLengthInBytes); } finally { /* TODO: required semantics is unclear: should reset() be executed only when there is an exception or should it be done always? */ inputStream.reset(); } if (TDebug.TraceAudioFileReader) {TDebug.out("TAudioFileReader.getAudioFileFormat(InputStream): end"); } return audioFileFormat; } /** Get an AudioFileFormat (internal implementation). Subclasses must implement this method in a way specific to the file format they handle. Note that depending on the implementation of this method, you should or should not override getAudioInputStream(InputStream, long), too (see comment there). @param inputStream The InputStream to read from. @param lFileLengthInBytes The size of the originating file, if known. If it isn't known, AudioSystem.NOT_SPECIFIED should be passed. This value may be used for byteLength in AudioFileFormat, if this value can't be derived from the informmation in the file header. @return an AudioFileFormat instance containing information from the header of the stream passed in as inputStream. */ protected abstract AudioFileFormat getAudioFileFormat( InputStream inputStream, long lFileLengthInBytes) throws UnsupportedAudioFileException, IOException; /** Get an AudioInputStream object for a file. This method calls getAudioInputStream(InputStream, long). Subclasses should not override this method unless there are really severe reasons. Normally, it is sufficient to implement getAudioFileFormat(InputStream, long) and perhaps override getAudioInputStream(InputStream, long). @param file the File object to read from. @return an AudioInputStream instance containing the audio data from this file. */ public AudioInputStream getAudioInputStream(File file) throws UnsupportedAudioFileException, IOException { if (TDebug.TraceAudioFileReader) {TDebug.out("TAudioFileReader.getAudioInputStream(File): begin"); } long lFileLengthInBytes = file.length(); InputStream inputStream = new FileInputStream(file); AudioInputStream audioInputStream = null; try { audioInputStream = getAudioInputStream(inputStream, lFileLengthInBytes); } catch (UnsupportedAudioFileException e) { inputStream.close(); throw e; } catch (IOException e) { inputStream.close(); throw e; } if (TDebug.TraceAudioFileReader) {TDebug.out("TAudioFileReader.getAudioInputStream(File): end"); } return audioInputStream; } /** Get an AudioInputStream object for a URL. This method calls getAudioInputStream(InputStream, long). Subclasses should not override this method unless there are really severe reasons. Normally, it is sufficient to implement getAudioFileFormat(InputStream, long) and perhaps override getAudioInputStream(InputStream, long). @param url the URL to read from. @return an AudioInputStream instance containing the audio data from this URL. */ public AudioInputStream getAudioInputStream(URL url) throws UnsupportedAudioFileException, IOException { if (TDebug.TraceAudioFileReader) {TDebug.out("TAudioFileReader.getAudioInputStream(URL): begin"); } long lFileLengthInBytes = getDataLength(url); InputStream inputStream = url.openStream(); AudioInputStream audioInputStream = null; try { audioInputStream = getAudioInputStream(inputStream, lFileLengthInBytes); } catch (UnsupportedAudioFileException e) { inputStream.close(); throw e; } catch (IOException e) { inputStream.close(); throw e; } if (TDebug.TraceAudioFileReader) {TDebug.out("TAudioFileReader.getAudioInputStream(URL): end"); } return audioInputStream; } /** Get an AudioInputStream object for an InputStream. This method calls getAudioInputStream(InputStream, long). Subclasses should not override this method unless there are really severe reasons. Normally, it is sufficient to implement getAudioFileFormat(InputStream, long) and perhaps override getAudioInputStream(InputStream, long). @param inputStream the stream to read from. @return an AudioInputStream instance containing the audio data from this stream. */ public AudioInputStream getAudioInputStream(InputStream inputStream) throws UnsupportedAudioFileException, IOException { if (TDebug.TraceAudioFileReader) {TDebug.out("TAudioFileReader.getAudioInputStream(InputStream): begin"); } long lFileLengthInBytes = AudioSystem.NOT_SPECIFIED; AudioInputStream audioInputStream = null; inputStream.mark(getMarkLimit()); try { audioInputStream = getAudioInputStream(inputStream, lFileLengthInBytes); } catch (UnsupportedAudioFileException e) { inputStream.reset(); throw e; } catch (IOException e) { inputStream.reset(); throw e; } if (TDebug.TraceAudioFileReader) {TDebug.out("TAudioFileReader.getAudioInputStream(InputStream): end"); } return audioInputStream; } /** Get an AudioInputStream (internal implementation). This implementation calls getAudioFileFormat() with the same arguments as passed in here. Then, it constructs an AudioInputStream instance. This instance takes the passed inputStream in the state it is left after getAudioFileFormat() did its work. In other words, the implementation here assumes that getAudioFileFormat() reads the entire header up to a position exactely where the audio data starts. If this can't be realized for a certain format, this method should be overridden. @param inputStream The InputStream to read from. @param lFileLengthInBytes The size of the originating file, if known. If it isn't known, AudioSystem.NOT_SPECIFIED should be passed. This value may be used for byteLength in AudioFileFormat, if this value can't be derived from the informmation in the file header. */ protected AudioInputStream getAudioInputStream(InputStream inputStream, long lFileLengthInBytes) throws UnsupportedAudioFileException, IOException { if (TDebug.TraceAudioFileReader) {TDebug.out("TAudioFileReader.getAudioInputStream(InputStream, long): begin"); } if (isRereading()) { inputStream = new BufferedInputStream(inputStream, getMarkLimit()); inputStream.mark(getMarkLimit()); } AudioFileFormat audioFileFormat = getAudioFileFormat(inputStream, lFileLengthInBytes); if (isRereading()) { inputStream.reset(); } AudioInputStream audioInputStream = new AudioInputStream(inputStream, audioFileFormat.getFormat(), audioFileFormat.getFrameLength()); if (TDebug.TraceAudioFileReader) {TDebug.out("TAudioFileReader.getAudioInputStream(InputStream, long): end"); } return audioInputStream; } protected static int calculateFrameSize(int nSampleSize, int nNumChannels) { return ((nSampleSize + 7) / 8) * nNumChannels; } private static long getDataLength(URL url) throws IOException { long lFileLengthInBytes = AudioSystem.NOT_SPECIFIED; URLConnection connection = url.openConnection(); connection.connect(); int nLength = connection.getContentLength(); if (nLength > 0) { lFileLengthInBytes = nLength; } return lFileLengthInBytes; } public static int readLittleEndianInt(InputStream is) throws IOException { int b0 = is.read(); int b1 = is.read(); int b2 = is.read(); int b3 = is.read(); if ((b0 | b1 | b2 | b3) < 0) { throw new EOFException(); } return (b3 << 24) + (b2 << 16) + (b1 << 8) + (b0 << 0); } public static short readLittleEndianShort(InputStream is) throws IOException { int b0 = is.read(); int b1 = is.read(); if ((b0 | b1) < 0) { throw new EOFException(); } return (short) ((b1 << 8) + (b0 << 0)); } /* * C O N V E R T F R O M I E E E E X T E N D E D */ /* * Copyright (C) 1988-1991 Apple Computer, Inc. * All rights reserved. * * Machine-independent I/O routines for IEEE floating-point numbers. * * NaN's and infinities are converted to HUGE_VAL or HUGE, which * happens to be infinity on IEEE machines. Unfortunately, it is * impossible to preserve NaN's in a machine-independent way. * Infinities are, however, preserved on IEEE machines. * * These routines have been tested on the following machines: * Apple Macintosh, MPW 3.1 C compiler * Apple Macintosh, THINK C compiler * Silicon Graphics IRIS, MIPS compiler * Cray X/MP and Y/MP * Digital Equipment VAX * * * Implemented by Malcolm Slaney and Ken Turkowski. * * Malcolm Slaney contributions during 1988-1990 include big- and little- * endian file I/O, conversion to and from Motorola's extended 80-bit * floating-point format, and conversions to and from IEEE single- * precision floating-point format. * * In 1991, Ken Turkowski implemented the conversions to and from * IEEE double-precision format, added more precision to the extended * conversions, and accommodated conversions involving +/- infinity, * NaN's, and denormalized numbers. */ public static double readIeeeExtended(DataInputStream dis) throws IOException { double f = 0.0D; int expon = 0; long hiMant = 0L; long loMant = 0L; double HUGE = 3.4028234663852886E+038D; expon = dis.readUnsignedShort(); long t1 = dis.readUnsignedShort(); long t2 = dis.readUnsignedShort(); hiMant = t1 << 16 | t2; t1 = dis.readUnsignedShort(); t2 = dis.readUnsignedShort(); loMant = t1 << 16 | t2; if(expon == 0 && hiMant == 0L && loMant == 0L) { f = 0.0D; } else { if(expon == 32767) { f = HUGE; } else { expon -= 16383; expon -= 31; f = hiMant * Math.pow(2D, expon); expon -= 32; f += loMant * Math.pow(2D, expon); } } return f; } } /*** TAudioFileReader.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/share/sampled/file/TAudioFileWriter.java0000644000175000017500000004050310374142167031621 0ustar twernertwerner/* * TAudioFileWriter.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999, 2000 by Matthias Pfisterer * Copyright (c) 1999, 2000 by Florian Bomers * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.share.sampled.file; import java.io.File; import java.io.IOException; import java.io.OutputStream; import java.util.Collection; import java.util.Iterator; import javax.sound.sampled.AudioFormat; import javax.sound.sampled.AudioFileFormat; import javax.sound.sampled.AudioInputStream; import javax.sound.sampled.AudioSystem; import javax.sound.sampled.spi.AudioFileWriter; import org.tritonus.share.TDebug; import org.tritonus.share.sampled.AudioFormats; import org.tritonus.share.sampled.AudioUtils; import org.tritonus.share.sampled.TConversionTool; import org.tritonus.share.ArraySet; /** * Common base class for implementing classes of AudioFileWriter. *

It provides often-used functionality and the new architecture using * an AudioOutputStream. *

There should be only one set of audio formats supported by any given * class of TAudioFileWriter. This class assumes implicitely that all * supported file types have a common set of audio formats they can handle. * * @author Matthias Pfisterer * @author Florian Bomers */ public abstract class TAudioFileWriter extends AudioFileWriter { protected static final int ALL = AudioSystem.NOT_SPECIFIED; protected static final AudioFormat.Encoding PCM_SIGNED = AudioFormat.Encoding.PCM_SIGNED; protected static final AudioFormat.Encoding PCM_UNSIGNED = AudioFormat.Encoding.PCM_UNSIGNED; /** Buffer length for the loop in the write() method. * This is in bytes. Perhaps it should be in frames to give an * equal amount of latency. */ private static final int BUFFER_LENGTH = 16384; // only needed for Collection.toArray() protected static final AudioFileFormat.Type[] NULL_TYPE_ARRAY = new AudioFileFormat.Type[0]; /** The audio file types (AudioFileFormat.Type) that can be * handled by the AudioFileWriter. */ private Collection m_audioFileTypes; /** The AudioFormats that can be handled by the * AudioFileWriter. */ // IDEA: implement a special collection that uses matches() to test whether an element is already in private Collection m_audioFormats; /** * Inheriting classes should call this constructor * in order to make use of the functionality of TAudioFileWriter. */ protected TAudioFileWriter(Collection fileTypes, Collection audioFormats) { if (TDebug.TraceAudioFileWriter) { TDebug.out("TAudioFileWriter.(): begin"); } m_audioFileTypes = fileTypes; m_audioFormats = audioFormats; if (TDebug.TraceAudioFileWriter) { TDebug.out("TAudioFileWriter.(): end"); } } // implementing the interface public AudioFileFormat.Type[] getAudioFileTypes() { return m_audioFileTypes.toArray(NULL_TYPE_ARRAY); } // implementing the interface public boolean isFileTypeSupported(AudioFileFormat.Type fileType) { return m_audioFileTypes.contains(fileType); } // implementing the interface public AudioFileFormat.Type[] getAudioFileTypes( AudioInputStream audioInputStream) { //$$fb 2000-08-16: rewrote this method. We need to check for *each* // file type, whether the format is supported ! AudioFormat format = audioInputStream.getFormat(); ArraySet res=new ArraySet(); Iterator it=m_audioFileTypes.iterator(); while (it.hasNext()) { AudioFileFormat.Type thisType = it.next(); if (isAudioFormatSupportedImpl(format, thisType)) { res.add(thisType); } } return res.toArray(NULL_TYPE_ARRAY); } // implementing the interface public boolean isFileTypeSupported(AudioFileFormat.Type fileType, AudioInputStream audioInputStream) { // $$fb 2000-08-16: finally this method works reliably ! return isFileTypeSupported(fileType) && (isAudioFormatSupportedImpl(audioInputStream.getFormat(), fileType) || findConvertableFormat(audioInputStream.getFormat(), fileType)!=null); // we may soft it up by including the possibility of endian/sign // changing for PCM formats. // I prefer to return false if the format is not exactly supported // but still exectute the write, if only sign/endian changing is necessary. } // implementing the interface public int write(AudioInputStream audioInputStream, AudioFileFormat.Type fileType, File file) throws IOException { if (TDebug.TraceAudioFileWriter) { TDebug.out(">TAudioFileWriter.write(.., File): called"); TDebug.out("class: "+getClass().getName()); } //$$fb added this check if (!isFileTypeSupported(fileType)) { if (TDebug.TraceAudioFileWriter) { TDebug.out("< file type is not supported"); } throw new IllegalArgumentException("file type is not supported."); } AudioFormat inputFormat = audioInputStream.getFormat(); if (TDebug.TraceAudioFileWriter) { TDebug.out("input format: " + inputFormat); } AudioFormat outputFormat = null; boolean bNeedsConversion = false; if (isAudioFormatSupportedImpl(inputFormat, fileType)) { if (TDebug.TraceAudioFileWriter) { TDebug.out("input format is supported directely"); } outputFormat = inputFormat; bNeedsConversion = false; } else { if (TDebug.TraceAudioFileWriter) { TDebug.out("input format is not supported directely; trying to find a convertable format"); } outputFormat = findConvertableFormat(inputFormat, fileType); if (outputFormat != null) { bNeedsConversion = true; // $$fb 2000-08-16 made consistent with new conversion trials // if 8 bit and only endianness changed, don't convert ! if (outputFormat.getSampleSizeInBits()==8 && outputFormat.getEncoding().equals(inputFormat.getEncoding())) { bNeedsConversion = false; } } else { if (TDebug.TraceAudioFileWriter) { TDebug.out("< input format is not supported and not convertable."); } throw new IllegalArgumentException("format not supported and not convertable"); } } long lLengthInBytes = AudioUtils.getLengthInBytes(audioInputStream); TDataOutputStream dataOutputStream = new TSeekableDataOutputStream(file); AudioOutputStream audioOutputStream = getAudioOutputStream( outputFormat, lLengthInBytes, fileType, dataOutputStream); int written=writeImpl(audioInputStream, audioOutputStream, bNeedsConversion); if (TDebug.TraceAudioFileWriter) { TDebug.out("< wrote "+written+" bytes."); } return written; } // implementing the interface public int write(AudioInputStream audioInputStream, AudioFileFormat.Type fileType, OutputStream outputStream) throws IOException { //$$fb added this check if (!isFileTypeSupported(fileType)) { throw new IllegalArgumentException("file type is not supported."); } if (TDebug.TraceAudioFileWriter) { TDebug.out(">TAudioFileWriter.write(.., OutputStream): called"); TDebug.out("class: "+getClass().getName()); } AudioFormat inputFormat = audioInputStream.getFormat(); if (TDebug.TraceAudioFileWriter) { TDebug.out("input format: " + inputFormat); } AudioFormat outputFormat = null; boolean bNeedsConversion = false; if (isAudioFormatSupportedImpl(inputFormat, fileType)) { if (TDebug.TraceAudioFileWriter) { TDebug.out("input format is supported directely"); } outputFormat = inputFormat; bNeedsConversion = false; } else { if (TDebug.TraceAudioFileWriter) { TDebug.out("input format is not supported directely; trying to find a convertable format"); } outputFormat = findConvertableFormat(inputFormat, fileType); if (outputFormat != null) { bNeedsConversion = true; // $$fb 2000-08-16 made consistent with new conversion trials // if 8 bit and only endianness changed, don't convert ! if (outputFormat.getSampleSizeInBits()==8 && outputFormat.getEncoding().equals(inputFormat.getEncoding())) { bNeedsConversion = false; } } else { if (TDebug.TraceAudioFileWriter) { TDebug.out("< format is not supported"); } throw new IllegalArgumentException("format not supported and not convertable"); } } long lLengthInBytes = AudioUtils.getLengthInBytes(audioInputStream); TDataOutputStream dataOutputStream = new TNonSeekableDataOutputStream(outputStream); AudioOutputStream audioOutputStream = getAudioOutputStream( outputFormat, lLengthInBytes, fileType, dataOutputStream); int written=writeImpl(audioInputStream, audioOutputStream, bNeedsConversion); if (TDebug.TraceAudioFileWriter) { TDebug.out("< wrote "+written+" bytes."); } return written; } protected int writeImpl( AudioInputStream audioInputStream, AudioOutputStream audioOutputStream, boolean bNeedsConversion) throws IOException { if (TDebug.TraceAudioFileWriter) { TDebug.out(">TAudioFileWriter.writeImpl(): called"); TDebug.out("class: "+getClass().getName()); } int nTotalWritten = 0; AudioFormat outputFormat = audioOutputStream.getFormat(); // TODO: handle case when frame size is unknown ? int nBytesPerSample = outputFormat.getFrameSize() / outputFormat.getChannels(); //$$fb 2000-07-18: BUFFER_LENGTH must be a multiple of frame size... int nBufferSize=((int)BUFFER_LENGTH/outputFormat.getFrameSize())*outputFormat.getFrameSize(); byte[] abBuffer = new byte[nBufferSize]; while (true) { if (TDebug.TraceAudioFileWriter) { TDebug.out("trying to read (bytes): " + abBuffer.length); } int nBytesRead = audioInputStream.read(abBuffer); if (TDebug.TraceAudioFileWriter) { TDebug.out("read (bytes): " + nBytesRead); } if (nBytesRead == -1) { break; } if (bNeedsConversion) { TConversionTool.changeOrderOrSign(abBuffer, 0, nBytesRead, nBytesPerSample); } int nWritten = audioOutputStream.write(abBuffer, 0, nBytesRead); nTotalWritten += nWritten; } if (TDebug.TraceAudioFileWriter) { TDebug.out(" getSupportedAudioFormats(AudioFileFormat.Type fileType) { return m_audioFormats.iterator(); } /** Checks whether the passed AudioFormat can be handled. * In this simple implementation, it is only checked if the * passed AudioFormat matches one of the generally handled * formats (i.e. the fileType argument is ignored). If the * handled AudioFormats depend on the file type, this method * or getSupportedAudioFormats() (on which this method relies) * has to be overwritten by subclasses. *

* This is the central method for checking if a FORMAT is supported. * Inheriting classes can overwrite this for performance * or to exclude/include special type/format combinations. *

* This method is only called when the fileType * is in the list of supported file types ! Overriding * classes need not check this. */ //$$fb 2000-08-16 changed name, changed documentation. Semantics ! protected boolean isAudioFormatSupportedImpl( AudioFormat audioFormat, AudioFileFormat.Type fileType) { if (TDebug.TraceAudioFileWriter) { TDebug.out("> TAudioFileWriter.isAudioFormatSupportedImpl(): format to test: " + audioFormat); TDebug.out("class: "+getClass().getName()); } Iterator audioFormats = getSupportedAudioFormats(fileType); while (audioFormats.hasNext()) { AudioFormat handledFormat = (AudioFormat) audioFormats.next(); if (TDebug.TraceAudioFileWriter) { TDebug.out("matching against format : " + handledFormat); } if (AudioFormats.matches(handledFormat, audioFormat)) { if (TDebug.TraceAudioFileWriter) { TDebug.out("<...succeeded."); } return true; } } if (TDebug.TraceAudioFileWriter) { TDebug.out("< ... failed"); } return false; } protected abstract AudioOutputStream getAudioOutputStream( AudioFormat audioFormat, long lLengthInBytes, AudioFileFormat.Type fileType, TDataOutputStream dataOutputStream) throws IOException; private AudioFormat findConvertableFormat( AudioFormat inputFormat, AudioFileFormat.Type fileType) { if (TDebug.TraceAudioFileWriter) { TDebug.out("TAudioFileWriter.findConvertableFormat(): input format: " + inputFormat); } if (!isFileTypeSupported(fileType)) { if (TDebug.TraceAudioFileWriter) { TDebug.out("< input file type is not supported."); } return null; } AudioFormat.Encoding inputEncoding = inputFormat.getEncoding(); if ((inputEncoding.equals(PCM_SIGNED) || inputEncoding.equals(PCM_UNSIGNED)) && inputFormat.getSampleSizeInBits() == 8) { AudioFormat outputFormat = convertFormat(inputFormat, true, false); if (TDebug.TraceAudioFileWriter) { TDebug.out("trying output format: " + outputFormat); } if (isAudioFormatSupportedImpl(outputFormat, fileType)) { if (TDebug.TraceAudioFileWriter) { TDebug.out("< ... succeeded"); } return outputFormat; } //$$fb 2000-08-16: added trial of other endianness for 8bit. We try harder ! outputFormat = convertFormat(inputFormat, false, true); if (TDebug.TraceAudioFileWriter) { TDebug.out("trying output format: " + outputFormat); } if (isAudioFormatSupportedImpl(outputFormat, fileType)) { if (TDebug.TraceAudioFileWriter) { TDebug.out("< ... succeeded"); } return outputFormat; } outputFormat = convertFormat(inputFormat, true, true); if (TDebug.TraceAudioFileWriter) { TDebug.out("trying output format: " + outputFormat); } if (isAudioFormatSupportedImpl(outputFormat, fileType)) { if (TDebug.TraceAudioFileWriter) { TDebug.out("< ... succeeded"); } return outputFormat; } if (TDebug.TraceAudioFileWriter) { TDebug.out("< ... failed"); } return null; } else if (inputEncoding.equals(PCM_SIGNED) && (inputFormat.getSampleSizeInBits() == 16 || inputFormat.getSampleSizeInBits() == 24 || inputFormat.getSampleSizeInBits() == 32) ) { // TODO: possible to allow all sample sized > 8 bit? // $$ fb: don't think that this is necessary. Well, let's talk about that in 5 years :) AudioFormat outputFormat = convertFormat(inputFormat, false, true); if (TDebug.TraceAudioFileWriter) { TDebug.out("trying output format: " + outputFormat); } if (isAudioFormatSupportedImpl(outputFormat, fileType)) { if (TDebug.TraceAudioFileWriter) { TDebug.out("< ... succeeded"); } return outputFormat; } else { if (TDebug.TraceAudioFileWriter) { TDebug.out("< ... failed"); } return null; } } else { if (TDebug.TraceAudioFileWriter) { TDebug.out("< ... failed"); } return null; } } // $$fb 2000-08-16: added convenience method private AudioFormat convertFormat(AudioFormat format, boolean changeSign, boolean changeEndian) { AudioFormat.Encoding enc=PCM_SIGNED; if (format.getEncoding().equals(PCM_UNSIGNED)!=changeSign) { enc=PCM_UNSIGNED; } return new AudioFormat( enc, format.getSampleRate(), format.getSampleSizeInBits(), format.getChannels(), format.getFrameSize(), format.getFrameRate(), format.isBigEndian() ^ changeEndian); } } /*** TAudioFileWriter.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/share/sampled/file/TAudioOutputStream.java0000644000175000017500000001100610173661005032207 0ustar twernertwerner/* * TAudioOutputStream.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2000 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.share.sampled.file; import java.io.IOException; import javax.sound.sampled.AudioFormat; import javax.sound.sampled.AudioSystem; import org.tritonus.share.TDebug; /** * Base class for classes implementing AudioOutputStream. * * @author Matthias Pfisterer */ public abstract class TAudioOutputStream implements AudioOutputStream { private AudioFormat m_audioFormat; private long m_lLength; // in bytes private long m_lCalculatedLength; private TDataOutputStream m_dataOutputStream; private boolean m_bDoBackPatching; private boolean m_bHeaderWritten; protected TAudioOutputStream(AudioFormat audioFormat, long lLength, TDataOutputStream dataOutputStream, boolean bDoBackPatching) { m_audioFormat = audioFormat; m_lLength = lLength; m_lCalculatedLength = 0; m_dataOutputStream = dataOutputStream; m_bDoBackPatching = bDoBackPatching; m_bHeaderWritten = false; } public AudioFormat getFormat() { return m_audioFormat; } /** Gives length of the stream. * This value is in bytes. It may be AudioSystem.NOT_SPECIFIED * to express that the length is unknown. */ public long getLength() { return m_lLength; } /** Gives number of bytes already written. */ // IDEA: rename this to BytesWritten or something like that ? public long getCalculatedLength() { return m_lCalculatedLength; } protected TDataOutputStream getDataOutputStream() { return m_dataOutputStream; } /** Writes audio data to the destination (file or output stream). */ // IDEA: use long? public int write(byte[] abData, int nOffset, int nLength) throws IOException { if (TDebug.TraceAudioOutputStream) { TDebug.out("TAudioOutputStream.write(): wanted length: " + nLength); } if (! m_bHeaderWritten) { writeHeader(); m_bHeaderWritten = true; } // $$fb added // check that total writes do not exceed specified length long lTotalLength=getLength(); if (lTotalLength!=AudioSystem.NOT_SPECIFIED && (m_lCalculatedLength+nLength)>lTotalLength) { if (TDebug.TraceAudioOutputStream) { TDebug.out("TAudioOutputStream.write(): requested more bytes to write than possible."); } nLength=(int) (lTotalLength-m_lCalculatedLength); // sanity if (nLength<0) { nLength=0; } } // TODO: throw an exception if nLength==0 ? (to indicate end of file ?) if (nLength>0) { m_dataOutputStream.write(abData, nOffset, nLength); m_lCalculatedLength += nLength; } if (TDebug.TraceAudioOutputStream) { TDebug.out("TAudioOutputStream.write(): calculated (total) length: " + m_lCalculatedLength+" bytes = "+(m_lCalculatedLength/getFormat().getFrameSize())+" frames"); } return nLength; } /** Writes the header of the audio file. */ protected abstract void writeHeader() throws IOException; /** Closes the stream. * This does write remaining buffered data to the destination, * backpatch the header, if necessary, and closes the destination. */ public void close() throws IOException { if (TDebug.TraceAudioOutputStream) { TDebug.out("TAudioOutputStream.close(): called"); } // flush? if (m_bDoBackPatching) { if (TDebug.TraceAudioOutputStream) { TDebug.out("TAudioOutputStream.close(): patching header"); } patchHeader(); } m_dataOutputStream.close(); } protected void patchHeader() throws IOException { TDebug.out("TAudioOutputStream.patchHeader(): called"); // DO NOTHING } protected void setLengthFromCalculatedLength() { m_lLength = m_lCalculatedLength; } } /*** TAudioOutputStream.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/share/sampled/file/TDataOutputStream.java0000644000175000017500000000331710374074736032041 0ustar twernertwerner/* * TDataOutputStream.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999 by Florian Bomers * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.share.sampled.file; import java.io.DataOutput; import java.io.IOException; /** * Interface for the file writing classes. *

Like that it is possible to write to a file without knowing * the length before. * * @author Florian Bomers */ public interface TDataOutputStream extends DataOutput { public boolean supportsSeek(); public void seek(long position) throws IOException; public long getFilePointer() throws IOException; public long length() throws IOException; public void writeLittleEndian32(int value) throws IOException; public void writeLittleEndian16(short value) throws IOException; public void close() throws IOException; } /*** TDataOutputStream.java ***/ ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootlibtritonus-java-20070428/src/classes/org/tritonus/share/sampled/file/THeaderlessAudioFileWriter.javalibtritonus-java-20070428/src/classes/org/tritonus/share/sampled/file/THeaderlessAudioFileWriter.jav0000644000175000017500000000514310173661005033453 0ustar twernertwerner/* * THeaderlessAudioFileWriter.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2000 by Florian Bomers * Copyright (c) 2000 - 2002 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.share.sampled.file; import java.io.IOException; import java.util.Collection; import javax.sound.sampled.AudioFileFormat; import javax.sound.sampled.AudioFormat; import org.tritonus.share.TDebug; /** Base class for formats without extra header. This AudioFileWriter is typically used for compressed formats where the encoder puts a header into the encoded stream. In this case, the AudioFileWriter needs not to add a header. This is why THeaderlessAudioOutputStream is used here. @author Florian Bomers @author Matthias Pfisterer */ public class THeaderlessAudioFileWriter extends TAudioFileWriter { protected THeaderlessAudioFileWriter(Collection fileTypes, Collection audioFormats) { super(fileTypes, audioFormats); if (TDebug.TraceAudioFileWriter) { TDebug.out("THeaderlessAudioFileWriter.(): begin"); } if (TDebug.TraceAudioFileWriter) { TDebug.out("THeaderlessAudioFileWriter.(): end"); } } protected AudioOutputStream getAudioOutputStream( AudioFormat audioFormat, long lLengthInBytes, AudioFileFormat.Type fileType, TDataOutputStream dataOutputStream) throws IOException { if (TDebug.TraceAudioFileWriter) { TDebug.out("THeaderlessAudioFileWriter.getAudioOutputStream(): begin"); } AudioOutputStream aos = new HeaderlessAudioOutputStream( audioFormat, lLengthInBytes, dataOutputStream); if (TDebug.TraceAudioFileWriter) { TDebug.out("THeaderlessAudioFileWriter.getAudioOutputStream(): end"); } return aos; } } /*** THeaderlessAudioFileWriter.java ***/ ././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootlibtritonus-java-20070428/src/classes/org/tritonus/share/sampled/file/TNonSeekableDataOutputStream.javalibtritonus-java-20070428/src/classes/org/tritonus/share/sampled/file/TNonSeekableDataOutputStream.j0000644000175000017500000000461610173661005033447 0ustar twernertwerner/* * TNonSeekableDataOutputStream.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999 by Florian Bomers * Copyright (c) 2000 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.share.sampled.file; import java.io.IOException; import java.io.OutputStream; import java.io.DataOutputStream; /** * A TDataOutputStream that does not allow seeking. * * @author Florian Bomers * @author Matthias Pfisterer */ public class TNonSeekableDataOutputStream extends DataOutputStream implements TDataOutputStream { public TNonSeekableDataOutputStream(OutputStream outputStream) { super(outputStream); } public boolean supportsSeek() { return false; } public void seek(long position) throws IOException { throw new IllegalArgumentException("TNonSeekableDataOutputStream: Call to seek not allowed."); } public long getFilePointer() throws IOException { throw new IllegalArgumentException("TNonSeekableDataOutputStream: Call to getFilePointer not allowed."); } public long length() throws IOException { throw new IllegalArgumentException("TNonSeekableDataOutputStream: Call to length not allowed."); } public void writeLittleEndian32(int value) throws IOException { writeByte(value & 0xFF); writeByte((value >> 8) & 0xFF); writeByte((value >> 16) & 0xFF); writeByte((value >> 24) & 0xFF); } public void writeLittleEndian16(short value) throws IOException { writeByte(value & 0xFF); writeByte((value >> 8) & 0xFF); } } /*** TNonSeekableDataOutputStream.java ***/ ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootlibtritonus-java-20070428/src/classes/org/tritonus/share/sampled/file/TSeekableDataOutputStream.javalibtritonus-java-20070428/src/classes/org/tritonus/share/sampled/file/TSeekableDataOutputStream.java0000644000175000017500000000362610173661005033464 0ustar twernertwerner/* * TSeekableDataOutputStream.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999 by Florian Bomers * Copyright (c) 2000 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.share.sampled.file; import java.io.File; import java.io.RandomAccessFile; import java.io.IOException; /** * A TDataOutputStream that allows seeking. * * @author Florian Bomers * @author Matthias Pfisterer */ public class TSeekableDataOutputStream extends RandomAccessFile implements TDataOutputStream { public TSeekableDataOutputStream(File file) throws IOException { super(file, "rw"); } public boolean supportsSeek() { return true; } public void writeLittleEndian32(int value) throws IOException { writeByte(value & 0xFF); writeByte((value >> 8) & 0xFF); writeByte((value >> 16) & 0xFF); writeByte((value >> 24) & 0xFF); } public void writeLittleEndian16(short value) throws IOException { writeByte(value & 0xFF); writeByte((value >> 8) & 0xFF); } } /*** TSeekableDataOutputStream.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/share/sampled/file/package.html0000644000175000017500000000103110173661005030040 0ustar twernertwerner

Base classes for the implementation of AudioFileReaders and AudioFileWriters. The classes provided here .

@see javax.sound.sampled.spi.AudioFileReader @see javax.sound.sampled.spi.AudioFileWriter @see org.tritonus.sampled.file @see org.tritonus.sampled.file.gsm @see org.tritonus.sampled.file.jorbis @see org.tritonus.sampled.file.mpeg @see org.tritonus.sampled.file.vorbis libtritonus-java-20070428/src/classes/org/tritonus/share/sampled/mixer/0000755000175000017500000000000010621572527026001 5ustar twernertwernerlibtritonus-java-20070428/src/classes/org/tritonus/share/sampled/mixer/TBaseDataLine.java0000644000175000017500000000436110374074736031254 0ustar twernertwerner/* * TBaseDataLine.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999 - 2004 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.share.sampled.mixer; import java.util.Collection; import javax.sound.sampled.AudioFormat; import javax.sound.sampled.Control; import javax.sound.sampled.DataLine; import javax.sound.sampled.LineUnavailableException; import org.tritonus.share.TDebug; /** Base class for implementing SourceDataLine or TargetDataLine. */ public abstract class TBaseDataLine extends TDataLine { public TBaseDataLine(TMixer mixer, DataLine.Info info) { super(mixer, info); } public TBaseDataLine(TMixer mixer, DataLine.Info info, Collection controls) { super(mixer, info, controls); } public void open(AudioFormat format, int nBufferSize) throws LineUnavailableException { if (TDebug.TraceDataLine) { TDebug.out("TBaseDataLine.open(AudioFormat, int): called with buffer size: " + nBufferSize); } setBufferSize(nBufferSize); open(format); } public void open(AudioFormat format) throws LineUnavailableException { if (TDebug.TraceDataLine) { TDebug.out("TBaseDataLine.open(AudioFormat): called"); } setFormat(format); open(); } // IDEA: move to TDataLine or TLine? // necessary and wise at all? protected void finalize() { if (isOpen()) { close(); } } } /*** TBaseDataLine.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/share/sampled/mixer/TBooleanControl.java0000644000175000017500000000540710173661005031706 0ustar twernertwerner/* * TBooleanControl.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2001 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.share.sampled.mixer; import javax.sound.sampled.BooleanControl; import org.tritonus.share.TDebug; /** Base class for classes implementing BooleanControl. */ public class TBooleanControl extends BooleanControl implements TControllable { private TControlController m_controller; public TBooleanControl(BooleanControl.Type type, boolean bInitialValue) { this(type, bInitialValue, null); } public TBooleanControl(BooleanControl.Type type, boolean bInitialValue, TCompoundControl parentControl) { super(type, bInitialValue); if (TDebug.TraceControl) { TDebug.out("TBooleanControl.: begin"); } m_controller = new TControlController(); if (TDebug.TraceControl) { TDebug.out("TBooleanControl.: end"); } } public TBooleanControl(BooleanControl.Type type, boolean bInitialValue, String strTrueStateLabel, String strFalseStateLabel) { this(type, bInitialValue, strTrueStateLabel, strFalseStateLabel, null); } public TBooleanControl(BooleanControl.Type type, boolean bInitialValue, String strTrueStateLabel, String strFalseStateLabel, TCompoundControl parentControl) { super(type, bInitialValue, strTrueStateLabel, strFalseStateLabel); if (TDebug.TraceControl) { TDebug.out("TBooleanControl.: begin"); } m_controller = new TControlController(); if (TDebug.TraceControl) { TDebug.out("TBooleanControl.: end"); } } public void setParentControl(TCompoundControl compoundControl) { m_controller.setParentControl(compoundControl); } public TCompoundControl getParentControl() { return m_controller.getParentControl(); } public void commit() { m_controller.commit(); } } /*** TBooleanControl.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/share/sampled/mixer/TClip.java0000644000175000017500000001431610540343256027657 0ustar twernertwerner/* * TClip.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999 - 2004 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.share.sampled.mixer; import java.io.IOException; import java.io.ByteArrayInputStream; import java.util.Collection; import javax.sound.sampled.AudioFormat; import javax.sound.sampled.AudioSystem; import javax.sound.sampled.Clip; import javax.sound.sampled.Control; import javax.sound.sampled.DataLine; import javax.sound.sampled.AudioInputStream; import javax.sound.sampled.LineUnavailableException; import org.tritonus.share.TDebug; import org.tritonus.share.sampled.mixer.TDataLine; public class TClip extends TDataLine implements Clip { //$$fb the following fields are never used //private static final Class[] CONTROL_CLASSES = {/*GainControl.class*/}; //private static final int BUFFER_FRAMES = 16384; public TClip(DataLine.Info info) { super(null, // TMixer info); } public TClip(DataLine.Info info, Collection controls) { super(null, // TMixer info, controls); } public void open(AudioFormat audioFormat, byte[] abData, int nOffset, int nLength) throws LineUnavailableException { // int nBufferLength = nNumFrames * audioFormat.getFrameSize(); // TODO: check if nOffset + nBufferLength <= abData.length // perhaps truncate automatically ByteArrayInputStream bais = new ByteArrayInputStream(abData, nOffset, nLength); AudioInputStream audioInputStream = new AudioInputStream(bais, audioFormat, AudioSystem.NOT_SPECIFIED); try { open(audioInputStream); } catch (IOException e) { if (TDebug.TraceAllExceptions) { TDebug.out(e); } throw new LineUnavailableException("IOException occured"); } } public void open(AudioInputStream audioInputStream) throws LineUnavailableException, IOException { AudioFormat audioFormat = audioInputStream.getFormat(); // TOOD: DataLine.Info info = new DataLine.Info(Clip.class, audioFormat, -1/*nBufferSize*/); setLineInfo(info); /* int nFrameSize = audioFormat.getFrameSize(); long lTotalLength = audioInputStream.getFrameLength() * nFrameSize; int nFormat = Esd.ESD_STREAM | Esd.ESD_PLAY | EsdUtils.getEsdFormat(audioFormat); if (TDebug.TraceClip) { TDebug.out("format: " + nFormat); TDebug.out("sample rate: " + audioFormat.getSampleRate()); } // m_esdSample.open(nFormat, (int) audioFormat.getSampleRate(), (int) lTotalLength); if (TDebug.TraceClip) { TDebug.out("size in esd: " + audioInputStream.getFrameLength() * nFrameSize); } int nBufferLength = BUFFER_FRAMES * nFrameSize; byte[] abData = new byte[nBufferLength]; int nBytesRead = 0; int nTotalBytes = 0; while (nBytesRead != -1) { try { nBytesRead = audioInputStream.read(abData, 0, abData.length); } catch (IOException e) { if (TDebug.TraceClip || TDebug.TraceAllExceptions) { TDebug.out(e); } } if (nBytesRead >= 0) { nTotalBytes += nBytesRead; if (TDebug.TraceClip) { TDebug.out("TClip.open(): total bytes: " + nTotalBytes); TDebug.out("TClip.open(): Trying to write: " + nBytesRead); } int nBytesWritten = 0; //m_esdSample.write(abData, 0, nBytesRead); if (TDebug.TraceClip) { TDebug.out("TClip.open(): Written: " + nBytesWritten); } } } // to trigger the events // open(); */ } public int getFrameLength() { // TODO: return -1; } public long getMicrosecondLength() { // TODO: return -1; } public void setFramePosition(int nPosition) { // TOOD: } public void setMicrosecondPosition(long lPosition) { // TOOD: } public int getFramePosition() { // TOOD: return -1; } public long getMicrosecondPosition() { // TOOD: return -1; } public void setLoopPoints(int nStart, int nEnd) { // TOOD: } public void loop(int nCount) { if (TDebug.TraceClip) { TDebug.out("TClip.loop(int): called; count = " + nCount); } if (false/*isStarted()*/) { /* * only allow zero count to stop the looping * at the end of an iteration. */ if (nCount == 0) { if (TDebug.TraceClip) { TDebug.out("TClip.loop(int): stopping sample"); } // m_esdSample.stop(); } } else { if (nCount == 0) { if (TDebug.TraceClip) { TDebug.out("TClip.loop(int): starting sample (once)"); } // m_esdSample.play(); } else { /* * we're ignoring the count, because esd * cannot loop for a fixed number of * times. */ // TDebug.out("hallo"); if (TDebug.TraceClip) { TDebug.out("TClip.loop(int): starting sample (forever)"); } // m_esdSample.loop(); } } // TOOD: } public void flush() { // TOOD: } public void drain() { // TOOD: } public void close() { // m_esdSample.free(); // m_esdSample.close(); // TOOD: } public void open() { // TODO: } public void start() { if (TDebug.TraceClip) { TDebug.out("TClip.start(): called"); } /* * This is a hack. What start() really should do is * start playing at the position playback was stopped. */ if (TDebug.TraceClip) { TDebug.out("TClip.start(): calling 'loop(0)' [hack]"); } loop(0); } public void stop() { // TODO: // m_esdSample.kill(); } /* * This method is enforced by DataLine, but doesn't make any * sense for Clips. */ public int available() { return -1; } } /*** TClip.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/share/sampled/mixer/TCompoundControl.java0000644000175000017500000000365710173661005032120 0ustar twernertwerner/* * TCompoundControl.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2001 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.share.sampled.mixer; import javax.sound.sampled.CompoundControl; import javax.sound.sampled.Control; import org.tritonus.share.TDebug; /** Base class for classes implementing Line. */ public class TCompoundControl extends CompoundControl implements TControllable { private TControlController m_controller; public TCompoundControl(CompoundControl.Type type, Control[] aMemberControls) { super(type, aMemberControls); if (TDebug.TraceControl) { TDebug.out("TCompoundControl.: begin"); } m_controller = new TControlController(); if (TDebug.TraceControl) { TDebug.out("TCompoundControl.: end"); } } public void setParentControl(TCompoundControl compoundControl) { m_controller.setParentControl(compoundControl); } public TCompoundControl getParentControl() { return m_controller.getParentControl(); } public void commit() { m_controller.commit(); } } /*** TCompoundControl.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/share/sampled/mixer/TCompoundControlType.java0000644000175000017500000000267710173661005032763 0ustar twernertwerner/* * TCompoundControlType.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2001 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.share.sampled.mixer; import javax.sound.sampled.CompoundControl; /** CompoundControl.Type class. This class is only needed to provide a public constructor. */ public class TCompoundControlType extends CompoundControl.Type { /** Constructor. Constructs a CompoundControl.Type with the name given. @param strName The name of the control. */ public TCompoundControlType(String strName) { super(strName); } } /*** TCompoundControlType.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/share/sampled/mixer/TControlController.java0000644000175000017500000000352310374074736032463 0ustar twernertwerner/* * TControlController.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2001 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.share.sampled.mixer; import org.tritonus.share.TDebug; /** Base class for classes implementing Line. */ public class TControlController implements TControllable { /** The parent (compound) control. In case this control is part of a compound control, the parentControl property is set to a value other than null. */ private TCompoundControl m_parentControl; public TControlController() { } public void setParentControl(TCompoundControl compoundControl) { m_parentControl = compoundControl; } public TCompoundControl getParentControl() { return m_parentControl; } public void commit() { if (TDebug.TraceControl) { TDebug.out("TControlController.commit(): called [" + this.getClass().getName() + "]"); } if (getParentControl() != null) { getParentControl().commit(); } } } /*** TControlController.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/share/sampled/mixer/TControllable.java0000644000175000017500000000231610374074736031416 0ustar twernertwerner/* * TControllable.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2001 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.share.sampled.mixer; public interface TControllable { public void setParentControl(TCompoundControl compoundControl); public TCompoundControl getParentControl(); public void commit(); } /*** TControllable.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/share/sampled/mixer/TDataLine.java0000644000175000017500000001135410374074736030461 0ustar twernertwerner/* * TDataLine.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999 - 2004 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.share.sampled.mixer; import java.util.Collection; import javax.sound.sampled.AudioFormat; import javax.sound.sampled.AudioSystem; import javax.sound.sampled.Control; import javax.sound.sampled.DataLine; import javax.sound.sampled.LineEvent; import org.tritonus.share.TDebug; /** Base class for classes implementing DataLine. */ public abstract class TDataLine extends TLine implements DataLine { private static final int DEFAULT_BUFFER_SIZE = 128000; private AudioFormat m_format; private int m_nBufferSize; private boolean m_bRunning; // private boolean m_bActive; public TDataLine(TMixer mixer, DataLine.Info info) { super(mixer, info); init(info); } public TDataLine(TMixer mixer, DataLine.Info info, Collection controls) { super(mixer, info, controls); init(info); } // IDEA: extract format and bufsize from info? private void init(DataLine.Info info) { m_format = null; m_nBufferSize = AudioSystem.NOT_SPECIFIED; setRunning(false); // setActive(false); } // not defined here: // public void drain() // public void flush() public void start() { if (TDebug.TraceSourceDataLine) { TDebug.out("TDataLine.start(): called"); } setRunning(true); } public void stop() { if (TDebug.TraceSourceDataLine) { TDebug.out("TDataLine.stop(): called"); } setRunning(false); } public boolean isRunning() { return m_bRunning; } // TODO: recheck protected void setRunning(boolean bRunning) { boolean bOldValue = isRunning(); m_bRunning = bRunning; if (bOldValue != isRunning()) { if (isRunning()) { startImpl(); notifyLineEvent(LineEvent.Type.START); } else { stopImpl(); notifyLineEvent(LineEvent.Type.STOP); } } } protected void startImpl() { } protected void stopImpl() { } /** * This implementation returns the status of isRunning(). * Subclasses should overwrite this method if there is more * precise information about the status of the line available. */ public boolean isActive() { return isRunning(); } /* public boolean isStarted() { return m_bStarted; } */ // TODO: should only ALLOW engaging in data I/O. // actual START event should only be sent when line really becomes active /* protected void setStarted(boolean bStarted) { m_bStarted = bStarted; if (!isRunning()) { setActive(false); } } */ public AudioFormat getFormat() { return m_format; } protected void setFormat(AudioFormat format) { if (TDebug.TraceDataLine) { TDebug.out("TDataLine.setFormat(): setting: " + format); } m_format = format; } public int getBufferSize() { return m_nBufferSize; } protected void setBufferSize(int nBufferSize) { if (TDebug.TraceDataLine) { TDebug.out("TDataLine.setBufferSize(): setting: " + nBufferSize); } m_nBufferSize = nBufferSize; } // not defined here: // public int available() public int getFramePosition() { // TODO: return -1; } public long getLongFramePosition() { // TODO: return -1; } public long getMicrosecondPosition() { return (long) (getFramePosition() * getFormat().getFrameRate() * 1000000); } /* * Has to be overridden to be useful. */ public float getLevel() { return AudioSystem.NOT_SPECIFIED; } protected void checkOpen() { if (getFormat() == null) { throw new IllegalStateException("format must be specified"); } if (getBufferSize() == AudioSystem.NOT_SPECIFIED) { setBufferSize(getDefaultBufferSize()); } } protected int getDefaultBufferSize() { return DEFAULT_BUFFER_SIZE; } protected void notifyLineEvent(LineEvent.Type type) { notifyLineEvent(new LineEvent(this, type, getFramePosition())); } } /*** TDataLine.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/share/sampled/mixer/TEnumControl.java0000644000175000017500000000360510173661005031231 0ustar twernertwerner/* * TEnumControl.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2001 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.share.sampled.mixer; import javax.sound.sampled.EnumControl; import org.tritonus.share.TDebug; /** Base class for classes implementing Line. */ public class TEnumControl extends EnumControl implements TControllable { private TControlController m_controller; public TEnumControl(EnumControl.Type type, Object[] aValues, Object value) { super(type, aValues, value); if (TDebug.TraceControl) { TDebug.out("TEnumControl.: begin"); } m_controller = new TControlController(); if (TDebug.TraceControl) { TDebug.out("TEnumControl.: end"); } } public void setParentControl(TCompoundControl compoundControl) { m_controller.setParentControl(compoundControl); } public TCompoundControl getParentControl() { return m_controller.getParentControl(); } public void commit() { m_controller.commit(); } } /*** TEnumControl.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/share/sampled/mixer/TFloatControl.java0000644000175000017500000000541210173661005031370 0ustar twernertwerner/* * TFloatControl.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2001 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.share.sampled.mixer; import javax.sound.sampled.FloatControl; import org.tritonus.share.TDebug; /** Base class for classes implementing Line. */ public class TFloatControl extends FloatControl implements TControllable { private TControlController m_controller; public TFloatControl(FloatControl.Type type, float fMinimum, float fMaximum, float fPrecision, int nUpdatePeriod, float fInitialValue, String strUnits) { super(type, fMinimum, fMaximum, fPrecision, nUpdatePeriod, fInitialValue, strUnits); if (TDebug.TraceControl) { TDebug.out("TFloatControl.: begin"); } m_controller = new TControlController(); if (TDebug.TraceControl) { TDebug.out("TFloatControl.: end"); } } public TFloatControl(FloatControl.Type type, float fMinimum, float fMaximum, float fPrecision, int nUpdatePeriod, float fInitialValue, String strUnits, String strMinLabel, String strMidLabel, String strMaxLabel) { super(type, fMinimum, fMaximum, fPrecision, nUpdatePeriod, fInitialValue, strUnits, strMinLabel, strMidLabel, strMaxLabel); if (TDebug.TraceControl) { TDebug.out("TFloatControl.: begin"); } m_controller = new TControlController(); if (TDebug.TraceControl) { TDebug.out("TFloatControl.: end"); } } public void setParentControl(TCompoundControl compoundControl) { m_controller.setParentControl(compoundControl); } public TCompoundControl getParentControl() { return m_controller.getParentControl(); } public void commit() { m_controller.commit(); } } /*** TFloatControl.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/share/sampled/mixer/TLine.java0000644000175000017500000001427210173661005027655 0ustar twernertwerner/* * TLine.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999 - 2004 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.share.sampled.mixer; import java.util.Collection; import java.util.ArrayList; import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Set; import javax.sound.sampled.AudioSystem; import javax.sound.sampled.Control; import javax.sound.sampled.Line; import javax.sound.sampled.LineEvent; import javax.sound.sampled.LineListener; import javax.sound.sampled.LineUnavailableException; import org.tritonus.share.TDebug; import org.tritonus.share.TNotifier; /** Base class for classes implementing Line. */ public abstract class TLine implements Line { private static final Control[] EMPTY_CONTROL_ARRAY = new Control[0]; private Line.Info m_info; private boolean m_bOpen; private List m_controls; private Set m_lineListeners; private TMixer m_mixer; protected TLine(TMixer mixer, Line.Info info) { setLineInfo(info); setOpen(false); m_controls = new ArrayList(); m_lineListeners = new HashSet(); m_mixer = mixer; } protected TLine(TMixer mixer, Line.Info info, Collection controls) { this (mixer, info); m_controls.addAll(controls); } protected TMixer getMixer() { return m_mixer; } public Line.Info getLineInfo() { return m_info; } protected void setLineInfo(Line.Info info) { if (TDebug.TraceLine) { TDebug.out("TLine.setLineInfo(): setting: " + info); } synchronized (this) { m_info = info; } } public void open() throws LineUnavailableException { if (TDebug.TraceLine) { TDebug.out("TLine.open(): called"); } if (! isOpen()) { if (TDebug.TraceLine) { TDebug.out("TLine.open(): opening"); } openImpl(); if (getMixer() != null) { getMixer().registerOpenLine(this); } setOpen(true); } else { if (TDebug.TraceLine) { TDebug.out("TLine.open(): already open"); } } } /** * Subclasses should override this method. */ protected void openImpl() throws LineUnavailableException { if (TDebug.TraceLine) { TDebug.out("TLine.openImpl(): called"); } } public void close() { if (TDebug.TraceLine) { TDebug.out("TLine.close(): called"); } if (isOpen()) { if (TDebug.TraceLine) { TDebug.out("TLine.close(): closing"); } if (getMixer() != null) { getMixer().unregisterOpenLine(this); } closeImpl(); setOpen(false); } else { if (TDebug.TraceLine) { TDebug.out("TLine.close(): not open"); } } } /** * Subclasses should override this method. */ protected void closeImpl() { if (TDebug.TraceLine) { TDebug.out("TLine.closeImpl(): called"); } } public boolean isOpen() { return m_bOpen; } protected void setOpen(boolean bOpen) { if (TDebug.TraceLine) { TDebug.out("TLine.setOpen(): called, value: " + bOpen); } boolean bOldValue = isOpen(); m_bOpen = bOpen; if (bOldValue != isOpen()) { if (isOpen()) { if (TDebug.TraceLine) { TDebug.out("TLine.setOpen(): opened"); } notifyLineEvent(LineEvent.Type.OPEN); } else { if (TDebug.TraceLine) { TDebug.out("TLine.setOpen(): closed"); } notifyLineEvent(LineEvent.Type.CLOSE); } } } protected void addControl(Control control) { synchronized (m_controls) { m_controls.add(control); } } protected void removeControl(Control control) { synchronized (m_controls) { m_controls.remove(control); } } public Control[] getControls() { synchronized (m_controls) { return m_controls.toArray(EMPTY_CONTROL_ARRAY); } } public Control getControl(Control.Type controlType) { synchronized (m_controls) { Iterator it = m_controls.iterator(); while (it.hasNext()) { Control control = it.next(); if (control.getType().equals(controlType)) { return control; } } throw new IllegalArgumentException("no control of type " + controlType); } } public boolean isControlSupported(Control.Type controlType) { // TDebug.out("TLine.isSupportedControl(): called"); try { return getControl(controlType) != null; } catch (IllegalArgumentException e) { if (TDebug.TraceAllExceptions) { TDebug.out(e); } // TDebug.out("TLine.isSupportedControl(): returning false"); return false; } } public void addLineListener(LineListener listener) { // TDebug.out("%% TChannel.addListener(): called"); synchronized (m_lineListeners) { m_lineListeners.add(listener); } } public void removeLineListener(LineListener listener) { synchronized (m_lineListeners) { m_lineListeners.remove(listener); } } private Set getLineListeners() { synchronized (m_lineListeners) { return new HashSet(m_lineListeners); } } // is overridden in TDataLine to provide a position protected void notifyLineEvent(LineEvent.Type type) { notifyLineEvent(new LineEvent(this, type, AudioSystem.NOT_SPECIFIED)); } protected void notifyLineEvent(LineEvent event) { // TDebug.out("%% TChannel.notifyChannelEvent(): called"); // Channel.Event event = new Channel.Event(this, type, getPosition()); TNotifier.notifier.addEntry(event, getLineListeners()); } } /*** TLine.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/share/sampled/mixer/TMixer.java0000644000175000017500000003262010173661005030047 0ustar twernertwerner/* * TMixer.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999 - 2004 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.share.sampled.mixer; import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; import java.util.Set; import javax.sound.sampled.AudioFormat; import javax.sound.sampled.Clip; import javax.sound.sampled.DataLine; import javax.sound.sampled.Line; import javax.sound.sampled.LineUnavailableException; import javax.sound.sampled.Mixer; import javax.sound.sampled.Port; import javax.sound.sampled.SourceDataLine; import javax.sound.sampled.TargetDataLine; import org.tritonus.share.TDebug; import org.tritonus.share.sampled.AudioFormats; import org.tritonus.share.ArraySet; // TODO: global controls (that use the system mixer) public abstract class TMixer extends TLine implements Mixer { private static Line.Info[] EMPTY_LINE_INFO_ARRAY = new Line.Info[0]; private static Line[] EMPTY_LINE_ARRAY = new Line[0]; private Mixer.Info m_mixerInfo; private Collection m_supportedSourceFormats; private Collection m_supportedTargetFormats; private Collection m_supportedSourceLineInfos; private Collection m_supportedTargetLineInfos; private Set m_openSourceDataLines; private Set m_openTargetDataLines; /** Constructor for mixers that use setSupportInformation(). */ protected TMixer(Mixer.Info mixerInfo, Line.Info lineInfo) { this(mixerInfo, lineInfo, new ArrayList(), new ArrayList(), new ArrayList(), new ArrayList()); } /** Constructor for mixers. */ protected TMixer(Mixer.Info mixerInfo, Line.Info lineInfo, Collection supportedSourceFormats, Collection supportedTargetFormats, Collection supportedSourceLineInfos, Collection supportedTargetLineInfos) { super(null, // TMixer lineInfo); if (TDebug.TraceMixer) { TDebug.out("TMixer.(): begin"); } m_mixerInfo = mixerInfo; setSupportInformation( supportedSourceFormats, supportedTargetFormats, supportedSourceLineInfos, supportedTargetLineInfos); m_openSourceDataLines = new ArraySet(); m_openTargetDataLines = new ArraySet(); if (TDebug.TraceMixer) { TDebug.out("TMixer.(): end"); } } protected void setSupportInformation( Collection supportedSourceFormats, Collection supportedTargetFormats, Collection supportedSourceLineInfos, Collection supportedTargetLineInfos) { if (TDebug.TraceMixer) { TDebug.out("TMixer.setSupportInformation(): begin"); } m_supportedSourceFormats = supportedSourceFormats; m_supportedTargetFormats = supportedTargetFormats; m_supportedSourceLineInfos = supportedSourceLineInfos; m_supportedTargetLineInfos = supportedTargetLineInfos; if (TDebug.TraceMixer) { TDebug.out("TMixer.setSupportInformation(): end"); } } public Mixer.Info getMixerInfo() { if (TDebug.TraceMixer) { TDebug.out("TMixer.getMixerInfo(): begin"); } if (TDebug.TraceMixer) { TDebug.out("TMixer.getMixerInfo(): end"); } return m_mixerInfo; } public Line.Info[] getSourceLineInfo() { if (TDebug.TraceMixer) { TDebug.out("TMixer.getSourceLineInfo(): begin"); } Line.Info[] infos = (Line.Info[]) m_supportedSourceLineInfos.toArray(EMPTY_LINE_INFO_ARRAY); if (TDebug.TraceMixer) { TDebug.out("TMixer.getSourceLineInfo(): end"); } return infos; } public Line.Info[] getTargetLineInfo() { if (TDebug.TraceMixer) { TDebug.out("TMixer.getTargetLineInfo(): begin"); } Line.Info[] infos = (Line.Info[]) m_supportedTargetLineInfos.toArray(EMPTY_LINE_INFO_ARRAY); if (TDebug.TraceMixer) { TDebug.out("TMixer.getTargetLineInfo(): end"); } return infos; } public Line.Info[] getSourceLineInfo(Line.Info info) { if (TDebug.TraceMixer) { TDebug.out("TMixer.getSourceLineInfo(Line.Info): info to test: " + info); } // TODO: return EMPTY_LINE_INFO_ARRAY; } public Line.Info[] getTargetLineInfo(Line.Info info) { if (TDebug.TraceMixer) { TDebug.out("TMixer.getTargetLineInfo(Line.Info): info to test: " + info); } // TODO: return EMPTY_LINE_INFO_ARRAY; } public boolean isLineSupported(Line.Info info) { if (TDebug.TraceMixer) { TDebug.out("TMixer.isLineSupported(): info to test: " + info); } Class lineClass = info.getLineClass(); if (lineClass.equals(SourceDataLine.class)) { return isLineSupportedImpl(info, m_supportedSourceLineInfos); } else if (lineClass.equals(TargetDataLine.class)) { return isLineSupportedImpl(info, m_supportedTargetLineInfos); } else if (lineClass.equals(Port.class)) { return isLineSupportedImpl(info, m_supportedSourceLineInfos) || isLineSupportedImpl(info, m_supportedTargetLineInfos); } else { return false; } } private static boolean isLineSupportedImpl(Line.Info info, Collection supportedLineInfos) { Iterator iterator = supportedLineInfos.iterator(); while (iterator.hasNext()) { Line.Info info2 = (Line.Info) iterator.next(); if (info2.matches(info)) { return true; } } return false; } public Line getLine(Line.Info info) throws LineUnavailableException { if (TDebug.TraceMixer) { TDebug.out("TMixer.getLine(): begin"); } Class lineClass = info.getLineClass(); DataLine.Info dataLineInfo = null; Port.Info portInfo = null; AudioFormat[] aFormats = null; if (info instanceof DataLine.Info) { dataLineInfo = (DataLine.Info) info; aFormats = dataLineInfo.getFormats(); } else if (info instanceof Port.Info) { portInfo = (Port.Info) info; } AudioFormat format = null; Line line = null; if (lineClass == SourceDataLine.class) { if (TDebug.TraceMixer) { TDebug.out("TMixer.getLine(): type: SourceDataLine"); } if (dataLineInfo == null) { throw new IllegalArgumentException("need DataLine.Info for SourceDataLine"); } format = getSupportedSourceFormat(aFormats); line = getSourceDataLine(format, dataLineInfo.getMaxBufferSize()); } else if (lineClass == Clip.class) { if (TDebug.TraceMixer) { TDebug.out("TMixer.getLine(): type: Clip"); } if (dataLineInfo == null) { throw new IllegalArgumentException("need DataLine.Info for Clip"); } format = getSupportedSourceFormat(aFormats); line = getClip(format); } else if (lineClass == TargetDataLine.class) { if (TDebug.TraceMixer) { TDebug.out("TMixer.getLine(): type: TargetDataLine"); } if (dataLineInfo == null) { throw new IllegalArgumentException("need DataLine.Info for TargetDataLine"); } format = getSupportedTargetFormat(aFormats); line = getTargetDataLine(format, dataLineInfo.getMaxBufferSize()); } else if (lineClass == Port.class) { if (TDebug.TraceMixer) { TDebug.out("TMixer.getLine(): type: TargetDataLine"); } if (portInfo == null) { throw new IllegalArgumentException("need Port.Info for Port"); } line = getPort(portInfo); } else { if (TDebug.TraceMixer) { TDebug.out("TMixer.getLine(): unknown line type, will throw exception"); } throw new LineUnavailableException("unknown line class: " + lineClass); } if (TDebug.TraceMixer) { TDebug.out("TMixer.getLine(): end"); } return line; } protected SourceDataLine getSourceDataLine(AudioFormat format, int nBufferSize) throws LineUnavailableException { if (TDebug.TraceMixer) { TDebug.out("TMixer.getSourceDataLine(): begin"); } throw new IllegalArgumentException("this mixer does not support SourceDataLines"); } protected Clip getClip(AudioFormat format) throws LineUnavailableException { if (TDebug.TraceMixer) { TDebug.out("TMixer.getClip(): begin"); } throw new IllegalArgumentException("this mixer does not support Clips"); } protected TargetDataLine getTargetDataLine(AudioFormat format, int nBufferSize) throws LineUnavailableException { if (TDebug.TraceMixer) { TDebug.out("TMixer.getTargetDataLine(): begin"); } throw new IllegalArgumentException("this mixer does not support TargetDataLines"); } protected Port getPort(Port.Info info) throws LineUnavailableException { if (TDebug.TraceMixer) { TDebug.out("TMixer.getTargetDataLine(): begin"); } throw new IllegalArgumentException("this mixer does not support Ports"); } private AudioFormat getSupportedSourceFormat(AudioFormat[] aFormats) { if (TDebug.TraceMixer) { TDebug.out("TMixer.getSupportedSourceFormat(): begin"); } AudioFormat format = null; for (int i = 0; i < aFormats.length; i++) { if (TDebug.TraceMixer) { TDebug.out("TMixer.getSupportedSourceFormat(): checking " + aFormats[i] + "..."); } if (isSourceFormatSupported(aFormats[i])) { if (TDebug.TraceMixer) { TDebug.out("TMixer.getSupportedSourceFormat(): ...supported"); } format = aFormats[i]; break; } else { if (TDebug.TraceMixer) { TDebug.out("TMixer.getSupportedSourceFormat(): ...no luck"); } } } if (format == null) { throw new IllegalArgumentException("no line matchine one of the passed formats"); } if (TDebug.TraceMixer) { TDebug.out("TMixer.getSupportedSourceFormat(): end"); } return format; } private AudioFormat getSupportedTargetFormat(AudioFormat[] aFormats) { if (TDebug.TraceMixer) { TDebug.out("TMixer.getSupportedTargetFormat(): begin"); } AudioFormat format = null; for (int i = 0; i < aFormats.length; i++) { if (TDebug.TraceMixer) { TDebug.out("TMixer.getSupportedTargetFormat(): checking " + aFormats[i] + " ..."); } if (isTargetFormatSupported(aFormats[i])) { if (TDebug.TraceMixer) { TDebug.out("TMixer.getSupportedTargetFormat(): ...supported"); } format = aFormats[i]; break; } else { if (TDebug.TraceMixer) { TDebug.out("TMixer.getSupportedTargetFormat(): ...no luck"); } } } if (format == null) { throw new IllegalArgumentException("no line matchine one of the passed formats"); } if (TDebug.TraceMixer) { TDebug.out("TMixer.getSupportedTargetFormat(): end"); } return format; } /* not implemented here: getMaxLines(Line.Info) */ public Line[] getSourceLines() { if (TDebug.TraceMixer) { TDebug.out("TMixer.getSourceLines(): called"); } return (Line[]) m_openSourceDataLines.toArray(EMPTY_LINE_ARRAY); } public Line[] getTargetLines() { if (TDebug.TraceMixer) { TDebug.out("TMixer.getTargetLines(): called"); } return (Line[]) m_openTargetDataLines.toArray(EMPTY_LINE_ARRAY); } public void synchronize(Line[] aLines, boolean bMaintainSync) { throw new IllegalArgumentException("synchronization not supported"); } public void unsynchronize(Line[] aLines) { throw new IllegalArgumentException("synchronization not supported"); } public boolean isSynchronizationSupported(Line[] aLines, boolean bMaintainSync) { return false; } protected boolean isSourceFormatSupported(AudioFormat format) { if (TDebug.TraceMixer) { TDebug.out("TMixer.isSourceFormatSupported(): format to test: " + format); } Iterator iterator = m_supportedSourceFormats.iterator(); while (iterator.hasNext()) { AudioFormat supportedFormat = iterator.next(); if (AudioFormats.matches(supportedFormat, format)) { return true; } } return false; } protected boolean isTargetFormatSupported(AudioFormat format) { if (TDebug.TraceMixer) { TDebug.out("TMixer.isTargetFormatSupported(): format to test: " + format); } Iterator iterator = m_supportedTargetFormats.iterator(); while (iterator.hasNext()) { AudioFormat supportedFormat = iterator.next(); if (AudioFormats.matches(supportedFormat, format)) { return true; } } return false; } /*package*/ void registerOpenLine(Line line) { if (TDebug.TraceMixer) { TDebug.out("TMixer.registerOpenLine(): line to register: " + line); } if (line instanceof SourceDataLine) { synchronized (m_openSourceDataLines) { m_openSourceDataLines.add((SourceDataLine) line); } } else if (line instanceof TargetDataLine) { synchronized (m_openSourceDataLines) { m_openTargetDataLines.add((TargetDataLine) line); } } } /*package*/ void unregisterOpenLine(Line line) { if (TDebug.TraceMixer) { TDebug.out("TMixer.unregisterOpenLine(): line to unregister: " + line); } if (line instanceof SourceDataLine) { synchronized (m_openSourceDataLines) { m_openSourceDataLines.remove((SourceDataLine) line); } } else if (line instanceof TargetDataLine) { synchronized (m_openTargetDataLines) { m_openTargetDataLines.remove((TargetDataLine) line); } } } } /*** TMixer.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/share/sampled/mixer/TMixerInfo.java0000644000175000017500000000246410374074736030702 0ustar twernertwerner/* * TMixerInfo.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999, 2000 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.share.sampled.mixer; import javax.sound.sampled.Mixer; /* * This is needed only because Mixer.Info's constructor * is protected (in the Sun jdk1.3). */ public class TMixerInfo extends Mixer.Info { public TMixerInfo(String a, String b, String c, String d) { super(a, b, c, d); } } /*** TMixerInfo.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/share/sampled/mixer/TMixerProvider.java0000644000175000017500000001377310173661005031572 0ustar twernertwerner/* * TMixerProvider.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999 - 2004 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.share.sampled.mixer; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; import javax.sound.sampled.Mixer; import javax.sound.sampled.spi.MixerProvider; import org.tritonus.share.TDebug; public abstract class TMixerProvider extends MixerProvider { private static final Mixer.Info[] EMPTY_MIXER_INFO_ARRAY = new Mixer.Info[0]; private static Map sm_mixerProviderStructs = new HashMap(); private boolean m_bDisabled = false; public TMixerProvider() { if (TDebug.TraceMixerProvider) { TDebug.out("TMixerProvider.(): begin"); } // currently does nothing if (TDebug.TraceMixerProvider) { TDebug.out("TMixerProvider.(): end"); } } /* Override this method if you want a thread-safe static initializaiton. */ protected void staticInit() { } private MixerProviderStruct getMixerProviderStruct() { if (TDebug.TraceMixerProvider) { TDebug.out("TMixerProvider.getMixerProviderStruct(): begin"); } Class cls = this.getClass(); if (TDebug.TraceMixerProvider) { TDebug.out("TMixerProvider.getMixerProviderStruct(): called from " + cls); } // Thread.dumpStack(); synchronized (TMixerProvider.class) { MixerProviderStruct struct = sm_mixerProviderStructs.get(cls); if (struct == null) { if (TDebug.TraceMixerProvider) { TDebug.out("TMixerProvider.getMixerProviderStruct(): creating new MixerProviderStruct for " + cls); } struct = new MixerProviderStruct(); sm_mixerProviderStructs.put(cls, struct); } if (TDebug.TraceMixerProvider) { TDebug.out("TMixerProvider.getMixerProviderStruct(): end"); } return struct; } } protected void disable() { if (TDebug.TraceMixerProvider) { TDebug.out("disabling " + getClass().getName()); } m_bDisabled = true; } protected boolean isDisabled() { return m_bDisabled; } protected void addMixer(Mixer mixer) { if (TDebug.TraceMixerProvider) { TDebug.out("TMixerProvider.addMixer(): begin"); } MixerProviderStruct struct = getMixerProviderStruct(); synchronized (struct) { struct.m_mixers.add(mixer); if (struct.m_defaultMixer == null) { struct.m_defaultMixer = mixer; } } if (TDebug.TraceMixerProvider) { TDebug.out("TMixerProvider.addMixer(): end"); } } protected void removeMixer(Mixer mixer) { if (TDebug.TraceMixerProvider) { TDebug.out("TMixerProvider.removeMixer(): begin"); } MixerProviderStruct struct = getMixerProviderStruct(); synchronized (struct) { struct.m_mixers.remove(mixer); // TODO: should search for another mixer if (struct.m_defaultMixer == mixer) { struct.m_defaultMixer = null; } } if (TDebug.TraceMixerProvider) { TDebug.out("TMixerProvider.removeMixer(): end"); } } // $$mp 2003/01/11: TODO: this implementation may become obsolete once the overridden method in spi.MixerProvider is implemented in a way documented officially. public boolean isMixerSupported(Mixer.Info info) { if (TDebug.TraceMixerProvider) { TDebug.out("TMixerProvider.isMixerSupported(): begin"); } boolean bIsSupported = false; Mixer.Info[] infos = getMixerInfo(); for (int i = 0; i < infos.length; i++) { if (infos[i].equals(info)) { bIsSupported = true; break; } } if (TDebug.TraceMixerProvider) { TDebug.out("TMixerProvider.isMixerSupported(): end"); } return bIsSupported; } /** */ public Mixer getMixer(Mixer.Info info) { if (TDebug.TraceMixerProvider) { TDebug.out("TMixerProvider.getMixer(): begin"); } MixerProviderStruct struct = getMixerProviderStruct(); Mixer mixerResult = null; synchronized (struct) { if (info == null) { mixerResult = struct.m_defaultMixer; } else { Iterator mixers = struct.m_mixers.iterator(); while (mixers.hasNext()) { Mixer mixer = (Mixer) mixers.next(); if (mixer.getMixerInfo().equals(info)) { mixerResult = mixer; break; } } } } if (mixerResult == null) { throw new IllegalArgumentException("no mixer available for " + info); } if (TDebug.TraceMixerProvider) { TDebug.out("TMixerProvider.getMixer(): end"); } return mixerResult; } public Mixer.Info[] getMixerInfo() { if (TDebug.TraceMixerProvider) { TDebug.out("TMixerProvider.getMixerInfo(): begin"); } Set mixerInfos = new HashSet(); MixerProviderStruct struct = getMixerProviderStruct(); synchronized (struct) { Iterator mixers = struct.m_mixers.iterator(); while (mixers.hasNext()) { Mixer mixer = mixers.next(); mixerInfos.add(mixer.getMixerInfo()); } } if (TDebug.TraceMixerProvider) { TDebug.out("TMixerProvider.getMixerInfo(): end"); } return mixerInfos.toArray(EMPTY_MIXER_INFO_ARRAY); } private class MixerProviderStruct { public List m_mixers; public Mixer m_defaultMixer; public MixerProviderStruct() { m_mixers = new ArrayList(); m_defaultMixer = null; } } } /*** TMixerProvider.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/share/sampled/mixer/TPort.java0000644000175000017500000000270010374074736027717 0ustar twernertwerner/* * TPort.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999 - 2004 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.share.sampled.mixer; import java.util.Collection; import javax.sound.sampled.Control; import javax.sound.sampled.Line; import javax.sound.sampled.Port; /** Base class for Ports. */ public class TPort extends TLine implements Port { public TPort(TMixer mixer, Line.Info info) { super(mixer, info); } public TPort(TMixer mixer, Line.Info info, Collection controls) { super(mixer, info, controls); } } /*** TPort.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/share/sampled/mixer/TSoftClip.java0000644000175000017500000001313610540343256030512 0ustar twernertwerner/* * TSoftClip.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.share.sampled.mixer; import java.io.IOException; import java.io.ByteArrayOutputStream; import javax.sound.sampled.AudioFormat; import javax.sound.sampled.AudioSystem; import javax.sound.sampled.DataLine; import javax.sound.sampled.SourceDataLine; import javax.sound.sampled.AudioInputStream; import javax.sound.sampled.LineUnavailableException; import javax.sound.sampled.Mixer; import org.tritonus.share.TDebug; public class TSoftClip extends TClip implements Runnable { //$$fb the following field is never used //private static final Class[] CONTROL_CLASSES = {/*GainControl.class*/}; private static final int BUFFER_SIZE = 16384; //$$fb the following field is never used //private Mixer m_mixer; private SourceDataLine m_line; private byte[] m_abClip; private int m_nRepeatCount; private Thread m_thread; public TSoftClip(Mixer mixer, AudioFormat format) throws LineUnavailableException { // TODO: info object /* DataLine.Info info = new DataLine.Info(Clip.class, audioFormat, -1); */ super(null); //m_mixer = mixer; DataLine.Info info = new DataLine.Info( SourceDataLine.class, // TODO: should pass a real AudioFormat object that isn't too restrictive format); m_line = (SourceDataLine) AudioSystem.getLine(info); } public void open(AudioInputStream audioInputStream) throws LineUnavailableException, IOException { AudioFormat audioFormat = audioInputStream.getFormat(); setFormat(audioFormat); int nFrameSize = audioFormat.getFrameSize(); if (nFrameSize < 1) { throw new IllegalArgumentException("frame size must be positive"); } if (TDebug.TraceClip) { TDebug.out("TSoftClip.open(): format: " + audioFormat); // TDebug.out("sample rate: " + audioFormat.getSampleRate()); } byte[] abData = new byte[BUFFER_SIZE]; ByteArrayOutputStream baos = new ByteArrayOutputStream(); int nBytesRead = 0; while (nBytesRead != -1) { try { nBytesRead = audioInputStream.read(abData, 0, abData.length); } catch (IOException e) { if (TDebug.TraceClip || TDebug.TraceAllExceptions) { TDebug.out(e); } } if (nBytesRead >= 0) { if (TDebug.TraceClip) { TDebug.out("TSoftClip.open(): Trying to write: " + nBytesRead); } baos.write(abData, 0, nBytesRead); if (TDebug.TraceClip) { TDebug.out("TSoftClip.open(): Written: " + nBytesRead); } } } m_abClip = baos.toByteArray(); setBufferSize(m_abClip.length); // open the line m_line.open(getFormat()); // to trigger the events // open(); } public int getFrameLength() { if (isOpen()) { return getBufferSize() / getFormat().getFrameSize(); } else { return AudioSystem.NOT_SPECIFIED; } } public long getMicrosecondLength() { if (isOpen()) { return (long) (getFrameLength() * getFormat().getFrameRate() * 1000000); } else { return AudioSystem.NOT_SPECIFIED; } } public void setFramePosition(int nPosition) { // TOOD: } public void setMicrosecondPosition(long lPosition) { // TOOD: } public int getFramePosition() { // TOOD: return -1; } public long getMicrosecondPosition() { // TOOD: return -1; } public void setLoopPoints(int nStart, int nEnd) { // TOOD: } public void loop(int nCount) { if (TDebug.TraceClip) { TDebug.out("TSoftClip.loop(int): called; count = " + nCount); } if (false/*isStarted()*/) { /* * only allow zero count to stop the looping * at the end of an iteration. */ if (nCount == 0) { if (TDebug.TraceClip) { TDebug.out("TSoftClip.loop(int): stopping sample"); } // m_esdSample.stop(); } } else { m_nRepeatCount = nCount; m_thread = new Thread(this); m_thread.start(); } // TOOD: } public void flush() { // TOOD: } public void drain() { // TOOD: } public void close() { // m_esdSample.free(); // m_esdSample.close(); // TOOD: } public void open() { // TODO: } public void start() { if (TDebug.TraceClip) { TDebug.out("TSoftClip.start(): called"); } /* * This is a hack. What start() really should do is * start playing at the position playback was stopped. */ if (TDebug.TraceClip) { TDebug.out("TSoftClip.start(): calling 'loop(0)' [hack]"); } loop(0); } public void stop() { // TODO: // m_esdSample.kill(); } /* * This method is enforced by DataLine, but doesn't make any * sense for Clips. */ public int available() { return -1; } public void run() { while (m_nRepeatCount >= 0) { m_line.write(m_abClip, 0, m_abClip.length); m_nRepeatCount--; } } } /*** TSoftClip.java ***/ libtritonus-java-20070428/src/classes/org/tritonus/share/sampled/mixer/package.html0000644000175000017500000000053210173661006030253 0ustar twernertwerner

Base classes for the implementation of MixerProviders. The classes provided here .

@see javax.sound.sampled.spi.MixerProvider @see org.tritonus.sampled.mixer.alsa @see org.tritonus.sampled.mixer.esd libtritonus-java-20070428/src/lib/0000755000175000017500000000000010621572601016552 5ustar twernertwernerlibtritonus-java-20070428/src/lib/alsa/0000755000175000017500000000000010621572551017476 5ustar twernertwernerlibtritonus-java-20070428/src/lib/alsa/.cvsignore0000644000175000017500000000004507241540164021474 0ustar twernertwernerMakefile org_tritonus_*.h *.o *.so* libtritonus-java-20070428/src/lib/alsa/Makefile.in0000644000175000017500000001200707753244416021553 0ustar twernertwerner# compilation and packing of the native library for alsa # SHELL = /bin/sh prefix=@prefix@ JAVADIR=$(prefix) REL_JAVAEXTLIBPATH=@REL_JAVAEXTLIBPATH@ JAVAEXTLIBPATH=$(JAVADIR)/$(REL_JAVAEXTLIBPATH) OSNAME=@OSNAME@ ARCHNAME=@ARCHNAME@ CC=@CC@ CPPFLAGS=-g -Wall -Werror -I$(JAVADIR)/include -I$(JAVADIR)/include/$(OSNAME) -fPIC -D_REENTRANT #-pedantic INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ LN_S=@LN_S@ RM_F=@RM_F@ MKDIR_P=@MKDIR_P@ OBJDIR=../../../@BUILD_DIR@ vpath %.class $(OBJDIR)/org/tritonus/lowlevel/alsa LIBBASENAME=libtritonusalsa LIBDEST=$(LIBBASENAME).so.1.0 LIBDEST_ABSOLUTE=@SRC_ABSOLUTE_PATH@/src/lib/alsa/$(LIBDEST) #or LIBDEST_ABSOLUTE=$(CURDIR)/$(LIBDEST) # This is intended to be overridden. For instance: # export EXTRALIBS=-lefence; make -e EXTRALIBS= LIBS=-lasound $(EXTRALIBS) JAVAH = @JAVAH@ JNIOBJ=\ org_tritonus_lowlevel_alsa_Alsa.o \ org_tritonus_lowlevel_alsa_AlsaCtl.o \ org_tritonus_lowlevel_alsa_AlsaCtlCardInfo.o \ org_tritonus_lowlevel_alsa_AlsaMixer.o \ org_tritonus_lowlevel_alsa_AlsaMixerElement.o \ org_tritonus_lowlevel_alsa_AlsaPcm.o \ org_tritonus_lowlevel_alsa_AlsaPcmHWParams.o \ org_tritonus_lowlevel_alsa_AlsaPcmHWParamsFormatMask.o \ org_tritonus_lowlevel_alsa_AlsaPcmSWParams.o \ org_tritonus_lowlevel_alsa_AlsaSeq.o \ org_tritonus_lowlevel_alsa_AlsaSeqClientInfo.o \ org_tritonus_lowlevel_alsa_AlsaSeqEvent.o \ org_tritonus_lowlevel_alsa_AlsaSeqPortInfo.o \ org_tritonus_lowlevel_alsa_AlsaSeqPortSubscribe.o \ org_tritonus_lowlevel_alsa_AlsaSeqQueueInfo.o \ org_tritonus_lowlevel_alsa_AlsaSeqQueueStatus.o \ org_tritonus_lowlevel_alsa_AlsaSeqQueueTempo.o \ org_tritonus_lowlevel_alsa_AlsaSeqRemoveEvents.o \ org_tritonus_lowlevel_alsa_AlsaSeqSystemInfo.o #org_tritonus_lowlevel_alsa_AlsaSeqQueueTimer.o \ OBJ=\ $(JNIOBJ) \ init.o \ ../common/common.o JNIHEADERS:=$(JNIOBJ:.o=.h) JNICLASSFILES=\ Alsa.class \ AlsaCtl.class \ AlsaCtlCardInfo.class \ AlsaMixer.class \ AlsaMixerElement.class \ AlsaPcm.class \ AlsaPcmHWParams.class \ AlsaPcmHWParamsFormatMask.class \ AlsaPcmSWParams.class \ AlsaSeq.class \ AlsaSeqClientInfo.class \ AlsaSeqEvent.class \ AlsaSeqPortInfo.class \ AlsaSeqPortInfo.class \ AlsaSeqQueueInfo.class \ AlsaSeqQueueStatus.class \ AlsaSeqQueueTempo.class \ AlsaSeqRemoveEvents.class \ AlsaSeqSystemInfo.class #AlsaSeqQueueTimer.class \ JNICLASSES=\ org.tritonus.lowlevel.alsa.Alsa \ org.tritonus.lowlevel.alsa.AlsaCtl \ org.tritonus.lowlevel.alsa.AlsaCtlCardInfo \ org.tritonus.lowlevel.alsa.AlsaMixer \ org.tritonus.lowlevel.alsa.AlsaMixerElement \ org.tritonus.lowlevel.alsa.AlsaPcm \ org.tritonus.lowlevel.alsa.AlsaPcmHWParams \ org.tritonus.lowlevel.alsa.AlsaPcmHWParamsFormatMask \ org.tritonus.lowlevel.alsa.AlsaPcmSWParams \ org.tritonus.lowlevel.alsa.AlsaSeq \ org.tritonus.lowlevel.alsa.AlsaSeqClientInfo \ org.tritonus.lowlevel.alsa.AlsaSeqEvent \ org.tritonus.lowlevel.alsa.AlsaSeqPortInfo \ org.tritonus.lowlevel.alsa.AlsaSeqPortSubscribe \ org.tritonus.lowlevel.alsa.AlsaSeqQueueInfo \ org.tritonus.lowlevel.alsa.AlsaSeqQueueStatus \ org.tritonus.lowlevel.alsa.AlsaSeqQueueTempo \ org.tritonus.lowlevel.alsa.AlsaSeqRemoveEvents \ org.tritonus.lowlevel.alsa.AlsaSeqSystemInfo #org.tritonus.lowlevel.alsa.AlsaSeqQueueTimer \ #----------------- rules ------------------- .PHONY: all all: $(LIBDEST) $(LIBDEST): $(OBJ) $(CC) -nostartfiles -shared -Wl,-soname,$(LIBBASENAME).so.1 -o $(LIBDEST) $(OBJ) -L/usr/lib $(LIBS) $(RM_F) $(LIBBASENAME).so.1 $(LN_S) $(LIBBASENAME).so.1.0 $(LIBBASENAME).so.1 $(RM_F) $(LIBBASENAME).so $(LN_S) $(LIBBASENAME).so.1 $(LIBBASENAME).so $(OBJ): $(JNIHEADERS) $(JNIHEADERS): $(JNICLASSFILES) $(RM_F) $(JNIHEADERS) $(JAVAH) -d . $(JNICLASSES) .PHONY: install install: @echo "Installing $(LIBBASENAME) in $(JAVAEXTLIBPATH)" @$(MKDIR_P) $(JAVAEXTLIBPATH) @$(RM_F) $(JAVAEXTLIBPATH)/$(LIBBASENAME).so.1.0 @$(RM_F) $(JAVAEXTLIBPATH)/$(LIBBASENAME).so.1 @$(RM_F) $(JAVAEXTLIBPATH)/$(LIBBASENAME).so $(INSTALL_PROGRAM) $(LIBDEST) $(JAVAEXTLIBPATH) @(cd $(JAVAEXTLIBPATH) && $(LN_S) $(LIBBASENAME).so.1.0 $(LIBBASENAME).so.1) @(cd $(JAVAEXTLIBPATH) && $(LN_S) $(LIBBASENAME).so.1 $(LIBBASENAME).so) .PHONY: install-link install-link: @echo "Creating links for $(LIBBASENAME) in $(JAVAEXTLIBPATH)" @$(MKDIR_P) $(JAVAEXTLIBPATH) @$(RM_F) $(JAVAEXTLIBPATH)/$(LIBBASENAME).so.1.0 @$(RM_F) $(JAVAEXTLIBPATH)/$(LIBBASENAME).so.1 @$(RM_F) $(JAVAEXTLIBPATH)/$(LIBBASENAME).so @(cd $(JAVAEXTLIBPATH) && $(LN_S) $(LIBDEST_ABSOLUTE) $(LIBBASENAME).so.1.0) @(cd $(JAVAEXTLIBPATH) && $(LN_S) $(LIBBASENAME).so.1.0 $(LIBBASENAME).so.1) @(cd $(JAVAEXTLIBPATH) && $(LN_S) $(LIBBASENAME).so.1 $(LIBBASENAME).so) .PHONY: uninstall uninstall: @echo "Removing $(LIBBASENAME) from $(JAVAEXTLIBPATH)" @$(RM_F) $(JAVAEXTLIBPATH)/$(LIBBASENAME).so.1.0 @$(RM_F) $(JAVAEXTLIBPATH)/$(LIBBASENAME).so.1 @$(RM_F) $(JAVAEXTLIBPATH)/$(LIBBASENAME).so .PHONY: uninstall-link uninstall-link: uninstall .PHONY: clean clean: rm -rf $(LIBDEST) $(JNIHEADERS) *.o *~ libtritonus-java-20070428/src/lib/alsa/common.h0000644000175000017500000000206707576434265021162 0ustar twernertwerner/* * common.h */ /* * Copyright (c) 1999 - 2001 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef _ALSA_COMMON_H #define _ALSA_COMMON_H #include #include "../common/HandleFieldHandler.h" #include "../common/common.h" #include "../common/debug.h" #endif /* _ALSA_COMMON_H */ /*** common.h ***/ libtritonus-java-20070428/src/lib/alsa/constants_check.h0000644000175000017500000004536107522670223023032 0ustar twernertwerner/* * constants_check.h */ /* * Copyright (c) 1999 - 2001 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #undef NDEBUG #include void check_constants() { assert(SND_SEQ_EVENT_SYSTEM == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_EVENT_SYSTEM); assert(SND_SEQ_EVENT_RESULT == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_EVENT_RESULT); assert(SND_SEQ_EVENT_NOTE == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_EVENT_NOTE); assert(SND_SEQ_EVENT_NOTEON == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_EVENT_NOTEON); assert(SND_SEQ_EVENT_NOTEOFF == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_EVENT_NOTEOFF); assert(SND_SEQ_EVENT_KEYPRESS == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_EVENT_KEYPRESS); assert(SND_SEQ_EVENT_CONTROLLER == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_EVENT_CONTROLLER); assert(SND_SEQ_EVENT_PGMCHANGE == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_EVENT_PGMCHANGE); assert(SND_SEQ_EVENT_CHANPRESS == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_EVENT_CHANPRESS); assert(SND_SEQ_EVENT_PITCHBEND == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_EVENT_PITCHBEND); assert(SND_SEQ_EVENT_CONTROL14 ==org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_EVENT_CONTROL14); assert(SND_SEQ_EVENT_NONREGPARAM == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_EVENT_NONREGPARAM); assert(SND_SEQ_EVENT_REGPARAM == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_EVENT_REGPARAM); assert(SND_SEQ_EVENT_SONGPOS == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_EVENT_SONGPOS); assert(SND_SEQ_EVENT_SONGSEL == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_EVENT_SONGSEL); assert(SND_SEQ_EVENT_QFRAME == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_EVENT_QFRAME); assert(SND_SEQ_EVENT_TIMESIGN == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_EVENT_TIMESIGN); assert(SND_SEQ_EVENT_KEYSIGN == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_EVENT_KEYSIGN); assert(SND_SEQ_EVENT_START == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_EVENT_START); assert(SND_SEQ_EVENT_CONTINUE == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_EVENT_CONTINUE); assert(SND_SEQ_EVENT_STOP == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_EVENT_STOP); assert(SND_SEQ_EVENT_SETPOS_TICK == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_EVENT_SETPOS_TICK); assert(SND_SEQ_EVENT_SETPOS_TIME == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_EVENT_SETPOS_TIME); assert(SND_SEQ_EVENT_TEMPO == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_EVENT_TEMPO); assert(SND_SEQ_EVENT_CLOCK == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_EVENT_CLOCK); assert(SND_SEQ_EVENT_TICK == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_EVENT_TICK); // gives an error with ALSA 0.9.0rc2 // assert(SND_SEQ_EVENT_SYNC == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_EVENT_SYNC); assert(SND_SEQ_EVENT_SYNC_POS == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_EVENT_SYNC_POS); assert(SND_SEQ_EVENT_TUNE_REQUEST == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_EVENT_TUNE_REQUEST); assert(SND_SEQ_EVENT_RESET == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_EVENT_RESET); assert(SND_SEQ_EVENT_SENSING == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_EVENT_SENSING); assert(SND_SEQ_EVENT_ECHO == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_EVENT_ECHO); assert(SND_SEQ_EVENT_OSS == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_EVENT_OSS); assert(SND_SEQ_EVENT_CLIENT_START == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_EVENT_CLIENT_START); assert(SND_SEQ_EVENT_CLIENT_EXIT == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_EVENT_CLIENT_EXIT); assert(SND_SEQ_EVENT_CLIENT_CHANGE == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_EVENT_CLIENT_CHANGE); assert(SND_SEQ_EVENT_PORT_START == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_EVENT_PORT_START); assert(SND_SEQ_EVENT_PORT_EXIT == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_EVENT_PORT_EXIT); assert(SND_SEQ_EVENT_PORT_CHANGE == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_EVENT_PORT_CHANGE); assert(SND_SEQ_EVENT_PORT_SUBSCRIBED == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_EVENT_PORT_SUBSCRIBED); assert(SND_SEQ_EVENT_PORT_UNSUBSCRIBED == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_EVENT_PORT_UNSUBSCRIBED); assert(SND_SEQ_EVENT_SAMPLE == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_EVENT_SAMPLE); assert(SND_SEQ_EVENT_SAMPLE_CLUSTER == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_EVENT_SAMPLE_CLUSTER); assert(SND_SEQ_EVENT_SAMPLE_START == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_EVENT_SAMPLE_START); assert(SND_SEQ_EVENT_SAMPLE_STOP == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_EVENT_SAMPLE_STOP); assert(SND_SEQ_EVENT_SAMPLE_FREQ == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_EVENT_SAMPLE_FREQ); assert(SND_SEQ_EVENT_SAMPLE_VOLUME == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_EVENT_SAMPLE_VOLUME); assert(SND_SEQ_EVENT_SAMPLE_LOOP == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_EVENT_SAMPLE_LOOP); assert(SND_SEQ_EVENT_SAMPLE_POSITION == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_EVENT_SAMPLE_POSITION); assert(SND_SEQ_EVENT_SAMPLE_PRIVATE1 == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_EVENT_SAMPLE_PRIVATE1); assert(SND_SEQ_EVENT_USR0 == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_EVENT_USR0); assert(SND_SEQ_EVENT_USR1 == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_EVENT_USR1); assert(SND_SEQ_EVENT_USR2 == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_EVENT_USR2); assert(SND_SEQ_EVENT_USR3 == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_EVENT_USR3); assert(SND_SEQ_EVENT_USR4 == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_EVENT_USR4); assert(SND_SEQ_EVENT_USR5 == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_EVENT_USR5); assert(SND_SEQ_EVENT_USR6 == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_EVENT_USR6); assert(SND_SEQ_EVENT_USR7 == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_EVENT_USR7); assert(SND_SEQ_EVENT_USR8 == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_EVENT_USR8); assert(SND_SEQ_EVENT_USR9 == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_EVENT_USR9); assert(SND_SEQ_EVENT_INSTR_BEGIN == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_EVENT_INSTR_BEGIN); assert(SND_SEQ_EVENT_INSTR_END == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_EVENT_INSTR_END); assert(SND_SEQ_EVENT_INSTR_INFO == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_EVENT_INSTR_INFO); assert(SND_SEQ_EVENT_INSTR_INFO_RESULT == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_EVENT_INSTR_INFO_RESULT); assert(SND_SEQ_EVENT_INSTR_FINFO == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_EVENT_INSTR_FINFO); assert(SND_SEQ_EVENT_INSTR_FINFO_RESULT == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_EVENT_INSTR_FINFO_RESULT); assert(SND_SEQ_EVENT_INSTR_RESET == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_EVENT_INSTR_RESET); assert(SND_SEQ_EVENT_INSTR_STATUS == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_EVENT_INSTR_STATUS); assert(SND_SEQ_EVENT_INSTR_STATUS_RESULT == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_EVENT_INSTR_STATUS_RESULT); assert(SND_SEQ_EVENT_INSTR_PUT == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_EVENT_INSTR_PUT); assert(SND_SEQ_EVENT_INSTR_GET == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_EVENT_INSTR_GET); assert(SND_SEQ_EVENT_INSTR_GET_RESULT == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_EVENT_INSTR_GET_RESULT); assert(SND_SEQ_EVENT_INSTR_FREE == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_EVENT_INSTR_FREE); assert(SND_SEQ_EVENT_INSTR_LIST == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_EVENT_INSTR_LIST); assert(SND_SEQ_EVENT_INSTR_LIST_RESULT == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_EVENT_INSTR_LIST_RESULT); assert(SND_SEQ_EVENT_INSTR_CLUSTER == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_EVENT_INSTR_CLUSTER); assert(SND_SEQ_EVENT_INSTR_CLUSTER_GET == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_EVENT_INSTR_CLUSTER_GET); assert(SND_SEQ_EVENT_INSTR_CLUSTER_RESULT == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_EVENT_INSTR_CLUSTER_RESULT); assert(SND_SEQ_EVENT_INSTR_CHANGE == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_EVENT_INSTR_CHANGE); assert(SND_SEQ_EVENT_SYSEX == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_EVENT_SYSEX); assert(SND_SEQ_EVENT_BOUNCE == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_EVENT_BOUNCE); assert(SND_SEQ_EVENT_USR_VAR0 == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_EVENT_USR_VAR0); assert(SND_SEQ_EVENT_USR_VAR1 == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_EVENT_USR_VAR1); assert(SND_SEQ_EVENT_USR_VAR2 == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_EVENT_USR_VAR2); assert(SND_SEQ_EVENT_USR_VAR3 == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_EVENT_USR_VAR3); assert(SND_SEQ_EVENT_USR_VAR4 == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_EVENT_USR_VAR4); assert(SND_SEQ_EVENT_NONE == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_EVENT_NONE); assert(SND_SEQ_ADDRESS_UNKNOWN == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_ADDRESS_UNKNOWN); assert(SND_SEQ_ADDRESS_SUBSCRIBERS == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_ADDRESS_SUBSCRIBERS); assert(SND_SEQ_ADDRESS_BROADCAST == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_ADDRESS_BROADCAST); assert(SND_SEQ_QUEUE_DIRECT == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_QUEUE_DIRECT); assert(SND_SEQ_TIME_STAMP_TICK == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_TIME_STAMP_TICK); assert(SND_SEQ_TIME_STAMP_REAL == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_TIME_STAMP_REAL); assert(SND_SEQ_TIME_STAMP_MASK == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_TIME_STAMP_MASK); assert(SND_SEQ_TIME_MODE_ABS == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_TIME_MODE_ABS); assert(SND_SEQ_TIME_MODE_REL == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_TIME_MODE_REL); assert(SND_SEQ_TIME_MODE_MASK == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_TIME_MODE_MASK); assert(SND_SEQ_EVENT_LENGTH_FIXED == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_EVENT_LENGTH_FIXED); assert(SND_SEQ_EVENT_LENGTH_VARIABLE == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_EVENT_LENGTH_VARIABLE); assert(SND_SEQ_EVENT_LENGTH_VARUSR == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_EVENT_LENGTH_VARUSR); // gives an error with ALSA 0.9.0rc2 // assert(SND_SEQ_EVENT_LENGTH_VARIPC == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_EVENT_LENGTH_VARIPC); assert(SND_SEQ_EVENT_LENGTH_MASK == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_EVENT_LENGTH_MASK); assert(SND_SEQ_PRIORITY_NORMAL == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_PRIORITY_NORMAL); assert(SND_SEQ_PRIORITY_HIGH == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_PRIORITY_HIGH); assert(SND_SEQ_PRIORITY_MASK == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_PRIORITY_MASK); assert(SND_SEQ_CLIENT_SYSTEM == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_CLIENT_SYSTEM); assert(SND_SEQ_CLIENT_DUMMY == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_CLIENT_DUMMY); assert(SND_SEQ_CLIENT_OSS == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_CLIENT_OSS); /* assert(SND_SEQ_FILTER_BROADCAST == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_FILTER_BROADCAST); */ /* assert(SND_SEQ_FILTER_MULTICAST == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_FILTER_MULTICAST); */ /* assert(SND_SEQ_FILTER_BOUNCE == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_FILTER_BOUNCE); */ /* assert(SND_SEQ_FILTER_USE_EVENT == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_FILTER_USE_EVENT); */ assert(SND_SEQ_REMOVE_DEST== org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_REMOVE_DEST); assert(SND_SEQ_REMOVE_DEST_CHANNEL== org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_REMOVE_DEST_CHANNEL); assert(SND_SEQ_REMOVE_TIME_BEFORE== org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_REMOVE_TIME_BEFORE); assert(SND_SEQ_REMOVE_TIME_AFTER== org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_REMOVE_TIME_AFTER); assert(SND_SEQ_REMOVE_EVENT_TYPE== org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_REMOVE_EVENT_TYPE); assert(SND_SEQ_REMOVE_IGNORE_OFF== org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_REMOVE_IGNORE_OFF); assert(SND_SEQ_REMOVE_TAG_MATCH== org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_REMOVE_TAG_MATCH); assert(SND_SEQ_PORT_SYSTEM_TIMER == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_PORT_SYSTEM_TIMER); assert(SND_SEQ_PORT_SYSTEM_ANNOUNCE == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_PORT_SYSTEM_ANNOUNCE); assert(SND_SEQ_PORT_CAP_READ == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_PORT_CAP_READ); assert(SND_SEQ_PORT_CAP_WRITE == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_PORT_CAP_WRITE); assert(SND_SEQ_PORT_CAP_SYNC_READ == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_PORT_CAP_SYNC_READ); assert(SND_SEQ_PORT_CAP_SYNC_WRITE == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_PORT_CAP_SYNC_WRITE); assert(SND_SEQ_PORT_CAP_DUPLEX == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_PORT_CAP_DUPLEX); assert(SND_SEQ_PORT_CAP_SUBS_READ == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_PORT_CAP_SUBS_READ); assert(SND_SEQ_PORT_CAP_SUBS_WRITE == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_PORT_CAP_SUBS_WRITE); assert(SND_SEQ_PORT_CAP_NO_EXPORT == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_PORT_CAP_NO_EXPORT); assert(SND_SEQ_PORT_TYPE_SPECIFIC == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_PORT_TYPE_SPECIFIC); assert(SND_SEQ_PORT_TYPE_MIDI_GENERIC == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_PORT_TYPE_MIDI_GENERIC); assert(SND_SEQ_PORT_TYPE_MIDI_GM == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_PORT_TYPE_MIDI_GM); assert(SND_SEQ_PORT_TYPE_MIDI_GS == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_PORT_TYPE_MIDI_GS); assert(SND_SEQ_PORT_TYPE_MIDI_XG == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_PORT_TYPE_MIDI_XG); assert(SND_SEQ_PORT_TYPE_MIDI_MT32 == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_PORT_TYPE_MIDI_MT32); assert(SND_SEQ_PORT_TYPE_SYNTH == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_PORT_TYPE_SYNTH); assert(SND_SEQ_PORT_TYPE_DIRECT_SAMPLE == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_PORT_TYPE_DIRECT_SAMPLE); assert(SND_SEQ_PORT_TYPE_SAMPLE == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_PORT_TYPE_SAMPLE); assert(SND_SEQ_PORT_TYPE_APPLICATION == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_PORT_TYPE_APPLICATION); /* assert(SND_SEQ_PORT_FLG_GIVEN_PORT == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_PORT_FLG_GIVEN_PORT); */ /* assert(SND_SEQ_QUEUE_FLG_SYNC == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_QUEUE_FLG_SYNC); */ /* assert(SND_SEQ_QUEUE_FLG_SYNC_LOST == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_QUEUE_FLG_SYNC_LOST); */ /* assert(SND_SEQ_SYNC_TICK == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_SYNC_TICK); */ /* assert(SND_SEQ_SYNC_TIME == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_SYNC_TIME); */ /* assert(SND_SEQ_SYNC_MODE == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_SYNC_MODE); */ /* assert(SND_SEQ_SYNC_FMT_PRIVATE_CLOCK == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_SYNC_FMT_PRIVATE_CLOCK); */ /* assert(SND_SEQ_SYNC_FMT_PRIVATE_TIME == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_SYNC_FMT_PRIVATE_TIME); */ /* assert(SND_SEQ_SYNC_FMT_MIDI_CLOCK == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_SYNC_FMT_MIDI_CLOCK); */ /* assert(SND_SEQ_SYNC_FMT_MTC == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_SYNC_FMT_MTC); */ /* assert(SND_SEQ_SYNC_FMT_DTL == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_SYNC_FMT_DTL); */ /* assert(SND_SEQ_SYNC_FMT_SMPTE == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_SYNC_FMT_SMPTE); */ /* assert(SND_SEQ_SYNC_FMT_MIDI_TICK == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_SYNC_FMT_MIDI_TICK); */ /* assert(SND_SEQ_SYNC_FPS_24 == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_SYNC_FPS_24); */ /* assert(SND_SEQ_SYNC_FPS_25 == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_SYNC_FPS_25); */ /* assert(SND_SEQ_SYNC_FPS_30_DP == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_SYNC_FPS_30_DP); */ /* assert(SND_SEQ_SYNC_FPS_30_NDP == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_SYNC_FPS_30_NDP); */ /* assert(SND_SEQ_TIMER_ALSA == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_TIMER_ALSA); */ /* assert(SND_SEQ_TIMER_MIDI_CLOCK == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_TIMER_MIDI_CLOCK); */ /* assert(SND_SEQ_TIMER_MIDI_TICK == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_TIMER_MIDI_TICK); */ assert(SND_SEQ_QUERY_SUBS_READ == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_QUERY_SUBS_READ); assert(SND_SEQ_QUERY_SUBS_WRITE == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_QUERY_SUBS_WRITE); /* assert(SND_SEQ_INSTR_ATYPE_DATA == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_INSTR_ATYPE_DATA); */ /* assert(SND_SEQ_INSTR_ATYPE_ALIAS == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_INSTR_ATYPE_ALIAS); */ /* assert(SND_SEQ_INSTR_TYPE0_DLS1 == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_INSTR_TYPE0_DLS1); */ /* assert(SND_SEQ_INSTR_TYPE0_DLS2 == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_INSTR_TYPE0_DLS2); */ /* assert(SND_SEQ_INSTR_TYPE1_SIMPLE == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_INSTR_TYPE1_SIMPLE); */ /* assert(SND_SEQ_INSTR_TYPE1_SOUNDFONT == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_INSTR_TYPE1_SOUNDFONT); */ /* assert(SND_SEQ_INSTR_TYPE1_GUS_PATCH == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_INSTR_TYPE1_GUS_PATCH); */ /* assert(SND_SEQ_INSTR_TYPE1_INTERWAVE == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_INSTR_TYPE1_INTERWAVE); */ /* assert(SND_SEQ_INSTR_TYPE2_OPL2_3 == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_INSTR_TYPE2_OPL2_3); */ /* assert(SND_SEQ_INSTR_TYPE2_OPL4 == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_INSTR_TYPE2_OPL4); */ /* assert(SND_SEQ_INSTR_PUT_CMD_CREATE == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_INSTR_PUT_CMD_CREATE); */ /* assert(SND_SEQ_INSTR_PUT_CMD_REPLACE == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_INSTR_PUT_CMD_REPLACE); */ /* assert(SND_SEQ_INSTR_PUT_CMD_MODIFY == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_INSTR_PUT_CMD_MODIFY); */ /* assert(SND_SEQ_INSTR_PUT_CMD_ADD == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_INSTR_PUT_CMD_ADD); */ /* assert(SND_SEQ_INSTR_PUT_CMD_REMOVE == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_INSTR_PUT_CMD_REMOVE); */ /* assert(SND_SEQ_INSTR_GET_CMD_FULL == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_INSTR_GET_CMD_FULL); */ /* assert(SND_SEQ_INSTR_GET_CMD_PARTIAL == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_INSTR_GET_CMD_PARTIAL); */ /* assert(SND_SEQ_INSTR_QUERY_FOLLOW_ALIAS == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_INSTR_QUERY_FOLLOW_ALIAS); */ /* assert(SND_SEQ_INSTR_FREE_CMD_ALL == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_INSTR_FREE_CMD_ALL); */ /* assert(SND_SEQ_INSTR_FREE_CMD_PRIVATE == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_INSTR_FREE_CMD_PRIVATE); */ /* assert(SND_SEQ_INSTR_FREE_CMD_CLUSTER == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_INSTR_FREE_CMD_CLUSTER); */ /* assert(SND_SEQ_INSTR_FREE_CMD_SINGLE == org_tritonus_lowlevel_alsa_AlsaSeq_SND_SEQ_INSTR_FREE_CMD_SINGLE); */ } /*** constants_check.h ***/ libtritonus-java-20070428/src/lib/alsa/init.c0000644000175000017500000000374307576663502020630 0ustar twernertwerner/* * init.c */ /* * Copyright (c) 1999 - 2001 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include #include #include "../common/debug.h" static void* asound_dl_handle = NULL; /* These methods are needed to circumvent a problem with the dynamic linker: The VM calls dlopen() to load this library, which depends on libasound.so. libasound.so, in turn, uses dlopen() to load plugins. It is this chained calling of dlopen() which results in the second call not resolving symbols properly. Making the symbols of libasound.so global here (RTLD_GLOBAL) solves the problem. */ void _init(void) { if (debug_flag) { (void) fprintf(debug_file, "_init(): begin\n"); } asound_dl_handle = dlopen("libasound.so", RTLD_LAZY | RTLD_GLOBAL); if (debug_flag) { (void) fprintf(debug_file, "_init(): result: %p\n", asound_dl_handle); } if (debug_flag) { (void) fprintf(debug_file, "_init(): end\n"); } } void _fini(void) { if (debug_flag) { (void) fprintf(debug_file, "_fini(): begin\n"); } if (asound_dl_handle != NULL) { if (debug_flag) { (void) fprintf(debug_file, "_fini(): closeing handle\n"); } (void) dlclose(asound_dl_handle); } if (debug_flag) { (void) fprintf(debug_file, "_fini(): end\n"); } } /*** init.c ***/ libtritonus-java-20070428/src/lib/alsa/org_tritonus_lowlevel_alsa_Alsa.c0000644000175000017500000000340407576434415026265 0ustar twernertwerner/* * org_tritonus_lowlevel_alsa_Alsa.cc */ /* * Copyright (c) 1999 - 2001 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "common.h" #include "org_tritonus_lowlevel_alsa_Alsa.h" /* * Class: org_tritonus_lowlevel_alsa_Alsa * Method: getStringError * Signature: (I)Ljava/lang/String; */ JNIEXPORT jstring JNICALL Java_org_tritonus_lowlevel_alsa_Alsa_getStringError (JNIEnv *env, jclass cls, jint nErrnum) { jstring strError; const char* err; if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_Alsa_getStringError(): begin\n"); } err = snd_strerror(nErrnum); if (err == NULL) { throwRuntimeException(env, "snd_strerror() failed"); } // strError = env->NewStringUTF(err); strError = (*env)->NewStringUTF(env, err); if (strError == NULL) { throwRuntimeException(env, "NewStringUTF() failed"); } if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_Alsa_getStringError(): end\n"); } return strError; } /*** org_tritonus_lowlevel_alsa_Alsa.cc ***/ libtritonus-java-20070428/src/lib/alsa/org_tritonus_lowlevel_alsa_AlsaCtl.c0000644000175000017500000001551507576435262026737 0ustar twernertwerner/* * org_tritonus_lowlevel_alsa_AlsaCtl.c */ /* * Copyright (c) 1999 - 2001 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "common.h" #include "org_tritonus_lowlevel_alsa_AlsaCtl.h" // static HandleFieldHandler handler; HandleFieldHandlerDeclaration(handler,snd_ctl_t*); snd_ctl_card_info_t* getAlsaCtlCardInfoNativeHandle(JNIEnv *env, jobject obj); /* * Class: org_tritonus_lowlevel_alsa_AlsaCtl * Method: loadCard * Signature: (I)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaCtl_loadCard (JNIEnv *env, jclass cls, jint nCard) { return snd_card_load(nCard); } /* * Class: org_tritonus_lowlevel_alsa_AlsaCtl * Method: getCards * Signature: ()[I */ JNIEXPORT jintArray JNICALL Java_org_tritonus_lowlevel_alsa_AlsaCtl_getCards (JNIEnv *env, jclass cls) { int anCards[32]; int nCard = -1; int nCardCount = 0; int nError; jintArray cardsArray; nError = snd_card_next(&nCard); while (nCard >= 0 && nError >= 0) { anCards[nCardCount] = nCard; nCardCount++; nError = snd_card_next(&nCard); } cardsArray = (*env)->NewIntArray(env, nCardCount); if (cardsArray == NULL) { throwRuntimeException(env, "cannot allocate int array"); } (*env)->SetIntArrayRegion(env, cardsArray, 0, nCardCount, (jint*) anCards); return cardsArray; } /* * Class: org_tritonus_lowlevel_alsa_AlsaCtl * Method: getCardIndex * Signature: (Ljava/lang/String;)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaCtl_getCardIndex (JNIEnv *env, jclass cls, jstring strCardName) { int nCard; const char* name = NULL; name = (*env)->GetStringUTFChars(env, strCardName, NULL); if (name == NULL) { throwRuntimeException(env, "cannot get characters from string argument"); } nCard = snd_card_get_index(name); (*env)->ReleaseStringUTFChars(env, strCardName, name); return nCard; } /* * Class: org_tritonus_lowlevel_alsa_AlsaCtl * Method: getCardName * Signature: (I)Ljava/lang/String; */ JNIEXPORT jstring JNICALL Java_org_tritonus_lowlevel_alsa_AlsaCtl_getCardName (JNIEnv *env, jclass cls, jint nCard) { int nReturn; jstring strName; char* name; nReturn = snd_card_get_name(nCard, &name); if (nReturn < 0) { throwRuntimeException(env, "snd_card_get_name() failed"); } strName = (*env)->NewStringUTF(env, name); if (strName == NULL) { throwRuntimeException(env, "NewStringUTF() failed"); } return strName; } /* * Class: org_tritonus_lowlevel_alsa_AlsaCtl * Method: getCardLongName * Signature: (I)Ljava/lang/String; */ JNIEXPORT jstring JNICALL Java_org_tritonus_lowlevel_alsa_AlsaCtl_getCardLongName (JNIEnv *env, jclass cls, jint nCard) { int nReturn; jstring strName; char* name; nReturn = snd_card_get_longname(nCard, &name); if (nReturn < 0) { throwRuntimeException(env, "snd_card_get_longname() failed"); } strName = (*env)->NewStringUTF(env, name); if (strName == NULL) { throwRuntimeException(env, "NewStringUTF() failed"); } return strName; } /* * Class: org_tritonus_lowlevel_alsa_AlsaCtl * Method: open * Signature: (Ljava/lang/String;I)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaCtl_open (JNIEnv *env, jobject obj, jstring strName, jint nMode) { snd_ctl_t* handle; int nResult; const char* name; // printf("1"); name = (*env)->GetStringUTFChars(env, strName, NULL); // printf("2"); if (name == NULL) { // printf("3"); throwRuntimeException(env, "cannot get characters from string argument"); } // printf("4"); nResult = snd_ctl_open(&handle, name, nMode); // printf("5"); (*env)->ReleaseStringUTFChars(env, strName, name); // printf("6"); if (nResult >= 0) { // printf("7"); setHandle(env, obj, handle); } return nResult; } /* * Class: org_tritonus_lowlevel_alsa_AlsaCtl * Method: close * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaCtl_close (JNIEnv *env, jobject obj) { snd_ctl_t* handle; int nResult; if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaCtl_close(): begin\n"); } handle = getHandle(env, obj); nResult = snd_ctl_close(handle); if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaCtl_close(): end\n"); } return nResult; } /* * Class: org_tritonus_lowlevel_alsa_AlsaCtl * Method: getCardInfo * Signature: (Lorg/tritonus/lowlevel/alsa/AlsaCtlCardInfo;)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaCtl_getCardInfo (JNIEnv* env, jobject obj, jobject cardInfoObj) { snd_ctl_t* handle; snd_ctl_card_info_t* cardInfo; int nReturn; handle = getHandle(env, obj); cardInfo = getAlsaCtlCardInfoNativeHandle(env, cardInfoObj); nReturn = snd_ctl_card_info(handle, cardInfo); return (jint) nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaCtl * Method: getPcmDevices * Signature: ()[I */ JNIEXPORT jintArray JNICALL Java_org_tritonus_lowlevel_alsa_AlsaCtl_getPcmDevices (JNIEnv *env, jobject obj) { snd_ctl_t* handle; int anDevices[128]; int nDevice = -1; int nDeviceCount = 0; int nError; jintArray devicesArray; handle = getHandle(env, obj); nError = snd_ctl_pcm_next_device(handle, &nDevice); while (nDevice >= 0 && nError >= 0) { anDevices[nDeviceCount] = nDevice; nDeviceCount++; nError = snd_ctl_pcm_next_device(handle, &nDevice); } devicesArray = (*env)->NewIntArray(env, nDeviceCount); if (devicesArray == NULL) { throwRuntimeException(env, "cannot allocate int array"); } (*env)->SetIntArrayRegion(env, devicesArray, 0, nDeviceCount, (jint*) anDevices); return devicesArray; } /* * Class: org_tritonus_lowlevel_alsa_AlsaCtl * Method: getPcmInfo * Signature: ([I[Ljava/lang/String;)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaCtl_getPcmInfo (JNIEnv *env, jobject obj, jintArray anValues, jobjectArray astrValues) { // TODO: return -1; } /* * Class: org_tritonus_lowlevel_alsa_AlsaCtl * Method: setTrace * Signature: (Z)V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_alsa_AlsaCtl_setTrace (JNIEnv* env, jclass cls, jboolean bTrace) { debug_flag = bTrace; debug_file = stderr; } /*** org_tritonus_lowlevel_alsa_AlsaCtl.c ***/ libtritonus-java-20070428/src/lib/alsa/org_tritonus_lowlevel_alsa_AlsaCtlCardInfo.c0000644000175000017500000001466307576435263030351 0ustar twernertwerner/* * org_tritonus_lowlevel_alsa_AlsaCtlCardInfo.c */ /* * Copyright (c) 2002 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "common.h" #include "org_tritonus_lowlevel_alsa_AlsaCtlCardInfo.h" HandleFieldHandler(snd_ctl_card_info_t*) snd_ctl_card_info_t* getAlsaCtlCardInfoNativeHandle(JNIEnv *env, jobject obj) { return getHandle(env, obj); } /* * Class: org_tritonus_lowlevel_alsa_AlsaCtlCardInfo * Method: malloc * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaCtlCardInfo_malloc (JNIEnv* env, jobject obj) { snd_ctl_card_info_t* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaCtlCardInfo_malloc(): begin\n"); } nReturn = snd_ctl_card_info_malloc(&handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaCtlCardInfo_malloc(): handle: %p\n", handle); } setHandle(env, obj, handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaCtlCardInfo_malloc(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaCtlCardInfo * Method: free * Signature: ()V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_alsa_AlsaCtlCardInfo_free (JNIEnv* env, jobject obj) { snd_ctl_card_info_t* handle; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaCtlCardInfo_free(): begin\n"); } handle = getHandle(env, obj); snd_ctl_card_info_free(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaCtlCardInfo_free(): end\n"); } } /* * Class: org_tritonus_lowlevel_alsa_AlsaCtlCardInfo * Method: getCard * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaCtlCardInfo_getCard (JNIEnv* env, jobject obj) { snd_ctl_card_info_t* handle; int nReturn; handle = getHandle(env, obj); nReturn = snd_ctl_card_info_get_card(handle); return nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaCtlCardInfo * Method: getId * Signature: ()Ljava/lang/String; */ JNIEXPORT jstring JNICALL Java_org_tritonus_lowlevel_alsa_AlsaCtlCardInfo_getId (JNIEnv* env, jobject obj) { snd_ctl_card_info_t* handle; jstring strResult; const char* result; handle = getHandle(env, obj); result = snd_ctl_card_info_get_id(handle); if (result == NULL) { throwRuntimeException(env, "snd_card_get_id() failed"); } strResult = (*env)->NewStringUTF(env, result); if (strResult == NULL) { throwRuntimeException(env, "NewStringUTF() failed"); } return strResult; } /* * Class: org_tritonus_lowlevel_alsa_AlsaCtlCardInfo * Method: getDriver * Signature: ()Ljava/lang/String; */ JNIEXPORT jstring JNICALL Java_org_tritonus_lowlevel_alsa_AlsaCtlCardInfo_getDriver (JNIEnv* env, jobject obj) { snd_ctl_card_info_t* handle; jstring strResult; const char* result; handle = getHandle(env, obj); result = snd_ctl_card_info_get_driver(handle); if (result == NULL) { throwRuntimeException(env, "snd_card_get_driver() failed"); } strResult = (*env)->NewStringUTF(env, result); if (strResult == NULL) { throwRuntimeException(env, "NewStringUTF() failed"); } return strResult; } /* * Class: org_tritonus_lowlevel_alsa_AlsaCtlCardInfo * Method: getName * Signature: ()Ljava/lang/String; */ JNIEXPORT jstring JNICALL Java_org_tritonus_lowlevel_alsa_AlsaCtlCardInfo_getName (JNIEnv* env, jobject obj) { snd_ctl_card_info_t* handle; jstring strResult; const char* result; handle = getHandle(env, obj); result = snd_ctl_card_info_get_name(handle); if (result == NULL) { throwRuntimeException(env, "snd_card_get_name() failed"); } strResult = (*env)->NewStringUTF(env, result); if (strResult == NULL) { throwRuntimeException(env, "NewStringUTF() failed"); } return strResult; } /* * Class: org_tritonus_lowlevel_alsa_AlsaCtlCardInfo * Method: getLongname * Signature: ()Ljava/lang/String; */ JNIEXPORT jstring JNICALL Java_org_tritonus_lowlevel_alsa_AlsaCtlCardInfo_getLongname (JNIEnv* env, jobject obj) { snd_ctl_card_info_t* handle; jstring strResult; const char* result; handle = getHandle(env, obj); result = snd_ctl_card_info_get_longname(handle); if (result == NULL) { throwRuntimeException(env, "snd_card_get_longname() failed"); } strResult = (*env)->NewStringUTF(env, result); if (strResult == NULL) { throwRuntimeException(env, "NewStringUTF() failed"); } return strResult; } /* * Class: org_tritonus_lowlevel_alsa_AlsaCtlCardInfo * Method: getMixername * Signature: ()Ljava/lang/String; */ JNIEXPORT jstring JNICALL Java_org_tritonus_lowlevel_alsa_AlsaCtlCardInfo_getMixername (JNIEnv* env, jobject obj) { snd_ctl_card_info_t* handle; jstring strResult; const char* result; handle = getHandle(env, obj); result = snd_ctl_card_info_get_mixername(handle); if (result == NULL) { throwRuntimeException(env, "snd_card_get_mixername() failed"); } strResult = (*env)->NewStringUTF(env, result); if (strResult == NULL) { throwRuntimeException(env, "NewStringUTF() failed"); } return strResult; } /* * Class: org_tritonus_lowlevel_alsa_AlsaCtlCardInfo * Method: getComponents * Signature: ()Ljava/lang/String; */ JNIEXPORT jstring JNICALL Java_org_tritonus_lowlevel_alsa_AlsaCtlCardInfo_getComponents (JNIEnv* env, jobject obj) { snd_ctl_card_info_t* handle; jstring strResult; const char* result; handle = getHandle(env, obj); result = snd_ctl_card_info_get_components(handle); if (result == NULL) { throwRuntimeException(env, "snd_card_get_components() failed"); } strResult = (*env)->NewStringUTF(env, result); if (strResult == NULL) { throwRuntimeException(env, "NewStringUTF() failed"); } return strResult; } /*** org_tritonus_lowlevel_alsa_AlsaCtlCardInfo.c ***/ libtritonus-java-20070428/src/lib/alsa/org_tritonus_lowlevel_alsa_AlsaMixer.c0000644000175000017500000002111207576435263027270 0ustar twernertwerner/* * org_tritonus_lowlevel_alsa_AlsaMixer.c */ /* * Copyright (c) 1999 - 2001 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "common.h" #include "org_tritonus_lowlevel_alsa_AlsaMixer.h" #define checkExceptionSpecial() if ((*env)->ExceptionOccurred(env)) { (*env)->ExceptionClear(env); return -1; } HandleFieldHandler(snd_mixer_t*) snd_mixer_t* getMixerNativeHandle(JNIEnv *env, jobject obj) { return getHandle(env, obj); } /* * Class: org_tritonus_lowlevel_alsa_AlsaMixer * Method: open * Signature: (I)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaMixer_open (JNIEnv *env, jobject obj, jint nMode) { snd_mixer_t* handle; int nReturn; if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaMixer_open(): begin\n"); } nReturn = snd_mixer_open(&handle, nMode); setHandle(env, obj, handle); if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaMixer_open(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaMixer * Method: attach * Signature: (Ljava/lang/String;)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaMixer_attach (JNIEnv *env, jobject obj, jstring strCardName) { snd_mixer_t* handle; int nReturn; const char* cardName; if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaMixer_attach(): begin\n"); } handle = getHandle(env, obj); cardName = (*env)->GetStringUTFChars(env, strCardName, NULL); if (cardName == NULL) { throwRuntimeException(env, "cannot retrieve chars from card name string"); return -1; } nReturn = snd_mixer_attach(handle, cardName); (*env)->ReleaseStringUTFChars(env, strCardName, cardName); if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaMixer_attach(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaMixer * Method: register * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaMixer_register (JNIEnv *env, jobject obj) { snd_mixer_t* handle; int nReturn; if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaMixer_register(): begin\n"); } handle = getHandle(env, obj); nReturn = snd_mixer_selem_register(handle, NULL, NULL); if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaMixer_register(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaMixer * Method: load * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaMixer_load (JNIEnv *env, jobject obj) { snd_mixer_t* handle; int nReturn; if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaMixer_load(): begin\n"); } handle = getHandle(env, obj); nReturn = snd_mixer_load(handle); if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaMixer_load(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaMixer * Method: close * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaMixer_close (JNIEnv *env, jobject obj) { snd_mixer_t* handle; int nReturn; if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaMixer_close(): begin\n"); } handle = getHandle(env, obj); nReturn = snd_mixer_close(handle); if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaMixer_close(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaMixer * Method: findElement * Signature: (Ljava/lang/String;I)Lorg/tritonus/lowlevel/alsa/AlsaMixerElement; */ JNIEXPORT jobject JNICALL Java_org_tritonus_lowlevel_alsa_AlsaMixer_findElement (JNIEnv *env, jobject obj, jstring strName, jint nIndex) { jobject element; snd_mixer_t* handle; snd_mixer_elem_t* elem; snd_mixer_selem_id_t* sid; const char* name; jclass element_class; jmethodID constructorID; jfieldID handleFieldID; if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaMixer_findElement(): begin\n"); } handle = getHandle(env, obj); snd_mixer_selem_id_alloca(&sid); snd_mixer_selem_id_set_index(sid, nIndex); name = (*env)->GetStringUTFChars(env, strName, NULL); if (name == NULL) { throwRuntimeException(env, "cannot retrieve chars from mixer name string"); return NULL; } snd_mixer_selem_id_set_name(sid, name); (*env)->ReleaseStringUTFChars(env, strName, name); elem = snd_mixer_find_selem(handle, sid); if (elem == NULL) { return NULL; } element_class = (*env)->FindClass(env, "org/tritonus/lowlevel/alsa/AlsaMixerElement"); if (element_class == NULL) { throwRuntimeException(env, "cannot get class object for AlsaMixerElement"); } constructorID = (*env)->GetMethodID(env, element_class, "", "(Lorg/tritonus/lowlevel/alsa/AlsaMixer;ILjava/lang/String;)V"); if (constructorID == NULL) { throwRuntimeException(env, "cannot get method ID for constructor"); } element = (*env)->NewObject(env, element_class, constructorID, NULL, 0, NULL); if (element == NULL) { throwRuntimeException(env, "object creation failed"); } // TODO: set the handle) handleFieldID = (*env)->GetFieldID(env, element_class, "m_lNativeHandle", "J"); if (handleFieldID == NULL) { throwRuntimeException(env, "cannot get field ID for m_lNativeHandle"); } (*env)->SetLongField(env, element, handleFieldID, (jlong) (long) elem); if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaMixer_findElement(): end\n"); } return element; } /* * Class: org_tritonus_lowlevel_alsa_AlsaMixer * Method: readControlList * Signature: ([I[Ljava/lang/String;)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaMixer_readControlList (JNIEnv *env, jobject obj, jintArray anIndices, jobjectArray astrNames) { snd_mixer_t* handle; int nReturn; int nIndex; snd_mixer_elem_t* element; jint* indices = NULL; if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaMixer_readControlList(): begin\n"); } handle = getHandle(env, obj); if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaMixer_readControlList(): handle: %p\n", handle); } indices = (*env)->GetIntArrayElements(env, anIndices, NULL); if (indices == NULL) { throwRuntimeException(env, "GetIntArrayElements() failed"); return -999; } nIndex = 0; element = snd_mixer_first_elem(handle); if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaMixer_readControlList(): first element: %p\n", element); } // printf("before loop"); while (element != NULL) { // TODO: should not throw exception, but return -1 (and clean the array) // printf("1"); checkArrayLength(env, anIndices, nIndex + 1); // printf("2"); checkExceptionSpecial(); // printf("3"); checkArrayLength(env, astrNames, nIndex + 1); // printf("4"); checkExceptionSpecial(); // printf("5"); indices[nIndex] = snd_mixer_selem_get_index(element); // printf("6"); setStringArrayElement(env, astrNames, nIndex, snd_mixer_selem_get_name(element)); // printf("7"); nIndex++; // printf("8"); element = snd_mixer_elem_next(element); // printf("9\n"); if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaMixer_readControlList(): next element: %p\n", element); } } // printf("after loop\n"); nReturn = nIndex; (*env)->ReleaseIntArrayElements(env, anIndices, indices, 0); if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaMixer_readControlList(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaMixer * Method: setTrace * Signature: (Z)V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_alsa_AlsaMixer_setTrace (JNIEnv *env, jclass cls, jboolean bTrace) { debug_flag = bTrace; debug_file = stderr; } /*** org_tritonus_lowlevel_alsa_AlsaMixer.c ***/ libtritonus-java-20070428/src/lib/alsa/org_tritonus_lowlevel_alsa_AlsaMixerElement.c0000644000175000017500000006720007576435263030612 0ustar twernertwerner/* * org_tritonus_lowlevel_alsa_AlsaMixerElement.c */ /* * Copyright (c) 1999 - 2001 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "common.h" #include "org_tritonus_lowlevel_alsa_AlsaMixerElement.h" snd_mixer_t* getMixerNativeHandle(JNIEnv *env, jobject obj); HandleFieldHandler(snd_mixer_elem_t*) /* * Class: org_tritonus_lowlevel_alsa_AlsaMixerElement * Method: open * Signature: (Lorg/tritonus/lowlevel/alsa/AlsaMixer;ILjava/lang/String;)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaMixerElement_open (JNIEnv *env, jobject obj, jobject mixer, jint nIndex, jstring strName) { snd_mixer_elem_t* handle; snd_mixer_t* mixerHandle; snd_mixer_selem_id_t* id; int nReturn; const char* name; if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaMixerElement_open(): begin\n"); } mixerHandle = getMixerNativeHandle(env, mixer); snd_mixer_selem_id_alloca(&id); snd_mixer_selem_id_set_index(id, nIndex); name= (*env)->GetStringUTFChars(env, strName, NULL); if (name == NULL) { throwRuntimeException(env, "GetStringUTFChars() failed"); return -1; } snd_mixer_selem_id_set_name(id, name); (*env)->ReleaseStringUTFChars(env, strName, name); handle = snd_mixer_find_selem(mixerHandle, id); if (handle == NULL) { nReturn = -1; } else { setHandle(env, obj, handle); nReturn = 0; } if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaMixerElement_open(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaMixerElement * Method: getName * Signature: ()Ljava/lang/String; */ JNIEXPORT jstring JNICALL Java_org_tritonus_lowlevel_alsa_AlsaMixerElement_getName (JNIEnv* env, jobject obj) { snd_mixer_elem_t* handle; jstring name; if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaMixerElement_getName(): begin\n"); } handle = getHandle(env, obj); name = (*env)->NewStringUTF(env, snd_mixer_selem_get_name(handle)); if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaMixerElement_getName(): end\n"); } return name; } /* * Class: org_tritonus_lowlevel_alsa_AlsaMixerElement * Method: getIndex * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaMixerElement_getIndex (JNIEnv* env, jobject obj) { snd_mixer_elem_t* handle; int nReturn; if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaMixerElement_getIndex(): begin\n"); } handle = getHandle(env, obj); nReturn = snd_mixer_selem_get_index(handle); if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaMixerElement_getIndex(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaMixerElement * Method: isActive * Signature: ()Z */ JNIEXPORT jboolean JNICALL Java_org_tritonus_lowlevel_alsa_AlsaMixerElement_isActive (JNIEnv* env, jobject obj) { snd_mixer_elem_t* handle; int nReturn; if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaMixerElement_isActive(): begin\n"); } handle = getHandle(env, obj); nReturn = snd_mixer_selem_is_active(handle); if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaMixerElement_isActive(): end\n"); } return (jboolean) nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaMixerElement * Method: isPlaybackMono * Signature: ()Z */ JNIEXPORT jboolean JNICALL Java_org_tritonus_lowlevel_alsa_AlsaMixerElement_isPlaybackMono (JNIEnv* env, jobject obj) { snd_mixer_elem_t* handle; int nReturn; if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaMixerElement_isPlaybackMono(): begin\n"); } handle = getHandle(env, obj); nReturn = snd_mixer_selem_is_playback_mono(handle); if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaMixerElement_isPlaybackMono(): end\n"); } return (jboolean) nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaMixerElement * Method: hasPlaybackChannel * Signature: (I)Z */ JNIEXPORT jboolean JNICALL Java_org_tritonus_lowlevel_alsa_AlsaMixerElement_hasPlaybackChannel (JNIEnv* env, jobject obj, jint nChannelType) { snd_mixer_elem_t* handle; int nReturn; if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaMixerElement_hasPlaybackChannel(): begin\n"); } handle = getHandle(env, obj); nReturn = snd_mixer_selem_has_playback_channel(handle, (snd_mixer_selem_channel_id_t) nChannelType); if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaMixerElement_hasPlaybackChannel(): end\n"); } return (jboolean) nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaMixerElement * Method: isCaptureMono * Signature: ()Z */ JNIEXPORT jboolean JNICALL Java_org_tritonus_lowlevel_alsa_AlsaMixerElement_isCaptureMono (JNIEnv* env, jobject obj) { snd_mixer_elem_t* handle; int nReturn; if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaMixerElement_isCaptureMono(): begin\n"); } handle = getHandle(env, obj); nReturn = snd_mixer_selem_is_capture_mono(handle); if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaMixerElement_isCaptureMono(): end\n"); } return (jboolean) nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaMixerElement * Method: hasCaptureChannel * Signature: (I)Z */ JNIEXPORT jboolean JNICALL Java_org_tritonus_lowlevel_alsa_AlsaMixerElement_hasCaptureChannel (JNIEnv* env, jobject obj, jint nChannelType) { snd_mixer_elem_t* handle; int nReturn; if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaMixerElement_hasCaptureChannel(): begin\n"); } handle = getHandle(env, obj); nReturn = snd_mixer_selem_has_capture_channel(handle, (snd_mixer_selem_channel_id_t) nChannelType); if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaMixerElement_hasCaptureChannel(): end\n"); } return (jboolean) nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaMixerElement * Method: getCaptureGroup * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaMixerElement_getCaptureGroup (JNIEnv* env, jobject obj) { snd_mixer_elem_t* handle; int nReturn; if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaMixerElement_getCaptureGroup(): begin\n"); } handle = getHandle(env, obj); nReturn = snd_mixer_selem_get_capture_group(handle); if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaMixerElement_getCaptureGroup(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaMixerElement * Method: hasCommonVolume * Signature: ()Z */ JNIEXPORT jboolean JNICALL Java_org_tritonus_lowlevel_alsa_AlsaMixerElement_hasCommonVolume (JNIEnv* env, jobject obj) { snd_mixer_elem_t* handle; int nReturn; if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaMixerElement_hasCommonVolume(): begin\n"); } handle = getHandle(env, obj); nReturn = snd_mixer_selem_has_common_volume(handle); if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaMixerElement_hasCommonVolume(): end\n"); } return (jboolean) nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaMixerElement * Method: hasPlaybackVolume * Signature: ()Z */ JNIEXPORT jboolean JNICALL Java_org_tritonus_lowlevel_alsa_AlsaMixerElement_hasPlaybackVolume (JNIEnv* env, jobject obj) { snd_mixer_elem_t* handle; int nReturn; if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaMixerElement_hasPlaybackVolume(): begin\n"); } handle = getHandle(env, obj); nReturn = snd_mixer_selem_has_playback_volume(handle); if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaMixerElement_hasPlaybackVolume(): end\n"); } return (jboolean) nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaMixerElement * Method: hasPlaybackVolumeJoined * Signature: ()Z */ JNIEXPORT jboolean JNICALL Java_org_tritonus_lowlevel_alsa_AlsaMixerElement_hasPlaybackVolumeJoined (JNIEnv* env, jobject obj) { snd_mixer_elem_t* handle; int nReturn; if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaMixerElement_hasPlaybackVolumeJoined(): begin\n"); } handle = getHandle(env, obj); nReturn = snd_mixer_selem_has_playback_volume_joined(handle); if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaMixerElement_hasPlaybackVolumeJoined(): end\n"); } return (jboolean) nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaMixerElement * Method: hasCaptureVolume * Signature: ()Z */ JNIEXPORT jboolean JNICALL Java_org_tritonus_lowlevel_alsa_AlsaMixerElement_hasCaptureVolume (JNIEnv* env, jobject obj) { snd_mixer_elem_t* handle; int nReturn; if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaMixerElement_hasCaptureVolume(): begin\n"); } handle = getHandle(env, obj); nReturn = snd_mixer_selem_has_capture_volume(handle); if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaMixerElement_hasCaptureVolume(): end\n"); } return (jboolean) nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaMixerElement * Method: hasCaptureVolumeJoined * Signature: ()Z */ JNIEXPORT jboolean JNICALL Java_org_tritonus_lowlevel_alsa_AlsaMixerElement_hasCaptureVolumeJoined (JNIEnv* env, jobject obj) { snd_mixer_elem_t* handle; int nReturn; if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaMixerElement_hasCaptureVolumeJoined(): begin\n"); } handle = getHandle(env, obj); nReturn = snd_mixer_selem_has_capture_volume_joined(handle); if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaMixerElement_hasCaptureVolumeJoined(): end\n"); } return (jboolean) nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaMixerElement * Method: hasCommonSwitch * Signature: ()Z */ JNIEXPORT jboolean JNICALL Java_org_tritonus_lowlevel_alsa_AlsaMixerElement_hasCommonSwitch (JNIEnv* env, jobject obj) { snd_mixer_elem_t* handle; int nReturn; if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaMixerElement_hasCommonSwitch(): begin\n"); } handle = getHandle(env, obj); nReturn = snd_mixer_selem_has_common_switch(handle); if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaMixerElement_hasCommonSwitch(): end\n"); } return (jboolean) nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaMixerElement * Method: hasPlaybackSwitch * Signature: ()Z */ JNIEXPORT jboolean JNICALL Java_org_tritonus_lowlevel_alsa_AlsaMixerElement_hasPlaybackSwitch (JNIEnv* env, jobject obj) { snd_mixer_elem_t* handle; int nReturn; if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaMixerElement_hasPlaybackSwitch(): begin\n"); } handle = getHandle(env, obj); nReturn = snd_mixer_selem_has_playback_switch(handle); if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaMixerElement_hasPlaybackSwitch(): end\n"); } return (jboolean) nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaMixerElement * Method: hasPlaybackSwitchJoined * Signature: ()Z */ JNIEXPORT jboolean JNICALL Java_org_tritonus_lowlevel_alsa_AlsaMixerElement_hasPlaybackSwitchJoined (JNIEnv* env, jobject obj) { snd_mixer_elem_t* handle; int nReturn; if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaMixerElement_hasPlaybackSwitchJoined(): begin\n"); } handle = getHandle(env, obj); nReturn = snd_mixer_selem_has_playback_switch_joined(handle); if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaMixerElement_hasPlaybackSwitchJoined(): end\n"); } return (jboolean) nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaMixerElement * Method: hasCaptureSwitch * Signature: ()Z */ JNIEXPORT jboolean JNICALL Java_org_tritonus_lowlevel_alsa_AlsaMixerElement_hasCaptureSwitch (JNIEnv* env, jobject obj) { snd_mixer_elem_t* handle; int nReturn; if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaMixerElement_hasCaptureSwitch(): begin\n"); } handle = getHandle(env, obj); nReturn = snd_mixer_selem_has_capture_switch(handle); if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaMixerElement_hasCaptureSwitch(): end\n"); } return (jboolean) nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaMixerElement * Method: hasCaptureSwitchJoinded * Signature: ()Z */ JNIEXPORT jboolean JNICALL Java_org_tritonus_lowlevel_alsa_AlsaMixerElement_hasCaptureSwitchJoinded (JNIEnv* env, jobject obj) { snd_mixer_elem_t* handle; int nReturn; if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaMixerElement_hasCaptureSwitchJoinded(): begin\n"); } handle = getHandle(env, obj); nReturn = snd_mixer_selem_has_capture_switch_joined(handle); if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaMixerElement_hasCaptureSwitchJoinded(): end\n"); } return (jboolean) nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaMixerElement * Method: hasCaptureSwitchExclusive * Signature: ()Z */ JNIEXPORT jboolean JNICALL Java_org_tritonus_lowlevel_alsa_AlsaMixerElement_hasCaptureSwitchExclusive (JNIEnv* env, jobject obj) { snd_mixer_elem_t* handle; int nReturn; if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaMixerElement_hasCaptureSwitchExclusive(): begin\n"); } handle = getHandle(env, obj); nReturn = snd_mixer_selem_has_capture_switch_exclusive(handle); if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaMixerElement_hasCaptureSwitchExclusive(): end\n"); } return (jboolean) nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaMixerElement * Method: getPlaybackVolume * Signature: (I)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaMixerElement_getPlaybackVolume (JNIEnv* env, jobject obj, jint nChannelType) { snd_mixer_elem_t* handle; int nReturn; long lValue; if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaMixerElement_getPlaybackVolume(): begin\n"); } handle = getHandle(env, obj); nReturn = snd_mixer_selem_get_playback_volume(handle, (snd_mixer_selem_channel_id_t) nChannelType, &lValue); if (nReturn < 0) { throwRuntimeException(env, snd_strerror(nReturn)); } if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaMixerElement_getPlaybackVolume(): end\n"); } return lValue; } /* * Class: org_tritonus_lowlevel_alsa_AlsaMixerElement * Method: getCaptureVolume * Signature: (I)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaMixerElement_getCaptureVolume (JNIEnv* env, jobject obj, jint nChannelType) { snd_mixer_elem_t* handle; int nReturn; long lValue; if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaMixerElement_getCaptureVolume(): begin\n"); } handle = getHandle(env, obj); nReturn = snd_mixer_selem_get_capture_volume(handle, (snd_mixer_selem_channel_id_t) nChannelType, &lValue); if (nReturn < 0) { throwRuntimeException(env, snd_strerror(nReturn)); } if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaMixerElement_getCaptureVolume(): end\n"); } return lValue; } /* * Class: org_tritonus_lowlevel_alsa_AlsaMixerElement * Method: getPlaybackSwitch * Signature: (I)Z */ JNIEXPORT jboolean JNICALL Java_org_tritonus_lowlevel_alsa_AlsaMixerElement_getPlaybackSwitch (JNIEnv* env, jobject obj, jint nChannelType) { snd_mixer_elem_t* handle; int nReturn; int nValue; if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaMixerElement_getPlaybackSwitch(): begin\n"); } handle = getHandle(env, obj); nReturn = snd_mixer_selem_get_playback_switch(handle, (snd_mixer_selem_channel_id_t) nChannelType, &nValue); if (nReturn < 0) { throwRuntimeException(env, snd_strerror(nReturn)); } if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaMixerElement_getPlaybackSwitch(): end\n"); } return (jboolean) nValue; } /* * Class: org_tritonus_lowlevel_alsa_AlsaMixerElement * Method: getCaptureSwitch * Signature: (I)Z */ JNIEXPORT jboolean JNICALL Java_org_tritonus_lowlevel_alsa_AlsaMixerElement_getCaptureSwitch (JNIEnv* env, jobject obj, jint nChannelType) { snd_mixer_elem_t* handle; int nReturn; int nValue; if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaMixerElement_getCaptureSwitch(): begin\n"); } handle = getHandle(env, obj); nReturn = snd_mixer_selem_get_capture_switch(handle, (snd_mixer_selem_channel_id_t) nChannelType, &nValue); if (nReturn < 0) { throwRuntimeException(env, snd_strerror(nReturn)); } if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaMixerElement_getCaptureSwitch(): end\n"); } return (jboolean) nValue; } /* * Class: org_tritonus_lowlevel_alsa_AlsaMixerElement * Method: setPlaybackVolume * Signature: (II)V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_alsa_AlsaMixerElement_setPlaybackVolume (JNIEnv* env, jobject obj, jint nChannelType, jint nValue) { snd_mixer_elem_t* handle; int nReturn; if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaMixerElement_setPlaybackVolume(): begin\n"); } handle = getHandle(env, obj); nReturn = snd_mixer_selem_set_playback_volume(handle, (snd_mixer_selem_channel_id_t) nChannelType, nValue); if (nReturn < 0) { throwRuntimeException(env, snd_strerror(nReturn)); } if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaMixerElement_setPlaybackVolume(): end\n"); } } /* * Class: org_tritonus_lowlevel_alsa_AlsaMixerElement * Method: setCaptureVolume * Signature: (II)V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_alsa_AlsaMixerElement_setCaptureVolume (JNIEnv* env, jobject obj, jint nChannelType, jint nValue) { snd_mixer_elem_t* handle; int nReturn; if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaMixerElement_setCaptureVolume(): begin\n"); } handle = getHandle(env, obj); nReturn = snd_mixer_selem_set_capture_volume(handle, (snd_mixer_selem_channel_id_t) nChannelType, nValue); if (nReturn < 0) { throwRuntimeException(env, snd_strerror(nReturn)); } if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaMixerElement_setCaptureVolume(): end\n"); } } /* * Class: org_tritonus_lowlevel_alsa_AlsaMixerElement * Method: setPlaybackVolumeAll * Signature: (I)V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_alsa_AlsaMixerElement_setPlaybackVolumeAll (JNIEnv* env, jobject obj, jint nValue) { snd_mixer_elem_t* handle; int nReturn; if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaMixerElement_setPlaybackVolumeAll(): begin\n"); } handle = getHandle(env, obj); nReturn = snd_mixer_selem_set_playback_volume_all(handle, nValue); if (nReturn < 0) { throwRuntimeException(env, snd_strerror(nReturn)); } if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaMixerElement_setPlaybackVolumeAll(): end\n"); } } /* * Class: org_tritonus_lowlevel_alsa_AlsaMixerElement * Method: setCaptureVolumeAll * Signature: (I)V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_alsa_AlsaMixerElement_setCaptureVolumeAll (JNIEnv* env, jobject obj, jint nValue) { snd_mixer_elem_t* handle; int nReturn; if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaMixerElement_setCaptureVolumeAll(): begin\n"); } handle = getHandle(env, obj); nReturn = snd_mixer_selem_set_capture_volume_all(handle, nValue); if (nReturn < 0) { throwRuntimeException(env, snd_strerror(nReturn)); } if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaMixerElement_setCaptureVolumeAll(): end\n"); } } /* * Class: org_tritonus_lowlevel_alsa_AlsaMixerElement * Method: setPlaybackSwitch * Signature: (IZ)V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_alsa_AlsaMixerElement_setPlaybackSwitch (JNIEnv* env, jobject obj, jint nChannelType, jboolean bValue) { snd_mixer_elem_t* handle; int nReturn; if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaMixerElement_setPlaybackSwitch(): begin\n"); } handle = getHandle(env, obj); nReturn = snd_mixer_selem_set_playback_switch(handle, (snd_mixer_selem_channel_id_t) nChannelType, bValue); if (nReturn < 0) { throwRuntimeException(env, snd_strerror(nReturn)); } if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaMixerElement_setPlaybackSwitch(): end\n"); } } /* * Class: org_tritonus_lowlevel_alsa_AlsaMixerElement * Method: setCaptureSwitch * Signature: (IZ)V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_alsa_AlsaMixerElement_setCaptureSwitch (JNIEnv* env, jobject obj, jint nChannelType, jboolean bValue) { snd_mixer_elem_t* handle; int nReturn; if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaMixerElement_setCaptureSwitch(): begin\n"); } handle = getHandle(env, obj); nReturn = snd_mixer_selem_set_capture_switch(handle, (snd_mixer_selem_channel_id_t) nChannelType, bValue); if (nReturn < 0) { throwRuntimeException(env, snd_strerror(nReturn)); } if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaMixerElement_setCaptureSwitch(): end\n"); } } /* * Class: org_tritonus_lowlevel_alsa_AlsaMixerElement * Method: setPlaybackSwitchAll * Signature: (Z)V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_alsa_AlsaMixerElement_setPlaybackSwitchAll (JNIEnv* env, jobject obj, jboolean bValue) { snd_mixer_elem_t* handle; int nReturn; if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaMixerElement_setPlaybackSwitchAll(): begin\n"); } handle = getHandle(env, obj); nReturn = snd_mixer_selem_set_playback_switch_all(handle, bValue); if (nReturn < 0) { throwRuntimeException(env, snd_strerror(nReturn)); } if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaMixerElement_setPlaybackSwitchAll(): end\n"); } } /* * Class: org_tritonus_lowlevel_alsa_AlsaMixerElement * Method: setCaptureSwitchAll * Signature: (Z)V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_alsa_AlsaMixerElement_setCaptureSwitchAll (JNIEnv* env, jobject obj, jboolean bValue) { snd_mixer_elem_t* handle; int nReturn; if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaMixerElement_setCaptureSwitchAll(): begin\n"); } handle = getHandle(env, obj); nReturn = snd_mixer_selem_set_capture_switch_all(handle, bValue); if (nReturn < 0) { throwRuntimeException(env, snd_strerror(nReturn)); } if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaMixerElement_setCaptureSwitchAll(): end\n"); } } /* * Class: org_tritonus_lowlevel_alsa_AlsaMixerElement * Method: getPlaybackVolumeRange * Signature: ([I)V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_alsa_AlsaMixerElement_getPlaybackVolumeRange (JNIEnv* env, jobject obj, jintArray anValues) { snd_mixer_elem_t* handle; jint values[2]; if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaMixerElement_getPlaybackVolumeRange(): begin\n"); } handle = getHandle(env, obj); snd_mixer_selem_get_playback_volume_range(handle, (long*) values, (long*) values + 1); checkArrayLength(env, anValues, 2); (*env)->SetIntArrayRegion(env, anValues, 0, 2, values); if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaMixerElement_getPlaybackVolumeRange(): end\n"); } } /* * Class: org_tritonus_lowlevel_alsa_AlsaMixerElement * Method: getCaptureVolumeRange * Signature: ([I)V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_alsa_AlsaMixerElement_getCaptureVolumeRange (JNIEnv* env, jobject obj, jintArray anValues) { snd_mixer_elem_t* handle; jint values[2]; if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaMixerElement_getCaptureVolumeRange(): begin\n"); } handle = getHandle(env, obj); snd_mixer_selem_get_capture_volume_range(handle, (long*) values, (long*) values + 1); checkArrayLength(env, anValues, 2); (*env)->SetIntArrayRegion(env, anValues, 0, 2, values); if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaMixerElement_getCaptureVolumeRange(): end\n"); } } /* * Class: org_tritonus_lowlevel_alsa_AlsaMixerElement * Method: setPlaybackVolumeRange * Signature: (II)V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_alsa_AlsaMixerElement_setPlaybackVolumeRange (JNIEnv* env, jobject obj, jint nMin, jint nMax) { snd_mixer_elem_t* handle; if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaMixerElement_setPlaybackVolumeRange(): begin\n"); } handle = getHandle(env, obj); snd_mixer_selem_set_playback_volume_range(handle, nMin, nMax); if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaMixerElement_setPlaybackVolumeRange(): end\n"); } } /* * Class: org_tritonus_lowlevel_alsa_AlsaMixerElement * Method: setCaptureVolumeRange * Signature: (II)V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_alsa_AlsaMixerElement_setCaptureVolumeRange (JNIEnv* env, jobject obj, jint nMin, jint nMax) { snd_mixer_elem_t* handle; if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaMixerElement_setCaptureVolumeRange(): begin\n"); } handle = getHandle(env, obj); snd_mixer_selem_set_capture_volume_range(handle, nMin, nMax); if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaMixerElement_setCaptureVolumeRange(): end\n"); } } /* * Class: org_tritonus_lowlevel_alsa_AlsaMixerElement * Method: getChannelName * Signature: (I)Ljava/lang/String; */ JNIEXPORT jstring JNICALL Java_org_tritonus_lowlevel_alsa_AlsaMixerElement_getChannelName (JNIEnv* env, jclass cls, jint nChannelType) { const char* channelName; jstring channelNameObj; if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaMixerElement_getChannelName(): begin\n"); } channelName = snd_mixer_selem_channel_name((snd_mixer_selem_channel_id_t) nChannelType); channelNameObj = (*env)->NewStringUTF(env, channelName); if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaMixerElement_getChannelName(): end\n"); } return channelNameObj; } /* * Class: org_tritonus_lowlevel_alsa_AlsaMixerElement * Method: setTrace * Signature: (Z)V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_alsa_AlsaMixerElement_setTrace (JNIEnv* env, jclass cls, jboolean bTrace) { debug_flag = bTrace; debug_file = stderr; } /*** org_tritonus_lowlevel_alsa_AlsaMixerElement.c ***/ libtritonus-java-20070428/src/lib/alsa/org_tritonus_lowlevel_alsa_AlsaPcm.c0000644000175000017500000006003407776243760026732 0ustar twernertwerner/* * org_tritonus_lowlevel_alsa_AlsaPcm.c */ /* * Copyright (c) 2000 - 2001 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ #include "common.h" #include "org_tritonus_lowlevel_alsa_AlsaPcm.h" // referring to methods in ..AlsaPcm_*.c snd_pcm_hw_params_t* getHWParamsNativeHandle(JNIEnv *env, jobject obj); snd_pcm_format_mask_t* getFormatMaskNativeHandle(JNIEnv *env, jobject obj); snd_pcm_sw_params_t* getSWParamsNativeHandle(JNIEnv *env, jobject obj); HandleFieldHandler(snd_pcm_t*) /* * Class: org_tritonus_lowlevel_alsa_AlsaPcm * Method: open * Signature: (Ljava/lang/String;II)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaPcm_open (JNIEnv *env, jobject obj, jstring strPcmName, jint nDirection, jint nMode) { const char* name = NULL; snd_pcm_t* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcm_open(): begin\n"); } name = (*env)->GetStringUTFChars(env, strPcmName, NULL); if (name == NULL) { throwRuntimeException(env, "cannot get characters from string argument"); } if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcm_open(): name: %s\n", name); fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcm_open(): direction: %d\n", (int) nDirection); fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcm_open(): mode: %d\n", (int) nMode); } nReturn = snd_pcm_open(&handle, name, (snd_pcm_stream_t) nDirection, nMode); (*env)->ReleaseStringUTFChars(env, strPcmName, name); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcm_open(): handle: %p\n", handle); } if (nReturn >= 0) { setHandle(env, obj, handle); } else { if (debug_flag) { fprintf(debug_file, "org_tritonus_lowlevel_alsa_AlsaPcm.open(): returns %d\n", nReturn); } } if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcm_open(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaPcm * Method: close * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaPcm_close (JNIEnv *env, jobject obj) { snd_pcm_t* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcm_close(): begin\n"); } handle = getHandle(env, obj); nReturn = snd_pcm_close(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcm_close(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaPcm * Method: getAnyHWParams * Signature: (Lorg/tritonus/lowlevel/alsa/AlsaPcm$HWParams;)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaPcm_getAnyHWParams (JNIEnv *env, jobject obj, jobject objHwParams) { snd_pcm_t* handle; snd_pcm_hw_params_t* hwParams; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcm_getAnyHWParams(): begin\n"); } handle = getHandle(env, obj); hwParams = getHWParamsNativeHandle(env, objHwParams); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcm_getAnyHWParams(): hwparams handle: %p\n", hwParams); } nReturn = snd_pcm_hw_params_any(handle, hwParams); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcm_getAnyHWParams(): snd_pcm_hw_params_any() returns: %d\n", nReturn); } if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcm_getAnyHWParams(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaPcm * Method: setHWParamsAccess * Signature: (Lorg/tritonus/lowlevel/alsa/AlsaPcm$HWParams;I)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaPcm_setHWParamsAccess (JNIEnv *env, jobject obj, jobject objHwParams, jint nAccess) { snd_pcm_t* handle; snd_pcm_hw_params_t* hwParams; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcm_setHWParamsAccess(): begin\n"); } handle = getHandle(env, obj); hwParams = getHWParamsNativeHandle(env, objHwParams); nReturn = snd_pcm_hw_params_set_access(handle, hwParams, (snd_pcm_access_t) nAccess); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcm_setHWParamsAccess(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaPcm * Method: setHWParamsFormat * Signature: (Lorg/tritonus/lowlevel/alsa/AlsaPcm$HWParams;I)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaPcm_setHWParamsFormat (JNIEnv *env, jobject obj, jobject objHwParams, jint nFormat) { snd_pcm_t* handle; snd_pcm_hw_params_t* hwParams; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcm_setHWParamsFormat(): begin\n"); } handle = getHandle(env, obj); hwParams = getHWParamsNativeHandle(env, objHwParams); nReturn = snd_pcm_hw_params_set_format(handle, hwParams, (snd_pcm_format_t) nFormat); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcm_setHWParamsFormat(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaPcm * Method: setHWParamsFormatMask * Signature: (Lorg/tritonus/lowlevel/alsa/AlsaPcm$HWParams;Lorg/tritonus/lowlevel/alsa/AlsaPcm$HWParams$FormatMask;)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaPcm_setHWParamsFormatMask (JNIEnv *env, jobject obj, jobject objHwParams, jobject objFormatMask) { snd_pcm_t* handle; snd_pcm_hw_params_t* hwParams; snd_pcm_format_mask_t* formatMask; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcm_setHWParamsFormatMask(): begin\n"); } handle = getHandle(env, obj); hwParams = getHWParamsNativeHandle(env, objHwParams); formatMask = getFormatMaskNativeHandle(env, objFormatMask); nReturn = snd_pcm_hw_params_set_format_mask(handle, hwParams, formatMask); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcm_setHWParamsFormatMask(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaPcm * Method: setHWParamsChannels * Signature: (Lorg/tritonus/lowlevel/alsa/AlsaPcm$HWParams;I)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaPcm_setHWParamsChannels (JNIEnv *env, jobject obj, jobject objHwParams, jint nChannels) { snd_pcm_t* handle; snd_pcm_hw_params_t* hwParams; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcm_setHWParamsChannels(): begin\n"); } handle = getHandle(env, obj); hwParams = getHWParamsNativeHandle(env, objHwParams); nReturn = snd_pcm_hw_params_set_channels(handle, hwParams, nChannels); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcm_setHWParamsChannels(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaPcm * Method: setHWParamsRateNear * Signature: (Lorg/tritonus/lowlevel/alsa/AlsaPcm$HWParams;I)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaPcm_setHWParamsRateNear (JNIEnv *env, jobject obj, jobject objHwParams, jint nRate) { snd_pcm_t* handle; snd_pcm_hw_params_t* hwParams; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcm_setHWParamsRateNear(): begin\n"); } handle = getHandle(env, obj); hwParams = getHWParamsNativeHandle(env, objHwParams); nReturn = snd_pcm_hw_params_set_rate_near(handle, hwParams, (unsigned int*)&nRate, 0); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcm_setHWParamsRateNear(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaPcm * Method: setHWParamsBufferTimeNear * Signature: (Lorg/tritonus/lowlevel/alsa/AlsaPcm$HWParams;I)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaPcm_setHWParamsBufferTimeNear (JNIEnv *env, jobject obj, jobject objHwParams, jint nBufferTime) { snd_pcm_t* handle; snd_pcm_hw_params_t* hwParams; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcm_setHWParamsBufferTimeNear(): begin\n"); } handle = getHandle(env, obj); hwParams = getHWParamsNativeHandle(env, objHwParams); nReturn = snd_pcm_hw_params_set_buffer_time_near(handle, hwParams, (unsigned int*) &nBufferTime, 0); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcm_setHWParamsBufferTimeNear(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaPcm * Method: setHWParamsPeriodTimeNear * Signature: (Lorg/tritonus/lowlevel/alsa/AlsaPcm$HWParams;I)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaPcm_setHWParamsPeriodTimeNear (JNIEnv *env, jobject obj, jobject objHwParams, jint nPeriodTime) { snd_pcm_t* handle; snd_pcm_hw_params_t* hwParams; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcm_setHWParamsPeriodTimeNear(): begin\n"); } handle = getHandle(env, obj); hwParams = getHWParamsNativeHandle(env, objHwParams); nReturn = snd_pcm_hw_params_set_period_time_near(handle, hwParams, (unsigned int*) &nPeriodTime, 0); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcm_setHWParamsPeriodTimeNear(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaPcm * Method: setHWParams * Signature: (Lorg/tritonus/lowlevel/alsa/AlsaPcm$HWParams;)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaPcm_setHWParams (JNIEnv *env, jobject obj, jobject objHwParams) { snd_pcm_t* handle; snd_pcm_hw_params_t* hwParams; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcm_setHWParams(): begin\n"); } handle = getHandle(env, obj); hwParams = getHWParamsNativeHandle(env, objHwParams); nReturn = snd_pcm_hw_params(handle, hwParams); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcm_setHWParams(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaPcm * Method: getHWParamsPeriodSize * Signature: (Lorg/tritonus/lowlevel/alsa/AlsaPcm$HWParams;)I */ /* JNIEXPORT jint JNICALL */ /* Java_org_tritonus_lowlevel_alsa_AlsaPcm_getHWParamsPeriodSize */ /* (JNIEnv *env, jobject obj, jobject objHwParams) */ /* { */ /* snd_pcm_t* handle; */ /* snd_pcm_hw_params_t* hwParams; */ /* int nReturn; */ /* handle = getHandle(env, obj); */ /* hwParams = getHWParamsNativeHandle(env, objHwParams); */ /* nReturn = snd_pcm_hw_params_get_period_size(handle, hwParams, NULL); */ /* return nReturn; */ /* } */ /* * Class: org_tritonus_lowlevel_alsa_AlsaPcm * Method: getHWParamsBufferSize * Signature: (Lorg/tritonus/lowlevel/alsa/AlsaPcm$HWParams;)I */ /* JNIEXPORT jint JNICALL */ /* Java_org_tritonus_lowlevel_alsa_AlsaPcm_getHWParamsBufferSize */ /* (JNIEnv *env, jobject obj, jobject objHwParams) */ /* { */ /* snd_pcm_t* handle; */ /* snd_pcm_hw_params_t* hwParams; */ /* int nReturn; */ /* handle = getHandle(env, obj); */ /* hwParams = getHWParamsNativeHandle(env, objHwParams); */ /* nReturn = snd_pcm_hw_params_get_buffer_size(handle, hwParams); */ /* return nReturn; */ /* } */ /* * Class: org_tritonus_lowlevel_alsa_AlsaPcm * Method: getSWParams * Signature: (Lorg/tritonus/lowlevel/alsa/AlsaPcm$SWParams;)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaPcm_getSWParams (JNIEnv *env, jobject obj, jobject objSwParams) { snd_pcm_t* handle; snd_pcm_sw_params_t* swParams; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcm_getSWParams(): begin\n"); } handle = getHandle(env, obj); swParams = getSWParamsNativeHandle(env, objSwParams); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcm_getSWParams(): swparams handle: %p\n", swParams); } nReturn = snd_pcm_sw_params_current(handle, swParams); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcm_getSWParams(): snd_pcm_sw_params_any() returns: %d\n", nReturn); } if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcm_getSWParams(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaPcm * Method: setSWParamsStartMode * Signature: (Lorg/tritonus/lowlevel/alsa/AlsaPcm$SWParams;I)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaPcm_setSWParamsStartMode (JNIEnv *env, jobject obj, jobject objSwParams, jint nStartMode) { snd_pcm_t* handle; snd_pcm_sw_params_t* swParams; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcm_setSWParamsStartMode(): begin\n"); } handle = getHandle(env, obj); swParams = getSWParamsNativeHandle(env, objSwParams); nReturn = snd_pcm_sw_params_set_start_mode(handle, swParams, (snd_pcm_start_t) nStartMode); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcm_setSWParamsStartMode(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaPcm * Method: setSWParamsXrunMode * Signature: (Lorg/tritonus/lowlevel/alsa/AlsaPcm$SWParams;I)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaPcm_setSWParamsXrunMode (JNIEnv *env, jobject obj, jobject objSwParams, jint nXrunMode) { snd_pcm_t* handle; snd_pcm_sw_params_t* swParams; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcm_setSWParamsXrunMode(): begin\n"); } handle = getHandle(env, obj); swParams = getSWParamsNativeHandle(env, objSwParams); nReturn = snd_pcm_sw_params_set_xrun_mode(handle, swParams, (snd_pcm_xrun_t) nXrunMode); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcm_setSWParamsXrunMode(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaPcm * Method: setSWParamsTStampMode * Signature: (Lorg/tritonus/lowlevel/alsa/AlsaPcm$SWParams;I)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaPcm_setSWParamsTStampMode (JNIEnv *env, jobject obj, jobject objSwParams, jint nTStampMode) { snd_pcm_t* handle; snd_pcm_sw_params_t* swParams; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcm_setSWParamsTStampMode(): begin\n"); } handle = getHandle(env, obj); swParams = getSWParamsNativeHandle(env, objSwParams); nReturn = snd_pcm_sw_params_set_tstamp_mode(handle, swParams, (snd_pcm_tstamp_t) nTStampMode); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcm_setSWParamsTStampMode(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaPcm * Method: setSWParamsSleepMin * Signature: (Lorg/tritonus/lowlevel/alsa/AlsaPcm$SWParams;I)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaPcm_setSWParamsSleepMin (JNIEnv *env, jobject obj, jobject objSwParams, jint nSleepMin) { snd_pcm_t* handle; snd_pcm_sw_params_t* swParams; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcm_setSWParamsSleepMin(): begin\n"); } handle = getHandle(env, obj); swParams = getSWParamsNativeHandle(env, objSwParams); nReturn = snd_pcm_sw_params_set_sleep_min(handle, swParams, nSleepMin); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcm_setSWParamsSleepMin(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaPcm * Method: setSWParamsAvailMin * Signature: (Lorg/tritonus/lowlevel/alsa/AlsaPcm$SWParams;I)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaPcm_setSWParamsAvailMin (JNIEnv *env, jobject obj, jobject objSwParams, jint nAvailMin) { snd_pcm_t* handle; snd_pcm_sw_params_t* swParams; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcm_setSWParamsAvailMin(): begin\n"); } handle = getHandle(env, obj); swParams = getSWParamsNativeHandle(env, objSwParams); nReturn = snd_pcm_sw_params_set_avail_min(handle, swParams, nAvailMin); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcm_setSWParamsAvailMin(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaPcm * Method: setSWParamsXferAlign * Signature: (Lorg/tritonus/lowlevel/alsa/AlsaPcm$SWParams;I)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaPcm_setSWParamsXferAlign (JNIEnv *env, jobject obj, jobject objSwParams, jint nXferAlign) { snd_pcm_t* handle; snd_pcm_sw_params_t* swParams; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcm_setSWParamsXferAlign(): begin\n"); } handle = getHandle(env, obj); swParams = getSWParamsNativeHandle(env, objSwParams); nReturn = snd_pcm_sw_params_set_xfer_align(handle, swParams, nXferAlign); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcm_setSWParamsXferAlign(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaPcm * Method: setSWParamsStartThreshold * Signature: (Lorg/tritonus/lowlevel/alsa/AlsaPcm$SWParams;I)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaPcm_setSWParamsStartThreshold (JNIEnv *env, jobject obj, jobject objSwParams, jint nStartThreshold) { snd_pcm_t* handle; snd_pcm_sw_params_t* swParams; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcm_setSWParamsStartThreshold(): begin\n"); } handle = getHandle(env, obj); swParams = getSWParamsNativeHandle(env, objSwParams); nReturn = snd_pcm_sw_params_set_start_threshold(handle, swParams, nStartThreshold); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcm_setSWParamsStartThreshold(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaPcm * Method: setSWParamsStopThreshold * Signature: (Lorg/tritonus/lowlevel/alsa/AlsaPcm$SWParams;I)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaPcm_setSWParamsStopThreshold (JNIEnv *env, jobject obj, jobject objSwParams, jint nStopThreshold) { snd_pcm_t* handle; snd_pcm_sw_params_t* swParams; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcm_setSWParamsStopThreshold(): begin\n"); } handle = getHandle(env, obj); swParams = getSWParamsNativeHandle(env, objSwParams); nReturn = snd_pcm_sw_params_set_stop_threshold(handle, swParams, nStopThreshold); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcm_setSWParamsStopThreshold(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaPcm * Method: setSWParamsSilenceThreshold * Signature: (Lorg/tritonus/lowlevel/alsa/AlsaPcm$SWParams;I)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaPcm_setSWParamsSilenceThreshold (JNIEnv *env, jobject obj, jobject objSwParams, jint nSilenceThreshold) { snd_pcm_t* handle; snd_pcm_sw_params_t* swParams; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcm_setSWParamsSilenceThreshold(): begin\n"); } handle = getHandle(env, obj); swParams = getSWParamsNativeHandle(env, objSwParams); nReturn = snd_pcm_sw_params_set_silence_threshold(handle, swParams, nSilenceThreshold); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcm_setSWParamsSilenceThreshold(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaPcm * Method: setSWParamsSilenceSize * Signature: (Lorg/tritonus/lowlevel/alsa/AlsaPcm$SWParams;I)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaPcm_setSWParamsSilenceSize (JNIEnv *env, jobject obj, jobject objSwParams, jint nSilenceSize) { snd_pcm_t* handle; snd_pcm_sw_params_t* swParams; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcm_setSWParamsSilenceSize(): begin\n"); } handle = getHandle(env, obj); swParams = getSWParamsNativeHandle(env, objSwParams); nReturn = snd_pcm_sw_params_set_silence_size(handle, swParams, nSilenceSize); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcm_setSWParamsSilenceSize(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaPcm * Method: setSWParams * Signature: (Lorg/tritonus/lowlevel/alsa/AlsaPcm$SWParams;)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaPcm_setSWParams (JNIEnv *env, jobject obj, jobject objSwParams) { snd_pcm_t* handle; snd_pcm_sw_params_t* swParams; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcm_setSWParams(): begin\n"); } handle = getHandle(env, obj); swParams = getSWParamsNativeHandle(env, objSwParams); nReturn = snd_pcm_sw_params(handle, swParams); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcm_setSWParams(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaPcm * Method: writei * Signature: ([BJJ)J */ JNIEXPORT jlong JNICALL Java_org_tritonus_lowlevel_alsa_AlsaPcm_writei (JNIEnv *env, jobject obj, jbyteArray abData, jlong lOffset, jlong lFrameCount) { snd_pcm_t* handle; signed char* data; snd_pcm_sframes_t lWritten; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcm_writei(): begin\n"); } handle = getHandle(env, obj); data = (*env)->GetByteArrayElements(env, abData, NULL); if (data == NULL) { throwRuntimeException(env, "GetByteArrayElements() failed"); } if (debug_flag) { printf("Java_org_tritonus_lowlevel_alsa_AlsaPcm_writei(): trying to write (frames): %lld\n", lFrameCount); } lWritten = snd_pcm_writei(handle, data + lOffset, lFrameCount); if (debug_flag) { printf("Java_org_tritonus_lowlevel_alsa_AlsaPcm_writei(): Written: %ld\n", lWritten); } // we can do a JNI_ABORT because we know the data wasn't altered. // This may improve performance (no copying back). (*env)->ReleaseByteArrayElements(env, abData, data, JNI_ABORT); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcm_writei(): end\n"); } return lWritten; } /* * Class: org_tritonus_lowlevel_alsa_AlsaPcm * Method: readi * Signature: ([BJJ)J */ JNIEXPORT jlong JNICALL Java_org_tritonus_lowlevel_alsa_AlsaPcm_readi (JNIEnv *env, jobject obj, jbyteArray abData, jlong lOffset, jlong lFrameCount) { snd_pcm_t* handle; signed char* data; snd_pcm_sframes_t lRead; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcm_readi(): begin\n"); } handle = getHandle(env, obj); data = (*env)->GetByteArrayElements(env, abData, NULL); printf("native array: %p\n", data); if (data == NULL) { throwRuntimeException(env, "GetByteArrayElements() failed"); } if (debug_flag) { printf("Java_org_tritonus_lowlevel_alsa_AlsaPcm_readi(): trying to read (frames): %lld\n", lFrameCount); } // To the ALSA method, frame count means number of complete PCM frames. // Frame: sample data vector for all channels. For 16 Bit stereo data, one frame has a length of four bytes. lRead = snd_pcm_readi(handle, data + lOffset, lFrameCount); if (debug_flag) { printf("Java_org_tritonus_lowlevel_alsa_AlsaPcm_readi(): Read: %ld\n", lRead); } // printf("1\n"); (*env)->ReleaseByteArrayElements(env, abData, data, 0); // printf("2\n"); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcm_readi(): end\n"); } return lRead; } /* * Class: org_tritonus_lowlevel_alsa_AlsaPcm * Method: setTrace * Signature: (Z)V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_alsa_AlsaPcm_setTrace (JNIEnv *env, jclass cls, jboolean bTrace) { debug_flag = bTrace; debug_file = stderr; } /*** org_tritonus_lowlevel_alsa_AlsaPcm.c ***/ libtritonus-java-20070428/src/lib/alsa/org_tritonus_lowlevel_alsa_AlsaPcmHWParams.c0000644000175000017500000006033407776243760030340 0ustar twernertwerner/* * org_tritonus_lowlevel_alsa_AlsaPcmHWParams.c */ /* * Copyright (c) 1999 - 2001 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "org_tritonus_lowlevel_alsa_AlsaPcmHWParams.h" #include "common.h" snd_pcm_format_mask_t* getFormatMaskNativeHandle(JNIEnv* env, jobject obj); HandleFieldHandler(snd_pcm_hw_params_t*) /* */ static void setDirection(JNIEnv* env, jint nDirection, jintArray anDirection) { if (anDirection != NULL) { checkArrayLength(env, anDirection, 1); (*env)->SetIntArrayRegion(env, anDirection, 0, 1, &nDirection); } } snd_pcm_hw_params_t* getHWParamsNativeHandle(JNIEnv* env, jobject obj) { return getHandle(env, obj); } /* * Class: org_tritonus_lowlevel_alsa_AlsaPcmHWParams * Method: malloc * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParams_malloc (JNIEnv* env, jobject obj) { snd_pcm_hw_params_t* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParams_malloc(): begin\n"); } nReturn = snd_pcm_hw_params_malloc(&handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParams_malloc(): handle: %p\n", handle); } setHandle(env, obj, handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParams_malloc(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaPcmHWParams * Method: free * Signature: ()V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParams_free (JNIEnv* env, jobject obj) { snd_pcm_hw_params_t* handle; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParams_free(): begin\n"); } handle = getHandle(env, obj); snd_pcm_hw_params_free(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParams_free(): end\n"); } } /* * Class: org_tritonus_lowlevel_alsa_AlsaPcmHWParams * Method: getRate * Signature: ([J)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParams_getRate___3J (JNIEnv* env, jobject obj, jlongArray alValues) { snd_pcm_hw_params_t* handle; int nReturn; unsigned int nNumerator; unsigned int nDenominator; jlong values[2]; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParams_getRate(): begin\n"); } handle = getHandle(env, obj); nReturn = snd_pcm_hw_params_get_rate_numden(handle, &nNumerator, &nDenominator); checkArrayLength(env, alValues, 2); values[0] = nNumerator; values[1] = nDenominator; (*env)->SetLongArrayRegion(env, alValues, 0, 2, values); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParams_getRate(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaPcmHWParams * Method: getSBits * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParams_getSBits (JNIEnv* env, jobject obj) { snd_pcm_hw_params_t* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParams_getSBits(): begin\n"); } handle = getHandle(env, obj); nReturn = snd_pcm_hw_params_get_sbits(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParams_getSBits(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaPcmHWParams * Method: getFifoSize * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParams_getFifoSize (JNIEnv* env, jobject obj) { snd_pcm_hw_params_t* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParams_getFifoSize(): begin\n"); } handle = getHandle(env, obj); nReturn = snd_pcm_hw_params_get_fifo_size(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParams_getFifoSize(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaPcmHWParams * Method: getAccess * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParams_getAccess (JNIEnv* env, jobject obj) { snd_pcm_hw_params_t* handle; snd_pcm_access_t access; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParams_getAccess(): begin\n"); } handle = getHandle(env, obj); nReturn = snd_pcm_hw_params_get_access(handle, &access); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParams_getAccess(): end\n"); } return access; } /* * Class: org_tritonus_lowlevel_alsa_AlsaPcmHWParams * Method: getFormat * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParams_getFormat (JNIEnv* env, jobject obj) { snd_pcm_hw_params_t* handle; snd_pcm_format_t nValue; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParams_getFormat(): begin\n"); } handle = getHandle(env, obj); nReturn = snd_pcm_hw_params_get_format(handle, &nValue); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParams_getFormat(): end\n"); } return nValue; } /* * Class: org_tritonus_lowlevel_alsa_AlsaPcmHWParams * Method: getFormatMask * Signature: (Lorg/tritonus/lowlevel/alsa/AlsaPcm$HWParams$FormatMask;)V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParams_getFormatMask (JNIEnv* env, jobject obj, jobject objFormatMask) { snd_pcm_hw_params_t* handle; snd_pcm_format_mask_t* formatMask; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParams_getFormatMask(): begin\n"); } handle = getHandle(env, obj); formatMask = getFormatMaskNativeHandle(env, objFormatMask); snd_pcm_hw_params_get_format_mask(handle, formatMask); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParams_getFormatMask(): end\n"); } } /* * Class: org_tritonus_lowlevel_alsa_AlsaPcmHWParams * Method: getSubformat * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParams_getSubformat (JNIEnv* env, jobject obj) { snd_pcm_hw_params_t* handle; snd_pcm_subformat_t nValue; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParams_getSubformat(): begin\n"); } handle = getHandle(env, obj); nReturn = snd_pcm_hw_params_get_subformat(handle, &nValue); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParams_getSubformat(): end\n"); } return nValue; } /* * Class: org_tritonus_lowlevel_alsa_AlsaPcmHWParams * Method: getChannels * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParams_getChannels (JNIEnv* env, jobject obj) { snd_pcm_hw_params_t* handle; unsigned int nValue; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParams_getChannels(): begin\n"); } handle = getHandle(env, obj); nReturn = snd_pcm_hw_params_get_channels(handle, &nValue); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParams_getChannels(): end\n"); } return nValue; } /* * Class: org_tritonus_lowlevel_alsa_AlsaPcmHWParams * Method: getChannelsMin * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParams_getChannelsMin (JNIEnv* env, jobject obj) { snd_pcm_hw_params_t* handle; unsigned int nValue; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParams_getChannelsMin(): begin\n"); } handle = getHandle(env, obj); nReturn = snd_pcm_hw_params_get_channels_min(handle, &nValue); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParams_getChannelsMin(): end\n"); } return nValue; } /* * Class: org_tritonus_lowlevel_alsa_AlsaPcmHWParams * Method: getChannelsMax * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParams_getChannelsMax (JNIEnv* env, jobject obj) { snd_pcm_hw_params_t* handle; unsigned int nValue; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParams_getChannelsMax(): begin\n"); } handle = getHandle(env, obj); nReturn = snd_pcm_hw_params_get_channels_max(handle, &nValue); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParams_getChannelsMax(): end\n"); } return nValue; } /* * Class: org_tritonus_lowlevel_alsa_AlsaPcmHWParams * Method: getRate * Signature: ([I)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParams_getRate___3I (JNIEnv* env, jobject obj, jintArray anDirection) { snd_pcm_hw_params_t* handle; int nReturn; unsigned int nValue; int nDirection; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParams_getRate(): begin\n"); } handle = getHandle(env, obj); nReturn = snd_pcm_hw_params_get_rate(handle, &nValue, &nDirection); setDirection(env, nDirection, anDirection); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParams_getRate(): end\n"); } return nValue; } /* * Class: org_tritonus_lowlevel_alsa_AlsaPcmHWParams * Method: getRateMin * Signature: ([I)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParams_getRateMin (JNIEnv* env, jobject obj, jintArray anDirection) { snd_pcm_hw_params_t* handle; int nReturn; unsigned int nValue; int nDirection; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParams_getRateMin(): begin\n"); } handle = getHandle(env, obj); nReturn = snd_pcm_hw_params_get_rate_min(handle, &nValue, &nDirection); setDirection(env, nDirection, anDirection); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParams_getRateMin(): end\n"); } return nValue; } /* * Class: org_tritonus_lowlevel_alsa_AlsaPcmHWParams * Method: getRateMax * Signature: ([I)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParams_getRateMax (JNIEnv* env, jobject obj, jintArray anDirection) { snd_pcm_hw_params_t* handle; int nReturn; unsigned int nValue; int nDirection; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParams_getRateMax(): begin\n"); } handle = getHandle(env, obj); nReturn = snd_pcm_hw_params_get_rate_max(handle, &nValue, &nDirection); setDirection(env, nDirection, anDirection); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParams_getRateMax(): end\n"); } return nValue; } /* * Class: org_tritonus_lowlevel_alsa_AlsaPcmHWParams * Method: getPeriodTime * Signature: ([I)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParams_getPeriodTime (JNIEnv* env, jobject obj, jintArray anDirection) { snd_pcm_hw_params_t* handle; int nReturn; unsigned int nValue; int nDirection; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParams_getPeriodTime(): begin\n"); } handle = getHandle(env, obj); nReturn = snd_pcm_hw_params_get_period_time(handle, &nValue, &nDirection); setDirection(env, nDirection, anDirection); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParams_getPeriodTime(): end\n"); } return nValue; } /* * Class: org_tritonus_lowlevel_alsa_AlsaPcmHWParams * Method: getPeriodTimeMin * Signature: ([I)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParams_getPeriodTimeMin (JNIEnv* env, jobject obj, jintArray anDirection) { snd_pcm_hw_params_t* handle; int nReturn; unsigned int nValue; int nDirection; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParams_getPeriodTimeMin(): begin\n"); } handle = getHandle(env, obj); nReturn = snd_pcm_hw_params_get_period_time_min(handle, &nValue, &nDirection); setDirection(env, nDirection, anDirection); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParams_getPeriodTimeMin(): end\n"); } return nValue; } /* * Class: org_tritonus_lowlevel_alsa_AlsaPcmHWParams * Method: getPeriodTimeMax * Signature: ([I)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParams_getPeriodTimeMax (JNIEnv* env, jobject obj, jintArray anDirection) { snd_pcm_hw_params_t* handle; int nReturn; unsigned int nValue; int nDirection; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParams_getPeriodTimeMax(): begin\n"); } handle = getHandle(env, obj); nReturn = snd_pcm_hw_params_get_period_time_max(handle, &nValue, &nDirection); setDirection(env, nDirection, anDirection); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParams_getPeriodTimeMax(): end\n"); } return nValue; } /* * Class: org_tritonus_lowlevel_alsa_AlsaPcmHWParams * Method: getPeriodSize * Signature: ([I)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParams_getPeriodSize (JNIEnv* env, jobject obj, jintArray anDirection) { snd_pcm_hw_params_t* handle; int nReturn; snd_pcm_uframes_t nValue; int nDirection; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParams_getPeriodSize(): begin\n"); } handle = getHandle(env, obj); nReturn = snd_pcm_hw_params_get_period_size(handle, &nValue, &nDirection); setDirection(env, nDirection, anDirection); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParams_getPeriodSize(): end\n"); } return nValue; } /* * Class: org_tritonus_lowlevel_alsa_AlsaPcmHWParams * Method: getPeriodSizeMin * Signature: ([I)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParams_getPeriodSizeMin (JNIEnv* env, jobject obj, jintArray anDirection) { snd_pcm_hw_params_t* handle; int nReturn; snd_pcm_uframes_t nValue; int nDirection; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParams_getPeriodSizeMin(): begin\n"); } handle = getHandle(env, obj); nReturn = snd_pcm_hw_params_get_period_size_min(handle, &nValue, &nDirection); setDirection(env, nDirection, anDirection); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParams_getPeriodSizeMin(): end\n"); } return nValue; } /* * Class: org_tritonus_lowlevel_alsa_AlsaPcmHWParams * Method: getPeriodSizeMax * Signature: ([I)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParams_getPeriodSizeMax (JNIEnv* env, jobject obj, jintArray anDirection) { snd_pcm_hw_params_t* handle; int nReturn; snd_pcm_uframes_t nValue; int nDirection; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParams_getPeriodSizeMax(): begin\n"); } handle = getHandle(env, obj); nReturn = snd_pcm_hw_params_get_period_size_max(handle, &nValue, &nDirection); setDirection(env, nDirection, anDirection); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParams_getPeriodSizeMax(): end\n"); } return nValue; } /* * Class: org_tritonus_lowlevel_alsa_AlsaPcmHWParams * Method: getPeriods * Signature: ([I)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParams_getPeriods (JNIEnv* env, jobject obj, jintArray anDirection) { snd_pcm_hw_params_t* handle; int nReturn; unsigned int nValue; int nDirection; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParams_getPeriods(): begin\n"); } handle = getHandle(env, obj); nReturn = snd_pcm_hw_params_get_periods(handle, &nValue, &nDirection); setDirection(env, nDirection, anDirection); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParams_getPeriods(): end\n"); } return nValue; } /* * Class: org_tritonus_lowlevel_alsa_AlsaPcmHWParams * Method: getPeriodsMin * Signature: ([I)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParams_getPeriodsMin (JNIEnv* env, jobject obj, jintArray anDirection) { snd_pcm_hw_params_t* handle; int nReturn; unsigned int nValue; int nDirection; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParams_getPeriodsMin(): begin\n"); } handle = getHandle(env, obj); nReturn = snd_pcm_hw_params_get_periods_min(handle, &nValue, &nDirection); setDirection(env, nDirection, anDirection); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParams_getPeriodsMin(): end\n"); } return nValue; } /* * Class: org_tritonus_lowlevel_alsa_AlsaPcmHWParams * Method: getPeriodsMax * Signature: ([I)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParams_getPeriodsMax (JNIEnv* env, jobject obj, jintArray anDirection) { snd_pcm_hw_params_t* handle; int nReturn; unsigned int nValue; int nDirection; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParams_getPeriodsMax(): begin\n"); } handle = getHandle(env, obj); nReturn = snd_pcm_hw_params_get_periods_max(handle, &nValue, &nDirection); setDirection(env, nDirection, anDirection); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParams_getPeriodsMax(): end\n"); } return nValue; } /* * Class: org_tritonus_lowlevel_alsa_AlsaPcmHWParams * Method: getBufferTime * Signature: ([I)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParams_getBufferTime (JNIEnv* env, jobject obj, jintArray anDirection) { snd_pcm_hw_params_t* handle; int nReturn; unsigned int nValue; int nDirection; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParams_getBufferTime(): begin\n"); } handle = getHandle(env, obj); nReturn = snd_pcm_hw_params_get_buffer_time(handle, &nValue, &nDirection); setDirection(env, nDirection, anDirection); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParams_getBufferTime(): end\n"); } return nValue; } /* * Class: org_tritonus_lowlevel_alsa_AlsaPcmHWParams * Method: getBufferTimeMin * Signature: ([I)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParams_getBufferTimeMin (JNIEnv* env, jobject obj, jintArray anDirection) { snd_pcm_hw_params_t* handle; int nReturn; unsigned int nValue; int nDirection; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParams_getBufferTimeMin(): begin\n"); } handle = getHandle(env, obj); nReturn = snd_pcm_hw_params_get_buffer_time_min(handle, &nValue, &nDirection); setDirection(env, nDirection, anDirection); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParams_getBufferTimeMin(): end\n"); } return nValue; } /* * Class: org_tritonus_lowlevel_alsa_AlsaPcmHWParams * Method: getBufferTimeMax * Signature: ([I)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParams_getBufferTimeMax (JNIEnv* env, jobject obj, jintArray anDirection) { snd_pcm_hw_params_t* handle; int nReturn; unsigned int nValue; int nDirection; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParams_getBufferTimeMax(): begin\n"); } handle = getHandle(env, obj); nReturn = snd_pcm_hw_params_get_buffer_time_max(handle, &nValue, &nDirection); setDirection(env, nDirection, anDirection); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParams_getBufferTimeMax(): end\n"); } return nValue; } /* * Class: org_tritonus_lowlevel_alsa_AlsaPcmHWParams * Method: getBufferSize * Signature: ([I)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParams_getBufferSize (JNIEnv* env, jobject obj) { snd_pcm_hw_params_t* handle; snd_pcm_uframes_t nValue; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParams_getBufferSize(): begin\n"); } handle = getHandle(env, obj); nReturn = snd_pcm_hw_params_get_buffer_size(handle, &nValue); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParams_getBufferSize(): end\n"); } return nValue; } /* * Class: org_tritonus_lowlevel_alsa_AlsaPcmHWParams * Method: getBufferSizeMin * Signature: ([I)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParams_getBufferSizeMin (JNIEnv* env, jobject obj) { snd_pcm_hw_params_t* handle; snd_pcm_uframes_t nValue; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParams_getBufferSizeMin(): begin\n"); } handle = getHandle(env, obj); nReturn = snd_pcm_hw_params_get_buffer_size_min(handle, &nValue); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParams_getBufferSizeMin(): end\n"); } return nValue; } /* * Class: org_tritonus_lowlevel_alsa_AlsaPcmHWParams * Method: getBufferSizeMax * Signature: ([I)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParams_getBufferSizeMax (JNIEnv* env, jobject obj) { snd_pcm_hw_params_t* handle; snd_pcm_uframes_t nValue; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParams_getBufferSizeMax(): begin\n"); } handle = getHandle(env, obj); nReturn = snd_pcm_hw_params_get_buffer_size_max(handle, &nValue); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParams_getBufferSizeMax(): end\n"); } return nValue; } /* * Class: org_tritonus_lowlevel_alsa_AlsaPcmHWParams * Method: getTickTime * Signature: ([I)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParams_getTickTime (JNIEnv* env, jobject obj, jintArray anDirection) { snd_pcm_hw_params_t* handle; int nReturn; unsigned int nValue; int nDirection; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParams_getTickTime(): begin\n"); } handle = getHandle(env, obj); nReturn = snd_pcm_hw_params_get_tick_time(handle, &nValue, &nDirection); setDirection(env, nDirection, anDirection); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParams_getTickTime(): end\n"); } return nValue; } /* * Class: org_tritonus_lowlevel_alsa_AlsaPcmHWParams * Method: getTickTimeMin * Signature: ([I)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParams_getTickTimeMin (JNIEnv* env, jobject obj, jintArray anDirection) { snd_pcm_hw_params_t* handle; int nReturn; unsigned int nValue; int nDirection; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParams_getTickTimeMin(): begin\n"); } handle = getHandle(env, obj); nReturn = snd_pcm_hw_params_get_tick_time_min(handle, &nValue, &nDirection); setDirection(env, nDirection, anDirection); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParams_getTickTimeMin(): end\n"); } return nValue; } /* * Class: org_tritonus_lowlevel_alsa_AlsaPcmHWParams * Method: getTickTimeMax * Signature: ([I)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParams_getTickTimeMax (JNIEnv* env, jobject obj, jintArray anDirection) { snd_pcm_hw_params_t* handle; int nReturn; unsigned int nValue; int nDirection; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParams_getTickTimeMax(): begin\n"); } handle = getHandle(env, obj); nReturn = snd_pcm_hw_params_get_tick_time_max(handle, &nValue, &nDirection); setDirection(env, nDirection, anDirection); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParams_getTickTimeMax(): end\n"); } return nValue; } /*** org_tritonus_lowlevel_alsa_AlsaPcmHWParams.c ***/ libtritonus-java-20070428/src/lib/alsa/org_tritonus_lowlevel_alsa_AlsaPcmHWParamsFormatMask.c0000644000175000017500000001266407600436725032317 0ustar twernertwerner/* * org_tritonus_lowlevel_alsa_AlsaPcmHWParamsFormatMask.c */ /* * Copyright (c) 1999 - 2001 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "common.h" #include "org_tritonus_lowlevel_alsa_AlsaPcmHWParamsFormatMask.h" HandleFieldHandler(snd_pcm_format_mask_t*) snd_pcm_format_mask_t* getFormatMaskNativeHandle(JNIEnv *env, jobject obj) { return getHandle(env, obj); } /* * Class: org_tritonus_lowlevel_alsa_AlsaPcmHWParamsFormatMask * Method: malloc * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParamsFormatMask_malloc (JNIEnv *env, jobject obj) { snd_pcm_format_mask_t* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParamsFormatMask_malloc(): begin\n"); } nReturn = snd_pcm_format_mask_malloc(&handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParamsFormatMask_malloc(): handle: %p\n", handle); } setHandle(env, obj, handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParamsFormatMask_malloc(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaPcmHWParamsFormatMask * Method: free * Signature: ()V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParamsFormatMask_free (JNIEnv *env, jobject obj) { snd_pcm_format_mask_t* handle; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParamsFormatMask_free(): begin\n"); } handle = getHandle(env, obj); snd_pcm_format_mask_free(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParamsFormatMask_free(): end\n"); } } //------------- /* * Class: org_tritonus_lowlevel_alsa_AlsaPcmHWParamsFormatMask * Method: none * Signature: ()V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParamsFormatMask_none (JNIEnv *env, jobject obj) { snd_pcm_format_mask_t* handle; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParamsFormatMask_none(): begin\n"); } handle = getHandle(env, obj); snd_pcm_format_mask_none(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParamsFormatMask_none(): end\n"); } } /* * Class: org_tritonus_lowlevel_alsa_AlsaPcmHWParamsFormatMask * Method: any * Signature: ()V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParamsFormatMask_any (JNIEnv *env, jobject obj) { snd_pcm_format_mask_t* handle; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParamsFormatMask_any(): begin\n"); } handle = getHandle(env, obj); snd_pcm_format_mask_any(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParamsFormatMask_any(): end\n"); } } /* * Class: org_tritonus_lowlevel_alsa_AlsaPcmHWParamsFormatMask * Method: test * Signature: (I)Z */ JNIEXPORT jboolean JNICALL Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParamsFormatMask_test (JNIEnv *env, jobject obj, jint nFormat) { snd_pcm_format_mask_t* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParamsFormatMask_test(): begin\n"); } handle = getHandle(env, obj); nReturn = snd_pcm_format_mask_test(handle, (snd_pcm_format_t) nFormat); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParamsFormatMask_test(): end\n"); } return (jboolean) nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaPcmHWParamsFormatMask * Method: set * Signature: (I)V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParamsFormatMask_set (JNIEnv *env, jobject obj, jint nFormat) { snd_pcm_format_mask_t* handle; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParamsFormatMask_set(): begin\n"); } handle = getHandle(env, obj); snd_pcm_format_mask_set(handle, (snd_pcm_format_t) nFormat); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParamsFormatMask_set(): end\n"); } } /* * Class: org_tritonus_lowlevel_alsa_AlsaPcmHWParamsFormatMask * Method: reset * Signature: (I)V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParamsFormatMask_reset (JNIEnv *env, jobject obj, jint nFormat) { snd_pcm_format_mask_t* handle; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParamsFormatMask_reset(): begin\n"); } handle = getHandle(env, obj); snd_pcm_format_mask_reset(handle, (snd_pcm_format_t) nFormat); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcmHWParamsFormatMask_reset(): end\n"); } } /*** org_tritonus_lowlevel_alsa_AlsaPcmHWParamsFormatMask.c ***/ libtritonus-java-20070428/src/lib/alsa/org_tritonus_lowlevel_alsa_AlsaPcmSWParams.c0000644000175000017500000001452107776243760030350 0ustar twernertwerner/* * org_tritonus_lowlevel_alsa_AlsaPcmSWParams.c */ /* * Copyright (c) 1999 - 2001 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "common.h" #include "org_tritonus_lowlevel_alsa_AlsaPcmSWParams.h" HandleFieldHandler(snd_pcm_sw_params_t*) snd_pcm_sw_params_t* getSWParamsNativeHandle(JNIEnv *env, jobject obj) { return getHandle(env, obj); } /* * Class: org_tritonus_lowlevel_alsa_AlsaPcmSWParams * Method: malloc * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaPcmSWParams_malloc (JNIEnv *env, jobject obj) { snd_pcm_sw_params_t* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcmSWParams_malloc(): begin\n"); } nReturn = snd_pcm_sw_params_malloc(&handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcmSWParams_malloc(): handle: %p\n", handle); } setHandle(env, obj, handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcmSWParams_malloc(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaPcmSWParams * Method: free * Signature: ()V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_alsa_AlsaPcmSWParams_free (JNIEnv *env, jobject obj) { snd_pcm_sw_params_t* handle; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcmSWParams_free(): begin\n"); } handle = getHandle(env, obj); snd_pcm_sw_params_free(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaPcmSWParams_free(): end\n"); } } /* * Class: org_tritonus_lowlevel_alsa_AlsaPcmSWParams * Method: getStartMode * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaPcmSWParams_getStartMode (JNIEnv *env, jobject obj) { snd_pcm_sw_params_t* handle; int nReturn; handle = getHandle(env, obj); nReturn = snd_pcm_sw_params_get_start_mode(handle); return nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaPcmSWParams * Method: getXrunMode * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaPcmSWParams_getXrunMode (JNIEnv *env, jobject obj) { snd_pcm_sw_params_t* handle; int nReturn; handle = getHandle(env, obj); nReturn = snd_pcm_sw_params_get_xrun_mode(handle); return nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaPcmSWParams * Method: getTStampMode * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaPcmSWParams_getTStampMode (JNIEnv *env, jobject obj) { snd_pcm_sw_params_t* handle; snd_pcm_tstamp_t nValue; int nReturn; handle = getHandle(env, obj); nReturn = snd_pcm_sw_params_get_tstamp_mode(handle, &nValue); return nValue; } /* * Class: org_tritonus_lowlevel_alsa_AlsaPcmSWParams * Method: getSleepMin * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaPcmSWParams_getSleepMin (JNIEnv *env, jobject obj) { snd_pcm_sw_params_t* handle; unsigned int nValue; int nReturn; handle = getHandle(env, obj); nReturn = snd_pcm_sw_params_get_sleep_min(handle, &nValue); return nValue; } /* * Class: org_tritonus_lowlevel_alsa_AlsaPcmSWParams * Method: getAvailMin * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaPcmSWParams_getAvailMin (JNIEnv *env, jobject obj) { snd_pcm_sw_params_t* handle; snd_pcm_uframes_t nValue; int nReturn; handle = getHandle(env, obj); nReturn = snd_pcm_sw_params_get_avail_min(handle, &nValue); return nValue; } /* * Class: org_tritonus_lowlevel_alsa_AlsaPcmSWParams * Method: getXferAlign * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaPcmSWParams_getXferAlign (JNIEnv *env, jobject obj) { snd_pcm_sw_params_t* handle; snd_pcm_uframes_t nValue; int nReturn; handle = getHandle(env, obj); nReturn = snd_pcm_sw_params_get_xfer_align(handle, &nValue); return nValue; } /* * Class: org_tritonus_lowlevel_alsa_AlsaPcmSWParams * Method: getStartThreshold * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaPcmSWParams_getStartThreshold (JNIEnv *env, jobject obj) { snd_pcm_sw_params_t* handle; snd_pcm_uframes_t nValue; int nReturn; handle = getHandle(env, obj); nReturn = snd_pcm_sw_params_get_start_threshold(handle, &nValue); return nValue; } /* * Class: org_tritonus_lowlevel_alsa_AlsaPcmSWParams * Method: getStopThreshold * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaPcmSWParams_getStopThreshold (JNIEnv *env, jobject obj) { snd_pcm_sw_params_t* handle; snd_pcm_uframes_t nValue; int nReturn; handle = getHandle(env, obj); nReturn = snd_pcm_sw_params_get_stop_threshold(handle, &nValue); return nValue; } /* * Class: org_tritonus_lowlevel_alsa_AlsaPcmSWParams * Method: getSilenceThreshold * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaPcmSWParams_getSilenceThreshold (JNIEnv *env, jobject obj) { snd_pcm_sw_params_t* handle; snd_pcm_uframes_t nValue; int nReturn; handle = getHandle(env, obj); nReturn = snd_pcm_sw_params_get_silence_threshold(handle, &nValue); return nValue; } /* * Class: org_tritonus_lowlevel_alsa_AlsaPcmSWParams * Method: getSilenceSize * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaPcmSWParams_getSilenceSize (JNIEnv *env, jobject obj) { snd_pcm_sw_params_t* handle; snd_pcm_uframes_t nValue; int nReturn; handle = getHandle(env, obj); nReturn = snd_pcm_sw_params_get_silence_size(handle, &nValue); return nValue; } /*** org_tritonus_lowlevel_alsa_AlsaPcmSWParams.c ***/ libtritonus-java-20070428/src/lib/alsa/org_tritonus_lowlevel_alsa_AlsaSeq.c0000644000175000017500000011561607753244416026744 0ustar twernertwerner/* * org_tritonus_lowlevel_alsa_AlsaSeq.c */ /* * Copyright (c) 1999 - 2001 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "common.h" #include "org_tritonus_lowlevel_alsa_AlsaSeq.h" #include "constants_check.h" HandleFieldHandler(snd_seq_t*) snd_seq_client_info_t* getClientInfoNativeHandle(JNIEnv* env, jobject obj); snd_seq_event_t* getEventNativeHandle(JNIEnv* env, jobject obj); snd_seq_port_info_t* getPortInfoNativeHandle(JNIEnv* env, jobject obj); snd_seq_port_subscribe_t* getPortSubscribeNativeHandle(JNIEnv* env, jobject obj); snd_seq_queue_info_t* getQueueInfoNativeHandle(JNIEnv* env, jobject obj); snd_seq_queue_status_t* getQueueStatusNativeHandle(JNIEnv* env, jobject obj); snd_seq_queue_tempo_t* getQueueTempoNativeHandle(JNIEnv* env, jobject obj); snd_seq_queue_timer_t* getQueueTimerNativeHandle(JNIEnv* env, jobject obj); snd_seq_remove_events_t* getRemoveEventsNativeHandle(JNIEnv* env, jobject obj); snd_seq_system_info_t* getSystemInfoNativeHandle(JNIEnv *env, jobject obj); /* * Class: org_tritonus_lowlevel_alsa_AlsaSeq * Method: open * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeq_open (JNIEnv* env, jobject obj) { snd_seq_t* seq; int nReturn; if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeq_open(): begin\n"); } check_constants(); nReturn = snd_seq_open(&seq, "hw", SND_SEQ_OPEN_DUPLEX, 0); if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeq_open(): snd_seq_open() returns: %d\n", nReturn); } if (nReturn < 0) { throwRuntimeException(env, "snd_seq_open() failed"); } setHandle(env, obj, seq); if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeq_open(): end\n"); } return (jint) nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeq * Method: close * Signature: ()V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeq_close (JNIEnv* env, jobject obj) { snd_seq_t* seq; int nReturn; if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeq_close(): begin\n"); } seq = getHandle(env, obj); if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeq_close(): now closing ALSA seq (client %d)\n", snd_seq_client_id(seq)); } nReturn = snd_seq_close(seq); if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeq_close(): closed\n"); } if (nReturn < 0) { throwRuntimeException(env, "snd_seq_close() failed"); } if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeq_close(): end\n"); } } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeq * Method: getName * Signature: ()Ljava/lang/String; */ JNIEXPORT jstring JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeq_getName (JNIEnv* env, jobject obj) { snd_seq_t* seq; const char* pName; jstring strName; if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeq_getName(): begin\n"); } seq = getHandle(env, obj); pName = snd_seq_name(seq); if (pName == NULL) { throwRuntimeException(env, "snd_seq_name() failed"); } strName = (*env)->NewStringUTF(env, pName); // TODO: check return value if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeq_getName(): end\n"); } return strName; } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeq * Method: getType * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeq_getType (JNIEnv* env, jobject obj) { snd_seq_t* seq; int nReturn; if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeq_getType(): begin\n"); } seq = getHandle(env, obj); nReturn = snd_seq_type(seq); if (nReturn < 0) { throwRuntimeException(env, "snd_seq_type() failed"); } if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeq_getType(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeq * Method: setNonblock * Signature: (Z)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeq_setNonblock (JNIEnv* env, jobject obj, jboolean bNonblock) { snd_seq_t* seq; int nReturn; if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeq_setNonblock(): begin\n"); } seq = getHandle(env, obj); nReturn = snd_seq_nonblock(seq, bNonblock); if (nReturn < 0) { throwRuntimeException(env, "snd_seq_nonblock() failed"); } if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeq_setNonblock(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeq * Method: getClientId * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeq_getClientId (JNIEnv* env, jobject obj) { snd_seq_t* seq; int nReturn; if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeq_getClientId(): begin\n"); } seq = getHandle(env, obj); nReturn = snd_seq_client_id(seq); if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeq_getClientId(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeq * Method: getOutputBufferSize * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeq_getOutputBufferSize (JNIEnv* env, jobject obj) { snd_seq_t* seq; int nReturn; if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeq_getOutputBufferSize(): begin\n"); } seq = getHandle(env, obj); nReturn = snd_seq_get_output_buffer_size(seq); if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeq_getOutputBufferSize(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeq * Method: getInputBufferSize * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeq_getInputBufferSize (JNIEnv* env, jobject obj) { snd_seq_t* seq; int nReturn; if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeq_getInputBufferSize(): begin\n"); } seq = getHandle(env, obj); nReturn = snd_seq_get_input_buffer_size(seq); if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeq_getInputBufferSize(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeq * Method: setOutputBufferSize * Signature: (I)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeq_setOutputBufferSize (JNIEnv* env, jobject obj, jint nBufferSize) { snd_seq_t* seq; int nReturn; if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeq_setOutputBufferSize(): begin\n"); } seq = getHandle(env, obj); nReturn = snd_seq_set_output_buffer_size(seq, nBufferSize); if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeq_setOutputBufferSize(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeq * Method: setInputBufferSize * Signature: (I)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeq_setInputBufferSize (JNIEnv* env, jobject obj, jint nBufferSize) { snd_seq_t* seq; int nReturn; if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeq_setInputBufferSize(): begin\n"); } seq = getHandle(env, obj); nReturn = snd_seq_set_input_buffer_size(seq, nBufferSize); if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeq_setInputBufferSize(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeq * Method: getSystemInfo * Signature: (Lorg/tritonus/lowlevel/alsa/AlsaSeq$SystemInfo;)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeq_getSystemInfo (JNIEnv* env, jobject obj, jobject systemInfoObj) { snd_seq_t* seq; snd_seq_system_info_t* systemInfo; int nReturn; if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeq_getSystemInfo(): begin\n"); } seq = getHandle(env, obj); systemInfo = getSystemInfoNativeHandle(env, systemInfoObj); nReturn = snd_seq_system_info(seq, systemInfo); if (nReturn < 0) { throwRuntimeException(env, "snd_seq_system_info() failed"); } if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeq_getSystemInfo(): end\n"); } return (jint) nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeq * Method: getClientInfo * Signature: (ILorg/tritonus/lowlevel/alsa/AlsaSeq$ClientInfo;)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeq_getClientInfo (JNIEnv* env, jobject obj, jint nClient, jobject clientInfoObj) { snd_seq_t* seq; snd_seq_client_info_t* clientInfo; int nReturn; if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeq_getClientInfo(): begin\n"); } seq = getHandle(env, obj); clientInfo = getClientInfoNativeHandle(env, clientInfoObj); if (nClient >= 0) { nReturn = snd_seq_get_any_client_info(seq, nClient, clientInfo); } else { nReturn = snd_seq_get_client_info(seq, clientInfo); } if (nReturn < 0) { throwRuntimeException(env, "snd_seq_get_client_info() failed"); } if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeq_getClientInfo(): end\n"); } return (jint) nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeq * Method: setClientInfo * Signature: (Lorg/tritonus/lowlevel/alsa/AlsaSeq$ClientInfo;)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeq_setClientInfo (JNIEnv* env, jobject obj, jobject clientInfoObj) { snd_seq_t* seq; snd_seq_client_info_t* clientInfo; int nReturn; if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeq_setClientInfo(): begin\n"); } seq = getHandle(env, obj); clientInfo = getClientInfoNativeHandle(env, clientInfoObj); nReturn = snd_seq_set_client_info(seq, clientInfo); if (nReturn < 0) { throwRuntimeException(env, "snd_seq_set_client_info() failed"); } if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeq_setClientInfo(): end\n"); } return (jint) nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeq * Method: getNextClient * Signature: (I[I)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeq_getNextClient (JNIEnv* env, jobject obj, jint nClient, jintArray anValues) { snd_seq_t* seq; snd_seq_client_info_t* clientInfo; int nReturn; if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeq_getNextClient(): begin\n"); } if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeq_getNextClient(): passed client: %d\n", (int) nClient); } seq = getHandle(env, obj); snd_seq_client_info_alloca(&clientInfo); snd_seq_client_info_set_client(clientInfo, nClient); nReturn = snd_seq_query_next_client(seq, clientInfo); if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeq_getNextClient(): return value from snd_seq_query_next_client(): %d\n", nReturn); } if (nReturn < 0) { // -2 (no such file or directory): returned when no more client is available if (nReturn != -2) { throwRuntimeException(env, "snd_seq_query_next_client() failed"); } } else { jint nThisClient; checkArrayLength(env, anValues, 1); nThisClient = snd_seq_client_info_get_client(clientInfo); (*env)->SetIntArrayRegion(env, anValues, 0, 1, &nThisClient); } if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeq_getNextClient(): end\n"); } return (jint) nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeq * Method: getPortInfo * Signature: (IILorg/tritonus/lowlevel/alsa/AlsaSeq$PortInfo;)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeq_getPortInfo (JNIEnv* env, jobject obj, jint nClient, jint nPort, jobject portInfoObj) { snd_seq_t* seq; snd_seq_port_info_t* portInfo; int nReturn; if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeq_getPortInfo(): begin\n"); } seq = getHandle(env, obj); portInfo = getPortInfoNativeHandle(env, portInfoObj); if (nClient >= 0) { nReturn = snd_seq_get_any_port_info(seq, nClient, nPort, portInfo); } else { nReturn = snd_seq_get_port_info(seq, nPort, portInfo); } if (nReturn < 0) { throwRuntimeException(env, "snd_seq_get_[any]_port_info() failed"); } if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeq_getPortInfo(): end\n"); } return (jint) nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeq * Method: getNextPort * Signature: (II[I)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeq_getNextPort (JNIEnv* env, jobject obj, jint nClient, jint nPort, jintArray anValues) { snd_seq_t* seq; snd_seq_port_info_t* portInfo; int nReturn; if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeq_getNextPort(): begin\n"); } seq = getHandle(env, obj); snd_seq_port_info_alloca(&portInfo); snd_seq_port_info_set_client(portInfo, nClient); snd_seq_port_info_set_port(portInfo, nPort); nReturn = snd_seq_query_next_port(seq, portInfo); if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeq_getNextPort(): snd_seq_query_next_port() returns: %d\n", nReturn); } if (nReturn < 0) { // -2 (no such file or directory): returned when no more port is available if (nReturn != -2) { throwRuntimeException(env, "snd_seq_query_next_port() failed"); } } else { jint pnValues[2]; checkArrayLength(env, anValues, 2); pnValues[0] = snd_seq_port_info_get_client(portInfo); pnValues[1] = snd_seq_port_info_get_port(portInfo); (*env)->SetIntArrayRegion(env, anValues, 0, 2, pnValues); } if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeq_getNextPort(): end\n"); } return (jint) nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeq * Method: createPort * Signature: (Ljava/lang/String;IIIIII)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeq_createPort (JNIEnv* env, jobject obj, jstring strName, jint nCapabilities, jint nGroupPermissions, jint nType, jint nMidiChannels, jint nMidiVoices, jint nSynthVoices) { snd_seq_t* seq; snd_seq_port_info_t* portInfo; const char* name; int nReturn; int nPort; if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeq_createPort(): begin\n"); } snd_seq_port_info_alloca(&portInfo); seq = getHandle(env, obj); // TODO: check if another action is required instead // memset(&portInfo, 0, sizeof(portInfo)); name = (*env)->GetStringUTFChars(env, strName, NULL); if (name == NULL) { throwRuntimeException(env, "GetStringUTFChars() failed"); } snd_seq_port_info_set_name(portInfo, name); (*env)->ReleaseStringUTFChars(env, strName, name); snd_seq_port_info_set_capability(portInfo, nCapabilities); snd_seq_port_info_set_port(portInfo, nGroupPermissions); snd_seq_port_info_set_type(portInfo, nType); snd_seq_port_info_set_midi_channels(portInfo, nMidiChannels); snd_seq_port_info_set_midi_voices(portInfo, nMidiVoices); snd_seq_port_info_set_synth_voices(portInfo, nSynthVoices); //portInfo.write_use = 1; // R/O attrs? //portInfo.read_use = 1; // errno = 0; nReturn = snd_seq_create_port(seq, portInfo); if (nReturn < 0) { throwRuntimeException(env, "snd_seq_create_port() failed"); } nPort = snd_seq_port_info_get_port(portInfo); if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeq_createPort(): end\n"); } return (jint) nPort; } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeq * Method: allocQueue * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeq_allocQueue (JNIEnv* env, jobject obj) { snd_seq_t* seq; int nQueue; if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeq_allocQueue(): begin\n"); } seq = getHandle(env, obj); nQueue = snd_seq_alloc_queue(seq); if (nQueue < 0) { throwRuntimeException(env, "snd_seq_alloc_queue() failed"); } // snd_seq_queue_timer_t* timer; // const snd_timer_id_t* id; // snd_seq_queue_timer_alloca(&timer); // snd_seq_get_queue_timer(seq, nQueue, timer); // id = snd_seq_queue_timer_get_id(timer); // if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeq_allocQueue(): timer resolution: %d\n", snd_seq_queue_timer_get_resolution(timer)); } if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeq_allocQueue(): end\n"); } return (jint) nQueue; } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeq * Method: freeQueue * Signature: (I)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeq_freeQueue (JNIEnv* env, jobject obj, jint nQueue) { snd_seq_t* seq; int nReturn; if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeq_freeQueue(): begin\n"); } seq = getHandle(env, obj); nReturn = snd_seq_free_queue(seq, nQueue); if (nReturn < 0) { throwRuntimeException(env, "snd_seq_free_queue() failed"); } if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeq_freeQueue(): end\n"); } return (jint) nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeq * Method: getQueueUsage * Signature: (I)Z */ JNIEXPORT jboolean JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeq_getQueueUsage (JNIEnv* env, jobject obj, jint nQueue) { snd_seq_t* seq; int nReturn; if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeq_getQueueUsage(): begin\n"); } seq = getHandle(env, obj); nReturn = snd_seq_get_queue_usage(seq, nQueue); if (nReturn < 0) { throwRuntimeException(env, "snd_seq_get_queue_usage() failed"); } if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeq_getQueueUsage(): end\n"); } return (jboolean) nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeq * Method: setQueueUsage * Signature: (IZ)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeq_setQueueUsage (JNIEnv* env, jobject obj, jint nQueue, jboolean bUsageAllowed) { snd_seq_t* seq; int nReturn; if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeq_setQueueUsage(): begin\n"); } seq = getHandle(env, obj); nReturn = snd_seq_set_queue_usage(seq, nQueue, bUsageAllowed); if (nReturn < 0) { throwRuntimeException(env, "snd_seq_set_queue_usage() failed"); } if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeq_setQueueUsage(): end\n"); } return (jint) nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeq * Method: getQueueInfo * Signature: (ILorg/tritonus/lowlevel/alsa/AlsaSeq$QueueInfo;)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeq_getQueueInfo (JNIEnv* env, jobject obj, jint nQueue, jobject queueInfoObj) { snd_seq_t* seq; snd_seq_queue_info_t* queueInfo; int nReturn; if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeq_getQueueInfo(): begin\n"); } seq = getHandle(env, obj); queueInfo = getQueueInfoNativeHandle(env, queueInfoObj); nReturn = snd_seq_get_queue_info(seq, nQueue, queueInfo); if (nReturn < 0) { throwRuntimeException(env, "snd_seq_get_queue_info() failed"); } if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeq_getQueueInfo(): end\n"); } return (jint) nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeq * Method: setQueueInfo * Signature: (ILorg/tritonus/lowlevel/alsa/AlsaSeq$QueueInfo;)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeq_setQueueInfo (JNIEnv* env, jobject obj, jint nQueue, jobject queueInfoObj) { snd_seq_t* seq; snd_seq_queue_info_t* queueInfo; int nReturn; if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeq_setQueueInfo(): begin\n"); } seq = getHandle(env, obj); queueInfo = getQueueInfoNativeHandle(env, queueInfoObj); nReturn = snd_seq_set_queue_info(seq, nQueue, queueInfo); if (nReturn < 0) { throwRuntimeException(env, "snd_seq_set_queue_info() failed"); } if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeq_setQueueInfo(): end\n"); } return (jint) nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeq * Method: getQueueStatus * Signature: (ILorg/tritonus/lowlevel/alsa/AlsaSeq$QueueStatus;)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeq_getQueueStatus (JNIEnv* env, jobject obj, jint nQueue, jobject queueStatusObj) { snd_seq_t* seq; snd_seq_queue_status_t* queueStatus; int nReturn; if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeq_getQueueStatus(): begin\n"); } seq = getHandle(env, obj); queueStatus = getQueueStatusNativeHandle(env, queueStatusObj); nReturn = snd_seq_get_queue_status(seq, nQueue, queueStatus); if (nReturn < 0) { throwRuntimeException(env, "snd_seq_get_queue_status() failed"); } if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeq_getQueueStatus(): end\n"); } return (jint) nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeq * Method: getQueueTempo * Signature: (ILorg/tritonus/lowlevel/alsa/AlsaSeq$QueueTempo;)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeq_getQueueTempo (JNIEnv* env, jobject obj, jint nQueue, jobject queueTempoObj) { snd_seq_t* seq; snd_seq_queue_tempo_t* pQueueTempo; int nReturn; if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeq_getQueueTempo(): begin\n"); } seq = getHandle(env, obj); pQueueTempo = getQueueTempoNativeHandle(env, queueTempoObj); nReturn = snd_seq_get_queue_tempo(seq, nQueue, pQueueTempo); if (nReturn < 0) { throwRuntimeException(env, "snd_seq_get_queue_tempo() failed"); } if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeq_getQueueTempo(): end\n"); } return (jint) nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeq * Method: setQueueTempo * Signature: (ILorg/tritonus/lowlevel/alsa/AlsaSeq$QueueTempo;)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeq_setQueueTempo (JNIEnv* env, jobject obj, jint nQueue, jobject queueTempoObj) { snd_seq_t* seq; snd_seq_queue_tempo_t* pQueueTempo; int nReturn; if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeq_setQueueTempo(): begin\n"); } seq = getHandle(env, obj); pQueueTempo = getQueueTempoNativeHandle(env, queueTempoObj); //fprintf(debug_file, "pQueueTempo: %p\n", pQueueTempo); fflush(debug_file); nReturn = snd_seq_set_queue_tempo(seq, nQueue, pQueueTempo); if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeq_setQueueTempo(): snd_seq_set_queue_tempo() returns %d\n", nReturn); } if (nReturn < 0) { //throwRuntimeException(env, "snd_seq_set_queue_tempo() failed"); throwRuntimeException(env, snd_strerror(nReturn)); } if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeq_setQueueTempo(): end\n"); } return (jint) nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeq * Method: getQueueTimer * Signature: (ILorg/tritonus/lowlevel/alsa/AlsaSeq$QueueTimer;)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeq_getQueueTimer (JNIEnv* env, jobject obj, jint nQueue, jobject queueTimerObj) { snd_seq_t* seq; snd_seq_queue_timer_t* pQueueTimer; int nReturn; if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeq_getQueueTimer(): begin\n"); } seq = getHandle(env, obj); // TODO: implement timer API, then re-enable pQueueTimer = NULL; // getQueueTimerNativeHandle(env, queueTimerObj); nReturn = snd_seq_get_queue_timer(seq, nQueue, pQueueTimer); if (nReturn < 0) { throwRuntimeException(env, "snd_seq_get_queue_timer() failed"); } if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeq_getQueueTimer(): end\n"); } return (jint) nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeq * Method: setQueueTimer * Signature: (ILorg/tritonus/lowlevel/alsa/AlsaSeq$QueueTimer;)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeq_setQueueTimer (JNIEnv* env, jobject obj, jint nQueue, jobject queueTimerObj) { snd_seq_t* seq; snd_seq_queue_timer_t* pQueueTimer; int nReturn; if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeq_setQueueTimer(): begin\n"); } seq = getHandle(env, obj); // TODO: pQueueTimer = NULL; // getQueueTimerNativeHandle(env, queueTimerObj); nReturn = snd_seq_set_queue_timer(seq, nQueue, pQueueTimer); if (nReturn < 0) { throwRuntimeException(env, "snd_seq_set_queue_timer() failed"); } if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeq_setQueueTimer(): end\n"); } return (jint) nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeq * Method: getPortSubscription * Signature: (Lorg/tritonus/lowlevel/alsa/AlsaSeq$PortSubscribe;)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeq_getPortSubscription (JNIEnv* env, jobject obj, jobject portSubscribeObj) { snd_seq_t* seq; snd_seq_port_subscribe_t* pPortSubscribe; int nReturn; if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeq_getPortSubscription(): begin\n"); } seq = getHandle(env, obj); pPortSubscribe = getPortSubscribeNativeHandle(env, portSubscribeObj); nReturn = snd_seq_get_port_subscription(seq, pPortSubscribe); if (nReturn < 0) { throwRuntimeException(env, "snd_seq_get_port_subscription() failed"); } if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeq_getPortSubscription(): end\n"); } return (jint) nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeq * Method: subscribePort * Signature: (Lorg/tritonus/lowlevel/alsa/AlsaSeq$PortSubscribe;)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeq_subscribePort (JNIEnv* env, jobject obj, jobject portSubscribeObj) { snd_seq_t* seq; snd_seq_port_subscribe_t* pPortSubscribe; int nReturn; if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeq_subscribePort(): begin\n"); } seq = getHandle(env, obj); pPortSubscribe = getPortSubscribeNativeHandle(env, portSubscribeObj); nReturn = snd_seq_subscribe_port(seq, pPortSubscribe); if (nReturn < 0) { throwRuntimeException(env, "snd_seq_subscribe_port() failed"); } if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeq_subscribePort(): end\n"); } return (jint) nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeq * Method: unsubscribePort * Signature: (Lorg/tritonus/lowlevel/alsa/AlsaSeq$PortSubscribe;)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeq_unsubscribePort (JNIEnv* env, jobject obj, jobject portSubscribeObj) { snd_seq_t* seq; snd_seq_port_subscribe_t* pPortSubscribe; int nReturn; if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeq_unsubscribePort(): begin\n"); } seq = getHandle(env, obj); pPortSubscribe = getPortSubscribeNativeHandle(env, portSubscribeObj); nReturn = snd_seq_unsubscribe_port(seq, pPortSubscribe); if (nReturn < 0) { throwRuntimeException(env, "snd_seq_unsubscribe_port() failed"); } if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeq_unsubscribePort(): end\n"); } return (jint) nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeq * Method: setTrace * Signature: (Z)V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeq_setTrace (JNIEnv* env, jclass cls, jboolean bTrace) { debug_flag = bTrace; debug_file = stderr; } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeq * Method: eventOutput * Signature: (Lorg/tritonus/lowlevel/alsa/AlsaSeq$Event;)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeq_eventOutput (JNIEnv* env, jobject obj, jobject eventObj) { snd_seq_t* seq; snd_seq_event_t* event; int nReturn; if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeq_eventOutput(): begin\n"); } seq = getHandle(env, obj); event = getEventNativeHandle(env, eventObj); if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeq_eventOutput(): length of event: %d\n", snd_seq_event_length(event)); } nReturn = snd_seq_event_output(seq, event); if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeq_eventOutput(): snd_seq_event_output() returns %d\n", nReturn); } if (nReturn < 0) { throwRuntimeException(env, "snd_seq_event_output() failed"); } if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeq_eventOutput(): end\n"); } return (jint) nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeq * Method: eventOutputBuffer * Signature: (Lorg/tritonus/lowlevel/alsa/AlsaSeq$Event;)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeq_eventOutputBuffer (JNIEnv* env, jobject obj, jobject eventObj) { snd_seq_t* seq; snd_seq_event_t* event; int nReturn; if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeq_eventOutputBuffer(): begin\n"); } seq = getHandle(env, obj); event = getEventNativeHandle(env, eventObj); nReturn = snd_seq_event_output_buffer(seq, event); if (nReturn < 0) { throwRuntimeException(env, "snd_seq_event_output_buffer() failed"); } if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeq_eventOutputBuffer(): end\n"); } return (jint) nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeq * Method: eventOutputDirect * Signature: (Lorg/tritonus/lowlevel/alsa/AlsaSeq$Event;)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeq_eventOutputDirect (JNIEnv* env, jobject obj, jobject eventObj) { snd_seq_t* seq; snd_seq_event_t* event; int nReturn; if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeq_eventOutputDirect(): begin\n"); } seq = getHandle(env, obj); event = getEventNativeHandle(env, eventObj); nReturn = snd_seq_event_output_direct(seq, event); if (nReturn < 0) { throwRuntimeException(env, "snd_seq_event_output_direct() failed"); } if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeq_eventOutputDirect(): end\n"); } return (jint) nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeq * Method: eventInput * Signature: (Lorg/tritonus/lowlevel/alsa/AlsaSeq$Event;)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeq_eventInput (JNIEnv* env, jobject obj, jobject eventObj) { snd_seq_t* seq; snd_seq_event_t* event; snd_seq_event_t* handle; int nReturn; if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeq_eventInput(): begin\n"); } seq = getHandle(env, obj); /* * snd_seq_event_input() results in a blocking read on a * device file. There are two problems: * 1. green threads VMs do no blocking read. Therefore, this * code doesn't work with green threads at all. A solution is * outstanding. * 2. In some cases, the read is interrupted by a signal. This * is the reason for the do..while. */ do { // printf("1\n"); //errno = 0; event = NULL; nReturn = snd_seq_event_input(seq, &event); //printf("return: %d\n", nReturn); // printf("event: %p\n", pEvent); // printf("errno: %d\n", errno); //perror("abc"); // printf("2\n"); } // TODO: should catch -EAGAIN, too? while (nReturn == -EINTR); // if (nReturn < 0) // { // throwRuntimeException(env, "snd_seq_event_input() failed"); // } if (event != NULL) { /* - get snd_seq_event_t handle of Event instance - if varlength, free associated mem - copy event to handle's memory - if varlength, allocate new memory for var part - copy data to new memory - set new var pointer TODO: make thread-safe (should acquire a lock) or: document behaviour */ handle = getEventNativeHandle(env, eventObj); if (snd_seq_ev_is_variable(handle)) { free(handle->data.ext.ptr); } *handle = *event; if (snd_seq_ev_is_variable(handle)) { char* ptr = (char*) malloc(handle->data.ext.len); memcpy(ptr, handle->data.ext.ptr, handle->data.ext.len); handle->data.ext.ptr = ptr; } } if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeq_eventInput(): end\n"); } return (jint) nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeq * Method: eventInputPending * Signature: (I)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeq_eventInputPending (JNIEnv* env, jobject obj, jint nFetchSequencer) { snd_seq_t* seq; int nReturn; if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeq_eventInputPending(): begin\n"); } seq = getHandle(env, obj); nReturn = snd_seq_event_input_pending(seq, nFetchSequencer); if (nReturn < 0) { throwRuntimeException(env, "snd_seq_event_input_pending() failed"); } if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeq_eventInputPending(): end\n"); } return (jint) nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeq * Method: drainOutput * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeq_drainOutput (JNIEnv* env, jobject obj) { snd_seq_t* seq; int nReturn; if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeq_drainOutput(): begin\n"); } seq = getHandle(env, obj); nReturn = snd_seq_drain_output(seq); if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeq_drainOutput(): snd_seq_drain_output() returned %d\n", nReturn); } if (nReturn < 0) { throwRuntimeException(env, "snd_seq_drain_output() failed"); } if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeq_drainOutput(): end\n"); } return (jint) nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeq * Method: eventOutputPending * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeq_eventOutputPending (JNIEnv* env, jobject obj) { snd_seq_t* seq; int nReturn; if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeq_eventOutputPending(): begin\n"); } seq = getHandle(env, obj); nReturn = snd_seq_event_output_pending(seq); if (nReturn < 0) { throwRuntimeException(env, "snd_seq_event_output_direct() failed"); } if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeq_eventOutputPending(): end\n"); } return (jint) nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeq * Method: extractOutput * Signature: (Lorg/tritonus/lowlevel/alsa/AlsaSeq$Event;)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeq_extractOutput (JNIEnv* env, jobject obj, jobject eventObj) { snd_seq_t* seq; snd_seq_event_t* event; snd_seq_event_t* handle; int nReturn; if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeq_extractOutput(): begin\n"); } seq = getHandle(env, obj); nReturn = snd_seq_extract_output(seq, &event); if (nReturn < 0) { throwRuntimeException(env, "snd_seq_extrct_output() failed"); } handle = getEventNativeHandle(env, eventObj); if (snd_seq_ev_is_variable(handle)) { free(handle->data.ext.ptr); } *handle = *event; if (snd_seq_ev_is_variable(handle)) { char* ptr = (char*) malloc(handle->data.ext.len); memcpy(ptr, handle->data.ext.ptr, handle->data.ext.len); handle->data.ext.ptr = ptr; } if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeq_extractOutput(): end\n"); } return (jint) nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeq * Method: dropOutput * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeq_dropOutput (JNIEnv* env, jobject obj) { snd_seq_t* seq; int nReturn; if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeq_dropOutput(): begin\n"); } seq = getHandle(env, obj); nReturn = snd_seq_drop_output(seq); if (nReturn < 0) { throwRuntimeException(env, "snd_seq_drop_output() failed"); } if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeq_dropOutput(): end\n"); } return (jint) nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeq * Method: dropOutputBuffer * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeq_dropOutputBuffer (JNIEnv* env, jobject obj) { snd_seq_t* seq; int nReturn; if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeq_dropOutputBuffer(): begin\n"); } seq = getHandle(env, obj); nReturn = snd_seq_drop_output_buffer(seq); if (nReturn < 0) { throwRuntimeException(env, "snd_seq_drop_output_buffer() failed"); } if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeq_dropOutputBuffer(): end\n"); } return (jint) nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeq * Method: dropInput * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeq_dropInput (JNIEnv* env, jobject obj) { snd_seq_t* seq; int nReturn; if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeq_dropInput(): begin\n"); } seq = getHandle(env, obj); nReturn = snd_seq_drop_input(seq); if (nReturn < 0) { throwRuntimeException(env, "snd_seq_drop_input() failed"); } if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeq_dropInput(): end\n"); } return (jint) nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeq * Method: dropInputBuffer * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeq_dropInputBuffer (JNIEnv* env, jobject obj) { snd_seq_t* seq; int nReturn; if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeq_dropInputBuffer(): begin\n"); } seq = getHandle(env, obj); nReturn = snd_seq_drop_input_buffer(seq); if (nReturn < 0) { throwRuntimeException(env, "snd_seq_drop_input_buffer() failed"); } if (debug_flag) { (void) fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeq_dropInputBuffer(): end\n"); } return (jint) nReturn; } /*** org_tritonus_lowlevel_alsa_AlsaSeq.c ***/ libtritonus-java-20070428/src/lib/alsa/org_tritonus_lowlevel_alsa_AlsaSeqClientInfo.c0000644000175000017500000002271607576663510030720 0ustar twernertwerner/* * org_tritonus_lowlevel_alsa_AlsaSeqClientInfo.c */ /* * Copyright (c) 1999 - 2001 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "common.h" #include "org_tritonus_lowlevel_alsa_AlsaSeqClientInfo.h" HandleFieldHandler(snd_seq_client_info_t*) snd_seq_client_info_t* getClientInfoNativeHandle(JNIEnv *env, jobject obj) { return getHandle(env, obj); } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqClientInfo * Method: malloc * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqClientInfo_malloc (JNIEnv* env, jobject obj) { snd_seq_client_info_t* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqClientInfo_malloc(): begin\n"); } nReturn = snd_seq_client_info_malloc(&handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqClientInfo_malloc(): handle: %p\n", handle); } setHandle(env, obj, handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqClientInfo_malloc(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqClientInfo * Method: free * Signature: ()V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqClientInfo_free (JNIEnv* env, jobject obj) { snd_seq_client_info_t* handle; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqClientInfo_free(): begin\n"); } handle = getHandle(env, obj); snd_seq_client_info_free(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqClientInfo_free(): end\n"); } } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqClientInfo * Method: getClient * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqClientInfo_getClient (JNIEnv* env, jobject obj) { snd_seq_client_info_t* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqClientInfo_getClient(): begin\n"); } handle = getHandle(env, obj); nReturn = snd_seq_client_info_get_client(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqClientInfo_getClient(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqClientInfo * Method: getType * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqClientInfo_getType (JNIEnv* env, jobject obj) { snd_seq_client_info_t* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqClientInfo_getType(): begin\n"); } handle = getHandle(env, obj); nReturn = snd_seq_client_info_get_type(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqClientInfo_getType(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqClientInfo * Method: getName * Signature: ()Ljava/lang/String; */ JNIEXPORT jstring JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqClientInfo_getName (JNIEnv* env, jobject obj) { snd_seq_client_info_t* handle; const char* pName; jstring strName; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqClientInfo_getName(): begin\n"); } handle = getHandle(env, obj); pName = snd_seq_client_info_get_name(handle); strName = (*env)->NewStringUTF(env, pName); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqClientInfo_getName(): end\n"); } return strName; } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqClientInfo * Method: getBroadcastFilter * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqClientInfo_getBroadcastFilter (JNIEnv* env, jobject obj) { snd_seq_client_info_t* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqClientInfo_getBroadcastFilter(): begin\n"); } handle = getHandle(env, obj); nReturn = snd_seq_client_info_get_broadcast_filter(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqClientInfo_getBroadcastFilter(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqClientInfo * Method: getErrorBounce * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqClientInfo_getErrorBounce (JNIEnv* env, jobject obj) { snd_seq_client_info_t* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqClientInfo_getErrorBounce(): begin\n"); } handle = getHandle(env, obj); nReturn = snd_seq_client_info_get_error_bounce(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqClientInfo_getErrorBounce(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqClientInfo * Method: getNumPorts * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqClientInfo_getNumPorts (JNIEnv* env, jobject obj) { snd_seq_client_info_t* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqClientInfo_getNumPorts(): begin\n"); } handle = getHandle(env, obj); nReturn = snd_seq_client_info_get_num_ports(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqClientInfo_getNumPorts(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqClientInfo * Method: getEventLost * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqClientInfo_getEventLost (JNIEnv* env, jobject obj) { snd_seq_client_info_t* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqClientInfo_getEventLost(): begin\n"); } handle = getHandle(env, obj); nReturn = snd_seq_client_info_get_event_lost(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqClientInfo_getEventLost(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqClientInfo * Method: setClient * Signature: (I)V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqClientInfo_setClient (JNIEnv* env, jobject obj, jint nClient) { snd_seq_client_info_t* handle; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqClientInfo_setClient(): begin\n"); } handle = getHandle(env, obj); snd_seq_client_info_set_client(handle, nClient); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqClientInfo_setClient(): end\n"); } } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqClientInfo * Method: setName * Signature: (Ljava/lang/String;)V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqClientInfo_setName (JNIEnv* env, jobject obj, jstring strName) { snd_seq_client_info_t* handle; const char* pName; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqClientInfo_setName(): begin\n"); } handle = getHandle(env, obj); pName = (*env)->GetStringUTFChars(env, strName, NULL); snd_seq_client_info_set_name(handle, pName); (*env)->ReleaseStringUTFChars(env, strName, pName); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqClientInfo_setName(): end\n"); } } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqClientInfo * Method: setBroadcastFilter * Signature: (I)V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqClientInfo_setBroadcastFilter (JNIEnv* env, jobject obj, jint nBroadcastFilter) { snd_seq_client_info_t* handle; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqClientInfo_setBroadcastFilter(): begin\n"); } handle = getHandle(env, obj); snd_seq_client_info_set_broadcast_filter(handle, nBroadcastFilter); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqClientInfo_setBroadcastFilter(): end\n"); } } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqClientInfo * Method: setErrorBounce * Signature: (I)V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqClientInfo_setErrorBounce (JNIEnv* env, jobject obj, jint nErrorBounce) { snd_seq_client_info_t* handle; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqClientInfo_setErrorBounce(): begin\n"); } handle = getHandle(env, obj); snd_seq_client_info_set_error_bounce(handle, nErrorBounce); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqClientInfo_setErrorBounce(): end\n"); } } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqClientInfo * Method: setTrace * Signature: (Z)V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqClientInfo_setTrace (JNIEnv* env, jclass cls, jboolean bTrace) { debug_flag = bTrace; debug_file = stderr; } /*** org_tritonus_lowlevel_alsa_AlsaSeqClientInfo.c ***/ libtritonus-java-20070428/src/lib/alsa/org_tritonus_lowlevel_alsa_AlsaSeqEvent.c0000644000175000017500000004355307753244416027746 0ustar twernertwerner/* * org_tritonus_lowlevel_alsa_AlsaSeqEvent.c */ /* * Copyright (c) 1999 - 2001 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "common.h" #include "org_tritonus_lowlevel_alsa_AlsaSeqEvent.h" HandleFieldHandler(snd_seq_event_t*) snd_seq_event_t* getEventNativeHandle(JNIEnv* env, jobject obj) { return getHandle(env, obj); } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqEvent * Method: malloc * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqEvent_malloc (JNIEnv* env, jobject obj) { snd_seq_event_t* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqEvent_malloc(): begin\n"); } handle = (snd_seq_event_t*) calloc(1, sizeof(snd_seq_event_t)); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqEvent_malloc(): handle: %p\n", handle); } setHandle(env, obj, handle); if (handle != NULL) { nReturn = 0; } else { nReturn = -1; } if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqEvent_malloc(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqEvent * Method: free * Signature: ()V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqEvent_free (JNIEnv* env, jobject obj) { snd_seq_event_t* handle; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqEvent_free(): begin\n"); } handle = getHandle(env, obj); if (snd_seq_ev_is_variable(handle)) { free(handle->data.ext.ptr); } free(handle); setHandle(env, obj, NULL); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqEvent_free(): end\n"); } } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqEvent * Method: getType * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqEvent_getType (JNIEnv* env, jobject obj) { snd_seq_event_t* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqEvent_getType(): begin\n"); } handle = getHandle(env, obj); nReturn = handle->type; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqEvent_getType(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqEvent * Method: getFlags * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqEvent_getFlags (JNIEnv* env, jobject obj) { snd_seq_event_t* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqEvent_getFlags(): begin\n"); } handle = getHandle(env, obj); nReturn = handle->flags; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqEvent_getFlags(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqEvent * Method: getTag * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqEvent_getTag (JNIEnv* env, jobject obj) { snd_seq_event_t* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqEvent_getTag(): begin\n"); } handle = getHandle(env, obj); nReturn = handle->tag; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqEvent_getTag(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqEvent * Method: getQueue * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqEvent_getQueue (JNIEnv* env, jobject obj) { snd_seq_event_t* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqEvent_getQueue(): begin\n"); } handle = getHandle(env, obj); nReturn = handle->type; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqEvent_getQueue(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqEvent * Method: getTimestamp * Signature: ()J */ JNIEXPORT jlong JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqEvent_getTimestamp (JNIEnv* env, jobject obj) { snd_seq_event_t* handle; jlong lTimestamp; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqEvent_getTimestamp(): begin\n"); } handle = getHandle(env, obj); if ((handle->flags & SND_SEQ_TIME_STAMP_MASK) == SND_SEQ_TIME_STAMP_TICK) { lTimestamp = handle->time.tick; } else // time { lTimestamp = (jlong) handle->time.time.tv_sec * (jlong) 1000000000 + (jlong) handle->time.time.tv_nsec; } if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqEvent_getTimestamp(): end\n"); } return lTimestamp; } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqEvent * Method: getSourceClient * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqEvent_getSourceClient (JNIEnv* env, jobject obj) { snd_seq_event_t* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqEvent_getSourceClient(): begin\n"); } handle = getHandle(env, obj); nReturn = handle->source.client; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqEvent_getSourceClient(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqEvent * Method: getSourcePort * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqEvent_getSourcePort (JNIEnv* env, jobject obj) { snd_seq_event_t* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqEvent_getSourcePort(): begin\n"); } handle = getHandle(env, obj); nReturn = handle->source.port; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqEvent_getSourcePort(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqEvent * Method: getDestClient * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqEvent_getDestClient (JNIEnv* env, jobject obj) { snd_seq_event_t* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqEvent_getDestClient(): begin\n"); } handle = getHandle(env, obj); nReturn = handle->dest.client; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqEvent_getDestClient(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqEvent * Method: getDestPort * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqEvent_getDestPort (JNIEnv* env, jobject obj) { snd_seq_event_t* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqEvent_getDestPort(): begin\n"); } handle = getHandle(env, obj); nReturn = handle->dest.port; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqEvent_getDestPort(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqEvent * Method: getNote * Signature: ([I)V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqEvent_getNote (JNIEnv* env, jobject obj, jintArray anValues) { snd_seq_event_t* handle; jint* panValues; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqEvent_getNote(): begin\n"); } handle = getHandle(env, obj); checkArrayLength(env, anValues, 5); panValues = (*env)->GetIntArrayElements(env, anValues, NULL); if (panValues == NULL) { throwRuntimeException(env, "GetIntArrayElements() failed"); } panValues[0] = handle->data.note.channel; panValues[1] = handle->data.note.note; panValues[2] = handle->data.note.velocity; panValues[3] = handle->data.note.off_velocity; panValues[4] = handle->data.note.duration; (*env)->ReleaseIntArrayElements(env, anValues, panValues, 0); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqEvent_getNote(): end\n"); } } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqEvent * Method: getControl * Signature: ([I)V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqEvent_getControl (JNIEnv* env, jobject obj, jintArray anValues) { snd_seq_event_t* handle; jint* panValues; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqEvent_getControl(): begin\n"); } handle = getHandle(env, obj); checkArrayLength(env, anValues, 3); panValues = (*env)->GetIntArrayElements(env, anValues, NULL); if (panValues == NULL) { throwRuntimeException(env, "GetIntArrayElements() failed"); } panValues[0] = handle->data.control.channel; panValues[1] = handle->data.control.param; panValues[2] = handle->data.control.value; (*env)->ReleaseIntArrayElements(env, anValues, panValues, 0); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqEvent_getControl(): end\n"); } } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqEvent * Method: getQueueControl * Signature: ([I[J)V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqEvent_getQueueControl (JNIEnv* env, jobject obj, jintArray anValues, jlongArray alValues) { snd_seq_event_t* handle; jint* panValues; jlong* palValues; int nType; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqEvent_getQueueControl(): begin\n"); } handle = getHandle(env, obj); checkArrayLength(env, anValues, 2); checkArrayLength(env, alValues, 1); panValues = (*env)->GetIntArrayElements(env, anValues, NULL); if (panValues == NULL) { throwRuntimeException(env, "GetIntArrayElements() failed"); } palValues = (*env)->GetLongArrayElements(env, alValues, NULL); if (palValues == NULL) { throwRuntimeException(env, "GetLongArrayElements() failed"); } panValues[0] = handle->data.queue.queue; nType = handle->type; if (nType == SND_SEQ_EVENT_TEMPO) { panValues[1] = handle->data.queue.param.value; } else if (nType == SND_SEQ_EVENT_SETPOS_TICK) { palValues[0] = handle->data.queue.param.time.tick; } else if (nType == SND_SEQ_EVENT_SETPOS_TIME) { palValues[0] = (jlong) handle->data.queue.param.time.time.tv_sec * (jlong) 1000000000 + (jlong) handle->data.queue.param.time.time.tv_nsec; } (*env)->ReleaseIntArrayElements(env, anValues, panValues, 0); (*env)->ReleaseLongArrayElements(env, alValues, palValues, 0); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqEvent_getQueueControl(): end\n"); } } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqEvent * Method: getVar * Signature: ()[B */ JNIEXPORT jbyteArray JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqEvent_getVar (JNIEnv* env, jobject obj) { snd_seq_event_t* handle; jbyteArray abData; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqEvent_getVar(): begin\n"); } handle = getHandle(env, obj); abData = (*env)->NewByteArray(env, handle->data.ext.len); if (abData == NULL) { throwRuntimeException(env, "NewByteArray() failed"); } (*env)->SetByteArrayRegion(env, abData, (jsize) 0, (jsize) handle->data.ext.len, (jbyte*) handle->data.ext.ptr); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqEvent_getVar(): end\n"); } return abData; } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqEvent * Method: setCommon * Signature: (IIIIJIIII)V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqEvent_setCommon (JNIEnv* env, jobject obj, jint nType, jint nFlags, jint nTag, jint nQueue, jlong lTimestamp, jint nSourceClient, jint nSourcePort, jint nDestClient, jint nDestPort) { snd_seq_event_t* handle; int nLengthFlags; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqEvent_setCommon(): begin\n"); } handle = getHandle(env, obj); handle->type = nType; // preserve the length flags nLengthFlags = handle->flags & SND_SEQ_EVENT_LENGTH_MASK; handle->flags = (nFlags & ~SND_SEQ_EVENT_LENGTH_MASK) | nLengthFlags; handle->tag = nTag; handle->queue = nQueue; if ((handle->flags & SND_SEQ_TIME_STAMP_MASK) == SND_SEQ_TIME_STAMP_TICK) { handle->time.tick = lTimestamp; } else { handle->time.time.tv_sec = lTimestamp / 1000000000; handle->time.time.tv_nsec = lTimestamp % 1000000000; } // source client is set by the sequencer to sending client handle->source.port = nSourcePort; handle->dest.client = nDestClient; handle->dest.port = nDestPort; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqEvent_setCommon(): end\n"); } } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqEvent * Method: setTimestamp * Signature: (J)V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqEvent_setTimestamp (JNIEnv* env, jobject obj, jlong lTimestamp) { snd_seq_event_t* handle; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqEvent_setTimestamp(): begin\n"); } handle = getHandle(env, obj); if ((handle->flags & SND_SEQ_TIME_STAMP_MASK) == SND_SEQ_TIME_STAMP_TICK) { handle->time.tick = lTimestamp; } else { handle->time.time.tv_sec = lTimestamp / 1000000000; handle->time.time.tv_nsec = lTimestamp % 1000000000; } if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqEvent_setTimestamp(): end\n"); } } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqEvent * Method: setNote * Signature: (IIIII)V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqEvent_setNote (JNIEnv* env, jobject obj, jint nChannel, jint nNote, jint nVelocity, jint nOffVelocity, jint nDuration) { snd_seq_event_t* handle; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqEvent_setNote(): begin\n"); } handle = getHandle(env, obj); snd_seq_ev_set_fixed(handle); handle->data.note.channel = nChannel; handle->data.note.note = nNote; handle->data.note.velocity = nVelocity; handle->data.note.off_velocity = nOffVelocity; handle->data.note.duration = nDuration; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqEvent_setNote(): end\n"); } } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqEvent * Method: setControl * Signature: (III)V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqEvent_setControl (JNIEnv* env, jobject obj, jint nChannel, jint nParam, jint nValue) { snd_seq_event_t* handle; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqEvent_setControl(): begin\n"); } handle = getHandle(env, obj); if (snd_seq_ev_is_variable(handle)) { // printf("var data free: %p\n", handle->data.ext.ptr); free(handle->data.ext.ptr); } snd_seq_ev_set_fixed(handle); handle->data.control.channel = nChannel; handle->data.control.param = nParam; handle->data.control.value = nValue; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqEvent_setControl(): end\n"); } } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqEvent * Method: setQueueControl * Signature: (IIJ)V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqEvent_setQueueControl (JNIEnv* env, jobject obj, jint nQueue, jint nValue, jlong lTime) { snd_seq_event_t* handle; int nType; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqEvent_setQueueControl(): begin\n"); } handle = getHandle(env, obj); if (snd_seq_ev_is_variable(handle)) { // printf("var data free: %p\n", handle->data.ext.ptr); free(handle->data.ext.ptr); } snd_seq_ev_set_fixed(handle); nType = handle->type; handle->data.queue.queue = nQueue; if (nType == SND_SEQ_EVENT_TEMPO) { handle->data.queue.param.value = nValue; } else if (nType == SND_SEQ_EVENT_SETPOS_TICK) { handle->data.queue.param.time.tick = lTime; } else if (nType == SND_SEQ_EVENT_SETPOS_TIME) { handle->data.queue.param.time.time.tv_sec = lTime / 1000000000; handle->data.queue.param.time.time.tv_nsec = lTime % 1000000000; } if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqEvent_setQueueControl(): end\n"); } } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqEvent * Method: setVar * Signature: ([BII)V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqEvent_setVar (JNIEnv* env, jobject obj, jbyteArray abData, jint nOffset, jint nLength) { snd_seq_event_t* handle; jbyte* pData; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqEvent_setVar(): begin\n"); } handle = getHandle(env, obj); if (snd_seq_ev_is_variable(handle)) { // printf("var data free: %p\n", handle->data.ext.ptr); free(handle->data.ext.ptr); } pData = (jbyte*) malloc(nLength); // printf("var data malloc: %p\n", pData); if (pData == NULL) { if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqEvent_setVar(): malloc() failed, throwing exception\n"); } throwRuntimeException(env, "malloc() failed"); return; } (*env)->GetByteArrayRegion(env, abData, nOffset, nLength, pData); snd_seq_ev_set_variable(handle, nLength, pData); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqEvent_setVar(): end\n"); } } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqEvent * Method: setTrace * Signature: (Z)V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqEvent_setTrace (JNIEnv* env, jclass cls, jboolean bTrace) { debug_flag = bTrace; debug_file = stderr; } /*** org_tritonus_lowlevel_alsa_AlsaSeqEvent.c ***/ libtritonus-java-20070428/src/lib/alsa/org_tritonus_lowlevel_alsa_AlsaSeqPortInfo.c0000644000175000017500000002224407576663513030425 0ustar twernertwerner/* * org_tritonus_lowlevel_alsa_AlsaSeqPortInfo.c */ /* * Copyright (c) 1999 - 2001 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "common.h" #include "org_tritonus_lowlevel_alsa_AlsaSeqPortInfo.h" HandleFieldHandler(snd_seq_port_info_t*) snd_seq_port_info_t* getPortInfoNativeHandle(JNIEnv *env, jobject obj) { return getHandle(env, obj); } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqPortInfo * Method: malloc * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqPortInfo_malloc (JNIEnv* env, jobject obj) { snd_seq_port_info_t* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqPortInfo_malloc(): begin\n"); } nReturn = snd_seq_port_info_malloc(&handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqPortInfo_malloc(): handle: %p\n", handle); } setHandle(env, obj, handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqPortInfo_malloc(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqPortInfo * Method: free * Signature: ()V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqPortInfo_free (JNIEnv* env, jobject obj) { snd_seq_port_info_t* handle; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqPortInfo_free(): begin\n"); } handle = getHandle(env, obj); snd_seq_port_info_free(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqPortInfo_free(): end\n"); } } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqPortInfo * Method: getClient * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqPortInfo_getClient (JNIEnv* env, jobject obj) { snd_seq_port_info_t* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqPortInfo_getClient(): begin\n"); } handle = getHandle(env, obj); nReturn = snd_seq_port_info_get_client(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqPortInfo_getClient(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqPortInfo * Method: getPort * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqPortInfo_getPort (JNIEnv* env, jobject obj) { snd_seq_port_info_t* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqPortInfo_getPort(): begin\n"); } handle = getHandle(env, obj); nReturn = snd_seq_port_info_get_port(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqPortInfo_getPort(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqPortInfo * Method: getName * Signature: ()Ljava/lang/String; */ JNIEXPORT jstring JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqPortInfo_getName (JNIEnv* env, jobject obj) { snd_seq_port_info_t* handle; const char* name; jstring nameObj; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqPortInfo_getName(): begin\n"); } handle = getHandle(env, obj); name = snd_seq_port_info_get_name(handle); nameObj = (*env)->NewStringUTF(env, name); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqPortInfo_getName(): end\n"); } return nameObj; } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqPortInfo * Method: getCapability * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqPortInfo_getCapability (JNIEnv* env, jobject obj) { snd_seq_port_info_t* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqPortInfo_getCapability(): begin\n"); } handle = getHandle(env, obj); nReturn = snd_seq_port_info_get_capability(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqPortInfo_getCapability(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqPortInfo * Method: getType * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqPortInfo_getType (JNIEnv* env, jobject obj) { snd_seq_port_info_t* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqPortInfo_getType(): begin\n"); } handle = getHandle(env, obj); nReturn = snd_seq_port_info_get_type(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqPortInfo_getType(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqPortInfo * Method: getMidiChannels * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqPortInfo_getMidiChannels (JNIEnv* env, jobject obj) { snd_seq_port_info_t* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqPortInfo_getMidiChannels(): begin\n"); } handle = getHandle(env, obj); nReturn = snd_seq_port_info_get_midi_channels(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqPortInfo_getMidiChannels(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqPortInfo * Method: getMidiVoices * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqPortInfo_getMidiVoices (JNIEnv* env, jobject obj) { snd_seq_port_info_t* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqPortInfo_getMidiVoices(): begin\n"); } handle = getHandle(env, obj); nReturn = snd_seq_port_info_get_midi_voices(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqPortInfo_getMidiVoices(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqPortInfo * Method: getSynthVoices * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqPortInfo_getSynthVoices (JNIEnv* env, jobject obj) { snd_seq_port_info_t* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqPortInfo_getSynthVoices(): begin\n"); } handle = getHandle(env, obj); nReturn = snd_seq_port_info_get_synth_voices(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqPortInfo_getSynthVoices(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqPortInfo * Method: getReadUse * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqPortInfo_getReadUse (JNIEnv* env, jobject obj) { snd_seq_port_info_t* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqPortInfo_getReadUse(): begin\n"); } handle = getHandle(env, obj); nReturn = snd_seq_port_info_get_read_use(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqPortInfo_getReadUse(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqPortInfo * Method: getWriteUse * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqPortInfo_getWriteUse (JNIEnv* env, jobject obj) { snd_seq_port_info_t* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqPortInfo_getWriteUse(): begin\n"); } handle = getHandle(env, obj); nReturn = snd_seq_port_info_get_write_use(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqPortInfo_getWriteUse(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqPortInfo * Method: getPortSpecified * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqPortInfo_getPortSpecified (JNIEnv* env, jobject obj) { snd_seq_port_info_t* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqPortInfo_getPortSpecified(): begin\n"); } handle = getHandle(env, obj); nReturn = snd_seq_port_info_get_port_specified(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqPortInfo_getPortSpecified(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqPortInfo * Method: setTrace * Signature: (Z)V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqPortInfo_setTrace (JNIEnv* env, jclass cls, jboolean bTrace) { debug_flag = bTrace; debug_file = stderr; } /*** org_tritonus_lowlevel_alsa_AlsaSeqPortInfo.c ***/ libtritonus-java-20070428/src/lib/alsa/org_tritonus_lowlevel_alsa_AlsaSeqPortSubscribe.c0000644000175000017500000002730307576663514031455 0ustar twernertwerner/* * org_tritonus_lowlevel_alsa_AlsaSeqPortSubscribe.c */ /* * Copyright (c) 1999 - 2001 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "common.h" #include "org_tritonus_lowlevel_alsa_AlsaSeqPortSubscribe.h" HandleFieldHandler(snd_seq_port_subscribe_t*) snd_seq_port_subscribe_t* getPortSubscribeNativeHandle(JNIEnv *env, jobject obj) { return getHandle(env, obj); } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqPortSubscribe * Method: malloc * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqPortSubscribe_malloc (JNIEnv* env, jobject obj) { snd_seq_port_subscribe_t* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqPortSubscribe_malloc(): begin\n"); } nReturn = snd_seq_port_subscribe_malloc(&handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqPortSubscribe_malloc(): handle: %p\n", handle); } setHandle(env, obj, handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqPortSubscribe_malloc(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqPortSubscribe * Method: free * Signature: ()V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqPortSubscribe_free (JNIEnv* env, jobject obj) { snd_seq_port_subscribe_t* handle; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqPortSubscribe_free(): begin\n"); } handle = getHandle(env, obj); snd_seq_port_subscribe_free(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqPortSubscribe_free(): end\n"); } } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqPortSubscribe * Method: getSenderClient * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqPortSubscribe_getSenderClient (JNIEnv* env, jobject obj) { snd_seq_port_subscribe_t* handle; const snd_seq_addr_t* address; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqPortSubscribe_getSenderClient(): begin\n"); } handle = getHandle(env, obj); address = snd_seq_port_subscribe_get_sender(handle); nReturn = address->client; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqPortSubscribe_getSenderClient(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqPortSubscribe * Method: getSenderPort * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqPortSubscribe_getSenderPort (JNIEnv* env, jobject obj) { snd_seq_port_subscribe_t* handle; const snd_seq_addr_t* address; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqPortSubscribe_getSenderPort(): begin\n"); } handle = getHandle(env, obj); address = snd_seq_port_subscribe_get_sender(handle); nReturn = address->port; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqPortSubscribe_getSenderPort(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqPortSubscribe * Method: getDestClient * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqPortSubscribe_getDestClient (JNIEnv* env, jobject obj) { snd_seq_port_subscribe_t* handle; const snd_seq_addr_t* address; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqPortSubscribe_getDestClient(): begin\n"); } handle = getHandle(env, obj); address = snd_seq_port_subscribe_get_dest(handle); nReturn = address->client; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqPortSubscribe_getDestClient(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqPortSubscribe * Method: getDestPort * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqPortSubscribe_getDestPort (JNIEnv* env, jobject obj) { snd_seq_port_subscribe_t* handle; const snd_seq_addr_t* address; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqPortSubscribe_getDestPort(): begin\n"); } handle = getHandle(env, obj); address = snd_seq_port_subscribe_get_dest(handle); nReturn = address->port; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqPortSubscribe_getDestPort(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqPortSubscribe * Method: getQueue * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqPortSubscribe_getQueue (JNIEnv* env, jobject obj) { snd_seq_port_subscribe_t* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqPortSubscribe_getQueue(): begin\n"); } handle = getHandle(env, obj); nReturn = snd_seq_port_subscribe_get_queue(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqPortSubscribe_getQueue(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqPortSubscribe * Method: getExclusive * Signature: ()Z */ JNIEXPORT jboolean JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqPortSubscribe_getExclusive (JNIEnv* env, jobject obj) { snd_seq_port_subscribe_t* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqPortSubscribe_getExclusive(): begin\n"); } handle = getHandle(env, obj); nReturn = snd_seq_port_subscribe_get_exclusive(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqPortSubscribe_getExclusive(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqPortSubscribe * Method: getTimeUpdate * Signature: ()Z */ JNIEXPORT jboolean JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqPortSubscribe_getTimeUpdate (JNIEnv* env, jobject obj) { snd_seq_port_subscribe_t* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqPortSubscribe_getTimeUpdate(): begin\n"); } handle = getHandle(env, obj); nReturn = snd_seq_port_subscribe_get_time_update(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqPortSubscribe_getTimeUpdate(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqPortSubscribe * Method: getTimeReal * Signature: ()Z */ JNIEXPORT jboolean JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqPortSubscribe_getTimeReal (JNIEnv* env, jobject obj) { snd_seq_port_subscribe_t* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqPortSubscribe_getTimeReal(): begin\n"); } handle = getHandle(env, obj); nReturn = snd_seq_port_subscribe_get_time_real(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqPortSubscribe_getTimeReal(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqPortSubscribe * Method: setSender * Signature: (II)V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqPortSubscribe_setSender (JNIEnv* env, jobject obj, jint nClient, jint nPort) { snd_seq_port_subscribe_t* handle; snd_seq_addr_t newAddress; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqPortSubscribe_setSender(): begin\n"); } handle = getHandle(env, obj); newAddress.client = nClient; newAddress.port = nPort; snd_seq_port_subscribe_set_sender(handle, &newAddress); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqPortSubscribe_setSender(): end\n"); } } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqPortSubscribe * Method: setDest * Signature: (II)V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqPortSubscribe_setDest (JNIEnv* env, jobject obj, jint nClient, jint nPort) { snd_seq_port_subscribe_t* handle; snd_seq_addr_t newAddress; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqPortSubscribe_setDest(): begin\n"); } handle = getHandle(env, obj); newAddress.client = nClient; newAddress.port = nPort; snd_seq_port_subscribe_set_dest(handle, &newAddress); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqPortSubscribe_setDest(): end\n"); } } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqPortSubscribe * Method: setQueue * Signature: (I)V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqPortSubscribe_setQueue (JNIEnv* env, jobject obj, jint nQueue) { snd_seq_port_subscribe_t* handle; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqPortSubscribe_setQueue(): begin\n"); } handle = getHandle(env, obj); snd_seq_port_subscribe_set_queue(handle, nQueue); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqPortSubscribe_setQueue(): end\n"); } } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqPortSubscribe * Method: setExclusive * Signature: (Z)V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqPortSubscribe_setExclusive (JNIEnv* env, jobject obj, jboolean bExclusive) { snd_seq_port_subscribe_t* handle; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqPortSubscribe_setExclusive(): begin\n"); } handle = getHandle(env, obj); snd_seq_port_subscribe_set_exclusive(handle, bExclusive); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqPortSubscribe_setExclusive(): end\n"); } } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqPortSubscribe * Method: setTimeUpdate * Signature: (Z)V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqPortSubscribe_setTimeUpdate (JNIEnv* env, jobject obj, jboolean bUpdate) { snd_seq_port_subscribe_t* handle; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqPortSubscribe_setTimeUpdate(): begin\n"); } handle = getHandle(env, obj); snd_seq_port_subscribe_set_time_update(handle, bUpdate); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqPortSubscribe_setTimeUpdate(): end\n"); } } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqPortSubscribe * Method: setTimeReal * Signature: (Z)V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqPortSubscribe_setTimeReal (JNIEnv* env, jobject obj, jboolean bReal) { snd_seq_port_subscribe_t* handle; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqPortSubscribe_setTimeReal(): begin\n"); } handle = getHandle(env, obj); snd_seq_port_subscribe_set_time_real(handle, bReal); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqPortSubscribe_setTimeReal(): end\n"); } } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqPortSubscribe * Method: setTrace * Signature: (Z)V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqPortSubscribe_setTrace (JNIEnv* env, jclass cls, jboolean bTrace) { debug_flag = bTrace; debug_file = stderr; } /*** org_tritonus_lowlevel_alsa_AlsaSeqPortSubscribe.c ***/ libtritonus-java-20070428/src/lib/alsa/org_tritonus_lowlevel_alsa_AlsaSeqQueueInfo.c0000644000175000017500000002002007576663516030556 0ustar twernertwerner/* * org_tritonus_lowlevel_alsa_AlsaSeqQueueInfo.c */ /* * Copyright (c) 1999 - 2001 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "common.h" #include "org_tritonus_lowlevel_alsa_AlsaSeqQueueInfo.h" HandleFieldHandler(snd_seq_queue_info_t*) // TODO: used in ... snd_seq_queue_info_t* getQueueInfoNativeHandle(JNIEnv *env, jobject obj) { return getHandle(env, obj); } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqQueueInfo * Method: malloc * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqQueueInfo_malloc (JNIEnv* env, jobject obj) { snd_seq_queue_info_t* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqQueueInfo_malloc(): begin\n"); } nReturn = snd_seq_queue_info_malloc(&handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqQueueInfo_malloc(): handle: %p\n", handle); } setHandle(env, obj, handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqQueueInfo_malloc(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqQueueInfo * Method: free * Signature: ()V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqQueueInfo_free (JNIEnv* env, jobject obj) { snd_seq_queue_info_t* handle; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqQueueInfo_free(): begin\n"); } handle = getHandle(env, obj); snd_seq_queue_info_free(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqQueueInfo_free(): end\n"); } } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqQueueInfo * Method: getQueue * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqQueueInfo_getQueue (JNIEnv* env, jobject obj) { snd_seq_queue_info_t* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqQueueInfo_getQueue(): begin\n"); } handle = getHandle(env, obj); nReturn = snd_seq_queue_info_get_queue(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqQueueInfo_getQueue(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqQueueInfo * Method: getName * Signature: ()Ljava/lang/String; */ JNIEXPORT jstring JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqQueueInfo_getName (JNIEnv* env, jobject obj) { snd_seq_queue_info_t* handle; const char* pName; jstring strName; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqQueueInfo_getName(): begin\n"); } handle = getHandle(env, obj); pName = snd_seq_queue_info_get_name(handle); strName = (*env)->NewStringUTF(env, pName); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqQueueInfo_getName(): end\n"); } return strName; } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqQueueInfo * Method: getOwner * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqQueueInfo_getOwner (JNIEnv* env, jobject obj) { snd_seq_queue_info_t* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqQueueInfo_getOwner(): begin\n"); } handle = getHandle(env, obj); nReturn = snd_seq_queue_info_get_owner(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqQueueInfo_getOwner(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqQueueInfo * Method: getLocked * Signature: ()Z */ JNIEXPORT jboolean JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqQueueInfo_getLocked (JNIEnv* env, jobject obj) { snd_seq_queue_info_t* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqQueueInfo_getLocked(): begin\n"); } handle = getHandle(env, obj); nReturn = snd_seq_queue_info_get_locked(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqQueueInfo_getLocked(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqQueueInfo * Method: getFlags * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqQueueInfo_getFlags (JNIEnv* env, jobject obj) { snd_seq_queue_info_t* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqQueueInfo_getFlags(): begin\n"); } handle = getHandle(env, obj); nReturn = snd_seq_queue_info_get_flags(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqQueueInfo_getFlags(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqQueueInfo * Method: setName * Signature: (Ljava/lang/String;)V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqQueueInfo_setName (JNIEnv* env, jobject obj, jstring strName) { snd_seq_queue_info_t* handle; const char* pName; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqQueueInfo_setName(): begin\n"); } handle = getHandle(env, obj); pName = (*env)->GetStringUTFChars(env, strName, NULL); snd_seq_queue_info_set_name(handle, pName); (*env)->ReleaseStringUTFChars(env, strName, pName); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqQueueInfo_setName(): end\n"); } } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqQueueInfo * Method: setOwner * Signature: (I)V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqQueueInfo_setOwner (JNIEnv* env, jobject obj, jint nOwner) { snd_seq_queue_info_t* handle; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqQueueInfo_setOwner(): begin\n"); } handle = getHandle(env, obj); snd_seq_queue_info_set_owner(handle, nOwner); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqQueueInfo_setOwner(): end\n"); } } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqQueueInfo * Method: setLocked * Signature: (Z)V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqQueueInfo_setLocked (JNIEnv* env, jobject obj, jboolean bLocked) { snd_seq_queue_info_t* handle; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqQueueInfo_setLocked(): begin\n"); } handle = getHandle(env, obj); snd_seq_queue_info_set_locked(handle, bLocked); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqQueueInfo_setLocked(): end\n"); } } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqQueueInfo * Method: setFlags * Signature: (I)V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqQueueInfo_setFlags (JNIEnv* env, jobject obj, jint nFlags) { snd_seq_queue_info_t* handle; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqQueueInfo_setFlags(): begin\n"); } handle = getHandle(env, obj); snd_seq_queue_info_set_flags(handle, nFlags); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqQueueInfo_setFlags(): end\n"); } } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqQueueInfo * Method: setTrace * Signature: (Z)V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqQueueInfo_setTrace (JNIEnv* env, jclass cls, jboolean bTrace) { debug_flag = bTrace; debug_file = stderr; } /*** org_tritonus_lowlevel_alsa_AlsaSeqQueueInfo.c ***/ libtritonus-java-20070428/src/lib/alsa/org_tritonus_lowlevel_alsa_AlsaSeqQueueStatus.c0000644000175000017500000001345407576663517031164 0ustar twernertwerner/* * org_tritonus_lowlevel_alsa_AlsaSeqQueueStatus.c */ /* * Copyright (c) 1999 - 2001 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "common.h" #include "org_tritonus_lowlevel_alsa_AlsaSeqQueueStatus.h" HandleFieldHandler(snd_seq_queue_status_t*) snd_seq_queue_status_t* getQueueStatusNativeHandle(JNIEnv *env, jobject obj) { return getHandle(env, obj); } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqQueueStatus * Method: malloc * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqQueueStatus_malloc (JNIEnv* env, jobject obj) { snd_seq_queue_status_t* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqQueueStatus_malloc(): begin\n"); } nReturn = snd_seq_queue_status_malloc(&handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqQueueStatus_malloc(): handle: %p\n", handle); } setHandle(env, obj, handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqQueueStatus_malloc(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqQueueStatus * Method: free * Signature: ()V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqQueueStatus_free (JNIEnv* env, jobject obj) { snd_seq_queue_status_t* handle; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqQueueStatus_free(): begin\n"); } handle = getHandle(env, obj); snd_seq_queue_status_free(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqQueueStatus_free(): end\n"); } } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqQueueStatus * Method: getQueue * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqQueueStatus_getQueue (JNIEnv* env, jobject obj) { snd_seq_queue_status_t* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqQueueStatus_getQueue(): begin\n"); } handle = getHandle(env, obj); nReturn = snd_seq_queue_status_get_queue(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqQueueStatus_getQueue(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqQueueStatus * Method: getEvents * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqQueueStatus_getEvents (JNIEnv* env, jobject obj) { snd_seq_queue_status_t* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqQueueStatus_getEvents(): begin\n"); } handle = getHandle(env, obj); nReturn = snd_seq_queue_status_get_events(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqQueueStatus_getEvents(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqQueueStatus * Method: getTickTime * Signature: ()J */ JNIEXPORT jlong JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqQueueStatus_getTickTime (JNIEnv* env, jobject obj) { snd_seq_queue_status_t* handle; long lReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqQueueStatus_getTickTime(): begin\n"); } handle = getHandle(env, obj); lReturn = snd_seq_queue_status_get_tick_time(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqQueueStatus_getTickTime(): end\n"); } return lReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqQueueStatus * Method: getRealTime * Signature: ()J */ JNIEXPORT jlong JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqQueueStatus_getRealTime (JNIEnv* env, jobject obj) { snd_seq_queue_status_t* handle; const snd_seq_real_time_t* pRealTime; jlong lNanoseconds; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqQueueStatus_getRealTime(): begin\n"); } handle = getHandle(env, obj); pRealTime = snd_seq_queue_status_get_real_time(handle); lNanoseconds = (jlong) pRealTime->tv_sec * 1000000000 + pRealTime->tv_nsec; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqQueueStatus_getRealTime(): end\n"); } return lNanoseconds; } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqQueueStatus * Method: getStatus * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqQueueStatus_getStatus (JNIEnv* env, jobject obj) { snd_seq_queue_status_t* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqQueueStatus_getStatus(): begin\n"); } handle = getHandle(env, obj); nReturn = snd_seq_queue_status_get_status(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqQueueStatus_getStatus(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqQueueStatus * Method: setTrace * Signature: (Z)V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqQueueStatus_setTrace (JNIEnv* env, jclass cls, jboolean bTrace) { debug_flag = bTrace; debug_file = stderr; } /*** org_tritonus_lowlevel_alsa_AlsaSeqQueueStatus.c ***/ libtritonus-java-20070428/src/lib/alsa/org_tritonus_lowlevel_alsa_AlsaSeqQueueTempo.c0000644000175000017500000001301007576663521030744 0ustar twernertwerner/* * org_tritonus_lowlevel_alsa_AlsaSeqQueueTempo.c */ /* * Copyright (c) 1999 - 2001 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "common.h" #include "org_tritonus_lowlevel_alsa_AlsaSeqQueueTempo.h" HandleFieldHandler(snd_seq_queue_tempo_t*) snd_seq_queue_tempo_t* getQueueTempoNativeHandle(JNIEnv *env, jobject obj) { return getHandle(env, obj); } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqQueueTempo * Method: malloc * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqQueueTempo_malloc (JNIEnv* env, jobject obj) { snd_seq_queue_tempo_t* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqQueueTempo_malloc(): begin\n"); } nReturn = snd_seq_queue_tempo_malloc(&handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqQueueTempo_malloc(): handle: %p\n", handle); } setHandle(env, obj, handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqQueueTempo_malloc(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqQueueTempo * Method: free * Signature: ()V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqQueueTempo_free (JNIEnv* env, jobject obj) { snd_seq_queue_tempo_t* handle; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqQueueTempo_free(): begin\n"); } handle = getHandle(env, obj); snd_seq_queue_tempo_free(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqQueueTempo_free(): end\n"); } } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqQueueTempo * Method: getQueue * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqQueueTempo_getQueue (JNIEnv* env, jobject obj) { snd_seq_queue_tempo_t* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqQueueTempo_getQueue(): begin\n"); } handle = getHandle(env, obj); nReturn = snd_seq_queue_tempo_get_queue(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqQueueTempo_getQueue(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqQueueTempo * Method: getTempo * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqQueueTempo_getTempo (JNIEnv* env, jobject obj) { snd_seq_queue_tempo_t* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqQueueTempo_getTempo(): begin\n"); } handle = getHandle(env, obj); nReturn = snd_seq_queue_tempo_get_tempo(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqQueueTempo_getTempo(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqQueueTempo * Method: getPpq * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqQueueTempo_getPpq (JNIEnv* env, jobject obj) { snd_seq_queue_tempo_t* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqQueueTempo_getPpq(): begin\n"); } handle = getHandle(env, obj); nReturn = snd_seq_queue_tempo_get_ppq(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqQueueTempo_getPpq(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqQueueTempo * Method: setTempo * Signature: (I)V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqQueueTempo_setTempo (JNIEnv* env, jobject obj, jint nTempo) { snd_seq_queue_tempo_t* handle; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqQueueTempo_setTempo(): begin\n"); } handle = getHandle(env, obj); snd_seq_queue_tempo_set_tempo(handle, nTempo); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqQueueTempo_setTempo(): end\n"); } } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqQueueTempo * Method: setPpq * Signature: (I)V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqQueueTempo_setPpq (JNIEnv* env, jobject obj, jint nPpq) { snd_seq_queue_tempo_t* handle; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqQueueTempo_setPpq(): begin\n"); } handle = getHandle(env, obj); snd_seq_queue_tempo_set_ppq(handle, nPpq); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqQueueTempo_setPpq(): end\n"); } } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqQueueTempo * Method: setTrace * Signature: (Z)V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqQueueTempo_setTrace (JNIEnv* env, jclass cls, jboolean bTrace) { debug_flag = bTrace; debug_file = stderr; } /*** org_tritonus_lowlevel_alsa_AlsaSeqQueueTempo.c ***/ libtritonus-java-20070428/src/lib/alsa/org_tritonus_lowlevel_alsa_AlsaSeqRemoveEvents.c0000644000175000017500000003233007576663524031306 0ustar twernertwerner/* * org_tritonus_lowlevel_alsa_AlsaSeqRemoveEvents.c */ /* * Copyright (c) 1999 - 2001 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "common.h" #include "org_tritonus_lowlevel_alsa_AlsaSeqRemoveEvents.h" HandleFieldHandler(snd_seq_remove_events_t*) snd_seq_remove_events_t* getRemoveEventsNativeHandle(JNIEnv *env, jobject obj) { return getHandle(env, obj); } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqRemoveEvents * Method: malloc * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqRemoveEvents_malloc (JNIEnv* env, jobject obj) { snd_seq_remove_events_t* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqRemoveEvents_malloc(): begin\n"); } nReturn = snd_seq_remove_events_malloc(&handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqRemoveEvents_malloc(): handle: %p\n", handle); } setHandle(env, obj, handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqRemoveEvents_malloc(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqRemoveEvents * Method: free * Signature: ()V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqRemoveEvents_free (JNIEnv* env, jobject obj) { snd_seq_remove_events_t* handle; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqRemoveEvents_free(): begin\n"); } handle = getHandle(env, obj); snd_seq_remove_events_free(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqRemoveEvents_free(): end\n"); } } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqRemoveEvents * Method: getCondition * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqRemoveEvents_getCondition (JNIEnv* env, jobject obj) { snd_seq_remove_events_t* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqRemoveEvents_getCondition(): begin\n"); } handle = getHandle(env, obj); nReturn = snd_seq_remove_events_get_condition(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqRemoveEvents_getCondition(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqRemoveEvents * Method: getQueue * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqRemoveEvents_getQueue (JNIEnv* env, jobject obj) { snd_seq_remove_events_t* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqRemoveEvents_getQueue(): begin\n"); } handle = getHandle(env, obj); nReturn = snd_seq_remove_events_get_queue(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqRemoveEvents_getQueue(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqRemoveEvents * Method: getTime * Signature: ()J */ JNIEXPORT jlong JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqRemoveEvents_getTime (JNIEnv* env, jobject obj) { snd_seq_remove_events_t* handle; int nCondition; const snd_seq_timestamp_t* time; jlong lTimestamp; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqRemoveEvents_getTime(): begin\n"); } handle = getHandle(env, obj); nCondition = snd_seq_remove_events_get_condition(handle); time = snd_seq_remove_events_get_time(handle); if ((nCondition & SND_SEQ_REMOVE_TIME_TICK) == SND_SEQ_REMOVE_TIME_TICK) { lTimestamp = time->tick; } else // time { lTimestamp = (jlong) time->time.tv_sec * (jlong) 1000000000 + (jlong) time->time.tv_nsec; } if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqRemoveEvents_getTime(): end\n"); } return lTimestamp; } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqRemoveEvents * Method: getDestClient * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqRemoveEvents_getDestClient (JNIEnv* env, jobject obj) { snd_seq_remove_events_t* handle; const snd_seq_addr_t* address; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqRemoveEvents_getDestClient(): begin\n"); } handle = getHandle(env, obj); address = snd_seq_remove_events_get_dest(handle); nReturn = address->client; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqRemoveEvents_getDestClient(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqRemoveEvents * Method: getDestPort * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqRemoveEvents_getDestPort (JNIEnv* env, jobject obj) { snd_seq_remove_events_t* handle; const snd_seq_addr_t* address; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqRemoveEvents_getDestPort(): begin\n"); } handle = getHandle(env, obj); address = snd_seq_remove_events_get_dest(handle); nReturn = address->port; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqRemoveEvents_getDestPort(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqRemoveEvents * Method: getChannel * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqRemoveEvents_getChannel (JNIEnv* env, jobject obj) { snd_seq_remove_events_t* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqRemoveEvents_getChannel(): begin\n"); } handle = getHandle(env, obj); nReturn = snd_seq_remove_events_get_channel(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqRemoveEvents_getChannel(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqRemoveEvents * Method: getEventType * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqRemoveEvents_getEventType (JNIEnv* env, jobject obj) { snd_seq_remove_events_t* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqRemoveEvents_getEventType(): begin\n"); } handle = getHandle(env, obj); nReturn = snd_seq_remove_events_get_event_type(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqRemoveEvents_getEventType(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqRemoveEvents * Method: getTag * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqRemoveEvents_getTag (JNIEnv* env, jobject obj) { snd_seq_remove_events_t* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqRemoveEvents_getTag(): begin\n"); } handle = getHandle(env, obj); nReturn = snd_seq_remove_events_get_tag(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqRemoveEvents_getTag(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqRemoveEvents * Method: setCondition * Signature: (I)V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqRemoveEvents_setCondition (JNIEnv* env, jobject obj, jint nCondition) { snd_seq_remove_events_t* handle; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqRemoveEvents_setCondition(): begin\n"); } handle = getHandle(env, obj); snd_seq_remove_events_set_condition(handle, nCondition); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqRemoveEvents_setCondition(): end\n"); } } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqRemoveEvents * Method: setQueue * Signature: (I)V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqRemoveEvents_setQueue (JNIEnv* env, jobject obj, jint nQueue) { snd_seq_remove_events_t* handle; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqRemoveEvents_setQueue(): begin\n"); } handle = getHandle(env, obj); snd_seq_remove_events_set_queue(handle, nQueue); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqRemoveEvents_setQueue(): end\n"); } } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqRemoveEvents * Method: setTime * Signature: (J)V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqRemoveEvents_setTime (JNIEnv* env, jobject obj, jlong lTime) { snd_seq_remove_events_t* handle; int nCondition; snd_seq_timestamp_t time; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqRemoveEvents_setTime(): begin\n"); } handle = getHandle(env, obj); nCondition = snd_seq_remove_events_get_condition(handle); if ((nCondition & SND_SEQ_REMOVE_TIME_TICK) == SND_SEQ_REMOVE_TIME_TICK) { time.tick = lTime; } else { time.time.tv_sec = lTime / 1000000000; time.time.tv_nsec = lTime % 1000000000; } snd_seq_remove_events_set_time(handle, &time); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqRemoveEvents_setTime(): end\n"); } } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqRemoveEvents * Method: setDest * Signature: (II)V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqRemoveEvents_setDest (JNIEnv* env, jobject obj, jint nClient, jint nPort) { snd_seq_remove_events_t* handle; snd_seq_addr_t newAddress; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqRemoveEvents_setDest(): begin\n"); } handle = getHandle(env, obj); newAddress.client = nClient; newAddress.port = nPort; snd_seq_remove_events_set_dest(handle, &newAddress); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqRemoveEvents_setDest(): end\n"); } } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqRemoveEvents * Method: setDestPort * Signature: (I)V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqRemoveEvents_setDestPort (JNIEnv* env, jobject obj, jint nPort) { snd_seq_remove_events_t* handle; const snd_seq_addr_t* oldAddress; snd_seq_addr_t newAddress; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqRemoveEvents_setDestPort(): begin\n"); } handle = getHandle(env, obj); oldAddress = snd_seq_remove_events_get_dest(handle); newAddress.client = oldAddress->client; newAddress.port = nPort; snd_seq_remove_events_set_dest(handle, &newAddress); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqRemoveEvents_setDestPort(): end\n"); } } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqRemoveEvents * Method: setChannel * Signature: (I)V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqRemoveEvents_setChannel (JNIEnv* env, jobject obj, jint nChannel) { snd_seq_remove_events_t* handle; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqRemoveEvents_setChannel(): begin\n"); } handle = getHandle(env, obj); snd_seq_remove_events_set_channel(handle, nChannel); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqRemoveEvents_setChannel(): end\n"); } } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqRemoveEvents * Method: setEventType * Signature: (I)V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqRemoveEvents_setEventType (JNIEnv* env, jobject obj, jint nType) { snd_seq_remove_events_t* handle; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqRemoveEvents_setEventType(): begin\n"); } handle = getHandle(env, obj); snd_seq_remove_events_set_event_type(handle, nType); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqRemoveEvents_setEventType(): end\n"); } } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqRemoveEvents * Method: setTag * Signature: (I)V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqRemoveEvents_setTag (JNIEnv* env, jobject obj, jint nTag) { snd_seq_remove_events_t* handle; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqRemoveEvents_setTag(): begin\n"); } handle = getHandle(env, obj); snd_seq_remove_events_set_tag(handle, nTag); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqRemoveEvents_setTag(): end\n"); } } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqRemoveEvents * Method: setTrace * Signature: (Z)V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqRemoveEvents_setTrace (JNIEnv* env, jclass cls, jboolean bTrace) { debug_flag = bTrace; debug_file = stderr; } /*** org_tritonus_lowlevel_alsa_AlsaSeqRemoveEvents.c ***/ libtritonus-java-20070428/src/lib/alsa/org_tritonus_lowlevel_alsa_AlsaSeqSystemInfo.c0000644000175000017500000001462207576663525030771 0ustar twernertwerner/* * org_tritonus_lowlevel_alsa_AlsaSeqSystemInfo.c */ /* * Copyright (c) 1999 - 2001 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "common.h" #include "org_tritonus_lowlevel_alsa_AlsaSeqSystemInfo.h" HandleFieldHandler(snd_seq_system_info_t*) snd_seq_system_info_t* getSystemInfoNativeHandle(JNIEnv *env, jobject obj) { return getHandle(env, obj); } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqSystemInfo * Method: malloc * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqSystemInfo_malloc (JNIEnv* env, jobject obj) { snd_seq_system_info_t* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqSystemInfo_malloc(): begin\n"); } nReturn = snd_seq_system_info_malloc(&handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqSystemInfo_malloc(): handle: %p\n", handle); } setHandle(env, obj, handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqSystemInfo_malloc(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqSystemInfo * Method: free * Signature: ()V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqSystemInfo_free (JNIEnv* env, jobject obj) { snd_seq_system_info_t* handle; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqSystemInfo_free(): begin\n"); } handle = getHandle(env, obj); snd_seq_system_info_free(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqSystemInfo_free(): end\n"); } } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqSystemInfo * Method: getQueues * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqSystemInfo_getQueues (JNIEnv* env, jobject obj) { snd_seq_system_info_t* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqSystemInfo_getQueues(): begin\n"); } handle = getHandle(env, obj); nReturn = snd_seq_system_info_get_queues(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqSystemInfo_getQueues(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqSystemInfo * Method: getClients * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqSystemInfo_getClients (JNIEnv* env, jobject obj) { snd_seq_system_info_t* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqSystemInfo_getClients(): begin\n"); } handle = getHandle(env, obj); nReturn = snd_seq_system_info_get_clients(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqSystemInfo_getClients(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqSystemInfo * Method: getPorts * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqSystemInfo_getPorts (JNIEnv* env, jobject obj) { snd_seq_system_info_t* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqSystemInfo_getPorts(): begin\n"); } handle = getHandle(env, obj); nReturn = snd_seq_system_info_get_ports(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqSystemInfo_getPorts(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqSystemInfo * Method: getChannels * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqSystemInfo_getChannels (JNIEnv* env, jobject obj) { snd_seq_system_info_t* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqSystemInfo_getChannels(): begin\n"); } handle = getHandle(env, obj); nReturn = snd_seq_system_info_get_channels(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqSystemInfo_getChannels(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqSystemInfo * Method: getCurrentClients * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqSystemInfo_getCurrentClients (JNIEnv* env, jobject obj) { snd_seq_system_info_t* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqSystemInfo_getCurrentClients(): begin\n"); } handle = getHandle(env, obj); // TODO: disabled because not available in ALSA 0.9.0beta6 nReturn = -1; // snd_seq_system_info_get_cur_clients(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqSystemInfo_getCurrentClients(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqSystemInfo * Method: getCurrentQueues * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqSystemInfo_getCurrentQueues (JNIEnv* env, jobject obj) { snd_seq_system_info_t* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqSystemInfo_getCurrentQueues(): begin\n"); } handle = getHandle(env, obj); // TODO: disabled because not available in ALSA 0.9.0beta6 nReturn = -1; // snd_seq_system_info_get_cur_queues(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_alsa_AlsaSeqSystemInfo_getCurrentQueues(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_alsa_AlsaSeqSystemInfo * Method: setTrace * Signature: (Z)V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_alsa_AlsaSeqSystemInfo_setTrace (JNIEnv* env, jclass cls, jboolean bTrace) { debug_flag = bTrace; debug_file = stderr; } /*** org_tritonus_lowlevel_alsa_AlsaSeqSystemInfo.c ***/ libtritonus-java-20070428/src/lib/cdparanoia/0000755000175000017500000000000010621572557020665 5ustar twernertwernerlibtritonus-java-20070428/src/lib/cdparanoia/.cvsignore0000644000175000017500000000004507413323466022662 0ustar twernertwernerMakefile org_tritonus_*.h *.o *.so* libtritonus-java-20070428/src/lib/cdparanoia/Makefile.in0000644000175000017500000000550507577061606022743 0ustar twernertwerner# compilation and packing of the native library for using cdparanoia # SHELL = /bin/sh prefix=@prefix@ JAVADIR=$(prefix) REL_JAVAEXTLIBPATH=@REL_JAVAEXTLIBPATH@ JAVAEXTLIBPATH=$(JAVADIR)/$(REL_JAVAEXTLIBPATH) OSNAME=@OSNAME@ ARCHNAME=@ARCHNAME@ CC=@CC@ CPPFLAGS=-g -Wall -Werror -I../common -I$(JAVADIR)/include -I$(JAVADIR)/include/$(OSNAME) -fPIC -D_REENTRANT #-pedantic INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ LN_S=@LN_S@ RM_F=@RM_F@ MKDIR_P=@MKDIR_P@ OBJDIR=../../../@BUILD_DIR@ vpath %.class $(OBJDIR)/org/tritonus/lowlevel/cdda/cdparanoia LIBBASENAME=libtritonuscdparanoia LIBDEST=$(LIBBASENAME).so.1.0 LIBDEST_ABSOLUTE=@SRC_ABSOLUTE_PATH@/src/lib/cdparanoia/$(LIBDEST) #or LIBDEST_ABSOLUTE=$(CURDIR)/$(LIBDEST) LIBS=-lcdda_interface -lcdda_paranoia JAVAH = @JAVAH@ JNIOBJ=\ org_tritonus_lowlevel_cdda_cdparanoia_Cdparanoia.o OBJ=\ $(JNIOBJ) \ ../common/common.o JNIHEADERS:=$(JNIOBJ:.o=.h) JNICLASSFILES=\ Cdparanoia.class JNICLASSES=\ org.tritonus.lowlevel.cdda.cdparanoia.Cdparanoia #----------------- rules ------------------- .PHONY: all all: $(LIBDEST) $(LIBDEST): $(OBJ) $(CC) -shared -Wl,-soname,$(LIBBASENAME).so.1 -Wl,-rpath,/home/matthias/java/tritonus/src/lib/common -o $(LIBDEST) $(OBJ) $(LIBS) $(RM_F) $(LIBBASENAME).so.1 $(LN_S) $(LIBBASENAME).so.1.0 $(LIBBASENAME).so.1 $(RM_F) $(LIBBASENAME).so $(LN_S) $(LIBBASENAME).so.1 $(LIBBASENAME).so $(OBJ): $(JNIHEADERS) $(JNIHEADERS): $(JNICLASSFILES) $(RM_F) $(JNIHEADERS) $(JAVAH) -d . $(JNICLASSES) .PHONY: install install: @echo "Installing $(LIBBASENAME) in $(JAVAEXTLIBPATH)" @$(MKDIR_P) $(JAVAEXTLIBPATH) @$(RM_F) $(JAVAEXTLIBPATH)/$(LIBBASENAME).so.1.0 @$(RM_F) $(JAVAEXTLIBPATH)/$(LIBBASENAME).so.1 @$(RM_F) $(JAVAEXTLIBPATH)/$(LIBBASENAME).so $(INSTALL_PROGRAM) $(LIBDEST) $(JAVAEXTLIBPATH) @(cd $(JAVAEXTLIBPATH) && $(LN_S) $(LIBBASENAME).so.1.0 $(LIBBASENAME).so.1) @(cd $(JAVAEXTLIBPATH) && $(LN_S) $(LIBBASENAME).so.1 $(LIBBASENAME).so) .PHONY: install-link install-link: @echo "Creating links for $(LIBBASENAME) in $(JAVAEXTLIBPATH)" @$(MKDIR_P) $(JAVAEXTLIBPATH) @$(RM_F) $(JAVAEXTLIBPATH)/$(LIBBASENAME).so.1.0 @$(RM_F) $(JAVAEXTLIBPATH)/$(LIBBASENAME).so.1 @$(RM_F) $(JAVAEXTLIBPATH)/$(LIBBASENAME).so @(cd $(JAVAEXTLIBPATH) && $(LN_S) $(LIBDEST_ABSOLUTE) $(LIBBASENAME).so.1.0) @(cd $(JAVAEXTLIBPATH) && $(LN_S) $(LIBBASENAME).so.1.0 $(LIBBASENAME).so.1) @(cd $(JAVAEXTLIBPATH) && $(LN_S) $(LIBBASENAME).so.1 $(LIBBASENAME).so) .PHONY: uninstall uninstall: @echo "Removing $(LIBBASENAME) from $(JAVAEXTLIBPATH)" @$(RM_F) $(JAVAEXTLIBPATH)/$(LIBBASENAME).so.1.0 @$(RM_F) $(JAVAEXTLIBPATH)/$(LIBBASENAME).so.1 @$(RM_F) $(JAVAEXTLIBPATH)/$(LIBBASENAME).so .PHONY: uninstall-link uninstall-link: uninstall .PHONY: clean clean: rm -rf $(LIBDEST) $(JNIHEADERS) *.o *~ libtritonus-java-20070428/src/lib/cdparanoia/handle_t.h0000644000175000017500000000026407753404211022607 0ustar twernertwerner/* * handle_t.h */ #include #include typedef struct { cdrom_drive* drive; cdrom_paranoia* paranoia; } handle_t; /*** handle_t.h ***/ libtritonus-java-20070428/src/lib/cdparanoia/org_tritonus_lowlevel_cdda_cdparanoia_Cdparanoia.c0000644000175000017500000002532707637033323032762 0ustar twernertwerner/* * org_tritonus_lowlevel_cdda_cdparanoia_Cdparanoia.c */ #include #include #include #include #include /* should declare swab(), but doesn't seem so (gcc 2.95.4/glibc 2.3.1) */ void swab(void*, void*, ssize_t); #include #include #include "../common/common.h" #include "../common/debug.h" #include "../common/HandleFieldHandler.h" #include "org_tritonus_lowlevel_cdda_cdparanoia_Cdparanoia.h" #include "handle_t.h" // default value taken over from cdparanoia's main.c static const int MAX_RETRIES = 20; static int sm_nParanoiaMode = 0; static int getParanoiaMode() { return sm_nParanoiaMode; } HandleFieldHandler(handle_t*) /* * Class: org_tritonus_lowlevel_cdda_cdparanoia_Cdparanoia * Method: open * Signature: (Ljava/lang/String;)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_cdda_cdparanoia_Cdparanoia_open (JNIEnv *env, jobject obj, jstring strDevice) { int nReturn; const char* cd_dev; cdrom_drive* cdrom = NULL; handle_t* pHandle; int nParanoiaMode; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_cdda_cdparanoia_Cdparanoia_open(): begin\n"); } cd_dev = (*env)->GetStringUTFChars(env, strDevice, NULL); if (cd_dev == NULL) { if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_cdda_cdparanoia_Cdparanoia_open(): GetStringUTFChars() failed.\n"); } return -1; } if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_cdda_cdparanoia_Cdparanoia_open(): device name: %s\n", cd_dev); } cdrom = cdda_identify(cd_dev, 0, NULL); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_cdda_cdparanoia_Cdparanoia_open(): device name: %s\n", cd_dev); } (*env)->ReleaseStringUTFChars(env, strDevice, cd_dev); if (cdrom == NULL) { if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_cdda_cdparanoia_Cdparanoia_open(): cdda_identify() failed.\n"); } return -1; } nReturn = cdda_open(cdrom); if (nReturn < 0) { if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_cdda_cdparanoia_Cdparanoia_open(): cdda_open() failed.\n"); } return -1; } if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_cdda_cdparanoia_Cdparanoia_open(): drive endianess: %d\n", cdrom->bigendianp); } pHandle = (handle_t*) malloc(sizeof(handle_t)); if (pHandle == NULL) { if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_cdda_cdparanoia_Cdparanoia_open(): malloc() failed.\n"); } cdda_close(cdrom); return -1; } pHandle->drive = cdrom; pHandle->paranoia = paranoia_init(pHandle->drive); if (pHandle->paranoia == NULL) { if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_cdda_cdparanoia_Cdparanoia_open(): paranoia_init() failed.\n"); } cdda_close(pHandle->drive); free(pHandle); return -1; } nParanoiaMode = getParanoiaMode(); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_cdda_cdparanoia_Cdparanoia_open(): paranoia mode: %d\n", nParanoiaMode); } paranoia_modeset(pHandle->paranoia, nParanoiaMode); setHandle(env, obj, pHandle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_cdda_cdparanoia_Cdparanoia_open(): end\n"); } return 0; } /* * Class: org_tritonus_lowlevel_cdda_cdparanoia_Cdparanoia * Method: close * Signature: ()V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_cdda_cdparanoia_Cdparanoia_close (JNIEnv *env, jobject obj) { handle_t* handle; cdrom_drive* cdrom; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_cdda_cdparanoia_Cdparanoia_close(): begin\n"); } // TODO: close paranoia pointer? handle = getHandle(env, obj); if (handle != NULL) { cdrom = handle->drive; if (cdrom != NULL) { cdda_close(cdrom); } } if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_cdda_cdparanoia_Cdparanoia_close(): end\n"); } } /* * Class: org_tritonus_lowlevel_cdda_cdparanoia_Cdparanoia * Method: readTOC * Signature: ([I[I[I[I[Z[Z[Z[I)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_cdda_cdparanoia_Cdparanoia_readTOC (JNIEnv* env, jobject obj, jintArray anValues, jintArray anStartFrame, jintArray anLength, jintArray anType, jbooleanArray abAudio, jbooleanArray abCopy, jbooleanArray abPre, jintArray anChannels) { handle_t* handle; cdrom_drive* cdrom; int nFirstTrack; int nLastTrack; jint* pnValues; jint* pnStartFrame; jint* pnLength; jint* pnType; jboolean* pbAudio; jboolean* pbCopy; jboolean* pbPre; jint* pnChannels; int nTrack; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_cdda_cdparanoia_Cdparanoia_readTOC(): begin\n"); } handle = getHandle(env, obj); cdrom = handle->drive; checkArrayLength(env, anValues, 2); pnValues = (*env)->GetIntArrayElements(env, anValues, NULL); if (pnValues == NULL) { throwRuntimeException(env, "GetIntArrayElements failed"); } // TODO: check if first track is guaranteed to be 1 pnValues[0] = 1; pnValues[1] = cdda_tracks(cdrom); nFirstTrack = 1; nLastTrack = cdda_tracks(cdrom); (*env)->ReleaseIntArrayElements(env, anValues, pnValues, 0); checkArrayLength(env, anStartFrame, 100); pnStartFrame = (*env)->GetIntArrayElements(env, anStartFrame, NULL); if (pnStartFrame == NULL) { throwRuntimeException(env, "GetIntArrayElements failed"); } checkArrayLength(env, anLength, 100); pnLength = (*env)->GetIntArrayElements(env, anLength, NULL); if (pnLength == NULL) { throwRuntimeException(env, "GetIntArrayElements failed"); } checkArrayLength(env, anType, 100); pnType = (*env)->GetIntArrayElements(env, anType, NULL); if (pnType == NULL) { throwRuntimeException(env, "GetIntArrayElements failed"); } checkArrayLength(env, abAudio, 100); pbAudio = (*env)->GetBooleanArrayElements(env, abAudio, NULL); if (pbAudio == NULL) { throwRuntimeException(env, "GetBooleanArrayElements failed"); } checkArrayLength(env, abCopy, 100); pbCopy = (*env)->GetBooleanArrayElements(env, abCopy, NULL); if (pbCopy == NULL) { throwRuntimeException(env, "GetBooleanArrayElements failed"); } checkArrayLength(env, abPre, 100); pbPre = (*env)->GetBooleanArrayElements(env, abPre, NULL); if (pbPre == NULL) { throwRuntimeException(env, "GetBooleanArrayElements failed"); } checkArrayLength(env, anChannels, 100); pnChannels = (*env)->GetIntArrayElements(env, anChannels, NULL); if (pnChannels == NULL) { throwRuntimeException(env, "GetIntArrayElements failed"); } for (nTrack = nFirstTrack; nTrack <= nLastTrack; nTrack++) { pnStartFrame[nTrack - nFirstTrack] = cdda_track_firstsector(cdrom, nTrack); pnLength[nTrack - nFirstTrack] = cdda_track_lastsector(cdrom, nTrack) - cdda_track_firstsector(cdrom, nTrack) + 1; pnType[nTrack - nFirstTrack] = 0; // TODO: toc_entry.cdte_ctrl & CDROM_DATA_TRACK; pbAudio[nTrack - nFirstTrack] = cdda_track_audiop(cdrom, nTrack); pbCopy[nTrack - nFirstTrack] = cdda_track_copyp(cdrom, nTrack); pbPre[nTrack - nFirstTrack] = cdda_track_preemp(cdrom, nTrack); pnChannels[nTrack - nFirstTrack] = cdda_track_channels(cdrom, nTrack); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_cdda_cdparanoia_Cdparanoia_readTOC(): %d: %d %ld %ld\n", nTrack - nFirstTrack, nTrack, (long) pnStartFrame[nTrack - nFirstTrack], (long) pnLength[nTrack - nFirstTrack]); } } (*env)->ReleaseIntArrayElements(env, anStartFrame, pnStartFrame, 0); (*env)->ReleaseIntArrayElements(env, anLength, pnLength, 0); (*env)->ReleaseIntArrayElements(env, anType, pnType, 0); (*env)->ReleaseBooleanArrayElements(env, abAudio, pbAudio, 0); (*env)->ReleaseBooleanArrayElements(env, abCopy, pbCopy, 0); (*env)->ReleaseBooleanArrayElements(env, abPre, pbPre, 0); (*env)->ReleaseIntArrayElements(env, anChannels, pnChannels, 0); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_cdda_cdparanoia_Cdparanoia_readTOC(): end\n"); } return 0; } /* * Class: org_tritonus_lowlevel_cdda_cdparanoia_Cdparanoia * Method: prepareTrack * Signature: (I)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_cdda_cdparanoia_Cdparanoia_prepareTrack (JNIEnv* env, jobject obj, jint nTrack) { handle_t* handle; cdrom_drive* cdrom; cdrom_paranoia* paranoia; int nFirstSector; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_cdda_cdparanoia_Cdparanoia_prepareTrack(): begin\n"); } handle = getHandle(env, obj); cdrom = handle->drive; paranoia = handle->paranoia; nFirstSector = cdda_track_firstsector(cdrom, nTrack); // TODO: check return value paranoia_seek(paranoia, nFirstSector, SEEK_SET); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_cdda_cdparanoia_Cdparanoia_prepareTrack(): end\n"); } return 0; } /* * Class: org_tritonus_lowlevel_cdda_cdparanoia_Cdparanoia * Method: readNextFrame * Signature: (I[B)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_cdda_cdparanoia_Cdparanoia_readNextFrame (JNIEnv *env, jobject obj, jint nCount, jbyteArray abData) { handle_t* handle; cdrom_drive* cdrom; cdrom_paranoia* paranoia; int16_t* psBuffer; jbyte* pbData; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_cdda_cdparanoia_Cdparanoia_readNextFrame(): begin\n"); } handle = getHandle(env, obj); cdrom = handle->drive; paranoia = handle->paranoia; checkArrayLength(env, abData, CD_FRAMESIZE_RAW * nCount); pbData = (*env)->GetByteArrayElements(env, abData, NULL); if (pbData == NULL) { throwRuntimeException(env, "GetByteArrayElements failed"); } // TODO: verify that NULL is allowed for callback; common values for maxretries // TODO: repeat for multiple sectors psBuffer = paranoia_read_limited(paranoia, NULL, MAX_RETRIES); if (psBuffer == NULL) { throwRuntimeException(env, "cdparanoia_Cdparanoia: read failed"); } #if __BYTE_ORDER == __LITTLE_ENDIAN (void) memcpy(pbData, psBuffer, CD_FRAMESIZE_RAW); #else swab(psBuffer, pbData, CD_FRAMESIZE_RAW); #endif (*env)->ReleaseByteArrayElements(env, abData, pbData, 0); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_cdda_cdparanoia_Cdparanoia_readNextFrame(): end\n"); } return 0; } /* * Class: org_tritonus_lowlevel_cdda_cdparanoia_Cdparanoia * Method: setTrace * Signature: (Z)V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_cdda_cdparanoia_Cdparanoia_setTrace (JNIEnv *env, jclass cls, jboolean bTrace) { debug_flag = bTrace; debug_file = stderr; } /* * Class: org_tritonus_lowlevel_cdda_cdparanoia_Cdparanoia * Method: setParanoiaMode * Signature: (Z)V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_cdda_cdparanoia_Cdparanoia_setParanoiaMode (JNIEnv* env, jclass cls, jboolean bParanoiaMode) { if (bParanoiaMode == JNI_TRUE) { sm_nParanoiaMode = PARANOIA_MODE_FULL ^ PARANOIA_MODE_NEVERSKIP; } else { sm_nParanoiaMode = PARANOIA_MODE_DISABLE; } } /*** org_tritonus_lowlevel_cdda_cdparanoia_Cdparanoia.c ***/ libtritonus-java-20070428/src/lib/common/0000755000175000017500000000000010621572560020046 5ustar twernertwernerlibtritonus-java-20070428/src/lib/common/.cvsignore0000644000175000017500000000004310373574011022040 0ustar twernertwernerMakefile *.o *.so* *.lo *.la .libs libtritonus-java-20070428/src/lib/common/HandleFieldHandler.h0000644000175000017500000000667407577062115023677 0ustar twernertwerner/* * HandleFieldHandler.h */ /* * Copyright (c) 1999 - 2002 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef _HANDLE_FIELD_HANDLER_H #define _HANDLE_FIELD_HANDLER_H #include #define HandleFieldHandler(_type) \ HandleFieldHandlerDeclaration(_handler, _type) #define HandleFieldHandlerDeclaration(_variableName, _type) \ static jfieldID _variableName ## FieldID = NULL; \ \ static jfieldID \ getNativeHandleFieldID(JNIEnv *env, jobject obj) \ { \ if (_variableName ## FieldID == NULL) \ { \ jclass cls = (*env)->GetObjectClass(env, obj); \ if (cls == NULL) \ { \ throwRuntimeException(env, "cannot get class"); \ } \ _variableName ## FieldID = (*env)->GetFieldID(env, cls, "m_lNativeHandle", "J"); \ if (_variableName ## FieldID == NULL) \ { \ throwRuntimeException(env, "cannot get field ID for m_lNativeHandle"); \ } \ } \ return _variableName ## FieldID; \ } \ \ static void \ setHandle(JNIEnv *env, jobject obj, _type handle) \ { \ jfieldID fieldID = getNativeHandleFieldID(env, obj); \ (*env)->SetLongField(env, obj, fieldID, (jlong) (int) handle); \ } \ \ static _type \ getHandle(JNIEnv *env, jobject obj) \ { \ jfieldID fieldID = getNativeHandleFieldID(env, obj); \ _type handle = (_type) (int) (*env)->GetLongField(env, obj, fieldID); \ return handle; \ } #endif /* _HANDLE_FIELD_HANDLER_H */ /*** HandleFieldHandler.h ***/ libtritonus-java-20070428/src/lib/common/Makefile.in0000644000175000017500000000455007576335021022123 0ustar twernertwerner# compilation and packing of the 'common' native library of tritonus # SHELL = /bin/sh prefix=@prefix@ JAVADIR=$(prefix) REL_JAVAEXTLIBPATH=@REL_JAVAEXTLIBPATH@ JAVAEXTLIBPATH=$(JAVADIR)/$(REL_JAVAEXTLIBPATH) OSNAME=@OSNAME@ ARCHNAME=@ARCHNAME@ CC=@CC@ CPPFLAGS=-g -Wall -Werror -I$(JAVADIR)/include -I$(JAVADIR)/include/$(OSNAME) -fPIC -D_REENTRANT #-pedantic INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ LN_S=@LN_S@ RM_F=@RM_F@ MKDIR_P=@MKDIR_P@ LIBBASENAME=libtritonuscommon LIBDEST=$(LIBBASENAME).so.1.0 # # ATTENTION: not adapted field in the next line !!! # LIBDEST_ABSOLUTE=@SRC_ABSOLUTE_PATH@/src/lib/alsa/$(LIBDEST) #or LIBDEST_ABSOLUTE=$(CURDIR)/$(LIBDEST) OBJ=\ common.o #----------------- rules ------------------- .PHONY: all all: $(LIBDEST) $(LIBDEST): $(OBJ) $(CC) -nostartfiles -shared -Wl,-soname,$(LIBBASENAME).so.1 -o $(LIBDEST) $(OBJ) -L/usr/lib $(LIBS) $(RM_F) $(LIBBASENAME).so.1 $(LN_S) $(LIBBASENAME).so.1.0 $(LIBBASENAME).so.1 $(RM_F) $(LIBBASENAME).so $(LN_S) $(LIBBASENAME).so.1 $(LIBBASENAME).so .PHONY: install install: @echo "Installing $(LIBBASENAME) in $(JAVAEXTLIBPATH)" @$(MKDIR_P) $(JAVAEXTLIBPATH) @$(RM_F) $(JAVAEXTLIBPATH)/$(LIBBASENAME).so.1.0 @$(RM_F) $(JAVAEXTLIBPATH)/$(LIBBASENAME).so.1 @$(RM_F) $(JAVAEXTLIBPATH)/$(LIBBASENAME).so $(INSTALL_PROGRAM) $(LIBDEST) $(JAVAEXTLIBPATH) @(cd $(JAVAEXTLIBPATH) && $(LN_S) $(LIBBASENAME).so.1.0 $(LIBBASENAME).so.1) @(cd $(JAVAEXTLIBPATH) && $(LN_S) $(LIBBASENAME).so.1 $(LIBBASENAME).so) .PHONY: install-link install-link: @echo "Creating links for $(LIBBASENAME) in $(JAVAEXTLIBPATH)" @$(MKDIR_P) $(JAVAEXTLIBPATH) @$(RM_F) $(JAVAEXTLIBPATH)/$(LIBBASENAME).so.1.0 @$(RM_F) $(JAVAEXTLIBPATH)/$(LIBBASENAME).so.1 @$(RM_F) $(JAVAEXTLIBPATH)/$(LIBBASENAME).so @(cd $(JAVAEXTLIBPATH) && $(LN_S) $(LIBDEST_ABSOLUTE) $(LIBBASENAME).so.1.0) @(cd $(JAVAEXTLIBPATH) && $(LN_S) $(LIBBASENAME).so.1.0 $(LIBBASENAME).so.1) @(cd $(JAVAEXTLIBPATH) && $(LN_S) $(LIBBASENAME).so.1 $(LIBBASENAME).so) .PHONY: uninstall uninstall: @echo "Removing $(LIBBASENAME) from $(JAVAEXTLIBPATH)" @$(RM_F) $(JAVAEXTLIBPATH)/$(LIBBASENAME).so.1.0 @$(RM_F) $(JAVAEXTLIBPATH)/$(LIBBASENAME).so.1 @$(RM_F) $(JAVAEXTLIBPATH)/$(LIBBASENAME).so .PHONY: uninstall-link uninstall-link: uninstall .PHONY: clean clean: rm -rf $(LIBDEST) *.o *~ libtritonus-java-20070428/src/lib/common/common.c0000644000175000017500000000411007576335021021502 0ustar twernertwerner/* * common.c */ /* * Copyright (c) 1999 - 2001 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "common.h" #include "debug.h" void throwRuntimeException(JNIEnv *env, const char* pStrMessage) { static jclass runtimeExceptionClass = NULL; if ((*env)->ExceptionOccurred(env) != NULL) { if (debug_flag) { (*env)->ExceptionDescribe(env); } (*env)->ExceptionClear(env); } if (runtimeExceptionClass == NULL) { runtimeExceptionClass = (*env)->FindClass(env, "java/lang/RuntimeException"); if (debug_flag) { fprintf(debug_file, "RTE: %p\n", runtimeExceptionClass); } if (runtimeExceptionClass == NULL) { (*env)->FatalError(env, "cannot get class object for java.lang.RuntimeException"); } } (*env)->ThrowNew(env, runtimeExceptionClass, pStrMessage); } void checkArrayLength(JNIEnv *env, jarray array, int nRequiredLength) { int nLength; nLength = (*env)->GetArrayLength(env, array); if (nLength < nRequiredLength) { throwRuntimeException(env, "array does not have enough elements"); } } void setStringArrayElement(JNIEnv *env, jobjectArray array, int nIndex, const char* string1) { jstring string2; string2 = (*env)->NewStringUTF(env, string1); if (string1 == NULL) { throwRuntimeException(env, "NewStringUTF() failed"); } (*env)->SetObjectArrayElement(env, array, nIndex, string2); } /*** common.c ***/ libtritonus-java-20070428/src/lib/common/common.h0000644000175000017500000000214507545342176021522 0ustar twernertwerner/* * common.h */ /* * Copyright (c) 1999 - 2001 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include void throwRuntimeException(JNIEnv *env, const char* pStrMessage); void checkArrayLength(JNIEnv *env, jarray array, int nRequiredLength); void setStringArrayElement(JNIEnv *env, jobjectArray array, int nIndex, const char* string1); /*** common.h ***/ libtritonus-java-20070428/src/lib/common/debug.h0000644000175000017500000000233710373702263021311 0ustar twernertwerner/* * debug.h */ /* * Copyright (c) 1999 - 2006 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef _DEBUG_H #define _DEBUG_H #include #define FALSE 0 #define TRUE 1 #ifndef _MSC_VER #define VARIADIC_MACROS #elif _MSC_VER >= 1400 #define VARIADIC_MACROS #endif #ifdef VARIADIC_MACROS #define out(...) if (debug_flag) { fprintf(debug_file, __VA_ARGS__); \ fflush(debug_file); } #endif static int debug_flag = FALSE; static FILE* debug_file = NULL; #endif /* _DEBUG_H */ /*** debug.h ***/ libtritonus-java-20070428/src/lib/cooked_ioctl/0000755000175000017500000000000010621572561021215 5ustar twernertwernerlibtritonus-java-20070428/src/lib/cooked_ioctl/.cvsignore0000644000175000017500000000004507413323467023220 0ustar twernertwernerMakefile org_tritonus_*.h *.o *.so* libtritonus-java-20070428/src/lib/cooked_ioctl/Makefile.in0000644000175000017500000000536607545261365023304 0ustar twernertwerner# compilation and packing of the native library for simple cdda # SHELL = /bin/sh prefix=@prefix@ JAVADIR=$(prefix) REL_JAVAEXTLIBPATH=@REL_JAVAEXTLIBPATH@ JAVAEXTLIBPATH=$(JAVADIR)/$(REL_JAVAEXTLIBPATH) OSNAME=@OSNAME@ ARCHNAME=@ARCHNAME@ CC=@CC@ CPPFLAGS=-g -Wall -I$(JAVADIR)/include -I$(JAVADIR)/include/$(OSNAME) -fPIC -D_REENTRANT #-pedantic INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ LN_S=@LN_S@ RM_F=@RM_F@ MKDIR_P=@MKDIR_P@ OBJDIR=../../../@BUILD_DIR@ vpath %.class $(OBJDIR)/org/tritonus/lowlevel/cdda/cooked_ioctl LIBBASENAME=libtritonuscooked_ioctl LIBDEST=$(LIBBASENAME).so.1.0 LIBDEST_ABSOLUTE=@SRC_ABSOLUTE_PATH@/src/lib/cdda/$(LIBDEST) #or LIBDEST_ABSOLUTE=$(CURDIR)/$(LIBDEST) JAVAH = @JAVAH@ JNIOBJ=\ org_tritonus_lowlevel_cdda_cooked_ioctl_CookedIoctl.o OBJ=$(JNIOBJ) \ handlers.o JNIHEADERS:=\ org_tritonus_lowlevel_cdda_cooked_0005fioctl_CookedIoctl.h JNICLASSFILES=\ CookedIoctl.class JNICLASSES=\ org.tritonus.lowlevel.cdda.cooked_ioctl.CookedIoctl #----------------- rules ------------------- .PHONY: all all: $(LIBDEST) $(LIBDEST): $(OBJ) $(CC) -shared -Wl,-soname,$(LIBBASENAME).so.1 -o $(LIBDEST) $(OBJ) $(LIBS) $(RM_F) $(LIBBASENAME).so.1 $(LN_S) $(LIBBASENAME).so.1.0 $(LIBBASENAME).so.1 $(RM_F) $(LIBBASENAME).so $(LN_S) $(LIBBASENAME).so.1 $(LIBBASENAME).so $(OBJ): $(JNIHEADERS) $(JNIHEADERS): $(JNICLASSFILES) $(RM_F) $(JNIHEADERS) $(JAVAH) -d . $(JNICLASSES) .PHONY: install install: @echo "Installing $(LIBBASENAME) in $(JAVAEXTLIBPATH)" @$(MKDIR_P) $(JAVAEXTLIBPATH) @$(RM_F) $(JAVAEXTLIBPATH)/$(LIBBASENAME).so.1.0 @$(RM_F) $(JAVAEXTLIBPATH)/$(LIBBASENAME).so.1 @$(RM_F) $(JAVAEXTLIBPATH)/$(LIBBASENAME).so $(INSTALL_PROGRAM) $(LIBDEST) $(JAVAEXTLIBPATH) @(cd $(JAVAEXTLIBPATH) && $(LN_S) $(LIBBASENAME).so.1.0 $(LIBBASENAME).so.1) @(cd $(JAVAEXTLIBPATH) && $(LN_S) $(LIBBASENAME).so.1 $(LIBBASENAME).so) .PHONY: install-link install-link: @echo "Creating links for $(LIBBASENAME) in $(JAVAEXTLIBPATH)" @$(MKDIR_P) $(JAVAEXTLIBPATH) @$(RM_F) $(JAVAEXTLIBPATH)/$(LIBBASENAME).so.1.0 @$(RM_F) $(JAVAEXTLIBPATH)/$(LIBBASENAME).so.1 @$(RM_F) $(JAVAEXTLIBPATH)/$(LIBBASENAME).so @(cd $(JAVAEXTLIBPATH) && $(LN_S) $(LIBDEST_ABSOLUTE) $(LIBBASENAME).so.1.0) @(cd $(JAVAEXTLIBPATH) && $(LN_S) $(LIBBASENAME).so.1.0 $(LIBBASENAME).so.1) @(cd $(JAVAEXTLIBPATH) && $(LN_S) $(LIBBASENAME).so.1 $(LIBBASENAME).so) .PHONY: uninstall uninstall: @echo "Removing $(LIBBASENAME) from $(JAVAEXTLIBPATH)" @$(RM_F) $(JAVAEXTLIBPATH)/$(LIBBASENAME).so.1.0 @$(RM_F) $(JAVAEXTLIBPATH)/$(LIBBASENAME).so.1 @$(RM_F) $(JAVAEXTLIBPATH)/$(LIBBASENAME).so .PHONY: uninstall-link uninstall-link: uninstall .PHONY: clean clean: rm -rf $(LIBDEST) $(JNIHEADERS) *.o *~ libtritonus-java-20070428/src/lib/cooked_ioctl/handlers.cc0000644000175000017500000000020607452717025023326 0ustar twernertwerner/* * handlers.cc */ #include "../common/HandleFieldHandler.cc" template class HandleFieldHandler; /*** handlers.cc ***/ ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootlibtritonus-java-20070428/src/lib/cooked_ioctl/org_tritonus_lowlevel_cdda_cooked_ioctl_CookedIoctl.cclibtritonus-java-20070428/src/lib/cooked_ioctl/org_tritonus_lowlevel_cdda_cooked_ioctl_CookedIoctl.c0000644000175000017500000001344107452717025034007 0ustar twernertwerner/* * org_tritonus_lowlevel_cdda_cooked_ioctl_CookedIoctl.cc */ #include #include #include #include #include #include #include "../common/common.h" #include "../common/HandleFieldHandler.hh" #include "org_tritonus_lowlevel_cdda_cooked_0005fioctl_CookedIoctl.h" static int DEBUG = 0; static FILE* debug_file = NULL; static HandleFieldHandler handler; /* * Class: org_tritonus_lowlevel_cdda_cooked_0005fioctl_CookedIoctl * Method: open * Signature: (Ljava/lang/String;)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_cdda_cooked_1ioctl_CookedIoctl_open (JNIEnv *env, jobject obj, jstring strDevice) { int cdrom_fd; char* cd_dev = "/dev/cdrom"; // TODO: use passed device name if (DEBUG) { fprintf(debug_file, "Java_org_tritonus_lowlevel_cdda_cooked_1ioctl_CookedIoctl_open(): begin\n"); } cdrom_fd = open(cd_dev, O_RDONLY | O_NONBLOCK); if (cdrom_fd == -1) { return -errno; } handler.setHandle(env, obj, cdrom_fd); if (DEBUG) { fprintf(debug_file, "Java_org_tritonus_lowlevel_cdda_cooked_1ioctl_CookedIoctl_open(): end\n"); } return 0; } /* * Class: org_tritonus_lowlevel_cdda_cooked_0005fioctl_CookedIoctl * Method: close * Signature: ()V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_cdda_cooked_1ioctl_CookedIoctl_close (JNIEnv *env, jobject obj) { int fd; if (DEBUG) { fprintf(debug_file, "Java_org_tritonus_lowlevel_cdda_cooked_1ioctl_CookedIoctl_close(): begin\n"); } fd = handler.getHandle(env, obj); close(fd); if (DEBUG) { fprintf(debug_file, "Java_org_tritonus_lowlevel_cdda_cooked_1ioctl_CookedIoctl_close(): end\n"); } } /* * Class: org_tritonus_lowlevel_cdda_cooked_0005fioctl_CookedIoctl * Method: readTOC * Signature: ([I[I[I[I[Z[Z[I)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_cdda_cooked_1ioctl_CookedIoctl_readTOC (JNIEnv *env, jobject obj, jintArray anValues, jintArray anStartFrame, jintArray anLength, jintArray anType, jbooleanArray abCopy, jbooleanArray abPre, jintArray anChannels) { int cdrom_fd; int nReturn; struct cdrom_tochdr toc_hdr; struct cdrom_tocentry toc_entry; int nFirstTrack; int nLastTrack; jint* pnValues; jint* pnStartFrame; jint* pnType; int i; if (DEBUG) { fprintf(debug_file, "Java_org_tritonus_lowlevel_cdda_cooked_1ioctl_CookedIoctl_readTOC(): begin\n"); } cdrom_fd = handler.getHandle(env, obj); nReturn = ioctl(cdrom_fd, CDROMREADTOCHDR, &toc_hdr); if (nReturn < 0) { throwRuntimeException(env, "CookedIoctl: read TOC header ioctl failed"); } checkArrayLength(env, anValues, 2); pnValues = env->GetIntArrayElements(anValues, NULL); if (pnValues == NULL) { throwRuntimeException(env, "GetIntArrayElements failed"); } pnValues[0] = toc_hdr.cdth_trk0; pnValues[1] = toc_hdr.cdth_trk1; nFirstTrack = toc_hdr.cdth_trk0; nLastTrack = toc_hdr.cdth_trk1; env->ReleaseIntArrayElements(anValues, pnValues, 0); checkArrayLength(env, anStartFrame, 100); pnStartFrame = env->GetIntArrayElements(anStartFrame, NULL); if (pnStartFrame == NULL) { throwRuntimeException(env, "GetIntArrayElements failed"); } checkArrayLength(env, anType, 100); pnType = env->GetIntArrayElements(anType, NULL); if (pnType == NULL) { throwRuntimeException(env, "GetIntArrayElements failed"); } // TODO: i -> nTrack for (i = nFirstTrack; i <= nLastTrack; i++) { toc_entry.cdte_track = i; toc_entry.cdte_format = CDROM_LBA; nReturn = ioctl(cdrom_fd, CDROMREADTOCENTRY, &toc_entry); if (nReturn < 0) { throwRuntimeException(env, "CookedIoctl: read TOC entry ioctl failed"); } pnStartFrame[i - nFirstTrack] = toc_entry.cdte_addr.lba; pnType[i - nFirstTrack] = toc_entry.cdte_ctrl & CDROM_DATA_TRACK; } i = CDROM_LEADOUT; toc_entry.cdte_track = i; toc_entry.cdte_format = CDROM_LBA; nReturn = ioctl(cdrom_fd, CDROMREADTOCENTRY, &toc_entry); if (nReturn < 0) { throwRuntimeException(env, "CookedIoctl: read TOC entry ioctl failed"); } pnStartFrame[nLastTrack - nFirstTrack + 1] = toc_entry.cdte_addr.lba; pnType[nLastTrack - nFirstTrack + 1] = toc_entry.cdte_ctrl&CDROM_DATA_TRACK; env->ReleaseIntArrayElements(anStartFrame, pnStartFrame, 0); env->ReleaseIntArrayElements(anType, pnType, 0); if (DEBUG) { fprintf(debug_file, "Java_org_tritonus_lowlevel_cdda_cooked_1ioctl_CookedIoctl_readTOC(): end\n"); } return 0; } /* * Class: org_tritonus_lowlevel_cdda_cooked_0005fioctl_CookedIoctl * Method: readFrame * Signature: (II[B)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_cdda_cooked_1ioctl_CookedIoctl_readFrame (JNIEnv *env, jobject obj, jint nStartFrame, jint nCount, jbyteArray abData) { int cdrom_fd; int nReturn; struct cdrom_read_audio ra; jbyte* pbData; if (DEBUG) { fprintf(debug_file, "Java_org_tritonus_lowlevel_cdda_cooked_1ioctl_CookedIoctl_readFrame(): begin\n"); } cdrom_fd = handler.getHandle(env, obj); checkArrayLength(env, abData, CD_FRAMESIZE_RAW * nCount); pbData = env->GetByteArrayElements(abData, NULL); if (pbData == NULL) { throwRuntimeException(env, "GetIntArrayElements failed"); } ra.addr.lba = nStartFrame; ra.addr_format = CDROM_LBA; ra.nframes = nCount; ra.buf = (unsigned char*) pbData; nReturn = ioctl(cdrom_fd, CDROMREADAUDIO, &ra); if (nReturn < 0) { throwRuntimeException(env, "CookedIoctl: read raw ioctl failed"); } env->ReleaseByteArrayElements(abData, pbData, 0); if (DEBUG) { fprintf(debug_file, "Java_org_tritonus_lowlevel_cdda_cooked_1ioctl_CookedIoctl_readFrame(): end\n"); } return 0; } /* * Class: org_tritonus_lowlevel_cdda_cooked_0005fioctl_CookedIoctl * Method: setTrace * Signature: (Z)V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_cdda_cooked_1ioctl_CookedIoctl_setTrace (JNIEnv *env, jclass cls, jboolean bTrace) { DEBUG = bTrace; debug_file = stderr; } /*** org_tritonus_lowlevel_cdda_cooked_ioctl_CookedIoctl.cc ***/ libtritonus-java-20070428/src/lib/esd/0000755000175000017500000000000010621572561017332 5ustar twernertwernerlibtritonus-java-20070428/src/lib/esd/.cvsignore0000644000175000017500000000003007164141114021315 0ustar twernertwernerMakefile *.h *.o *.so* libtritonus-java-20070428/src/lib/esd/Makefile.in0000644000175000017500000000547107576664771021432 0ustar twernertwerner# compilation and packing of the native library for esd # SHELL = /bin/sh prefix=@prefix@ JAVADIR=$(prefix) REL_JAVAEXTLIBPATH=@REL_JAVAEXTLIBPATH@ JAVAEXTLIBPATH=$(JAVADIR)/$(REL_JAVAEXTLIBPATH) OSNAME=@OSNAME@ ARCHNAME=@ARCHNAME@ CC=@CC@ CPPFLAGS=-g -Wall -Werror -I$(JAVADIR)/include -I$(JAVADIR)/include/$(OSNAME) -fPIC -D_REENTRANT #-pedantic INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ LN_S=@LN_S@ RM_F=@RM_F@ MKDIR_P=@MKDIR_P@ OBJDIR=../../../@BUILD_DIR@ vpath %.class $(OBJDIR)/org/tritonus/lowlevel/esd LIBBASENAME=libtritonusesd LIBDEST=$(LIBBASENAME).so.1.0 LIBDEST_ABSOLUTE=@SRC_ABSOLUTE_PATH@/src/lib/esd/$(LIBDEST) #or LIBDEST_ABSOLUTE=$(CURDIR)/$(LIBDEST) LIBS=-lesd JAVAH = @JAVAH@ JNIOBJ=\ org_tritonus_lowlevel_esd_EsdRecordingStream.o \ org_tritonus_lowlevel_esd_EsdStream.o OBJ=\ $(JNIOBJ) \ ../common/common.o JNIHEADERS:=$(JNIOBJ:.o=.h) JNICLASSFILES=\ EsdRecordingStream.class \ EsdStream.class JNICLASSES=\ org.tritonus.lowlevel.esd.EsdRecordingStream \ org.tritonus.lowlevel.esd.EsdStream #----------------- rules ------------------- .PHONY: all all: $(LIBDEST) $(LIBDEST): $(OBJ) $(CC) -nostartfiles -shared -Wl,-soname,$(LIBBASENAME).so.1 -o $(LIBDEST) $(OBJ) -L/usr/lib $(LIBS) $(RM_F) $(LIBBASENAME).so.1 $(LN_S) $(LIBBASENAME).so.1.0 $(LIBBASENAME).so.1 $(RM_F) $(LIBBASENAME).so $(LN_S) $(LIBBASENAME).so.1 $(LIBBASENAME).so $(OBJ): $(JNIHEADERS) $(JNIHEADERS): $(JNICLASSFILES) $(RM_F) $(JNIHEADERS) $(JAVAH) -d . $(JNICLASSES) .PHONY: install install: @echo "Installing $(LIBBASENAME) in $(JAVAEXTLIBPATH)" @$(MKDIR_P) $(JAVAEXTLIBPATH) @$(RM_F) $(JAVAEXTLIBPATH)/$(LIBBASENAME).so.1.0 @$(RM_F) $(JAVAEXTLIBPATH)/$(LIBBASENAME).so.1 @$(RM_F) $(JAVAEXTLIBPATH)/$(LIBBASENAME).so $(INSTALL_PROGRAM) $(LIBDEST) $(JAVAEXTLIBPATH) @(cd $(JAVAEXTLIBPATH) && $(LN_S) $(LIBBASENAME).so.1.0 $(LIBBASENAME).so.1) @(cd $(JAVAEXTLIBPATH) && $(LN_S) $(LIBBASENAME).so.1 $(LIBBASENAME).so) .PHONY: install-link install-link: @echo "Creating links for $(LIBBASENAME) in $(JAVAEXTLIBPATH)" @$(MKDIR_P) $(JAVAEXTLIBPATH) @$(RM_F) $(JAVAEXTLIBPATH)/$(LIBBASENAME).so.1.0 @$(RM_F) $(JAVAEXTLIBPATH)/$(LIBBASENAME).so.1 @$(RM_F) $(JAVAEXTLIBPATH)/$(LIBBASENAME).so @(cd $(JAVAEXTLIBPATH) && $(LN_S) $(LIBDEST_ABSOLUTE) $(LIBBASENAME).so.1.0) @(cd $(JAVAEXTLIBPATH) && $(LN_S) $(LIBBASENAME).so.1.0 $(LIBBASENAME).so.1) @(cd $(JAVAEXTLIBPATH) && $(LN_S) $(LIBBASENAME).so.1 $(LIBBASENAME).so) .PHONY: uninstall uninstall: @echo "Removing $(LIBBASENAME) from $(JAVAEXTLIBPATH)" @$(RM_F) $(JAVAEXTLIBPATH)/$(LIBBASENAME).so.1.0 @$(RM_F) $(JAVAEXTLIBPATH)/$(LIBBASENAME).so.1 @$(RM_F) $(JAVAEXTLIBPATH)/$(LIBBASENAME).so .PHONY: uninstall-link uninstall-link: uninstall .PHONY: clean clean: rm -rf $(LIBDEST) $(JNIHEADERS) *.o *~ libtritonus-java-20070428/src/lib/esd/common.h0000644000175000017500000000174207576332705021010 0ustar twernertwerner/* * common.h */ /* * Copyright (c) 1999 - 2001 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include #include "../common/HandleFieldHandler.h" #include "../common/common.h" #include "../common/debug.h" /*** common.h ***/ libtritonus-java-20070428/src/lib/esd/org_tritonus_lowlevel_esd_EsdRecordingStream.c0000644000175000017500000000550107576332705030616 0ustar twernertwerner/* * org_tritonus_lowlevel_esd_EsdRecordingStream.cc */ #include #include #include #include "common.h" #include "org_tritonus_lowlevel_esd_EsdRecordingStream.h" // static HandleFieldHandler handler; HandleFieldHandlerDeclaration(handler,int) /* * Class: org_tritonus_lowlevel_esd_EsdRecordingStream * Method: open * Signature: (II)V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_esd_EsdRecordingStream_open (JNIEnv *env, jobject obj, jint nFormat, jint nSampleRate) { int nFd = -1; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_esd_EsdRecordingStream_open(): begin\n"); } nFd = esd_record_stream/*_fallback*/(nFormat, nSampleRate, NULL, "abc"); if (nFd < 0) { // cerr << "cannot create esd stream\n"; // jclass cls = env->FindClass("org/tritonus_lowlevel/nas/DeviceAttributes"); // env->ThrowNew(cls, "exc: cannot create esd stream"); } setHandle(env, obj, nFd); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_esd_EsdRecordingStream_open(): end\n"); } } /* * Class: org_tritonus_lowlevel_esd_EsdRecordingStream * Method: read * Signature: ([BII)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_esd_EsdRecordingStream_read (JNIEnv *env, jobject obj, jbyteArray abData, jint nOffset, jint nLength) { int nFd = -1; int nBytesRead = 0; jbyte buffer[nLength]; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_esd_EsdRecordingStream_read(): begin\n"); } nFd = getHandle(env, obj); nBytesRead = read(nFd, buffer, nLength); if (nBytesRead > 0) { (*env)->SetByteArrayRegion(env, abData, nOffset, nBytesRead, buffer); } if (debug_flag) { printf("Java_org_tritonus_lowlevel_esd_EsdRecordingStream_read: Length: %d\n", (int) nLength); printf("Java_org_tritonus_lowlevel_esd_EsdRecordingStream_read: Read: %d\n", nBytesRead); } if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_esd_EsdRecordingStream_read(): end\n"); } return nBytesRead; } /* * Class: org_tritonus_lowlevel_esd_EsdRecordingStream * Method: close * Signature: ()V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_esd_EsdRecordingStream_close (JNIEnv *env, jobject obj) { int nFd = -1; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_esd_EsdRecordingStream_close(): begin\n"); } nFd = getHandle(env, obj); close(nFd); setHandle(env, obj, -1); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_esd_EsdRecordingStream_close(): end\n"); } } /* * Class: org_tritonus_lowlevel_esd_EsdStream * Method: setTrace * Signature: (Z)V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_esd_EsdRecordingStream_setTrace (JNIEnv* env, jclass cls, jboolean bTrace) { debug_flag = bTrace; debug_file = stderr; } /*** org_tritonus_lowlevel_esd_EsdRecordingStream.cc ***/ libtritonus-java-20070428/src/lib/esd/org_tritonus_lowlevel_esd_EsdStream.c0000644000175000017500000000747207622451372026764 0ustar twernertwerner/* * org_tritonus_lowlevel_esd_EsdStream.c */ /* * Copyright (c) 1999, 2000 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ #include #include #include #include #include "common.h" #include "org_tritonus_lowlevel_esd_EsdStream.h" // TODO: remove, replace by debug_flag //static int debug_flag = 0; HandleFieldHandlerDeclaration(handler, int) /* * Class: org_tritonus_lowlevel_esd_EsdStream * Method: open * Signature: (II)V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_esd_EsdStream_open (JNIEnv *env, jobject obj, jint nFormat, jint nSampleRate) { int nFd = -1; char name[20]; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_esd_EsdStream_open(): begin\n"); } sprintf(name, "trit%d", (int) obj); // DANGEROUS!! // printf("name: %s\n", name); errno = 0; //perror("abc"); nFd = esd_play_stream/*_fallback*/(nFormat, nSampleRate, NULL, name); if (nFd < 0) { // TODO: error message printf("Java_org_tritonus_lowlevel_esd_EsdStream_open: cannot create esd stream\n"); perror("abc"); // jclass cls = env->FindClass("org/tritonus_lowlevel/nas/DeviceAttributes"); // env->ThrowNew(cls, "exc: cannot create esd stream"); } // printf("fd: %d\n", nFd); //perror("abc"); setHandle(env, obj, nFd); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_esd_EsdStream_open(): end\n"); } } /* * Class: org_tritonus_lowlevel_esd_EsdStream * Method: write * Signature: ([BII)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_esd_EsdStream_write (JNIEnv *env, jobject obj, jbyteArray abData, jint nOffset, jint nLength) { int nFd = -1; signed char* data = NULL; int nWritten = -1; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_esd_EsdStream_write(): begin\n"); } nFd = getHandle(env, obj); data = (*env)->GetByteArrayElements(env, abData, NULL); nWritten = write(nFd, data + nOffset, nLength); (*env)->ReleaseByteArrayElements(env, abData, data, JNI_ABORT); if (debug_flag) { printf("Java_org_tritonus_lowlevel_esd_EsdStream_write: Length: %d\n", (int) nLength); printf("Java_org_tritonus_lowlevel_esd_EsdStream_write: Written: %d\n", nWritten); } if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_esd_EsdStream_write(): end\n"); } return nWritten; } /* * Class: org_tritonus_lowlevel_esd_EsdStream * Method: close * Signature: ()V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_esd_EsdStream_close (JNIEnv *env, jobject obj) { int nFd = -1; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_esd_EsdStream_close(): begin\n"); } nFd = getHandle(env, obj); close(nFd); setHandle(env, obj, -1); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_esd_EsdStream_close(): end\n"); } } /* * Class: org_tritonus_lowlevel_esd_EsdStream * Method: setTrace * Signature: (Z)V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_esd_EsdStream_setTrace (JNIEnv* env, jclass cls, jboolean bTrace) { debug_flag = bTrace; debug_file = stderr; } /*** org_tritonus_lowlevel_esd_EsdStream.c ***/ libtritonus-java-20070428/src/lib/fluidsynth/0000755000175000017500000000000010621572562020751 5ustar twernertwernerlibtritonus-java-20070428/src/lib/fluidsynth/.cvsignore0000644000175000017500000000006410373072070022742 0ustar twernertwernerMakefile org_tritonus_*.h *.o *.so* *.lo *.la .libs libtritonus-java-20070428/src/lib/fluidsynth/Makefile.am0000644000175000017500000000043210401161422022765 0ustar twernertwernerlib_LTLIBRARIES = libtritonusfluid.la libtritonusfluid_la_SOURCES = org_tritonus_midi_device_fluidsynth_FluidSynthesizer.c org_tritonus_midi_device_fluidsynth_FluidSynthesizer.h libtritonusfluid_la_LDFLAGS = -no-undefined -L /usr/local/lib libtritonusfluid_la_LIBADD = -lfluidsynth libtritonus-java-20070428/src/lib/fluidsynth/Makefile.in0000644000175000017500000000671610373446731023032 0ustar twernertwerner# compilation and packing of the native library for alsa # SHELL = /bin/sh prefix=@prefix@ JAVADIR=$(prefix) REL_JAVAEXTLIBPATH=@REL_JAVAEXTLIBPATH@ JAVAEXTLIBPATH=$(JAVADIR)/$(REL_JAVAEXTLIBPATH) OSNAME=@OSNAME@ ARCHNAME=@ARCHNAME@ CC=libtool --mode=compile @CC@ CPPFLAGS=-g -Wall -Werror -I"$(JAVADIR)/include" -I"$(JAVADIR)/include/$(OSNAME)" #-fPIC -D_REENTRANT #-pedantic INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ LN_S=@LN_S@ RM_F=@RM_F@ MKDIR_P=@MKDIR_P@ OBJDIR=../../../@BUILD_DIR@ vpath %.class $(OBJDIR)/org/tritonus/midi/device/fluidsynth vpath %.class $(OBJDIR)/org/tritonus/midi/sb/fluidsynth LIBBASENAME=libtritonusfluid LIBDEST=$(LIBBASENAME).so.1.0 LIBDEST_ABSOLUTE=@SRC_ABSOLUTE_PATH@/src/lib/fluidsynth/$(LIBDEST) #or LIBDEST_ABSOLUTE=$(CURDIR)/$(LIBDEST) # This is intended to be overridden. For instance: # export EXTRALIBS=-lefence; make -e EXTRALIBS= LIBS=-lfluidsynth $(EXTRALIBS) JAVAH = @JAVAH@ JNIOBJ=\ org_tritonus_midi_device_fluidsynth_FluidSynthesizer.o \ # org_tritonus_midi_sb_fluidsynth_FluidSoundbank.o OBJ=\ $(JNIOBJ) \ ../common/common.o LTOBJ:=$(OBJ:.o=.lo) JNIHEADERS:=$(JNIOBJ:.o=.h) JNICLASSFILES=\ FluidSynthesizer.class \ FluidSoundbank.class JNICLASSES=\ org.tritonus.midi.device.fluidsynth.FluidSynthesizer \ org.tritonus.midi.sb.fluidsynth.FluidSoundbank #----------------- rules ------------------- .PHONY: all all: $(LIBDEST) $(LIBDEST): $(OBJ) libtool --mode=link gcc -g -O -o $(LIBBASENAME).la $(LTOBJ) \ -rpath /usr/lib $(LIBS) ## $(CC) -nostartfiles -shared -Wl,-soname,$(LIBBASENAME).so.1 -o $(LIBDEST) $(OBJ) -L/usr/lib $(LIBS) ## ## use this for testing with a custom version of libfluidsynth ## ## $(CC) -nostartfiles -shared -Wl,-soname,$(LIBBASENAME).so.1 -Wl,--rpath -Wl,/usr/local/lib -o $(LIBDEST) $(OBJ) -L/usr/lib $(LIBS) $(RM_F) $(LIBBASENAME).so.1 $(LN_S) $(LIBBASENAME).so.1.0 $(LIBBASENAME).so.1 $(RM_F) $(LIBBASENAME).so $(LN_S) $(LIBBASENAME).so.1 $(LIBBASENAME).so $(OBJ): $(JNIHEADERS) $(JNIHEADERS): $(JNICLASSFILES) $(RM_F) $(JNIHEADERS) $(JAVAH) -d . $(JNICLASSES) .PHONY: install install: @echo "Installing $(LIBBASENAME) in $(JAVAEXTLIBPATH)" @$(MKDIR_P) $(JAVAEXTLIBPATH) @$(RM_F) $(JAVAEXTLIBPATH)/$(LIBBASENAME).so.1.0 @$(RM_F) $(JAVAEXTLIBPATH)/$(LIBBASENAME).so.1 @$(RM_F) $(JAVAEXTLIBPATH)/$(LIBBASENAME).so $(INSTALL_PROGRAM) $(LIBDEST) $(JAVAEXTLIBPATH) @(cd $(JAVAEXTLIBPATH) && $(LN_S) $(LIBBASENAME).so.1.0 $(LIBBASENAME).so.1) @(cd $(JAVAEXTLIBPATH) && $(LN_S) $(LIBBASENAME).so.1 $(LIBBASENAME).so) .PHONY: install-link install-link: @echo "Creating links for $(LIBBASENAME) in $(JAVAEXTLIBPATH)" @$(MKDIR_P) $(JAVAEXTLIBPATH) @$(RM_F) $(JAVAEXTLIBPATH)/$(LIBBASENAME).so.1.0 @$(RM_F) $(JAVAEXTLIBPATH)/$(LIBBASENAME).so.1 @$(RM_F) $(JAVAEXTLIBPATH)/$(LIBBASENAME).so @(cd $(JAVAEXTLIBPATH) && $(LN_S) $(LIBDEST_ABSOLUTE) $(LIBBASENAME).so.1.0) @(cd $(JAVAEXTLIBPATH) && $(LN_S) $(LIBBASENAME).so.1.0 $(LIBBASENAME).so.1) @(cd $(JAVAEXTLIBPATH) && $(LN_S) $(LIBBASENAME).so.1 $(LIBBASENAME).so) .PHONY: uninstall uninstall: @echo "Removing $(LIBBASENAME) from $(JAVAEXTLIBPATH)" @$(RM_F) $(JAVAEXTLIBPATH)/$(LIBBASENAME).so.1.0 @$(RM_F) $(JAVAEXTLIBPATH)/$(LIBBASENAME).so.1 @$(RM_F) $(JAVAEXTLIBPATH)/$(LIBBASENAME).so .PHONY: uninstall-link uninstall-link: uninstall .PHONY: clean clean: rm -rf $(LIBDEST) $(JNIHEADERS) *.o *~ libtool --mode=clean $(RM_F) $(LTOBJ) $(LIBBASENAME).lalibtritonus-java-20070428/src/lib/fluidsynth/org_tritonus_midi_device_fluidsynth_FluidSynthesizer.c0000644000175000017500000003731010401152372034031 0ustar twernertwerner/* * org_tritonus_midi_device_fluidsynth_FluidSynthesizer.c * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2006 by Henri Manson * Copyright (c) 2006 by Matthias Pfisterer * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * - Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * - Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. */ /* |<--- this code is formatted to fit into 80 columns --->| */ #include #include #include "org_tritonus_midi_device_fluidsynth_FluidSynthesizer.h" #include "org_tritonus_midi_sb_fluidsynth_FluidSoundbank.h" #include "../common/common.h" #include "../common/debug.h" /* non-API method of libfluidsynth */ void fluid_log_config(void); static jclass fluidsynthclass; static jfieldID settingsPtrFieldID; static jfieldID synthPtrFieldID; static jfieldID audioDriverPtrFieldID; static int get_fluidclassinfo(JNIEnv *env) { if (fluidsynthclass == NULL) { fluidsynthclass = (*env)->FindClass(env, "org/tritonus/midi/device/fluidsynth/FluidSynthesizer"); if (!fluidsynthclass) return -1; synthPtrFieldID = (*env)->GetFieldID(env, fluidsynthclass, "synthPtr", "J"); settingsPtrFieldID = (*env)->GetFieldID(env, fluidsynthclass, "settingsPtr", "J"); audioDriverPtrFieldID = (*env)->GetFieldID(env, fluidsynthclass, "audioDriverPtr", "J"); } return 0; } static fluid_synth_t* get_synth(JNIEnv *env, jobject obj) { get_fluidclassinfo(env); return (fluid_synth_t*) ((unsigned int) (*env)->GetLongField(env, obj, synthPtrFieldID)); } static void fluid_jni_delete_synth(JNIEnv *env, jobject obj, fluid_settings_t* settings, fluid_synth_t* synth, fluid_audio_driver_t* adriver) { get_fluidclassinfo(env); if (adriver) { delete_fluid_audio_driver(adriver); (*env)->SetLongField(env, obj, audioDriverPtrFieldID, (jlong) 0); } if (synth) { delete_fluid_synth(synth); (*env)->SetLongField(env, obj, synthPtrFieldID, (jlong) 0); } if (settings) { delete_fluid_settings(settings); (*env)->SetLongField(env, obj, settingsPtrFieldID, (jlong) 0); } } /* * Class: org_tritonus_midi_device_fluidsynth_FluidSynthesizer * Method: newSynth * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_midi_device_fluidsynth_FluidSynthesizer_newSynth (JNIEnv *env, jobject obj) { fluid_synth_t* synth = NULL; fluid_settings_t* settings = NULL; fluid_audio_driver_t* adriver = NULL; synth = get_synth(env, obj); if (synth == 0) { settings = new_fluid_settings(); if (settings == 0) { goto error_recovery; } synth = new_fluid_synth(settings); if (synth == 0) { goto error_recovery; } #ifdef VARIADIC_MACROS out("newSynth: synth: %p\n", synth); #else if (debug_flag) { fprintf(debug_file, "newSynth: synth: %p\n", synth); fflush(debug_file); } #endif adriver = new_fluid_audio_driver(settings, synth); if (adriver == 0) { goto error_recovery; } (*env)->SetLongField(env, obj, settingsPtrFieldID, (jlong) ((unsigned int) settings)); (*env)->SetLongField(env, obj, synthPtrFieldID, (jlong) ((unsigned int) synth)); (*env)->SetLongField(env, obj, audioDriverPtrFieldID, (jlong) ((unsigned int) adriver)); } return 0; error_recovery: fluid_jni_delete_synth(env, obj, settings, synth, adriver); return -1; } /* * Class: org_tritonus_midi_device_fluidsynth_FluidSynthesizer * Method: deleteSynth * Signature: ()V */ JNIEXPORT void JNICALL Java_org_tritonus_midi_device_fluidsynth_FluidSynthesizer_deleteSynth (JNIEnv *env, jobject obj) { fluid_synth_t* synth; fluid_settings_t* settings; fluid_audio_driver_t* adriver; synth = get_synth(env, obj); #ifdef VARIADIC_MACROS out("deleteSynth: synth: %p\n", synth); #else if (debug_flag) { fprintf(debug_file, "deleteSynth: synth: %p\n", synth); fflush(debug_file); } #endif settings = (fluid_settings_t*) ((unsigned int) (*env)->GetLongField(env, obj, settingsPtrFieldID)); adriver = (fluid_audio_driver_t*) ((unsigned int) (*env)->GetLongField(env, obj, audioDriverPtrFieldID)); fluid_jni_delete_synth(env, obj, settings, synth, adriver); } /* * Class: org_tritonus_midi_device_fluidsynth_FluidSynthesizer * Method: nReceive * Signature: (IIII)V */ JNIEXPORT void JNICALL Java_org_tritonus_midi_device_fluidsynth_FluidSynthesizer_nReceive (JNIEnv *env, jobject obj, jint command, jint channel, jint data1, jint data2) { fluid_midi_event_t* event; fluid_synth_t* synth = get_synth(env, obj); #ifdef VARIADIC_MACROS out("nReceive: synth: %p, values: %x %d %d %d\n", synth, (int) command, (int) channel, (int) data1, (int) data2); #else if (debug_flag) { fprintf(debug_file, "synth: %p, values: %x %d %d %d\n", synth, (int) command, (int) channel, (int) data1, (int) data2); fflush(debug_file); } #endif if (synth) { event = new_fluid_midi_event(); if (!event) { printf("failed to instantiate fluid_midi_event_t\n"); return; } //printf("2"); fflush(stdout); fluid_midi_event_set_type(event, command); fluid_midi_event_set_channel(event, channel); fluid_midi_event_set_key(event, data1); fluid_midi_event_set_velocity(event, data2); //printf("3"); fflush(stdout); /*printf("values2: %d %d %d %d\n", fluid_midi_event_get_type(event), fluid_midi_event_get_channel(event), fluid_midi_event_get_key(event), fluid_midi_event_get_velocity(event)); fflush(stdout); */ fluid_synth_handle_midi_event(synth, event); //printf("4"); fflush(stdout); delete_fluid_midi_event(event); //printf("5\n"); fflush(stdout); } } /* * Class: org_tritonus_midi_device_fluidsynth_FluidSynthesizer * Method: loadSoundFont * Signature: (Ljava/lang/String;)I */ JNIEXPORT jint JNICALL Java_org_tritonus_midi_device_fluidsynth_FluidSynthesizer_loadSoundFont (JNIEnv *env, jobject obj, jstring filename) { const char *cfilename = (*env)->GetStringUTFChars(env, filename, 0); int sfont_id; fluid_synth_t* synth = get_synth(env, obj); if (synth == 0) { sfont_id = -1; } else { sfont_id = fluid_synth_sfload(synth, cfilename, 1); } (*env)->ReleaseStringUTFChars(env, filename, cfilename); return sfont_id; } /* * Class: org_tritonus_midi_device_fluidsynth_FluidSynthesizer * Method: setBankOffset * Signature: (II)V */ JNIEXPORT void JNICALL Java_org_tritonus_midi_device_fluidsynth_FluidSynthesizer_setBankOffset (JNIEnv *env, jobject obj, jint sfontID, jint offset) { fluid_synth_t* synth = get_synth(env, obj); fluid_synth_set_bank_offset(synth, sfontID, offset); } /* * Class: org_tritonus_midi_sb_fluidsynth_FluidSoundbank * Method: nGetInstruments * Signature: (I)[Lorg/tritonus/midi/sb/fluidsynth/FluidSoundbank/FluidInstrument; */ JNIEXPORT jobjectArray JNICALL Java_org_tritonus_midi_sb_fluidsynth_FluidSoundbank_nGetInstruments (JNIEnv *env, jobject obj, jint sfontID) { //printf("3a\n"); //printf("4"); jclass fluidsoundbankclass; jfieldID synthFieldID; jobject synthobj; jclass fluidinstrclass; jmethodID initid; int count = 0; jobjectArray instruments; jstring instrname; jobject instrument; fluid_sfont_t* sfont; fluid_preset_t preset; int offset; int i = 0; fluid_synth_t* synth; fluidsoundbankclass = (*env)->FindClass(env, "org/tritonus/midi/sb/fluidsynth/FluidSoundbank"); synthFieldID = (*env)->GetFieldID(env, fluidsoundbankclass, "synth", "Lorg/tritonus/midi/device/fluidsynth/FluidSynthesizer;"); synthobj = (*env)->GetObjectField(env, obj, synthFieldID); synth = get_synth(env, synthobj); #ifdef VARIADIC_MACROS out("nGetInstruments: synth: %p\n", synth); #else if (debug_flag) { fprintf(debug_file, "nGetInstruments: synth: %p\n", synth); fflush(debug_file); } #endif if (synth) { fluidinstrclass = (*env)->FindClass(env, "org/tritonus/midi/sb/fluidsynth/FluidSoundbank$FluidInstrument"); if (!fluidinstrclass) printf("could not get class id"); //printf("5"); initid = (*env)->GetMethodID(env, fluidinstrclass, "", "(Lorg/tritonus/midi/sb/fluidsynth/FluidSoundbank;IILjava/lang/String;)V"); if (!initid) printf("could not get method id"); //printf("6"); sfont = fluid_synth_get_sfont_by_id(synth, sfontID); if (sfont != NULL) { sfont->iteration_start(sfont); while (sfont->iteration_next(sfont, &preset)) { count++; } } //printf("7"); instruments = (*env)->NewObjectArray(env, count, fluidinstrclass, NULL); sfont = fluid_synth_get_sfont_by_id(synth, sfontID); offset = fluid_synth_get_bank_offset(synth, sfontID); if (sfont == NULL) return 0; sfont->iteration_start(sfont); while (sfont->iteration_next(sfont, &preset)) { instrname = (*env)->NewStringUTF(env, // fluid_preset_get_name(&preset) preset.get_name(&preset) ); instrument = (*env)->NewObject(env, fluidinstrclass, initid, obj, // (jint) fluid_preset_get_banknum(&preset) + offset, (jint) (preset.get_banknum(&preset) + offset), // (jint) fluid_preset_get_num(&preset), (jint) (preset.get_num(&preset)), (jobject) instrname); (*env)->SetObjectArrayElement(env, instruments, i++, instrument); } return instruments; } else return NULL; } /* * Class: org_tritonus_midi_device_fluidsynth_FluidSynthesizer * Method: setGain * Signature: (F)V */ JNIEXPORT void JNICALL Java_org_tritonus_midi_device_fluidsynth_FluidSynthesizer_setGain (JNIEnv *env, jobject obj, jfloat gain) { fluid_synth_t* synth = get_synth(env, obj); fluid_synth_set_gain(synth, (float) gain); } /* * Class: org_tritonus_midi_device_fluidsynth_FluidSynthesizer * Method: setReverbPreset * Signature: (I)V */ JNIEXPORT void JNICALL Java_org_tritonus_midi_device_fluidsynth_FluidSynthesizer_setReverbPreset (JNIEnv *env, jobject obj, jint reverbPreset) { /* $$mp: currently not functional because fluid_synth_set_reverb_preset() is not present in fluidsynth 1.0.6 */ //fluid_synth_set_reverb_preset(synth, (int) reverbPreset); } /* * Class: org_tritonus_midi_device_fluidsynth_FluidSynthesizer * Method: getMaxPolyphony * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_midi_device_fluidsynth_FluidSynthesizer_getMaxPolyphony (JNIEnv *env, jobject obj) { fluid_synth_t* synth = get_synth(env, obj); if (synth) { return fluid_synth_get_polyphony(synth); } else { return -1; } } /* * Class: org_tritonus_midi_device_fluidsynth_FluidSynthesizer * Method: noteOn * Signature: (III)V */ JNIEXPORT void JNICALL Java_org_tritonus_midi_device_fluidsynth_FluidSynthesizer_noteOn (JNIEnv *env, jobject obj, jint channel, jint key, jint velocity) { fluid_synth_t* synth = get_synth(env, obj); if (synth) { fluid_synth_noteon(synth, channel, key, velocity); } } /* * Class: org_tritonus_midi_device_fluidsynth_FluidSynthesizer * Method: noteOff * Signature: (III)V */ JNIEXPORT void JNICALL Java_org_tritonus_midi_device_fluidsynth_FluidSynthesizer_noteOff (JNIEnv *env, jobject obj, jint channel, jint key, jint velocity) { fluid_synth_t* synth = get_synth(env, obj); if (synth) { /* There is no method noteoff that takes a velocity param. */ //fluid_synth_noteoff(synth, channel, key, velocity); fluid_synth_noteoff(synth, channel, key); } } /* * Class: org_tritonus_midi_device_fluidsynth_FluidSynthesizer * Method: controlChange * Signature: (III)V */ JNIEXPORT void JNICALL Java_org_tritonus_midi_device_fluidsynth_FluidSynthesizer_controlChange (JNIEnv *env, jobject obj, jint channel, jint controller, jint value) { fluid_synth_t* synth = get_synth(env, obj); if (synth) { fluid_synth_cc(synth, channel, controller, value); } } /* * Class: org_tritonus_midi_device_fluidsynth_FluidSynthesizer * Method: getController * Signature: (II)I */ JNIEXPORT jint JNICALL Java_org_tritonus_midi_device_fluidsynth_FluidSynthesizer_getController (JNIEnv *env, jobject obj, jint channel, jint controller) { fluid_synth_t* synth = get_synth(env, obj); int value = 0; if (synth) { fluid_synth_get_cc(synth, channel, controller, &value); } return value; } /* * Class: org_tritonus_midi_device_fluidsynth_FluidSynthesizer * Method: programChange * Signature: (II)V */ JNIEXPORT void JNICALL Java_org_tritonus_midi_device_fluidsynth_FluidSynthesizer_programChange (JNIEnv *env, jobject obj, jint channel, jint program) { fluid_synth_t* synth = get_synth(env, obj); if (synth) { fluid_synth_program_change(synth, channel, program); } } /* * Class: org_tritonus_midi_device_fluidsynth_FluidSynthesizer * Method: getProgram * Signature: (I)I */ JNIEXPORT jint JNICALL Java_org_tritonus_midi_device_fluidsynth_FluidSynthesizer_getProgram (JNIEnv *env, jobject obj, jint channel) { fluid_synth_t* synth = get_synth(env, obj); unsigned int sfont; unsigned int bank; unsigned int program = 0; if (synth) { fluid_synth_get_program(synth, channel, &sfont, &bank, &program); } return program; } /* * Class: org_tritonus_midi_device_fluidsynth_FluidSynthesizer * Method: setPitchBend * Signature: (II)V */ JNIEXPORT void JNICALL Java_org_tritonus_midi_device_fluidsynth_FluidSynthesizer_setPitchBend (JNIEnv *env, jobject obj, jint channel, jint bend) { fluid_synth_t* synth = get_synth(env, obj); if (synth) { fluid_synth_pitch_bend(synth, channel, bend); } } /* * Class: org_tritonus_midi_device_fluidsynth_FluidSynthesizer * Method: getPitchBend * Signature: (I)I */ JNIEXPORT jint JNICALL Java_org_tritonus_midi_device_fluidsynth_FluidSynthesizer_getPitchBend (JNIEnv *env, jobject obj, jint channel) { fluid_synth_t* synth = get_synth(env, obj); int bend = 0; if (synth) { fluid_synth_get_pitch_bend(synth, channel, &bend); } return bend; } /* * Class: org_tritonus_midi_device_fluidsynth_FluidSynthesizer * Method: setTrace * Signature: (Z)V */ JNIEXPORT void JNICALL Java_org_tritonus_midi_device_fluidsynth_FluidSynthesizer_setTrace (JNIEnv *env, jclass cls, jboolean bTrace) { debug_flag = bTrace; debug_file = stderr; /* Don't try to turn of log levels in Win32 since fluid_log_config() is not an exported function * in the fluidsynth DLL and so causes a link error */ #if !defined(WIN32) && !defined(__CYGWIN__) if (!bTrace) { /* fluid_log_config() is not part of the public API of fluidsynth. * However, this call is necessary because of a bug in fluidsynth: * fluid_set_log_function() does not initialize the data structures. * This is only done with the first call to fluid_log() and then, log * functions that are NULL are initialized to the default, so that * setting them to NULL with fluid_set_log_function() previously has no * effect. */ fluid_log_config(); fluid_set_log_function(FLUID_WARN, NULL, NULL); fluid_set_log_function(FLUID_INFO, NULL, NULL); } #endif } /* org_tritonus_midi_device_fluidsynth_FluidSynthesizer.c */ libtritonus-java-20070428/src/lib/lame/0000755000175000017500000000000010621572565017501 5ustar twernertwernerlibtritonus-java-20070428/src/lib/lame/windows/0000755000175000017500000000000010621572565021173 5ustar twernertwernerlibtritonus-java-20070428/src/lib/lame/windows/.cvsignore0000644000175000017500000000007307271377301023171 0ustar twernertwernerMakefile *.so* *.o org_tritonus_lowlevel_lame_Lame.h *.dll libtritonus-java-20070428/src/lib/lame/windows/BladeMP3EncDLL.h0000644000175000017500000001364007271377301023657 0ustar twernertwerner/* * Blade DLL Interface for LAME. * * Copyright (c) 1999 A.L. Faber * Based on bladedll.h version 1.0 written by Jukka Poikolainen * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #ifndef ___BLADEDLL_H_INCLUDED___ #define ___BLADEDLL_H_INCLUDED___ #pragma pack(push) #pragma pack(1) /* encoding formats */ #define BE_CONFIG_MP3 0 #define BE_CONFIG_LAME 256 /* type definitions */ typedef unsigned long HBE_STREAM; typedef HBE_STREAM *PHBE_STREAM; typedef unsigned long BE_ERR; /* error codes */ #define BE_ERR_SUCCESSFUL 0x00000000 #define BE_ERR_INVALID_FORMAT 0x00000001 #define BE_ERR_INVALID_FORMAT_PARAMETERS 0x00000002 #define BE_ERR_NO_MORE_HANDLES 0x00000003 #define BE_ERR_INVALID_HANDLE 0x00000004 #define BE_ERR_BUFFER_TOO_SMALL 0x00000005 /* other constants */ #define BE_MAX_HOMEPAGE 128 /* format specific variables */ #define BE_MP3_MODE_STEREO 0 #define BE_MP3_MODE_JSTEREO 1 #define BE_MP3_MODE_DUALCHANNEL 2 #define BE_MP3_MODE_MONO 3 #define MPEG1 1 #define MPEG2 0 #ifdef _BLADEDLL #undef FLOAT #include #endif #define CURRENT_STRUCT_VERSION 1 #define CURRENT_STRUCT_SIZE sizeof(BE_CONFIG) // is currently 331 bytes /* OBSOLETE, VALUES STILL WORK typedef enum { NORMAL_QUALITY=0, LOW_QUALITY, HIGH_QUALITY, VOICE_QUALITY } LAME_QUALTIY_PRESET; */ typedef enum { LQP_NOPRESET=-1, // STANDARD QUALITY PRESETS LQP_NORMAL_QUALITY=0, LQP_LOW_QUALITY, LQP_HIGH_QUALITY, LQP_VOICE_QUALITY, // NEW PRESET VALUES LQP_PHONE =1000, LQP_SW =2000, LQP_AM =3000, LQP_FM =4000, LQP_VOICE =5000, LQP_RADIO =6000, LQP_TAPE =7000, LQP_HIFI =8000, LQP_CD =9000, LQP_STUDIO =10000 } LAME_QUALTIY_PRESET; typedef struct { DWORD dwConfig; // BE_CONFIG_XXXXX // Currently only BE_CONFIG_MP3 is supported union { struct { DWORD dwSampleRate; // 48000, 44100 and 32000 allowed BYTE byMode; // BE_MP3_MODE_STEREO, BE_MP3_MODE_DUALCHANNEL, BE_MP3_MODE_MONO WORD wBitrate; // 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256 and 320 allowed BOOL bPrivate; BOOL bCRC; BOOL bCopyright; BOOL bOriginal; } mp3; // BE_CONFIG_MP3 struct { // STRUCTURE INFORMATION DWORD dwStructVersion; DWORD dwStructSize; // BASIC ENCODER SETTINGS DWORD dwSampleRate; // SAMPLERATE OF INPUT FILE DWORD dwReSampleRate; // DOWNSAMPLERATE, 0=ENCODER DECIDES LONG nMode; // BE_MP3_MODE_STEREO, BE_MP3_MODE_DUALCHANNEL, BE_MP3_MODE_MONO DWORD dwBitrate; // CBR bitrate, VBR min bitrate DWORD dwMaxBitrate; // CBR ignored, VBR Max bitrate LONG nPreset; // Quality preset, use one of the settings of the LAME_QUALITY_PRESET enum DWORD dwMpegVersion; // FUTURE USE, MPEG-1 OR MPEG-2 DWORD dwPsyModel; // FUTURE USE, SET TO 0 DWORD dwEmphasis; // FUTURE USE, SET TO 0 // BIT STREAM SETTINGS BOOL bPrivate; // Set Private Bit (TRUE/FALSE) BOOL bCRC; // Insert CRC (TRUE/FALSE) BOOL bCopyright; // Set Copyright Bit (TRUE/FALSE) BOOL bOriginal; // Set Original Bit (TRUE/FALSE) // VBR STUFF BOOL bWriteVBRHeader; // WRITE XING VBR HEADER (TRUE/FALSE) BOOL bEnableVBR; // USE VBR ENCODING (TRUE/FALSE) INT nVBRQuality; // VBR QUALITY 0..9 DWORD dwVbrAbr_bps; // Use ABR in stead of nVBRQuality BOOL bNoRes; // Disable Bit resorvoir BYTE btReserved[255-2*sizeof(DWORD)]; // FUTURE USE, SET TO 0 } LHV1; // LAME header version 1 struct { DWORD dwSampleRate; BYTE byMode; WORD wBitrate; BYTE byEncodingMethod; } aac; } format; } BE_CONFIG, *PBE_CONFIG; typedef struct { // BladeEnc DLL Version number BYTE byDLLMajorVersion; BYTE byDLLMinorVersion; // BladeEnc Engine Version Number BYTE byMajorVersion; BYTE byMinorVersion; // DLL Release date BYTE byDay; BYTE byMonth; WORD wYear; // BladeEnc Homepage URL CHAR zHomepage[BE_MAX_HOMEPAGE + 1]; BYTE byAlphaLevel; BYTE byBetaLevel; BYTE byMMXEnabled; BYTE btReserved[125]; } BE_VERSION, *PBE_VERSION; #ifndef _BLADEDLL typedef BE_ERR (*BEINITSTREAM) (PBE_CONFIG, PDWORD, PDWORD, PHBE_STREAM); typedef BE_ERR (*BEENCODECHUNK) (HBE_STREAM, DWORD, PSHORT, PBYTE, PDWORD); typedef BE_ERR (*BEDEINITSTREAM) (HBE_STREAM, PBYTE, PDWORD); typedef BE_ERR (*BECLOSESTREAM) (HBE_STREAM); typedef VOID (*BEVERSION) (PBE_VERSION); typedef VOID (*BEWRITEVBRHEADER) (LPCSTR); #define TEXT_BEINITSTREAM "beInitStream" #define TEXT_BEENCODECHUNK "beEncodeChunk" #define TEXT_BEDEINITSTREAM "beDeinitStream" #define TEXT_BECLOSESTREAM "beCloseStream" #define TEXT_BEVERSION "beVersion" #define TEXT_BEWRITEVBRHEADER "beWriteVBRHeader" #else __declspec(dllexport) BE_ERR beInitStream(PBE_CONFIG pbeConfig, PDWORD dwSamples, PDWORD dwBufferSize, PHBE_STREAM phbeStream); __declspec(dllexport) BE_ERR beEncodeChunk(HBE_STREAM hbeStream, DWORD nSamples, PSHORT pSamples, PBYTE pOutput, PDWORD pdwOutput); __declspec(dllexport) BE_ERR beDeinitStream(HBE_STREAM hbeStream, PBYTE pOutput, PDWORD pdwOutput); __declspec(dllexport) BE_ERR beCloseStream(HBE_STREAM hbeStream); __declspec(dllexport) VOID beVersion(PBE_VERSION pbeVersion); __declspec(dllexport) BE_ERR beWriteVBRHeader(LPCSTR lpszFileName); #endif #pragma pack(pop) #endif libtritonus-java-20070428/src/lib/lame/windows/bladenc.c0000644000175000017500000003177310043054532022725 0ustar twernertwerner/* * bladenc.c * for Windows bladenc-style DLLs */ /* * Copyright (c) 2001 by Florian Bomers * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ #include "bladenc.h" ////////////////////////////// used in lame and bladenc ////////////////////////////////////////////// int copyVersion(char* s, int len, int major, int minor, int alpha, int beta) { int thislen; int result=0; if (len<8) { return -1; } sprintf(s, "%d.%d", major, minor); thislen=strlen(s); len-=thislen; s+=thislen; result+=thislen; // now put something like "alpha" or "beta" if (alpha && len>=6) { strcpy(s, "alpha"); len-=5; s+=5; result+=5; } else if (beta && len>=5) { strcpy(s, "beta"); len-=4; s+=4; result+=4; } return result; } ////////////////////////////// bladenc specific ////////////////////////////////////////////// #ifndef _BLADEDLL static BEINITSTREAM beInitStream=NULL; static BEENCODECHUNK beEncodeChunk=NULL; static BEDEINITSTREAM beDeinitStream=NULL; static BECLOSESTREAM beCloseStream=NULL; static BEVERSION beVersion=NULL; static BEWRITEVBRHEADER beWriteVBRHeader=NULL; static HINSTANCE hDLL=NULL; #endif //////////////////////////////helper functions /* * loadLameLibrary */ #ifndef _BLADEDLL // returns 0 on error / or one of DLL_TYPE_xx constants int loadLameLibrary(const char* name) { if (hDLL==NULL) { hDLL=LoadLibrary(name); if(hDLL==NULL) { #ifdef _DEBUG printf("Unable to load bladenc library\n"); fflush(stdout); #endif return 0; } } if(!beInitStream || !beEncodeChunk || !beDeinitStream || !beCloseStream || !beVersion) { // Get Interface functions beInitStream = (BEINITSTREAM) GetProcAddress(hDLL, TEXT_BEINITSTREAM); beEncodeChunk = (BEENCODECHUNK) GetProcAddress(hDLL, TEXT_BEENCODECHUNK); beDeinitStream = (BEDEINITSTREAM) GetProcAddress(hDLL, TEXT_BEDEINITSTREAM); beCloseStream = (BECLOSESTREAM) GetProcAddress(hDLL, TEXT_BECLOSESTREAM); beVersion = (BEVERSION) GetProcAddress(hDLL, TEXT_BEVERSION); beWriteVBRHeader= (BEWRITEVBRHEADER) GetProcAddress(hDLL,TEXT_BEWRITEVBRHEADER); } // Check if all interfaces are present if(!beInitStream || !beEncodeChunk || !beDeinitStream || !beCloseStream || !beVersion) { #ifdef _DEBUG printf("Unable to get bladenc functions from dll\n"); fflush(stdout); #endif return 0; } if (beWriteVBRHeader) { #ifdef _DEBUG printf("DLL ist lame.\n"); fflush(stdout); #endif return DLL_TYPE_LAME; } #ifdef _DEBUG printf("DLL ist bladenc.\n"); fflush(stdout); #endif return DLL_TYPE_BLADENC; } #endif int getBladeMpegVersion(LameConf* conf) { switch (conf->sampleRate) { case 8000: // MPEG 2.5 case 11025: // MPEG 2.5 case 12000: // MPEG 2.5 case 16000: // MPEG 2 case 22050: // MPEG 2 case 24000: return MPEG2; // MPEG 2 //case 32000: // MPEG 1 //case 44100: // MPEG 1 //case 48000: // MPEG 1 } return MPEG1; } int getLameMpegVersion(int bladeVersion, int sampleRate) { if (bladeVersion==MPEG2) { switch (sampleRate) { case 8000: // MPEG 2.5 case 11025: // MPEG 2.5 case 12000: return org_tritonus_lowlevel_lame_Lame_MPEG_VERSION_2DOT5; //case 16000: // MPEG 2 //case 22050: // MPEG 2 //case 24000: } return org_tritonus_lowlevel_lame_Lame_MPEG_VERSION_2; } return org_tritonus_lowlevel_lame_Lame_MPEG_VERSION_1; } int getBladeChannelMode(int channels, int includeJointStereo) { if (channels==1) { return BE_MP3_MODE_MONO; } if (includeJointStereo) { return BE_MP3_MODE_JSTEREO; } return BE_MP3_MODE_STEREO; } int getLameChannelMode(int bladencMode) { switch (bladencMode) { case BE_MP3_MODE_STEREO: return org_tritonus_lowlevel_lame_Lame_CHANNEL_MODE_STEREO; case BE_MP3_MODE_JSTEREO: return org_tritonus_lowlevel_lame_Lame_CHANNEL_MODE_JOINT_STEREO; case BE_MP3_MODE_DUALCHANNEL: return org_tritonus_lowlevel_lame_Lame_CHANNEL_MODE_DUAL_CHANNEL; case BE_MP3_MODE_MONO: return org_tritonus_lowlevel_lame_Lame_CHANNEL_MODE_MONO; } return -1; } int getBitrate(LameConf* conf) { int result=64; if (conf->bitrate!=org_tritonus_lowlevel_lame_Lame_BITRATE_AUTO) { return conf->bitrate; } // these are the values for MONO switch (conf->sampleRate) { case 8000: result=16; break; // MPEG 2.5 case 11025: result=24; break; // MPEG 2.5 case 12000: result=32; break; // MPEG 2.5 case 16000: result=32; break; // MPEG 2 case 22050: result=40; break; // MPEG 2 case 24000: result=48; break; // MPEG 2 case 32000: result=48; break; // MPEG 1 case 44100: result=64; break; // MPEG 1 case 48000: result=80; break; // MPEG 1 } // now double it if stereo return result*conf->channels; } LONG getBladePreset(int quality) { if (qualityorg_tritonus_lowlevel_lame_Lame_QUALITY_MIDDLE) { return LQP_HIGH_QUALITY; } return LQP_NORMAL_QUALITY; } int getLameQuality(LONG preset) { if (preset==LQP_LOW_QUALITY) { return org_tritonus_lowlevel_lame_Lame_QUALITY_LOWEST; } else if (preset==LQP_HIGH_QUALITY) { return org_tritonus_lowlevel_lame_Lame_QUALITY_HIGHEST; } return org_tritonus_lowlevel_lame_Lame_QUALITY_MIDDLE; } ////////////////////////////////// functions called by native functions /* * doInit */ int doInit(LameConf* conf) { int initDone; BE_ERR err; #ifndef _BLADEDLL conf->dllType=loadLameLibrary(LAME_ENC_DLL); if (!conf->dllType) { return org_tritonus_lowlevel_lame_Lame_LAME_ENC_NOT_FOUND; } #else // first try with LAME style config conf->dllType=DLL_TYPE_LAME; #endif initDone=0; while (!initDone) { if (conf->dllType==DLL_TYPE_LAME) { // fill lame-style fields conf->beConfig.dwConfig = BE_CONFIG_LAME; conf->beConfig.format.LHV1.dwStructVersion = CURRENT_STRUCT_VERSION; conf->beConfig.format.LHV1.dwStructSize = CURRENT_STRUCT_SIZE; conf->beConfig.format.LHV1.dwSampleRate = conf->sampleRate; // INPUT FREQUENCY conf->beConfig.format.LHV1.dwReSampleRate = 0; // DON"T RESAMPLE conf->beConfig.format.LHV1.nMode = getBladeChannelMode(conf->channels, 1); conf->beConfig.format.LHV1.dwBitrate = (WORD) getBitrate(conf); // MINIMUM BIT RATE conf->beConfig.format.LHV1.nPreset = getBladePreset(conf->quality); // QUALITY PRESET SETTING conf->beConfig.format.LHV1.dwMpegVersion = getBladeMpegVersion(conf); // MPEG VERSION (I or II) if (conf->VBR) { conf->beConfig.format.LHV1.bEnableVBR = TRUE; // USE VBR conf->beConfig.format.LHV1.nVBRQuality = conf->quality; // SET VBR QUALITY } } else { // fill bladenc-style fields conf->beConfig.dwConfig = BE_CONFIG_MP3; conf->beConfig.format.mp3.dwSampleRate=conf->sampleRate; // 48000, 44100 and 32000 allowed conf->beConfig.format.mp3.byMode=(BYTE) getBladeChannelMode(conf->channels, 0); // BE_MP3_MODE_STEREO, BE_MP3_MODE_DUALCHANNEL, BE_MP3_MODE_MONO conf->beConfig.format.mp3.wBitrate=(WORD) getBitrate(conf); } // Init the MP3 Stream err = beInitStream(&(conf->beConfig), &(conf->PCMBufferSizeInBytes), &(conf->MP3BufferSizeInBytes), &(conf->hbeStream)); // blade returns in number of shorts conf->PCMBufferSizeInBytes*=2; // Check result if(err != BE_ERR_SUCCESSFUL) { if (conf->dllType==DLL_TYPE_LAME) { // retry with bladenc-style conf->dllType=DLL_TYPE_BLADENC; } else { #ifdef _DEBUG printf("Error opening encoding stream (%lu)\n", err); fflush(stdout); #endif // TODO: better error return return -1; } } else { initDone=1; } #ifdef _DEBUG printf("BufferSizeInBytes=%d\n", conf->PCMBufferSizeInBytes); #endif } // update the Lame instance with the effective values if (conf->dllType==DLL_TYPE_LAME) { #ifdef _DEBUG printf("using LAME dll format\n"); fflush(stdout); #endif conf->bitrate=conf->beConfig.format.LHV1.dwBitrate; conf->VBR=conf->beConfig.format.LHV1.bEnableVBR; conf->mode=getLameChannelMode(conf->beConfig.format.LHV1.nMode); if (conf->beConfig.format.LHV1.dwReSampleRate!=0) { conf->sampleRate=conf->beConfig.format.LHV1.dwReSampleRate; } else { conf->sampleRate=conf->beConfig.format.LHV1.dwSampleRate; } conf->mpegVersion=getLameMpegVersion(conf->beConfig.format.LHV1.dwMpegVersion, conf->sampleRate); conf->quality=getLameQuality(conf->beConfig.format.LHV1.nPreset); } else { #ifdef _DEBUG printf("using BLADENC dll format\n"); fflush(stdout); #endif conf->sampleRate=conf->beConfig.format.mp3.dwSampleRate; conf->bitrate=conf->beConfig.format.mp3.wBitrate; conf->mode=getLameChannelMode(conf->beConfig.format.mp3.byMode); conf->quality=org_tritonus_lowlevel_lame_Lame_QUALITY_MIDDLE; conf->VBR=0; conf->mpegVersion=getLameMpegVersion(MPEG1, conf->sampleRate); } return 0; } /* * doGetEncoderVersion */ int doGetEncoderVersion(LameConf* conf, char* charBuffer, int charBufferSize) { BE_VERSION version; char* thisString=charBuffer; int size=charBufferSize; int len; int result=0; #ifndef _BLADEDLL if (beVersion==NULL && !loadLameLibrary(LAME_ENC_DLL)) { return org_tritonus_lowlevel_lame_Lame_LAME_ENC_NOT_FOUND; } #endif memset(&version, 0, sizeof(version)); memset(charBuffer, 0, charBufferSize); beVersion(&version); // first put something like "333.333alpha" len=copyVersion(thisString, size, version.byMajorVersion, version.byMinorVersion, version.byAlphaLevel, version.byBetaLevel); if (len<=0) { return result; } thisString+=len; size-=len; result+=len; // dll version like "; dll 333.333)" if (size>13) { strcpy(thisString, "; dll "); thisString+=6; size-=6; result+=6; len=copyVersion(thisString, size, version.byDLLMajorVersion, version.byDLLMinorVersion, 0, 0); if (len<=0) { return result; } thisString+=len; size-=len; result+=len; } // copy date "; 2001-01-01" if (size>12) { sprintf(thisString, "; %d-%d-%d", version.wYear, version.byMonth, version.byDay); len=strlen(thisString); thisString+=len; size-=len; result+=len; } // copy features if (size>5 && version.byMMXEnabled) { strcpy(thisString, "; MMX"); thisString+=5; size-=5; result+=5; } return result; } /* * doGetPCMBufferSize */ int doGetPCMBufferSize(LameConf* conf, int wishedBufferSize) { int result=wishedBufferSize; if (conf->PCMBufferSizeInBytes<=0) { //throwRuntimeException(env, "not initialized"); return org_tritonus_lowlevel_lame_Lame_NOT_INITIALIZED; } if ((result % conf->PCMBufferSizeInBytes)!=0) { //result=conf->PCMBufferSizeInBytes; result=(result/conf->PCMBufferSizeInBytes)*conf->PCMBufferSizeInBytes; if (result==0) { result=conf->PCMBufferSizeInBytes; } } return result; } /* * doEncode */ int doEncode(LameConf* conf, short* pcmSamples, int pcmLengthInFrames, char* encodedBytes, int encodedArrayByteSize) { DWORD thisPcmSizeInShorts; DWORD mp3SizeInBytes; DWORD bladeBufferSizeInShorts=conf->PCMBufferSizeInBytes/2; BE_ERR err; int pcmLengthInShorts=pcmLengthInFrames*conf->channels; int result=0; // bladenc prefers a fixed buffer size. if necessary, call bladenc several times while (pcmLengthInShorts>0) { thisPcmSizeInShorts=pcmLengthInShorts; if (thisPcmSizeInShorts>bladeBufferSizeInShorts) { thisPcmSizeInShorts=bladeBufferSizeInShorts; } mp3SizeInBytes=encodedArrayByteSize; #ifdef _DEBUG printf(" Encoding %d shorts at %p (size=%d shorts) into buffer %p (size=%d bytes).\n", thisPcmSizeInShorts, pcmSamples, pcmLengthInShorts, encodedBytes, mp3SizeInBytes); //printf(" Sample1=%d Sample2=%d\n", pcmSamples[0], pcmSamples[1]); fflush(stdout); #endif err = beEncodeChunk(conf->hbeStream, thisPcmSizeInShorts, pcmSamples, (PBYTE) encodedBytes, &mp3SizeInBytes); // Check result if(err != BE_ERR_SUCCESSFUL) { result=-10; break; } else { #ifdef _DEBUG printf(" -encoded %d bytes.\n", (int) mp3SizeInBytes); //printf(" MP3-1=%d MP3-2=%d\n", (int) encodedBytes[0], (int) encodedBytes[1]); fflush(stdout); //pcmArraySizeInShorts-=thisPcmSizeInShorts; #endif result+=mp3SizeInBytes; encodedBytes+=mp3SizeInBytes; encodedArrayByteSize-=mp3SizeInBytes; pcmLengthInShorts-=thisPcmSizeInShorts; pcmSamples+=thisPcmSizeInShorts; } } return result; } /* * doEncodeFinish */ int doEncodeFinish(LameConf* conf, char* encodedBytes, int encodedArrayByteSize) { BE_ERR err; DWORD result=(DWORD) encodedArrayByteSize; err = beDeinitStream(conf->hbeStream, (PBYTE) encodedBytes, &result); if(err != BE_ERR_SUCCESSFUL) { result=-1; } return (int) result; } /* * doClose */ void doClose(LameConf* conf) { beCloseStream(conf->hbeStream); } libtritonus-java-20070428/src/lib/lame/windows/bladenc.h0000644000175000017500000000354210043054532022723 0ustar twernertwerner/* * bladenc.h * for Windows bladenc-style DLLs */ /* * Copyright (c) 2001 by Florian Bomers * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ #ifndef BLADENC_API_H_INCLUDED #define BLADENC_API_H_INCLUDED #include #include #include #include "org_tritonus_lowlevel_lame_Lame.h" #include "BladeMP3EncDLL.h" #define DLL_TYPE_LAME 1 #define DLL_TYPE_BLADENC 2 #define LAME_ENC_DLL "lame_enc.dll" typedef struct tagLameConf { int channels; int sampleRate; int bitrate; int mode; int quality; int VBR; int mpegVersion; int swapbytes; BE_CONFIG beConfig; HBE_STREAM hbeStream; int dllType; DWORD PCMBufferSizeInBytes; DWORD MP3BufferSizeInBytes; } LameConf; extern int doInit(LameConf* conf); extern int doGetPCMBufferSize(LameConf* conf, int wishedBufferSize); extern int doEncode(LameConf* conf, short* pcmSamples, int pcmLengthInFrames, char* encodedBytes, int encodedArrayByteSize); extern int doEncodeFinish(LameConf* conf, char* encodedBytes, int encodedArrayByteSize); extern void doClose(LameConf* conf); extern int doGetEncoderVersion(LameConf* conf, char* charBuffer, int charBufferSize); #endif libtritonus-java-20070428/src/lib/lame/windows/compile.txt0000644000175000017500000000337007271377301023365 0ustar twernertwernerCompiling the native lametritonus dll ------------------------------------- 1. make sure the header file org_tritonus_lowlevel_lame_Lame.h exists. You can create it with javah org.tritonus.lowlevel.lame.Lame . 2. Copy org_tritonus_lowlevel_lame_Lame.c from one directory higher to this directory. 2.1 For Borland free C++ command line tools: (download from http://www.borland.com/bcppbuilder/freecompiler/cppc55steps.html) Edit the provided the makefile to match your settings. Run it with "make" (Borland make) 2.2 For MS VC++ 6.0: Open a workspace with bladenc.c, bladenc.h, org_tritonus_lowlevel_lame_Lame.h, org_tritonus_lowlevel_lame_Lame.c. ( old project/workspace files are included) Go to project settings, select "All configurations", click on the C/C++ tab and selct as category "Preprocessor". In "Additional include directories" set the path of the "include" and "include\win32" directories of your JDK1.3 installation. Set the symbol "USE_BLADENC_API". You can set the symbol _BLADEDLL when you want to link statically. You need to add lame_enc.dll to the Link section in Project Settings. Static loading is not tested. Dynamic loading is recommended. Install the dll in e.g. \JDK1.3\jre\bin\ext (for the JDK 1.3) \Program Files\JavaSoft\JRE\1.3.0_02\lib\ext (for JRE 1.3.0_02 - also for Java plugin) When your IE or NS supports Java 2 Version 1.3 or higher directly, you may need to install it in \WINNT\java\trustlib (for Internet Explorer) \Program Files\Netscape\Communicator\java\classes (for Netscape 4.6). You need tritonus_mp3.jar and tritonus_share.jar to make the encoder work. You can use "Mp3Encoder.java" from the Java Sound Examples to test it.libtritonus-java-20070428/src/lib/lame/windows/lametritonus.dsp0000644000175000017500000001077607265404651024444 0ustar twernertwerner# Microsoft Developer Studio Project File - Name="lametritonus" - Package Owner=<4> # Microsoft Developer Studio Generated Build File, Format Version 6.00 # ** DO NOT EDIT ** # TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 CFG=lametritonus - Win32 Debug !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run !MESSAGE !MESSAGE NMAKE /f "lametritonus.mak". !MESSAGE !MESSAGE You can specify a configuration when running NMAKE !MESSAGE by defining the macro CFG on the command line. For example: !MESSAGE !MESSAGE NMAKE /f "lametritonus.mak" CFG="lametritonus - Win32 Debug" !MESSAGE !MESSAGE Possible choices for configuration are: !MESSAGE !MESSAGE "lametritonus - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") !MESSAGE "lametritonus - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") !MESSAGE # Begin Project # PROP AllowPerConfigDependencies 0 # PROP Scc_ProjName "" # PROP Scc_LocalPath "" CPP=cl.exe MTL=midl.exe RSC=rc.exe !IF "$(CFG)" == "lametritonus - Win32 Release" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 0 # PROP BASE Output_Dir "Release" # PROP BASE Intermediate_Dir "Release" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 # PROP Output_Dir "Release" # PROP Intermediate_Dir "Release" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LAMETRITONUS_EXPORTS" /YX /FD /c # ADD CPP /nologo /MT /W3 /GX /O2 /I "E:\jdks\jdk1.3\include" /I "E:\jdks\jdk1.3\include\win32" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LAMETRITONUS_EXPORTS" /YX /FD /c # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD BASE RSC /l 0x402 /d "NDEBUG" # ADD RSC /l 0x409 /d "NDEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /nodefaultlib:"libcpmt.lib" # SUBTRACT LINK32 /nodefaultlib !ELSEIF "$(CFG)" == "lametritonus - Win32 Debug" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 1 # PROP BASE Output_Dir "Debug" # PROP BASE Intermediate_Dir "Debug" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 # PROP Output_Dir "Debug" # PROP Intermediate_Dir "Debug" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LAMETRITONUS_EXPORTS" /YX /FD /GZ /c # ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "E:\jdks\jdk1.3\include" /I "E:\jdks\jdk1.3\include\win32" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LAMETRITONUS_EXPORTS" /YX /FD /GZ /c # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD BASE RSC /l 0x402 /d "_DEBUG" # ADD RSC /l 0x402 /d "_DEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /nodefaultlib:"libcpmtd.lib" /pdbtype:sept # SUBTRACT LINK32 /nodefaultlib !ENDIF # Begin Target # Name "lametritonus - Win32 Release" # Name "lametritonus - Win32 Debug" # Begin Group "Source Files" # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" # Begin Source File SOURCE=org_tritonus_lowlevel_lame_Lame.c # End Source File # End Group # Begin Group "Header Files" # PROP Default_Filter "h;hpp;hxx;hm;inl" # Begin Source File SOURCE=.\BladeMP3EncDLL.h # End Source File # Begin Source File SOURCE=org_tritonus_lowlevel_lame_Lame.h # End Source File # End Group # Begin Group "Resource Files" # PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" # End Group # End Target # End Project libtritonus-java-20070428/src/lib/lame/windows/lametritonus.dsw0000644000175000017500000000104307265404651024436 0ustar twernertwernerMicrosoft Developer Studio Workspace File, Format Version 6.00 # WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! ############################################################################### Project: "lametritonus"=.\lametritonus.dsp - Package Owner=<4> Package=<5> {{{ }}} Package=<4> {{{ }}} ############################################################################### Global: Package=<5> {{{ }}} Package=<3> {{{ }}} ############################################################################### libtritonus-java-20070428/src/lib/lame/windows/makefile0000644000175000017500000000346307271377301022677 0ustar twernertwerner# # makefile for lame JNI classes # # # Borland specific directives --- # .SWAP .AUTODEPEND # edit this to reflect your installation of JDK ! JDK_HOME=E:\jdks\jdk1.3.0_02 # # Set tool and version names: CPP = bcc32 CPP32 = cpp32 # Defines DEFINES = -DUSE_BLADENC_API #DEFINES = $(DEFINES) -D_DEBUG # # Set the various flags: CCLINKOPT = -lGn # uncomment the following line for debug compile #DBGOPT= -v -N -x -xp CCLINKOPT = $(CCLINKOPT) -tWM #options for single thread: #CCLINKOPT = $(CCLINKOPT) -tWM- # # C: console # D: DLL # DEFOPTS=-tWD # # Set any compiler options # -4: i486 # -5: Pentium # -6: Pentium Pro/Pentium II/III options # -O2: optimize for speed # -OS: Pentium instruction scheduling CCOPTS = -w -w-8004 -w-8057 -4 -O2 -OS -q #Compile flags: CPPFLAGS= $(CCOPTS) $(DBGOPT) $(ENVOPTS) $(DEFOPTS) $(CCLINKOPT) $(DEFINES) LINKFLAGS=$(CCLINKOPT) $(DEFOPTS) -lq -L$(MAKEDIR)\..\lib INCLUDES= -I$(MAKEDIR)\..\include;$(MAKEDIR)\..\include\windows;$(JDK_HOME)\include;$(JDK_HOME)\include\win32 ######################## Targets ################################# TARGETS=lametritonus.dll OBJECTS=bladenc.obj org_tritonus_lowlevel_lame_Lame.obj all: $(TARGETS) install: all copy $(TARGETS) $(JDK_HOME)\jre\bin lametritonus.dll: $(OBJECTS) $(CPP) $(LINKFLAGS) -e$* {$? } clean: -@if exist *.obj del *.obj >nul -@if exist *.lib del *.lib >nul -@if exist *.exe del *.exe >nul -@if exist *.dll del *.dll >nul -@if exist *.tds del *.tds >nul ########################### Implicit Rules ####################### .c.obj: $(CPP) $(CPPFLAGS) $(INCLUDES) -c {$? } .c.i: $(CPP32) $(CPPFLAGS) -c -Sr -Sd {$? } libtritonus-java-20070428/src/lib/lame/.cvsignore0000644000175000017500000000007307271377300021476 0ustar twernertwernerMakefile *.so* *.o org_tritonus_lowlevel_lame_Lame.h *.dll libtritonus-java-20070428/src/lib/lame/Makefile.in0000644000175000017500000000561307545261365021557 0ustar twernertwerner# compilation and packing of the native library for lame # SHELL = /bin/sh prefix=@prefix@ JAVADIR=$(prefix) REL_JAVAEXTLIBPATH=@REL_JAVAEXTLIBPATH@ JAVAEXTLIBPATH=$(JAVADIR)/$(REL_JAVAEXTLIBPATH) OSNAME=@OSNAME@ ARCHNAME=@ARCHNAME@ CC=@CC@ DEFINES=-DUSE_LAME_API CPPFLAGS=-g -Wall -I$(JAVADIR)/include -I$(JAVADIR)/include/$(OSNAME) -fPIC -D_REENTRANT $(DEFINES) INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ LN_S=@LN_S@ RM_F=@RM_F@ MKDIR_P=@MKDIR_P@ # to enable debugging of the JNI code: #DEFINES = $(DEFINES) _DEBUG OBJDIR=../../../@BUILD_DIR@ vpath %.class $(OBJDIR)/org/tritonus/lowlevel/lame LIBBASENAME=liblametritonus LIBDEST=$(LIBBASENAME).so.1.0 LIBDEST_ABSOLUTE=@SRC_ABSOLUTE_PATH@/src/lib/lame/$(LIBDEST) #or LIBDEST_ABSOLUTE=$(CURDIR)/$(LIBDEST) LIBS=-lmp3lame JAVAH = @JAVAH@ JNIOBJ=\ org_tritonus_lowlevel_lame_Lame.o OBJECTS=$(JNIOBJ) lameapi.o JNICLASSFILES=\ Lame.class JNIHEADERS:=$(JNIOBJ:.o=.h) JNICLASSES=\ org.tritonus.lowlevel.lame.Lame #----------------- rules ------------------- .PHONY: all all: $(LIBDEST) $(LIBDEST): $(OBJECTS) # dynamic linking of liblame.so $(CC) -shared -Wl,-soname,$(LIBBASENAME).so.1 -o $(LIBDEST) $(OBJECTS) $(LIBS) # static linking of liblame.a # $(CC) -shared -Wl,-soname,$(LIBBASENAME).so.1 -o $(LIBDEST) $(OBJECTS) -L. $(LIBS) @$(RM_F) $(LIBBASENAME).so.1 @$(LN_S) $(LIBBASENAME).so.1.0 $(LIBBASENAME).so.1 @$(RM_F) $(LIBBASENAME).so @$(LN_S) $(LIBBASENAME).so.1 $(LIBBASENAME).so $(JNIOBJ): $(JNIHEADERS) $(JNIHEADERS): $(JNICLASSFILES) @$(RM_F) $(JNIHEADERS) $(JAVAH) -d . $(JNICLASSES) .PHONY: install install: @echo "Installing $(LIBBASENAME) in $(JAVAEXTLIBPATH)" @$(MKDIR_P) $(JAVAEXTLIBPATH) @$(RM_F) $(JAVAEXTLIBPATH)/$(LIBBASENAME).so.1.0 @$(RM_F) $(JAVAEXTLIBPATH)/$(LIBBASENAME).so.1 @$(RM_F) $(JAVAEXTLIBPATH)/$(LIBBASENAME).so $(INSTALL_PROGRAM) $(LIBDEST) $(JAVAEXTLIBPATH) @(cd $(JAVAEXTLIBPATH) && $(LN_S) $(LIBBASENAME).so.1.0 $(LIBBASENAME).so.1) @(cd $(JAVAEXTLIBPATH) && $(LN_S) $(LIBBASENAME).so.1 $(LIBBASENAME).so) .PHONY: install-link install-link: @echo "Creating links for $(LIBBASENAME) in $(JAVAEXTLIBPATH)" @$(MKDIR_P) $(JAVAEXTLIBPATH) @$(RM_F) $(JAVAEXTLIBPATH)/$(LIBBASENAME).so.1.0 @$(RM_F) $(JAVAEXTLIBPATH)/$(LIBBASENAME).so.1 @$(RM_F) $(JAVAEXTLIBPATH)/$(LIBBASENAME).so @(cd $(JAVAEXTLIBPATH) && $(LN_S) $(LIBDEST_ABSOLUTE) $(LIBBASENAME).so.1.0) @(cd $(JAVAEXTLIBPATH) && $(LN_S) $(LIBBASENAME).so.1.0 $(LIBBASENAME).so.1) @(cd $(JAVAEXTLIBPATH) && $(LN_S) $(LIBBASENAME).so.1 $(LIBBASENAME).so) .PHONY: uninstall uninstall: @echo "Removing $(LIBBASENAME) from $(JAVAEXTLIBPATH)" @$(RM_F) $(JAVAEXTLIBPATH)/$(LIBBASENAME).so.1.0 @$(RM_F) $(JAVAEXTLIBPATH)/$(LIBBASENAME).so.1 @$(RM_F) $(JAVAEXTLIBPATH)/$(LIBBASENAME).so .PHONY: uninstall-link uninstall-link: uninstall .PHONY: clean clean: $(RM_F) $(LIBDEST) $(JNIHEADERS) *.o *~ libtritonus-java-20070428/src/lib/lame/lameapi.c0000644000175000017500000001121510043054532021240 0ustar twernertwerner/* * lameapi.c * functions that use the lame API */ /* * Copyright (c) 2001 by Florian Bomers * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ #include "lameapi.h" int doInit(LameConf* conf) { int result; conf->gf=lame_init(); if (conf->gf==NULL) { //throwRuntimeException(env, "out of memory"); return org_tritonus_lowlevel_lame_Lame_OUT_OF_MEMORY; } lame_set_num_channels(conf->gf, conf->channels); lame_set_in_samplerate(conf->gf, conf->sampleRate); if (conf->mode!=org_tritonus_lowlevel_lame_Lame_CHANNEL_MODE_AUTO) { lame_set_mode(conf->gf, conf->mode); } if (conf->VBR) { lame_set_VBR(conf->gf, vbr_default); lame_set_VBR_q(conf->gf, conf->quality); } else { if (conf->bitrate!=org_tritonus_lowlevel_lame_Lame_BITRATE_AUTO) { lame_set_brate(conf->gf, conf->bitrate); } } lame_set_quality(conf->gf, conf->quality); result=lame_init_params(conf->gf); // return effective values conf->sampleRate=lame_get_out_samplerate(conf->gf); conf->bitrate=lame_get_brate(conf->gf); conf->mode=lame_get_mode(conf->gf); conf->VBR=lame_get_VBR(conf->gf); conf->quality=(conf->VBR)?lame_get_VBR_q(conf->gf):lame_get_quality(conf->gf); conf->mpegVersion=lame_get_version(conf->gf); return result; } int doGetPCMBufferSize(LameConf* conf, int wishedBufferSize) { // lame supports all buffer sizes return wishedBufferSize; } int doEncode(LameConf* conf, short* pcmSamples, int pcmLengthInFrames, char* encodedBytes, int encodedArrayByteSize) { if (conf->gf==NULL) { //throwRuntimeException(env, "not initialized"); return org_tritonus_lowlevel_lame_Lame_NOT_INITIALIZED; } if (conf->channels==1) { return lame_encode_buffer(conf->gf, pcmSamples, pcmSamples, pcmLengthInFrames, encodedBytes, encodedArrayByteSize); } else { return lame_encode_buffer_interleaved(conf->gf, pcmSamples, pcmLengthInFrames, encodedBytes, encodedArrayByteSize); } } int doEncodeFinish(LameConf* conf, char* encodedBytes, int encodedArrayByteSize) { if (conf->gf==NULL) { //throwRuntimeException(env, "not initialized"); return org_tritonus_lowlevel_lame_Lame_NOT_INITIALIZED; } return lame_encode_flush(conf->gf, encodedBytes, encodedArrayByteSize); } void doClose(LameConf* conf) { if (conf->gf!=NULL) { lame_close(conf->gf); conf->gf=NULL; } } int copyVersion(char* s, int len, int major, int minor, int alpha, int beta) { int thislen; int result=0; if (len<8) { return -1; } sprintf(s, "%d.%d", major, minor); thislen=strlen(s); len-=thislen; s+=thislen; result+=thislen; // now put something like "alpha" or "beta" if (alpha && len>=6) { strcpy(s, "alpha"); len-=5; s+=5; result+=5; } else if (beta && len>=5) { strcpy(s, "beta"); len-=4; s+=4; result+=4; } return result; } int doGetEncoderVersion(LameConf* conf, char* charBuffer, int charBufferSize) { lame_version_t version; char* thisString=charBuffer; int size=charBufferSize; int len; int result=0; memset(&version, 0, sizeof(version)); memset(charBuffer, 0, charBufferSize); get_lame_version_numerical(&version); // first put something like "LAME 333.333 alpha" if (size>=13) { strcpy(thisString, "LAME "); thisString+=5; size-=5; result+=5; } len=copyVersion(thisString, size, version.major, version.minor, version.alpha, version.beta); if (len<=0) { return result; } thisString+=len; size-=len; result+=len; // first put something like "(psy model 333.333beta)" if (size>=25) { strcpy(thisString, "; psy model "); thisString+=12; size-=12; result+=12; len=copyVersion(thisString, size, version.major, version.minor, version.alpha, version.beta); if (len<=0) { return result; } thisString+=len; size-=len; result+=len; } // at last, copy features string if (size>5 && version.features!=NULL && version.features[0]!=0) { strcpy(thisString, "; "); thisString+=2; size-=2; result+=2; strncpy(thisString, version.features, size-1); charBuffer[charBufferSize-1]=0; result=strlen(charBuffer); } return result; } libtritonus-java-20070428/src/lib/lame/lameapi.h0000644000175000017500000000315210043054532021246 0ustar twernertwerner/* * lameapi.h */ /* * Copyright (c) 2001 by Florian Bomers * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ #ifndef LAME_API_H_INCLUDED #define LAME_API_H_INCLUDED #include #include #include "org_tritonus_lowlevel_lame_Lame.h" #include typedef struct tagLameConf { int channels; int sampleRate; int bitrate; int mode; int quality; int VBR; int mpegVersion; int swapbytes; lame_global_flags* gf; } LameConf; extern int doInit(LameConf* conf); extern int doGetPCMBufferSize(LameConf* conf, int wishedBufferSize); extern int doEncode(LameConf* conf, short* pcmSamples, int pcmLengthInFrames, char* encodedBytes, int encodedArrayByteSize); extern int doEncodeFinish(LameConf* conf, char* encodedBytes, int encodedArrayByteSize); extern void doClose(LameConf* conf); extern int doGetEncoderVersion(LameConf* conf, char* charBuffer, int charBufferSize); #endif libtritonus-java-20070428/src/lib/lame/org_tritonus_lowlevel_lame_Lame.c0000644000175000017500000002606310043054532026242 0ustar twernertwerner/* * org_tritonus_lowlevel_lame_Lame.c */ /* * Copyright (c) 2000,2001 by Florian Bomers * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ #include #include #include "org_tritonus_lowlevel_lame_Lame.h" #ifdef USE_LAME_API #include "lameapi.h" #endif #ifdef USE_BLADENC_API #include "bladenc.h" #endif ////////////////////////////// JNI ////////////////////////////////////////////// //todo: this is BUGGY ! seg fault... static void throwRuntimeException(JNIEnv *env, char* pStrMessage) { static jclass runtimeExceptionClass = NULL; if (runtimeExceptionClass == NULL) { runtimeExceptionClass = (*env)->FindClass(env, "java/lang/RuntimeException"); if (runtimeExceptionClass == NULL) { (*env)->FatalError(env, "cannot get class object for java.lang.RuntimeException"); } } (*env)->ThrowNew(env, runtimeExceptionClass, pStrMessage); } static jfieldID getFieldID(JNIEnv *env, char* name, char* signature) { jfieldID result; jclass cls = (*env)->FindClass(env, "org/tritonus/lowlevel/lame/Lame"); if (cls == NULL) { throwRuntimeException(env, "cannot get class object for org.tritonus.lowlevel.lame.Lame"); } result = (*env)->GetFieldID(env, cls, name, signature); if (result == NULL) { throwRuntimeException(env, "cannot get field ID in class Lame"); } return result; } static jfieldID nativeGlobalFlagsFieldID = NULL; static jfieldID getNativeGlobalFlagsFieldID(JNIEnv *env) { if (nativeGlobalFlagsFieldID == NULL) { nativeGlobalFlagsFieldID = getFieldID(env, "m_lNativeGlobalFlags", "J"); } return nativeGlobalFlagsFieldID; } static LameConf* getNativeGlobalFlags(JNIEnv *env, jobject obj) { jfieldID fieldID = getNativeGlobalFlagsFieldID(env); return (LameConf*) ((unsigned int) (*env)->GetLongField(env, obj, fieldID)); } static void setNativeGlobalFlags(JNIEnv *env, jobject obj, LameConf* flags) { jfieldID fieldID = getNativeGlobalFlagsFieldID(env); (*env)->SetLongField(env, obj, fieldID, (jlong) ((unsigned int) flags)); } static void setIntField(JNIEnv *env, jobject obj, char* name, int value) { jfieldID fieldID = getFieldID(env, name, "I"); (*env)->SetIntField(env, obj, fieldID, (jint) value); } #define LA_ENDIAN_NOT_TESTED 0 #define LA_BIG_ENDIAN 1 #define LA_LITTLE_ENDIAN 2 static int platformEndianness=LA_ENDIAN_NOT_TESTED; void CheckEndianness(void) { if (platformEndianness==LA_ENDIAN_NOT_TESTED) { int dummy=1; char* pDummy=(char*) (&dummy); if (*pDummy) { platformEndianness=LA_LITTLE_ENDIAN; } else { platformEndianness=LA_BIG_ENDIAN; } } } //////////////////////////////////////// exported JNI functions //////////////////////////////////// /* * Class: org_tritonus_lowlevel_lame_Lame * Method: nInitParams * Signature: (IIIIIZZ)I * returns >=0 on success */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_lame_Lame_nInitParams (JNIEnv * env, jobject obj, jint channels, jint sampleRate, jint bitrate, jint mode, jint quality, jboolean VBR, jboolean bigEndian) { int result; LameConf* conf; #ifdef _DEBUG printf("Java_org_tritonus_lowlevel_lame_Lame_initParams: \n"); printf(" %d channels, %d Hz, %d KBit/s, mode %d, quality=%d VBR=%d bigEndian=%d\n", (int) channels, (int) sampleRate, (int) bitrate, (int) mode, (int) quality, (int) VBR, (int) bigEndian); fflush(stdout); #endif nativeGlobalFlagsFieldID = NULL; conf=(LameConf*) calloc(sizeof(LameConf),1); setNativeGlobalFlags(env, obj, conf); if (conf==NULL) { //throwRuntimeException(env, "out of memory"); return org_tritonus_lowlevel_lame_Lame_OUT_OF_MEMORY; } CheckEndianness(); if ((bigEndian && platformEndianness==LA_LITTLE_ENDIAN) || (!bigEndian && platformEndianness==LA_BIG_ENDIAN)) { // swap samples conf->swapbytes=1; } conf->channels=(int) channels; conf->sampleRate=(int) sampleRate; conf->bitrate=(int) bitrate; conf->mode=(int) mode; conf->quality=(int) quality; conf->VBR=(int) VBR; conf->mpegVersion=0; result=doInit(conf); if (result<0) { free(conf); setNativeGlobalFlags(env, obj, 0); return result; } // update the Lame instance with the effective values setIntField(env, obj, "effSampleRate", conf->sampleRate); setIntField(env, obj, "effBitRate", conf->bitrate); setIntField(env, obj, "effChMode", conf->mode); setIntField(env, obj, "effQuality", conf->quality); setIntField(env, obj, "effVbr", conf->VBR); setIntField(env, obj, "effEncoding", conf->mpegVersion); return (jint) result; } /* * Class: org_tritonus_lowlevel_lame_Lame * Method: nGetPCMBufferSize * Signature: (I)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_lame_Lame_nGetPCMBufferSize (JNIEnv *env, jobject obj, jint wishedBufferSize) { int result=(int) wishedBufferSize; LameConf* conf; conf=getNativeGlobalFlags(env, obj); if (conf!=NULL) { result=doGetPCMBufferSize(conf, (int) wishedBufferSize); } else { //throwRuntimeException(env, "not initialized"); return org_tritonus_lowlevel_lame_Lame_NOT_INITIALIZED; } return (jint) result; } void swapSamples(unsigned short* samples, int count) { while (count>0) { *samples=(unsigned short) ((((*samples) & 0xFF)<<8) | (((*samples) >>8) & 0xFF00)); count--; samples++; } } /* * Class: org_tritonus_lowlevel_lame_Lame * Method: nEncodeBuffer * Signature: ([BII[B)I * * returns result of lame_encode_buffer: * return code number of bytes output in mp3buf. Can be 0 * -1: mp3buf was too small * -2: malloc() problem * -3: lame_init_params() not called * -4: psycho acoustic problems * -5: ogg cleanup encoding error * -6: ogg frame encoding error * */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_lame_Lame_nEncodeBuffer (JNIEnv *env, jobject obj, jbyteArray pcm, jint offset, jint length, jbyteArray encoded) { LameConf* conf; int result; char* encodedBytes, *pcmSamplesOrig; short* pcmSamples; int pcmLengthInFrames; // todo: consistency check for pcm array ? int encodedArrayByteSize=(int) ((*env)->GetArrayLength(env, encoded)); #ifdef _DEBUG jsize pcmArrayByteSize=(*env)->GetArrayLength(env, pcm); int pcmArraySizeInShorts=(pcmArrayByteSize-offset)/2; printf("Java_org_tritonus_lowlevel_lame_Lame_encodeBuffer: \n"); printf(" offset: %d, length:%d, offset+length:%d\n", (int) offset, (int) length, (int) (offset+length)); printf(" %d bytes in PCM array\n", (int) pcmArrayByteSize); printf(" %d bytes in to-be-encoded array\n", (int) encodedArrayByteSize); fflush(stdout); #endif conf=getNativeGlobalFlags(env, obj); if (conf!=NULL) { pcmLengthInFrames=length/(conf->channels*2); // always 16 bit pcmSamplesOrig=(*env)->GetByteArrayElements(env, pcm, NULL); pcmSamples=(short*) pcmSamplesOrig; pcmSamples+=(offset/2); // 16bit if (conf->swapbytes) { swapSamples((unsigned short*) pcmSamples, length/2); } encodedBytes=(*env)->GetByteArrayElements(env, encoded, NULL); #ifdef _DEBUG printf(" Encoding %d frames at %p into buffer %p of size %d bytes.\n", pcmLengthInFrames, pcmSamples, encodedBytes, encodedArrayByteSize); //printf(" Sample1=%d Sample2=%d\n", pcmSamples[0], pcmSamples[1]); #endif result=doEncode(conf, pcmSamples, pcmLengthInFrames, encodedBytes, encodedArrayByteSize); #ifdef _DEBUG //printf(" MP3-1=%d MP3-2=%d\n", (int) encodedBytes[0], (int) encodedBytes[1]); #endif // clean up: // discard any changes in pcmArray (*env)->ReleaseByteArrayElements(env, pcm, pcmSamplesOrig, JNI_ABORT); // commit the encoded bytes (*env)->ReleaseByteArrayElements(env, encoded, encodedBytes, 0); } else { #ifdef _DEBUG printf("Java_org_tritonus_lowlevel_lame_Lame_nEncodeBuffer: \n"); printf(" no global flags !\n"); fflush(stdout); #endif //throwRuntimeException(env, "not initialized"); return org_tritonus_lowlevel_lame_Lame_NOT_INITIALIZED; } return (jint) result; } /* * Class: org_tritonus_lowlevel_lame_Lame * Method: **************************************** nEncodeFinish * Signature: ([B)I ///////////// */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_lame_Lame_nEncodeFinish (JNIEnv *env, jobject obj, jbyteArray buffer) { int result=0; LameConf* conf; #ifdef _DEBUG //jsize length=(*env)->GetArrayLength(env, buffer); printf("Java_org_tritonus_lowlevel_lame_Lame_encodeFinish: \n"); //printf(" %d bytes in the array\n", (int) length); #endif conf=getNativeGlobalFlags(env, obj); if (conf!=NULL) { jsize charBufferSize=(*env)->GetArrayLength(env, buffer); char* charBuffer=NULL; if (charBufferSize>0) { charBuffer=(*env)->GetByteArrayElements(env, buffer, NULL); } result=doEncodeFinish(conf, charBuffer, charBufferSize); doClose(conf); #ifdef _DEBUG printf(" %d bytes returned\n", (int) result); #endif (*env)->ReleaseByteArrayElements(env, buffer, charBuffer, 0); setNativeGlobalFlags(env, obj, 0); free(conf); } #ifdef _DEBUG else { printf("Java_org_tritonus_lowlevel_lame_Lame_encodeFinish: \n"); printf(" no global flags !\n"); } #endif return (jint) result; } /* * Class: org_tritonus_lowlevel_lame_Lame * Method: ************************************** nClose * Signature: ()V ////// */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_lame_Lame_nClose(JNIEnv * env, jobject obj) { LameConf* conf; #ifdef _DEBUG printf("Java_org_tritonus_lowlevel_lame_Lame_nClose. \n"); #endif conf=getNativeGlobalFlags(env, obj); if (conf!=NULL) { doClose(conf); setNativeGlobalFlags(env, obj, 0); free(conf); } #ifdef _DEBUG else { printf(" no global flags !\n"); } #endif } /* * Class: org_tritonus_lowlevel_lame_Lame * Method: nGetEncoderVersion * Signature: ([B)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_lame_Lame_nGetEncoderVersion (JNIEnv * env, jobject obj, jbyteArray string) { LameConf* conf; int res; jsize charBufferSize; char* charBuffer=NULL; #ifdef _DEBUG printf("Java_org_tritonus_lowlevel_lame_Lame_nGetEncoderVersion\n"); #endif conf=getNativeGlobalFlags(env, obj); charBufferSize=(*env)->GetArrayLength(env, string); charBuffer=NULL; if (charBufferSize>0) { charBuffer=(*env)->GetByteArrayElements(env, string, NULL); } if (charBuffer==NULL) { #ifdef _DEBUG printf(" passed array is NULL or zero-length !\n"); return -1; #endif } res=doGetEncoderVersion(conf, charBuffer, charBufferSize); (*env)->ReleaseByteArrayElements(env, string, charBuffer, 0); return res; } libtritonus-java-20070428/src/lib/pvorbis/0000755000175000017500000000000010621572577020252 5ustar twernertwernerlibtritonus-java-20070428/src/lib/pvorbis/books/0000755000175000017500000000000010621572573021363 5ustar twernertwernerlibtritonus-java-20070428/src/lib/pvorbis/books/coupled/0000755000175000017500000000000010621572572023015 5ustar twernertwernerlibtritonus-java-20070428/src/lib/pvorbis/books/coupled/res_books_stereo.h0000644000175000017500000214574010167052701026542 0ustar twernertwerner/******************************************************************** * * * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 * * by the Xiph.Org Foundation http://www.xiph.org/ * * * ******************************************************************** function: static codebooks autogenerated by huff/huffbuld last modified: $Id: res_books_stereo.h,v 1.1 2005/01/05 21:01:53 pfisterer Exp $ ********************************************************************/ #include "codebook.h" static long _vq_quantlist__16c0_s_p1_0[] = { 1, 0, 2, }; static long _vq_lengthlist__16c0_s_p1_0[] = { 1, 4, 4, 0, 0, 0, 0, 0, 0, 5, 7, 7, 0, 0, 0, 0, 0, 0, 5, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 8, 8, 0, 0, 0, 0, 0, 0, 8, 9,10, 0, 0, 0, 0, 0, 0, 7, 9,10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 8, 8, 0, 0, 0, 0, 0, 0, 7, 9, 9, 0, 0, 0, 0, 0, 0, 7, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; static float _vq_quantthresh__16c0_s_p1_0[] = { -0.5, 0.5, }; static long _vq_quantmap__16c0_s_p1_0[] = { 1, 0, 2, }; static encode_aux_threshmatch _vq_auxt__16c0_s_p1_0 = { _vq_quantthresh__16c0_s_p1_0, _vq_quantmap__16c0_s_p1_0, 3, 3 }; static static_codebook _16c0_s_p1_0 = { 8, 6561, _vq_lengthlist__16c0_s_p1_0, 1, -535822336, 1611661312, 2, 0, _vq_quantlist__16c0_s_p1_0, NULL, &_vq_auxt__16c0_s_p1_0, NULL, 0 }; static long _vq_quantlist__16c0_s_p2_0[] = { 2, 1, 3, 0, 4, }; static long _vq_lengthlist__16c0_s_p2_0[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; static float _vq_quantthresh__16c0_s_p2_0[] = { -1.5, -0.5, 0.5, 1.5, }; static long _vq_quantmap__16c0_s_p2_0[] = { 3, 1, 0, 2, 4, }; static encode_aux_threshmatch _vq_auxt__16c0_s_p2_0 = { _vq_quantthresh__16c0_s_p2_0, _vq_quantmap__16c0_s_p2_0, 5, 5 }; static static_codebook _16c0_s_p2_0 = { 4, 625, _vq_lengthlist__16c0_s_p2_0, 1, -533725184, 1611661312, 3, 0, _vq_quantlist__16c0_s_p2_0, NULL, &_vq_auxt__16c0_s_p2_0, NULL, 0 }; static long _vq_quantlist__16c0_s_p3_0[] = { 2, 1, 3, 0, 4, }; static long _vq_lengthlist__16c0_s_p3_0[] = { 1, 4, 4, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 6, 6, 7, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; static float _vq_quantthresh__16c0_s_p3_0[] = { -1.5, -0.5, 0.5, 1.5, }; static long _vq_quantmap__16c0_s_p3_0[] = { 3, 1, 0, 2, 4, }; static encode_aux_threshmatch _vq_auxt__16c0_s_p3_0 = { _vq_quantthresh__16c0_s_p3_0, _vq_quantmap__16c0_s_p3_0, 5, 5 }; static static_codebook _16c0_s_p3_0 = { 4, 625, _vq_lengthlist__16c0_s_p3_0, 1, -533725184, 1611661312, 3, 0, _vq_quantlist__16c0_s_p3_0, NULL, &_vq_auxt__16c0_s_p3_0, NULL, 0 }; static long _vq_quantlist__16c0_s_p4_0[] = { 4, 3, 5, 2, 6, 1, 7, 0, 8, }; static long _vq_lengthlist__16c0_s_p4_0[] = { 1, 3, 2, 7, 8, 0, 0, 0, 0, 0, 0, 0, 6, 6, 0, 0, 0, 0, 0, 0, 0, 6, 6, 0, 0, 0, 0, 0, 0, 0, 7, 7, 0, 0, 0, 0, 0, 0, 0, 7, 7, 0, 0, 0, 0, 0, 0, 0, 8, 8, 0, 0, 0, 0, 0, 0, 0, 8, 8, 0, 0, 0, 0, 0, 0, 0, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; static float _vq_quantthresh__16c0_s_p4_0[] = { -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, }; static long _vq_quantmap__16c0_s_p4_0[] = { 7, 5, 3, 1, 0, 2, 4, 6, 8, }; static encode_aux_threshmatch _vq_auxt__16c0_s_p4_0 = { _vq_quantthresh__16c0_s_p4_0, _vq_quantmap__16c0_s_p4_0, 9, 9 }; static static_codebook _16c0_s_p4_0 = { 2, 81, _vq_lengthlist__16c0_s_p4_0, 1, -531628032, 1611661312, 4, 0, _vq_quantlist__16c0_s_p4_0, NULL, &_vq_auxt__16c0_s_p4_0, NULL, 0 }; static long _vq_quantlist__16c0_s_p5_0[] = { 4, 3, 5, 2, 6, 1, 7, 0, 8, }; static long _vq_lengthlist__16c0_s_p5_0[] = { 1, 3, 3, 6, 6, 6, 6, 8, 8, 0, 0, 0, 7, 7, 7, 7, 8, 8, 0, 0, 0, 7, 7, 7, 7, 8, 8, 0, 0, 0, 7, 7, 8, 8, 9, 9, 0, 0, 0, 7, 7, 8, 8, 9, 9, 0, 0, 0, 8, 9, 8, 8,10,10, 0, 0, 0, 8, 8, 8, 8,10,10, 0, 0, 0,10,10, 9, 9,10,10, 0, 0, 0, 0, 0, 9, 9,10, 10, }; static float _vq_quantthresh__16c0_s_p5_0[] = { -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, }; static long _vq_quantmap__16c0_s_p5_0[] = { 7, 5, 3, 1, 0, 2, 4, 6, 8, }; static encode_aux_threshmatch _vq_auxt__16c0_s_p5_0 = { _vq_quantthresh__16c0_s_p5_0, _vq_quantmap__16c0_s_p5_0, 9, 9 }; static static_codebook _16c0_s_p5_0 = { 2, 81, _vq_lengthlist__16c0_s_p5_0, 1, -531628032, 1611661312, 4, 0, _vq_quantlist__16c0_s_p5_0, NULL, &_vq_auxt__16c0_s_p5_0, NULL, 0 }; static long _vq_quantlist__16c0_s_p6_0[] = { 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15, 0, 16, }; static long _vq_lengthlist__16c0_s_p6_0[] = { 1, 3, 4, 6, 6, 7, 7, 8, 8, 8, 8, 9, 9,10,10,11, 11, 0, 0, 0, 7, 7, 8, 8, 9, 9, 9, 9,10,10,10,11, 11,11, 0, 0, 0, 6, 6, 8, 8, 9, 9, 9, 9,10,10,11, 11,11,11, 0, 0, 0, 7, 7, 8, 8, 9, 9, 9, 9,10,10, 11,11,12,12, 0, 0, 0, 7, 7, 8, 8, 9, 9, 9, 9,10, 10,11,11,12,12, 0, 0, 0, 8, 8, 9, 9,10,10,10,10, 11,11,12,12,12,12, 0, 0, 0, 8, 8, 9, 9,10,10,10, 10,11,11,12,12,12,13, 0, 0, 0, 9, 9, 9, 9,10,10, 10,10,11,11,12,12,13,13, 0, 0, 0, 0, 0,10,10,10, 10,10,10,11,11,12,12,13,13, 0, 0, 0, 0, 0, 9, 9, 10,10,11,11,12,12,13,13,13,13, 0, 0, 0, 0, 0, 9, 9,10,10,11,11,12,12,13,13,13,14, 0, 0, 0, 0, 0, 10,10,10,11,11,11,12,12,13,13,13,14, 0, 0, 0, 0, 0, 0, 0,10,10,11,11,12,12,13,13,14,14, 0, 0, 0, 0, 0, 0, 0,11,11,12,12,13,13,13,13,14,14, 0, 0, 0, 0, 0, 0, 0,11,11,12,12,12,13,13,14,15,14, 0, 0, 0, 0, 0, 0, 0,12,12,12,12,13,13,13,14,14,15, 0, 0, 0, 0, 0, 0, 0, 0, 0,12,12,13,13,14,13,14, 14, }; static float _vq_quantthresh__16c0_s_p6_0[] = { -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, }; static long _vq_quantmap__16c0_s_p6_0[] = { 15, 13, 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, 14, 16, }; static encode_aux_threshmatch _vq_auxt__16c0_s_p6_0 = { _vq_quantthresh__16c0_s_p6_0, _vq_quantmap__16c0_s_p6_0, 17, 17 }; static static_codebook _16c0_s_p6_0 = { 2, 289, _vq_lengthlist__16c0_s_p6_0, 1, -529530880, 1611661312, 5, 0, _vq_quantlist__16c0_s_p6_0, NULL, &_vq_auxt__16c0_s_p6_0, NULL, 0 }; static long _vq_quantlist__16c0_s_p7_0[] = { 1, 0, 2, }; static long _vq_lengthlist__16c0_s_p7_0[] = { 1, 4, 4, 6, 6, 6, 7, 6, 6, 4, 7, 7,11,10,10,11, 11,10, 4, 7, 7,10,10,10,11,10,10, 6,10,10,11,11, 11,11,11,10, 6, 9, 9,11,12,12,11, 9, 9, 6, 9,10, 11,12,12,11, 9,10, 7,11,11,11,11,11,12,13,12, 6, 9,10,11,10,10,12,13,13, 6,10, 9,11,10,10,11,12, 13, }; static float _vq_quantthresh__16c0_s_p7_0[] = { -5.5, 5.5, }; static long _vq_quantmap__16c0_s_p7_0[] = { 1, 0, 2, }; static encode_aux_threshmatch _vq_auxt__16c0_s_p7_0 = { _vq_quantthresh__16c0_s_p7_0, _vq_quantmap__16c0_s_p7_0, 3, 3 }; static static_codebook _16c0_s_p7_0 = { 4, 81, _vq_lengthlist__16c0_s_p7_0, 1, -529137664, 1618345984, 2, 0, _vq_quantlist__16c0_s_p7_0, NULL, &_vq_auxt__16c0_s_p7_0, NULL, 0 }; static long _vq_quantlist__16c0_s_p7_1[] = { 5, 4, 6, 3, 7, 2, 8, 1, 9, 0, 10, }; static long _vq_lengthlist__16c0_s_p7_1[] = { 1, 3, 4, 6, 6, 7, 7, 8, 8, 8, 8,10,10,10, 7, 7, 8, 8, 8, 9, 9, 9,10,10,10, 6, 7, 8, 8, 8, 8, 9, 8,10,10,10, 7, 7, 8, 8, 9, 9, 9, 9,10,10,10, 7, 7, 8, 8, 9, 9, 8, 9,10,10,10, 8, 8, 9, 9, 9, 9, 9, 9,11,11,11, 8, 8, 9, 9, 9, 9, 9,10,10,11,11, 9, 9, 9, 9, 9, 9, 9,10,11,11,11,10,11, 9, 9, 9, 9,10, 9,11,11,11,10,11,10,10, 9, 9,10,10,11,11, 11,11,11, 9, 9, 9, 9,10,10, }; static float _vq_quantthresh__16c0_s_p7_1[] = { -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, }; static long _vq_quantmap__16c0_s_p7_1[] = { 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, }; static encode_aux_threshmatch _vq_auxt__16c0_s_p7_1 = { _vq_quantthresh__16c0_s_p7_1, _vq_quantmap__16c0_s_p7_1, 11, 11 }; static static_codebook _16c0_s_p7_1 = { 2, 121, _vq_lengthlist__16c0_s_p7_1, 1, -531365888, 1611661312, 4, 0, _vq_quantlist__16c0_s_p7_1, NULL, &_vq_auxt__16c0_s_p7_1, NULL, 0 }; static long _vq_quantlist__16c0_s_p8_0[] = { 6, 5, 7, 4, 8, 3, 9, 2, 10, 1, 11, 0, 12, }; static long _vq_lengthlist__16c0_s_p8_0[] = { 1, 4, 4, 7, 7, 7, 7, 7, 6, 8, 8,10,10, 6, 5, 6, 8, 8, 8, 8, 8, 8, 8, 9,10,10, 7, 6, 6, 8, 8, 8, 8, 8, 8, 8, 8,10,10, 0, 8, 8, 8, 8, 9, 8, 9, 9, 9,10,10,10, 0, 9, 8, 8, 8, 9, 9, 8, 8, 9, 9,10, 10, 0,12,11, 8, 8, 9, 9, 9, 9,10,10,11,10, 0,12, 13, 8, 8, 9,10, 9, 9,11,11,11,12, 0, 0, 0, 8, 8, 8, 8,10, 9,12,13,12,14, 0, 0, 0, 8, 8, 8, 9,10, 10,12,12,13,14, 0, 0, 0,13,13, 9, 9,11,11, 0, 0, 14, 0, 0, 0, 0,14,14,10,10,12,11,12,14,14,14, 0, 0, 0, 0, 0,11,11,13,13,14,13,14,14, 0, 0, 0, 0, 0,12,13,13,12,13,14,14,14, }; static float _vq_quantthresh__16c0_s_p8_0[] = { -27.5, -22.5, -17.5, -12.5, -7.5, -2.5, 2.5, 7.5, 12.5, 17.5, 22.5, 27.5, }; static long _vq_quantmap__16c0_s_p8_0[] = { 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, }; static encode_aux_threshmatch _vq_auxt__16c0_s_p8_0 = { _vq_quantthresh__16c0_s_p8_0, _vq_quantmap__16c0_s_p8_0, 13, 13 }; static static_codebook _16c0_s_p8_0 = { 2, 169, _vq_lengthlist__16c0_s_p8_0, 1, -526516224, 1616117760, 4, 0, _vq_quantlist__16c0_s_p8_0, NULL, &_vq_auxt__16c0_s_p8_0, NULL, 0 }; static long _vq_quantlist__16c0_s_p8_1[] = { 2, 1, 3, 0, 4, }; static long _vq_lengthlist__16c0_s_p8_1[] = { 1, 4, 3, 5, 5, 7, 7, 7, 6, 6, 7, 7, 7, 5, 5, 7, 7, 7, 6, 6, 7, 7, 7, 6, 6, }; static float _vq_quantthresh__16c0_s_p8_1[] = { -1.5, -0.5, 0.5, 1.5, }; static long _vq_quantmap__16c0_s_p8_1[] = { 3, 1, 0, 2, 4, }; static encode_aux_threshmatch _vq_auxt__16c0_s_p8_1 = { _vq_quantthresh__16c0_s_p8_1, _vq_quantmap__16c0_s_p8_1, 5, 5 }; static static_codebook _16c0_s_p8_1 = { 2, 25, _vq_lengthlist__16c0_s_p8_1, 1, -533725184, 1611661312, 3, 0, _vq_quantlist__16c0_s_p8_1, NULL, &_vq_auxt__16c0_s_p8_1, NULL, 0 }; static long _vq_quantlist__16c0_s_p9_0[] = { 1, 0, 2, }; static long _vq_lengthlist__16c0_s_p9_0[] = { 1, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, }; static float _vq_quantthresh__16c0_s_p9_0[] = { -157.5, 157.5, }; static long _vq_quantmap__16c0_s_p9_0[] = { 1, 0, 2, }; static encode_aux_threshmatch _vq_auxt__16c0_s_p9_0 = { _vq_quantthresh__16c0_s_p9_0, _vq_quantmap__16c0_s_p9_0, 3, 3 }; static static_codebook _16c0_s_p9_0 = { 4, 81, _vq_lengthlist__16c0_s_p9_0, 1, -518803456, 1628680192, 2, 0, _vq_quantlist__16c0_s_p9_0, NULL, &_vq_auxt__16c0_s_p9_0, NULL, 0 }; static long _vq_quantlist__16c0_s_p9_1[] = { 7, 6, 8, 5, 9, 4, 10, 3, 11, 2, 12, 1, 13, 0, 14, }; static long _vq_lengthlist__16c0_s_p9_1[] = { 1, 5, 5, 5, 5, 9,11,11,10,10,10,10,10,10,10, 7, 6, 6, 6, 6,10,10,10,10,10,10,10,10,10,10, 7, 6, 6, 6, 6,10, 9,10,10,10,10,10,10,10,10,10, 7, 7, 8, 9,10,10,10,10,10,10,10,10,10,10,10, 8, 7,10, 10,10, 9,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10, }; static float _vq_quantthresh__16c0_s_p9_1[] = { -136.5, -115.5, -94.5, -73.5, -52.5, -31.5, -10.5, 10.5, 31.5, 52.5, 73.5, 94.5, 115.5, 136.5, }; static long _vq_quantmap__16c0_s_p9_1[] = { 13, 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, 14, }; static encode_aux_threshmatch _vq_auxt__16c0_s_p9_1 = { _vq_quantthresh__16c0_s_p9_1, _vq_quantmap__16c0_s_p9_1, 15, 15 }; static static_codebook _16c0_s_p9_1 = { 2, 225, _vq_lengthlist__16c0_s_p9_1, 1, -520986624, 1620377600, 4, 0, _vq_quantlist__16c0_s_p9_1, NULL, &_vq_auxt__16c0_s_p9_1, NULL, 0 }; static long _vq_quantlist__16c0_s_p9_2[] = { 10, 9, 11, 8, 12, 7, 13, 6, 14, 5, 15, 4, 16, 3, 17, 2, 18, 1, 19, 0, 20, }; static long _vq_lengthlist__16c0_s_p9_2[] = { 1, 5, 5, 7, 8, 8, 7, 9, 9, 9,12,12,11,12,12,10, 10,11,12,12,12,11,12,12, 8, 9, 8, 7, 9,10,10,11, 11,10,11,12,10,12,10,12,12,12,11,12,11, 9, 8, 8, 9,10, 9, 8, 9,10,12,12,11,11,12,11,10,11,12,11, 12,12, 8, 9, 9, 9,10,11,12,11,12,11,11,11,11,12, 12,11,11,12,12,11,11, 9, 9, 8, 9, 9,11, 9, 9,10, 9,11,11,11,11,12,11,11,10,12,12,12, 9,12,11,10, 11,11,11,11,12,12,12,11,11,11,12,10,12,12,12,10, 10, 9,10, 9,10,10, 9, 9, 9,10,10,12,10,11,11, 9, 11,11,10,11,11,11,10,10,10, 9, 9,10,10, 9, 9,10, 11,11,10,11,10,11,10,11,11,10,11,11,11,10, 9,10, 10, 9,10, 9, 9,11, 9, 9,11,10,10,11,11,10,10,11, 10,11, 8, 9,11,11,10, 9,10,11,11,10,11,11,10,10, 10,11,10, 9,10,10,11, 9,10,10, 9,11,10,10,10,10, 11,10,11,11, 9,11,10,11,10,10,11,11,10,10,10, 9, 10,10,11,11,11, 9,10,10,10,10,10,11,10,10,10, 9, 10,10,11,10,10,10,10,10, 9,10,11,10,10,10,10,11, 11,11,10,10,10,10,10,11,10,11,10,11,10,10,10, 9, 11,11,10,10,10,11,11,10,10,10,10,10,10,10,10,11, 11, 9,10,10,10,11,10,11,10,10,10,11, 9,10,11,10, 11,10,10, 9,10,10,10,11,10,11,10,10,10,10,10,11, 11,10,11,11,10,10,11,11,10, 9, 9,10,10,10,10,10, 9,11, 9,10,10,10,11,11,10,10,10,10,11,11,11,10, 9, 9,10,10,11,10,10,10,10,10,11,11,11,10,10,10, 11,11,11, 9,10,10,10,10, 9,10, 9,10,11,10,11,10, 10,11,11,10,11,11,11,11,11,10,11,10,10,10, 9,11, 11,10,11,11,11,11,11,11,11,11,11,10,11,10,10,10, 10,11,10,10,11, 9,10,10,10, }; static float _vq_quantthresh__16c0_s_p9_2[] = { -9.5, -8.5, -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, 9.5, }; static long _vq_quantmap__16c0_s_p9_2[] = { 19, 17, 15, 13, 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, }; static encode_aux_threshmatch _vq_auxt__16c0_s_p9_2 = { _vq_quantthresh__16c0_s_p9_2, _vq_quantmap__16c0_s_p9_2, 21, 21 }; static static_codebook _16c0_s_p9_2 = { 2, 441, _vq_lengthlist__16c0_s_p9_2, 1, -529268736, 1611661312, 5, 0, _vq_quantlist__16c0_s_p9_2, NULL, &_vq_auxt__16c0_s_p9_2, NULL, 0 }; static long _huff_lengthlist__16c0_s_single[] = { 3, 4,19, 7, 9, 7, 8,11, 9,12, 4, 1,19, 6, 7, 7, 8,10,11,13,18,18,18,18,18,18,18,18,18,18, 8, 6, 18, 8, 9, 9,11,12,14,18, 9, 6,18, 9, 7, 8, 9,11, 12,18, 7, 6,18, 8, 7, 7, 7, 9,11,17, 8, 8,18, 9, 7, 6, 6, 8,11,17,10,10,18,12, 9, 8, 7, 9,12,18, 13,15,18,15,13,11,10,11,15,18,14,18,18,18,18,18, 16,16,18,18, }; static static_codebook _huff_book__16c0_s_single = { 2, 100, _huff_lengthlist__16c0_s_single, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _huff_lengthlist__16c1_s_long[] = { 2, 5,20, 7,10, 7, 8,10,11,11, 4, 2,20, 5, 8, 6, 7, 9,10,10,20,20,20,20,19,19,19,19,19,19, 7, 5, 19, 6,10, 7, 9,11,13,17,11, 8,19,10, 7, 7, 8,10, 11,15, 7, 5,19, 7, 7, 5, 6, 9,11,16, 7, 6,19, 8, 7, 6, 6, 7, 9,13, 9, 9,19,11, 9, 8, 6, 7, 8,13, 12,14,19,16,13,10, 9, 8, 9,13,14,17,19,18,18,17, 12,11,11,13, }; static static_codebook _huff_book__16c1_s_long = { 2, 100, _huff_lengthlist__16c1_s_long, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _vq_quantlist__16c1_s_p1_0[] = { 1, 0, 2, }; static long _vq_lengthlist__16c1_s_p1_0[] = { 1, 5, 5, 0, 0, 0, 0, 0, 0, 5, 7, 7, 0, 0, 0, 0, 0, 0, 5, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 8, 7, 0, 0, 0, 0, 0, 0, 7, 9, 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] = { 1, 0, 2, }; static encode_aux_threshmatch _vq_auxt__16c1_s_p1_0 = { _vq_quantthresh__16c1_s_p1_0, _vq_quantmap__16c1_s_p1_0, 3, 3 }; static static_codebook _16c1_s_p1_0 = { 8, 6561, _vq_lengthlist__16c1_s_p1_0, 1, -535822336, 1611661312, 2, 0, _vq_quantlist__16c1_s_p1_0, NULL, &_vq_auxt__16c1_s_p1_0, NULL, 0 }; static long _vq_quantlist__16c1_s_p2_0[] = { 2, 1, 3, 0, 4, }; static long _vq_lengthlist__16c1_s_p2_0[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; static float _vq_quantthresh__16c1_s_p2_0[] = { -1.5, -0.5, 0.5, 1.5, }; static long _vq_quantmap__16c1_s_p2_0[] = { 3, 1, 0, 2, 4, }; static encode_aux_threshmatch _vq_auxt__16c1_s_p2_0 = { _vq_quantthresh__16c1_s_p2_0, _vq_quantmap__16c1_s_p2_0, 5, 5 }; static static_codebook _16c1_s_p2_0 = { 4, 625, _vq_lengthlist__16c1_s_p2_0, 1, -533725184, 1611661312, 3, 0, _vq_quantlist__16c1_s_p2_0, NULL, &_vq_auxt__16c1_s_p2_0, NULL, 0 }; static long _vq_quantlist__16c1_s_p3_0[] = { 2, 1, 3, 0, 4, }; static long _vq_lengthlist__16c1_s_p3_0[] = { 1, 4, 4, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 5, 5, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 5, 5, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 7, 7, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; static float _vq_quantthresh__16c1_s_p3_0[] = { -1.5, -0.5, 0.5, 1.5, }; static long _vq_quantmap__16c1_s_p3_0[] = { 3, 1, 0, 2, 4, }; static encode_aux_threshmatch _vq_auxt__16c1_s_p3_0 = { _vq_quantthresh__16c1_s_p3_0, _vq_quantmap__16c1_s_p3_0, 5, 5 }; static static_codebook _16c1_s_p3_0 = { 4, 625, _vq_lengthlist__16c1_s_p3_0, 1, -533725184, 1611661312, 3, 0, _vq_quantlist__16c1_s_p3_0, NULL, &_vq_auxt__16c1_s_p3_0, NULL, 0 }; static long _vq_quantlist__16c1_s_p4_0[] = { 4, 3, 5, 2, 6, 1, 7, 0, 8, }; static long _vq_lengthlist__16c1_s_p4_0[] = { 1, 2, 3, 7, 7, 0, 0, 0, 0, 0, 0, 0, 6, 6, 0, 0, 0, 0, 0, 0, 0, 6, 6, 0, 0, 0, 0, 0, 0, 0, 7, 7, 0, 0, 0, 0, 0, 0, 0, 7, 7, 0, 0, 0, 0, 0, 0, 0, 8, 8, 0, 0, 0, 0, 0, 0, 0, 8, 9, 0, 0, 0, 0, 0, 0, 0,10,10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; static float _vq_quantthresh__16c1_s_p4_0[] = { -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, }; static long _vq_quantmap__16c1_s_p4_0[] = { 7, 5, 3, 1, 0, 2, 4, 6, 8, }; static encode_aux_threshmatch _vq_auxt__16c1_s_p4_0 = { _vq_quantthresh__16c1_s_p4_0, _vq_quantmap__16c1_s_p4_0, 9, 9 }; static static_codebook _16c1_s_p4_0 = { 2, 81, _vq_lengthlist__16c1_s_p4_0, 1, -531628032, 1611661312, 4, 0, _vq_quantlist__16c1_s_p4_0, NULL, &_vq_auxt__16c1_s_p4_0, NULL, 0 }; static long _vq_quantlist__16c1_s_p5_0[] = { 4, 3, 5, 2, 6, 1, 7, 0, 8, }; static long _vq_lengthlist__16c1_s_p5_0[] = { 1, 3, 3, 5, 5, 6, 6, 8, 8, 0, 0, 0, 7, 7, 7, 7, 9, 9, 0, 0, 0, 7, 7, 7, 7, 9, 9, 0, 0, 0, 8, 8, 8, 8, 9, 9, 0, 0, 0, 8, 8, 8, 8,10,10, 0, 0, 0, 9, 9, 8, 8,10,10, 0, 0, 0, 9, 9, 8, 8,10,10, 0, 0, 0,10,10, 9, 9,10,10, 0, 0, 0, 0, 0, 9, 9,10, 10, }; static float _vq_quantthresh__16c1_s_p5_0[] = { -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, }; static long _vq_quantmap__16c1_s_p5_0[] = { 7, 5, 3, 1, 0, 2, 4, 6, 8, }; static encode_aux_threshmatch _vq_auxt__16c1_s_p5_0 = { _vq_quantthresh__16c1_s_p5_0, _vq_quantmap__16c1_s_p5_0, 9, 9 }; static static_codebook _16c1_s_p5_0 = { 2, 81, _vq_lengthlist__16c1_s_p5_0, 1, -531628032, 1611661312, 4, 0, _vq_quantlist__16c1_s_p5_0, NULL, &_vq_auxt__16c1_s_p5_0, NULL, 0 }; static long _vq_quantlist__16c1_s_p6_0[] = { 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15, 0, 16, }; static long _vq_lengthlist__16c1_s_p6_0[] = { 1, 3, 3, 6, 6, 8, 8, 9, 9, 9, 9,10,10,11,11,12, 12, 0, 0, 0, 7, 7, 8, 8, 9, 9, 9, 9,10,10,11,11, 12,12, 0, 0, 0, 7, 7, 8, 8, 9, 9, 9, 9,10,10,11, 11,12,12, 0, 0, 0, 8, 8, 8, 9,10, 9,10,10,10,10, 11,11,12,12, 0, 0, 0, 8, 8, 9, 9,10,10,10,10,11, 11,11,12,12,12, 0, 0, 0, 8, 8, 9, 9,10,10,10,10, 11,11,12,12,12,12, 0, 0, 0, 8, 8, 9, 9,10,10,10, 10,11,11,12,12,13,13, 0, 0, 0, 9, 9, 9, 9,10,10, 10,10,11,11,12,12,13,13, 0, 0, 0, 0, 0, 9, 9,10, 10,10,10,11,11,12,12,13,13, 0, 0, 0, 0, 0, 9, 9, 10,10,11,11,12,12,12,12,13,13, 0, 0, 0, 0, 0, 9, 9,10,10,11,11,12,12,12,12,13,13, 0, 0, 0, 0, 0, 10,10,11,10,11,11,12,12,13,13,13,13, 0, 0, 0, 0, 0, 0, 0,10,10,11,11,12,12,13,13,13,13, 0, 0, 0, 0, 0, 0, 0,11,11,12,12,12,12,13,13,14,14, 0, 0, 0, 0, 0, 0, 0,11,11,12,12,12,12,13,13,14,14, 0, 0, 0, 0, 0, 0, 0,12,12,12,12,13,13,13,13,14,14, 0, 0, 0, 0, 0, 0, 0, 0, 0,12,12,13,13,13,13,14, 14, }; static float _vq_quantthresh__16c1_s_p6_0[] = { -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, }; static long _vq_quantmap__16c1_s_p6_0[] = { 15, 13, 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, 14, 16, }; static encode_aux_threshmatch _vq_auxt__16c1_s_p6_0 = { _vq_quantthresh__16c1_s_p6_0, _vq_quantmap__16c1_s_p6_0, 17, 17 }; static static_codebook _16c1_s_p6_0 = { 2, 289, _vq_lengthlist__16c1_s_p6_0, 1, -529530880, 1611661312, 5, 0, _vq_quantlist__16c1_s_p6_0, NULL, &_vq_auxt__16c1_s_p6_0, NULL, 0 }; static long _vq_quantlist__16c1_s_p7_0[] = { 1, 0, 2, }; static long _vq_lengthlist__16c1_s_p7_0[] = { 1, 4, 4, 6, 6, 6, 7, 6, 6, 4, 7, 7,10, 9,10,10, 10, 9, 4, 7, 7,10,10,10,11,10,10, 6,10,10,11,11, 11,11,10,10, 6,10, 9,11,11,11,11,10,10, 6,10,10, 11,11,11,11,10,10, 7,11,11,11,11,11,12,12,11, 6, 10,10,11,10,10,11,11,11, 6,10,10,10,11,10,11,11, 11, }; static float _vq_quantthresh__16c1_s_p7_0[] = { -5.5, 5.5, }; static long _vq_quantmap__16c1_s_p7_0[] = { 1, 0, 2, }; static encode_aux_threshmatch _vq_auxt__16c1_s_p7_0 = { _vq_quantthresh__16c1_s_p7_0, _vq_quantmap__16c1_s_p7_0, 3, 3 }; static static_codebook _16c1_s_p7_0 = { 4, 81, _vq_lengthlist__16c1_s_p7_0, 1, -529137664, 1618345984, 2, 0, _vq_quantlist__16c1_s_p7_0, NULL, &_vq_auxt__16c1_s_p7_0, NULL, 0 }; static long _vq_quantlist__16c1_s_p7_1[] = { 5, 4, 6, 3, 7, 2, 8, 1, 9, 0, 10, }; static long _vq_lengthlist__16c1_s_p7_1[] = { 2, 3, 3, 5, 6, 7, 7, 7, 7, 8, 8,10,10,10, 6, 6, 7, 7, 8, 8, 8, 8,10,10,10, 6, 6, 7, 7, 8, 8, 8, 8,10,10,10, 7, 7, 7, 7, 8, 8, 8, 8,10,10,10, 7, 7, 7, 7, 8, 8, 8, 8,10,10,10, 7, 7, 8, 8, 8, 8, 8, 8,10,10,10, 7, 7, 8, 8, 8, 8, 8, 8,10,10,10, 8, 8, 8, 8, 8, 8, 9, 9,10,10,10,10,10, 8, 8, 8, 8, 9, 9,10,10,10,10,10, 9, 9, 8, 8, 9, 9,10,10, 10,10,10, 8, 8, 8, 8, 9, 9, }; static float _vq_quantthresh__16c1_s_p7_1[] = { -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, }; static long _vq_quantmap__16c1_s_p7_1[] = { 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, }; static encode_aux_threshmatch _vq_auxt__16c1_s_p7_1 = { _vq_quantthresh__16c1_s_p7_1, _vq_quantmap__16c1_s_p7_1, 11, 11 }; static static_codebook _16c1_s_p7_1 = { 2, 121, _vq_lengthlist__16c1_s_p7_1, 1, -531365888, 1611661312, 4, 0, _vq_quantlist__16c1_s_p7_1, NULL, &_vq_auxt__16c1_s_p7_1, NULL, 0 }; static long _vq_quantlist__16c1_s_p8_0[] = { 6, 5, 7, 4, 8, 3, 9, 2, 10, 1, 11, 0, 12, }; static long _vq_lengthlist__16c1_s_p8_0[] = { 1, 4, 4, 6, 6, 7, 7, 7, 7, 8, 8, 9, 9, 6, 5, 5, 7, 8, 8, 9, 8, 8, 9, 9,10,11, 6, 5, 5, 8, 8, 9, 9, 8, 8, 9,10,10,11, 0, 8, 8, 8, 9, 9, 9, 9, 9, 10,10,11,11, 0, 9, 9, 9, 8, 9, 9, 9, 9,10,10,11, 11, 0,13,13, 9, 9,10,10,10,10,11,11,12,12, 0,14, 13, 9, 9,10,10,10,10,11,11,12,12, 0, 0, 0,10,10, 9, 9,11,11,12,12,13,12, 0, 0, 0,10,10, 9, 9,10, 10,12,12,13,13, 0, 0, 0,13,14,11,10,11,11,12,12, 13,14, 0, 0, 0,14,14,10,10,11,11,12,12,13,13, 0, 0, 0, 0, 0,12,12,12,12,13,13,14,15, 0, 0, 0, 0, 0,12,12,12,12,13,13,14,15, }; static float _vq_quantthresh__16c1_s_p8_0[] = { -27.5, -22.5, -17.5, -12.5, -7.5, -2.5, 2.5, 7.5, 12.5, 17.5, 22.5, 27.5, }; static long _vq_quantmap__16c1_s_p8_0[] = { 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, }; static encode_aux_threshmatch _vq_auxt__16c1_s_p8_0 = { _vq_quantthresh__16c1_s_p8_0, _vq_quantmap__16c1_s_p8_0, 13, 13 }; static static_codebook _16c1_s_p8_0 = { 2, 169, _vq_lengthlist__16c1_s_p8_0, 1, -526516224, 1616117760, 4, 0, _vq_quantlist__16c1_s_p8_0, NULL, &_vq_auxt__16c1_s_p8_0, NULL, 0 }; static long _vq_quantlist__16c1_s_p8_1[] = { 2, 1, 3, 0, 4, }; static long _vq_lengthlist__16c1_s_p8_1[] = { 2, 3, 3, 5, 5, 6, 6, 6, 5, 5, 6, 6, 6, 5, 5, 6, 6, 6, 5, 5, 6, 6, 6, 5, 5, }; static float _vq_quantthresh__16c1_s_p8_1[] = { -1.5, -0.5, 0.5, 1.5, }; static long _vq_quantmap__16c1_s_p8_1[] = { 3, 1, 0, 2, 4, }; static encode_aux_threshmatch _vq_auxt__16c1_s_p8_1 = { _vq_quantthresh__16c1_s_p8_1, _vq_quantmap__16c1_s_p8_1, 5, 5 }; static static_codebook _16c1_s_p8_1 = { 2, 25, _vq_lengthlist__16c1_s_p8_1, 1, -533725184, 1611661312, 3, 0, _vq_quantlist__16c1_s_p8_1, NULL, &_vq_auxt__16c1_s_p8_1, NULL, 0 }; static long _vq_quantlist__16c1_s_p9_0[] = { 6, 5, 7, 4, 8, 3, 9, 2, 10, 1, 11, 0, 12, }; static long _vq_lengthlist__16c1_s_p9_0[] = { 1, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, }; static float _vq_quantthresh__16c1_s_p9_0[] = { -1732.5, -1417.5, -1102.5, -787.5, -472.5, -157.5, 157.5, 472.5, 787.5, 1102.5, 1417.5, 1732.5, }; static long _vq_quantmap__16c1_s_p9_0[] = { 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, }; static encode_aux_threshmatch _vq_auxt__16c1_s_p9_0 = { _vq_quantthresh__16c1_s_p9_0, _vq_quantmap__16c1_s_p9_0, 13, 13 }; static static_codebook _16c1_s_p9_0 = { 2, 169, _vq_lengthlist__16c1_s_p9_0, 1, -513964032, 1628680192, 4, 0, _vq_quantlist__16c1_s_p9_0, NULL, &_vq_auxt__16c1_s_p9_0, NULL, 0 }; static long _vq_quantlist__16c1_s_p9_1[] = { 7, 6, 8, 5, 9, 4, 10, 3, 11, 2, 12, 1, 13, 0, 14, }; static long _vq_lengthlist__16c1_s_p9_1[] = { 1, 4, 4, 4, 4, 8, 8,12,13,14,14,14,14,14,14, 6, 6, 6, 6, 6,10, 9,14,14,14,14,14,14,14,14, 7, 6, 5, 6, 6,10, 9,12,13,13,13,13,13,13,13,13, 7, 7, 9, 9,11,11,12,13,13,13,13,13,13,13,13, 7, 7, 8, 8,11,12,13,13,13,13,13,13,13,13,13,12,12,10,10, 13,12,13,13,13,13,13,13,13,13,13,12,12,10,10,13, 13,13,13,13,13,13,13,13,13,13,13,13,13,12,13,12, 13,13,13,13,13,13,13,13,13,13,13,13,12,13,13,13, 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, 13,13,13,13,13,13,13,13,13,13,13,13,12,13,13,13, 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, 13,13,13,13,13,13,13,13,13,12,13,13,13,13,13,13, 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, 13, }; static float _vq_quantthresh__16c1_s_p9_1[] = { -136.5, -115.5, -94.5, -73.5, -52.5, -31.5, -10.5, 10.5, 31.5, 52.5, 73.5, 94.5, 115.5, 136.5, }; static long _vq_quantmap__16c1_s_p9_1[] = { 13, 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, 14, }; static encode_aux_threshmatch _vq_auxt__16c1_s_p9_1 = { _vq_quantthresh__16c1_s_p9_1, _vq_quantmap__16c1_s_p9_1, 15, 15 }; static static_codebook _16c1_s_p9_1 = { 2, 225, _vq_lengthlist__16c1_s_p9_1, 1, -520986624, 1620377600, 4, 0, _vq_quantlist__16c1_s_p9_1, NULL, &_vq_auxt__16c1_s_p9_1, NULL, 0 }; static long _vq_quantlist__16c1_s_p9_2[] = { 10, 9, 11, 8, 12, 7, 13, 6, 14, 5, 15, 4, 16, 3, 17, 2, 18, 1, 19, 0, 20, }; static long _vq_lengthlist__16c1_s_p9_2[] = { 1, 4, 4, 6, 6, 7, 7, 8, 7, 8, 8, 9, 9, 9, 9,10, 10,10, 9,10,10,11,12,12, 8, 8, 8, 8, 9, 9, 9, 9, 10,10,10,10,10,11,11,10,12,11,11,13,11, 7, 7, 8, 8, 8, 8, 9, 9, 9,10,10,10,10, 9,10,10,11,11,12, 11,11, 8, 8, 8, 8, 9, 9,10,10,10,10,11,11,11,11, 11,11,11,12,11,12,12, 8, 8, 9, 9, 9, 9, 9,10,10, 10,10,10,10,11,11,11,11,11,11,12,11, 9, 9, 9, 9, 10,10,10,10,11,10,11,11,11,11,11,11,12,12,12,12, 11, 9, 9, 9, 9,10,10,10,10,11,11,11,11,11,11,11, 11,11,12,12,12,13, 9,10,10, 9,11,10,10,10,10,11, 11,11,11,11,10,11,12,11,12,12,11,12,11,10, 9,10, 10,11,10,11,11,11,11,11,11,11,11,11,12,12,11,12, 12,12,10,10,10,11,10,11,11,11,11,11,11,11,11,11, 11,11,12,13,12,12,11, 9,10,10,11,11,10,11,11,11, 12,11,11,11,11,11,12,12,13,13,12,13,10,10,12,10, 11,11,11,11,11,11,11,11,11,12,12,11,13,12,12,12, 12,13,12,11,11,11,11,11,11,12,11,12,11,11,11,11, 12,12,13,12,11,12,12,11,11,11,11,11,12,11,11,11, 11,12,11,11,12,11,12,13,13,12,12,12,12,11,11,11, 11,11,12,11,11,12,11,12,11,11,11,11,13,12,12,12, 12,13,11,11,11,12,12,11,11,11,12,11,12,12,12,11, 12,13,12,11,11,12,12,11,12,11,11,11,12,12,11,12, 11,11,11,12,12,12,12,13,12,13,12,12,12,12,11,11, 12,11,11,11,11,11,11,12,12,12,13,12,11,13,13,12, 12,11,12,10,11,11,11,11,12,11,12,12,11,12,12,13, 12,12,13,12,12,12,12,12,11,12,12,12,11,12,11,11, 11,12,13,12,13,13,13,13,13,12,13,13,12,12,13,11, 11,11,11,11,12,11,11,12,11, }; static float _vq_quantthresh__16c1_s_p9_2[] = { -9.5, -8.5, -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, 9.5, }; static long _vq_quantmap__16c1_s_p9_2[] = { 19, 17, 15, 13, 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, }; static encode_aux_threshmatch _vq_auxt__16c1_s_p9_2 = { _vq_quantthresh__16c1_s_p9_2, _vq_quantmap__16c1_s_p9_2, 21, 21 }; static static_codebook _16c1_s_p9_2 = { 2, 441, _vq_lengthlist__16c1_s_p9_2, 1, -529268736, 1611661312, 5, 0, _vq_quantlist__16c1_s_p9_2, NULL, &_vq_auxt__16c1_s_p9_2, NULL, 0 }; static long _huff_lengthlist__16c1_s_short[] = { 5, 6,17, 8,12, 9,10,10,12,13, 5, 2,17, 4, 9, 5, 7, 8,11,13,16,16,16,16,16,16,16,16,16,16, 6, 4, 16, 5,10, 5, 7,10,14,16,13, 9,16,11, 8, 7, 8, 9, 13,16, 7, 4,16, 5, 7, 4, 6, 8,11,13, 8, 6,16, 7, 8, 5, 5, 7, 9,13, 9, 8,16, 9, 8, 6, 6, 7, 9,13, 11,11,16,10,10, 7, 7, 7, 9,13,13,13,16,13,13, 9, 9, 9,10,13, }; static static_codebook _huff_book__16c1_s_short = { 2, 100, _huff_lengthlist__16c1_s_short, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _huff_lengthlist__16c2_s_long[] = { 4, 7, 9, 9, 9, 8, 9,10,15,19, 5, 4, 5, 6, 7, 7, 8, 9,14,16, 6, 5, 4, 5, 6, 7, 8,10,12,19, 7, 6, 5, 4, 5, 6, 7, 9,11,18, 8, 7, 6, 5, 5, 5, 7, 9, 10,17, 8, 7, 7, 5, 5, 5, 6, 7,12,18, 8, 8, 8, 7, 7, 5, 5, 7,12,18, 8, 9,10, 9, 9, 7, 6, 7,12,17, 14,18,16,16,15,12,11,10,12,18,15,17,18,18,18,15, 14,14,16,18, }; static static_codebook _huff_book__16c2_s_long = { 2, 100, _huff_lengthlist__16c2_s_long, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _vq_quantlist__16c2_s_p1_0[] = { 1, 0, 2, }; static long _vq_lengthlist__16c2_s_p1_0[] = { 1, 3, 3, 0, 0, 0, 0, 0, 0, 4, 5, 5, 0, 0, 0, 0, 0, 0, 4, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; static float _vq_quantthresh__16c2_s_p1_0[] = { -0.5, 0.5, }; static long _vq_quantmap__16c2_s_p1_0[] = { 1, 0, 2, }; static encode_aux_threshmatch _vq_auxt__16c2_s_p1_0 = { _vq_quantthresh__16c2_s_p1_0, _vq_quantmap__16c2_s_p1_0, 3, 3 }; static static_codebook _16c2_s_p1_0 = { 4, 81, _vq_lengthlist__16c2_s_p1_0, 1, -535822336, 1611661312, 2, 0, _vq_quantlist__16c2_s_p1_0, NULL, &_vq_auxt__16c2_s_p1_0, NULL, 0 }; static long _vq_quantlist__16c2_s_p2_0[] = { 2, 1, 3, 0, 4, }; static long _vq_lengthlist__16c2_s_p2_0[] = { 2, 4, 3, 7, 7, 0, 0, 0, 7, 8, 0, 0, 0, 8, 8, 0, 0, 0, 8, 8, 0, 0, 0, 8, 8, 4, 5, 4, 8, 8, 0, 0, 0, 8, 8, 0, 0, 0, 8, 8, 0, 0, 0, 9, 9, 0, 0, 0, 9, 9, 4, 4, 5, 8, 8, 0, 0, 0, 8, 8, 0, 0, 0, 8, 8, 0, 0, 0, 9, 9, 0, 0, 0, 9, 9, 7, 8, 8,10,10, 0, 0, 0,12,11, 0, 0, 0,11,11, 0, 0, 0,14,13, 0, 0, 0,14,13, 7, 8, 8, 9,10, 0, 0, 0,11,12, 0, 0, 0,11,11, 0, 0, 0,14,14, 0, 0, 0,13,14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 8, 8,11,11, 0, 0, 0, 11,11, 0, 0, 0,12,11, 0, 0, 0,12,12, 0, 0, 0,13, 13, 8, 8, 8,11,11, 0, 0, 0,11,11, 0, 0, 0,11,12, 0, 0, 0,12,13, 0, 0, 0,13,13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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; static float _vq_quantthresh__16c2_s_p2_0[] = { -1.5, -0.5, 0.5, 1.5, }; static long _vq_quantmap__16c2_s_p2_0[] = { 3, 1, 0, 2, 4, }; static encode_aux_threshmatch _vq_auxt__16c2_s_p2_0 = { _vq_quantthresh__16c2_s_p2_0, _vq_quantmap__16c2_s_p2_0, 5, 5 }; static static_codebook _16c2_s_p2_0 = { 4, 625, _vq_lengthlist__16c2_s_p2_0, 1, -533725184, 1611661312, 3, 0, _vq_quantlist__16c2_s_p2_0, NULL, &_vq_auxt__16c2_s_p2_0, NULL, 0 }; static long _vq_quantlist__16c2_s_p3_0[] = { 4, 3, 5, 2, 6, 1, 7, 0, 8, }; static long _vq_lengthlist__16c2_s_p3_0[] = { 1, 3, 3, 6, 6, 7, 7, 8, 8, 0, 0, 0, 6, 6, 7, 7, 9, 9, 0, 0, 0, 6, 6, 7, 7, 9, 9, 0, 0, 0, 7, 7, 8, 8,10,10, 0, 0, 0, 7, 7, 8, 8,10,10, 0, 0, 0, 7, 7, 9, 9,10,10, 0, 0, 0, 7, 7, 9, 9,10,10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; static float _vq_quantthresh__16c2_s_p3_0[] = { -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, }; static long _vq_quantmap__16c2_s_p3_0[] = { 7, 5, 3, 1, 0, 2, 4, 6, 8, }; static encode_aux_threshmatch _vq_auxt__16c2_s_p3_0 = { _vq_quantthresh__16c2_s_p3_0, _vq_quantmap__16c2_s_p3_0, 9, 9 }; static static_codebook _16c2_s_p3_0 = { 2, 81, _vq_lengthlist__16c2_s_p3_0, 1, -531628032, 1611661312, 4, 0, _vq_quantlist__16c2_s_p3_0, NULL, &_vq_auxt__16c2_s_p3_0, NULL, 0 }; static long _vq_quantlist__16c2_s_p4_0[] = { 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15, 0, 16, }; static long _vq_lengthlist__16c2_s_p4_0[] = { 2, 3, 3, 5, 5, 6, 6, 7, 7, 7, 7, 8, 8, 9, 9,10, 10, 0, 0, 0, 6, 6, 7, 7, 8, 8, 8, 8, 9, 9,10,10, 11,11, 0, 0, 0, 6, 6, 7, 7, 8, 8, 8, 8, 9, 9,10, 10,10,11, 0, 0, 0, 6, 6, 8, 8, 8, 8, 9, 9,10,10, 10,11,11,11, 0, 0, 0, 6, 6, 8, 8, 9, 9, 9, 9,10, 10,11,11,11,11, 0, 0, 0, 7, 7, 8, 8, 9, 9, 9, 9, 10,10,11,11,12,12, 0, 0, 0, 7, 7, 8, 8, 9, 9, 9, 9,10,10,11,11,12,12, 0, 0, 0, 7, 7, 8, 8, 9, 9, 10,10,11,11,12,12,12,12, 0, 0, 0, 0, 0, 8, 8, 9, 9,10,10,11,11,12,12,12,12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; static float _vq_quantthresh__16c2_s_p4_0[] = { -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, }; static long _vq_quantmap__16c2_s_p4_0[] = { 15, 13, 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, 14, 16, }; static encode_aux_threshmatch _vq_auxt__16c2_s_p4_0 = { _vq_quantthresh__16c2_s_p4_0, _vq_quantmap__16c2_s_p4_0, 17, 17 }; static static_codebook _16c2_s_p4_0 = { 2, 289, _vq_lengthlist__16c2_s_p4_0, 1, -529530880, 1611661312, 5, 0, _vq_quantlist__16c2_s_p4_0, NULL, &_vq_auxt__16c2_s_p4_0, NULL, 0 }; static long _vq_quantlist__16c2_s_p5_0[] = { 1, 0, 2, }; static long _vq_lengthlist__16c2_s_p5_0[] = { 1, 4, 4, 5, 7, 7, 6, 7, 7, 4, 6, 6,10,10,10,10, 10,10, 4, 7, 6,10,10,10,10,10,10, 5, 9, 9, 9,12, 11,10,11,12, 7,10,10,12,12,12,12,12,12, 7,10,10, 11,12,12,12,12,13, 6,10,10,10,12,12,10,12,12, 7, 10,10,11,13,12,12,12,12, 7,10,10,11,12,12,12,12, 12, }; static float _vq_quantthresh__16c2_s_p5_0[] = { -5.5, 5.5, }; static long _vq_quantmap__16c2_s_p5_0[] = { 1, 0, 2, }; static encode_aux_threshmatch _vq_auxt__16c2_s_p5_0 = { _vq_quantthresh__16c2_s_p5_0, _vq_quantmap__16c2_s_p5_0, 3, 3 }; static static_codebook _16c2_s_p5_0 = { 4, 81, _vq_lengthlist__16c2_s_p5_0, 1, -529137664, 1618345984, 2, 0, _vq_quantlist__16c2_s_p5_0, NULL, &_vq_auxt__16c2_s_p5_0, NULL, 0 }; static long _vq_quantlist__16c2_s_p5_1[] = { 5, 4, 6, 3, 7, 2, 8, 1, 9, 0, 10, }; static long _vq_lengthlist__16c2_s_p5_1[] = { 2, 3, 3, 6, 6, 7, 7, 7, 7, 8, 8,11,11,11, 6, 6, 7, 7, 8, 8, 8, 8,11,11,11, 6, 6, 7, 7, 8, 8, 8, 8,11,11,11, 6, 6, 8, 8, 8, 8, 9, 9,11,11,11, 6, 6, 8, 8, 8, 8, 9, 9,11,11,11, 7, 7, 8, 8, 8, 8, 8, 8,11,11,11, 7, 7, 8, 8, 8, 8, 8, 9,11,11,11, 8, 8, 8, 8, 8, 8, 8, 8,11,11,11,11,11, 8, 8, 8, 8, 8, 8,11,11,11,11,11, 8, 8, 8, 8, 8, 8,11,11, 11,11,11, 7, 7, 8, 8, 8, 8, }; static float _vq_quantthresh__16c2_s_p5_1[] = { -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, }; static long _vq_quantmap__16c2_s_p5_1[] = { 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, }; static encode_aux_threshmatch _vq_auxt__16c2_s_p5_1 = { _vq_quantthresh__16c2_s_p5_1, _vq_quantmap__16c2_s_p5_1, 11, 11 }; static static_codebook _16c2_s_p5_1 = { 2, 121, _vq_lengthlist__16c2_s_p5_1, 1, -531365888, 1611661312, 4, 0, _vq_quantlist__16c2_s_p5_1, NULL, &_vq_auxt__16c2_s_p5_1, NULL, 0 }; static long _vq_quantlist__16c2_s_p6_0[] = { 6, 5, 7, 4, 8, 3, 9, 2, 10, 1, 11, 0, 12, }; static long _vq_lengthlist__16c2_s_p6_0[] = { 1, 4, 4, 7, 6, 8, 8, 9, 9,10,10,11,11, 5, 5, 5, 7, 7, 9, 9, 9, 9,11,11,12,12, 6, 5, 5, 7, 7, 9, 9,10,10,11,11,12,12, 0, 6, 6, 7, 7, 9, 9,10,10, 11,11,12,12, 0, 7, 7, 7, 7, 9, 9,10,10,11,12,12, 12, 0,11,11, 8, 8,10,10,11,11,12,12,13,13, 0,11, 12, 8, 8,10,10,11,11,12,12,13,13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; static float _vq_quantthresh__16c2_s_p6_0[] = { -27.5, -22.5, -17.5, -12.5, -7.5, -2.5, 2.5, 7.5, 12.5, 17.5, 22.5, 27.5, }; static long _vq_quantmap__16c2_s_p6_0[] = { 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, }; static encode_aux_threshmatch _vq_auxt__16c2_s_p6_0 = { _vq_quantthresh__16c2_s_p6_0, _vq_quantmap__16c2_s_p6_0, 13, 13 }; static static_codebook _16c2_s_p6_0 = { 2, 169, _vq_lengthlist__16c2_s_p6_0, 1, -526516224, 1616117760, 4, 0, _vq_quantlist__16c2_s_p6_0, NULL, &_vq_auxt__16c2_s_p6_0, NULL, 0 }; static long _vq_quantlist__16c2_s_p6_1[] = { 2, 1, 3, 0, 4, }; static long _vq_lengthlist__16c2_s_p6_1[] = { 2, 3, 3, 5, 5, 6, 6, 6, 5, 5, 6, 6, 6, 5, 5, 6, 6, 6, 5, 5, 6, 6, 6, 5, 5, }; static float _vq_quantthresh__16c2_s_p6_1[] = { -1.5, -0.5, 0.5, 1.5, }; static long _vq_quantmap__16c2_s_p6_1[] = { 3, 1, 0, 2, 4, }; static encode_aux_threshmatch _vq_auxt__16c2_s_p6_1 = { _vq_quantthresh__16c2_s_p6_1, _vq_quantmap__16c2_s_p6_1, 5, 5 }; static static_codebook _16c2_s_p6_1 = { 2, 25, _vq_lengthlist__16c2_s_p6_1, 1, -533725184, 1611661312, 3, 0, _vq_quantlist__16c2_s_p6_1, NULL, &_vq_auxt__16c2_s_p6_1, NULL, 0 }; static long _vq_quantlist__16c2_s_p7_0[] = { 6, 5, 7, 4, 8, 3, 9, 2, 10, 1, 11, 0, 12, }; static long _vq_lengthlist__16c2_s_p7_0[] = { 1, 4, 4, 7, 7, 8, 8, 9, 9,10,10,11,11, 5, 5, 5, 8, 8, 9, 9,10,10,11,11,12,12, 6, 5, 5, 8, 8, 9, 9,10,10,11,11,12,13,18, 6, 6, 7, 7, 9, 9,10,10, 12,12,13,13,18, 6, 6, 7, 7, 9, 9,10,10,12,12,13, 13,18,11,10, 8, 8,10,10,11,11,12,12,13,13,18,11, 11, 8, 8,10,10,11,11,12,13,13,13,18,18,18,10,11, 11,11,12,12,13,13,14,14,18,18,18,11,11,11,11,12, 12,13,13,14,14,18,18,18,14,14,12,12,12,12,14,14, 15,14,18,18,18,15,15,11,12,12,12,13,13,15,15,18, 18,18,18,18,13,13,13,13,13,14,17,16,18,18,18,18, 18,13,14,13,13,14,13,15,14, }; static float _vq_quantthresh__16c2_s_p7_0[] = { -60.5, -49.5, -38.5, -27.5, -16.5, -5.5, 5.5, 16.5, 27.5, 38.5, 49.5, 60.5, }; static long _vq_quantmap__16c2_s_p7_0[] = { 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, }; static encode_aux_threshmatch _vq_auxt__16c2_s_p7_0 = { _vq_quantthresh__16c2_s_p7_0, _vq_quantmap__16c2_s_p7_0, 13, 13 }; static static_codebook _16c2_s_p7_0 = { 2, 169, _vq_lengthlist__16c2_s_p7_0, 1, -523206656, 1618345984, 4, 0, _vq_quantlist__16c2_s_p7_0, NULL, &_vq_auxt__16c2_s_p7_0, NULL, 0 }; static long _vq_quantlist__16c2_s_p7_1[] = { 5, 4, 6, 3, 7, 2, 8, 1, 9, 0, 10, }; static long _vq_lengthlist__16c2_s_p7_1[] = { 2, 4, 4, 6, 6, 7, 7, 7, 7, 7, 7, 9, 9, 9, 6, 6, 7, 7, 8, 8, 8, 8, 9, 9, 9, 6, 6, 7, 7, 8, 8, 8, 8, 9, 9, 9, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 7, 7, 7, 7, 7, 7, 8, 8, 9, 9, 9, 7, 7, 8, 8, 7, 7, 8, 8, 9, 9, 9, 9, 9, 7, 7, 7, 7, 8, 8, 9, 9, 9, 9, 9, 8, 8, 7, 7, 8, 8, 9, 9, 9, 9, 9, 7, 7, 7, 7, 8, 8, }; static float _vq_quantthresh__16c2_s_p7_1[] = { -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, }; static long _vq_quantmap__16c2_s_p7_1[] = { 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, }; static encode_aux_threshmatch _vq_auxt__16c2_s_p7_1 = { _vq_quantthresh__16c2_s_p7_1, _vq_quantmap__16c2_s_p7_1, 11, 11 }; static static_codebook _16c2_s_p7_1 = { 2, 121, _vq_lengthlist__16c2_s_p7_1, 1, -531365888, 1611661312, 4, 0, _vq_quantlist__16c2_s_p7_1, NULL, &_vq_auxt__16c2_s_p7_1, NULL, 0 }; static long _vq_quantlist__16c2_s_p8_0[] = { 7, 6, 8, 5, 9, 4, 10, 3, 11, 2, 12, 1, 13, 0, 14, }; static long _vq_lengthlist__16c2_s_p8_0[] = { 1, 4, 4, 7, 6, 7, 7, 6, 6, 8, 8, 9, 9,10,10, 6, 6, 6, 8, 8, 9, 8, 8, 8, 9, 9,11,10,11,11, 7, 6, 6, 8, 8, 9, 8, 7, 7, 9, 9,10,10,12,11,14, 8, 8, 8, 9, 9, 9, 9, 9,10, 9,10,10,11,13,14, 8, 8, 8, 8, 9, 9, 8, 8, 9, 9,10,10,11,12,14,13,11, 9, 9, 9, 9, 9, 9, 9,10,11,10,13,12,14,11,13, 8, 9, 9, 9, 9, 9,10,10,11,10,13,12,14,14,14, 8, 9, 9, 9, 11,11,11,11,11,12,13,13,14,14,14, 9, 8, 9, 9,10, 10,12,10,11,12,12,14,14,14,14,11,12,10,10,12,12, 12,12,13,14,12,12,14,14,14,12,12, 9,10,11,11,12, 14,12,14,14,14,14,14,14,14,14,11,11,12,11,12,14, 14,14,14,14,14,14,14,14,14,12,11,11,11,11,14,14, 14,14,14,14,14,14,14,14,14,14,13,12,14,14,14,14, 14,14,14,14,14,14,14,14,14,12,12,12,13,14,14,13, 13, }; static float _vq_quantthresh__16c2_s_p8_0[] = { -136.5, -115.5, -94.5, -73.5, -52.5, -31.5, -10.5, 10.5, 31.5, 52.5, 73.5, 94.5, 115.5, 136.5, }; static long _vq_quantmap__16c2_s_p8_0[] = { 13, 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, 14, }; static encode_aux_threshmatch _vq_auxt__16c2_s_p8_0 = { _vq_quantthresh__16c2_s_p8_0, _vq_quantmap__16c2_s_p8_0, 15, 15 }; static static_codebook _16c2_s_p8_0 = { 2, 225, _vq_lengthlist__16c2_s_p8_0, 1, -520986624, 1620377600, 4, 0, _vq_quantlist__16c2_s_p8_0, NULL, &_vq_auxt__16c2_s_p8_0, NULL, 0 }; static long _vq_quantlist__16c2_s_p8_1[] = { 10, 9, 11, 8, 12, 7, 13, 6, 14, 5, 15, 4, 16, 3, 17, 2, 18, 1, 19, 0, 20, }; static long _vq_lengthlist__16c2_s_p8_1[] = { 2, 4, 4, 6, 6, 7, 7, 7, 7, 8, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,11,12,11, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9,10, 9, 9,11,11,10, 7, 7, 8, 8, 8, 8, 9, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,11, 11,11, 8, 7, 8, 8, 9, 9, 9, 9, 9, 9,10,10, 9,10, 10, 9,10,10,11,11,12, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9,10, 9,10,10,10,10,11,11,11, 8, 8, 9, 9, 9, 9, 9, 9, 9,10,10,10,10,10,10,10,10,10,11,11, 11, 8, 8, 9, 8, 9, 9, 9, 9,10, 9, 9, 9,10,10,10, 10, 9,10,11,11,11, 9, 9, 9, 9,10, 9, 9, 9,10,10, 9,10, 9,10,10,10,10,10,11,12,11,11,11, 9, 9, 9, 9, 9,10,10, 9,10,10,10,10,10,10,10,10,12,11,13, 13,11, 9, 9, 9, 9,10,10, 9,10,10,10,10,11,10,10, 10,10,11,12,11,12,11, 9, 9, 9,10,10, 9,10,10,10, 10,10,10,10,10,10,10,11,11,11,12,11, 9,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,11,12,12,12, 11,11,11,10, 9,10,10,10,10,10,10,10,10,11,10,10, 10,11,11,11,11,11,11,11,10,10,10,11,10,10,10,10, 10,10,10,10,10,10,11,11,11,11,12,12,11,10,10,10, 10,10,10,10,10,11,10,10,10,11,10,12,11,11,12,11, 11,11,10,10,10,10,10,11,10,10,10,10,10,11,10,10, 11,11,11,12,11,12,11,11,12,10,10,10,10,10,10,10, 11,10,10,11,10,12,11,11,11,12,11,11,11,11,10,10, 10,10,10,10,10,11,11,11,10,11,12,11,11,11,12,11, 12,11,12,10,11,10,10,10,10,11,10,10,10,10,10,10, 12,11,11,11,11,11,12,12,10,10,10,10,10,11,10,10, 11,10,11,11,11,11,11,11,11,11,11,11,11,11,12,11, 10,11,10,10,10,10,10,10,10, }; static float _vq_quantthresh__16c2_s_p8_1[] = { -9.5, -8.5, -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, 9.5, }; static long _vq_quantmap__16c2_s_p8_1[] = { 19, 17, 15, 13, 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, }; static encode_aux_threshmatch _vq_auxt__16c2_s_p8_1 = { _vq_quantthresh__16c2_s_p8_1, _vq_quantmap__16c2_s_p8_1, 21, 21 }; static static_codebook _16c2_s_p8_1 = { 2, 441, _vq_lengthlist__16c2_s_p8_1, 1, -529268736, 1611661312, 5, 0, _vq_quantlist__16c2_s_p8_1, NULL, &_vq_auxt__16c2_s_p8_1, NULL, 0 }; static long _vq_quantlist__16c2_s_p9_0[] = { 6, 5, 7, 4, 8, 3, 9, 2, 10, 1, 11, 0, 12, }; static long _vq_lengthlist__16c2_s_p9_0[] = { 1, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, }; static float _vq_quantthresh__16c2_s_p9_0[] = { -5120.5, -4189.5, -3258.5, -2327.5, -1396.5, -465.5, 465.5, 1396.5, 2327.5, 3258.5, 4189.5, 5120.5, }; static long _vq_quantmap__16c2_s_p9_0[] = { 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, }; static encode_aux_threshmatch _vq_auxt__16c2_s_p9_0 = { _vq_quantthresh__16c2_s_p9_0, _vq_quantmap__16c2_s_p9_0, 13, 13 }; static static_codebook _16c2_s_p9_0 = { 2, 169, _vq_lengthlist__16c2_s_p9_0, 1, -510275072, 1631393792, 4, 0, _vq_quantlist__16c2_s_p9_0, NULL, &_vq_auxt__16c2_s_p9_0, NULL, 0 }; static long _vq_quantlist__16c2_s_p9_1[] = { 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15, 0, 16, }; static long _vq_lengthlist__16c2_s_p9_1[] = { 1, 5, 5, 9, 8, 7, 7, 7, 6,10,11,11,11,11,11,11, 11, 8, 7, 6, 8, 8,10, 9,10,10,10, 9,11,10,10,10, 10,10, 8, 6, 6, 8, 8, 9, 8, 9, 8, 9,10,10,10,10, 10,10,10,10, 8,10, 9, 9, 9, 9,10,10,10,10,10,10, 10,10,10,10,10, 8, 9, 9, 9,10,10, 9,10,10,10,10, 10,10,10,10,10,10,10,10, 9, 8, 9, 9,10,10,10,10, 10,10,10,10,10,10,10,10, 9, 8, 8, 9, 9,10,10,10, 10,10,10,10,10,10,10,10,10,10, 9,10, 9, 9,10,10, 10,10,10,10,10,10,10,10,10,10,10, 9, 8, 9, 9,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 9, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 8,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10, 9,10, 9,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10, 9,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10, }; static float _vq_quantthresh__16c2_s_p9_1[] = { -367.5, -318.5, -269.5, -220.5, -171.5, -122.5, -73.5, -24.5, 24.5, 73.5, 122.5, 171.5, 220.5, 269.5, 318.5, 367.5, }; static long _vq_quantmap__16c2_s_p9_1[] = { 15, 13, 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, 14, 16, }; static encode_aux_threshmatch _vq_auxt__16c2_s_p9_1 = { _vq_quantthresh__16c2_s_p9_1, _vq_quantmap__16c2_s_p9_1, 17, 17 }; static static_codebook _16c2_s_p9_1 = { 2, 289, _vq_lengthlist__16c2_s_p9_1, 1, -518488064, 1622704128, 5, 0, _vq_quantlist__16c2_s_p9_1, NULL, &_vq_auxt__16c2_s_p9_1, NULL, 0 }; static long _vq_quantlist__16c2_s_p9_2[] = { 13, 12, 14, 11, 15, 10, 16, 9, 17, 8, 18, 7, 19, 6, 20, 5, 21, 4, 22, 3, 23, 2, 24, 1, 25, 0, 26, }; static long _vq_lengthlist__16c2_s_p9_2[] = { 1, 4, 4, 5, 5, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 7, 8, 7, 7, 4, 4, }; static float _vq_quantthresh__16c2_s_p9_2[] = { -12.5, -11.5, -10.5, -9.5, -8.5, -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, 9.5, 10.5, 11.5, 12.5, }; static long _vq_quantmap__16c2_s_p9_2[] = { 25, 23, 21, 19, 17, 15, 13, 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, }; static encode_aux_threshmatch _vq_auxt__16c2_s_p9_2 = { _vq_quantthresh__16c2_s_p9_2, _vq_quantmap__16c2_s_p9_2, 27, 27 }; static static_codebook _16c2_s_p9_2 = { 1, 27, _vq_lengthlist__16c2_s_p9_2, 1, -528875520, 1611661312, 5, 0, _vq_quantlist__16c2_s_p9_2, NULL, &_vq_auxt__16c2_s_p9_2, NULL, 0 }; static long _huff_lengthlist__16c2_s_short[] = { 7,10,11,11,11,14,15,15,17,14, 8, 6, 7, 7, 8, 9, 11,11,14,17, 9, 6, 6, 6, 7, 7,10,11,15,16, 9, 6, 6, 4, 4, 5, 8, 9,12,16,10, 6, 6, 4, 4, 4, 6, 9, 13,16,10, 7, 6, 5, 4, 3, 5, 7,13,16,11, 9, 8, 7, 6, 5, 5, 6,12,15,10,10,10, 9, 7, 6, 6, 7,11,15, 13,13,13,13,11,10,10, 9,12,16,16,16,16,14,16,15, 15,12,14,14, }; static static_codebook _huff_book__16c2_s_short = { 2, 100, _huff_lengthlist__16c2_s_short, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _huff_lengthlist__44c0_s_long[] = { 3, 4,18, 8, 8, 8, 9,10,11,13, 3, 2,18, 5, 5, 6, 8,11,12,12,18,18,18,18,18,18,18,18,18,18, 8, 5, 18, 7, 8, 8,10,14,14,16, 8, 5,18, 7, 5, 6, 7,11, 12,13, 8, 6,18, 7, 5, 6, 7,10,12,14, 8, 7,18,10, 7, 6, 6, 8,11,14, 9,10,18,13, 9, 7, 6, 8,10,13, 11,13,18,16,13,10, 9, 8, 8,11,12,17,18,17,18,14, 11, 9,10,14, }; static static_codebook _huff_book__44c0_s_long = { 2, 100, _huff_lengthlist__44c0_s_long, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _vq_quantlist__44c0_s_p1_0[] = { 1, 0, 2, }; static long _vq_lengthlist__44c0_s_p1_0[] = { 1, 5, 5, 0, 0, 0, 0, 0, 0, 5, 7, 7, 0, 0, 0, 0, 0, 0, 5, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 8, 7, 0, 0, 0, 0, 0, 0, 7, 9, 9, 0, 0, 0, 0, 0, 0, 7, 8, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 7, 8, 0, 0, 0, 0, 0, 0, 7, 9, 8, 0, 0, 0, 0, 0, 0, 7, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; static float _vq_quantthresh__44c0_s_p1_0[] = { -0.5, 0.5, }; static long _vq_quantmap__44c0_s_p1_0[] = { 1, 0, 2, }; static encode_aux_threshmatch _vq_auxt__44c0_s_p1_0 = { _vq_quantthresh__44c0_s_p1_0, _vq_quantmap__44c0_s_p1_0, 3, 3 }; static static_codebook _44c0_s_p1_0 = { 8, 6561, _vq_lengthlist__44c0_s_p1_0, 1, -535822336, 1611661312, 2, 0, _vq_quantlist__44c0_s_p1_0, NULL, &_vq_auxt__44c0_s_p1_0, NULL, 0 }; static long _vq_quantlist__44c0_s_p2_0[] = { 2, 1, 3, 0, 4, }; static long _vq_lengthlist__44c0_s_p2_0[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; static float _vq_quantthresh__44c0_s_p2_0[] = { -1.5, -0.5, 0.5, 1.5, }; static long _vq_quantmap__44c0_s_p2_0[] = { 3, 1, 0, 2, 4, }; static encode_aux_threshmatch _vq_auxt__44c0_s_p2_0 = { _vq_quantthresh__44c0_s_p2_0, _vq_quantmap__44c0_s_p2_0, 5, 5 }; static static_codebook _44c0_s_p2_0 = { 4, 625, _vq_lengthlist__44c0_s_p2_0, 1, -533725184, 1611661312, 3, 0, _vq_quantlist__44c0_s_p2_0, N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= { 3, 1, 0, 2, 4, }; static encode_aux_threshmatch _vq_auxt__44c0_s_p3_0 = { _vq_quantthresh__44c0_s_p3_0, _vq_quantmap__44c0_s_p3_0, 5, 5 }; static static_codebook _44c0_s_p3_0 = { 4, 625, _vq_lengthlist__44c0_s_p3_0, 1, -533725184, 1611661312, 3, 0, _vq_quantlist__44c0_s_p3_0, NULL, &_vq_auxt__44c0_s_p3_0, NULL, 0 }; static long _vq_quantlist__44c0_s_p4_0[] = { 4, 3, 5, 2, 6, 1, 7, 0, 8, }; static long _vq_lengthlist__44c0_s_p4_0[] = { 1, 3, 2, 8, 7, 0, 0, 0, 0, 0, 0, 0, 6, 6, 0, 0, 0, 0, 0, 0, 0, 6, 6, 0, 0, 0, 0, 0, 0, 0, 7, 7, 0, 0, 0, 0, 0, 0, 0, 7, 7, 0, 0, 0, 0, 0, 0, 0, 8, 8, 0, 0, 0, 0, 0, 0, 0, 8, 8, 0, 0, 0, 0, 0, 0, 0, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; static float _vq_quantthresh__44c0_s_p4_0[] = { -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, }; static long _vq_quantmap__44c0_s_p4_0[] = { 7, 5, 3, 1, 0, 2, 4, 6, 8, }; static encode_aux_threshmatch _vq_auxt__44c0_s_p4_0 = { _vq_quantthresh__44c0_s_p4_0, _vq_quantmap__44c0_s_p4_0, 9, 9 }; static static_codebook _44c0_s_p4_0 = { 2, 81, _vq_lengthlist__44c0_s_p4_0, 1, -531628032, 1611661312, 4, 0, _vq_quantlist__44c0_s_p4_0, NULL, &_vq_auxt__44c0_s_p4_0, NULL, 0 }; static long _vq_quantlist__44c0_s_p5_0[] = { 4, 3, 5, 2, 6, 1, 7, 0, 8, }; static long _vq_lengthlist__44c0_s_p5_0[] = { 1, 3, 3, 6, 6, 6, 6, 8, 8, 0, 0, 0, 6, 7, 7, 7, 9, 9, 0, 0, 0, 7, 7, 7, 7, 9, 9, 0, 0, 0, 7, 7, 8, 8, 9, 9, 0, 0, 0, 7, 7, 8, 8,10, 9, 0, 0, 0, 8, 8, 8, 8,10,10, 0, 0, 0, 8, 8, 8, 8,10,10, 0, 0, 0,10, 9, 9, 9,11,11, 0, 0, 0, 0, 0, 9, 9,11, 11, }; static float _vq_quantthresh__44c0_s_p5_0[] = { -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, }; static long _vq_quantmap__44c0_s_p5_0[] = { 7, 5, 3, 1, 0, 2, 4, 6, 8, }; static encode_aux_threshmatch _vq_auxt__44c0_s_p5_0 = { _vq_quantthresh__44c0_s_p5_0, _vq_quantmap__44c0_s_p5_0, 9, 9 }; static static_codebook _44c0_s_p5_0 = { 2, 81, _vq_lengthlist__44c0_s_p5_0, 1, -531628032, 1611661312, 4, 0, _vq_quantlist__44c0_s_p5_0, NULL, &_vq_auxt__44c0_s_p5_0, NULL, 0 }; static long _vq_quantlist__44c0_s_p6_0[] = { 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15, 0, 16, }; static long _vq_lengthlist__44c0_s_p6_0[] = { 1, 3, 4, 6, 6, 7, 8, 8, 8, 8, 8, 9, 9,10,10,11, 11, 0, 0, 0, 7, 7, 8, 8, 9, 9, 9, 9,10,10,10,10, 11,11, 0, 0, 0, 7, 7, 8, 8, 9, 9, 9, 9,10,10,10, 11,11,11, 0, 0, 0, 7, 7, 8, 8, 9, 9, 9, 9,10,10, 11,11,12,12, 0, 0, 0, 7, 7, 8, 8, 9, 9, 9, 9,10, 10,11,11,12,12, 0, 0, 0, 8, 8, 9, 9, 9,10,10,10, 10,11,11,11,12,12, 0, 0, 0, 8, 8, 9, 9, 9, 9,10, 10,11,11,11,11,12,12, 0, 0, 0, 9, 9, 9, 9,10,10, 10,10,11,11,12,12,12,13, 0, 0, 0, 0, 0, 9, 9,10, 10,10,10,11,11,12,12,12,12, 0, 0, 0, 0, 0, 9, 9, 9,10,10,10,11,11,12,12,13,13, 0, 0, 0, 0, 0, 9, 9, 9, 9,10,10,11,11,12,12,13,13, 0, 0, 0, 0, 0, 10, 9,10,10,11,11,11,12,12,13,13,13, 0, 0, 0, 0, 0, 0, 0,10,10,11,11,12,12,12,12,13,13, 0, 0, 0, 0, 0, 0, 0,11,11,11,11,12,12,13,13,13,13, 0, 0, 0, 0, 0, 0, 0,11,11,11,11,12,12,13,12,13,13, 0, 0, 0, 0, 0, 0, 0,11,11,12,12,12,12,13,13,13,14, 0, 0, 0, 0, 0, 0, 0, 0, 0,12,12,12,12,13,13,13, 14, }; static float _vq_quantthresh__44c0_s_p6_0[] = { -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, }; static long _vq_quantmap__44c0_s_p6_0[] = { 15, 13, 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, 14, 16, }; static encode_aux_threshmatch _vq_auxt__44c0_s_p6_0 = { _vq_quantthresh__44c0_s_p6_0, _vq_quantmap__44c0_s_p6_0, 17, 17 }; static static_codebook _44c0_s_p6_0 = { 2, 289, _vq_lengthlist__44c0_s_p6_0, 1, -529530880, 1611661312, 5, 0, _vq_quantlist__44c0_s_p6_0, NULL, &_vq_auxt__44c0_s_p6_0, NULL, 0 }; static long _vq_quantlist__44c0_s_p7_0[] = { 1, 0, 2, }; static long _vq_lengthlist__44c0_s_p7_0[] = { 1, 4, 4, 6, 6, 6, 7, 6, 6, 4, 7, 7,10, 9, 9,10, 9, 9, 4, 7, 7,10, 9, 9,11, 9, 9, 7,10,10,10,11, 10,11,10,10, 6, 9, 9,11,10,10,11, 9,10, 6, 9, 9, 11,10,10,11, 9, 9, 7,10,10,11,11,11,12,11,11, 7, 9, 9,10, 9, 9,11,11,10, 7, 9, 9,10,10,10,12,10, 11, }; static float _vq_quantthresh__44c0_s_p7_0[] = { -5.5, 5.5, }; static long _vq_quantmap__44c0_s_p7_0[] = { 1, 0, 2, }; static encode_aux_threshmatch _vq_auxt__44c0_s_p7_0 = { _vq_quantthresh__44c0_s_p7_0, _vq_quantmap__44c0_s_p7_0, 3, 3 }; static static_codebook _44c0_s_p7_0 = { 4, 81, _vq_lengthlist__44c0_s_p7_0, 1, -529137664, 1618345984, 2, 0, _vq_quantlist__44c0_s_p7_0, NULL, &_vq_auxt__44c0_s_p7_0, NULL, 0 }; static long _vq_quantlist__44c0_s_p7_1[] = { 5, 4, 6, 3, 7, 2, 8, 1, 9, 0, 10, }; static long _vq_lengthlist__44c0_s_p7_1[] = { 2, 3, 3, 6, 6, 7, 7, 7, 7, 7, 7,10, 9, 9, 6, 6, 7, 7, 8, 8, 8, 8, 9, 9, 9, 6, 6, 7, 7, 8, 8, 8, 8,10, 9,10, 7, 7, 8, 8, 8, 8, 8, 8,10,10,10, 7, 7, 7, 7, 8, 8, 8, 8,10,10,10, 7, 7, 8, 8, 8, 8, 8, 8,10,10,10, 8, 7, 8, 8, 8, 8, 8, 8,10,10,10, 8, 8, 8, 8, 8, 8, 8, 8,10,10,10,10,10, 8, 8, 8, 8, 8, 8,10,10,10,10,10, 9, 9, 8, 8, 9, 8,10,10, 10,10,10, 8, 8, 8, 8, 8, 8, }; static float _vq_quantthresh__44c0_s_p7_1[] = { -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, }; static long _vq_quantmap__44c0_s_p7_1[] = { 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, }; static encode_aux_threshmatch _vq_auxt__44c0_s_p7_1 = { _vq_quantthresh__44c0_s_p7_1, _vq_quantmap__44c0_s_p7_1, 11, 11 }; static static_codebook _44c0_s_p7_1 = { 2, 121, _vq_lengthlist__44c0_s_p7_1, 1, -531365888, 1611661312, 4, 0, _vq_quantlist__44c0_s_p7_1, NULL, &_vq_auxt__44c0_s_p7_1, NULL, 0 }; static long _vq_quantlist__44c0_s_p8_0[] = { 6, 5, 7, 4, 8, 3, 9, 2, 10, 1, 11, 0, 12, }; static long _vq_lengthlist__44c0_s_p8_0[] = { 1, 4, 4, 6, 6, 7, 7, 7, 7, 8, 8,10, 9, 7, 5, 5, 7, 7, 8, 8, 8, 8, 9, 9,10,10, 7, 6, 6, 7, 7, 8, 8, 8, 8, 9, 9,10,10, 0, 8, 8, 8, 8, 9, 8, 9, 9, 10,10,11,11, 0, 8, 8, 8, 8, 9, 9, 9, 9,10,10,11, 11, 0,12,12, 9, 8, 9, 9,10,10,10,11,12,11, 0,13, 13, 9, 8, 9, 9,10,10,10,11,11,11, 0, 0, 0,10,10, 9, 9,10,10,11,11,12,12, 0, 0, 0,10,10, 9, 8,10, 10,11,11,12,12, 0, 0, 0,13,13,10,10,11,11,12,12, 12,12, 0, 0, 0,15,15,10,10,11, 9,12,12,13,13, 0, 0, 0, 0, 0,12,11,11,11,12,12,13,13, 0, 0, 0, 0, 0,12,12,11,11,12,11,14,13, }; static float _vq_quantthresh__44c0_s_p8_0[] = { -27.5, -22.5, -17.5, -12.5, -7.5, -2.5, 2.5, 7.5, 12.5, 17.5, 22.5, 27.5, }; static long _vq_quantmap__44c0_s_p8_0[] = { 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, }; static encode_aux_threshmatch _vq_auxt__44c0_s_p8_0 = { _vq_quantthresh__44c0_s_p8_0, _vq_quantmap__44c0_s_p8_0, 13, 13 }; static static_codebook _44c0_s_p8_0 = { 2, 169, _vq_lengthlist__44c0_s_p8_0, 1, -526516224, 1616117760, 4, 0, _vq_quantlist__44c0_s_p8_0, NULL, &_vq_auxt__44c0_s_p8_0, NULL, 0 }; static long _vq_quantlist__44c0_s_p8_1[] = { 2, 1, 3, 0, 4, }; static long _vq_lengthlist__44c0_s_p8_1[] = { 2, 3, 4, 4, 4, 6, 6, 6, 5, 5, 6, 6, 6, 5, 5, 6, 6, 6, 5, 5, 6, 6, 6, 5, 5, }; static float _vq_quantthresh__44c0_s_p8_1[] = { -1.5, -0.5, 0.5, 1.5, }; static long _vq_quantmap__44c0_s_p8_1[] = { 3, 1, 0, 2, 4, }; static encode_aux_threshmatch _vq_auxt__44c0_s_p8_1 = { _vq_quantthresh__44c0_s_p8_1, _vq_quantmap__44c0_s_p8_1, 5, 5 }; static static_codebook _44c0_s_p8_1 = { 2, 25, _vq_lengthlist__44c0_s_p8_1, 1, -533725184, 1611661312, 3, 0, _vq_quantlist__44c0_s_p8_1, NULL, &_vq_auxt__44c0_s_p8_1, NULL, 0 }; static long _vq_quantlist__44c0_s_p9_0[] = { 2, 1, 3, 0, 4, }; static long _vq_lengthlist__44c0_s_p9_0[] = { 1, 7, 7,11,11,10,11,11,11,11, 9,11,11,11,11,11, 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, 11,11,11,11,11,11,11,11,11,11,11,11,11, 8,11,11, 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, 11,11,11,11,11,11,11,11,11,11, 8,11,11,11,11,11, 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, 11,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10, }; static float _vq_quantthresh__44c0_s_p9_0[] = { -331.5, -110.5, 110.5, 331.5, }; static long _vq_quantmap__44c0_s_p9_0[] = { 3, 1, 0, 2, 4, }; static encode_aux_threshmatch _vq_auxt__44c0_s_p9_0 = { _vq_quantthresh__44c0_s_p9_0, _vq_quantmap__44c0_s_p9_0, 5, 5 }; static static_codebook _44c0_s_p9_0 = { 4, 625, _vq_lengthlist__44c0_s_p9_0, 1, -518283264, 1627103232, 3, 0, _vq_quantlist__44c0_s_p9_0, NULL, &_vq_auxt__44c0_s_p9_0, NULL, 0 }; static long _vq_quantlist__44c0_s_p9_1[] = { 6, 5, 7, 4, 8, 3, 9, 2, 10, 1, 11, 0, 12, }; static long _vq_lengthlist__44c0_s_p9_1[] = { 1, 4, 4, 6, 6, 7, 7, 9, 9,12,12,13,12, 6, 5, 5, 7, 7, 8, 8,10,10,12,11,14,13, 6, 5, 5, 7, 7, 7, 8, 9, 9,11,12,13,12,15, 7, 7, 7, 7, 9, 9,11,11, 14,13,14,13,15, 7, 7, 8, 8, 8, 9,10,10,11,11,12, 11,15,10,10, 8, 8,10,10,12,11,13,15,14,14,15,11, 10, 8, 8,11,11,11,11,13,13,12,13,15,15,15,10,10, 10,10,12,13,13,13,15,14,15,15,15,10,10,10,11,13, 14,13,14,14,14,15,15,15,15,15,11,12,11,13,14,14, 15,15,15,15,15,14,15,11,11,13,12,14,13,15,15,15, 15,15,15,15,13,12,13,12,15,15,15,15,15,15,15,15, 15,12,13,12,12,15,14,15,15, }; static float _vq_quantthresh__44c0_s_p9_1[] = { -93.5, -76.5, -59.5, -42.5, -25.5, -8.5, 8.5, 25.5, 42.5, 59.5, 76.5, 93.5, }; static long _vq_quantmap__44c0_s_p9_1[] = { 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, }; static encode_aux_threshmatch _vq_auxt__44c0_s_p9_1 = { _vq_quantthresh__44c0_s_p9_1, _vq_quantmap__44c0_s_p9_1, 13, 13 }; static static_codebook _44c0_s_p9_1 = { 2, 169, _vq_lengthlist__44c0_s_p9_1, 1, -522616832, 1620115456, 4, 0, _vq_quantlist__44c0_s_p9_1, NULL, &_vq_auxt__44c0_s_p9_1, NULL, 0 }; static long _vq_quantlist__44c0_s_p9_2[] = { 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15, 0, 16, }; static long _vq_lengthlist__44c0_s_p9_2[] = { 2, 4, 4, 6, 6, 7, 7, 7, 8, 8, 8, 8, 8, 8, 9, 8, 9,10,10,10, 7, 7, 8, 7, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9,10,10,10, 7, 7, 7, 7, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9,10,10,10, 7, 7, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9,10,10,10, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9,11,10,10, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,10,10,10, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9,10, 9, 9,10,10,11, 9, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,10,10,10,10,11, 9, 8, 9, 9, 9, 9, 9, 9, 9, 9,10,10,11,11,10,11,11, 9, 9, 9, 9, 9, 9,10, 9, 9, 9,10, 9,10,10,10,11,11, 9, 9, 9, 9, 9, 9, 9,10, 9, 9, 9,10,11,10,10,10,11, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,10,10,10,10, 11,11,10, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,10,10,10, 11,11,10,10, 9,10,10,10, 9,10, 9, 9, 9, 9,10,10, 11,10,11,11,11, 9,10, 9, 9, 9, 9, 9, 9, 9,10,10, 11,10,11,11,10,10,10,10, 9, 9, 9, 9, 9, 9, 9, 9, 10,10,10,10,11,11,10,11,11, 9, 9, 9, 9, 9, 9, 9, 9, }; static float _vq_quantthresh__44c0_s_p9_2[] = { -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, }; static long _vq_quantmap__44c0_s_p9_2[] = { 15, 13, 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, 14, 16, }; static encode_aux_threshmatch _vq_auxt__44c0_s_p9_2 = { _vq_quantthresh__44c0_s_p9_2, _vq_quantmap__44c0_s_p9_2, 17, 17 }; static static_codebook _44c0_s_p9_2 = { 2, 289, _vq_lengthlist__44c0_s_p9_2, 1, -529530880, 1611661312, 5, 0, _vq_quantlist__44c0_s_p9_2, NULL, &_vq_auxt__44c0_s_p9_2, NULL, 0 }; static long _huff_lengthlist__44c0_s_short[] = { 6, 8,17,12,12,12,14,15,17,16, 5, 1,16, 5, 6, 6, 9,12,14,13,16,16,16,16,16,16,16,16,16,16, 9, 4, 16, 6, 9, 7,10,14,14,14, 8, 5,16, 8, 6, 7,10,13, 15,16, 9, 6,16, 7, 7, 7,10,12,15,14,10, 8,16, 9, 9, 9,10,12,15,14,13, 7,16, 8, 7, 7,10,12,14,13, 15, 6,16, 7, 5, 5, 7, 9,13,16,14, 7,16, 8, 6, 6, 8, 9,11,14, }; static static_codebook _huff_book__44c0_s_short = { 2, 100, _huff_lengthlist__44c0_s_short, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _huff_lengthlist__44c0_sm_long[] = { 3, 4,10, 8,11, 9,10,10,11,13, 3, 2,10, 5, 8, 6, 8,11,12,13,10, 8, 7,10, 7, 8, 9,11,12,13, 8, 5, 12, 6, 9, 7,10,13,14,16,11, 7, 7, 9, 5, 6, 7,10, 13,13, 8, 6, 7, 7, 5, 5, 6, 9,12,13, 9, 8, 8, 8, 7, 6, 6, 8,11,14,10,10,10,11, 9, 8, 7, 8,10,13, 11,14,12,15,13,11, 9, 8, 9,12,12,18,15,18,17,15, 12,10,10,14, }; static static_codebook _huff_book__44c0_sm_long = { 2, 100, _huff_lengthlist__44c0_sm_long, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _vq_quantlist__44c0_sm_p1_0[] = { 1, 0, 2, }; static long _vq_lengthlist__44c0_sm_p1_0[] = { 1, 5, 5, 0, 0, 0, 0, 0, 0, 5, 7, 7, 0, 0, 0, 0, 0, 0, 5, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 8, 7, 0, 0, 0, 0, 0, 0, 7, 9, 9, 0, 0, 0, 0, 0, 0, 7, 8, 9, 0, 0, 0, 0, 0, 0, 0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{ _vq_quantthresh__44c0_sm_p1_0, _vq_quantmap__44c0_sm_p1_0, 3, 3 }; static static_codebook _44c0_sm_p1_0 = { 8, 6561, _vq_lengthlist__44c0_sm_p1_0, 1, -535822336, 1611661312, 2, 0, _vq_quantlist__44c0_sm_p1_0, NULL, &_vq_auxt__44c0_sm_p1_0, NULL, 0 }; static long _vq_quantlist__44c0_sm_p2_0[] = { 2, 1, 3, 0, 4, }; static long _vq_lengthlist__44c0_sm_p2_0[] = { 1, 5, 5, 0, 0, 0, 5, 5, 0, 0, 0, 6, 6, 0, 0, 0, 8, 8, 0, 0, 0, 0, 0, 0, 0, 5, 7, 6, 0, 0, 0, 8, 8, 0, 0, 0, 8, 8, 0, 0, 0,10,10, 0, 0, 0, 0, 0, 0, 0, 5, 6, 7, 0, 0, 0, 8, 8, 0, 0, 0, 8, 8, 0, 0, 0,10,10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 8, 8, 0, 0, 0, 8, 8, 0, 0, 0, 8, 8, 0, 0, 0,10, 9, 0, 0, 0, 0, 0, 0, 0, 6, 8, 8, 0, 0, 0, 8, 8, 0, 0, 0, 8, 8, 0, 0, 0, 9, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; static float _vq_quantthresh__44c0_sm_p2_0[] = { -1.5, -0.5, 0.5, 1.5, }; static long _vq_quantmap__44c0_sm_p2_0[] = { 3, 1, 0, 2, 4, }; static encode_aux_threshmatch _vq_auxt__44c0_sm_p2_0 = { _vq_quantthresh__44c0_sm_p2_0, _vq_quantmap__44c0_sm_p2_0, 5, 5 }; static static_codebook _44c0_sm_p2_0 = { 4, 625, _vq_lengthlist__44c0_sm_p2_0, 1, -533725184, 1611661312, 3, 0, _vq_quantlist__44c0_sm_p2_0, NULL, &_vq_auxt__44c0_sm_p2_0, NULL, 0 }; static long _vq_quantlist__44c0_sm_p3_0[] = { 2, 1, 3, 0, 4, }; static long _vq_lengthlist__44c0_sm_p3_0[] = { 2, 3, 4, 6, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 5, 4, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 6, 6, 8, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 6, 6, 8, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; static float _vq_quantthresh__44c0_sm_p3_0[] = { -1.5, -0.5, 0.5, 1.5, }; static long _vq_quantmap__44c0_sm_p3_0[] = { 3, 1, 0, 2, 4, }; static encode_aux_threshmatch _vq_auxt__44c0_sm_p3_0 = { _vq_quantthresh__44c0_sm_p3_0, _vq_quantmap__44c0_sm_p3_0, 5, 5 }; static static_codebook _44c0_sm_p3_0 = { 4, 625, _vq_lengthlist__44c0_sm_p3_0, 1, -533725184, 1611661312, 3, 0, _vq_quantlist__44c0_sm_p3_0, NULL, &_vq_auxt__44c0_sm_p3_0, NULL, 0 }; static long _vq_quantlist__44c0_sm_p4_0[] = { 4, 3, 5, 2, 6, 1, 7, 0, 8, }; static long _vq_lengthlist__44c0_sm_p4_0[] = { 2, 3, 3, 6, 6, 0, 0, 0, 0, 0, 4, 4, 6, 6, 0, 0, 0, 0, 0, 4, 4, 6, 6, 0, 0, 0, 0, 0, 5, 5, 6, 6, 0, 0, 0, 0, 0, 0, 0, 6, 6, 0, 0, 0, 0, 0, 0, 0, 7, 8, 0, 0, 0, 0, 0, 0, 0, 7, 7, 0, 0, 0, 0, 0, 0, 0, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; static float _vq_quantthresh__44c0_sm_p4_0[] = { -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, }; static long _vq_quantmap__44c0_sm_p4_0[] = { 7, 5, 3, 1, 0, 2, 4, 6, 8, }; static encode_aux_threshmatch _vq_auxt__44c0_sm_p4_0 = { _vq_quantthresh__44c0_sm_p4_0, _vq_quantmap__44c0_sm_p4_0, 9, 9 }; static static_codebook _44c0_sm_p4_0 = { 2, 81, _vq_lengthlist__44c0_sm_p4_0, 1, -531628032, 1611661312, 4, 0, _vq_quantlist__44c0_sm_p4_0, NULL, &_vq_auxt__44c0_sm_p4_0, NULL, 0 }; static long _vq_quantlist__44c0_sm_p5_0[] = { 4, 3, 5, 2, 6, 1, 7, 0, 8, }; static long _vq_lengthlist__44c0_sm_p5_0[] = { 1, 3, 3, 6, 6, 7, 7, 9, 9, 0, 6, 6, 7, 7, 8, 8, 9, 9, 0, 6, 6, 7, 7, 8, 8,10,10, 0, 7, 7, 8, 8, 8, 8,10,10, 0, 0, 0, 8, 8, 8, 8,10,10, 0, 0, 0, 8, 8, 9, 9,11,11, 0, 0, 0, 9, 9, 9, 9,11,11, 0, 0, 0,10,10, 9, 9,11,11, 0, 0, 0, 0, 0, 9, 9,11, 11, }; static float _vq_quantthresh__44c0_sm_p5_0[] = { -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, }; static long _vq_quantmap__44c0_sm_p5_0[] = { 7, 5, 3, 1, 0, 2, 4, 6, 8, }; static encode_aux_threshmatch _vq_auxt__44c0_sm_p5_0 = { _vq_quantthresh__44c0_sm_p5_0, _vq_quantmap__44c0_sm_p5_0, 9, 9 }; static static_codebook _44c0_sm_p5_0 = { 2, 81, _vq_lengthlist__44c0_sm_p5_0, 1, -531628032, 1611661312, 4, 0, _vq_quantlist__44c0_sm_p5_0, NULL, &_vq_auxt__44c0_sm_p5_0, NULL, 0 }; static long _vq_quantlist__44c0_sm_p6_0[] = { 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15, 0, 16, }; static long _vq_lengthlist__44c0_sm_p6_0[] = { 1, 4, 4, 6, 6, 8, 8, 9, 9, 8, 8,10,10,10,10,11, 11, 0, 6, 5, 7, 7, 8, 8, 9, 9, 9, 9,10,10,11,11, 12,12, 0, 6, 5, 7, 7, 8, 8, 9, 9, 9, 9,10,10,11, 11,12,12, 0, 7, 7, 8, 8, 8, 8,10,10,10,10,11,11, 11,11,12,12, 0, 0, 0, 8, 7, 8, 8,10,10,10,10,11, 11,11,11,12,12, 0, 0, 0, 8, 8, 9, 9,10,10,10,10, 11,11,12,12,12,12, 0, 0, 0, 8, 8, 9, 9,10,10,10, 10,11,11,12,12,12,13, 0, 0, 0, 9, 9, 9, 9,10,10, 10,10,11,11,12,12,13,13, 0, 0, 0, 0, 0, 9, 9,10, 10,10,10,11,11,12,12,13,13, 0, 0, 0, 0, 0, 9, 9, 10,10,11,11,12,12,12,13,13,13, 0, 0, 0, 0, 0, 9, 9,10, 9,11,11,12,12,13,13,13,13, 0, 0, 0, 0, 0, 10,10,10,10,11,11,12,12,13,13,14,14, 0, 0, 0, 0, 0, 0, 0,10,10,11,11,12,12,13,13,14,14, 0, 0, 0, 0, 0, 0, 0,11,11,11,11,12,12,13,13,14,14, 0, 0, 0, 0, 0, 0, 0,11,11,11,11,12,12,13,13,14,14, 0, 0, 0, 0, 0, 0, 0,12,12,12,12,13,13,13,13,14,14, 0, 0, 0, 0, 0, 0, 0, 0, 0,12,12,12,12,13,13,14, 14, }; static float _vq_quantthresh__44c0_sm_p6_0[] = { -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, }; static long _vq_quantmap__44c0_sm_p6_0[] = { 15, 13, 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, 14, 16, }; static encode_aux_threshmatch _vq_auxt__44c0_sm_p6_0 = { _vq_quantthresh__44c0_sm_p6_0, _vq_quantmap__44c0_sm_p6_0, 17, 17 }; static static_codebook _44c0_sm_p6_0 = { 2, 289, _vq_lengthlist__44c0_sm_p6_0, 1, -529530880, 1611661312, 5, 0, _vq_quantlist__44c0_sm_p6_0, NULL, &_vq_auxt__44c0_sm_p6_0, NULL, 0 }; static long _vq_quantlist__44c0_sm_p7_0[] = { 1, 0, 2, }; static long _vq_lengthlist__44c0_sm_p7_0[] = { 1, 4, 4, 6, 6, 6, 7, 6, 6, 5, 7, 6,10, 9, 9,10, 9, 9, 4, 7, 7,10, 9, 9,11, 9, 9, 6,10,10,10,10, 10,11,10,10, 6, 9, 9,10,10,10,11, 9,10, 6, 9, 9, 10,10,10,11,10, 9, 7,10,10,11,11,11,11,11,11, 6, 9, 9,10, 9,10,11,11,10, 6, 9, 9,10,10,10,11,10, 11, }; static float _vq_quantthresh__44c0_sm_p7_0[] = { -5.5, 5.5, }; static long _vq_quantmap__44c0_sm_p7_0[] = { 1, 0, 2, }; static encode_aux_threshmatch _vq_auxt__44c0_sm_p7_0 = { _vq_quantthresh__44c0_sm_p7_0, _vq_quantmap__44c0_sm_p7_0, 3, 3 }; static static_codebook _44c0_sm_p7_0 = { 4, 81, _vq_lengthlist__44c0_sm_p7_0, 1, -529137664, 1618345984, 2, 0, _vq_quantlist__44c0_sm_p7_0, NULL, &_vq_auxt__44c0_sm_p7_0, NULL, 0 }; static long _vq_quantlist__44c0_sm_p7_1[] = { 5, 4, 6, 3, 7, 2, 8, 1, 9, 0, 10, }; static long _vq_lengthlist__44c0_sm_p7_1[] = { 2, 4, 4, 5, 5, 7, 7, 7, 7, 7, 7, 9, 5, 5, 7, 7, 7, 7, 8, 8, 8, 8, 9, 5, 5, 7, 7, 7, 7, 8, 8, 8, 8,10, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8,10,10,10, 7, 7, 7, 7, 8, 8, 8, 8,10,10,10, 8, 8, 8, 8, 8, 8, 8, 8,10,10,10, 8, 8, 8, 8, 8, 8, 8, 8,10,10,10, 8, 8, 8, 8, 8, 8, 8, 8,10,10,10,10,10, 8, 8, 8, 8, 8, 8,10,10,10,10,10, 9, 9, 8, 8, 8, 8,10,10, 10,10,10, 8, 8, 8, 8, 8, 8, }; static float _vq_quantthresh__44c0_sm_p7_1[] = { -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, }; static long _vq_quantmap__44c0_sm_p7_1[] = { 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, }; static encode_aux_threshmatch _vq_auxt__44c0_sm_p7_1 = { _vq_quantthresh__44c0_sm_p7_1, _vq_quantmap__44c0_sm_p7_1, 11, 11 }; static static_codebook _44c0_sm_p7_1 = { 2, 121, _vq_lengthlist__44c0_sm_p7_1, 1, -531365888, 1611661312, 4, 0, _vq_quantlist__44c0_sm_p7_1, NULL, &_vq_auxt__44c0_sm_p7_1, NULL, 0 }; static long _vq_quantlist__44c0_sm_p8_0[] = { 6, 5, 7, 4, 8, 3, 9, 2, 10, 1, 11, 0, 12, }; static long _vq_lengthlist__44c0_sm_p8_0[] = { 1, 4, 4, 6, 6, 7, 7, 7, 7, 9, 9,10,10, 7, 5, 5, 7, 7, 8, 8, 8, 8, 9, 9,10,10, 7, 5, 6, 7, 7, 8, 8, 8, 8, 9, 9,10,10, 0, 8, 8, 8, 8, 9, 9, 9, 9, 10,10,11,11, 0, 8, 8, 8, 8, 9, 9, 9, 9,10,10,11, 11, 0,12,12, 9, 9, 9, 9,10,10,11,11,12,11, 0,12, 12, 9, 9, 9, 9,10,10,11,11,12,11, 0, 0, 0, 9, 9, 9,10,11,11,11,11,12,12, 0, 0, 0,10,10, 9, 9,11, 11,11,11,12,12, 0, 0, 0,13,13,10,10,11,11,12,12, 13,13, 0, 0, 0,14,14,10,10,11,10,12,12,13,13, 0, 0, 0, 0, 0,12,12,11,11,12,12,13,13, 0, 0, 0, 0, 0,12,12,11,10,12,11,14,14, }; static float _vq_quantthresh__44c0_sm_p8_0[] = { -27.5, -22.5, -17.5, -12.5, -7.5, -2.5, 2.5, 7.5, 12.5, 17.5, 22.5, 27.5, }; static long _vq_quantmap__44c0_sm_p8_0[] = { 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, }; static encode_aux_threshmatch _vq_auxt__44c0_sm_p8_0 = { _vq_quantthresh__44c0_sm_p8_0, _vq_quantmap__44c0_sm_p8_0, 13, 13 }; static static_codebook _44c0_sm_p8_0 = { 2, 169, _vq_lengthlist__44c0_sm_p8_0, 1, -526516224, 1616117760, 4, 0, _vq_quantlist__44c0_sm_p8_0, NULL, &_vq_auxt__44c0_sm_p8_0, NULL, 0 }; static long _vq_quantlist__44c0_sm_p8_1[] = { 2, 1, 3, 0, 4, }; static long _vq_lengthlist__44c0_sm_p8_1[] = { 2, 4, 4, 4, 5, 6, 5, 5, 5, 5, 6, 5, 5, 5, 5, 6, 5, 5, 5, 5, 6, 6, 6, 5, 5, }; static float _vq_quantthresh__44c0_sm_p8_1[] = { -1.5, -0.5, 0.5, 1.5, }; static long _vq_quantmap__44c0_sm_p8_1[] = { 3, 1, 0, 2, 4, }; static encode_aux_threshmatch _vq_auxt__44c0_sm_p8_1 = { _vq_quantthresh__44c0_sm_p8_1, _vq_quantmap__44c0_sm_p8_1, 5, 5 }; static static_codebook _44c0_sm_p8_1 = { 2, 25, _vq_lengthlist__44c0_sm_p8_1, 1, -533725184, 1611661312, 3, 0, _vq_quantlist__44c0_sm_p8_1, NULL, &_vq_auxt__44c0_sm_p8_1, NULL, 0 }; static long _vq_quantlist__44c0_sm_p9_0[] = { 4, 3, 5, 2, 6, 1, 7, 0, 8, }; static long _vq_lengthlist__44c0_sm_p9_0[] = { 1, 3, 4,11,11,11,11,11,11, 4, 6, 6,10,10,10,10, 10,10, 4, 6, 5,10,10,10,10,10,10,10, 6, 7,10, 9, 10,10,10,10,10, 7, 9,10, 9,10,10,10,10,10, 9,10, 7, 9,10,10,10,10,10,10,10, 9,10,10,10,10,10,10, 10,10, 9,10,10,10,10,10,10,10,10,10,10,10,10,10, 10, }; static float _vq_quantthresh__44c0_sm_p9_0[] = { -773.5, -552.5, -331.5, -110.5, 110.5, 331.5, 552.5, 773.5, }; static long _vq_quantmap__44c0_sm_p9_0[] = { 7, 5, 3, 1, 0, 2, 4, 6, 8, }; static encode_aux_threshmatch _vq_auxt__44c0_sm_p9_0 = { _vq_quantthresh__44c0_sm_p9_0, _vq_quantmap__44c0_sm_p9_0, 9, 9 }; static static_codebook _44c0_sm_p9_0 = { 2, 81, _vq_lengthlist__44c0_sm_p9_0, 1, -516186112, 1627103232, 4, 0, _vq_quantlist__44c0_sm_p9_0, NULL, &_vq_auxt__44c0_sm_p9_0, NULL, 0 }; static long _vq_quantlist__44c0_sm_p9_1[] = { 6, 5, 7, 4, 8, 3, 9, 2, 10, 1, 11, 0, 12, }; static long _vq_lengthlist__44c0_sm_p9_1[] = { 1, 4, 4, 6, 6, 7, 7, 9, 9,12,12,13,13, 6, 5, 5, 7, 7, 8, 8,10,10,12,12,14,13, 6, 5, 5, 6, 7, 8, 8,10, 9,11,12,13,12,18, 7, 7, 7, 7, 9, 9,11,11, 14,14,14,13,17, 7, 7, 8, 7, 9, 9,10,10,12,11,13, 12,18,10,10, 8, 8,10,10,12,11,13,14,16,15,17,11, 11, 8, 8,11,11,11,12,13,13,13,15,18,18,18,10,11, 10,10,12,13,14,13,17,14,17,17,17,10,10,11,11,14, 14,14,13,14,14,18,18,18,17,15,11,12,12,13,15,15, 16,17,18,16,18,14,15,11,11,14,13,14,14,16,17,18, 17,17,17,18,14,13,13,12,17,15,17,16,18,17,18,18, 18,12,13,12,13,16,14,18,18, }; static float _vq_quantthresh__44c0_sm_p9_1[] = { -93.5, -76.5, -59.5, -42.5, -25.5, -8.5, 8.5, 25.5, 42.5, 59.5, 76.5, 93.5, }; static long _vq_quantmap__44c0_sm_p9_1[] = { 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, }; static encode_aux_threshmatch _vq_auxt__44c0_sm_p9_1 = { _vq_quantthresh__44c0_sm_p9_1, _vq_quantmap__44c0_sm_p9_1, 13, 13 }; static static_codebook _44c0_sm_p9_1 = { 2, 169, _vq_lengthlist__44c0_sm_p9_1, 1, -522616832, 1620115456, 4, 0, _vq_quantlist__44c0_sm_p9_1, NULL, &_vq_auxt__44c0_sm_p9_1, NULL, 0 }; static long _vq_quantlist__44c0_sm_p9_2[] = { 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15, 0, 16, }; static long _vq_lengthlist__44c0_sm_p9_2[] = { 2, 5, 5, 6, 6, 7, 7, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9,10, 6, 6, 7, 7, 8, 7, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9,10, 6, 6, 7, 7, 7, 7, 8, 8, 9, 8, 9, 9, 9, 9, 9, 9,10, 7, 7, 7, 7, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9,10,10,10, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9,10,10,10, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,11,10,10, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9,10, 9,10,11,10, 9, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,10,10,10,10,11,11, 9, 8, 9, 9, 9, 9, 9, 9, 9, 9,10,10,10,11,10,11,11, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,10, 9,10,10,10,11,11, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,11,10,10,11,11, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,10, 9,10,10,10,10, 11,11,10, 9, 9, 9, 9, 9, 9, 9, 9, 9,10,10,11,10, 11,11,10,10, 9,10,10,10, 9, 9, 9, 9, 9, 9,10,10, 10,11,11,11,11,10,10, 9, 9, 9, 9, 9, 9, 9, 9,10, 11,10,11,10,10,10,10,10, 9, 9, 9, 9, 9, 9, 9, 9, 10,10,10,11,11,11,10,11,11, 9, 9, 9, 9, 9, 9, 9, 9, }; static float _vq_quantthresh__44c0_sm_p9_2[] = { -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, }; static long _vq_quantmap__44c0_sm_p9_2[] = { 15, 13, 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, 14, 16, }; static encode_aux_threshmatch _vq_auxt__44c0_sm_p9_2 = { _vq_quantthresh__44c0_sm_p9_2, _vq_quantmap__44c0_sm_p9_2, 17, 17 }; static static_codebook _44c0_sm_p9_2 = { 2, 289, _vq_lengthlist__44c0_sm_p9_2, 1, -529530880, 1611661312, 5, 0, _vq_quantlist__44c0_sm_p9_2, NULL, &_vq_auxt__44c0_sm_p9_2, NULL, 0 }; static long _huff_lengthlist__44c0_sm_short[] = { 5, 7,12,12,13,13,13,15,16,18, 4, 2,11, 5, 9, 7, 9,12,13,14,13, 7, 8, 9, 8, 9,11,13,19,19, 9, 4, 12, 5,10, 7, 9,12,15,14,11, 6, 7, 7, 5, 6, 8,11, 15,17,10, 5, 8, 6, 6, 5, 6, 9,14,14,10, 5, 9, 7, 7, 6, 6, 9,12,14,12, 6,10, 7, 7, 7, 8, 9,13,14, 14, 7, 9, 7, 5, 5, 6, 9,11,13,14, 9,10, 9, 6, 6, 7, 8,10,13, }; static static_codebook _huff_book__44c0_sm_short = { 2, 100, _huff_lengthlist__44c0_sm_short, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _huff_lengthlist__44c1_s_long[] = { 3, 4,19, 9,10, 9, 9,10,11,12, 4, 2,19, 5, 6, 6, 8,10,12,11,19,19,19,19,19,19,19,19,18,18, 8, 4, 18, 6, 8, 7,10,13,14,13,10, 5,18, 7, 4, 6, 7,10, 12,13, 9, 6,18, 7, 5, 6, 7,10,12,13, 9, 7,18, 9, 7, 6, 6, 7,10,13, 9, 9,18,12, 9, 8, 6, 6, 9,12, 10,12,18,15,12,11, 9, 8, 8,11,11,14,18,17,15,13, 12, 9,10,12, }; static static_codebook _huff_book__44c1_s_long = { 2, 100, _huff_lengthlist__44c1_s_long, 0, 0, 0, 0, 0, NULL, NULL, NULL, N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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; static float _vq_quantthresh__44c1_s_p1_0[] = { -0.5, 0.5, }; static long _vq_quantmap__44c1_s_p1_0[] = { 1, 0, 2, }; static encode_aux_threshmatch _vq_auxt__44c1_s_p1_0 = { _vq_quantthresh__44c1_s_p1_0, _vq_quantmap__44c1_s_p1_0, 3, 3 }; static static_codebook _44c1_s_p1_0 = { 8, 6561, _vq_lengthlist__44c1_s_p1_0, 1, -535822336, 1611661312, 2, 0, _vq_quantlist__44c1_s_p1_0, NULL, &_vq_auxt__44c1_s_p1_0, NULL, 0 }; static long _vq_quantlist__44c1_s_p2_0[] = { 2, 1, 3, 0, 4, }; static long _vq_lengthlist__44c1_s_p2_0[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; static float _vq_quantthresh__44c1_s_p2_0[] = { -1.5, -0.5, 0.5, 1.5, }; static long _vq_quantmap__44c1_s_p2_0[] = { 3, 1, 0, 2, 4, }; static encode_aux_threshmatch _vq_auxt__44c1_s_p2_0 = { _vq_quantthresh__44c1_s_p2_0, _vq_quantmap__44c1_s_p2_0, 5, 5 }; static static_codebook _44c1_s_p2_0 = { 4, 625, _vq_lengthlist__44c1_s_p2_0, 1, -533725184, 1611661312, 3, 0, _vq_quantlist__44c1_s_p2_0, NULL, &_vq_auxt__44c1_s_p2_0, NULL, 0 }; static long _vq_quantlist__44c1_s_p3_0[] = { 2, 1, 3, 0, 4, }; static long _vq_lengthlist__44c1_s_p3_0[] = { 2, 3, 4, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 5, 4, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; static float _vq_quantthresh__44c1_s_p3_0[] = { -1.5, -0.5, 0.5, 1.5, }; static long _vq_quantmap__44c1_s_p3_0[] = { 3, 1, 0, 2, 4, }; static encode_aux_threshmatch _vq_auxt__44c1_s_p3_0 = { _vq_quantthresh__44c1_s_p3_0, _vq_quantmap__44c1_s_p3_0, 5, 5 }; static static_codebook _44c1_s_p3_0 = { 4, 625, _vq_lengthlist__44c1_s_p3_0, 1, -533725184, 1611661312, 3, 0, _vq_quantlist__44c1_s_p3_0, NULL, &_vq_auxt__44c1_s_p3_0, NULL, 0 }; static long _vq_quantlist__44c1_s_p4_0[] = { 4, 3, 5, 2, 6, 1, 7, 0, 8, }; static long _vq_lengthlist__44c1_s_p4_0[] = { 1, 3, 2, 7, 7, 0, 0, 0, 0, 0, 0, 0, 6, 6, 0, 0, 0, 0, 0, 0, 0, 6, 6, 0, 0, 0, 0, 0, 0, 0, 7, 7, 0, 0, 0, 0, 0, 0, 0, 7, 7, 0, 0, 0, 0, 0, 0, 0, 8, 9, 0, 0, 0, 0, 0, 0, 0, 8, 8, 0, 0, 0, 0, 0, 0, 0,10,10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; static float _vq_quantthresh__44c1_s_p4_0[] = { -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, }; static long _vq_quantmap__44c1_s_p4_0[] = { 7, 5, 3, 1, 0, 2, 4, 6, 8, }; static encode_aux_threshmatch _vq_auxt__44c1_s_p4_0 = { _vq_quantthresh__44c1_s_p4_0, _vq_quantmap__44c1_s_p4_0, 9, 9 }; static static_codebook _44c1_s_p4_0 = { 2, 81, _vq_lengthlist__44c1_s_p4_0, 1, -531628032, 1611661312, 4, 0, _vq_quantlist__44c1_s_p4_0, NULL, &_vq_auxt__44c1_s_p4_0, NULL, 0 }; static long _vq_quantlist__44c1_s_p5_0[] = { 4, 3, 5, 2, 6, 1, 7, 0, 8, }; static long _vq_lengthlist__44c1_s_p5_0[] = { 1, 3, 3, 5, 5, 6, 6, 8, 8, 0, 0, 0, 7, 7, 8, 7, 9, 9, 0, 0, 0, 7, 7, 8, 8, 9, 9, 0, 0, 0, 7, 7, 8, 8,10,10, 0, 0, 0, 7, 7, 8, 8,10,10, 0, 0, 0, 8, 8, 9, 9,10,10, 0, 0, 0, 8, 8, 9, 9,10,10, 0, 0, 0,10,10, 9, 9,11,11, 0, 0, 0, 0, 0, 9, 9,11, 11, }; static float _vq_quantthresh__44c1_s_p5_0[] = { -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, }; static long _vq_quantmap__44c1_s_p5_0[] = { 7, 5, 3, 1, 0, 2, 4, 6, 8, }; static encode_aux_threshmatch _vq_auxt__44c1_s_p5_0 = { _vq_quantthresh__44c1_s_p5_0, _vq_quantmap__44c1_s_p5_0, 9, 9 }; static static_codebook _44c1_s_p5_0 = { 2, 81, _vq_lengthlist__44c1_s_p5_0, 1, -531628032, 1611661312, 4, 0, _vq_quantlist__44c1_s_p5_0, NULL, &_vq_auxt__44c1_s_p5_0, NULL, 0 }; static long _vq_quantlist__44c1_s_p6_0[] = { 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15, 0, 16, }; static long _vq_lengthlist__44c1_s_p6_0[] = { 1, 3, 4, 6, 6, 7, 7, 8, 8, 8, 8, 9, 9,10,10,11, 11, 0, 0, 0, 7, 7, 8, 8, 9, 9, 9, 9,10,10,11,11, 11,11, 0, 0, 0, 7, 7, 8, 8, 9, 9, 9, 9,10,10,10, 11,11,11, 0, 0, 0, 7, 7, 8, 8, 9, 9, 9, 9,10,10, 11,11,12,12, 0, 0, 0, 7, 7, 8, 8, 9, 9, 9, 9,10, 10,11,11,12,12, 0, 0, 0, 8, 8, 9, 9,10,10,10,10, 10,10,11,11,12,12, 0, 0, 0, 8, 8, 9, 9, 9,10,10, 10,11,11,11,11,12,12, 0, 0, 0, 9, 9, 9, 9,10,10, 10,10,11,11,12,12,13,12, 0, 0, 0, 0, 0, 9, 9,10, 10,10,10,11,11,12,12,12,12, 0, 0, 0, 0, 0, 9, 9, 10,10,10,10,11,11,12,12,13,13, 0, 0, 0, 0, 0, 9, 9,10, 9,10,10,11,11,12,12,13,13, 0, 0, 0, 0, 0, 10,10,10,10,11,11,11,11,12,12,13,13, 0, 0, 0, 0, 0, 0, 0,10,10,11,11,11,11,12,12,13,13, 0, 0, 0, 0, 0, 0, 0,11,11,11,11,12,12,13,12,13,13, 0, 0, 0, 0, 0, 0, 0,11,11,11,11,12,12,13,13,13,13, 0, 0, 0, 0, 0, 0, 0,11,11,11,12,12,12,13,13,14,14, 0, 0, 0, 0, 0, 0, 0, 0, 0,11,11,12,12,13,13,14, 14, }; static float _vq_quantthresh__44c1_s_p6_0[] = { -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, }; static long _vq_quantmap__44c1_s_p6_0[] = { 15, 13, 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, 14, 16, }; static encode_aux_threshmatch _vq_auxt__44c1_s_p6_0 = { _vq_quantthresh__44c1_s_p6_0, _vq_quantmap__44c1_s_p6_0, 17, 17 }; static static_codebook _44c1_s_p6_0 = { 2, 289, _vq_lengthlist__44c1_s_p6_0, 1, -529530880, 1611661312, 5, 0, _vq_quantlist__44c1_s_p6_0, NULL, &_vq_auxt__44c1_s_p6_0, NULL, 0 }; static long _vq_quantlist__44c1_s_p7_0[] = { 1, 0, 2, }; static long _vq_lengthlist__44c1_s_p7_0[] = { 1, 4, 4, 6, 6, 6, 7, 6, 6, 4, 7, 7,10, 9, 9,10, 9, 9, 5, 7, 7,10, 9, 9,10, 9, 9, 6,10,10,10,10, 10,11,10,10, 6, 9, 9,10,11,10,10, 9, 9, 6, 9, 9, 10,10,10,10, 9, 9, 7,10,10,11,10,10,11,11,11, 6, 9, 9,10, 9, 9,11,10,10, 6, 9, 9,10, 9, 9,11,10, 10, }; static float _vq_quantthresh__44c1_s_p7_0[] = { -5.5, 5.5, }; static long _vq_quantmap__44c1_s_p7_0[] = { 1, 0, 2, }; static encode_aux_threshmatch _vq_auxt__44c1_s_p7_0 = { _vq_quantthresh__44c1_s_p7_0, _vq_quantmap__44c1_s_p7_0, 3, 3 }; static static_codebook _44c1_s_p7_0 = { 4, 81, _vq_lengthlist__44c1_s_p7_0, 1, -529137664, 1618345984, 2, 0, _vq_quantlist__44c1_s_p7_0, NULL, &_vq_auxt__44c1_s_p7_0, NULL, 0 }; static long _vq_quantlist__44c1_s_p7_1[] = { 5, 4, 6, 3, 7, 2, 8, 1, 9, 0, 10, }; static long _vq_lengthlist__44c1_s_p7_1[] = { 2, 3, 3, 6, 6, 7, 7, 7, 7, 8, 8,10,10,10, 6, 6, 7, 7, 8, 8, 8, 8,10,10,10, 6, 6, 7, 7, 8, 8, 8, 8,10,10,10, 7, 7, 7, 7, 8, 8, 8, 8,10,10,10, 7, 7, 7, 7, 8, 8, 8, 8,10,10,10, 7, 7, 8, 8, 8, 8, 8, 8,10,10,10, 7, 7, 8, 8, 8, 8, 8, 8,10,10,10, 8, 8, 8, 8, 8, 8, 8, 8,10,10,10,10,10, 8, 8, 8, 8, 8, 8,10,10,10,10,10, 9, 9, 8, 8, 8, 8,10,10, 10,10,10, 8, 8, 8, 8, 8, 8, }; static float _vq_quantthresh__44c1_s_p7_1[] = { -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, }; static long _vq_quantmap__44c1_s_p7_1[] = { 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, }; static encode_aux_threshmatch _vq_auxt__44c1_s_p7_1 = { _vq_quantthresh__44c1_s_p7_1, _vq_quantmap__44c1_s_p7_1, 11, 11 }; static static_codebook _44c1_s_p7_1 = { 2, 121, _vq_lengthlist__44c1_s_p7_1, 1, -531365888, 1611661312, 4, 0, _vq_quantlist__44c1_s_p7_1, NULL, &_vq_auxt__44c1_s_p7_1, NULL, 0 }; static long _vq_quantlist__44c1_s_p8_0[] = { 6, 5, 7, 4, 8, 3, 9, 2, 10, 1, 11, 0, 12, }; static long _vq_lengthlist__44c1_s_p8_0[] = { 1, 4, 4, 6, 6, 7, 7, 7, 7, 9, 8,10,10, 6, 5, 5, 7, 7, 8, 8, 8, 8, 9, 9,10,10, 7, 6, 6, 7, 7, 8, 8, 8, 8, 9, 9,10,10, 0, 8, 8, 8, 8, 9, 9, 9, 9, 10,10,11,11, 0, 8, 8, 8, 8, 9, 9, 9, 9,10,10,11, 11, 0,12,12, 9, 9, 9, 9,10,10,10,11,12,11, 0,12, 13, 9, 8, 9, 9,10,10,11,11,11,11, 0, 0, 0, 9, 9, 9, 9,10,10,11,11,12,12, 0, 0, 0,10,10, 9, 9,10, 10,11,11,12,12, 0, 0, 0,13,14,10,10,11,11,12,12, 12,13, 0, 0, 0,14,14,10,10,11,10,12,12,13,13, 0, 0, 0, 0, 0,12,11,11,11,12,12,13,13, 0, 0, 0, 0, 0,12,12,11,10,12,11,14,13, }; static float _vq_quantthresh__44c1_s_p8_0[] = { -27.5, -22.5, -17.5, -12.5, -7.5, -2.5, 2.5, 7.5, 12.5, 17.5, 22.5, 27.5, }; static long _vq_quantmap__44c1_s_p8_0[] = { 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, }; static encode_aux_threshmatch _vq_auxt__44c1_s_p8_0 = { _vq_quantthresh__44c1_s_p8_0, _vq_quantmap__44c1_s_p8_0, 13, 13 }; static static_codebook _44c1_s_p8_0 = { 2, 169, _vq_lengthlist__44c1_s_p8_0, 1, -526516224, 1616117760, 4, 0, _vq_quantlist__44c1_s_p8_0, NULL, &_vq_auxt__44c1_s_p8_0, NULL, 0 }; static long _vq_quantlist__44c1_s_p8_1[] = { 2, 1, 3, 0, 4, }; static long _vq_lengthlist__44c1_s_p8_1[] = { 2, 3, 3, 5, 5, 6, 6, 6, 5, 5, 6, 6, 6, 5, 5, 6, 6, 6, 5, 5, 6, 6, 6, 5, 5, }; static float _vq_quantthresh__44c1_s_p8_1[] = { -1.5, -0.5, 0.5, 1.5, }; static long _vq_quantmap__44c1_s_p8_1[] = { 3, 1, 0, 2, 4, }; static encode_aux_threshmatch _vq_auxt__44c1_s_p8_1 = { _vq_quantthresh__44c1_s_p8_1, _vq_quantmap__44c1_s_p8_1, 5, 5 }; static static_codebook _44c1_s_p8_1 = { 2, 25, _vq_lengthlist__44c1_s_p8_1, 1, -533725184, 1611661312, 3, 0, _vq_quantlist__44c1_s_p8_1, NULL, &_vq_auxt__44c1_s_p8_1, NULL, 0 }; static long _vq_quantlist__44c1_s_p9_0[] = { 6, 5, 7, 4, 8, 3, 9, 2, 10, 1, 11, 0, 12, }; static long _vq_lengthlist__44c1_s_p9_0[] = { 1, 6, 6, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 5, 7, 6, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 4, 6, 6, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 7, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 8, }; static float _vq_quantthresh__44c1_s_p9_0[] = { -1215.5, -994.5, -773.5, -552.5, -331.5, -110.5, 110.5, 331.5, 552.5, 773.5, 994.5, 1215.5, }; static long _vq_quantmap__44c1_s_p9_0[] = { 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, }; static encode_aux_threshmatch _vq_auxt__44c1_s_p9_0 = { _vq_quantthresh__44c1_s_p9_0, _vq_quantmap__44c1_s_p9_0, 13, 13 }; static static_codebook _44c1_s_p9_0 = { 2, 169, _vq_lengthlist__44c1_s_p9_0, 1, -514541568, 1627103232, 4, 0, _vq_quantlist__44c1_s_p9_0, NULL, &_vq_auxt__44c1_s_p9_0, NULL, 0 }; static long _vq_quantlist__44c1_s_p9_1[] = { 6, 5, 7, 4, 8, 3, 9, 2, 10, 1, 11, 0, 12, }; static long _vq_lengthlist__44c1_s_p9_1[] = { 1, 4, 4, 6, 6, 7, 7, 9, 9,12,12,13,12, 6, 5, 5, 7, 7, 8, 8,10,10,11,12,13,13, 6, 5, 5, 7, 7, 8, 8, 9, 9,11,11,12,12,15, 7, 7, 7, 7, 9, 9,11,11, 13,13,14,13,15, 7, 7, 8, 7, 9, 9,10,10,12,11,14, 12,15,10,10, 8, 8,10,10,12,11,12,13,14,13,15,10, 10, 8, 8,11,10,11,11,13,12,13,15,14,15,15,10,10, 10,10,12,13,13,12,15,14,15,15,13,10,10,11,11,13, 13,13,12,13,13,15,15,15,14,15,11,11,13,13,13,13, 14,15,15,15,15,13,13,11,11,12,13,13,14,13,15,15, 15,14,15,15,13,12,12,11,13,13,15,15,15,15,15,15, 14,13,12,13,12,15,13,15,15, }; static float _vq_quantthresh__44c1_s_p9_1[] = { -93.5, -76.5, -59.5, -42.5, -25.5, -8.5, 8.5, 25.5, 42.5, 59.5, 76.5, 93.5, }; static long _vq_quantmap__44c1_s_p9_1[] = { 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, }; static encode_aux_threshmatch _vq_auxt__44c1_s_p9_1 = { _vq_quantthresh__44c1_s_p9_1, _vq_quantmap__44c1_s_p9_1, 13, 13 }; static static_codebook _44c1_s_p9_1 = { 2, 169, _vq_lengthlist__44c1_s_p9_1, 1, -522616832, 1620115456, 4, 0, _vq_quantlist__44c1_s_p9_1, NULL, &_vq_auxt__44c1_s_p9_1, NULL, 0 }; static long _vq_quantlist__44c1_s_p9_2[] = { 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15, 0, 16, }; static long _vq_lengthlist__44c1_s_p9_2[] = { 2, 4, 4, 6, 6, 7, 7, 8, 8, 8, 8, 8, 9, 8, 9, 9, 9,10,10,10, 7, 7, 7, 7, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9,10,10,10, 7, 7, 7, 7, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9,10,10,10, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9,10,10,10, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9,10,10,11,10, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9,10, 9, 9, 9,10,10,10, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,10,10,11, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,10, 9,10,10,10,11,11, 9, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9,10,10,11,11,11,11, 9, 9, 9, 9, 9, 9,10, 9,10, 9, 9, 9,10,10,10,11,10, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,10,10,11,11,11, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,10, 9,10,10,10,10, 11,11,10, 9, 9,10, 9, 9, 9, 9, 9, 9, 9,10,10,10, 11,11,11,10, 9,10,10,10, 9, 9, 9, 9,10, 9,10,10, 10,10,11,11,10,10, 9, 9, 9, 9, 9, 9, 9, 9, 9,10, 11,10,10,10,10,10,10, 9, 9, 9, 9,10, 9, 9, 9, 9, 10,10,10,11,11,10,10,11,11, 9, 9,10, 9, 9, 9, 9, 9, }; static float _vq_quantthresh__44c1_s_p9_2[] = { -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, }; static long _vq_quantmap__44c1_s_p9_2[] = { 15, 13, 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, 14, 16, }; static encode_aux_threshmatch _vq_auxt__44c1_s_p9_2 = { _vq_quantthresh__44c1_s_p9_2, _vq_quantmap__44c1_s_p9_2, 17, 17 }; static static_codebook _44c1_s_p9_2 = { 2, 289, _vq_lengthlist__44c1_s_p9_2, 1, -529530880, 1611661312, 5, 0, _vq_quantlist__44c1_s_p9_2, NULL, &_vq_auxt__44c1_s_p9_2, NULL, 0 }; static long _huff_lengthlist__44c1_s_short[] = { 5, 7,17,13,12,12,14,16,15,16, 4, 2,17, 5, 7, 6, 8,11,14,13,16,16,16,16,16,16,16,16,16,16,10, 4, 16, 4, 8, 6, 7,11,14,14,10, 5,16, 6, 5, 6, 8,12, 15,15,10, 5,16, 5, 6, 5, 7,10,14,15,11, 6,16, 7, 8, 7, 7,10,14,14,13, 8,16, 8, 7, 7, 8,10,12,13, 12, 8,16, 7, 5, 5, 6, 8,11,13,13, 9,16, 9, 6, 6, 7, 8,10,13, }; static static_codebook _huff_book__44c1_s_short = { 2, 100, _huff_lengthlist__44c1_s_short, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _huff_lengthlist__44c1_sm_long[] = { 3, 4,10, 9,11, 9,10,11,11,13, 4, 2,11, 5, 7, 7, 8,10,12,13,10,10, 7,12, 8, 9, 9,10,12,13, 8, 5, 13, 6, 9, 7,10,12,15,15,10, 6, 7, 8, 5, 5, 7,10, 12,13, 9, 6, 8, 7, 5, 5, 6, 9,11,12, 9, 8, 9, 9, 6, 5, 5, 7,10,13,10,10,10,12, 9, 7, 6, 7, 9,13, 10,13,11,17,11,11, 9, 8, 9,12,12,16,14,17,15,14, 12,10,10,12, }; static static_codebook _huff_book__44c1_sm_long = { 2, 100, _huff_lengthlist__44c1_sm_long, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _vq_quantlist__44c1_sm_p1_0[] = { 1, 0, 2, }; static long _vq_lengthlist__44c1_sm_p1_0[] = { 1, 5, 5, 0, 0, 0, 0, 0, 0, 5, 7, 7, 0, 0, 0, 0, 0, 0, 5, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 8, 7, 0, 0, 0, 0, 0, 0, 7, 9, 9, 0, 0, 0, 0, 0, 0, 7, 8,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atch _vq_auxt__44c1_sm_p1_0 = { _vq_quantthresh__44c1_sm_p1_0, _vq_quantmap__44c1_sm_p1_0, 3, 3 }; static static_codebook _44c1_sm_p1_0 = { 8, 6561, _vq_lengthlist__44c1_sm_p1_0, 1, -535822336, 1611661312, 2, 0, _vq_quantlist__44c1_sm_p1_0, NULL, &_vq_auxt__44c1_sm_p1_0, NULL, 0 }; static long _vq_quantlist__44c1_sm_p2_0[] = { 2, 1, 3, 0, 4, }; static long _vq_lengthlist__44c1_sm_p2_0[] = { 1, 5, 5, 0, 0, 0, 5, 6, 0, 0, 0, 5, 6, 0, 0, 0, 8, 8, 0, 0, 0, 0, 0, 0, 0, 5, 7, 6, 0, 0, 0, 8, 8, 0, 0, 0, 8, 8, 0, 0, 0,10,10, 0, 0, 0, 0, 0, 0, 0, 5, 6, 7, 0, 0, 0, 8, 8, 0, 0, 0, 8, 8, 0, 0, 0,10,10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 8, 8, 0, 0, 0, 8, 8, 0, 0, 0, 8, 8, 0, 0, 0,10, 9, 0, 0, 0, 0, 0, 0, 0, 6, 8, 8, 0, 0, 0, 8, 8, 0, 0, 0, 8, 8, 0, 0, 0, 9, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; static float _vq_quantthresh__44c1_sm_p2_0[] = { -1.5, -0.5, 0.5, 1.5, }; static long _vq_quantmap__44c1_sm_p2_0[] = { 3, 1, 0, 2, 4, }; static encode_aux_threshmatch _vq_auxt__44c1_sm_p2_0 = { _vq_quantthresh__44c1_sm_p2_0, _vq_quantmap__44c1_sm_p2_0, 5, 5 }; static static_codebook _44c1_sm_p2_0 = { 4, 625, _vq_lengthlist__44c1_sm_p2_0, 1, -533725184, 1611661312, 3, 0, _vq_quantlist__44c1_sm_p2_0, NULL, &_vq_auxt__44c1_sm_p2_0, NULL, 0 }; static long _vq_quantlist__44c1_sm_p3_0[] = { 2, 1, 3, 0, 4, }; static long _vq_lengthlist__44c1_sm_p3_0[] = { 2, 3, 4, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 7, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 6, 6, 8, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 6, 7, 8, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; static float _vq_quantthresh__44c1_sm_p3_0[] = { -1.5, -0.5, 0.5, 1.5, }; static long _vq_quantmap__44c1_sm_p3_0[] = { 3, 1, 0, 2, 4, }; static encode_aux_threshmatch _vq_auxt__44c1_sm_p3_0 = { _vq_quantthresh__44c1_sm_p3_0, _vq_quantmap__44c1_sm_p3_0, 5, 5 }; static static_codebook _44c1_sm_p3_0 = { 4, 625, _vq_lengthlist__44c1_sm_p3_0, 1, -533725184, 1611661312, 3, 0, _vq_quantlist__44c1_sm_p3_0, NULL, &_vq_auxt__44c1_sm_p3_0, NULL, 0 }; static long _vq_quantlist__44c1_sm_p4_0[] = { 4, 3, 5, 2, 6, 1, 7, 0, 8, }; static long _vq_lengthlist__44c1_sm_p4_0[] = { 1, 3, 3, 7, 7, 0, 0, 0, 0, 0, 5, 5, 6, 6, 0, 0, 0, 0, 0, 5, 5, 7, 7, 0, 0, 0, 0, 0, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 7, 7, 0, 0, 0, 0, 0, 0, 0, 8, 9, 0, 0, 0, 0, 0, 0, 0, 8, 8, 0, 0, 0, 0, 0, 0, 0,10,10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; static float _vq_quantthresh__44c1_sm_p4_0[] = { -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, }; static long _vq_quantmap__44c1_sm_p4_0[] = { 7, 5, 3, 1, 0, 2, 4, 6, 8, }; static encode_aux_threshmatch _vq_auxt__44c1_sm_p4_0 = { _vq_quantthresh__44c1_sm_p4_0, _vq_quantmap__44c1_sm_p4_0, 9, 9 }; static static_codebook _44c1_sm_p4_0 = { 2, 81, _vq_lengthlist__44c1_sm_p4_0, 1, -531628032, 1611661312, 4, 0, _vq_quantlist__44c1_sm_p4_0, NULL, &_vq_auxt__44c1_sm_p4_0, NULL, 0 }; static long _vq_quantlist__44c1_sm_p5_0[] = { 4, 3, 5, 2, 6, 1, 7, 0, 8, }; static long _vq_lengthlist__44c1_sm_p5_0[] = { 2, 3, 3, 5, 5, 6, 6, 8, 8, 0, 5, 5, 6, 6, 7, 7, 9, 9, 0, 5, 5, 6, 6, 7, 7, 9, 9, 0, 6, 6, 7, 7, 7, 7, 9, 9, 0, 0, 0, 7, 7, 7, 7, 9, 9, 0, 0, 0, 7, 7, 8, 8,10,10, 0, 0, 0, 7, 7, 8, 8,10,10, 0, 0, 0, 9, 9, 9, 9,10,10, 0, 0, 0, 0, 0, 8, 8,10, 10, }; static float _vq_quantthresh__44c1_sm_p5_0[] = { -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, }; static long _vq_quantmap__44c1_sm_p5_0[] = { 7, 5, 3, 1, 0, 2, 4, 6, 8, }; static encode_aux_threshmatch _vq_auxt__44c1_sm_p5_0 = { _vq_quantthresh__44c1_sm_p5_0, _vq_quantmap__44c1_sm_p5_0, 9, 9 }; static static_codebook _44c1_sm_p5_0 = { 2, 81, _vq_lengthlist__44c1_sm_p5_0, 1, -531628032, 1611661312, 4, 0, _vq_quantlist__44c1_sm_p5_0, NULL, &_vq_auxt__44c1_sm_p5_0, NULL, 0 }; static long _vq_quantlist__44c1_sm_p6_0[] = { 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15, 0, 16, }; static long _vq_lengthlist__44c1_sm_p6_0[] = { 2, 3, 4, 6, 6, 7, 7, 8, 8, 8, 8, 9, 9,10,10,11, 11, 0, 5, 5, 6, 6, 8, 8, 9, 9, 9, 9,10,10,10,10, 11,11, 0, 5, 5, 6, 6, 8, 8, 9, 9, 9, 9,10,10,10, 10,11,11, 0, 6, 6, 7, 7, 8, 8, 9, 9, 9, 9,10,10, 11,11,12,12, 0, 0, 0, 7, 7, 8, 8, 9, 9, 9, 9,10, 10,11,11,12,12, 0, 0, 0, 7, 7, 8, 8, 9, 9, 9, 9, 10,10,11,11,12,12, 0, 0, 0, 7, 7, 8, 8, 9, 9, 9, 9,10,10,11,11,12,12, 0, 0, 0, 8, 8, 8, 8,10,10, 10,10,11,11,12,12,12,12, 0, 0, 0, 0, 0, 8, 8,10, 10,10,10,11,11,12,12,12,12, 0, 0, 0, 0, 0, 8, 8, 9, 9,10,10,11,11,12,12,13,13, 0, 0, 0, 0, 0, 8, 8, 9, 9,10,10,11,11,12,12,13,13, 0, 0, 0, 0, 0, 9, 9,10,10,10,10,11,11,12,12,13,13, 0, 0, 0, 0, 0, 0, 0,10,10,10,10,11,11,12,12,13,13, 0, 0, 0, 0, 0, 0, 0,10,10,11,11,11,11,13,12,13,13, 0, 0, 0, 0, 0, 0, 0,10,10,11,11,11,11,13,13,13,13, 0, 0, 0, 0, 0, 0, 0,11,11,11,11,12,12,13,13,14,14, 0, 0, 0, 0, 0, 0, 0, 0, 0,11,11,12,12,13,12,14, 14, }; static float _vq_quantthresh__44c1_sm_p6_0[] = { -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, }; static long _vq_quantmap__44c1_sm_p6_0[] = { 15, 13, 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, 14, 16, }; static encode_aux_threshmatch _vq_auxt__44c1_sm_p6_0 = { _vq_quantthresh__44c1_sm_p6_0, _vq_quantmap__44c1_sm_p6_0, 17, 17 }; static static_codebook _44c1_sm_p6_0 = { 2, 289, _vq_lengthlist__44c1_sm_p6_0, 1, -529530880, 1611661312, 5, 0, _vq_quantlist__44c1_sm_p6_0, NULL, &_vq_auxt__44c1_sm_p6_0, NULL, 0 }; static long _vq_quantlist__44c1_sm_p7_0[] = { 1, 0, 2, }; static long _vq_lengthlist__44c1_sm_p7_0[] = { 1, 4, 4, 6, 6, 6, 7, 6, 6, 4, 7, 7,10, 9, 9,10, 9, 9, 5, 7, 7,10, 9, 9,10, 9, 9, 6,10,10,10,10, 10,10,10,10, 6, 9, 9,10,10,10,10, 9, 9, 6, 9, 9, 10,10,10,10,10, 9, 7,10,10,11,10,10,11,11,11, 6, 9, 9,10, 9, 9,11,10,10, 6, 9, 9,10, 9, 9,11,10, 10, }; static float _vq_quantthresh__44c1_sm_p7_0[] = { -5.5, 5.5, }; static long _vq_quantmap__44c1_sm_p7_0[] = { 1, 0, 2, }; static encode_aux_threshmatch _vq_auxt__44c1_sm_p7_0 = { _vq_quantthresh__44c1_sm_p7_0, _vq_quantmap__44c1_sm_p7_0, 3, 3 }; static static_codebook _44c1_sm_p7_0 = { 4, 81, _vq_lengthlist__44c1_sm_p7_0, 1, -529137664, 1618345984, 2, 0, _vq_quantlist__44c1_sm_p7_0, NULL, &_vq_auxt__44c1_sm_p7_0, NULL, 0 }; static long _vq_quantlist__44c1_sm_p7_1[] = { 5, 4, 6, 3, 7, 2, 8, 1, 9, 0, 10, }; static long _vq_lengthlist__44c1_sm_p7_1[] = { 2, 4, 4, 6, 6, 7, 7, 7, 7, 8, 8,10, 5, 5, 6, 6, 7, 7, 8, 8, 8, 8,10, 5, 5, 6, 6, 7, 7, 8, 8, 8, 8,10, 7, 6, 7, 7, 8, 8, 8, 8, 8, 8,10,10,10, 7, 7, 8, 8, 8, 8, 8, 8,10,10,10, 7, 7, 8, 8, 8, 8, 8, 8,10,10,10, 7, 7, 8, 8, 8, 8, 9, 8,10,10,10, 8, 8, 8, 8, 8, 8, 8, 8,10,10,10,10,10, 8, 8, 8, 8, 8, 8,10,10,10,10,10, 9, 9, 8, 8, 8, 8,10,10, 10,10,10, 8, 8, 8, 8, 8, 8, }; static float _vq_quantthresh__44c1_sm_p7_1[] = { -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, }; static long _vq_quantmap__44c1_sm_p7_1[] = { 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, }; static encode_aux_threshmatch _vq_auxt__44c1_sm_p7_1 = { _vq_quantthresh__44c1_sm_p7_1, _vq_quantmap__44c1_sm_p7_1, 11, 11 }; static static_codebook _44c1_sm_p7_1 = { 2, 121, _vq_lengthlist__44c1_sm_p7_1, 1, -531365888, 1611661312, 4, 0, _vq_quantlist__44c1_sm_p7_1, NULL, &_vq_auxt__44c1_sm_p7_1, NULL, 0 }; static long _vq_quantlist__44c1_sm_p8_0[] = { 6, 5, 7, 4, 8, 3, 9, 2, 10, 1, 11, 0, 12, }; static long _vq_lengthlist__44c1_sm_p8_0[] = { 1, 4, 4, 6, 6, 7, 7, 8, 8, 9, 9,10,10, 6, 5, 5, 7, 7, 8, 8, 8, 8, 9, 9,10,10, 7, 5, 6, 7, 7, 8, 8, 8, 8, 9, 9,11,10, 0, 8, 8, 8, 8, 9, 9, 9, 9, 10,10,11,11, 0, 8, 8, 8, 8, 9, 9, 9, 9,10,10,11, 11, 0,12,12, 9, 9, 9, 9,10,10,11,11,12,11, 0,13, 13, 9, 9, 9, 9,10,10,11,11,12,12, 0, 0, 0, 9, 9, 9, 9,10,10,11,12,12,12, 0, 0, 0,10,10, 9, 9,11, 11,12,12,13,13, 0, 0, 0,13,13,10,10,11,11,12,12, 13,13, 0, 0, 0,14,14,10,10,11,10,12,12,13,13, 0, 0, 0, 0, 0,12,11,11,11,12,12,14,13, 0, 0, 0, 0, 0,12,12,11,10,12,12,14,13, }; static float _vq_quantthresh__44c1_sm_p8_0[] = { -27.5, -22.5, -17.5, -12.5, -7.5, -2.5, 2.5, 7.5, 12.5, 17.5, 22.5, 27.5, }; static long _vq_quantmap__44c1_sm_p8_0[] = { 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, }; static encode_aux_threshmatch _vq_auxt__44c1_sm_p8_0 = { _vq_quantthresh__44c1_sm_p8_0, _vq_quantmap__44c1_sm_p8_0, 13, 13 }; static static_codebook _44c1_sm_p8_0 = { 2, 169, _vq_lengthlist__44c1_sm_p8_0, 1, -526516224, 1616117760, 4, 0, _vq_quantlist__44c1_sm_p8_0, NULL, &_vq_auxt__44c1_sm_p8_0, NULL, 0 }; static long _vq_quantlist__44c1_sm_p8_1[] = { 2, 1, 3, 0, 4, }; static long _vq_lengthlist__44c1_sm_p8_1[] = { 2, 4, 4, 4, 5, 6, 5, 5, 5, 5, 6, 5, 5, 5, 5, 6, 5, 5, 5, 5, 6, 6, 6, 5, 5, }; static float _vq_quantthresh__44c1_sm_p8_1[] = { -1.5, -0.5, 0.5, 1.5, }; static long _vq_quantmap__44c1_sm_p8_1[] = { 3, 1, 0, 2, 4, }; static encode_aux_threshmatch _vq_auxt__44c1_sm_p8_1 = { _vq_quantthresh__44c1_sm_p8_1, _vq_quantmap__44c1_sm_p8_1, 5, 5 }; static static_codebook _44c1_sm_p8_1 = { 2, 25, _vq_lengthlist__44c1_sm_p8_1, 1, -533725184, 1611661312, 3, 0, _vq_quantlist__44c1_sm_p8_1, NULL, &_vq_auxt__44c1_sm_p8_1, NULL, 0 }; static long _vq_quantlist__44c1_sm_p9_0[] = { 6, 5, 7, 4, 8, 3, 9, 2, 10, 1, 11, 0, 12, }; static long _vq_lengthlist__44c1_sm_p9_0[] = { 1, 5, 5,11,11,11,11,11,11,11,11,11,11, 4, 5, 5, 11,10,11,11,11,11,11,11,11,11, 4, 5, 4,11,11,11, 11,11,11,11,11,11,11,11, 6, 7,11, 9,11,11,11,11, 11,11,11,11,11, 6, 7, 9, 8,11,11,11,11,11,11,11, 11,11, 9, 9, 7, 8,11,11,11,11,11,11,11,11,11,10, 10, 9,10,11,11,11,11,11,11,11,11,11,11,11, 8,11, 10,10,11,11,11,11,11,11,11,11,11, 9,11,11,11,11, 11,11,11,11,11,11,11,11,11,11, 9,11,11,11,11,11, 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, 11,11,11,11,10,10,10,10,10, }; static float _vq_quantthresh__44c1_sm_p9_0[] = { -1215.5, -994.5, -773.5, -552.5, -331.5, -110.5, 110.5, 331.5, 552.5, 773.5, 994.5, 1215.5, }; static long _vq_quantmap__44c1_sm_p9_0[] = { 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, }; static encode_aux_threshmatch _vq_auxt__44c1_sm_p9_0 = { _vq_quantthresh__44c1_sm_p9_0, _vq_quantmap__44c1_sm_p9_0, 13, 13 }; static static_codebook _44c1_sm_p9_0 = { 2, 169, _vq_lengthlist__44c1_sm_p9_0, 1, -514541568, 1627103232, 4, 0, _vq_quantlist__44c1_sm_p9_0, NULL, &_vq_auxt__44c1_sm_p9_0, NULL, 0 }; static long _vq_quantlist__44c1_sm_p9_1[] = { 6, 5, 7, 4, 8, 3, 9, 2, 10, 1, 11, 0, 12, }; static long _vq_lengthlist__44c1_sm_p9_1[] = { 1, 4, 4, 6, 6, 7, 7,10,10,12,12,13,13, 6, 5, 5, 7, 7, 8, 8,10,10,12,12,14,13, 6, 5, 5, 7, 7, 8, 8,10,10,12,12,13,13,16, 7, 7, 7, 7, 9, 9,11,11, 13,14,13,15,18, 7, 6, 8, 7, 9, 9,11,10,12,12,14, 12,19,10,10, 8, 8,10,10,12,11,13,15,15,15,17,11, 11, 8, 7,11,10,12,12,13,13,14,15,16,17,17,10,11, 10,10,13,13,14,13,16,15,17,17,16,10,10,11,11,14, 14,16,13,14,14,17,19,17,15,14,11,11,13,13,15,14, 16,15,17,16,17,14,14,11,11,14,13,14,14,14,15,17, 16,16,16,17,13,13,13,13,16,14,17,15,16,17,18,18, 17,13,13,13,13,15,15,16,16, }; static float _vq_quantthresh__44c1_sm_p9_1[] = { -93.5, -76.5, -59.5, -42.5, -25.5, -8.5, 8.5, 25.5, 42.5, 59.5, 76.5, 93.5, }; static long _vq_quantmap__44c1_sm_p9_1[] = { 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, }; static encode_aux_threshmatch _vq_auxt__44c1_sm_p9_1 = { _vq_quantthresh__44c1_sm_p9_1, _vq_quantmap__44c1_sm_p9_1, 13, 13 }; static static_codebook _44c1_sm_p9_1 = { 2, 169, _vq_lengthlist__44c1_sm_p9_1, 1, -522616832, 1620115456, 4, 0, _vq_quantlist__44c1_sm_p9_1, NULL, &_vq_auxt__44c1_sm_p9_1, NULL, 0 }; static long _vq_quantlist__44c1_sm_p9_2[] = { 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15, 0, 16, }; static long _vq_lengthlist__44c1_sm_p9_2[] = { 2, 5, 5, 6, 6, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9,10, 6, 6, 7, 7, 8, 7, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9,10, 6, 6, 7, 7, 7, 7, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9,10, 7, 7, 7, 7, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9,10,10,10, 7, 7, 8, 8, 9, 8, 9, 9, 9, 9, 9, 9, 9, 9,11,11,11, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,10,10,10, 7, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9,10, 9,10,10,10, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,10,10,10,10,11,11, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9,10, 9,10,11,10,11,11, 9, 9, 9, 9, 9, 9, 9,10,10, 9, 9, 9,10,11,10,11,11, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,10,10,10,11,11, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,10, 9,10,11,10,11, 11,10,11, 9, 9, 9, 9, 9, 9, 9, 9, 9,10,10,10,10, 11,11,11,11, 9,10,10,10, 9, 9, 9, 9,10, 9,10,10, 10,11,11,11,10,10,10, 9, 9, 9, 9, 9, 9, 9, 9,10, 11,10,11,10,11,10,10,10, 9, 9, 9, 9, 9, 9, 9, 9, 10,10,10,11,11,10,10,10,11, 9, 9, 9, 9, 9, 9, 9, 9, }; static float _vq_quantthresh__44c1_sm_p9_2[] = { -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, }; static long _vq_quantmap__44c1_sm_p9_2[] = { 15, 13, 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, 14, 16, }; static encode_aux_threshmatch _vq_auxt__44c1_sm_p9_2 = { _vq_quantthresh__44c1_sm_p9_2, _vq_quantmap__44c1_sm_p9_2, 17, 17 }; static static_codebook _44c1_sm_p9_2 = { 2, 289, _vq_lengthlist__44c1_sm_p9_2, 1, -529530880, 1611661312, 5, 0, _vq_quantlist__44c1_sm_p9_2, NULL, &_vq_auxt__44c1_sm_p9_2, NULL, 0 }; static long _huff_lengthlist__44c1_sm_short[] = { 4, 7,13,13,13,13,14,16,16,19, 4, 2,13, 5, 8, 7, 9,12,14,13,16, 9,10,10, 9,10,11,13,17,19, 9, 4, 13, 5,10, 6, 8,11,15,15,11, 6, 9, 7, 6, 6, 8,11, 14,18,11, 5, 9, 6, 6, 5, 6, 9,13,15,12, 6, 9, 7, 6, 5, 5, 8,12,15,13, 7,10, 8, 6, 6, 7, 9,12,13, 13, 9,11, 9, 6, 5, 6, 8,11,13,13,11,13,11, 7, 6, 7, 8,10,12, }; static static_codebook _huff_book__44c1_sm_short = { 2, 100, _huff_lengthlist__44c1_sm_short, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _huff_lengthlist__44c2_s_long[] = { 5, 5,12,10,11,10,10,10,11,13, 5, 1, 9, 5, 8, 7, 8,10,13,13,12, 9, 8,11, 7, 8, 9,11,13,15, 9, 5, 12, 6, 9, 8,10,12,15,14,12, 7, 6, 8, 5, 6, 7,10, 12,13,10, 7, 8, 7, 6, 6, 7, 9,12,12,10, 8, 9, 9, 7, 6, 6, 7,10,11,10, 9,10,11, 9, 8, 6, 6, 8,11, 10,12,13,15,11,10, 8, 7, 8,11,11,13,16,16,14,13, 11, 9, 9,10, }; static static_codebook _huff_book__44c2_s_long = { 2, 100, _huff_lengthlist__44c2_s_long, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _vq_quantlist__44c2_s_p1_0[] = { 1, 0, 2, }; static long _vq_lengthlist__44c2_s_p1_0[] = { 2, 4, 4, 0, 0, 0, 0, 0, 0, 5, 7, 6, 0, 0, 0, 0, 0, 0, 5, 6, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 7, 7, 0, 0, 0, 0, 0, 0, 7, 8, 8, 0, 0, 0, 0, 0, 0, 7, 8, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 7, 7, 0, 0, 0, 0, 0, 0, 7, 8, 8, 0, 0, 0, 0, 0, 0, 7, 8, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; static float _vq_quantthresh__44c2_s_p1_0[] = { -0.5, 0.5, }; static long _vq_quantmap__44c2_s_p1_0[] = { 1, 0, 2, }; static encode_aux_threshmatch _vq_auxt__44c2_s_p1_0 = { _vq_quantthresh__44c2_s_p1_0, _vq_quantmap__44c2_s_p1_0, 3, 3 }; static static_codebook _44c2_s_p1_0 = { 8, 6561, _vq_lengthlist__44c2_s_p1_0, 1, -535822336, 1611661312, 2, 0, _vq_quantlist__44c2_s_p1_0, NULL, &_vq_auxt__44c2_s_p1_0, NULL, 0 }; static long _vq_quantlist__44c2_s_p2_0[] = { 2, 1, 3, 0, 4, }; static long _vq_lengthlist__44c2_s_p2_0[] = { 1, 4, 4, 0, 0, 0, 7, 7, 0, 0, 0, 7, 7, 0, 0, 0, 7, 7, 0, 0, 0, 0, 0, 0, 0, 4, 6, 6, 0, 0, 0, 8, 8, 0, 0,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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 9, 9, 0, 0, 0,11,12, 0, 0, 0,11,12, 0, 0, 0, 12,11, 0, 0, 0, 0, 0, 0, 0, 7, 9, 9, 0, 0, 0,12, 11, 0, 0, 0,11,11, 0, 0, 0,11,11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; static float _vq_quantthresh__44c2_s_p2_0[] = { -1.5, -0.5, 0.5, 1.5, }; static long _vq_quantmap__44c2_s_p2_0[] = { 3, 1, 0, 2, 4, }; static encode_aux_threshmatch _vq_auxt__44c2_s_p2_0 = { _vq_quantthresh__44c2_s_p2_0, _vq_quantmap__44c2_s_p2_0, 5, 5 }; static static_codebook _44c2_s_p2_0 = { 4, 625, _vq_lengthlist__44c2_s_p2_0, 1, -533725184, 1611661312, 3, 0, _vq_quantlist__44c2_s_p2_0, NULL, &_vq_auxt__44c2_s_p2_0, NULL, 0 }; static long _vq_quantlist__44c2_s_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 = { _vq_quantthresh__44c2_s_p3_0, _vq_quantmap__44c2_s_p3_0, 5, 5 }; static static_codebook _44c2_s_p3_0 = { 4, 625, _vq_lengthlist__44c2_s_p3_0, 1, -533725184, 1611661312, 3, 0, _vq_quantlist__44c2_s_p3_0, NULL, &_vq_auxt__44c2_s_p3_0, NULL, 0 }; static long _vq_quantlist__44c2_s_p4_0[] = { 4, 3, 5, 2, 6, 1, 7, 0, 8, }; static long _vq_lengthlist__44c2_s_p4_0[] = { 1, 3, 3, 6, 6, 0, 0, 0, 0, 0, 6, 6, 6, 6, 0, 0, 0, 0, 0, 6, 6, 6, 6, 0, 0, 0, 0, 0, 6, 6, 7, 7, 0, 0, 0, 0, 0, 0, 0, 7, 7, 0, 0, 0, 0, 0, 0, 0, 7, 8, 0, 0, 0, 0, 0, 0, 0, 7, 7, 0, 0, 0, 0, 0, 0, 0, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; static float _vq_quantthresh__44c2_s_p4_0[] = { -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, }; static long _vq_quantmap__44c2_s_p4_0[] = { 7, 5, 3, 1, 0, 2, 4, 6, 8, }; static encode_aux_threshmatch _vq_auxt__44c2_s_p4_0 = { _vq_quantthresh__44c2_s_p4_0, _vq_quantmap__44c2_s_p4_0, 9, 9 }; static static_codebook _44c2_s_p4_0 = { 2, 81, _vq_lengthlist__44c2_s_p4_0, 1, -531628032, 1611661312, 4, 0, _vq_quantlist__44c2_s_p4_0, NULL, &_vq_auxt__44c2_s_p4_0, NULL, 0 }; static long _vq_quantlist__44c2_s_p5_0[] = { 4, 3, 5, 2, 6, 1, 7, 0, 8, }; static long _vq_lengthlist__44c2_s_p5_0[] = { 1, 3, 3, 6, 6, 6, 6, 8, 8, 0, 7, 7, 7, 7, 8, 8, 9, 9, 0, 7, 7, 7, 7, 8, 8, 9, 9, 0, 7, 7, 8, 7, 8, 8,10,10, 0, 0, 0, 8, 8, 8, 8,10,10, 0, 0, 0, 8, 8, 9, 9,10,10, 0, 0, 0, 8, 8, 9, 9,10,10, 0, 0, 0,10,10, 9, 9,11,11, 0, 0, 0, 0, 0, 9, 9,11, 11, }; static float _vq_quantthresh__44c2_s_p5_0[] = { -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, }; static long _vq_quantmap__44c2_s_p5_0[] = { 7, 5, 3, 1, 0, 2, 4, 6, 8, }; static encode_aux_threshmatch _vq_auxt__44c2_s_p5_0 = { _vq_quantthresh__44c2_s_p5_0, _vq_quantmap__44c2_s_p5_0, 9, 9 }; static static_codebook _44c2_s_p5_0 = { 2, 81, _vq_lengthlist__44c2_s_p5_0, 1, -531628032, 1611661312, 4, 0, _vq_quantlist__44c2_s_p5_0, NULL, &_vq_auxt__44c2_s_p5_0, NULL, 0 }; static long _vq_quantlist__44c2_s_p6_0[] = { 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15, 0, 16, }; static long _vq_lengthlist__44c2_s_p6_0[] = { 1, 4, 4, 6, 6, 7, 7, 8, 8, 8, 8, 9, 9,10,10,11, 11, 0, 7, 7, 7, 7, 8, 8, 9, 9, 9, 9,10,10,10,10, 11,11, 0, 7, 7, 7, 7, 8, 8, 9, 9, 9, 9,10,10,10, 10,11,11, 0, 7, 7, 7, 7, 8, 8, 9, 9, 9, 9,10,10, 11,11,11,11, 0, 0, 0, 7, 7, 8, 8, 9, 9, 9, 9,10, 10,11,11,12,12, 0, 0, 0, 8, 8, 9, 9, 9, 9, 9, 9, 10,10,11,11,12,12, 0, 0, 0, 8, 8, 9, 9, 9, 9, 9, 9,10,11,11,11,12,12, 0, 0, 0, 9, 9, 9, 9,10,10, 10,10,11,11,11,12,12,12, 0, 0, 0, 0, 0, 9, 9,10, 10,10,10,11,11,12,12,12,12, 0, 0, 0, 0, 0, 9, 9, 9, 9,10,10,11,11,12,12,12,12, 0, 0, 0, 0, 0, 9, 9, 9, 9,10,10,11,11,12,12,12,13, 0, 0, 0, 0, 0, 10,10,10,10,10,11,11,11,12,12,13,13, 0, 0, 0, 0, 0, 0, 0,10,10,10,10,11,11,12,12,13,13, 0, 0, 0, 0, 0, 0, 0,11,11,11,11,12,12,12,12,13,13, 0, 0, 0, 0, 0, 0, 0,11,11,11,11,12,11,12,12,13,13, 0, 0, 0, 0, 0, 0, 0,11,11,11,11,12,12,13,12,14,13, 0, 0, 0, 0, 0, 0, 0, 0, 0,11,11,12,12,12,13,13, 14, }; static float _vq_quantthresh__44c2_s_p6_0[] = { -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, }; static long _vq_quantmap__44c2_s_p6_0[] = { 15, 13, 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, 14, 16, }; static encode_aux_threshmatch _vq_auxt__44c2_s_p6_0 = { _vq_quantthresh__44c2_s_p6_0, _vq_quantmap__44c2_s_p6_0, 17, 17 }; static static_codebook _44c2_s_p6_0 = { 2, 289, _vq_lengthlist__44c2_s_p6_0, 1, -529530880, 1611661312, 5, 0, _vq_quantlist__44c2_s_p6_0, NULL, &_vq_auxt__44c2_s_p6_0, NULL, 0 }; static long _vq_quantlist__44c2_s_p7_0[] = { 1, 0, 2, }; static long _vq_lengthlist__44c2_s_p7_0[] = { 1, 4, 4, 6, 6, 6, 7, 6, 6, 4, 7, 7,10, 9, 9,10, 9, 9, 5, 7, 7,10, 9, 9,10, 9, 9, 6,10, 9,10,10, 10,11,10,10, 6, 9, 9,10,10,10,11, 9, 9, 6, 9, 9, 10,10,10,11, 9, 9, 7,10,10,11,10,10,11,11,10, 6, 9, 9,10, 9, 9,11,10,10, 6, 9, 9,10, 9,10,11,10, 10, }; static float _vq_quantthresh__44c2_s_p7_0[] = { -5.5, 5.5, }; static long _vq_quantmap__44c2_s_p7_0[] = { 1, 0, 2, }; static encode_aux_threshmatch _vq_auxt__44c2_s_p7_0 = { _vq_quantthresh__44c2_s_p7_0, _vq_quantmap__44c2_s_p7_0, 3, 3 }; static static_codebook _44c2_s_p7_0 = { 4, 81, _vq_lengthlist__44c2_s_p7_0, 1, -529137664, 1618345984, 2, 0, _vq_quantlist__44c2_s_p7_0, NULL, &_vq_auxt__44c2_s_p7_0, NULL, 0 }; static long _vq_quantlist__44c2_s_p7_1[] = { 5, 4, 6, 3, 7, 2, 8, 1, 9, 0, 10, }; static long _vq_lengthlist__44c2_s_p7_1[] = { 2, 4, 4, 6, 6, 7, 7, 7, 7, 7, 7,10, 6, 6, 6, 6, 7, 7, 8, 7, 8, 8, 9, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7,10, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8,10, 9, 9, 6, 6, 7, 7, 8, 8, 8, 8,10,10,10, 7, 7, 8, 8, 8, 8, 8, 8,10,10,10, 7, 7, 8, 8, 8, 8, 8, 8,10,10,10, 8, 8, 8, 8, 8, 8, 8, 8,10,10,10,10, 9, 8, 8, 8, 8, 8, 8,10,10,10, 9,10, 8, 8, 8, 8, 8, 8,10,10, 10,10, 9, 8, 8, 8, 8, 8, 8, }; static float _vq_quantthresh__44c2_s_p7_1[] = { -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, }; static long _vq_quantmap__44c2_s_p7_1[] = { 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, }; static encode_aux_threshmatch _vq_auxt__44c2_s_p7_1 = { _vq_quantthresh__44c2_s_p7_1, _vq_quantmap__44c2_s_p7_1, 11, 11 }; static static_codebook _44c2_s_p7_1 = { 2, 121, _vq_lengthlist__44c2_s_p7_1, 1, -531365888, 1611661312, 4, 0, _vq_quantlist__44c2_s_p7_1, NULL, &_vq_auxt__44c2_s_p7_1, NULL, 0 }; static long _vq_quantlist__44c2_s_p8_0[] = { 6, 5, 7, 4, 8, 3, 9, 2, 10, 1, 11, 0, 12, }; static long _vq_lengthlist__44c2_s_p8_0[] = { 1, 4, 4, 6, 6, 7, 7, 8, 8, 9, 9,10,10, 6, 5, 5, 7, 7, 8, 8, 9, 8, 9, 9,10,10, 7, 5, 5, 7, 7, 8, 8, 8, 9,10, 9,11,11, 0, 8, 8, 8, 8, 9, 9, 9, 9, 10,10,11,11, 0, 8, 8, 8, 8, 9, 9, 9,10,10,10,11, 11, 0,12,12, 9, 9,10,10,10,10,11,11,12,12, 0,13, 12, 9, 9,10, 9,10,10,11,11,11,12, 0, 0, 0,10,10, 10,10,11,11,11,11,12,12, 0, 0, 0,10,10, 9, 9,11, 11,12,12,12,13, 0, 0, 0,13,13,10,10,11,11,12,12, 13,13, 0, 0, 0,14,14,10,10,11,11,12,12,13,13, 0, 0, 0, 0, 0,12,12,11,12,12,12,14,13, 0, 0, 0, 0, 0,12,12,12,12,12,12,14,13, }; static float _vq_quantthresh__44c2_s_p8_0[] = { -27.5, -22.5, -17.5, -12.5, -7.5, -2.5, 2.5, 7.5, 12.5, 17.5, 22.5, 27.5, }; static long _vq_quantmap__44c2_s_p8_0[] = { 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, }; static encode_aux_threshmatch _vq_auxt__44c2_s_p8_0 = { _vq_quantthresh__44c2_s_p8_0, _vq_quantmap__44c2_s_p8_0, 13, 13 }; static static_codebook _44c2_s_p8_0 = { 2, 169, _vq_lengthlist__44c2_s_p8_0, 1, -526516224, 1616117760, 4, 0, _vq_quantlist__44c2_s_p8_0, NULL, &_vq_auxt__44c2_s_p8_0, NULL, 0 }; static long _vq_quantlist__44c2_s_p8_1[] = { 2, 1, 3, 0, 4, }; static long _vq_lengthlist__44c2_s_p8_1[] = { 2, 4, 4, 4, 5, 6, 5, 5, 5, 5, 6, 5, 5, 5, 5, 6, 5, 5, 5, 5, 6, 6, 6, 5, 5, }; static float _vq_quantthresh__44c2_s_p8_1[] = { -1.5, -0.5, 0.5, 1.5, }; static long _vq_quantmap__44c2_s_p8_1[] = { 3, 1, 0, 2, 4, }; static encode_aux_threshmatch _vq_auxt__44c2_s_p8_1 = { _vq_quantthresh__44c2_s_p8_1, _vq_quantmap__44c2_s_p8_1, 5, 5 }; static static_codebook _44c2_s_p8_1 = { 2, 25, _vq_lengthlist__44c2_s_p8_1, 1, -533725184, 1611661312, 3, 0, _vq_quantlist__44c2_s_p8_1, NULL, &_vq_auxt__44c2_s_p8_1, NULL, 0 }; static long _vq_quantlist__44c2_s_p9_0[] = { 6, 5, 7, 4, 8, 3, 9, 2, 10, 1, 11, 0, 12, }; static long _vq_lengthlist__44c2_s_p9_0[] = { 1, 5, 4,10,10, 9, 9, 9, 9, 9, 9, 9, 9, 5, 7, 7, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 5, 9, 6, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, }; static float _vq_quantthresh__44c2_s_p9_0[] = { -1215.5, -994.5, -773.5, -552.5, -331.5, -110.5, 110.5, 331.5, 552.5, 773.5, 994.5, 1215.5, }; static long _vq_quantmap__44c2_s_p9_0[] = { 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, }; static encode_aux_threshmatch _vq_auxt__44c2_s_p9_0 = { _vq_quantthresh__44c2_s_p9_0, _vq_quantmap__44c2_s_p9_0, 13, 13 }; static static_codebook _44c2_s_p9_0 = { 2, 169, _vq_lengthlist__44c2_s_p9_0, 1, -514541568, 1627103232, 4, 0, _vq_quantlist__44c2_s_p9_0, NULL, &_vq_auxt__44c2_s_p9_0, NULL, 0 }; static long _vq_quantlist__44c2_s_p9_1[] = { 6, 5, 7, 4, 8, 3, 9, 2, 10, 1, 11, 0, 12, }; static long _vq_lengthlist__44c2_s_p9_1[] = { 1, 4, 4, 6, 6, 7, 7, 9, 9,11,11,12,12, 6, 5, 5, 7, 7, 8, 8,10,10,12,11,13,13, 6, 5, 5, 7, 7, 8, 8, 9, 9,11,11,12,13,16, 7, 7, 8, 8, 9, 9,10,10, 13,13,16,14,16, 7, 7, 8, 8, 9, 9,10,10,13,13,15, 13,16,10,10, 8, 8,10,10,11,11,12,12,15,14,16,11, 11, 8, 8,10,10,11,11,12,12,14,13,16,16,16,10,11, 10,10,12,12,14,13,13,13,16,16,16,10, 9,10, 7,13, 12,13,13,13,13,16,16,16,14,15,11,11,12,12,13,13, 15,14,16,16,16,16,14,11, 9,12, 9,15,13,13,14,16, 16,16,16,16,13,13,12,12,14,15,16,15,16,16,15,16, 16,13,12,12,11,15,13,14,15, }; static float _vq_quantthresh__44c2_s_p9_1[] = { -93.5, -76.5, -59.5, -42.5, -25.5, -8.5, 8.5, 25.5, 42.5, 59.5, 76.5, 93.5, }; static long _vq_quantmap__44c2_s_p9_1[] = { 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, }; static encode_aux_threshmatch _vq_auxt__44c2_s_p9_1 = { _vq_quantthresh__44c2_s_p9_1, _vq_quantmap__44c2_s_p9_1, 13, 13 }; static static_codebook _44c2_s_p9_1 = { 2, 169, _vq_lengthlist__44c2_s_p9_1, 1, -522616832, 1620115456, 4, 0, _vq_quantlist__44c2_s_p9_1, NULL, &_vq_auxt__44c2_s_p9_1, NULL, 0 }; static long _vq_quantlist__44c2_s_p9_2[] = { 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15, 0, 16, }; static long _vq_lengthlist__44c2_s_p9_2[] = { 2, 5, 5, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 9, 9,10, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9,10, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9,10, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9,10,10,10, 7, 7, 8, 8, 9, 8, 9, 9, 9, 9, 9, 9, 9, 9,10,11,10, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,10,10,10, 7, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,10,11,11, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,10,10,10,10,10, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9,10,11,11,10,11,10, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,10,10,10,11,10, 9, 9, 9, 9, 9, 9, 9, 9,10, 9,10,10,10,10,10,11,11, 9, 9, 9, 9, 9, 9, 9, 9,10, 9, 9, 9,11,10,10,11, 10,10,11, 9, 9,10,10, 9, 9,10,10, 9, 9,10,10,10, 11,10,11,10,10, 9, 9,10, 9, 9, 9, 9, 9, 9,10,10, 10,10,11,10,10, 9,10, 9, 9, 9, 9,10, 9, 9, 9,10, 10,10,11,11,10,10,10,10, 9, 9,10, 9, 9, 9,10, 9, 10,10,10,10,11,10,11,11,10, 9, 9, 9, 9, 9, 9, 9, 10, }; static float _vq_quantthresh__44c2_s_p9_2[] = { -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, }; static long _vq_quantmap__44c2_s_p9_2[] = { 15, 13, 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, 14, 16, }; static encode_aux_threshmatch _vq_auxt__44c2_s_p9_2 = { _vq_quantthresh__44c2_s_p9_2, _vq_quantmap__44c2_s_p9_2, 17, 17 }; static static_codebook _44c2_s_p9_2 = { 2, 289, _vq_lengthlist__44c2_s_p9_2, 1, -529530880, 1611661312, 5, 0, _vq_quantlist__44c2_s_p9_2, NULL, &_vq_auxt__44c2_s_p9_2, NULL, 0 }; static long _huff_lengthlist__44c2_s_short[] = { 9, 9,12,11,11,11,12,12,12,13, 6, 2, 9, 4, 7, 6, 8,11,15,17,12, 7, 8, 9, 7, 9,10,13,15,17,11, 4, 12, 4, 9, 5, 8,11,16,17,12, 6, 7, 6, 6, 6, 8,11, 15,17,11, 5, 9, 5, 6, 5, 6,10,15,15,12, 7,11, 7, 7, 6, 7,10,13,16,13, 8,11, 9, 8, 6, 7,10,12,16, 13, 9, 9, 8, 5, 5, 6, 9,12,14,16,10, 9, 9, 6, 5, 6, 8,11,14, }; static static_codebook _huff_book__44c2_s_short = { 2, 100, _huff_lengthlist__44c2_s_short, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _huff_lengthlist__44c3_s_long[] = { 4, 5,11,10,12,10,10,10,11,12, 4, 2,11, 5,11, 6, 7, 9,13,16,11,11, 7,11, 6, 8, 8, 9,11,12,10, 5, 11, 6,10, 7, 9,11,16,16,14, 9, 6, 9, 4, 5, 7, 8, 11,13,10, 6, 7, 7, 5, 5, 6, 8,10,11,10, 7, 8, 8, 6, 6, 5, 7, 9,10,10, 9, 8,11, 8, 7, 6, 6, 7,10, 10,12,10,14, 9, 9, 7, 7, 7, 9,10,14,11,16,12,12, 9, 8, 8, 9, }; static static_codebook _huff_book__44c3_s_long = { 2, 100, _huff_lengthlist__44c3_s_long, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _vq_quantlist__44c3_s_p1_0[] = { 1, 0, 2, }; static long _vq_lengthlist__44c3_s_p1_0[] = { 2, 4, 4, 0, 0, 0, 0, 0, 0, 5,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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; static float _vq_quantthresh__44c3_s_p1_0[] = { -0.5, 0.5, }; static long _vq_quantmap__44c3_s_p1_0[] = { 1, 0, 2, }; static encode_aux_threshmatch _vq_auxt__44c3_s_p1_0 = { _vq_quantthresh__44c3_s_p1_0, _vq_quantmap__44c3_s_p1_0, 3, 3 }; static static_codebook _44c3_s_p1_0 = { 8, 6561, _vq_lengthlist__44c3_s_p1_0, 1, -535822336, 1611661312, 2, 0, _vq_quantlist__44c3_s_p1_0, NULL, &_vq_auxt__44c3_s_p1_0, NULL, 0 }; static long _vq_quantlist__44c3_s_p2_0[] = { 2, 1, 3, 0, 4, }; static long _vq_lengthlist__44c3_s_p2_0[] = { 2, 5, 5, 0, 0, 0, 5, 5, 0, 0, 0, 5, 5, 0, 0, 0, 8, 7, 0, 0, 0, 0, 0, 0, 0, 5, 6, 6, 0, 0, 0, 8, 7, 0, 0, 0, 7, 7, 0, 0, 0,10, 9, 0, 0, 0, 0, 0, 0, 0, 5, 5, 6, 0, 0, 0, 7, 8, 0, 0, 0, 7, 7, 0, 0, 0, 9,10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 7, 7, 0, 0, 0, 7, 7, 0, 0, 0, 7,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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; static float _vq_quantthresh__44c3_s_p2_0[] = { -1.5, -0.5, 0.5, 1.5, }; static long _vq_quantmap__44c3_s_p2_0[] = { 3, 1, 0, 2, 4, }; static encode_aux_threshmatch _vq_auxt__44c3_s_p2_0 = { _vq_quantthresh__44c3_s_p2_0, _vq_quantmap__44c3_s_p2_0, 5, 5 }; static static_codebook _44c3_s_p2_0 = { 4, 625, _vq_lengthlist__44c3_s_p2_0, 1, -533725184, 1611661312, 3, 0, _vq_quantlist__44c3_s_p2_0, NULL, &_vq_auxt__44c3_s_p2_0, NULL, 0 }; static long _vq_quantlist__44c3_s_p3_0[] = { 2, 1, 3, 0, 4, }; static long _vq_lengthlist__44c3_s_p3_0[] = { 2, 3, 4, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 6, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 6, 6, 8, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; static float _vq_quantthresh__44c3_s_p3_0[] = { -1.5, -0.5, 0.5, 1.5, }; static long _vq_quantmap__44c3_s_p3_0[] = { 3, 1, 0, 2, 4, }; static encode_aux_threshmatch _vq_auxt__44c3_s_p3_0 = { _vq_quantthresh__44c3_s_p3_0, _vq_quantmap__44c3_s_p3_0, 5, 5 }; static static_codebook _44c3_s_p3_0 = { 4, 625, _vq_lengthlist__44c3_s_p3_0, 1, -533725184, 1611661312, 3, 0, _vq_quantlist__44c3_s_p3_0, NULL, &_vq_auxt__44c3_s_p3_0, NULL, 0 }; static long _vq_quantlist__44c3_s_p4_0[] = { 4, 3, 5, 2, 6, 1, 7, 0, 8, }; static long _vq_lengthlist__44c3_s_p4_0[] = { 2, 3, 3, 6, 6, 0, 0, 0, 0, 0, 4, 4, 6, 6, 0, 0, 0, 0, 0, 4, 4, 6, 6, 0, 0, 0, 0, 0, 5, 5, 6, 6, 0, 0, 0, 0, 0, 0, 0, 6, 6, 0, 0, 0, 0, 0, 0, 0, 7, 7, 0, 0, 0, 0, 0, 0, 0, 8, 7, 0, 0, 0, 0, 0, 0, 0, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; static float _vq_quantthresh__44c3_s_p4_0[] = { -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, }; static long _vq_quantmap__44c3_s_p4_0[] = { 7, 5, 3, 1, 0, 2, 4, 6, 8, }; static encode_aux_threshmatch _vq_auxt__44c3_s_p4_0 = { _vq_quantthresh__44c3_s_p4_0, _vq_quantmap__44c3_s_p4_0, 9, 9 }; static static_codebook _44c3_s_p4_0 = { 2, 81, _vq_lengthlist__44c3_s_p4_0, 1, -531628032, 1611661312, 4, 0, _vq_quantlist__44c3_s_p4_0, NULL, &_vq_auxt__44c3_s_p4_0, NULL, 0 }; static long _vq_quantlist__44c3_s_p5_0[] = { 4, 3, 5, 2, 6, 1, 7, 0, 8, }; static long _vq_lengthlist__44c3_s_p5_0[] = { 2, 3, 3, 5, 5, 7, 7, 9, 8, 0, 4, 4, 7, 7, 7, 7, 9, 9, 0, 5, 5, 6, 7, 7, 7, 9, 9, 0, 6, 6, 7, 7, 7, 7, 9, 9, 0, 0, 0, 7, 7, 7, 7, 9, 9, 0, 0, 0, 8, 8, 8, 8,10,10, 0, 0, 0, 8, 8, 8, 8,10,10, 0, 0, 0,10,10, 9, 9,10,10, 0, 0, 0, 0, 0, 9, 9,10, 10, }; static float _vq_quantthresh__44c3_s_p5_0[] = { -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, }; static long _vq_quantmap__44c3_s_p5_0[] = { 7, 5, 3, 1, 0, 2, 4, 6, 8, }; static encode_aux_threshmatch _vq_auxt__44c3_s_p5_0 = { _vq_quantthresh__44c3_s_p5_0, _vq_quantmap__44c3_s_p5_0, 9, 9 }; static static_codebook _44c3_s_p5_0 = { 2, 81, _vq_lengthlist__44c3_s_p5_0, 1, -531628032, 1611661312, 4, 0, _vq_quantlist__44c3_s_p5_0, NULL, &_vq_auxt__44c3_s_p5_0, NULL, 0 }; static long _vq_quantlist__44c3_s_p6_0[] = { 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15, 0, 16, }; static long _vq_lengthlist__44c3_s_p6_0[] = { 2, 3, 3, 6, 6, 7, 7, 8, 8, 8, 8, 9, 9,10,10,11, 11, 0, 5, 5, 7, 7, 8, 8, 9, 9, 9, 9,10,10,11,11, 11,11, 0, 5, 5, 7, 7, 8, 8, 9, 9, 9, 9,10,10,11, 11,11,11, 0, 6, 6, 7, 7, 8, 8, 9, 9, 9, 9,10,10, 11,11,12,12, 0, 0, 0, 7, 7, 8, 8, 9, 9, 9, 9,10, 10,11,11,12,12, 0, 0, 0, 8, 8, 8, 8, 9, 9,10, 9, 10,10,11,11,12,12, 0, 0, 0, 8, 8, 8, 8, 9, 9,10, 9,10,10,11,11,12,12, 0, 0, 0, 9, 9, 9, 9,10,10, 10,10,11,11,12,11,12,12, 0, 0, 0, 0, 0, 9, 9,10, 10,10,10,11,11,12,12,12,12, 0, 0, 0, 0, 0, 8, 8, 9, 9,10,10,11,11,12,12,12,12, 0, 0, 0, 0, 0, 8, 8, 9, 9,10,10,11,11,12,12,13,12, 0, 0, 0, 0, 0, 9, 9,10,10,11,10,11,11,12,12,13,13, 0, 0, 0, 0, 0, 0, 0,10,10,10,10,11,11,12,12,13,13, 0, 0, 0, 0, 0, 0, 0,10,10,11,11,12,12,12,12,13,13, 0, 0, 0, 0, 0, 0, 0,10,10,11,11,11,11,12,12,13,13, 0, 0, 0, 0, 0, 0, 0,11,11,12,12,12,12,12,13,13,13, 0, 0, 0, 0, 0, 0, 0, 0, 0,11,11,12,12,12,12,13, 13, }; static float _vq_quantthresh__44c3_s_p6_0[] = { -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, }; static long _vq_quantmap__44c3_s_p6_0[] = { 15, 13, 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, 14, 16, }; static encode_aux_threshmatch _vq_auxt__44c3_s_p6_0 = { _vq_quantthresh__44c3_s_p6_0, _vq_quantmap__44c3_s_p6_0, 17, 17 }; static static_codebook _44c3_s_p6_0 = { 2, 289, _vq_lengthlist__44c3_s_p6_0, 1, -529530880, 1611661312, 5, 0, _vq_quantlist__44c3_s_p6_0, NULL, &_vq_auxt__44c3_s_p6_0, NULL, 0 }; static long _vq_quantlist__44c3_s_p7_0[] = { 1, 0, 2, }; static long _vq_lengthlist__44c3_s_p7_0[] = { 1, 4, 4, 6, 6, 6, 7, 6, 6, 4, 7, 7,10, 9, 9,10, 9, 9, 5, 7, 7,10, 9, 9,10, 9, 9, 6,10,10,10,10, 10,11,10,10, 6, 9, 9,10,10,10,10, 9, 9, 6, 9, 9, 10,10,10,10, 9, 9, 7,10,10,10,11,11,11,10,11, 6, 9, 9,10,10, 9,11,10,10, 6, 9, 9,10, 9, 9,10,10, 10, }; static float _vq_quantthresh__44c3_s_p7_0[] = { -5.5, 5.5, }; static long _vq_quantmap__44c3_s_p7_0[] = { 1, 0, 2, }; static encode_aux_threshmatch _vq_auxt__44c3_s_p7_0 = { _vq_quantthresh__44c3_s_p7_0, _vq_quantmap__44c3_s_p7_0, 3, 3 }; static static_codebook _44c3_s_p7_0 = { 4, 81, _vq_lengthlist__44c3_s_p7_0, 1, -529137664, 1618345984, 2, 0, _vq_quantlist__44c3_s_p7_0, NULL, &_vq_auxt__44c3_s_p7_0, NULL, 0 }; static long _vq_quantlist__44c3_s_p7_1[] = { 5, 4, 6, 3, 7, 2, 8, 1, 9, 0, 10, }; static long _vq_lengthlist__44c3_s_p7_1[] = { 2, 4, 4, 6, 6, 7, 7, 8, 8, 8, 8,10, 5, 5, 6, 6, 7, 7, 8, 8, 8, 8,10, 5, 5, 6, 6, 7, 7, 8, 8, 8, 8,10, 6, 6, 7, 7, 8, 8, 8, 8, 8, 8,10,10,10, 7, 7, 8, 8, 8, 8, 8, 8,10,10,10, 7, 7, 8, 8, 8, 8, 8, 8,10,10,10, 7, 7, 8, 8, 8, 8, 8, 8,10,10,10, 8, 8, 8, 8, 8, 8, 8, 8,10,10,10,10,10, 8, 8, 8, 8, 8, 8,10,10,10,10,10, 9, 9, 8, 8, 8, 8,10,10, 10,10,10, 8, 8, 8, 8, 8, 9, }; static float _vq_quantthresh__44c3_s_p7_1[] = { -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, }; static long _vq_quantmap__44c3_s_p7_1[] = { 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, }; static encode_aux_threshmatch _vq_auxt__44c3_s_p7_1 = { _vq_quantthresh__44c3_s_p7_1, _vq_quantmap__44c3_s_p7_1, 11, 11 }; static static_codebook _44c3_s_p7_1 = { 2, 121, _vq_lengthlist__44c3_s_p7_1, 1, -531365888, 1611661312, 4, 0, _vq_quantlist__44c3_s_p7_1, NULL, &_vq_auxt__44c3_s_p7_1, NULL, 0 }; static long _vq_quantlist__44c3_s_p8_0[] = { 6, 5, 7, 4, 8, 3, 9, 2, 10, 1, 11, 0, 12, }; static long _vq_lengthlist__44c3_s_p8_0[] = { 1, 4, 4, 6, 6, 7, 8, 8, 8, 9, 9,10,10, 6, 5, 5, 7, 7, 8, 8, 9, 9, 9, 9,10,10, 7, 5, 5, 7, 7, 8, 8, 9, 9, 9,10,11,11, 0, 8, 8, 8, 8, 9, 9, 9, 9, 10,10,11,11, 0, 8, 8, 8, 8, 9, 9, 9, 9,10,10,11, 11, 0,11,12, 9, 9, 9,10,10,10,11,11,11,12, 0,13, 13, 9, 9, 9, 9,10,10,11,11,12,12, 0, 0, 0,10, 9, 9, 9,10,11,11,11,12,12, 0, 0, 0,10,10, 9, 9,11, 11,11,11,12,13, 0, 0, 0,13,13,10,10,11,11,12,12, 13,13, 0, 0, 0,14,14,10,10,11,11,12,12,13,13, 0, 0, 0, 0, 0,12,12,11,11,12,12,13,13, 0, 0, 0, 0, 0,12,12,11,11,12,12,13,13, }; static float _vq_quantthresh__44c3_s_p8_0[] = { -27.5, -22.5, -17.5, -12.5, -7.5, -2.5, 2.5, 7.5, 12.5, 17.5, 22.5, 27.5, }; static long _vq_quantmap__44c3_s_p8_0[] = { 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, }; static encode_aux_threshmatch _vq_auxt__44c3_s_p8_0 = { _vq_quantthresh__44c3_s_p8_0, _vq_quantmap__44c3_s_p8_0, 13, 13 }; static static_codebook _44c3_s_p8_0 = { 2, 169, _vq_lengthlist__44c3_s_p8_0, 1, -526516224, 1616117760, 4, 0, _vq_quantlist__44c3_s_p8_0, NULL, &_vq_auxt__44c3_s_p8_0, NULL, 0 }; static long _vq_quantlist__44c3_s_p8_1[] = { 2, 1, 3, 0, 4, }; static long _vq_lengthlist__44c3_s_p8_1[] = { 2, 4, 4, 5, 5, 6, 5, 5, 5, 5, 6, 4, 5, 5, 5, 6, 5, 5, 5, 5, 6, 6, 6, 5, 5, }; static float _vq_quantthresh__44c3_s_p8_1[] = { -1.5, -0.5, 0.5, 1.5, }; static long _vq_quantmap__44c3_s_p8_1[] = { 3, 1, 0, 2, 4, }; static encode_aux_threshmatch _vq_auxt__44c3_s_p8_1 = { _vq_quantthresh__44c3_s_p8_1, _vq_quantmap__44c3_s_p8_1, 5, 5 }; static static_codebook _44c3_s_p8_1 = { 2, 25, _vq_lengthlist__44c3_s_p8_1, 1, -533725184, 1611661312, 3, 0, _vq_quantlist__44c3_s_p8_1, NULL, &_vq_auxt__44c3_s_p8_1, NULL, 0 }; static long _vq_quantlist__44c3_s_p9_0[] = { 6, 5, 7, 4, 8, 3, 9, 2, 10, 1, 11, 0, 12, }; static long _vq_lengthlist__44c3_s_p9_0[] = { 1, 4, 4,10,10,10,10,10,10,10,10,10,10, 5,10, 7, 10,10,10,10,10,10,10,10,10,10, 5, 8, 6,10,10,10, 10,10,10,10,10,10,10,10, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, }; static float _vq_quantthresh__44c3_s_p9_0[] = { -1402.5, -1147.5, -892.5, -637.5, -382.5, -127.5, 127.5, 382.5, 637.5, 892.5, 1147.5, 1402.5, }; static long _vq_quantmap__44c3_s_p9_0[] = { 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, }; static encode_aux_threshmatch _vq_auxt__44c3_s_p9_0 = { _vq_quantthresh__44c3_s_p9_0, _vq_quantmap__44c3_s_p9_0, 13, 13 }; static static_codebook _44c3_s_p9_0 = { 2, 169, _vq_lengthlist__44c3_s_p9_0, 1, -514332672, 1627381760, 4, 0, _vq_quantlist__44c3_s_p9_0, NULL, &_vq_auxt__44c3_s_p9_0, NULL, 0 }; static long _vq_quantlist__44c3_s_p9_1[] = { 7, 6, 8, 5, 9, 4, 10, 3, 11, 2, 12, 1, 13, 0, 14, }; static long _vq_lengthlist__44c3_s_p9_1[] = { 1, 4, 4, 6, 6, 7, 7, 9, 9,11,11,11,12,12,12, 6, 5, 5, 7, 7, 8, 8,10, 9,11,11,13,12,13,14, 6, 5, 5, 7, 7, 8, 8,10,10,11,11,12,12,13,13,17, 7, 7, 8, 8, 9, 9,10,10,12,12,14,13,14,14,17, 8, 7, 8, 7, 9, 9,10,10,12,12,13,13,13,14,17,11,11, 8, 8, 10,10,11,11,12,12,13,13,15,14,17,11,11, 8, 7,10, 10,11,11,12,12,13,14,14,13,17,17,17,10,11,10,10, 12,12,13,12,13,13,14,14,17,16,16,10,10,11, 9,13, 12,13,13,13,13,14,14,16,16,15,13,15,11,12,12,12, 14,14,14,14,14,15,16,16,16,14,14,11, 9,12,10,13, 13,14,14,14,14,16,16,16,16,16,12,13,12,12,13,14, 14,14,15,15,15,16,16,15,16,13,11,13,10,14,12,15, 14,16,14,15,16,16,16,16,15,15,13,13,13,13,14,14, 16,16,16,16,16,15,16,16,14,13,12,13,13,14,16,16, 16, }; static float _vq_quantthresh__44c3_s_p9_1[] = { -110.5, -93.5, -76.5, -59.5, -42.5, -25.5, -8.5, 8.5, 25.5, 42.5, 59.5, 76.5, 93.5, 110.5, }; static long _vq_quantmap__44c3_s_p9_1[] = { 13, 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, 14, }; static encode_aux_threshmatch _vq_auxt__44c3_s_p9_1 = { _vq_quantthresh__44c3_s_p9_1, _vq_quantmap__44c3_s_p9_1, 15, 15 }; static static_codebook _44c3_s_p9_1 = { 2, 225, _vq_lengthlist__44c3_s_p9_1, 1, -522338304, 1620115456, 4, 0, _vq_quantlist__44c3_s_p9_1, NULL, &_vq_auxt__44c3_s_p9_1, NULL, 0 }; static long _vq_quantlist__44c3_s_p9_2[] = { 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15, 0, 16, }; static long _vq_lengthlist__44c3_s_p9_2[] = { 3, 5, 5, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 9, 8,10, 5, 5, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9,10, 5, 5, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9,10, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9,10,10,10, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9,10,10,10, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,10,10,10, 8, 7, 8, 8, 9, 8, 9, 9, 9, 9, 9, 9, 9, 9,10,10,10, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,10,10,10,11,10, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,10,10,10,10,10, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,10,10,10,10,11, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,10,10,10,11,10, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,10,10,10,10, 10,10,11, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,10,10,10, 11,10,11,10, 9, 9, 9,10, 9, 9, 9, 9, 9, 9,10,10, 10,10,11,11,10,10, 9, 9, 9, 9, 9, 9, 9, 9, 9,10, 10,10,10,10,10,10,10,10, 9, 9, 9, 9, 9, 9,10, 9, 10,10,10,10,11,10,11,10,10, 9, 9, 9, 9, 9, 9, 9, 9, }; static float _vq_quantthresh__44c3_s_p9_2[] = { -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, }; static long _vq_quantmap__44c3_s_p9_2[] = { 15, 13, 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, 14, 16, }; static encode_aux_threshmatch _vq_auxt__44c3_s_p9_2 = { _vq_quantthresh__44c3_s_p9_2, _vq_quantmap__44c3_s_p9_2, 17, 17 }; static static_codebook _44c3_s_p9_2 = { 2, 289, _vq_lengthlist__44c3_s_p9_2, 1, -529530880, 1611661312, 5, 0, _vq_quantlist__44c3_s_p9_2, NULL, &_vq_auxt__44c3_s_p9_2, NULL, 0 }; static long _huff_lengthlist__44c3_s_short[] = { 10,10,13,12,13,12,12,12,12,13, 8, 3,11, 5,10, 5, 7,11,14,16,11, 6, 9, 8, 7, 7, 9,12,15,16,12, 4, 12, 4,10, 5, 8,12,15,16,12, 6, 8, 7, 5, 5, 7,11, 14,15,11, 4, 9, 4, 6, 4, 6, 9,13,15,10, 6,10, 7, 7, 5, 6, 9,13,15,12, 9,11, 9, 8, 6, 7, 9,12,15, 13,11,10, 9, 6, 5, 5, 8,11,14,16,12,11,10, 6, 5, 6, 8,10,14, }; static static_codebook _huff_book__44c3_s_short = { 2, 100, _huff_lengthlist__44c3_s_short, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _huff_lengthlist__44c4_s_long[] = { 3, 5,11,11,13,11,11,11,12,12, 5, 2,11, 6,10, 7, 8,10,13,16,10, 9, 6,10, 6, 7, 8, 9,11,12,11, 5, 11, 7,10, 8,10,12,15,17,12, 8, 5, 9, 4, 5, 7, 8, 10,12,10, 6, 7, 8, 5, 5, 6, 8,10,11,10, 8, 8, 9, 6, 6, 6, 7, 9,10,11,10, 9,11, 8, 7, 6, 6, 7, 9, 11,13,10,15, 9, 9, 7, 7, 7, 8,10,15,11,17,11,11, 9, 8, 7, 8, }; static static_codebook _huff_book__44c4_s_long = { 2, 100, _huff_lengthlist__44c4_s_long, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _vq_quantlist__44c4_s_p1_0[] = { 1, 0, 2, }; static long _vq_lengthlist__44c4_s_p1_0[] = { 2, 4, 4, 0, 0, 0, 0, 0, 0, 5, 7, 6, 0, 0, 0, 0, 0, 0, 5, 6, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 7, 7, 0, 0, 0, 0, 0, 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antmap__44c4_s_p1_0[] = { 1, 0, 2, }; static encode_aux_threshmatch _vq_auxt__44c4_s_p1_0 = { _vq_quantthresh__44c4_s_p1_0, _vq_quantmap__44c4_s_p1_0, 3, 3 }; static static_codebook _44c4_s_p1_0 = { 8, 6561, _vq_lengthlist__44c4_s_p1_0, 1, -535822336, 1611661312, 2, 0, _vq_quantlist__44c4_s_p1_0, NULL, &_vq_auxt__44c4_s_p1_0, NULL, 0 }; static long _vq_quantlist__44c4_s_p2_0[] = { 2, 1, 3, 0, 4, }; static long _vq_lengthlist__44c4_s_p2_0[] = { 2, 5, 5, 0, 0, 0, 5, 5, 0, 0, 0, 5, 5, 0, 0, 0, 7, 7, 0, 0, 0, 0, 0, 0, 0, 5, 6, 6, 0, 0, 0, 8, 7, 0, 0, 0, 7, 7, 0, 0, 0,10,10, 0, 0, 0, 0, 0, 0, 0, 5, 6, 6, 0, 0, 0, 7, 7, 0, 0, 0, 7, 7, 0, 0, 0,10,10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 7, 7, 0, 0, 0, 7, 7, 0, 0, 0, 7, 7, 0, 0, 0, 9, 9, 0, 0, 0, 0, 0, 0, 0, 5, 7, 7, 0, 0, 0, 7, 7, 0, 0, 0, 7, 7, 0, 0, 0, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; static float _vq_quantthresh__44c4_s_p2_0[] = { -1.5, -0.5, 0.5, 1.5, }; static long _vq_quantmap__44c4_s_p2_0[] = { 3, 1, 0, 2, 4, }; static encode_aux_threshmatch _vq_auxt__44c4_s_p2_0 = { _vq_quantthresh__44c4_s_p2_0, _vq_quantmap__44c4_s_p2_0, 5, 5 }; static static_codebook _44c4_s_p2_0 = { 4, 625, _vq_lengthlist__44c4_s_p2_0, 1, -533725184, 1611661312, 3, 0, _vq_quantlist__44c4_s_p2_0, NULL, &_vq_auxt__44c4_s_p2_0, NULL, 0 }; static long _vq_quantlist__44c4_s_p3_0[] = { 2, 1, 3, 0, 4, }; static long _vq_lengthlist__44c4_s_p3_0[] = { 2, 3, 4, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 5, 4, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 6, 6, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 6, 6, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; static float _vq_quantthresh__44c4_s_p3_0[] = { -1.5, -0.5, 0.5, 1.5, }; static long _vq_quantmap__44c4_s_p3_0[] = { 3, 1, 0, 2, 4, }; static encode_aux_threshmatch _vq_auxt__44c4_s_p3_0 = { _vq_quantthresh__44c4_s_p3_0, _vq_quantmap__44c4_s_p3_0, 5, 5 }; static static_codebook _44c4_s_p3_0 = { 4, 625, _vq_lengthlist__44c4_s_p3_0, 1, -533725184, 1611661312, 3, 0, _vq_quantlist__44c4_s_p3_0, NULL, &_vq_auxt__44c4_s_p3_0, NULL, 0 }; static long _vq_quantlist__44c4_s_p4_0[] = { 4, 3, 5, 2, 6, 1, 7, 0, 8, }; static long _vq_lengthlist__44c4_s_p4_0[] = { 2, 3, 3, 6, 6, 0, 0, 0, 0, 0, 4, 4, 6, 6, 0, 0, 0, 0, 0, 4, 4, 6, 6, 0, 0, 0, 0, 0, 5, 5, 6, 6, 0, 0, 0, 0, 0, 0, 0, 6, 6, 0, 0, 0, 0, 0, 0, 0, 7, 8, 0, 0, 0, 0, 0, 0, 0, 7, 7, 0, 0, 0, 0, 0, 0, 0, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; static float _vq_quantthresh__44c4_s_p4_0[] = { -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, }; static long _vq_quantmap__44c4_s_p4_0[] = { 7, 5, 3, 1, 0, 2, 4, 6, 8, }; static encode_aux_threshmatch _vq_auxt__44c4_s_p4_0 = { _vq_quantthresh__44c4_s_p4_0, _vq_quantmap__44c4_s_p4_0, 9, 9 }; static static_codebook _44c4_s_p4_0 = { 2, 81, _vq_lengthlist__44c4_s_p4_0, 1, -531628032, 1611661312, 4, 0, _vq_quantlist__44c4_s_p4_0, NULL, &_vq_auxt__44c4_s_p4_0, NULL, 0 }; static long _vq_quantlist__44c4_s_p5_0[] = { 4, 3, 5, 2, 6, 1, 7, 0, 8, }; static long _vq_lengthlist__44c4_s_p5_0[] = { 2, 3, 3, 6, 6, 7, 7, 9, 9, 0, 4, 4, 7, 7, 7, 7, 9, 9, 0, 4, 4, 7, 7, 7, 7, 9, 9, 0, 6, 6, 7, 7, 8, 8,10,10, 0, 0, 0, 7, 7, 8, 8,10,10, 0, 0, 0, 8, 8, 8, 8,10,10, 0, 0, 0, 8, 8, 8, 8,10,10, 0, 0, 0,10,10, 9, 9,11,11, 0, 0, 0, 0, 0, 9, 9,11, 11, }; static float _vq_quantthresh__44c4_s_p5_0[] = { -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, }; static long _vq_quantmap__44c4_s_p5_0[] = { 7, 5, 3, 1, 0, 2, 4, 6, 8, }; static encode_aux_threshmatch _vq_auxt__44c4_s_p5_0 = { _vq_quantthresh__44c4_s_p5_0, _vq_quantmap__44c4_s_p5_0, 9, 9 }; static static_codebook _44c4_s_p5_0 = { 2, 81, _vq_lengthlist__44c4_s_p5_0, 1, -531628032, 1611661312, 4, 0, _vq_quantlist__44c4_s_p5_0, NULL, &_vq_auxt__44c4_s_p5_0, NULL, 0 }; static long _vq_quantlist__44c4_s_p6_0[] = { 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15, 0, 16, }; static long _vq_lengthlist__44c4_s_p6_0[] = { 2, 4, 4, 6, 6, 8, 8, 8, 8, 9, 9,10, 9,10,10,11, 11, 0, 4, 4, 7, 7, 8, 8, 9, 9, 9, 9,10,10,11,11, 11,11, 0, 4, 4, 6, 6, 8, 8, 9, 9, 9, 9,10,10,11, 11,12,12, 0, 6, 6, 7, 7, 8, 8, 9, 9, 9, 9,10,10, 11,11,12,12, 0, 0, 0, 7, 7, 8, 8, 9, 9, 9, 9,10, 10,11,11,12,12, 0, 0, 0, 8, 8, 8, 8, 9, 9,10, 9, 10,11,11,11,12,12, 0, 0, 0, 8, 8, 8, 8, 9, 9,10, 10,11,10,11,11,12,12, 0, 0, 0, 9, 9, 9, 9,10,10, 10,10,11,11,11,11,12,12, 0, 0, 0, 0, 0, 9, 9,10, 10,10,10,11,11,12,11,12,12, 0, 0, 0, 0, 0, 8, 8, 9, 9,10,10,11,11,12,12,12,12, 0, 0, 0, 0, 0, 8, 8, 9, 9,10,10,11,11,12,12,12,12, 0, 0, 0, 0, 0, 9, 9,10,10,11,10,11,11,12,12,12,12, 0, 0, 0, 0, 0, 0, 0,10,10,10,10,11,11,12,12,13,12, 0, 0, 0, 0, 0, 0, 0,11,11,11,11,11,12,12,12,13,12, 0, 0, 0, 0, 0, 0, 0,11,11,11,11,11,11,12,12,13,13, 0, 0, 0, 0, 0, 0, 0,11,11,12,12,12,12,12,12,13,13, 0, 0, 0, 0, 0, 0, 0, 0, 0,11,11,12,12,12,12,13, 13, }; static float _vq_quantthresh__44c4_s_p6_0[] = { -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, }; static long _vq_quantmap__44c4_s_p6_0[] = { 15, 13, 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, 14, 16, }; static encode_aux_threshmatch _vq_auxt__44c4_s_p6_0 = { _vq_quantthresh__44c4_s_p6_0, _vq_quantmap__44c4_s_p6_0, 17, 17 }; static static_codebook _44c4_s_p6_0 = { 2, 289, _vq_lengthlist__44c4_s_p6_0, 1, -529530880, 1611661312, 5, 0, _vq_quantlist__44c4_s_p6_0, NULL, &_vq_auxt__44c4_s_p6_0, NULL, 0 }; static long _vq_quantlist__44c4_s_p7_0[] = { 1, 0, 2, }; static long _vq_lengthlist__44c4_s_p7_0[] = { 1, 4, 4, 6, 6, 6, 7, 6, 6, 4, 7, 7,10, 9, 9,10, 9, 9, 5, 7, 7,10, 9, 9,10, 9, 9, 6,10,10,10,10, 10,11,10,10, 6, 9, 9,10,10,10,10,10, 9, 6, 9, 9, 10, 9,10,11, 9, 9, 7,10,10,11,11,11,11,10,10, 6, 9, 9,10, 9, 9,10,10, 9, 6, 9, 9,10,10,10,10,10, 10, }; static float _vq_quantthresh__44c4_s_p7_0[] = { -5.5, 5.5, }; static long _vq_quantmap__44c4_s_p7_0[] = { 1, 0, 2, }; static encode_aux_threshmatch _vq_auxt__44c4_s_p7_0 = { _vq_quantthresh__44c4_s_p7_0, _vq_quantmap__44c4_s_p7_0, 3, 3 }; static static_codebook _44c4_s_p7_0 = { 4, 81, _vq_lengthlist__44c4_s_p7_0, 1, -529137664, 1618345984, 2, 0, _vq_quantlist__44c4_s_p7_0, NULL, &_vq_auxt__44c4_s_p7_0, NULL, 0 }; static long _vq_quantlist__44c4_s_p7_1[] = { 5, 4, 6, 3, 7, 2, 8, 1, 9, 0, 10, }; static long _vq_lengthlist__44c4_s_p7_1[] = { 2, 4, 4, 6, 6, 7, 7, 8, 8, 8, 8,10, 5, 5, 6, 6, 7, 7, 8, 8, 8, 8,10, 5, 5, 6, 6, 7, 7, 8, 8, 8, 8,10, 6, 6, 7, 7, 8, 8, 8, 8, 8, 8,10,10,10, 7, 7, 8, 8, 8, 8, 8, 8,10,10,10, 7, 7, 8, 8, 8, 8, 8, 8,10,10,10, 7, 7, 8, 8, 8, 8, 8, 8,10,10,10, 8, 8, 8, 8, 8, 8, 8, 8,10,10,10,10,10, 8, 8, 8, 8, 8, 8,10,10,10,10,10, 9, 9, 8, 8, 8, 9,10,10, 10,10,10, 8, 8, 8, 8, 8, 8, }; static float _vq_quantthresh__44c4_s_p7_1[] = { -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, }; static long _vq_quantmap__44c4_s_p7_1[] = { 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, }; static encode_aux_threshmatch _vq_auxt__44c4_s_p7_1 = { _vq_quantthresh__44c4_s_p7_1, _vq_quantmap__44c4_s_p7_1, 11, 11 }; static static_codebook _44c4_s_p7_1 = { 2, 121, _vq_lengthlist__44c4_s_p7_1, 1, -531365888, 1611661312, 4, 0, _vq_quantlist__44c4_s_p7_1, NULL, &_vq_auxt__44c4_s_p7_1, NULL, 0 }; static long _vq_quantlist__44c4_s_p8_0[] = { 6, 5, 7, 4, 8, 3, 9, 2, 10, 1, 11, 0, 12, }; static long _vq_lengthlist__44c4_s_p8_0[] = { 1, 4, 4, 6, 6, 8, 8, 8, 8, 9, 9,10,10, 6, 5, 5, 7, 7, 8, 8, 9, 9,10,10,11,11, 7, 5, 5, 7, 7, 8, 8, 9, 9,10,10,11,11, 0, 8, 8, 8, 8, 9, 9, 9, 9, 10,10,11,11, 0, 8, 8, 8, 8, 9, 9, 9, 9,10,10,11, 11, 0,12,12, 9, 9, 9, 9,10,10,10,10,11,11, 0,12, 12, 9, 8, 9, 9,10,10,11,11,12,11, 0, 0, 0, 9,10, 9, 9,10,10,11,11,12,12, 0, 0, 0,10,10, 9, 9,10, 10,11,11,12,12, 0, 0, 0,13,13,10,10,10,11,12,12, 12,12, 0, 0, 0,14,14,10,10,11,11,11,11,12,12, 0, 0, 0, 0, 0,11,12,11,11,12,12,12,13, 0, 0, 0, 0, 0,12,12,11,11,12,12,13,13, }; static float _vq_quantthresh__44c4_s_p8_0[] = { -27.5, -22.5, -17.5, -12.5, -7.5, -2.5, 2.5, 7.5, 12.5, 17.5, 22.5, 27.5, }; static long _vq_quantmap__44c4_s_p8_0[] = { 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, }; static encode_aux_threshmatch _vq_auxt__44c4_s_p8_0 = { _vq_quantthresh__44c4_s_p8_0, _vq_quantmap__44c4_s_p8_0, 13, 13 }; static static_codebook _44c4_s_p8_0 = { 2, 169, _vq_lengthlist__44c4_s_p8_0, 1, -526516224, 1616117760, 4, 0, _vq_quantlist__44c4_s_p8_0, NULL, &_vq_auxt__44c4_s_p8_0, NULL, 0 }; static long _vq_quantlist__44c4_s_p8_1[] = { 2, 1, 3, 0, 4, }; static long _vq_lengthlist__44c4_s_p8_1[] = { 2, 4, 4, 5, 5, 6, 5, 5, 5, 5, 6, 4, 5, 5, 5, 6, 5, 5, 5, 5, 6, 6, 6, 5, 5, }; static float _vq_quantthresh__44c4_s_p8_1[] = { -1.5, -0.5, 0.5, 1.5, }; static long _vq_quantmap__44c4_s_p8_1[] = { 3, 1, 0, 2, 4, }; static encode_aux_threshmatch _vq_auxt__44c4_s_p8_1 = { _vq_quantthresh__44c4_s_p8_1, _vq_quantmap__44c4_s_p8_1, 5, 5 }; static static_codebook _44c4_s_p8_1 = { 2, 25, _vq_lengthlist__44c4_s_p8_1, 1, -533725184, 1611661312, 3, 0, _vq_quantlist__44c4_s_p8_1, NULL, &_vq_auxt__44c4_s_p8_1, NULL, 0 }; static long _vq_quantlist__44c4_s_p9_0[] = { 6, 5, 7, 4, 8, 3, 9, 2, 10, 1, 11, 0, 12, }; static long _vq_lengthlist__44c4_s_p9_0[] = { 1, 3, 3,10,10,10,10,10,10,10,10,10,10, 5, 7, 7, 10,10,10,10,10,10,10,10,10,10, 5, 7, 8,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10, 9, 9, 9, 9, }; static float _vq_quantthresh__44c4_s_p9_0[] = { -1732.5, -1417.5, -1102.5, -787.5, -472.5, -157.5, 157.5, 472.5, 787.5, 1102.5, 1417.5, 1732.5, }; static long _vq_quantmap__44c4_s_p9_0[] = { 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, }; static encode_aux_threshmatch _vq_auxt__44c4_s_p9_0 = { _vq_quantthresh__44c4_s_p9_0, _vq_quantmap__44c4_s_p9_0, 13, 13 }; static static_codebook _44c4_s_p9_0 = { 2, 169, _vq_lengthlist__44c4_s_p9_0, 1, -513964032, 1628680192, 4, 0, _vq_quantlist__44c4_s_p9_0, NULL, &_vq_auxt__44c4_s_p9_0, NULL, 0 }; static long _vq_quantlist__44c4_s_p9_1[] = { 7, 6, 8, 5, 9, 4, 10, 3, 11, 2, 12, 1, 13, 0, 14, }; static long _vq_lengthlist__44c4_s_p9_1[] = { 1, 4, 4, 5, 6, 7, 7, 9, 9,11,11,12,12,12,13, 6, 5, 5, 6, 7, 8, 8,10,10,11,11,13,13,13,13, 6, 5, 5, 7, 7, 8, 8,11,10,11,11,12,13,12,13,17, 7, 7, 8, 8, 9, 9,11,11,12,12,12,13,15,14,17, 7, 7, 8, 8, 9, 9,11,10,12,12,13,13,14,13,17,11,12, 9, 9, 10,10,12,12,13,13,14,14,14,14,17,12,11, 9, 8,11, 10,11,12,13,13,13,14,14,14,17,17,17,11,11,11,11, 13,13,13,13,14,13,15,14,17,17,17,11,10,11, 9,13, 12,13,14,15,14,15,14,17,17,17,14,14,11,12,12,13, 14,14,16,15,15,15,17,17,17,15,15,12,11,13,11,13, 13,13,15,16,14,17,17,17,17,17,13,13,14,13,14,14, 15,15,16,15,17,17,17,17,17,14,14,14,12,14,12,16, 14,15,14,17,17,17,17,17,16,17,13,14,14,15,15,15, 17,15,17,17,17,17,17,16,17,13,14,14,14,15,17,15, 15, }; static float _vq_quantthresh__44c4_s_p9_1[] = { -136.5, -115.5, -94.5, -73.5, -52.5, -31.5, -10.5, 10.5, 31.5, 52.5, 73.5, 94.5, 115.5, 136.5, }; static long _vq_quantmap__44c4_s_p9_1[] = { 13, 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, 14, }; static encode_aux_threshmatch _vq_auxt__44c4_s_p9_1 = { _vq_quantthresh__44c4_s_p9_1, _vq_quantmap__44c4_s_p9_1, 15, 15 }; static static_codebook _44c4_s_p9_1 = { 2, 225, _vq_lengthlist__44c4_s_p9_1, 1, -520986624, 1620377600, 4, 0, _vq_quantlist__44c4_s_p9_1, NULL, &_vq_auxt__44c4_s_p9_1, NULL, 0 }; static long _vq_quantlist__44c4_s_p9_2[] = { 10, 9, 11, 8, 12, 7, 13, 6, 14, 5, 15, 4, 16, 3, 17, 2, 18, 1, 19, 0, 20, }; static long _vq_lengthlist__44c4_s_p9_2[] = { 3, 5, 5, 6, 6, 7, 7, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9,11, 5, 5, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9,10,10,11, 5, 5, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,11, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9,10,10, 10,10,10,10,11,11,11, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9,10,10,10,10,10,10,11,11,11, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9,10,10,10,10,10,10,10,10,11,11, 11, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9,10, 9,10,10,10, 10,10,10,11,11,11, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 10,10,10,10,10,10,10,10,11,11,11,11,11, 8, 8, 9, 9, 9, 9, 9,10,10,10,10,10,10,10,10,10,11,11,11, 11,11, 9, 9, 9, 9, 9,10,10,10,10,10,10,10,10,10, 10,10,11,11,11,11,11, 9, 9, 9, 9, 9,10,10,10,10, 10,10,10,10,10,10,10,11,11,11,11,11, 9, 9, 9, 9, 10,10,10,10,10,10,10,10,10,10,10,10,11,11,11,11, 11,11,11, 9, 9, 9,10,10,10,10,10,10,10,10,10,10, 10,11,11,11,11,11,11,11,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,11,11,11,11,11,11,11,10,10, 9, 10,10,10,10,10,10,10,10,10,10,10,11,11,11,11,11, 11,11,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 11,11,11,11,11,11,11,11,11,10,10,10,10,10,10,10, 10,10,10,10,10,11,11,11,11,11,11,11,11,11,10,10, 10,10,10,10,10,10,10,10,10,10,11,11,11,11,11,11, 12,11,11,10,10,10,10,10,10,10,10,10,10,10,10,12, 11,12,12,11,11,11,11,11,10,10,10,10,10,10,10,10, 10,10,10,10,11,11,11,11,11,11,11,11,11,11,11,10, 10,10,10,10,10,10,10,10,10, }; static float _vq_quantthresh__44c4_s_p9_2[] = { -9.5, -8.5, -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, 9.5, }; static long _vq_quantmap__44c4_s_p9_2[] = { 19, 17, 15, 13, 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, }; static encode_aux_threshmatch _vq_auxt__44c4_s_p9_2 = { _vq_quantthresh__44c4_s_p9_2, _vq_quantmap__44c4_s_p9_2, 21, 21 }; static static_codebook _44c4_s_p9_2 = { 2, 441, _vq_lengthlist__44c4_s_p9_2, 1, -529268736, 1611661312, 5, 0, _vq_quantlist__44c4_s_p9_2, NULL, &_vq_auxt__44c4_s_p9_2, NULL, 0 }; static long _huff_lengthlist__44c4_s_short[] = { 4, 9,13,12,16,11,12,15,15,16, 4, 2,11, 5,10, 6, 8,11,14,14,13,11, 8,11, 7, 8,10,13,17,17,10, 4, 11, 5, 9, 6, 9,13,17,17,13, 9, 6, 9, 5, 5, 7,11, 15,17,10, 5, 7, 6, 5, 4, 7,10,15,15,10, 7, 9, 8, 7, 6, 7,10,14,13,13,10,11,10, 8, 7, 8,10,14,14, 12,11,10, 9, 6, 5, 6, 9,13,17,14,13,11,10, 6, 6, 6, 8,11,16, }; static static_codebook _huff_book__44c4_s_short = { 2, 100, _huff_lengthlist__44c4_s_short, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _huff_lengthlist__44c5_s_long[] = { 3, 6, 9,14,11,13,12,12,12,12, 6, 3, 5, 8, 6, 8, 10,11,12,14, 9, 5, 4,10, 5, 7, 8, 9,11,12,13, 8, 10, 9, 9, 9,12,15,16,17,10, 6, 5, 9, 3, 5, 6, 8, 10,12,10, 8, 7, 9, 5, 5, 6, 8,10,11,10, 9, 8,11, 6, 6, 6, 7, 8,10,12,11, 9,13, 8, 7, 6, 6, 7, 9, 11,13,10,15, 9, 9, 7, 7, 7, 8,10,15,10,17,11,10, 9, 8, 7, 7, }; static static_codebook _huff_book__44c5_s_long = { 2, 100, _huff_lengthlist__44c5_s_long, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _vq_quantlist__44c5_s_p1_0[] = { 1, 0, 2, }; static long _vq_lengthlist__44c5_s_p1_0[] = { 2, 4, 4, 0, 0, 0, 0, 0, 0, 4, 7, 6, 0, 0, 0, 0, 0, 0, 4, 6, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 7, 7, 0, 0, 0, 0, 0, 0, 7, 9, 9, 0, 0, 0, 0, 0, 0, 7, 8, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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vq_quantmap__44c5_s_p1_0, 3, 3 }; static static_codebook _44c5_s_p1_0 = { 8, 6561, _vq_lengthlist__44c5_s_p1_0, 1, -535822336, 1611661312, 2, 0, _vq_quantlist__44c5_s_p1_0, NULL, &_vq_auxt__44c5_s_p1_0, NULL, 0 }; static long _vq_quantlist__44c5_s_p2_0[] = { 2, 1, 3, 0, 4, }; static long _vq_lengthlist__44c5_s_p2_0[] = { 2, 4, 4, 0, 0, 0, 6, 5, 0, 0, 0, 5, 5, 0, 0, 0, 7, 7, 0, 0, 0, 0, 0, 0, 0, 4, 6, 5, 0, 0, 0, 8, 7, 0, 0, 0, 8, 8, 0, 0, 0, 9, 9, 0, 0, 0, 0, 0, 0, 0, 4, 5, 6, 0, 0, 0, 7, 8, 0, 0, 0, 7, 8, 0, 0, 0, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 8, 7, 0, 0, 0, 8, 8, 0, 0, 0, 8, 8, 0, 0, 0,10,10, 0, 0, 0, 0, 0, 0, 0, 6, 7, 8, 0, 0, 0, 8, 8, 0, 0, 0, 8, 8, 0, 0, 0,10, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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0, 0, 0, 0, 0, 0, 0, 0, 0, }; static float _vq_quantthresh__44c5_s_p2_0[] = { -1.5, -0.5, 0.5, 1.5, }; static long _vq_quantmap__44c5_s_p2_0[] = { 3, 1, 0, 2, 4, }; static encode_aux_threshmatch _vq_auxt__44c5_s_p2_0 = { _vq_quantthresh__44c5_s_p2_0, _vq_quantmap__44c5_s_p2_0, 5, 5 }; static static_codebook _44c5_s_p2_0 = { 4, 625, _vq_lengthlist__44c5_s_p2_0, 1, -533725184, 1611661312, 3, 0, _vq_quantlist__44c5_s_p2_0, NULL, &_vq_auxt__44c5_s_p2_0, NULL, 0 }; static long _vq_quantlist__44c5_s_p3_0[] = { 2, 1, 3, 0, 4, }; static long _vq_lengthlist__44c5_s_p3_0[] = { 2, 4, 3, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 5, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 6, 6, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 6, 6, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; static float _vq_quantthresh__44c5_s_p3_0[] = { -1.5, -0.5, 0.5, 1.5, }; static long _vq_quantmap__44c5_s_p3_0[] = { 3, 1, 0, 2, 4, }; static encode_aux_threshmatch _vq_auxt__44c5_s_p3_0 = { _vq_quantthresh__44c5_s_p3_0, _vq_quantmap__44c5_s_p3_0, 5, 5 }; static static_codebook _44c5_s_p3_0 = { 4, 625, _vq_lengthlist__44c5_s_p3_0, 1, -533725184, 1611661312, 3, 0, _vq_quantlist__44c5_s_p3_0, NULL, &_vq_auxt__44c5_s_p3_0, NULL, 0 }; static long _vq_quantlist__44c5_s_p4_0[] = { 4, 3, 5, 2, 6, 1, 7, 0, 8, }; static long _vq_lengthlist__44c5_s_p4_0[] = { 2, 3, 3, 6, 6, 0, 0, 0, 0, 0, 4, 4, 6, 6, 0, 0, 0, 0, 0, 4, 4, 6, 6, 0, 0, 0, 0, 0, 5, 5, 6, 6, 0, 0, 0, 0, 0, 0, 0, 6, 6, 0, 0, 0, 0, 0, 0, 0, 8, 7, 0, 0, 0, 0, 0, 0, 0, 7, 7, 0, 0, 0, 0, 0, 0, 0, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; static float _vq_quantthresh__44c5_s_p4_0[] = { -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, }; static long _vq_quantmap__44c5_s_p4_0[] = { 7, 5, 3, 1, 0, 2, 4, 6, 8, }; static encode_aux_threshmatch _vq_auxt__44c5_s_p4_0 = { _vq_quantthresh__44c5_s_p4_0, _vq_quantmap__44c5_s_p4_0, 9, 9 }; static static_codebook _44c5_s_p4_0 = { 2, 81, _vq_lengthlist__44c5_s_p4_0, 1, -531628032, 1611661312, 4, 0, _vq_quantlist__44c5_s_p4_0, NULL, &_vq_auxt__44c5_s_p4_0, NULL, 0 }; static long _vq_quantlist__44c5_s_p5_0[] = { 4, 3, 5, 2, 6, 1, 7, 0, 8, }; static long _vq_lengthlist__44c5_s_p5_0[] = { 2, 3, 4, 5, 6, 7, 7, 9, 9, 0, 4, 4, 6, 6, 7, 7, 9, 9, 0, 4, 4, 6, 6, 7, 7, 9, 9, 0, 6, 6, 7, 7, 8, 8,10,10, 0, 0, 0, 7, 7, 8, 8,10,10, 0, 0, 0, 7, 7, 8, 8,10,10, 0, 0, 0, 7, 8, 8, 8,10,10, 0, 0, 0, 9, 9, 9, 9,10,10, 0, 0, 0, 0, 0, 9, 9,10, 10, }; static float _vq_quantthresh__44c5_s_p5_0[] = { -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, }; static long _vq_quantmap__44c5_s_p5_0[] = { 7, 5, 3, 1, 0, 2, 4, 6, 8, }; static encode_aux_threshmatch _vq_auxt__44c5_s_p5_0 = { _vq_quantthresh__44c5_s_p5_0, _vq_quantmap__44c5_s_p5_0, 9, 9 }; static static_codebook _44c5_s_p5_0 = { 2, 81, _vq_lengthlist__44c5_s_p5_0, 1, -531628032, 1611661312, 4, 0, _vq_quantlist__44c5_s_p5_0, NULL, &_vq_auxt__44c5_s_p5_0, NULL, 0 }; static long _vq_quantlist__44c5_s_p6_0[] = { 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15, 0, 16, }; static long _vq_lengthlist__44c5_s_p6_0[] = { 2, 4, 4, 6, 6, 8, 8, 9, 9, 9, 9,10,10,11,11,12, 12, 0, 4, 4, 6, 6, 8, 8, 9, 9, 9, 9,10,10,11,11, 12,12, 0, 4, 4, 6, 6, 8, 8, 9, 9, 9, 9,10,10,11, 11,12,12, 0, 6, 6, 7, 7, 8, 8, 9,10,10,10,11,11, 11,12,12,12, 0, 0, 0, 7, 7, 8, 8,10,10,10,10,11, 11,12,12,12,12, 0, 0, 0, 7, 7, 9, 9,10,10,10,10, 11,11,12,12,12,12, 0, 0, 0, 7, 7, 8, 9,10,10,10, 10,11,11,12,12,12,13, 0, 0, 0, 8, 8, 9, 9,10,10, 10,10,11,11,12,12,13,12, 0, 0, 0, 0, 0, 9, 9,10, 10,10,10,11,11,12,12,13,13, 0, 0, 0, 0, 0, 8, 8, 9, 9,10,10,11,11,12,12,13,13, 0, 0, 0, 0, 0, 8, 8, 9, 9,10,10,11,11,12,12,13,13, 0, 0, 0, 0, 0, 9, 9,10,10,11,11,11,12,12,12,13,13, 0, 0, 0, 0, 0, 0, 0,10,10,11,11,11,12,12,12,13,13, 0, 0, 0, 0, 0, 0, 0,11,11,11,11,12,12,12,13,13,13, 0, 0, 0, 0, 0, 0, 0,11,11,11,11,12,12,13,12,13,13, 0, 0, 0, 0, 0, 0, 0,11,11,12,12,12,12,13,13,13,13, 0, 0, 0, 0, 0, 0, 0, 0, 0,12,12,12,12,13,13,13, 13, }; static float _vq_quantthresh__44c5_s_p6_0[] = { -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, }; static long _vq_quantmap__44c5_s_p6_0[] = { 15, 13, 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, 14, 16, }; static encode_aux_threshmatch _vq_auxt__44c5_s_p6_0 = { _vq_quantthresh__44c5_s_p6_0, _vq_quantmap__44c5_s_p6_0, 17, 17 }; static static_codebook _44c5_s_p6_0 = { 2, 289, _vq_lengthlist__44c5_s_p6_0, 1, -529530880, 1611661312, 5, 0, _vq_quantlist__44c5_s_p6_0, NULL, &_vq_auxt__44c5_s_p6_0, NULL, 0 }; static long _vq_quantlist__44c5_s_p7_0[] = { 1, 0, 2, }; static long _vq_lengthlist__44c5_s_p7_0[] = { 1, 4, 4, 6, 6, 6, 7, 6, 6, 4, 7, 7,10, 9, 9,10, 9, 9, 5, 7, 7,10, 9, 9,10, 9, 9, 6,10,10,10,10, 10,11,10,10, 6, 9, 9,10,10, 9,11,10,10, 6, 9, 9, 10, 9,10,11,10, 9, 7,10,10,11,11,11,11,10,10, 6, 9, 9,10,10, 9,10, 9, 9, 6, 9, 9,10,10,10,11, 9, 9, }; static float _vq_quantthresh__44c5_s_p7_0[] = { -5.5, 5.5, }; static long _vq_quantmap__44c5_s_p7_0[] = { 1, 0, 2, }; static encode_aux_threshmatch _vq_auxt__44c5_s_p7_0 = { _vq_quantthresh__44c5_s_p7_0, _vq_quantmap__44c5_s_p7_0, 3, 3 }; static static_codebook _44c5_s_p7_0 = { 4, 81, _vq_lengthlist__44c5_s_p7_0, 1, -529137664, 1618345984, 2, 0, _vq_quantlist__44c5_s_p7_0, NULL, &_vq_auxt__44c5_s_p7_0, NULL, 0 }; static long _vq_quantlist__44c5_s_p7_1[] = { 5, 4, 6, 3, 7, 2, 8, 1, 9, 0, 10, }; static long _vq_lengthlist__44c5_s_p7_1[] = { 2, 4, 4, 6, 6, 7, 7, 8, 8, 8, 8,10, 5, 5, 6, 6, 7, 7, 8, 8, 8, 8,10, 5, 5, 6, 6, 7, 7, 8, 8, 8, 8,10, 6, 6, 7, 7, 8, 8, 8, 8, 8, 8,10,10,10, 7, 7, 8, 8, 8, 8, 8, 8,10,10,10, 7, 7, 8, 8, 8, 8, 8, 8,10,10,10, 7, 7, 8, 8, 8, 8, 8, 8,10,10,10, 8, 8, 8, 8, 8, 8, 8, 8,10,10,10,10,10, 8, 8, 8, 8, 8, 8,10,10,10,10,10, 9, 9, 8, 8, 9, 8,10,10, 10,10,10, 8, 8, 8, 8, 8, 8, }; static float _vq_quantthresh__44c5_s_p7_1[] = { -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, }; static long _vq_quantmap__44c5_s_p7_1[] = { 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, }; static encode_aux_threshmatch _vq_auxt__44c5_s_p7_1 = { _vq_quantthresh__44c5_s_p7_1, _vq_quantmap__44c5_s_p7_1, 11, 11 }; static static_codebook _44c5_s_p7_1 = { 2, 121, _vq_lengthlist__44c5_s_p7_1, 1, -531365888, 1611661312, 4, 0, _vq_quantlist__44c5_s_p7_1, NULL, &_vq_auxt__44c5_s_p7_1, NULL, 0 }; static long _vq_quantlist__44c5_s_p8_0[] = { 6, 5, 7, 4, 8, 3, 9, 2, 10, 1, 11, 0, 12, }; static long _vq_lengthlist__44c5_s_p8_0[] = { 1, 4, 4, 6, 6, 8, 8, 8, 8, 9, 9,10,10, 6, 5, 5, 7, 7, 8, 8, 9, 9,10,10,10,10, 7, 5, 5, 7, 7, 8, 8, 9, 9,10,10,11,11, 0, 8, 8, 8, 8, 9, 9, 9, 9, 10,10,11,11, 0, 8, 8, 8, 8, 9, 9, 9, 9,10,10,11, 11, 0,11,12, 9, 9, 9, 9, 9,10,10,10,11,11, 0,13, 12, 9, 9, 9, 9,10,10,11,11,11,11, 0, 0, 0, 9,10, 9, 9,10,10,11,11,12,11, 0, 0, 0,10,10, 9, 9,10, 10,11,11,12,12, 0, 0, 0,13,13,10,10,11,11,11,12, 12,12, 0, 0, 0,14,14,10,10,11,11,11,11,12,12, 0, 0, 0, 0, 0,12,12,11,11,12,12,13,13, 0, 0, 0, 0, 0,12,12,11,11,12,12,13,13, }; static float _vq_quantthresh__44c5_s_p8_0[] = { -27.5, -22.5, -17.5, -12.5, -7.5, -2.5, 2.5, 7.5, 12.5, 17.5, 22.5, 27.5, }; static long _vq_quantmap__44c5_s_p8_0[] = { 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, }; static encode_aux_threshmatch _vq_auxt__44c5_s_p8_0 = { _vq_quantthresh__44c5_s_p8_0, _vq_quantmap__44c5_s_p8_0, 13, 13 }; static static_codebook _44c5_s_p8_0 = { 2, 169, _vq_lengthlist__44c5_s_p8_0, 1, -526516224, 1616117760, 4, 0, _vq_quantlist__44c5_s_p8_0, NULL, &_vq_auxt__44c5_s_p8_0, NULL, 0 }; static long _vq_quantlist__44c5_s_p8_1[] = { 2, 1, 3, 0, 4, }; static long _vq_lengthlist__44c5_s_p8_1[] = { 2, 4, 4, 5, 5, 6, 5, 5, 5, 5, 6, 4, 5, 5, 5, 6, 5, 5, 5, 5, 6, 6, 6, 5, 5, }; static float _vq_quantthresh__44c5_s_p8_1[] = { -1.5, -0.5, 0.5, 1.5, }; static long _vq_quantmap__44c5_s_p8_1[] = { 3, 1, 0, 2, 4, }; static encode_aux_threshmatch _vq_auxt__44c5_s_p8_1 = { _vq_quantthresh__44c5_s_p8_1, _vq_quantmap__44c5_s_p8_1, 5, 5 }; static static_codebook _44c5_s_p8_1 = { 2, 25, _vq_lengthlist__44c5_s_p8_1, 1, -533725184, 1611661312, 3, 0, _vq_quantlist__44c5_s_p8_1, NULL, &_vq_auxt__44c5_s_p8_1, NULL, 0 }; static long _vq_quantlist__44c5_s_p9_0[] = { 7, 6, 8, 5, 9, 4, 10, 3, 11, 2, 12, 1, 13, 0, 14, }; static long _vq_lengthlist__44c5_s_p9_0[] = { 1, 3, 3,11,11,11,11,11,11,11,11,11,11,11,11, 5, 7, 7,11,11,11,11,11,11,11,11,11,11,11,11, 5, 9, 7,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, 11,11,11,11,11,11,11,11,11,11,11,11,11,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10, }; static float _vq_quantthresh__44c5_s_p9_0[] = { -2320.5, -1963.5, -1606.5, -1249.5, -892.5, -535.5, -178.5, 178.5, 535.5, 892.5, 1249.5, 1606.5, 1963.5, 2320.5, }; static long _vq_quantmap__44c5_s_p9_0[] = { 13, 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, 14, }; static encode_aux_threshmatch _vq_auxt__44c5_s_p9_0 = { _vq_quantthresh__44c5_s_p9_0, _vq_quantmap__44c5_s_p9_0, 15, 15 }; static static_codebook _44c5_s_p9_0 = { 2, 225, _vq_lengthlist__44c5_s_p9_0, 1, -512522752, 1628852224, 4, 0, _vq_quantlist__44c5_s_p9_0, NULL, &_vq_auxt__44c5_s_p9_0, NULL, 0 }; static long _vq_quantlist__44c5_s_p9_1[] = { 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15, 0, 16, }; static long _vq_lengthlist__44c5_s_p9_1[] = { 1, 4, 4, 6, 6, 8, 7, 9, 9,10,10,11,11,12,12,13, 13, 6, 5, 5, 6, 6, 8, 8,10,10,11,11,12,12,13,13, 13,13, 6, 5, 5, 7, 7, 8, 8,10,10,11,11,12,12,13, 13,13,13,18, 7, 7, 8, 8, 9, 9,10,11,11,11,12,12, 13,13,13,14,18, 7, 7, 8, 8, 9, 9,11,10,12,12,13, 13,13,13,14,15,18,12,12, 9, 9,10,10,11,11,12,12, 13,13,13,14,14,14,18,12,12, 9, 8,10,10,11,11,12, 12,14,13,13,14,15,15,18,16,18,11,11,11,11,12,12, 13,13,13,14,14,14,14,15,17,18,17,11,10,11, 9,12, 13,13,13,14,14,13,14,14,14,18,18,18,13,14,11,12, 12,12,13,14,13,13,14,15,16,15,18,18,18,15,13,12, 9,12,11,13,14,14,15,14,14,16,14,18,18,18,18,18, 12,13,13,13,13,14,15,14,15,15,15,15,18,18,18,18, 17,14,12,13,11,14,12,15,14,14,15,16,15,18,18,18, 17,18,15,18,13,13,14,13,15,14,16,15,17,16,18,18, 17,18,18,15,17,14,13,14,12,14,14,15,15,15,15,18, 18,18,17,17,18,18,14,15,14,14,14,14,15,14,16,16, 17,18,18,18,18,17,17,15,15,13,13,15,13,15,13,15, 15, }; static float _vq_quantthresh__44c5_s_p9_1[] = { -157.5, -136.5, -115.5, -94.5, -73.5, -52.5, -31.5, -10.5, 10.5, 31.5, 52.5, 73.5, 94.5, 115.5, 136.5, 157.5, }; static long _vq_quantmap__44c5_s_p9_1[] = { 15, 13, 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, 14, 16, }; static encode_aux_threshmatch _vq_auxt__44c5_s_p9_1 = { _vq_quantthresh__44c5_s_p9_1, _vq_quantmap__44c5_s_p9_1, 17, 17 }; static static_codebook _44c5_s_p9_1 = { 2, 289, _vq_lengthlist__44c5_s_p9_1, 1, -520814592, 1620377600, 5, 0, _vq_quantlist__44c5_s_p9_1, NULL, &_vq_auxt__44c5_s_p9_1, NULL, 0 }; static long _vq_quantlist__44c5_s_p9_2[] = { 10, 9, 11, 8, 12, 7, 13, 6, 14, 5, 15, 4, 16, 3, 17, 2, 18, 1, 19, 0, 20, }; static long _vq_lengthlist__44c5_s_p9_2[] = { 3, 5, 5, 6, 6, 7, 7, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9,11, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9,10,11, 5, 5, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,11, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 10,10,10,10,11,11,11, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,10,10,11,11,11, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9,10,10,10,10,10,10,11,11, 11, 8, 8, 8, 8, 9, 8, 9, 9, 9, 9, 9, 9,10,10,10, 10,10,10,11,11,11, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9,10,10,10,10,10,10,10,11,11,11,11,11, 8, 8, 9, 9, 9, 9, 9, 9,10,10,10,10,10,10,10,10,11,11,11, 11,11, 9, 9, 9, 9, 9, 9, 9,10,10,10,10,10,10,10, 10,10,11,11,11,11,11, 9, 9, 9, 9, 9, 9, 9,10,10, 10,10,10,10,10,10,10,11,11,11,11,11, 9, 9, 9, 9, 9, 9,10,10,10,10,10,10,10,10,10,10,11,11,11,11, 11,11,11, 9, 9, 9, 9,10,10,10,10,10,10,10,10,10, 10,11,11,11,11,11,11,11,10, 9,10,10,10,10,10,10, 10,10,10, 9,10,10,11,11,11,11,11,11,11, 9, 9,10, 10,10,10,10,10,10,10,10,10,10,10,11,11,11,11,11, 11,11,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 11,11,11,11,11,11,11,11,11,10,10,10,10,10, 9,10, 10,10,10,10,10,11,11,11,11,11,11,11,11,11,10,10, 10,10,10,10,10,10,10,10,10,10,11,11,11,11,11,11, 11,11,11,10,10,10,10,10,10,10,10,10,10,10,10,11, 11,11,11,11,11,11,11,11,10,10,10,10,10,10,10,10, 10,10,10,10,11,11,11,11,11,11,11,11,11,11,11,10, 10,10,10,10,10,10,10,10,10, }; static float _vq_quantthresh__44c5_s_p9_2[] = { -9.5, -8.5, -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, 9.5, }; static long _vq_quantmap__44c5_s_p9_2[] = { 19, 17, 15, 13, 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, }; static encode_aux_threshmatch _vq_auxt__44c5_s_p9_2 = { _vq_quantthresh__44c5_s_p9_2, _vq_quantmap__44c5_s_p9_2, 21, 21 }; static static_codebook _44c5_s_p9_2 = { 2, 441, _vq_lengthlist__44c5_s_p9_2, 1, -529268736, 1611661312, 5, 0, _vq_quantlist__44c5_s_p9_2, NULL, &_vq_auxt__44c5_s_p9_2, NULL, 0 }; static long _huff_lengthlist__44c5_s_short[] = { 3, 9,10,15,10,10,11,15,15,17, 4, 5, 7, 8, 7, 7, 9,13,15,16, 7, 6, 6,10, 6, 8, 9,12,12,16,10, 8, 11, 8, 8, 7,11,15,17,17, 8, 5, 5, 8, 3, 4, 6,10, 15,17,10, 7, 7, 7, 4, 4, 5,10,14,17,10, 9, 8, 9, 6, 5, 6,10,14,17,12,12,11,12, 9, 8, 8,11,14,17, 13,14,13,10, 7, 5, 6, 9,13,17,14,14,14,10, 7, 5, 6, 7,10,15, }; static static_codebook _huff_book__44c5_s_short = { 2, 100, _huff_lengthlist__44c5_s_short, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _huff_lengthlist__44c6_s_long[] = { 3, 8,11,13,13,13,12,12,13,18, 6, 3, 4, 7, 9, 9, 11,11,13,16, 9, 4, 3, 5, 7, 7, 9,10,14,18,11, 7, 4, 4, 6, 6, 8,10,14,15,11, 9, 6, 6, 6, 6, 8,10, 13,15,10, 9, 7, 6, 6, 6, 7, 8,12,12,12,10, 9, 8, 7, 6, 6, 7,11,12,11,10,10, 9, 9, 7, 7, 6, 9,12, 12,12,13,13,13,10, 9, 8,10,12,13,14,16,16,17,14, 12,11,11,13, }; static static_codebook _huff_book__44c6_s_long = { 2, 100, _huff_lengthlist__44c6_s_long, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _vq_quantlist__44c6_s_p1_0[] = { 1, 0, 2, }; static long _vq_lengthlist__44c6_s_p1_0[] = { 1, 5, 5, 0, 5, 5, 0, 5, 5, 5, 8, 7, 0, 9, 8, 0, 8, 8, 6, 7, 8, 0, 8, 9, 0, 8, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 8, 8, 0, 8, 8, 0, 8, 8, 5, 8, 8, 0, 8, 8, 0, 8, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 9, 8, 0, 8, 8, 0, 8, 8, 5, 8, 9, 0, 8, 8, 0, 8, 8, }; static float _vq_quantthresh__44c6_s_p1_0[] = { -0.5, 0.5, }; static long _vq_quantmap__44c6_s_p1_0[] = { 1, 0, 2, }; static encode_aux_threshmatch _vq_auxt__44c6_s_p1_0 = { _vq_quantthresh__44c6_s_p1_0, _vq_quantmap__44c6_s_p1_0, 3, 3 }; static static_codebook _44c6_s_p1_0 = { 4, 81, _vq_lengthlist__44c6_s_p1_0, 1, -535822336, 1611661312, 2, 0, _vq_quantlist__44c6_s_p1_0, NULL, &_vq_auxt__44c6_s_p1_0, NULL, 0 }; static long _vq_quantlist__44c6_s_p2_0[] = { 2, 1, 3, 0, 4, }; static long _vq_lengthlist__44c6_s_p2_0[] = { 3, 5, 5, 8, 8, 0, 5, 5, 9, 9, 0, 5, 5, 9, 9, 0, 7, 7,10,10, 0, 0, 0,10,10, 5, 7, 7, 9, 9, 0, 8, 7,10, 9, 0, 8, 8,10,10, 0,10,10,11,11, 0, 0, 0, 11,11, 5, 7, 7, 9, 9, 0, 7, 8, 9,10, 0, 7, 8,10, 10, 0,10,10,11,11, 0, 0, 0,11,11, 8, 9, 9,11,10, 0,11,10,12,12, 0,11,11,12,12, 0,13,13,14,14, 0, 0, 0,14,14, 8, 9, 9,10,11, 0,10,11,12,12, 0,11, 11,12,12, 0,13,13,14,14, 0, 0, 0,14,14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 8, 8,11,11, 0, 7, 7,10,10, 0, 7, 7,10,10, 0, 9, 8,11,10, 0, 0, 0,11,11, 5, 7, 8,11,11, 0, 7, 7,10,10, 0, 7, 7,10,10, 0, 8, 9,10,11, 0, 0, 0,11,11, 9,10,10,12,12, 0,10,10, 12,11, 0,10,10,12,12, 0,12,12,13,13, 0, 0, 0,13, 13, 9,10,10,12,12, 0,10,10,11,12, 0,10,10,12,12, 0,12,12,13,13, 0, 0, 0,13,13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 8, 7,11,10, 0, 7, 7,10,10, 0, 7, 7, 10,10, 0, 8, 9,11,11, 0, 0, 0,11,10, 5, 7, 8,10, 11, 0, 7, 7,10,10, 0, 7, 7,10,10, 0, 9, 8,11,11, 0, 0, 0,11,11, 9,10,10,12,12, 0,10,10,12,12, 0, 10,10,12,12, 0,12,12,13,13, 0, 0, 0,13,13, 9, 9, 10,12,12, 0,10,10,12,12, 0,10,10,12,12, 0,12,12, 13,13, 0, 0, 0,13,13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7,10,10,13,13, 0, 9, 8,12,12, 0, 8, 9,12,12, 0, 10, 9,12,12, 0, 0, 0,12,12, 7,10,10,13,13, 0, 9, 9,12,12, 0, 9, 8,12,12, 0, 9,10,12,12, 0, 0, 0, 12,12,10,11,11,14,14, 0,11,10,13,13, 0,11,11,13, 13, 0,12,12,13,13, 0, 0, 0,13,13,10,11,11,14,14, 0,10,11,13,13, 0,11,11,13,13, 0,12,12,13,13, 0, 0, 0,13,13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,10, 11,11,14,14, 0,11,11,13,13, 0,11,10,13,13, 0,12, 12,13,13, 0, 0, 0,13,13,10,11,11,14,14, 0,11,11, 13,13, 0,10,11,13,13, 0,12,12,13,13, 0, 0, 0,13, 13, }; static float _vq_quantthresh__44c6_s_p2_0[] = { -1.5, -0.5, 0.5, 1.5, }; static long _vq_quantmap__44c6_s_p2_0[] = { 3, 1, 0, 2, 4, }; static encode_aux_threshmatch _vq_auxt__44c6_s_p2_0 = { _vq_quantthresh__44c6_s_p2_0, _vq_quantmap__44c6_s_p2_0, 5, 5 }; static static_codebook _44c6_s_p2_0 = { 4, 625, _vq_lengthlist__44c6_s_p2_0, 1, -533725184, 1611661312, 3, 0, _vq_quantlist__44c6_s_p2_0, NULL, &_vq_auxt__44c6_s_p2_0, NULL, 0 }; static long _vq_quantlist__44c6_s_p3_0[] = { 4, 3, 5, 2, 6, 1, 7, 0, 8, }; static long _vq_lengthlist__44c6_s_p3_0[] = { 2, 4, 4, 5, 5, 7, 7, 9, 9, 0, 4, 4, 6, 6, 7, 7, 9, 9, 0, 4, 4, 6, 6, 7, 7, 9, 9, 0, 5, 5, 6, 6, 8, 8,10,10, 0, 0, 0, 6, 6, 8, 8,10,10, 0, 0, 0, 7, 7, 8, 8,10,10, 0, 0, 0, 7, 7, 9, 9,10,10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; static float _vq_quantthresh__44c6_s_p3_0[] = { -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, }; static long _vq_quantmap__44c6_s_p3_0[] = { 7, 5, 3, 1, 0, 2, 4, 6, 8, }; static encode_aux_threshmatch _vq_auxt__44c6_s_p3_0 = { _vq_quantthresh__44c6_s_p3_0, _vq_quantmap__44c6_s_p3_0, 9, 9 }; static static_codebook _44c6_s_p3_0 = { 2, 81, _vq_lengthlist__44c6_s_p3_0, 1, -531628032, 1611661312, 4, 0, _vq_quantlist__44c6_s_p3_0, NULL, &_vq_auxt__44c6_s_p3_0, NULL, 0 }; static long _vq_quantlist__44c6_s_p4_0[] = { 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15, 0, 16, }; static long _vq_lengthlist__44c6_s_p4_0[] = { 3, 4, 4, 6, 6, 7, 7, 8, 8, 8, 8, 9, 9,10,10,11, 11, 0, 4, 4, 6, 6, 7, 7, 8, 8, 8, 9,10,10,11,11, 11,11, 0, 4, 4, 6, 6, 7, 7, 8, 8, 9, 9,10,10,11, 11,11,11, 0, 5, 5, 6, 6, 8, 8, 9, 9, 9, 9,10,10, 11,11,12,12, 0, 0, 0, 6, 6, 8, 8, 9, 9, 9, 9,10, 10,11,11,12,12, 0, 0, 0, 7, 7, 8, 8, 9, 9,10,10, 11,11,12,11,12,12, 0, 0, 0, 7, 7, 8, 8, 9, 9,10, 10,11,11,12,12,12,12, 0, 0, 0, 6, 6, 7, 7, 9, 9, 10,10,11,11,12,12,12,13, 0, 0, 0, 0, 0, 7, 7, 9, 9,10,10,11,11,12,12,12,13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; static float _vq_quantthresh__44c6_s_p4_0[] = { -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, }; static long _vq_quantmap__44c6_s_p4_0[] = { 15, 13, 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, 14, 16, }; static encode_aux_threshmatch _vq_auxt__44c6_s_p4_0 = { _vq_quantthresh__44c6_s_p4_0, _vq_quantmap__44c6_s_p4_0, 17, 17 }; static static_codebook _44c6_s_p4_0 = { 2, 289, _vq_lengthlist__44c6_s_p4_0, 1, -529530880, 1611661312, 5, 0, _vq_quantlist__44c6_s_p4_0, NULL, &_vq_auxt__44c6_s_p4_0, NULL, 0 }; static long _vq_quantlist__44c6_s_p5_0[] = { 1, 0, 2, }; static long _vq_lengthlist__44c6_s_p5_0[] = { 1, 4, 4, 5, 7, 7, 5, 7, 7, 4, 7, 7, 9,10,10,10, 10,10, 4, 7, 7, 9,10,10,10,10,10, 5, 9, 9, 9,11, 11, 9,11,11, 7,10,10,11,12,11,12,12,12, 7,10,10, 11,12,12,12,12,12, 6,10,10, 9,11,11,10,11,11, 7, 10, 9,11,12,12,11,12,11, 7,10,10,11,12,12,11,12, 12, }; static float _vq_quantthresh__44c6_s_p5_0[] = { -5.5, 5.5, }; static long _vq_quantmap__44c6_s_p5_0[] = { 1, 0, 2, }; static encode_aux_threshmatch _vq_auxt__44c6_s_p5_0 = { _vq_quantthresh__44c6_s_p5_0, _vq_quantmap__44c6_s_p5_0, 3, 3 }; static static_codebook _44c6_s_p5_0 = { 4, 81, _vq_lengthlist__44c6_s_p5_0, 1, -529137664, 1618345984, 2, 0, _vq_quantlist__44c6_s_p5_0, NULL, &_vq_auxt__44c6_s_p5_0, NULL, 0 }; static long _vq_quantlist__44c6_s_p5_1[] = { 5, 4, 6, 3, 7, 2, 8, 1, 9, 0, 10, }; static long _vq_lengthlist__44c6_s_p5_1[] = { 3, 4, 4, 6, 6, 8, 8, 8, 8, 9, 9,11, 4, 4, 6, 6, 8, 8, 9, 9, 9, 9,11, 4, 4, 6, 6, 8, 8, 9, 8, 9, 9,12, 5, 5, 6, 6, 8, 8, 9, 9, 9, 9,12,12,12, 6, 6, 8, 8, 9, 9, 9, 9,11,11,11, 7, 7, 8, 8, 9, 9, 9, 9,11,11,11, 7, 7, 8, 8, 8, 8, 9, 9,11,11,11, 7, 7, 8, 8, 8, 8, 9, 9,11,11,11,11,11, 8, 8, 8, 8, 9, 9,11,11,11,11,11, 7, 7, 8, 8, 8, 8,11,11, 11,11,11, 7, 7, 8, 8, 8, 8, }; static float _vq_quantthresh__44c6_s_p5_1[] = { -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, }; static long _vq_quantmap__44c6_s_p5_1[] = { 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, }; static encode_aux_threshmatch _vq_auxt__44c6_s_p5_1 = { _vq_quantthresh__44c6_s_p5_1, _vq_quantmap__44c6_s_p5_1, 11, 11 }; static static_codebook _44c6_s_p5_1 = { 2, 121, _vq_lengthlist__44c6_s_p5_1, 1, -531365888, 1611661312, 4, 0, _vq_quantlist__44c6_s_p5_1, NULL, &_vq_auxt__44c6_s_p5_1, NULL, 0 }; static long _vq_quantlist__44c6_s_p6_0[] = { 6, 5, 7, 4, 8, 3, 9, 2, 10, 1, 11, 0, 12, }; static long _vq_lengthlist__44c6_s_p6_0[] = { 1, 4, 4, 6, 7, 8, 8, 8, 8, 9, 9,10,10, 5, 5, 5, 7, 7, 9, 9, 9, 9,10,10,11,11, 6, 5, 5, 7, 7, 9, 9, 9, 9,10,10,11,11, 0, 7, 7, 7, 7, 9, 9,10,10, 11,11,11,11, 0, 7, 7, 7, 7, 9, 9,10,10,11,11,12, 12, 0,11,11, 8, 8,10, 9,10,11,11,11,12,12, 0,12, 12, 8, 8,10, 9,11,11,12,11,13,13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; static float _vq_quantthresh__44c6_s_p6_0[] = { -27.5, -22.5, -17.5, -12.5, -7.5, -2.5, 2.5, 7.5, 12.5, 17.5, 22.5, 27.5, }; static long _vq_quantmap__44c6_s_p6_0[] = { 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, }; static encode_aux_threshmatch _vq_auxt__44c6_s_p6_0 = { _vq_quantthresh__44c6_s_p6_0, _vq_quantmap__44c6_s_p6_0, 13, 13 }; static static_codebook _44c6_s_p6_0 = { 2, 169, _vq_lengthlist__44c6_s_p6_0, 1, -526516224, 1616117760, 4, 0, _vq_quantlist__44c6_s_p6_0, NULL, &_vq_auxt__44c6_s_p6_0, NULL, 0 }; static long _vq_quantlist__44c6_s_p6_1[] = { 2, 1, 3, 0, 4, }; static long _vq_lengthlist__44c6_s_p6_1[] = { 3, 4, 4, 5, 5, 6, 4, 4, 5, 5, 6, 4, 4, 5, 4, 6, 5, 5, 5, 5, 6, 6, 6, 5, 5, }; static float _vq_quantthresh__44c6_s_p6_1[] = { -1.5, -0.5, 0.5, 1.5, }; static long _vq_quantmap__44c6_s_p6_1[] = { 3, 1, 0, 2, 4, }; static encode_aux_threshmatch _vq_auxt__44c6_s_p6_1 = { _vq_quantthresh__44c6_s_p6_1, _vq_quantmap__44c6_s_p6_1, 5, 5 }; static static_codebook _44c6_s_p6_1 = { 2, 25, _vq_lengthlist__44c6_s_p6_1, 1, -533725184, 1611661312, 3, 0, _vq_quantlist__44c6_s_p6_1, NULL, &_vq_auxt__44c6_s_p6_1, NULL, 0 }; static long _vq_quantlist__44c6_s_p7_0[] = { 6, 5, 7, 4, 8, 3, 9, 2, 10, 1, 11, 0, 12, }; static long _vq_lengthlist__44c6_s_p7_0[] = { 1, 4, 4, 7, 7, 8, 8, 9, 9,10,10,11,11, 5, 5, 5, 7, 7, 8, 8, 9, 9,11,11,12,12, 6, 5, 5, 7, 7, 9, 9, 9, 9,11,11,12,12,19, 7, 7, 7, 7, 9, 9,10,10, 11,11,12,12,19, 7, 7, 7, 7, 9, 9,10,10,11,11,12, 12,19,11,11, 8, 8,10,10,11,11,11,12,12,12,19,12, 12, 8, 8,10, 9,11,11,12,12,13,12,19,19,19,11,11, 10,10,11,11,12,12,13,13,19,19,19,11,11,10,10,11, 11,12,12,13,13,19,19,19,14,14,11,11,11,12,13,13, 13,13,19,19,19,15,15,11,11,12,12,13,12,14,14,19, 19,19,19,18,13,13,12,12,13,13,14,14,18,18,18,18, 18,13,12,12,12,13,13,14,14, }; static float _vq_quantthresh__44c6_s_p7_0[] = { -60.5, -49.5, -38.5, -27.5, -16.5, -5.5, 5.5, 16.5, 27.5, 38.5, 49.5, 60.5, }; static long _vq_quantmap__44c6_s_p7_0[] = { 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, }; static encode_aux_threshmatch _vq_auxt__44c6_s_p7_0 = { _vq_quantthresh__44c6_s_p7_0, _vq_quantmap__44c6_s_p7_0, 13, 13 }; static static_codebook _44c6_s_p7_0 = { 2, 169, _vq_lengthlist__44c6_s_p7_0, 1, -523206656, 1618345984, 4, 0, _vq_quantlist__44c6_s_p7_0, NULL, &_vq_auxt__44c6_s_p7_0, NULL, 0 }; static long _vq_quantlist__44c6_s_p7_1[] = { 5, 4, 6, 3, 7, 2, 8, 1, 9, 0, 10, }; static long _vq_lengthlist__44c6_s_p7_1[] = { 3, 5, 5, 6, 6, 7, 7, 7, 7, 7, 7, 9, 5, 5, 7, 7, 7, 7, 7, 7, 8, 8, 9, 5, 5, 6, 6, 7, 7, 7, 7, 7, 7, 9, 6, 6, 7, 7, 7, 7, 7, 7, 7, 8, 9, 9, 9, 7, 7, 7, 7, 7, 8, 7, 8, 9, 9, 9, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 7, 7, 7, 7, 7, 7, 7, 7, 9, 9, 9, 7, 7, 8, 8, 7, 7, 8, 8, 9, 9, 9, 8, 9, 8, 8, 7, 7, 7, 7, 9, 9, 8, 8, 9, 8, 8, 7, 7, 8, 8, 9, 9, 9, 9, 8, 7, 7, 7, 7, 8, 8, }; static float _vq_quantthresh__44c6_s_p7_1[] = { -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, }; static long _vq_quantmap__44c6_s_p7_1[] = { 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, }; static encode_aux_threshmatch _vq_auxt__44c6_s_p7_1 = { _vq_quantthresh__44c6_s_p7_1, _vq_quantmap__44c6_s_p7_1, 11, 11 }; static static_codebook _44c6_s_p7_1 = { 2, 121, _vq_lengthlist__44c6_s_p7_1, 1, -531365888, 1611661312, 4, 0, _vq_quantlist__44c6_s_p7_1, NULL, &_vq_auxt__44c6_s_p7_1, NULL, 0 }; static long _vq_quantlist__44c6_s_p8_0[] = { 7, 6, 8, 5, 9, 4, 10, 3, 11, 2, 12, 1, 13, 0, 14, }; static long _vq_lengthlist__44c6_s_p8_0[] = { 1, 4, 4, 7, 7, 8, 8, 7, 7, 9, 9, 9,10,11,11, 6, 5, 5, 8, 8, 9, 9, 8, 8, 9, 9,10,10,11,11, 6, 5, 5, 8, 8, 9, 9, 8, 8, 9, 9,10,10,11,11,17, 8, 8, 8, 8,10,10, 8, 9,10,10,11,11,12,11,17, 8, 8, 9, 9,10,10, 9, 9,10,10,11,12,12,12,17,12,13, 9, 9, 10,10, 9,10,10,10,11,11,13,12,17,13,13,10, 9,10, 10,10,10,10,11,12,11,12,12,17,17,17, 9, 9, 9, 9, 10,10,11,11,11,12,12,13,17,17,17, 9, 9, 9, 9,11, 10,11,11,12,12,12,13,17,17,17,13,13,10,10,11,11, 12,11,12,13,13,13,17,17,17,14,13,10, 9,11, 9,12, 12,12,13,13,14,17,17,17,17,17,11,12,11,11,12,12, 13,14,13,14,17,17,17,17,17,12,10,11, 8,12,11,13, 14,14,14,17,17,16,16,16,13,15,11,12,12,13,13,13, 14,14,16,16,16,16,16,14,13,12, 9,13,10,14,13,14, 13, }; static float _vq_quantthresh__44c6_s_p8_0[] = { -136.5, -115.5, -94.5, -73.5, -52.5, -31.5, -10.5, 10.5, 31.5, 52.5, 73.5, 94.5, 115.5, 136.5, }; static long _vq_quantmap__44c6_s_p8_0[] = { 13, 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, 14, }; static encode_aux_threshmatch _vq_auxt__44c6_s_p8_0 = { _vq_quantthresh__44c6_s_p8_0, _vq_quantmap__44c6_s_p8_0, 15, 15 }; static static_codebook _44c6_s_p8_0 = { 2, 225, _vq_lengthlist__44c6_s_p8_0, 1, -520986624, 1620377600, 4, 0, _vq_quantlist__44c6_s_p8_0, NULL, &_vq_auxt__44c6_s_p8_0, NULL, 0 }; static long _vq_quantlist__44c6_s_p8_1[] = { 10, 9, 11, 8, 12, 7, 13, 6, 14, 5, 15, 4, 16, 3, 17, 2, 18, 1, 19, 0, 20, }; static long _vq_lengthlist__44c6_s_p8_1[] = { 3, 5, 5, 6, 6, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 8, 9, 9, 9,11, 6, 6, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,10, 6, 6, 7, 7, 8, 7, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,11, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,11,10,11, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,11,11,11, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9,10, 9, 9, 9, 9,11,11, 11, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9,10,10, 9,10, 9, 10,10, 9,11,11,11, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10,10, 9,10, 9, 9, 9, 9,11,11,11,11,11, 8, 8, 9, 9, 9, 9, 9, 9, 9,10,10,10,10,10,10,10,11,11,11, 11,11, 9, 9, 9, 9, 9, 9,10, 9, 9, 9,10,10, 9, 9, 9, 9,11,11,11,11,11, 9, 9, 9, 9, 9, 9, 9,10,10, 9,10, 9,10,10,10,10,11,11,11,11,11, 9, 9, 9, 9, 9, 9,10,10,10,10, 9,10,10, 9,10, 9,11,11,11,11, 11,11,11, 9, 9, 9, 9,10, 9,10, 9, 9,10,10,10,10, 10,10,11,11,11,11,11,11, 9, 9, 9, 9,10,10,10,10, 9,10, 9,10,10, 9,11,11,11,11,11,11,10, 9, 9, 9, 9, 9,10, 9,10,10,10,10,10,10,10,11,11,11,11,11, 11,11, 9, 9,10,10,10,10,10,10,10,10,10,10,10,10, 11,11,11,11,11,11,11,11,11, 9,10, 9,10, 9,10,10, 10,10,10,10,10,11,11,11,11,11,11,11,11,11,10,10, 10,10,10,10,10,10,10,10,10,10,11,11,11,11,11,11, 11,11,11,10,10, 9,10,10,10,10, 9,10, 9,10,10,11, 11,11,11,11,11,11,11,11,10,10,10, 9,10,10,10,10, 10,10,10,10,11,11,11,11,11,11,11,11,11,11,11,10, 10, 9,10,10,10,10,10,10,10, }; static float _vq_quantthresh__44c6_s_p8_1[] = { -9.5, -8.5, -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, 9.5, }; static long _vq_quantmap__44c6_s_p8_1[] = { 19, 17, 15, 13, 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, }; static encode_aux_threshmatch _vq_auxt__44c6_s_p8_1 = { _vq_quantthresh__44c6_s_p8_1, _vq_quantmap__44c6_s_p8_1, 21, 21 }; static static_codebook _44c6_s_p8_1 = { 2, 441, _vq_lengthlist__44c6_s_p8_1, 1, -529268736, 1611661312, 5, 0, _vq_quantlist__44c6_s_p8_1, NULL, &_vq_auxt__44c6_s_p8_1, NULL, 0 }; static long _vq_quantlist__44c6_s_p9_0[] = { 6, 5, 7, 4, 8, 3, 9, 2, 10, 1, 11, 0, 12, }; static long _vq_lengthlist__44c6_s_p9_0[] = { 1, 4, 4, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 6, 9, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 6, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, }; static float _vq_quantthresh__44c6_s_p9_0[] = { -3503.5, -2866.5, -2229.5, -1592.5, -955.5, -318.5, 318.5, 955.5, 1592.5, 2229.5, 2866.5, 3503.5, }; static long _vq_quantmap__44c6_s_p9_0[] = { 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, }; static encode_aux_threshmatch _vq_auxt__44c6_s_p9_0 = { _vq_quantthresh__44c6_s_p9_0, _vq_quantmap__44c6_s_p9_0, 13, 13 }; static static_codebook _44c6_s_p9_0 = { 2, 169, _vq_lengthlist__44c6_s_p9_0, 1, -511845376, 1630791680, 4, 0, _vq_quantlist__44c6_s_p9_0, NULL, &_vq_auxt__44c6_s_p9_0, NULL, 0 }; static long _vq_quantlist__44c6_s_p9_1[] = { 6, 5, 7, 4, 8, 3, 9, 2, 10, 1, 11, 0, 12, }; static long _vq_lengthlist__44c6_s_p9_1[] = { 1, 4, 4, 7, 7, 7, 7, 7, 7, 8, 9,10,11, 6, 6, 6, 7, 8, 8, 8, 7, 8, 9,10,11,10, 6, 5, 6, 7, 8, 8, 8, 8, 8, 9,10,10,11,14, 9, 8, 8, 8, 9, 8, 8, 9, 10,10,12,11,14, 8, 8, 9, 8, 9, 8, 8, 8,11,10,11, 11,14,14,13, 8, 9, 9, 9, 9,10,11,11,12,12,13,12, 12, 8, 7,10, 9, 9, 9,11,11,11,10,13,13,13, 8, 9, 9, 8,12,11,11,11,13,11,13,13,13, 9, 8, 9, 8,10, 10,11,10,11,10,13,13,13,12,12, 9,10,11,11,11,12, 13,12,13,13,13,13,12,10,10,10, 9,13,12,12,13,13, 13,13,13,13,12,12,10,10,12,12,13,13,13,13,13,13, 13,12,12,11,12,12,12,12,13, }; static float _vq_quantthresh__44c6_s_p9_1[] = { -269.5, -220.5, -171.5, -122.5, -73.5, -24.5, 24.5, 73.5, 122.5, 171.5, 220.5, 269.5, }; static long _vq_quantmap__44c6_s_p9_1[] = { 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, }; static encode_aux_threshmatch _vq_auxt__44c6_s_p9_1 = { _vq_quantthresh__44c6_s_p9_1, _vq_quantmap__44c6_s_p9_1, 13, 13 }; static static_codebook _44c6_s_p9_1 = { 2, 169, _vq_lengthlist__44c6_s_p9_1, 1, -518889472, 1622704128, 4, 0, _vq_quantlist__44c6_s_p9_1, NULL, &_vq_auxt__44c6_s_p9_1, NULL, 0 }; static long _vq_quantlist__44c6_s_p9_2[] = { 24, 23, 25, 22, 26, 21, 27, 20, 28, 19, 29, 18, 30, 17, 31, 16, 32, 15, 33, 14, 34, 13, 35, 12, 36, 11, 37, 10, 38, 9, 39, 8, 40, 7, 41, 6, 42, 5, 43, 4, 44, 3, 45, 2, 46, 1, 47, 0, 48, }; static long _vq_lengthlist__44c6_s_p9_2[] = { 2, 4, 3, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 6, 7, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, }; static float _vq_quantthresh__44c6_s_p9_2[] = { -23.5, -22.5, -21.5, -20.5, -19.5, -18.5, -17.5, -16.5, -15.5, -14.5, -13.5, -12.5, -11.5, -10.5, -9.5, -8.5, -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, 9.5, 10.5, 11.5, 12.5, 13.5, 14.5, 15.5, 16.5, 17.5, 18.5, 19.5, 20.5, 21.5, 22.5, 23.5, }; static long _vq_quantmap__44c6_s_p9_2[] = { 47, 45, 43, 41, 39, 37, 35, 33, 31, 29, 27, 25, 23, 21, 19, 17, 15, 13, 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, }; static encode_aux_threshmatch _vq_auxt__44c6_s_p9_2 = { _vq_quantthresh__44c6_s_p9_2, _vq_quantmap__44c6_s_p9_2, 49, 49 }; static static_codebook _44c6_s_p9_2 = { 1, 49, _vq_lengthlist__44c6_s_p9_2, 1, -526909440, 1611661312, 6, 0, _vq_quantlist__44c6_s_p9_2, NULL, &_vq_auxt__44c6_s_p9_2, NULL, 0 }; static long _huff_lengthlist__44c6_s_short[] = { 4, 9,11,11,13,13,17,16,17,17, 4, 4, 6, 7, 9, 9, 12,15,17,17, 7, 5, 4, 5, 7, 8,11,12,17,17, 9, 6, 4, 3, 5, 6,10,14,17,17,11, 8, 6, 4, 5, 6, 9,13, 17,17,11,10, 7, 5, 5, 5, 8,12,17,17,13,12, 9, 8, 7, 6, 8,11,17,17,13,13, 9, 6, 6, 5, 6, 9,17,17, 17,16,10, 8, 7, 7, 8, 9,17,17,17,17,14,12,11,11, 11,13,17,17, }; static static_codebook _huff_book__44c6_s_short = { 2, 100, _huff_lengthlist__44c6_s_short, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _huff_lengthlist__44c7_s_long[] = { 3, 8,11,13,14,13,13,12,14,16, 6, 4, 5, 7, 9,10, 11,11,13,15,10, 4, 3, 5, 7, 7,10,10,14,16,11, 7, 4, 4, 5, 6, 8,10,13,15,12, 9, 6, 5, 5, 6, 8, 9, 13,15,11, 9, 7, 6, 5, 5, 6, 8,11,13,11,10, 9, 8, 7, 6, 6, 7,11,12,12,11,10, 9, 8, 7, 6, 6, 9,11, 12,12,12,12,12,10, 9, 8,10,12,12,14,15,16,16,14, 12,10,11,13, }; static static_codebook _huff_book__44c7_s_long = { 2, 100, _huff_lengthlist__44c7_s_long, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _vq_quantlist__44c7_s_p1_0[] = { 1, 0, 2, }; static long _vq_lengthlist__44c7_s_p1_0[] = { 1, 5, 5, 0, 5, 5, 0, 5, 5, 6, 8, 7, 0, 9, 8, 0, 8, 8, 5, 7, 8, 0, 8, 9, 0, 8, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 8, 8, 0, 8, 8, 0, 8, 8, 5, 8, 8, 0, 8, 8, 0, 8, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 9, 8, 0, 8, 8, 0, 8, 8, 5, 8, 9, 0, 8, 8, 0, 8, 8, }; static float _vq_quantthresh__44c7_s_p1_0[] = { -0.5, 0.5, }; static long _vq_quantmap__44c7_s_p1_0[] = { 1, 0, 2, }; static encode_aux_threshmatch _vq_auxt__44c7_s_p1_0 = { _vq_quantthresh__44c7_s_p1_0, _vq_quantmap__44c7_s_p1_0, 3, 3 }; static static_codebook _44c7_s_p1_0 = { 4, 81, _vq_lengthlist__44c7_s_p1_0, 1, -535822336, 1611661312, 2, 0, _vq_quantlist__44c7_s_p1_0, NULL, &_vq_auxt__44c7_s_p1_0, NULL, 0 }; static long _vq_quantlist__44c7_s_p2_0[] = { 2, 1, 3, 0, 4, }; static long _vq_lengthlist__44c7_s_p2_0[] = { 3, 5, 5, 8, 8, 0, 5, 5, 9, 9, 0, 5, 5, 9, 9, 0, 7, 7,10, 9, 0, 0, 0, 9,10, 5, 7, 7, 9, 9, 0, 8, 7,10, 9, 0, 8, 7,10, 9, 0,10, 9,11,11, 0, 0, 0, 11,11, 6, 7, 7, 9, 9, 0, 7, 8, 9,10, 0, 7, 8,10, 10, 0, 9, 9,11,11, 0, 0, 0,11,11, 8, 9, 9,11,10, 0,11,10,12,12, 0,11,11,12,12, 0,13,13,14,14, 0, 0, 0,14,14, 8, 9, 9,10,11, 0,10,11,11,12, 0,11, 11,12,12, 0,13,13,14,14, 0, 0, 0,14,14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 8, 7,11,11, 0, 7, 7,10,10, 0, 7, 7,10,10, 0, 9, 8,11,10, 0, 0, 0,11,11, 5, 7, 8,11,11, 0, 7, 7,10,10, 0, 7, 7,10,10, 0, 8, 9,10,11, 0, 0, 0,11,11, 9,10,10,12,12, 0,10,10, 12,11, 0,10,10,12,12, 0,12,12,13,13, 0, 0, 0,13, 13, 9,10,10,12,12, 0,10,10,11,12, 0,10,10,12,12, 0,12,12,13,13, 0, 0, 0,13,13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 8, 7,11,10, 0, 7, 7,10,10, 0, 7, 7, 10,10, 0, 9, 9,11,11, 0, 0, 0,11,10, 5, 7, 8,10, 11, 0, 7, 7,10,10, 0, 7, 7,10,10, 0, 9, 9,11,11, 0, 0, 0,10,11, 9,10, 9,12,11, 0,10,10,12,12, 0, 10,10,12,11, 0,12,12,13,13, 0, 0, 0,13,13, 9, 9, 10,11,12, 0,10,10,12,12, 0,10,10,11,12, 0,12,12, 13,13, 0, 0, 0,13,13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 9, 9,13,13, 0, 9, 8,12,12, 0, 8, 9,12,12, 0, 10, 9,12,12, 0, 0, 0,12,12, 7,10, 9,13,13, 0, 9, 9,12,12, 0, 9, 8,12,12, 0, 9,10,12,12, 0, 0, 0, 12,12,10,11,11,14,14, 0,11,10,13,12, 0,11,11,13, 13, 0,12,12,13,13, 0, 0, 0,13,13,10,11,11,14,14, 0,10,11,12,13, 0,11,11,13,13, 0,12,12,13,13, 0, 0, 0,13,13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,10, 11,11,14,14, 0,11,11,13,13, 0,11,10,13,13, 0,12, 12,13,13, 0, 0, 0,13,13,10,11,11,14,14, 0,11,11, 13,13, 0,10,11,13,13, 0,12,12,13,13, 0, 0, 0,13, 13, }; static float _vq_quantthresh__44c7_s_p2_0[] = { -1.5, -0.5, 0.5, 1.5, }; static long _vq_quantmap__44c7_s_p2_0[] = { 3, 1, 0, 2, 4, }; static encode_aux_threshmatch _vq_auxt__44c7_s_p2_0 = { _vq_quantthresh__44c7_s_p2_0, _vq_quantmap__44c7_s_p2_0, 5, 5 }; static static_codebook _44c7_s_p2_0 = { 4, 625, _vq_lengthlist__44c7_s_p2_0, 1, -533725184, 1611661312, 3, 0, _vq_quantlist__44c7_s_p2_0, NULL, &_vq_auxt__44c7_s_p2_0, NULL, 0 }; static long _vq_quantlist__44c7_s_p3_0[] = { 4, 3, 5, 2, 6, 1, 7, 0, 8, }; static long _vq_lengthlist__44c7_s_p3_0[] = { 2, 4, 4, 5, 5, 7, 7, 8, 8, 0, 4, 4, 6, 6, 7, 7, 9, 9, 0, 4, 4, 6, 6, 7, 7, 9, 9, 0, 5, 5, 6, 6, 8, 8,10,10, 0, 0, 0, 6, 6, 8, 8,10,10, 0, 0, 0, 7, 7, 9, 9,10,10, 0, 0, 0, 7, 7, 9, 9,10,10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; static float _vq_quantthresh__44c7_s_p3_0[] = { -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, }; static long _vq_quantmap__44c7_s_p3_0[] = { 7, 5, 3, 1, 0, 2, 4, 6, 8, }; static encode_aux_threshmatch _vq_auxt__44c7_s_p3_0 = { _vq_quantthresh__44c7_s_p3_0, _vq_quantmap__44c7_s_p3_0, 9, 9 }; static static_codebook _44c7_s_p3_0 = { 2, 81, _vq_lengthlist__44c7_s_p3_0, 1, -531628032, 1611661312, 4, 0, _vq_quantlist__44c7_s_p3_0, NULL, &_vq_auxt__44c7_s_p3_0, NULL, 0 }; static long _vq_quantlist__44c7_s_p4_0[] = { 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15, 0, 16, }; static long _vq_lengthlist__44c7_s_p4_0[] = { 3, 4, 4, 6, 5, 7, 7, 7, 7, 8, 8, 9, 9,10,10,11, 11, 0, 4, 4, 6, 6, 7, 7, 8, 8, 8, 8, 9,10,10,10, 11,11, 0, 4, 4, 6, 6, 7, 7, 8, 8, 8, 8,10,10,10, 11,11,11, 0, 5, 5, 6, 6, 8, 8, 9, 9, 9, 9,10,10, 11,11,12,12, 0, 0, 0, 6, 6, 8, 8, 9, 9, 9, 9,10, 10,11,11,12,12, 0, 0, 0, 7, 7, 8, 8, 9, 9,10,10, 11,11,12,12,12,12, 0, 0, 0, 7, 7, 8, 8, 9, 9,10, 10,11,11,12,12,12,12, 0, 0, 0, 7, 7, 8, 8, 9, 9, 10,10,11,11,12,12,13,13, 0, 0, 0, 0, 0, 8, 8, 9, 9,10,10,11,11,12,12,13,13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; static float _vq_quantthresh__44c7_s_p4_0[] = { -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, }; static long _vq_quantmap__44c7_s_p4_0[] = { 15, 13, 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, 14, 16, }; static encode_aux_threshmatch _vq_auxt__44c7_s_p4_0 = { _vq_quantthresh__44c7_s_p4_0, _vq_quantmap__44c7_s_p4_0, 17, 17 }; static static_codebook _44c7_s_p4_0 = { 2, 289, _vq_lengthlist__44c7_s_p4_0, 1, -529530880, 1611661312, 5, 0, _vq_quantlist__44c7_s_p4_0, NULL, &_vq_auxt__44c7_s_p4_0, NULL, 0 }; static long _vq_quantlist__44c7_s_p5_0[] = { 1, 0, 2, }; static long _vq_lengthlist__44c7_s_p5_0[] = { 1, 4, 4, 5, 7, 7, 5, 7, 7, 4, 7, 7,10,11,10,10, 11,11, 4, 7, 7,10,10,11,10,10,11, 5,10,10, 9,12, 11,10,12,12, 7,11,10,12,12,12,12,13,13, 7,10,11, 11,12,12,12,13,13, 5,10,10,10,12,12,10,12,12, 7, 11,10,12,13,13,12,12,12, 7,10,11,12,13,13,12,12, 12, }; static float _vq_quantthresh__44c7_s_p5_0[] = { -5.5, 5.5, }; static long _vq_quantmap__44c7_s_p5_0[] = { 1, 0, 2, }; static encode_aux_threshmatch _vq_auxt__44c7_s_p5_0 = { _vq_quantthresh__44c7_s_p5_0, _vq_quantmap__44c7_s_p5_0, 3, 3 }; static static_codebook _44c7_s_p5_0 = { 4, 81, _vq_lengthlist__44c7_s_p5_0, 1, -529137664, 1618345984, 2, 0, _vq_quantlist__44c7_s_p5_0, NULL, &_vq_auxt__44c7_s_p5_0, NULL, 0 }; static long _vq_quantlist__44c7_s_p5_1[] = { 5, 4, 6, 3, 7, 2, 8, 1, 9, 0, 10, }; static long _vq_lengthlist__44c7_s_p5_1[] = { 3, 5, 5, 6, 6, 7, 7, 8, 8, 8, 9,12, 4, 4, 6, 6, 7, 7, 8, 8, 9, 9,11, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9,12, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9,12,12,12, 6, 6, 7, 7, 8, 8, 9, 9,12,12,12, 6, 6, 7, 7, 8, 8, 9, 9,12,11,11, 6, 6, 7, 7, 8, 8, 9, 9,12,12,11, 7, 7, 8, 8, 8, 8, 8, 8,12,12,12,11,11, 8, 8, 8, 8, 8, 8,12,12,12,11,11, 7, 7, 7, 7, 8, 8,12,12, 12,11,11, 7, 7, 7, 7, 8, 8, }; static float _vq_quantthresh__44c7_s_p5_1[] = { -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, }; static long _vq_quantmap__44c7_s_p5_1[] = { 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, }; static encode_aux_threshmatch _vq_auxt__44c7_s_p5_1 = { _vq_quantthresh__44c7_s_p5_1, _vq_quantmap__44c7_s_p5_1, 11, 11 }; static static_codebook _44c7_s_p5_1 = { 2, 121, _vq_lengthlist__44c7_s_p5_1, 1, -531365888, 1611661312, 4, 0, _vq_quantlist__44c7_s_p5_1, NULL, &_vq_auxt__44c7_s_p5_1, NULL, 0 }; static long _vq_quantlist__44c7_s_p6_0[] = { 6, 5, 7, 4, 8, 3, 9, 2, 10, 1, 11, 0, 12, }; static long _vq_lengthlist__44c7_s_p6_0[] = { 1, 4, 4, 7, 7, 8, 8, 9, 9,10, 9,10,10, 5, 5, 5, 7, 7, 9, 9, 9, 9,10,10,11,11, 6, 5, 5, 7, 7, 9, 9, 9, 9,11,10,11,11, 0, 6, 6, 7, 7, 9, 9,10,10, 11,11,12,12, 0, 7, 7, 7, 7, 9, 9,10,10,11,11,12, 12, 0,11,10, 8, 8,10,10,11,11,11,12,12,12, 0,11, 11, 8, 8,10,10,11,11,12,12,13,13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; static float _vq_quantthresh__44c7_s_p6_0[] = { -27.5, -22.5, -17.5, -12.5, -7.5, -2.5, 2.5, 7.5, 12.5, 17.5, 22.5, 27.5, }; static long _vq_quantmap__44c7_s_p6_0[] = { 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, }; static encode_aux_threshmatch _vq_auxt__44c7_s_p6_0 = { _vq_quantthresh__44c7_s_p6_0, _vq_quantmap__44c7_s_p6_0, 13, 13 }; static static_codebook _44c7_s_p6_0 = { 2, 169, _vq_lengthlist__44c7_s_p6_0, 1, -526516224, 1616117760, 4, 0, _vq_quantlist__44c7_s_p6_0, NULL, &_vq_auxt__44c7_s_p6_0, NULL, 0 }; static long _vq_quantlist__44c7_s_p6_1[] = { 2, 1, 3, 0, 4, }; static long _vq_lengthlist__44c7_s_p6_1[] = { 3, 4, 4, 5, 5, 6, 4, 4, 5, 5, 6, 4, 4, 4, 5, 6, 5, 5, 5, 5, 6, 6, 6, 5, 5, }; static float _vq_quantthresh__44c7_s_p6_1[] = { -1.5, -0.5, 0.5, 1.5, }; static long _vq_quantmap__44c7_s_p6_1[] = { 3, 1, 0, 2, 4, }; static encode_aux_threshmatch _vq_auxt__44c7_s_p6_1 = { _vq_quantthresh__44c7_s_p6_1, _vq_quantmap__44c7_s_p6_1, 5, 5 }; static static_codebook _44c7_s_p6_1 = { 2, 25, _vq_lengthlist__44c7_s_p6_1, 1, -533725184, 1611661312, 3, 0, _vq_quantlist__44c7_s_p6_1, NULL, &_vq_auxt__44c7_s_p6_1, NULL, 0 }; static long _vq_quantlist__44c7_s_p7_0[] = { 6, 5, 7, 4, 8, 3, 9, 2, 10, 1, 11, 0, 12, }; static long _vq_lengthlist__44c7_s_p7_0[] = { 1, 4, 4, 7, 7, 8, 8, 9, 9,10,10,11,11, 5, 5, 5, 7, 7, 9, 8, 9, 9,11,11,12,12, 6, 5, 5, 7, 7, 9, 9, 9,10,11,11,12,12,20, 7, 7, 7, 7, 9, 9,10,10, 11,11,12,12,20, 7, 7, 7, 7, 9, 9,10,10,11,11,12, 12,20,11,11, 8, 8,10, 9,11,11,11,11,12,12,20,12, 12, 8, 8, 9, 9,11,11,12,12,12,12,20,20,20,11,11, 10,10,11,11,12,12,13,13,20,20,20,11,11,10,10,11, 11,12,12,13,13,20,20,20,14,14,11,11,11,12,13,13, 13,13,20,20,20,15,14,11,11,11,11,13,13,14,14,20, 20,20,20,19,12,12,12,12,13,13,14,14,19,19,19,19, 19,13,12,12,12,13,13,14,14, }; static float _vq_quantthresh__44c7_s_p7_0[] = { -60.5, -49.5, -38.5, -27.5, -16.5, -5.5, 5.5, 16.5, 27.5, 38.5, 49.5, 60.5, }; static long _vq_quantmap__44c7_s_p7_0[] = { 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, }; static encode_aux_threshmatch _vq_auxt__44c7_s_p7_0 = { _vq_quantthresh__44c7_s_p7_0, _vq_quantmap__44c7_s_p7_0, 13, 13 }; static static_codebook _44c7_s_p7_0 = { 2, 169, _vq_lengthlist__44c7_s_p7_0, 1, -523206656, 1618345984, 4, 0, _vq_quantlist__44c7_s_p7_0, NULL, &_vq_auxt__44c7_s_p7_0, NULL, 0 }; static long _vq_quantlist__44c7_s_p7_1[] = { 5, 4, 6, 3, 7, 2, 8, 1, 9, 0, 10, }; static long _vq_lengthlist__44c7_s_p7_1[] = { 3, 5, 5, 6, 6, 7, 7, 7, 7, 7, 7, 9, 5, 5, 6, 6, 7, 7, 7, 7, 8, 8, 9, 5, 5, 6, 6, 7, 7, 7, 7, 7, 7, 9, 6, 6, 7, 7, 7, 7, 8, 8, 7, 8, 9, 9, 9, 7, 7, 7, 7, 7, 7, 8, 8, 9, 9, 9, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 7, 7, 7, 7, 7, 7, 8, 8, 9, 9, 9, 7, 7, 8, 7, 7, 7, 8, 8, 9, 9, 9, 9, 9, 7, 7, 7, 7, 8, 7, 9, 9, 9, 9, 9, 8, 8, 7, 7, 8, 8, 9, 9, 9, 9, 9, 7, 7, 7, 7, 8, 8, }; static float _vq_quantthresh__44c7_s_p7_1[] = { -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, }; static long _vq_quantmap__44c7_s_p7_1[] = { 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, }; static encode_aux_threshmatch _vq_auxt__44c7_s_p7_1 = { _vq_quantthresh__44c7_s_p7_1, _vq_quantmap__44c7_s_p7_1, 11, 11 }; static static_codebook _44c7_s_p7_1 = { 2, 121, _vq_lengthlist__44c7_s_p7_1, 1, -531365888, 1611661312, 4, 0, _vq_quantlist__44c7_s_p7_1, NULL, &_vq_auxt__44c7_s_p7_1, NULL, 0 }; static long _vq_quantlist__44c7_s_p8_0[] = { 7, 6, 8, 5, 9, 4, 10, 3, 11, 2, 12, 1, 13, 0, 14, }; static long _vq_lengthlist__44c7_s_p8_0[] = { 1, 4, 4, 7, 7, 8, 8, 8, 8, 9, 9, 9,10,11,11, 6, 5, 5, 8, 8, 9, 9, 8, 8, 9, 9,10,10,11,11, 6, 5, 5, 8, 8, 9, 9, 8, 8, 9, 9,10,10,11,11,17, 8, 8, 8, 8,10, 9, 8, 9,10,10,11,11,11,11,17, 8, 8, 8, 8,10,10, 9, 9,10,10,11,11,12,12,17,12,13, 9, 9, 10,10, 9, 9,10,11,11,11,12,12,17,13,13, 9, 9,10, 10,10,10,10,10,11,11,12,12,17,17,17, 9, 9, 9, 9, 10,10,11,11,11,12,12,12,17,17,17, 9, 9, 9, 9,11, 10,11,12,11,12,13,12,17,17,17,13,14,10,10,10,11, 12,11,12,12,12,13,17,17,17,14,14,10, 9,10, 9,12, 12,12,12,13,13,17,17,17,17,17,11,11,11,11,11,12, 13,13,13,14,17,17,17,17,17,12,10,11, 9,12,11,13, 15,14,14,17,17,17,17,17,14,15,11,12,12,13,13,12, 14,14,17,16,16,16,16,15,13,12, 9,12,10,14,12,15, 14, }; static float _vq_quantthresh__44c7_s_p8_0[] = { -136.5, -115.5, -94.5, -73.5, -52.5, -31.5, -10.5, 10.5, 31.5, 52.5, 73.5, 94.5, 115.5, 136.5, }; static long _vq_quantmap__44c7_s_p8_0[] = { 13, 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, 14, }; static encode_aux_threshmatch _vq_auxt__44c7_s_p8_0 = { _vq_quantthresh__44c7_s_p8_0, _vq_quantmap__44c7_s_p8_0, 15, 15 }; static static_codebook _44c7_s_p8_0 = { 2, 225, _vq_lengthlist__44c7_s_p8_0, 1, -520986624, 1620377600, 4, 0, _vq_quantlist__44c7_s_p8_0, NULL, &_vq_auxt__44c7_s_p8_0, NULL, 0 }; static long _vq_quantlist__44c7_s_p8_1[] = { 10, 9, 11, 8, 12, 7, 13, 6, 14, 5, 15, 4, 16, 3, 17, 2, 18, 1, 19, 0, 20, }; static long _vq_lengthlist__44c7_s_p8_1[] = { 3, 5, 5, 6, 6, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9,10, 6, 6, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,10, 6, 6, 7, 7, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,11, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,11,11,11, 7, 7, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,11,11,11, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,11,11, 11, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9,10, 9, 9, 9, 9, 10,10, 9,11,11,11, 8, 9, 9, 8, 9, 9, 9, 9, 9, 9, 9, 9,10,10, 9, 9,10, 9,11,11,11,11,11, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,10,10,10,10,10,10,11,10,11, 11,11, 9, 9, 9, 9, 9, 9,10, 9,10,10,10,10,10, 9, 9,10,11,11,11,11,11, 9, 9, 9, 9, 9, 9, 9, 9,10, 10, 9, 9,10,10,10,10,11,11,11,11,11, 9, 9, 9, 9, 9, 9, 9,10,10,10, 9,10,10,10,10, 9,11,11,10,11, 11,11,11, 9, 9, 9, 9,10,10,10,10,10,10,10, 9,10, 10,10,11,11,11,11,11,11, 9, 9, 9, 9, 9,10,10,10, 10,10, 9, 9,10, 9,11,10,11,11,11,11,11, 9, 9, 9, 9, 9,10,10, 9,10,10,10,10,10,10,11,11,11,11,11, 11,11,10, 9,10, 9,10,10,10,10,10,10,10,10,10, 9, 10,11,10,11,11,11,11,11,10, 9, 9,10,10,10,10,10, 10,10,10,10,10,11,11,11,11,11,11,11,10,11,10,10, 10,10,10,10,10,10, 9,10,10, 9,11,11,11,11,11,10, 11,11,11,10,10, 9, 9,10,10,10,10,10, 9,10,10,11, 11,11,11,11,10,11,11,11,10,10, 9, 9,10,10,10,10, 10,10,10,10,11,11,11,11,11,11,11,11,11,11,11, 9, 9, 9, 9,10,10,10,10,10,10, }; static float _vq_quantthresh__44c7_s_p8_1[] = { -9.5, -8.5, -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, 9.5, }; static long _vq_quantmap__44c7_s_p8_1[] = { 19, 17, 15, 13, 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, }; static encode_aux_threshmatch _vq_auxt__44c7_s_p8_1 = { _vq_quantthresh__44c7_s_p8_1, _vq_quantmap__44c7_s_p8_1, 21, 21 }; static static_codebook _44c7_s_p8_1 = { 2, 441, _vq_lengthlist__44c7_s_p8_1, 1, -529268736, 1611661312, 5, 0, _vq_quantlist__44c7_s_p8_1, NULL, &_vq_auxt__44c7_s_p8_1, NULL, 0 }; static long _vq_quantlist__44c7_s_p9_0[] = { 6, 5, 7, 4, 8, 3, 9, 2, 10, 1, 11, 0, 12, }; static long _vq_lengthlist__44c7_s_p9_0[] = { 1, 4, 4, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 5, 9, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 6, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 8, 8, 8, }; static float _vq_quantthresh__44c7_s_p9_0[] = { -3503.5, -2866.5, -2229.5, -1592.5, -955.5, -318.5, 318.5, 955.5, 1592.5, 2229.5, 2866.5, 3503.5, }; static long _vq_quantmap__44c7_s_p9_0[] = { 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, }; static encode_aux_threshmatch _vq_auxt__44c7_s_p9_0 = { _vq_quantthresh__44c7_s_p9_0, _vq_quantmap__44c7_s_p9_0, 13, 13 }; static static_codebook _44c7_s_p9_0 = { 2, 169, _vq_lengthlist__44c7_s_p9_0, 1, -511845376, 1630791680, 4, 0, _vq_quantlist__44c7_s_p9_0, NULL, &_vq_auxt__44c7_s_p9_0, NULL, 0 }; static long _vq_quantlist__44c7_s_p9_1[] = { 6, 5, 7, 4, 8, 3, 9, 2, 10, 1, 11, 0, 12, }; static long _vq_lengthlist__44c7_s_p9_1[] = { 1, 4, 4, 7, 7, 7, 7, 7, 7, 9, 8,10,10, 6, 6, 6, 7, 8, 8, 8, 8, 8, 9, 9,10,11, 6, 5, 6, 8, 7, 8, 8, 8, 8, 9, 9,10,11,14, 9, 8, 9, 8, 9, 8, 8, 9, 10,10,11,11,14, 8, 9, 8, 8, 8, 9, 9, 8,12,10,11, 11,14,13,13, 8, 9, 9, 9, 9,10,10,12,12,12,14,14, 13, 8, 7,10, 9, 9,10,10,11,11,10,14,14,14, 8, 9, 9, 8,11,10,12,11,11,11,14,14,14, 9, 7, 9, 8,10, 10,11,11,11,10,14,14,14,12,12,10, 9,11,11,11,13, 12,13,14,14,14,12,12,10,10,11, 8,11,11,14,13,14, 14,14,14,14,12,13,11,12,12,11,14,13,13,13,13,13, 13,12,11,11, 9,12,12,12,13, }; static float _vq_quantthresh__44c7_s_p9_1[] = { -269.5, -220.5, -171.5, -122.5, -73.5, -24.5, 24.5, 73.5, 122.5, 171.5, 220.5, 269.5, }; static long _vq_quantmap__44c7_s_p9_1[] = { 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, }; static encode_aux_threshmatch _vq_auxt__44c7_s_p9_1 = { _vq_quantthresh__44c7_s_p9_1, _vq_quantmap__44c7_s_p9_1, 13, 13 }; static static_codebook _44c7_s_p9_1 = { 2, 169, _vq_lengthlist__44c7_s_p9_1, 1, -518889472, 1622704128, 4, 0, _vq_quantlist__44c7_s_p9_1, NULL, &_vq_auxt__44c7_s_p9_1, NULL, 0 }; static long _vq_quantlist__44c7_s_p9_2[] = { 24, 23, 25, 22, 26, 21, 27, 20, 28, 19, 29, 18, 30, 17, 31, 16, 32, 15, 33, 14, 34, 13, 35, 12, 36, 11, 37, 10, 38, 9, 39, 8, 40, 7, 41, 6, 42, 5, 43, 4, 44, 3, 45, 2, 46, 1, 47, 0, 48, }; static long _vq_lengthlist__44c7_s_p9_2[] = { 2, 4, 3, 4, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, }; static float _vq_quantthresh__44c7_s_p9_2[] = { -23.5, -22.5, -21.5, -20.5, -19.5, -18.5, -17.5, -16.5, -15.5, -14.5, -13.5, -12.5, -11.5, -10.5, -9.5, -8.5, -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, 9.5, 10.5, 11.5, 12.5, 13.5, 14.5, 15.5, 16.5, 17.5, 18.5, 19.5, 20.5, 21.5, 22.5, 23.5, }; static long _vq_quantmap__44c7_s_p9_2[] = { 47, 45, 43, 41, 39, 37, 35, 33, 31, 29, 27, 25, 23, 21, 19, 17, 15, 13, 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, }; static encode_aux_threshmatch _vq_auxt__44c7_s_p9_2 = { _vq_quantthresh__44c7_s_p9_2, _vq_quantmap__44c7_s_p9_2, 49, 49 }; static static_codebook _44c7_s_p9_2 = { 1, 49, _vq_lengthlist__44c7_s_p9_2, 1, -526909440, 1611661312, 6, 0, _vq_quantlist__44c7_s_p9_2, NULL, &_vq_auxt__44c7_s_p9_2, NULL, 0 }; static long _huff_lengthlist__44c7_s_short[] = { 4,10,12,13,15,15,16,16,17,17, 5, 5, 7, 8, 9, 9, 12,17,18,18, 7, 5, 4, 5, 7, 8,10,13,18,18, 8, 6, 5, 4, 5, 6, 9,12,17,18,10, 9, 6, 4, 4, 5, 8,12, 18,17,11, 9, 7, 5, 4, 4, 6,10,17,17,13,12,10, 8, 6, 5, 6, 9,17,17,14,13,12, 7, 6, 5, 5, 8,16,17, 16,15,14, 8, 8, 7, 7, 9,14,17,17,17,17,12,11,11, 11,12,16,17, }; static static_codebook _huff_book__44c7_s_short = { 2, 100, _huff_lengthlist__44c7_s_short, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _huff_lengthlist__44c8_s_long[] = { 3, 8,12,14,14,13,13,12,13,15, 6, 4, 6, 8,10,10, 11,11,13,15, 9, 5, 4, 5, 7, 8, 9,10,13,15,11, 7, 4, 4, 5, 6, 8, 9,13,14,12, 9, 6, 5, 5, 5, 7, 9, 12,14,11,10, 7, 6, 5, 4, 6, 7,11,12,11,10, 9, 8, 7, 5, 6, 6,10,11,12,11,10, 9, 8, 6, 6, 5, 8,10, 12,12,12,11,11,10, 9, 7, 8,11,12,13,14,14,15,13, 10, 9, 9,11, }; static static_codebook _huff_book__44c8_s_long = { 2, 100, _huff_lengthlist__44c8_s_long, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _vq_quantlist__44c8_s_p1_0[] = { 1, 0, 2, }; static long _vq_lengthlist__44c8_s_p1_0[] = { 1, 5, 5, 0, 5, 5, 0, 5, 5, 6, 7, 7, 0, 9, 8, 0, 8, 8, 6, 7, 8, 0, 8, 9, 0, 8, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 8, 8, 0, 8, 8, 0, 8, 8, 5, 8, 8, 0, 8, 8, 0, 8, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 8, 8, 0, 8, 8, 0, 8, 7, 5, 8, 8, 0, 8, 8, 0, 7, 8, }; static float _vq_quantthresh__44c8_s_p1_0[] = { -0.5, 0.5, }; static long _vq_quantmap__44c8_s_p1_0[] = { 1, 0, 2, }; static encode_aux_threshmatch _vq_auxt__44c8_s_p1_0 = { _vq_quantthresh__44c8_s_p1_0, _vq_quantmap__44c8_s_p1_0, 3, 3 }; static static_codebook _44c8_s_p1_0 = { 4, 81, _vq_lengthlist__44c8_s_p1_0, 1, -535822336, 1611661312, 2, 0, _vq_quantlist__44c8_s_p1_0, NULL, &_vq_auxt__44c8_s_p1_0, NULL, 0 }; static long _vq_quantlist__44c8_s_p2_0[] = { 2, 1, 3, 0, 4, }; static long _vq_lengthlist__44c8_s_p2_0[] = { 3, 5, 5, 8, 8, 0, 6, 6, 8, 8, 0, 5, 6, 8, 8, 0, 7, 7, 9, 9, 0, 0, 0, 9, 9, 5, 7, 6, 9, 9, 0, 7, 7,10, 9, 0, 7, 7,10, 9, 0, 9, 9,11,11, 0, 0, 0, 11,11, 5, 6, 7, 9, 9, 0, 7, 7, 9,10, 0, 7, 7, 9, 10, 0, 9, 9,11,11, 0, 0, 0,11,11, 8, 9, 9,11,10, 0,11,10,12,11, 0,10,10,12,11, 0,13,13,14,13, 0, 0, 0,14,13, 8, 9, 9,10,11, 0,10,11,11,12, 0,10, 10,12,12, 0,13,13,13,14, 0, 0, 0,13,14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 7, 7,10,10, 0, 7, 7,10,10, 0, 7, 7,10,10, 0, 9, 8,10,10, 0, 0, 0,10,10, 6, 7, 7,10,10, 0, 7, 7,10,10, 0, 7, 7,10,10, 0, 8, 9,10,10, 0, 0, 0,10,10, 8,10, 9,12,12, 0,10, 9, 12,11, 0,10,10,11,12, 0,12,11,13,12, 0, 0, 0,13, 13, 8, 9,10,11,12, 0, 9,10,11,12, 0,10,10,11,12, 0,11,12,12,13, 0, 0, 0,13,13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 8, 7,11,10, 0, 7, 7,10,10, 0, 7, 7, 10, 9, 0, 8, 9,10,10, 0, 0, 0,10,10, 6, 7, 8,10, 11, 0, 7, 7,10,10, 0, 7, 7,10,10, 0, 9, 8,10,10, 0, 0, 0,10,10, 8,10, 9,12,11, 0,10,10,12,11, 0, 10,10,12,11, 0,11,12,13,12, 0, 0, 0,13,12, 9, 9, 10,11,12, 0,10,10,11,12, 0,10,10,11,12, 0,12,11, 12,13, 0, 0, 0,12,13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 9, 9,12,13, 0, 9, 8,12,11, 0, 8, 9,11,12, 0, 10, 9,12,11, 0, 0, 0,11,12, 7, 9, 9,13,13, 0, 9, 9,11,12, 0, 9, 8,12,11, 0, 9,10,11,12, 0, 0, 0, 12,11, 9,11,11,14,13, 0,10,10,13,12, 0,10,10,13, 13, 0,12,11,13,12, 0, 0, 0,13,13, 9,11,11,13,14, 0,10,10,12,13, 0,10,10,13,13, 0,11,12,12,13, 0, 0, 0,13,13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 11,11,14,13, 0,10,10,13,12, 0,10,10,13,12, 0,11, 12,13,13, 0, 0, 0,13,12, 9,11,11,13,14, 0,10,10, 13,13, 0,10,10,12,13, 0,12,11,13,13, 0, 0, 0,12, 13, }; static float _vq_quantthresh__44c8_s_p2_0[] = { -1.5, -0.5, 0.5, 1.5, }; static long _vq_quantmap__44c8_s_p2_0[] = { 3, 1, 0, 2, 4, }; static encode_aux_threshmatch _vq_auxt__44c8_s_p2_0 = { _vq_quantthresh__44c8_s_p2_0, _vq_quantmap__44c8_s_p2_0, 5, 5 }; static static_codebook _44c8_s_p2_0 = { 4, 625, _vq_lengthlist__44c8_s_p2_0, 1, -533725184, 1611661312, 3, 0, _vq_quantlist__44c8_s_p2_0, NULL, &_vq_auxt__44c8_s_p2_0, NULL, 0 }; static long _vq_quantlist__44c8_s_p3_0[] = { 4, 3, 5, 2, 6, 1, 7, 0, 8, }; static long _vq_lengthlist__44c8_s_p3_0[] = { 3, 3, 4, 5, 5, 7, 6, 8, 8, 0, 4, 4, 5, 5, 7, 7, 9, 9, 0, 4, 4, 5, 6, 7, 7, 9, 9, 0, 5, 5, 6, 6, 8, 8,10,10, 0, 0, 0, 6, 6, 8, 8,10,10, 0, 0, 0, 7, 7, 8, 8,10,10, 0, 0, 0, 7, 7, 8, 8,10,10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; static float _vq_quantthresh__44c8_s_p3_0[] = { -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, }; static long _vq_quantmap__44c8_s_p3_0[] = { 7, 5, 3, 1, 0, 2, 4, 6, 8, }; static encode_aux_threshmatch _vq_auxt__44c8_s_p3_0 = { _vq_quantthresh__44c8_s_p3_0, _vq_quantmap__44c8_s_p3_0, 9, 9 }; static static_codebook _44c8_s_p3_0 = { 2, 81, _vq_lengthlist__44c8_s_p3_0, 1, -531628032, 1611661312, 4, 0, _vq_quantlist__44c8_s_p3_0, NULL, &_vq_auxt__44c8_s_p3_0, NULL, 0 }; static long _vq_quantlist__44c8_s_p4_0[] = { 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15, 0, 16, }; static long _vq_lengthlist__44c8_s_p4_0[] = { 3, 4, 4, 5, 5, 7, 7, 8, 8, 8, 8, 9, 9,10,10,10, 10, 0, 4, 4, 6, 6, 7, 7, 8, 8, 9, 9,10,10,10,10, 11,11, 0, 4, 4, 6, 6, 7, 7, 8, 8, 9, 9,10,10,11, 10,11,11, 0, 5, 5, 6, 6, 8, 8, 9, 9, 9, 9,10,10, 11,11,12,12, 0, 0, 0, 6, 6, 8, 8, 9, 9, 9, 9,10, 10,11,11,12,12, 0, 0, 0, 7, 7, 8, 8, 9, 9,10,10, 11,11,12,12,12,12, 0, 0, 0, 7, 7, 8, 8, 9, 9,10, 10,11,11,12,12,12,12, 0, 0, 0, 7, 7, 8, 8, 9, 9, 10,10,11,11,12,12,13,13, 0, 0, 0, 0, 0, 8, 8, 9, 9,10,10,11,11,12,12,13,13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; static float _vq_quantthresh__44c8_s_p4_0[] = { -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, }; static long _vq_quantmap__44c8_s_p4_0[] = { 15, 13, 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, 14, 16, }; static encode_aux_threshmatch _vq_auxt__44c8_s_p4_0 = { _vq_quantthresh__44c8_s_p4_0, _vq_quantmap__44c8_s_p4_0, 17, 17 }; static static_codebook _44c8_s_p4_0 = { 2, 289, _vq_lengthlist__44c8_s_p4_0, 1, -529530880, 1611661312, 5, 0, _vq_quantlist__44c8_s_p4_0, NULL, &_vq_auxt__44c8_s_p4_0, NULL, 0 }; static long _vq_quantlist__44c8_s_p5_0[] = { 1, 0, 2, }; static long _vq_lengthlist__44c8_s_p5_0[] = { 1, 4, 4, 5, 7, 7, 6, 7, 7, 4, 6, 6,10,10,10,10, 10,10, 4, 6, 6,10,10,10,10,10,10, 5,10,10, 9,12, 12,10,12,12, 7,10,10,12,12,12,12,12,12, 7,10,10, 12,12,12,12,12,13, 6,10,10,10,12,12,11,12,12, 8, 10,10,12,13,12,12,12,12, 7,10,10,12,12,13,12,13, 12, }; static float _vq_quantthresh__44c8_s_p5_0[] = { -5.5, 5.5, }; static long _vq_quantmap__44c8_s_p5_0[] = { 1, 0, 2, }; static encode_aux_threshmatch _vq_auxt__44c8_s_p5_0 = { _vq_quantthresh__44c8_s_p5_0, _vq_quantmap__44c8_s_p5_0, 3, 3 }; static static_codebook _44c8_s_p5_0 = { 4, 81, _vq_lengthlist__44c8_s_p5_0, 1, -529137664, 1618345984, 2, 0, _vq_quantlist__44c8_s_p5_0, NULL, &_vq_auxt__44c8_s_p5_0, NULL, 0 }; static long _vq_quantlist__44c8_s_p5_1[] = { 5, 4, 6, 3, 7, 2, 8, 1, 9, 0, 10, }; static long _vq_lengthlist__44c8_s_p5_1[] = { 4, 5, 5, 6, 6, 7, 7, 7, 7, 7, 7,10, 4, 4, 6, 6, 7, 7, 8, 8, 8, 8,10, 5, 5, 6, 6, 7, 7, 8, 8, 8, 8,11, 5, 5, 6, 6, 7, 7, 8, 8, 8, 8,11,11,11, 6, 6, 7, 7, 8, 8, 8, 8,11,11,11, 6, 6, 7, 7, 8, 8, 8, 8,11,11,11, 6, 6, 7, 7, 8, 8, 8, 8,11,11,11, 7, 7, 7, 7, 8, 8, 8, 8,11,11,11,11,11, 7, 7, 8, 8, 8, 8,11,11,11,11,11, 7, 7, 7, 7, 8, 8,11,11, 11,11,11, 7, 7, 7, 7, 8, 8, }; static float _vq_quantthresh__44c8_s_p5_1[] = { -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, }; static long _vq_quantmap__44c8_s_p5_1[] = { 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, }; static encode_aux_threshmatch _vq_auxt__44c8_s_p5_1 = { _vq_quantthresh__44c8_s_p5_1, _vq_quantmap__44c8_s_p5_1, 11, 11 }; static static_codebook _44c8_s_p5_1 = { 2, 121, _vq_lengthlist__44c8_s_p5_1, 1, -531365888, 1611661312, 4, 0, _vq_quantlist__44c8_s_p5_1, NULL, &_vq_auxt__44c8_s_p5_1, NULL, 0 }; static long _vq_quantlist__44c8_s_p6_0[] = { 6, 5, 7, 4, 8, 3, 9, 2, 10, 1, 11, 0, 12, }; static long _vq_lengthlist__44c8_s_p6_0[] = { 1, 4, 4, 7, 6, 8, 8, 9, 9,10,10,11,11, 5, 5, 5, 7, 7, 9, 9,10, 9,11,11,12,12, 6, 5, 5, 7, 7, 9, 9,10,10,11,11,12,12, 0, 6, 6, 7, 7, 9, 9,10,10, 11,11,12,12, 0, 7, 7, 7, 7, 9, 9,10,10,12,12,12, 12, 0,10,10, 8, 8,10,10,11,11,12,12,13,13, 0,11, 11, 8, 8,10,10,11,11,12,12,13,13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; static float _vq_quantthresh__44c8_s_p6_0[] = { -27.5, -22.5, -17.5, -12.5, -7.5, -2.5, 2.5, 7.5, 12.5, 17.5, 22.5, 27.5, }; static long _vq_quantmap__44c8_s_p6_0[] = { 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, }; static encode_aux_threshmatch _vq_auxt__44c8_s_p6_0 = { _vq_quantthresh__44c8_s_p6_0, _vq_quantmap__44c8_s_p6_0, 13, 13 }; static static_codebook _44c8_s_p6_0 = { 2, 169, _vq_lengthlist__44c8_s_p6_0, 1, -526516224, 1616117760, 4, 0, _vq_quantlist__44c8_s_p6_0, NULL, &_vq_auxt__44c8_s_p6_0, NULL, 0 }; static long _vq_quantlist__44c8_s_p6_1[] = { 2, 1, 3, 0, 4, }; static long _vq_lengthlist__44c8_s_p6_1[] = { 3, 4, 4, 5, 5, 5, 4, 4, 5, 5, 5, 4, 4, 5, 5, 6, 5, 5, 5, 5, 6, 6, 6, 5, 5, }; static float _vq_quantthresh__44c8_s_p6_1[] = { -1.5, -0.5, 0.5, 1.5, }; static long _vq_quantmap__44c8_s_p6_1[] = { 3, 1, 0, 2, 4, }; static encode_aux_threshmatch _vq_auxt__44c8_s_p6_1 = { _vq_quantthresh__44c8_s_p6_1, _vq_quantmap__44c8_s_p6_1, 5, 5 }; static static_codebook _44c8_s_p6_1 = { 2, 25, _vq_lengthlist__44c8_s_p6_1, 1, -533725184, 1611661312, 3, 0, _vq_quantlist__44c8_s_p6_1, NULL, &_vq_auxt__44c8_s_p6_1, NULL, 0 }; static long _vq_quantlist__44c8_s_p7_0[] = { 6, 5, 7, 4, 8, 3, 9, 2, 10, 1, 11, 0, 12, }; static long _vq_lengthlist__44c8_s_p7_0[] = { 1, 4, 4, 7, 7, 8, 8, 9, 9,10,10,11,11, 5, 5, 5, 7, 7, 9, 9,10,10,11,11,12,12, 6, 5, 5, 7, 7, 9, 9,10,10,11,11,12,12,20, 6, 7, 7, 7, 9, 9,10,10, 11,11,12,12,20, 7, 7, 7, 7, 9, 9,10,10,11,11,12, 12,20,11,11, 8, 8,10,10,11,11,12,12,12,12,20,12, 12, 8, 8,10, 9,11,11,12,12,13,13,20,20,20,11,10, 10,10,11,11,12,12,13,13,20,20,20,10,11,10,10,11, 11,12,12,13,13,20,20,20,14,15,11,11,12,12,13,13, 14,13,20,20,20,15,15,11,11,12,12,13,13,14,14,20, 20,20,20,19,13,13,12,12,13,13,14,14,19,19,19,19, 19,13,13,12,12,13,13,14,14, }; static float _vq_quantthresh__44c8_s_p7_0[] = { -60.5, -49.5, -38.5, -27.5, -16.5, -5.5, 5.5, 16.5, 27.5, 38.5, 49.5, 60.5, }; static long _vq_quantmap__44c8_s_p7_0[] = { 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, }; static encode_aux_threshmatch _vq_auxt__44c8_s_p7_0 = { _vq_quantthresh__44c8_s_p7_0, _vq_quantmap__44c8_s_p7_0, 13, 13 }; static static_codebook _44c8_s_p7_0 = { 2, 169, _vq_lengthlist__44c8_s_p7_0, 1, -523206656, 1618345984, 4, 0, _vq_quantlist__44c8_s_p7_0, NULL, &_vq_auxt__44c8_s_p7_0, NULL, 0 }; static long _vq_quantlist__44c8_s_p7_1[] = { 5, 4, 6, 3, 7, 2, 8, 1, 9, 0, 10, }; static long _vq_lengthlist__44c8_s_p7_1[] = { 4, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 8, 5, 5, 7, 7, 7, 7, 7, 7, 7, 7, 8, 5, 5, 7, 7, 7, 7, 7, 7, 7, 7, 8, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 7, 7, 7, 7, 8, 8, 8, 8, 8, 7, 7, 7, 7, 7, 7, }; static float _vq_quantthresh__44c8_s_p7_1[] = { -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, }; static long _vq_quantmap__44c8_s_p7_1[] = { 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, }; static encode_aux_threshmatch _vq_auxt__44c8_s_p7_1 = { _vq_quantthresh__44c8_s_p7_1, _vq_quantmap__44c8_s_p7_1, 11, 11 }; static static_codebook _44c8_s_p7_1 = { 2, 121, _vq_lengthlist__44c8_s_p7_1, 1, -531365888, 1611661312, 4, 0, _vq_quantlist__44c8_s_p7_1, NULL, &_vq_auxt__44c8_s_p7_1, NULL, 0 }; static long _vq_quantlist__44c8_s_p8_0[] = { 7, 6, 8, 5, 9, 4, 10, 3, 11, 2, 12, 1, 13, 0, 14, }; static long _vq_lengthlist__44c8_s_p8_0[] = { 1, 4, 4, 7, 7, 8, 8, 8, 8, 9, 9,10,10,11,11, 6, 5, 5, 7, 7, 9, 9, 8, 8,10,10,11,11,11,12, 6, 5, 5, 7, 7, 9, 9, 9, 8,10,10,11,10,11,12,18, 8, 8, 8, 8, 9, 9, 9, 9,10,10,11,11,12,12,18, 8, 8, 8, 8, 9, 9, 9, 9,10,10,11,11,12,13,18,12,12, 9, 9, 10,10, 9, 9,10,11,11,12,13,12,18,12,12, 9, 9,10, 10,10,10,10,11,11,12,13,13,18,18,18, 9, 9, 9, 9, 10,10,11,11,12,12,12,12,18,18,18, 9, 9, 9, 9,10, 10,11,11,12,12,13,13,18,18,18,13,13,10,10,11,11, 12,11,12,12,13,13,18,18,18,14,14,10, 9,11,10,12, 12,12,12,13,13,18,18,18,18,18,11,12,11,11,12,12, 13,13,14,13,18,18,18,18,18,12,11,11,10,12,11,13, 13,13,14,18,18,18,18,18,15,16,12,12,12,13,13,13, 14,14,18,17,17,17,17,16,14,12,11,12,11,13,12,15, 14, }; static float _vq_quantthresh__44c8_s_p8_0[] = { -136.5, -115.5, -94.5, -73.5, -52.5, -31.5, -10.5, 10.5, 31.5, 52.5, 73.5, 94.5, 115.5, 136.5, }; static long _vq_quantmap__44c8_s_p8_0[] = { 13, 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, 14, }; static encode_aux_threshmatch _vq_auxt__44c8_s_p8_0 = { _vq_quantthresh__44c8_s_p8_0, _vq_quantmap__44c8_s_p8_0, 15, 15 }; static static_codebook _44c8_s_p8_0 = { 2, 225, _vq_lengthlist__44c8_s_p8_0, 1, -520986624, 1620377600, 4, 0, _vq_quantlist__44c8_s_p8_0, NULL, &_vq_auxt__44c8_s_p8_0, NULL, 0 }; static long _vq_quantlist__44c8_s_p8_1[] = { 10, 9, 11, 8, 12, 7, 13, 6, 14, 5, 15, 4, 16, 3, 17, 2, 18, 1, 19, 0, 20, }; static long _vq_lengthlist__44c8_s_p8_1[] = { 4, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9,10, 6, 6, 7, 7, 8, 8, 8, 8, 9, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,10, 6, 6, 7, 7, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,10, 7, 7, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,10,10,10, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,10,10,10, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,10,10, 10, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,10,10,11, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,11,11,10,11,10, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,10,10,10, 10,10, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,10, 9,10, 9, 9,10,11,10,10,10, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,10,10,11,10,10, 9, 9, 9, 9, 9, 9, 9, 9,10, 9, 9, 9, 9, 9, 9, 9,11,10,11,10, 10,10,10, 9, 9, 9, 9, 9, 9,10, 9, 9, 9, 9, 9, 9, 9,11,11,11,10,10,11,10, 9, 9, 9, 9, 9, 9,10,10, 9, 9, 9, 9, 9, 9,10,11,10,10,10,11,10, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,10, 9,10, 9,11,11,10,10,10, 10,10, 9, 9, 9,10,10, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10,10,11,10,10,10,10,10,10, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,10,10,11,11,10,11,10,10,10,10,10,10, 9, 10, 9, 9, 9, 9, 9, 9, 9, 9, 9,10,10,10,10,10,10, 10,10,10, 9,10, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,10, 10,10,10,10,10,10,10,10,10,10, 9, 9, 9, 9, 9, 9, 9, 9,10, 9,10,10,10,10,10,10,10,10,10,10,10, 9, 9, 9, 9,10, 9, 9,10, 9, 9, }; static float _vq_quantthresh__44c8_s_p8_1[] = { -9.5, -8.5, -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, 9.5, }; static long _vq_quantmap__44c8_s_p8_1[] = { 19, 17, 15, 13, 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, }; static encode_aux_threshmatch _vq_auxt__44c8_s_p8_1 = { _vq_quantthresh__44c8_s_p8_1, _vq_quantmap__44c8_s_p8_1, 21, 21 }; static static_codebook _44c8_s_p8_1 = { 2, 441, _vq_lengthlist__44c8_s_p8_1, 1, -529268736, 1611661312, 5, 0, _vq_quantlist__44c8_s_p8_1, NULL, &_vq_auxt__44c8_s_p8_1, NULL, 0 }; static long _vq_quantlist__44c8_s_p9_0[] = { 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15, 0, 16, }; static long _vq_lengthlist__44c8_s_p9_0[] = { 1, 5, 5,10,10,10,10,10,10,10,10,10,10,10,10,10, 10, 7,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10, 6, 8,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, }; static float _vq_quantthresh__44c8_s_p9_0[] = { -6982.5, -6051.5, -5120.5, -4189.5, -3258.5, -2327.5, -1396.5, -465.5, 465.5, 1396.5, 2327.5, 3258.5, 4189.5, 5120.5, 6051.5, 6982.5, }; static long _vq_quantmap__44c8_s_p9_0[] = { 15, 13, 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, 14, 16, }; static encode_aux_threshmatch _vq_auxt__44c8_s_p9_0 = { _vq_quantthresh__44c8_s_p9_0, _vq_quantmap__44c8_s_p9_0, 17, 17 }; static static_codebook _44c8_s_p9_0 = { 2, 289, _vq_lengthlist__44c8_s_p9_0, 1, -509798400, 1631393792, 5, 0, _vq_quantlist__44c8_s_p9_0, NULL, &_vq_auxt__44c8_s_p9_0, NULL, 0 }; static long _vq_quantlist__44c8_s_p9_1[] = { 9, 8, 10, 7, 11, 6, 12, 5, 13, 4, 14, 3, 15, 2, 16, 1, 17, 0, 18, }; static long _vq_lengthlist__44c8_s_p9_1[] = { 1, 4, 4, 7, 7, 7, 7, 7, 7, 9, 9,10,10,11,10,13, 12,11,12, 6, 6, 6, 8, 8, 8, 8, 8, 8, 9,10,10,10, 12,12,12,12,13,15, 5, 5, 5, 8, 8, 8, 8, 8, 8,10, 9,10,11,12,13,12,13,13,12,15, 9, 8, 9, 9, 9, 9, 9, 9,10,10,10,11,14,12,13,15,12,14,15, 8, 9, 9, 9, 9, 9, 9, 9,10,10,12,11,12,11,12,13,13,13,15, 13,13, 9, 9,10, 9,10,10,11,10,11,12,12,12,14,13, 14,15,15,13,13, 9, 8,10, 9,10,10,11,10,12,12,13, 13,14,13,14,15,15,15,15, 9, 9, 9, 9,10,11,12,12, 12,13,13,13,14,15,15,14,15,15,15, 9, 7, 9, 8,12, 11,11,13,12,12,13,12,14,13,13,14,15,15,15,13,13, 10,10,12,11,13,13,12,12,13,13,14,13,13,15,15,15, 15,12,13,11, 9,11,10,12,12,15,13,13,13,14,13,14, 13,15,15,15,15,15,12,12,11,11,12,13,15,13,13,14, 14,14,15,14,15,15,15,15,15,13,11,12,11,12,11,13, 14,13,13,14,14,13,14,15,15,15,15,15,15,15,12,12, 12,13,15,13,15,14,15,14,13,15,15,15,15,15,15,14, 15,13,13,12,11,14,12,15,13,14,14,14,13,15,15,15, 15,15,15,15,14,13,14,13,15,13,15,15,15,14,15,14, 15,15,15,15,15,15,15,14,14,14,13,13,13,15,15,15, 15,14,15,15,15,15,15,15,15,15,15,15,12,13,13,13, 14,15,15,13,15,15,15,15,15,15,15,15,15,15,15,15, 15,14,14,15,15,15,14,14,15, }; static float _vq_quantthresh__44c8_s_p9_1[] = { -416.5, -367.5, -318.5, -269.5, -220.5, -171.5, -122.5, -73.5, -24.5, 24.5, 73.5, 122.5, 171.5, 220.5, 269.5, 318.5, 367.5, 416.5, }; static long _vq_quantmap__44c8_s_p9_1[] = { 17, 15, 13, 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, }; static encode_aux_threshmatch _vq_auxt__44c8_s_p9_1 = { _vq_quantthresh__44c8_s_p9_1, _vq_quantmap__44c8_s_p9_1, 19, 19 }; static static_codebook _44c8_s_p9_1 = { 2, 361, _vq_lengthlist__44c8_s_p9_1, 1, -518287360, 1622704128, 5, 0, _vq_quantlist__44c8_s_p9_1, NULL, &_vq_auxt__44c8_s_p9_1, NULL, 0 }; static long _vq_quantlist__44c8_s_p9_2[] = { 24, 23, 25, 22, 26, 21, 27, 20, 28, 19, 29, 18, 30, 17, 31, 16, 32, 15, 33, 14, 34, 13, 35, 12, 36, 11, 37, 10, 38, 9, 39, 8, 40, 7, 41, 6, 42, 5, 43, 4, 44, 3, 45, 2, 46, 1, 47, 0, 48, }; static long _vq_lengthlist__44c8_s_p9_2[] = { 3, 4, 3, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 6, 7, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, }; static float _vq_quantthresh__44c8_s_p9_2[] = { -23.5, -22.5, -21.5, -20.5, -19.5, -18.5, -17.5, -16.5, -15.5, -14.5, -13.5, -12.5, -11.5, -10.5, -9.5, -8.5, -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, 9.5, 10.5, 11.5, 12.5, 13.5, 14.5, 15.5, 16.5, 17.5, 18.5, 19.5, 20.5, 21.5, 22.5, 23.5, }; static long _vq_quantmap__44c8_s_p9_2[] = { 47, 45, 43, 41, 39, 37, 35, 33, 31, 29, 27, 25, 23, 21, 19, 17, 15, 13, 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, }; static encode_aux_threshmatch _vq_auxt__44c8_s_p9_2 = { _vq_quantthresh__44c8_s_p9_2, _vq_quantmap__44c8_s_p9_2, 49, 49 }; static static_codebook _44c8_s_p9_2 = { 1, 49, _vq_lengthlist__44c8_s_p9_2, 1, -526909440, 1611661312, 6, 0, _vq_quantlist__44c8_s_p9_2, NULL, &_vq_auxt__44c8_s_p9_2, NULL, 0 }; static long _huff_lengthlist__44c8_s_short[] = { 4,11,13,14,16,15,16,16,17,16, 5, 6, 8, 9,10, 9, 11,17,16,17, 6, 6, 6, 6, 7, 8, 9,14,16,17, 8, 6, 5, 4, 6, 7, 9,12,14,17, 9, 7, 6, 5, 5, 5, 8,11, 14,17,10, 9, 7, 6, 5, 3, 5, 8,13,17,12,11, 9, 8, 7, 4, 4, 6,14,17,13,13,12, 8, 7, 5, 4, 5,12,17, 17,14,15,10, 8, 7, 7, 7,11,17,17,16,17,14,12,10, 11,11,15,17, }; static static_codebook _huff_book__44c8_s_short = { 2, 100, _huff_lengthlist__44c8_s_short, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _huff_lengthlist__44c9_s_long[] = { 3, 8,13,14,15,15,13,13,14,14, 6, 5, 8,10,12,12, 13,12,13,14,10, 6, 5, 6, 8, 9,11,11,13,14,13, 8, 5, 4, 5, 6, 9,10,13,14,14,11, 7, 5, 4, 5, 8, 9, 12,14,12,11, 8, 6, 5, 3, 5, 7,10,13,12,10,10, 8, 7, 5, 4, 6, 9,12,13,12,11,10, 9, 6, 5, 5, 7,10, 13,12,12,11,11, 9, 8, 7, 8,10,12,12,13,13,14,12, 10, 9, 9,10, }; static static_codebook _huff_book__44c9_s_long = { 2, 100, _huff_lengthlist__44c9_s_long, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _vq_quantlist__44c9_s_p1_0[] = { 1, 0, 2, }; static long _vq_lengthlist__44c9_s_p1_0[] = { 1, 5, 5, 0, 5, 5, 0, 5, 5, 6, 8, 8, 0, 9, 8, 0, 8, 8, 6, 8, 8, 0, 8, 9, 0, 8, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 8, 8, 0, 8, 7, 0, 8, 8, 5, 8, 8, 0, 7, 8, 0, 8, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 9, 8, 0, 8, 8, 0, 7, 7, 5, 8, 9, 0, 8, 8, 0, 7, 7, }; static float _vq_quantthresh__44c9_s_p1_0[] = { -0.5, 0.5, }; static long _vq_quantmap__44c9_s_p1_0[] = { 1, 0, 2, }; static encode_aux_threshmatch _vq_auxt__44c9_s_p1_0 = { _vq_quantthresh__44c9_s_p1_0, _vq_quantmap__44c9_s_p1_0, 3, 3 }; static static_codebook _44c9_s_p1_0 = { 4, 81, _vq_lengthlist__44c9_s_p1_0, 1, -535822336, 1611661312, 2, 0, _vq_quantlist__44c9_s_p1_0, NULL, &_vq_auxt__44c9_s_p1_0, NULL, 0 }; static long _vq_quantlist__44c9_s_p2_0[] = { 2, 1, 3, 0, 4, }; static long _vq_lengthlist__44c9_s_p2_0[] = { 3, 6, 6, 8, 8, 0, 6, 6, 8, 8, 0, 5, 5, 8, 8, 0, 7, 7, 9, 9, 0, 0, 0, 9, 9, 6, 7, 7, 9, 8, 0, 8, 7, 9, 9, 0, 7, 7, 9, 9, 0, 9, 9,11,10, 0, 0, 0, 10,10, 6, 7, 7, 8, 9, 0, 7, 8, 9, 9, 0, 7, 7, 9, 9, 0, 9, 9,10,11, 0, 0, 0,10,10, 8, 9, 9,10,10, 0,10,10,11,11, 0,10,10,11,11, 0,12,12,13,12, 0, 0, 0,13,13, 8, 8, 9,10,10, 0,10,10,11,12, 0,10, 10,11,11, 0,12,12,13,13, 0, 0, 0,13,13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 8, 7,10,10, 0, 7, 7,10, 9, 0, 7, 7,10,10, 0, 9, 8,10,10, 0, 0, 0,10,10, 6, 7, 7,10,10, 0, 7, 7, 9,10, 0, 7, 7,10,10, 0, 8, 9,10,10, 0, 0, 0,10,10, 8, 9, 9,11,11, 0,10, 9, 11,11, 0,10,10,11,11, 0,11,11,12,12, 0, 0, 0,12, 12, 8, 9, 9,11,11, 0, 9,10,11,11, 0,10,10,11,11, 0,11,11,12,12, 0, 0, 0,12,12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 8, 7,10,10, 0, 7, 7,10,10, 0, 7, 7, 10, 9, 0, 8, 9,10,10, 0, 0, 0,10, 9, 5, 7, 8,10, 10, 0, 7, 7,10,10, 0, 7, 7, 9,10, 0, 9, 8,10,10, 0, 0, 0,10,10, 8, 9, 9,12,11, 0,10,10,11,11, 0, 10, 9,11,11, 0,11,11,12,12, 0, 0, 0,12,12, 8, 9, 9,11,11, 0,10,10,11,11, 0, 9,10,11,11, 0,11,11, 12,12, 0, 0, 0,12,12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 9, 9,12,12, 0, 9, 9,11,11, 0, 8, 9,11,11, 0, 10, 9,12,11, 0, 0, 0,11,11, 7, 9, 9,12,12, 0, 8, 9,11,11, 0, 9, 8,11,11, 0, 9,10,11,11, 0, 0, 0, 11,11, 9,11,11,13,13, 0,10,10,12,12, 0,10,10,12, 12, 0,12,11,12,12, 0, 0, 0,13,13, 9,10,11,13,13, 0,10,10,12,12, 0,10,10,12,12, 0,11,11,12,12, 0, 0, 0,12,12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 11,10,13,13, 0,10,10,12,12, 0,10, 9,12,12, 0,11, 11,12,13, 0, 0, 0,12,11, 9,10,10,12,13, 0,10,10, 12,12, 0,10,10,12,12, 0,11,11,13,12, 0, 0, 0,12, 12, }; static float _vq_quantthresh__44c9_s_p2_0[] = { -1.5, -0.5, 0.5, 1.5, }; static long _vq_quantmap__44c9_s_p2_0[] = { 3, 1, 0, 2, 4, }; static encode_aux_threshmatch _vq_auxt__44c9_s_p2_0 = { _vq_quantthresh__44c9_s_p2_0, _vq_quantmap__44c9_s_p2_0, 5, 5 }; static static_codebook _44c9_s_p2_0 = { 4, 625, _vq_lengthlist__44c9_s_p2_0, 1, -533725184, 1611661312, 3, 0, _vq_quantlist__44c9_s_p2_0, NULL, &_vq_auxt__44c9_s_p2_0, NULL, 0 }; static long _vq_quantlist__44c9_s_p3_0[] = { 4, 3, 5, 2, 6, 1, 7, 0, 8, }; static long _vq_lengthlist__44c9_s_p3_0[] = { 3, 4, 4, 5, 5, 6, 6, 8, 8, 0, 4, 4, 5, 5, 7, 6, 8, 8, 0, 4, 4, 5, 5, 7, 7, 8, 8, 0, 5, 5, 6, 6, 7, 7, 9, 9, 0, 0, 0, 6, 6, 7, 7, 9, 9, 0, 0, 0, 7, 7, 8, 8, 9, 9, 0, 0, 0, 7, 7, 8, 8, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; static float _vq_quantthresh__44c9_s_p3_0[] = { -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, }; static long _vq_quantmap__44c9_s_p3_0[] = { 7, 5, 3, 1, 0, 2, 4, 6, 8, }; static encode_aux_threshmatch _vq_auxt__44c9_s_p3_0 = { _vq_quantthresh__44c9_s_p3_0, _vq_quantmap__44c9_s_p3_0, 9, 9 }; static static_codebook _44c9_s_p3_0 = { 2, 81, _vq_lengthlist__44c9_s_p3_0, 1, -531628032, 1611661312, 4, 0, _vq_quantlist__44c9_s_p3_0, NULL, &_vq_auxt__44c9_s_p3_0, NULL, 0 }; static long _vq_quantlist__44c9_s_p4_0[] = { 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15, 0, 16, }; static long _vq_lengthlist__44c9_s_p4_0[] = { 4, 4, 4, 5, 5, 6, 6, 7, 7, 7, 7, 8, 8, 9, 9,10, 10, 0, 5, 5, 5, 5, 6, 6, 8, 7, 8, 8, 9, 9,10,10, 11,11, 0, 5, 5, 5, 5, 7, 7, 8, 8, 8, 8, 9, 9,10, 10,11,11, 0, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9,10,10, 11,11,12,12, 0, 0, 0, 6, 6, 7, 7, 8, 8, 9, 9,10, 10,11,11,12,12, 0, 0, 0, 7, 7, 7, 7, 9, 9, 9, 9, 11,11,11,11,12,12, 0, 0, 0, 7, 7, 7, 8, 9, 9, 9, 9,11,10,11,11,12,12, 0, 0, 0, 7, 7, 7, 7, 9, 9, 10,10,11,11,12,12,13,13, 0, 0, 0, 0, 0, 7, 7, 9, 9,10,10,11,11,12,12,13,13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; static float _vq_quantthresh__44c9_s_p4_0[] = { -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, }; static long _vq_quantmap__44c9_s_p4_0[] = { 15, 13, 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, 14, 16, }; static encode_aux_threshmatch _vq_auxt__44c9_s_p4_0 = { _vq_quantthresh__44c9_s_p4_0, _vq_quantmap__44c9_s_p4_0, 17, 17 }; static static_codebook _44c9_s_p4_0 = { 2, 289, _vq_lengthlist__44c9_s_p4_0, 1, -529530880, 1611661312, 5, 0, _vq_quantlist__44c9_s_p4_0, NULL, &_vq_auxt__44c9_s_p4_0, NULL, 0 }; static long _vq_quantlist__44c9_s_p5_0[] = { 1, 0, 2, }; static long _vq_lengthlist__44c9_s_p5_0[] = { 1, 4, 4, 5, 7, 7, 6, 7, 7, 4, 6, 6,10,10,10,10, 10,10, 4, 6, 6,10,10,10,10,10,10, 5,10,10, 9,12, 12,10,12,12, 7,10,10,12,12,12,12,12,13, 7,10,10, 12,12,12,12,13,13, 6,10,10,10,12,12,11,12,12, 8, 10,10,12,12,12,12,12,12, 7,10,10,12,12,13,12,12, 12, }; static float _vq_quantthresh__44c9_s_p5_0[] = { -5.5, 5.5, }; static long _vq_quantmap__44c9_s_p5_0[] = { 1, 0, 2, }; static encode_aux_threshmatch _vq_auxt__44c9_s_p5_0 = { _vq_quantthresh__44c9_s_p5_0, _vq_quantmap__44c9_s_p5_0, 3, 3 }; static static_codebook _44c9_s_p5_0 = { 4, 81, _vq_lengthlist__44c9_s_p5_0, 1, -529137664, 1618345984, 2, 0, _vq_quantlist__44c9_s_p5_0, NULL, &_vq_auxt__44c9_s_p5_0, NULL, 0 }; static long _vq_quantlist__44c9_s_p5_1[] = { 5, 4, 6, 3, 7, 2, 8, 1, 9, 0, 10, }; static long _vq_lengthlist__44c9_s_p5_1[] = { 4, 5, 5, 6, 6, 6, 7, 7, 7, 7, 7,10, 5, 5, 6, 6, 7, 7, 7, 7, 8, 8,10, 5, 5, 6, 6, 7, 7, 7, 7, 8, 8,11, 5, 5, 6, 6, 7, 7, 8, 8, 8, 8,11,11,11, 6, 6, 7, 7, 8, 8, 8, 8,11,11,11, 6, 6, 7, 7, 8, 8, 8, 8,11,11,11, 6, 6, 7, 7, 7, 7, 8, 8,11,11,11, 7, 7, 7, 7, 7, 7, 8, 8,11,11,11,11,11, 7, 7, 7, 7, 8, 8,11,11,11,11,11, 7, 7, 7, 7, 7, 7,11,11, 11,11,11, 7, 7, 7, 7, 7, 7, }; static float _vq_quantthresh__44c9_s_p5_1[] = { -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, }; static long _vq_quantmap__44c9_s_p5_1[] = { 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, }; static encode_aux_threshmatch _vq_auxt__44c9_s_p5_1 = { _vq_quantthresh__44c9_s_p5_1, _vq_quantmap__44c9_s_p5_1, 11, 11 }; static static_codebook _44c9_s_p5_1 = { 2, 121, _vq_lengthlist__44c9_s_p5_1, 1, -531365888, 1611661312, 4, 0, _vq_quantlist__44c9_s_p5_1, NULL, &_vq_auxt__44c9_s_p5_1, NULL, 0 }; static long _vq_quantlist__44c9_s_p6_0[] = { 6, 5, 7, 4, 8, 3, 9, 2, 10, 1, 11, 0, 12, }; static long _vq_lengthlist__44c9_s_p6_0[] = { 2, 4, 4, 6, 6, 7, 7, 8, 8, 9, 9,10,10, 5, 4, 4, 6, 6, 8, 8, 9, 9,10,10,11,11, 6, 4, 4, 6, 6, 8, 8, 9, 9,10,10,12,12, 0, 6, 6, 6, 6, 8, 8,10,10, 11,11,12,12, 0, 6, 6, 6, 6, 8, 8,10,10,11,11,12, 12, 0,10,10, 8, 8, 9, 9,11,11,12,12,13,13, 0,11, 11, 8, 8, 9,10,11,11,12,12,13,13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; static float _vq_quantthresh__44c9_s_p6_0[] = { -27.5, -22.5, -17.5, -12.5, -7.5, -2.5, 2.5, 7.5, 12.5, 17.5, 22.5, 27.5, }; static long _vq_quantmap__44c9_s_p6_0[] = { 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, }; static encode_aux_threshmatch _vq_auxt__44c9_s_p6_0 = { _vq_quantthresh__44c9_s_p6_0, _vq_quantmap__44c9_s_p6_0, 13, 13 }; static static_codebook _44c9_s_p6_0 = { 2, 169, _vq_lengthlist__44c9_s_p6_0, 1, -526516224, 1616117760, 4, 0, _vq_quantlist__44c9_s_p6_0, NULL, &_vq_auxt__44c9_s_p6_0, NULL, 0 }; static long _vq_quantlist__44c9_s_p6_1[] = { 2, 1, 3, 0, 4, }; static long _vq_lengthlist__44c9_s_p6_1[] = { 4, 4, 4, 5, 5, 5, 4, 4, 5, 5, 5, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, }; static float _vq_quantthresh__44c9_s_p6_1[] = { -1.5, -0.5, 0.5, 1.5, }; static long _vq_quantmap__44c9_s_p6_1[] = { 3, 1, 0, 2, 4, }; static encode_aux_threshmatch _vq_auxt__44c9_s_p6_1 = { _vq_quantthresh__44c9_s_p6_1, _vq_quantmap__44c9_s_p6_1, 5, 5 }; static static_codebook _44c9_s_p6_1 = { 2, 25, _vq_lengthlist__44c9_s_p6_1, 1, -533725184, 1611661312, 3, 0, _vq_quantlist__44c9_s_p6_1, NULL, &_vq_auxt__44c9_s_p6_1, NULL, 0 }; static long _vq_quantlist__44c9_s_p7_0[] = { 6, 5, 7, 4, 8, 3, 9, 2, 10, 1, 11, 0, 12, }; static long _vq_lengthlist__44c9_s_p7_0[] = { 1, 4, 4, 7, 7, 8, 8, 9, 9,10,10,11,11, 6, 5, 5, 7, 7, 9, 8,10,10,11,11,12,12, 6, 5, 5, 7, 7, 9, 9,10,10,11,11,12,12,20, 6, 6, 7, 7, 9, 9,10,10, 11,11,12,12,20, 7, 7, 7, 7, 9, 9,10,10,11,11,13, 12,20,10,10, 8, 8, 9, 9,11,11,12,12,13,13,20,11, 11, 8, 8, 9, 9,11,11,12,12,13,13,20,20,20,10,10, 10,10,11,11,12,12,13,13,20,20,20,10,10,10,10,11, 11,12,12,13,13,20,20,20,14,14,11,11,12,12,13,13, 14,13,20,20,20,14,15,11,11,11,11,13,13,14,13,20, 20,20,20,19,12,12,12,12,13,13,14,14,19,19,19,19, 19,13,13,12,12,13,13,14,14, }; static float _vq_quantthresh__44c9_s_p7_0[] = { -60.5, -49.5, -38.5, -27.5, -16.5, -5.5, 5.5, 16.5, 27.5, 38.5, 49.5, 60.5, }; static long _vq_quantmap__44c9_s_p7_0[] = { 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, }; static encode_aux_threshmatch _vq_auxt__44c9_s_p7_0 = { _vq_quantthresh__44c9_s_p7_0, _vq_quantmap__44c9_s_p7_0, 13, 13 }; static static_codebook _44c9_s_p7_0 = { 2, 169, _vq_lengthlist__44c9_s_p7_0, 1, -523206656, 1618345984, 4, 0, _vq_quantlist__44c9_s_p7_0, NULL, &_vq_auxt__44c9_s_p7_0, NULL, 0 }; static long _vq_quantlist__44c9_s_p7_1[] = { 5, 4, 6, 3, 7, 2, 8, 1, 9, 0, 10, }; static long _vq_lengthlist__44c9_s_p7_1[] = { 5, 6, 6, 6, 6, 7, 6, 7, 7, 7, 7, 8, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 8, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 8, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 8, 8, 8, 6, 6, 7, 7, 7, 7, 7, 7, 8, 8, 8, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 7, 7, 7, 7, 7, 7, }; static float _vq_quantthresh__44c9_s_p7_1[] = { -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, }; static long _vq_quantmap__44c9_s_p7_1[] = { 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, }; static encode_aux_threshmatch _vq_auxt__44c9_s_p7_1 = { _vq_quantthresh__44c9_s_p7_1, _vq_quantmap__44c9_s_p7_1, 11, 11 }; static static_codebook _44c9_s_p7_1 = { 2, 121, _vq_lengthlist__44c9_s_p7_1, 1, -531365888, 1611661312, 4, 0, _vq_quantlist__44c9_s_p7_1, NULL, &_vq_auxt__44c9_s_p7_1, NULL, 0 }; static long _vq_quantlist__44c9_s_p8_0[] = { 7, 6, 8, 5, 9, 4, 10, 3, 11, 2, 12, 1, 13, 0, 14, }; static long _vq_lengthlist__44c9_s_p8_0[] = { 1, 4, 4, 7, 7, 8, 8, 8, 8, 9, 9,10,10,11,11, 6, 5, 5, 7, 7, 9, 9, 8, 9,10,10,11,11,12,12, 6, 5, 5, 7, 7, 9, 9, 9, 9,10,10,11,11,12,12,19, 7, 8, 8, 8, 9, 9, 9, 9,10,10,11,11,12,13,19, 8, 8, 8, 8, 9, 9, 9, 9,10,10,11,12,12,12,19,12,12, 9, 9, 9,10, 9,10,10,10,12,12,12,12,19,12,12, 9, 9,10, 9,10,10,11,11,12,11,13,13,19,19,19, 9, 9, 9, 9, 10,10,11,11,12,12,12,12,19,19,19, 9, 9, 9, 9,10, 10,11,11,12,12,13,13,19,19,19,13,13,10,10,10,10, 12,12,12,12,13,13,19,19,19,13,13,10,10,10,10,12, 12,12,12,13,13,19,19,19,19,19,11,12,11,11,12,12, 13,12,13,13,19,19,19,18,18,12,11,11,10,12,11,13, 13,13,14,18,18,18,18,18,15,16,12,12,13,12,13,13, 14,14,18,18,18,18,18,16,15,12,11,12,11,13,13,14, 14, }; static float _vq_quantthresh__44c9_s_p8_0[] = { -136.5, -115.5, -94.5, -73.5, -52.5, -31.5, -10.5, 10.5, 31.5, 52.5, 73.5, 94.5, 115.5, 136.5, }; static long _vq_quantmap__44c9_s_p8_0[] = { 13, 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, 14, }; static encode_aux_threshmatch _vq_auxt__44c9_s_p8_0 = { _vq_quantthresh__44c9_s_p8_0, _vq_quantmap__44c9_s_p8_0, 15, 15 }; static static_codebook _44c9_s_p8_0 = { 2, 225, _vq_lengthlist__44c9_s_p8_0, 1, -520986624, 1620377600, 4, 0, _vq_quantlist__44c9_s_p8_0, NULL, &_vq_auxt__44c9_s_p8_0, NULL, 0 }; static long _vq_quantlist__44c9_s_p8_1[] = { 10, 9, 11, 8, 12, 7, 13, 6, 14, 5, 15, 4, 16, 3, 17, 2, 18, 1, 19, 0, 20, }; static long _vq_lengthlist__44c9_s_p8_1[] = { 4, 6, 6, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9,10, 6, 6, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,10, 6, 6, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,10, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,10,10,10, 7, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,10,10,10, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,10,10, 10, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,10,10,10, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,10,10,10,10,10, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,10,10,10, 10,10, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,10,10,10,10,10, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,10,10,10,10,10, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,10,10,10,10, 10,10,10, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,10,10,10,10,10,10,10, 9, 9, 9, 9,10,10,10,10, 9, 9, 9, 9, 9, 9,10,10,10,10,10,10,10, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,10,10,10,10,10, 10,10, 9, 9, 9, 9, 9,10, 9, 9, 9, 9, 9, 9, 9, 9, 10,10,10,10,10,10,10,10,10, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,10,10,10,10,10,10,10,10,10,10,10, 10,10, 9, 9, 9,10, 9, 9, 9, 9,10,10,10,10,10,10, 10,10,10, 9,10, 9, 9, 9, 9, 9, 9, 9, 9, 9,10,10, 10,10,10,10,10,10,10,10,10,10, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,10,10,10,10,10,10,10,10,10,10,10, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, }; static float _vq_quantthresh__44c9_s_p8_1[] = { -9.5, -8.5, -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, 9.5, }; static long _vq_quantmap__44c9_s_p8_1[] = { 19, 17, 15, 13, 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, }; static encode_aux_threshmatch _vq_auxt__44c9_s_p8_1 = { _vq_quantthresh__44c9_s_p8_1, _vq_quantmap__44c9_s_p8_1, 21, 21 }; static static_codebook _44c9_s_p8_1 = { 2, 441, _vq_lengthlist__44c9_s_p8_1, 1, -529268736, 1611661312, 5, 0, _vq_quantlist__44c9_s_p8_1, NULL, &_vq_auxt__44c9_s_p8_1, NULL, 0 }; static long _vq_quantlist__44c9_s_p9_0[] = { 9, 8, 10, 7, 11, 6, 12, 5, 13, 4, 14, 3, 15, 2, 16, 1, 17, 0, 18, }; static long _vq_lengthlist__44c9_s_p9_0[] = { 1, 4, 4,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10, 7, 9,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10, 7, 9,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, }; static float _vq_quantthresh__44c9_s_p9_0[] = { -7913.5, -6982.5, -6051.5, -5120.5, -4189.5, -3258.5, -2327.5, -1396.5, -465.5, 465.5, 1396.5, 2327.5, 3258.5, 4189.5, 5120.5, 6051.5, 6982.5, 7913.5, }; static long _vq_quantmap__44c9_s_p9_0[] = { 17, 15, 13, 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, }; static encode_aux_threshmatch _vq_auxt__44c9_s_p9_0 = { _vq_quantthresh__44c9_s_p9_0, _vq_quantmap__44c9_s_p9_0, 19, 19 }; static static_codebook _44c9_s_p9_0 = { 2, 361, _vq_lengthlist__44c9_s_p9_0, 1, -508535424, 1631393792, 5, 0, _vq_quantlist__44c9_s_p9_0, NULL, &_vq_auxt__44c9_s_p9_0, NULL, 0 }; static long _vq_quantlist__44c9_s_p9_1[] = { 9, 8, 10, 7, 11, 6, 12, 5, 13, 4, 14, 3, 15, 2, 16, 1, 17, 0, 18, }; static long _vq_lengthlist__44c9_s_p9_1[] = { 1, 4, 4, 7, 7, 8, 8, 8, 8, 9,10,10,10,12,11,12, 13,13,12, 6, 5, 5, 8, 8, 8, 9, 8, 9,10,10,11,11, 12,12,14,13,13,12, 5, 5, 5, 8, 8, 9, 8, 8, 9,10, 10,11,11,12,12,14,12,13,13,16, 8, 8, 9, 9, 9, 9, 9, 9,10,10,11,12,13,13,13,13,14,14,16, 8, 8, 9, 9, 9, 9, 9, 9,11,11,12,11,13,13,14,13,13,13,16, 14,13, 9, 9, 9, 9,10,10,11,12,12,13,13,13,14,13, 15,14,16,13,13, 9, 8, 9, 9,10,10,12,11,13,13,14, 14,14,14,15,14,16,16,16, 9, 9, 9, 9,10,10,12,12, 12,13,13,13,15,13,15,15,16,16,16, 9, 7, 9, 8,10, 11,11,12,12,13,13,16,15,14,14,14,16,16,16,13,13, 10,10,11,11,13,15,13,14,13,14,14,13,14,14,16,16, 16,13,12,10, 9,11,11,12,12,14,14,13,14,14,14,14, 14,16,16,16,16,16,12,13,11,11,12,13,13,13,14,15, 14,14,16,15,16,16,16,16,16,12,11,12,12,15,13,13, 13,14,13,15,14,15,14,16,16,16,16,16,14,15,12,13, 13,12,14,15,15,14,15,14,15,13,16,16,16,16,16,16, 16,13,13,14,12,16,12,16,15,14,15,14,14,16,16,16, 16,16,16,16,15,14,14,14,15,16,16,16,16,14,16,16, 16,16,16,16,16,16,16,14,14,14,12,15,11,15,13,16, 15,16,15,16,16,16,16,16,16,16,15,16,14,14,15,13, 15,16,16,16,16,15,16,16,16,16,16,16,16,16,16,15, 15,14,13,14,16,16,14,15,16, }; static float _vq_quantthresh__44c9_s_p9_1[] = { -416.5, -367.5, -318.5, -269.5, -220.5, -171.5, -122.5, -73.5, -24.5, 24.5, 73.5, 122.5, 171.5, 220.5, 269.5, 318.5, 367.5, 416.5, }; static long _vq_quantmap__44c9_s_p9_1[] = { 17, 15, 13, 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, }; static encode_aux_threshmatch _vq_auxt__44c9_s_p9_1 = { _vq_quantthresh__44c9_s_p9_1, _vq_quantmap__44c9_s_p9_1, 19, 19 }; static static_codebook _44c9_s_p9_1 = { 2, 361, _vq_lengthlist__44c9_s_p9_1, 1, -518287360, 1622704128, 5, 0, _vq_quantlist__44c9_s_p9_1, NULL, &_vq_auxt__44c9_s_p9_1, NULL, 0 }; static long _vq_quantlist__44c9_s_p9_2[] = { 24, 23, 25, 22, 26, 21, 27, 20, 28, 19, 29, 18, 30, 17, 31, 16, 32, 15, 33, 14, 34, 13, 35, 12, 36, 11, 37, 10, 38, 9, 39, 8, 40, 7, 41, 6, 42, 5, 43, 4, 44, 3, 45, 2, 46, 1, 47, 0, 48, }; static long _vq_lengthlist__44c9_s_p9_2[] = { 3, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 6, 6, 7, 7, 6, 7, 6, 7, 7, 7, 7, 7, 7, 7, 7, }; static float _vq_quantthresh__44c9_s_p9_2[] = { -23.5, -22.5, -21.5, -20.5, -19.5, -18.5, -17.5, -16.5, -15.5, -14.5, -13.5, -12.5, -11.5, -10.5, -9.5, -8.5, -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, 9.5, 10.5, 11.5, 12.5, 13.5, 14.5, 15.5, 16.5, 17.5, 18.5, 19.5, 20.5, 21.5, 22.5, 23.5, }; static long _vq_quantmap__44c9_s_p9_2[] = { 47, 45, 43, 41, 39, 37, 35, 33, 31, 29, 27, 25, 23, 21, 19, 17, 15, 13, 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, }; static encode_aux_threshmatch _vq_auxt__44c9_s_p9_2 = { _vq_quantthresh__44c9_s_p9_2, _vq_quantmap__44c9_s_p9_2, 49, 49 }; static static_codebook _44c9_s_p9_2 = { 1, 49, _vq_lengthlist__44c9_s_p9_2, 1, -526909440, 1611661312, 6, 0, _vq_quantlist__44c9_s_p9_2, NULL, &_vq_auxt__44c9_s_p9_2, NULL, 0 }; static long _huff_lengthlist__44c9_s_short[] = { 5,13,17,15,16,16,18,17,18,18, 5, 7,10,12,12,12, 12,17,18,17, 7, 6, 7, 8, 9, 9, 9,13,17,17, 8, 6, 6, 5, 6, 7, 8,11,16,18, 9, 7, 7, 5, 5, 6, 7,10, 15,18, 9, 8, 7, 6, 5, 4, 5, 7,13,17,11,11, 9, 8, 7, 4, 3, 5,12,18,13,13,12,10, 7, 5, 4, 3, 8,13, 16,16,16,13, 8, 8, 7, 5, 8,12,15,18,17,15,11,10, 9, 8,10,14, }; static static_codebook _huff_book__44c9_s_short = { 2, 100, _huff_lengthlist__44c9_s_short, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _vq_quantlist__8c0_s_p1_0[] = { 1, 0, 2, }; static long _vq_lengthlist__8c0_s_p1_0[] = { 1, 5, 4, 0, 0, 0, 0, 0, 0, 5, 7, 7, 0, 0, 0, 0, 0, 0, 5, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,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 0.5, }; static long _vq_quantmap__8c0_s_p1_0[] = { 1, 0, 2, }; static encode_aux_threshmatch _vq_auxt__8c0_s_p1_0 = { _vq_quantthresh__8c0_s_p1_0, _vq_quantmap__8c0_s_p1_0, 3, 3 }; static static_codebook _8c0_s_p1_0 = { 8, 6561, _vq_lengthlist__8c0_s_p1_0, 1, -535822336, 1611661312, 2, 0, _vq_quantlist__8c0_s_p1_0, NULL, &_vq_auxt__8c0_s_p1_0, NULL, 0 }; static long _vq_quantlist__8c0_s_p2_0[] = { 2, 1, 3, 0, 4, }; static long _vq_lengthlist__8c0_s_p2_0[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; static float _vq_quantthresh__8c0_s_p2_0[] = { -1.5, -0.5, 0.5, 1.5, }; static long _vq_quantmap__8c0_s_p2_0[] = { 3, 1, 0, 2, 4, }; static encode_aux_threshmatch _vq_auxt__8c0_s_p2_0 = { _vq_quantthresh__8c0_s_p2_0, _vq_quantmap__8c0_s_p2_0, 5, 5 }; static static_codebook _8c0_s_p2_0 = { 4, 625, _vq_lengthlist__8c0_s_p2_0, 1, -533725184, 1611661312, 3, 0, _vq_quantlist__8c0_s_p2_0, NULL, &_vq_auxt__8c0_s_p2_0, NULL, 0 }; static long _vq_quantlist__8c0_s_p3_0[] = { 2, 1, 3, 0, 4, }; static long _vq_lengthlist__8c0_s_p3_0[] = { 1, 4, 4, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 5, 6, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 5, 5, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 7, 7, 8, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 7, 7, 8, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; static float _vq_quantthresh__8c0_s_p3_0[] = { -1.5, -0.5, 0.5, 1.5, }; static long _vq_quantmap__8c0_s_p3_0[] = { 3, 1, 0, 2, 4, }; static encode_aux_threshmatch _vq_auxt__8c0_s_p3_0 = { _vq_quantthresh__8c0_s_p3_0, _vq_quantmap__8c0_s_p3_0, 5, 5 }; static static_codebook _8c0_s_p3_0 = { 4, 625, _vq_lengthlist__8c0_s_p3_0, 1, -533725184, 1611661312, 3, 0, _vq_quantlist__8c0_s_p3_0, NULL, &_vq_auxt__8c0_s_p3_0, NULL, 0 }; static long _vq_quantlist__8c0_s_p4_0[] = { 4, 3, 5, 2, 6, 1, 7, 0, 8, }; static long _vq_lengthlist__8c0_s_p4_0[] = { 1, 2, 3, 7, 7, 0, 0, 0, 0, 0, 0, 0, 6, 6, 0, 0, 0, 0, 0, 0, 0, 6, 6, 0, 0, 0, 0, 0, 0, 0, 7, 7, 0, 0, 0, 0, 0, 0, 0, 7, 7, 0, 0, 0, 0, 0, 0, 0, 8, 8, 0, 0, 0, 0, 0, 0, 0, 9, 8, 0, 0, 0, 0, 0, 0, 0,10,10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; static float _vq_quantthresh__8c0_s_p4_0[] = { -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, }; static long _vq_quantmap__8c0_s_p4_0[] = { 7, 5, 3, 1, 0, 2, 4, 6, 8, }; static encode_aux_threshmatch _vq_auxt__8c0_s_p4_0 = { _vq_quantthresh__8c0_s_p4_0, _vq_quantmap__8c0_s_p4_0, 9, 9 }; static static_codebook _8c0_s_p4_0 = { 2, 81, _vq_lengthlist__8c0_s_p4_0, 1, -531628032, 1611661312, 4, 0, _vq_quantlist__8c0_s_p4_0, NULL, &_vq_auxt__8c0_s_p4_0, NULL, 0 }; static long _vq_quantlist__8c0_s_p5_0[] = { 4, 3, 5, 2, 6, 1, 7, 0, 8, }; static long _vq_lengthlist__8c0_s_p5_0[] = { 1, 3, 3, 5, 5, 7, 6, 8, 8, 0, 0, 0, 7, 7, 7, 7, 8, 8, 0, 0, 0, 7, 7, 7, 7, 8, 9, 0, 0, 0, 8, 8, 8, 8, 9, 9, 0, 0, 0, 8, 8, 8, 8, 9, 9, 0, 0, 0, 9, 9, 8, 8,10,10, 0, 0, 0, 9, 9, 8, 8,10,10, 0, 0, 0,10,10, 9, 9,10,10, 0, 0, 0, 0, 0, 9, 9,10, 10, }; static float _vq_quantthresh__8c0_s_p5_0[] = { -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, }; static long _vq_quantmap__8c0_s_p5_0[] = { 7, 5, 3, 1, 0, 2, 4, 6, 8, }; static encode_aux_threshmatch _vq_auxt__8c0_s_p5_0 = { _vq_quantthresh__8c0_s_p5_0, _vq_quantmap__8c0_s_p5_0, 9, 9 }; static static_codebook _8c0_s_p5_0 = { 2, 81, _vq_lengthlist__8c0_s_p5_0, 1, -531628032, 1611661312, 4, 0, _vq_quantlist__8c0_s_p5_0, NULL, &_vq_auxt__8c0_s_p5_0, NULL, 0 }; static long _vq_quantlist__8c0_s_p6_0[] = { 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15, 0, 16, }; static long _vq_lengthlist__8c0_s_p6_0[] = { 1, 3, 3, 6, 6, 8, 8, 9, 9, 8, 8,10, 9,10,10,11, 11, 0, 0, 0, 7, 7, 8, 8, 9, 9, 9, 9,10,10,11,11, 11,12, 0, 0, 0, 7, 7, 8, 8, 9, 9, 9, 9,10,10,11, 11,12,11, 0, 0, 0, 8, 8, 9, 9,10,10, 9, 9,10,10, 11,11,12,12, 0, 0, 0, 8, 8, 9, 9,10,10, 9, 9,11, 10,11,11,12,12, 0, 0, 0, 9, 9, 9, 9,10,10,10,10, 11,11,11,12,12,12, 0, 0, 0, 9, 9, 9, 9,10,10,10, 10,11,11,12,12,13,13, 0, 0, 0,10,10,10,10,11,11, 10,10,11,11,12,12,13,13, 0, 0, 0, 0, 0,10, 9,10, 11,10,10,11,11,12,12,13,13, 0, 0, 0, 0, 0, 9, 9, 10, 9,10,11,12,12,13,13,14,13, 0, 0, 0, 0, 0, 9, 9, 9,10,10,10,11,11,13,12,13,13, 0, 0, 0, 0, 0, 10,10,10,10,11,11,12,12,13,13,14,14, 0, 0, 0, 0, 0, 0, 0,10,10,11,11,12,12,13,13,13,14, 0, 0, 0, 0, 0, 0, 0,11,11,11,11,12,12,13,14,14,14, 0, 0, 0, 0, 0, 0, 0,11,11,11,11,12,12,13,13,14,13, 0, 0, 0, 0, 0, 0, 0,11,11,12,12,13,13,14,14,14,14, 0, 0, 0, 0, 0, 0, 0, 0, 0,12,12,12,12,13,13,14, 14, }; static float _vq_quantthresh__8c0_s_p6_0[] = { -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, }; static long _vq_quantmap__8c0_s_p6_0[] = { 15, 13, 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, 14, 16, }; static encode_aux_threshmatch _vq_auxt__8c0_s_p6_0 = { _vq_quantthresh__8c0_s_p6_0, _vq_quantmap__8c0_s_p6_0, 17, 17 }; static static_codebook _8c0_s_p6_0 = { 2, 289, _vq_lengthlist__8c0_s_p6_0, 1, -529530880, 1611661312, 5, 0, _vq_quantlist__8c0_s_p6_0, NULL, &_vq_auxt__8c0_s_p6_0, NULL, 0 }; static long _vq_quantlist__8c0_s_p7_0[] = { 1, 0, 2, }; static long _vq_lengthlist__8c0_s_p7_0[] = { 1, 4, 4, 7, 6, 6, 7, 6, 6, 4, 7, 7,11, 9,10,12, 9,10, 4, 7, 7,10,10,10,11, 9, 9, 6,11,10,11,11, 12,11,11,11, 6,10,10,11,11,12,11,10,10, 6, 9,10, 11,11,11,11,10,10, 7,10,11,12,11,11,12,11,12, 6, 9, 9,10, 9, 9,11,10,10, 6, 9, 9,10,10,10,11,10, 10, }; static float _vq_quantthresh__8c0_s_p7_0[] = { -5.5, 5.5, }; static long _vq_quantmap__8c0_s_p7_0[] = { 1, 0, 2, }; static encode_aux_threshmatch _vq_auxt__8c0_s_p7_0 = { _vq_quantthresh__8c0_s_p7_0, _vq_quantmap__8c0_s_p7_0, 3, 3 }; static static_codebook _8c0_s_p7_0 = { 4, 81, _vq_lengthlist__8c0_s_p7_0, 1, -529137664, 1618345984, 2, 0, _vq_quantlist__8c0_s_p7_0, NULL, &_vq_auxt__8c0_s_p7_0, NULL, 0 }; static long _vq_quantlist__8c0_s_p7_1[] = { 5, 4, 6, 3, 7, 2, 8, 1, 9, 0, 10, }; static long _vq_lengthlist__8c0_s_p7_1[] = { 1, 3, 3, 6, 6, 8, 8, 9, 9, 9, 9,10,10,10, 7, 7, 8, 8, 9, 9, 9, 9,10,10, 9, 7, 7, 8, 8, 9, 9, 9, 9,10,10,10, 8, 8, 9, 9, 9, 9, 9, 9,10,10,10, 8, 8, 9, 9, 9, 9, 8, 9,10,10,10, 8, 8, 9, 9, 9,10, 10,10,10,10,10, 9, 9, 9, 9, 9, 9,10,10,11,10,11, 9, 9, 9, 9,10,10,10,10,11,11,11,10,10, 9, 9,10, 10,10, 9,11,10,10,10,10,10,10, 9, 9,10,10,11,11, 10,10,10, 9, 9, 9,10,10,10, }; static float _vq_quantthresh__8c0_s_p7_1[] = { -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, }; static long _vq_quantmap__8c0_s_p7_1[] = { 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, }; static encode_aux_threshmatch _vq_auxt__8c0_s_p7_1 = { _vq_quantthresh__8c0_s_p7_1, _vq_quantmap__8c0_s_p7_1, 11, 11 }; static static_codebook _8c0_s_p7_1 = { 2, 121, _vq_lengthlist__8c0_s_p7_1, 1, -531365888, 1611661312, 4, 0, _vq_quantlist__8c0_s_p7_1, NULL, &_vq_auxt__8c0_s_p7_1, NULL, 0 }; static long _vq_quantlist__8c0_s_p8_0[] = { 6, 5, 7, 4, 8, 3, 9, 2, 10, 1, 11, 0, 12, }; static long _vq_lengthlist__8c0_s_p8_0[] = { 1, 4, 4, 7, 6, 7, 7, 7, 7, 8, 8, 9, 9, 7, 6, 6, 7, 7, 8, 8, 7, 7, 8, 9,10,10, 7, 6, 6, 7, 7, 8, 7, 7, 7, 9, 9,10,12, 0, 8, 8, 8, 8, 8, 9, 8, 8, 9, 9,10,10, 0, 8, 8, 8, 8, 8, 9, 8, 9, 9, 9,11, 10, 0, 0,13, 9, 8, 9, 9, 9, 9,10,10,11,11, 0,13, 0, 9, 9, 9, 9, 9, 9,11,10,11,11, 0, 0, 0, 8, 9, 10, 9,10,10,13,11,12,12, 0, 0, 0, 8, 9, 9, 9,10, 10,13,12,12,13, 0, 0, 0,12, 0,10,10,12,11,10,11, 12,12, 0, 0, 0,13,13,10,10,10,11,12, 0,13, 0, 0, 0, 0, 0, 0,13,11, 0,12,12,12,13,12, 0, 0, 0, 0, 0, 0,13,13,11,13,13,11,12, }; static float _vq_quantthresh__8c0_s_p8_0[] = { -27.5, -22.5, -17.5, -12.5, -7.5, -2.5, 2.5, 7.5, 12.5, 17.5, 22.5, 27.5, }; static long _vq_quantmap__8c0_s_p8_0[] = { 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, }; static encode_aux_threshmatch _vq_auxt__8c0_s_p8_0 = { _vq_quantthresh__8c0_s_p8_0, _vq_quantmap__8c0_s_p8_0, 13, 13 }; static static_codebook _8c0_s_p8_0 = { 2, 169, _vq_lengthlist__8c0_s_p8_0, 1, -526516224, 1616117760, 4, 0, _vq_quantlist__8c0_s_p8_0, NULL, &_vq_auxt__8c0_s_p8_0, NULL, 0 }; static long _vq_quantlist__8c0_s_p8_1[] = { 2, 1, 3, 0, 4, }; static long _vq_lengthlist__8c0_s_p8_1[] = { 1, 3, 4, 5, 5, 7, 6, 6, 6, 5, 7, 7, 7, 6, 6, 7, 7, 7, 6, 6, 7, 7, 7, 6, 6, }; static float _vq_quantthresh__8c0_s_p8_1[] = { -1.5, -0.5, 0.5, 1.5, }; static long _vq_quantmap__8c0_s_p8_1[] = { 3, 1, 0, 2, 4, }; static encode_aux_threshmatch _vq_auxt__8c0_s_p8_1 = { _vq_quantthresh__8c0_s_p8_1, _vq_quantmap__8c0_s_p8_1, 5, 5 }; static static_codebook _8c0_s_p8_1 = { 2, 25, _vq_lengthlist__8c0_s_p8_1, 1, -533725184, 1611661312, 3, 0, _vq_quantlist__8c0_s_p8_1, NULL, &_vq_auxt__8c0_s_p8_1, NULL, 0 }; static long _vq_quantlist__8c0_s_p9_0[] = { 1, 0, 2, }; static long _vq_lengthlist__8c0_s_p9_0[] = { 1, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, }; static float _vq_quantthresh__8c0_s_p9_0[] = { -157.5, 157.5, }; static long _vq_quantmap__8c0_s_p9_0[] = { 1, 0, 2, }; static encode_aux_threshmatch _vq_auxt__8c0_s_p9_0 = { _vq_quantthresh__8c0_s_p9_0, _vq_quantmap__8c0_s_p9_0, 3, 3 }; static static_codebook _8c0_s_p9_0 = { 4, 81, _vq_lengthlist__8c0_s_p9_0, 1, -518803456, 1628680192, 2, 0, _vq_quantlist__8c0_s_p9_0, NULL, &_vq_auxt__8c0_s_p9_0, NULL, 0 }; static long _vq_quantlist__8c0_s_p9_1[] = { 7, 6, 8, 5, 9, 4, 10, 3, 11, 2, 12, 1, 13, 0, 14, }; static long _vq_lengthlist__8c0_s_p9_1[] = { 1, 4, 4, 5, 5,10, 8,11,11,11,11,11,11,11,11, 6, 6, 6, 7, 6,11,10,11,11,11,11,11,11,11,11, 7, 5, 6, 6, 6, 8, 7,11,11,11,11,11,11,11,11,11, 7, 8, 8, 8, 9, 9,11,11,11,11,11,11,11,11,11, 9, 8, 7, 8, 9,11,11,11,11,11,11,11,11,11,11,11,10,11,11, 11,11,11,11,11,11,11,11,11,11,11,11,11,10,11,11, 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, 11, }; static float _vq_quantthresh__8c0_s_p9_1[] = { -136.5, -115.5, -94.5, -73.5, -52.5, -31.5, -10.5, 10.5, 31.5, 52.5, 73.5, 94.5, 115.5, 136.5, }; static long _vq_quantmap__8c0_s_p9_1[] = { 13, 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, 14, }; static encode_aux_threshmatch _vq_auxt__8c0_s_p9_1 = { _vq_quantthresh__8c0_s_p9_1, _vq_quantmap__8c0_s_p9_1, 15, 15 }; static static_codebook _8c0_s_p9_1 = { 2, 225, _vq_lengthlist__8c0_s_p9_1, 1, -520986624, 1620377600, 4, 0, _vq_quantlist__8c0_s_p9_1, NULL, &_vq_auxt__8c0_s_p9_1, NULL, 0 }; static long _vq_quantlist__8c0_s_p9_2[] = { 10, 9, 11, 8, 12, 7, 13, 6, 14, 5, 15, 4, 16, 3, 17, 2, 18, 1, 19, 0, 20, }; static long _vq_lengthlist__8c0_s_p9_2[] = { 1, 5, 5, 7, 7, 8, 7, 8, 8,10,10, 9, 9,10,10,10, 11,11,10,12,11,12,12,12, 9, 8, 8, 8, 8, 8, 9,10, 10,10,10,11,11,11,10,11,11,12,12,11,12, 8, 8, 7, 7, 8, 9,10,10,10, 9,10,10, 9,10,10,11,11,11,11, 11,11, 9, 9, 9, 9, 8, 9,10,10,11,10,10,11,11,12, 10,10,12,12,11,11,10, 9, 9,10, 8, 9,10,10,10, 9, 10,10,11,11,10,11,10,10,10,12,12,12, 9,10, 9,10, 9, 9,10,10,11,11,11,11,10,10,10,11,12,11,12,11, 12,10,11,10,11, 9,10, 9,10, 9,10,10, 9,10,10,11, 10,11,11,11,11,12,11, 9,10,10,10,10,11,11,11,11, 11,10,11,11,11,11,10,12,10,12,12,11,12,10,10,11, 10, 9,11,10,11, 9,10,11,10,10,10,11,11,11,11,12, 12,10, 9, 9,11,10, 9,12,11,10,12,12,11,11,11,11, 10,11,11,12,11,10,12, 9,11,10,11,10,10,11,10,11, 9,10,10,10,11,12,11,11,12,11,10,10,11,11, 9,10, 10,12,10,11,10,10,10, 9,10,10,10,10, 9,10,10,11, 11,11,11,12,11,10,10,10,10,11,11,10,11,11, 9,11, 10,12,10,12,11,10,11,10,10,10,11,10,10,11,11,10, 11,10,10,10,10,11,11,12,10,10,10,11,10,11,12,11, 10,11,10,10,11,11,10,12,10, 9,10,10,11,11,11,10, 12,10,10,11,11,11,10,10,11,10,10,10,11,10,11,10, 12,11,11,10,10,10,12,10,10,11, 9,10,11,11,11,10, 10,11,10,10, 9,11,11,12,12,11,12,11,11,11,11,11, 11, 9,10,11,10,12,10,10,10,10,11,10,10,11,10,10, 12,10,10,10,10,10, 9,12,10,10,10,10,12, 9,11,10, 10,11,10,12,12,10,12,12,12,10,10,10,10, 9,10,11, 10,10,12,10,10,12,11,10,11,10,10,12,11,10,12,10, 10,11, 9,11,10, 9,10, 9,10, }; static float _vq_quantthresh__8c0_s_p9_2[] = { -9.5, -8.5, -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, 9.5, }; static long _vq_quantmap__8c0_s_p9_2[] = { 19, 17, 15, 13, 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, }; static encode_aux_threshmatch _vq_auxt__8c0_s_p9_2 = { _vq_quantthresh__8c0_s_p9_2, _vq_quantmap__8c0_s_p9_2, 21, 21 }; static static_codebook _8c0_s_p9_2 = { 2, 441, _vq_lengthlist__8c0_s_p9_2, 1, -529268736, 1611661312, 5, 0, _vq_quantlist__8c0_s_p9_2, NULL, &_vq_auxt__8c0_s_p9_2, NULL, 0 }; static long _huff_lengthlist__8c0_s_single[] = { 4, 5,18, 7,10, 6, 7, 8, 9,10, 5, 2,18, 5, 7, 5, 6, 7, 8,11,17,17,17,17,17,17,17,17,17,17, 7, 4, 17, 6, 9, 6, 8,10,12,15,11, 7,17, 9, 6, 6, 7, 9, 11,15, 6, 4,17, 6, 6, 4, 5, 8,11,16, 6, 6,17, 8, 6, 5, 6, 9,13,16, 8, 9,17,11, 9, 8, 8,11,13,17, 9,12,17,15,14,13,12,13,14,17,12,15,17,17,17,17, 17,16,17,17, }; static static_codebook _huff_book__8c0_s_single = { 2, 100, _huff_lengthlist__8c0_s_single, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _vq_quantlist__8c1_s_p1_0[] = { 1, 0, 2, }; static long _vq_lengthlist__8c1_s_p1_0[] = { 1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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; static float _vq_quantthresh__8c1_s_p1_0[] = { -0.5, 0.5, }; static long _vq_quantmap__8c1_s_p1_0[] = { 1, 0, 2, }; static encode_aux_threshmatch _vq_auxt__8c1_s_p1_0 = { _vq_quantthresh__8c1_s_p1_0, _vq_quantmap__8c1_s_p1_0, 3, 3 }; static static_codebook _8c1_s_p1_0 = { 8, 6561, _vq_lengthlist__8c1_s_p1_0, 1, -535822336, 1611661312, 2, 0, _vq_quantlist__8c1_s_p1_0, NULL, &_vq_auxt__8c1_s_p1_0, NULL, 0 }; static long _vq_quantlist__8c1_s_p2_0[] = { 2, 1, 3, 0, 4, }; static long _vq_lengthlist__8c1_s_p2_0[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; static float _vq_quantthresh__8c1_s_p2_0[] = { -1.5, -0.5, 0.5, 1.5, }; static long _vq_quantmap__8c1_s_p2_0[] = { 3, 1, 0, 2, 4, }; static encode_aux_threshmatch _vq_auxt__8c1_s_p2_0 = { _vq_quantthresh__8c1_s_p2_0, _vq_quantmap__8c1_s_p2_0, 5, 5 }; static static_codebook _8c1_s_p2_0 = { 4, 625, _vq_lengthlist__8c1_s_p2_0, 1, -533725184, 1611661312, 3, 0, _vq_quantlist__8c1_s_p2_0, NULL, &_vq_auxt__8c1_s_p2_0, NULL, 0 }; static long _vq_quantlist__8c1_s_p3_0[] = { 2, 1, 3, 0, 4, }; static long _vq_lengthlist__8c1_s_p3_0[] = { 2, 4, 4, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 6, 6, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; static float _vq_quantthresh__8c1_s_p3_0[] = { -1.5, -0.5, 0.5, 1.5, }; static long _vq_quantmap__8c1_s_p3_0[] = { 3, 1, 0, 2, 4, }; static encode_aux_threshmatch _vq_auxt__8c1_s_p3_0 = { _vq_quantthresh__8c1_s_p3_0, _vq_quantmap__8c1_s_p3_0, 5, 5 }; static static_codebook _8c1_s_p3_0 = { 4, 625, _vq_lengthlist__8c1_s_p3_0, 1, -533725184, 1611661312, 3, 0, _vq_quantlist__8c1_s_p3_0, NULL, &_vq_auxt__8c1_s_p3_0, NULL, 0 }; static long _vq_quantlist__8c1_s_p4_0[] = { 4, 3, 5, 2, 6, 1, 7, 0, 8, }; static long _vq_lengthlist__8c1_s_p4_0[] = { 1, 2, 3, 7, 7, 0, 0, 0, 0, 0, 0, 0, 6, 6, 0, 0, 0, 0, 0, 0, 0, 6, 6, 0, 0, 0, 0, 0, 0, 0, 7, 7, 0, 0, 0, 0, 0, 0, 0, 7, 7, 0, 0, 0, 0, 0, 0, 0, 8, 8, 0, 0, 0, 0, 0, 0, 0, 9, 8, 0, 0, 0, 0, 0, 0, 0,10,10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; static float _vq_quantthresh__8c1_s_p4_0[] = { -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, }; static long _vq_quantmap__8c1_s_p4_0[] = { 7, 5, 3, 1, 0, 2, 4, 6, 8, }; static encode_aux_threshmatch _vq_auxt__8c1_s_p4_0 = { _vq_quantthresh__8c1_s_p4_0, _vq_quantmap__8c1_s_p4_0, 9, 9 }; static static_codebook _8c1_s_p4_0 = { 2, 81, _vq_lengthlist__8c1_s_p4_0, 1, -531628032, 1611661312, 4, 0, _vq_quantlist__8c1_s_p4_0, NULL, &_vq_auxt__8c1_s_p4_0, NULL, 0 }; static long _vq_quantlist__8c1_s_p5_0[] = { 4, 3, 5, 2, 6, 1, 7, 0, 8, }; static long _vq_lengthlist__8c1_s_p5_0[] = { 1, 3, 3, 4, 5, 6, 6, 8, 8, 0, 0, 0, 8, 8, 7, 7, 9, 9, 0, 0, 0, 8, 8, 7, 7, 9, 9, 0, 0, 0, 9,10, 8, 8, 9, 9, 0, 0, 0,10,10, 8, 8, 9, 9, 0, 0, 0, 11,10, 8, 8,10,10, 0, 0, 0,11,11, 8, 8,10,10, 0, 0, 0,12,12, 9, 9,10,10, 0, 0, 0, 0, 0, 9, 9,10, 10, }; static float _vq_quantthresh__8c1_s_p5_0[] = { -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, }; static long _vq_quantmap__8c1_s_p5_0[] = { 7, 5, 3, 1, 0, 2, 4, 6, 8, }; static encode_aux_threshmatch _vq_auxt__8c1_s_p5_0 = { _vq_quantthresh__8c1_s_p5_0, _vq_quantmap__8c1_s_p5_0, 9, 9 }; static static_codebook _8c1_s_p5_0 = { 2, 81, _vq_lengthlist__8c1_s_p5_0, 1, -531628032, 1611661312, 4, 0, _vq_quantlist__8c1_s_p5_0, NULL, &_vq_auxt__8c1_s_p5_0, NULL, 0 }; static long _vq_quantlist__8c1_s_p6_0[] = { 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15, 0, 16, }; static long _vq_lengthlist__8c1_s_p6_0[] = { 1, 3, 3, 5, 5, 8, 8, 8, 8, 9, 9,10,10,11,11,11, 11, 0, 0, 0, 8, 8, 8, 8, 9, 9, 9, 9,10,10,11,11, 12,12, 0, 0, 0, 8, 8, 8, 8, 9, 9, 9, 9,10,10,11, 11,12,12, 0, 0, 0, 9, 9, 8, 8,10,10,10,10,11,11, 12,12,12,12, 0, 0, 0, 9, 9, 8, 8,10,10,10,10,11, 11,12,12,12,12, 0, 0, 0,10,10, 9, 9,10,10,10,10, 11,11,12,12,13,13, 0, 0, 0,10,10, 9, 9,10,10,10, 10,11,11,12,12,13,13, 0, 0, 0,11,11, 9, 9,10,10, 10,10,11,11,12,12,13,13, 0, 0, 0, 0, 0, 9, 9,10, 10,10,10,11,11,12,12,13,13, 0, 0, 0, 0, 0, 9, 9, 10,10,11,11,12,12,12,12,13,13, 0, 0, 0, 0, 0, 9, 9,10,10,11,11,12,11,12,12,13,13, 0, 0, 0, 0, 0, 10,10,11,11,11,11,12,12,13,12,13,13, 0, 0, 0, 0, 0, 0, 0,11,10,11,11,12,12,13,13,13,13, 0, 0, 0, 0, 0, 0, 0,11,11,12,12,12,12,13,13,13,14, 0, 0, 0, 0, 0, 0, 0,11,11,12,12,12,12,13,13,14,13, 0, 0, 0, 0, 0, 0, 0,12,12,12,12,13,13,13,13,14,14, 0, 0, 0, 0, 0, 0, 0, 0, 0,12,12,13,13,13,13,14, 14, }; static float _vq_quantthresh__8c1_s_p6_0[] = { -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, }; static long _vq_quantmap__8c1_s_p6_0[] = { 15, 13, 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, 14, 16, }; static encode_aux_threshmatch _vq_auxt__8c1_s_p6_0 = { _vq_quantthresh__8c1_s_p6_0, _vq_quantmap__8c1_s_p6_0, 17, 17 }; static static_codebook _8c1_s_p6_0 = { 2, 289, _vq_lengthlist__8c1_s_p6_0, 1, -529530880, 1611661312, 5, 0, _vq_quantlist__8c1_s_p6_0, NULL, &_vq_auxt__8c1_s_p6_0, NULL, 0 }; static long _vq_quantlist__8c1_s_p7_0[] = { 1, 0, 2, }; static long _vq_lengthlist__8c1_s_p7_0[] = { 1, 4, 4, 6, 6, 6, 7, 6, 6, 4, 7, 7,10, 9, 9,10, 9, 9, 5, 7, 7,10, 9, 9,10, 9, 9, 6,10,10,10,10, 10,11,10,10, 6, 9, 9,10, 9,10,11,10,10, 6, 9, 9, 10, 9, 9,11, 9,10, 7,10,10,11,11,11,11,10,10, 6, 9, 9,10,10,10,11, 9, 9, 6, 9, 9,10,10,10,10, 9, 9, }; static float _vq_quantthresh__8c1_s_p7_0[] = { -5.5, 5.5, }; static long _vq_quantmap__8c1_s_p7_0[] = { 1, 0, 2, }; static encode_aux_threshmatch _vq_auxt__8c1_s_p7_0 = { _vq_quantthresh__8c1_s_p7_0, _vq_quantmap__8c1_s_p7_0, 3, 3 }; static static_codebook _8c1_s_p7_0 = { 4, 81, _vq_lengthlist__8c1_s_p7_0, 1, -529137664, 1618345984, 2, 0, _vq_quantlist__8c1_s_p7_0, NULL, &_vq_auxt__8c1_s_p7_0, NULL, 0 }; static long _vq_quantlist__8c1_s_p7_1[] = { 5, 4, 6, 3, 7, 2, 8, 1, 9, 0, 10, }; static long _vq_lengthlist__8c1_s_p7_1[] = { 2, 3, 3, 5, 5, 7, 7, 7, 7, 7, 7,10,10, 9, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 7, 7, 7, 7, 8, 8, 8, 8,10,10,10, 7, 7, 7, 7, 8, 8, 8, 8,10,10,10, 7, 7, 7, 7, 8, 8, 8, 8,10,10,10, 8, 8, 8, 8, 8, 8, 8, 8,10,10,10, 8, 8, 8, 8, 8, 8, 8, 8,10,10,10, 8, 8, 8, 8, 8, 8, 8, 8,10,10,10,10,10, 8, 8, 8, 8, 8, 8,10,10,10,10,10, 8, 8, 8, 8, 8, 8,10,10, 10,10,10, 8, 8, 8, 8, 8, 8, }; static float _vq_quantthresh__8c1_s_p7_1[] = { -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, }; static long _vq_quantmap__8c1_s_p7_1[] = { 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, }; static encode_aux_threshmatch _vq_auxt__8c1_s_p7_1 = { _vq_quantthresh__8c1_s_p7_1, _vq_quantmap__8c1_s_p7_1, 11, 11 }; static static_codebook _8c1_s_p7_1 = { 2, 121, _vq_lengthlist__8c1_s_p7_1, 1, -531365888, 1611661312, 4, 0, _vq_quantlist__8c1_s_p7_1, NULL, &_vq_auxt__8c1_s_p7_1, NULL, 0 }; static long _vq_quantlist__8c1_s_p8_0[] = { 6, 5, 7, 4, 8, 3, 9, 2, 10, 1, 11, 0, 12, }; static long _vq_lengthlist__8c1_s_p8_0[] = { 1, 4, 4, 6, 6, 8, 8, 8, 8, 9, 9,10,10, 7, 5, 5, 7, 7, 8, 8, 8, 8, 9,10,11,11, 7, 5, 5, 7, 7, 8, 8, 9, 9,10,10,11,11, 0, 8, 8, 8, 8, 9, 9, 9, 9, 9,10,11,11, 0, 8, 8, 8, 8, 9, 9, 9, 9,10,10,11, 11, 0,12,12, 9, 9, 9, 9,10, 9,10,11,11,11, 0,13, 12, 9, 8, 9, 9,10,10,11,11,12,11, 0, 0, 0, 9, 9, 9, 9,10,10,11,11,12,12, 0, 0, 0,10,10, 9, 9,10, 10,11,11,12,12, 0, 0, 0,13,13,10,10,11,11,12,11, 13,12, 0, 0, 0,14,14,10,10,11,10,11,11,12,12, 0, 0, 0, 0, 0,12,12,11,11,12,12,13,13, 0, 0, 0, 0, 0,12,12,11,10,12,11,13,12, }; static float _vq_quantthresh__8c1_s_p8_0[] = { -27.5, -22.5, -17.5, -12.5, -7.5, -2.5, 2.5, 7.5, 12.5, 17.5, 22.5, 27.5, }; static long _vq_quantmap__8c1_s_p8_0[] = { 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, }; static encode_aux_threshmatch _vq_auxt__8c1_s_p8_0 = { _vq_quantthresh__8c1_s_p8_0, _vq_quantmap__8c1_s_p8_0, 13, 13 }; static static_codebook _8c1_s_p8_0 = { 2, 169, _vq_lengthlist__8c1_s_p8_0, 1, -526516224, 1616117760, 4, 0, _vq_quantlist__8c1_s_p8_0, NULL, &_vq_auxt__8c1_s_p8_0, NULL, 0 }; static long _vq_quantlist__8c1_s_p8_1[] = { 2, 1, 3, 0, 4, }; static long _vq_lengthlist__8c1_s_p8_1[] = { 2, 3, 3, 5, 5, 6, 6, 6, 5, 5, 6, 6, 6, 5, 5, 6, 6, 6, 5, 5, 6, 6, 6, 5, 5, }; static float _vq_quantthresh__8c1_s_p8_1[] = { -1.5, -0.5, 0.5, 1.5, }; static long _vq_quantmap__8c1_s_p8_1[] = { 3, 1, 0, 2, 4, }; static encode_aux_threshmatch _vq_auxt__8c1_s_p8_1 = { _vq_quantthresh__8c1_s_p8_1, _vq_quantmap__8c1_s_p8_1, 5, 5 }; static static_codebook _8c1_s_p8_1 = { 2, 25, _vq_lengthlist__8c1_s_p8_1, 1, -533725184, 1611661312, 3, 0, _vq_quantlist__8c1_s_p8_1, NULL, &_vq_auxt__8c1_s_p8_1, NULL, 0 }; static long _vq_quantlist__8c1_s_p9_0[] = { 6, 5, 7, 4, 8, 3, 9, 2, 10, 1, 11, 0, 12, }; static long _vq_lengthlist__8c1_s_p9_0[] = { 1, 3, 3,10,10,10,10,10,10,10,10,10,10, 5, 6, 6, 10,10,10,10,10,10,10,10,10,10, 6, 7, 8,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10, 9, 9, 9, 9, }; static float _vq_quantthresh__8c1_s_p9_0[] = { -1732.5, -1417.5, -1102.5, -787.5, -472.5, -157.5, 157.5, 472.5, 787.5, 1102.5, 1417.5, 1732.5, }; static long _vq_quantmap__8c1_s_p9_0[] = { 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, }; static encode_aux_threshmatch _vq_auxt__8c1_s_p9_0 = { _vq_quantthresh__8c1_s_p9_0, _vq_quantmap__8c1_s_p9_0, 13, 13 }; static static_codebook _8c1_s_p9_0 = { 2, 169, _vq_lengthlist__8c1_s_p9_0, 1, -513964032, 1628680192, 4, 0, _vq_quantlist__8c1_s_p9_0, NULL, &_vq_auxt__8c1_s_p9_0, NULL, 0 }; static long _vq_quantlist__8c1_s_p9_1[] = { 7, 6, 8, 5, 9, 4, 10, 3, 11, 2, 12, 1, 13, 0, 14, }; static long _vq_lengthlist__8c1_s_p9_1[] = { 1, 4, 4, 5, 5, 7, 7, 9, 9,11,11,12,12,13,13, 6, 5, 5, 6, 6, 9, 9,10,10,12,12,12,13,15,14, 6, 5, 5, 7, 7, 9, 9,10,10,12,12,12,13,14,13,17, 7, 7, 8, 8,10,10,11,11,12,13,13,13,13,13,17, 7, 7, 8, 8,10,10,11,11,13,13,13,13,14,14,17,11,11, 9, 9, 11,11,12,12,12,13,13,14,15,13,17,12,12, 9, 9,11, 11,12,12,13,13,13,13,14,16,17,17,17,11,12,12,12, 13,13,13,14,15,14,15,15,17,17,17,12,12,11,11,13, 13,14,14,15,14,15,15,17,17,17,15,15,13,13,14,14, 15,14,15,15,16,15,17,17,17,15,15,13,13,13,14,14, 15,15,15,15,16,17,17,17,17,16,14,15,14,14,15,14, 14,15,15,15,17,17,17,17,17,14,14,16,14,15,15,15, 15,15,15,17,17,17,17,17,17,16,16,15,17,15,15,14, 17,15,17,16,17,17,17,17,16,15,14,15,15,15,15,15, 15, }; static float _vq_quantthresh__8c1_s_p9_1[] = { -136.5, -115.5, -94.5, -73.5, -52.5, -31.5, -10.5, 10.5, 31.5, 52.5, 73.5, 94.5, 115.5, 136.5, }; static long _vq_quantmap__8c1_s_p9_1[] = { 13, 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, 14, }; static encode_aux_threshmatch _vq_auxt__8c1_s_p9_1 = { _vq_quantthresh__8c1_s_p9_1, _vq_quantmap__8c1_s_p9_1, 15, 15 }; static static_codebook _8c1_s_p9_1 = { 2, 225, _vq_lengthlist__8c1_s_p9_1, 1, -520986624, 1620377600, 4, 0, _vq_quantlist__8c1_s_p9_1, NULL, &_vq_auxt__8c1_s_p9_1, NULL, 0 }; static long _vq_quantlist__8c1_s_p9_2[] = { 10, 9, 11, 8, 12, 7, 13, 6, 14, 5, 15, 4, 16, 3, 17, 2, 18, 1, 19, 0, 20, }; static long _vq_lengthlist__8c1_s_p9_2[] = { 2, 4, 4, 6, 6, 7, 7, 8, 8, 8, 8, 9, 8, 9, 9, 9, 9, 9, 9, 9, 9,11,11,12, 7, 7, 7, 7, 8, 8, 9, 9, 9, 9,10,10,10,10,10,10,10,10,11,11,11, 7, 7, 7, 7, 8, 8, 9, 8, 9, 9, 9, 9, 9, 9,10,10,10,10,11, 11,12, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9,10,10,10,10, 10,10,10,10,11,11,11, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9,10,10,10,10,10,10,10,10,11,11,11, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9,10,10,10,10,10,10,10,10,11,11, 11, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9,10,10,10,10,10, 10,10,10,11,12,11, 9, 9, 8, 9, 9, 9, 9, 9,10,10, 10,10,10,10,10,10,10,10,11,11,11,11,11, 8, 8, 9, 9, 9, 9,10,10,10,10,10,10,10,10,10,10,11,12,11, 12,11, 9, 9, 9, 9, 9,10,10,10,10,10,10,10,10,10, 10,10,11,11,11,11,11, 9, 9, 9, 9,10,10,10,10,10, 10,10,10,10,10,10,10,12,11,12,11,11, 9, 9, 9,10, 10,10,10,10,10,10,10,10,10,10,10,10,12,11,11,11, 11,11,11,10,10,10,10,10,10,10,10,10,10,10,10,10, 11,11,11,12,11,11,12,11,10,10,10,10,10,10,10,10, 10,10,10,10,11,10,11,11,11,11,11,11,11,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,11,11,12,11,12, 11,11,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 11,11,12,11,12,11,11,11,11,10,10,10,10,10,10,10, 10,10,10,10,10,11,11,12,11,11,12,11,11,12,10,10, 11,10,10,10,10,10,10,10,10,10,11,11,11,11,11,11, 11,11,11,10,10,10,10,10,10,10,10,10,10,10,10,12, 12,11,12,11,11,12,12,12,11,11,10,10,10,10,10,10, 10,10,10,11,12,12,11,12,12,11,12,11,11,11,11,10, 10,10,10,10,10,10,10,10,10, }; static float _vq_quantthresh__8c1_s_p9_2[] = { -9.5, -8.5, -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, 9.5, }; static long _vq_quantmap__8c1_s_p9_2[] = { 19, 17, 15, 13, 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, }; static encode_aux_threshmatch _vq_auxt__8c1_s_p9_2 = { _vq_quantthresh__8c1_s_p9_2, _vq_quantmap__8c1_s_p9_2, 21, 21 }; static static_codebook _8c1_s_p9_2 = { 2, 441, _vq_lengthlist__8c1_s_p9_2, 1, -529268736, 1611661312, 5, 0, _vq_quantlist__8c1_s_p9_2, NULL, &_vq_auxt__8c1_s_p9_2, NULL, 0 }; static long _huff_lengthlist__8c1_s_single[] = { 4, 6,18, 8,11, 8, 8, 9, 9,10, 4, 4,18, 5, 9, 5, 6, 7, 8,10,18,18,18,18,17,17,17,17,17,17, 7, 5, 17, 6,11, 6, 7, 8, 9,12,12, 9,17,12, 8, 8, 9,10, 10,13, 7, 5,17, 6, 8, 4, 5, 6, 8,10, 6, 5,17, 6, 8, 5, 4, 5, 7, 9, 7, 7,17, 8, 9, 6, 5, 5, 6, 8, 8, 8,17, 9,11, 8, 6, 6, 6, 7, 9,10,17,12,12,10, 9, 7, 7, 8, }; static static_codebook _huff_book__8c1_s_single = { 2, 100, _huff_lengthlist__8c1_s_single, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; libtritonus-java-20070428/src/lib/pvorbis/books/floor/0000755000175000017500000000000010621572573022504 5ustar twernertwernerlibtritonus-java-20070428/src/lib/pvorbis/books/floor/floor_books.h0000644000175000017500000010231310167052702025163 0ustar twernertwerner/******************************************************************** * * * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 * * by the Xiph.Org Foundation http://www.xiph.org/ * * * ******************************************************************** function: static codebooks autogenerated by huff/huffbuld last modified: $Id: floor_books.h,v 1.1 2005/01/05 21:01:54 pfisterer Exp $ ********************************************************************/ #include "codebook.h" static long _huff_lengthlist_line_1024x27_0sub0[] = { 5, 5, 5, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6, 5, 7, 5, 7, 5, 7, 5, 8, 5, 8, 6, 8, 6, 9, 6, 9, 6, 9, 6,10, 6,10, 6,11, 6,11, 6, 11, 6,12, 6,12, 7,12, 7,12, 7,12, 7,12, 7,12, 7, 12, 7,12, 7,12, 7,12, 7,12, 8,12, 8,11, 8,11, 8, 12, 9,11, 9, 9,10,11, 9,12, 9,12,12,14,13,13,14, 13,13,13,12,14,16,20,20,21,14,14,15,21,21,21,20, 21,21,21,21,21,21,21,21,21,21,20,20,20,20,20,20, }; static static_codebook _huff_book_line_1024x27_0sub0 = { 1, 128, _huff_lengthlist_line_1024x27_0sub0, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _huff_lengthlist_line_1024x27_1sub0[] = { 2, 5, 5, 4, 5, 4, 5, 4, 5, 4, 6, 4, 6, 5, 6, 5, 7, 5, 7, 6, 8, 6, 8, 6, 8, 6, 9, 6,10, 6,10, 6, }; static static_codebook _huff_book_line_1024x27_1sub0 = { 1, 32, _huff_lengthlist_line_1024x27_1sub0, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _huff_lengthlist_line_1024x27_1sub1[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 5,10, 4,10, 4, 9, 4, 9, 3, 9, 4, 9, 4, 9, 4, 9, 4, 9, 4, 9, 4, 8, 4, 8, 4, 8, 5, 9, 5, 9, 6, 8, 6, 9, 7,10, 8,10, 9,10,10,10,12,11,13,12,13, 13,15,13,14,13,14,12,15,13,15,14,15,13,16,14,16, 14,15,14,14,14,16,15,18,15,18,16,18,18,18,18,18, 18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,17, }; static static_codebook _huff_book_line_1024x27_1sub1 = { 1, 128, _huff_lengthlist_line_1024x27_1sub1, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _huff_lengthlist_line_1024x27_2sub0[] = { 1, 5, 5, 5, 5, 5, 5, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6, 6, 7, 6, 7, 7, 8, 8, 9, 8, 9, 9, 9, 9,10,10, }; static static_codebook _huff_book_line_1024x27_2sub0 = { 1, 32, _huff_lengthlist_line_1024x27_2sub0, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _huff_lengthlist_line_1024x27_2sub1[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 4, 3, 4, 4, 5, 4, 5, 5, 5, 5, 6, 5, 6, 6, 7, 6, 7, 7, 7, 7, 7, 7, 8, 9, 8, 9, 8,10, 8,11, 8,12, 9,13, 9,14, 9,14, 8,12, 8,14, 9,14, 8,12, 8,11, 8,11, 8,11, 9,11,10,11,10,12,10,12,11,12, 12,12,12,12,11,12,11,13,11,13,12,14,14,14,14,14, 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,13, }; static static_codebook _huff_book_line_1024x27_2sub1 = { 1, 128, _huff_lengthlist_line_1024x27_2sub1, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _huff_lengthlist_line_1024x27_3sub1[] = { 0, 4, 5, 4, 5, 3, 5, 3, 5, 3, 5, 4, 4, 4, 5, 4, 5, 5, }; static static_codebook _huff_book_line_1024x27_3sub1 = { 1, 18, _huff_lengthlist_line_1024x27_3sub1, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _huff_lengthlist_line_1024x27_3sub2[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 4, 4, 4, 5, 4, 6, 5, 6, 5, 7, 5, 9, 5,10, 6,11, 6,12, 7,13, 8,15, 8,15, 9,15, 9,15, }; static static_codebook _huff_book_line_1024x27_3sub2 = { 1, 50, _huff_lengthlist_line_1024x27_3sub2, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _huff_lengthlist_line_1024x27_3sub3[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 9, 2, 9, 2, 9, 4, 9, 6, 9, 7, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, }; static static_codebook _huff_book_line_1024x27_3sub3 = { 1, 128, _huff_lengthlist_line_1024x27_3sub3, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _huff_lengthlist_line_1024x27_4sub1[] = { 0, 4, 5, 4, 5, 4, 6, 3, 6, 3, 5, 3, 5, 3, 6, 4, 6, 4, }; static static_codebook _huff_book_line_1024x27_4sub1 = { 1, 18, _huff_lengthlist_line_1024x27_4sub1, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _huff_lengthlist_line_1024x27_4sub2[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 2, 4, 2, 5, 3, 5, 4, 6, 6, 6, 6, 7, 7, 7, 8, 8, 8, 8, 8, 9, 8, 9, 9, 9, 9, 9,10,10,11, 10,11, }; static static_codebook _huff_book_line_1024x27_4sub2 = { 1, 50, _huff_lengthlist_line_1024x27_4sub2, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _huff_lengthlist_line_1024x27_4sub3[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 6, 4, 6, 4, 5, 5, 7, 4, 8, 5, 9, 4, 9, 5, 9, 5, 9, 6, 9, 5, 9, 7, 9, 7, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, }; static static_codebook _huff_book_line_1024x27_4sub3 = { 1, 128, _huff_lengthlist_line_1024x27_4sub3, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _huff_lengthlist_line_1024x27_class1[] = { 2, 9, 8,14, 7,13,11,14, 1, 5, 3, 7, 4,10, 7,12, }; static static_codebook _huff_book_line_1024x27_class1 = { 1, 16, _huff_lengthlist_line_1024x27_class1, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _huff_lengthlist_line_1024x27_class2[] = { 1, 3, 2, 5, 4, 7, 6, 7, }; static static_codebook _huff_book_line_1024x27_class2 = { 1, 8, _huff_lengthlist_line_1024x27_class2, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _huff_lengthlist_line_1024x27_class3[] = { 1, 5, 6,19, 5, 8,10,19, 9,10,15,19,19,19,19,19, 4, 7, 9,19, 6, 7,10,19,11,11,15,19,19,19,19,19, 8,11,13,19, 8,11,14,19,13,13,17,19,19,19,19,19, 19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19, 3, 7, 9,19, 6, 8,11,19,11,11,15,19,19,19,19,19, 5, 7,11,19, 6, 7,11,19,11,10,14,19,19,19,19,19, 8,11,15,19, 8,10,14,19,13,13,16,19,19,19,19,19, 19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19, 6, 9,11,19, 8,10,12,19,15,14,17,19,19,19,19,19, 5, 8,11,19, 7, 9,12,19,14,11,16,19,19,19,19,19, 9,10,18,19, 9,10,15,19,14,16,19,19,19,19,19,19, 19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19, 16,17,19,19,16,17,17,19,19,19,19,19,19,19,19,19, 12,14,16,19,12,12,16,19,19,19,19,19,19,19,19,19, 18,18,19,19,17,16,19,19,19,19,19,19,19,19,19,19, 19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,18, }; static static_codebook _huff_book_line_1024x27_class3 = { 1, 256, _huff_lengthlist_line_1024x27_class3, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _huff_lengthlist_line_1024x27_class4[] = { 1, 4, 8,12, 4, 6, 8,21, 9, 8,10,21,20,16,18,20, 2, 6, 8,20, 7, 6, 9,19,11, 9,10,20,17,15,16,20, 5, 8,11,19, 8, 8,10,15,12,10,12,15,20,20,15,20, 17,20,20,20,15,20,20,19,20,20,16,19,20,20,20,20, }; static static_codebook _huff_book_line_1024x27_class4 = { 1, 64, _huff_lengthlist_line_1024x27_class4, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _huff_lengthlist_line_128x11_0sub0[] = { 5, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6, 6, 6, 6, 6, 6, 6, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 8, 7, 8, 7, 8, 7, 8, 7, 9, 7, 9, 7, 9, 8,10, 8, 10, 8,10, 8,10, 8,10, 9,11, 9,11, 9,10, 9,10,10, 11,10,11,11,11,11,12,12,13,14,13,14,16,16,16,16, 16,16,15,16,16,16,16,16,16,16,16,16,16,16,16,16, 16,16,16,16,16,16,16,16,16,16,16,16,16,15,15,15, }; static static_codebook _huff_book_line_128x11_0sub0 = { 1, 128, _huff_lengthlist_line_128x11_0sub0, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _huff_lengthlist_line_128x11_1sub0[] = { 2, 5, 5, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 5, 6, 5, 6, 5, 7, 6, 7, 6, 7, 6, 8, 6, 8, 6, }; static static_codebook _huff_book_line_128x11_1sub0 = { 1, 32, _huff_lengthlist_line_128x11_1sub0, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _huff_lengthlist_line_128x11_1sub1[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 3, 6, 3, 7, 3, 7, 4, 8, 4, 8, 4, 8, 4, 9, 4, 10, 5, 9, 5,10, 5,10, 5,10, 5,12, 6,12, 6,10, 6, 10, 7,10, 8,10, 8,10, 9,11, 9,12,11,10,11,11,13, 12,12,12,13,10,13,10,13,10,13,10,13,11,13,10,13, 10,13,10,13,10,13,10,13,11,12,13,13,13,13,13,13, 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, }; static static_codebook _huff_book_line_128x11_1sub1 = { 1, 128, _huff_lengthlist_line_128x11_1sub1, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _huff_lengthlist_line_128x11_2sub1[] = { 0, 4, 5, 4, 5, 4, 5, 3, 4, 3, 4, 4, 4, 4, 4, 5, 5, 5, }; static static_codebook _huff_book_line_128x11_2sub1 = { 1, 18, _huff_lengthlist_line_128x11_2sub1, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _huff_lengthlist_line_128x11_2sub2[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 3, 4, 3, 5, 4, 5, 5, 6, 5, 6, 6, 6, 6, 8, 6,10, 7,10, 8,10, 8,10,10,10,10,10,10,10, 10,10, }; static static_codebook _huff_book_line_128x11_2sub2 = { 1, 50, _huff_lengthlist_line_128x11_2sub2, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _huff_lengthlist_line_128x11_2sub3[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, }; static static_codebook _huff_book_line_128x11_2sub3 = { 1, 128, _huff_lengthlist_line_128x11_2sub3, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _huff_lengthlist_line_128x11_3sub1[] = { 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 4, 5, 4, }; static static_codebook _huff_book_line_128x11_3sub1 = { 1, 18, _huff_lengthlist_line_128x11_3sub1, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _huff_lengthlist_line_128x11_3sub2[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 3, 5, 3, 6, 4, 7, 4, 7, 4, 7, 4, 8, 4, 8, 4, 9, 4, 9, 4, 9, 5,10, 5,11, 5,12, 6,13, 6, 13, 7, }; static static_codebook _huff_book_line_128x11_3sub2 = { 1, 50, _huff_lengthlist_line_128x11_3sub2, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _huff_lengthlist_line_128x11_3sub3[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 2, 6, 2, 7, 3, 8, 4, 7, 6, 9, 7, 9, 7, 9, 9, 9, 8, 9, 8, 9, 9, 9, 9, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, }; static static_codebook _huff_book_line_128x11_3sub3 = { 1, 128, _huff_lengthlist_line_128x11_3sub3, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _huff_lengthlist_line_128x11_class1[] = { 1, 6, 3, 7, 2, 5, 4, 7, }; static static_codebook _huff_book_line_128x11_class1 = { 1, 8, _huff_lengthlist_line_128x11_class1, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _huff_lengthlist_line_128x11_class2[] = { 1, 5,11,14, 4,11,13,14,10,14,13,14,14,14,13,13, 2, 6,11,13, 5,11,12,13,11,12,13,13,13,13,13,13, 4, 8,12,13, 5, 9,11,13,12,13,13,13,13,13,13,13, 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, }; static static_codebook _huff_book_line_128x11_class2 = { 1, 64, _huff_lengthlist_line_128x11_class2, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _huff_lengthlist_line_128x11_class3[] = { 6, 7,11,16, 6, 7,10,16,11, 9,13,15,15,15,15,15, 4, 4, 7,14, 4, 4, 6,14, 8, 6, 8,15,15,15,15,15, 4, 4, 6,15, 3, 2, 4,13, 6, 5, 6,14,15,12,11,14, 11,11,13,15, 9, 8,10,15,11,10,11,15,15,15,15,15, }; static static_codebook _huff_book_line_128x11_class3 = { 1, 64, _huff_lengthlist_line_128x11_class3, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _huff_lengthlist_line_128x17_0sub0[] = { 5, 5, 5, 5, 5, 5, 5, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6, 5, 7, 5, 7, 5, 7, 6, 7, 6, 7, 6, 8, 6, 8, 6, 8, 6, 8, 6, 8, 6, 8, 7, 9, 7, 9, 7, 9, 7, 9, 7, 9, 7, 9, 7,10, 7,10, 8,10, 8, 11, 8,11, 8,11, 8,12, 8,12, 8,12, 8,12, 9,12, 9, 12, 9,12, 9,13, 9,13,10,13,10,13,11,14,12,14,13, 14,14,16,15,17,17,19,18,19,19,19,19,19,19,19,19, 19,19,19,19,19,19,19,19,19,19,19,18,18,18,18,18, }; static static_codebook _huff_book_line_128x17_0sub0 = { 1, 128, _huff_lengthlist_line_128x17_0sub0, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _huff_lengthlist_line_128x17_1sub0[] = { 2, 5, 5, 4, 5, 4, 5, 4, 5, 4, 5, 5, 5, 5, 6, 5, 6, 5, 6, 6, 7, 6, 7, 6, 8, 6, 8, 7, 9, 7, 9, 8, }; static static_codebook _huff_book_line_128x17_1sub0 = { 1, 32, _huff_lengthlist_line_128x17_1sub0, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _huff_lengthlist_line_128x17_1sub1[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 2, 5, 3, 5, 3, 6, 4, 6, 4, 7, 4, 8, 5, 8, 5, 8, 6, 9, 6, 9, 7, 9, 8,10, 8,10, 9,10,10,10,10, 10,12,10,14,11,15,12,15,11,15,11,15,11,14,11,15, 11,14,11,13,10,12,10,14,10,14,11,13,10,12,11,15, 12,15,13,15,12,13,14,15,15,15,15,15,15,15,15,15, 15,15,15,15,15,15,15,15,15,15,15,15,15,14,14,14, }; static static_codebook _huff_book_line_128x17_1sub1 = { 1, 128, _huff_lengthlist_line_128x17_1sub1, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _huff_lengthlist_line_128x17_2sub1[] = { 0, 4, 5, 4, 7, 3, 8, 3, 9, 3,10, 2,12, 3,12, 4, 11, 6, }; static static_codebook _huff_book_line_128x17_2sub1 = { 1, 18, _huff_lengthlist_line_128x17_2sub1, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _huff_lengthlist_line_128x17_2sub2[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 1, 8, 2, 9, 3, 9, 7, 9, 7, 9, 7, 8, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, }; static static_codebook _huff_book_line_128x17_2sub2 = { 1, 50, _huff_lengthlist_line_128x17_2sub2, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _huff_lengthlist_line_128x17_2sub3[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, }; static static_codebook _huff_book_line_128x17_2sub3 = { 1, 128, _huff_lengthlist_line_128x17_2sub3, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _huff_lengthlist_line_128x17_3sub1[] = { 0, 4, 4, 4, 5, 4, 5, 3, 5, 3, 5, 3, 5, 4, 6, 4, 6, 4, }; static static_codebook _huff_book_line_128x17_3sub1 = { 1, 18, _huff_lengthlist_line_128x17_3sub1, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _huff_lengthlist_line_128x17_3sub2[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 3, 6, 3, 6, 3, 7, 4, 8, 4, 8, 4, 9, 4, 9, 4,10, 4,10, 5,11, 5,11, 5,12, 5,12, 6,12, 6, 12, 7, }; static static_codebook _huff_book_line_128x17_3sub2 = { 1, 50, _huff_lengthlist_line_128x17_3sub2, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _huff_lengthlist_line_128x17_3sub3[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 1, 7, 3, 6, 3, 6, 4, 6, 5, 6, 8, 7,10, 7,11, 7,11, 8,11, 9,11, 7,11, 8,11, 8,11,10,11, 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, }; static static_codebook _huff_book_line_128x17_3sub3 = { 1, 128, _huff_lengthlist_line_128x17_3sub3, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _huff_lengthlist_line_128x17_class1[] = { 1, 3, 4, 7, 2, 6, 5, 7, }; static static_codebook _huff_book_line_128x17_class1 = { 1, 8, _huff_lengthlist_line_128x17_class1, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _huff_lengthlist_line_128x17_class2[] = { 1, 2, 7,14, 4, 9,13,14, 8,14,14,14,14,14,14,14, 3, 5,10,14, 8,14,14,14,11,14,14,14,14,14,14,14, 7,10,14,14,12,14,14,14,14,14,14,14,14,14,14,14, 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,13, }; static static_codebook _huff_book_line_128x17_class2 = { 1, 64, _huff_lengthlist_line_128x17_class2, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _huff_lengthlist_line_128x17_class3[] = { 2, 6,11,19, 5, 9,12,19,10,11,13,19,19,19,19,19, 2, 5, 8,19, 4, 6, 8,19, 8, 8, 9,19,19,16,19,19, 3, 6, 8,19, 3, 5, 7,18, 8, 8, 9,16,16,11,16,19, 14,14,14,19,10,10,11,19,16,12,14,19,19,19,19,19, }; static static_codebook _huff_book_line_128x17_class3 = { 1, 64, _huff_lengthlist_line_128x17_class3, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _huff_lengthlist_line_128x4_0sub0[] = { 2, 2, 2, 2, }; static static_codebook _huff_book_line_128x4_0sub0 = { 1, 4, _huff_lengthlist_line_128x4_0sub0, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _huff_lengthlist_line_128x4_0sub1[] = { 0, 0, 0, 0, 3, 2, 3, 2, 3, 3, }; static static_codebook _huff_book_line_128x4_0sub1 = { 1, 10, _huff_lengthlist_line_128x4_0sub1, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _huff_lengthlist_line_128x4_0sub2[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 3, 4, 4, 4, 4, 4, 3, 4, 4, 5, 3, 6, 4, 6, }; static static_codebook _huff_book_line_128x4_0sub2 = { 1, 25, _huff_lengthlist_line_128x4_0sub2, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _huff_lengthlist_line_128x4_0sub3[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 5, 2, 6, 3, 6, 3, 7, 4, 7, 5, 7, 5, 7, 6, 8, 8, 9,10,10,16,10,16, 10,14,10,14,11,15,15,15,15,15,15,15,15,15,15,15, }; static static_codebook _huff_book_line_128x4_0sub3 = { 1, 64, _huff_lengthlist_line_128x4_0sub3, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _huff_lengthlist_line_128x4_class0[] = { 8, 8, 8,14, 7, 7, 8,13, 7, 6, 7,11,11,11,10,13, 9, 9,10,16, 8, 8, 9,12, 7, 7, 7,11,11,11,10,12, 11,11,11,14,10,10,10,14, 9, 8, 9,12,13,14,12,14, 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, 8, 7, 8,11, 7, 7, 7,11, 6, 6, 6,10,10,10,10,14, 8, 8, 8,12, 7, 7, 8,11, 6, 7, 7,10,10,10,10,13, 10,10,10,12,10, 9, 9,12, 9, 9, 9,12,12,13,12,14, 16,16,16,16,16,14,16,16,14,14,16,16,16,16,16,16, 7, 6, 5, 7, 6, 6, 5, 6, 6, 5, 5, 5, 9,10, 9,10, 8, 7, 6, 7, 7, 6, 5, 6, 6, 6, 5, 6,10,10, 9, 9, 10, 9, 7, 8, 9, 8, 7, 7, 8, 7, 6, 7,11,11,10, 9, 16,13,14,16,14,14,13,15,16,14,12,13,16,16,14,16, 9, 8, 7, 8, 8, 8, 7, 8, 8, 7, 6, 7,10,10, 9,12, 9, 9, 8, 8, 9, 8, 7, 8, 8, 8, 6, 7,10,10, 9,12, 11,10, 9,10,10, 9, 7, 9, 9, 8, 6, 9,12,11,10,13, 12,16,16,16,12,13,12,16,15,12,11,14,16,16,16,16, }; static static_codebook _huff_book_line_128x4_class0 = { 1, 256, _huff_lengthlist_line_128x4_class0, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _huff_lengthlist_line_128x7_0sub1[] = { 0, 3, 3, 3, 3, 3, 3, 3, 3, }; static static_codebook _huff_book_line_128x7_0sub1 = { 1, 9, _huff_lengthlist_line_128x7_0sub1, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _huff_lengthlist_line_128x7_0sub2[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 4, 3, 4, 4, 4, 5, 4, 5, 4, 5, 4, 6, 4, 6, }; static static_codebook _huff_book_line_128x7_0sub2 = { 1, 25, _huff_lengthlist_line_128x7_0sub2, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _huff_lengthlist_line_128x7_0sub3[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 5, 3, 5, 3, 6, 4, 6, 4, 6, 4, 6, 5, 6, 5, 6, 5, 6, 5, 6, 5, 5, 5, 6, 7, 8,10,12,12,12,12,12,12,12,12,12,12,12,12, }; static static_codebook _huff_book_line_128x7_0sub3 = { 1, 64, _huff_lengthlist_line_128x7_0sub3, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _huff_lengthlist_line_128x7_1sub1[] = { 0, 3, 3, 3, 3, 2, 4, 3, 4, }; static static_codebook _huff_book_line_128x7_1sub1 = { 1, 9, _huff_lengthlist_line_128x7_1sub1, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _huff_lengthlist_line_128x7_1sub2[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 5, 3, 6, 3, 7, 3, 8, 3, 9, 3,10, 3,11, 4,11, }; static static_codebook _huff_book_line_128x7_1sub2 = { 1, 25, _huff_lengthlist_line_128x7_1sub2, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _huff_lengthlist_line_128x7_1sub3[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,12, 2, 9, 3,10, 4, 12, 5,12, 6,12,10,12,11,12,12,12,12,12,12,12,11, 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, }; static static_codebook _huff_book_line_128x7_1sub3 = { 1, 64, _huff_lengthlist_line_128x7_1sub3, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _huff_lengthlist_line_128x7_class0[] = { 10, 7, 8,14,10, 7, 7,12,11, 8, 8,13,16,16,16,16, 8, 5, 5,10, 7, 4, 4, 8, 8, 5, 5, 9,16,16,16,16, 7, 4, 5, 7, 6, 3, 3, 6, 8, 5, 5, 7,16,14,13,16, 9, 7, 7,10, 7, 4, 4, 7, 9, 6, 5, 6,15,13,11,14, }; static static_codebook _huff_book_line_128x7_class0 = { 1, 64, _huff_lengthlist_line_128x7_class0, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _huff_lengthlist_line_128x7_class1[] = { 8,12,16,16,10,14,16,16,12,15,16,16,16,16,16,16, 7,11,15,16, 7,11,16,16,10,12,16,16,16,16,16,16, 9,15,16,16, 9,12,16,16,11,15,16,16,16,16,16,16, 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, 6,10,13,16, 7,10,15,16, 9,11,16,16,16,16,16,16, 4, 8,13,16, 5, 8,15,16, 7, 9,15,16,16,16,16,16, 6,12,16,16, 6,10,15,16, 9,10,14,16,16,16,16,16, 14,16,16,16,12,14,16,16,15,16,16,16,16,16,16,16, 4, 9,11,16, 5, 9,13,16, 7, 9,15,16,16,16,16,16, 2, 7,11,16, 3, 6,11,16, 5, 7,12,16,16,16,16,16, 4, 9,14,16, 4, 7,13,16, 6, 8,13,16,16,16,16,16, 11,14,16,16,10,16,14,16,11,16,16,16,16,16,16,16, 7,13,16,16, 9,13,15,16,11,13,16,16,16,16,16,16, 5,10,14,16, 6,10,15,16, 9,10,16,16,16,16,16,16, 7,13,16,16, 6,10,16,16, 9,12,16,16,16,16,16,16, 11,16,16,16,10,16,16,16,13,16,16,16,16,16,16,16, }; static static_codebook _huff_book_line_128x7_class1 = { 1, 256, _huff_lengthlist_line_128x7_class1, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _huff_lengthlist_line_256x4_0sub0[] = { 1, 3, 2, 3, }; static static_codebook _huff_book_line_256x4_0sub0 = { 1, 4, _huff_lengthlist_line_256x4_0sub0, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _huff_lengthlist_line_256x4_0sub1[] = { 0, 0, 0, 0, 2, 2, 3, 3, 3, 3, }; static static_codebook _huff_book_line_256x4_0sub1 = { 1, 10, _huff_lengthlist_line_256x4_0sub1, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _huff_lengthlist_line_256x4_0sub2[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 4, 3, 4, 4, 4, 5, 4, 5, 5, 6, 4, 6, }; static static_codebook _huff_book_line_256x4_0sub2 = { 1, 25, _huff_lengthlist_line_256x4_0sub2, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _huff_lengthlist_line_256x4_0sub3[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 4, 3, 4, 3, 4, 4, 5, 4, 5, 5, 6, 5, 7, 6, 8, 7, 9, 8, 9, 9,10,12, 15,15,15,15,15,15,15,15,14,14,14,14,14,14,14,14, }; static static_codebook _huff_book_line_256x4_0sub3 = { 1, 64, _huff_lengthlist_line_256x4_0sub3, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _huff_lengthlist_line_256x4_class0[] = { 4, 5, 6,11, 5, 5, 6,10, 7, 6, 5, 6,14,13,10,10, 6, 6, 6,10, 6, 6, 6,10, 7, 7, 7, 9, 9,10, 9,12, 9, 8, 8,11, 8, 8, 8,10, 8, 8, 9,11, 8, 9, 9,13, 18,18,18,18,16,17,18,18,12,13,14,18,14,14,10,12, 5, 5, 6,12, 6, 5, 6,10, 7, 7, 6, 7,13,12, 9,12, 6, 6, 6,11, 6, 6, 6, 9, 7, 7, 7,10,10,10, 9,12, 9, 8, 8,12, 8, 8, 7,11, 8, 8, 8,11, 9, 9, 8,10, 18,18,17,18,18,18,15,18,16,14,12,18,14,12,10,11, 8, 7, 7,12, 8, 7, 7,10, 8, 7, 6, 6,11,10, 9,10, 8, 8, 7,11, 8, 7, 7, 9, 8, 8, 7, 9,10,10, 9, 9, 10, 9, 8,12, 9, 9, 8,11,10, 9, 8, 9, 8, 8, 7, 9, 18,18,18,18,18,18,18,18,17,16,14,18,13,12,11,13, 12,12,13,16,11,10,10,16,12,12, 9, 7,15,12,11,11, 14,14,14,14,12,11,11,18,14,12,10,11,18,13,11,13, 18,18,18,17,17,16,15,17,18,15,16,18,16,12,11,11, 18,18,18,18,18,18,18,18,18,18,17,18,18,13,12,15, }; static static_codebook _huff_book_line_256x4_class0 = { 1, 256, _huff_lengthlist_line_256x4_class0, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _huff_lengthlist_line_256x7_0sub1[] = { 0, 2, 3, 3, 3, 3, 4, 3, 4, }; static static_codebook _huff_book_line_256x7_0sub1 = { 1, 9, _huff_lengthlist_line_256x7_0sub1, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _huff_lengthlist_line_256x7_0sub2[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 4, 3, 4, 3, 5, 3, 6, 3, 6, 4, 6, 4, 7, 5, 7, }; static static_codebook _huff_book_line_256x7_0sub2 = { 1, 25, _huff_lengthlist_line_256x7_0sub2, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _huff_lengthlist_line_256x7_0sub3[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 5, 2, 5, 3, 5, 3, 6, 3, 6, 4, 7, 6, 7, 8, 7, 9, 8, 9, 9, 9,10, 9, 11,13,11,13,10,10,13,13,13,13,13,13,12,12,12,12, }; static static_codebook _huff_book_line_256x7_0sub3 = { 1, 64, _huff_lengthlist_line_256x7_0sub3, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _huff_lengthlist_line_256x7_1sub1[] = { 0, 3, 3, 3, 3, 2, 4, 3, 4, }; static static_codebook _huff_book_line_256x7_1sub1 = { 1, 9, _huff_lengthlist_line_256x7_1sub1, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _huff_lengthlist_line_256x7_1sub2[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 3, 4, 3, 4, 4, 5, 4, 6, 5, 6, 7, 6, 8, 8, }; static static_codebook _huff_book_line_256x7_1sub2 = { 1, 25, _huff_lengthlist_line_256x7_1sub2, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _huff_lengthlist_line_256x7_1sub3[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 2, 4, 3, 6, 3, 7, 3, 8, 5, 8, 6, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 7, }; static static_codebook _huff_book_line_256x7_1sub3 = { 1, 64, _huff_lengthlist_line_256x7_1sub3, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _huff_lengthlist_line_256x7_class0[] = { 7, 5, 5, 9, 9, 6, 6, 9,12, 8, 7, 8,11, 8, 9,15, 6, 3, 3, 7, 7, 4, 3, 6, 9, 6, 5, 6, 8, 6, 8,15, 8, 5, 5, 9, 8, 5, 4, 6,10, 7, 5, 5,11, 8, 7,15, 14,15,13,13,13,13, 8,11,15,10, 7, 6,11, 9,10,15, }; static static_codebook _huff_book_line_256x7_class0 = { 1, 64, _huff_lengthlist_line_256x7_class0, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _huff_lengthlist_line_256x7_class1[] = { 5, 6, 8,15, 6, 9,10,15,10,11,12,15,15,15,15,15, 4, 6, 7,15, 6, 7, 8,15, 9, 8, 9,15,15,15,15,15, 6, 8, 9,15, 7, 7, 8,15,10, 9,10,15,15,15,15,15, 15,13,15,15,15,10,11,15,15,13,13,15,15,15,15,15, 4, 6, 7,15, 6, 8, 9,15,10,10,12,15,15,15,15,15, 2, 5, 6,15, 5, 6, 7,15, 8, 6, 7,15,15,15,15,15, 5, 6, 8,15, 5, 6, 7,15, 9, 6, 7,15,15,15,15,15, 14,12,13,15,12,10,11,15,15,15,15,15,15,15,15,15, 7, 8, 9,15, 9,10,10,15,15,14,14,15,15,15,15,15, 5, 6, 7,15, 7, 8, 9,15,12, 9,10,15,15,15,15,15, 7, 7, 9,15, 7, 7, 8,15,12, 8, 9,15,15,15,15,15, 13,13,14,15,12,11,12,15,15,15,15,15,15,15,15,15, 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, 13,13,13,15,15,15,15,15,15,15,15,15,15,15,15,15, 15,12,13,15,15,12,13,15,15,14,15,15,15,15,15,15, 15,15,15,15,15,15,13,15,15,15,15,15,15,15,15,15, }; static static_codebook _huff_book_line_256x7_class1 = { 1, 256, _huff_lengthlist_line_256x7_class1, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _huff_lengthlist_line_512x17_0sub0[] = { 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 5, 6, 6, 6, 6, 5, 6, 6, 7, 6, 7, 6, 7, 6, 7, 6, 8, 7, 8, 7, 8, 7, 8, 7, 8, 7, 9, 7, 9, 7, 9, 7, 9, 8, 9, 8,10, 8,10, 8,10, 7,10, 6,10, 8, 10, 8,11, 7,10, 7,11, 8,11,11,12,12,11,11,12,11, 13,11,13,11,13,12,15,12,13,13,14,14,14,14,14,15, 15,15,16,14,17,19,19,18,18,18,18,18,18,18,18,18, 18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18, }; static static_codebook _huff_book_line_512x17_0sub0 = { 1, 128, _huff_lengthlist_line_512x17_0sub0, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _huff_lengthlist_line_512x17_1sub0[] = { 2, 4, 5, 4, 5, 4, 5, 4, 5, 5, 5, 5, 5, 5, 6, 5, 6, 5, 6, 6, 7, 6, 7, 6, 8, 7, 8, 7, 8, 7, 8, 7, }; static static_codebook _huff_book_line_512x17_1sub0 = { 1, 32, _huff_lengthlist_line_512x17_1sub0, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _huff_lengthlist_line_512x17_1sub1[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 3, 5, 3, 5, 4, 5, 4, 5, 4, 5, 5, 5, 5, 6, 5, 6, 5, 7, 5, 8, 6, 8, 6, 8, 6, 8, 6, 8, 7, 9, 7, 9, 7,11, 9,11,11,12,11,14,12,14,16,14,16,13,16, 14,16,12,15,13,16,14,16,13,14,12,15,13,15,13,13, 13,15,12,14,14,15,13,15,12,15,15,15,15,15,15,15, 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, }; static static_codebook _huff_book_line_512x17_1sub1 = { 1, 128, _huff_lengthlist_line_512x17_1sub1, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _huff_lengthlist_line_512x17_2sub1[] = { 0, 4, 5, 4, 4, 4, 5, 4, 4, 4, 5, 4, 5, 4, 5, 3, 5, 3, }; static static_codebook _huff_book_line_512x17_2sub1 = { 1, 18, _huff_lengthlist_line_512x17_2sub1, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _huff_lengthlist_line_512x17_2sub2[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 3, 4, 3, 4, 4, 5, 4, 5, 4, 6, 4, 6, 5, 6, 5, 7, 5, 7, 6, 8, 6, 8, 6, 8, 7, 8, 7, 9, 7, 9, 8, }; static static_codebook _huff_book_line_512x17_2sub2 = { 1, 50, _huff_lengthlist_line_512x17_2sub2, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _huff_lengthlist_line_512x17_2sub3[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 4, 3, 4, 4, 5, 5, 6, 6, 7, 7, 7, 8, 8,11, 8, 9, 9, 9,10,11,11,11, 9,10,10,11, 11,11,11,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, }; static static_codebook _huff_book_line_512x17_2sub3 = { 1, 128, _huff_lengthlist_line_512x17_2sub3, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _huff_lengthlist_line_512x17_3sub1[] = { 0, 4, 4, 4, 4, 4, 4, 3, 4, 4, 4, 4, 4, 5, 4, 5, 5, 5, }; static static_codebook _huff_book_line_512x17_3sub1 = { 1, 18, _huff_lengthlist_line_512x17_3sub1, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _huff_lengthlist_line_512x17_3sub2[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 3, 4, 3, 5, 4, 6, 4, 6, 5, 7, 6, 7, 6, 8, 6, 8, 7, 9, 8,10, 8,12, 9,13,10,15,10,15, 11,14, }; static static_codebook _huff_book_line_512x17_3sub2 = { 1, 50, _huff_lengthlist_line_512x17_3sub2, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _huff_lengthlist_line_512x17_3sub3[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 8, 4, 8, 4, 8, 4, 8, 5, 8, 5, 8, 6, 8, 4, 8, 4, 8, 5, 8, 5, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, }; static static_codebook _huff_book_line_512x17_3sub3 = { 1, 128, _huff_lengthlist_line_512x17_3sub3, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _huff_lengthlist_line_512x17_class1[] = { 1, 2, 3, 6, 5, 4, 7, 7, }; static static_codebook _huff_book_line_512x17_class1 = { 1, 8, _huff_lengthlist_line_512x17_class1, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _huff_lengthlist_line_512x17_class2[] = { 3, 3, 3,14, 5, 4, 4,11, 8, 6, 6,10,17,12,11,17, 6, 5, 5,15, 5, 3, 4,11, 8, 5, 5, 8,16, 9,10,14, 10, 8, 9,17, 8, 6, 6,13,10, 7, 7,10,16,11,13,14, 17,17,17,17,17,16,16,16,16,15,16,16,16,16,16,16, }; static static_codebook _huff_book_line_512x17_class2 = { 1, 64, _huff_lengthlist_line_512x17_class2, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _huff_lengthlist_line_512x17_class3[] = { 2, 4, 6,17, 4, 5, 7,17, 8, 7,10,17,17,17,17,17, 3, 4, 6,15, 3, 3, 6,15, 7, 6, 9,17,17,17,17,17, 6, 8,10,17, 6, 6, 8,16, 9, 8,10,17,17,15,16,17, 17,17,17,17,12,15,15,16,12,15,15,16,16,16,16,16, }; static static_codebook _huff_book_line_512x17_class3 = { 1, 64, _huff_lengthlist_line_512x17_class3, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; libtritonus-java-20070428/src/lib/pvorbis/books/uncoupled/0000755000175000017500000000000010621572573023361 5ustar twernertwernerlibtritonus-java-20070428/src/lib/pvorbis/books/uncoupled/res_books_uncoupled.h0000644000175000017500000075754410167052702027614 0ustar twernertwerner/******************************************************************** * * * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 * * by the Xiph.Org Foundation http://www.xiph.org/ * * * ******************************************************************** function: static codebooks autogenerated by huff/huffbuld last modified: $Id: res_books_uncoupled.h,v 1.1 2005/01/05 21:01:54 pfisterer Exp $ ********************************************************************/ #include "codebook.h" static long _vq_quantlist__16u0__p1_0[] = { 1, 0, 2, }; static long _vq_lengthlist__16u0__p1_0[] = { 1, 4, 4, 5, 7, 7, 5, 7, 8, 5, 8, 8, 8,10,10, 8, 10,11, 5, 8, 8, 8,10,10, 8,10,10, 4, 9, 9, 9,12, 11, 8,11,11, 8,12,11,10,12,14,10,13,13, 7,11,11, 10,14,12,11,14,14, 4, 9, 9, 8,11,11, 9,11,12, 7, 11,11,10,13,14,10,12,14, 8,11,12,10,14,14,10,13, 12, }; static float _vq_quantthresh__16u0__p1_0[] = { -0.5, 0.5, }; static long _vq_quantmap__16u0__p1_0[] = { 1, 0, 2, }; static encode_aux_threshmatch _vq_auxt__16u0__p1_0 = { _vq_quantthresh__16u0__p1_0, _vq_quantmap__16u0__p1_0, 3, 3 }; static static_codebook _16u0__p1_0 = { 4, 81, _vq_lengthlist__16u0__p1_0, 1, -535822336, 1611661312, 2, 0, _vq_quantlist__16u0__p1_0, NULL, &_vq_auxt__16u0__p1_0, NULL, 0 }; static long _vq_quantlist__16u0__p2_0[] = { 1, 0, 2, }; static long _vq_lengthlist__16u0__p2_0[] = { 2, 4, 4, 5, 6, 6, 5, 6, 6, 5, 7, 7, 7, 8, 9, 7, 8, 9, 5, 7, 7, 7, 9, 8, 7, 9, 7, 4, 7, 7, 7, 9, 9, 7, 8, 8, 6, 9, 8, 7, 8,11, 9,11,10, 6, 8, 9, 8,11, 8, 9,10,11, 4, 7, 7, 7, 8, 8, 7, 9, 9, 6, 9, 8, 9,11,10, 8, 8,11, 6, 8, 9, 9,10,11, 8,11, 8, }; static float _vq_quantthresh__16u0__p2_0[] = { -0.5, 0.5, }; static long _vq_quantmap__16u0__p2_0[] = { 1, 0, 2, }; static encode_aux_threshmatch _vq_auxt__16u0__p2_0 = { _vq_quantthresh__16u0__p2_0, _vq_quantmap__16u0__p2_0, 3, 3 }; static static_codebook _16u0__p2_0 = { 4, 81, _vq_lengthlist__16u0__p2_0, 1, -535822336, 1611661312, 2, 0, _vq_quantlist__16u0__p2_0, NULL, &_vq_auxt__16u0__p2_0, NULL, 0 }; static long _vq_quantlist__16u0__p3_0[] = { 2, 1, 3, 0, 4, }; static long _vq_lengthlist__16u0__p3_0[] = { 1, 5, 5, 7, 7, 6, 7, 7, 8, 8, 6, 7, 8, 8, 8, 8, 9, 9,11,11, 8, 9, 9,11,11, 6, 9, 8,10,10, 8,10, 10,11,11, 8,10,10,11,11,10,11,10,13,12, 9,11,10, 13,13, 6, 8, 9,10,10, 8,10,10,11,11, 8,10,10,11, 11, 9,10,11,13,12,10,10,11,12,12, 8,11,11,14,13, 10,12,11,15,13, 9,12,11,15,14,12,14,13,16,14,12, 13,13,17,14, 8,11,11,13,14, 9,11,12,14,15,10,11, 12,13,15,11,13,13,14,16,12,13,14,14,16, 5, 9, 9, 11,11, 9,11,11,12,12, 8,11,11,12,12,11,12,12,15, 14,10,12,12,15,15, 8,11,11,13,12,10,12,12,13,13, 10,12,12,14,13,12,12,13,14,15,11,13,13,17,16, 7, 11,11,13,13,10,12,12,14,13,10,12,12,13,14,12,13, 12,15,14,11,13,13,15,14, 9,12,12,16,15,11,13,13, 17,16,10,13,13,16,16,13,14,15,15,16,13,15,14,19, 17, 9,12,12,14,16,11,13,13,15,16,10,13,13,17,16, 13,14,13,17,15,12,15,15,16,17, 5, 9, 9,11,11, 8, 11,11,13,12, 9,11,11,12,12,10,12,12,14,15,11,12, 12,14,14, 7,11,10,13,12,10,12,12,14,13,10,11,12, 13,13,11,13,13,15,16,12,12,13,15,15, 7,11,11,13, 13,10,13,13,14,14,10,12,12,13,13,11,13,13,16,15, 12,13,13,15,14, 9,12,12,15,15,10,13,13,17,16,11, 12,13,15,15,12,15,14,18,18,13,14,14,16,17, 9,12, 12,15,16,10,13,13,15,16,11,13,13,15,16,13,15,15, 17,17,13,15,14,16,15, 7,11,11,15,16,10,13,12,16, 17,10,12,13,15,17,15,16,16,18,17,13,15,15,17,18, 8,12,12,16,16,11,13,14,17,18,11,13,13,18,16,15, 17,16,17,19,14,15,15,17,16, 8,12,12,16,15,11,14, 13,18,17,11,13,14,18,17,15,16,16,18,17,13,16,16, 18,18,11,15,14,18,17,13,14,15,18, 0,12,15,15, 0, 17,17,16,17,17,18,14,16,18,18, 0,11,14,14,17, 0, 12,15,14,17,19,12,15,14,18, 0,15,18,16, 0,17,14, 18,16,18, 0, 7,11,11,16,15,10,12,12,18,16,10,13, 13,16,15,13,15,14,17,17,14,16,16,19,18, 8,12,12, 16,16,11,13,13,18,16,11,13,14,17,16,14,15,15,19, 18,15,16,16, 0,19, 8,12,12,16,17,11,13,13,17,17, 11,14,13,17,17,13,15,15,17,19,15,17,17,19, 0,11, 14,15,19,17,12,15,16,18,18,12,14,15,19,17,14,16, 17, 0,18,16,16,19,17, 0,11,14,14,18,19,12,15,14, 17,17,13,16,14,17,16,14,17,16,18,18,15,18,15, 0, 18, }; static float _vq_quantthresh__16u0__p3_0[] = { -1.5, -0.5, 0.5, 1.5, }; static long _vq_quantmap__16u0__p3_0[] = { 3, 1, 0, 2, 4, }; static encode_aux_threshmatch _vq_auxt__16u0__p3_0 = { _vq_quantthresh__16u0__p3_0, _vq_quantmap__16u0__p3_0, 5, 5 }; static static_codebook _16u0__p3_0 = { 4, 625, _vq_lengthlist__16u0__p3_0, 1, -533725184, 1611661312, 3, 0, _vq_quantlist__16u0__p3_0, NULL, &_vq_auxt__16u0__p3_0, NULL, 0 }; static long _vq_quantlist__16u0__p4_0[] = { 2, 1, 3, 0, 4, }; static long _vq_lengthlist__16u0__p4_0[] = { 3, 5, 5, 8, 8, 6, 6, 6, 9, 9, 6, 6, 6, 9, 9, 9, 10, 9,11,11, 9, 9, 9,11,11, 6, 7, 7,10,10, 7, 7, 8,10,10, 7, 7, 8,10,10,10,10,10,11,12, 9,10,10, 11,12, 6, 7, 7,10,10, 7, 8, 7,10,10, 7, 8, 7,10, 10,10,11,10,12,11,10,10,10,13,10, 9,10,10,12,12, 10,11,10,14,12, 9,11,11,13,13,11,12,13,13,13,11, 12,12,15,13, 9,10,10,12,13, 9,11,10,12,13,10,10, 11,12,13,11,12,12,12,13,11,12,12,13,13, 5, 7, 7, 10,10, 7, 8, 8,10,10, 7, 8, 8,10,10,10,11,10,12, 13,10,10,11,12,12, 6, 8, 8,11,10, 7, 8, 9,10,12, 8, 9, 9,11,11,11,10,11,11,12,10,11,11,13,12, 7, 8, 8,10,11, 8, 9, 8,11,10, 8, 9, 9,11,11,10,12, 10,13,11,10,11,11,13,13,10,11,10,14,13,10,10,11, 13,13,10,12,11,14,13,12,11,13,12,13,13,12,13,14, 14,10,11,11,13,13,10,11,10,12,13,10,12,12,12,14, 12,12,12,14,12,12,13,12,17,15, 5, 7, 7,10,10, 7, 8, 8,10,10, 7, 8, 8,11,10,10,10,11,12,12,10,11, 11,12,13, 6, 8, 8,11,10, 8, 9, 9,11,11, 7, 8, 9, 10,11,11,11,11,12,12,10,10,11,12,13, 6, 8, 8,10, 11, 8, 9, 9,11,11, 7, 9, 7,11,10,10,12,12,13,13, 11,11,10,13,11, 9,11,10,14,13,11,11,11,15,13,10, 10,11,13,13,12,13,13,14,14,12,11,12,12,13,10,11, 11,12,13,10,11,12,13,13,10,11,10,13,12,12,12,13, 14, 0,12,13,11,13,11, 8,10,10,13,13,10,11,11,14, 13,10,11,11,13,12,13,14,14,14,15,12,12,12,15,14, 9,11,10,13,12,10,10,11,13,14,11,11,11,15,12,13, 12,14,15,16,13,13,13,14,13, 9,11,11,12,12,10,12, 11,13,13,10,11,11,13,14,13,13,13,15,15,13,13,14, 17,15,11,12,12,14,14,10,11,12,13,15,12,13,13, 0, 15,13,11,14,12,16,14,16,14, 0,15,11,12,12,14,16, 11,13,12,16,15,12,13,13,14,15,12,14,12,15,13,15, 14,14,16,16, 8,10,10,13,13,10,11,10,13,14,10,11, 11,13,13,13,13,12,14,14,14,13,13,16,17, 9,10,10, 12,14,10,12,11,14,13,10,11,12,13,14,12,12,12,15, 15,13,13,13,14,14, 9,10,10,13,13,10,11,12,12,14, 10,11,10,13,13,13,13,13,14,16,13,13,13,14,14,11, 12,13,15,13,12,14,13,14,16,12,12,13,13,14,13,14, 14,17,15,13,12,17,13,16,11,12,13,14,15,12,13,14, 14,17,11,12,11,14,14,13,16,14,16, 0,14,15,11,15, 11, }; static float _vq_quantthresh__16u0__p4_0[] = { -1.5, -0.5, 0.5, 1.5, }; static long _vq_quantmap__16u0__p4_0[] = { 3, 1, 0, 2, 4, }; static encode_aux_threshmatch _vq_auxt__16u0__p4_0 = { _vq_quantthresh__16u0__p4_0, _vq_quantmap__16u0__p4_0, 5, 5 }; static static_codebook _16u0__p4_0 = { 4, 625, _vq_lengthlist__16u0__p4_0, 1, -533725184, 1611661312, 3, 0, _vq_quantlist__16u0__p4_0, NULL, &_vq_auxt__16u0__p4_0, NULL, 0 }; static long _vq_quantlist__16u0__p5_0[] = { 4, 3, 5, 2, 6, 1, 7, 0, 8, }; static long _vq_lengthlist__16u0__p5_0[] = { 1, 4, 4, 7, 7, 7, 7, 9, 9, 4, 6, 6, 8, 8, 8, 8, 9, 9, 4, 6, 6, 8, 8, 8, 8, 9, 9, 7, 8, 8, 9, 9, 9, 9,11,10, 7, 8, 8, 9, 9, 9, 9,10,11, 7, 8, 8, 9, 9,10,10,11,11, 7, 8, 8, 9, 9,10,10,11,11, 9, 9, 9,10,10,11,11,12,12, 9, 9, 9,10,10,11,11,12, 12, }; static float _vq_quantthresh__16u0__p5_0[] = { -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, }; static long _vq_quantmap__16u0__p5_0[] = { 7, 5, 3, 1, 0, 2, 4, 6, 8, }; static encode_aux_threshmatch _vq_auxt__16u0__p5_0 = { _vq_quantthresh__16u0__p5_0, _vq_quantmap__16u0__p5_0, 9, 9 }; static static_codebook _16u0__p5_0 = { 2, 81, _vq_lengthlist__16u0__p5_0, 1, -531628032, 1611661312, 4, 0, _vq_quantlist__16u0__p5_0, NULL, &_vq_auxt__16u0__p5_0, NULL, 0 }; static long _vq_quantlist__16u0__p6_0[] = { 6, 5, 7, 4, 8, 3, 9, 2, 10, 1, 11, 0, 12, }; static long _vq_lengthlist__16u0__p6_0[] = { 1, 4, 4, 7, 7,10,10,12,12,13,13,18,17, 3, 6, 6, 9, 9,11,11,13,13,14,14,18,17, 3, 6, 6, 9, 9,11, 11,13,13,14,14,17,18, 7, 9, 9,11,11,13,13,14,14, 15,15, 0, 0, 7, 9, 9,11,11,13,13,14,14,15,16,19, 18,10,11,11,13,13,14,14,16,15,17,18, 0, 0,10,11, 11,13,13,14,14,15,15,16,18, 0, 0,11,13,13,14,14, 15,15,17,17, 0,19, 0, 0,11,13,13,14,14,14,15,16, 18, 0,19, 0, 0,13,14,14,15,15,18,17,18,18, 0,19, 0, 0,13,14,14,15,16,16,16,18,18,19, 0, 0, 0,16, 17,17, 0,17,19,19, 0,19, 0, 0, 0, 0,16,19,16,17, 18, 0,19, 0, 0, 0, 0, 0, 0, }; static float _vq_quantthresh__16u0__p6_0[] = { -27.5, -22.5, -17.5, -12.5, -7.5, -2.5, 2.5, 7.5, 12.5, 17.5, 22.5, 27.5, }; static long _vq_quantmap__16u0__p6_0[] = { 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, }; static encode_aux_threshmatch _vq_auxt__16u0__p6_0 = { _vq_quantthresh__16u0__p6_0, _vq_quantmap__16u0__p6_0, 13, 13 }; static static_codebook _16u0__p6_0 = { 2, 169, _vq_lengthlist__16u0__p6_0, 1, -526516224, 1616117760, 4, 0, _vq_quantlist__16u0__p6_0, NULL, &_vq_auxt__16u0__p6_0, NULL, 0 }; static long _vq_quantlist__16u0__p6_1[] = { 2, 1, 3, 0, 4, }; static long _vq_lengthlist__16u0__p6_1[] = { 1, 4, 5, 6, 6, 4, 6, 6, 6, 6, 4, 6, 6, 6, 6, 6, 6, 6, 7, 7, 6, 6, 6, 7, 7, }; static float _vq_quantthresh__16u0__p6_1[] = { -1.5, -0.5, 0.5, 1.5, }; static long _vq_quantmap__16u0__p6_1[] = { 3, 1, 0, 2, 4, }; static encode_aux_threshmatch _vq_auxt__16u0__p6_1 = { _vq_quantthresh__16u0__p6_1, _vq_quantmap__16u0__p6_1, 5, 5 }; static static_codebook _16u0__p6_1 = { 2, 25, _vq_lengthlist__16u0__p6_1, 1, -533725184, 1611661312, 3, 0, _vq_quantlist__16u0__p6_1, NULL, &_vq_auxt__16u0__p6_1, NULL, 0 }; static long _vq_quantlist__16u0__p7_0[] = { 1, 0, 2, }; static long _vq_lengthlist__16u0__p7_0[] = { 1, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, }; static float _vq_quantthresh__16u0__p7_0[] = { -157.5, 157.5, }; static long _vq_quantmap__16u0__p7_0[] = { 1, 0, 2, }; static encode_aux_threshmatch _vq_auxt__16u0__p7_0 = { _vq_quantthresh__16u0__p7_0, _vq_quantmap__16u0__p7_0, 3, 3 }; static static_codebook _16u0__p7_0 = { 4, 81, _vq_lengthlist__16u0__p7_0, 1, -518803456, 1628680192, 2, 0, _vq_quantlist__16u0__p7_0, NULL, &_vq_auxt__16u0__p7_0, NULL, 0 }; static long _vq_quantlist__16u0__p7_1[] = { 7, 6, 8, 5, 9, 4, 10, 3, 11, 2, 12, 1, 13, 0, 14, }; static long _vq_lengthlist__16u0__p7_1[] = { 1, 5, 5, 6, 5, 9,10,11,11,10,10,10,10,10,10, 5, 8, 8, 8,10,10,10,10,10,10,10,10,10,10,10, 5, 8, 9, 9, 9,10,10,10,10,10,10,10,10,10,10, 5,10, 8, 10,10,10,10,10,10,10,10,10,10,10,10, 4, 8, 9,10, 10,10,10,10,10,10,10,10,10,10,10, 9,10,10,10,10, 10,10,10,10,10,10,10,10,10,10, 9,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10, }; static float _vq_quantthresh__16u0__p7_1[] = { -136.5, -115.5, -94.5, -73.5, -52.5, -31.5, -10.5, 10.5, 31.5, 52.5, 73.5, 94.5, 115.5, 136.5, }; static long _vq_quantmap__16u0__p7_1[] = { 13, 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, 14, }; static encode_aux_threshmatch _vq_auxt__16u0__p7_1 = { _vq_quantthresh__16u0__p7_1, _vq_quantmap__16u0__p7_1, 15, 15 }; static static_codebook _16u0__p7_1 = { 2, 225, _vq_lengthlist__16u0__p7_1, 1, -520986624, 1620377600, 4, 0, _vq_quantlist__16u0__p7_1, NULL, &_vq_auxt__16u0__p7_1, NULL, 0 }; static long _vq_quantlist__16u0__p7_2[] = { 10, 9, 11, 8, 12, 7, 13, 6, 14, 5, 15, 4, 16, 3, 17, 2, 18, 1, 19, 0, 20, }; static long _vq_lengthlist__16u0__p7_2[] = { 1, 6, 6, 7, 8, 7, 7,10, 9,10, 9,11,10, 9,11,10, 9, 9, 9, 9,10, 6, 8, 7, 9, 9, 8, 8,10,10, 9,11, 11,12,12,10, 9,11, 9,12,10, 9, 6, 9, 8, 9,12, 8, 8,11, 9,11,11,12,11,12,12,10,11,11,10,10,11, 7, 10, 9, 9, 9, 9, 9,10, 9,10, 9,10,10,12,10,10,10, 11,12,10,10, 7, 9, 9, 9,10, 9, 9,10,10, 9, 9, 9, 11,11,10,10,10,10, 9, 9,12, 7, 9,10, 9,11, 9,10, 9,10,11,11,11,10,11,12, 9,12,11,10,10,10, 7, 9, 9, 9, 9,10,12,10, 9,11,12,10,11,12,12,11, 9,10, 11,10,11, 7, 9,10,10,11,10, 9,10,11,11,11,10,12, 12,12,11,11,10,11,11,12, 8, 9,10,12,11,10,10,12, 12,12,12,12,10,11,11, 9,11,10,12,11,11, 8, 9,10, 10,11,12,11,11,10,10,10,12,12,12, 9,10,12,12,12, 12,12, 8,10,11,10,10,12, 9,11,12,12,11,12,12,12, 12,10,12,10,10,10,10, 8,12,11,11,11,10,10,11,12, 12,12,12,11,12,12,12,11,11,11,12,10, 9,10,10,12, 10,12,10,12,12,10,10,10,11,12,12,12,11,12,12,12, 11,10,11,12,12,12,11,12,12,11,12,12,11,12,12,12, 12,11,12,12,10,10,10,10,11,11,12,11,12,12,12,12, 12,12,12,11,12,11,10,11,11,12,11,11, 9,10,10,10, 12,10,10,11, 9,11,12,11,12,11,12,12,10,11,10,12, 9, 9, 9,12,11,10,11,10,12,10,12,10,12,12,12,11, 11,11,11,11,10, 9,10,10,11,10,11,11,12,11,10,11, 12,12,12,11,11, 9,12,10,12, 9,10,12,10,10,11,10, 11,11,12,11,10,11,10,11,11,11,11,12,11,11,10, 9, 10,10,10, 9,11,11,10, 9,12,10,11,12,11,12,12,11, 12,11,12,11,10,11,10,12,11,12,11,12,11,12,10,11, 10,10,12,11,10,11,11,11,10, }; static float _vq_quantthresh__16u0__p7_2[] = { -9.5, -8.5, -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, 9.5, }; static long _vq_quantmap__16u0__p7_2[] = { 19, 17, 15, 13, 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, }; static encode_aux_threshmatch _vq_auxt__16u0__p7_2 = { _vq_quantthresh__16u0__p7_2, _vq_quantmap__16u0__p7_2, 21, 21 }; static static_codebook _16u0__p7_2 = { 2, 441, _vq_lengthlist__16u0__p7_2, 1, -529268736, 1611661312, 5, 0, _vq_quantlist__16u0__p7_2, NULL, &_vq_auxt__16u0__p7_2, NULL, 0 }; static long _huff_lengthlist__16u0__single[] = { 3, 5, 8, 7,14, 8, 9,19, 5, 2, 5, 5, 9, 6, 9,19, 8, 4, 5, 7, 8, 9,13,19, 7, 4, 6, 5, 9, 6, 9,19, 12, 8, 7, 9,10,11,13,19, 8, 5, 8, 6, 9, 6, 7,19, 8, 8,10, 7, 7, 4, 5,19,12,17,19,15,18,13,11,18, }; static static_codebook _huff_book__16u0__single = { 2, 64, _huff_lengthlist__16u0__single, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _huff_lengthlist__16u1__long[] = { 3, 6,10, 8,12, 8,14, 8,14,19, 5, 3, 5, 5, 7, 6, 11, 7,16,19, 7, 5, 6, 7, 7, 9,11,12,19,19, 6, 4, 7, 5, 7, 6,10, 7,18,18, 8, 6, 7, 7, 7, 7, 8, 9, 18,18, 7, 5, 8, 5, 7, 5, 8, 6,18,18,12, 9,10, 9, 9, 9, 8, 9,18,18, 8, 7,10, 6, 8, 5, 6, 4,11,18, 11,15,16,12,11, 8, 8, 6, 9,18,14,18,18,18,16,16, 16,13,16,18, }; static static_codebook _huff_book__16u1__long = { 2, 100, _huff_lengthlist__16u1__long, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _vq_quantlist__16u1__p1_0[] = { 1, 0, 2, }; static long _vq_lengthlist__16u1__p1_0[] = { 1, 4, 4, 5, 7, 7, 5, 7, 7, 5, 8, 7, 7,10,10, 7, 9,10, 5, 7, 8, 7,10, 9, 7,10,10, 5, 8, 8, 8,10, 10, 8,10,10, 7,10,10,10,11,12,10,12,13, 7,10,10, 9,13,11,10,12,13, 5, 8, 8, 8,10,10, 8,10,10, 7, 10,10,10,12,12, 9,11,12, 7,10,11,10,12,12,10,13, 11, }; static float _vq_quantthresh__16u1__p1_0[] = { -0.5, 0.5, }; static long _vq_quantmap__16u1__p1_0[] = { 1, 0, 2, }; static encode_aux_threshmatch _vq_auxt__16u1__p1_0 = { _vq_quantthresh__16u1__p1_0, _vq_quantmap__16u1__p1_0, 3, 3 }; static static_codebook _16u1__p1_0 = { 4, 81, _vq_lengthlist__16u1__p1_0, 1, -535822336, 1611661312, 2, 0, _vq_quantlist__16u1__p1_0, NULL, &_vq_auxt__16u1__p1_0, NULL, 0 }; static long _vq_quantlist__16u1__p2_0[] = { 1, 0, 2, }; static long _vq_lengthlist__16u1__p2_0[] = { 3, 4, 4, 5, 6, 6, 5, 6, 6, 5, 6, 6, 6, 7, 8, 6, 7, 8, 5, 6, 6, 6, 8, 7, 6, 8, 7, 5, 6, 6, 6, 8, 8, 6, 8, 8, 6, 8, 8, 7, 7,10, 8, 9, 9, 6, 8, 8, 7, 9, 8, 8, 9,10, 5, 6, 6, 6, 8, 8, 7, 8, 8, 6, 8, 8, 8,10, 9, 7, 8, 9, 6, 8, 8, 8, 9, 9, 7,10, 8, }; static float _vq_quantthresh__16u1__p2_0[] = { -0.5, 0.5, }; static long _vq_quantmap__16u1__p2_0[] = { 1, 0, 2, }; static encode_aux_threshmatch _vq_auxt__16u1__p2_0 = { _vq_quantthresh__16u1__p2_0, _vq_quantmap__16u1__p2_0, 3, 3 }; static static_codebook _16u1__p2_0 = { 4, 81, _vq_lengthlist__16u1__p2_0, 1, -535822336, 1611661312, 2, 0, _vq_quantlist__16u1__p2_0, NULL, &_vq_auxt__16u1__p2_0, NULL, 0 }; static long _vq_quantlist__16u1__p3_0[] = { 2, 1, 3, 0, 4, }; static long _vq_lengthlist__16u1__p3_0[] = { 1, 5, 5, 8, 8, 6, 7, 7, 9, 9, 5, 7, 7, 9, 9, 9, 10, 9,11,11, 9, 9,10,11,11, 6, 8, 8,10,10, 8, 9, 10,11,11, 8, 9,10,11,11,10,11,11,12,13,10,11,11, 13,13, 6, 8, 8,10,10, 8,10, 9,11,11, 8,10, 9,11, 11,10,11,11,13,13,10,11,11,13,12, 9,11,11,14,13, 10,12,12,15,14,10,12,11,14,13,12,13,13,15,15,12, 13,13,16,14, 9,11,11,13,14,10,11,12,14,14,10,12, 12,14,15,12,13,13,14,15,12,13,14,15,16, 5, 8, 8, 11,11, 8,10,10,12,12, 8,10,10,12,12,11,12,12,14, 14,11,12,12,14,14, 8,10,10,12,12, 9,11,12,12,13, 10,12,12,13,13,12,12,13,14,15,11,13,13,15,15, 7, 10,10,12,12, 9,12,11,13,12,10,11,12,13,13,12,13, 12,15,14,11,12,13,15,15,10,12,12,15,14,11,13,13, 16,15,11,13,13,16,15,14,13,14,15,16,13,15,15,17, 17,10,12,12,14,15,11,12,12,15,15,11,13,13,15,16, 13,15,13,16,15,13,15,15,16,17, 5, 8, 8,11,11, 8, 10,10,12,12, 8,10,10,12,12,11,12,12,14,14,11,12, 12,14,14, 7,10,10,12,12,10,12,12,14,13, 9,11,12, 12,13,12,13,13,15,15,12,12,13,13,15, 7,10,10,12, 13,10,11,12,13,13,10,12,11,13,13,11,13,13,15,15, 12,13,12,15,14, 9,12,12,15,14,11,13,13,15,15,11, 12,13,15,15,13,14,14,17,19,13,13,14,16,16,10,12, 12,14,15,11,13,13,15,16,11,13,12,16,15,13,15,15, 17,18,14,15,13,16,15, 8,11,11,15,14,10,12,12,16, 15,10,12,12,16,16,14,15,15,18,17,13,14,15,16,18, 9,12,12,15,15,11,12,14,16,17,11,13,13,16,15,15, 15,15,17,18,14,15,16,17,17, 9,12,12,15,15,11,14, 13,16,16,11,13,13,16,16,15,16,15,17,18,14,16,15, 17,16,12,14,14,17,16,12,14,15,18,17,13,15,15,17, 17,15,15,18,16,20,15,16,17,18,18,11,14,14,16,17, 13,15,14,18,17,13,15,15,17,17,15,17,15,18,17,15, 17,16,19,18, 8,11,11,14,15,10,12,12,15,15,10,12, 12,16,16,13,14,14,17,16,14,15,15,17,17, 9,12,12, 15,16,11,13,13,16,16,11,12,13,16,16,14,16,15,20, 17,14,16,16,17,17, 9,12,12,15,16,11,13,13,16,17, 11,13,13,17,16,14,15,15,17,18,15,15,15,18,18,11, 14,14,17,16,13,15,15,17,17,13,14,14,18,17,15,16, 16,18,19,15,15,17,17,19,11,14,14,16,17,13,15,14, 17,19,13,15,14,18,17,15,17,16,18,18,15,17,15,18, 16, }; static float _vq_quantthresh__16u1__p3_0[] = { -1.5, -0.5, 0.5, 1.5, }; static long _vq_quantmap__16u1__p3_0[] = { 3, 1, 0, 2, 4, }; static encode_aux_threshmatch _vq_auxt__16u1__p3_0 = { _vq_quantthresh__16u1__p3_0, _vq_quantmap__16u1__p3_0, 5, 5 }; static static_codebook _16u1__p3_0 = { 4, 625, _vq_lengthlist__16u1__p3_0, 1, -533725184, 1611661312, 3, 0, _vq_quantlist__16u1__p3_0, NULL, &_vq_auxt__16u1__p3_0, NULL, 0 }; static long _vq_quantlist__16u1__p4_0[] = { 2, 1, 3, 0, 4, }; static long _vq_lengthlist__16u1__p4_0[] = { 4, 5, 5, 8, 8, 6, 6, 7, 9, 9, 6, 6, 6, 9, 9, 9, 10, 9,11,11, 9, 9,10,11,11, 6, 7, 7,10, 9, 7, 7, 8, 9,10, 7, 7, 8,10,10,10,10,10,10,12, 9, 9,10, 11,12, 6, 7, 7, 9, 9, 7, 8, 7,10,10, 7, 8, 7,10, 10, 9,10, 9,12,11,10,10, 9,12,10, 9,10,10,12,11, 10,10,10,12,12, 9,10,10,12,12,12,11,12,13,13,11, 11,12,12,13, 9,10,10,11,12, 9,10,10,12,12,10,10, 10,12,12,11,12,11,14,13,11,12,12,14,13, 5, 7, 7, 10,10, 7, 8, 8,10,10, 7, 8, 7,10,10,10,10,10,12, 12,10,10,10,12,12, 6, 8, 7,10,10, 7, 7, 9,10,11, 8, 9, 9,11,10,10,10,11,11,13,10,10,11,12,13, 6, 8, 8,10,10, 7, 9, 8,11,10, 8, 9, 9,10,11,10,11, 10,13,11,10,11,10,12,12,10,11,10,12,11,10,10,10, 12,13,10,11,11,13,12,11,11,13,11,14,12,12,13,14, 14, 9,10,10,12,13,10,11,10,13,12,10,11,11,12,13, 11,12,11,14,12,12,13,13,15,14, 5, 7, 7,10,10, 7, 7, 8,10,10, 7, 8, 8,10,10,10,10,10,11,12,10,10, 10,12,12, 7, 8, 8,10,10, 8, 9, 8,11,10, 7, 8, 9, 10,11,10,11,11,12,12,10,10,11,11,13, 7, 7, 8,10, 10, 8, 8, 9,10,11, 7, 9, 7,11,10,10,11,11,13,12, 11,11,10,13,11, 9,10,10,12,12,10,11,11,13,12,10, 10,11,12,12,12,13,13,14,14,11,11,12,12,14,10,10, 11,12,12,10,11,11,12,13,10,10,10,13,12,12,13,13, 15,14,12,13,10,14,11, 8,10,10,12,12,10,11,10,13, 13, 9,10,10,12,12,12,13,13,15,14,11,12,12,13,13, 9,10,10,13,12,10,10,11,13,13,10,11,10,13,12,12, 12,13,14,15,12,13,12,15,13, 9,10,10,12,13,10,11, 10,13,12,10,10,11,12,13,12,14,12,15,13,12,12,13, 14,15,11,12,11,14,13,11,11,12,14,15,12,13,12,15, 14,13,11,15,11,16,13,14,14,16,15,11,12,12,14,14, 11,12,11,14,13,12,12,13,14,15,13,14,12,16,12,14, 14,14,15,15, 8,10,10,12,12, 9,10,10,12,12,10,10, 11,13,13,11,12,12,13,13,12,13,13,14,15, 9,10,10, 13,12,10,11,11,13,12,10,10,11,13,13,12,13,12,15, 14,12,12,13,13,16, 9, 9,10,12,13,10,10,11,12,13, 10,11,10,13,13,12,12,13,13,15,13,13,12,15,13,11, 12,12,14,14,12,13,12,15,14,11,11,12,13,14,14,14, 14,16,15,13,12,15,12,16,11,11,12,13,14,12,13,13, 14,15,10,12,11,14,13,14,15,14,16,16,13,14,11,15, 11, }; static float _vq_quantthresh__16u1__p4_0[] = { -1.5, -0.5, 0.5, 1.5, }; static long _vq_quantmap__16u1__p4_0[] = { 3, 1, 0, 2, 4, }; static encode_aux_threshmatch _vq_auxt__16u1__p4_0 = { _vq_quantthresh__16u1__p4_0, _vq_quantmap__16u1__p4_0, 5, 5 }; static static_codebook _16u1__p4_0 = { 4, 625, _vq_lengthlist__16u1__p4_0, 1, -533725184, 1611661312, 3, 0, _vq_quantlist__16u1__p4_0, NULL, &_vq_auxt__16u1__p4_0, NULL, 0 }; static long _vq_quantlist__16u1__p5_0[] = { 4, 3, 5, 2, 6, 1, 7, 0, 8, }; static long _vq_lengthlist__16u1__p5_0[] = { 1, 4, 4, 7, 7, 7, 7, 9, 9, 4, 6, 6, 8, 8, 8, 8, 10,10, 4, 5, 6, 8, 8, 8, 8,10,10, 7, 8, 8, 9, 9, 9, 9,11,11, 7, 8, 8, 9, 9, 9, 9,11,11, 7, 8, 8, 10, 9,11,11,12,11, 7, 8, 8, 9, 9,11,11,12,12, 9, 10,10,11,11,12,12,13,12, 9,10,10,11,11,12,12,12, 13, }; static float _vq_quantthresh__16u1__p5_0[] = { -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, }; static long _vq_quantmap__16u1__p5_0[] = { 7, 5, 3, 1, 0, 2, 4, 6, 8, }; static encode_aux_threshmatch _vq_auxt__16u1__p5_0 = { _vq_quantthresh__16u1__p5_0, _vq_quantmap__16u1__p5_0, 9, 9 }; static static_codebook _16u1__p5_0 = { 2, 81, _vq_lengthlist__16u1__p5_0, 1, -531628032, 1611661312, 4, 0, _vq_quantlist__16u1__p5_0, NULL, &_vq_auxt__16u1__p5_0, NULL, 0 }; static long _vq_quantlist__16u1__p6_0[] = { 4, 3, 5, 2, 6, 1, 7, 0, 8, }; static long _vq_lengthlist__16u1__p6_0[] = { 3, 4, 4, 6, 6, 7, 7, 9, 9, 4, 4, 4, 6, 6, 8, 8, 9, 9, 4, 4, 4, 6, 6, 7, 7, 9, 9, 6, 6, 6, 7, 7, 8, 8,10, 9, 6, 6, 6, 7, 7, 8, 8, 9,10, 7, 8, 7, 8, 8, 9, 9,10,10, 7, 8, 8, 8, 8, 9, 9,10,10, 9, 9, 9,10,10,10,10,11,11, 9, 9, 9,10,10,10,10,11, 11, }; static float _vq_quantthresh__16u1__p6_0[] = { -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, }; static long _vq_quantmap__16u1__p6_0[] = { 7, 5, 3, 1, 0, 2, 4, 6, 8, }; static encode_aux_threshmatch _vq_auxt__16u1__p6_0 = { _vq_quantthresh__16u1__p6_0, _vq_quantmap__16u1__p6_0, 9, 9 }; static static_codebook _16u1__p6_0 = { 2, 81, _vq_lengthlist__16u1__p6_0, 1, -531628032, 1611661312, 4, 0, _vq_quantlist__16u1__p6_0, NULL, &_vq_auxt__16u1__p6_0, NULL, 0 }; static long _vq_quantlist__16u1__p7_0[] = { 1, 0, 2, }; static long _vq_lengthlist__16u1__p7_0[] = { 1, 4, 4, 4, 8, 8, 4, 8, 8, 5,11, 9, 8,12,11, 8, 12,11, 5,10,11, 8,11,12, 8,11,12, 4,11,11,11,14, 13,10,13,13, 8,14,13,12,14,16,12,16,15, 8,14,14, 13,16,14,12,15,16, 4,11,11,10,14,13,11,14,14, 8, 15,14,12,15,15,12,14,16, 8,14,14,11,16,15,12,15, 13, }; static float _vq_quantthresh__16u1__p7_0[] = { -5.5, 5.5, }; static long _vq_quantmap__16u1__p7_0[] = { 1, 0, 2, }; static encode_aux_threshmatch _vq_auxt__16u1__p7_0 = { _vq_quantthresh__16u1__p7_0, _vq_quantmap__16u1__p7_0, 3, 3 }; static static_codebook _16u1__p7_0 = { 4, 81, _vq_lengthlist__16u1__p7_0, 1, -529137664, 1618345984, 2, 0, _vq_quantlist__16u1__p7_0, NULL, &_vq_auxt__16u1__p7_0, NULL, 0 }; static long _vq_quantlist__16u1__p7_1[] = { 5, 4, 6, 3, 7, 2, 8, 1, 9, 0, 10, }; static long _vq_lengthlist__16u1__p7_1[] = { 2, 4, 4, 6, 6, 7, 7, 8, 8, 8, 8, 4, 6, 5, 7, 7, 8, 8, 8, 8, 8, 8, 4, 5, 6, 7, 7, 8, 8, 8, 8, 8, 8, 6, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 6, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 7, 8, 8, 8, 8, 9, 9, 9,10, 9,10, 7, 8, 8, 8, 8, 9, 9, 9, 9,10, 9, 8, 8, 8, 9, 9,10,10,10,10,10,10, 8, 8, 8, 9, 9, 9, 9,10, 10,10,10, 8, 8, 8, 9, 9, 9,10,10,10,10,10, 8, 8, 8, 9, 9,10,10,10,10,10,10, }; static float _vq_quantthresh__16u1__p7_1[] = { -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, }; static long _vq_quantmap__16u1__p7_1[] = { 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, }; static encode_aux_threshmatch _vq_auxt__16u1__p7_1 = { _vq_quantthresh__16u1__p7_1, _vq_quantmap__16u1__p7_1, 11, 11 }; static static_codebook _16u1__p7_1 = { 2, 121, _vq_lengthlist__16u1__p7_1, 1, -531365888, 1611661312, 4, 0, _vq_quantlist__16u1__p7_1, NULL, &_vq_auxt__16u1__p7_1, NULL, 0 }; static long _vq_quantlist__16u1__p8_0[] = { 5, 4, 6, 3, 7, 2, 8, 1, 9, 0, 10, }; static long _vq_lengthlist__16u1__p8_0[] = { 1, 4, 4, 5, 5, 8, 8,10,10,12,12, 4, 7, 7, 8, 8, 9, 9,12,11,14,13, 4, 7, 7, 7, 8, 9,10,11,11,13, 12, 5, 8, 8, 9, 9,11,11,12,13,15,14, 5, 7, 8, 9, 9,11,11,13,13,17,15, 8, 9,10,11,11,12,13,17,14, 17,16, 8,10, 9,11,11,12,12,13,15,15,17,10,11,11, 12,13,14,15,15,16,16,17, 9,11,11,12,12,14,15,17, 15,15,16,11,14,12,14,15,16,15,16,16,16,15,11,13, 13,14,14,15,15,16,16,15,16, }; static float _vq_quantthresh__16u1__p8_0[] = { -49.5, -38.5, -27.5, -16.5, -5.5, 5.5, 16.5, 27.5, 38.5, 49.5, }; static long _vq_quantmap__16u1__p8_0[] = { 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, }; static encode_aux_threshmatch _vq_auxt__16u1__p8_0 = { _vq_quantthresh__16u1__p8_0, _vq_quantmap__16u1__p8_0, 11, 11 }; static static_codebook _16u1__p8_0 = { 2, 121, _vq_lengthlist__16u1__p8_0, 1, -524582912, 1618345984, 4, 0, _vq_quantlist__16u1__p8_0, NULL, &_vq_auxt__16u1__p8_0, NULL, 0 }; static long _vq_quantlist__16u1__p8_1[] = { 5, 4, 6, 3, 7, 2, 8, 1, 9, 0, 10, }; static long _vq_lengthlist__16u1__p8_1[] = { 2, 5, 5, 6, 6, 7, 7, 8, 8, 8, 8, 4, 6, 6, 7, 7, 8, 7, 8, 8, 8, 8, 4, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 6, 7, 7, 7, 7, 8, 8, 8, 8, 8, 9, 6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 8, 8, 8, 9, 8, 9, 9, 9, 9, 9, 9, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, }; static float _vq_quantthresh__16u1__p8_1[] = { -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, }; static long _vq_quantmap__16u1__p8_1[] = { 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, }; static encode_aux_threshmatch _vq_auxt__16u1__p8_1 = { _vq_quantthresh__16u1__p8_1, _vq_quantmap__16u1__p8_1, 11, 11 }; static static_codebook _16u1__p8_1 = { 2, 121, _vq_lengthlist__16u1__p8_1, 1, -531365888, 1611661312, 4, 0, _vq_quantlist__16u1__p8_1, NULL, &_vq_auxt__16u1__p8_1, NULL, 0 }; static long _vq_quantlist__16u1__p9_0[] = { 7, 6, 8, 5, 9, 4, 10, 3, 11, 2, 12, 1, 13, 0, 14, }; static long _vq_lengthlist__16u1__p9_0[] = { 1, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, }; static float _vq_quantthresh__16u1__p9_0[] = { -1657.5, -1402.5, -1147.5, -892.5, -637.5, -382.5, -127.5, 127.5, 382.5, 637.5, 892.5, 1147.5, 1402.5, 1657.5, }; static long _vq_quantmap__16u1__p9_0[] = { 13, 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, 14, }; static encode_aux_threshmatch _vq_auxt__16u1__p9_0 = { _vq_quantthresh__16u1__p9_0, _vq_quantmap__16u1__p9_0, 15, 15 }; static static_codebook _16u1__p9_0 = { 2, 225, _vq_lengthlist__16u1__p9_0, 1, -514071552, 1627381760, 4, 0, _vq_quantlist__16u1__p9_0, NULL, &_vq_auxt__16u1__p9_0, NULL, 0 }; static long _vq_quantlist__16u1__p9_1[] = { 7, 6, 8, 5, 9, 4, 10, 3, 11, 2, 12, 1, 13, 0, 14, }; static long _vq_lengthlist__16u1__p9_1[] = { 1, 6, 5, 9, 9,10,10, 6, 7, 9, 9,10,10,10,10, 5, 10, 8,10, 8,10,10, 8, 8,10, 9,10,10,10,10, 5, 8, 9,10,10,10,10, 8,10,10,10,10,10,10,10, 9,10,10, 10,10,10,10, 9, 9,10,10,10,10,10,10, 9, 9, 8, 9, 10,10,10, 9,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10, 8,10,10,10,10, 10,10,10,10,10,10,10,10,10, 6, 8, 8,10,10,10, 8, 10,10,10,10,10,10,10,10, 5, 8, 8,10,10,10, 9, 9, 10,10,10,10,10,10,10,10, 9,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, }; static float _vq_quantthresh__16u1__p9_1[] = { -110.5, -93.5, -76.5, -59.5, -42.5, -25.5, -8.5, 8.5, 25.5, 42.5, 59.5, 76.5, 93.5, 110.5, }; static long _vq_quantmap__16u1__p9_1[] = { 13, 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, 14, }; static encode_aux_threshmatch _vq_auxt__16u1__p9_1 = { _vq_quantthresh__16u1__p9_1, _vq_quantmap__16u1__p9_1, 15, 15 }; static static_codebook _16u1__p9_1 = { 2, 225, _vq_lengthlist__16u1__p9_1, 1, -522338304, 1620115456, 4, 0, _vq_quantlist__16u1__p9_1, NULL, &_vq_auxt__16u1__p9_1, NULL, 0 }; static long _vq_quantlist__16u1__p9_2[] = { 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15, 0, 16, }; static long _vq_lengthlist__16u1__p9_2[] = { 1, 6, 6, 7, 8, 8,11,10, 9, 9,11, 9,10, 9,11,11, 9, 6, 7, 6,11, 8,11, 9,10,10,11, 9,11,10,10,10, 11, 9, 5, 7, 7, 8, 8,10,11, 8, 8,11, 9, 9,10,11, 9,10,11, 8, 9, 6, 8, 8, 9, 9,10,10,11,11,11, 9, 11,10, 9,11, 8, 8, 8, 9, 8, 9,10,11, 9, 9,11,11, 10, 9, 9,11,10, 8,11, 8, 9, 8,11, 9,10, 9,10,11, 11,10,10, 9,10,10, 8, 8, 9,10,10,10, 9,11, 9,10, 11,11,11,11,10, 9,11, 9, 9,11,11,10, 8,11,11,11, 9,10,10,11,10,11,11, 9,11,10, 9,11,10,10,10,10, 9,11,10,11,10, 9, 9,10,11, 9, 8,10,11,11,10,10, 11, 9,11,10,11,11,10,11, 9, 9, 8,10, 8, 9,11, 9, 8,10,10, 9,11,10,11,10,11, 9,11, 8,10,11,11,11, 11,10,10,11,11,11,11,10,11,11,10, 9, 8,10,10, 9, 11,10,11,11,11, 9, 9, 9,11,11,11,10,10, 9, 9,10, 9,11,11,11,11, 8,10,11,10,11,11,10,11,11, 9, 9, 9,10, 9,11, 9,11,11,11,11,11,10,11,11,10,11,10, 11,11, 9,11,10,11,10, 9,10, 9,10,10,11,11,11,11, 9,10, 9,10,11,11,10,11,11,11,11,11,11,10,11,11, 10, }; static float _vq_quantthresh__16u1__p9_2[] = { -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, }; static long _vq_quantmap__16u1__p9_2[] = { 15, 13, 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, 14, 16, }; static encode_aux_threshmatch _vq_auxt__16u1__p9_2 = { _vq_quantthresh__16u1__p9_2, _vq_quantmap__16u1__p9_2, 17, 17 }; static static_codebook _16u1__p9_2 = { 2, 289, _vq_lengthlist__16u1__p9_2, 1, -529530880, 1611661312, 5, 0, _vq_quantlist__16u1__p9_2, NULL, &_vq_auxt__16u1__p9_2, NULL, 0 }; static long _huff_lengthlist__16u1__short[] = { 5, 7,10, 9,11,10,15,11,13,16, 6, 4, 6, 6, 7, 7, 10, 9,12,16,10, 6, 5, 6, 6, 7,10,11,16,16, 9, 6, 7, 6, 7, 7,10, 8,14,16,11, 6, 5, 4, 5, 6, 8, 9, 15,16, 9, 6, 6, 5, 6, 6, 9, 8,14,16,12, 7, 6, 6, 5, 6, 6, 7,13,16, 8, 6, 7, 6, 5, 5, 4, 4,11,16, 9, 8, 9, 9, 7, 7, 6, 5,13,16,14,14,16,15,16,15, 16,16,16,16, }; static static_codebook _huff_book__16u1__short = { 2, 100, _huff_lengthlist__16u1__short, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _huff_lengthlist__16u2__long[] = { 5, 7,10,10,10,11,11,13,18,19, 6, 5, 5, 6, 7, 8, 9,12,19,19, 8, 5, 4, 4, 6, 7, 9,13,19,19, 8, 5, 4, 4, 5, 6, 8,12,17,19, 7, 5, 5, 4, 4, 5, 7,12, 18,18, 8, 7, 7, 6, 5, 5, 6,10,18,18, 9, 9, 9, 8, 6, 5, 6, 9,18,18,11,13,13,13, 8, 7, 7, 9,16,18, 13,17,18,16,11, 9, 9, 9,17,18,15,18,18,18,15,13, 13,14,18,18, }; static static_codebook _huff_book__16u2__long = { 2, 100, _huff_lengthlist__16u2__long, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _huff_lengthlist__16u2__short[] = { 8,11,12,12,14,15,16,16,16,16, 9, 7, 7, 8, 9,11, 13,14,16,16,13, 7, 6, 6, 7, 9,12,13,15,16,15, 7, 6, 5, 4, 6,10,11,14,16,12, 8, 7, 4, 2, 4, 7,10, 14,16,11, 9, 7, 5, 3, 4, 6, 9,14,16,11,10, 9, 7, 5, 5, 6, 9,16,16,10,10, 9, 8, 6, 6, 7,10,16,16, 11,11,11,10,10,10,11,14,16,16,16,14,14,13,14,16, 16,16,16,16, }; static static_codebook _huff_book__16u2__short = { 2, 100, _huff_lengthlist__16u2__short, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _vq_quantlist__16u2_p1_0[] = { 1, 0, 2, }; static long _vq_lengthlist__16u2_p1_0[] = { 1, 5, 5, 5, 7, 7, 5, 7, 7, 5, 7, 7, 7, 9, 9, 7, 9, 9, 5, 7, 7, 7, 9, 9, 7, 9, 9, 5, 7, 7, 8, 9, 9, 7, 9, 9, 7, 9, 9, 9,10,10, 9,10,10, 7, 9, 9, 9,10,10, 9,10,11, 5, 7, 8, 8, 9, 9, 8, 9, 9, 7, 9, 9, 9,10,10, 9, 9,10, 7, 9, 9, 9,10,10, 9,11, 10, }; static float _vq_quantthresh__16u2_p1_0[] = { -0.5, 0.5, }; static long _vq_quantmap__16u2_p1_0[] = { 1, 0, 2, }; static encode_aux_threshmatch _vq_auxt__16u2_p1_0 = { _vq_quantthresh__16u2_p1_0, _vq_quantmap__16u2_p1_0, 3, 3 }; static static_codebook _16u2_p1_0 = { 4, 81, _vq_lengthlist__16u2_p1_0, 1, -535822336, 1611661312, 2, 0, _vq_quantlist__16u2_p1_0, NULL, &_vq_auxt__16u2_p1_0, NULL, 0 }; static long _vq_quantlist__16u2_p2_0[] = { 2, 1, 3, 0, 4, }; static long _vq_lengthlist__16u2_p2_0[] = { 3, 5, 5, 8, 8, 5, 7, 7, 9, 9, 5, 7, 7, 9, 9, 9, 10, 9,11,11, 9, 9, 9,11,11, 5, 7, 7, 9, 9, 7, 8, 8,10,10, 7, 8, 8,10,10,10,10,10,12,12, 9,10,10, 11,12, 5, 7, 7, 9, 9, 7, 8, 8,10,10, 7, 8, 8,10, 10, 9,10,10,12,11,10,10,10,12,12, 9,10,10,12,12, 10,11,10,13,12, 9,10,10,12,12,12,12,12,14,14,11, 12,12,13,14, 9,10,10,12,12, 9,10,10,12,12,10,10, 10,12,12,11,12,12,14,13,12,13,12,14,14, 5, 7, 7, 9, 9, 7, 8, 8,10,10, 7, 8, 8,10,10,10,11,10,12, 12,10,10,11,12,12, 7, 8, 8,10,10, 8, 9, 9,11,11, 8, 9, 9,11,11,11,11,11,12,13,10,11,11,12,13, 7, 8, 8,10,10, 8, 9, 8,11,10, 8, 9, 9,11,11,10,11, 10,13,12,10,11,11,13,13, 9,11,10,13,13,10,11,11, 13,13,10,11,11,13,13,12,12,13,13,15,12,12,13,14, 15, 9,10,10,12,12,10,11,10,13,12,10,11,11,13,13, 11,13,11,14,13,12,13,13,15,15, 5, 7, 7, 9, 9, 7, 8, 8,10,10, 7, 8, 8,10,10,10,10,10,12,12,10,10, 11,12,12, 7, 8, 8,10,10, 8, 9, 9,11,11, 8, 8, 9, 10,11,10,11,11,13,13,10,10,11,12,13, 7, 8, 8,10, 11, 8, 9, 9,11,11, 8, 9, 9,11,11,10,11,11,13,12, 11,11,11,13,12, 9,10,10,12,12,10,11,11,13,13,10, 10,11,12,13,12,13,13,15,14,11,11,13,12,14,10,10, 11,13,13,10,11,11,13,13,10,11,11,13,13,12,13,13, 14,14,12,13,12,14,13, 8,10, 9,12,12, 9,11,10,13, 13, 9,10,10,12,13,12,13,13,14,14,12,12,13,14,14, 9,11,10,13,13,10,11,11,13,13,10,11,11,13,13,12, 13,13,15,15,13,13,13,14,15, 9,10,10,12,13,10,11, 10,13,12,10,11,11,13,13,12,13,12,15,14,13,13,13, 14,15,11,12,12,15,14,12,12,13,15,15,12,13,13,15, 14,14,13,15,14,16,13,14,15,16,16,11,12,12,14,14, 11,12,12,15,14,12,13,13,15,15,13,14,13,16,14,14, 14,14,16,16, 8, 9, 9,12,12, 9,10,10,13,12, 9,10, 10,13,13,12,12,12,14,14,12,12,13,15,15, 9,10,10, 13,12,10,11,11,13,13,10,10,11,13,14,12,13,13,15, 15,12,12,13,14,15, 9,10,10,13,13,10,11,11,13,13, 10,11,11,13,13,12,13,13,14,14,13,14,13,15,14,11, 12,12,14,14,12,13,13,15,14,11,12,12,14,15,14,14, 14,16,15,13,12,14,14,16,11,12,13,14,15,12,13,13, 14,16,12,13,12,15,14,13,15,14,16,16,14,15,13,16, 13, }; static float _vq_quantthresh__16u2_p2_0[] = { -1.5, -0.5, 0.5, 1.5, }; static long _vq_quantmap__16u2_p2_0[] = { 3, 1, 0, 2, 4, }; static encode_aux_threshmatch _vq_auxt__16u2_p2_0 = { _vq_quantthresh__16u2_p2_0, _vq_quantmap__16u2_p2_0, 5, 5 }; static static_codebook _16u2_p2_0 = { 4, 625, _vq_lengthlist__16u2_p2_0, 1, -533725184, 1611661312, 3, 0, _vq_quantlist__16u2_p2_0, NULL, &_vq_auxt__16u2_p2_0, NULL, 0 }; static long _vq_quantlist__16u2_p3_0[] = { 4, 3, 5, 2, 6, 1, 7, 0, 8, }; static long _vq_lengthlist__16u2_p3_0[] = { 2, 4, 4, 6, 6, 7, 7, 9, 9, 4, 5, 5, 6, 6, 8, 7, 9, 9, 4, 5, 5, 6, 6, 7, 8, 9, 9, 6, 6, 6, 7, 7, 8, 8,10,10, 6, 6, 6, 7, 7, 8, 8, 9,10, 7, 8, 7, 8, 8, 9, 9,10,10, 7, 8, 8, 8, 8, 9, 9,10,10, 9, 9, 9,10, 9,10,10,11,11, 9, 9, 9,10,10,10,10,11, 11, }; static float _vq_quantthresh__16u2_p3_0[] = { -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, }; static long _vq_quantmap__16u2_p3_0[] = { 7, 5, 3, 1, 0, 2, 4, 6, 8, }; static encode_aux_threshmatch _vq_auxt__16u2_p3_0 = { _vq_quantthresh__16u2_p3_0, _vq_quantmap__16u2_p3_0, 9, 9 }; static static_codebook _16u2_p3_0 = { 2, 81, _vq_lengthlist__16u2_p3_0, 1, -531628032, 1611661312, 4, 0, _vq_quantlist__16u2_p3_0, NULL, &_vq_auxt__16u2_p3_0, NULL, 0 }; static long _vq_quantlist__16u2_p4_0[] = { 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15, 0, 16, }; static long _vq_lengthlist__16u2_p4_0[] = { 2, 4, 4, 6, 6, 7, 7, 8, 8, 9, 9,10,10,11,11,11, 11, 5, 5, 5, 7, 7, 8, 8, 9, 9, 9, 9,10,10,11,11, 12,11, 5, 5, 5, 7, 7, 8, 8, 9, 9, 9, 9,10,10,11, 11,12,12, 6, 7, 7, 7, 7, 8, 8, 9, 9, 9, 9,10,10, 11,11,12,12, 6, 7, 7, 7, 7, 8, 8, 9, 9, 9, 9,10, 10,11,11,12,12, 7, 8, 8, 8, 8, 9, 9, 9, 9,10,10, 11,11,12,12,12,12, 7, 8, 8, 8, 8, 9, 9, 9, 9,10, 10,11,11,11,12,12,12, 9, 9, 9, 9, 9, 9,10,10,10, 10,10,11,11,12,12,13,13, 8, 9, 9, 9, 9,10, 9,10, 10,10,10,11,11,12,12,13,13, 9, 9, 9, 9, 9,10,10, 10,10,11,11,11,12,12,12,13,13, 9, 9, 9, 9, 9,10, 10,10,10,11,11,12,11,12,12,13,13,10,10,10,10,10, 11,11,11,11,11,12,12,12,12,13,13,14,10,10,10,10, 10,11,11,11,11,12,11,12,12,13,12,13,13,11,11,11, 11,11,12,12,12,12,12,12,13,13,13,13,14,14,11,11, 11,11,11,12,12,12,12,12,12,13,12,13,13,14,14,11, 12,12,12,12,12,12,13,13,13,13,13,13,14,14,14,14, 11,12,12,12,12,12,12,13,13,13,13,14,13,14,14,14, 14, }; static float _vq_quantthresh__16u2_p4_0[] = { -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, }; static long _vq_quantmap__16u2_p4_0[] = { 15, 13, 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, 14, 16, }; static encode_aux_threshmatch _vq_auxt__16u2_p4_0 = { _vq_quantthresh__16u2_p4_0, _vq_quantmap__16u2_p4_0, 17, 17 }; static static_codebook _16u2_p4_0 = { 2, 289, _vq_lengthlist__16u2_p4_0, 1, -529530880, 1611661312, 5, 0, _vq_quantlist__16u2_p4_0, NULL, &_vq_auxt__16u2_p4_0, NULL, 0 }; static long _vq_quantlist__16u2_p5_0[] = { 1, 0, 2, }; static long _vq_lengthlist__16u2_p5_0[] = { 1, 4, 4, 5, 7, 7, 5, 7, 7, 5, 9, 8, 7,10, 9, 7, 10, 9, 5, 8, 9, 7, 9,10, 7, 9,10, 4, 9, 9, 9,11, 11, 8,11,11, 7,11,11,10,10,13,10,14,13, 7,11,11, 10,13,11,10,13,14, 5, 9, 9, 8,11,11, 9,11,11, 7, 11,11,10,14,13,10,12,14, 7,11,11,10,13,13,10,13, 10, }; static float _vq_quantthresh__16u2_p5_0[] = { -5.5, 5.5, }; static long _vq_quantmap__16u2_p5_0[] = { 1, 0, 2, }; static encode_aux_threshmatch _vq_auxt__16u2_p5_0 = { _vq_quantthresh__16u2_p5_0, _vq_quantmap__16u2_p5_0, 3, 3 }; static static_codebook _16u2_p5_0 = { 4, 81, _vq_lengthlist__16u2_p5_0, 1, -529137664, 1618345984, 2, 0, _vq_quantlist__16u2_p5_0, NULL, &_vq_auxt__16u2_p5_0, NULL, 0 }; static long _vq_quantlist__16u2_p5_1[] = { 5, 4, 6, 3, 7, 2, 8, 1, 9, 0, 10, }; static long _vq_lengthlist__16u2_p5_1[] = { 2, 5, 5, 6, 6, 7, 7, 8, 8, 8, 8, 5, 5, 5, 7, 7, 7, 7, 8, 8, 8, 8, 5, 5, 6, 7, 7, 7, 7, 8, 8, 8, 8, 6, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 6, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, }; static float _vq_quantthresh__16u2_p5_1[] = { -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, }; static long _vq_quantmap__16u2_p5_1[] = { 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, }; static encode_aux_threshmatch _vq_auxt__16u2_p5_1 = { _vq_quantthresh__16u2_p5_1, _vq_quantmap__16u2_p5_1, 11, 11 }; static static_codebook _16u2_p5_1 = { 2, 121, _vq_lengthlist__16u2_p5_1, 1, -531365888, 1611661312, 4, 0, _vq_quantlist__16u2_p5_1, NULL, &_vq_auxt__16u2_p5_1, NULL, 0 }; static long _vq_quantlist__16u2_p6_0[] = { 6, 5, 7, 4, 8, 3, 9, 2, 10, 1, 11, 0, 12, }; static long _vq_lengthlist__16u2_p6_0[] = { 1, 4, 4, 7, 7, 8, 8, 8, 8, 9, 9,10,10, 4, 6, 6, 8, 8, 9, 9, 9, 9,10,10,12,11, 4, 6, 6, 8, 8, 9, 9, 9, 9,10,10,11,12, 7, 8, 8, 9, 9,10,10,10,10, 12,12,13,12, 7, 8, 8, 9, 9,10,10,10,10,11,12,12, 12, 8, 9, 9,10,10,11,11,11,11,12,12,13,13, 8, 9, 9,10,10,11,11,11,11,12,13,13,13, 8, 9, 9,10,10, 11,11,12,12,13,13,14,14, 8, 9, 9,10,10,11,11,12, 12,13,13,14,14, 9,10,10,11,12,13,12,13,14,14,14, 14,14, 9,10,10,11,12,12,13,13,13,14,14,14,14,10, 11,11,12,12,13,13,14,14,15,15,15,15,10,11,11,12, 12,13,13,14,14,14,14,15,15, }; static float _vq_quantthresh__16u2_p6_0[] = { -27.5, -22.5, -17.5, -12.5, -7.5, -2.5, 2.5, 7.5, 12.5, 17.5, 22.5, 27.5, }; static long _vq_quantmap__16u2_p6_0[] = { 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, }; static encode_aux_threshmatch _vq_auxt__16u2_p6_0 = { _vq_quantthresh__16u2_p6_0, _vq_quantmap__16u2_p6_0, 13, 13 }; static static_codebook _16u2_p6_0 = { 2, 169, _vq_lengthlist__16u2_p6_0, 1, -526516224, 1616117760, 4, 0, _vq_quantlist__16u2_p6_0, NULL, &_vq_auxt__16u2_p6_0, NULL, 0 }; static long _vq_quantlist__16u2_p6_1[] = { 2, 1, 3, 0, 4, }; static long _vq_lengthlist__16u2_p6_1[] = { 2, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 5, 5, 5, 6, 6, }; static float _vq_quantthresh__16u2_p6_1[] = { -1.5, -0.5, 0.5, 1.5, }; static long _vq_quantmap__16u2_p6_1[] = { 3, 1, 0, 2, 4, }; static encode_aux_threshmatch _vq_auxt__16u2_p6_1 = { _vq_quantthresh__16u2_p6_1, _vq_quantmap__16u2_p6_1, 5, 5 }; static static_codebook _16u2_p6_1 = { 2, 25, _vq_lengthlist__16u2_p6_1, 1, -533725184, 1611661312, 3, 0, _vq_quantlist__16u2_p6_1, NULL, &_vq_auxt__16u2_p6_1, NULL, 0 }; static long _vq_quantlist__16u2_p7_0[] = { 6, 5, 7, 4, 8, 3, 9, 2, 10, 1, 11, 0, 12, }; static long _vq_lengthlist__16u2_p7_0[] = { 1, 4, 4, 7, 7, 7, 7, 8, 8, 9, 9,10,10, 4, 6, 6, 9, 9, 9, 9, 9, 9,10,10,11,11, 4, 6, 6, 8, 9, 9, 9, 9, 9,10,11,12,11, 7, 8, 9,10,10,10,10,11,10, 11,12,12,13, 7, 9, 9,10,10,10,10,10,10,11,12,13, 13, 7, 9, 8,10,10,11,11,11,12,12,13,13,14, 7, 9, 9,10,10,11,11,11,12,13,13,13,13, 8, 9, 9,10,11, 11,12,12,12,13,13,13,13, 8, 9, 9,10,11,11,11,12, 12,13,13,14,14, 9,10,10,12,11,12,13,13,13,14,13, 13,13, 9,10,10,11,11,12,12,13,14,13,13,14,13,10, 11,11,12,13,14,14,14,15,14,14,14,14,10,11,11,12, 12,13,13,13,14,14,14,15,14, }; static float _vq_quantthresh__16u2_p7_0[] = { -60.5, -49.5, -38.5, -27.5, -16.5, -5.5, 5.5, 16.5, 27.5, 38.5, 49.5, 60.5, }; static long _vq_quantmap__16u2_p7_0[] = { 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, }; static encode_aux_threshmatch _vq_auxt__16u2_p7_0 = { _vq_quantthresh__16u2_p7_0, _vq_quantmap__16u2_p7_0, 13, 13 }; static static_codebook _16u2_p7_0 = { 2, 169, _vq_lengthlist__16u2_p7_0, 1, -523206656, 1618345984, 4, 0, _vq_quantlist__16u2_p7_0, NULL, &_vq_auxt__16u2_p7_0, NULL, 0 }; static long _vq_quantlist__16u2_p7_1[] = { 5, 4, 6, 3, 7, 2, 8, 1, 9, 0, 10, }; static long _vq_lengthlist__16u2_p7_1[] = { 3, 5, 5, 6, 6, 7, 7, 7, 7, 7, 7, 5, 6, 6, 7, 7, 7, 7, 7, 7, 8, 8, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 6, 6, 7, 7, 7, 8, 7, 8, 8, 8, 8, 6, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, }; static float _vq_quantthresh__16u2_p7_1[] = { -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, }; static long _vq_quantmap__16u2_p7_1[] = { 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, }; static encode_aux_threshmatch _vq_auxt__16u2_p7_1 = { _vq_quantthresh__16u2_p7_1, _vq_quantmap__16u2_p7_1, 11, 11 }; static static_codebook _16u2_p7_1 = { 2, 121, _vq_lengthlist__16u2_p7_1, 1, -531365888, 1611661312, 4, 0, _vq_quantlist__16u2_p7_1, NULL, &_vq_auxt__16u2_p7_1, NULL, 0 }; static long _vq_quantlist__16u2_p8_0[] = { 7, 6, 8, 5, 9, 4, 10, 3, 11, 2, 12, 1, 13, 0, 14, }; static long _vq_lengthlist__16u2_p8_0[] = { 1, 5, 5, 7, 7, 8, 8, 7, 7, 8, 8,10, 9,11,11, 4, 6, 6, 8, 8,10, 9, 9, 8, 9, 9,10,10,12,14, 4, 6, 7, 8, 9, 9,10, 9, 8, 9, 9,10,12,12,11, 7, 8, 8, 10,10,10,10, 9, 9,10,10,11,13,13,12, 7, 8, 8, 9, 11,11,10, 9, 9,11,10,12,11,11,14, 8, 9, 9,11,10, 11,11,10,10,11,11,13,12,14,12, 8, 9, 9,11,12,11, 11,10,10,12,11,12,12,12,14, 7, 8, 8, 9, 9,10,10, 10,11,12,11,13,13,14,12, 7, 8, 9, 9, 9,10,10,11, 11,11,12,12,14,14,14, 8,10, 9,10,11,11,11,11,14, 12,12,13,14,14,13, 9, 9, 9,10,11,11,11,12,12,12, 14,12,14,13,14,10,10,10,12,11,12,11,14,13,14,13, 14,14,13,14, 9,10,10,11,12,11,13,12,13,13,14,14, 14,13,14,10,13,13,12,12,11,12,14,13,14,13,14,12, 14,13,10,11,11,12,11,12,12,14,14,14,13,14,14,14, 14, }; static float _vq_quantthresh__16u2_p8_0[] = { -136.5, -115.5, -94.5, -73.5, -52.5, -31.5, -10.5, 10.5, 31.5, 52.5, 73.5, 94.5, 115.5, 136.5, }; static long _vq_quantmap__16u2_p8_0[] = { 13, 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, 14, }; static encode_aux_threshmatch _vq_auxt__16u2_p8_0 = { _vq_quantthresh__16u2_p8_0, _vq_quantmap__16u2_p8_0, 15, 15 }; static static_codebook _16u2_p8_0 = { 2, 225, _vq_lengthlist__16u2_p8_0, 1, -520986624, 1620377600, 4, 0, _vq_quantlist__16u2_p8_0, NULL, &_vq_auxt__16u2_p8_0, NULL, 0 }; static long _vq_quantlist__16u2_p8_1[] = { 10, 9, 11, 8, 12, 7, 13, 6, 14, 5, 15, 4, 16, 3, 17, 2, 18, 1, 19, 0, 20, }; static long _vq_lengthlist__16u2_p8_1[] = { 2, 5, 5, 7, 7, 8, 8, 8, 8, 9, 9,10, 9,10, 9, 9, 9,10,10,10,10, 5, 6, 6, 7, 7, 8, 8, 9, 9, 9, 9, 10, 9,10,10,10,10,10,10,11,10, 5, 6, 6, 7, 7, 8, 8, 8, 9, 9,10,10,10,10,10,10,10,10,10,10,10, 7, 7, 7, 8, 8, 9, 8, 9, 9,10, 9,10,10,10,10,10,10, 11,10,11,10, 7, 7, 7, 8, 8, 8, 9, 9, 9,10, 9,10, 10,10,10,10,10,10,10,10,10, 8, 8, 8, 9, 9, 9, 9, 10, 9,10,10,10,10,10,10,10,11,10,10,11,10, 8, 8, 8, 8, 9, 9, 9, 9,10,10,10,10,10,10,10,10,10,11, 11,10,10, 8, 9, 9, 9, 9, 9, 9,10,10,10,10,10,10, 11,10,11,10,11,10,11,10, 8, 9, 9, 9, 9, 9,10,10, 10,10,10,10,10,10,10,10,11,11,10,10,10, 9,10, 9, 9,10,10,10,11,10,10,10,10,10,10,10,10,11,11,11, 11,11, 9, 9, 9,10, 9,10,10,10,10,10,10,11,10,11, 10,11,11,11,11,10,10, 9,10, 9,10,10,10,10,11,10, 10,10,10,10,11,10,11,10,11,10,10,11, 9,10,10,10, 10,10,10,10,10,10,11,10,10,11,11,10,11,11,11,11, 11, 9, 9,10,10,10,10,10,11,10,10,11,10,10,11,10, 10,11,11,11,11,11, 9,10,10,10,10,10,10,10,11,10, 11,10,11,10,11,11,11,11,11,10,11,10,10,10,10,10, 10,10,10,10,11,11,11,11,11,11,11,11,11,10,11,11, 10,10,10,10,10,11,10,10,10,11,10,11,11,11,11,10, 12,11,11,11,10,10,10,10,10,10,11,10,10,10,11,11, 12,11,11,11,11,11,11,11,11,11,10,10,10,11,10,11, 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10, 10,10,11,10,11,10,10,11,11,11,11,11,11,11,11,11, 11,11,11,10,10,10,10,10,10,10,11,11,10,11,11,10, 11,11,10,11,11,11,10,11,11, }; static float _vq_quantthresh__16u2_p8_1[] = { -9.5, -8.5, -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, 9.5, }; static long _vq_quantmap__16u2_p8_1[] = { 19, 17, 15, 13, 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, }; static encode_aux_threshmatch _vq_auxt__16u2_p8_1 = { _vq_quantthresh__16u2_p8_1, _vq_quantmap__16u2_p8_1, 21, 21 }; static static_codebook _16u2_p8_1 = { 2, 441, _vq_lengthlist__16u2_p8_1, 1, -529268736, 1611661312, 5, 0, _vq_quantlist__16u2_p8_1, NULL, &_vq_auxt__16u2_p8_1, NULL, 0 }; static long _vq_quantlist__16u2_p9_0[] = { 5586, 4655, 6517, 3724, 7448, 2793, 8379, 1862, 9310, 931, 10241, 0, 11172, 5521, 5651, }; static long _vq_lengthlist__16u2_p9_0[] = { 1,10,10,10,10,10,10,10,10,10,10,10,10, 5, 4,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10, 4,10,10,10,10,10,10,10,10,10,10,10,10, 6, 6, 5,10,10,10,10, 9, 9, 9, 9, 9, 9, 9, 9, 5, 5, }; static float _vq_quantthresh__16u2_p9_0[] = { -5120.5, -4189.5, -3258.5, -2327.5, -1396.5, -498, -32.5, 32.5, 498, 1396.5, 2327.5, 3258.5, 4189.5, 5120.5, }; static long _vq_quantmap__16u2_p9_0[] = { 11, 9, 7, 5, 3, 1, 13, 0, 14, 2, 4, 6, 8, 10, 12, }; static encode_aux_threshmatch _vq_auxt__16u2_p9_0 = { _vq_quantthresh__16u2_p9_0, _vq_quantmap__16u2_p9_0, 15, 15 }; static static_codebook _16u2_p9_0 = { 2, 225, _vq_lengthlist__16u2_p9_0, 1, -510275072, 1611661312, 14, 0, _vq_quantlist__16u2_p9_0, NULL, &_vq_auxt__16u2_p9_0, NULL, 0 }; static long _vq_quantlist__16u2_p9_1[] = { 392, 343, 441, 294, 490, 245, 539, 196, 588, 147, 637, 98, 686, 49, 735, 0, 784, 388, 396, }; static long _vq_lengthlist__16u2_p9_1[] = { 1,12,10,12,10,12,10,12,11,12,12,12,12,12,12,12, 12, 5, 5, 9,10,12,11,11,12,12,12,12,12,12,12,12, 12,12,12,12,10, 9, 9,11, 9,11,11,12,11,12,12,12, 12,12,12,12,12,12,12, 8, 8,10,11, 9,12,11,12,12, 12,12,12,12,12,12,12,12,12,12, 9, 8,10,11,12,11, 12,11,12,12,12,12,12,12,12,12,12,12,12, 8, 9,11, 11,10,12,12,12,12,12,12,12,12,12,12,12,12,12,12, 9,10,11,12,11,12,11,12,12,12,12,12,12,12,12,12, 12,12,12, 9, 9,11,12,12,12,12,12,12,12,12,12,12, 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, 12,12,12,12,11,11,11,11,11,11,11,11,11,11,11,11, 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, 11,11,11, 5, 8, 9, 9, 8,11, 9,11,11,11,11,11,11, 11,11,11,11, 5, 5, 4, 8, 8, 8, 8,10, 9,10,10,11, 11,11,11,11,11,11,11, 5, 4, }; static float _vq_quantthresh__16u2_p9_1[] = { -367.5, -318.5, -269.5, -220.5, -171.5, -122.5, -73.5, -26.5, -2, 2, 26.5, 73.5, 122.5, 171.5, 220.5, 269.5, 318.5, 367.5, }; static long _vq_quantmap__16u2_p9_1[] = { 15, 13, 11, 9, 7, 5, 3, 1, 17, 0, 18, 2, 4, 6, 8, 10, 12, 14, 16, }; static encode_aux_threshmatch _vq_auxt__16u2_p9_1 = { _vq_quantthresh__16u2_p9_1, _vq_quantmap__16u2_p9_1, 19, 19 }; static static_codebook _16u2_p9_1 = { 2, 361, _vq_lengthlist__16u2_p9_1, 1, -518488064, 1611661312, 10, 0, _vq_quantlist__16u2_p9_1, NULL, &_vq_auxt__16u2_p9_1, NULL, 0 }; static long _vq_quantlist__16u2_p9_2[] = { 24, 23, 25, 22, 26, 21, 27, 20, 28, 19, 29, 18, 30, 17, 31, 16, 32, 15, 33, 14, 34, 13, 35, 12, 36, 11, 37, 10, 38, 9, 39, 8, 40, 7, 41, 6, 42, 5, 43, 4, 44, 3, 45, 2, 46, 1, 47, 0, 48, }; static long _vq_lengthlist__16u2_p9_2[] = { 1, 3, 3, 4, 7, 7, 7, 8, 7, 7, 7, 7, 8, 8, 8, 8, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 7, 9, 9, 8, 9, 9, 9, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,12,12,10, 11, }; static float _vq_quantthresh__16u2_p9_2[] = { -23.5, -22.5, -21.5, -20.5, -19.5, -18.5, -17.5, -16.5, -15.5, -14.5, -13.5, -12.5, -11.5, -10.5, -9.5, -8.5, -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, 9.5, 10.5, 11.5, 12.5, 13.5, 14.5, 15.5, 16.5, 17.5, 18.5, 19.5, 20.5, 21.5, 22.5, 23.5, }; static long _vq_quantmap__16u2_p9_2[] = { 47, 45, 43, 41, 39, 37, 35, 33, 31, 29, 27, 25, 23, 21, 19, 17, 15, 13, 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, }; static encode_aux_threshmatch _vq_auxt__16u2_p9_2 = { _vq_quantthresh__16u2_p9_2, _vq_quantmap__16u2_p9_2, 49, 49 }; static static_codebook _16u2_p9_2 = { 1, 49, _vq_lengthlist__16u2_p9_2, 1, -526909440, 1611661312, 6, 0, _vq_quantlist__16u2_p9_2, NULL, &_vq_auxt__16u2_p9_2, NULL, 0 }; static long _huff_lengthlist__44u0__long[] = { 3, 7,12,10,15,10, 9,18, 5, 2, 5, 6, 8, 7, 9,20, 10, 4, 4, 6, 6, 8,11,20, 9, 5, 6, 5, 7, 6, 9,20, 11, 7, 5, 7, 5, 7,10,20,10, 6, 7, 6, 6, 6, 8,17, 9, 8,10, 7, 7, 5, 5,17,11,18,19,14,13, 9, 8,19, }; static static_codebook _huff_book__44u0__long = { 2, 64, _huff_lengthlist__44u0__long, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _vq_quantlist__44u0__p1_0[] = { 1, 0, 2, }; static long _vq_lengthlist__44u0__p1_0[] = { 1, 4, 4, 5, 8, 7, 5, 7, 8, 5, 8, 8, 8,11,11, 8, 10,11, 5, 8, 8, 8,10,10, 8,11,11, 4, 8, 8, 8,11, 11, 8,11,11, 8,11,11,11,13,14,11,13,14, 7,11,11, 10,14,12,11,13,14, 4, 8, 8, 8,11,11, 8,11,11, 8, 11,11,11,14,13,10,12,13, 8,11,12,11,14,14,11,14, 13, }; static float _vq_quantthresh__44u0__p1_0[] = { -0.5, 0.5, }; static long _vq_quantmap__44u0__p1_0[] = { 1, 0, 2, }; static encode_aux_threshmatch _vq_auxt__44u0__p1_0 = { _vq_quantthresh__44u0__p1_0, _vq_quantmap__44u0__p1_0, 3, 3 }; static static_codebook _44u0__p1_0 = { 4, 81, _vq_lengthlist__44u0__p1_0, 1, -535822336, 1611661312, 2, 0, _vq_quantlist__44u0__p1_0, NULL, &_vq_auxt__44u0__p1_0, NULL, 0 }; static long _vq_quantlist__44u0__p2_0[] = { 1, 0, 2, }; static long _vq_lengthlist__44u0__p2_0[] = { 2, 4, 4, 5, 6, 6, 5, 6, 6, 5, 7, 6, 7, 8, 8, 6, 7, 8, 5, 6, 7, 6, 8, 7, 7, 8, 8, 5, 7, 7, 7, 8, 8, 7, 8, 8, 7, 8, 8, 8, 9,10, 8,10,10, 6, 8, 8, 7,10, 8, 8,10,10, 5, 7, 7, 7, 8, 8, 7, 8, 8, 6, 8, 8, 8,10,10, 7, 8,10, 6, 8, 8, 8,10,10, 8,10, 9, }; static float _vq_quantthresh__44u0__p2_0[] = { -0.5, 0.5, }; static long _vq_quantmap__44u0__p2_0[] = { 1, 0, 2, }; static encode_aux_threshmatch _vq_auxt__44u0__p2_0 = { _vq_quantthresh__44u0__p2_0, _vq_quantmap__44u0__p2_0, 3, 3 }; static static_codebook _44u0__p2_0 = { 4, 81, _vq_lengthlist__44u0__p2_0, 1, -535822336, 1611661312, 2, 0, _vq_quantlist__44u0__p2_0, NULL, &_vq_auxt__44u0__p2_0, NULL, 0 }; static long _vq_quantlist__44u0__p3_0[] = { 2, 1, 3, 0, 4, }; static long _vq_lengthlist__44u0__p3_0[] = { 1, 5, 5, 8, 8, 5, 7, 7, 9, 9, 5, 7, 8, 9, 9, 8, 10, 9,12,11, 8, 9,10,11,12, 6, 8, 8,10,10, 8,10, 10,11,11, 8, 9,10,11,11,10,12,11,13,13,10,11,11, 13,13, 6, 8, 8,10,10, 8,10, 9,11,11, 8,10,10,11, 11,10,11,11,13,13,10,11,11,13,13, 9,11,11,15,14, 10,12,11,15,14,10,12,11,15,14,12,14,13,16,15,12, 13,13,17,15, 9,11,11,14,14,10,11,12,14,15,10,11, 12,14,17,12,13,14,15,16,13,13,14,15,17, 5, 8, 8, 11,11, 8,10,10,12,12, 8,10,10,12,12,11,12,12,15, 14,11,12,12,14,15, 8,10,10,13,12,10,12,12,13,13, 10,12,12,14,14,12,13,13,15,15,11,13,13,15,16, 7, 10,10,12,12, 9,12,11,14,13,10,12,12,13,14,12,13, 12,15,15,12,13,13,16,17,10,12,12,15,16,12,13,13, 17,15,11,13,13,17,16,15,15,15,17,17,13,15,16,18, 18, 9,12,12,15,17,11,13,12,16,16,11,13,13,16,18, 14,15,14,16,16,13,15,15,17,18, 5, 8, 8,11,11, 8, 10,10,12,12, 8,10,10,12,12,10,12,12,15,15,11,12, 12,14,15, 7,10,10,12,12,10,12,12,14,14, 9,11,12, 13,13,12,13,13,16,16,12,12,13,15,15, 8,10,10,12, 13,10,12,12,13,14,10,12,12,13,13,12,13,13,16,16, 12,13,13,15,15,10,12,12,15,16,11,13,13,17,16,11, 12,13,17,16,13,15,15,18,19,14,14,14,17,16,10,12, 12,15,15,11,13,13,15,16,11,13,13,15,17,13,15,15, 18,20,14,15,15,17,17, 8,11,11,15,16,10,13,12,17, 16,10,12,13,16,17,15,16,15,20,19,14,15,16,18,19, 9,12,12,15,17,11,13,14,18,18,11,13,14,17,17,16, 17,18,19,19,15,16,18,19,20, 9,12,12,16,16,11,14, 12,17,17,11,13,13,16,19,15,16,15,20,19,15,15,15, 19,17,12,14,14,18,19,14,15,15,19,18,13,15,15,18, 17,17,18,19,20, 0,15,16,17,20, 0,12,15,14,17,18, 13,16,14,20,20,13,16,15,19,18,16,20,17,20,19,16, 17,16, 0,19, 8,11,11,15,15,10,12,12,17,17,10,12, 13,16,16,13,14,15,17,17,15,16,17,19,19, 9,12,12, 16,17,11,13,13,18,16,11,13,13,16,17,14,15,16,19, 18,15,16,17,17,18, 9,12,12,17,16,11,14,13,16,16, 12,14,13,17,18,14,16,15,18,19,17,17,17,19,18,12, 14,14,19,17,13,15,15,17, 0,13,14,16, 0, 0,15,16, 16,19, 0,16,16,19,19, 0,12,15,14,19,18,13,15,15, 19, 0,14,16,15, 0,19,15,17,17, 0,19,17,18,17, 0, 19, }; static float _vq_quantthresh__44u0__p3_0[] = { -1.5, -0.5, 0.5, 1.5, }; static long _vq_quantmap__44u0__p3_0[] = { 3, 1, 0, 2, 4, }; static encode_aux_threshmatch _vq_auxt__44u0__p3_0 = { _vq_quantthresh__44u0__p3_0, _vq_quantmap__44u0__p3_0, 5, 5 }; static static_codebook _44u0__p3_0 = { 4, 625, _vq_lengthlist__44u0__p3_0, 1, -533725184, 1611661312, 3, 0, _vq_quantlist__44u0__p3_0, NULL, &_vq_auxt__44u0__p3_0, NULL, 0 }; static long _vq_quantlist__44u0__p4_0[] = { 2, 1, 3, 0, 4, }; static long _vq_lengthlist__44u0__p4_0[] = { 4, 5, 5, 8, 8, 5, 7, 6, 9, 9, 5, 6, 7, 9, 9, 9, 9, 9,11,11, 9, 9, 9,11,11, 5, 7, 7, 9, 9, 7, 8, 8,10,10, 6, 7, 8, 9,10,10,10,10,11,12, 9,10,10, 11,12, 5, 7, 7, 9, 9, 6, 8, 7,10,10, 7, 8, 8,10, 10, 9,10,10,12,11,10,10,10,12,11, 9,10,10,12,12, 10,11,10,13,13, 9,10,10,13,13,12,12,12,14,14,11, 12,12,14,14, 9,10,10,12,12, 9,10,10,13,13,10,10, 10,12,13,11,12,12,14,14,12,13,12,14,14, 5, 7, 7, 10,10, 7, 8, 8,10,10, 7, 8, 8,10,10,10,10,10,13, 12,10,10,10,12,12, 7, 8, 8,11,10, 8, 8, 9,10,11, 8, 9, 9,11,11,10,10,11,12,13,10,11,11,13,14, 6, 8, 8,10,10, 7, 9, 8,11,10, 8, 9, 9,11,11,10,11, 10,13,11,10,11,11,13,13,10,11,10,13,13,10,10,11, 13,14,10,11,11,14,13,12,11,13,12,14,12,13,13,15, 15, 9,10,10,13,13,10,11,10,13,13,10,11,11,13,14, 12,13,11,15,12,12,13,13,14,15, 5, 7, 7,10, 9, 7, 8, 8,10,10, 7, 8, 8,10,10,10,10,10,12,12,10,10, 10,12,13, 6, 8, 8,10,10, 8, 9, 9,11,11, 7, 8, 9, 10,11,10,11,11,13,13,10,10,11,11,14, 7, 8, 8,10, 10, 8, 9, 9,11,11, 8, 9, 8,11,10,10,11,11,13,13, 10,11,10,13,11, 9,10,10,13,13,10,11,11,14,13,10, 10,11,12,13,13,13,13,15,14,12,11,13,12,15, 9,10, 11,13,13,10,11,11,13,14,10,11,10,13,13,12,13,13, 15,15,12,13,11,15,12, 8,10,10,13,12,10,11,11,13, 13, 9,10,11,13,13,13,13,13,15,15,12,13,13,15,15, 9,10,10,13,13,10,11,11,13,14,10,11,11,14,13,13, 13,14,14,15,13,13,13,14,15, 9,10,10,13,13,10,11, 10,14,13,10,11,11,13,14,13,14,13,15,14,12,13,13, 14,15,11,13,13,15,14,11,11,13,14,15,12,14,13,15, 15,13,12,15,12,16,14,14,15,17,16,11,12,12,14,15, 11,13,11,15,14,12,13,13,15,15,14,14,12,17,13,14, 15,15,18,16, 8,10,10,13,12, 9,10,10,13,13,10,10, 11,13,13,12,13,13,14,14,12,13,13,15,15, 9,10,10, 13,13,10,11,11,14,13,10,10,11,13,14,12,13,13,17, 15,12,12,13,14,16, 9,10,10,13,13,10,11,11,13,13, 10,11,10,14,13,13,13,13,14,15,13,14,13,15,15,11, 13,12,14,14,12,13,13,16,14,11,12,13,15,15,14,15, 16,17,18,14,12,15,14,16,11,12,13,14,15,12,13,13, 15,16,11,13,11,15,14,14,16,14,16,17,14,15,12,16, 12, }; static float _vq_quantthresh__44u0__p4_0[] = { -1.5, -0.5, 0.5, 1.5, }; static long _vq_quantmap__44u0__p4_0[] = { 3, 1, 0, 2, 4, }; static encode_aux_threshmatch _vq_auxt__44u0__p4_0 = { _vq_quantthresh__44u0__p4_0, _vq_quantmap__44u0__p4_0, 5, 5 }; static static_codebook _44u0__p4_0 = { 4, 625, _vq_lengthlist__44u0__p4_0, 1, -533725184, 1611661312, 3, 0, _vq_quantlist__44u0__p4_0, NULL, &_vq_auxt__44u0__p4_0, NULL, 0 }; static long _vq_quantlist__44u0__p5_0[] = { 4, 3, 5, 2, 6, 1, 7, 0, 8, }; static long _vq_lengthlist__44u0__p5_0[] = { 1, 4, 4, 7, 7, 8, 8, 9, 9, 4, 6, 5, 8, 8, 8, 8, 10,10, 4, 5, 6, 8, 8, 8, 8,10,10, 7, 8, 8, 9, 9, 9, 9,11,11, 7, 8, 8, 9, 9, 9, 9,11,11, 8, 8, 8, 10, 9,10,11,12,12, 8, 8, 8, 9, 9,11,11,12,12, 9, 10,10,11,11,12,12,13,13, 9,10,10,11,11,12,12,13, 13, }; static float _vq_quantthresh__44u0__p5_0[] = { -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, }; static long _vq_quantmap__44u0__p5_0[] = { 7, 5, 3, 1, 0, 2, 4, 6, 8, }; static encode_aux_threshmatch _vq_auxt__44u0__p5_0 = { _vq_quantthresh__44u0__p5_0, _vq_quantmap__44u0__p5_0, 9, 9 }; static static_codebook _44u0__p5_0 = { 2, 81, _vq_lengthlist__44u0__p5_0, 1, -531628032, 1611661312, 4, 0, _vq_quantlist__44u0__p5_0, NULL, &_vq_auxt__44u0__p5_0, NULL, 0 }; static long _vq_quantlist__44u0__p6_0[] = { 6, 5, 7, 4, 8, 3, 9, 2, 10, 1, 11, 0, 12, }; static long _vq_lengthlist__44u0__p6_0[] = { 1, 4, 4, 6, 6, 8, 8,10, 9,10,10,14,14, 4, 6, 5, 8, 8, 9, 9,10,10,11,11,14,14, 4, 5, 6, 8, 8, 9, 9,10,10,11,11,14,14, 7, 8, 8, 9, 9,10,10,11,11, 12,12,15,15, 7, 8, 8, 9, 9,10,10,11,11,12,12,14, 15, 9, 9, 9,10,10,11,11,12,11,12,12,15,16, 9, 9, 9,10,10,11,11,11,11,12,12,15,15,10,10,10,11,11, 12,11,12,12,13,13,16,16,10,10,10,11,11,12,12,12, 12,13,13,16,17,11,11,12,12,12,13,13,14,13,14,14, 18,17,11,11,11,12,12,12,12,13,14,14,14,18,18,14, 14,14,15,15,15,16,16,16,17,17, 0,19,14,14,14,15, 15,16,17,16,17,17,17,19, 0, }; static float _vq_quantthresh__44u0__p6_0[] = { -27.5, -22.5, -17.5, -12.5, -7.5, -2.5, 2.5, 7.5, 12.5, 17.5, 22.5, 27.5, }; static long _vq_quantmap__44u0__p6_0[] = { 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, }; static encode_aux_threshmatch _vq_auxt__44u0__p6_0 = { _vq_quantthresh__44u0__p6_0, _vq_quantmap__44u0__p6_0, 13, 13 }; static static_codebook _44u0__p6_0 = { 2, 169, _vq_lengthlist__44u0__p6_0, 1, -526516224, 1616117760, 4, 0, _vq_quantlist__44u0__p6_0, NULL, &_vq_auxt__44u0__p6_0, NULL, 0 }; static long _vq_quantlist__44u0__p6_1[] = { 2, 1, 3, 0, 4, }; static long _vq_lengthlist__44u0__p6_1[] = { 2, 4, 4, 5, 5, 4, 5, 5, 5, 5, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 5, 6, 6, 6, 6, }; static float _vq_quantthresh__44u0__p6_1[] = { -1.5, -0.5, 0.5, 1.5, }; static long _vq_quantmap__44u0__p6_1[] = { 3, 1, 0, 2, 4, }; static encode_aux_threshmatch _vq_auxt__44u0__p6_1 = { _vq_quantthresh__44u0__p6_1, _vq_quantmap__44u0__p6_1, 5, 5 }; static static_codebook _44u0__p6_1 = { 2, 25, _vq_lengthlist__44u0__p6_1, 1, -533725184, 1611661312, 3, 0, _vq_quantlist__44u0__p6_1, NULL, &_vq_auxt__44u0__p6_1, NULL, 0 }; static long _vq_quantlist__44u0__p7_0[] = { 2, 1, 3, 0, 4, }; static long _vq_lengthlist__44u0__p7_0[] = { 1, 5, 5,11,11, 9,11,11,11,11,11,11,11,11,11,11, 11,11,11,11,11,11,11,11,11, 8,11,11,11,11,11,11, 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, 11,11, 9,11,11,11,11,11,11,11,11,11,11,11,11,11, 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, 11,11,11,11,11,11,11,11,11,11,11,11,11, 8,11,11, 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, 11,11,11,11,11,11,11,11,11,11,10,11,11,11,11,11, 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, 11,11,11,11,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10, }; static float _vq_quantthresh__44u0__p7_0[] = { -253.5, -84.5, 84.5, 253.5, }; static long _vq_quantmap__44u0__p7_0[] = { 3, 1, 0, 2, 4, }; static encode_aux_threshmatch _vq_auxt__44u0__p7_0 = { _vq_quantthresh__44u0__p7_0, _vq_quantmap__44u0__p7_0, 5, 5 }; static static_codebook _44u0__p7_0 = { 4, 625, _vq_lengthlist__44u0__p7_0, 1, -518709248, 1626677248, 3, 0, _vq_quantlist__44u0__p7_0, NULL, &_vq_auxt__44u0__p7_0, NULL, 0 }; static long _vq_quantlist__44u0__p7_1[] = { 6, 5, 7, 4, 8, 3, 9, 2, 10, 1, 11, 0, 12, }; static long _vq_lengthlist__44u0__p7_1[] = { 1, 4, 4, 6, 6, 7, 7, 8, 8, 9, 9,10,10, 4, 7, 7, 8, 8, 8, 8, 9, 9,11,10,12,11, 4, 6, 7, 8, 8, 7, 8, 9, 9,10,11,12,11, 7, 8, 8, 9, 9,10,10,11,11, 12,11,13,13, 7, 8, 8, 9,10,10,10,11,11,12,12,12, 13, 7, 8, 8,10,10,12,12,13,12,16,13,13,14, 7, 8, 8,10,11,12,12,13,12,13,13,14,14, 8, 9,10,12,12, 14,13,16,15,16,16,16,15, 8,10,10,12,12,14,13,14, 15,16,16,15,16,10,11,12,14,14,14,14,16,13,16,15, 16,16,10,11,12,13,13,15,14,14,15,16,16,14,14,13, 14,13,15,16,16,16,15,15,16,16,16,16,11,15,14,16, 16,14,14,16,15,16,14,16,15, }; static float _vq_quantthresh__44u0__p7_1[] = { -71.5, -58.5, -45.5, -32.5, -19.5, -6.5, 6.5, 19.5, 32.5, 45.5, 58.5, 71.5, }; static long _vq_quantmap__44u0__p7_1[] = { 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, }; static encode_aux_threshmatch _vq_auxt__44u0__p7_1 = { _vq_quantthresh__44u0__p7_1, _vq_quantmap__44u0__p7_1, 13, 13 }; static static_codebook _44u0__p7_1 = { 2, 169, _vq_lengthlist__44u0__p7_1, 1, -523010048, 1618608128, 4, 0, _vq_quantlist__44u0__p7_1, NULL, &_vq_auxt__44u0__p7_1, NULL, 0 }; static long _vq_quantlist__44u0__p7_2[] = { 6, 5, 7, 4, 8, 3, 9, 2, 10, 1, 11, 0, 12, }; static long _vq_lengthlist__44u0__p7_2[] = { 2, 5, 5, 6, 6, 7, 7, 8, 8, 8, 8, 8, 8, 5, 5, 6, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 5, 5, 5, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 9, 9, 9, 6, 7, 7, 8, 7, 8, 8, 9, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 8, 8, 9, 9, 9, 9, 8, 9, 9, 9, 9, 9, 9, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, }; static float _vq_quantthresh__44u0__p7_2[] = { -5.5, -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, }; static long _vq_quantmap__44u0__p7_2[] = { 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, }; static encode_aux_threshmatch _vq_auxt__44u0__p7_2 = { _vq_quantthresh__44u0__p7_2, _vq_quantmap__44u0__p7_2, 13, 13 }; static static_codebook _44u0__p7_2 = { 2, 169, _vq_lengthlist__44u0__p7_2, 1, -531103744, 1611661312, 4, 0, _vq_quantlist__44u0__p7_2, NULL, &_vq_auxt__44u0__p7_2, NULL, 0 }; static long _huff_lengthlist__44u0__short[] = { 6,10,11,12,13,12,12,12, 4, 6, 6, 9, 9,10,11,13, 3, 4, 3, 7, 6, 8,10,15, 5, 7, 7, 9, 8, 9,11,16, 6, 7, 5, 8, 5, 7,10,16, 7, 8, 7, 9, 6, 7,10,16, 10, 6, 3, 5, 4, 5, 7,16,13, 8, 5, 7, 6, 7,10,15, }; static static_codebook _huff_book__44u0__short = { 2, 64, _huff_lengthlist__44u0__short, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _huff_lengthlist__44u1__long[] = { 4, 8,13,11,14,11,10,14, 6, 3, 5, 6, 8, 7, 9,14, 12, 4, 3, 6, 5, 7,10,18,11, 6, 6, 6, 6, 6, 8,16, 13, 7, 4, 6, 4, 6, 9,19,11, 6, 6, 5, 5, 5, 7,16, 10, 8, 9, 7, 9, 6, 4,12,11,16,18,19,18,10, 7,11, }; static static_codebook _huff_book__44u1__long = { 2, 64, _huff_lengthlist__44u1__long, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _vq_quantlist__44u1__p1_0[] = { 1, 0, 2, }; static long _vq_lengthlist__44u1__p1_0[] = { 1, 4, 4, 5, 8, 7, 5, 7, 8, 5, 8, 8, 8,11,11, 8, 10,11, 5, 8, 8, 8,11,10, 8,11,11, 4, 8, 8, 8,11, 11, 8,11,11, 8,11,11,11,13,14,11,13,14, 8,11,11, 10,14,11,11,13,14, 4, 8, 8, 8,11,11, 8,11,11, 7, 11,11,11,14,13,10,12,13, 8,11,11,11,14,14,11,14, 13, }; static float _vq_quantthresh__44u1__p1_0[] = { -0.5, 0.5, }; static long _vq_quantmap__44u1__p1_0[] = { 1, 0, 2, }; static encode_aux_threshmatch _vq_auxt__44u1__p1_0 = { _vq_quantthresh__44u1__p1_0, _vq_quantmap__44u1__p1_0, 3, 3 }; static static_codebook _44u1__p1_0 = { 4, 81, _vq_lengthlist__44u1__p1_0, 1, -535822336, 1611661312, 2, 0, _vq_quantlist__44u1__p1_0, NULL, &_vq_auxt__44u1__p1_0, NULL, 0 }; static long _vq_quantlist__44u1__p2_0[] = { 1, 0, 2, }; static long _vq_lengthlist__44u1__p2_0[] = { 2, 5, 5, 5, 6, 6, 5, 6, 6, 5, 6, 6, 7, 8, 8, 6, 7, 8, 5, 6, 6, 6, 8, 7, 7, 8, 8, 5, 6, 6, 7, 8, 8, 6, 8, 8, 7, 8, 8, 8, 9,10, 8, 9, 9, 6, 8, 8, 7, 9, 8, 8, 9,10, 5, 6, 6, 6, 8, 8, 7, 8, 8, 6, 8, 8, 8,10, 9, 7, 8, 9, 7, 8, 8, 8, 9, 9, 8,10, 9, }; static float _vq_quantthresh__44u1__p2_0[] = { -0.5, 0.5, }; static long _vq_quantmap__44u1__p2_0[] = { 1, 0, 2, }; static encode_aux_threshmatch _vq_auxt__44u1__p2_0 = { _vq_quantthresh__44u1__p2_0, _vq_quantmap__44u1__p2_0, 3, 3 }; static static_codebook _44u1__p2_0 = { 4, 81, _vq_lengthlist__44u1__p2_0, 1, -535822336, 1611661312, 2, 0, _vq_quantlist__44u1__p2_0, NULL, &_vq_auxt__44u1__p2_0, NULL, 0 }; static long _vq_quantlist__44u1__p3_0[] = { 2, 1, 3, 0, 4, }; static long _vq_lengthlist__44u1__p3_0[] = { 2, 5, 4, 7, 7, 5, 7, 7, 9, 8, 5, 7, 7, 8, 9, 8, 9, 9,11,11, 8, 9, 9,11,11, 5, 7, 7,10,10, 7, 9, 9,11,10, 7, 9, 9,10,10, 9,11,10,13,12, 9,10,10, 12,13, 5, 7, 7,10, 9, 7, 9, 9,11,10, 7, 9, 9,10, 11, 9,10,10,12,12,10,10,11,12,13, 8,10,10,14,13, 9,11,11,15,13, 9,11,11,15,13,12,14,12,16,14,12, 13,12,15,14, 8,10,10,13,14, 9,11,11,13,14,10,11, 11,13,15,12,12,13,14,15,12,13,14,14,16, 5, 7, 7, 10,10, 7, 9, 9,11,11, 7, 9, 9,11,12,10,11,11,14, 14,10,11,11,14,14, 7, 9, 9,12,12, 9,11,11,13,12, 9,11,11,13,13,12,12,12,14,14,11,12,13,15,15, 7, 9, 9,12,11, 9,11,10,12,12, 9,11,11,12,13,11,12, 11,14,14,11,12,12,15,16, 9,11,11,15,15,11,12,12, 16,15,10,12,12,16,15,14,15,15,17,16,13,14,14,17, 17, 9,11,11,14,15,10,12,11,15,15,10,12,12,15,17, 13,14,13,16,15,13,14,15,17,17, 5, 7, 7,10,10, 7, 9, 9,12,11, 7, 9, 9,11,12,10,11,11,14,14,10,11, 11,13,14, 7, 9, 9,11,12, 9,11,11,13,13, 9,10,11, 12,12,11,12,12,15,15,11,12,12,13,14, 7,10, 9,12, 12, 9,11,11,13,13, 9,11,11,12,12,11,12,12,16,15, 11,12,12,14,14, 9,11,11,15,14,10,12,12,16,15,10, 11,12,15,15,13,14,14,17,18,13,13,14,15,16, 9,11, 11,15,16,10,12,12,15,15,11,12,12,14,17,13,14,14, 17,17,14,14,14,16,18, 7,10,10,14,15,10,12,12,16, 15,10,11,12,16,16,14,16,15,18,17,13,15,14,17,19, 9,11,12,16,15,11,13,13,17,16,10,13,13,16,16,15, 16,16,17,19,13,15,15,17,17, 8,11,11,15,15,10,13, 11,16,16,10,13,13,16,17,14,16,15,18,19,13,15,15, 17,17,12,14,14,18,18,13,14,15,18,19,12,14,15,17, 18,16,18,18,19, 0,14,15,16,18,18,11,14,13,17,18, 12,16,14,19,19,12,15,14, 0,18,15,17,16,18,17,14, 17,16,18,18, 7,10,10,15,14,10,12,11,16,16,10,11, 12,16,16,13,15,14,19,18,14,15,16,18,18, 8,11,11, 15,15,10,13,12,17,16,10,12,13,16,17,14,14,15,19, 18,14,15,16,18, 0, 9,11,11,16,15,11,13,12,15,16, 11,13,13,16,16,14,15,14, 0,17,15,16,16,19,18,11, 14,14,18,17,12,14,15,17,17,12,13,15, 0,17,14,15, 16,18,17,16,17,18,17,19,11,14,13,17,19,12,15,14, 18,19,13,16,14, 0,19,14,17,15, 0,18,15,18,16, 0, 0, }; static float _vq_quantthresh__44u1__p3_0[] = { -1.5, -0.5, 0.5, 1.5, }; static long _vq_quantmap__44u1__p3_0[] = { 3, 1, 0, 2, 4, }; static encode_aux_threshmatch _vq_auxt__44u1__p3_0 = { _vq_quantthresh__44u1__p3_0, _vq_quantmap__44u1__p3_0, 5, 5 }; static static_codebook _44u1__p3_0 = { 4, 625, _vq_lengthlist__44u1__p3_0, 1, -533725184, 1611661312, 3, 0, _vq_quantlist__44u1__p3_0, NULL, &_vq_auxt__44u1__p3_0, NULL, 0 }; static long _vq_quantlist__44u1__p4_0[] = { 2, 1, 3, 0, 4, }; static long _vq_lengthlist__44u1__p4_0[] = { 4, 5, 5, 8, 8, 6, 7, 6, 9, 9, 6, 6, 7, 9, 9, 9, 9, 9,11,11, 9, 9, 9,11,11, 6, 7, 7, 9, 9, 7, 8, 8,10,10, 6, 7, 8, 9,10,10,10,10,11,12, 9, 9,10, 11,12, 6, 7, 7, 9, 9, 6, 8, 7,10, 9, 7, 8, 8,10, 10, 9,10, 9,12,11,10,10,10,12,11, 9,10,10,12,12, 10,10,10,13,12, 9,10,10,12,12,12,12,12,14,14,11, 12,12,13,14, 9,10,10,12,12, 9,10,10,13,12,10,10, 10,12,13,12,12,12,14,13,12,12,12,14,14, 5, 7, 7, 9, 9, 7, 8, 7,10,10, 7, 7, 8,10,10,10,10,10,12, 12,10,10,10,12,12, 7, 8, 8,10,10, 8, 8, 9,10,11, 8, 8, 8,11,11,10,10,11,11,13,10,11,11,12,13, 6, 7, 7,10,10, 7, 8, 8,11,10, 8, 8, 9,11,11,10,11, 10,13,11,10,11,11,13,12,10,11,10,13,12,10,10,11, 13,13,10,11,11,13,13,12,11,13,12,14,12,13,13,15, 15, 9,10,10,12,13,10,11,10,13,13,10,11,11,13,14, 12,13,11,14,12,12,13,13,14,15, 5, 7, 7, 9,10, 7, 8, 7,10,10, 7, 7, 8,10,10,10,10,10,12,12,10,10, 10,12,12, 6, 7, 7,10,10, 8, 9, 8,11,11, 7, 8, 8, 10,11,10,11,11,12,13,10,10,11,11,13, 7, 8, 8,10, 10, 8, 8, 8,11,11, 8, 9, 8,11,10,10,11,10,13,12, 10,11,10,13,12, 9,10,10,13,12,10,11,11,13,13, 9, 10,10,12,13,13,13,13,15,14,12,11,13,12,15,10,10, 11,12,13,10,11,11,13,13,10,11,10,13,13,12,13,13, 15,15,12,13,11,14,12, 8,10, 9,12,12, 9,10,10,13, 13, 9,10,10,13,13,13,13,13,14,15,12,12,12,14,14, 9,10,10,13,12,10,11,11,13,13,10,11,11,13,12,13, 13,14,14,16,12,13,13,15,14, 9,10,10,13,13,10,11, 10,13,13,10,11,11,13,13,13,14,12,15,14,12,13,13, 14,15,12,12,12,14,14,11,12,12,14,15,12,13,13,15, 14,14,12,15,12,16,14,14,15,17,16,11,12,12,14,14, 11,12,11,15,14,12,13,13,15,15,13,14,12,16,13,14, 14,15,17,16, 8,10,10,12,12, 9,10,10,13,12,10,10, 10,13,13,12,13,12,14,14,12,13,13,15,14, 9,10,10, 13,13,10,11,11,13,13,10,10,11,12,13,13,13,13,15, 15,12,12,13,14,15, 9,10,10,12,13,10,11,11,12,13, 10,11,10,13,13,12,13,13,14,15,13,14,13,15,14,11, 12,12,15,14,12,13,13,15,14,11,12,12,14,15,14,14, 14,17,15,13,12,15,13,16,12,12,12,14,15,12,13,13, 14,15,11,12,12,15,14,14,15,14,16,17,13,15,12,16, 12, }; static float _vq_quantthresh__44u1__p4_0[] = { -1.5, -0.5, 0.5, 1.5, }; static long _vq_quantmap__44u1__p4_0[] = { 3, 1, 0, 2, 4, }; static encode_aux_threshmatch _vq_auxt__44u1__p4_0 = { _vq_quantthresh__44u1__p4_0, _vq_quantmap__44u1__p4_0, 5, 5 }; static static_codebook _44u1__p4_0 = { 4, 625, _vq_lengthlist__44u1__p4_0, 1, -533725184, 1611661312, 3, 0, _vq_quantlist__44u1__p4_0, NULL, &_vq_auxt__44u1__p4_0, NULL, 0 }; static long _vq_quantlist__44u1__p5_0[] = { 4, 3, 5, 2, 6, 1, 7, 0, 8, }; static long _vq_lengthlist__44u1__p5_0[] = { 1, 4, 4, 7, 7, 8, 8,10,10, 4, 6, 5, 8, 8, 8, 8, 10,10, 4, 5, 6, 8, 8, 8, 8,10,10, 7, 8, 7, 9, 9, 9, 9,11,11, 7, 8, 8, 9, 9, 9, 9,11,11, 8, 8, 8, 9, 9,10,11,12,12, 8, 8, 9, 9, 9,10,10,12,12,10, 10,10,11,11,12,12,13,13,10,10,10,11,11,12,12,13, 13, }; static float _vq_quantthresh__44u1__p5_0[] = { -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, }; static long _vq_quantmap__44u1__p5_0[] = { 7, 5, 3, 1, 0, 2, 4, 6, 8, }; static encode_aux_threshmatch _vq_auxt__44u1__p5_0 = { _vq_quantthresh__44u1__p5_0, _vq_quantmap__44u1__p5_0, 9, 9 }; static static_codebook _44u1__p5_0 = { 2, 81, _vq_lengthlist__44u1__p5_0, 1, -531628032, 1611661312, 4, 0, _vq_quantlist__44u1__p5_0, NULL, &_vq_auxt__44u1__p5_0, NULL, 0 }; static long _vq_quantlist__44u1__p6_0[] = { 6, 5, 7, 4, 8, 3, 9, 2, 10, 1, 11, 0, 12, }; static long _vq_lengthlist__44u1__p6_0[] = { 1, 4, 4, 7, 7, 9, 8,10, 9,11,10,14,13, 4, 5, 5, 8, 8, 9, 9,11,11,11,11,14,14, 4, 5, 5, 8, 8, 9, 9,10,11,11,11,14,14, 7, 8, 8, 9, 9,11,10,11,11, 12,12,16,15, 7, 8, 8, 9, 9,10,11,11,11,12,12,15, 15, 9,10,10,11,11,11,11,12,12,13,13,16,16, 9,10, 10,11,11,11,11,12,12,12,13,16,15,10,11,11,11,11, 12,12,13,13,13,13,16,17,10,11,11,11,11,12,12,12, 12,13,14,16,16,11,12,12,12,12,13,13,14,14,14,15, 18,17,11,12,12,12,12,13,13,13,14,14,15,18,18,15, 14,15,15,15,16,16,17,17,18,17,20,20,14,15,15,15, 15,16,17,17,16,18, 0,19, 0, }; static float _vq_quantthresh__44u1__p6_0[] = { -27.5, -22.5, -17.5, -12.5, -7.5, -2.5, 2.5, 7.5, 12.5, 17.5, 22.5, 27.5, }; static long _vq_quantmap__44u1__p6_0[] = { 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, }; static encode_aux_threshmatch _vq_auxt__44u1__p6_0 = { _vq_quantthresh__44u1__p6_0, _vq_quantmap__44u1__p6_0, 13, 13 }; static static_codebook _44u1__p6_0 = { 2, 169, _vq_lengthlist__44u1__p6_0, 1, -526516224, 1616117760, 4, 0, _vq_quantlist__44u1__p6_0, NULL, &_vq_auxt__44u1__p6_0, NULL, 0 }; static long _vq_quantlist__44u1__p6_1[] = { 2, 1, 3, 0, 4, }; static long _vq_lengthlist__44u1__p6_1[] = { 2, 4, 4, 5, 5, 4, 5, 5, 6, 5, 4, 5, 5, 5, 6, 5, 6, 5, 6, 6, 5, 5, 6, 6, 6, }; static float _vq_quantthresh__44u1__p6_1[] = { -1.5, -0.5, 0.5, 1.5, }; static long _vq_quantmap__44u1__p6_1[] = { 3, 1, 0, 2, 4, }; static encode_aux_threshmatch _vq_auxt__44u1__p6_1 = { _vq_quantthresh__44u1__p6_1, _vq_quantmap__44u1__p6_1, 5, 5 }; static static_codebook _44u1__p6_1 = { 2, 25, _vq_lengthlist__44u1__p6_1, 1, -533725184, 1611661312, 3, 0, _vq_quantlist__44u1__p6_1, NULL, &_vq_auxt__44u1__p6_1, NULL, 0 }; static long _vq_quantlist__44u1__p7_0[] = { 3, 2, 4, 1, 5, 0, 6, }; static long _vq_lengthlist__44u1__p7_0[] = { 1, 3, 3, 9, 9, 9, 9, 5, 7, 7, 9, 9, 9, 9, 5, 6, 6, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, }; static float _vq_quantthresh__44u1__p7_0[] = { -422.5, -253.5, -84.5, 84.5, 253.5, 422.5, }; static long _vq_quantmap__44u1__p7_0[] = { 5, 3, 1, 0, 2, 4, 6, }; static encode_aux_threshmatch _vq_auxt__44u1__p7_0 = { _vq_quantthresh__44u1__p7_0, _vq_quantmap__44u1__p7_0, 7, 7 }; static static_codebook _44u1__p7_0 = { 2, 49, _vq_lengthlist__44u1__p7_0, 1, -518017024, 1626677248, 3, 0, _vq_quantlist__44u1__p7_0, NULL, &_vq_auxt__44u1__p7_0, NULL, 0 }; static long _vq_quantlist__44u1__p7_1[] = { 6, 5, 7, 4, 8, 3, 9, 2, 10, 1, 11, 0, 12, }; static long _vq_lengthlist__44u1__p7_1[] = { 1, 4, 4, 6, 6, 6, 7, 8, 8, 9, 9,11,10, 4, 7, 7, 8, 8, 8, 8, 9, 9,11,10,12,11, 4, 6, 7, 8, 8, 8, 8,10,10,10,11,12,11, 7, 8, 8, 9, 9,10,10,11,11, 12,12,13,13, 7, 8, 8, 9, 9,10,10,11,11,12,12,13, 13, 7, 8, 8,10,10,13,12,13,13,16,13,13,14, 7, 8, 8,10,11,12,12,13,13,14,14,14,14, 8,10,10,13,12, 13,13,16,14,15,15,16,15, 8,10,11,12,13,13,13,13, 16,15,16,16,14,10,12,13,14,15,15,14,14,14,15,16, 15,16,10,11,12,13,13,15,15,16,16,16,14,16,16,12, 13,13,15,14,15,14,15,15,14,15,16,16,11,14,14,15, 14,16,15,16,14,15,16,14,15, }; static float _vq_quantthresh__44u1__p7_1[] = { -71.5, -58.5, -45.5, -32.5, -19.5, -6.5, 6.5, 19.5, 32.5, 45.5, 58.5, 71.5, }; static long _vq_quantmap__44u1__p7_1[] = { 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, }; static encode_aux_threshmatch _vq_auxt__44u1__p7_1 = { _vq_quantthresh__44u1__p7_1, _vq_quantmap__44u1__p7_1, 13, 13 }; static static_codebook _44u1__p7_1 = { 2, 169, _vq_lengthlist__44u1__p7_1, 1, -523010048, 1618608128, 4, 0, _vq_quantlist__44u1__p7_1, NULL, &_vq_auxt__44u1__p7_1, NULL, 0 }; static long _vq_quantlist__44u1__p7_2[] = { 6, 5, 7, 4, 8, 3, 9, 2, 10, 1, 11, 0, 12, }; static long _vq_lengthlist__44u1__p7_2[] = { 2, 5, 5, 6, 6, 7, 7, 8, 8, 8, 8, 8, 8, 5, 6, 6, 6, 7, 8, 7, 8, 8, 8, 9, 9, 9, 5, 6, 6, 7, 7, 8, 8, 8, 8, 8, 8, 8, 9, 6, 7, 7, 7, 7, 8, 8, 8, 9, 9, 9, 9, 9, 6, 7, 7, 7, 7, 8, 8, 9, 9, 9, 9, 9, 9, 7, 8, 8, 8, 8, 8, 8, 9, 8, 9, 9, 9, 9, 7, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 8, 8, 9, 9, 9, 8, 9, 9, 9, 9, 9, 9, 9, 8, 8, 8, 9, 9, 9, 8, 9, 9, 9, 9, 9, 9, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, }; static float _vq_quantthresh__44u1__p7_2[] = { -5.5, -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, }; static long _vq_quantmap__44u1__p7_2[] = { 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, }; static encode_aux_threshmatch _vq_auxt__44u1__p7_2 = { _vq_quantthresh__44u1__p7_2, _vq_quantmap__44u1__p7_2, 13, 13 }; static static_codebook _44u1__p7_2 = { 2, 169, _vq_lengthlist__44u1__p7_2, 1, -531103744, 1611661312, 4, 0, _vq_quantlist__44u1__p7_2, NULL, &_vq_auxt__44u1__p7_2, NULL, 0 }; static long _huff_lengthlist__44u1__short[] = { 7,12,12,14,16,13,12,15, 6, 9,10,13,11,11,12,12, 4, 5, 5, 8, 5, 7, 9,12, 6, 7, 8,10, 8, 9,11,16, 5, 5, 4, 7, 4, 5, 7,15, 6, 5, 5, 8, 5, 5, 6,15, 8, 7, 4, 7, 3, 4, 5,16,15,11, 6, 8, 5, 6, 8,16, }; static static_codebook _huff_book__44u1__short = { 2, 64, _huff_lengthlist__44u1__short, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _huff_lengthlist__44u2__long[] = { 8,14,15,15,17,15,12,13,13, 3, 4, 7, 8, 7, 8,11, 20, 4, 3, 6, 5, 7, 9,16,15, 6, 5, 6, 6, 6, 8,15, 20, 7, 4, 6, 4, 5, 8,18,16, 7, 6, 6, 5, 5, 6,14, 11, 7, 8, 7, 7, 5, 4,10,10,13,15,16,19,10, 6,10, }; static static_codebook _huff_book__44u2__long = { 2, 64, _huff_lengthlist__44u2__long, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _vq_quantlist__44u2__p1_0[] = { 1, 0, 2, }; static long _vq_lengthlist__44u2__p1_0[] = { 1, 4, 4, 5, 8, 7, 5, 7, 8, 5, 8, 8, 8,11,11, 8, 10,11, 5, 8, 8, 8,11,10, 8,11,11, 4, 8, 8, 8,11, 11, 8,11,11, 8,11,11,11,13,14,11,13,13, 8,11,11, 10,13,12,11,13,14, 4, 8, 8, 8,11,11, 8,11,11, 7, 11,11,11,14,13,10,12,13, 8,11,11,11,14,13,11,13, 13, }; static float _vq_quantthresh__44u2__p1_0[] = { -0.5, 0.5, }; static long _vq_quantmap__44u2__p1_0[] = { 1, 0, 2, }; static encode_aux_threshmatch _vq_auxt__44u2__p1_0 = { _vq_quantthresh__44u2__p1_0, _vq_quantmap__44u2__p1_0, 3, 3 }; static static_codebook _44u2__p1_0 = { 4, 81, _vq_lengthlist__44u2__p1_0, 1, -535822336, 1611661312, 2, 0, _vq_quantlist__44u2__p1_0, NULL, &_vq_auxt__44u2__p1_0, NULL, 0 }; static long _vq_quantlist__44u2__p2_0[] = { 1, 0, 2, }; static long _vq_lengthlist__44u2__p2_0[] = { 3, 4, 4, 5, 6, 6, 5, 6, 6, 5, 6, 6, 6, 8, 8, 6, 7, 8, 5, 6, 6, 6, 8, 7, 6, 8, 8, 5, 6, 6, 6, 8, 7, 6, 7, 8, 6, 8, 8, 8, 9, 9, 8, 9, 9, 6, 8, 8, 7, 9, 8, 8, 9, 9, 5, 6, 6, 6, 8, 8, 6, 7, 8, 6, 8, 8, 8, 9, 9, 7, 8, 9, 6, 8, 8, 8, 9, 9, 8, 9, 9, }; static float _vq_quantthresh__44u2__p2_0[] = { -0.5, 0.5, }; static long _vq_quantmap__44u2__p2_0[] = { 1, 0, 2, }; static encode_aux_threshmatch _vq_auxt__44u2__p2_0 = { _vq_quantthresh__44u2__p2_0, _vq_quantmap__44u2__p2_0, 3, 3 }; static static_codebook _44u2__p2_0 = { 4, 81, _vq_lengthlist__44u2__p2_0, 1, -535822336, 1611661312, 2, 0, _vq_quantlist__44u2__p2_0, NULL, &_vq_auxt__44u2__p2_0, NULL, 0 }; static long _vq_quantlist__44u2__p3_0[] = { 2, 1, 3, 0, 4, }; static long _vq_lengthlist__44u2__p3_0[] = { 2, 4, 4, 8, 8, 5, 7, 7, 9, 9, 5, 7, 7, 9, 9, 8, 9, 9,12,12, 8, 9,10,11,12, 5, 7, 7,10,10, 7, 9, 9,11,10, 7, 8, 9,10,11,10,11,10,14,13, 9,10,10, 12,13, 5, 7, 7,10,10, 7, 9, 8,11,10, 7, 9, 9,11, 11, 9,10,10,13,12,10,10,11,13,13, 8,10,10,15,13, 10,11,11,15,13, 9,11,11,14,13,13,14,13,17,15,12, 13,13,15,15, 8,10,10,13,14, 9,11,11,13,14,10,11, 12,13,16,12,13,13,15,15,13,13,14,15,17, 5, 7, 7, 10,10, 7, 9, 9,11,11, 7, 9, 9,11,12,10,11,11,14, 14,10,11,12,14,14, 7, 9, 9,12,12, 9,11,11,13,12, 9,11,11,13,13,12,13,12,14,14,11,12,12,15,14, 7, 9, 9,12,11, 9,11,10,13,11, 9,11,11,12,13,11,12, 11,14,13,11,12,12,15,15,10,12,12,16,15,11,13,13, 16,16,10,12,12,16,16,14,14,14,17,16,13,14,14,17, 18, 9,11,11,14,15,10,12,11,15,15,10,12,12,15,17, 13,15,13,17,16,13,14,15,17,19, 5, 7, 7,10,10, 7, 9, 9,12,11, 7, 9, 9,11,11,10,11,11,15,14,10,11, 12,13,14, 7, 9, 9,12,12, 9,11,11,13,12, 8,10,11, 12,12,11,12,12,15,15,11,11,12,14,14, 7, 9, 9,12, 12, 9,11,11,13,13, 9,11,11,12,12,11,12,12,16,15, 11,12,13,14,14, 9,11,11,16,15,10,12,12,16,15,10, 11,12,14,14,13,14,15,18,17,13,13,14,16,16,10,12, 12,15,15,10,13,12,15,17,11,13,12,15,16,13,15,14, 17,18,14,15,14,15,17, 8,10,10,15,15,10,12,12,17, 15,10,12,12,17,16,14,16,15,17,17,13,14,15,16,16, 9,11,12,16,16,11,13,13,16,17,11,13,13,16,16,15, 16,16, 0, 0,14,15,15,19,17, 9,11,11,17,16,10,13, 11,16,16,11,12,12,16,17,15,16,15,19,19,14,16,15, 0,18,12,14,15, 0, 0,14,15,16,18,18,13,14,15,17, 17,16,18,18, 0, 0,15,16,16,19,18,11,14,13, 0,18, 13,16,13,17,17,13,15,14, 0, 0,17,17,15,19,18,14, 16,16,19, 0, 8,10,10,15,15,10,12,11,16,16,10,11, 12,17,16,14,15,15,17,18,15,15,16, 0, 0, 9,11,11, 15,15,11,13,12,16,18,10,12,13,17,17,13,15,15,17, 19,15,15,16,19,18, 9,12,11, 0,16,11,13,12,16,16, 11,13,13,16,17,14,16,15,19,19,15,15,16,18,18,12, 14,14,17,18,13,14,15,18, 0,13,14,15,18,19,15,17, 16, 0,19,16,15,18,17,19,12,14,14,19,19,13,15,15, 0,18,13,17,15,18,18,15,16,17, 0,19,17,19,18,18, 0, }; static float _vq_quantthresh__44u2__p3_0[] = { -1.5, -0.5, 0.5, 1.5, }; static long _vq_quantmap__44u2__p3_0[] = { 3, 1, 0, 2, 4, }; static encode_aux_threshmatch _vq_auxt__44u2__p3_0 = { _vq_quantthresh__44u2__p3_0, _vq_quantmap__44u2__p3_0, 5, 5 }; static static_codebook _44u2__p3_0 = { 4, 625, _vq_lengthlist__44u2__p3_0, 1, -533725184, 1611661312, 3, 0, _vq_quantlist__44u2__p3_0, NULL, &_vq_auxt__44u2__p3_0, NULL, 0 }; static long _vq_quantlist__44u2__p4_0[] = { 2, 1, 3, 0, 4, }; static long _vq_lengthlist__44u2__p4_0[] = { 4, 5, 5, 9, 9, 6, 7, 6, 9, 9, 6, 6, 7, 9, 9, 9, 10, 9,12,11, 9, 9,10,11,12, 6, 7, 7,10,10, 7, 8, 7,10,10, 7, 7, 8,10,10,10,10,10,12,12, 9,10,10, 11,12, 6, 7, 7,10,10, 7, 8, 7,10,10, 7, 7, 7,10, 10, 9,10,10,12,11,10,10,10,12,12, 9,10,10,13,12, 10,10,10,13,13,10,10,10,13,12,12,12,12,14,14,12, 12,12,14,14, 9,10,10,12,13, 9,10,10,13,13,10,10, 10,13,13,12,12,12,15,14,12,13,12,14,14, 5, 7, 7, 10,10, 7, 8, 7,10,10, 7, 7, 8,10,10,10,10,10,12, 12,10,10,10,12,12, 7, 8, 8,10,10, 8, 8, 8,10,11, 8, 8, 8,11,10,10,10,11,11,13,10,10,11,12,13, 6, 7, 7,10,10, 7, 8, 7,11,10, 8, 8, 8,10,11,10,11, 10,13,11,10,10,10,13,12,10,11,10,13,13,10,10,10, 12,13,10,11,11,13,13,12,11,13,11,14,12,13,13,14, 14, 9,10,10,12,13,10,10,10,13,12,10,10,11,13,13, 12,13,11,14,12,13,13,13,15,14, 5, 7, 7,10,10, 7, 7, 7,10,10, 7, 7, 8,10,10,10,10,10,12,12,10,10, 10,12,13, 6, 7, 7,10,10, 8, 8, 8,11,10, 7, 7, 8, 10,11,10,10,10,12,12,10,10,11,11,13, 7, 8, 8,10, 10, 7, 8, 8,10,11, 8, 8, 8,11,10,10,11,10,13,12, 10,11,10,13,11, 9,10,10,13,13,10,11,11,13,13,10, 10,10,12,13,13,13,13,14,14,12,11,13,12,14,10,10, 11,13,13,10,11,11,13,13,10,10,10,13,12,12,13,13, 14,14,12,13,11,15,12, 9,10,10,13,13,10,10,10,13, 13,10,10,10,13,13,13,13,13,15,15,12,13,13,14,14, 9,10,10,13,13,10,10,11,13,13,10,11,10,13,12,13, 12,13,14,15,13,13,13,15,14, 9,10,10,13,13,10,10, 10,13,12,10,10,11,12,13,13,13,12,15,14,13,13,13, 14,14,12,13,12,15,14,12,11,12,14,14,12,13,12,15, 14,14,12,15,12,16,14,14,15,16,16,12,12,12,14,15, 11,12,11,15,14,12,13,13,14,15,14,14,12,16,13,14, 14,15,16,16, 9,10,10,13,13,10,10,10,13,13,10,10, 10,13,13,12,13,12,14,14,13,13,13,15,15, 9,10,10, 13,13,10,11,10,13,12,10,10,10,12,13,13,13,13,14, 14,12,12,13,14,15, 9,10,10,13,13,10,10,11,12,13, 10,11,10,13,13,13,13,13,14,15,13,13,13,15,14,12, 12,12,15,14,12,13,12,15,14,11,11,12,14,15,14,14, 14,17,16,14,12,14,13,17,12,12,13,14,16,13,13,13, 13,15,12,12,11,14,14,14,15,14,16,16,14,14,12,16, 12, }; static float _vq_quantthresh__44u2__p4_0[] = { -1.5, -0.5, 0.5, 1.5, }; static long _vq_quantmap__44u2__p4_0[] = { 3, 1, 0, 2, 4, }; static encode_aux_threshmatch _vq_auxt__44u2__p4_0 = { _vq_quantthresh__44u2__p4_0, _vq_quantmap__44u2__p4_0, 5, 5 }; static static_codebook _44u2__p4_0 = { 4, 625, _vq_lengthlist__44u2__p4_0, 1, -533725184, 1611661312, 3, 0, _vq_quantlist__44u2__p4_0, NULL, &_vq_auxt__44u2__p4_0, NULL, 0 }; static long _vq_quantlist__44u2__p5_0[] = { 4, 3, 5, 2, 6, 1, 7, 0, 8, }; static long _vq_lengthlist__44u2__p5_0[] = { 2, 4, 4, 6, 6, 7, 7, 9, 9, 4, 5, 4, 7, 7, 8, 7, 9, 9, 4, 4, 4, 7, 7, 7, 8, 9, 9, 6, 7, 7, 8, 8, 8, 9,10,10, 6, 7, 7, 8, 8, 9, 8,10,10, 7, 8, 7, 8, 9, 9,10,11,11, 7, 7, 8, 9, 9,10,10,11,11, 9, 9, 9,10,10,11,11,12,12, 9, 9, 9,10,10,11,11,12, 12, }; static float _vq_quantthresh__44u2__p5_0[] = { -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, }; static long _vq_quantmap__44u2__p5_0[] = { 7, 5, 3, 1, 0, 2, 4, 6, 8, }; static encode_aux_threshmatch _vq_auxt__44u2__p5_0 = { _vq_quantthresh__44u2__p5_0, _vq_quantmap__44u2__p5_0, 9, 9 }; static static_codebook _44u2__p5_0 = { 2, 81, _vq_lengthlist__44u2__p5_0, 1, -531628032, 1611661312, 4, 0, _vq_quantlist__44u2__p5_0, NULL, &_vq_auxt__44u2__p5_0, NULL, 0 }; static long _vq_quantlist__44u2__p6_0[] = { 6, 5, 7, 4, 8, 3, 9, 2, 10, 1, 11, 0, 12, }; static long _vq_lengthlist__44u2__p6_0[] = { 1, 4, 4, 6, 6, 8, 8, 9,10,11,11,14,14, 4, 6, 5, 8, 8, 9, 9,11,11,11,11,14,14, 4, 5, 5, 8, 8, 9, 9,10,11,11,12,14,14, 7, 8, 8, 9, 9,11,10,11,11, 12,12,15,15, 7, 8, 8, 9, 9,11,11,11,11,12,12,15, 14, 9,10,10,11,11,11,11,12,12,13,12,16,16, 9,10, 10,11,11,11,11,12,12,13,13,15,16,10,11,11,11,11, 12,12,13,13,13,13,17,16,10,11,11,12,12,12,12,12, 13,14,14,16,16,11,12,12,12,12,13,13,14,14,14,14, 17,17,11,12,12,12,12,13,13,14,14,15,14,18,17,15, 14,15,15,15,16,16,17,18,19,17,19, 0,15,15,15,15, 15,16,17,16,16,18,17, 0, 0, }; static float _vq_quantthresh__44u2__p6_0[] = { -27.5, -22.5, -17.5, -12.5, -7.5, -2.5, 2.5, 7.5, 12.5, 17.5, 22.5, 27.5, }; static long _vq_quantmap__44u2__p6_0[] = { 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, }; static encode_aux_threshmatch _vq_auxt__44u2__p6_0 = { _vq_quantthresh__44u2__p6_0, _vq_quantmap__44u2__p6_0, 13, 13 }; static static_codebook _44u2__p6_0 = { 2, 169, _vq_lengthlist__44u2__p6_0, 1, -526516224, 1616117760, 4, 0, _vq_quantlist__44u2__p6_0, NULL, &_vq_auxt__44u2__p6_0, NULL, 0 }; static long _vq_quantlist__44u2__p6_1[] = { 2, 1, 3, 0, 4, }; static long _vq_lengthlist__44u2__p6_1[] = { 2, 4, 4, 5, 5, 4, 5, 5, 6, 5, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 5, 5, 6, 6, 6, }; static float _vq_quantthresh__44u2__p6_1[] = { -1.5, -0.5, 0.5, 1.5, }; static long _vq_quantmap__44u2__p6_1[] = { 3, 1, 0, 2, 4, }; static encode_aux_threshmatch _vq_auxt__44u2__p6_1 = { _vq_quantthresh__44u2__p6_1, _vq_quantmap__44u2__p6_1, 5, 5 }; static static_codebook _44u2__p6_1 = { 2, 25, _vq_lengthlist__44u2__p6_1, 1, -533725184, 1611661312, 3, 0, _vq_quantlist__44u2__p6_1, NULL, &_vq_auxt__44u2__p6_1, NULL, 0 }; static long _vq_quantlist__44u2__p7_0[] = { 4, 3, 5, 2, 6, 1, 7, 0, 8, }; static long _vq_lengthlist__44u2__p7_0[] = { 1, 3, 3,10,10,10,10,10,10, 4,10,10,10,10,10,10, 10,10, 4,10,10,10,10,10,10,10,10,10,10, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, }; static float _vq_quantthresh__44u2__p7_0[] = { -591.5, -422.5, -253.5, -84.5, 84.5, 253.5, 422.5, 591.5, }; static long _vq_quantmap__44u2__p7_0[] = { 7, 5, 3, 1, 0, 2, 4, 6, 8, }; static encode_aux_threshmatch _vq_auxt__44u2__p7_0 = { _vq_quantthresh__44u2__p7_0, _vq_quantmap__44u2__p7_0, 9, 9 }; static static_codebook _44u2__p7_0 = { 2, 81, _vq_lengthlist__44u2__p7_0, 1, -516612096, 1626677248, 4, 0, _vq_quantlist__44u2__p7_0, NULL, &_vq_auxt__44u2__p7_0, NULL, 0 }; static long _vq_quantlist__44u2__p7_1[] = { 6, 5, 7, 4, 8, 3, 9, 2, 10, 1, 11, 0, 12, }; static long _vq_lengthlist__44u2__p7_1[] = { 1, 4, 4, 6, 6, 7, 7, 8, 7, 9, 9,10,10, 4, 7, 6, 8, 8, 8, 8,10, 9,11,10,12,12, 4, 6, 7, 8, 8, 8, 8,10,10,11,11,12,12, 7, 8, 8,10, 9,10,10,12,11, 13,12,13,13, 7, 8, 8, 9, 9,10,10,11,11,13,13,14, 15, 7, 8, 9,10,10,12,11,14,13,13,14,14,15, 7, 8, 9,10,10,11,12,13,13,15,14,14,15, 8,10,10,12,11, 13,13,15,15,15,17,15,15, 8,10,10,11,12,14,13,14, 15,17,15,15,15,10,11,11,14,13,14,14,15,15,17,17, 16,17,10,11,12,13,13,14,14,14,15,16,15,15,17,11, 12,13,14,13,16,16,16,14,17,16,17,17,11,12,13,15, 15,15,15,16,15,15,15,15,17, }; static float _vq_quantthresh__44u2__p7_1[] = { -71.5, -58.5, -45.5, -32.5, -19.5, -6.5, 6.5, 19.5, 32.5, 45.5, 58.5, 71.5, }; static long _vq_quantmap__44u2__p7_1[] = { 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, }; static encode_aux_threshmatch _vq_auxt__44u2__p7_1 = { _vq_quantthresh__44u2__p7_1, _vq_quantmap__44u2__p7_1, 13, 13 }; static static_codebook _44u2__p7_1 = { 2, 169, _vq_lengthlist__44u2__p7_1, 1, -523010048, 1618608128, 4, 0, _vq_quantlist__44u2__p7_1, NULL, &_vq_auxt__44u2__p7_1, NULL, 0 }; static long _vq_quantlist__44u2__p7_2[] = { 6, 5, 7, 4, 8, 3, 9, 2, 10, 1, 11, 0, 12, }; static long _vq_lengthlist__44u2__p7_2[] = { 2, 5, 5, 6, 6, 7, 7, 8, 8, 8, 8, 8, 8, 5, 6, 6, 7, 7, 8, 8, 8, 8, 8, 8, 9, 9, 5, 6, 6, 7, 7, 8, 7, 8, 8, 8, 8, 8, 8, 6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 7, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 7, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 8, 8, 8, 9, 8, 9, 9, 9, 9, 9, 9, 9, 9, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, }; static float _vq_quantthresh__44u2__p7_2[] = { -5.5, -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, }; static long _vq_quantmap__44u2__p7_2[] = { 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, }; static encode_aux_threshmatch _vq_auxt__44u2__p7_2 = { _vq_quantthresh__44u2__p7_2, _vq_quantmap__44u2__p7_2, 13, 13 }; static static_codebook _44u2__p7_2 = { 2, 169, _vq_lengthlist__44u2__p7_2, 1, -531103744, 1611661312, 4, 0, _vq_quantlist__44u2__p7_2, NULL, &_vq_auxt__44u2__p7_2, NULL, 0 }; static long _huff_lengthlist__44u2__short[] = { 16,15,15,16,14,16,16,16,16, 9, 8,11,10,10,10,15, 16, 6, 3, 7, 5, 7, 9,16,16,11, 7,11, 9,10,12,16, 16, 9, 4, 8, 3, 5, 8,16,16,11, 6, 9, 4, 4, 7,16, 16,11, 5, 9, 3, 3, 5,12,16,15, 6,11, 5, 5, 6,14, }; static static_codebook _huff_book__44u2__short = { 2, 64, _huff_lengthlist__44u2__short, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _huff_lengthlist__44u3__long[] = { 7,11,14,13,14,12,12,12,12, 2, 5, 8, 9, 8, 9,11, 17, 4, 3, 6, 5, 7, 9,15,14, 6, 6, 7, 7, 7, 8,14, 17, 8, 5, 7, 4, 5, 7,15,13, 7, 6, 7, 5, 5, 6,14, 10, 8, 8, 7, 7, 5, 4, 9,10,12,15,14,16,10, 6, 9, }; static static_codebook _huff_book__44u3__long = { 2, 64, _huff_lengthlist__44u3__long, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _vq_quantlist__44u3__p1_0[] = { 1, 0, 2, }; static long _vq_lengthlist__44u3__p1_0[] = { 1, 4, 4, 5, 8, 7, 5, 7, 8, 5, 8, 8, 8,11,11, 8, 10,11, 5, 8, 8, 8,11,10, 8,11,11, 4, 8, 8, 8,11, 11, 8,11,11, 8,11,11,11,13,14,11,13,14, 7,11,11, 10,13,11,11,13,14, 4, 8, 8, 8,11,11, 8,11,11, 8, 11,11,11,14,14,10,12,14, 8,11,11,11,14,13,11,14, 13, }; static float _vq_quantthresh__44u3__p1_0[] = { -0.5, 0.5, }; static long _vq_quantmap__44u3__p1_0[] = { 1, 0, 2, }; static encode_aux_threshmatch _vq_auxt__44u3__p1_0 = { _vq_quantthresh__44u3__p1_0, _vq_quantmap__44u3__p1_0, 3, 3 }; static static_codebook _44u3__p1_0 = { 4, 81, _vq_lengthlist__44u3__p1_0, 1, -535822336, 1611661312, 2, 0, _vq_quantlist__44u3__p1_0, NULL, &_vq_auxt__44u3__p1_0, NULL, 0 }; static long _vq_quantlist__44u3__p2_0[] = { 1, 0, 2, }; static long _vq_lengthlist__44u3__p2_0[] = { 3, 4, 4, 5, 6, 6, 5, 6, 6, 5, 6, 6, 6, 8, 8, 6, 7, 8, 5, 6, 6, 6, 8, 7, 6, 8, 8, 5, 6, 6, 6, 8, 7, 6, 8, 8, 6, 8, 8, 8, 8, 9, 8, 9, 9, 6, 8, 7, 7, 9, 8, 8, 9, 9, 5, 6, 6, 6, 8, 8, 6, 8, 8, 6, 8, 8, 8, 9, 9, 7, 8, 9, 6, 8, 8, 8, 9, 9, 8, 9, 8, }; static float _vq_quantthresh__44u3__p2_0[] = { -0.5, 0.5, }; static long _vq_quantmap__44u3__p2_0[] = { 1, 0, 2, }; static encode_aux_threshmatch _vq_auxt__44u3__p2_0 = { _vq_quantthresh__44u3__p2_0, _vq_quantmap__44u3__p2_0, 3, 3 }; static static_codebook _44u3__p2_0 = { 4, 81, _vq_lengthlist__44u3__p2_0, 1, -535822336, 1611661312, 2, 0, _vq_quantlist__44u3__p2_0, NULL, &_vq_auxt__44u3__p2_0, NULL, 0 }; static long _vq_quantlist__44u3__p3_0[] = { 2, 1, 3, 0, 4, }; static long _vq_lengthlist__44u3__p3_0[] = { 2, 4, 4, 8, 8, 5, 7, 7, 9, 9, 5, 7, 7, 9, 9, 8, 10, 9,12,12, 8, 9,10,12,12, 5, 7, 7,10,10, 7, 9, 9,11,11, 7, 8, 9,10,11,10,11,10,14,13, 9,10,11, 13,13, 5, 7, 7,10,10, 7, 9, 8,11,10, 7, 9, 9,11, 11, 9,10,10,13,12,10,10,11,13,14, 8,10,10,14,13, 10,11,11,15,13, 9,11,11,14,13,13,14,13,17,15,12, 13,13,17,14, 8,10,10,14,14, 9,11,11,14,15,10,11, 12,14,16,12,13,13,14,17,13,13,14,14,17, 5, 7, 7, 10,10, 7, 9, 9,11,11, 7, 9, 9,11,11,10,11,11,15, 14,10,11,11,15,14, 7, 9, 9,12,12, 9,11,11,13,13, 9,11,11,13,13,11,12,12,15,14,11,12,12,15,16, 7, 9, 9,12,11, 8,11,10,13,12, 9,11,11,12,13,11,12, 11,16,14,11,12,13,15,16,10,12,12,17,15,11,12,13, 16,15,11,12,12,16,16,15,15,15,16,16,13,14,15, 0, 17, 9,11,11,15,15,10,12,11,16,15,11,12,12,15,17, 13,15,13,16,15,13,15,14, 0,18, 5, 7, 7,10,10, 7, 9, 9,12,11, 7, 9, 9,11,11,10,11,11,14,14,10,11, 11,14,15, 7, 9, 9,12,11, 9,11,11,13,12, 8,10,11, 11,12,11,12,12,16,15,11,11,12,13,14, 7, 9, 9,12, 12, 9,11,11,13,13, 9,11,11,13,13,11,12,12,16,15, 12,12,12,15,15, 9,11,11,17,15,11,12,12,17,16,10, 11,12,15,15,13,14,15,18,17,13,13,14,15,15, 9,12, 12,15,14,11,13,12,16,16,11,12,12,15,15,13,15,14, 0, 0,14,15,14,16,18, 8,10,10,15,15,10,12,12,16, 14,10,11,11,16,16,15,16,16,18,16,13,15,14,17,18, 9,11,11,16,15,11,12,13,17,17,11,13,13,16,15,15, 16,16,18,18,14,16,15,18,17, 9,11,11,16,16,10,13, 12,16,16,11,12,12,16,16,14,16,16,17, 0,14,15,15, 18,16,12,14,14, 0, 0,14,15,16, 0, 0,14,15,15, 0, 0,17,17,16, 0, 0,15,16,18,17, 0,11,14,14,18, 0, 12,15,13, 0,18,13,15,14,18, 0,15,16,15, 0,18,15, 18,17, 0,18, 8,10,10,15,15,10,12,11,15,15,10,11, 12,15,15,13,14,15,17, 0,14,15,16,17, 0, 9,11,11, 15,15,11,12,12,17,15,10,12,13,16,15,13,15,15,18, 18,15,16,17,18,18, 9,12,11,16,16,11,13,13,16,16, 11,13,13,18,15,14,15,15,18, 0,16,16,17, 0,17,12, 13,13,18,18,13,14,14,17,18,13,14,15,18,17,17,18, 18, 0,18,16,16,18,16, 0,12,15,13,18,18,13,14,15, 18,18,13,16,14,17,18,15,17,16, 0,18,17, 0,17, 0, 0, }; static float _vq_quantthresh__44u3__p3_0[] = { -1.5, -0.5, 0.5, 1.5, }; static long _vq_quantmap__44u3__p3_0[] = { 3, 1, 0, 2, 4, }; static encode_aux_threshmatch _vq_auxt__44u3__p3_0 = { _vq_quantthresh__44u3__p3_0, _vq_quantmap__44u3__p3_0, 5, 5 }; static static_codebook _44u3__p3_0 = { 4, 625, _vq_lengthlist__44u3__p3_0, 1, -533725184, 1611661312, 3, 0, _vq_quantlist__44u3__p3_0, NULL, &_vq_auxt__44u3__p3_0, NULL, 0 }; static long _vq_quantlist__44u3__p4_0[] = { 2, 1, 3, 0, 4, }; static long _vq_lengthlist__44u3__p4_0[] = { 4, 6, 6, 9, 9, 6, 7, 6, 9, 9, 6, 6, 7, 9, 9, 9, 10, 9,12,11, 9, 9,10,11,12, 6, 7, 7, 9, 9, 7, 7, 7,10,10, 6, 7, 7, 9,10,10,10,10,12,12, 9, 9,10, 11,12, 6, 7, 7, 9, 9, 7, 7, 7,10, 9, 7, 7, 7,10, 10, 9,10, 9,12,11,10,10,10,12,12, 9,10,10,12,12, 10,10,10,13,12, 9,10,10,12,12,12,12,12,14,14,12, 12,12,13,14, 9,10,10,12,12, 9,10,10,12,12,10,10, 10,12,13,11,12,12,14,13,12,12,12,14,14, 6, 7, 7, 10, 9, 7, 8, 7,10,10, 7, 7, 7,10,10,10,10,10,12, 12,10,10,10,12,12, 7, 8, 8,10,10, 8, 8, 8,10,10, 7, 8, 8,10,10,10,10,11,11,13,10,10,11,12,13, 6, 7, 7,10,10, 7, 8, 7,10,10, 8, 8, 8,10,10,10,11, 10,13,11,10,10,10,12,12,10,10,10,13,12,10,10,10, 12,13,10,10,10,13,12,12,11,13,12,14,12,12,13,14, 14, 9,10,10,12,13, 9,10,10,12,12,10,10,11,12,13, 12,12,11,14,12,12,12,13,14,14, 6, 7, 7, 9, 9, 7, 7, 7,10,10, 7, 7, 8,10,10,10,10,10,12,12,10,10, 10,12,12, 6, 7, 7,10,10, 8, 8, 8,10,10, 7, 7, 8, 10,10,10,10,10,12,12,10,10,11,11,13, 7, 8, 8,10, 10, 7, 8, 8,10,10, 8, 8, 8,10,10,10,10,10,12,12, 10,11,10,13,11, 9,10,10,13,12,10,11,10,13,12, 9, 10,10,12,13,12,13,12,14,14,12,11,12,12,14,10,10, 10,12,13,10,10,11,12,13,10,10,10,12,12,12,13,12, 14,14,12,12,11,14,12, 9,10, 9,12,12,10,10,10,13, 13, 9,10,10,13,13,12,13,13,15,14,12,12,13,14,14, 9,10,10,13,13,10,10,10,12,13,10,10,10,13,12,13, 12,13,14,15,12,13,13,15,14, 9,10,10,13,12,10,10, 10,13,12,10,10,10,12,13,12,13,12,14,14,13,12,12, 14,14,12,12,12,15,14,12,11,12,14,14,12,13,12,14, 14,14,12,14,12,16,14,14,14,16,16,11,12,12,14,14, 11,12,11,15,13,12,12,12,14,15,13,14,12,16,13,14, 14,15,16,16, 9,10,10,12,12, 9,10,10,13,12, 9,10, 10,13,13,12,12,12,14,14,12,13,13,14,15, 9,10,10, 13,12,10,11,10,13,12,10,10,10,12,13,12,13,12,14, 14,12,12,13,14,15, 9,10,10,13,13,10,10,10,12,13, 10,10,10,13,13,12,13,13,14,15,13,13,12,14,14,11, 12,12,14,14,12,13,12,15,14,11,11,12,14,15,14,14, 14,16,16,14,12,14,13,16,12,12,12,14,15,12,12,13, 14,15,12,12,11,14,14,14,14,14,16,16,14,14,12,16, 12, }; static float _vq_quantthresh__44u3__p4_0[] = { -1.5, -0.5, 0.5, 1.5, }; static long _vq_quantmap__44u3__p4_0[] = { 3, 1, 0, 2, 4, }; static encode_aux_threshmatch _vq_auxt__44u3__p4_0 = { _vq_quantthresh__44u3__p4_0, _vq_quantmap__44u3__p4_0, 5, 5 }; static static_codebook _44u3__p4_0 = { 4, 625, _vq_lengthlist__44u3__p4_0, 1, -533725184, 1611661312, 3, 0, _vq_quantlist__44u3__p4_0, NULL, &_vq_auxt__44u3__p4_0, NULL, 0 }; static long _vq_quantlist__44u3__p5_0[] = { 4, 3, 5, 2, 6, 1, 7, 0, 8, }; static long _vq_lengthlist__44u3__p5_0[] = { 2, 4, 4, 6, 6, 7, 7, 9, 9, 4, 5, 4, 7, 6, 8, 8, 9, 9, 4, 4, 4, 6, 7, 8, 8, 9, 9, 6, 7, 6, 8, 8, 9, 9,10,10, 6, 6, 7, 8, 8, 9, 9,10,10, 8, 8, 8, 9, 9,10,10,11,11, 8, 8, 8, 9, 9,10,10,11,11, 9, 9, 9,10,10,11,11,12,12, 9, 9,10,10,10,11,11,12, 12, }; static float _vq_quantthresh__44u3__p5_0[] = { -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, }; static long _vq_quantmap__44u3__p5_0[] = { 7, 5, 3, 1, 0, 2, 4, 6, 8, }; static encode_aux_threshmatch _vq_auxt__44u3__p5_0 = { _vq_quantthresh__44u3__p5_0, _vq_quantmap__44u3__p5_0, 9, 9 }; static static_codebook _44u3__p5_0 = { 2, 81, _vq_lengthlist__44u3__p5_0, 1, -531628032, 1611661312, 4, 0, _vq_quantlist__44u3__p5_0, NULL, &_vq_auxt__44u3__p5_0, NULL, 0 }; static long _vq_quantlist__44u3__p6_0[] = { 6, 5, 7, 4, 8, 3, 9, 2, 10, 1, 11, 0, 12, }; static long _vq_lengthlist__44u3__p6_0[] = { 1, 4, 4, 6, 6, 8, 8, 9,10,10,11,13,14, 4, 6, 5, 8, 8, 9, 9,10,10,11,11,14,14, 4, 5, 6, 8, 8, 9, 9,10,10,11,11,14,14, 7, 8, 8, 9, 9,10,10,11,11, 12,12,15,15, 7, 8, 8, 9, 9,10,10,11,11,12,12,14, 15, 8, 9, 9,10,10,11,11,12,12,13,12,16,16, 8, 9, 9,10,10,11,11,12,12,12,12,16,16,10,11,10,11,11, 12,12,13,13,13,13,17,16,10,11,11,11,11,12,12,12, 12,13,13,17,17,11,11,12,12,12,13,13,13,14,14,14, 16,17,11,12,11,12,12,13,13,14,14,14,14,19,17,14, 14,14,16,15,16,16,16,17,17,17,20,19,14,15,15,15, 15,15,16,16,17,17,17,20,19, }; static float _vq_quantthresh__44u3__p6_0[] = { -27.5, -22.5, -17.5, -12.5, -7.5, -2.5, 2.5, 7.5, 12.5, 17.5, 22.5, 27.5, }; static long _vq_quantmap__44u3__p6_0[] = { 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, }; static encode_aux_threshmatch _vq_auxt__44u3__p6_0 = { _vq_quantthresh__44u3__p6_0, _vq_quantmap__44u3__p6_0, 13, 13 }; static static_codebook _44u3__p6_0 = { 2, 169, _vq_lengthlist__44u3__p6_0, 1, -526516224, 1616117760, 4, 0, _vq_quantlist__44u3__p6_0, NULL, &_vq_auxt__44u3__p6_0, NULL, 0 }; static long _vq_quantlist__44u3__p6_1[] = { 2, 1, 3, 0, 4, }; static long _vq_lengthlist__44u3__p6_1[] = { 2, 4, 4, 5, 5, 4, 5, 5, 6, 5, 4, 5, 5, 5, 6, 5, 6, 5, 6, 6, 5, 5, 6, 6, 6, }; static float _vq_quantthresh__44u3__p6_1[] = { -1.5, -0.5, 0.5, 1.5, }; static long _vq_quantmap__44u3__p6_1[] = { 3, 1, 0, 2, 4, }; static encode_aux_threshmatch _vq_auxt__44u3__p6_1 = { _vq_quantthresh__44u3__p6_1, _vq_quantmap__44u3__p6_1, 5, 5 }; static static_codebook _44u3__p6_1 = { 2, 25, _vq_lengthlist__44u3__p6_1, 1, -533725184, 1611661312, 3, 0, _vq_quantlist__44u3__p6_1, NULL, &_vq_auxt__44u3__p6_1, NULL, 0 }; static long _vq_quantlist__44u3__p7_0[] = { 4, 3, 5, 2, 6, 1, 7, 0, 8, }; static long _vq_lengthlist__44u3__p7_0[] = { 1, 4, 4, 9, 9, 9, 9, 9, 9, 4, 9, 9, 9, 9, 9, 9, 9, 9, 3, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, }; static float _vq_quantthresh__44u3__p7_0[] = { -892.5, -637.5, -382.5, -127.5, 127.5, 382.5, 637.5, 892.5, }; static long _vq_quantmap__44u3__p7_0[] = { 7, 5, 3, 1, 0, 2, 4, 6, 8, }; static encode_aux_threshmatch _vq_auxt__44u3__p7_0 = { _vq_quantthresh__44u3__p7_0, _vq_quantmap__44u3__p7_0, 9, 9 }; static static_codebook _44u3__p7_0 = { 2, 81, _vq_lengthlist__44u3__p7_0, 1, -515907584, 1627381760, 4, 0, _vq_quantlist__44u3__p7_0, NULL, &_vq_auxt__44u3__p7_0, NULL, 0 }; static long _vq_quantlist__44u3__p7_1[] = { 7, 6, 8, 5, 9, 4, 10, 3, 11, 2, 12, 1, 13, 0, 14, }; static long _vq_lengthlist__44u3__p7_1[] = { 1, 4, 4, 6, 5, 7, 7, 9, 8,10,10,11,11,12,13, 4, 7, 6, 7, 7, 9, 9,10,10,11,11,14,13,14,13, 4, 6, 7, 7, 8, 9, 9,10,10,12,12,13,13,13,13, 6, 8, 8, 10, 9,11,11,12,12,13,13,14,14,15,14, 6, 8, 8, 9, 9,11,11,12,12,14,14,14,15,15,15, 8, 9, 9,11,10, 13,12,14,14,14,14,15,16,15,15, 8, 9, 9,11,11,12, 12,14,14,15,14,15,15,14,17, 9,10,10,13,12,14,14, 15,14,14,17,15,15,16,15, 9,11,11,12,13,14,14,15, 15,15,16,15,17,16,17,11,12,12,14,14,15,14,16,16, 16,15,15,17,16,16,11,12,13,14,15,15,15,15,15,16, 16,17,17,16,17,12,13,13,15,14,15,15,15,15,16,16, 16,17,17,17,13,12,14,14,15,15,15,15,16,17,17,15, 17,17,17,12,14,14,16,15,17,16,17,16,17,16,17,17, 17,17,14,13,14,15,16,17,17,17,15,17,17,17,16,17, 16, }; static float _vq_quantthresh__44u3__p7_1[] = { -110.5, -93.5, -76.5, -59.5, -42.5, -25.5, -8.5, 8.5, 25.5, 42.5, 59.5, 76.5, 93.5, 110.5, }; static long _vq_quantmap__44u3__p7_1[] = { 13, 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, 14, }; static encode_aux_threshmatch _vq_auxt__44u3__p7_1 = { _vq_quantthresh__44u3__p7_1, _vq_quantmap__44u3__p7_1, 15, 15 }; static static_codebook _44u3__p7_1 = { 2, 225, _vq_lengthlist__44u3__p7_1, 1, -522338304, 1620115456, 4, 0, _vq_quantlist__44u3__p7_1, NULL, &_vq_auxt__44u3__p7_1, NULL, 0 }; static long _vq_quantlist__44u3__p7_2[] = { 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15, 0, 16, }; static long _vq_lengthlist__44u3__p7_2[] = { 3, 5, 5, 6, 6, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 5, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 5, 6, 6, 7, 7, 7, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 6, 7, 7, 7, 7, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9,10, 9, 6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 7, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9,10,10,10, 7, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9,10,10,10,10, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9,10,10,10,10,10,10, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9,10,10,10,10,10,10, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,10,10,10,10,10,10, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,10,10,10,10,10,10, 9, 9, 9, 9, 9, 9, 9,10, 9,10,10,10,10,10,10,10,10, 9, 9, 9, 9, 9, 9, 9,10,10,10,10,10,10,10,10,10,10, 9, 9, 9, 9, 9,10,10,10,10,10,10,10,10,10,10,10,10, 9, 9, 9,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 9, 9,10,10, 9,10, 9,10,10,10,10,10,10,10,10,10,10, 9,10, 9,10, 9,10,10,10,10,10,10,10,10,10,10,10, 10, }; static float _vq_quantthresh__44u3__p7_2[] = { -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, }; static long _vq_quantmap__44u3__p7_2[] = { 15, 13, 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, 14, 16, }; static encode_aux_threshmatch _vq_auxt__44u3__p7_2 = { _vq_quantthresh__44u3__p7_2, _vq_quantmap__44u3__p7_2, 17, 17 }; static static_codebook _44u3__p7_2 = { 2, 289, _vq_lengthlist__44u3__p7_2, 1, -529530880, 1611661312, 5, 0, _vq_quantlist__44u3__p7_2, NULL, &_vq_auxt__44u3__p7_2, NULL, 0 }; static long _huff_lengthlist__44u3__short[] = { 17,17,17,17,17,17,16,16,16,12,11,13,11,12,11,15, 16, 9, 4, 8, 5, 7, 9,15,16,14, 9,12,10,10,12,16, 16,11, 4, 9, 3, 4, 8,16,16,12, 6,10, 3, 4, 7,16, 16,12, 6,11, 3, 3, 4,12,16,16, 7,13, 5, 5, 6,13, }; static static_codebook _huff_book__44u3__short = { 2, 64, _huff_lengthlist__44u3__short, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _huff_lengthlist__44u4__long[] = { 3, 7,11,11,12,11,11,12, 5, 3, 5, 7, 8, 8, 9,11, 9, 4, 4, 6, 6, 7, 9,15,10, 6, 6, 7, 7, 7, 8,14, 12, 7, 5, 6, 4, 5, 7,15,10, 7, 6, 7, 5, 5, 6,13, 9, 8, 8, 7, 7, 5, 4, 8,10,12,14,13,14,10, 5, 7, }; static static_codebook _huff_book__44u4__long = { 2, 64, _huff_lengthlist__44u4__long, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _vq_quantlist__44u4__p1_0[] = { 1, 0, 2, }; static long _vq_lengthlist__44u4__p1_0[] = { 1, 4, 4, 5, 8, 7, 5, 7, 8, 5, 8, 8, 8,11,11, 8, 10,11, 5, 8, 8, 8,11,10, 8,11,11, 4, 8, 8, 8,11, 11, 8,11,11, 8,11,11,11,13,14,11,14,14, 7,11,10, 10,14,12,11,14,14, 4, 8, 8, 8,11,11, 8,11,11, 8, 11,11,11,14,14,10,12,14, 8,11,11,11,14,14,11,14, 13, }; static float _vq_quantthresh__44u4__p1_0[] = { -0.5, 0.5, }; static long _vq_quantmap__44u4__p1_0[] = { 1, 0, 2, }; static encode_aux_threshmatch _vq_auxt__44u4__p1_0 = { _vq_quantthresh__44u4__p1_0, _vq_quantmap__44u4__p1_0, 3, 3 }; static static_codebook _44u4__p1_0 = { 4, 81, _vq_lengthlist__44u4__p1_0, 1, -535822336, 1611661312, 2, 0, _vq_quantlist__44u4__p1_0, NULL, &_vq_auxt__44u4__p1_0, NULL, 0 }; static long _vq_quantlist__44u4__p2_0[] = { 1, 0, 2, }; static long _vq_lengthlist__44u4__p2_0[] = { 2, 5, 5, 5, 6, 6, 5, 6, 6, 5, 6, 6, 7, 8, 8, 6, 7, 8, 5, 6, 6, 6, 8, 7, 7, 8, 8, 5, 6, 6, 7, 8, 8, 6, 8, 8, 7, 8, 8, 8, 9,10, 8,10,10, 6, 8, 8, 7, 9, 8, 8, 9,10, 5, 6, 6, 6, 8, 8, 7, 8, 8, 6, 8, 8, 8,10, 9, 8, 8, 9, 6, 8, 8, 8,10,10, 8,10, 9, }; static float _vq_quantthresh__44u4__p2_0[] = { -0.5, 0.5, }; static long _vq_quantmap__44u4__p2_0[] = { 1, 0, 2, }; static encode_aux_threshmatch _vq_auxt__44u4__p2_0 = { _vq_quantthresh__44u4__p2_0, _vq_quantmap__44u4__p2_0, 3, 3 }; static static_codebook _44u4__p2_0 = { 4, 81, _vq_lengthlist__44u4__p2_0, 1, -535822336, 1611661312, 2, 0, _vq_quantlist__44u4__p2_0, NULL, &_vq_auxt__44u4__p2_0, NULL, 0 }; static long _vq_quantlist__44u4__p3_0[] = { 2, 1, 3, 0, 4, }; static long _vq_lengthlist__44u4__p3_0[] = { 2, 4, 4, 7, 7, 5, 7, 7, 9, 9, 5, 7, 7, 9, 9, 8, 10, 9,12,12, 8, 9, 9,12,12, 5, 7, 7,10, 9, 7, 9, 9,11,11, 7, 8, 9,10,11,10,11,11,13,13, 9,10,11, 13,13, 5, 7, 7, 9,10, 7, 9, 9,11,11, 7, 9, 9,11, 11, 9,11,10,13,12,10,11,11,13,13, 8,10,10,13,13, 10,11,11,15,13, 9,11,11,14,13,13,15,13,16,15,12, 13,13,15,15, 8,10,10,13,14, 9,11,11,14,14,10,11, 12,14,16,12,13,13,14,16,13,14,14,15,17, 5, 7, 7, 10,10, 7, 9, 9,11,11, 7, 9, 9,11,11,10,11,11,15, 14,10,11,11,14,14, 7, 9, 9,12,12, 9,11,11,13,13, 9,11,11,13,13,11,12,13,15,15,11,13,13,16,15, 7, 9, 9,11,11, 9,11,10,13,12, 9,11,12,13,13,11,13, 12,16,14,11,13,13,15,16,10,12,12,18,15,11,12,13, 16,15,11,13,13,17,16,15,15,15,17,17,14,15,16,18, 19, 9,11,11,15,15,10,12,11,15,16,11,13,13,15,16, 13,15,13,18,15,14,15,15,17,19, 5, 7, 7,10,10, 7, 9, 9,12,11, 7, 9, 9,11,12,10,12,11,14,14,10,11, 12,14,15, 7, 9, 9,11,11, 9,11,11,13,12, 9,10,11, 12,13,11,13,13,16,17,11,11,13,14,15, 7, 9, 9,12, 12, 9,11,11,13,13, 9,11,11,13,13,11,13,12,15,16, 11,13,13,16,15, 9,11,11,16,15,11,13,12,16,15,10, 12,12,16,15,14,15,16,19,17,13,14,15,15,16,10,11, 12,15,15,11,13,13,16,16,11,13,12,16,17,14,15,15, 18,17,14,16,14,16,19, 7,10,10,15,14,10,12,12,16, 15,10,11,11,16,15,14,16,16,19,18,13,15,14,17,17, 9,11,11,17,16,11,13,14,18,17,11,13,13,16,16,15, 16,17,19, 0,14,15,18,16,19, 9,11,11,16,15,11,13, 12,18,16,11,13,13,17,16,14,16,16,17,19,15,16,15, 18, 0,12,14,15,18,19,13,15,16,19,17,14,16,15,18, 0,17,16,19, 0,18,16,17,18, 0, 0,11,13,14,18,19, 13,15,13,19,19,14,15,15,17,17,15,17,15,19,17,16, 18,18,19, 0, 8,10,10,14,14,10,12,11,15,15,10,11, 12,15,17,13,15,15,17,16,14,15,15,18, 0, 9,11,11, 15,15,11,13,13,18,16,10,12,13,16,17,14,15,16,17, 18,14,15,17,19,19, 9,12,12,15,16,11,13,13,16,17, 11,14,13,19,16,14,16,15,18,19,15,16,18,19,18,12, 14,14,19,18,13,15,17,18,17,13,14,15,18, 0,16, 0, 0,18,18,16,15, 0,17,19,12,15,14,17, 0,13,15,16, 19,18,13,16,15, 0,19,16,18,16,19,18,17,19,16, 0, 19, }; static float _vq_quantthresh__44u4__p3_0[] = { -1.5, -0.5, 0.5, 1.5, }; static long _vq_quantmap__44u4__p3_0[] = { 3, 1, 0, 2, 4, }; static encode_aux_threshmatch _vq_auxt__44u4__p3_0 = { _vq_quantthresh__44u4__p3_0, _vq_quantmap__44u4__p3_0, 5, 5 }; static static_codebook _44u4__p3_0 = { 4, 625, _vq_lengthlist__44u4__p3_0, 1, -533725184, 1611661312, 3, 0, _vq_quantlist__44u4__p3_0, NULL, &_vq_auxt__44u4__p3_0, NULL, 0 }; static long _vq_quantlist__44u4__p4_0[] = { 2, 1, 3, 0, 4, }; static long _vq_lengthlist__44u4__p4_0[] = { 4, 5, 5, 8, 8, 6, 7, 6, 9, 9, 6, 6, 7, 9, 9, 9, 9, 9,11,11, 8, 9, 9,11,11, 6, 7, 7, 9, 9, 7, 8, 8,10,10, 6, 7, 8, 9,10, 9,10,10,11,12, 9, 9,10, 11,12, 6, 7, 7, 9, 9, 7, 8, 7,10, 9, 7, 8, 8,10, 10, 9,10, 9,12,11, 9,10,10,12,11, 9, 9, 9,12,11, 9,10,10,12,12, 9,10,10,12,12,11,12,12,13,14,11, 11,12,13,14, 9, 9, 9,11,12, 9,10,10,12,12, 9,10, 10,12,12,11,12,11,14,13,11,12,12,13,13, 5, 7, 7, 9, 9, 7, 8, 8,10,10, 7, 7, 8,10,10, 9,10,10,12, 12, 9,10,10,12,12, 7, 8, 8,10,10, 8, 8, 9,10,11, 8, 9, 9,11,11,10,10,11,11,13,10,10,11,12,13, 6, 7, 8,10,10, 7, 9, 8,11,10, 8, 8, 9,10,11,10,11, 10,13,11,10,11,11,13,12, 9,10,10,12,12,10,10,11, 12,13,10,11,11,13,13,12,11,13,12,15,12,13,13,14, 14, 9,10,10,12,12, 9,11,10,13,12,10,11,11,13,13, 11,13,11,14,12,12,13,13,14,15, 5, 7, 7, 9, 9, 7, 8, 7,10,10, 7, 8, 8,10,10, 9,10,10,12,12, 9,10, 10,12,12, 6, 8, 7,10,10, 8, 9, 8,11,10, 7, 8, 9, 10,11,10,11,11,12,13,10,10,11,11,13, 7, 8, 8,10, 10, 8, 9, 9,10,11, 8, 9, 8,11,10,10,11,11,13,12, 10,11,10,13,11, 9,10,10,13,12,10,11,11,13,13, 9, 10,10,12,13,12,13,13,15,14,11,11,13,12,14, 9,10, 10,12,12,10,11,11,13,13,10,11,10,13,12,12,13,13, 14,14,12,13,11,15,12, 8, 9, 9,12,12, 9,10,10,13, 12, 9,10,10,12,12,12,13,12,14,14,11,12,12,14,13, 9,10,10,12,12,10,10,11,13,13,10,11,11,13,12,12, 13,13,14,15,12,13,13,15,14, 9,10,10,12,12, 9,11, 10,13,12,10,10,11,12,13,12,13,12,15,14,12,13,13, 14,14,11,12,12,14,13,11,11,12,13,14,12,13,13,15, 14,13,12,14,12,16,14,15,14,16,16,11,12,12,14,14, 11,12,11,15,13,12,13,13,14,15,13,14,12,16,13,14, 14,15,16,16, 8, 9, 9,12,12, 9,10,10,12,12, 9,10, 10,12,13,11,12,12,14,13,12,12,13,14,14, 9,10,10, 12,12,10,11,11,13,12,10,10,11,12,13,12,13,13,14, 14,12,12,13,14,15, 9,10,10,12,13,10,11,11,12,13, 10,11,10,13,13,12,13,13,14,15,12,13,13,15,14,11, 12,12,14,14,12,13,13,15,14,11,11,12,14,15,14,14, 14,17,16,13,12,14,13,16,11,12,12,13,15,12,13,13, 14,15,11,12,11,14,14,14,15,14,15,17,13,14,12,16, 12, }; static float _vq_quantthresh__44u4__p4_0[] = { -1.5, -0.5, 0.5, 1.5, }; static long _vq_quantmap__44u4__p4_0[] = { 3, 1, 0, 2, 4, }; static encode_aux_threshmatch _vq_auxt__44u4__p4_0 = { _vq_quantthresh__44u4__p4_0, _vq_quantmap__44u4__p4_0, 5, 5 }; static static_codebook _44u4__p4_0 = { 4, 625, _vq_lengthlist__44u4__p4_0, 1, -533725184, 1611661312, 3, 0, _vq_quantlist__44u4__p4_0, NULL, &_vq_auxt__44u4__p4_0, NULL, 0 }; static long _vq_quantlist__44u4__p5_0[] = { 4, 3, 5, 2, 6, 1, 7, 0, 8, }; static long _vq_lengthlist__44u4__p5_0[] = { 2, 4, 4, 6, 6, 7, 7, 9, 9, 4, 5, 4, 7, 6, 8, 7, 10, 9, 4, 4, 5, 6, 7, 7, 8, 9, 9, 6, 7, 6, 8, 8, 8, 8,10,10, 6, 6, 7, 8, 8, 8, 9,10,10, 7, 8, 7, 9, 8,10,10,11,11, 7, 7, 8, 8, 9,10,10,11,11, 9, 10, 9,10,10,11,11,12,12, 9, 9,10,10,10,11,11,12, 12, }; static float _vq_quantthresh__44u4__p5_0[] = { -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, }; static long _vq_quantmap__44u4__p5_0[] = { 7, 5, 3, 1, 0, 2, 4, 6, 8, }; static encode_aux_threshmatch _vq_auxt__44u4__p5_0 = { _vq_quantthresh__44u4__p5_0, _vq_quantmap__44u4__p5_0, 9, 9 }; static static_codebook _44u4__p5_0 = { 2, 81, _vq_lengthlist__44u4__p5_0, 1, -531628032, 1611661312, 4, 0, _vq_quantlist__44u4__p5_0, NULL, &_vq_auxt__44u4__p5_0, NULL, 0 }; static long _vq_quantlist__44u4__p6_0[] = { 6, 5, 7, 4, 8, 3, 9, 2, 10, 1, 11, 0, 12, }; static long _vq_lengthlist__44u4__p6_0[] = { 1, 4, 4, 6, 6, 8, 8, 9,10,10,11,13,13, 4, 6, 5, 8, 8, 9, 9,10,10,11,11,14,14, 4, 5, 6, 8, 8, 9, 9,10,10,11,11,14,14, 7, 8, 8, 9, 9,10,10,11,11, 12,12,15,15, 7, 8, 8, 9, 9,10,10,11,11,12,12,15, 15, 8, 9, 9,10,10,11,11,12,12,13,13,16,16, 8, 9, 9,10,10,11,11,12,12,13,13,16,16,10,10,10,11,11, 12,12,13,13,14,13,16,16,10,10,11,11,12,12,12,13, 13,13,14,16,17,11,12,11,12,12,13,13,13,14,14,14, 17,16,11,11,12,12,12,13,13,14,14,15,14,17,17,14, 14,14,15,15,16,16,17,17,17,19,19, 0,14,15,15,15, 15,16,16,16,17,17,19,20,20, }; static float _vq_quantthresh__44u4__p6_0[] = { -27.5, -22.5, -17.5, -12.5, -7.5, -2.5, 2.5, 7.5, 12.5, 17.5, 22.5, 27.5, }; static long _vq_quantmap__44u4__p6_0[] = { 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, }; static encode_aux_threshmatch _vq_auxt__44u4__p6_0 = { _vq_quantthresh__44u4__p6_0, _vq_quantmap__44u4__p6_0, 13, 13 }; static static_codebook _44u4__p6_0 = { 2, 169, _vq_lengthlist__44u4__p6_0, 1, -526516224, 1616117760, 4, 0, _vq_quantlist__44u4__p6_0, NULL, &_vq_auxt__44u4__p6_0, NULL, 0 }; static long _vq_quantlist__44u4__p6_1[] = { 2, 1, 3, 0, 4, }; static long _vq_lengthlist__44u4__p6_1[] = { 2, 4, 4, 5, 5, 4, 5, 5, 6, 5, 4, 5, 5, 5, 6, 5, 6, 5, 6, 6, 5, 5, 6, 6, 6, }; static float _vq_quantthresh__44u4__p6_1[] = { -1.5, -0.5, 0.5, 1.5, }; static long _vq_quantmap__44u4__p6_1[] = { 3, 1, 0, 2, 4, }; static encode_aux_threshmatch _vq_auxt__44u4__p6_1 = { _vq_quantthresh__44u4__p6_1, _vq_quantmap__44u4__p6_1, 5, 5 }; static static_codebook _44u4__p6_1 = { 2, 25, _vq_lengthlist__44u4__p6_1, 1, -533725184, 1611661312, 3, 0, _vq_quantlist__44u4__p6_1, NULL, &_vq_auxt__44u4__p6_1, NULL, 0 }; static long _vq_quantlist__44u4__p7_0[] = { 6, 5, 7, 4, 8, 3, 9, 2, 10, 1, 11, 0, 12, }; static long _vq_lengthlist__44u4__p7_0[] = { 1, 3, 3,11,11,11,11,11,11,11,11,11,11, 4,10, 9, 11,11,11,11,11,11,11,11,11,11, 4,10,10,11,11,11, 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, 11,11,11,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10, }; static float _vq_quantthresh__44u4__p7_0[] = { -1402.5, -1147.5, -892.5, -637.5, -382.5, -127.5, 127.5, 382.5, 637.5, 892.5, 1147.5, 1402.5, }; static long _vq_quantmap__44u4__p7_0[] = { 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, }; static encode_aux_threshmatch _vq_auxt__44u4__p7_0 = { _vq_quantthresh__44u4__p7_0, _vq_quantmap__44u4__p7_0, 13, 13 }; static static_codebook _44u4__p7_0 = { 2, 169, _vq_lengthlist__44u4__p7_0, 1, -514332672, 1627381760, 4, 0, _vq_quantlist__44u4__p7_0, NULL, &_vq_auxt__44u4__p7_0, NULL, 0 }; static long _vq_quantlist__44u4__p7_1[] = { 7, 6, 8, 5, 9, 4, 10, 3, 11, 2, 12, 1, 13, 0, 14, }; static long _vq_lengthlist__44u4__p7_1[] = { 1, 4, 4, 6, 6, 7, 7, 9, 8,10,10,11,11,12,12, 4, 7, 6, 8, 7, 9, 9,10,10,11,10,12,11,12,12, 4, 6, 6, 7, 8, 9, 9,10,10,11,11,12,12,13,13, 6, 8, 8, 10, 9,11,10,11,11,12,12,14,13,13,13, 6, 8, 8, 9, 9,11,11,12,12,12,12,13,14,13,14, 8, 9, 9,11,10, 12,12,13,12,13,14,14,14,14,14, 8, 9, 9,10,11,12, 11,12,13,13,14,14,13,14,14, 9,10,10,12,12,14,13, 14,14,15,15,16,15,15,15, 9,10,10,11,12,13,13,13, 14,15,15,18,16,17,15,10,12,12,13,13,15,14,15,14, 16,16,16,15,16,15,10,11,11,13,13,14,14,17,16,15, 16,18,16,15,16,11,12,13,14,13,15,14,15,16,17,15, 16,16,15,16,11,12,13,14,15,14,16,15,15,16,15,15, 17,17,17,12,13,13,14,14,14,15,16,14,15,15,16,16, 16,16,12,13,13,13,14,15,15,15,14,16,16,16,16,16, 17, }; static float _vq_quantthresh__44u4__p7_1[] = { -110.5, -93.5, -76.5, -59.5, -42.5, -25.5, -8.5, 8.5, 25.5, 42.5, 59.5, 76.5, 93.5, 110.5, }; static long _vq_quantmap__44u4__p7_1[] = { 13, 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, 14, }; static encode_aux_threshmatch _vq_auxt__44u4__p7_1 = { _vq_quantthresh__44u4__p7_1, _vq_quantmap__44u4__p7_1, 15, 15 }; static static_codebook _44u4__p7_1 = { 2, 225, _vq_lengthlist__44u4__p7_1, 1, -522338304, 1620115456, 4, 0, _vq_quantlist__44u4__p7_1, NULL, &_vq_auxt__44u4__p7_1, NULL, 0 }; static long _vq_quantlist__44u4__p7_2[] = { 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15, 0, 16, }; static long _vq_lengthlist__44u4__p7_2[] = { 3, 5, 5, 6, 6, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 5, 6, 6, 7, 7, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 5, 6, 6, 7, 7, 8, 7, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 6, 7, 7, 7, 7, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 7, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9,10,10, 7, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9,10,10, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9,10,10,10,10,10,10, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9,10,10,10,10,10,10, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,10,10,10,10,10,10, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,10,10,10,10,10,10, 9, 9, 9, 9, 9, 9, 9,10, 9, 9,10,10,10,10,10,10,10, 9, 9, 9, 9, 9, 9,10, 9,10,10,10,10,10,10,10,10,10, 9, 9, 9, 9, 9,10,10,10,10,10,10,10,10,10,10,10,10, 9, 9, 9, 9, 9,10, 9,10,10,10,10,10,10,10,10,10,10, 9, 9, 9,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 9, 9, 9,10, 9,10,10,10,10,10,10,10,10,10,10,10, 10, }; static float _vq_quantthresh__44u4__p7_2[] = { -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, }; static long _vq_quantmap__44u4__p7_2[] = { 15, 13, 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, 14, 16, }; static encode_aux_threshmatch _vq_auxt__44u4__p7_2 = { _vq_quantthresh__44u4__p7_2, _vq_quantmap__44u4__p7_2, 17, 17 }; static static_codebook _44u4__p7_2 = { 2, 289, _vq_lengthlist__44u4__p7_2, 1, -529530880, 1611661312, 5, 0, _vq_quantlist__44u4__p7_2, NULL, &_vq_auxt__44u4__p7_2, NULL, 0 }; static long _huff_lengthlist__44u4__short[] = { 3, 9,14,12,17,13,13,13, 4, 7, 8, 9,12,10,11,12, 6, 5, 4, 7, 6, 7, 9,14, 8, 8, 7, 9, 8, 9,10,13, 9, 8, 5, 7, 3, 5, 8,15, 9, 9, 6, 8, 4, 5, 7,16, 11,10, 6, 9, 4, 3, 6,15,17,16, 8,11, 5, 5, 7,16, }; static static_codebook _huff_book__44u4__short = { 2, 64, _huff_lengthlist__44u4__short, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _huff_lengthlist__44u5__long[] = { 3, 8,13,12,14,13,16,11,12,13, 5, 4, 5, 6, 8, 9, 10, 9,12,12,10, 5, 4, 6, 6, 8, 9,10,14,16,10, 6, 6, 6, 6, 7, 9, 8,12,13,13, 7, 5, 6, 4, 6, 6, 7, 11,16,10, 7, 7, 7, 6, 6, 7, 7,11,14,14, 9, 8, 8, 5, 6, 6, 7,11,16, 9, 8, 8, 8, 6, 6, 6, 4, 7,12, 11,10,12,11,10, 9,10, 5, 6,10,10,13,15,15,15,15, 14, 8, 7, 9, }; static static_codebook _huff_book__44u5__long = { 2, 100, _huff_lengthlist__44u5__long, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _vq_quantlist__44u5__p1_0[] = { 1, 0, 2, }; static long _vq_lengthlist__44u5__p1_0[] = { 1, 4, 4, 5, 8, 7, 5, 7, 7, 5, 8, 8, 8,10,10, 7, 9,10, 5, 8, 8, 7,10, 9, 8,10,10, 4, 8, 8, 8,11, 10, 8,10,10, 8,11,11,10,12,13,10,13,13, 7,10,10, 9,13,11,10,13,13, 5, 8, 8, 8,10,10, 8,10,10, 7, 10,10,10,13,13,10,11,13, 8,10,11,10,13,13,10,13, 12, }; static float _vq_quantthresh__44u5__p1_0[] = { -0.5, 0.5, }; static long _vq_quantmap__44u5__p1_0[] = { 1, 0, 2, }; static encode_aux_threshmatch _vq_auxt__44u5__p1_0 = { _vq_quantthresh__44u5__p1_0, _vq_quantmap__44u5__p1_0, 3, 3 }; static static_codebook _44u5__p1_0 = { 4, 81, _vq_lengthlist__44u5__p1_0, 1, -535822336, 1611661312, 2, 0, _vq_quantlist__44u5__p1_0, NULL, &_vq_auxt__44u5__p1_0, NULL, 0 }; static long _vq_quantlist__44u5__p2_0[] = { 1, 0, 2, }; static long _vq_lengthlist__44u5__p2_0[] = { 3, 4, 4, 5, 6, 6, 5, 6, 6, 5, 6, 6, 6, 8, 8, 6, 7, 8, 5, 6, 6, 6, 8, 7, 6, 8, 8, 5, 6, 6, 6, 8, 7, 6, 8, 8, 6, 8, 8, 8, 9, 9, 8, 9, 9, 6, 7, 8, 7, 9, 8, 8, 9, 9, 5, 6, 6, 6, 8, 7, 6, 8, 8, 6, 8, 8, 8, 9, 9, 7, 8, 9, 6, 8, 8, 8, 9, 9, 8, 9, 9, }; static float _vq_quantthresh__44u5__p2_0[] = { -0.5, 0.5, }; static long _vq_quantmap__44u5__p2_0[] = { 1, 0, 2, }; static encode_aux_threshmatch _vq_auxt__44u5__p2_0 = { _vq_quantthresh__44u5__p2_0, _vq_quantmap__44u5__p2_0, 3, 3 }; static static_codebook _44u5__p2_0 = { 4, 81, _vq_lengthlist__44u5__p2_0, 1, -535822336, 1611661312, 2, 0, _vq_quantlist__44u5__p2_0, NULL, &_vq_auxt__44u5__p2_0, NULL, 0 }; static long _vq_quantlist__44u5__p3_0[] = { 2, 1, 3, 0, 4, }; static long _vq_lengthlist__44u5__p3_0[] = { 2, 4, 5, 8, 8, 5, 7, 6, 9, 9, 5, 6, 7, 9, 9, 8, 10, 9,12,12, 8, 9,10,12,13, 5, 7, 7,10, 9, 7, 9, 9,11,11, 7, 8, 9,10,11,10,11,11,13,14, 9,10,11, 13,13, 5, 7, 7, 9, 9, 7, 9, 8,11,10, 7, 9, 9,11, 11, 9,11,10,14,13,10,11,11,13,14, 8,10,10,13,13, 10,11,11,15,14, 9,11,11,14,14,13,15,14,18,16,12, 13,14,16,16, 8,10,10,13,13, 9,11,11,14,14,10,11, 12,14,15,12,13,13,16,16,13,14,14,15,17, 5, 7, 7, 10,10, 7, 9, 9,11,11, 7, 9, 9,11,11,10,11,11,15, 14,10,11,11,14,14, 7, 9, 9,12,11, 9,11,11,13,13, 9,11,11,13,13,12,12,13,15,15,11,12,13,16,15, 6, 9, 9,11,11, 8,11,10,13,12, 9,10,11,12,14,11,13, 11,16,14,11,13,13,15,16,10,11,11,15,15,11,12,13, 16,15,11,13,13,16,16,14,15,15,17,18,14,15,16,17, 18, 9,11,11,14,15,10,12,11,15,15,11,12,13,15,16, 13,15,13,17,15,14,15,16,18,19, 5, 7, 7,10,10, 7, 9, 9,11,11, 7, 9, 9,11,11,10,11,11,15,14,10,11, 11,14,15, 6, 9, 9,11,11, 9,11,10,13,13, 8,10,11, 12,13,11,13,13,15,15,11,11,13,13,15, 7, 9, 9,11, 12, 9,11,11,13,13, 9,11,11,13,13,11,13,12,17,16, 11,13,12,16,15, 9,11,11,15,14,11,13,13,16,16,10, 11,12,15,15,14,15,15,17,17,13,13,15,15,17,10,11, 12,15,15,11,13,13,16,19,11,13,12,17,17,14,16,15, 19,17,14,15,15,18,18, 8,10,10,14,14,10,12,11,16, 15, 9,11,11,15,16,14,16,15,17,17,13,14,14,18,17, 9,11,11,16,15,11,13,13,16,18,11,13,13,17,16,15, 16,17,18, 0,15,15,16, 0,18, 9,11,11,16,15,10,13, 12,17,15,11,13,13,16,17,14,18,15,19,18,15,16,16, 19,18,13,15,15,19,17,13,15,15,18,18,14,15,15,19, 0,17,18, 0,19,19,16,17,17, 0,18,12,14,13,18,17, 13,15,13,19,18,14,15,15,19,19,16,17,15, 0,17,16, 19,17,19,18, 8,10,10,14,14,10,11,11,15,15,10,11, 11,16,16,13,15,15,17,16,14,15,15,18,19, 9,11,11, 16,15,11,13,13,19,16,10,12,13,15,17,15,15,15,19, 19,15,16,16,17, 0, 9,11,11,16,16,11,13,13,16,17, 11,13,13,18,18,14,16,15,18,18,15,17,16,19, 0,12, 14,14,17,18,13,16,16,18,18,13,14,15,17, 0,16,17, 17, 0, 0,16,15, 0,19,17,12,15,14,17,18,14,15,16, 0,18,14,16,16,18, 0,16,17,17, 0, 0,17,19,17,19, 0, }; static float _vq_quantthresh__44u5__p3_0[] = { -1.5, -0.5, 0.5, 1.5, }; static long _vq_quantmap__44u5__p3_0[] = { 3, 1, 0, 2, 4, }; static encode_aux_threshmatch _vq_auxt__44u5__p3_0 = { _vq_quantthresh__44u5__p3_0, _vq_quantmap__44u5__p3_0, 5, 5 }; static static_codebook _44u5__p3_0 = { 4, 625, _vq_lengthlist__44u5__p3_0, 1, -533725184, 1611661312, 3, 0, _vq_quantlist__44u5__p3_0, NULL, &_vq_auxt__44u5__p3_0, NULL, 0 }; static long _vq_quantlist__44u5__p4_0[] = { 2, 1, 3, 0, 4, }; static long _vq_lengthlist__44u5__p4_0[] = { 4, 6, 6, 8, 8, 6, 7, 6, 9, 9, 6, 6, 7, 9, 9, 8, 9, 9,11,11, 8, 9, 9,11,11, 6, 7, 7, 9, 9, 7, 8, 8,10,10, 6, 7, 8, 9,10, 9,10,10,11,11, 9, 9,10, 11,12, 6, 7, 7, 9, 9, 6, 8, 7,10, 9, 7, 8, 8,10, 10, 9,10, 9,12,11, 9,10,10,12,11, 8, 9, 9,12,11, 9,10,10,12,12, 9,10,10,12,12,11,12,12,13,13,11, 11,12,12,13, 8, 9, 9,11,11, 9,10,10,12,12, 9,10, 10,12,12,11,12,11,13,13,11,12,12,14,13, 6, 7, 7, 9, 9, 7, 8, 7,10,10, 7, 7, 8, 9,10, 9,10,10,12, 11, 9,10,10,11,11, 7, 8, 8,10,10, 8, 8, 9,10,11, 8, 8, 8,11,10,10,10,11,11,12,10,10,11,12,12, 6, 7, 7,10,10, 7, 8, 8,11,10, 8, 8, 9,10,11,10,11, 10,13,11,10,10,11,12,12, 9,10,10,12,12,10,10,10, 12,13,10,11,11,13,13,12,11,12,11,14,12,12,13,13, 14, 9,10,10,12,12, 9,10,10,12,12,10,10,11,12,13, 11,12,11,14,12,12,12,12,14,14, 6, 7, 7, 9, 9, 7, 8, 7,10,10, 7, 7, 8,10,10, 9,10,10,11,11, 9,10, 10,12,12, 6, 7, 7,10,10, 8, 9, 8,11,10, 7, 8, 8, 10,11,10,10,11,12,12,10,10,11,11,13, 7, 8, 8,10, 10, 8, 8, 8,10,11, 8, 9, 8,11,10,10,11,10,12,12, 10,11,10,12,11, 9,10,10,12,12,10,11,11,13,12, 9, 10,10,12,12,12,12,12,14,14,11,11,12,12,14, 9,10, 10,12,12,10,11,11,12,12,10,10,10,12,12,12,13,12, 14,14,11,12,11,14,11, 8, 9, 9,11,11, 9,10,10,12, 12, 9,10,10,12,12,11,12,12,14,14,11,12,12,13,13, 9,10,10,12,12,10,10,11,12,13,10,11,10,13,12,12, 12,13,14,14,12,12,12,14,13, 9,10,10,12,12, 9,10, 10,13,12,10,10,11,12,13,12,13,12,14,13,12,12,13, 13,14,11,12,11,14,13,11,11,12,13,14,12,13,12,14, 14,13,12,14,11,16,13,14,14,16,15,11,11,11,13,13, 11,12,11,14,13,12,12,13,14,15,12,14,12,16,12,14, 14,14,16,16, 8, 9, 9,11,11, 9,10,10,12,12, 9,10, 10,12,12,11,12,12,13,13,12,12,12,14,14, 9,10,10, 12,12,10,11,10,13,12, 9,10,10,12,13,12,12,12,14, 13,12,12,13,13,15, 9,10,10,12,12,10,10,11,12,13, 10,11,10,13,12,12,13,12,14,14,12,13,12,14,13,11, 11,11,13,13,12,13,12,14,14,11,11,12,13,14,13,14, 14,16,15,13,12,14,12,15,11,12,12,13,14,12,12,13, 14,14,11,12,11,14,13,13,14,14,15,16,13,14,11,16, 11, }; static float _vq_quantthresh__44u5__p4_0[] = { -1.5, -0.5, 0.5, 1.5, }; static long _vq_quantmap__44u5__p4_0[] = { 3, 1, 0, 2, 4, }; static encode_aux_threshmatch _vq_auxt__44u5__p4_0 = { _vq_quantthresh__44u5__p4_0, _vq_quantmap__44u5__p4_0, 5, 5 }; static static_codebook _44u5__p4_0 = { 4, 625, _vq_lengthlist__44u5__p4_0, 1, -533725184, 1611661312, 3, 0, _vq_quantlist__44u5__p4_0, NULL, &_vq_auxt__44u5__p4_0, NULL, 0 }; static long _vq_quantlist__44u5__p5_0[] = { 4, 3, 5, 2, 6, 1, 7, 0, 8, }; static long _vq_lengthlist__44u5__p5_0[] = { 2, 4, 3, 6, 6, 8, 7,10,10, 3, 5, 5, 8, 7, 8, 8, 11,11, 3, 5, 5, 7, 8, 8, 8,10,11, 6, 8, 7, 9, 9, 10, 9,12,11, 7, 7, 8, 9, 9, 9,10,11,12, 8, 8, 8, 10, 9,11,11,13,12, 8, 8, 8, 9,10,11,12,12,13,10, 11,10,12,11,13,12,14,14,10,10,11,11,12,12,13,14, 14, }; static float _vq_quantthresh__44u5__p5_0[] = { -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, }; static long _vq_quantmap__44u5__p5_0[] = { 7, 5, 3, 1, 0, 2, 4, 6, 8, }; static encode_aux_threshmatch _vq_auxt__44u5__p5_0 = { _vq_quantthresh__44u5__p5_0, _vq_quantmap__44u5__p5_0, 9, 9 }; static static_codebook _44u5__p5_0 = { 2, 81, _vq_lengthlist__44u5__p5_0, 1, -531628032, 1611661312, 4, 0, _vq_quantlist__44u5__p5_0, NULL, &_vq_auxt__44u5__p5_0, NULL, 0 }; static long _vq_quantlist__44u5__p6_0[] = { 4, 3, 5, 2, 6, 1, 7, 0, 8, }; static long _vq_lengthlist__44u5__p6_0[] = { 3, 4, 4, 5, 6, 7, 7, 9, 9, 4, 5, 4, 6, 6, 7, 7, 9, 9, 4, 4, 4, 6, 6, 7, 7, 9, 9, 6, 6, 6, 7, 7, 8, 8,10,10, 6, 6, 6, 7, 7, 8, 8,10,10, 7, 7, 7, 8, 8, 9, 9,10,10, 7, 7, 7, 8, 8, 9, 9,10,11, 9, 9, 9,10,10,11,10,11,11, 9, 9, 9,10,10,11,11,11, 11, }; static float _vq_quantthresh__44u5__p6_0[] = { -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, }; static long _vq_quantmap__44u5__p6_0[] = { 7, 5, 3, 1, 0, 2, 4, 6, 8, }; static encode_aux_threshmatch _vq_auxt__44u5__p6_0 = { _vq_quantthresh__44u5__p6_0, _vq_quantmap__44u5__p6_0, 9, 9 }; static static_codebook _44u5__p6_0 = { 2, 81, _vq_lengthlist__44u5__p6_0, 1, -531628032, 1611661312, 4, 0, _vq_quantlist__44u5__p6_0, NULL, &_vq_auxt__44u5__p6_0, NULL, 0 }; static long _vq_quantlist__44u5__p7_0[] = { 1, 0, 2, }; static long _vq_lengthlist__44u5__p7_0[] = { 1, 4, 4, 5, 7, 7, 5, 7, 7, 5, 9, 8, 8,11,10, 7, 10,10, 5, 9, 9, 8,10,10, 8,10,11, 4, 9, 9, 9,11, 11, 9,12,11, 8,11,11,11,12,12,10,12,12, 7,11,11, 10,12,12,10,12,12, 4, 9, 9, 9,11,11, 9,11,11, 7, 11,11,10,12,12,10,11,12, 8,11,11,10,12,12,11,12, 12, }; static float _vq_quantthresh__44u5__p7_0[] = { -5.5, 5.5, }; static long _vq_quantmap__44u5__p7_0[] = { 1, 0, 2, }; static encode_aux_threshmatch _vq_auxt__44u5__p7_0 = { _vq_quantthresh__44u5__p7_0, _vq_quantmap__44u5__p7_0, 3, 3 }; static static_codebook _44u5__p7_0 = { 4, 81, _vq_lengthlist__44u5__p7_0, 1, -529137664, 1618345984, 2, 0, _vq_quantlist__44u5__p7_0, NULL, &_vq_auxt__44u5__p7_0, NULL, 0 }; static long _vq_quantlist__44u5__p7_1[] = { 5, 4, 6, 3, 7, 2, 8, 1, 9, 0, 10, }; static long _vq_lengthlist__44u5__p7_1[] = { 2, 4, 4, 6, 6, 7, 7, 8, 8, 8, 8, 4, 5, 5, 7, 7, 8, 8, 9, 8, 9, 8, 4, 5, 5, 7, 7, 8, 8, 8, 9, 9, 9, 6, 7, 7, 8, 8, 9, 8, 9, 9, 9, 9, 6, 7, 7, 8, 8, 8, 9, 9, 9, 9, 9, 8, 8, 8, 9, 8, 9, 9, 9, 9, 9, 9, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 8, 9, 8, 9, 9, 9, 9,10,10,10,10, 8, 9, 9, 9, 9, 9, 9,10, 10,10,10, 8, 9, 9, 9, 9, 9, 9,10,10,10,10, 8, 9, 9, 9, 9, 9, 9,10,10,10,10, }; static float _vq_quantthresh__44u5__p7_1[] = { -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, }; static long _vq_quantmap__44u5__p7_1[] = { 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, }; static encode_aux_threshmatch _vq_auxt__44u5__p7_1 = { _vq_quantthresh__44u5__p7_1, _vq_quantmap__44u5__p7_1, 11, 11 }; static static_codebook _44u5__p7_1 = { 2, 121, _vq_lengthlist__44u5__p7_1, 1, -531365888, 1611661312, 4, 0, _vq_quantlist__44u5__p7_1, NULL, &_vq_auxt__44u5__p7_1, NULL, 0 }; static long _vq_quantlist__44u5__p8_0[] = { 5, 4, 6, 3, 7, 2, 8, 1, 9, 0, 10, }; static long _vq_lengthlist__44u5__p8_0[] = { 1, 4, 4, 6, 6, 8, 8, 9, 9,10,10, 4, 6, 6, 7, 7, 9, 9,10,10,11,11, 4, 6, 6, 7, 7, 9, 9,10,10,11, 11, 6, 8, 8, 9, 9,10,10,12,11,13,12, 6, 7, 8, 9, 9,10,10,11,11,12,12, 8, 9, 9,10,10,11,12,12,12, 14,13, 8, 9, 9,10,10,11,11,12,13,14,13,10,11,10, 12,12,13,13,14,13,15,14,10,11,11,12,12,12,13,13, 13,15,15,11,12,12,13,12,13,14,14,14,15,14,11,11, 12,13,13,13,14,14,14,15,15, }; static float _vq_quantthresh__44u5__p8_0[] = { -49.5, -38.5, -27.5, -16.5, -5.5, 5.5, 16.5, 27.5, 38.5, 49.5, }; static long _vq_quantmap__44u5__p8_0[] = { 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, }; static encode_aux_threshmatch _vq_auxt__44u5__p8_0 = { _vq_quantthresh__44u5__p8_0, _vq_quantmap__44u5__p8_0, 11, 11 }; static static_codebook _44u5__p8_0 = { 2, 121, _vq_lengthlist__44u5__p8_0, 1, -524582912, 1618345984, 4, 0, _vq_quantlist__44u5__p8_0, NULL, &_vq_auxt__44u5__p8_0, NULL, 0 }; static long _vq_quantlist__44u5__p8_1[] = { 5, 4, 6, 3, 7, 2, 8, 1, 9, 0, 10, }; static long _vq_lengthlist__44u5__p8_1[] = { 3, 5, 5, 6, 6, 7, 7, 7, 7, 8, 8, 5, 6, 5, 6, 6, 7, 7, 8, 8, 8, 8, 5, 6, 6, 6, 6, 7, 7, 8, 8, 8, 8, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 6, 6, 7, 7, 7, 7, 7, 8, 8, 8, 8, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, }; static float _vq_quantthresh__44u5__p8_1[] = { -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, }; static long _vq_quantmap__44u5__p8_1[] = { 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, }; static encode_aux_threshmatch _vq_auxt__44u5__p8_1 = { _vq_quantthresh__44u5__p8_1, _vq_quantmap__44u5__p8_1, 11, 11 }; static static_codebook _44u5__p8_1 = { 2, 121, _vq_lengthlist__44u5__p8_1, 1, -531365888, 1611661312, 4, 0, _vq_quantlist__44u5__p8_1, NULL, &_vq_auxt__44u5__p8_1, NULL, 0 }; static long _vq_quantlist__44u5__p9_0[] = { 6, 5, 7, 4, 8, 3, 9, 2, 10, 1, 11, 0, 12, }; static long _vq_lengthlist__44u5__p9_0[] = { 1, 3, 3,12,10,12,12,12,12,12,12,12,12, 3, 8, 9, 12,12,12,12,12,12,12,12,12,12, 4, 9, 9,12,12,12, 12,12,12,12,12,12,12,11,12,12,12,12,12,12,12,12, 12,12,12,12, 9,12,12,12,12,12,12,12,12,12,12,12, 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, 12,12,12,12,12,12,12,12,12,12,12,12,11,11,11,11, 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, 11,11,11,11,11,11,11,11,11, }; static float _vq_quantthresh__44u5__p9_0[] = { -1402.5, -1147.5, -892.5, -637.5, -382.5, -127.5, 127.5, 382.5, 637.5, 892.5, 1147.5, 1402.5, }; static long _vq_quantmap__44u5__p9_0[] = { 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, }; static encode_aux_threshmatch _vq_auxt__44u5__p9_0 = { _vq_quantthresh__44u5__p9_0, _vq_quantmap__44u5__p9_0, 13, 13 }; static static_codebook _44u5__p9_0 = { 2, 169, _vq_lengthlist__44u5__p9_0, 1, -514332672, 1627381760, 4, 0, _vq_quantlist__44u5__p9_0, NULL, &_vq_auxt__44u5__p9_0, NULL, 0 }; static long _vq_quantlist__44u5__p9_1[] = { 7, 6, 8, 5, 9, 4, 10, 3, 11, 2, 12, 1, 13, 0, 14, }; static long _vq_lengthlist__44u5__p9_1[] = { 1, 4, 4, 7, 7, 8, 9, 7, 7, 8, 8, 9, 9,10,10, 5, 6, 6, 9, 8,10,10, 9, 8, 9, 9,10, 9,11,10, 4, 6, 6, 8, 9, 9,10, 8, 9, 9,10,10,10,11,10, 7, 8, 8, 10,10,11,11,10,10,11,11,11,11,11,11, 7, 8, 8,10, 10,11,11,10,10,11,11,11,11,11,12, 8, 9,10,11,10, 12,12,11,11,11,11,12,12,12,13, 8, 9, 9,11,11,11, 12,11,11,11,11,12,12,12,12, 8, 9, 9,10,10,11,11, 12,11,12,12,12,13,13,13, 8, 9, 9,10,10,11,11,12, 11,12,12,13,13,12,13, 9,10,10,11,11,12,11,12,13, 14,14,15,15,15,14, 9,10,10,11,11,12,12,12,12,13, 13,14,14,14,14, 9,10,11,12,11,12,13,14,13,14,13, 14,14,14,14, 9,11,11,11,11,12,13,13,13,14,13,15, 15,14,14,10,11,11,12,12,13,13,13,13,14,14,14,15, 15,15,10,11,11,12,12,12,13,13,13,15,14,15,14,14, 14, }; static float _vq_quantthresh__44u5__p9_1[] = { -110.5, -93.5, -76.5, -59.5, -42.5, -25.5, -8.5, 8.5, 25.5, 42.5, 59.5, 76.5, 93.5, 110.5, }; static long _vq_quantmap__44u5__p9_1[] = { 13, 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, 14, }; static encode_aux_threshmatch _vq_auxt__44u5__p9_1 = { _vq_quantthresh__44u5__p9_1, _vq_quantmap__44u5__p9_1, 15, 15 }; static static_codebook _44u5__p9_1 = { 2, 225, _vq_lengthlist__44u5__p9_1, 1, -522338304, 1620115456, 4, 0, _vq_quantlist__44u5__p9_1, NULL, &_vq_auxt__44u5__p9_1, NULL, 0 }; static long _vq_quantlist__44u5__p9_2[] = { 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15, 0, 16, }; static long _vq_lengthlist__44u5__p9_2[] = { 3, 5, 5, 7, 7, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 5, 6, 6, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 5, 6, 6, 7, 7, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 7, 7, 7, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 7, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 7, 8, 8, 8, 8, 9, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,10, 9, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,10, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,10, 9, 9,10, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,10, 9,10, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,10, 9, 9, 9, 9, 9,10, 9, 9, 9, 9, 9, 9, 9, 9, 9,10,10,10,10, 9,10,10,10,10, 9, 9, 9, 9, 9, 9, 9, 9, 9,10,10,10, 9, 9, 9, 9,10, 9, 9, 9, 9, 9, 9, 9,10, 9,10, 9, 9, 9,10,10, 9, 9, }; static float _vq_quantthresh__44u5__p9_2[] = { -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, }; static long _vq_quantmap__44u5__p9_2[] = { 15, 13, 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, 14, 16, }; static encode_aux_threshmatch _vq_auxt__44u5__p9_2 = { _vq_quantthresh__44u5__p9_2, _vq_quantmap__44u5__p9_2, 17, 17 }; static static_codebook _44u5__p9_2 = { 2, 289, _vq_lengthlist__44u5__p9_2, 1, -529530880, 1611661312, 5, 0, _vq_quantlist__44u5__p9_2, NULL, &_vq_auxt__44u5__p9_2, NULL, 0 }; static long _huff_lengthlist__44u5__short[] = { 4,11,16,14,18,15,18,15,17,17, 4, 6, 9, 9,12, 9, 14,10,14,17, 6, 6, 5, 7, 6, 8,10,10,16,17, 7, 8, 7, 9, 9,10,12,12,14,17, 8, 6, 5, 7, 4, 7, 5, 7, 14,17, 9, 9, 8, 9, 7,10, 8,10,14,17,11, 9, 7, 9, 4, 7, 3, 6,15,17,11,10,10,10, 6, 9, 5, 6,14,17, 17,17,10,15, 4, 8, 3, 5,12,17,17,17,12,16, 7,11, 6, 8,16,17, }; static static_codebook _huff_book__44u5__short = { 2, 100, _huff_lengthlist__44u5__short, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _huff_lengthlist__44u6__long[] = { 3, 9,14,13,15,13,16,12,12,12, 5, 4, 6, 7, 8, 9, 10,10,13,12,10, 5, 5, 6, 6, 9, 9,10,14,14,10, 6, 6, 7, 6, 8, 9, 9,13,12,13, 7, 5, 6, 4, 6, 6, 7, 11,15,10, 8, 7, 7, 6, 7, 7, 7,11,13,16,10, 8, 8, 5, 6, 4, 6,10,14, 9, 9, 9, 8, 6, 6, 5, 4, 7,11, 11,11,12,11,10, 9, 9, 5, 5, 9,10,13,14,14,14,14, 15, 8, 7, 8, }; static static_codebook _huff_book__44u6__long = { 2, 100, _huff_lengthlist__44u6__long, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _vq_quantlist__44u6__p1_0[] = { 1, 0, 2, }; static long _vq_lengthlist__44u6__p1_0[] = { 1, 4, 4, 4, 8, 7, 5, 7, 7, 5, 8, 8, 8,10,10, 7, 9,10, 5, 8, 8, 7,10, 9, 8,10,10, 5, 8, 8, 8,11, 10, 8,10,10, 8,11,10,10,12,13,10,13,13, 7,10,10, 10,13,11,10,13,13, 5, 8, 8, 8,11,10, 8,10,10, 7, 10,10,10,13,13, 9,11,13, 8,10,11,10,13,13,10,13, 12, }; static float _vq_quantthresh__44u6__p1_0[] = { -0.5, 0.5, }; static long _vq_quantmap__44u6__p1_0[] = { 1, 0, 2, }; static encode_aux_threshmatch _vq_auxt__44u6__p1_0 = { _vq_quantthresh__44u6__p1_0, _vq_quantmap__44u6__p1_0, 3, 3 }; static static_codebook _44u6__p1_0 = { 4, 81, _vq_lengthlist__44u6__p1_0, 1, -535822336, 1611661312, 2, 0, _vq_quantlist__44u6__p1_0, NULL, &_vq_auxt__44u6__p1_0, NULL, 0 }; static long _vq_quantlist__44u6__p2_0[] = { 1, 0, 2, }; static long _vq_lengthlist__44u6__p2_0[] = { 3, 5, 4, 5, 6, 6, 5, 6, 6, 5, 6, 6, 6, 7, 8, 6, 7, 8, 5, 6, 6, 6, 8, 7, 6, 8, 7, 5, 6, 6, 6, 8, 7, 6, 7, 8, 6, 8, 8, 8, 8, 9, 8, 9, 9, 6, 7, 7, 7, 9, 8, 8, 9, 9, 5, 6, 6, 6, 8, 7, 6, 7, 8, 6, 7, 7, 8, 9, 9, 7, 8, 9, 6, 8, 8, 8, 9, 9, 8, 9, 8, }; static float _vq_quantthresh__44u6__p2_0[] = { -0.5, 0.5, }; static long _vq_quantmap__44u6__p2_0[] = { 1, 0, 2, }; static encode_aux_threshmatch _vq_auxt__44u6__p2_0 = { _vq_quantthresh__44u6__p2_0, _vq_quantmap__44u6__p2_0, 3, 3 }; static static_codebook _44u6__p2_0 = { 4, 81, _vq_lengthlist__44u6__p2_0, 1, -535822336, 1611661312, 2, 0, _vq_quantlist__44u6__p2_0, NULL, &_vq_auxt__44u6__p2_0, NULL, 0 }; static long _vq_quantlist__44u6__p3_0[] = { 2, 1, 3, 0, 4, }; static long _vq_lengthlist__44u6__p3_0[] = { 2, 4, 5, 8, 8, 5, 7, 6, 9, 9, 5, 6, 7, 9, 9, 8, 10, 9,13,12, 8, 9,10,12,13, 5, 7, 7,10, 9, 7, 9, 9,11,11, 7, 8, 9,10,11,10,11,11,13,14, 9,10,11, 13,13, 5, 7, 7, 9, 9, 7, 9, 8,11,10, 7, 9, 9,11, 11, 9,11,10,14,13,10,11,11,14,13, 8,10,10,14,13, 10,12,11,15,14, 9,11,11,15,14,13,15,14,20,16,13, 13,14,16,16, 8,10,10,13,14, 9,11,11,14,15,10,11, 12,14,15,13,13,14,16,16,13,14,14,16,17, 5, 7, 7, 10,10, 7, 9, 9,11,11, 7, 9, 9,11,11,10,11,11,15, 14,10,11,11,14,14, 7, 9, 9,12,11, 9,11,11,12,13, 9,11,11,13,13,11,12,13,14,16,11,12,13,16,16, 6, 9, 8,11,11, 8,11,10,13,12, 9,10,11,12,13,11,13, 11,15,14,11,13,13,15,15,10,12,11,15,14,11,12,13, 17,16,11,13,13,16,17,14,15,16,17,17,14,15,16,20, 0, 9,11,11,14,15,10,13,12,16,16,11,13,13,17,17, 13,15,14,17,15,15,16,16, 0, 0, 5, 7, 7,10,10, 7, 9, 9,11,11, 7, 8, 9,11,11,10,11,11,14,14,10,11, 11,14,14, 6, 9, 9,11,11, 9,11,11,14,12, 8,10,11, 12,13,11,13,13,16,16,11,11,13,14,16, 7, 9, 9,11, 12, 9,11,11,13,13, 9,11,11,13,12,11,13,12,16,16, 12,13,12,16,14, 9,11,11,16,15,11,13,13,17,15,10, 12,12,15,16,14,16,16, 0,17,13,14,15,15,17,10,11, 12,15,15,11,13,13,17,17,11,13,13,15,16,14,15,15, 19,18,14,15,15,19,16, 8,10,10,14,14,10,12,11,15, 16,10,11,11,15,17,13,16,15,19,19,13,15,14,17,17, 9,11,12,15,16,11,13,13,18,19,11,13,13,16,17,16, 16,17, 0, 0,15,15,16, 0,19, 9,11,11,15,16,10,13, 12,17,15,11,13,13,16,17,14,17,15,18,17,15,16,15, 18, 0,13,14,15, 0,19,14,16,16, 0,17,15,16,16, 0, 17,16,17, 0, 0, 0,16,17,19, 0, 0,12,14,14,17,17, 13,15,13, 0,19,14,16,16,18,19,16,18,15,19,18,17, 18,17,19, 0, 8,10,10,14,13,10,11,11,16,15,10,11, 11,15,15,13,15,15,19,18,14,15,16, 0,18, 9,11,11, 15,14,11,13,13, 0,16,10,12,13,15,17,14,16,16, 0, 18,15,16,17,17, 0, 9,11,11,16,15,11,13,13,16,16, 11,14,13,18,18,15,17,15,18,17,15,16,18, 0, 0,12, 14,14,18,19,14,15,16, 0,18,13,14,15,18, 0,17,17, 17, 0, 0,16,15,18,17, 0,12,14,15,17,19,14,16,16, 19, 0,14,17,16, 0,18,17,19,17, 0, 0,16,18,17, 0, 17, }; static float _vq_quantthresh__44u6__p3_0[] = { -1.5, -0.5, 0.5, 1.5, }; static long _vq_quantmap__44u6__p3_0[] = { 3, 1, 0, 2, 4, }; static encode_aux_threshmatch _vq_auxt__44u6__p3_0 = { _vq_quantthresh__44u6__p3_0, _vq_quantmap__44u6__p3_0, 5, 5 }; static static_codebook _44u6__p3_0 = { 4, 625, _vq_lengthlist__44u6__p3_0, 1, -533725184, 1611661312, 3, 0, _vq_quantlist__44u6__p3_0, NULL, &_vq_auxt__44u6__p3_0, NULL, 0 }; static long _vq_quantlist__44u6__p4_0[] = { 2, 1, 3, 0, 4, }; static long _vq_lengthlist__44u6__p4_0[] = { 4, 6, 6, 8, 8, 6, 7, 6, 9, 9, 6, 6, 7, 9, 9, 8, 9, 9,11,11, 8, 9, 9,11,11, 6, 7, 7, 9, 9, 7, 8, 8,10,10, 6, 7, 8, 9,10, 9,10,10,11,12, 9, 9,10, 11,12, 6, 7, 7, 9, 9, 7, 8, 7,10, 9, 7, 8, 8,10, 10, 9,10, 9,12,11, 9,10,10,12,11, 8, 9, 9,11,11, 9,10,10,12,12, 9, 9,10,12,12,11,12,12,13,13,11, 11,12,12,13, 8, 9, 9,11,11, 9,10,10,12,12, 9,10, 10,12,12,11,12,11,13,13,11,12,12,13,13, 6, 7, 7, 9, 9, 7, 8, 7,10, 9, 7, 7, 8, 9,10, 9,10,10,12, 11, 9,10,10,11,12, 7, 8, 8,10,10, 8, 8, 9,10,10, 8, 8, 8,10,10,10,10,11,12,12,10,10,11,12,12, 6, 7, 7,10,10, 7, 8, 8,11,10, 8, 8, 9,10,11,10,11, 10,12,11,10,10,11,12,12, 9,10,10,12,12,10,10,11, 12,12,10,11,10,13,12,12,12,12,12,14,12,12,12,13, 14, 9,10,10,12,12, 9,10,10,12,12,10,10,11,12,13, 11,12,11,14,12,12,12,13,14,14, 6, 7, 7, 9, 9, 7, 8, 7,10, 9, 7, 7, 8,10,10, 9,10,10,12,11, 9,10, 10,11,12, 6, 7, 7,10,10, 8, 9, 8,11,10, 7, 8, 8, 10,10,10,10,11,12,12,10,10,10,11,12, 7, 8, 8,10, 10, 8, 8, 8,10,10, 8, 8, 8,10,10,10,11,10,12,12, 10,11,10,12,11, 9,10,10,12,12,10,11,10,13,12, 9, 10,10,12,12,12,12,12,14,14,11,11,12,12,13, 9,10, 10,12,12,10,11,11,12,12,10,11,10,12,12,12,12,12, 14,14,12,12,12,14,12, 8, 9, 9,11,11, 9,10,10,12, 12, 9,10,10,12,12,11,12,12,13,13,11,12,12,13,13, 9,10,10,12,12,10,10,11,12,13,10,11,10,12,12,12, 12,13,13,14,12,12,12,14,14, 9,10,10,12,12, 9,10, 10,12,12,10,10,10,12,12,12,12,12,14,13,12,12,12, 14,14,11,12,12,13,13,11,12,12,14,14,12,12,12,14, 14,13,12,14,12,15,13,14,14,15,15,11,11,11,13,13, 11,12,11,14,13,12,12,12,14,14,12,14,12,15,12,13, 14,14,15,16, 8, 9, 9,11,11, 9,10,10,12,12, 9,10, 10,12,12,11,12,12,13,13,11,12,12,13,14, 9,10,10, 12,12,10,11,10,13,12, 9,10,10,12,13,12,12,12,15, 14,12,12,13,13,14, 9,10,10,12,12,10,10,11,12,12, 10,11,10,12,12,12,13,12,14,14,12,13,12,14,13,11, 11,11,13,13,12,12,12,14,13,11,11,12,13,14,13,14, 14,15,15,12,12,14,12,15,11,12,12,13,14,12,12,12, 14,14,11,12,12,14,14,13,14,14,15,15,13,14,12,16, 12, }; static float _vq_quantthresh__44u6__p4_0[] = { -1.5, -0.5, 0.5, 1.5, }; static long _vq_quantmap__44u6__p4_0[] = { 3, 1, 0, 2, 4, }; static encode_aux_threshmatch _vq_auxt__44u6__p4_0 = { _vq_quantthresh__44u6__p4_0, _vq_quantmap__44u6__p4_0, 5, 5 }; static static_codebook _44u6__p4_0 = { 4, 625, _vq_lengthlist__44u6__p4_0, 1, -533725184, 1611661312, 3, 0, _vq_quantlist__44u6__p4_0, NULL, &_vq_auxt__44u6__p4_0, NULL, 0 }; static long _vq_quantlist__44u6__p5_0[] = { 4, 3, 5, 2, 6, 1, 7, 0, 8, }; static long _vq_lengthlist__44u6__p5_0[] = { 2, 3, 3, 6, 6, 8, 8,10,10, 4, 5, 5, 8, 7, 8, 8, 11,11, 3, 5, 5, 7, 8, 8, 8,11,11, 6, 8, 7,10, 9, 10, 9,12,12, 6, 7, 8, 9,10, 9,10,12,12, 8, 8, 8, 10, 9,12,11,13,13, 8, 8, 8, 9,10,11,12,12,13,10, 11,11,12,11,13,12,14,14,10,10,11,11,12,13,13,14, 14, }; static float _vq_quantthresh__44u6__p5_0[] = { -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, }; static long _vq_quantmap__44u6__p5_0[] = { 7, 5, 3, 1, 0, 2, 4, 6, 8, }; static encode_aux_threshmatch _vq_auxt__44u6__p5_0 = { _vq_quantthresh__44u6__p5_0, _vq_quantmap__44u6__p5_0, 9, 9 }; static static_codebook _44u6__p5_0 = { 2, 81, _vq_lengthlist__44u6__p5_0, 1, -531628032, 1611661312, 4, 0, _vq_quantlist__44u6__p5_0, NULL, &_vq_auxt__44u6__p5_0, NULL, 0 }; static long _vq_quantlist__44u6__p6_0[] = { 4, 3, 5, 2, 6, 1, 7, 0, 8, }; static long _vq_lengthlist__44u6__p6_0[] = { 3, 4, 4, 5, 5, 7, 7, 9, 9, 4, 5, 4, 6, 6, 7, 7, 9, 9, 4, 4, 5, 6, 6, 7, 7, 9, 9, 5, 6, 6, 7, 7, 8, 8,10,10, 6, 6, 6, 7, 7, 8, 8,10,10, 7, 7, 7, 8, 8, 9, 9,10,10, 7, 7, 7, 8, 8, 9, 9,10,11, 9, 9, 9,10,10,11,11,11,11, 9, 9, 9,10,10,10,11,11, 11, }; static float _vq_quantthresh__44u6__p6_0[] = { -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, }; static long _vq_quantmap__44u6__p6_0[] = { 7, 5, 3, 1, 0, 2, 4, 6, 8, }; static encode_aux_threshmatch _vq_auxt__44u6__p6_0 = { _vq_quantthresh__44u6__p6_0, _vq_quantmap__44u6__p6_0, 9, 9 }; static static_codebook _44u6__p6_0 = { 2, 81, _vq_lengthlist__44u6__p6_0, 1, -531628032, 1611661312, 4, 0, _vq_quantlist__44u6__p6_0, NULL, &_vq_auxt__44u6__p6_0, NULL, 0 }; static long _vq_quantlist__44u6__p7_0[] = { 1, 0, 2, }; static long _vq_lengthlist__44u6__p7_0[] = { 1, 4, 4, 5, 7, 7, 5, 7, 7, 5, 9, 8, 8,11,10, 8, 11,10, 5, 8, 9, 7,10,10, 8,10,11, 4, 9, 9, 9,12, 11, 9,11,12, 8,11,12,11,12,13,10,13,12, 7,12,11, 10,12,12,10,13,13, 4, 9, 9, 8,11,11, 9,11,12, 7, 12,12,10,13,13,10,12,13, 8,12,12,10,13,13,11,13, 12, }; static float _vq_quantthresh__44u6__p7_0[] = { -5.5, 5.5, }; static long _vq_quantmap__44u6__p7_0[] = { 1, 0, 2, }; static encode_aux_threshmatch _vq_auxt__44u6__p7_0 = { _vq_quantthresh__44u6__p7_0, _vq_quantmap__44u6__p7_0, 3, 3 }; static static_codebook _44u6__p7_0 = { 4, 81, _vq_lengthlist__44u6__p7_0, 1, -529137664, 1618345984, 2, 0, _vq_quantlist__44u6__p7_0, NULL, &_vq_auxt__44u6__p7_0, NULL, 0 }; static long _vq_quantlist__44u6__p7_1[] = { 5, 4, 6, 3, 7, 2, 8, 1, 9, 0, 10, }; static long _vq_lengthlist__44u6__p7_1[] = { 3, 4, 4, 6, 6, 7, 7, 8, 8, 8, 8, 4, 5, 5, 6, 6, 8, 7, 8, 8, 8, 8, 4, 5, 5, 6, 6, 7, 8, 8, 8, 8, 8, 6, 7, 6, 7, 7, 8, 8, 9, 9, 9, 9, 6, 6, 7, 7, 7, 8, 8, 9, 9, 9, 9, 7, 8, 7, 8, 8, 9, 9, 9, 9, 9, 9, 7, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 8, 8, 8, 9, 9, 9, 9, 9, 9,10,10, 8, 8, 8, 9, 9, 9, 9, 9, 9,10,10, }; static float _vq_quantthresh__44u6__p7_1[] = { -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, }; static long _vq_quantmap__44u6__p7_1[] = { 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, }; static encode_aux_threshmatch _vq_auxt__44u6__p7_1 = { _vq_quantthresh__44u6__p7_1, _vq_quantmap__44u6__p7_1, 11, 11 }; static static_codebook _44u6__p7_1 = { 2, 121, _vq_lengthlist__44u6__p7_1, 1, -531365888, 1611661312, 4, 0, _vq_quantlist__44u6__p7_1, NULL, &_vq_auxt__44u6__p7_1, NULL, 0 }; static long _vq_quantlist__44u6__p8_0[] = { 5, 4, 6, 3, 7, 2, 8, 1, 9, 0, 10, }; static long _vq_lengthlist__44u6__p8_0[] = { 1, 4, 4, 6, 6, 8, 8, 9, 9,10,10, 4, 6, 6, 7, 7, 9, 9,10,10,11,11, 4, 6, 6, 7, 7, 9, 9,10,10,11, 11, 6, 8, 8, 9, 9,10,10,11,11,12,12, 6, 8, 8, 9, 9,10,10,11,11,12,12, 8, 9, 9,10,10,11,11,12,12, 13,13, 8, 9, 9,10,10,11,11,12,12,13,13,10,10,10, 11,11,12,12,13,13,14,14,10,10,10,11,11,12,13,13, 13,14,14,11,12,12,13,13,13,13,14,14,15,14,11,11, 11,13,13,14,13,14,14,15,14, }; static float _vq_quantthresh__44u6__p8_0[] = { -49.5, -38.5, -27.5, -16.5, -5.5, 5.5, 16.5, 27.5, 38.5, 49.5, }; static long _vq_quantmap__44u6__p8_0[] = { 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, }; static encode_aux_threshmatch _vq_auxt__44u6__p8_0 = { _vq_quantthresh__44u6__p8_0, _vq_quantmap__44u6__p8_0, 11, 11 }; static static_codebook _44u6__p8_0 = { 2, 121, _vq_lengthlist__44u6__p8_0, 1, -524582912, 1618345984, 4, 0, _vq_quantlist__44u6__p8_0, NULL, &_vq_auxt__44u6__p8_0, NULL, 0 }; static long _vq_quantlist__44u6__p8_1[] = { 5, 4, 6, 3, 7, 2, 8, 1, 9, 0, 10, }; static long _vq_lengthlist__44u6__p8_1[] = { 3, 5, 5, 6, 6, 7, 7, 7, 7, 8, 8, 5, 6, 6, 7, 6, 7, 7, 7, 7, 8, 8, 5, 6, 6, 6, 7, 7, 7, 7, 7, 8, 8, 6, 7, 6, 7, 7, 7, 7, 8, 8, 8, 8, 6, 6, 7, 7, 7, 7, 7, 8, 8, 8, 8, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, }; static float _vq_quantthresh__44u6__p8_1[] = { -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, }; static long _vq_quantmap__44u6__p8_1[] = { 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, }; static encode_aux_threshmatch _vq_auxt__44u6__p8_1 = { _vq_quantthresh__44u6__p8_1, _vq_quantmap__44u6__p8_1, 11, 11 }; static static_codebook _44u6__p8_1 = { 2, 121, _vq_lengthlist__44u6__p8_1, 1, -531365888, 1611661312, 4, 0, _vq_quantlist__44u6__p8_1, NULL, &_vq_auxt__44u6__p8_1, NULL, 0 }; static long _vq_quantlist__44u6__p9_0[] = { 7, 6, 8, 5, 9, 4, 10, 3, 11, 2, 12, 1, 13, 0, 14, }; static long _vq_lengthlist__44u6__p9_0[] = { 1, 3, 3,10,12,13,13,13,13,13,13,13,13,13,13, 3, 9, 9,13,13,13,13,13,13,13,13,13,13,12,12, 4, 9, 9,12,12,12,12,12,12,12,12,12,12,12,12, 9,12,12, 12,12,12,12,12,12,12,12,12,12,12,12, 9,11,12,12, 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, 12, }; static float _vq_quantthresh__44u6__p9_0[] = { -1657.5, -1402.5, -1147.5, -892.5, -637.5, -382.5, -127.5, 127.5, 382.5, 637.5, 892.5, 1147.5, 1402.5, 1657.5, }; static long _vq_quantmap__44u6__p9_0[] = { 13, 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, 14, }; static encode_aux_threshmatch _vq_auxt__44u6__p9_0 = { _vq_quantthresh__44u6__p9_0, _vq_quantmap__44u6__p9_0, 15, 15 }; static static_codebook _44u6__p9_0 = { 2, 225, _vq_lengthlist__44u6__p9_0, 1, -514071552, 1627381760, 4, 0, _vq_quantlist__44u6__p9_0, NULL, &_vq_auxt__44u6__p9_0, NULL, 0 }; static long _vq_quantlist__44u6__p9_1[] = { 7, 6, 8, 5, 9, 4, 10, 3, 11, 2, 12, 1, 13, 0, 14, }; static long _vq_lengthlist__44u6__p9_1[] = { 1, 4, 4, 7, 7, 8, 8, 7, 7, 8, 8, 9, 9, 9, 9, 5, 6, 6, 8, 8,10,10, 9, 9,10, 9,10, 9,10,10, 4, 6, 6, 8, 9,10,10, 8, 9, 9,10,10,10,10,10, 7, 9, 8, 10,10,11,11,10,10,11,11,11,11,12,12, 7, 8, 8,10, 10,11,11,10,10,10,11,11,11,11,12, 8,10,10,11,11, 12,12,11,11,11,11,12,12,12,13, 8, 9, 9,11,11,12, 12,11,11,12,12,12,12,12,12, 8, 9, 9,10,10,11,11, 13,12,13,12,13,13,13,13, 8, 9, 9,10,10,11,11,12, 12,12,12,13,12,13,12, 9,10,10,11,11,12,12,13,13, 14,12,13,13,14,13, 9,10,10,11,11,12,12,12,12,13, 13,13,13,14,14, 9,11,10,11,11,12,13,13,12,13,13, 15,13,14,14, 9,10,10,11,12,12,13,13,13,13,13,14, 14,14,14,10,11,11,12,12,13,12,13,13,14,14,14,14, 14,15,10,11,11,11,12,13,13,13,13,14,14,14,14,14, 14, }; static float _vq_quantthresh__44u6__p9_1[] = { -110.5, -93.5, -76.5, -59.5, -42.5, -25.5, -8.5, 8.5, 25.5, 42.5, 59.5, 76.5, 93.5, 110.5, }; static long _vq_quantmap__44u6__p9_1[] = { 13, 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, 14, }; static encode_aux_threshmatch _vq_auxt__44u6__p9_1 = { _vq_quantthresh__44u6__p9_1, _vq_quantmap__44u6__p9_1, 15, 15 }; static static_codebook _44u6__p9_1 = { 2, 225, _vq_lengthlist__44u6__p9_1, 1, -522338304, 1620115456, 4, 0, _vq_quantlist__44u6__p9_1, NULL, &_vq_auxt__44u6__p9_1, NULL, 0 }; static long _vq_quantlist__44u6__p9_2[] = { 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15, 0, 16, }; static long _vq_lengthlist__44u6__p9_2[] = { 3, 5, 5, 7, 7, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 5, 6, 6, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 5, 6, 6, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 7, 7, 7, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 7, 7, 7, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8, 9, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,10, 9,10,10, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,10,10, 9,10, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,10, 9,10,10, 9, 9, 9, 9, 9, 9, 9, 9, 9,10, 9, 9, 9,10, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,10, 9,10,10, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,10, 9,10,10, 9, 9, 9,10, 9, }; static float _vq_quantthresh__44u6__p9_2[] = { -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, }; static long _vq_quantmap__44u6__p9_2[] = { 15, 13, 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, 14, 16, }; static encode_aux_threshmatch _vq_auxt__44u6__p9_2 = { _vq_quantthresh__44u6__p9_2, _vq_quantmap__44u6__p9_2, 17, 17 }; static static_codebook _44u6__p9_2 = { 2, 289, _vq_lengthlist__44u6__p9_2, 1, -529530880, 1611661312, 5, 0, _vq_quantlist__44u6__p9_2, NULL, &_vq_auxt__44u6__p9_2, NULL, 0 }; static long _huff_lengthlist__44u6__short[] = { 5,11,15,14,17,14,17,15,17,17, 4, 6, 9, 9,14, 9, 17,10,15,17, 6, 6, 5, 7, 7, 9,11,10,15,17, 6, 8, 8,10, 9,11,14,13,16,17, 7, 6, 5, 7, 5, 7, 5, 8, 15,17, 9, 8, 8, 9, 8,10,10,11,14,17,10, 8, 7, 9, 4, 7, 3, 5,11,17,10,10,10,10, 6, 9, 4, 5,11,17, 16,16,13,15, 5,10, 4, 3, 9,16,17,17,14,17, 7,11, 6, 6,11,17, }; static static_codebook _huff_book__44u6__short = { 2, 100, _huff_lengthlist__44u6__short, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _huff_lengthlist__44u7__long[] = { 3, 9,15,13,16,13,16,12,12,12, 5, 5, 7, 8, 8,10, 11,10,13,13,10, 5, 5, 6, 6, 9, 9,10,14,14, 9, 6, 6, 7, 6, 8, 9,10,13,12,13, 7, 5, 6, 4, 6, 6, 8, 12,13,11, 8, 7, 8, 6, 7, 7, 7,11,13,15,10, 8, 8, 5, 6, 4, 5, 9,13, 9, 9, 8, 9, 7, 7, 4, 4, 6,11, 11,11,12,12,10,10, 8, 5, 5, 9,10,12,13,15,13,13, 12, 7, 6, 8, }; static static_codebook _huff_book__44u7__long = { 2, 100, _huff_lengthlist__44u7__long, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _vq_quantlist__44u7__p1_0[] = { 1, 0, 2, }; static long _vq_lengthlist__44u7__p1_0[] = { 1, 4, 4, 5, 7, 7, 4, 7, 7, 5, 8, 8, 8,10,10, 7, 10,10, 5, 8, 8, 7,10, 9, 8,10,10, 5, 8, 8, 8,11, 10, 8,10,10, 8,11,10,10,12,13,11,13,13, 7,10,10, 10,13,11,11,13,13, 5, 8, 8, 8,11,10, 8,10,10, 7, 10,10,11,13,13,10,11,13, 8,11,11,10,13,13,10,13, 12, }; static float _vq_quantthresh__44u7__p1_0[] = { -0.5, 0.5, }; static long _vq_quantmap__44u7__p1_0[] = { 1, 0, 2, }; static encode_aux_threshmatch _vq_auxt__44u7__p1_0 = { _vq_quantthresh__44u7__p1_0, _vq_quantmap__44u7__p1_0, 3, 3 }; static static_codebook _44u7__p1_0 = { 4, 81, _vq_lengthlist__44u7__p1_0, 1, -535822336, 1611661312, 2, 0, _vq_quantlist__44u7__p1_0, NULL, &_vq_auxt__44u7__p1_0, NULL, 0 }; static long _vq_quantlist__44u7__p2_0[] = { 1, 0, 2, }; static long _vq_lengthlist__44u7__p2_0[] = { 3, 5, 4, 5, 6, 6, 5, 6, 6, 5, 6, 6, 6, 7, 8, 6, 7, 7, 5, 6, 6, 6, 7, 7, 6, 8, 8, 5, 6, 6, 6, 8, 7, 6, 7, 8, 6, 8, 8, 8, 9, 9, 8, 9, 9, 6, 7, 7, 7, 9, 8, 8, 9, 9, 5, 6, 6, 6, 8, 7, 6, 7, 8, 6, 7, 7, 8, 9, 9, 7, 8, 9, 6, 8, 8, 8, 9, 9, 8, 9, 9, }; static float _vq_quantthresh__44u7__p2_0[] = { -0.5, 0.5, }; static long _vq_quantmap__44u7__p2_0[] = { 1, 0, 2, }; static encode_aux_threshmatch _vq_auxt__44u7__p2_0 = { _vq_quantthresh__44u7__p2_0, _vq_quantmap__44u7__p2_0, 3, 3 }; static static_codebook _44u7__p2_0 = { 4, 81, _vq_lengthlist__44u7__p2_0, 1, -535822336, 1611661312, 2, 0, _vq_quantlist__44u7__p2_0, NULL, &_vq_auxt__44u7__p2_0, NULL, 0 }; static long _vq_quantlist__44u7__p3_0[] = { 2, 1, 3, 0, 4, }; static long _vq_lengthlist__44u7__p3_0[] = { 2, 5, 5, 8, 8, 5, 7, 6, 9, 9, 5, 6, 7, 9, 9, 8, 9, 9,12,12, 8, 9, 9,12,12, 5, 7, 7,10, 9, 7, 9, 9,11,11, 6, 8, 9,10,11,10,11,11,13,14, 9,10,11, 13,13, 5, 7, 7, 9, 9, 6, 9, 8,11,10, 7, 9, 9,11, 11, 9,11,10,13,13,10,11,11,14,13, 8,10,10,14,13, 10,11,11,16,14, 9,11,11,14,14,13,15,14,17,16,12, 13,14,16,15, 8, 9,10,13,14, 9,11,11,14,14,10,11, 11,14,15,13,13,14,17,17,13,14,15,16,17, 5, 7, 7, 10,10, 7, 9, 8,11,11, 7, 8, 9,11,11,10,11,11,14, 14,10,11,11,14,14, 7, 9, 9,11,11, 9,11,11,13,13, 9,11,11,13,13,11,12,13,15,17,11,12,13,16,18, 6, 8, 8,11,11, 8,10,10,13,12, 9,11,11,12,13,11,13, 11,16,14,11,13,12,16,16,10,11,11,15,15,11,13,13, 16,16,11,13,13,18,16,14,14,15,17,16,14,15,17,19, 0, 9,11,11,14,15,10,12,12,15,17,11,13,13,15,17, 14,15,13, 0,15,15,17,16,18, 0, 5, 7, 7, 9,10, 7, 9, 9,11,11, 7, 8, 9,11,11,10,11,11,14,14,10,11, 11,14,14, 6, 8, 9,11,11, 9,11,11,14,13, 8,10,10, 11,14,11,13,13,17,15,11,12,13,14,16, 7, 9, 9,11, 11, 9,11,11,13,12, 9,11,11,12,13,11,13,12,15,15, 11,13,12,16,15, 9,11,11,15,15,11,12,13,16,15,10, 11,12,16,15,15,16,16, 0, 0,14,13,15,16,19, 9,11, 12,15,15,11,13,13,17,16,11,13,12,15,17,14,16,16, 18, 0,15,15,16,18,17, 8,10,10,13,14,10,11,11,15, 16,10,11,11,15,16,14,15,15,17,19,14,14,15,19,19, 9,11,11,16,15,11,13,13,17,17,11,13,13,17,17,15, 17,16, 0, 0,15,17,17, 0,17, 9,11,11,15,15,11,13, 12,16,16,11,13,13,18,17,15,16,15,19,19,14,16,18, 17,19,13,15,15, 0,18,14,16,17,17,18,14,16,16,19, 19,18,19,19, 0, 0,16,17,18,19, 0,12,14,14,16,18, 13,16,14, 0,19,14,16,17,19, 0,16,19,16,19,17,17, 18,18, 0, 0, 8,10,10,14,13, 9,11,11,15,14,10,11, 12,14,16,13,15,14,19,19,14,16,16,18,17, 9,11,11, 16,15,11,13,13, 0,17,10,12,13,15,16,15,18,16,19, 19,14,15,16,18,18, 9,11,12,15,15,11,13,13,17,19, 11,13,13,17,17,15,17,16,19,19,15,17,16, 0, 0,12, 14,14, 0,19,14,16,15, 0,19,13,14,16,19, 0,16,18, 18, 0, 0,16,16,17,17, 0,13,14,14,17, 0,14,17,16, 0,19,14,16,16,19,18,17,19,17, 0, 0,18,18,17, 0, 0, }; static float _vq_quantthresh__44u7__p3_0[] = { -1.5, -0.5, 0.5, 1.5, }; static long _vq_quantmap__44u7__p3_0[] = { 3, 1, 0, 2, 4, }; static encode_aux_threshmatch _vq_auxt__44u7__p3_0 = { _vq_quantthresh__44u7__p3_0, _vq_quantmap__44u7__p3_0, 5, 5 }; static static_codebook _44u7__p3_0 = { 4, 625, _vq_lengthlist__44u7__p3_0, 1, -533725184, 1611661312, 3, 0, _vq_quantlist__44u7__p3_0, NULL, &_vq_auxt__44u7__p3_0, NULL, 0 }; static long _vq_quantlist__44u7__p4_0[] = { 2, 1, 3, 0, 4, }; static long _vq_lengthlist__44u7__p4_0[] = { 5, 6, 6, 8, 8, 6, 7, 6, 9, 9, 6, 6, 7, 9, 9, 8, 9, 9,11,11, 8, 9, 9,11,11, 6, 7, 7, 9, 9, 7, 8, 7,10,10, 6, 7, 8, 9,10, 9,10,10,11,12, 9, 9,10, 11,12, 6, 7, 7, 9, 9, 6, 7, 7,10, 9, 7, 7, 8,10, 10, 9,10, 9,12,11, 9,10,10,12,11, 8, 9, 9,11,11, 9,10,10,12,12, 9,10,10,11,12,11,12,12,13,13,11, 11,12,12,13, 8, 9, 9,11,11, 9,10,10,12,11, 9,10, 10,12,12,11,12,11,13,12,11,12,12,13,14, 6, 7, 7, 9, 9, 7, 8, 7,10, 9, 7, 7, 8, 9,10, 9,10,10,12, 11, 9,10,10,11,12, 7, 8, 8,10,10, 8, 8, 8,10,10, 8, 8, 8,10,10,10,10,11,12,12,10,10,11,12,12, 6, 7, 7,10,10, 7, 8, 8,10,10, 8, 8, 8,10,11, 9,10, 10,12,11,10,10,11,12,12, 9,10,10,12,12,10,10,10, 12,12,10,11,10,12,12,12,12,12,13,14,12,12,12,13, 14, 9,10,10,11,12, 9,10,10,12,12,10,10,11,12,12, 11,12,11,14,12,12,12,12,14,14, 6, 7, 7, 9, 9, 7, 8, 7,10, 9, 7, 7, 8, 9,10, 9,10,10,12,11, 9,10, 10,11,12, 6, 7, 7,10,10, 8, 8, 8,11,10, 7, 8, 8, 10,10,10,10,10,12,12,10,10,10,11,12, 7, 8, 8,10, 10, 8, 8, 8,10,10, 8, 8, 8,10,10,10,11,10,12,12, 10,11,10,12,12, 9,10,10,12,12,10,11,10,13,12, 9, 10,10,12,12,12,12,12,14,14,11,11,12,12,14, 9,10, 10,12,12,10,10,10,12,12,10,11,10,12,12,12,12,12, 14,14,12,12,12,14,13, 8, 9, 9,11,11, 9,10,10,12, 12, 9,10,10,12,12,11,12,12,14,13,11,12,12,13,13, 9,10,10,12,12,10,10,10,12,12,10,11,11,12,12,12, 12,13,14,14,12,12,12,14,14, 9,10, 9,12,12, 9,10, 10,12,12,10,10,11,12,12,12,12,11,14,13,12,12,12, 13,14,11,12,12,13,13,12,12,12,14,14,12,13,12,14, 14,13,13,14,13,15,14,14,14,15,15,11,11,11,13,13, 11,12,11,14,13,12,12,12,14,14,12,13,12,15,12,13, 14,14,15,15, 8, 9, 9,11,11, 9,10,10,12,12, 9,10, 10,12,12,11,12,12,13,13,11,12,12,13,14, 9,10,10, 12,11,10,10,10,12,12, 9,10,10,12,12,12,13,12,14, 13,11,12,12,13,14, 9,10,10,12,12,10,10,10,12,12, 10,11,11,12,12,12,12,12,14,14,12,13,12,14,13,11, 11,11,13,13,12,12,12,14,13,11,11,12,13,14,13,14, 14,15,15,13,12,13,12,15,11,12,12,13,14,12,12,12, 14,14,11,12,12,14,14,13,14,14,15,15,13,14,13,15, 13, }; static float _vq_quantthresh__44u7__p4_0[] = { -1.5, -0.5, 0.5, 1.5, }; static long _vq_quantmap__44u7__p4_0[] = { 3, 1, 0, 2, 4, }; static encode_aux_threshmatch _vq_auxt__44u7__p4_0 = { _vq_quantthresh__44u7__p4_0, _vq_quantmap__44u7__p4_0, 5, 5 }; static static_codebook _44u7__p4_0 = { 4, 625, _vq_lengthlist__44u7__p4_0, 1, -533725184, 1611661312, 3, 0, _vq_quantlist__44u7__p4_0, NULL, &_vq_auxt__44u7__p4_0, NULL, 0 }; static long _vq_quantlist__44u7__p5_0[] = { 4, 3, 5, 2, 6, 1, 7, 0, 8, }; static long _vq_lengthlist__44u7__p5_0[] = { 2, 3, 3, 6, 6, 8, 8,10,10, 3, 5, 5, 8, 7, 8, 8, 11,11, 4, 5, 5, 7, 8, 8, 8,11,11, 6, 8, 7, 9, 9, 10, 9,12,12, 6, 7, 8, 9,10, 9,10,12,12, 8, 8, 8, 10, 9,12,11,13,13, 8, 8, 8, 9,10,11,12,13,13,10, 11,11,12,11,13,13,14,14,10,11,11,12,12,13,13,14, 14, }; static float _vq_quantthresh__44u7__p5_0[] = { -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, }; static long _vq_quantmap__44u7__p5_0[] = { 7, 5, 3, 1, 0, 2, 4, 6, 8, }; static encode_aux_threshmatch _vq_auxt__44u7__p5_0 = { _vq_quantthresh__44u7__p5_0, _vq_quantmap__44u7__p5_0, 9, 9 }; static static_codebook _44u7__p5_0 = { 2, 81, _vq_lengthlist__44u7__p5_0, 1, -531628032, 1611661312, 4, 0, _vq_quantlist__44u7__p5_0, NULL, &_vq_auxt__44u7__p5_0, NULL, 0 }; static long _vq_quantlist__44u7__p6_0[] = { 4, 3, 5, 2, 6, 1, 7, 0, 8, }; static long _vq_lengthlist__44u7__p6_0[] = { 4, 4, 4, 5, 5, 7, 7, 9, 9, 4, 4, 4, 6, 6, 7, 7, 9, 9, 4, 4, 5, 6, 6, 7, 7, 9, 9, 5, 6, 6, 7, 7, 8, 8, 9, 9, 5, 6, 6, 6, 7, 8, 8, 9, 9, 7, 7, 7, 8, 8, 9, 9,10,10, 7, 7, 7, 8, 8, 9, 9,10,10, 9, 9, 9,10, 9,10,10,11,11, 9, 9, 9, 9,10,10,10,11, 11, }; static float _vq_quantthresh__44u7__p6_0[] = { -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, }; static long _vq_quantmap__44u7__p6_0[] = { 7, 5, 3, 1, 0, 2, 4, 6, 8, }; static encode_aux_threshmatch _vq_auxt__44u7__p6_0 = { _vq_quantthresh__44u7__p6_0, _vq_quantmap__44u7__p6_0, 9, 9 }; static static_codebook _44u7__p6_0 = { 2, 81, _vq_lengthlist__44u7__p6_0, 1, -531628032, 1611661312, 4, 0, _vq_quantlist__44u7__p6_0, NULL, &_vq_auxt__44u7__p6_0, NULL, 0 }; static long _vq_quantlist__44u7__p7_0[] = { 1, 0, 2, }; static long _vq_lengthlist__44u7__p7_0[] = { 1, 4, 4, 5, 7, 7, 5, 7, 7, 5, 9, 8, 8,10,10, 8, 10,10, 5, 8, 9, 8,10,10, 8,10,10, 4, 9, 9, 9,11, 12, 8,12,11, 8,12,11,11,12,13,10,13,13, 7,12,11, 10,13,12,10,13,13, 4, 9, 9, 8,11,12, 9,11,12, 7, 11,12,10,13,13,10,12,13, 8,11,12,10,13,13,10,13, 12, }; static float _vq_quantthresh__44u7__p7_0[] = { -5.5, 5.5, }; static long _vq_quantmap__44u7__p7_0[] = { 1, 0, 2, }; static encode_aux_threshmatch _vq_auxt__44u7__p7_0 = { _vq_quantthresh__44u7__p7_0, _vq_quantmap__44u7__p7_0, 3, 3 }; static static_codebook _44u7__p7_0 = { 4, 81, _vq_lengthlist__44u7__p7_0, 1, -529137664, 1618345984, 2, 0, _vq_quantlist__44u7__p7_0, NULL, &_vq_auxt__44u7__p7_0, NULL, 0 }; static long _vq_quantlist__44u7__p7_1[] = { 5, 4, 6, 3, 7, 2, 8, 1, 9, 0, 10, }; static long _vq_lengthlist__44u7__p7_1[] = { 3, 5, 4, 6, 6, 7, 7, 8, 8, 8, 8, 5, 5, 5, 6, 6, 7, 7, 8, 8, 8, 8, 5, 5, 5, 6, 6, 7, 7, 8, 8, 8, 8, 6, 6, 6, 7, 7, 8, 7, 8, 8, 8, 8, 6, 6, 6, 7, 7, 7, 8, 8, 8, 8, 8, 7, 7, 7, 8, 7, 8, 8, 9, 9, 9, 9, 7, 7, 7, 7, 8, 8, 8, 9, 9, 9, 9, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, }; static float _vq_quantthresh__44u7__p7_1[] = { -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, }; static long _vq_quantmap__44u7__p7_1[] = { 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, }; static encode_aux_threshmatch _vq_auxt__44u7__p7_1 = { _vq_quantthresh__44u7__p7_1, _vq_quantmap__44u7__p7_1, 11, 11 }; static static_codebook _44u7__p7_1 = { 2, 121, _vq_lengthlist__44u7__p7_1, 1, -531365888, 1611661312, 4, 0, _vq_quantlist__44u7__p7_1, NULL, &_vq_auxt__44u7__p7_1, NULL, 0 }; static long _vq_quantlist__44u7__p8_0[] = { 5, 4, 6, 3, 7, 2, 8, 1, 9, 0, 10, }; static long _vq_lengthlist__44u7__p8_0[] = { 1, 4, 4, 6, 6, 8, 8, 9, 9,10,10, 4, 6, 6, 7, 7, 9, 9,10,10,11,11, 4, 6, 6, 7, 7, 9, 9,10,10,11, 11, 6, 8, 8, 9, 9,10,10,11,11,12,12, 6, 8, 8, 9, 9,10,10,11,11,12,12, 8, 9, 9,10,10,11,11,12,12, 14,13, 8, 9, 9,10,10,11,11,12,12,13,13,10,10,10, 11,11,12,12,13,13,14,14,10,10,10,11,11,12,13,13, 13,14,14,11,12,11,13,12,13,14,14,14,15,15,11,11, 12,13,13,13,13,14,14,15,15, }; static float _vq_quantthresh__44u7__p8_0[] = { -49.5, -38.5, -27.5, -16.5, -5.5, 5.5, 16.5, 27.5, 38.5, 49.5, }; static long _vq_quantmap__44u7__p8_0[] = { 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, }; static encode_aux_threshmatch _vq_auxt__44u7__p8_0 = { _vq_quantthresh__44u7__p8_0, _vq_quantmap__44u7__p8_0, 11, 11 }; static static_codebook _44u7__p8_0 = { 2, 121, _vq_lengthlist__44u7__p8_0, 1, -524582912, 1618345984, 4, 0, _vq_quantlist__44u7__p8_0, NULL, &_vq_auxt__44u7__p8_0, NULL, 0 }; static long _vq_quantlist__44u7__p8_1[] = { 5, 4, 6, 3, 7, 2, 8, 1, 9, 0, 10, }; static long _vq_lengthlist__44u7__p8_1[] = { 3, 5, 5, 6, 6, 7, 7, 7, 7, 8, 8, 5, 6, 6, 7, 6, 7, 7, 7, 7, 8, 8, 5, 6, 6, 6, 7, 7, 7, 7, 7, 8, 8, 6, 7, 6, 7, 7, 7, 7, 8, 8, 8, 8, 6, 6, 7, 7, 7, 7, 7, 8, 8, 8, 8, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, }; static float _vq_quantthresh__44u7__p8_1[] = { -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, }; static long _vq_quantmap__44u7__p8_1[] = { 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, }; static encode_aux_threshmatch _vq_auxt__44u7__p8_1 = { _vq_quantthresh__44u7__p8_1, _vq_quantmap__44u7__p8_1, 11, 11 }; static static_codebook _44u7__p8_1 = { 2, 121, _vq_lengthlist__44u7__p8_1, 1, -531365888, 1611661312, 4, 0, _vq_quantlist__44u7__p8_1, NULL, &_vq_auxt__44u7__p8_1, NULL, 0 }; static long _vq_quantlist__44u7__p9_0[] = { 5, 4, 6, 3, 7, 2, 8, 1, 9, 0, 10, }; static long _vq_lengthlist__44u7__p9_0[] = { 1, 4, 4, 9, 9, 9, 9, 9, 9, 9, 9, 5, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 4, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, }; static float _vq_quantthresh__44u7__p9_0[] = { -2866.5, -2229.5, -1592.5, -955.5, -318.5, 318.5, 955.5, 1592.5, 2229.5, 2866.5, }; static long _vq_quantmap__44u7__p9_0[] = { 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, }; static encode_aux_threshmatch _vq_auxt__44u7__p9_0 = { _vq_quantthresh__44u7__p9_0, _vq_quantmap__44u7__p9_0, 11, 11 }; static static_codebook _44u7__p9_0 = { 2, 121, _vq_lengthlist__44u7__p9_0, 1, -512171520, 1630791680, 4, 0, _vq_quantlist__44u7__p9_0, NULL, &_vq_auxt__44u7__p9_0, NULL, 0 }; static long _vq_quantlist__44u7__p9_1[] = { 6, 5, 7, 4, 8, 3, 9, 2, 10, 1, 11, 0, 12, }; static long _vq_lengthlist__44u7__p9_1[] = { 1, 4, 4, 5, 5, 7, 7,10, 9,11,11,12,12, 4, 7, 6, 8, 8, 9, 9,11,10,13,12,13,13, 4, 6, 7, 8, 8, 9, 9,10,11,13,13,12,13, 5, 8, 8,10, 9,12,11,12,12, 13,13,15,14, 6, 8, 8,10,10,11,11,13,12,13,14,14, 15, 8,10,10,12,11,13,13,14,15,15,16,15,16, 8, 9, 10,12,12,13,13,16,15,15,15,15,15,10,11,11,14,13, 14,14,16,16,15,16,16,16,10,12,12,12,14,14,14,15, 16,15,16,15,16,11,12,12,14,14,16,16,15,16,16,16, 16,16,12,12,13,13,15,15,14,15,16,16,16,16,16,12, 14,14,15,14,16,16,16,16,16,16,16,16,13,14,13,14, 15,16,15,16,16,16,16,16,16, }; static float _vq_quantthresh__44u7__p9_1[] = { -269.5, -220.5, -171.5, -122.5, -73.5, -24.5, 24.5, 73.5, 122.5, 171.5, 220.5, 269.5, }; static long _vq_quantmap__44u7__p9_1[] = { 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, }; static encode_aux_threshmatch _vq_auxt__44u7__p9_1 = { _vq_quantthresh__44u7__p9_1, _vq_quantmap__44u7__p9_1, 13, 13 }; static static_codebook _44u7__p9_1 = { 2, 169, _vq_lengthlist__44u7__p9_1, 1, -518889472, 1622704128, 4, 0, _vq_quantlist__44u7__p9_1, NULL, &_vq_auxt__44u7__p9_1, NULL, 0 }; static long _vq_quantlist__44u7__p9_2[] = { 24, 23, 25, 22, 26, 21, 27, 20, 28, 19, 29, 18, 30, 17, 31, 16, 32, 15, 33, 14, 34, 13, 35, 12, 36, 11, 37, 10, 38, 9, 39, 8, 40, 7, 41, 6, 42, 5, 43, 4, 44, 3, 45, 2, 46, 1, 47, 0, 48, }; static long _vq_lengthlist__44u7__p9_2[] = { 2, 4, 3, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 7, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, }; static float _vq_quantthresh__44u7__p9_2[] = { -23.5, -22.5, -21.5, -20.5, -19.5, -18.5, -17.5, -16.5, -15.5, -14.5, -13.5, -12.5, -11.5, -10.5, -9.5, -8.5, -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, 9.5, 10.5, 11.5, 12.5, 13.5, 14.5, 15.5, 16.5, 17.5, 18.5, 19.5, 20.5, 21.5, 22.5, 23.5, }; static long _vq_quantmap__44u7__p9_2[] = { 47, 45, 43, 41, 39, 37, 35, 33, 31, 29, 27, 25, 23, 21, 19, 17, 15, 13, 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, }; static encode_aux_threshmatch _vq_auxt__44u7__p9_2 = { _vq_quantthresh__44u7__p9_2, _vq_quantmap__44u7__p9_2, 49, 49 }; static static_codebook _44u7__p9_2 = { 1, 49, _vq_lengthlist__44u7__p9_2, 1, -526909440, 1611661312, 6, 0, _vq_quantlist__44u7__p9_2, NULL, &_vq_auxt__44u7__p9_2, NULL, 0 }; static long _huff_lengthlist__44u7__short[] = { 6,14,18,18,18,18,17,17,17,17, 4, 8,11,12,13,11, 13,11,16,17, 6, 7, 8, 9, 8, 9,12, 9,14,17, 6, 9, 11,12,12,12,15,12,17,17, 6, 6, 6, 8, 5, 7, 7, 8, 14,17, 7, 9, 9,11, 8,10,10,11,14,16, 8, 7, 7, 8, 5, 7, 4, 5,11,17, 9, 8,10, 9, 7, 9, 4, 2, 9,16, 15,14,16,14, 8,14, 4, 3, 7,16,17,17,16,17, 9,15, 6, 5,10,17, }; static static_codebook _huff_book__44u7__short = { 2, 100, _huff_lengthlist__44u7__short, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _huff_lengthlist__44u8__long[] = { 3, 9,13,13,14,13,13,13,13,14, 5, 4, 6, 8,10,12, 13,15,13,14, 9, 5, 3, 5, 8,10,12,14,13,13,11, 7, 4, 3, 5, 7,10,11,12,14,11, 9, 7, 4, 4, 6, 8,10, 13,14,10,11, 9, 7, 6, 6, 7, 9,12,15,12,11,11, 8, 7, 6, 6, 7,11,14,12,12,12,10, 8, 7, 6, 7, 9,13, 11,12,13,12,11, 8, 8, 7, 9,12,11,14,16,16,15,11, 10, 9, 9,11, }; static static_codebook _huff_book__44u8__long = { 2, 100, _huff_lengthlist__44u8__long, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _huff_lengthlist__44u8__short[] = { 7,15,18,18,18,18,18,18,18,18, 4, 6, 9,10,10,11, 16,15,18,18, 5, 6, 6, 6, 8,10,15,15,18,18, 5, 6, 5, 4, 6, 9,12,15,17,18, 7, 6, 6, 5, 6, 5, 8,11, 15,18,10, 9, 9, 7, 4, 3, 6,10,16,17,13,12,12, 6, 6, 4, 5, 9,14,16,16,17,13, 5, 5, 4, 5, 8,13,16, 17,17,14, 7, 7, 6, 7,10,15,17,17,17,17,11,12,12, 12,14,17,17, }; static static_codebook _huff_book__44u8__short = { 2, 100, _huff_lengthlist__44u8__short, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _vq_quantlist__44u8_p1_0[] = { 1, 0, 2, }; static long _vq_lengthlist__44u8_p1_0[] = { 1, 5, 5, 5, 7, 7, 5, 7, 7, 5, 7, 7, 8, 9, 9, 7, 8, 9, 5, 7, 7, 7, 9, 8, 8, 9, 9, 5, 7, 7, 7, 9, 9, 7, 9, 9, 8, 9, 9, 9,10,11, 9,10,10, 7, 9, 9, 9,10, 9, 9,10,11, 5, 7, 7, 7, 9, 9, 8, 9, 9, 7, 9, 9, 9,11,10, 9, 9,10, 8, 9, 9, 9,10,10, 9,11, 10, }; static float _vq_quantthresh__44u8_p1_0[] = { -0.5, 0.5, }; static long _vq_quantmap__44u8_p1_0[] = { 1, 0, 2, }; static encode_aux_threshmatch _vq_auxt__44u8_p1_0 = { _vq_quantthresh__44u8_p1_0, _vq_quantmap__44u8_p1_0, 3, 3 }; static static_codebook _44u8_p1_0 = { 4, 81, _vq_lengthlist__44u8_p1_0, 1, -535822336, 1611661312, 2, 0, _vq_quantlist__44u8_p1_0, NULL, &_vq_auxt__44u8_p1_0, NULL, 0 }; static long _vq_quantlist__44u8_p2_0[] = { 2, 1, 3, 0, 4, }; static long _vq_lengthlist__44u8_p2_0[] = { 4, 5, 5, 8, 8, 6, 7, 6, 9, 9, 5, 6, 7, 9, 9, 8, 9, 9,11,11, 8, 9, 9,11,11, 6, 7, 7, 9, 9, 7, 8, 8,10,10, 7, 7, 8, 9,10, 9,10,10,12,12, 9, 9,10, 11,12, 6, 7, 7, 9, 9, 7, 8, 7,10, 9, 7, 8, 8,10, 10, 9,10, 9,12,11, 9,10,10,12,12, 8, 9, 9,11,11, 9,10,10,12,12, 9,10,10,12,12,11,12,12,13,13,11, 11,12,13,13, 8, 9, 9,11,11, 9,10,10,12,12, 9,10, 10,12,12,11,12,11,13,13,11,12,12,14,13, 5, 7, 7, 9, 9, 7, 8, 8,10,10, 7, 8, 8,10,10, 9,10,10,12, 12, 9,10,10,11,12, 7, 8, 8,10,10, 8, 9, 9,11,11, 8, 9, 9,10,11,10,11,11,12,12,10,10,11,12,13, 6, 8, 8,10,10, 7, 8, 8,11,10, 8, 8, 9,10,11,10,11, 10,12,11,10,11,11,12,12, 9,10,10,12,12,10,11,11, 13,13,10,11,11,13,13,12,12,13,13,14,12,12,13,14, 14, 9,10,10,12,12, 9,10,10,12,12,10,11,11,12,13, 11,12,11,14,12,12,12,12,14,14, 5, 7, 7, 9, 9, 7, 8, 8,10,10, 7, 8, 8,10,10, 9,10,10,12,11, 9,10, 10,12,12, 6, 8, 8,10,10, 8, 9, 8,11,10, 7, 8, 8, 10,11,10,11,11,13,12,10,10,11,11,13, 7, 8, 8,10, 10, 8, 9, 9,11,10, 8, 9, 9,11,11,10,11,10,13,12, 10,11,11,12,12, 9,10,10,12,12,10,11,11,13,12, 9, 10,10,12,12,12,13,13,14,14,11,11,12,12,14, 9,10, 10,12,12,10,11,11,13,13,10,11,11,13,12,12,13,12, 14,14,12,13,12,14,13, 8, 9, 9,11,11, 9,10,10,12, 12, 9,10,10,12,12,11,12,12,14,13,11,12,12,13,14, 9,10,10,12,12,10,11,11,13,13,10,11,11,13,13,12, 13,13,14,15,12,12,13,14,14, 9,10,10,12,12, 9,11, 10,13,12,10,11,11,12,13,12,13,12,14,13,12,12,13, 14,14,11,12,12,14,14,12,12,12,14,14,12,13,13,14, 14,13,13,14,14,16,14,14,14,15,15,11,12,12,14,14, 11,12,11,14,13,12,12,13,14,14,13,14,12,15,13,14, 14,14,15,16, 8, 9, 9,11,11, 9,10,10,12,12, 9,10, 10,12,12,11,12,12,14,13,11,12,12,13,14, 9,10,10, 12,12,10,11,10,13,12, 9,10,11,12,13,12,13,12,14, 14,12,12,13,13,14, 9,10,10,12,12,10,11,11,13,13, 10,11,11,13,13,12,12,12,14,14,12,13,12,15,14,11, 12,11,14,13,12,13,12,14,14,11,11,12,13,14,13,14, 14,16,15,13,12,14,13,15,11,12,12,13,14,12,13,13, 14,14,12,13,12,14,14,14,14,14,15,16,13,14,13,15, 14, }; static float _vq_quantthresh__44u8_p2_0[] = { -1.5, -0.5, 0.5, 1.5, }; static long _vq_quantmap__44u8_p2_0[] = { 3, 1, 0, 2, 4, }; static encode_aux_threshmatch _vq_auxt__44u8_p2_0 = { _vq_quantthresh__44u8_p2_0, _vq_quantmap__44u8_p2_0, 5, 5 }; static static_codebook _44u8_p2_0 = { 4, 625, _vq_lengthlist__44u8_p2_0, 1, -533725184, 1611661312, 3, 0, _vq_quantlist__44u8_p2_0, NULL, &_vq_auxt__44u8_p2_0, NULL, 0 }; static long _vq_quantlist__44u8_p3_0[] = { 4, 3, 5, 2, 6, 1, 7, 0, 8, }; static long _vq_lengthlist__44u8_p3_0[] = { 3, 4, 4, 5, 5, 7, 7, 9, 9, 4, 5, 4, 6, 6, 7, 7, 9, 9, 4, 4, 5, 6, 6, 7, 7, 9, 9, 5, 6, 6, 7, 7, 8, 8,10,10, 6, 6, 6, 7, 7, 8, 8, 9,10, 7, 7, 7, 8, 8, 9, 9,11,10, 7, 7, 7, 8, 8, 9, 9,10,11, 9, 9, 9,10,10,11,10,12,12, 9, 9, 9,10,10,10,11,12, 12, }; static float _vq_quantthresh__44u8_p3_0[] = { -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, }; static long _vq_quantmap__44u8_p3_0[] = { 7, 5, 3, 1, 0, 2, 4, 6, 8, }; static encode_aux_threshmatch _vq_auxt__44u8_p3_0 = { _vq_quantthresh__44u8_p3_0, _vq_quantmap__44u8_p3_0, 9, 9 }; static static_codebook _44u8_p3_0 = { 2, 81, _vq_lengthlist__44u8_p3_0, 1, -531628032, 1611661312, 4, 0, _vq_quantlist__44u8_p3_0, NULL, &_vq_auxt__44u8_p3_0, NULL, 0 }; static long _vq_quantlist__44u8_p4_0[] = { 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15, 0, 16, }; static long _vq_lengthlist__44u8_p4_0[] = { 4, 4, 4, 6, 6, 7, 7, 8, 8, 8, 8,10,10,11,11,11, 11, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9,10,10,11,11, 12,12, 5, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9,10,10,11, 11,11,12, 6, 6, 6, 7, 7, 8, 7, 9, 9, 9, 9,10,10, 11,11,12,12, 6, 6, 6, 7, 7, 7, 8, 8, 9, 9, 9,10, 10,11,11,12,12, 7, 7, 7, 8, 7, 9, 8, 9, 9,10, 9, 11,10,11,11,12,12, 7, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10,10,10,11,11,12,12, 8, 8, 8, 9, 9, 9, 9,10,10, 10,10,11,11,11,11,12,12, 8, 8, 8, 8, 9, 9, 9,10, 10,10,10,11,11,11,12,12,12, 9, 9, 9, 9, 9,10, 9, 10,10,11,10,11,11,12,12,12,12, 9, 9, 9, 9, 9, 9, 10,10,10,11,11,11,11,12,12,12,13,10,10,10,10,10, 11,10,11,11,11,11,12,12,12,12,12,13,10,10,10,10, 10,10,11,11,11,11,11,12,12,12,12,13,12,11,11,11, 11,11,11,11,12,12,12,12,12,12,12,13,13,13,11,11, 11,11,11,11,11,12,12,12,12,12,12,13,12,13,13,11, 12,12,12,12,12,12,12,12,12,12,13,13,13,13,13,13, 12,12,12,12,12,12,12,12,12,12,13,13,13,13,13,13, 13, }; static float _vq_quantthresh__44u8_p4_0[] = { -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, }; static long _vq_quantmap__44u8_p4_0[] = { 15, 13, 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, 14, 16, }; static encode_aux_threshmatch _vq_auxt__44u8_p4_0 = { _vq_quantthresh__44u8_p4_0, _vq_quantmap__44u8_p4_0, 17, 17 }; static static_codebook _44u8_p4_0 = { 2, 289, _vq_lengthlist__44u8_p4_0, 1, -529530880, 1611661312, 5, 0, _vq_quantlist__44u8_p4_0, NULL, &_vq_auxt__44u8_p4_0, NULL, 0 }; static long _vq_quantlist__44u8_p5_0[] = { 1, 0, 2, }; static long _vq_lengthlist__44u8_p5_0[] = { 1, 5, 5, 5, 7, 7, 5, 7, 7, 5, 8, 7, 7, 8, 9, 7, 9, 9, 5, 7, 8, 7, 9, 9, 7, 9, 8, 5, 7, 7, 8, 9, 9, 7, 9, 9, 7, 9, 9, 8, 9,11, 9,11,11, 7, 9, 9, 9,11,10, 9,11,11, 5, 7, 8, 7, 9, 9, 8, 9, 9, 7, 9, 9, 9,11,11, 9,10,11, 7, 9, 9, 9,11,11, 8,11, 9, }; static float _vq_quantthresh__44u8_p5_0[] = { -5.5, 5.5, }; static long _vq_quantmap__44u8_p5_0[] = { 1, 0, 2, }; static encode_aux_threshmatch _vq_auxt__44u8_p5_0 = { _vq_quantthresh__44u8_p5_0, _vq_quantmap__44u8_p5_0, 3, 3 }; static static_codebook _44u8_p5_0 = { 4, 81, _vq_lengthlist__44u8_p5_0, 1, -529137664, 1618345984, 2, 0, _vq_quantlist__44u8_p5_0, NULL, &_vq_auxt__44u8_p5_0, NULL, 0 }; static long _vq_quantlist__44u8_p5_1[] = { 5, 4, 6, 3, 7, 2, 8, 1, 9, 0, 10, }; static long _vq_lengthlist__44u8_p5_1[] = { 4, 5, 5, 6, 6, 7, 7, 7, 7, 7, 8, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 6, 6, 6, 7, 7, 7, 7, 8, 7, 8, 8, 6, 6, 6, 7, 7, 7, 7, 7, 8, 8, 8, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, }; static float _vq_quantthresh__44u8_p5_1[] = { -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, }; static long _vq_quantmap__44u8_p5_1[] = { 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, }; static encode_aux_threshmatch _vq_auxt__44u8_p5_1 = { _vq_quantthresh__44u8_p5_1, _vq_quantmap__44u8_p5_1, 11, 11 }; static static_codebook _44u8_p5_1 = { 2, 121, _vq_lengthlist__44u8_p5_1, 1, -531365888, 1611661312, 4, 0, _vq_quantlist__44u8_p5_1, NULL, &_vq_auxt__44u8_p5_1, NULL, 0 }; static long _vq_quantlist__44u8_p6_0[] = { 6, 5, 7, 4, 8, 3, 9, 2, 10, 1, 11, 0, 12, }; static long _vq_lengthlist__44u8_p6_0[] = { 1, 4, 4, 7, 7, 8, 8, 8, 8, 9,10,10,10, 5, 6, 6, 7, 7, 8, 8, 9, 9,10,10,11,11, 5, 6, 6, 7, 7, 8, 9, 9, 9,10,10,11,11, 7, 7, 7, 8, 8, 9, 9,10,10, 11,11,11,11, 7, 7, 7, 8, 8, 9, 9,10,10,10,11,11, 11, 8, 9, 9, 9, 9,10,10,10,10,11,11,12,12, 8, 9, 9, 9, 9,10,10,10,11,11,11,12,12, 8, 9, 9,10,10, 11,10,11,11,12,12,12,12, 9, 9, 9,10,10,11,11,11, 11,12,12,12,12,10,10,10,11,11,11,11,12,12,12,12, 13,13,10,10,10,11,11,11,11,12,12,12,12,13,13,11, 11,11,12,12,12,12,12,12,13,13,13,13,11,11,11,12, 12,12,12,12,12,13,13,13,13, }; static float _vq_quantthresh__44u8_p6_0[] = { -27.5, -22.5, -17.5, -12.5, -7.5, -2.5, 2.5, 7.5, 12.5, 17.5, 22.5, 27.5, }; static long _vq_quantmap__44u8_p6_0[] = { 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, }; static encode_aux_threshmatch _vq_auxt__44u8_p6_0 = { _vq_quantthresh__44u8_p6_0, _vq_quantmap__44u8_p6_0, 13, 13 }; static static_codebook _44u8_p6_0 = { 2, 169, _vq_lengthlist__44u8_p6_0, 1, -526516224, 1616117760, 4, 0, _vq_quantlist__44u8_p6_0, NULL, &_vq_auxt__44u8_p6_0, NULL, 0 }; static long _vq_quantlist__44u8_p6_1[] = { 2, 1, 3, 0, 4, }; static long _vq_lengthlist__44u8_p6_1[] = { 3, 4, 4, 5, 5, 4, 5, 5, 5, 5, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, }; static float _vq_quantthresh__44u8_p6_1[] = { -1.5, -0.5, 0.5, 1.5, }; static long _vq_quantmap__44u8_p6_1[] = { 3, 1, 0, 2, 4, }; static encode_aux_threshmatch _vq_auxt__44u8_p6_1 = { _vq_quantthresh__44u8_p6_1, _vq_quantmap__44u8_p6_1, 5, 5 }; static static_codebook _44u8_p6_1 = { 2, 25, _vq_lengthlist__44u8_p6_1, 1, -533725184, 1611661312, 3, 0, _vq_quantlist__44u8_p6_1, NULL, &_vq_auxt__44u8_p6_1, NULL, 0 }; static long _vq_quantlist__44u8_p7_0[] = { 6, 5, 7, 4, 8, 3, 9, 2, 10, 1, 11, 0, 12, }; static long _vq_lengthlist__44u8_p7_0[] = { 1, 4, 4, 7, 7, 8, 8, 8, 8, 9, 9,10,10, 4, 6, 6, 8, 8, 9, 8, 9, 9,10,10,11,11, 4, 6, 6, 8, 8, 8, 9, 9, 9,10,10,11,11, 7, 8, 8, 9, 9,10,10,10,10, 11,11,12,12, 7, 8, 8, 9, 9,10,10,10,10,11,11,12, 12, 8, 9, 9,10,10,10,10,11,11,12,12,13,13, 8, 9, 9,10,10,10,11,11,11,12,13,13,13, 9, 9, 9,10,10, 11,11,12,12,13,13,14,14, 9, 9, 9,10,10,11,11,12, 12,13,13,14,14,10,10,10,11,11,12,12,13,13,14,14, 14,14,10,10,11,11,12,12,12,13,13,13,14,14,15,11, 11,11,12,12,13,13,14,14,14,14,16,15,11,11,11,12, 12,13,13,14,14,14,14,16,15, }; static float _vq_quantthresh__44u8_p7_0[] = { -60.5, -49.5, -38.5, -27.5, -16.5, -5.5, 5.5, 16.5, 27.5, 38.5, 49.5, 60.5, }; static long _vq_quantmap__44u8_p7_0[] = { 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, }; static encode_aux_threshmatch _vq_auxt__44u8_p7_0 = { _vq_quantthresh__44u8_p7_0, _vq_quantmap__44u8_p7_0, 13, 13 }; static static_codebook _44u8_p7_0 = { 2, 169, _vq_lengthlist__44u8_p7_0, 1, -523206656, 1618345984, 4, 0, _vq_quantlist__44u8_p7_0, NULL, &_vq_auxt__44u8_p7_0, NULL, 0 }; static long _vq_quantlist__44u8_p7_1[] = { 5, 4, 6, 3, 7, 2, 8, 1, 9, 0, 10, }; static long _vq_lengthlist__44u8_p7_1[] = { 4, 5, 5, 6, 6, 7, 7, 7, 7, 7, 7, 5, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 5, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 6, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 6, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, }; static float _vq_quantthresh__44u8_p7_1[] = { -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, }; static long _vq_quantmap__44u8_p7_1[] = { 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, }; static encode_aux_threshmatch _vq_auxt__44u8_p7_1 = { _vq_quantthresh__44u8_p7_1, _vq_quantmap__44u8_p7_1, 11, 11 }; static static_codebook _44u8_p7_1 = { 2, 121, _vq_lengthlist__44u8_p7_1, 1, -531365888, 1611661312, 4, 0, _vq_quantlist__44u8_p7_1, NULL, &_vq_auxt__44u8_p7_1, NULL, 0 }; static long _vq_quantlist__44u8_p8_0[] = { 7, 6, 8, 5, 9, 4, 10, 3, 11, 2, 12, 1, 13, 0, 14, }; static long _vq_lengthlist__44u8_p8_0[] = { 1, 4, 4, 7, 7, 8, 8, 8, 7, 9, 8,10,10,11,11, 4, 6, 6, 8, 8,10,10, 9, 9,10,10,11,10,12,12, 4, 6, 6, 8, 8, 9,10, 9, 9,10,10,11,11,11,12, 7, 8, 8, 10,10,11,11,11,10,11,11,13,12,13,12, 7, 8, 8,10, 10,11,11,10,11,11,11,12,12,13,13, 8,10, 9,11,11, 12,12,11,11,12,12,13,13,14,14, 8, 9, 9,11,11,12, 12,11,11,12,12,14,13,13,13, 8, 9, 9,11,10,12,11, 12,12,13,13,14,13,14,13, 8, 9, 9,11,11,11,12,12, 12,13,13,13,14,14,14, 9,10,10,12,11,12,12,13,13, 14,14,15,13,14,14, 9,10,10,11,12,12,12,13,13,14, 14,15,14,14,14,10,11,11,12,12,13,13,14,13,14,14, 15,14,15,15,10,11,11,12,12,13,13,13,14,14,14,14, 15,16,15,11,12,12,13,12,14,14,14,13,15,14,16,15, 16,15,11,12,12,13,13,13,14,14,15,15,15,15,16,15, 15, }; static float _vq_quantthresh__44u8_p8_0[] = { -136.5, -115.5, -94.5, -73.5, -52.5, -31.5, -10.5, 10.5, 31.5, 52.5, 73.5, 94.5, 115.5, 136.5, }; static long _vq_quantmap__44u8_p8_0[] = { 13, 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, 14, }; static encode_aux_threshmatch _vq_auxt__44u8_p8_0 = { _vq_quantthresh__44u8_p8_0, _vq_quantmap__44u8_p8_0, 15, 15 }; static static_codebook _44u8_p8_0 = { 2, 225, _vq_lengthlist__44u8_p8_0, 1, -520986624, 1620377600, 4, 0, _vq_quantlist__44u8_p8_0, NULL, &_vq_auxt__44u8_p8_0, NULL, 0 }; static long _vq_quantlist__44u8_p8_1[] = { 10, 9, 11, 8, 12, 7, 13, 6, 14, 5, 15, 4, 16, 3, 17, 2, 18, 1, 19, 0, 20, }; static long _vq_lengthlist__44u8_p8_1[] = { 4, 6, 6, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 6, 6, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 6, 7, 6, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 7, 7, 7, 8, 8, 8, 8, 9, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,10, 9, 9,10, 9,10, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,10, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10, 9,10,10, 9,10, 9,10, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,10,10, 9,10,10, 9,10, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,10, 9,10,10,10, 10,10, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,10, 10,10,10,10,10,10,10, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,10, 9,10,10,10,10,10,10,10,10, 9, 9, 9, 9, 9, 9, 9, 9, 9,10, 9, 9,10,10,10,10,10,10,10,10, 10, 9, 9, 9, 9, 9, 9, 9, 9, 9,10,10,10,10,10,10, 10,10,10,10,10,10, 9, 9, 9, 9, 9, 9, 9, 9,10,10, 10,10,10,10,10,10,10,10,10,10,10, 9, 9, 9, 9,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 9, 9, 9, 9, 9, 9,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10, 9, 9, 9, 9, 9, 9, 9, 9,10,10,10, 10,10,10,10,10,10,10,10,10,10, 9, 9, 9, 9, 9, 9, 10,10, 9,10,10,10,10,10,10,10,10,10,10,10,10, 9, 9, 9, 9, 9, 9,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10, 9, 9, 9, 9, 9,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10, }; static float _vq_quantthresh__44u8_p8_1[] = { -9.5, -8.5, -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, 9.5, }; static long _vq_quantmap__44u8_p8_1[] = { 19, 17, 15, 13, 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, }; static encode_aux_threshmatch _vq_auxt__44u8_p8_1 = { _vq_quantthresh__44u8_p8_1, _vq_quantmap__44u8_p8_1, 21, 21 }; static static_codebook _44u8_p8_1 = { 2, 441, _vq_lengthlist__44u8_p8_1, 1, -529268736, 1611661312, 5, 0, _vq_quantlist__44u8_p8_1, NULL, &_vq_auxt__44u8_p8_1, NULL, 0 }; static long _vq_quantlist__44u8_p9_0[] = { 4, 3, 5, 2, 6, 1, 7, 0, 8, }; static long _vq_lengthlist__44u8_p9_0[] = { 1, 4, 4, 9, 9, 9, 9, 9, 9, 5, 9, 9, 8, 8, 8, 8, 8, 8, 4, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, }; static float _vq_quantthresh__44u8_p9_0[] = { -3258.5, -2327.5, -1396.5, -465.5, 465.5, 1396.5, 2327.5, 3258.5, }; static long _vq_quantmap__44u8_p9_0[] = { 7, 5, 3, 1, 0, 2, 4, 6, 8, }; static encode_aux_threshmatch _vq_auxt__44u8_p9_0 = { _vq_quantthresh__44u8_p9_0, _vq_quantmap__44u8_p9_0, 9, 9 }; static static_codebook _44u8_p9_0 = { 2, 81, _vq_lengthlist__44u8_p9_0, 1, -511895552, 1631393792, 4, 0, _vq_quantlist__44u8_p9_0, NULL, &_vq_auxt__44u8_p9_0, NULL, 0 }; static long _vq_quantlist__44u8_p9_1[] = { 9, 8, 10, 7, 11, 6, 12, 5, 13, 4, 14, 3, 15, 2, 16, 1, 17, 0, 18, }; static long _vq_lengthlist__44u8_p9_1[] = { 1, 4, 4, 7, 7, 8, 8, 7, 8, 9, 9,10,10,11,11,12, 12,12,12, 4, 7, 6, 9, 9, 9, 9, 9, 8, 9, 9,11,10, 12,11,13,12,13,14, 4, 6, 6, 9, 9, 9, 9, 8, 9, 9, 10,10,11,12,12,12,12,13,12, 7, 9, 8,11,10,10,10, 10,10,11,11,12,11,14,12,13,14,14,13, 7, 8, 9,10, 10,10,10,10,10,11,11,12,13,13,13,14,15,15,13, 8, 9, 9,11,11,11,11,11,12,13,12,14,14,14,14,14,14, 15,13, 8, 9, 9,10,11,11,11,12,12,13,12,13,14,13, 15,14,15,15,15, 8, 9, 9,10,10,12,11,13,12,13,13, 14,14,13,15,14,15,14,14, 8, 9, 9,10,11,12,12,13, 13,14,14,14,14,15,15,15,12,14,14, 9,11,10,11,11, 14,12,13,14,15,14,14,14,14,15,15,15,15,15, 9,10, 11,11,12,12,13,13,14,14,14,14,15,15,14,15,15,15, 15,10,11,11,12,12,14,14,13,14,14,15,15,15,15,15, 15,15,15,15,10,11,11,12,13,13,13,14,14,15,15,14, 14,15,15,15,15,14,15,11,12,13,15,13,14,15,15,15, 15,14,15,15,15,15,15,15,15,15,11,12,12,14,14,14, 13,14,15,15,14,15,15,15,15,15,15,15,15,13,13,14, 13,13,14,14,15,14,15,15,15,15,15,15,15,15,15,15, 11,14,13,14,14,15,14,14,15,15,15,15,15,15,15,15, 15,15,15,12,12,13,14,13,13,14,15,14,15,15,15,15, 15,15,15,15,15,15,13,13,14,14,13,15,14,14,15,15, 14,15,15,15,15,15,15,15,15, }; static float _vq_quantthresh__44u8_p9_1[] = { -416.5, -367.5, -318.5, -269.5, -220.5, -171.5, -122.5, -73.5, -24.5, 24.5, 73.5, 122.5, 171.5, 220.5, 269.5, 318.5, 367.5, 416.5, }; static long _vq_quantmap__44u8_p9_1[] = { 17, 15, 13, 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, }; static encode_aux_threshmatch _vq_auxt__44u8_p9_1 = { _vq_quantthresh__44u8_p9_1, _vq_quantmap__44u8_p9_1, 19, 19 }; static static_codebook _44u8_p9_1 = { 2, 361, _vq_lengthlist__44u8_p9_1, 1, -518287360, 1622704128, 5, 0, _vq_quantlist__44u8_p9_1, NULL, &_vq_auxt__44u8_p9_1, NULL, 0 }; static long _vq_quantlist__44u8_p9_2[] = { 24, 23, 25, 22, 26, 21, 27, 20, 28, 19, 29, 18, 30, 17, 31, 16, 32, 15, 33, 14, 34, 13, 35, 12, 36, 11, 37, 10, 38, 9, 39, 8, 40, 7, 41, 6, 42, 5, 43, 4, 44, 3, 45, 2, 46, 1, 47, 0, 48, }; static long _vq_lengthlist__44u8_p9_2[] = { 2, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, }; static float _vq_quantthresh__44u8_p9_2[] = { -23.5, -22.5, -21.5, -20.5, -19.5, -18.5, -17.5, -16.5, -15.5, -14.5, -13.5, -12.5, -11.5, -10.5, -9.5, -8.5, -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, 9.5, 10.5, 11.5, 12.5, 13.5, 14.5, 15.5, 16.5, 17.5, 18.5, 19.5, 20.5, 21.5, 22.5, 23.5, }; static long _vq_quantmap__44u8_p9_2[] = { 47, 45, 43, 41, 39, 37, 35, 33, 31, 29, 27, 25, 23, 21, 19, 17, 15, 13, 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, }; static encode_aux_threshmatch _vq_auxt__44u8_p9_2 = { _vq_quantthresh__44u8_p9_2, _vq_quantmap__44u8_p9_2, 49, 49 }; static static_codebook _44u8_p9_2 = { 1, 49, _vq_lengthlist__44u8_p9_2, 1, -526909440, 1611661312, 6, 0, _vq_quantlist__44u8_p9_2, NULL, &_vq_auxt__44u8_p9_2, NULL, 0 }; static long _huff_lengthlist__44u9__long[] = { 3, 9,13,13,14,14,13,14,14,13, 5, 5, 9,10,12,13, 13,14,14,14, 9, 5, 6, 6, 8,11,12,14,14,14,11, 7, 5, 3, 5, 8,10,12,13,12,12,10, 7, 4, 3, 5, 8,10, 12,13,10,12, 9, 7, 4, 4, 6, 8,11,13,12,12,11, 9, 7, 5, 6, 7, 9,13,12,12,12,11, 8, 7, 6, 6, 8,12, 12,12,13,12,10, 9, 7, 7, 8,11,11,13,15,15,14,12, 10, 9, 9,10, }; static static_codebook _huff_book__44u9__long = { 2, 100, _huff_lengthlist__44u9__long, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _huff_lengthlist__44u9__short[] = { 10,17,18,18,18,18,18,18,18,18, 5, 8,12,13,14,13, 16,17,16,17, 5, 6, 8, 8,10, 9,12,16,16,17, 5, 6, 7, 5, 6, 9,12,15,16,16, 7, 6, 6, 4, 5, 7, 9,14, 15,17,10, 8, 8, 6, 6, 3, 5, 9,13,18,14,11,11,10, 6, 3, 4, 7,13,17,15,16,16,10, 5, 6, 4, 4, 9,13, 18,18,18,11, 6, 8, 5, 6,10,15,18,18,18,14,10,11, 9,10,16,18, }; static static_codebook _huff_book__44u9__short = { 2, 100, _huff_lengthlist__44u9__short, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _vq_quantlist__44u9_p1_0[] = { 1, 0, 2, }; static long _vq_lengthlist__44u9_p1_0[] = { 1, 5, 5, 5, 7, 7, 5, 7, 7, 5, 7, 7, 8, 9, 9, 7, 9, 9, 5, 7, 7, 7, 9, 9, 7, 9, 9, 5, 7, 7, 7, 9, 9, 7, 9, 9, 8, 9, 9, 9,10,11, 9,11,10, 7, 9, 9, 9,11,10, 9,10,11, 5, 7, 7, 7, 9, 9, 7, 9, 9, 7, 9, 9, 9,11,11, 9,10,11, 8, 9, 9, 9,10,10, 9,11, 10, }; static float _vq_quantthresh__44u9_p1_0[] = { -0.5, 0.5, }; static long _vq_quantmap__44u9_p1_0[] = { 1, 0, 2, }; static encode_aux_threshmatch _vq_auxt__44u9_p1_0 = { _vq_quantthresh__44u9_p1_0, _vq_quantmap__44u9_p1_0, 3, 3 }; static static_codebook _44u9_p1_0 = { 4, 81, _vq_lengthlist__44u9_p1_0, 1, -535822336, 1611661312, 2, 0, _vq_quantlist__44u9_p1_0, NULL, &_vq_auxt__44u9_p1_0, NULL, 0 }; static long _vq_quantlist__44u9_p2_0[] = { 2, 1, 3, 0, 4, }; static long _vq_lengthlist__44u9_p2_0[] = { 3, 6, 5, 8, 8, 6, 7, 7, 9, 9, 6, 7, 7, 9, 9, 8, 9, 9,11,10, 8, 9, 9,10,11, 6, 7, 7, 9, 9, 7, 8, 8,10,10, 7, 8, 8, 9,10, 9,10,10,11,11, 9, 9,10, 11,11, 6, 7, 7, 9, 9, 7, 8, 7,10, 9, 7, 8, 8,10, 10, 9,10, 9,11,11, 9,10,10,11,11, 8, 9, 9,11,11, 9,10,10,12,11, 9,10,10,11,11,11,12,12,13,13,11, 11,11,12,13, 8, 9, 9,11,11, 9,10,10,11,11, 9,10, 10,12,12,11,11,11,13,12,11,11,11,13,13, 6, 7, 7, 9, 9, 7, 8, 8,10, 9, 7, 8, 8, 9,10, 9,10,10,11, 11, 9,10,10,11,11, 7, 8, 8,10,10, 8, 9, 9,10,10, 8, 9, 9,10,10,10,10,10,12,12,10,10,10,11,12, 7, 8, 8,10,10, 8, 9, 8,10,10, 8, 9, 9,10,10, 9,10, 10,12,11,10,10,10,12,12, 9,10,10,12,11,10,10,10, 12,12,10,10,10,12,12,12,12,12,12,13,11,12,12,13, 13, 9,10,10,11,11, 9,10,10,12,11,10,10,10,12,12, 11,12,11,13,12,12,12,12,13,13, 6, 7, 7, 9, 9, 7, 8, 8,10, 9, 7, 8, 8, 9,10, 9,10,10,12,11, 9,10, 10,11,11, 7, 8, 8,10, 9, 8, 9, 9,11,10, 8, 8, 9, 10,10,10,10,10,12,12,10,10,10,11,12, 7, 8, 8,10, 10, 8, 9, 9,10,10, 8, 9, 9,10,10,10,10,10,12,12, 10,10,10,12,12, 9,10,10,11,11,10,11,10,12,12, 9, 10,10,11,12,11,12,12,13,13,11,11,12,11,13, 9,10, 10,11,12,10,10,10,12,12,10,10,10,12,12,11,12,12, 13,13,12,12,12,13,13, 8, 9, 9,11,11, 9,10,10,12, 11, 9,10,10,11,12,11,12,12,13,13,11,11,12,13,13, 9,10,10,12,12,10,10,10,12,12,10,11,10,12,12,12, 12,12,13,13,12,12,12,13,13, 9,10,10,12,11,10,10, 10,12,11,10,10,10,12,12,11,12,12,13,13,12,12,12, 13,14,11,12,12,13,13,11,12,12,13,13,11,12,12,13, 13,13,13,14,13,15,13,13,13,14,14,11,11,11,13,13, 11,12,11,13,13,11,12,12,13,13,12,13,12,14,12,13, 13,13,15,14, 8, 9, 9,11,11, 9,10,10,11,11, 9,10, 10,11,12,11,12,11,13,13,11,12,12,13,13, 9,10,10, 11,11,10,11,10,12,12, 9,10,10,12,12,12,12,12,13, 13,11,11,12,12,13, 9,10,10,12,12,10,10,11,12,12, 10,11,10,12,12,11,12,12,13,13,12,12,12,13,13,11, 11,11,13,13,11,12,12,13,13,11,11,12,13,13,13,13, 13,14,14,12,12,13,12,14,11,11,12,13,13,12,12,12, 14,13,11,12,12,13,13,13,13,13,14,14,13,13,13,14, 13, }; static float _vq_quantthresh__44u9_p2_0[] = { -1.5, -0.5, 0.5, 1.5, }; static long _vq_quantmap__44u9_p2_0[] = { 3, 1, 0, 2, 4, }; static encode_aux_threshmatch _vq_auxt__44u9_p2_0 = { _vq_quantthresh__44u9_p2_0, _vq_quantmap__44u9_p2_0, 5, 5 }; static static_codebook _44u9_p2_0 = { 4, 625, _vq_lengthlist__44u9_p2_0, 1, -533725184, 1611661312, 3, 0, _vq_quantlist__44u9_p2_0, NULL, &_vq_auxt__44u9_p2_0, NULL, 0 }; static long _vq_quantlist__44u9_p3_0[] = { 4, 3, 5, 2, 6, 1, 7, 0, 8, }; static long _vq_lengthlist__44u9_p3_0[] = { 3, 4, 4, 5, 5, 7, 7, 9, 8, 4, 5, 5, 6, 6, 7, 7, 9, 9, 4, 5, 5, 6, 6, 7, 7, 9, 9, 5, 6, 6, 7, 6, 8, 7, 9, 9, 5, 6, 6, 6, 7, 7, 8, 9, 9, 7, 7, 7, 8, 7, 9, 8,10,10, 7, 7, 7, 7, 8, 8, 9,10,10, 9, 9, 9, 9, 9,10,10,11,11, 9, 9, 9, 9, 9,10,10,11, 11, }; static float _vq_quantthresh__44u9_p3_0[] = { -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, }; static long _vq_quantmap__44u9_p3_0[] = { 7, 5, 3, 1, 0, 2, 4, 6, 8, }; static encode_aux_threshmatch _vq_auxt__44u9_p3_0 = { _vq_quantthresh__44u9_p3_0, _vq_quantmap__44u9_p3_0, 9, 9 }; static static_codebook _44u9_p3_0 = { 2, 81, _vq_lengthlist__44u9_p3_0, 1, -531628032, 1611661312, 4, 0, _vq_quantlist__44u9_p3_0, NULL, &_vq_auxt__44u9_p3_0, NULL, 0 }; static long _vq_quantlist__44u9_p4_0[] = { 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15, 0, 16, }; static long _vq_lengthlist__44u9_p4_0[] = { 4, 5, 5, 6, 6, 7, 7, 8, 8, 8, 8, 9, 9,10,10,11, 11, 5, 5, 5, 6, 6, 7, 7, 8, 8, 8, 8,10, 9,11,10, 12,11, 5, 5, 5, 6, 6, 7, 7, 8, 8, 8, 8, 9,10,10, 11,11,11, 6, 6, 6, 7, 6, 7, 7, 8, 8, 9, 9,10,10, 11,11,12,12, 6, 6, 6, 6, 7, 7, 7, 8, 8, 9, 9,10, 10,11,11,12,12, 7, 7, 7, 7, 7, 8, 8, 9, 8, 9, 9, 10,10,11,11,12,12, 7, 7, 7, 7, 7, 8, 8, 8, 9, 9, 9,10,10,11,11,12,12, 8, 8, 8, 8, 8, 9, 8, 9, 9, 10,10,11,10,12,11,12,12, 8, 8, 8, 8, 8, 8, 9, 9, 9,10,10,10,11,11,12,12,13, 8, 8, 8, 9, 9, 9, 9, 10,10,11,10,11,11,12,12,13,12, 8, 8, 9, 9, 9, 9, 9,10,10,10,11,11,11,12,12,12,13, 9,10, 9,10,10, 10,10,11,10,11,11,12,11,13,12,13,13, 9, 9,10,10, 10,10,10,10,11,11,11,11,12,12,13,13,13,10,11,10, 11,11,11,11,12,11,12,12,13,12,13,13,14,13,10,10, 11,11,11,11,11,11,12,12,12,12,13,13,13,13,14,11, 12,11,12,12,12,12,12,12,13,13,13,13,14,13,14,14, 11,11,12,12,12,12,12,12,12,12,13,13,13,13,14,14, 14, }; static float _vq_quantthresh__44u9_p4_0[] = { -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, }; static long _vq_quantmap__44u9_p4_0[] = { 15, 13, 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, 14, 16, }; static encode_aux_threshmatch _vq_auxt__44u9_p4_0 = { _vq_quantthresh__44u9_p4_0, _vq_quantmap__44u9_p4_0, 17, 17 }; static static_codebook _44u9_p4_0 = { 2, 289, _vq_lengthlist__44u9_p4_0, 1, -529530880, 1611661312, 5, 0, _vq_quantlist__44u9_p4_0, NULL, &_vq_auxt__44u9_p4_0, NULL, 0 }; static long _vq_quantlist__44u9_p5_0[] = { 1, 0, 2, }; static long _vq_lengthlist__44u9_p5_0[] = { 1, 5, 5, 5, 7, 7, 5, 7, 7, 5, 8, 7, 7, 8, 9, 7, 8, 9, 5, 7, 8, 7, 9, 8, 7, 9, 8, 5, 8, 8, 8, 9, 9, 7, 9, 9, 7, 9, 9, 8, 9,11, 9,11,10, 7, 9, 9, 9,11, 9, 9,10,11, 5, 7, 8, 7, 9, 9, 8, 9, 9, 7, 9, 9, 9,11,10, 9, 9,11, 7, 9, 9, 9,10,11, 8,11, 9, }; static float _vq_quantthresh__44u9_p5_0[] = { -5.5, 5.5, }; static long _vq_quantmap__44u9_p5_0[] = { 1, 0, 2, }; static encode_aux_threshmatch _vq_auxt__44u9_p5_0 = { _vq_quantthresh__44u9_p5_0, _vq_quantmap__44u9_p5_0, 3, 3 }; static static_codebook _44u9_p5_0 = { 4, 81, _vq_lengthlist__44u9_p5_0, 1, -529137664, 1618345984, 2, 0, _vq_quantlist__44u9_p5_0, NULL, &_vq_auxt__44u9_p5_0, NULL, 0 }; static long _vq_quantlist__44u9_p5_1[] = { 5, 4, 6, 3, 7, 2, 8, 1, 9, 0, 10, }; static long _vq_lengthlist__44u9_p5_1[] = { 5, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, }; static float _vq_quantthresh__44u9_p5_1[] = { -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, }; static long _vq_quantmap__44u9_p5_1[] = { 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, }; static encode_aux_threshmatch _vq_auxt__44u9_p5_1 = { _vq_quantthresh__44u9_p5_1, _vq_quantmap__44u9_p5_1, 11, 11 }; static static_codebook _44u9_p5_1 = { 2, 121, _vq_lengthlist__44u9_p5_1, 1, -531365888, 1611661312, 4, 0, _vq_quantlist__44u9_p5_1, NULL, &_vq_auxt__44u9_p5_1, NULL, 0 }; static long _vq_quantlist__44u9_p6_0[] = { 6, 5, 7, 4, 8, 3, 9, 2, 10, 1, 11, 0, 12, }; static long _vq_lengthlist__44u9_p6_0[] = { 2, 4, 4, 6, 6, 7, 7, 8, 8, 9, 9,10,10, 4, 5, 5, 7, 7, 8, 8, 8, 8,10,10,11,11, 4, 5, 5, 7, 7, 8, 8, 8, 8,10,10,11,11, 6, 7, 7, 8, 7, 8, 8, 9, 9, 10,10,11,11, 6, 7, 7, 8, 7, 8, 8, 9, 9,10,10,11, 11, 7, 8, 8, 8, 8, 9, 9, 9,10,11,11,12,12, 7, 8, 8, 8, 8, 9, 9,10, 9,11,11,12,12, 8, 9, 8, 9, 9, 10,10,10,10,11,11,12,12, 8, 8, 8, 9, 9,10, 9,10, 10,11,11,12,12, 9,10,10,10,10,11,11,11,11,12,12, 13,13, 9,10,10,10,10,11,11,11,11,12,12,13,12,10, 11,11,11,11,12,12,12,12,12,12,13,13,10,11,11,11, 11,12,12,12,12,13,12,13,13, }; static float _vq_quantthresh__44u9_p6_0[] = { -27.5, -22.5, -17.5, -12.5, -7.5, -2.5, 2.5, 7.5, 12.5, 17.5, 22.5, 27.5, }; static long _vq_quantmap__44u9_p6_0[] = { 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, }; static encode_aux_threshmatch _vq_auxt__44u9_p6_0 = { _vq_quantthresh__44u9_p6_0, _vq_quantmap__44u9_p6_0, 13, 13 }; static static_codebook _44u9_p6_0 = { 2, 169, _vq_lengthlist__44u9_p6_0, 1, -526516224, 1616117760, 4, 0, _vq_quantlist__44u9_p6_0, NULL, &_vq_auxt__44u9_p6_0, NULL, 0 }; static long _vq_quantlist__44u9_p6_1[] = { 2, 1, 3, 0, 4, }; static long _vq_lengthlist__44u9_p6_1[] = { 4, 4, 4, 5, 5, 4, 5, 4, 5, 5, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, }; static float _vq_quantthresh__44u9_p6_1[] = { -1.5, -0.5, 0.5, 1.5, }; static long _vq_quantmap__44u9_p6_1[] = { 3, 1, 0, 2, 4, }; static encode_aux_threshmatch _vq_auxt__44u9_p6_1 = { _vq_quantthresh__44u9_p6_1, _vq_quantmap__44u9_p6_1, 5, 5 }; static static_codebook _44u9_p6_1 = { 2, 25, _vq_lengthlist__44u9_p6_1, 1, -533725184, 1611661312, 3, 0, _vq_quantlist__44u9_p6_1, NULL, &_vq_auxt__44u9_p6_1, NULL, 0 }; static long _vq_quantlist__44u9_p7_0[] = { 6, 5, 7, 4, 8, 3, 9, 2, 10, 1, 11, 0, 12, }; static long _vq_lengthlist__44u9_p7_0[] = { 1, 5, 4, 6, 6, 7, 7, 8, 8, 9, 9,10,10, 5, 6, 6, 7, 7, 8, 8, 9, 9,10,10,11,11, 5, 6, 6, 7, 7, 8, 8, 9, 9,10,10,11,11, 6, 7, 7, 8, 8, 9, 9,10,10, 11,11,12,12, 7, 7, 7, 8, 8, 9, 9,10,10,11,11,12, 12, 8, 8, 8, 9, 9,10,10,11,10,12,12,13,12, 8, 8, 8, 9, 9,10,10,11,11,12,12,12,13, 9, 9, 9,10,10, 11,11,12,11,13,13,13,14, 9, 9, 9,10,10,11,11,11, 12,13,12,13,13,10,10,10,11,11,12,12,13,12,13,13, 14,14,10,10,10,11,11,11,12,12,12,13,13,14,14,11, 11,11,12,12,13,13,13,13,14,14,15,14,11,11,11,12, 12,13,13,13,14,14,15,15,15, }; static float _vq_quantthresh__44u9_p7_0[] = { -60.5, -49.5, -38.5, -27.5, -16.5, -5.5, 5.5, 16.5, 27.5, 38.5, 49.5, 60.5, }; static long _vq_quantmap__44u9_p7_0[] = { 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, }; static encode_aux_threshmatch _vq_auxt__44u9_p7_0 = { _vq_quantthresh__44u9_p7_0, _vq_quantmap__44u9_p7_0, 13, 13 }; static static_codebook _44u9_p7_0 = { 2, 169, _vq_lengthlist__44u9_p7_0, 1, -523206656, 1618345984, 4, 0, _vq_quantlist__44u9_p7_0, NULL, &_vq_auxt__44u9_p7_0, NULL, 0 }; static long _vq_quantlist__44u9_p7_1[] = { 5, 4, 6, 3, 7, 2, 8, 1, 9, 0, 10, }; static long _vq_lengthlist__44u9_p7_1[] = { 5, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 7, 7, 7, 7, 7, 7, 7, 8, 7, 8, 8, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, }; static float _vq_quantthresh__44u9_p7_1[] = { -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, }; static long _vq_quantmap__44u9_p7_1[] = { 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, }; static encode_aux_threshmatch _vq_auxt__44u9_p7_1 = { _vq_quantthresh__44u9_p7_1, _vq_quantmap__44u9_p7_1, 11, 11 }; static static_codebook _44u9_p7_1 = { 2, 121, _vq_lengthlist__44u9_p7_1, 1, -531365888, 1611661312, 4, 0, _vq_quantlist__44u9_p7_1, NULL, &_vq_auxt__44u9_p7_1, NULL, 0 }; static long _vq_quantlist__44u9_p8_0[] = { 7, 6, 8, 5, 9, 4, 10, 3, 11, 2, 12, 1, 13, 0, 14, }; static long _vq_lengthlist__44u9_p8_0[] = { 1, 4, 4, 7, 7, 8, 8, 8, 7, 9, 9,10,10,11,11, 4, 6, 6, 8, 8, 9, 9, 9, 9,10,10,11,10,12,11, 4, 6, 6, 8, 8, 9,10, 9, 9,10,10,11,11,12,12, 7, 8, 8, 10,10,11,11,11,10,11,11,12,12,13,12, 7, 8, 8,10, 10,11,11,10,10,11,12,12,12,13,13, 8,10, 9,11,11, 12,12,11,12,12,12,13,13,14,14, 8, 9, 9,11,11,12, 12,11,12,12,13,13,13,14,14, 8, 9, 9,10,10,11,11, 13,12,13,13,14,14,15,14, 8, 9, 9,10,10,11,12,12, 13,13,13,14,14,14,15, 9,10,10,11,11,13,12,13,13, 14,14,15,15,15,15, 9,10,10,11,12,12,12,13,13,14, 15,14,15,15,15,10,11,11,12,12,13,13,14,14,15,15, 15,16,16,15,10,11,11,12,12,13,14,14,14,15,14,15, 16,16,17,11,12,12,13,13,14,14,15,14,16,15,15,16, 16,16,11,12,12,13,13,14,14,14,15,15,15,16,16,17, 16, }; static float _vq_quantthresh__44u9_p8_0[] = { -136.5, -115.5, -94.5, -73.5, -52.5, -31.5, -10.5, 10.5, 31.5, 52.5, 73.5, 94.5, 115.5, 136.5, }; static long _vq_quantmap__44u9_p8_0[] = { 13, 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, 14, }; static encode_aux_threshmatch _vq_auxt__44u9_p8_0 = { _vq_quantthresh__44u9_p8_0, _vq_quantmap__44u9_p8_0, 15, 15 }; static static_codebook _44u9_p8_0 = { 2, 225, _vq_lengthlist__44u9_p8_0, 1, -520986624, 1620377600, 4, 0, _vq_quantlist__44u9_p8_0, NULL, &_vq_auxt__44u9_p8_0, NULL, 0 }; static long _vq_quantlist__44u9_p8_1[] = { 10, 9, 11, 8, 12, 7, 13, 6, 14, 5, 15, 4, 16, 3, 17, 2, 18, 1, 19, 0, 20, }; static long _vq_lengthlist__44u9_p8_1[] = { 4, 6, 6, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,10, 9, 9, 8, 8, 8, 8, 8, 9, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9,10, 9, 9, 9, 9, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,10,10,10,10, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,10, 9, 9,10,10, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,10, 9, 9,10, 10,10, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,10, 10,10,10, 9,10,10,10, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,10, 9,10,10,10,10,10,10,10,10,10, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,10,10,10,10,10,10,10,10,10, 10, 9, 9, 9, 9, 9, 9, 9, 9, 9,10, 9,10,10,10,10, 10,10,10,10,10,10, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10,10,10,10,10,10,10,10,10,10,10, 9, 9, 9, 9, 9, 9,10, 9,10,10,10,10,10,10,10,10,10,10,10,10,10, 9, 9, 9, 9, 9, 9, 9, 9,10,10, 9,10,10,10,10,10, 10,10,10,10,10, 9, 9, 9, 9, 9, 9, 9,10,10,10,10, 10,10,10,10,10,10,10,10,10,10, 9, 9, 9, 9, 9, 9, 9,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 9, 9, 9, 9, 9,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10, 9, 9, 9, 9, 9, 9,10,10, 9,10,10,10, 10,10,10,10,10,10,10,10,10, }; static float _vq_quantthresh__44u9_p8_1[] = { -9.5, -8.5, -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, 9.5, }; static long _vq_quantmap__44u9_p8_1[] = { 19, 17, 15, 13, 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, }; static encode_aux_threshmatch _vq_auxt__44u9_p8_1 = { _vq_quantthresh__44u9_p8_1, _vq_quantmap__44u9_p8_1, 21, 21 }; static static_codebook _44u9_p8_1 = { 2, 441, _vq_lengthlist__44u9_p8_1, 1, -529268736, 1611661312, 5, 0, _vq_quantlist__44u9_p8_1, NULL, &_vq_auxt__44u9_p8_1, NULL, 0 }; static long _vq_quantlist__44u9_p9_0[] = { 7, 6, 8, 5, 9, 4, 10, 3, 11, 2, 12, 1, 13, 0, 14, }; static long _vq_lengthlist__44u9_p9_0[] = { 1, 5, 5,10,10,10,10,10,10,10,10,10,10,10,10, 5, 10,10,10,10,10,10,10,10,10,10,10,10,10,10, 5,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, }; static float _vq_quantthresh__44u9_p9_0[] = { -6051.5, -5120.5, -4189.5, -3258.5, -2327.5, -1396.5, -465.5, 465.5, 1396.5, 2327.5, 3258.5, 4189.5, 5120.5, 6051.5, }; static long _vq_quantmap__44u9_p9_0[] = { 13, 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, 14, }; static encode_aux_threshmatch _vq_auxt__44u9_p9_0 = { _vq_quantthresh__44u9_p9_0, _vq_quantmap__44u9_p9_0, 15, 15 }; static static_codebook _44u9_p9_0 = { 2, 225, _vq_lengthlist__44u9_p9_0, 1, -510036736, 1631393792, 4, 0, _vq_quantlist__44u9_p9_0, NULL, &_vq_auxt__44u9_p9_0, NULL, 0 }; static long _vq_quantlist__44u9_p9_1[] = { 9, 8, 10, 7, 11, 6, 12, 5, 13, 4, 14, 3, 15, 2, 16, 1, 17, 0, 18, }; static long _vq_lengthlist__44u9_p9_1[] = { 1, 4, 4, 7, 7, 8, 8, 7, 7, 9, 9,10,10,12,11,12, 11,12,12, 4, 7, 6, 9, 9, 9, 9, 9, 9,10, 9,11, 9, 11,11,13,12,14,12, 4, 6, 6, 9, 9, 9, 9, 8, 9,10, 10,11,11,12,12,12,13,13,13, 7, 9, 8,11,11,11,11, 10,10,11,11,12,12,14,13,14,14,15,13, 7, 9, 9,10, 10,10,10,10,10,11,11,12,13,13,13,14,14,15,13, 8, 9, 9,12,10,11,11,12,11,12,12,13,13,14,14,15,16, 15,14, 8, 9, 9,10,11,12,11,11,12,13,12,14,14,13, 15,16,15,14,16, 7, 9, 9,10,10,12,11,12,13,16,13, 14,16,14,15,15,15,15,15, 7, 9, 9,10,11,11,12,12, 13,14,16,14,14,16,16,14,14,14,15, 9,10,11,12,12, 12,13,13,13,16,15,16,15,14,15,15,15,16,16, 9,10, 11,12,13,13,14,13,14,15,14,14,16,16,16,16,16,16, 16,10,11,11,13,13,15,13,15,13,14,16,16,16,16,16, 16,15,14,16,11,11,12,12,13,13,15,13,15,14,15,16, 16,16,16,16,16,16,16,12,13,13,13,13,15,14,15,16, 16,16,16,14,16,16,16,16,16,16,13,12,12,14,14,13, 15,14,16,15,16,16,16,16,16,16,16,16,15,12,12,13, 13,14,16,15,16,15,16,16,16,16,16,16,16,16,16,16, 12,13,13,14,15,14,14,16,16,15,16,16,16,16,16,16, 15,16,16,13,14,14,13,14,14,15,16,15,16,16,16,16, 16,16,16,16,15,16,12,13,13,14,14,14,14,16,16,16, 16,16,16,15,16,16,16,16,16, }; static float _vq_quantthresh__44u9_p9_1[] = { -416.5, -367.5, -318.5, -269.5, -220.5, -171.5, -122.5, -73.5, -24.5, 24.5, 73.5, 122.5, 171.5, 220.5, 269.5, 318.5, 367.5, 416.5, }; static long _vq_quantmap__44u9_p9_1[] = { 17, 15, 13, 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, }; static encode_aux_threshmatch _vq_auxt__44u9_p9_1 = { _vq_quantthresh__44u9_p9_1, _vq_quantmap__44u9_p9_1, 19, 19 }; static static_codebook _44u9_p9_1 = { 2, 361, _vq_lengthlist__44u9_p9_1, 1, -518287360, 1622704128, 5, 0, _vq_quantlist__44u9_p9_1, NULL, &_vq_auxt__44u9_p9_1, NULL, 0 }; static long _vq_quantlist__44u9_p9_2[] = { 24, 23, 25, 22, 26, 21, 27, 20, 28, 19, 29, 18, 30, 17, 31, 16, 32, 15, 33, 14, 34, 13, 35, 12, 36, 11, 37, 10, 38, 9, 39, 8, 40, 7, 41, 6, 42, 5, 43, 4, 44, 3, 45, 2, 46, 1, 47, 0, 48, }; static long _vq_lengthlist__44u9_p9_2[] = { 2, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, }; static float _vq_quantthresh__44u9_p9_2[] = { -23.5, -22.5, -21.5, -20.5, -19.5, -18.5, -17.5, -16.5, -15.5, -14.5, -13.5, -12.5, -11.5, -10.5, -9.5, -8.5, -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, 9.5, 10.5, 11.5, 12.5, 13.5, 14.5, 15.5, 16.5, 17.5, 18.5, 19.5, 20.5, 21.5, 22.5, 23.5, }; static long _vq_quantmap__44u9_p9_2[] = { 47, 45, 43, 41, 39, 37, 35, 33, 31, 29, 27, 25, 23, 21, 19, 17, 15, 13, 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, }; static encode_aux_threshmatch _vq_auxt__44u9_p9_2 = { _vq_quantthresh__44u9_p9_2, _vq_quantmap__44u9_p9_2, 49, 49 }; static static_codebook _44u9_p9_2 = { 1, 49, _vq_lengthlist__44u9_p9_2, 1, -526909440, 1611661312, 6, 0, _vq_quantlist__44u9_p9_2, NULL, &_vq_auxt__44u9_p9_2, NULL, 0 }; static long _vq_quantlist__8u0__p1_0[] = { 1, 0, 2, }; static long _vq_lengthlist__8u0__p1_0[] = { 1, 4, 4, 5, 7, 7, 5, 7, 7, 5, 8, 8, 8,10,10, 7, 10,10, 5, 8, 8, 7,10,10, 8,10,10, 4, 9, 8, 8,11, 11, 8,11,11, 7,11,11,10,11,13,10,13,13, 7,11,11, 10,13,12,10,13,13, 5, 9, 8, 8,11,11, 8,11,11, 7, 11,11, 9,13,13,10,12,13, 7,11,11,10,13,13,10,13, 11, }; static float _vq_quantthresh__8u0__p1_0[] = { -0.5, 0.5, }; static long _vq_quantmap__8u0__p1_0[] = { 1, 0, 2, }; static encode_aux_threshmatch _vq_auxt__8u0__p1_0 = { _vq_quantthresh__8u0__p1_0, _vq_quantmap__8u0__p1_0, 3, 3 }; static static_codebook _8u0__p1_0 = { 4, 81, _vq_lengthlist__8u0__p1_0, 1, -535822336, 1611661312, 2, 0, _vq_quantlist__8u0__p1_0, NULL, &_vq_auxt__8u0__p1_0, NULL, 0 }; static long _vq_quantlist__8u0__p2_0[] = { 1, 0, 2, }; static long _vq_lengthlist__8u0__p2_0[] = { 2, 4, 4, 5, 6, 6, 5, 6, 6, 5, 7, 7, 6, 7, 8, 6, 7, 8, 5, 7, 7, 6, 8, 8, 7, 9, 7, 5, 7, 7, 7, 9, 9, 7, 8, 8, 6, 9, 8, 7, 7,10, 8,10,10, 6, 8, 8, 8,10, 8, 8,10,10, 5, 7, 7, 7, 8, 8, 7, 8, 9, 6, 8, 8, 8,10,10, 8, 8,10, 6, 8, 9, 8,10,10, 7,10, 8, }; static float _vq_quantthresh__8u0__p2_0[] = { -0.5, 0.5, }; static long _vq_quantmap__8u0__p2_0[] = { 1, 0, 2, }; static encode_aux_threshmatch _vq_auxt__8u0__p2_0 = { _vq_quantthresh__8u0__p2_0, _vq_quantmap__8u0__p2_0, 3, 3 }; static static_codebook _8u0__p2_0 = { 4, 81, _vq_lengthlist__8u0__p2_0, 1, -535822336, 1611661312, 2, 0, _vq_quantlist__8u0__p2_0, NULL, &_vq_auxt__8u0__p2_0, NULL, 0 }; static long _vq_quantlist__8u0__p3_0[] = { 2, 1, 3, 0, 4, }; static long _vq_lengthlist__8u0__p3_0[] = { 1, 5, 5, 7, 7, 6, 7, 7, 9, 9, 6, 7, 7, 9, 9, 8, 10, 9,11,11, 8, 9, 9,11,11, 6, 8, 8,10,10, 8,10, 10,11,11, 8,10,10,11,11,10,11,11,12,12,10,11,11, 12,13, 6, 8, 8,10,10, 8,10,10,11,11, 8,10,10,11, 11, 9,10,11,12,12,10,11,11,12,12, 8,11,11,14,13, 10,12,11,15,13,10,12,11,14,14,12,13,12,16,14,12, 14,12,16,15, 8,11,11,13,14,10,11,12,13,15,10,11, 12,13,15,11,12,13,14,15,12,12,14,14,16, 5, 8, 8, 11,11, 9,11,11,12,12, 8,10,11,12,12,11,12,12,15, 14,11,12,12,14,14, 7,11,10,13,12,10,11,12,13,14, 10,12,12,14,13,12,13,13,14,15,12,13,13,15,15, 7, 10,11,12,13,10,12,11,14,13,10,12,13,13,15,12,13, 12,14,14,11,13,13,15,16, 9,12,12,15,14,11,13,13, 15,16,11,13,13,16,16,13,14,15,15,15,12,14,15,17, 16, 9,12,12,14,15,11,13,13,15,16,11,13,13,16,18, 13,14,14,17,16,13,15,15,17,18, 5, 8, 9,11,11, 8, 11,11,12,12, 8,10,11,12,12,11,12,12,14,14,11,12, 12,14,15, 7,11,10,12,13,10,12,12,14,13,10,11,12, 13,14,11,13,13,15,14,12,13,13,14,15, 7,10,11,13, 13,10,12,12,13,14,10,12,12,13,13,11,13,13,16,16, 12,13,13,15,14, 9,12,12,16,15,10,13,13,15,15,11, 13,13,17,15,12,15,15,18,17,13,14,14,15,16, 9,12, 12,15,15,11,13,13,15,16,11,13,13,15,15,12,15,15, 16,16,13,15,14,17,15, 7,11,11,15,15,10,13,13,16, 15,10,13,13,15,16,14,15,15,17,19,13,15,14,15,18, 9,12,12,16,16,11,13,14,17,16,11,13,13,17,16,15, 15,16,17,19,13,15,16, 0,18, 9,12,12,16,15,11,14, 13,17,17,11,13,14,16,16,15,16,16,19,18,13,15,15, 17,19,11,14,14,19,16,12,14,15, 0,18,12,16,15,18, 17,15,15,18,16,19,14,15,17,19,19,11,14,14,18,19, 13,15,14,19,19,12,16,15,18,17,15,17,15, 0,16,14, 17,16,19, 0, 7,11,11,14,14,10,12,12,15,15,10,13, 13,16,15,13,15,15,17, 0,14,15,15,16,19, 9,12,12, 16,16,11,14,14,16,16,11,13,13,16,16,14,17,16,19, 0,14,18,17,17,19, 9,12,12,15,16,11,13,13,15,17, 12,14,13,19,16,13,15,15,17,19,15,17,16,17,19,11, 14,14,19,16,12,15,15,19,17,13,14,15,17,19,14,16, 17,19,19,16,15,16,17,19,11,15,14,16,16,12,15,15, 19, 0,12,14,15,19,19,14,16,16, 0,18,15,19,14,18, 16, }; static float _vq_quantthresh__8u0__p3_0[] = { -1.5, -0.5, 0.5, 1.5, }; static long _vq_quantmap__8u0__p3_0[] = { 3, 1, 0, 2, 4, }; static encode_aux_threshmatch _vq_auxt__8u0__p3_0 = { _vq_quantthresh__8u0__p3_0, _vq_quantmap__8u0__p3_0, 5, 5 }; static static_codebook _8u0__p3_0 = { 4, 625, _vq_lengthlist__8u0__p3_0, 1, -533725184, 1611661312, 3, 0, _vq_quantlist__8u0__p3_0, NULL, &_vq_auxt__8u0__p3_0, NULL, 0 }; static long _vq_quantlist__8u0__p4_0[] = { 2, 1, 3, 0, 4, }; static long _vq_lengthlist__8u0__p4_0[] = { 3, 5, 5, 8, 8, 5, 6, 7, 9, 9, 6, 7, 6, 9, 9, 9, 9, 9,10,11, 9, 9, 9,11,10, 6, 7, 7,10,10, 7, 7, 8,10,10, 7, 8, 8,10,10,10,10,10,10,11, 9,10,10, 11,12, 6, 7, 7,10,10, 7, 8, 8,10,10, 7, 8, 7,10, 10, 9,10,10,12,11,10,10,10,11,10, 9,10,10,12,11, 10,10,10,13,11, 9,10,10,12,12,11,11,12,12,13,11, 11,11,12,13, 9,10,10,12,12,10,10,11,12,12,10,10, 11,12,12,11,11,11,13,13,11,12,12,13,13, 5, 7, 7, 10,10, 7, 8, 8,10,10, 7, 8, 8,10,10,10,11,11,12, 12,10,11,10,12,12, 7, 8, 8,11,11, 7, 8, 9,10,11, 8, 9, 9,11,11,11,10,11,10,12,10,11,11,12,13, 7, 8, 8,10,11, 8, 9, 8,12,10, 8, 9, 9,11,12,10,11, 10,13,11,10,11,11,13,12, 9,11,10,13,12,10,10,11, 12,12,10,11,11,13,13,12,10,13,11,14,11,12,12,15, 13, 9,11,11,13,13,10,11,11,13,12,10,11,11,12,14, 12,13,11,14,12,12,12,12,14,14, 5, 7, 7,10,10, 7, 8, 8,10,10, 7, 8, 8,11,10,10,11,11,12,12,10,11, 10,12,12, 7, 8, 8,10,11, 8, 9, 9,12,11, 8, 8, 9, 10,11,10,11,11,12,13,11,10,11,11,13, 6, 8, 8,10, 11, 8, 9, 9,11,11, 7, 9, 7,11,10,10,11,11,12,12, 10,11,10,13,10, 9,11,10,13,12,10,12,11,13,13,10, 10,11,12,13,11,12,13,15,14,11,11,13,12,13, 9,10, 11,12,13,10,11,11,12,13,10,11,10,13,12,12,13,13, 13,14,12,12,11,14,11, 8,10,10,12,13,10,11,11,13, 13,10,11,10,13,13,12,13,14,15,14,12,12,12,14,13, 9,10,10,13,12,10,10,12,13,13,10,11,11,15,12,12, 12,13,15,14,12,13,13,15,13, 9,10,11,12,13,10,12, 10,13,12,10,11,11,12,13,12,14,12,15,13,12,12,12, 15,14,11,12,11,14,13,11,11,12,14,14,12,13,13,14, 13,13,11,15,11,15,14,14,14,16,15,11,12,12,13,14, 11,13,11,14,14,12,12,13,14,15,12,14,12,15,12,13, 15,14,16,15, 8,10,10,12,12,10,10,10,12,13,10,11, 11,13,13,12,12,12,13,14,13,13,13,15,15, 9,10,10, 12,12,10,11,11,13,12,10,10,11,13,13,12,12,12,14, 14,12,12,13,15,14, 9,10,10,13,12,10,10,12,12,13, 10,11,10,13,13,12,13,13,14,14,12,13,12,14,13,11, 12,12,14,13,12,13,12,14,14,10,12,12,14,14,14,14, 14,16,14,13,12,14,12,15,10,12,12,14,15,12,13,13, 14,16,11,12,11,15,14,13,14,14,14,15,13,14,11,14, 12, }; static float _vq_quantthresh__8u0__p4_0[] = { -1.5, -0.5, 0.5, 1.5, }; static long _vq_quantmap__8u0__p4_0[] = { 3, 1, 0, 2, 4, }; static encode_aux_threshmatch _vq_auxt__8u0__p4_0 = { _vq_quantthresh__8u0__p4_0, _vq_quantmap__8u0__p4_0, 5, 5 }; static static_codebook _8u0__p4_0 = { 4, 625, _vq_lengthlist__8u0__p4_0, 1, -533725184, 1611661312, 3, 0, _vq_quantlist__8u0__p4_0, NULL, &_vq_auxt__8u0__p4_0, NULL, 0 }; static long _vq_quantlist__8u0__p5_0[] = { 4, 3, 5, 2, 6, 1, 7, 0, 8, }; static long _vq_lengthlist__8u0__p5_0[] = { 1, 4, 4, 7, 7, 7, 7, 9, 9, 4, 6, 6, 8, 7, 8, 8, 10,10, 4, 6, 6, 8, 8, 8, 8,10,10, 6, 8, 8, 9, 9, 9, 9,11,11, 7, 8, 8, 9, 9, 9, 9,11,11, 7, 8, 8, 9, 9,10,10,12,11, 7, 8, 8, 9, 9,10,10,11,11, 9, 10,10,11,11,11,12,12,12, 9,10,10,11,11,12,12,12, 12, }; static float _vq_quantthresh__8u0__p5_0[] = { -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, }; static long _vq_quantmap__8u0__p5_0[] = { 7, 5, 3, 1, 0, 2, 4, 6, 8, }; static encode_aux_threshmatch _vq_auxt__8u0__p5_0 = { _vq_quantthresh__8u0__p5_0, _vq_quantmap__8u0__p5_0, 9, 9 }; static static_codebook _8u0__p5_0 = { 2, 81, _vq_lengthlist__8u0__p5_0, 1, -531628032, 1611661312, 4, 0, _vq_quantlist__8u0__p5_0, NULL, &_vq_auxt__8u0__p5_0, NULL, 0 }; static long _vq_quantlist__8u0__p6_0[] = { 6, 5, 7, 4, 8, 3, 9, 2, 10, 1, 11, 0, 12, }; static long _vq_lengthlist__8u0__p6_0[] = { 1, 4, 4, 7, 7, 9, 9,11,11,12,12,16,16, 3, 6, 6, 9, 9,11,11,12,12,13,14,18,16, 3, 6, 7, 9, 9,11, 11,13,12,14,14,17,16, 7, 9, 9,11,11,12,12,14,14, 14,14,17,16, 7, 9, 9,11,11,13,12,13,13,14,14,17, 0, 9,11,11,12,13,14,14,14,13,15,14,17,17, 9,11, 11,12,12,14,14,13,14,14,15, 0, 0,11,12,12,15,14, 15,14,15,14,15,16,17, 0,11,12,13,13,13,14,14,15, 14,15,15, 0, 0,12,14,14,15,15,14,16,15,15,17,16, 0,18,13,14,14,15,14,15,14,15,16,17,16, 0, 0,17, 17,18, 0,16,18,16, 0, 0, 0,17, 0, 0,16, 0, 0,16, 16, 0,15, 0,17, 0, 0, 0, 0, }; static float _vq_quantthresh__8u0__p6_0[] = { -27.5, -22.5, -17.5, -12.5, -7.5, -2.5, 2.5, 7.5, 12.5, 17.5, 22.5, 27.5, }; static long _vq_quantmap__8u0__p6_0[] = { 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, }; static encode_aux_threshmatch _vq_auxt__8u0__p6_0 = { _vq_quantthresh__8u0__p6_0, _vq_quantmap__8u0__p6_0, 13, 13 }; static static_codebook _8u0__p6_0 = { 2, 169, _vq_lengthlist__8u0__p6_0, 1, -526516224, 1616117760, 4, 0, _vq_quantlist__8u0__p6_0, NULL, &_vq_auxt__8u0__p6_0, NULL, 0 }; static long _vq_quantlist__8u0__p6_1[] = { 2, 1, 3, 0, 4, }; static long _vq_lengthlist__8u0__p6_1[] = { 1, 4, 4, 6, 6, 4, 6, 5, 7, 7, 4, 5, 6, 7, 7, 6, 7, 7, 7, 7, 6, 7, 7, 7, 7, }; static float _vq_quantthresh__8u0__p6_1[] = { -1.5, -0.5, 0.5, 1.5, }; static long _vq_quantmap__8u0__p6_1[] = { 3, 1, 0, 2, 4, }; static encode_aux_threshmatch _vq_auxt__8u0__p6_1 = { _vq_quantthresh__8u0__p6_1, _vq_quantmap__8u0__p6_1, 5, 5 }; static static_codebook _8u0__p6_1 = { 2, 25, _vq_lengthlist__8u0__p6_1, 1, -533725184, 1611661312, 3, 0, _vq_quantlist__8u0__p6_1, NULL, &_vq_auxt__8u0__p6_1, NULL, 0 }; static long _vq_quantlist__8u0__p7_0[] = { 1, 0, 2, }; static long _vq_lengthlist__8u0__p7_0[] = { 1, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, }; static float _vq_quantthresh__8u0__p7_0[] = { -157.5, 157.5, }; static long _vq_quantmap__8u0__p7_0[] = { 1, 0, 2, }; static encode_aux_threshmatch _vq_auxt__8u0__p7_0 = { _vq_quantthresh__8u0__p7_0, _vq_quantmap__8u0__p7_0, 3, 3 }; static static_codebook _8u0__p7_0 = { 4, 81, _vq_lengthlist__8u0__p7_0, 1, -518803456, 1628680192, 2, 0, _vq_quantlist__8u0__p7_0, NULL, &_vq_auxt__8u0__p7_0, NULL, 0 }; static long _vq_quantlist__8u0__p7_1[] = { 7, 6, 8, 5, 9, 4, 10, 3, 11, 2, 12, 1, 13, 0, 14, }; static long _vq_lengthlist__8u0__p7_1[] = { 1, 5, 5, 5, 5,10,10,11,11,11,11,11,11,11,11, 5, 7, 6, 8, 8, 9,10,11,11,11,11,11,11,11,11, 6, 6, 7, 9, 7,11,10,11,11,11,11,11,11,11,11, 5, 6, 6, 11, 8,11,11,11,11,11,11,11,11,11,11, 5, 6, 6, 9, 10,11,10,11,11,11,11,11,11,11,11, 7,10,10,11,11, 11,11,11,11,11,11,11,11,11,11, 7,11, 8,11,11,11, 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, 11,11,11,11,11,11,11,11,11,11,11,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10, }; static float _vq_quantthresh__8u0__p7_1[] = { -136.5, -115.5, -94.5, -73.5, -52.5, -31.5, -10.5, 10.5, 31.5, 52.5, 73.5, 94.5, 115.5, 136.5, }; static long _vq_quantmap__8u0__p7_1[] = { 13, 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, 14, }; static encode_aux_threshmatch _vq_auxt__8u0__p7_1 = { _vq_quantthresh__8u0__p7_1, _vq_quantmap__8u0__p7_1, 15, 15 }; static static_codebook _8u0__p7_1 = { 2, 225, _vq_lengthlist__8u0__p7_1, 1, -520986624, 1620377600, 4, 0, _vq_quantlist__8u0__p7_1, NULL, &_vq_auxt__8u0__p7_1, NULL, 0 }; static long _vq_quantlist__8u0__p7_2[] = { 10, 9, 11, 8, 12, 7, 13, 6, 14, 5, 15, 4, 16, 3, 17, 2, 18, 1, 19, 0, 20, }; static long _vq_lengthlist__8u0__p7_2[] = { 1, 6, 5, 7, 7, 9, 9, 9, 9,10,12,12,10,11,11,10, 11,11,11,10,11, 6, 8, 8, 9, 9,10,10, 9,10,11,11, 10,11,11,11,11,10,11,11,11,11, 6, 7, 8, 9, 9, 9, 10,11,10,11,12,11,10,11,11,11,11,11,11,12,10, 8, 9, 9,10, 9,10,10, 9,10,10,10,10,10, 9,10,10,10, 10, 9,10,10, 9, 9, 9, 9,10,10, 9, 9,10,10,11,10, 9,12,10,11,10, 9,10,10,10, 8, 9, 9,10, 9,10, 9, 9,10,10, 9,10, 9,11,10,10,10,10,10, 9,10, 8, 8, 9, 9,10, 9,11, 9, 8, 9, 9,10,11,10,10,10,11,12, 9, 9,11, 8, 9, 8,11,10,11,10,10, 9,11,10,10,10, 10,10,10,10,11,11,11,11, 8, 9, 9, 9,10,10,10,11, 11,12,11,12,11,10,10,10,12,11,11,11,10, 8,10, 9, 11,10,10,11,12,10,11,12,11,11,12,11,12,12,10,11, 11,10, 9, 9,10,11,12,10,10,10,11,10,11,11,10,12, 12,10,11,10,11,12,10, 9,10,10,11,10,11,11,11,11, 11,12,11,11,11, 9,11,10,11,10,11,10, 9, 9,10,11, 11,11,10,10,11,12,12,11,12,11,11,11,12,12,12,12, 11, 9,11,11,12,10,11,11,11,11,11,11,12,11,11,12, 11,11,11,10,11,11, 9,11,10,11,11,11,10,10,10,11, 11,11,12,10,11,10,11,11,11,11,12, 9,11,10,11,11, 10,10,11,11, 9,11,11,12,10,10,10,10,10,11,11,10, 9,10,11,11,12,11,10,10,12,11,11,12,11,12,11,11, 10,10,11,11,10,12,11,10,11,10,11,10,10,10,11,11, 10,10,11,11,11,11,10,10,10,12,11,11,11,11,10, 9, 10,11,11,11,12,11,11,11,12,10,11,11,11, 9,10,11, 11,11,11,11,11,10,10,11,11,12,11,10,11,12,11,10, 10,11, 9,10,11,11,11,11,11,10,11,11,10,12,11,11, 11,12,11,11,11,10,10,11,11, }; static float _vq_quantthresh__8u0__p7_2[] = { -9.5, -8.5, -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, 9.5, }; static long _vq_quantmap__8u0__p7_2[] = { 19, 17, 15, 13, 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, }; static encode_aux_threshmatch _vq_auxt__8u0__p7_2 = { _vq_quantthresh__8u0__p7_2, _vq_quantmap__8u0__p7_2, 21, 21 }; static static_codebook _8u0__p7_2 = { 2, 441, _vq_lengthlist__8u0__p7_2, 1, -529268736, 1611661312, 5, 0, _vq_quantlist__8u0__p7_2, NULL, &_vq_auxt__8u0__p7_2, NULL, 0 }; static long _huff_lengthlist__8u0__single[] = { 4, 7,11, 9,12, 8, 7,10, 6, 4, 5, 5, 7, 5, 6,16, 9, 5, 5, 6, 7, 7, 9,16, 7, 4, 6, 5, 7, 5, 7,17, 10, 7, 7, 8, 7, 7, 8,18, 7, 5, 6, 4, 5, 4, 5,15, 7, 6, 7, 5, 6, 4, 5,15,12,13,18,12,17,11, 9,17, }; static static_codebook _huff_book__8u0__single = { 2, 64, _huff_lengthlist__8u0__single, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; static long _vq_quantlist__8u1__p1_0[] = { 1, 0, 2, }; static long _vq_lengthlist__8u1__p1_0[] = { 1, 4, 4, 5, 7, 7, 5, 7, 7, 5, 8, 8, 7, 9,10, 7, 9, 9, 5, 8, 8, 7,10, 9, 7, 9, 9, 5, 8, 8, 8,10, 10, 8,10,10, 7,10,10, 9,10,12,10,12,12, 7,10,10, 9,12,11,10,12,12, 5, 8, 8, 8,10,10, 8,10,10, 7, 10,10,10,12,12, 9,11,12, 7,10,10,10,12,12, 9,12, 10, }; static float _vq_quantthresh__8u1__p1_0[] = { -0.5, 0.5, }; static long _vq_quantmap__8u1__p1_0[] = { 1, 0, 2, }; static encode_aux_threshmatch _vq_auxt__8u1__p1_0 = { _vq_quantthresh__8u1__p1_0, _vq_quantmap__8u1__p1_0, 3, 3 }; static static_codebook _8u1__p1_0 = { 4, 81, _vq_lengthlist__8u1__p1_0, 1, -535822336, 1611661312, 2, 0, _vq_quantlist__8u1__p1_0, NULL, &_vq_auxt__8u1__p1_0, NULL, 0 }; static long _vq_quantlist__8u1__p2_0[] = { 1, 0, 2, }; static long _vq_lengthlist__8u1__p2_0[] = { 3, 4, 5, 5, 6, 6, 5, 6, 6, 5, 7, 6, 6, 7, 8, 6, 7, 8, 5, 6, 6, 6, 8, 7, 6, 8, 7, 5, 6, 6, 7, 8, 8, 6, 7, 7, 6, 8, 7, 7, 7, 9, 8, 9, 9, 6, 7, 8, 7, 9, 7, 8, 9, 9, 5, 6, 6, 6, 7, 7, 7, 8, 8, 6, 8, 7, 8, 9, 9, 7, 7, 9, 6, 7, 8, 8, 9, 9, 7, 9, 7, }; static float _vq_quantthresh__8u1__p2_0[] = { -0.5, 0.5, }; static long _vq_quantmap__8u1__p2_0[] = { 1, 0, 2, }; static encode_aux_threshmatch _vq_auxt__8u1__p2_0 = { _vq_quantthresh__8u1__p2_0, _vq_quantmap__8u1__p2_0, 3, 3 }; static static_codebook _8u1__p2_0 = { 4, 81, _vq_lengthlist__8u1__p2_0, 1, -535822336, 1611661312, 2, 0, _vq_quantlist__8u1__p2_0, NULL, &_vq_auxt__8u1__p2_0, NULL, 0 }; static long _vq_quantlist__8u1__p3_0[] = { 2, 1, 3, 0, 4, }; static long _vq_lengthlist__8u1__p3_0[] = { 1, 5, 5, 7, 7, 6, 7, 7, 9, 9, 6, 7, 7, 9, 9, 8, 10, 9,11,11, 9, 9, 9,11,11, 6, 8, 8,10,10, 8,10, 10,11,11, 8, 9,10,11,11,10,11,11,12,12,10,11,11, 12,13, 6, 8, 8,10,10, 8,10, 9,11,11, 8,10, 9,11, 11,10,11,11,12,12,10,11,11,12,12, 9,11,11,14,13, 10,12,11,14,14,10,12,11,14,13,12,13,13,15,14,12, 13,13,15,14, 8,11,11,13,14,10,11,12,13,15,10,11, 12,14,14,12,13,13,14,15,12,13,13,14,15, 5, 8, 8, 11,11, 8,10,10,12,12, 8,10,10,12,12,11,12,12,14, 13,11,12,12,13,14, 8,10,10,12,12, 9,11,12,13,14, 10,12,12,13,13,12,12,13,14,14,11,13,13,15,15, 7, 10,10,12,12, 9,12,11,14,12,10,11,12,13,14,12,13, 12,14,14,12,13,13,15,16,10,12,12,15,14,11,12,13, 15,15,11,13,13,15,16,14,14,15,15,16,13,14,15,17, 15, 9,12,12,14,15,11,13,12,15,15,11,13,13,15,15, 13,14,13,15,14,13,14,14,17, 0, 5, 8, 8,11,11, 8, 10,10,12,12, 8,10,10,12,12,11,12,12,14,14,11,12, 12,14,14, 7,10,10,12,12,10,12,12,13,13, 9,11,12, 12,13,11,12,13,15,15,11,12,13,14,15, 8,10,10,12, 12,10,12,11,13,13,10,12,11,13,13,11,13,13,15,14, 12,13,12,15,13, 9,12,12,14,14,11,13,13,16,15,11, 12,13,16,15,13,14,15,16,16,13,13,15,15,16,10,12, 12,15,14,11,13,13,14,16,11,13,13,15,16,13,15,15, 16,17,13,15,14,16,15, 8,11,11,14,15,10,12,12,15, 15,10,12,12,15,16,14,15,15,16,17,13,14,14,16,16, 9,12,12,15,15,11,13,14,15,17,11,13,13,15,16,14, 15,16,19,17,13,15,15, 0,17, 9,12,12,15,15,11,14, 13,16,15,11,13,13,15,16,15,15,15,18,17,13,15,15, 17,17,11,15,14,18,16,12,14,15,17,17,12,15,15,18, 18,15,15,16,15,19,14,16,16, 0, 0,11,14,14,16,17, 12,15,14,18,17,12,15,15,18,18,15,17,15,18,16,14, 16,16,18,18, 7,11,11,14,14,10,12,12,15,15,10,12, 13,15,15,13,14,15,16,16,14,15,15,18,18, 9,12,12, 15,15,11,13,13,16,15,11,12,13,16,16,14,15,15,17, 16,15,16,16,17,17, 9,12,12,15,15,11,13,13,15,17, 11,14,13,16,15,13,15,15,17,17,15,15,15,18,17,11, 14,14,17,15,12,14,15,17,18,13,13,15,17,17,14,16, 16,19,18,16,15,17,17, 0,11,14,14,17,17,12,15,15, 18, 0,12,15,14,18,16,14,17,17,19, 0,16,18,15, 0, 16, }; static float _vq_quantthresh__8u1__p3_0[] = { -1.5, -0.5, 0.5, 1.5, }; static long _vq_quantmap__8u1__p3_0[] = { 3, 1, 0, 2, 4, }; static encode_aux_threshmatch _vq_auxt__8u1__p3_0 = { _vq_quantthresh__8u1__p3_0, _vq_quantmap__8u1__p3_0, 5, 5 }; static static_codebook _8u1__p3_0 = { 4, 625, _vq_lengthlist__8u1__p3_0, 1, -533725184, 1611661312, 3, 0, _vq_quantlist__8u1__p3_0, NULL, &_vq_auxt__8u1__p3_0, NULL, 0 }; static long _vq_quantlist__8u1__p4_0[] = { 2, 1, 3, 0, 4, }; static long _vq_lengthlist__8u1__p4_0[] = { 4, 5, 5, 9, 9, 6, 7, 7, 9, 9, 6, 7, 7, 9, 9, 9, 9, 9,11,11, 9, 9, 9,11,11, 6, 7, 7, 9, 9, 7, 7, 8, 9,10, 7, 7, 8, 9,10, 9, 9,10,10,11, 9, 9,10, 10,12, 6, 7, 7, 9, 9, 7, 8, 7,10, 9, 7, 8, 7,10, 9, 9,10, 9,12,11,10,10, 9,12,10, 9,10,10,12,11, 9,10,10,12,11, 9,10,10,12,12,11,11,12,12,13,11, 11,12,12,13, 9, 9,10,12,11, 9,10,10,12,12,10,10, 10,12,12,11,12,11,13,12,11,12,11,13,12, 6, 7, 7, 9, 9, 7, 8, 8,10,10, 7, 8, 7,10, 9,10,10,10,12, 12,10,10,10,12,11, 7, 8, 7,10,10, 7, 7, 9,10,11, 8, 9, 9,11,10,10,10,11,10,12,10,10,11,12,12, 7, 8, 8,10,10, 7, 9, 8,11,10, 8, 8, 9,11,11,10,11, 10,12,11,10,11,11,12,12, 9,10,10,12,12, 9,10,10, 12,12,10,11,11,13,12,11,10,12,10,14,12,12,12,13, 14, 9,10,10,12,12, 9,11,10,12,12,10,11,11,12,12, 11,12,11,14,12,12,12,12,14,14, 5, 7, 7, 9, 9, 7, 7, 7, 9,10, 7, 8, 8,10,10,10,10,10,11,11,10,10, 10,12,12, 7, 8, 8,10,10, 8, 9, 8,11,10, 7, 8, 9, 10,11,10,10,10,11,12,10,10,11,11,13, 6, 7, 8,10, 10, 8, 9, 9,10,10, 7, 9, 7,11,10,10,11,10,12,12, 10,11,10,12,10, 9,10,10,12,12,10,11,11,13,12, 9, 10,10,12,12,12,12,12,14,13,11,11,12,11,14, 9,10, 10,11,12,10,11,11,12,13, 9,10,10,12,12,12,12,12, 14,13,11,12,10,14,11, 9, 9,10,11,12, 9,10,10,12, 12, 9,10,10,12,12,12,12,12,14,14,11,12,12,13,12, 9,10, 9,12,12, 9,10,11,12,13,10,11,10,13,11,12, 12,13,13,14,12,12,12,13,13, 9,10,10,12,12,10,11, 10,13,12,10,10,11,12,13,12,13,12,14,13,12,12,12, 13,14,11,12,11,14,13,10,10,11,13,13,12,12,12,14, 13,12,10,14,10,15,13,14,14,14,14,11,11,12,13,14, 10,12,11,13,13,12,12,12,13,15,12,13,11,15,12,13, 13,14,14,14, 9,10, 9,12,12, 9,10,10,12,12,10,10, 10,12,12,11,11,12,12,13,12,12,12,14,14, 9,10,10, 12,12,10,11,10,13,12,10,10,11,12,13,12,12,12,14, 13,12,12,13,13,14, 9,10,10,12,13,10,10,11,11,12, 9,11,10,13,12,12,12,12,13,14,12,13,12,14,13,11, 12,11,13,13,12,13,12,14,13,10,11,12,13,13,13,13, 13,14,15,12,11,14,12,14,11,11,12,12,13,12,12,12, 13,14,10,12,10,14,13,13,13,13,14,15,12,14,11,15, 10, }; static float _vq_quantthresh__8u1__p4_0[] = { -1.5, -0.5, 0.5, 1.5, }; static long _vq_quantmap__8u1__p4_0[] = { 3, 1, 0, 2, 4, }; static encode_aux_threshmatch _vq_auxt__8u1__p4_0 = { _vq_quantthresh__8u1__p4_0, _vq_quantmap__8u1__p4_0, 5, 5 }; static static_codebook _8u1__p4_0 = { 4, 625, _vq_lengthlist__8u1__p4_0, 1, -533725184, 1611661312, 3, 0, _vq_quantlist__8u1__p4_0, NULL, &_vq_auxt__8u1__p4_0, NULL, 0 }; static long _vq_quantlist__8u1__p5_0[] = { 4, 3, 5, 2, 6, 1, 7, 0, 8, }; static long _vq_lengthlist__8u1__p5_0[] = { 1, 4, 4, 7, 7, 7, 7, 9, 9, 4, 6, 5, 8, 7, 8, 8, 10,10, 4, 6, 6, 8, 8, 8, 8,10,10, 7, 8, 8, 9, 9, 9, 9,11,11, 7, 8, 8, 9, 9, 9, 9,11,11, 8, 8, 8, 9, 9,10,10,12,11, 8, 8, 8, 9, 9,10,10,11,11, 9, 10,10,11,11,11,11,13,12, 9,10,10,11,11,12,12,12, 13, }; static float _vq_quantthresh__8u1__p5_0[] = { -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, }; static long _vq_quantmap__8u1__p5_0[] = { 7, 5, 3, 1, 0, 2, 4, 6, 8, }; static encode_aux_threshmatch _vq_auxt__8u1__p5_0 = { _vq_quantthresh__8u1__p5_0, _vq_quantmap__8u1__p5_0, 9, 9 }; static static_codebook _8u1__p5_0 = { 2, 81, _vq_lengthlist__8u1__p5_0, 1, -531628032, 1611661312, 4, 0, _vq_quantlist__8u1__p5_0, NULL, &_vq_auxt__8u1__p5_0, NULL, 0 }; static long _vq_quantlist__8u1__p6_0[] = { 4, 3, 5, 2, 6, 1, 7, 0, 8, }; static long _vq_lengthlist__8u1__p6_0[] = { 3, 4, 4, 6, 6, 7, 7, 9, 9, 4, 4, 5, 6, 6, 7, 7, 9, 9, 4, 4, 4, 6, 6, 7, 7, 9, 9, 6, 6, 6, 7, 7, 8, 8, 9, 9, 6, 6, 6, 7, 7, 8, 8, 9, 9, 7, 7, 7, 8, 8, 8, 9,10,10, 7, 7, 7, 8, 8, 9, 8,10,10, 9, 9, 9, 9, 9,10,10,10,10, 9, 9, 9, 9, 9,10,10,10, 10, }; static float _vq_quantthresh__8u1__p6_0[] = { -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, }; static long _vq_quantmap__8u1__p6_0[] = { 7, 5, 3, 1, 0, 2, 4, 6, 8, }; static encode_aux_threshmatch _vq_auxt__8u1__p6_0 = { _vq_quantthresh__8u1__p6_0, _vq_quantmap__8u1__p6_0, 9, 9 }; static static_codebook _8u1__p6_0 = { 2, 81, _vq_lengthlist__8u1__p6_0, 1, -531628032, 1611661312, 4, 0, _vq_quantlist__8u1__p6_0, NULL, &_vq_auxt__8u1__p6_0, NULL, 0 }; static long _vq_quantlist__8u1__p7_0[] = { 1, 0, 2, }; static long _vq_lengthlist__8u1__p7_0[] = { 1, 4, 4, 5, 7, 7, 5, 7, 7, 5, 9, 9, 8,10,10, 8, 10,10, 5, 9, 9, 7,10,10, 8,10,10, 4,10,10, 9,12, 12, 9,11,11, 7,12,11,10,11,13,10,13,13, 7,12,12, 10,13,12,10,13,13, 4,10,10, 9,12,12, 9,12,12, 7, 12,12,10,13,13,10,12,13, 7,11,12,10,13,13,10,13, 11, }; static float _vq_quantthresh__8u1__p7_0[] = { -5.5, 5.5, }; static long _vq_quantmap__8u1__p7_0[] = { 1, 0, 2, }; static encode_aux_threshmatch _vq_auxt__8u1__p7_0 = { _vq_quantthresh__8u1__p7_0, _vq_quantmap__8u1__p7_0, 3, 3 }; static static_codebook _8u1__p7_0 = { 4, 81, _vq_lengthlist__8u1__p7_0, 1, -529137664, 1618345984, 2, 0, _vq_quantlist__8u1__p7_0, NULL, &_vq_auxt__8u1__p7_0, NULL, 0 }; static long _vq_quantlist__8u1__p7_1[] = { 5, 4, 6, 3, 7, 2, 8, 1, 9, 0, 10, }; static long _vq_lengthlist__8u1__p7_1[] = { 2, 4, 4, 6, 6, 7, 7, 8, 8, 8, 8, 4, 5, 5, 7, 7, 8, 8, 9, 9, 9, 9, 4, 5, 5, 7, 7, 8, 8, 9, 9, 9, 9, 6, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 6, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 8, 9, 9, 9, 9, 9, 9,10,10,10,10, 8, 9, 9, 9, 9, 9, 9,10, 10,10,10, 8, 9, 9, 9, 9, 9, 9,10,10,10,10, 8, 9, 9, 9, 9, 9, 9,10,10,10,10, }; static float _vq_quantthresh__8u1__p7_1[] = { -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, }; static long _vq_quantmap__8u1__p7_1[] = { 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, }; static encode_aux_threshmatch _vq_auxt__8u1__p7_1 = { _vq_quantthresh__8u1__p7_1, _vq_quantmap__8u1__p7_1, 11, 11 }; static static_codebook _8u1__p7_1 = { 2, 121, _vq_lengthlist__8u1__p7_1, 1, -531365888, 1611661312, 4, 0, _vq_quantlist__8u1__p7_1, NULL, &_vq_auxt__8u1__p7_1, NULL, 0 }; static long _vq_quantlist__8u1__p8_0[] = { 5, 4, 6, 3, 7, 2, 8, 1, 9, 0, 10, }; static long _vq_lengthlist__8u1__p8_0[] = { 1, 4, 4, 6, 6, 8, 8,10,10,11,11, 4, 6, 6, 7, 7, 9, 9,11,11,13,12, 4, 6, 6, 7, 7, 9, 9,11,11,12, 12, 6, 7, 7, 9, 9,11,11,12,12,13,13, 6, 7, 7, 9, 9,11,11,12,12,13,13, 8, 9, 9,11,11,12,12,13,13, 14,14, 8, 9, 9,11,11,12,12,13,13,14,14, 9,11,11, 12,12,13,13,14,14,15,15, 9,11,11,12,12,13,13,14, 14,15,14,11,12,12,13,13,14,14,15,15,16,16,11,12, 12,13,13,14,14,15,15,15,15, }; static float _vq_quantthresh__8u1__p8_0[] = { -49.5, -38.5, -27.5, -16.5, -5.5, 5.5, 16.5, 27.5, 38.5, 49.5, }; static long _vq_quantmap__8u1__p8_0[] = { 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, }; static encode_aux_threshmatch _vq_auxt__8u1__p8_0 = { _vq_quantthresh__8u1__p8_0, _vq_quantmap__8u1__p8_0, 11, 11 }; static static_codebook _8u1__p8_0 = { 2, 121, _vq_lengthlist__8u1__p8_0, 1, -524582912, 1618345984, 4, 0, _vq_quantlist__8u1__p8_0, NULL, &_vq_auxt__8u1__p8_0, NULL, 0 }; static long _vq_quantlist__8u1__p8_1[] = { 5, 4, 6, 3, 7, 2, 8, 1, 9, 0, 10, }; static long _vq_lengthlist__8u1__p8_1[] = { 2, 5, 5, 6, 6, 7, 7, 7, 7, 8, 8, 5, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 5, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 6, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 6, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 8, 9, 9, 7, 8, 8, 8, 8, 8, 8, 9, 8, 9, 9, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, }; static float _vq_quantthresh__8u1__p8_1[] = { -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, }; static long _vq_quantmap__8u1__p8_1[] = { 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, }; static encode_aux_threshmatch _vq_auxt__8u1__p8_1 = { _vq_quantthresh__8u1__p8_1, _vq_quantmap__8u1__p8_1, 11, 11 }; static static_codebook _8u1__p8_1 = { 2, 121, _vq_lengthlist__8u1__p8_1, 1, -531365888, 1611661312, 4, 0, _vq_quantlist__8u1__p8_1, NULL, &_vq_auxt__8u1__p8_1, NULL, 0 }; static long _vq_quantlist__8u1__p9_0[] = { 7, 6, 8, 5, 9, 4, 10, 3, 11, 2, 12, 1, 13, 0, 14, }; static long _vq_lengthlist__8u1__p9_0[] = { 1, 4, 4,11,11,11,11,11,11,11,11,11,11,11,11, 3, 11, 8,11,11,11,11,11,11,11,11,11,11,11,11, 3, 9, 9,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, 11,11,11,11,11,11,11,11,11,11,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10, }; static float _vq_quantthresh__8u1__p9_0[] = { -1657.5, -1402.5, -1147.5, -892.5, -637.5, -382.5, -127.5, 127.5, 382.5, 637.5, 892.5, 1147.5, 1402.5, 1657.5, }; static long _vq_quantmap__8u1__p9_0[] = { 13, 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, 14, }; static encode_aux_threshmatch _vq_auxt__8u1__p9_0 = { _vq_quantthresh__8u1__p9_0, _vq_quantmap__8u1__p9_0, 15, 15 }; static static_codebook _8u1__p9_0 = { 2, 225, _vq_lengthlist__8u1__p9_0, 1, -514071552, 1627381760, 4, 0, _vq_quantlist__8u1__p9_0, NULL, &_vq_auxt__8u1__p9_0, NULL, 0 }; static long _vq_quantlist__8u1__p9_1[] = { 7, 6, 8, 5, 9, 4, 10, 3, 11, 2, 12, 1, 13, 0, 14, }; static long _vq_lengthlist__8u1__p9_1[] = { 1, 4, 4, 7, 7, 9, 9, 7, 7, 8, 8,10,10,11,11, 4, 7, 7, 9, 9,10,10, 8, 8,10,10,10,11,10,11, 4, 7, 7, 9, 9,10,10, 8, 8,10, 9,11,11,11,11, 7, 9, 9, 12,12,11,12,10,10,11,10,12,11,11,11, 7, 9, 9,11, 11,13,12, 9, 9,11,10,11,11,12,11, 9,10,10,12,12, 14,14,10,10,11,12,12,11,11,11, 9,10,11,11,13,14, 13,10,11,11,11,12,11,12,12, 7, 8, 8,10, 9,11,10, 11,12,12,11,12,14,12,13, 7, 8, 8, 9,10,10,11,12, 12,12,11,12,12,12,13, 9, 9, 9,11,11,13,12,12,12, 12,11,12,12,13,12, 8,10,10,11,10,11,12,12,12,12, 12,12,14,12,12, 9,11,11,11,12,12,12,12,13,13,12, 12,13,13,12,10,11,11,12,11,12,12,12,11,12,13,12, 12,12,13,11,11,12,12,12,13,12,12,11,12,13,13,12, 12,13,12,11,12,12,13,13,12,13,12,13,13,13,13,14, 13, }; static float _vq_quantthresh__8u1__p9_1[] = { -110.5, -93.5, -76.5, -59.5, -42.5, -25.5, -8.5, 8.5, 25.5, 42.5, 59.5, 76.5, 93.5, 110.5, }; static long _vq_quantmap__8u1__p9_1[] = { 13, 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, 14, }; static encode_aux_threshmatch _vq_auxt__8u1__p9_1 = { _vq_quantthresh__8u1__p9_1, _vq_quantmap__8u1__p9_1, 15, 15 }; static static_codebook _8u1__p9_1 = { 2, 225, _vq_lengthlist__8u1__p9_1, 1, -522338304, 1620115456, 4, 0, _vq_quantlist__8u1__p9_1, NULL, &_vq_auxt__8u1__p9_1, NULL, 0 }; static long _vq_quantlist__8u1__p9_2[] = { 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15, 0, 16, }; static long _vq_lengthlist__8u1__p9_2[] = { 2, 5, 4, 6, 6, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 5, 6, 6, 7, 7, 8, 8, 9, 8, 9, 9, 9, 9, 9, 9, 9, 9, 5, 6, 6, 7, 7, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 7, 7, 7, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9,10,10, 9, 7, 7, 7, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,10,10, 8, 8, 8, 9, 9, 9, 9,10,10,10, 9, 10,10,10,10,10,10, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 10,10,10,10,10,10,10, 9, 9, 9, 9, 9, 9, 9, 9,10, 10,10,10,10,10,10,10,10, 9, 9, 9, 9, 9,10,10,10, 10,10,10,10,10,10,10,10,10, 9, 9, 9, 9, 9, 9,10, 10,10,10,10,10,10,10,10,10,10, 9, 9, 9, 9, 9,10, 10,10,10,10,10,10,10,10,10,10,10, 9, 9, 9, 9,10, 10,10,10,10,10,10,10,10,10,10,10,10, 9, 9, 9, 9, 9,10,10,10,10,10,10,10,10,10,10,10,10, 9, 9, 9, 10,10,10,10,10,10,10,10,10,10,10,10,10,10, 9,10, 9, 9, 9,10,10,10,10,10,10,10,10,10,10,10,10, 9, 10, 9,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 9, 9,10,10,10,10,10,10,10,10,10,10,10,10,10,10, 10, }; static float _vq_quantthresh__8u1__p9_2[] = { -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, }; static long _vq_quantmap__8u1__p9_2[] = { 15, 13, 11, 9, 7, 5, 3, 1, 0, 2, 4, 6, 8, 10, 12, 14, 16, }; static encode_aux_threshmatch _vq_auxt__8u1__p9_2 = { _vq_quantthresh__8u1__p9_2, _vq_quantmap__8u1__p9_2, 17, 17 }; static static_codebook _8u1__p9_2 = { 2, 289, _vq_lengthlist__8u1__p9_2, 1, -529530880, 1611661312, 5, 0, _vq_quantlist__8u1__p9_2, NULL, &_vq_auxt__8u1__p9_2, NULL, 0 }; static long _huff_lengthlist__8u1__single[] = { 4, 7,13, 9,15, 9,16, 8,10,13, 7, 5, 8, 6, 9, 7, 10, 7,10,11,11, 6, 7, 8, 8, 9, 9, 9,12,16, 8, 5, 8, 6, 8, 6, 9, 7,10,12,11, 7, 7, 7, 6, 7, 7, 7, 11,15, 7, 5, 8, 6, 7, 5, 7, 6, 9,13,13, 9, 9, 8, 6, 6, 5, 5, 9,14, 8, 6, 8, 6, 6, 4, 5, 3, 5,13, 9, 9,11, 8,10, 7, 8, 4, 5,12,11,16,17,15,17,12, 13, 8, 8,15, }; static static_codebook _huff_book__8u1__single = { 2, 100, _huff_lengthlist__8u1__single, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, 0 }; libtritonus-java-20070428/src/lib/pvorbis/.cvsignore0000644000175000017500000000005210167052676022245 0ustar twernertwernerMakefile org_tritonus_*.h *.o *.so* .libs libtritonus-java-20070428/src/lib/pvorbis/Makefile.in0000644000175000017500000000664610201232627022312 0ustar twernertwerner# compilation and packing of the native library for vorbis # SHELL = /bin/sh prefix=@prefix@ JAVADIR=$(prefix) REL_JAVAEXTLIBPATH=@REL_JAVAEXTLIBPATH@ JAVAEXTLIBPATH=$(JAVADIR)/$(REL_JAVAEXTLIBPATH) OSNAME=@OSNAME@ ARCHNAME=@ARCHNAME@ CC=@CC@ CPPFLAGS=-g -Wall -I. -I$(JAVADIR)/include -I$(JAVADIR)/include/$(OSNAME) -fPIC -D_REENTRANT #-pedantic INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ LN_S=@LN_S@ RM_F=@RM_F@ MKDIR_P=@MKDIR_P@ OBJDIR=../../../@BUILD_DIR@ vpath %.class $(OBJDIR)/org/tritonus/lowlevel/pogg vpath %.class $(OBJDIR)/org/tritonus/lowlevel/pvorbis LIBBASENAME=libtritonuspvorbis LIBDEST=$(LIBBASENAME).so.1.0 LIBDEST_ABSOLUTE=@SRC_ABSOLUTE_PATH@/src/lib/pvorbis/$(LIBDEST) #or LIBDEST_ABSOLUTE=$(CURDIR)/$(LIBDEST) LIBS= JAVAH = @JAVAH@ VORBISOBJ=\ analysis.o \ bitrate.o \ block.o \ codebook.o \ envelope.o \ floor0.o \ floor1.o \ info.o \ lpc.o \ lsp.o \ mapping0.o \ mdct.o \ psy.o \ registry.o \ res0.o \ sharedbook.o \ smallft.o \ synthesis.o \ vorbisenc.o \ window.o OGGOBJ=bitwise.o framing.o JNIOBJ=\ org_tritonus_lowlevel_pogg_Buffer.o \ org_tritonus_lowlevel_pogg_Packet.o \ org_tritonus_lowlevel_pvorbis_Block.o \ org_tritonus_lowlevel_pvorbis_DspState.o \ org_tritonus_lowlevel_pvorbis_Info.o OBJ=\ $(JNIOBJ) \ ../common/common.o \ $(VORBISOBJ) \ $(OGGOBJ) JNIHEADERS:=$(JNIOBJ:.o=.h) JNICLASSFILES=\ Buffer.class \ Packet.class \ Block.class \ DspState.class \ Info.class JNICLASSES=\ org.tritonus.lowlevel.pogg.Buffer \ org.tritonus.lowlevel.pogg.Packet \ org.tritonus.lowlevel.pvorbis.Block \ org.tritonus.lowlevel.pvorbis.DspState \ org.tritonus.lowlevel.pvorbis.Info #----------------- rules ------------------- .PHONY: all all: $(LIBDEST) $(LIBDEST): $(OBJ) $(CC) -nostartfiles -shared -Wl,-soname,$(LIBBASENAME).so.1 -o $(LIBDEST) $(OBJ) -L/usr/lib $(LIBS) $(RM_F) $(LIBBASENAME).so.1 $(LN_S) $(LIBBASENAME).so.1.0 $(LIBBASENAME).so.1 $(RM_F) $(LIBBASENAME).so $(LN_S) $(LIBBASENAME).so.1 $(LIBBASENAME).so $(OBJ): $(JNIHEADERS) $(JNIHEADERS): $(JNICLASSFILES) $(RM_F) $(JNIHEADERS) $(JAVAH) -d . $(JNICLASSES) .PHONY: install install: @echo "Installing $(LIBBASENAME) in $(JAVAEXTLIBPATH)" @$(MKDIR_P) $(JAVAEXTLIBPATH) @$(RM_F) $(JAVAEXTLIBPATH)/$(LIBBASENAME).so.1.0 @$(RM_F) $(JAVAEXTLIBPATH)/$(LIBBASENAME).so.1 @$(RM_F) $(JAVAEXTLIBPATH)/$(LIBBASENAME).so $(INSTALL_PROGRAM) $(LIBDEST) $(JAVAEXTLIBPATH) @(cd $(JAVAEXTLIBPATH) && $(LN_S) $(LIBBASENAME).so.1.0 $(LIBBASENAME).so.1) @(cd $(JAVAEXTLIBPATH) && $(LN_S) $(LIBBASENAME).so.1 $(LIBBASENAME).so) .PHONY: install-link install-link: @echo "Creating links for $(LIBBASENAME) in $(JAVAEXTLIBPATH)" @$(MKDIR_P) $(JAVAEXTLIBPATH) @$(RM_F) $(JAVAEXTLIBPATH)/$(LIBBASENAME).so.1.0 @$(RM_F) $(JAVAEXTLIBPATH)/$(LIBBASENAME).so.1 @$(RM_F) $(JAVAEXTLIBPATH)/$(LIBBASENAME).so @(cd $(JAVAEXTLIBPATH) && $(LN_S) $(LIBDEST_ABSOLUTE) $(LIBBASENAME).so.1.0) @(cd $(JAVAEXTLIBPATH) && $(LN_S) $(LIBBASENAME).so.1.0 $(LIBBASENAME).so.1) @(cd $(JAVAEXTLIBPATH) && $(LN_S) $(LIBBASENAME).so.1 $(LIBBASENAME).so) .PHONY: uninstall uninstall: @echo "Removing $(LIBBASENAME) from $(JAVAEXTLIBPATH)" @$(RM_F) $(JAVAEXTLIBPATH)/$(LIBBASENAME).so.1.0 @$(RM_F) $(JAVAEXTLIBPATH)/$(LIBBASENAME).so.1 @$(RM_F) $(JAVAEXTLIBPATH)/$(LIBBASENAME).so .PHONY: uninstall-link uninstall-link: uninstall .PHONY: clean clean: rm -rf $(LIBDEST) $(JNIHEADERS) *.o *~ libtritonus-java-20070428/src/lib/pvorbis/analysis.c0000644000175000017500000000577010171253130022227 0ustar twernertwerner/******************************************************************** * * * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 * * by the XIPHOPHORUS Company http://www.xiph.org/ * * * ******************************************************************** function: single-block PCM analysis mode dispatch last mod: $Id: analysis.c,v 1.2 2005/01/12 16:54:48 pfisterer Exp $ ********************************************************************/ #include #include #include #include "ogg/ogg.h" #include "vorbis/codec.h" #include "codec_internal.h" #include "registry.h" #include "scales.h" #include "os.h" #include "misc.h" int analysis_noisy=1; /* decides between modes, dispatches to the appropriate mapping. */ int vorbis_analysis(vorbis_block *vb, ogg_packet *op){ int ret; vb->glue_bits=0; vb->time_bits=0; vb->floor_bits=0; vb->res_bits=0; /* first things first. Make sure encode is ready */ oggpack_reset(&vb->opb); /* we only have one mapping type (0), and we let the mapping code itself figure out what soft mode to use. This allows easier bitrate management */ if((ret=_mapping_P[0]->forward(vb))) return(ret); if(op){ if(vorbis_bitrate_managed(vb)) /* The app is using a bitmanaged mode... but not using the bitrate management interface. */ return(OV_EINVAL); op->packet=oggpack_get_buffer(&vb->opb); op->bytes=oggpack_bytes(&vb->opb); op->b_o_s=0; op->e_o_s=vb->eofflag; op->granulepos=vb->granulepos; op->packetno=vb->sequence; /* for sake of completeness */ } return(0); } /* there was no great place to put this.... */ void _analysis_output_always(char *base,int i,float *v,int n,int bark,int dB,ogg_int64_t off){ int j; FILE *of; char buffer[80]; /* if(i==5870){*/ sprintf(buffer,"%s_%d.m",base,i); of=fopen(buffer,"w"); if(!of)perror("failed to open data dump file"); for(j=0;j #include #include #include #include "ogg/ogg.h" #include "vorbis/codec.h" #include "codec_internal.h" #include "os.h" #include "misc.h" #include "bitrate.h" static long BINBYTES(bitrate_manager_state *bm,long pos,long bin){ int bins=bm->queue_bins; return(bm->queue_binned[pos*bins+bin]); } #define LIMITBYTES(pos,bin) (bm->minmax_binstack[(pos)*bins*2+((bin)+bins)]) static long LACING_ADJUST(long bytes){ int addto=bytes/255+1; return(bytes+addto); } static int floater_interpolate(bitrate_manager_state *bm,vorbis_info *vi, double desired_rate){ int bin=rint(bm->avgfloat); double lobitrate,hibitrate; lobitrate=(double)(bm->avg_binacc[bin]*8)/bm->avg_sampleacc*vi->rate; while(lobitrate>desired_rate && bin>0){ bin--; lobitrate=(double)(bm->avg_binacc[bin]*8)/bm->avg_sampleacc*vi->rate; } if(bin+1queue_bins){ hibitrate=(double)(bm->avg_binacc[bin+1]*8)/bm->avg_sampleacc*vi->rate; if(fabs(hibitrate-desired_rate) < fabs(lobitrate-desired_rate))bin++; } return(bin); } /* try out a new limit */ static long limit_sum(bitrate_manager_state *bm,int limit){ int i=bm->minmax_stackptr; long acc=bm->minmax_acctotal; long bins=bm->queue_bins; acc-=LIMITBYTES(i,0); acc+=LIMITBYTES(i,limit); while(i-->0){ if(bm->minmax_limitstack[i]<=limit)break; acc-=LIMITBYTES(i,bm->minmax_limitstack[i]); acc+=LIMITBYTES(i,limit); } return(acc); } /* compute bitrate tracking setup, allocate circular packet size queue */ void vorbis_bitrate_init(vorbis_info *vi,bitrate_manager_state *bm){ int i; codec_setup_info *ci=vi->codec_setup; bitrate_manager_info *bi=&ci->bi; long maxlatency; memset(bm,0,sizeof(*bm)); if(bi){ bm->avg_sampledesired=bi->queue_avg_time*vi->rate; bm->avg_centerdesired=bi->queue_avg_time*vi->rate*bi->queue_avg_center; bm->minmax_sampledesired=bi->queue_minmax_time*vi->rate; /* first find the max possible needed queue size */ maxlatency=max(bm->avg_sampledesired-bm->avg_centerdesired, bm->minmax_sampledesired)+bm->avg_centerdesired; if(maxlatency>0 && (bi->queue_avgmin>0 || bi->queue_avgmax>0 || bi->queue_hardmax>0 || bi->queue_hardmin>0)){ long maxpackets=maxlatency/(ci->blocksizes[0]>>1)+3; long bins=PACKETBLOBS; bm->queue_size=maxpackets; bm->queue_bins=bins; bm->queue_binned=_ogg_calloc(maxpackets,bins*sizeof(*bm->queue_binned)); bm->queue_actual=_ogg_calloc(maxpackets,sizeof(*bm->queue_actual)); if((bi->queue_avgmin>0 || bi->queue_avgmax>0) && bi->queue_avg_time>0){ bm->avg_binacc=_ogg_calloc(bins,sizeof(*bm->avg_binacc)); bm->avgfloat=PACKETBLOBS/2; }else{ bm->avg_tail= -1; } if((bi->queue_hardmin>0 || bi->queue_hardmax>0) && bi->queue_minmax_time>0){ bm->minmax_binstack=_ogg_calloc((bins*2+1)*bins*2, sizeof(*bm->minmax_binstack)); bm->minmax_posstack=_ogg_calloc((bins*2+1), sizeof(*bm->minmax_posstack)); bm->minmax_limitstack=_ogg_calloc((bins*2+1), sizeof(*bm->minmax_limitstack)); }else{ bm->minmax_tail= -1; } /* space for the packet queueing */ bm->packetbuffers=_ogg_calloc(maxpackets,sizeof(*bm->packetbuffers)); bm->packets=_ogg_calloc(maxpackets,sizeof(*bm->packets)); for(i=0;ipacketbuffers+i); }else{ bm->packetbuffers=_ogg_calloc(1,sizeof(*bm->packetbuffers)); bm->packets=_ogg_calloc(1,sizeof(*bm->packets)); oggpack_writeinit(bm->packetbuffers); } } } void vorbis_bitrate_clear(bitrate_manager_state *bm){ int i; if(bm){ if(bm->queue_binned)_ogg_free(bm->queue_binned); if(bm->queue_actual)_ogg_free(bm->queue_actual); if(bm->avg_binacc)_ogg_free(bm->avg_binacc); if(bm->minmax_binstack)_ogg_free(bm->minmax_binstack); if(bm->minmax_posstack)_ogg_free(bm->minmax_posstack); if(bm->minmax_limitstack)_ogg_free(bm->minmax_limitstack); if(bm->packetbuffers){ if(bm->queue_size==0){ oggpack_writeclear(bm->packetbuffers); }else{ for(i=0;iqueue_size;i++) oggpack_writeclear(bm->packetbuffers+i); } _ogg_free(bm->packetbuffers); } if(bm->packets)_ogg_free(bm->packets); memset(bm,0,sizeof(*bm)); } } int vorbis_bitrate_managed(vorbis_block *vb){ vorbis_dsp_state *vd=vb->vd; private_state *b=vd->backend_state; bitrate_manager_state *bm=&b->bms; if(bm->queue_binned)return(1); return(0); } /* finish taking in the block we just processed */ int vorbis_bitrate_addblock(vorbis_block *vb){ int i; vorbis_block_internal *vbi=vb->internal; vorbis_dsp_state *vd=vb->vd; private_state *b=vd->backend_state; bitrate_manager_state *bm=&b->bms; vorbis_info *vi=vd->vi; codec_setup_info *ci=vi->codec_setup; bitrate_manager_info *bi=&ci->bi; int eofflag=vb->eofflag; int head=bm->queue_head; int next_head=head+1; int bins=bm->queue_bins; int minmax_head,new_minmax_head; ogg_uint32_t *head_ptr; oggpack_buffer temp; if(!bm->queue_binned){ oggpack_buffer temp; /* not a bitrate managed stream, but for API simplicity, we'll buffer one packet to keep the code path clean */ if(bm->queue_head)return(-1); /* one has been submitted without being claimed */ bm->queue_head++; bm->packets[0].packet=oggpack_get_buffer(&vb->opb); bm->packets[0].bytes=oggpack_bytes(&vb->opb); bm->packets[0].b_o_s=0; bm->packets[0].e_o_s=vb->eofflag; bm->packets[0].granulepos=vb->granulepos; bm->packets[0].packetno=vb->sequence; /* for sake of completeness */ memcpy(&temp,bm->packetbuffers,sizeof(vb->opb)); memcpy(bm->packetbuffers,&vb->opb,sizeof(vb->opb)); memcpy(&vb->opb,&temp,sizeof(vb->opb)); return(0); } /* add encoded packet to head */ if(next_head>=bm->queue_size)next_head=0; head_ptr=bm->queue_binned+bins*head; /* is there room to add a block? In proper use of the API, this will never come up... but guard it anyway */ if(next_head==bm->avg_tail || next_head==bm->minmax_tail)return(-1); /* add the block to the toplevel queue */ bm->queue_head=next_head; bm->queue_actual[head]=(vb->W?0x80000000UL:0); /* buffer packet fields */ bm->packets[head].packet=oggpack_get_buffer(&vb->opb); bm->packets[head].bytes=oggpack_bytes(&vb->opb); bm->packets[head].b_o_s=0; bm->packets[head].e_o_s=vb->eofflag; bm->packets[head].granulepos=vb->granulepos; bm->packets[head].packetno=vb->sequence; /* for sake of completeness */ /* swap packet buffers */ memcpy(&temp,bm->packetbuffers+head,sizeof(vb->opb)); memcpy(bm->packetbuffers+head,&vb->opb,sizeof(vb->opb)); memcpy(&vb->opb,&temp,sizeof(vb->opb)); /* save markers */ head_ptr[0]=vbi->packetblob_markers[0]; for(i=1;ipacketblob_markers[i]-vbi->packetblob_markers[i-1]; } if(bm->avg_binacc) new_minmax_head=minmax_head=bm->avg_center; else new_minmax_head=minmax_head=head; /* the average tracking queue is updated first; its results (if it's in use) are taken into account by the min/max limiter (if min/max is in use) */ if(bm->avg_binacc){ unsigned long desired_center=bm->avg_centerdesired; if(eofflag)desired_center=0; /* update the avg head */ for(i=0;iavg_binacc[i]+=LACING_ADJUST(head_ptr[i]); bm->avg_sampleacc+=ci->blocksizes[vb->W]>>1; bm->avg_centeracc+=ci->blocksizes[vb->W]>>1; if(bm->avg_sampleacc>bm->avg_sampledesired || eofflag){ /* update the avg center */ if(bm->avg_centeracc>desired_center){ /* choose the new average floater */ int samples=ci->blocksizes[vb->W]>>1; double upper=floater_interpolate(bm,vi,bi->queue_avgmax); double lower=floater_interpolate(bm,vi,bi->queue_avgmin); double new=PACKETBLOBS/2.,slew; int bin; if(uppernew)new=lower; slew=(new-bm->avgfloat)/samples*vi->rate; if(slewavgfloat_downslew_max) new=bm->avgfloat+bi->avgfloat_downslew_max/vi->rate*samples; if(slew>bi->avgfloat_upslew_max) new=bm->avgfloat+bi->avgfloat_upslew_max/vi->rate*samples; bm->avgfloat=new; /* apply the average floater to new blocks */ bin=rint(bm->avgfloat); /*fprintf(stderr,"%d ",bin);*/ while(bm->avg_centeracc>desired_center){ samples=ci->blocksizes[bm->queue_actual[bm->avg_center]& 0x80000000UL?1:0]>>1; bm->queue_actual[bm->avg_center]|=bin; bm->avg_centeracc-=samples; bm->avg_center++; if(bm->avg_center>=bm->queue_size)bm->avg_center=0; } new_minmax_head=bm->avg_center; } /* update the avg tail if needed */ while(bm->avg_sampleacc>bm->avg_sampledesired){ int samples= ci->blocksizes[bm->queue_actual[bm->avg_tail]&0x80000000UL?1:0]>>1; for(i=0;iqueue_bins;i++) bm->avg_binacc[i]-=LACING_ADJUST(bm->queue_binned[bins*bm->avg_tail+i]); bm->avg_sampleacc-=samples; bm->avg_tail++; if(bm->avg_tail>=bm->queue_size)bm->avg_tail=0; } } }else{ /* if we're not using an average tracker, the 'float' is nailed to the avgfloat_initial value. It needs to be set for the min/max to deal properly */ long bin=PACKETBLOBS/2; bm->queue_actual[head]|=bin; new_minmax_head=next_head; } /* update the min/max queues and enforce limits */ if(bm->minmax_binstack){ unsigned long sampledesired=eofflag?0:bm->minmax_sampledesired; /* add to stack recent */ while(minmax_head!=new_minmax_head){ unsigned int i; int samples=ci->blocksizes[bm->queue_actual[minmax_head]& 0x80000000UL?1:0]>>1; int actual=bm->queue_actual[minmax_head]&0x7fffffffUL; for(i=0;i<(unsigned int)bins;i++){ bm->minmax_binstack[bm->minmax_stackptr*bins*2+bins+i]+= LACING_ADJUST(BINBYTES(bm,minmax_head, actual>i?actual:i)); bm->minmax_binstack[bm->minmax_stackptr*bins*2+i]+= LACING_ADJUST(BINBYTES(bm,minmax_head, actualminmax_posstack[bm->minmax_stackptr]=minmax_head; /* not one past like typical */ bm->minmax_limitstack[bm->minmax_stackptr]=0; bm->minmax_sampleacc+=samples; bm->minmax_acctotal+= LACING_ADJUST(BINBYTES(bm,minmax_head,actual)); minmax_head++; if(minmax_head>=bm->queue_size)minmax_head=0; } /* check limits, enforce changes */ if(bm->minmax_sampleacc>sampledesired){ double bitrate=(double)(bm->minmax_acctotal*8)/ bm->minmax_sampleacc*vi->rate; int limit=0; if((bi->queue_hardmax>0 && bitrate>bi->queue_hardmax) || (bi->queue_hardmin>0 && bitratequeue_hardmin)){ int newstack; int stackctr; long bitsum=bm->minmax_acctotal*8; bitrate=(double)bitsum/bm->minmax_sampleacc*vi->rate; /* we're off rate. Iteratively try out new hard floater limits until we find one that brings us inside. Here's where we see the whole point of the limit stacks. */ if(bi->queue_hardmax>0 && bitrate>bi->queue_hardmax){ for(limit=-1;limit>-bins+1;limit--){ long bitsum=limit_sum(bm,limit)*8; bitrate=(double)bitsum/bm->minmax_sampleacc*vi->rate; if(bitrate<=bi->queue_hardmax)break; } }else if(bitratequeue_hardmin){ for(limit=1;limitminmax_sampleacc*vi->rate; if(bitrate>=bi->queue_hardmin)break; } if(bitrate>bi->queue_hardmax)limit--; } /* trace the limit backward, stop when we see a lower limit */ newstack=bm->minmax_stackptr-1; while(newstack>=0){ if(bm->minmax_limitstack[newstack]minmax_stackptr; while(stackctr>newstack){ bm->minmax_acctotal-= LIMITBYTES(stackctr,bm->minmax_limitstack[stackctr]); bm->minmax_acctotal+=LIMITBYTES(stackctr,limit); if(stackctrminmax_stackptr) for(i=0;iminmax_binstack[stackctr*bins*2+i]+= bm->minmax_binstack[(stackctr+1)*bins*2+i]; stackctr--; } stackctr++; bm->minmax_posstack[stackctr]=bm->minmax_posstack[bm->minmax_stackptr]; bm->minmax_limitstack[stackctr]=limit; /* set up new blank stack entry */ stackctr++; bm->minmax_stackptr=stackctr; memset(&bm->minmax_binstack[stackctr*bins*2], 0, sizeof(*bm->minmax_binstack)*bins*2); bm->minmax_limitstack[stackctr]=0; bm->minmax_posstack[stackctr]=-1; } } /* remove from tail */ while(bm->minmax_sampleacc>sampledesired){ int samples= ci->blocksizes[bm->queue_actual[bm->minmax_tail]&0x80000000UL?1:0]>>1; int actual=bm->queue_actual[bm->minmax_tail]&0x7fffffffUL; for(i=0;iminmax_binstack[bins+i]-= /* always comes off the stack bottom */ LACING_ADJUST(BINBYTES(bm,bm->minmax_tail, actual>i? actual:i)); bm->minmax_binstack[i]-= LACING_ADJUST(BINBYTES(bm,bm->minmax_tail, actualminmax_limitstack[0]>actual) actual=bm->minmax_limitstack[0]; if(bins+bm->minmax_limitstack[0]minmax_limitstack[0]; bm->minmax_acctotal-=LACING_ADJUST(BINBYTES(bm,bm->minmax_tail,actual)); bm->minmax_sampleacc-=samples; /* revise queue_actual to reflect the limit */ bm->queue_actual[bm->minmax_tail]&=0x80000000UL; bm->queue_actual[bm->minmax_tail]|=actual; if(bm->minmax_tail==bm->minmax_posstack[0]){ /* the stack becomes a FIFO; the first data has fallen off */ memmove(bm->minmax_binstack,bm->minmax_binstack+bins*2, sizeof(*bm->minmax_binstack)*bins*2*bm->minmax_stackptr); memmove(bm->minmax_posstack,bm->minmax_posstack+1, sizeof(*bm->minmax_posstack)*bm->minmax_stackptr); memmove(bm->minmax_limitstack,bm->minmax_limitstack+1, sizeof(*bm->minmax_limitstack)*bm->minmax_stackptr); bm->minmax_stackptr--; } bm->minmax_tail++; if(bm->minmax_tail>=bm->queue_size)bm->minmax_tail=0; } bm->last_to_flush=bm->minmax_tail; }else{ bm->last_to_flush=bm->avg_center; } if(eofflag) bm->last_to_flush=bm->queue_head; return(0); } int vorbis_bitrate_flushpacket(vorbis_dsp_state *vd,ogg_packet *op){ private_state *b=vd->backend_state; bitrate_manager_state *bm=&b->bms; if(bm->queue_size==0){ if(bm->queue_head==0)return(0); memcpy(op,bm->packets,sizeof(*op)); bm->queue_head=0; }else{ if(bm->next_to_flush==bm->last_to_flush)return(0); { long bin=bm->queue_actual[bm->next_to_flush]&0x7fffffff,i; long bins=bm->queue_bins; ogg_uint32_t *markers=bm->queue_binned+bins*bm->next_to_flush; long bytes=markers[bin]; memcpy(op,bm->packets+bm->next_to_flush,sizeof(*op)); /* we have [PACKETBLOBS] possible packets all squished together in the buffer, in sequence. count in to number [bin] */ for(i=0;ipacket+=markers[i]; op->bytes=bytes; } bm->next_to_flush++; if(bm->next_to_flush>=bm->queue_size)bm->next_to_flush=0; } return(1); } libtritonus-java-20070428/src/lib/pvorbis/bitrate.h0000644000175000017500000000523510167052676022060 0ustar twernertwerner/******************************************************************** * * * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 * * by the XIPHOPHORUS Company http://www.xiph.org/ * * * ******************************************************************** function: bitrate tracking and management last mod: $Id: bitrate.h,v 1.1 2005/01/05 21:01:50 pfisterer Exp $ ********************************************************************/ #ifndef _V_BITRATE_H_ #define _V_BITRATE_H_ #include "vorbis/codec.h" #include "codec_internal.h" #include "os.h" /* encode side bitrate tracking */ typedef struct bitrate_manager_state { ogg_uint32_t *queue_binned; ogg_uint32_t *queue_actual; int queue_size; int queue_head; int queue_bins; long *avg_binacc; int avg_center; int avg_tail; ogg_uint32_t avg_centeracc; ogg_uint32_t avg_sampleacc; ogg_uint32_t avg_sampledesired; ogg_uint32_t avg_centerdesired; long *minmax_binstack; long *minmax_posstack; long *minmax_limitstack; long minmax_stackptr; long minmax_acctotal; int minmax_tail; ogg_uint32_t minmax_sampleacc; ogg_uint32_t minmax_sampledesired; int next_to_flush; int last_to_flush; double avgfloat; /* unfortunately, we need to hold queued packet data somewhere */ oggpack_buffer *packetbuffers; ogg_packet *packets; } bitrate_manager_state; typedef struct bitrate_manager_info{ /* detailed bitrate management setup */ double queue_avg_time; double queue_avg_center; double queue_minmax_time; double queue_hardmin; double queue_hardmax; double queue_avgmin; double queue_avgmax; double avgfloat_downslew_max; double avgfloat_upslew_max; } bitrate_manager_info; extern void vorbis_bitrate_init(vorbis_info *vi,bitrate_manager_state *bs); extern void vorbis_bitrate_clear(bitrate_manager_state *bs); extern int vorbis_bitrate_managed(vorbis_block *vb); extern int vorbis_bitrate_addblock(vorbis_block *vb); extern int vorbis_bitrate_flushpacket(vorbis_dsp_state *vd, ogg_packet *op); #endif libtritonus-java-20070428/src/lib/pvorbis/bitwise.c0000644000175000017500000005023710171253130022050 0ustar twernertwerner/******************************************************************** * * * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 * * by the Xiph.Org Foundation http://www.xiph.org/ * * * ******************************************************************** function: packing variable sized words into an octet stream last mod: $Id: bitwise.c,v 1.1 2005/01/12 16:54:48 pfisterer Exp $ ********************************************************************/ /* We're 'LSb' endian; if we write a word but read individual bits, then we'll read the lsb first */ #include #include #include "ogg/ogg.h" #define BUFFER_INCREMENT 256 static unsigned long mask[]= {0x00000000,0x00000001,0x00000003,0x00000007,0x0000000f, 0x0000001f,0x0000003f,0x0000007f,0x000000ff,0x000001ff, 0x000003ff,0x000007ff,0x00000fff,0x00001fff,0x00003fff, 0x00007fff,0x0000ffff,0x0001ffff,0x0003ffff,0x0007ffff, 0x000fffff,0x001fffff,0x003fffff,0x007fffff,0x00ffffff, 0x01ffffff,0x03ffffff,0x07ffffff,0x0fffffff,0x1fffffff, 0x3fffffff,0x7fffffff,0xffffffff }; static unsigned int mask8B[]= {0x00,0x80,0xc0,0xe0,0xf0,0xf8,0xfc,0xfe,0xff}; void oggpack_writeinit(oggpack_buffer *b){ memset(b,0,sizeof(*b)); b->ptr=b->buffer=_ogg_malloc(BUFFER_INCREMENT); b->buffer[0]='\0'; b->storage=BUFFER_INCREMENT; } void oggpackB_writeinit(oggpack_buffer *b){ oggpack_writeinit(b); } void oggpack_writetrunc(oggpack_buffer *b,long bits){ long bytes=bits>>3; bits-=bytes*8; b->ptr=b->buffer+bytes; b->endbit=bits; b->endbyte=bytes; *b->ptr&=mask[bits]; } void oggpackB_writetrunc(oggpack_buffer *b,long bits){ long bytes=bits>>3; bits-=bytes*8; b->ptr=b->buffer+bytes; b->endbit=bits; b->endbyte=bytes; *b->ptr&=mask8B[bits]; } /* Takes only up to 32 bits. */ void oggpack_write(oggpack_buffer *b,unsigned long value,int bits){ if(b->endbyte+4>=b->storage){ b->buffer=_ogg_realloc(b->buffer,b->storage+BUFFER_INCREMENT); b->storage+=BUFFER_INCREMENT; b->ptr=b->buffer+b->endbyte; } value&=mask[bits]; bits+=b->endbit; b->ptr[0]|=value<endbit; if(bits>=8){ b->ptr[1]=value>>(8-b->endbit); if(bits>=16){ b->ptr[2]=value>>(16-b->endbit); if(bits>=24){ b->ptr[3]=value>>(24-b->endbit); if(bits>=32){ if(b->endbit) b->ptr[4]=value>>(32-b->endbit); else b->ptr[4]=0; } } } } b->endbyte+=bits/8; b->ptr+=bits/8; b->endbit=bits&7; } /* Takes only up to 32 bits. */ void oggpackB_write(oggpack_buffer *b,unsigned long value,int bits){ if(b->endbyte+4>=b->storage){ b->buffer=_ogg_realloc(b->buffer,b->storage+BUFFER_INCREMENT); b->storage+=BUFFER_INCREMENT; b->ptr=b->buffer+b->endbyte; } value=(value&mask[bits])<<(32-bits); bits+=b->endbit; b->ptr[0]|=value>>(24+b->endbit); if(bits>=8){ b->ptr[1]=value>>(16+b->endbit); if(bits>=16){ b->ptr[2]=value>>(8+b->endbit); if(bits>=24){ b->ptr[3]=value>>(b->endbit); if(bits>=32){ if(b->endbit) b->ptr[4]=value<<(8-b->endbit); else b->ptr[4]=0; } } } } b->endbyte+=bits/8; b->ptr+=bits/8; b->endbit=bits&7; } void oggpack_writealign(oggpack_buffer *b){ int bits=8-b->endbit; if(bits<8) oggpack_write(b,0,bits); } void oggpackB_writealign(oggpack_buffer *b){ int bits=8-b->endbit; if(bits<8) oggpackB_write(b,0,bits); } static void oggpack_writecopy_helper(oggpack_buffer *b, void *source, long bits, void (*w)(oggpack_buffer *, unsigned long, int), int msb){ unsigned char *ptr=(unsigned char *)source; long bytes=bits/8; bits-=bytes*8; if(b->endbit){ int i; /* unaligned copy. Do it the hard way. */ for(i=0;iendbyte+bytes+1>=b->storage){ b->storage=b->endbyte+bytes+BUFFER_INCREMENT; b->buffer=_ogg_realloc(b->buffer,b->storage); b->ptr=b->buffer+b->endbyte; } memmove(b->ptr,source,bytes); b->ptr+=bytes; b->buffer+=bytes; *b->ptr=0; } if(bits){ if(msb) w(b,(unsigned long)(ptr[bytes]>>(8-bits)),bits); else w(b,(unsigned long)(ptr[bytes]),bits); } } void oggpack_writecopy(oggpack_buffer *b,void *source,long bits){ oggpack_writecopy_helper(b,source,bits,oggpack_write,0); } void oggpackB_writecopy(oggpack_buffer *b,void *source,long bits){ oggpack_writecopy_helper(b,source,bits,oggpackB_write,1); } void oggpack_reset(oggpack_buffer *b){ b->ptr=b->buffer; b->buffer[0]=0; b->endbit=b->endbyte=0; } void oggpackB_reset(oggpack_buffer *b){ oggpack_reset(b); } void oggpack_writeclear(oggpack_buffer *b){ _ogg_free(b->buffer); memset(b,0,sizeof(*b)); } void oggpackB_writeclear(oggpack_buffer *b){ oggpack_writeclear(b); } void oggpack_readinit(oggpack_buffer *b,unsigned char *buf,int bytes){ memset(b,0,sizeof(*b)); b->buffer=b->ptr=buf; b->storage=bytes; } void oggpackB_readinit(oggpack_buffer *b,unsigned char *buf,int bytes){ oggpack_readinit(b,buf,bytes); } /* Read in bits without advancing the bitptr; bits <= 32 */ long oggpack_look(oggpack_buffer *b,int bits){ unsigned long ret; unsigned long m=mask[bits]; bits+=b->endbit; if(b->endbyte+4>=b->storage){ /* not the main path */ if(b->endbyte*8+bits>b->storage*8)return(-1); } ret=b->ptr[0]>>b->endbit; if(bits>8){ ret|=b->ptr[1]<<(8-b->endbit); if(bits>16){ ret|=b->ptr[2]<<(16-b->endbit); if(bits>24){ ret|=b->ptr[3]<<(24-b->endbit); if(bits>32 && b->endbit) ret|=b->ptr[4]<<(32-b->endbit); } } } return(m&ret); } /* Read in bits without advancing the bitptr; bits <= 32 */ long oggpackB_look(oggpack_buffer *b,int bits){ unsigned long ret; int m=32-bits; bits+=b->endbit; if(b->endbyte+4>=b->storage){ /* not the main path */ if(b->endbyte*8+bits>b->storage*8)return(-1); } ret=b->ptr[0]<<(24+b->endbit); if(bits>8){ ret|=b->ptr[1]<<(16+b->endbit); if(bits>16){ ret|=b->ptr[2]<<(8+b->endbit); if(bits>24){ ret|=b->ptr[3]<<(b->endbit); if(bits>32 && b->endbit) ret|=b->ptr[4]>>(8-b->endbit); } } } return (ret>>(m>>1))>>((m+1)>>1); } long oggpack_look1(oggpack_buffer *b){ if(b->endbyte>=b->storage)return(-1); return((b->ptr[0]>>b->endbit)&1); } long oggpackB_look1(oggpack_buffer *b){ if(b->endbyte>=b->storage)return(-1); return((b->ptr[0]>>(7-b->endbit))&1); } void oggpack_adv(oggpack_buffer *b,int bits){ bits+=b->endbit; b->ptr+=bits/8; b->endbyte+=bits/8; b->endbit=bits&7; } void oggpackB_adv(oggpack_buffer *b,int bits){ oggpack_adv(b,bits); } void oggpack_adv1(oggpack_buffer *b){ if(++(b->endbit)>7){ b->endbit=0; b->ptr++; b->endbyte++; } } void oggpackB_adv1(oggpack_buffer *b){ oggpack_adv1(b); } /* bits <= 32 */ long oggpack_read(oggpack_buffer *b,int bits){ unsigned long ret; unsigned long m=mask[bits]; bits+=b->endbit; if(b->endbyte+4>=b->storage){ /* not the main path */ ret=-1UL; if(b->endbyte*8+bits>b->storage*8)goto overflow; } ret=b->ptr[0]>>b->endbit; if(bits>8){ ret|=b->ptr[1]<<(8-b->endbit); if(bits>16){ ret|=b->ptr[2]<<(16-b->endbit); if(bits>24){ ret|=b->ptr[3]<<(24-b->endbit); if(bits>32 && b->endbit){ ret|=b->ptr[4]<<(32-b->endbit); } } } } ret&=m; overflow: b->ptr+=bits/8; b->endbyte+=bits/8; b->endbit=bits&7; return(ret); } /* bits <= 32 */ long oggpackB_read(oggpack_buffer *b,int bits){ unsigned long ret; long m=32-bits; bits+=b->endbit; if(b->endbyte+4>=b->storage){ /* not the main path */ ret=-1UL; if(b->endbyte*8+bits>b->storage*8)goto overflow; } ret=b->ptr[0]<<(24+b->endbit); if(bits>8){ ret|=b->ptr[1]<<(16+b->endbit); if(bits>16){ ret|=b->ptr[2]<<(8+b->endbit); if(bits>24){ ret|=b->ptr[3]<<(b->endbit); if(bits>32 && b->endbit) ret|=b->ptr[4]>>(8-b->endbit); } } } ret=(ret>>(m>>1))>>((m+1)>>1); overflow: b->ptr+=bits/8; b->endbyte+=bits/8; b->endbit=bits&7; return(ret); } long oggpack_read1(oggpack_buffer *b){ unsigned long ret; if(b->endbyte>=b->storage){ /* not the main path */ ret=-1UL; goto overflow; } ret=(b->ptr[0]>>b->endbit)&1; overflow: b->endbit++; if(b->endbit>7){ b->endbit=0; b->ptr++; b->endbyte++; } return(ret); } long oggpackB_read1(oggpack_buffer *b){ unsigned long ret; if(b->endbyte>=b->storage){ /* not the main path */ ret=-1UL; goto overflow; } ret=(b->ptr[0]>>(7-b->endbit))&1; overflow: b->endbit++; if(b->endbit>7){ b->endbit=0; b->ptr++; b->endbyte++; } return(ret); } long oggpack_bytes(oggpack_buffer *b){ return(b->endbyte+(b->endbit+7)/8); } long oggpack_bits(oggpack_buffer *b){ return(b->endbyte*8+b->endbit); } long oggpackB_bytes(oggpack_buffer *b){ return oggpack_bytes(b); } long oggpackB_bits(oggpack_buffer *b){ return oggpack_bits(b); } unsigned char *oggpack_get_buffer(oggpack_buffer *b){ return(b->buffer); } unsigned char *oggpackB_get_buffer(oggpack_buffer *b){ return oggpack_get_buffer(b); } /* Self test of the bitwise routines; everything else is based on them, so they damned well better be solid. */ #ifdef _V_SELFTEST #include static int ilog(unsigned int v){ int ret=0; while(v){ ret++; v>>=1; } return(ret); } oggpack_buffer o; oggpack_buffer r; void report(char *in){ fprintf(stderr,"%s",in); exit(1); } void cliptest(unsigned long *b,int vals,int bits,int *comp,int compsize){ long bytes,i; unsigned char *buffer; oggpack_reset(&o); for(i=0;i #include #include #include "ogg/ogg.h" #include "vorbis/codec.h" #include "codec_internal.h" #include "window.h" #include "mdct.h" #include "lpc.h" #include "registry.h" #include "misc.h" static int ilog2(unsigned int v){ int ret=0; if(v)--v; while(v){ ret++; v>>=1; } return(ret); } /* pcm accumulator examples (not exhaustive): <-------------- lW ----------------> <--------------- W ----------------> : .....|..... _______________ | : .''' | '''_--- | |\ | :.....''' |_____--- '''......| | \_______| :.................|__________________|_______|__|______| |<------ Sl ------>| > Sr < |endW |beginSl |endSl | |endSr |beginW |endlW |beginSr |< lW >| <--------------- W ----------------> | | .. ______________ | | | ' `/ | ---_ | |___.'___/`. | ---_____| |_______|__|_______|_________________| | >|Sl|< |<------ Sr ----->|endW | | |endSl |beginSr |endSr |beginW | |endlW mult[0] |beginSl mult[n] <-------------- lW -----------------> |<--W-->| : .............. ___ | | : .''' |`/ \ | | :.....''' |/`....\|...| :.........................|___|___|___| |Sl |Sr |endW | | |endSr | |beginSr | |endSl |beginSl |beginW */ /* block abstraction setup *********************************************/ #ifndef WORD_ALIGN #define WORD_ALIGN 8 #endif int vorbis_block_init(vorbis_dsp_state *v, vorbis_block *vb){ memset(vb,0,sizeof(*vb)); vb->vd=v; vb->localalloc=0; vb->localstore=NULL; if(v->analysisp){ vorbis_block_internal *vbi= vb->internal=_ogg_calloc(1,sizeof(vorbis_block_internal)); oggpack_writeinit(&vb->opb); vbi->ampmax=-9999; } return(0); } void *_vorbis_block_alloc(vorbis_block *vb,long bytes){ bytes=(bytes+(WORD_ALIGN-1)) & ~(WORD_ALIGN-1); if(bytes+vb->localtop>vb->localalloc){ /* can't just _ogg_realloc... there are outstanding pointers */ if(vb->localstore){ struct alloc_chain *link=_ogg_malloc(sizeof(*link)); vb->totaluse+=vb->localtop; link->next=vb->reap; link->ptr=vb->localstore; vb->reap=link; } /* highly conservative */ vb->localalloc=bytes; vb->localstore=_ogg_malloc(vb->localalloc); vb->localtop=0; } { void *ret=(void *)(((char *)vb->localstore)+vb->localtop); vb->localtop+=bytes; return ret; } } /* reap the chain, pull the ripcord */ void _vorbis_block_ripcord(vorbis_block *vb){ /* reap the chain */ struct alloc_chain *reap=vb->reap; while(reap){ struct alloc_chain *next=reap->next; _ogg_free(reap->ptr); memset(reap,0,sizeof(*reap)); _ogg_free(reap); reap=next; } /* consolidate storage */ if(vb->totaluse){ vb->localstore=_ogg_realloc(vb->localstore,vb->totaluse+vb->localalloc); vb->localalloc+=vb->totaluse; vb->totaluse=0; } /* pull the ripcord */ vb->localtop=0; vb->reap=NULL; } int vorbis_block_clear(vorbis_block *vb){ if(vb->vd) if(vb->vd->analysisp) oggpack_writeclear(&vb->opb); _vorbis_block_ripcord(vb); if(vb->localstore)_ogg_free(vb->localstore); if(vb->internal) _ogg_free(vb->internal); memset(vb,0,sizeof(*vb)); return(0); } /* Analysis side code, but directly related to blocking. Thus it's here and not in analysis.c (which is for analysis transforms only). The init is here because some of it is shared */ static int _vds_shared_init(vorbis_dsp_state *v,vorbis_info *vi,int encp){ int i; codec_setup_info *ci=vi->codec_setup; private_state *b=NULL; int hs; if(ci==NULL) return 1; hs=ci->halfrate_flag; memset(v,0,sizeof(*v)); b=v->backend_state=_ogg_calloc(1,sizeof(*b)); v->vi=vi; b->modebits=ilog2(ci->modes); b->transform[0]=_ogg_calloc(VI_TRANSFORMB,sizeof(*b->transform[0])); b->transform[1]=_ogg_calloc(VI_TRANSFORMB,sizeof(*b->transform[1])); /* MDCT is tranform 0 */ b->transform[0][0]=_ogg_calloc(1,sizeof(mdct_lookup)); b->transform[1][0]=_ogg_calloc(1,sizeof(mdct_lookup)); mdct_init(b->transform[0][0],ci->blocksizes[0]>>hs); mdct_init(b->transform[1][0],ci->blocksizes[1]>>hs); /* Vorbis I uses only window type 0 */ b->window[0]=ilog2(ci->blocksizes[0])-6; b->window[1]=ilog2(ci->blocksizes[1])-6; if(encp){ /* encode/decode differ here */ /* analysis always needs an fft */ drft_init(&b->fft_look[0],ci->blocksizes[0]); drft_init(&b->fft_look[1],ci->blocksizes[1]); /* finish the codebooks */ if(!ci->fullbooks){ ci->fullbooks=_ogg_calloc(ci->books,sizeof(*ci->fullbooks)); for(i=0;ibooks;i++) vorbis_book_init_encode(ci->fullbooks+i,ci->book_param[i]); } b->psy=_ogg_calloc(ci->psys,sizeof(*b->psy)); for(i=0;ipsys;i++){ _vp_psy_init(b->psy+i, ci->psy_param[i], &ci->psy_g_param, ci->blocksizes[ci->psy_param[i]->blockflag]/2, vi->rate); } v->analysisp=1; }else{ /* finish the codebooks */ if(!ci->fullbooks){ ci->fullbooks=_ogg_calloc(ci->books,sizeof(*ci->fullbooks)); for(i=0;ibooks;i++){ vorbis_book_init_decode(ci->fullbooks+i,ci->book_param[i]); /* decode codebooks are now standalone after init */ vorbis_staticbook_destroy(ci->book_param[i]); ci->book_param[i]=NULL; } } } /* initialize the storage vectors. blocksize[1] is small for encode, but the correct size for decode */ v->pcm_storage=ci->blocksizes[1]; v->pcm=_ogg_malloc(vi->channels*sizeof(*v->pcm)); v->pcmret=_ogg_malloc(vi->channels*sizeof(*v->pcmret)); { int i; for(i=0;ichannels;i++) v->pcm[i]=_ogg_calloc(v->pcm_storage,sizeof(*v->pcm[i])); } /* all 1 (large block) or 0 (small block) */ /* explicitly set for the sake of clarity */ v->lW=0; /* previous window size */ v->W=0; /* current window size */ /* all vector indexes */ v->centerW=ci->blocksizes[1]/2; v->pcm_current=v->centerW; /* initialize all the backend lookups */ b->flr=_ogg_calloc(ci->floors,sizeof(*b->flr)); b->residue=_ogg_calloc(ci->residues,sizeof(*b->residue)); for(i=0;ifloors;i++) b->flr[i]=_floor_P[ci->floor_type[i]]-> look(v,ci->floor_param[i]); for(i=0;iresidues;i++) b->residue[i]=_residue_P[ci->residue_type[i]]-> look(v,ci->residue_param[i]); return 0; } /* arbitrary settings and spec-mandated numbers get filled in here */ int vorbis_analysis_init(vorbis_dsp_state *v,vorbis_info *vi){ private_state *b=NULL; if(_vds_shared_init(v,vi,1))return 1; b=v->backend_state; b->psy_g_look=_vp_global_look(vi); /* Initialize the envelope state storage */ b->ve=_ogg_calloc(1,sizeof(*b->ve)); _ve_envelope_init(b->ve,vi); vorbis_bitrate_init(vi,&b->bms); return(0); } void vorbis_dsp_clear(vorbis_dsp_state *v){ int i; if(v){ vorbis_info *vi=v->vi; codec_setup_info *ci=(vi?vi->codec_setup:NULL); private_state *b=v->backend_state; if(b){ if(b->ve){ _ve_envelope_clear(b->ve); _ogg_free(b->ve); } if(b->transform[0]){ mdct_clear(b->transform[0][0]); _ogg_free(b->transform[0][0]); _ogg_free(b->transform[0]); } if(b->transform[1]){ mdct_clear(b->transform[1][0]); _ogg_free(b->transform[1][0]); _ogg_free(b->transform[1]); } if(b->flr){ for(i=0;ifloors;i++) _floor_P[ci->floor_type[i]]-> free_look(b->flr[i]); _ogg_free(b->flr); } if(b->residue){ for(i=0;iresidues;i++) _residue_P[ci->residue_type[i]]-> free_look(b->residue[i]); _ogg_free(b->residue); } if(b->psy){ for(i=0;ipsys;i++) _vp_psy_clear(b->psy+i); _ogg_free(b->psy); } if(b->psy_g_look)_vp_global_free(b->psy_g_look); vorbis_bitrate_clear(&b->bms); drft_clear(&b->fft_look[0]); drft_clear(&b->fft_look[1]); } if(v->pcm){ for(i=0;ichannels;i++) if(v->pcm[i])_ogg_free(v->pcm[i]); _ogg_free(v->pcm); if(v->pcmret)_ogg_free(v->pcmret); } if(b){ /* free header2 */ if(b->header2)_ogg_free(b->header2); _ogg_free(b); } memset(v,0,sizeof(*v)); } } float **vorbis_analysis_buffer(vorbis_dsp_state *v, int vals){ int i; vorbis_info *vi=v->vi; private_state *b=v->backend_state; /* free header2 */ if(b->header2)_ogg_free(b->header2);b->header2=NULL; /* Do we have enough storage space for the requested buffer? If not, expand the PCM (and envelope) storage */ if(v->pcm_current+vals>=v->pcm_storage){ v->pcm_storage=v->pcm_current+vals*2; for(i=0;ichannels;i++){ v->pcm[i]=_ogg_realloc(v->pcm[i],v->pcm_storage*sizeof(*v->pcm[i])); } } for(i=0;ichannels;i++) v->pcmret[i]=v->pcm[i]+v->pcm_current; return(v->pcmret); } static void _preextrapolate_helper(vorbis_dsp_state *v){ int i; int order=32; float *lpc=alloca(order*sizeof(*lpc)); float *work=alloca(v->pcm_current*sizeof(*work)); long j; v->preextrapolate=1; if(v->pcm_current-v->centerW>order*2){ /* safety */ for(i=0;ivi->channels;i++){ /* need to run the extrapolation in reverse! */ for(j=0;jpcm_current;j++) work[j]=v->pcm[i][v->pcm_current-j-1]; /* prime as above */ vorbis_lpc_from_data(work,lpc,v->pcm_current-v->centerW,order); /* run the predictor filter */ vorbis_lpc_predict(lpc,work+v->pcm_current-v->centerW-order, order, work+v->pcm_current-v->centerW, v->centerW); for(j=0;jpcm_current;j++) v->pcm[i][v->pcm_current-j-1]=work[j]; } } } /* call with val<=0 to set eof */ int vorbis_analysis_wrote(vorbis_dsp_state *v, int vals){ vorbis_info *vi=v->vi; codec_setup_info *ci=vi->codec_setup; if(vals<=0){ int order=32; int i; float *lpc=alloca(order*sizeof(*lpc)); /* if it wasn't done earlier (very short sample) */ if(!v->preextrapolate) _preextrapolate_helper(v); /* We're encoding the end of the stream. Just make sure we have [at least] a few full blocks of zeroes at the end. */ /* actually, we don't want zeroes; that could drop a large amplitude off a cliff, creating spread spectrum noise that will suck to encode. Extrapolate for the sake of cleanliness. */ vorbis_analysis_buffer(v,ci->blocksizes[1]*3); v->eofflag=v->pcm_current; v->pcm_current+=ci->blocksizes[1]*3; for(i=0;ichannels;i++){ if(v->eofflag>order*2){ /* extrapolate with LPC to fill in */ long n; /* make a predictor filter */ n=v->eofflag; if(n>ci->blocksizes[1])n=ci->blocksizes[1]; vorbis_lpc_from_data(v->pcm[i]+v->eofflag-n,lpc,n,order); /* run the predictor filter */ vorbis_lpc_predict(lpc,v->pcm[i]+v->eofflag-order,order, v->pcm[i]+v->eofflag,v->pcm_current-v->eofflag); }else{ /* not enough data to extrapolate (unlikely to happen due to guarding the overlap, but bulletproof in case that assumtion goes away). zeroes will do. */ memset(v->pcm[i]+v->eofflag,0, (v->pcm_current-v->eofflag)*sizeof(*v->pcm[i])); } } }else{ if(v->pcm_current+vals>v->pcm_storage) return(OV_EINVAL); v->pcm_current+=vals; /* we may want to reverse extrapolate the beginning of a stream too... in case we're beginning on a cliff! */ /* clumsy, but simple. It only runs once, so simple is good. */ if(!v->preextrapolate && v->pcm_current-v->centerW>ci->blocksizes[1]) _preextrapolate_helper(v); } return(0); } /* do the deltas, envelope shaping, pre-echo and determine the size of the next block on which to continue analysis */ int vorbis_analysis_blockout(vorbis_dsp_state *v,vorbis_block *vb){ int i; vorbis_info *vi=v->vi; codec_setup_info *ci=vi->codec_setup; private_state *b=v->backend_state; vorbis_look_psy_global *g=b->psy_g_look; long beginW=v->centerW-ci->blocksizes[v->W]/2,centerNext; vorbis_block_internal *vbi=(vorbis_block_internal *)vb->internal; /* check to see if we're started... */ if(!v->preextrapolate)return(0); /* check to see if we're done... */ if(v->eofflag==-1)return(0); /* By our invariant, we have lW, W and centerW set. Search for the next boundary so we can determine nW (the next window size) which lets us compute the shape of the current block's window */ /* we do an envelope search even on a single blocksize; we may still be throwing more bits at impulses, and envelope search handles marking impulses too. */ { long bp=_ve_envelope_search(v); if(bp==-1){ if(v->eofflag==0)return(0); /* not enough data currently to search for a full long block */ v->nW=0; }else{ if(ci->blocksizes[0]==ci->blocksizes[1]) v->nW=0; else v->nW=bp; } } centerNext=v->centerW+ci->blocksizes[v->W]/4+ci->blocksizes[v->nW]/4; { /* center of next block + next block maximum right side. */ long blockbound=centerNext+ci->blocksizes[v->nW]/2; if(v->pcm_currentlW=v->lW; vb->W=v->W; vb->nW=v->nW; if(v->W){ if(!v->lW || !v->nW){ vbi->blocktype=BLOCKTYPE_TRANSITION; /*fprintf(stderr,"-");*/ }else{ vbi->blocktype=BLOCKTYPE_LONG; /*fprintf(stderr,"_");*/ } }else{ if(_ve_envelope_mark(v)){ vbi->blocktype=BLOCKTYPE_IMPULSE; /*fprintf(stderr,"|");*/ }else{ vbi->blocktype=BLOCKTYPE_PADDING; /*fprintf(stderr,".");*/ } } vb->vd=v; vb->sequence=v->sequence++; vb->granulepos=v->granulepos; vb->pcmend=ci->blocksizes[v->W]; /* copy the vectors; this uses the local storage in vb */ /* this tracks 'strongest peak' for later psychoacoustics */ /* moved to the global psy state; clean this mess up */ if(vbi->ampmax>g->ampmax)g->ampmax=vbi->ampmax; g->ampmax=_vp_ampmax_decay(g->ampmax,v); vbi->ampmax=g->ampmax; vb->pcm=_vorbis_block_alloc(vb,sizeof(*vb->pcm)*vi->channels); vbi->pcmdelay=_vorbis_block_alloc(vb,sizeof(*vbi->pcmdelay)*vi->channels); for(i=0;ichannels;i++){ vbi->pcmdelay[i]= _vorbis_block_alloc(vb,(vb->pcmend+beginW)*sizeof(*vbi->pcmdelay[i])); memcpy(vbi->pcmdelay[i],v->pcm[i],(vb->pcmend+beginW)*sizeof(*vbi->pcmdelay[i])); vb->pcm[i]=vbi->pcmdelay[i]+beginW; /* before we added the delay vb->pcm[i]=_vorbis_block_alloc(vb,vb->pcmend*sizeof(*vb->pcm[i])); memcpy(vb->pcm[i],v->pcm[i]+beginW,ci->blocksizes[v->W]*sizeof(*vb->pcm[i])); */ } /* handle eof detection: eof==0 means that we've not yet received EOF eof>0 marks the last 'real' sample in pcm[] eof<0 'no more to do'; doesn't get here */ if(v->eofflag){ if(v->centerW>=v->eofflag){ v->eofflag=-1; vb->eofflag=1; return(1); } } /* advance storage vectors and clean up */ { int new_centerNext=ci->blocksizes[1]/2; int movementW=centerNext-new_centerNext; if(movementW>0){ _ve_envelope_shift(b->ve,movementW); v->pcm_current-=movementW; for(i=0;ichannels;i++) memmove(v->pcm[i],v->pcm[i]+movementW, v->pcm_current*sizeof(*v->pcm[i])); v->lW=v->W; v->W=v->nW; v->centerW=new_centerNext; if(v->eofflag){ v->eofflag-=movementW; if(v->eofflag<=0)v->eofflag=-1; /* do not add padding to end of stream! */ if(v->centerW>=v->eofflag){ v->granulepos+=movementW-(v->centerW-v->eofflag); }else{ v->granulepos+=movementW; } }else{ v->granulepos+=movementW; } } } /* done */ return(1); } int vorbis_synthesis_restart(vorbis_dsp_state *v){ vorbis_info *vi=v->vi; codec_setup_info *ci; int hs; if(!v->backend_state)return -1; if(!vi)return -1; ci=vi->codec_setup; if(!ci)return -1; hs=ci->halfrate_flag; v->centerW=ci->blocksizes[1]>>(hs+1); v->pcm_current=v->centerW>>hs; v->pcm_returned=-1; v->granulepos=-1; v->sequence=-1; v->eofflag=0; ((private_state *)(v->backend_state))->sample_count=-1; return(0); } int vorbis_synthesis_init(vorbis_dsp_state *v,vorbis_info *vi){ if(_vds_shared_init(v,vi,0)) return 1; vorbis_synthesis_restart(v); return 0; } /* Unlike in analysis, the window is only partially applied for each block. The time domain envelope is not yet handled at the point of calling (as it relies on the previous block). */ int vorbis_synthesis_blockin(vorbis_dsp_state *v,vorbis_block *vb){ vorbis_info *vi=v->vi; codec_setup_info *ci=vi->codec_setup; private_state *b=v->backend_state; int hs=ci->halfrate_flag; int i,j; if(!vb)return(OV_EINVAL); if(v->pcm_current>v->pcm_returned && v->pcm_returned!=-1)return(OV_EINVAL); v->lW=v->W; v->W=vb->W; v->nW=-1; if((v->sequence==-1)|| (v->sequence+1 != vb->sequence)){ v->granulepos=-1; /* out of sequence; lose count */ b->sample_count=-1; } v->sequence=vb->sequence; if(vb->pcm){ /* no pcm to process if vorbis_synthesis_trackonly was called on block */ int n=ci->blocksizes[v->W]>>(hs+1); int n0=ci->blocksizes[0]>>(hs+1); int n1=ci->blocksizes[1]>>(hs+1); int thisCenter; int prevCenter; v->glue_bits+=vb->glue_bits; v->time_bits+=vb->time_bits; v->floor_bits+=vb->floor_bits; v->res_bits+=vb->res_bits; if(v->centerW){ thisCenter=n1; prevCenter=0; }else{ thisCenter=0; prevCenter=n1; } /* v->pcm is now used like a two-stage double buffer. We don't want to have to constantly shift *or* adjust memory usage. Don't accept a new block until the old is shifted out */ for(j=0;jchannels;j++){ /* the overlap/add section */ if(v->lW){ if(v->W){ /* large/large */ float *w=_vorbis_window_get(b->window[1]-hs); float *pcm=v->pcm[j]+prevCenter; float *p=vb->pcm[j]; for(i=0;iwindow[0]-hs); float *pcm=v->pcm[j]+prevCenter+n1/2-n0/2; float *p=vb->pcm[j]; for(i=0;iW){ /* small/large */ float *w=_vorbis_window_get(b->window[0]-hs); float *pcm=v->pcm[j]+prevCenter; float *p=vb->pcm[j]+n1/2-n0/2; for(i=0;iwindow[0]-hs); float *pcm=v->pcm[j]+prevCenter; float *p=vb->pcm[j]; for(i=0;ipcm[j]+thisCenter; float *p=vb->pcm[j]+n; for(i=0;icenterW) v->centerW=0; else v->centerW=n1; /* deal with initial packet state; we do this using the explicit pcm_returned==-1 flag otherwise we're sensitive to first block being short or long */ if(v->pcm_returned==-1){ v->pcm_returned=thisCenter; v->pcm_current=thisCenter; }else{ v->pcm_returned=prevCenter; v->pcm_current=prevCenter+ ((ci->blocksizes[v->lW]/4+ ci->blocksizes[v->W]/4)>>hs); } } /* track the frame number... This is for convenience, but also making sure our last packet doesn't end with added padding. If the last packet is partial, the number of samples we'll have to return will be past the vb->granulepos. This is not foolproof! It will be confused if we begin decoding at the last page after a seek or hole. In that case, we don't have a starting point to judge where the last frame is. For this reason, vorbisfile will always try to make sure it reads the last two marked pages in proper sequence */ if(b->sample_count==-1){ b->sample_count=0; }else{ b->sample_count+=ci->blocksizes[v->lW]/4+ci->blocksizes[v->W]/4; } if(v->granulepos==-1){ if(vb->granulepos!=-1){ /* only set if we have a position to set to */ v->granulepos=vb->granulepos; /* is this a short page? */ if(b->sample_count>v->granulepos){ /* corner case; if this is both the first and last audio page, then spec says the end is cut, not beginning */ if(vb->eofflag){ /* trim the end */ /* no preceeding granulepos; assume we started at zero (we'd have to in a short single-page stream) */ /* granulepos could be -1 due to a seek, but that would result in a long count, not short count */ v->pcm_current-=(b->sample_count-v->granulepos)>>hs; }else{ /* trim the beginning */ v->pcm_returned+=(b->sample_count-v->granulepos)>>hs; if(v->pcm_returned>v->pcm_current) v->pcm_returned=v->pcm_current; } } } }else{ v->granulepos+=ci->blocksizes[v->lW]/4+ci->blocksizes[v->W]/4; if(vb->granulepos!=-1 && v->granulepos!=vb->granulepos){ if(v->granulepos>vb->granulepos){ long extra=v->granulepos-vb->granulepos; if(extra) if(vb->eofflag){ /* partial last frame. Strip the extra samples off */ v->pcm_current-=extra>>hs; } /* else {Shouldn't happen *unless* the bitstream is out of spec. Either way, believe the bitstream } */ } /* else {Shouldn't happen *unless* the bitstream is out of spec. Either way, believe the bitstream } */ v->granulepos=vb->granulepos; } } /* Update, cleanup */ if(vb->eofflag)v->eofflag=1; return(0); } /* pcm==NULL indicates we just want the pending samples, no more */ int vorbis_synthesis_pcmout(vorbis_dsp_state *v,float ***pcm){ vorbis_info *vi=v->vi; if(v->pcm_returned>-1 && v->pcm_returnedpcm_current){ if(pcm){ int i; for(i=0;ichannels;i++) v->pcmret[i]=v->pcm[i]+v->pcm_returned; *pcm=v->pcmret; } return(v->pcm_current-v->pcm_returned); } return(0); } int vorbis_synthesis_read(vorbis_dsp_state *v,int n){ if(n && v->pcm_returned+n>v->pcm_current)return(OV_EINVAL); v->pcm_returned+=n; return(0); } /* intended for use with a specific vorbisfile feature; we want access to the [usually synthetic/postextrapolated] buffer and lapping at the end of a decode cycle, specifically, a half-short-block worth. This funtion works like pcmout above, except it will also expose this implicit buffer data not normally decoded. */ int vorbis_synthesis_lapout(vorbis_dsp_state *v,float ***pcm){ vorbis_info *vi=v->vi; codec_setup_info *ci=vi->codec_setup; int hs=ci->halfrate_flag; int n=ci->blocksizes[v->W]>>(hs+1); int n0=ci->blocksizes[0]>>(hs+1); int n1=ci->blocksizes[1]>>(hs+1); int i,j; if(v->pcm_returned<0)return 0; /* our returned data ends at pcm_returned; because the synthesis pcm buffer is a two-fragment ring, that means our data block may be fragmented by buffering, wrapping or a short block not filling out a buffer. To simplify things, we unfragment if it's at all possibly needed. Otherwise, we'd need to call lapout more than once as well as hold additional dsp state. Opt for simplicity. */ /* centerW was advanced by blockin; it would be the center of the *next* block */ if(v->centerW==n1){ /* the data buffer wraps; swap the halves */ /* slow, sure, small */ for(j=0;jchannels;j++){ float *p=v->pcm[j]; for(i=0;ipcm_current-=n1; v->pcm_returned-=n1; v->centerW=0; } /* solidify buffer into contiguous space */ if((v->lW^v->W)==1){ /* long/short or short/long */ for(j=0;jchannels;j++){ float *s=v->pcm[j]; float *d=v->pcm[j]+(n1-n0)/2; for(i=(n1+n0)/2-1;i>=0;--i) d[i]=s[i]; } v->pcm_returned+=(n1-n0)/2; v->pcm_current+=(n1-n0)/2; }else{ if(v->lW==0){ /* short/short */ for(j=0;jchannels;j++){ float *s=v->pcm[j]; float *d=v->pcm[j]+n1-n0; for(i=n0-1;i>=0;--i) d[i]=s[i]; } v->pcm_returned+=n1-n0; v->pcm_current+=n1-n0; } } if(pcm){ int i; for(i=0;ichannels;i++) v->pcmret[i]=v->pcm[i]+v->pcm_returned; *pcm=v->pcmret; } return(n1+n-v->pcm_returned); } float *vorbis_window(vorbis_dsp_state *v,int W){ vorbis_info *vi=v->vi; codec_setup_info *ci=vi->codec_setup; int hs=ci->halfrate_flag; private_state *b=v->backend_state; if(b->window[W]-1<0)return NULL; return _vorbis_window_get(b->window[W]-hs); } libtritonus-java-20070428/src/lib/pvorbis/codebook.c0000644000175000017500000004015310173661006022172 0ustar twernertwerner/******************************************************************** * * * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 * * by the XIPHOPHORUS Company http://www.xiph.org/ * * * ******************************************************************** function: basic codebook pack/unpack/code/decode operations last mod: $Id: codebook.c,v 1.3 2005/01/20 07:47:18 pfisterer Exp $ ********************************************************************/ #include #include #include #include "ogg/ogg.h" #include "vorbis/codec.h" #include "codebook.h" #include "scales.h" #include "misc.h" #include "os.h" /* packs the given codebook into the bitstream **************************/ int vorbis_staticbook_pack(const static_codebook *c,oggpack_buffer *opb){ long i,j; int ordered=0; /* first the basic parameters */ oggpack_write(opb,0x564342,24); oggpack_write(opb,c->dim,16); oggpack_write(opb,c->entries,24); /* pack the codewords. There are two packings; length ordered and length random. Decide between the two now. */ for(i=1;ientries;i++) if(c->lengthlist[i-1]==0 || c->lengthlist[i]lengthlist[i-1])break; if(i==c->entries)ordered=1; if(ordered){ /* length ordered. We only need to say how many codewords of each length. The actual codewords are generated deterministically */ long count=0; oggpack_write(opb,1,1); /* ordered */ oggpack_write(opb,c->lengthlist[0]-1,5); /* 1 to 32 */ for(i=1;ientries;i++){ long this=c->lengthlist[i]; long last=c->lengthlist[i-1]; if(this>last){ for(j=last;jentries-count)); count=i; } } } oggpack_write(opb,i-count,_ilog(c->entries-count)); }else{ /* length random. Again, we don't code the codeword itself, just the length. This time, though, we have to encode each length */ oggpack_write(opb,0,1); /* unordered */ /* algortihmic mapping has use for 'unused entries', which we tag here. The algorithmic mapping happens as usual, but the unused entry has no codeword. */ for(i=0;ientries;i++) if(c->lengthlist[i]==0)break; if(i==c->entries){ oggpack_write(opb,0,1); /* no unused entries */ for(i=0;ientries;i++) oggpack_write(opb,c->lengthlist[i]-1,5); }else{ oggpack_write(opb,1,1); /* we have unused entries; thus we tag */ for(i=0;ientries;i++){ if(c->lengthlist[i]==0){ oggpack_write(opb,0,1); }else{ oggpack_write(opb,1,1); oggpack_write(opb,c->lengthlist[i]-1,5); } } } } /* is the entry number the desired return value, or do we have a mapping? If we have a mapping, what type? */ oggpack_write(opb,c->maptype,4); switch(c->maptype){ case 0: /* no mapping */ break; case 1:case 2: /* implicitly populated value mapping */ /* explicitly populated value mapping */ if(!c->quantlist){ /* no quantlist? error */ return(-1); } /* values that define the dequantization */ oggpack_write(opb,c->q_min,32); oggpack_write(opb,c->q_delta,32); oggpack_write(opb,c->q_quant-1,4); oggpack_write(opb,c->q_sequencep,1); { int quantvals; switch(c->maptype){ case 1: /* a single column of (c->entries/c->dim) quantized values for building a full value list algorithmically (square lattice) */ quantvals=_book_maptype1_quantvals(c); break; case 2: /* every value (c->entries*c->dim total) specified explicitly */ quantvals=c->entries*c->dim; break; default: /* NOT_REACHABLE */ quantvals=-1; } /* quantized values */ for(i=0;iquantlist[i]),c->q_quant); } break; default: /* error case; we don't have any other map types now */ return(-1); } return(0); } /* unpacks a codebook from the packet buffer into the codebook struct, readies the codebook auxiliary structures for decode *************/ int vorbis_staticbook_unpack(oggpack_buffer *opb,static_codebook *s){ long i,j; memset(s,0,sizeof(*s)); s->allocedp=1; /* make sure alignment is correct */ if(oggpack_read(opb,24)!=0x564342)goto _eofout; /* first the basic parameters */ s->dim=oggpack_read(opb,16); s->entries=oggpack_read(opb,24); if(s->entries==-1)goto _eofout; /* codeword ordering.... length ordered or unordered? */ switch((int)oggpack_read(opb,1)){ case 0: /* unordered */ s->lengthlist=_ogg_malloc(sizeof(*s->lengthlist)*s->entries); /* allocated but unused entries? */ if(oggpack_read(opb,1)){ /* yes, unused entries */ for(i=0;ientries;i++){ if(oggpack_read(opb,1)){ long num=oggpack_read(opb,5); if(num==-1)goto _eofout; s->lengthlist[i]=num+1; }else s->lengthlist[i]=0; } }else{ /* all entries used; no tagging */ for(i=0;ientries;i++){ long num=oggpack_read(opb,5); if(num==-1)goto _eofout; s->lengthlist[i]=num+1; } } break; case 1: /* ordered */ { long length=oggpack_read(opb,5)+1; s->lengthlist=_ogg_malloc(sizeof(*s->lengthlist)*s->entries); for(i=0;ientries;) { long num=oggpack_read(opb,_ilog(s->entries-i)); if(num==-1)goto _eofout; for(j=0;jentries;j++,i++) s->lengthlist[i]=length; length++; } } break; default: /* EOF */ return(-1); } /* Do we have a mapping to unpack? */ switch((s->maptype=oggpack_read(opb,4))){ case 0: /* no mapping */ break; case 1: case 2: /* implicitly populated value mapping */ /* explicitly populated value mapping */ s->q_min=oggpack_read(opb,32); s->q_delta=oggpack_read(opb,32); s->q_quant=oggpack_read(opb,4)+1; s->q_sequencep=oggpack_read(opb,1); { int quantvals=0; switch(s->maptype){ case 1: quantvals=_book_maptype1_quantvals(s); break; case 2: quantvals=s->entries*s->dim; break; } /* quantized values */ s->quantlist=_ogg_malloc(sizeof(*s->quantlist)*quantvals); for(i=0;iquantlist[i]=oggpack_read(opb,s->q_quant); if(quantvals&&s->quantlist[quantvals-1]==-1)goto _eofout; } break; default: goto _errout; } /* all set */ return(0); _errout: _eofout: vorbis_staticbook_clear(s); return(-1); } /* returns the number of bits ************************************************/ int vorbis_book_encode(codebook *book, int a, oggpack_buffer *b){ oggpack_write(b,book->codelist[a],book->c->lengthlist[a]); return(book->c->lengthlist[a]); } /* One the encode side, our vector writers are each designed for a specific purpose, and the encoder is not flexible without modification: The LSP vector coder uses a single stage nearest-match with no interleave, so no step and no error return. This is specced by floor0 and doesn't change. Residue0 encoding interleaves, uses multiple stages, and each stage peels of a specific amount of resolution from a lattice (thus we want to match by threshold, not nearest match). Residue doesn't *have* to be encoded that way, but to change it, one will need to add more infrastructure on the encode side (decode side is specced and simpler) */ /* floor0 LSP (single stage, non interleaved, nearest match) */ /* returns entry number and *modifies a* to the quantization value *****/ int vorbis_book_errorv(codebook *book,float *a){ int dim=book->dim,k; int best=_best(book,a,1); for(k=0;kvaluelist+best*dim)[k]; return(best); } /* returns the number of bits and *modifies a* to the quantization value *****/ int vorbis_book_encodev(codebook *book,int best,float *a,oggpack_buffer *b){ int k,dim=book->dim; for(k=0;kvaluelist+best*dim)[k]; return(vorbis_book_encode(book,best,b)); } /* the 'eliminate the decode tree' optimization actually requires the codewords to be MSb first, not LSb. This is an annoying inelegancy (and one of the first places where carefully thought out design turned out to be wrong; Vorbis II and future Ogg codecs should go to an MSb bitpacker), but not actually the huge hit it appears to be. The first-stage decode table catches most words so that bitreverse is not in the main execution path. */ static ogg_uint32_t bitreverse(ogg_uint32_t x){ x= ((x>>16)&0x0000ffff) | ((x<<16)&0xffff0000); x= ((x>> 8)&0x00ff00ff) | ((x<< 8)&0xff00ff00); x= ((x>> 4)&0x0f0f0f0f) | ((x<< 4)&0xf0f0f0f0); x= ((x>> 2)&0x33333333) | ((x<< 2)&0xcccccccc); return((x>> 1)&0x55555555) | ((x<< 1)&0xaaaaaaaa); } STIN long decode_packed_entry_number(codebook *book, oggpack_buffer *b){ int read=book->dec_maxlength; long lo,hi; long lok = oggpack_look(b,book->dec_firsttablen); if (lok >= 0) { long entry = book->dec_firsttable[lok]; if(entry&0x80000000UL){ lo=(entry>>15)&0x7fff; hi=book->used_entries-(entry&0x7fff); }else{ oggpack_adv(b, book->dec_codelengths[entry-1]); return(entry-1); } }else{ lo=0; hi=book->used_entries; } lok = oggpack_look(b, read); while(lok<0 && read>1) lok = oggpack_look(b, --read); if(lok<0)return -1; /* bisect search for the codeword in the ordered list */ { ogg_uint32_t testword=bitreverse((ogg_uint32_t)lok); while(hi-lo>1){ long p=(hi-lo)>>1; long test=book->codelist[lo+p]>testword; lo+=p&(test-1); hi-=p&(-test); } if(book->dec_codelengths[lo]<=read){ oggpack_adv(b, book->dec_codelengths[lo]); return(lo); } } oggpack_adv(b, read); return(-1); } /* Decode side is specced and easier, because we don't need to find matches using different criteria; we simply read and map. There are two things we need to do 'depending': We may need to support interleave. We don't really, but it's convenient to do it here rather than rebuild the vector later. Cascades may be additive or multiplicitive; this is not inherent in the codebook, but set in the code using the codebook. Like interleaving, it's easiest to do it here. addmul==0 -> declarative (set the value) addmul==1 -> additive addmul==2 -> multiplicitive */ /* returns the [original, not compacted] entry number or -1 on eof *********/ long vorbis_book_decode(codebook *book, oggpack_buffer *b){ long packed_entry=decode_packed_entry_number(book,b); if(packed_entry>=0) return(book->dec_index[packed_entry]); /* if there's no dec_index, the codebook unpacking isn't collapsed */ return(packed_entry); } /* returns 0 on OK or -1 on eof *************************************/ long vorbis_book_decodevs_add(codebook *book,float *a,oggpack_buffer *b,int n){ int step=n/book->dim; long *entry = alloca(sizeof(*entry)*step); float **t = alloca(sizeof(*t)*step); int i,j,o; for (i = 0; i < step; i++) { entry[i]=decode_packed_entry_number(book,b); if(entry[i]==-1)return(-1); t[i] = book->valuelist+entry[i]*book->dim; } for(i=0,o=0;idim;i++,o+=step) for (j=0;jdim>8){ for(i=0;ivaluelist+entry*book->dim; for (j=0;jdim;) a[i++]+=t[j++]; } }else{ for(i=0;ivaluelist+entry*book->dim; j=0; switch((int)book->dim){ case 8: a[i++]+=t[j++]; case 7: a[i++]+=t[j++]; case 6: a[i++]+=t[j++]; case 5: a[i++]+=t[j++]; case 4: a[i++]+=t[j++]; case 3: a[i++]+=t[j++]; case 2: a[i++]+=t[j++]; case 1: a[i++]+=t[j++]; case 0: break; } } } return(0); } long vorbis_book_decodev_set(codebook *book,float *a,oggpack_buffer *b,int n){ int i,j,entry; float *t; for(i=0;ivaluelist+entry*book->dim; for (j=0;jdim;) a[i++]=t[j++]; } return(0); } long vorbis_book_decodevv_add(codebook *book,float **a,long offset,int ch, oggpack_buffer *b,int n){ long i,j,entry; int chptr=0; for(i=offset/ch;i<(offset+n)/ch;){ entry = decode_packed_entry_number(book,b); if(entry==-1)return(-1); { const float *t = book->valuelist+entry*book->dim; for (j=0;jdim;j++){ a[chptr++][i]+=t[j]; if(chptr==ch){ chptr=0; i++; } } } } return(0); } #ifdef _V_SELFTEST /* Simple enough; pack a few candidate codebooks, unpack them. Code a number of vectors through (keeping track of the quantized values), and decode using the unpacked book. quantized version of in should exactly equal out */ #include #include "vorbis/book/lsp20_0.vqh" #include "vorbis/book/res0a_13.vqh" #define TESTSIZE 40 float test1[TESTSIZE]={ 0.105939f, 0.215373f, 0.429117f, 0.587974f, 0.181173f, 0.296583f, 0.515707f, 0.715261f, 0.162327f, 0.263834f, 0.342876f, 0.406025f, 0.103571f, 0.223561f, 0.368513f, 0.540313f, 0.136672f, 0.395882f, 0.587183f, 0.652476f, 0.114338f, 0.417300f, 0.525486f, 0.698679f, 0.147492f, 0.324481f, 0.643089f, 0.757582f, 0.139556f, 0.215795f, 0.324559f, 0.399387f, 0.120236f, 0.267420f, 0.446940f, 0.608760f, 0.115587f, 0.287234f, 0.571081f, 0.708603f, }; float test3[TESTSIZE]={ 0,1,-2,3,4,-5,6,7,8,9, 8,-2,7,-1,4,6,8,3,1,-9, 10,11,12,13,14,15,26,17,18,19, 30,-25,-30,-1,-5,-32,4,3,-2,0}; static_codebook *testlist[]={&_vq_book_lsp20_0, &_vq_book_res0a_13,NULL}; float *testvec[]={test1,test3}; int main(){ oggpack_buffer write; oggpack_buffer read; long ptr=0,i; oggpack_writeinit(&write); fprintf(stderr,"Testing codebook abstraction...:\n"); while(testlist[ptr]){ codebook c; static_codebook s; float *qv=alloca(sizeof(*qv)*TESTSIZE); float *iv=alloca(sizeof(*iv)*TESTSIZE); memcpy(qv,testvec[ptr],sizeof(*qv)*TESTSIZE); memset(iv,0,sizeof(*iv)*TESTSIZE); fprintf(stderr,"\tpacking/coding %ld... ",ptr); /* pack the codebook, write the testvector */ oggpack_reset(&write); vorbis_book_init_encode(&c,testlist[ptr]); /* get it into memory we can write */ vorbis_staticbook_pack(testlist[ptr],&write); fprintf(stderr,"Codebook size %ld bytes... ",oggpack_bytes(&write)); for(i=0;i.000001){ fprintf(stderr,"read (%g) != written (%g) at position (%ld)\n", iv[i],qv[i],i); exit(1); } fprintf(stderr,"OK\n"); ptr++; } /* The above is the trivial stuff; now try unquantizing a log scale codebook */ exit(0); } #endif libtritonus-java-20070428/src/lib/pvorbis/codebook.h0000644000175000017500000001355610171253130022177 0ustar twernertwerner/******************************************************************** * * * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 * * by the XIPHOPHORUS Company http://www.xiph.org/ * * * ******************************************************************** function: basic shared codebook operations last mod: $Id: codebook.h,v 1.2 2005/01/12 16:54:48 pfisterer Exp $ ********************************************************************/ #ifndef _V_CODEBOOK_H_ #define _V_CODEBOOK_H_ #include "ogg/ogg.h" /* This structure encapsulates huffman and VQ style encoding books; it doesn't do anything specific to either. valuelist/quantlist are nonNULL (and q_* significant) only if there's entry->value mapping to be done. If encode-side mapping must be done (and thus the entry needs to be hunted), the auxiliary encode pointer will point to a decision tree. This is true of both VQ and huffman, but is mostly useful with VQ. */ typedef struct static_codebook{ long dim; /* codebook dimensions (elements per vector) */ long entries; /* codebook entries */ long *lengthlist; /* codeword lengths in bits */ /* mapping ***************************************************************/ int maptype; /* 0=none 1=implicitly populated values from map column 2=listed arbitrary values */ /* The below does a linear, single monotonic sequence mapping. */ long q_min; /* packed 32 bit float; quant value 0 maps to minval */ long q_delta; /* packed 32 bit float; val 1 - val 0 == delta */ int q_quant; /* bits: 0 < quant <= 16 */ int q_sequencep; /* bitflag */ long *quantlist; /* map == 1: (int)(entries^(1/dim)) element column map map == 2: list of dim*entries quantized entry vals */ /* encode helpers ********************************************************/ struct encode_aux_nearestmatch *nearest_tree; struct encode_aux_threshmatch *thresh_tree; struct encode_aux_pigeonhole *pigeon_tree; int allocedp; } static_codebook; /* this structures an arbitrary trained book to quickly find the nearest cell match */ typedef struct encode_aux_nearestmatch{ /* pre-calculated partitioning tree */ long *ptr0; long *ptr1; long *p; /* decision points (each is an entry) */ long *q; /* decision points (each is an entry) */ long aux; /* number of tree entries */ long alloc; } encode_aux_nearestmatch; /* assumes a maptype of 1; encode side only, so that's OK */ typedef struct encode_aux_threshmatch{ float *quantthresh; long *quantmap; int quantvals; int threshvals; } encode_aux_threshmatch; typedef struct encode_aux_pigeonhole{ float min; float del; int mapentries; int quantvals; long *pigeonmap; long fittotal; long *fitlist; long *fitmap; long *fitlength; } encode_aux_pigeonhole; typedef struct codebook{ long dim; /* codebook dimensions (elements per vector) */ long entries; /* codebook entries */ long used_entries; /* populated codebook entries */ const static_codebook *c; /* for encode, the below are entry-ordered, fully populated */ /* for decode, the below are ordered by bitreversed codeword and only used entries are populated */ float *valuelist; /* list of dim*entries actual entry values */ ogg_uint32_t *codelist; /* list of bitstream codewords for each entry */ int *dec_index; /* only used if sparseness collapsed */ char *dec_codelengths; ogg_uint32_t *dec_firsttable; int dec_firsttablen; int dec_maxlength; } codebook; extern void vorbis_staticbook_clear(static_codebook *b); extern void vorbis_staticbook_destroy(static_codebook *b); extern int vorbis_book_init_encode(codebook *dest,const static_codebook *source); extern int vorbis_book_init_decode(codebook *dest,const static_codebook *source); extern void vorbis_book_clear(codebook *b); extern float *_book_unquantize(const static_codebook *b,int n,int *map); extern float *_book_logdist(const static_codebook *b,float *vals); extern float _float32_unpack(long val); extern long _float32_pack(float val); extern int _best(codebook *book, float *a, int step); extern int _ilog(unsigned int v); extern long _book_maptype1_quantvals(const static_codebook *b); extern int vorbis_book_besterror(codebook *book,float *a,int step,int addmul); extern long vorbis_book_codeword(codebook *book,int entry); extern long vorbis_book_codelen(codebook *book,int entry); extern int vorbis_staticbook_pack(const static_codebook *c,oggpack_buffer *b); extern int vorbis_staticbook_unpack(oggpack_buffer *b,static_codebook *c); extern int vorbis_book_encode(codebook *book, int a, oggpack_buffer *b); extern int vorbis_book_errorv(codebook *book, float *a); extern int vorbis_book_encodev(codebook *book, int best,float *a, oggpack_buffer *b); extern long vorbis_book_decode(codebook *book, oggpack_buffer *b); extern long vorbis_book_decodevs_add(codebook *book, float *a, oggpack_buffer *b,int n); extern long vorbis_book_decodev_set(codebook *book, float *a, oggpack_buffer *b,int n); extern long vorbis_book_decodev_add(codebook *book, float *a, oggpack_buffer *b,int n); extern long vorbis_book_decodevv_add(codebook *book, float **a, long off,int ch, oggpack_buffer *b,int n); #endif libtritonus-java-20070428/src/lib/pvorbis/codec_internal.h0000644000175000017500000001044310171714041023356 0ustar twernertwerner/******************************************************************** * * * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 * * by the XIPHOPHORUS Company http://www.xiph.org/ * * * ******************************************************************** function: libvorbis codec headers last mod: $Id: codec_internal.h,v 1.3 2005/01/14 10:00:01 pfisterer Exp $ ********************************************************************/ #ifndef _V_CODECI_H_ #define _V_CODECI_H_ #include "envelope.h" #include "codebook.h" #define BLOCKTYPE_IMPULSE 0 #define BLOCKTYPE_PADDING 1 #define BLOCKTYPE_TRANSITION 0 #define BLOCKTYPE_LONG 1 #define PACKETBLOBS 15 typedef struct vorbis_block_internal{ float **pcmdelay; /* this is a pointer into local storage */ float ampmax; int blocktype; ogg_uint32_t packetblob_markers[PACKETBLOBS]; } vorbis_block_internal; typedef void vorbis_look_floor; typedef void vorbis_look_residue; typedef void vorbis_look_transform; /* mode ************************************************************/ typedef struct { int blockflag; int windowtype; int transformtype; int mapping; } vorbis_info_mode; typedef void vorbis_info_floor; typedef void vorbis_info_residue; typedef void vorbis_info_mapping; #include "psy.h" #include "bitrate.h" typedef struct private_state { /* local lookup storage */ envelope_lookup *ve; /* envelope lookup */ int window[2]; vorbis_look_transform **transform[2]; /* block, type */ drft_lookup fft_look[2]; int modebits; vorbis_look_floor **flr; vorbis_look_residue **residue; vorbis_look_psy *psy; vorbis_look_psy_global *psy_g_look; /* local storage, only used on the encoding side. This way the application does not need to worry about freeing some packets' memory and not others'; packet storage is always tracked. Cleared next call to a _dsp_ function */ unsigned char *header2; bitrate_manager_state bms; ogg_int64_t sample_count; } private_state; /* codec_setup_info contains all the setup information specific to the specific compression/decompression mode in progress (eg, psychoacoustic settings, channel setup, options, codebook etc). *********************************************************************/ #include "highlevel.h" typedef struct codec_setup_info { /* Vorbis supports only short and long blocks, but allows the encoder to choose the sizes */ long blocksizes[2]; /* modes are the primary means of supporting on-the-fly different blocksizes, different channel mappings (LR or M/A), different residue backends, etc. Each mode consists of a blocksize flag and a mapping (along with the mapping setup */ int modes; int maps; int floors; int residues; int books; int psys; /* encode only */ vorbis_info_mode *mode_param[64]; int map_type[64]; vorbis_info_mapping *map_param[64]; int floor_type[64]; vorbis_info_floor *floor_param[64]; int residue_type[64]; vorbis_info_residue *residue_param[64]; static_codebook *book_param[256]; codebook *fullbooks; vorbis_info_psy *psy_param[4]; /* encode only */ vorbis_info_psy_global psy_g_param; bitrate_manager_info bi; highlevel_encode_setup hi; /* used only by vorbisenc.c. It's a highly redundant structure, but improves clarity of program flow. */ int halfrate_flag; /* painless downsample for decode */ } codec_setup_info; extern vorbis_look_psy_global *_vp_global_look(vorbis_info *vi); extern void _vp_global_free(vorbis_look_psy_global *look); #endif libtritonus-java-20070428/src/lib/pvorbis/common.h0000644000175000017500000000206110171253130021667 0ustar twernertwerner/* * common.h */ /* * Copyright (c) 1999 - 2001 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "../common/HandleFieldHandler.h" #include "../common/common.h" #include "../common/debug.h" #include #include "ogg/ogg.h" #include "vorbis/codec.h" #include "vorbis/vorbisenc.h" /*** common.h ***/ libtritonus-java-20070428/src/lib/pvorbis/envelope.c0000644000175000017500000002432310171253130022214 0ustar twernertwerner/******************************************************************** * * * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 * * by the XIPHOPHORUS Company http://www.xiph.org/ * * * ******************************************************************** function: PCM data envelope analysis last mod: $Id: envelope.c,v 1.2 2005/01/12 16:54:48 pfisterer Exp $ ********************************************************************/ #include #include #include #include #include "ogg/ogg.h" #include "vorbis/codec.h" #include "codec_internal.h" #include "os.h" #include "scales.h" #include "envelope.h" #include "mdct.h" #include "misc.h" void _ve_envelope_init(envelope_lookup *e,vorbis_info *vi){ codec_setup_info *ci=vi->codec_setup; vorbis_info_psy_global *gi=&ci->psy_g_param; int ch=vi->channels; int i,j; int n=e->winlength=128; e->searchstep=64; /* not random */ e->minenergy=gi->preecho_minenergy; e->ch=ch; e->storage=128; e->cursor=ci->blocksizes[1]/2; e->mdct_win=_ogg_calloc(n,sizeof(*e->mdct_win)); mdct_init(&e->mdct,n); for(i=0;imdct_win[i]=sin(i/(n-1.)*M_PI); e->mdct_win[i]*=e->mdct_win[i]; } /* magic follows */ e->band[0].begin=2; e->band[0].end=4; e->band[1].begin=4; e->band[1].end=5; e->band[2].begin=6; e->band[2].end=6; e->band[3].begin=9; e->band[3].end=8; e->band[4].begin=13; e->band[4].end=8; e->band[5].begin=17; e->band[5].end=8; e->band[6].begin=22; e->band[6].end=8; for(j=0;jband[j].end; e->band[j].window=_ogg_malloc(n*sizeof(*e->band[0].window)); for(i=0;iband[j].window[i]=sin((i+.5)/n*M_PI); e->band[j].total+=e->band[j].window[i]; } e->band[j].total=1./e->band[j].total; } e->filter=_ogg_calloc(VE_BANDS*ch,sizeof(*e->filter)); e->mark=_ogg_calloc(e->storage,sizeof(*e->mark)); } void _ve_envelope_clear(envelope_lookup *e){ int i; mdct_clear(&e->mdct); for(i=0;iband[i].window); _ogg_free(e->mdct_win); _ogg_free(e->filter); _ogg_free(e->mark); memset(e,0,sizeof(*e)); } /* fairly straight threshhold-by-band based until we find something that works better and isn't patented. */ static int _ve_amp(envelope_lookup *ve, vorbis_info_psy_global *gi, float *data, envelope_band *bands, envelope_filter_state *filters, long pos){ long n=ve->winlength; int ret=0; long i,j; float decay; /* we want to have a 'minimum bar' for energy, else we're just basing blocks on quantization noise that outweighs the signal itself (for low power signals) */ float minV=ve->minenergy; float *vec=alloca(n*sizeof(*vec)); /* stretch is used to gradually lengthen the number of windows considered prevoius-to-potential-trigger */ int stretch=max(VE_MINSTRETCH,ve->stretch/2); float penalty=gi->stretch_penalty-(ve->stretch/2-VE_MINSTRETCH); if(penalty<0.f)penalty=0.f; if(penalty>gi->stretch_penalty)penalty=gi->stretch_penalty; /*_analysis_output_always("lpcm",seq2,data,n,0,0, totalshift+pos*ve->searchstep);*/ /* window and transform */ for(i=0;imdct_win[i]; mdct_forward(&ve->mdct,vec,vec); /*_analysis_output_always("mdct",seq2,vec,n/2,0,1,0); */ /* near-DC spreading function; this has nothing to do with psychoacoustics, just sidelobe leakage and window size */ { float temp=vec[0]*vec[0]+.7*vec[1]*vec[1]+.2*vec[2]*vec[2]; int ptr=filters->nearptr; /* the accumulation is regularly refreshed from scratch to avoid floating point creep */ if(ptr==0){ decay=filters->nearDC_acc=filters->nearDC_partialacc+temp; filters->nearDC_partialacc=temp; }else{ decay=filters->nearDC_acc+=temp; filters->nearDC_partialacc+=temp; } filters->nearDC_acc-=filters->nearDC[ptr]; filters->nearDC[ptr]=temp; decay*=(1./(VE_NEARDC+1)); filters->nearptr++; if(filters->nearptr>=VE_NEARDC)filters->nearptr=0; decay=todB(&decay)*.5-15.f; } /* perform spreading and limiting, also smooth the spectrum. yes, the MDCT results in all real coefficients, but it still *behaves* like real/imaginary pairs */ for(i=0;i>1]=val; decay-=8.; } /*_analysis_output_always("spread",seq2++,vec,n/4,0,0,0);*/ /* perform preecho/postecho triggering by band */ for(j=0;j=VE_AMP)filters[j].ampptr=0; } /* look at min/max, decide trigger */ if(valmax>gi->preecho_thresh[j]+penalty){ ret|=1; ret|=4; } if(valminpostecho_thresh[j]-penalty)ret|=2; } return(ret); } #if 0 static int seq=0; static ogg_int64_t totalshift=-1024; #endif long _ve_envelope_search(vorbis_dsp_state *v){ vorbis_info *vi=v->vi; codec_setup_info *ci=vi->codec_setup; vorbis_info_psy_global *gi=&ci->psy_g_param; envelope_lookup *ve=((private_state *)(v->backend_state))->ve; long i,j; int first=ve->current/ve->searchstep; int last=v->pcm_current/ve->searchstep-VE_WIN; if(first<0)first=0; /* make sure we have enough storage to match the PCM */ if(last+VE_WIN+VE_POST>ve->storage){ ve->storage=last+VE_WIN+VE_POST; /* be sure */ ve->mark=_ogg_realloc(ve->mark,ve->storage*sizeof(*ve->mark)); } for(j=first;jstretch++; if(ve->stretch>VE_MAXSTRETCH*2) ve->stretch=VE_MAXSTRETCH*2; for(i=0;ich;i++){ float *pcm=v->pcm[i]+ve->searchstep*(j); ret|=_ve_amp(ve,gi,pcm,ve->band,ve->filter+i*VE_BANDS,j); } ve->mark[j+VE_POST]=0; if(ret&1){ ve->mark[j]=1; ve->mark[j+1]=1; } if(ret&2){ ve->mark[j]=1; if(j>0)ve->mark[j-1]=1; } if(ret&4)ve->stretch=-1; } ve->current=last*ve->searchstep; { long centerW=v->centerW; long testW= centerW+ ci->blocksizes[v->W]/4+ ci->blocksizes[1]/2+ ci->blocksizes[0]/4; j=ve->cursor; while(jcurrent-(ve->searchstep)){/* account for postecho working back one window */ if(j>=testW)return(1); ve->cursor=j; if(ve->mark[j/ve->searchstep]){ if(j>centerW){ #if 0 if(j>ve->curmark){ float *marker=alloca(v->pcm_current*sizeof(*marker)); int l,m; memset(marker,0,sizeof(*marker)*v->pcm_current); fprintf(stderr,"mark! seq=%d, cursor:%fs time:%fs\n", seq, (totalshift+ve->cursor)/44100., (totalshift+j)/44100.); _analysis_output_always("pcmL",seq,v->pcm[0],v->pcm_current,0,0,totalshift); _analysis_output_always("pcmR",seq,v->pcm[1],v->pcm_current,0,0,totalshift); _analysis_output_always("markL",seq,v->pcm[0],j,0,0,totalshift); _analysis_output_always("markR",seq,v->pcm[1],j,0,0,totalshift); for(m=0;msearchstep]=ve->filter[m].markers[l]*.1; _analysis_output_always(buf,seq,marker,v->pcm_current,0,0,totalshift); } for(m=0;msearchstep]=ve->filter[m+VE_BANDS].markers[l]*.1; _analysis_output_always(buf,seq,marker,v->pcm_current,0,0,totalshift); } for(l=0;lsearchstep]=ve->mark[l]*.4; _analysis_output_always("mark",seq,marker,v->pcm_current,0,0,totalshift); seq++; } #endif ve->curmark=j; if(j>=testW)return(1); return(0); } } j+=ve->searchstep; } } return(-1); } int _ve_envelope_mark(vorbis_dsp_state *v){ envelope_lookup *ve=((private_state *)(v->backend_state))->ve; vorbis_info *vi=v->vi; codec_setup_info *ci=vi->codec_setup; long centerW=v->centerW; long beginW=centerW-ci->blocksizes[v->W]/4; long endW=centerW+ci->blocksizes[v->W]/4; if(v->W){ beginW-=ci->blocksizes[v->lW]/4; endW+=ci->blocksizes[v->nW]/4; }else{ beginW-=ci->blocksizes[0]/4; endW+=ci->blocksizes[0]/4; } if(ve->curmark>=beginW && ve->curmarksearchstep; long last=endW/ve->searchstep; long i; for(i=first;imark[i])return(1); } return(0); } void _ve_envelope_shift(envelope_lookup *e,long shift){ int smallsize=e->current/e->searchstep+VE_POST; /* adjust for placing marks ahead of ve->current */ int smallshift=shift/e->searchstep; memmove(e->mark,e->mark+smallshift,(smallsize-smallshift)*sizeof(*e->mark)); #if 0 for(i=0;ich;i++) memmove(e->filter[i].markers, e->filter[i].markers+smallshift, (1024-smallshift)*sizeof(*(*e->filter).markers)); totalshift+=shift; #endif e->current-=shift; if(e->curmark>=0) e->curmark-=shift; e->cursor-=shift; } libtritonus-java-20070428/src/lib/pvorbis/envelope.h0000644000175000017500000000421210167052677022236 0ustar twernertwerner/******************************************************************** * * * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 * * by the XIPHOPHORUS Company http://www.xiph.org/ * * * ******************************************************************** function: PCM data envelope analysis and manipulation last mod: $Id: envelope.h,v 1.1 2005/01/05 21:01:51 pfisterer Exp $ ********************************************************************/ #ifndef _V_ENVELOPE_ #define _V_ENVELOPE_ #include "mdct.h" #define VE_PRE 16 #define VE_WIN 4 #define VE_POST 2 #define VE_AMP (VE_PRE+VE_POST-1) #define VE_BANDS 7 #define VE_NEARDC 15 #define VE_MINSTRETCH 2 /* a bit less than short block */ #define VE_MAXSTRETCH 12 /* one-third full block */ typedef struct { float ampbuf[VE_AMP]; int ampptr; float nearDC[VE_NEARDC]; float nearDC_acc; float nearDC_partialacc; int nearptr; } envelope_filter_state; typedef struct { int begin; int end; float *window; float total; } envelope_band; typedef struct { int ch; int winlength; int searchstep; float minenergy; mdct_lookup mdct; float *mdct_win; envelope_band band[VE_BANDS]; envelope_filter_state *filter; int stretch; int *mark; long storage; long current; long curmark; long cursor; } envelope_lookup; extern void _ve_envelope_init(envelope_lookup *e,vorbis_info *vi); extern void _ve_envelope_clear(envelope_lookup *e); extern long _ve_envelope_search(vorbis_dsp_state *v); extern void _ve_envelope_shift(envelope_lookup *e,long shift); extern int _ve_envelope_mark(vorbis_dsp_state *v); #endif libtritonus-java-20070428/src/lib/pvorbis/floor0.c0000644000175000017500000001477210171253130021607 0ustar twernertwerner/******************************************************************** * * * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 * * by the XIPHOPHORUS Company http://www.xiph.org/ * * * ******************************************************************** function: floor backend 0 implementation last mod: $Id: floor0.c,v 1.2 2005/01/12 16:54:48 pfisterer Exp $ ********************************************************************/ #include #include #include #include "ogg/ogg.h" #include "vorbis/codec.h" #include "codec_internal.h" #include "registry.h" #include "lpc.h" #include "lsp.h" #include "codebook.h" #include "scales.h" #include "misc.h" #include "os.h" #include "misc.h" #include typedef struct { int ln; int m; int **linearmap; int n[2]; vorbis_info_floor0 *vi; long bits; long frames; } vorbis_look_floor0; /***********************************************/ static void floor0_free_info(vorbis_info_floor *i){ vorbis_info_floor0 *info=(vorbis_info_floor0 *)i; if(info){ memset(info,0,sizeof(*info)); _ogg_free(info); } } static void floor0_free_look(vorbis_look_floor *i){ vorbis_look_floor0 *look=(vorbis_look_floor0 *)i; if(look){ if(look->linearmap){ if(look->linearmap[0])_ogg_free(look->linearmap[0]); if(look->linearmap[1])_ogg_free(look->linearmap[1]); _ogg_free(look->linearmap); } memset(look,0,sizeof(*look)); _ogg_free(look); } } static vorbis_info_floor *floor0_unpack (vorbis_info *vi,oggpack_buffer *opb){ codec_setup_info *ci=vi->codec_setup; int j; vorbis_info_floor0 *info=_ogg_malloc(sizeof(*info)); info->order=oggpack_read(opb,8); info->rate=oggpack_read(opb,16); info->barkmap=oggpack_read(opb,16); info->ampbits=oggpack_read(opb,6); info->ampdB=oggpack_read(opb,8); info->numbooks=oggpack_read(opb,4)+1; if(info->order<1)goto err_out; if(info->rate<1)goto err_out; if(info->barkmap<1)goto err_out; if(info->numbooks<1)goto err_out; for(j=0;jnumbooks;j++){ info->books[j]=oggpack_read(opb,8); if(info->books[j]<0 || info->books[j]>=ci->books)goto err_out; } return(info); err_out: floor0_free_info(info); return(NULL); } /* initialize Bark scale and normalization lookups. We could do this with static tables, but Vorbis allows a number of possible combinations, so it's best to do it computationally. The below is authoritative in terms of defining scale mapping. Note that the scale depends on the sampling rate as well as the linear block and mapping sizes */ static void floor0_map_lazy_init(vorbis_block *vb, vorbis_info_floor *infoX, vorbis_look_floor0 *look){ if(!look->linearmap[vb->W]){ vorbis_dsp_state *vd=vb->vd; vorbis_info *vi=vd->vi; codec_setup_info *ci=vi->codec_setup; vorbis_info_floor0 *info=(vorbis_info_floor0 *)infoX; int W=vb->W; int n=ci->blocksizes[W]/2,j; /* we choose a scaling constant so that: floor(bark(rate/2-1)*C)=mapped-1 floor(bark(rate/2)*C)=mapped */ float scale=look->ln/toBARK(info->rate/2.f); /* the mapping from a linear scale to a smaller bark scale is straightforward. We do *not* make sure that the linear mapping does not skip bark-scale bins; the decoder simply skips them and the encoder may do what it wishes in filling them. They're necessary in some mapping combinations to keep the scale spacing accurate */ look->linearmap[W]=_ogg_malloc((n+1)*sizeof(**look->linearmap)); for(j=0;jrate/2.f)/n*j) *scale); /* bark numbers represent band edges */ if(val>=look->ln)val=look->ln-1; /* guard against the approximation */ look->linearmap[W][j]=val; } look->linearmap[W][j]=-1; look->n[W]=n; } } static vorbis_look_floor *floor0_look(vorbis_dsp_state *vd, vorbis_info_floor *i){ vorbis_info_floor0 *info=(vorbis_info_floor0 *)i; vorbis_look_floor0 *look=_ogg_calloc(1,sizeof(*look)); look->m=info->order; look->ln=info->barkmap; look->vi=info; look->linearmap=_ogg_calloc(2,sizeof(*look->linearmap)); return look; } static void *floor0_inverse1(vorbis_block *vb,vorbis_look_floor *i){ vorbis_look_floor0 *look=(vorbis_look_floor0 *)i; vorbis_info_floor0 *info=look->vi; int j,k; int ampraw=oggpack_read(&vb->opb,info->ampbits); if(ampraw>0){ /* also handles the -1 out of data case */ long maxval=(1<ampbits)-1; float amp=(float)ampraw/maxval*info->ampdB; int booknum=oggpack_read(&vb->opb,_ilog(info->numbooks)); if(booknum!=-1 && booknumnumbooks){ /* be paranoid */ codec_setup_info *ci=vb->vd->vi->codec_setup; codebook *b=ci->fullbooks+info->books[booknum]; float last=0.f; /* the additional b->dim is a guard against any possible stack smash; b->dim is provably more than we can overflow the vector */ float *lsp=_vorbis_block_alloc(vb,sizeof(*lsp)*(look->m+b->dim+1)); for(j=0;jm;j+=b->dim) if(vorbis_book_decodev_set(b,lsp+j,&vb->opb,b->dim)==-1)goto eop; for(j=0;jm;){ for(k=0;kdim;k++,j++)lsp[j]+=last; last=lsp[j-1]; } lsp[look->m]=amp; return(lsp); } } eop: return(NULL); } static int floor0_inverse2(vorbis_block *vb,vorbis_look_floor *i, void *memo,float *out){ vorbis_look_floor0 *look=(vorbis_look_floor0 *)i; vorbis_info_floor0 *info=look->vi; floor0_map_lazy_init(vb,info,look); if(memo){ float *lsp=(float *)memo; float amp=lsp[look->m]; /* take the coefficients back to a spectral envelope curve */ vorbis_lsp_to_curve(out, look->linearmap[vb->W], look->n[vb->W], look->ln, lsp,look->m,amp,(float)info->ampdB); return(1); } memset(out,0,sizeof(*out)*look->n[vb->W]); return(0); } /* export hooks */ vorbis_func_floor floor0_exportbundle={ NULL,&floor0_unpack,&floor0_look,&floor0_free_info, &floor0_free_look,&floor0_inverse1,&floor0_inverse2 }; libtritonus-java-20070428/src/lib/pvorbis/floor1.c0000644000175000017500000006771310171253130021613 0ustar twernertwerner/******************************************************************** * * * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 * * by the XIPHOPHORUS Company http://www.xiph.org/ * * * ******************************************************************** function: floor backend 1 implementation last mod: $Id: floor1.c,v 1.2 2005/01/12 16:54:48 pfisterer Exp $ ********************************************************************/ #include #include #include #include "ogg/ogg.h" #include "vorbis/codec.h" #include "codec_internal.h" #include "registry.h" #include "codebook.h" #include "misc.h" #include "scales.h" #include #define floor1_rangedB 140 /* floor 1 fixed at -140dB to 0dB range */ typedef struct { int sorted_index[VIF_POSIT+2]; int forward_index[VIF_POSIT+2]; int reverse_index[VIF_POSIT+2]; int hineighbor[VIF_POSIT]; int loneighbor[VIF_POSIT]; int posts; int n; int quant_q; vorbis_info_floor1 *vi; long phrasebits; long postbits; long frames; } vorbis_look_floor1; typedef struct lsfit_acc{ long x0; long x1; long xa; long ya; long x2a; long y2a; long xya; long an; } lsfit_acc; /***********************************************/ static void floor1_free_info(vorbis_info_floor *i){ vorbis_info_floor1 *info=(vorbis_info_floor1 *)i; if(info){ memset(info,0,sizeof(*info)); _ogg_free(info); } } static void floor1_free_look(vorbis_look_floor *i){ vorbis_look_floor1 *look=(vorbis_look_floor1 *)i; if(look){ /*fprintf(stderr,"floor 1 bit usage %f:%f (%f total)\n", (float)look->phrasebits/look->frames, (float)look->postbits/look->frames, (float)(look->postbits+look->phrasebits)/look->frames);*/ memset(look,0,sizeof(*look)); _ogg_free(look); } } static int ilog(unsigned int v){ int ret=0; while(v){ ret++; v>>=1; } return(ret); } static int ilog2(unsigned int v){ int ret=0; if(v)--v; while(v){ ret++; v>>=1; } return(ret); } static void floor1_pack (vorbis_info_floor *i,oggpack_buffer *opb){ vorbis_info_floor1 *info=(vorbis_info_floor1 *)i; int j,k; int count=0; int rangebits; int maxposit=info->postlist[1]; int maxclass=-1; /* save out partitions */ oggpack_write(opb,info->partitions,5); /* only 0 to 31 legal */ for(j=0;jpartitions;j++){ oggpack_write(opb,info->partitionclass[j],4); /* only 0 to 15 legal */ if(maxclasspartitionclass[j])maxclass=info->partitionclass[j]; } /* save out partition classes */ for(j=0;jclass_dim[j]-1,3); /* 1 to 8 */ oggpack_write(opb,info->class_subs[j],2); /* 0 to 3 */ if(info->class_subs[j])oggpack_write(opb,info->class_book[j],8); for(k=0;k<(1<class_subs[j]);k++) oggpack_write(opb,info->class_subbook[j][k]+1,8); } /* save out the post list */ oggpack_write(opb,info->mult-1,2); /* only 1,2,3,4 legal now */ oggpack_write(opb,ilog2(maxposit),4); rangebits=ilog2(maxposit); for(j=0,k=0;jpartitions;j++){ count+=info->class_dim[info->partitionclass[j]]; for(;kpostlist[k+2],rangebits); } } static vorbis_info_floor *floor1_unpack (vorbis_info *vi,oggpack_buffer *opb){ codec_setup_info *ci=vi->codec_setup; int j,k,count=0,maxclass=-1,rangebits; vorbis_info_floor1 *info=_ogg_calloc(1,sizeof(*info)); /* read partitions */ info->partitions=oggpack_read(opb,5); /* only 0 to 31 legal */ for(j=0;jpartitions;j++){ info->partitionclass[j]=oggpack_read(opb,4); /* only 0 to 15 legal */ if(maxclasspartitionclass[j])maxclass=info->partitionclass[j]; } /* read partition classes */ for(j=0;jclass_dim[j]=oggpack_read(opb,3)+1; /* 1 to 8 */ info->class_subs[j]=oggpack_read(opb,2); /* 0,1,2,3 bits */ if(info->class_subs[j]<0) goto err_out; if(info->class_subs[j])info->class_book[j]=oggpack_read(opb,8); if(info->class_book[j]<0 || info->class_book[j]>=ci->books) goto err_out; for(k=0;k<(1<class_subs[j]);k++){ info->class_subbook[j][k]=oggpack_read(opb,8)-1; if(info->class_subbook[j][k]<-1 || info->class_subbook[j][k]>=ci->books) goto err_out; } } /* read the post list */ info->mult=oggpack_read(opb,2)+1; /* only 1,2,3,4 legal now */ rangebits=oggpack_read(opb,4); for(j=0,k=0;jpartitions;j++){ count+=info->class_dim[info->partitionclass[j]]; for(;kpostlist[k+2]=oggpack_read(opb,rangebits); if(t<0 || t>=(1<postlist[0]=0; info->postlist[1]=1<vi=info; look->n=info->postlist[1]; /* we drop each position value in-between already decoded values, and use linear interpolation to predict each new value past the edges. The positions are read in the order of the position list... we precompute the bounding positions in the lookup. Of course, the neighbors can change (if a position is declined), but this is an initial mapping */ for(i=0;ipartitions;i++)n+=info->class_dim[info->partitionclass[i]]; n+=2; look->posts=n; /* also store a sorted position index */ for(i=0;ipostlist+i; qsort(sortpointer,n,sizeof(*sortpointer),icomp); /* points from sort order back to range number */ for(i=0;iforward_index[i]=sortpointer[i]-info->postlist; /* points from range order to sorted position */ for(i=0;ireverse_index[look->forward_index[i]]=i; /* we actually need the post values too */ for(i=0;isorted_index[i]=info->postlist[look->forward_index[i]]; /* quantize values to multiplier spec */ switch(info->mult){ case 1: /* 1024 -> 256 */ look->quant_q=256; break; case 2: /* 1024 -> 128 */ look->quant_q=128; break; case 3: /* 1024 -> 86 */ look->quant_q=86; break; case 4: /* 1024 -> 64 */ look->quant_q=64; break; } /* discover our neighbors for decode where we don't use fit flags (that would push the neighbors outward) */ for(i=0;in; int currentx=info->postlist[i+2]; for(j=0;jpostlist[j]; if(x>lx && xcurrentx){ hi=j; hx=x; } } look->loneighbor[i]=lo; look->hineighbor[i]=hi; } return(look); } static int render_point(int x0,int x1,int y0,int y1,int x){ y0&=0x7fff; /* mask off flag */ y1&=0x7fff; { int dy=y1-y0; int adx=x1-x0; int ady=abs(dy); int err=ady*(x-x0); int off=err/adx; if(dy<0)return(y0-off); return(y0+off); } } static int vorbis_dBquant(const float *x){ int i= *x*7.3142857f+1023.5f; if(i>1023)return(1023); if(i<0)return(0); return i; } static float FLOOR1_fromdB_LOOKUP[256]={ 1.0649863e-07F, 1.1341951e-07F, 1.2079015e-07F, 1.2863978e-07F, 1.3699951e-07F, 1.4590251e-07F, 1.5538408e-07F, 1.6548181e-07F, 1.7623575e-07F, 1.8768855e-07F, 1.9988561e-07F, 2.128753e-07F, 2.2670913e-07F, 2.4144197e-07F, 2.5713223e-07F, 2.7384213e-07F, 2.9163793e-07F, 3.1059021e-07F, 3.3077411e-07F, 3.5226968e-07F, 3.7516214e-07F, 3.9954229e-07F, 4.2550680e-07F, 4.5315863e-07F, 4.8260743e-07F, 5.1396998e-07F, 5.4737065e-07F, 5.8294187e-07F, 6.2082472e-07F, 6.6116941e-07F, 7.0413592e-07F, 7.4989464e-07F, 7.9862701e-07F, 8.5052630e-07F, 9.0579828e-07F, 9.6466216e-07F, 1.0273513e-06F, 1.0941144e-06F, 1.1652161e-06F, 1.2409384e-06F, 1.3215816e-06F, 1.4074654e-06F, 1.4989305e-06F, 1.5963394e-06F, 1.7000785e-06F, 1.8105592e-06F, 1.9282195e-06F, 2.0535261e-06F, 2.1869758e-06F, 2.3290978e-06F, 2.4804557e-06F, 2.6416497e-06F, 2.8133190e-06F, 2.9961443e-06F, 3.1908506e-06F, 3.3982101e-06F, 3.6190449e-06F, 3.8542308e-06F, 4.1047004e-06F, 4.3714470e-06F, 4.6555282e-06F, 4.9580707e-06F, 5.2802740e-06F, 5.6234160e-06F, 5.9888572e-06F, 6.3780469e-06F, 6.7925283e-06F, 7.2339451e-06F, 7.7040476e-06F, 8.2047000e-06F, 8.7378876e-06F, 9.3057248e-06F, 9.9104632e-06F, 1.0554501e-05F, 1.1240392e-05F, 1.1970856e-05F, 1.2748789e-05F, 1.3577278e-05F, 1.4459606e-05F, 1.5399272e-05F, 1.6400004e-05F, 1.7465768e-05F, 1.8600792e-05F, 1.9809576e-05F, 2.1096914e-05F, 2.2467911e-05F, 2.3928002e-05F, 2.5482978e-05F, 2.7139006e-05F, 2.8902651e-05F, 3.0780908e-05F, 3.2781225e-05F, 3.4911534e-05F, 3.7180282e-05F, 3.9596466e-05F, 4.2169667e-05F, 4.4910090e-05F, 4.7828601e-05F, 5.0936773e-05F, 5.4246931e-05F, 5.7772202e-05F, 6.1526565e-05F, 6.5524908e-05F, 6.9783085e-05F, 7.4317983e-05F, 7.9147585e-05F, 8.4291040e-05F, 8.9768747e-05F, 9.5602426e-05F, 0.00010181521F, 0.00010843174F, 0.00011547824F, 0.00012298267F, 0.00013097477F, 0.00013948625F, 0.00014855085F, 0.00015820453F, 0.00016848555F, 0.00017943469F, 0.00019109536F, 0.00020351382F, 0.00021673929F, 0.00023082423F, 0.00024582449F, 0.00026179955F, 0.00027881276F, 0.00029693158F, 0.00031622787F, 0.00033677814F, 0.00035866388F, 0.00038197188F, 0.00040679456F, 0.00043323036F, 0.00046138411F, 0.00049136745F, 0.00052329927F, 0.00055730621F, 0.00059352311F, 0.00063209358F, 0.00067317058F, 0.00071691700F, 0.00076350630F, 0.00081312324F, 0.00086596457F, 0.00092223983F, 0.00098217216F, 0.0010459992F, 0.0011139742F, 0.0011863665F, 0.0012634633F, 0.0013455702F, 0.0014330129F, 0.0015261382F, 0.0016253153F, 0.0017309374F, 0.0018434235F, 0.0019632195F, 0.0020908006F, 0.0022266726F, 0.0023713743F, 0.0025254795F, 0.0026895994F, 0.0028643847F, 0.0030505286F, 0.0032487691F, 0.0034598925F, 0.0036847358F, 0.0039241906F, 0.0041792066F, 0.0044507950F, 0.0047400328F, 0.0050480668F, 0.0053761186F, 0.0057254891F, 0.0060975636F, 0.0064938176F, 0.0069158225F, 0.0073652516F, 0.0078438871F, 0.0083536271F, 0.0088964928F, 0.009474637F, 0.010090352F, 0.010746080F, 0.011444421F, 0.012188144F, 0.012980198F, 0.013823725F, 0.014722068F, 0.015678791F, 0.016697687F, 0.017782797F, 0.018938423F, 0.020169149F, 0.021479854F, 0.022875735F, 0.024362330F, 0.025945531F, 0.027631618F, 0.029427276F, 0.031339626F, 0.033376252F, 0.035545228F, 0.037855157F, 0.040315199F, 0.042935108F, 0.045725273F, 0.048696758F, 0.051861348F, 0.055231591F, 0.058820850F, 0.062643361F, 0.066714279F, 0.071049749F, 0.075666962F, 0.080584227F, 0.085821044F, 0.091398179F, 0.097337747F, 0.10366330F, 0.11039993F, 0.11757434F, 0.12521498F, 0.13335215F, 0.14201813F, 0.15124727F, 0.16107617F, 0.17154380F, 0.18269168F, 0.19456402F, 0.20720788F, 0.22067342F, 0.23501402F, 0.25028656F, 0.26655159F, 0.28387361F, 0.30232132F, 0.32196786F, 0.34289114F, 0.36517414F, 0.38890521F, 0.41417847F, 0.44109412F, 0.46975890F, 0.50028648F, 0.53279791F, 0.56742212F, 0.60429640F, 0.64356699F, 0.68538959F, 0.72993007F, 0.77736504F, 0.82788260F, 0.88168307F, 0.9389798F, 1.F, }; static void render_line(int x0,int x1,int y0,int y1,float *d){ int dy=y1-y0; int adx=x1-x0; int ady=abs(dy); int base=dy/adx; int sy=(dy<0?base-1:base+1); int x=x0; int y=y0; int err=0; ady-=abs(base*adx); d[x]*=FLOOR1_fromdB_LOOKUP[y]; while(++x=adx){ err-=adx; y+=sy; }else{ y+=base; } d[x]*=FLOOR1_fromdB_LOOKUP[y]; } } static void render_line0(int x0,int x1,int y0,int y1,int *d){ int dy=y1-y0; int adx=x1-x0; int ady=abs(dy); int base=dy/adx; int sy=(dy<0?base-1:base+1); int x=x0; int y=y0; int err=0; ady-=abs(base*adx); d[x]=y; while(++x=adx){ err-=adx; y+=sy; }else{ y+=base; } d[x]=y; } } /* the floor has already been filtered to only include relevant sections */ static int accumulate_fit(const float *flr,const float *mdct, int x0, int x1,lsfit_acc *a, int n,vorbis_info_floor1 *info){ long i; int quantized=vorbis_dBquant(flr+x0); long xa=0,ya=0,x2a=0,y2a=0,xya=0,na=0, xb=0,yb=0,x2b=0,y2b=0,xyb=0,nb=0; memset(a,0,sizeof(*a)); a->x0=x0; a->x1=x1; if(x1>=n)x1=n-1; for(i=x0;i<=x1;i++){ int quantized=vorbis_dBquant(flr+i); if(quantized){ if(mdct[i]+info->twofitatten>=flr[i]){ xa += i; ya += quantized; x2a += i*i; y2a += quantized*quantized; xya += i*quantized; na++; }else{ xb += i; yb += quantized; x2b += i*i; y2b += quantized*quantized; xyb += i*quantized; nb++; } } } xb+=xa; yb+=ya; x2b+=x2a; y2b+=y2a; xyb+=xya; nb+=na; /* weight toward the actually used frequencies if we meet the threshhold */ { int weight=nb*info->twofitweight/(na+1); a->xa=xa*weight+xb; a->ya=ya*weight+yb; a->x2a=x2a*weight+x2b; a->y2a=y2a*weight+y2b; a->xya=xya*weight+xyb; a->an=na*weight+nb; } return(na); } static void fit_line(lsfit_acc *a,int fits,int *y0,int *y1){ long x=0,y=0,x2=0,y2=0,xy=0,an=0,i; long x0=a[0].x0; long x1=a[fits-1].x1; for(i=0;i=0){ x+= x0; y+= *y0; x2+= x0 * x0; y2+= *y0 * *y0; xy+= *y0 * x0; an++; } if(*y1>=0){ x+= x1; y+= *y1; x2+= x1 * x1; y2+= *y1 * *y1; xy+= *y1 * x1; an++; } if(an){ /* need 64 bit multiplies, which C doesn't give portably as int */ double fx=x; double fy=y; double fx2=x2; double fxy=xy; double denom=1./(an*fx2-fx*fx); double a=(fy*fx2-fxy*fx)*denom; double b=(an*fxy-fx*fy)*denom; *y0=rint(a+b*x0); *y1=rint(a+b*x1); /* limit to our range! */ if(*y0>1023)*y0=1023; if(*y1>1023)*y1=1023; if(*y0<0)*y0=0; if(*y1<0)*y1=0; }else{ *y0=0; *y1=0; } } /*static void fit_line_point(lsfit_acc *a,int fits,int *y0,int *y1){ long y=0; int i; for(i=0;itwofitatten>=mask[x]){ if(y+info->maxovermaxunder>val)return(1); } while(++x=adx){ err-=adx; y+=sy; }else{ y+=base; } val=vorbis_dBquant(mask+x); mse+=((y-val)*(y-val)); n++; if(mdct[x]+info->twofitatten>=mask[x]){ if(val){ if(y+info->maxovermaxunder>val)return(1); } } } if(info->maxover*info->maxover/n>info->maxerr)return(0); if(info->maxunder*info->maxunder/n>info->maxerr)return(0); if(mse/n>info->maxerr)return(1); return(0); } static int post_Y(int *A,int *B,int pos){ if(A[pos]<0) return B[pos]; if(B[pos]<0) return A[pos]; return (A[pos]+B[pos])>>1; } static int seq=0; int *floor1_fit(vorbis_block *vb,vorbis_look_floor1 *look, const float *logmdct, /* in */ const float *logmask){ long i,j; vorbis_info_floor1 *info=look->vi; long n=look->n; long posts=look->posts; long nonzero=0; lsfit_acc fits[VIF_POSIT+1]; int fit_valueA[VIF_POSIT+2]; /* index by range list position */ int fit_valueB[VIF_POSIT+2]; /* index by range list position */ int loneighbor[VIF_POSIT+2]; /* sorted index of range list position (+2) */ int hineighbor[VIF_POSIT+2]; int *output=NULL; int memo[VIF_POSIT+2]; for(i=0;isorted_index[i], look->sorted_index[i+1],fits+i, n,info); } if(nonzero){ /* start by fitting the implicit base case.... */ int y0=-200; int y1=-200; fit_line(fits,posts-1,&y0,&y1); fit_valueA[0]=y0; fit_valueB[0]=y0; fit_valueB[1]=y1; fit_valueA[1]=y1; /* Non degenerate case */ /* start progressive splitting. This is a greedy, non-optimal algorithm, but simple and close enough to the best answer. */ for(i=2;ireverse_index[i]; int ln=loneighbor[sortpos]; int hn=hineighbor[sortpos]; /* eliminate repeat searches of a particular range with a memo */ if(memo[ln]!=hn){ /* haven't performed this error search yet */ int lsortpos=look->reverse_index[ln]; int hsortpos=look->reverse_index[hn]; memo[ln]=hn; { /* A note: we want to bound/minimize *local*, not global, error */ int lx=info->postlist[ln]; int hx=info->postlist[hn]; int ly=post_Y(fit_valueA,fit_valueB,ln); int hy=post_Y(fit_valueA,fit_valueB,hn); if(ly==-1 || hy==-1){ exit(1); } if(inspect_error(lx,hx,ly,hy,logmask,logmdct,info)){ /* outside error bounds/begin search area. Split it. */ int ly0=-200; int ly1=-200; int hy0=-200; int hy1=-200; fit_line(fits+lsortpos,sortpos-lsortpos,&ly0,&ly1); fit_line(fits+sortpos,hsortpos-sortpos,&hy0,&hy1); /* store new edge values */ fit_valueB[ln]=ly0; if(ln==0)fit_valueA[ln]=ly0; fit_valueA[i]=ly1; fit_valueB[i]=hy0; fit_valueA[hn]=hy1; if(hn==1)fit_valueB[hn]=hy1; if(ly1>=0 || hy0>=0){ /* store new neighbor values */ for(j=sortpos-1;j>=0;j--) if(hineighbor[j]==hn) hineighbor[j]=i; else break; for(j=sortpos+1;jloneighbor[i-2]; int hn=look->hineighbor[i-2]; int x0=info->postlist[ln]; int x1=info->postlist[hn]; int y0=output[ln]; int y1=output[hn]; int predicted=render_point(x0,x1,y0,y1,info->postlist[i]); int vx=post_Y(fit_valueA,fit_valueB,i); if(vx>=0 && predicted!=vx){ output[i]=vx; }else{ output[i]= predicted|0x8000; } } } return(output); } int *floor1_interpolate_fit(vorbis_block *vb,vorbis_look_floor1 *look, int *A,int *B, int del){ long i; long posts=look->posts; int *output=NULL; if(A && B){ output=_vorbis_block_alloc(vb,sizeof(*output)*posts); for(i=0;i>16; if(A[i]&0x8000 && B[i]&0x8000)output[i]|=0x8000; } } return(output); } int floor1_encode(vorbis_block *vb,vorbis_look_floor1 *look, int *post,int *ilogmask){ long i,j; vorbis_info_floor1 *info=look->vi; long n=look->n; long posts=look->posts; codec_setup_info *ci=vb->vd->vi->codec_setup; int out[VIF_POSIT+2]; static_codebook **sbooks=ci->book_param; codebook *books=ci->fullbooks; static long seq=0; /* quantize values to multiplier spec */ if(post){ for(i=0;imult){ case 1: /* 1024 -> 256 */ val>>=2; break; case 2: /* 1024 -> 128 */ val>>=3; break; case 3: /* 1024 -> 86 */ val/=12; break; case 4: /* 1024 -> 64 */ val>>=4; break; } post[i]=val | (post[i]&0x8000); } out[0]=post[0]; out[1]=post[1]; /* find prediction values for each post and subtract them */ for(i=2;iloneighbor[i-2]; int hn=look->hineighbor[i-2]; int x0=info->postlist[ln]; int x1=info->postlist[hn]; int y0=post[ln]; int y1=post[hn]; int predicted=render_point(x0,x1,y0,y1,info->postlist[i]); if((post[i]&0x8000) || (predicted==post[i])){ post[i]=predicted|0x8000; /* in case there was roundoff jitter in interpolation */ out[i]=0; }else{ int headroom=(look->quant_q-predictedquant_q-predicted:predicted); int val=post[i]-predicted; /* at this point the 'deviation' value is in the range +/- max range, but the real, unique range can always be mapped to only [0-maxrange). So we want to wrap the deviation into this limited range, but do it in the way that least screws an essentially gaussian probability distribution. */ if(val<0) if(val<-headroom) val=headroom-val-1; else val=-1-(val<<1); else if(val>=headroom) val= val+headroom; else val<<=1; out[i]=val; post[ln]&=0x7fff; post[hn]&=0x7fff; } } /* we have everything we need. pack it out */ /* mark nontrivial floor */ oggpack_write(&vb->opb,1,1); /* beginning/end post */ look->frames++; look->postbits+=ilog(look->quant_q-1)*2; oggpack_write(&vb->opb,out[0],ilog(look->quant_q-1)); oggpack_write(&vb->opb,out[1],ilog(look->quant_q-1)); /* partition by partition */ for(i=0,j=2;ipartitions;i++){ int class=info->partitionclass[i]; int cdim=info->class_dim[class]; int csubbits=info->class_subs[class]; int csub=1<class_subbook[class][k]; if(booknum<0){ maxval[k]=1; }else{ maxval[k]=sbooks[info->class_subbook[class][k]]->entries; } } for(k=0;kphrasebits+= vorbis_book_encode(books+info->class_book[class],cval,&vb->opb); #ifdef TRAIN_FLOOR1 { FILE *of; char buffer[80]; sprintf(buffer,"line_%dx%ld_class%d.vqd", vb->pcmend/2,posts-2,class); of=fopen(buffer,"a"); fprintf(of,"%d\n",cval); fclose(of); } #endif } /* write post values */ for(k=0;kclass_subbook[class][bookas[k]]; if(book>=0){ /* hack to allow training with 'bad' books */ if(out[j+k]<(books+book)->entries) look->postbits+=vorbis_book_encode(books+book, out[j+k],&vb->opb); /*else fprintf(stderr,"+!");*/ #ifdef TRAIN_FLOOR1 { FILE *of; char buffer[80]; sprintf(buffer,"line_%dx%ld_%dsub%d.vqd", vb->pcmend/2,posts-2,class,bookas[k]); of=fopen(buffer,"a"); fprintf(of,"%d\n",out[j+k]); fclose(of); } #endif } } j+=cdim; } { /* generate quantized floor equivalent to what we'd unpack in decode */ /* render the lines */ int hx=0; int lx=0; int ly=post[0]*info->mult; for(j=1;jposts;j++){ int current=look->forward_index[j]; int hy=post[current]&0x7fff; if(hy==post[current]){ hy*=info->mult; hx=info->postlist[current]; render_line0(lx,hx,ly,hy,ilogmask); lx=hx; ly=hy; } } for(j=hx;jpcmend/2;j++)ilogmask[j]=ly; /* be certain */ seq++; return(1); } }else{ oggpack_write(&vb->opb,0,1); memset(ilogmask,0,vb->pcmend/2*sizeof(*ilogmask)); seq++; return(0); } } static void *floor1_inverse1(vorbis_block *vb,vorbis_look_floor *in){ vorbis_look_floor1 *look=(vorbis_look_floor1 *)in; vorbis_info_floor1 *info=look->vi; codec_setup_info *ci=vb->vd->vi->codec_setup; int i,j,k; codebook *books=ci->fullbooks; /* unpack wrapped/predicted values from stream */ if(oggpack_read(&vb->opb,1)==1){ int *fit_value=_vorbis_block_alloc(vb,(look->posts)*sizeof(*fit_value)); fit_value[0]=oggpack_read(&vb->opb,ilog(look->quant_q-1)); fit_value[1]=oggpack_read(&vb->opb,ilog(look->quant_q-1)); /* partition by partition */ for(i=0,j=2;ipartitions;i++){ int class=info->partitionclass[i]; int cdim=info->class_dim[class]; int csubbits=info->class_subs[class]; int csub=1<class_book[class],&vb->opb); if(cval==-1)goto eop; } for(k=0;kclass_subbook[class][cval&(csub-1)]; cval>>=csubbits; if(book>=0){ if((fit_value[j+k]=vorbis_book_decode(books+book,&vb->opb))==-1) goto eop; }else{ fit_value[j+k]=0; } } j+=cdim; } /* unwrap positive values and reconsitute via linear interpolation */ for(i=2;iposts;i++){ int predicted=render_point(info->postlist[look->loneighbor[i-2]], info->postlist[look->hineighbor[i-2]], fit_value[look->loneighbor[i-2]], fit_value[look->hineighbor[i-2]], info->postlist[i]); int hiroom=look->quant_q-predicted; int loroom=predicted; int room=(hiroom=room){ if(hiroom>loroom){ val = val-loroom; }else{ val = -1-(val-hiroom); } }else{ if(val&1){ val= -((val+1)>>1); }else{ val>>=1; } } fit_value[i]=val+predicted; fit_value[look->loneighbor[i-2]]&=0x7fff; fit_value[look->hineighbor[i-2]]&=0x7fff; }else{ fit_value[i]=predicted|0x8000; } } return(fit_value); } eop: return(NULL); } static int floor1_inverse2(vorbis_block *vb,vorbis_look_floor *in,void *memo, float *out){ vorbis_look_floor1 *look=(vorbis_look_floor1 *)in; vorbis_info_floor1 *info=look->vi; codec_setup_info *ci=vb->vd->vi->codec_setup; int n=ci->blocksizes[vb->W]/2; int j; if(memo){ /* render the lines */ int *fit_value=(int *)memo; int hx=0; int lx=0; int ly=fit_value[0]*info->mult; for(j=1;jposts;j++){ int current=look->forward_index[j]; int hy=fit_value[current]&0x7fff; if(hy==fit_value[current]){ hy*=info->mult; hx=info->postlist[current]; render_line(lx,hx,ly,hy,out); lx=hx; ly=hy; } } for(j=hx;j #include #include "ogg/ogg.h" /* A complete description of Ogg framing exists in docs/framing.html */ static ogg_uint32_t crc_lookup[256]={ 0x00000000,0x04c11db7,0x09823b6e,0x0d4326d9, 0x130476dc,0x17c56b6b,0x1a864db2,0x1e475005, 0x2608edb8,0x22c9f00f,0x2f8ad6d6,0x2b4bcb61, 0x350c9b64,0x31cd86d3,0x3c8ea00a,0x384fbdbd, 0x4c11db70,0x48d0c6c7,0x4593e01e,0x4152fda9, 0x5f15adac,0x5bd4b01b,0x569796c2,0x52568b75, 0x6a1936c8,0x6ed82b7f,0x639b0da6,0x675a1011, 0x791d4014,0x7ddc5da3,0x709f7b7a,0x745e66cd, 0x9823b6e0,0x9ce2ab57,0x91a18d8e,0x95609039, 0x8b27c03c,0x8fe6dd8b,0x82a5fb52,0x8664e6e5, 0xbe2b5b58,0xbaea46ef,0xb7a96036,0xb3687d81, 0xad2f2d84,0xa9ee3033,0xa4ad16ea,0xa06c0b5d, 0xd4326d90,0xd0f37027,0xddb056fe,0xd9714b49, 0xc7361b4c,0xc3f706fb,0xceb42022,0xca753d95, 0xf23a8028,0xf6fb9d9f,0xfbb8bb46,0xff79a6f1, 0xe13ef6f4,0xe5ffeb43,0xe8bccd9a,0xec7dd02d, 0x34867077,0x30476dc0,0x3d044b19,0x39c556ae, 0x278206ab,0x23431b1c,0x2e003dc5,0x2ac12072, 0x128e9dcf,0x164f8078,0x1b0ca6a1,0x1fcdbb16, 0x018aeb13,0x054bf6a4,0x0808d07d,0x0cc9cdca, 0x7897ab07,0x7c56b6b0,0x71159069,0x75d48dde, 0x6b93dddb,0x6f52c06c,0x6211e6b5,0x66d0fb02, 0x5e9f46bf,0x5a5e5b08,0x571d7dd1,0x53dc6066, 0x4d9b3063,0x495a2dd4,0x44190b0d,0x40d816ba, 0xaca5c697,0xa864db20,0xa527fdf9,0xa1e6e04e, 0xbfa1b04b,0xbb60adfc,0xb6238b25,0xb2e29692, 0x8aad2b2f,0x8e6c3698,0x832f1041,0x87ee0df6, 0x99a95df3,0x9d684044,0x902b669d,0x94ea7b2a, 0xe0b41de7,0xe4750050,0xe9362689,0xedf73b3e, 0xf3b06b3b,0xf771768c,0xfa325055,0xfef34de2, 0xc6bcf05f,0xc27dede8,0xcf3ecb31,0xcbffd686, 0xd5b88683,0xd1799b34,0xdc3abded,0xd8fba05a, 0x690ce0ee,0x6dcdfd59,0x608edb80,0x644fc637, 0x7a089632,0x7ec98b85,0x738aad5c,0x774bb0eb, 0x4f040d56,0x4bc510e1,0x46863638,0x42472b8f, 0x5c007b8a,0x58c1663d,0x558240e4,0x51435d53, 0x251d3b9e,0x21dc2629,0x2c9f00f0,0x285e1d47, 0x36194d42,0x32d850f5,0x3f9b762c,0x3b5a6b9b, 0x0315d626,0x07d4cb91,0x0a97ed48,0x0e56f0ff, 0x1011a0fa,0x14d0bd4d,0x19939b94,0x1d528623, 0xf12f560e,0xf5ee4bb9,0xf8ad6d60,0xfc6c70d7, 0xe22b20d2,0xe6ea3d65,0xeba91bbc,0xef68060b, 0xd727bbb6,0xd3e6a601,0xdea580d8,0xda649d6f, 0xc423cd6a,0xc0e2d0dd,0xcda1f604,0xc960ebb3, 0xbd3e8d7e,0xb9ff90c9,0xb4bcb610,0xb07daba7, 0xae3afba2,0xaafbe615,0xa7b8c0cc,0xa379dd7b, 0x9b3660c6,0x9ff77d71,0x92b45ba8,0x9675461f, 0x8832161a,0x8cf30bad,0x81b02d74,0x857130c3, 0x5d8a9099,0x594b8d2e,0x5408abf7,0x50c9b640, 0x4e8ee645,0x4a4ffbf2,0x470cdd2b,0x43cdc09c, 0x7b827d21,0x7f436096,0x7200464f,0x76c15bf8, 0x68860bfd,0x6c47164a,0x61043093,0x65c52d24, 0x119b4be9,0x155a565e,0x18197087,0x1cd86d30, 0x029f3d35,0x065e2082,0x0b1d065b,0x0fdc1bec, 0x3793a651,0x3352bbe6,0x3e119d3f,0x3ad08088, 0x2497d08d,0x2056cd3a,0x2d15ebe3,0x29d4f654, 0xc5a92679,0xc1683bce,0xcc2b1d17,0xc8ea00a0, 0xd6ad50a5,0xd26c4d12,0xdf2f6bcb,0xdbee767c, 0xe3a1cbc1,0xe760d676,0xea23f0af,0xeee2ed18, 0xf0a5bd1d,0xf464a0aa,0xf9278673,0xfde69bc4, 0x89b8fd09,0x8d79e0be,0x803ac667,0x84fbdbd0, 0x9abc8bd5,0x9e7d9662,0x933eb0bb,0x97ffad0c, 0xafb010b1,0xab710d06,0xa6322bdf,0xa2f33668, 0xbcb4666d,0xb8757bda,0xb5365d03,0xb1f740b4}; /* DECODING PRIMITIVES: packet streaming layer **********************/ /* This has two layers to place more of the multi-serialno and paging control in the application's hands. First, we expose a data buffer using ogg_sync_buffer(). The app either copies into the buffer, or passes it directly to read(), etc. We then call ogg_sync_wrote() to tell how many bytes we just added. Pages are returned (pointers into the buffer in ogg_sync_state) by ogg_sync_pageout(). The page is then submitted to ogg_stream_pagein() along with the appropriate ogg_stream_state* (ie, matching serialno). We then get raw packets out calling ogg_stream_packetout() with a ogg_stream_state. See the 'frame-prog.txt' docs for details and example code. */ void ogg_packet_clear(ogg_packet *op) { _ogg_free(op->packet); memset(op, 0, sizeof(*op)); } #ifdef _V_SELFTEST #include ogg_stream_state os_en, os_de; ogg_sync_state oy; void checkpacket(ogg_packet *op,int len, int no, int pos){ long j; static int sequence=0; static int lastno=0; if(op->bytes!=len){ fprintf(stderr,"incorrect packet length!\n"); exit(1); } if(op->granulepos!=pos){ fprintf(stderr,"incorrect packet position!\n"); exit(1); } /* packet number just follows sequence/gap; adjust the input number for that */ if(no==0){ sequence=0; }else{ sequence++; if(no>lastno+1) sequence++; } lastno=no; if(op->packetno!=sequence){ fprintf(stderr,"incorrect packet sequence %ld != %d\n", (long)(op->packetno),sequence); exit(1); } /* Test data */ for(j=0;jbytes;j++) if(op->packet[j]!=((j+no)&0xff)){ fprintf(stderr,"body data mismatch (1) at pos %ld: %x!=%lx!\n\n", j,op->packet[j],(j+no)&0xff); exit(1); } } void check_page(unsigned char *data,const int *header,ogg_page *og){ long j; /* Test data */ for(j=0;jbody_len;j++) if(og->body[j]!=data[j]){ fprintf(stderr,"body data mismatch (2) at pos %ld: %x!=%x!\n\n", j,data[j],og->body[j]); exit(1); } /* Test header */ for(j=0;jheader_len;j++){ if(og->header[j]!=header[j]){ fprintf(stderr,"header content mismatch at pos %ld:\n",j); for(j=0;jheader[j]); fprintf(stderr,"\n"); exit(1); } } if(og->header_len!=header[26]+27){ fprintf(stderr,"header length incorrect! (%ld!=%d)\n", og->header_len,header[26]+27); exit(1); } } void print_header(ogg_page *og){ int j; fprintf(stderr,"\nHEADER:\n"); fprintf(stderr," capture: %c %c %c %c version: %d flags: %x\n", og->header[0],og->header[1],og->header[2],og->header[3], (int)og->header[4],(int)og->header[5]); fprintf(stderr," granulepos: %d serialno: %d pageno: %ld\n", (og->header[9]<<24)|(og->header[8]<<16)| (og->header[7]<<8)|og->header[6], (og->header[17]<<24)|(og->header[16]<<16)| (og->header[15]<<8)|og->header[14], ((long)(og->header[21])<<24)|(og->header[20]<<16)| (og->header[19]<<8)|og->header[18]); fprintf(stderr," checksum: %02x:%02x:%02x:%02x\n segments: %d (", (int)og->header[22],(int)og->header[23], (int)og->header[24],(int)og->header[25], (int)og->header[26]); for(j=27;jheader_len;j++) fprintf(stderr,"%d ",(int)og->header[j]); fprintf(stderr,")\n\n"); } void copy_page(ogg_page *og){ unsigned char *temp=_ogg_malloc(og->header_len); memcpy(temp,og->header,og->header_len); og->header=temp; temp=_ogg_malloc(og->body_len); memcpy(temp,og->body,og->body_len); og->body=temp; } void error(void){ fprintf(stderr,"error!\n"); exit(1); } /* 17 only */ const int head1_0[] = {0x4f,0x67,0x67,0x53,0,0x06, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x01,0x02,0x03,0x04,0,0,0,0, 0x15,0xed,0xec,0x91, 1, 17}; /* 17, 254, 255, 256, 500, 510, 600 byte, pad */ const int head1_1[] = {0x4f,0x67,0x67,0x53,0,0x02, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x01,0x02,0x03,0x04,0,0,0,0, 0x59,0x10,0x6c,0x2c, 1, 17}; const int head2_1[] = {0x4f,0x67,0x67,0x53,0,0x04, 0x07,0x18,0x00,0x00,0x00,0x00,0x00,0x00, 0x01,0x02,0x03,0x04,1,0,0,0, 0x89,0x33,0x85,0xce, 13, 254,255,0,255,1,255,245,255,255,0, 255,255,90}; /* nil packets; beginning,middle,end */ const int head1_2[] = {0x4f,0x67,0x67,0x53,0,0x02, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x01,0x02,0x03,0x04,0,0,0,0, 0xff,0x7b,0x23,0x17, 1, 0}; const int head2_2[] = {0x4f,0x67,0x67,0x53,0,0x04, 0x07,0x28,0x00,0x00,0x00,0x00,0x00,0x00, 0x01,0x02,0x03,0x04,1,0,0,0, 0x5c,0x3f,0x66,0xcb, 17, 17,254,255,0,0,255,1,0,255,245,255,255,0, 255,255,90,0}; /* large initial packet */ const int head1_3[] = {0x4f,0x67,0x67,0x53,0,0x02, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x01,0x02,0x03,0x04,0,0,0,0, 0x01,0x27,0x31,0xaa, 18, 255,255,255,255,255,255,255,255, 255,255,255,255,255,255,255,255,255,10}; const int head2_3[] = {0x4f,0x67,0x67,0x53,0,0x04, 0x07,0x08,0x00,0x00,0x00,0x00,0x00,0x00, 0x01,0x02,0x03,0x04,1,0,0,0, 0x7f,0x4e,0x8a,0xd2, 4, 255,4,255,0}; /* continuing packet test */ const int head1_4[] = {0x4f,0x67,0x67,0x53,0,0x02, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x01,0x02,0x03,0x04,0,0,0,0, 0xff,0x7b,0x23,0x17, 1, 0}; const int head2_4[] = {0x4f,0x67,0x67,0x53,0,0x00, 0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x01,0x02,0x03,0x04,1,0,0,0, 0x34,0x24,0xd5,0x29, 17, 255,255,255,255,255,255,255,255, 255,255,255,255,255,255,255,255,255}; const int head3_4[] = {0x4f,0x67,0x67,0x53,0,0x05, 0x07,0x0c,0x00,0x00,0x00,0x00,0x00,0x00, 0x01,0x02,0x03,0x04,2,0,0,0, 0xc8,0xc3,0xcb,0xed, 5, 10,255,4,255,0}; /* page with the 255 segment limit */ const int head1_5[] = {0x4f,0x67,0x67,0x53,0,0x02, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x01,0x02,0x03,0x04,0,0,0,0, 0xff,0x7b,0x23,0x17, 1, 0}; const int head2_5[] = {0x4f,0x67,0x67,0x53,0,0x00, 0x07,0xfc,0x03,0x00,0x00,0x00,0x00,0x00, 0x01,0x02,0x03,0x04,1,0,0,0, 0xed,0x2a,0x2e,0xa7, 255, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10}; const int head3_5[] = {0x4f,0x67,0x67,0x53,0,0x04, 0x07,0x00,0x04,0x00,0x00,0x00,0x00,0x00, 0x01,0x02,0x03,0x04,2,0,0,0, 0x6c,0x3b,0x82,0x3d, 1, 50}; /* packet that overspans over an entire page */ const int head1_6[] = {0x4f,0x67,0x67,0x53,0,0x02, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x01,0x02,0x03,0x04,0,0,0,0, 0xff,0x7b,0x23,0x17, 1, 0}; const int head2_6[] = {0x4f,0x67,0x67,0x53,0,0x00, 0x07,0x04,0x00,0x00,0x00,0x00,0x00,0x00, 0x01,0x02,0x03,0x04,1,0,0,0, 0x3c,0xd9,0x4d,0x3f, 17, 100,255,255,255,255,255,255,255,255, 255,255,255,255,255,255,255,255}; const int head3_6[] = {0x4f,0x67,0x67,0x53,0,0x01, 0x07,0x04,0x00,0x00,0x00,0x00,0x00,0x00, 0x01,0x02,0x03,0x04,2,0,0,0, 0xbd,0xd5,0xb5,0x8b, 17, 255,255,255,255,255,255,255,255, 255,255,255,255,255,255,255,255,255}; const int head4_6[] = {0x4f,0x67,0x67,0x53,0,0x05, 0x07,0x10,0x00,0x00,0x00,0x00,0x00,0x00, 0x01,0x02,0x03,0x04,3,0,0,0, 0xef,0xdd,0x88,0xde, 7, 255,255,75,255,4,255,0}; /* packet that overspans over an entire page */ const int head1_7[] = {0x4f,0x67,0x67,0x53,0,0x02, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x01,0x02,0x03,0x04,0,0,0,0, 0xff,0x7b,0x23,0x17, 1, 0}; const int head2_7[] = {0x4f,0x67,0x67,0x53,0,0x00, 0x07,0x04,0x00,0x00,0x00,0x00,0x00,0x00, 0x01,0x02,0x03,0x04,1,0,0,0, 0x3c,0xd9,0x4d,0x3f, 17, 100,255,255,255,255,255,255,255,255, 255,255,255,255,255,255,255,255}; const int head3_7[] = {0x4f,0x67,0x67,0x53,0,0x05, 0x07,0x08,0x00,0x00,0x00,0x00,0x00,0x00, 0x01,0x02,0x03,0x04,2,0,0,0, 0xd4,0xe0,0x60,0xe5, 1,0}; void test_pack(const int *pl, const int **headers){ unsigned char *data=_ogg_malloc(1024*1024); /* for scripted test cases only */ long inptr=0; long outptr=0; long deptr=0; long depacket=0; long granule_pos=7,pageno=0; int i,j,packets,pageout=0; int eosflag=0; int bosflag=0; ogg_stream_reset(&os_en); ogg_stream_reset(&os_de); ogg_sync_reset(&oy); for(packets=0;;packets++)if(pl[packets]==-1)break; for(i=0;i0){ /* got a page. Happy happy. Verify that it's good. */ check_page(data+deptr,headers[pageout],&og_de); deptr+=og_de.body_len; pageout++; /* submit it to deconstitution */ ogg_stream_pagein(&os_de,&og_de); /* packets out? */ while(ogg_stream_packetpeek(&os_de,&op_de2)>0){ ogg_stream_packetpeek(&os_de,NULL); ogg_stream_packetout(&os_de,&op_de); /* just catching them all */ /* verify peek and out match */ if(memcmp(&op_de,&op_de2,sizeof(op_de))){ fprintf(stderr,"packetout != packetpeek! pos=%ld\n", depacket); exit(1); } /* verify the packet! */ /* check data */ if(memcmp(data+depacket,op_de.packet,op_de.bytes)){ fprintf(stderr,"packet data mismatch in decode! pos=%ld\n", depacket); exit(1); } /* check bos flag */ if(bosflag==0 && op_de.b_o_s==0){ fprintf(stderr,"b_o_s flag not set on packet!\n"); exit(1); } if(bosflag && op_de.b_o_s){ fprintf(stderr,"b_o_s flag incorrectly set on packet!\n"); exit(1); } bosflag=1; depacket+=op_de.bytes; /* check eos flag */ if(eosflag){ fprintf(stderr,"Multiple decoded packets with eos flag!\n"); exit(1); } if(op_de.e_o_s)eosflag=1; /* check granulepos flag */ if(op_de.granulepos!=-1){ fprintf(stderr," granule:%ld ",(long)op_de.granulepos); } } } } } } } _ogg_free(data); if(headers[pageno]!=NULL){ fprintf(stderr,"did not write last page!\n"); exit(1); } if(headers[pageout]!=NULL){ fprintf(stderr,"did not decode last page!\n"); exit(1); } if(inptr!=outptr){ fprintf(stderr,"encoded page data incomplete!\n"); exit(1); } if(inptr!=deptr){ fprintf(stderr,"decoded page data incomplete!\n"); exit(1); } if(inptr!=depacket){ fprintf(stderr,"decoded packet data incomplete!\n"); exit(1); } if(!eosflag){ fprintf(stderr,"Never got a packet with EOS set!\n"); exit(1); } fprintf(stderr,"ok.\n"); } int main(void){ ogg_stream_init(&os_en,0x04030201); ogg_stream_init(&os_de,0x04030201); ogg_sync_init(&oy); /* Exercise each code path in the framing code. Also verify that the checksums are working. */ { /* 17 only */ const int packets[]={17, -1}; const int *headret[]={head1_0,NULL}; fprintf(stderr,"testing single page encoding... "); test_pack(packets,headret); } { /* 17, 254, 255, 256, 500, 510, 600 byte, pad */ const int packets[]={17, 254, 255, 256, 500, 510, 600, -1}; const int *headret[]={head1_1,head2_1,NULL}; fprintf(stderr,"testing basic page encoding... "); test_pack(packets,headret); } { /* nil packets; beginning,middle,end */ const int packets[]={0,17, 254, 255, 0, 256, 0, 500, 510, 600, 0, -1}; const int *headret[]={head1_2,head2_2,NULL}; fprintf(stderr,"testing basic nil packets... "); test_pack(packets,headret); } { /* large initial packet */ const int packets[]={4345,259,255,-1}; const int *headret[]={head1_3,head2_3,NULL}; fprintf(stderr,"testing initial-packet lacing > 4k... "); test_pack(packets,headret); } { /* continuing packet test */ const int packets[]={0,4345,259,255,-1}; const int *headret[]={head1_4,head2_4,head3_4,NULL}; fprintf(stderr,"testing single packet page span... "); test_pack(packets,headret); } /* page with the 255 segment limit */ { const int packets[]={0,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,50,-1}; const int *headret[]={head1_5,head2_5,head3_5,NULL}; fprintf(stderr,"testing max packet segments... "); test_pack(packets,headret); } { /* packet that overspans over an entire page */ const int packets[]={0,100,9000,259,255,-1}; const int *headret[]={head1_6,head2_6,head3_6,head4_6,NULL}; fprintf(stderr,"testing very large packets... "); test_pack(packets,headret); } { /* term only page. why not? */ const int packets[]={0,100,4080,-1}; const int *headret[]={head1_7,head2_7,head3_7,NULL}; fprintf(stderr,"testing zero data page (1 nil packet)... "); test_pack(packets,headret); } { /* build a bunch of pages for testing */ unsigned char *data=_ogg_malloc(1024*1024); int pl[]={0,100,4079,2956,2057,76,34,912,0,234,1000,1000,1000,300,-1}; int inptr=0,i,j; ogg_page og[5]; ogg_stream_reset(&os_en); for(i=0;pl[i]!=-1;i++){ ogg_packet op; int len=pl[i]; op.packet=data+inptr; op.bytes=len; op.e_o_s=(pl[i+1]<0?1:0); op.granulepos=(i+1)*1000; for(j=0;j0)error(); /* Test fractional page inputs: incomplete fixed header */ memcpy(ogg_sync_buffer(&oy,og[1].header_len),og[1].header+3, 20); ogg_sync_wrote(&oy,20); if(ogg_sync_pageout(&oy,&og_de)>0)error(); /* Test fractional page inputs: incomplete header */ memcpy(ogg_sync_buffer(&oy,og[1].header_len),og[1].header+23, 5); ogg_sync_wrote(&oy,5); if(ogg_sync_pageout(&oy,&og_de)>0)error(); /* Test fractional page inputs: incomplete body */ memcpy(ogg_sync_buffer(&oy,og[1].header_len),og[1].header+28, og[1].header_len-28); ogg_sync_wrote(&oy,og[1].header_len-28); if(ogg_sync_pageout(&oy,&og_de)>0)error(); memcpy(ogg_sync_buffer(&oy,og[1].body_len),og[1].body,1000); ogg_sync_wrote(&oy,1000); if(ogg_sync_pageout(&oy,&og_de)>0)error(); memcpy(ogg_sync_buffer(&oy,og[1].body_len),og[1].body+1000, og[1].body_len-1000); ogg_sync_wrote(&oy,og[1].body_len-1000); if(ogg_sync_pageout(&oy,&og_de)<=0)error(); fprintf(stderr,"ok.\n"); } /* Test fractional page inputs: page + incomplete capture */ { ogg_page og_de; fprintf(stderr,"Testing sync on 1+partial inputs... "); ogg_sync_reset(&oy); memcpy(ogg_sync_buffer(&oy,og[1].header_len),og[1].header, og[1].header_len); ogg_sync_wrote(&oy,og[1].header_len); memcpy(ogg_sync_buffer(&oy,og[1].body_len),og[1].body, og[1].body_len); ogg_sync_wrote(&oy,og[1].body_len); memcpy(ogg_sync_buffer(&oy,og[1].header_len),og[1].header, 20); ogg_sync_wrote(&oy,20); if(ogg_sync_pageout(&oy,&og_de)<=0)error(); if(ogg_sync_pageout(&oy,&og_de)>0)error(); memcpy(ogg_sync_buffer(&oy,og[1].header_len),og[1].header+20, og[1].header_len-20); ogg_sync_wrote(&oy,og[1].header_len-20); memcpy(ogg_sync_buffer(&oy,og[1].body_len),og[1].body, og[1].body_len); ogg_sync_wrote(&oy,og[1].body_len); if(ogg_sync_pageout(&oy,&og_de)<=0)error(); fprintf(stderr,"ok.\n"); } /* Test recapture: garbage + page */ { ogg_page og_de; fprintf(stderr,"Testing search for capture... "); ogg_sync_reset(&oy); /* 'garbage' */ memcpy(ogg_sync_buffer(&oy,og[1].body_len),og[1].body, og[1].body_len); ogg_sync_wrote(&oy,og[1].body_len); memcpy(ogg_sync_buffer(&oy,og[1].header_len),og[1].header, og[1].header_len); ogg_sync_wrote(&oy,og[1].header_len); memcpy(ogg_sync_buffer(&oy,og[1].body_len),og[1].body, og[1].body_len); ogg_sync_wrote(&oy,og[1].body_len); memcpy(ogg_sync_buffer(&oy,og[2].header_len),og[2].header, 20); ogg_sync_wrote(&oy,20); if(ogg_sync_pageout(&oy,&og_de)>0)error(); if(ogg_sync_pageout(&oy,&og_de)<=0)error(); if(ogg_sync_pageout(&oy,&og_de)>0)error(); memcpy(ogg_sync_buffer(&oy,og[2].header_len),og[2].header+20, og[2].header_len-20); ogg_sync_wrote(&oy,og[2].header_len-20); memcpy(ogg_sync_buffer(&oy,og[2].body_len),og[2].body, og[2].body_len); ogg_sync_wrote(&oy,og[2].body_len); if(ogg_sync_pageout(&oy,&og_de)<=0)error(); fprintf(stderr,"ok.\n"); } /* Test recapture: page + garbage + page */ { ogg_page og_de; fprintf(stderr,"Testing recapture... "); ogg_sync_reset(&oy); memcpy(ogg_sync_buffer(&oy,og[1].header_len),og[1].header, og[1].header_len); ogg_sync_wrote(&oy,og[1].header_len); memcpy(ogg_sync_buffer(&oy,og[1].body_len),og[1].body, og[1].body_len); ogg_sync_wrote(&oy,og[1].body_len); memcpy(ogg_sync_buffer(&oy,og[2].header_len),og[2].header, og[2].header_len); ogg_sync_wrote(&oy,og[2].header_len); memcpy(ogg_sync_buffer(&oy,og[2].header_len),og[2].header, og[2].header_len); ogg_sync_wrote(&oy,og[2].header_len); if(ogg_sync_pageout(&oy,&og_de)<=0)error(); memcpy(ogg_sync_buffer(&oy,og[2].body_len),og[2].body, og[2].body_len-5); ogg_sync_wrote(&oy,og[2].body_len-5); memcpy(ogg_sync_buffer(&oy,og[3].header_len),og[3].header, og[3].header_len); ogg_sync_wrote(&oy,og[3].header_len); memcpy(ogg_sync_buffer(&oy,og[3].body_len),og[3].body, og[3].body_len); ogg_sync_wrote(&oy,og[3].body_len); if(ogg_sync_pageout(&oy,&og_de)>0)error(); if(ogg_sync_pageout(&oy,&og_de)<=0)error(); fprintf(stderr,"ok.\n"); } } return(0); } #endif libtritonus-java-20070428/src/lib/pvorbis/highlevel.h0000644000175000017500000000354010167052677022373 0ustar twernertwerner/******************************************************************** * * * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 * * by the XIPHOPHORUS Company http://www.xiph.org/ * * * ******************************************************************** function: highlevel encoder setup struct seperated out for vorbisenc clarity last mod: $Id: highlevel.h,v 1.1 2005/01/05 21:01:51 pfisterer Exp $ ********************************************************************/ typedef struct highlevel_byblocktype { double tone_mask_setting; double tone_peaklimit_setting; double noise_bias_setting; double noise_compand_setting; } highlevel_byblocktype; typedef struct highlevel_encode_setup { void *setup; int set_in_stone; double base_setting; double long_setting; double short_setting; double impulse_noisetune; int managed; long bitrate_min; long bitrate_av_lo; long bitrate_av_hi; long bitrate_max; double bitrate_limit_window; double bitrate_av_window; double bitrate_av_window_center; int impulse_block_p; int noise_normalize_p; double stereo_point_setting; double lowpass_kHz; double ath_floating_dB; double ath_absolute_dB; double amplitude_track_dBpersec; double trigger_setting; highlevel_byblocktype block[4]; /* padding, impulse, transition, long */ } highlevel_encode_setup; libtritonus-java-20070428/src/lib/pvorbis/info.c0000644000175000017500000002210110171714041021325 0ustar twernertwerner/******************************************************************** * * * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2003 * * by the XIPHOPHORUS Company http://www.xiph.org/ * * * ******************************************************************** function: maintain the info structure, info <-> header packets last mod: $Id: info.c,v 1.6 2005/01/14 10:00:01 pfisterer Exp $ ********************************************************************/ /* general handling of the header and the vorbis_info structure (and substructures) */ #include #include #include #include "ogg/ogg.h" #include "vorbis/codec.h" #include "codec_internal.h" #include "codebook.h" #include "registry.h" #include "window.h" #include "psy.h" #include "misc.h" #include "os.h" /* helpers */ static void _v_writestring(oggpack_buffer *o,char *s, int bytes){ while(bytes--){ oggpack_write(o,*s++,8); } } /* blocksize 0 is guaranteed to be short, 1 is guarantted to be long. They may be equal, but short will never ge greater than long */ int vorbis_info_blocksize(vorbis_info *vi,int zo){ codec_setup_info *ci = vi->codec_setup; return ci ? ci->blocksizes[zo] : -1; } /* used by synthesis, which has a full, alloced vi */ void vorbis_info_init(vorbis_info *vi){ memset(vi,0,sizeof(*vi)); vi->codec_setup=_ogg_calloc(1,sizeof(codec_setup_info)); } void vorbis_info_clear(vorbis_info *vi){ codec_setup_info *ci=vi->codec_setup; int i; if(ci){ for(i=0;imodes;i++) if(ci->mode_param[i])_ogg_free(ci->mode_param[i]); for(i=0;imaps;i++) /* unpack does the range checking */ _mapping_P[ci->map_type[i]]->free_info(ci->map_param[i]); for(i=0;ifloors;i++) /* unpack does the range checking */ _floor_P[ci->floor_type[i]]->free_info(ci->floor_param[i]); for(i=0;iresidues;i++) /* unpack does the range checking */ _residue_P[ci->residue_type[i]]->free_info(ci->residue_param[i]); for(i=0;ibooks;i++){ if(ci->book_param[i]){ /* knows if the book was not alloced */ vorbis_staticbook_destroy(ci->book_param[i]); } if(ci->fullbooks) vorbis_book_clear(ci->fullbooks+i); } if(ci->fullbooks) _ogg_free(ci->fullbooks); for(i=0;ipsys;i++) _vi_psy_free(ci->psy_param[i]); _ogg_free(ci); } memset(vi,0,sizeof(*vi)); } /* Header packing/unpacking ********************************************/ /* all of the real encoding details are here. The modes, books, everything */ static int _vorbis_unpack_books(vorbis_info *vi,oggpack_buffer *opb){ codec_setup_info *ci=vi->codec_setup; int i; if(!ci)return(OV_EFAULT); /* codebooks */ ci->books=oggpack_read(opb,8)+1; /*ci->book_param=_ogg_calloc(ci->books,sizeof(*ci->book_param));*/ for(i=0;ibooks;i++){ ci->book_param[i]=_ogg_calloc(1,sizeof(*ci->book_param[i])); if(vorbis_staticbook_unpack(opb,ci->book_param[i]))goto err_out; } /* time backend settings; hooks are unused */ { int times=oggpack_read(opb,6)+1; for(i=0;i=VI_TIMEB)goto err_out; } } /* floor backend settings */ ci->floors=oggpack_read(opb,6)+1; /*ci->floor_type=_ogg_malloc(ci->floors*sizeof(*ci->floor_type));*/ /*ci->floor_param=_ogg_calloc(ci->floors,sizeof(void *));*/ for(i=0;ifloors;i++){ ci->floor_type[i]=oggpack_read(opb,16); if(ci->floor_type[i]<0 || ci->floor_type[i]>=VI_FLOORB)goto err_out; ci->floor_param[i]=_floor_P[ci->floor_type[i]]->unpack(vi,opb); if(!ci->floor_param[i])goto err_out; } /* residue backend settings */ ci->residues=oggpack_read(opb,6)+1; /*ci->residue_type=_ogg_malloc(ci->residues*sizeof(*ci->residue_type));*/ /*ci->residue_param=_ogg_calloc(ci->residues,sizeof(void *));*/ for(i=0;iresidues;i++){ ci->residue_type[i]=oggpack_read(opb,16); if(ci->residue_type[i]<0 || ci->residue_type[i]>=VI_RESB)goto err_out; ci->residue_param[i]=_residue_P[ci->residue_type[i]]->unpack(vi,opb); if(!ci->residue_param[i])goto err_out; } /* map backend settings */ ci->maps=oggpack_read(opb,6)+1; /*ci->map_type=_ogg_malloc(ci->maps*sizeof(*ci->map_type));*/ /*ci->map_param=_ogg_calloc(ci->maps,sizeof(void *));*/ for(i=0;imaps;i++){ ci->map_type[i]=oggpack_read(opb,16); if(ci->map_type[i]<0 || ci->map_type[i]>=VI_MAPB)goto err_out; ci->map_param[i]=_mapping_P[ci->map_type[i]]->unpack(vi,opb); if(!ci->map_param[i])goto err_out; } /* mode settings */ ci->modes=oggpack_read(opb,6)+1; /*vi->mode_param=_ogg_calloc(vi->modes,sizeof(void *));*/ for(i=0;imodes;i++){ ci->mode_param[i]=_ogg_calloc(1,sizeof(*ci->mode_param[i])); ci->mode_param[i]->blockflag=oggpack_read(opb,1); ci->mode_param[i]->windowtype=oggpack_read(opb,16); ci->mode_param[i]->transformtype=oggpack_read(opb,16); ci->mode_param[i]->mapping=oggpack_read(opb,8); if(ci->mode_param[i]->windowtype>=VI_WINDOWB)goto err_out; if(ci->mode_param[i]->transformtype>=VI_WINDOWB)goto err_out; if(ci->mode_param[i]->mapping>=ci->maps)goto err_out; } if(oggpack_read(opb,1)!=1)goto err_out; /* top level EOP check */ return(0); err_out: vorbis_info_clear(vi); return(OV_EBADHEADER); } /* The Vorbis header is in three packets; the initial small packet in the first page that identifies basic parameters, a second packet with bitstream comments and a third packet that holds the codebook. */ int vorbis_synthesis_headerin(vorbis_info *vi,oggpack_buffer *opb, int packtype, ogg_packet *op) { if(op){ /* Which of the three types of header is this? */ /* Also verify header-ness, vorbis */ { switch(packtype){ case 0x05: /* least significant *bit* is read first */ if(vi->rate==0 /*|| vc->vendor==NULL*/){ /* um... we didn;t get the initial header or comments yet */ return(OV_EBADHEADER); } return(_vorbis_unpack_books(vi,opb)); default: /* Not a valid vorbis header type */ return(OV_EBADHEADER); break; } } } return(OV_EBADHEADER); } /* pack side **********************************************************/ static int _vorbis_pack_books(oggpack_buffer *opb,vorbis_info *vi){ codec_setup_info *ci=vi->codec_setup; int i; if(!ci)return(OV_EFAULT); oggpack_write(opb,0x05,8); _v_writestring(opb,"vorbis", 6); /* books */ oggpack_write(opb,ci->books-1,8); for(i=0;ibooks;i++) if(vorbis_staticbook_pack(ci->book_param[i],opb))goto err_out; /* times; hook placeholders */ oggpack_write(opb,0,6); oggpack_write(opb,0,16); /* floors */ oggpack_write(opb,ci->floors-1,6); for(i=0;ifloors;i++){ oggpack_write(opb,ci->floor_type[i],16); if(_floor_P[ci->floor_type[i]]->pack) _floor_P[ci->floor_type[i]]->pack(ci->floor_param[i],opb); else goto err_out; } /* residues */ oggpack_write(opb,ci->residues-1,6); for(i=0;iresidues;i++){ oggpack_write(opb,ci->residue_type[i],16); _residue_P[ci->residue_type[i]]->pack(ci->residue_param[i],opb); } /* maps */ oggpack_write(opb,ci->maps-1,6); for(i=0;imaps;i++){ oggpack_write(opb,ci->map_type[i],16); _mapping_P[ci->map_type[i]]->pack(vi,ci->map_param[i],opb); } /* modes */ oggpack_write(opb,ci->modes-1,6); for(i=0;imodes;i++){ oggpack_write(opb,ci->mode_param[i]->blockflag,1); oggpack_write(opb,ci->mode_param[i]->windowtype,16); oggpack_write(opb,ci->mode_param[i]->transformtype,16); oggpack_write(opb,ci->mode_param[i]->mapping,8); } oggpack_write(opb,1,1); return(0); err_out: return(-1); } int vorbis_analysis_headerout(vorbis_dsp_state *v, ogg_packet *op_code) { int ret=OV_EIMPL; vorbis_info *vi=v->vi; oggpack_buffer opb; private_state *b=v->backend_state; if(!b){ ret=OV_EFAULT; goto err_out; } oggpack_writeinit(&opb); /* third header packet (modes/codebooks) ****************************/ oggpack_reset(&opb); if(_vorbis_pack_books(&opb,vi))goto err_out; if(b->header2)_ogg_free(b->header2); b->header2=_ogg_malloc(oggpack_bytes(&opb)); memcpy(b->header2,opb.buffer,oggpack_bytes(&opb)); op_code->packet=b->header2; op_code->bytes=oggpack_bytes(&opb); op_code->b_o_s=0; op_code->e_o_s=0; op_code->granulepos=0; oggpack_writeclear(&opb); return(0); err_out: oggpack_writeclear(&opb); memset(op_code,0,sizeof(*op_code)); if(b->header2)_ogg_free(b->header2); b->header2=NULL; return(ret); } double vorbis_granule_time(vorbis_dsp_state *v,ogg_int64_t granulepos){ if(granulepos>=0) return((double)granulepos/v->vi->rate); return(-1); } libtritonus-java-20070428/src/lib/pvorbis/lookup.c0000644000175000017500000000634110167052677021732 0ustar twernertwerner/******************************************************************** * * * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 * * by the XIPHOPHORUS Company http://www.xiph.org/ * * * ******************************************************************** function: lookup based functions last mod: $Id: lookup.c,v 1.1 2005/01/05 21:01:51 pfisterer Exp $ ********************************************************************/ #include #include "lookup.h" #include "lookup_data.h" #include "os.h" #include "misc.h" #ifdef FLOAT_LOOKUP /* interpolated lookup based cos function, domain 0 to PI only */ float vorbis_coslook(float a){ double d=a*(.31830989*(float)COS_LOOKUP_SZ); int i=vorbis_ftoi(d-.5); return COS_LOOKUP[i]+ (d-i)*(COS_LOOKUP[i+1]-COS_LOOKUP[i]); } /* interpolated 1./sqrt(p) where .5 <= p < 1. */ float vorbis_invsqlook(float a){ double d=a*(2.f*(float)INVSQ_LOOKUP_SZ)-(float)INVSQ_LOOKUP_SZ; int i=vorbis_ftoi(d-.5f); return INVSQ_LOOKUP[i]+ (d-i)*(INVSQ_LOOKUP[i+1]-INVSQ_LOOKUP[i]); } /* interpolated 1./sqrt(p) where .5 <= p < 1. */ float vorbis_invsq2explook(int a){ return INVSQ2EXP_LOOKUP[a-INVSQ2EXP_LOOKUP_MIN]; } #include /* interpolated lookup based fromdB function, domain -140dB to 0dB only */ float vorbis_fromdBlook(float a){ int i=vorbis_ftoi(a*((float)(-(1<=(FROMdB_LOOKUP_SZ<>FROMdB_SHIFT]*FROMdB2_LOOKUP[i&FROMdB2_MASK]); } #endif #ifdef INT_LOOKUP /* interpolated 1./sqrt(p) where .5 <= a < 1. (.100000... to .111111...) in 16.16 format returns in m.8 format */ long vorbis_invsqlook_i(long a,long e){ long i=(a&0x7fff)>>(INVSQ_LOOKUP_I_SHIFT-1); long d=(a&INVSQ_LOOKUP_I_MASK)<<(16-INVSQ_LOOKUP_I_SHIFT); /* 0.16 */ long val=INVSQ_LOOKUP_I[i]- /* 1.16 */ (((INVSQ_LOOKUP_I[i]-INVSQ_LOOKUP_I[i+1])* /* 0.16 */ d)>>16); /* result 1.16 */ e+=32; if(e&1)val=(val*5792)>>13; /* multiply val by 1/sqrt(2) */ e=(e>>1)-8; return(val>>e); } /* interpolated lookup based fromdB function, domain -140dB to 0dB only */ /* a is in n.12 format */ float vorbis_fromdBlook_i(long a){ int i=(-a)>>(12-FROMdB2_SHIFT); return (i<0)?1.f: ((i>=(FROMdB_LOOKUP_SZ<>FROMdB_SHIFT]*FROMdB2_LOOKUP[i&FROMdB2_MASK]); } /* interpolated lookup based cos function, domain 0 to PI only */ /* a is in 0.16 format, where 0==0, 2^^16-1==PI, return 0.14 */ long vorbis_coslook_i(long a){ int i=a>>COS_LOOKUP_I_SHIFT; int d=a&COS_LOOKUP_I_MASK; return COS_LOOKUP_I[i]- ((d*(COS_LOOKUP_I[i]-COS_LOOKUP_I[i+1]))>> COS_LOOKUP_I_SHIFT); } #endif libtritonus-java-20070428/src/lib/pvorbis/lookup.h0000644000175000017500000000244610167052677021741 0ustar twernertwerner/******************************************************************** * * * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 * * by the XIPHOPHORUS Company http://www.xiph.org/ * * * ******************************************************************** function: lookup based functions last mod: $Id: lookup.h,v 1.1 2005/01/05 21:01:51 pfisterer Exp $ ********************************************************************/ #ifndef _V_LOOKUP_H_ #ifdef FLOAT_LOOKUP extern float vorbis_coslook(float a); extern float vorbis_invsqlook(float a); extern float vorbis_invsq2explook(int a); extern float vorbis_fromdBlook(float a); #endif #ifdef INT_LOOKUP extern long vorbis_invsqlook_i(long a,long e); extern long vorbis_coslook_i(long a); extern float vorbis_fromdBlook_i(long a); #endif #endif libtritonus-java-20070428/src/lib/pvorbis/lookup_data.h0000644000175000017500000002170510167052677022731 0ustar twernertwerner/******************************************************************** * * * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 * * by the XIPHOPHORUS Company http://www.xiph.org/ * * * ******************************************************************** function: lookup data; generated by lookups.pl; edit there last mod: $Id: lookup_data.h,v 1.1 2005/01/05 21:01:51 pfisterer Exp $ ********************************************************************/ #ifndef _V_LOOKUP_DATA_H_ #ifdef FLOAT_LOOKUP #define COS_LOOKUP_SZ 128 static float COS_LOOKUP[COS_LOOKUP_SZ+1]={ +1.0000000000000f,+0.9996988186962f,+0.9987954562052f,+0.9972904566787f, +0.9951847266722f,+0.9924795345987f,+0.9891765099648f,+0.9852776423889f, +0.9807852804032f,+0.9757021300385f,+0.9700312531945f,+0.9637760657954f, +0.9569403357322f,+0.9495281805930f,+0.9415440651830f,+0.9329927988347f, +0.9238795325113f,+0.9142097557035f,+0.9039892931234f,+0.8932243011955f, +0.8819212643484f,+0.8700869911087f,+0.8577286100003f,+0.8448535652497f, +0.8314696123025f,+0.8175848131516f,+0.8032075314806f,+0.7883464276266f, +0.7730104533627f,+0.7572088465065f,+0.7409511253550f,+0.7242470829515f, +0.7071067811865f,+0.6895405447371f,+0.6715589548470f,+0.6531728429538f, +0.6343932841636f,+0.6152315905806f,+0.5956993044924f,+0.5758081914178f, +0.5555702330196f,+0.5349976198871f,+0.5141027441932f,+0.4928981922298f, +0.4713967368260f,+0.4496113296546f,+0.4275550934303f,+0.4052413140050f, +0.3826834323651f,+0.3598950365350f,+0.3368898533922f,+0.3136817403989f, +0.2902846772545f,+0.2667127574749f,+0.2429801799033f,+0.2191012401569f, +0.1950903220161f,+0.1709618887603f,+0.1467304744554f,+0.1224106751992f, +0.0980171403296f,+0.0735645635997f,+0.0490676743274f,+0.0245412285229f, +0.0000000000000f,-0.0245412285229f,-0.0490676743274f,-0.0735645635997f, -0.0980171403296f,-0.1224106751992f,-0.1467304744554f,-0.1709618887603f, -0.1950903220161f,-0.2191012401569f,-0.2429801799033f,-0.2667127574749f, -0.2902846772545f,-0.3136817403989f,-0.3368898533922f,-0.3598950365350f, -0.3826834323651f,-0.4052413140050f,-0.4275550934303f,-0.4496113296546f, -0.4713967368260f,-0.4928981922298f,-0.5141027441932f,-0.5349976198871f, -0.5555702330196f,-0.5758081914178f,-0.5956993044924f,-0.6152315905806f, -0.6343932841636f,-0.6531728429538f,-0.6715589548470f,-0.6895405447371f, -0.7071067811865f,-0.7242470829515f,-0.7409511253550f,-0.7572088465065f, -0.7730104533627f,-0.7883464276266f,-0.8032075314806f,-0.8175848131516f, -0.8314696123025f,-0.8448535652497f,-0.8577286100003f,-0.8700869911087f, -0.8819212643484f,-0.8932243011955f,-0.9039892931234f,-0.9142097557035f, -0.9238795325113f,-0.9329927988347f,-0.9415440651830f,-0.9495281805930f, -0.9569403357322f,-0.9637760657954f,-0.9700312531945f,-0.9757021300385f, -0.9807852804032f,-0.9852776423889f,-0.9891765099648f,-0.9924795345987f, -0.9951847266722f,-0.9972904566787f,-0.9987954562052f,-0.9996988186962f, -1.0000000000000f, }; #define INVSQ_LOOKUP_SZ 32 static float INVSQ_LOOKUP[INVSQ_LOOKUP_SZ+1]={ 1.414213562373f,1.392621247646f,1.371988681140f,1.352246807566f, 1.333333333333f,1.315191898443f,1.297771369046f,1.281025230441f, 1.264911064067f,1.249390095109f,1.234426799697f,1.219988562661f, 1.206045378311f,1.192569588000f,1.179535649239f,1.166919931983f, 1.154700538379f,1.142857142857f,1.131370849898f,1.120224067222f, 1.109400392450f,1.098884511590f,1.088662107904f,1.078719779941f, 1.069044967650f,1.059625885652f,1.050451462878f,1.041511287847f, 1.032795558989f,1.024295039463f,1.016001016002f,1.007905261358f, 1.000000000000f, }; #define INVSQ2EXP_LOOKUP_MIN (-32) #define INVSQ2EXP_LOOKUP_MAX 32 static float INVSQ2EXP_LOOKUP[INVSQ2EXP_LOOKUP_MAX-\ INVSQ2EXP_LOOKUP_MIN+1]={ 65536.f, 46340.95001f, 32768.f, 23170.47501f, 16384.f, 11585.2375f, 8192.f, 5792.618751f, 4096.f, 2896.309376f, 2048.f, 1448.154688f, 1024.f, 724.0773439f, 512.f, 362.038672f, 256.f, 181.019336f, 128.f, 90.50966799f, 64.f, 45.254834f, 32.f, 22.627417f, 16.f, 11.3137085f, 8.f, 5.656854249f, 4.f, 2.828427125f, 2.f, 1.414213562f, 1.f, 0.7071067812f, 0.5f, 0.3535533906f, 0.25f, 0.1767766953f, 0.125f, 0.08838834765f, 0.0625f, 0.04419417382f, 0.03125f, 0.02209708691f, 0.015625f, 0.01104854346f, 0.0078125f, 0.005524271728f, 0.00390625f, 0.002762135864f, 0.001953125f, 0.001381067932f, 0.0009765625f, 0.000690533966f, 0.00048828125f, 0.000345266983f, 0.000244140625f,0.0001726334915f,0.0001220703125f,8.631674575e-05f, 6.103515625e-05f,4.315837288e-05f,3.051757812e-05f,2.157918644e-05f, 1.525878906e-05f, }; #endif #define FROMdB_LOOKUP_SZ 35 #define FROMdB2_LOOKUP_SZ 32 #define FROMdB_SHIFT 5 #define FROMdB2_SHIFT 3 #define FROMdB2_MASK 31 static float FROMdB_LOOKUP[FROMdB_LOOKUP_SZ]={ 1.f, 0.6309573445f, 0.3981071706f, 0.2511886432f, 0.1584893192f, 0.1f, 0.06309573445f, 0.03981071706f, 0.02511886432f, 0.01584893192f, 0.01f, 0.006309573445f, 0.003981071706f, 0.002511886432f, 0.001584893192f, 0.001f, 0.0006309573445f,0.0003981071706f,0.0002511886432f,0.0001584893192f, 0.0001f,6.309573445e-05f,3.981071706e-05f,2.511886432e-05f, 1.584893192e-05f, 1e-05f,6.309573445e-06f,3.981071706e-06f, 2.511886432e-06f,1.584893192e-06f, 1e-06f,6.309573445e-07f, 3.981071706e-07f,2.511886432e-07f,1.584893192e-07f, }; static float FROMdB2_LOOKUP[FROMdB2_LOOKUP_SZ]={ 0.9928302478f, 0.9786445908f, 0.9646616199f, 0.9508784391f, 0.9372921937f, 0.92390007f, 0.9106992942f, 0.8976871324f, 0.8848608897f, 0.8722179097f, 0.8597555737f, 0.8474713009f, 0.835362547f, 0.8234268041f, 0.8116616003f, 0.8000644989f, 0.7886330981f, 0.7773650302f, 0.7662579617f, 0.755309592f, 0.7445176537f, 0.7338799116f, 0.7233941627f, 0.7130582353f, 0.7028699885f, 0.6928273125f, 0.6829281272f, 0.6731703824f, 0.6635520573f, 0.6540711597f, 0.6447257262f, 0.6355138211f, }; #ifdef INT_LOOKUP #define INVSQ_LOOKUP_I_SHIFT 10 #define INVSQ_LOOKUP_I_MASK 1023 static long INVSQ_LOOKUP_I[64+1]={ 92682l, 91966l, 91267l, 90583l, 89915l, 89261l, 88621l, 87995l, 87381l, 86781l, 86192l, 85616l, 85051l, 84497l, 83953l, 83420l, 82897l, 82384l, 81880l, 81385l, 80899l, 80422l, 79953l, 79492l, 79039l, 78594l, 78156l, 77726l, 77302l, 76885l, 76475l, 76072l, 75674l, 75283l, 74898l, 74519l, 74146l, 73778l, 73415l, 73058l, 72706l, 72359l, 72016l, 71679l, 71347l, 71019l, 70695l, 70376l, 70061l, 69750l, 69444l, 69141l, 68842l, 68548l, 68256l, 67969l, 67685l, 67405l, 67128l, 66855l, 66585l, 66318l, 66054l, 65794l, 65536l, }; #define COS_LOOKUP_I_SHIFT 9 #define COS_LOOKUP_I_MASK 511 #define COS_LOOKUP_I_SZ 128 static long COS_LOOKUP_I[COS_LOOKUP_I_SZ+1]={ 16384l, 16379l, 16364l, 16340l, 16305l, 16261l, 16207l, 16143l, 16069l, 15986l, 15893l, 15791l, 15679l, 15557l, 15426l, 15286l, 15137l, 14978l, 14811l, 14635l, 14449l, 14256l, 14053l, 13842l, 13623l, 13395l, 13160l, 12916l, 12665l, 12406l, 12140l, 11866l, 11585l, 11297l, 11003l, 10702l, 10394l, 10080l, 9760l, 9434l, 9102l, 8765l, 8423l, 8076l, 7723l, 7366l, 7005l, 6639l, 6270l, 5897l, 5520l, 5139l, 4756l, 4370l, 3981l, 3590l, 3196l, 2801l, 2404l, 2006l, 1606l, 1205l, 804l, 402l, 0l, -401l, -803l, -1204l, -1605l, -2005l, -2403l, -2800l, -3195l, -3589l, -3980l, -4369l, -4755l, -5138l, -5519l, -5896l, -6269l, -6638l, -7004l, -7365l, -7722l, -8075l, -8422l, -8764l, -9101l, -9433l, -9759l, -10079l, -10393l, -10701l, -11002l, -11296l, -11584l, -11865l, -12139l, -12405l, -12664l, -12915l, -13159l, -13394l, -13622l, -13841l, -14052l, -14255l, -14448l, -14634l, -14810l, -14977l, -15136l, -15285l, -15425l, -15556l, -15678l, -15790l, -15892l, -15985l, -16068l, -16142l, -16206l, -16260l, -16304l, -16339l, -16363l, -16378l, -16383l, }; #endif #endif libtritonus-java-20070428/src/lib/pvorbis/lpc.c0000644000175000017500000001031610167052677021174 0ustar twernertwerner/******************************************************************** * * * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 * * by the XIPHOPHORUS Company http://www.xiph.org/ * * * ******************************************************************** function: LPC low level routines last mod: $Id: lpc.c,v 1.1 2005/01/05 21:01:51 pfisterer Exp $ ********************************************************************/ /* Some of these routines (autocorrelator, LPC coefficient estimator) are derived from code written by Jutta Degener and Carsten Bormann; thus we include their copyright below. The entirety of this file is freely redistributable on the condition that both of these copyright notices are preserved without modification. */ /* Preserved Copyright: *********************************************/ /* Copyright 1992, 1993, 1994 by Jutta Degener and Carsten Bormann, Technische Universita"t Berlin Any use of this software is permitted provided that this notice is not removed and that neither the authors nor the Technische Universita"t Berlin are deemed to have made any representations as to the suitability of this software for any purpose nor are held responsible for any defects of this software. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE. As a matter of courtesy, the authors request to be informed about uses this software has found, about bugs in this software, and about any improvements that may be of general interest. Berlin, 28.11.1994 Jutta Degener Carsten Bormann *********************************************************************/ #include #include #include #include "os.h" #include "smallft.h" #include "lpc.h" #include "scales.h" #include "misc.h" /* Autocorrelation LPC coeff generation algorithm invented by N. Levinson in 1947, modified by J. Durbin in 1959. */ /* Input : n elements of time doamin data Output: m lpc coefficients, excitation energy */ float vorbis_lpc_from_data(float *data,float *lpci,int n,int m){ double *aut=alloca(sizeof(*aut)*(m+1)); double *lpc=alloca(sizeof(*lpc)*(m)); double error; int i,j; /* autocorrelation, p+1 lag coefficients */ j=m+1; while(j--){ double d=0; /* double needed for accumulator depth */ for(i=j;i #include #include #include "lsp.h" #include "os.h" #include "misc.h" #include "lookup.h" #include "scales.h" /* three possible LSP to f curve functions; the exact computation (float), a lookup based float implementation, and an integer implementation. The float lookup is likely the optimal choice on any machine with an FPU. The integer implementation is *not* fixed point (due to the need for a large dynamic range and thus a seperately tracked exponent) and thus much more complex than the relatively simple float implementations. It's mostly for future work on a fully fixed point implementation for processors like the ARM family. */ /* undefine both for the 'old' but more precise implementation */ #define FLOAT_LOOKUP #undef INT_LOOKUP #ifdef FLOAT_LOOKUP #include "lookup.c" /* catch this in the build system; we #include for compilers (like gcc) that can't inline across modules */ /* side effect: changes *lsp to cosines of lsp */ void vorbis_lsp_to_curve(float *curve,int *map,int n,int ln,float *lsp,int m, float amp,float ampoffset){ int i; float wdel=M_PI/ln; vorbis_fpu_control fpu; vorbis_fpu_setround(&fpu); for(i=0;i>1; do{ q*=ftmp[0]-w; p*=ftmp[1]-w; ftmp+=2; }while(--c); if(m&1){ /* odd order filter; slightly assymetric */ /* the last coefficient */ q*=ftmp[0]-w; q*=q; p*=p*(1.f-w*w); }else{ /* even order filter; still symmetric */ q*=q*(1.f+w); p*=p*(1.f-w); } q=frexp(p+q,&qexp); q=vorbis_fromdBlook(amp* vorbis_invsqlook(q)* vorbis_invsq2explook(qexp+m)- ampoffset); do{ curve[i++]*=q; }while(map[i]==k); } vorbis_fpu_restore(fpu); } #else #ifdef INT_LOOKUP #include "lookup.c" /* catch this in the build system; we #include for compilers (like gcc) that can't inline across modules */ static int MLOOP_1[64]={ 0,10,11,11, 12,12,12,12, 13,13,13,13, 13,13,13,13, 14,14,14,14, 14,14,14,14, 14,14,14,14, 14,14,14,14, 15,15,15,15, 15,15,15,15, 15,15,15,15, 15,15,15,15, 15,15,15,15, 15,15,15,15, 15,15,15,15, 15,15,15,15, }; static int MLOOP_2[64]={ 0,4,5,5, 6,6,6,6, 7,7,7,7, 7,7,7,7, 8,8,8,8, 8,8,8,8, 8,8,8,8, 8,8,8,8, 9,9,9,9, 9,9,9,9, 9,9,9,9, 9,9,9,9, 9,9,9,9, 9,9,9,9, 9,9,9,9, 9,9,9,9, }; static int MLOOP_3[8]={0,1,2,2,3,3,3,3}; /* side effect: changes *lsp to cosines of lsp */ void vorbis_lsp_to_curve(float *curve,int *map,int n,int ln,float *lsp,int m, float amp,float ampoffset){ /* 0 <= m < 256 */ /* set up for using all int later */ int i; int ampoffseti=rint(ampoffset*4096.f); int ampi=rint(amp*16.f); long *ilsp=alloca(m*sizeof(*ilsp)); for(i=0;i>25])) if(!(shift=MLOOP_2[(pi|qi)>>19])) shift=MLOOP_3[(pi|qi)>>16]; qi=(qi>>shift)*labs(ilsp[j-1]-wi); pi=(pi>>shift)*labs(ilsp[j]-wi); qexp+=shift; } if(!(shift=MLOOP_1[(pi|qi)>>25])) if(!(shift=MLOOP_2[(pi|qi)>>19])) shift=MLOOP_3[(pi|qi)>>16]; /* pi,qi normalized collectively, both tracked using qexp */ if(m&1){ /* odd order filter; slightly assymetric */ /* the last coefficient */ qi=(qi>>shift)*labs(ilsp[j-1]-wi); pi=(pi>>shift)<<14; qexp+=shift; if(!(shift=MLOOP_1[(pi|qi)>>25])) if(!(shift=MLOOP_2[(pi|qi)>>19])) shift=MLOOP_3[(pi|qi)>>16]; pi>>=shift; qi>>=shift; qexp+=shift-14*((m+1)>>1); pi=((pi*pi)>>16); qi=((qi*qi)>>16); qexp=qexp*2+m; pi*=(1<<14)-((wi*wi)>>14); qi+=pi>>14; }else{ /* even order filter; still symmetric */ /* p*=p(1-w), q*=q(1+w), let normalization drift because it isn't worth tracking step by step */ pi>>=shift; qi>>=shift; qexp+=shift-7*m; pi=((pi*pi)>>16); qi=((qi*qi)>>16); qexp=qexp*2+m; pi*=(1<<14)-wi; qi*=(1<<14)+wi; qi=(qi+pi)>>14; } /* we've let the normalization drift because it wasn't important; however, for the lookup, things must be normalized again. We need at most one right shift or a number of left shifts */ if(qi&0xffff0000){ /* checks for 1.xxxxxxxxxxxxxxxx */ qi>>=1; qexp++; }else while(qi && !(qi&0x8000)){ /* checks for 0.0xxxxxxxxxxxxxxx or less*/ qi<<=1; qexp--; } amp=vorbis_fromdBlook_i(ampi* /* n.4 */ vorbis_invsqlook_i(qi,qexp)- /* m.8, m+n<=8 */ ampoffseti); /* 8.12[0] */ curve[i]*=amp; while(map[++i]==k)curve[i]*=amp; } } #else /* old, nonoptimized but simple version for any poor sap who needs to figure out what the hell this code does, or wants the other fraction of a dB precision */ /* side effect: changes *lsp to cosines of lsp */ void vorbis_lsp_to_curve(float *curve,int *map,int n,int ln,float *lsp,int m, float amp,float ampoffset){ int i; float wdel=M_PI/ln; for(i=0;i= i; j--) { g[j-2] -= g[j]; g[j] += g[j]; } } } static int comp(const void *a,const void *b){ return (*(float *)a<*(float *)b)-(*(float *)a>*(float *)b); } /* Newton-Raphson-Maehly actually functioned as a decent root finder, but there are root sets for which it gets into limit cycles (exacerbated by zero suppression) and fails. We can't afford to fail, even if the failure is 1 in 100,000,000, so we now use Laguerre and later polish with Newton-Raphson (which can then afford to fail) */ #define EPSILON 10e-7 static int Laguerre_With_Deflation(float *a,int ord,float *r){ int i,m; double lastdelta=0.f; double *defl=alloca(sizeof(*defl)*(ord+1)); for(i=0;i<=ord;i++)defl[i]=a[i]; for(m=ord;m>0;m--){ double new=0.f,delta; /* iterate a root */ while(1){ double p=defl[m],pp=0.f,ppp=0.f,denom; /* eval the polynomial and its first two derivatives */ for(i=m;i>0;i--){ ppp = new*ppp + pp; pp = new*pp + p; p = new*p + defl[i-1]; } /* Laguerre's method */ denom=(m-1) * ((m-1)*pp*pp - m*p*ppp); if(denom<0) return(-1); /* complex root! The LPC generator handed us a bad filter */ if(pp>0){ denom = pp + sqrt(denom); if(denom-(EPSILON))denom=-(EPSILON); } delta = m*p/denom; new -= delta; if(delta<0.f)delta*=-1; if(fabs(delta/new)<10e-12)break; lastdelta=delta; } r[m-1]=new; /* forward deflation */ for(i=m;i>0;i--) defl[i-1]+=new*defl[i]; defl++; } return(0); } /* for spit-and-polish only */ static int Newton_Raphson(float *a,int ord,float *r){ int i, k, count=0; double error=1.f; double *root=alloca(ord*sizeof(*root)); for(i=0; i1e-20){ error=0; for(i=0; i= 0; k--) { pp= pp* rooti + p; p = p * rooti + a[k]; } delta = p/pp; root[i] -= delta; error+= delta*delta; } if(count>40)return(-1); count++; } /* Replaced the original bubble sort with a real sort. With your help, we can eliminate the bubble sort in our lifetime. --Monty */ for(i=0; i>1; int g1_order,g2_order; float *g1=alloca(sizeof(*g1)*(order2+1)); float *g2=alloca(sizeof(*g2)*(order2+1)); float *g1r=alloca(sizeof(*g1r)*(order2+1)); float *g2r=alloca(sizeof(*g2r)*(order2+1)); int i; /* even and odd are slightly different base cases */ g1_order=(m+1)>>1; g2_order=(m) >>1; /* Compute the lengths of the x polynomials. */ /* Compute the first half of K & R F1 & F2 polynomials. */ /* Compute half of the symmetric and antisymmetric polynomials. */ /* Remove the roots at +1 and -1. */ g1[g1_order] = 1.f; for(i=1;i<=g1_order;i++) g1[g1_order-i] = lpc[i-1]+lpc[m-i]; g2[g2_order] = 1.f; for(i=1;i<=g2_order;i++) g2[g2_order-i] = lpc[i-1]-lpc[m-i]; if(g1_order>g2_order){ for(i=2; i<=g2_order;i++) g2[g2_order-i] += g2[g2_order-i+2]; }else{ for(i=1; i<=g1_order;i++) g1[g1_order-i] -= g1[g1_order-i+1]; for(i=1; i<=g2_order;i++) g2[g2_order-i] += g2[g2_order-i+1]; } /* Convert into polynomials in cos(alpha) */ cheby(g1,g1_order); cheby(g2,g2_order); /* Find the roots of the 2 even polynomials.*/ if(Laguerre_With_Deflation(g1,g1_order,g1r) || Laguerre_With_Deflation(g2,g2_order,g2r)) return(-1); Newton_Raphson(g1,g1_order,g1r); /* if it fails, it leaves g1r alone */ Newton_Raphson(g2,g2_order,g2r); /* if it fails, it leaves g2r alone */ qsort(g1r,g1_order,sizeof(*g1r),comp); qsort(g2r,g2_order,sizeof(*g2r),comp); for(i=0;i #include #include #include #include "ogg/ogg.h" #include "vorbis/codec.h" #include "codec_internal.h" #include "codebook.h" #include "window.h" #include "registry.h" #include "psy.h" #include "misc.h" /* simplistic, wasteful way of doing this (unique lookup for each mode/submapping); there should be a central repository for identical lookups. That will require minor work, so I'm putting it off as low priority. Why a lookup for each backend in a given mode? Because the blocksize is set by the mode, and low backend lookups may require parameters from other areas of the mode/mapping */ static void mapping0_free_info(vorbis_info_mapping *i){ vorbis_info_mapping0 *info=(vorbis_info_mapping0 *)i; if(info){ memset(info,0,sizeof(*info)); _ogg_free(info); } } static int ilog(unsigned int v){ int ret=0; if(v)--v; while(v){ ret++; v>>=1; } return(ret); } static void mapping0_pack(vorbis_info *vi,vorbis_info_mapping *vm, oggpack_buffer *opb){ int i; vorbis_info_mapping0 *info=(vorbis_info_mapping0 *)vm; /* another 'we meant to do it this way' hack... up to beta 4, we packed 4 binary zeros here to signify one submapping in use. We now redefine that to mean four bitflags that indicate use of deeper features; bit0:submappings, bit1:coupling, bit2,3:reserved. This is backward compatable with all actual uses of the beta code. */ if(info->submaps>1){ oggpack_write(opb,1,1); oggpack_write(opb,info->submaps-1,4); }else oggpack_write(opb,0,1); if(info->coupling_steps>0){ oggpack_write(opb,1,1); oggpack_write(opb,info->coupling_steps-1,8); for(i=0;icoupling_steps;i++){ oggpack_write(opb,info->coupling_mag[i],ilog(vi->channels)); oggpack_write(opb,info->coupling_ang[i],ilog(vi->channels)); } }else oggpack_write(opb,0,1); oggpack_write(opb,0,2); /* 2,3:reserved */ /* we don't write the channel submappings if we only have one... */ if(info->submaps>1){ for(i=0;ichannels;i++) oggpack_write(opb,info->chmuxlist[i],4); } for(i=0;isubmaps;i++){ oggpack_write(opb,0,8); /* time submap unused */ oggpack_write(opb,info->floorsubmap[i],8); oggpack_write(opb,info->residuesubmap[i],8); } } /* also responsible for range checking */ static vorbis_info_mapping *mapping0_unpack(vorbis_info *vi,oggpack_buffer *opb){ int i; vorbis_info_mapping0 *info=_ogg_calloc(1,sizeof(*info)); codec_setup_info *ci=vi->codec_setup; memset(info,0,sizeof(*info)); if(oggpack_read(opb,1)) info->submaps=oggpack_read(opb,4)+1; else info->submaps=1; if(oggpack_read(opb,1)){ info->coupling_steps=oggpack_read(opb,8)+1; for(i=0;icoupling_steps;i++){ int testM=info->coupling_mag[i]=oggpack_read(opb,ilog(vi->channels)); int testA=info->coupling_ang[i]=oggpack_read(opb,ilog(vi->channels)); if(testM<0 || testA<0 || testM==testA || testM>=vi->channels || testA>=vi->channels) goto err_out; } } if(oggpack_read(opb,2)>0)goto err_out; /* 2,3:reserved */ if(info->submaps>1){ for(i=0;ichannels;i++){ info->chmuxlist[i]=oggpack_read(opb,4); if(info->chmuxlist[i]>=info->submaps)goto err_out; } } for(i=0;isubmaps;i++){ oggpack_read(opb,8); /* time submap unused */ info->floorsubmap[i]=oggpack_read(opb,8); if(info->floorsubmap[i]>=ci->floors)goto err_out; info->residuesubmap[i]=oggpack_read(opb,8); if(info->residuesubmap[i]>=ci->residues)goto err_out; } return info; err_out: mapping0_free_info(info); return(NULL); } #include "os.h" #include "lpc.h" #include "lsp.h" #include "envelope.h" #include "mdct.h" #include "psy.h" #include "scales.h" #if 0 static long seq=0; static ogg_int64_t total=0; static float FLOOR1_fromdB_LOOKUP[256]={ 1.0649863e-07F, 1.1341951e-07F, 1.2079015e-07F, 1.2863978e-07F, 1.3699951e-07F, 1.4590251e-07F, 1.5538408e-07F, 1.6548181e-07F, 1.7623575e-07F, 1.8768855e-07F, 1.9988561e-07F, 2.128753e-07F, 2.2670913e-07F, 2.4144197e-07F, 2.5713223e-07F, 2.7384213e-07F, 2.9163793e-07F, 3.1059021e-07F, 3.3077411e-07F, 3.5226968e-07F, 3.7516214e-07F, 3.9954229e-07F, 4.2550680e-07F, 4.5315863e-07F, 4.8260743e-07F, 5.1396998e-07F, 5.4737065e-07F, 5.8294187e-07F, 6.2082472e-07F, 6.6116941e-07F, 7.0413592e-07F, 7.4989464e-07F, 7.9862701e-07F, 8.5052630e-07F, 9.0579828e-07F, 9.6466216e-07F, 1.0273513e-06F, 1.0941144e-06F, 1.1652161e-06F, 1.2409384e-06F, 1.3215816e-06F, 1.4074654e-06F, 1.4989305e-06F, 1.5963394e-06F, 1.7000785e-06F, 1.8105592e-06F, 1.9282195e-06F, 2.0535261e-06F, 2.1869758e-06F, 2.3290978e-06F, 2.4804557e-06F, 2.6416497e-06F, 2.8133190e-06F, 2.9961443e-06F, 3.1908506e-06F, 3.3982101e-06F, 3.6190449e-06F, 3.8542308e-06F, 4.1047004e-06F, 4.3714470e-06F, 4.6555282e-06F, 4.9580707e-06F, 5.2802740e-06F, 5.6234160e-06F, 5.9888572e-06F, 6.3780469e-06F, 6.7925283e-06F, 7.2339451e-06F, 7.7040476e-06F, 8.2047000e-06F, 8.7378876e-06F, 9.3057248e-06F, 9.9104632e-06F, 1.0554501e-05F, 1.1240392e-05F, 1.1970856e-05F, 1.2748789e-05F, 1.3577278e-05F, 1.4459606e-05F, 1.5399272e-05F, 1.6400004e-05F, 1.7465768e-05F, 1.8600792e-05F, 1.9809576e-05F, 2.1096914e-05F, 2.2467911e-05F, 2.3928002e-05F, 2.5482978e-05F, 2.7139006e-05F, 2.8902651e-05F, 3.0780908e-05F, 3.2781225e-05F, 3.4911534e-05F, 3.7180282e-05F, 3.9596466e-05F, 4.2169667e-05F, 4.4910090e-05F, 4.7828601e-05F, 5.0936773e-05F, 5.4246931e-05F, 5.7772202e-05F, 6.1526565e-05F, 6.5524908e-05F, 6.9783085e-05F, 7.4317983e-05F, 7.9147585e-05F, 8.4291040e-05F, 8.9768747e-05F, 9.5602426e-05F, 0.00010181521F, 0.00010843174F, 0.00011547824F, 0.00012298267F, 0.00013097477F, 0.00013948625F, 0.00014855085F, 0.00015820453F, 0.00016848555F, 0.00017943469F, 0.00019109536F, 0.00020351382F, 0.00021673929F, 0.00023082423F, 0.00024582449F, 0.00026179955F, 0.00027881276F, 0.00029693158F, 0.00031622787F, 0.00033677814F, 0.00035866388F, 0.00038197188F, 0.00040679456F, 0.00043323036F, 0.00046138411F, 0.00049136745F, 0.00052329927F, 0.00055730621F, 0.00059352311F, 0.00063209358F, 0.00067317058F, 0.00071691700F, 0.00076350630F, 0.00081312324F, 0.00086596457F, 0.00092223983F, 0.00098217216F, 0.0010459992F, 0.0011139742F, 0.0011863665F, 0.0012634633F, 0.0013455702F, 0.0014330129F, 0.0015261382F, 0.0016253153F, 0.0017309374F, 0.0018434235F, 0.0019632195F, 0.0020908006F, 0.0022266726F, 0.0023713743F, 0.0025254795F, 0.0026895994F, 0.0028643847F, 0.0030505286F, 0.0032487691F, 0.0034598925F, 0.0036847358F, 0.0039241906F, 0.0041792066F, 0.0044507950F, 0.0047400328F, 0.0050480668F, 0.0053761186F, 0.0057254891F, 0.0060975636F, 0.0064938176F, 0.0069158225F, 0.0073652516F, 0.0078438871F, 0.0083536271F, 0.0088964928F, 0.009474637F, 0.010090352F, 0.010746080F, 0.011444421F, 0.012188144F, 0.012980198F, 0.013823725F, 0.014722068F, 0.015678791F, 0.016697687F, 0.017782797F, 0.018938423F, 0.020169149F, 0.021479854F, 0.022875735F, 0.024362330F, 0.025945531F, 0.027631618F, 0.029427276F, 0.031339626F, 0.033376252F, 0.035545228F, 0.037855157F, 0.040315199F, 0.042935108F, 0.045725273F, 0.048696758F, 0.051861348F, 0.055231591F, 0.058820850F, 0.062643361F, 0.066714279F, 0.071049749F, 0.075666962F, 0.080584227F, 0.085821044F, 0.091398179F, 0.097337747F, 0.10366330F, 0.11039993F, 0.11757434F, 0.12521498F, 0.13335215F, 0.14201813F, 0.15124727F, 0.16107617F, 0.17154380F, 0.18269168F, 0.19456402F, 0.20720788F, 0.22067342F, 0.23501402F, 0.25028656F, 0.26655159F, 0.28387361F, 0.30232132F, 0.32196786F, 0.34289114F, 0.36517414F, 0.38890521F, 0.41417847F, 0.44109412F, 0.46975890F, 0.50028648F, 0.53279791F, 0.56742212F, 0.60429640F, 0.64356699F, 0.68538959F, 0.72993007F, 0.77736504F, 0.82788260F, 0.88168307F, 0.9389798F, 1.F, }; #endif extern int *floor1_fit(vorbis_block *vb,vorbis_look_floor *look, const float *logmdct, /* in */ const float *logmask); extern int *floor1_interpolate_fit(vorbis_block *vb,vorbis_look_floor *look, int *A,int *B, int del); extern int floor1_encode(vorbis_block *vb,vorbis_look_floor *look, int *post,int *ilogmask); static int mapping0_forward(vorbis_block *vb){ vorbis_dsp_state *vd=vb->vd; vorbis_info *vi=vd->vi; codec_setup_info *ci=vi->codec_setup; private_state *b=vb->vd->backend_state; vorbis_block_internal *vbi=(vorbis_block_internal *)vb->internal; int n=vb->pcmend; int i,j,k; int *nonzero = alloca(sizeof(*nonzero)*vi->channels); float **gmdct = _vorbis_block_alloc(vb,vi->channels*sizeof(*gmdct)); int **ilogmaskch= _vorbis_block_alloc(vb,vi->channels*sizeof(*ilogmaskch)); int ***floor_posts = _vorbis_block_alloc(vb,vi->channels*sizeof(*floor_posts)); float global_ampmax=vbi->ampmax; float *local_ampmax=alloca(sizeof(*local_ampmax)*vi->channels); int blocktype=vbi->blocktype; int modenumber=vb->W; vorbis_info_mapping0 *info=ci->map_param[modenumber]; vorbis_look_psy *psy_look= b->psy+blocktype+(vb->W?2:0); vb->mode=modenumber; for(i=0;ichannels;i++){ float scale=4.f/n; float scale_dB; float *pcm =vb->pcm[i]; float *logfft =pcm; gmdct[i]=_vorbis_block_alloc(vb,n/2*sizeof(**gmdct)); scale_dB=todB(&scale); #if 0 if(vi->channels==2) if(i==0) _analysis_output("pcmL",seq,pcm,n,0,0,total-n/2); else _analysis_output("pcmR",seq,pcm,n,0,0,total-n/2); #endif /* window the PCM data */ _vorbis_apply_window(pcm,b->window,ci->blocksizes,vb->lW,vb->W,vb->nW); #if 0 if(vi->channels==2) if(i==0) _analysis_output("windowedL",seq,pcm,n,0,0,total-n/2); else _analysis_output("windowedR",seq,pcm,n,0,0,total-n/2); #endif /* transform the PCM data */ /* only MDCT right now.... */ mdct_forward(b->transform[vb->W][0],pcm,gmdct[i]); /* FFT yields more accurate tonal estimation (not phase sensitive) */ drft_forward(&b->fft_look[vb->W],pcm); logfft[0]=scale_dB+todB(pcm); local_ampmax[i]=logfft[0]; for(j=1;j>1]=scale_dB+.5f*todB(&temp); if(temp>local_ampmax[i])local_ampmax[i]=temp; } if(local_ampmax[i]>0.f)local_ampmax[i]=0.f; if(local_ampmax[i]>global_ampmax)global_ampmax=local_ampmax[i]; #if 0 if(vi->channels==2) if(i==0) _analysis_output("fftL",seq,logfft,n/2,1,0,0); else _analysis_output("fftR",seq,logfft,n/2,1,0,0); #endif } { float *noise = _vorbis_block_alloc(vb,n/2*sizeof(*noise)); float *tone = _vorbis_block_alloc(vb,n/2*sizeof(*tone)); for(i=0;ichannels;i++){ /* the encoder setup assumes that all the modes used by any specific bitrate tweaking use the same floor */ int submap=info->chmuxlist[i]; /* the following makes things clearer to *me* anyway */ float *mdct =gmdct[i]; float *logfft =vb->pcm[i]; float *logmdct =logfft+n/2; float *logmask =logfft; vb->mode=modenumber; floor_posts[i]=_vorbis_block_alloc(vb,PACKETBLOBS*sizeof(**floor_posts)); memset(floor_posts[i],0,sizeof(**floor_posts)*PACKETBLOBS); for(j=0;jchannels==2){ if(i==0) _analysis_output("mdctL",seq,logmdct,n/2,1,0,0); else _analysis_output("mdctR",seq,logmdct,n/2,1,0,0); }else{ _analysis_output("mdct",seq,logmdct,n/2,1,0,0); } #endif /* first step; noise masking. Not only does 'noise masking' give us curves from which we can decide how much resolution to give noise parts of the spectrum, it also implicitly hands us a tonality estimate (the larger the value in the 'noise_depth' vector, the more tonal that area is) */ _vp_noisemask(psy_look, logmdct, noise); /* noise does not have by-frequency offset bias applied yet */ #if 0 if(vi->channels==2){ if(i==0) _analysis_output("noiseL",seq,noise,n/2,1,0,0); else _analysis_output("noiseR",seq,noise,n/2,1,0,0); } #endif /* second step: 'all the other crap'; all the stuff that isn't computed/fit for bitrate management goes in the second psy vector. This includes tone masking, peak limiting and ATH */ _vp_tonemask(psy_look, logfft, tone, global_ampmax, local_ampmax[i]); #if 0 if(vi->channels==2){ if(i==0) _analysis_output("toneL",seq,tone,n/2,1,0,0); else _analysis_output("toneR",seq,tone,n/2,1,0,0); } #endif /* third step; we offset the noise vectors, overlay tone masking. We then do a floor1-specific line fit. If we're performing bitrate management, the line fit is performed multiple times for up/down tweakage on demand. */ _vp_offset_and_mix(psy_look, noise, tone, 1, logmask); #if 0 if(vi->channels==2){ if(i==0) _analysis_output("mask1L",seq,logmask,n/2,1,0,0); else _analysis_output("mask1R",seq,logmask,n/2,1,0,0); } #endif /* this algorithm is hardwired to floor 1 for now; abort out if we're *not* floor1. This won't happen unless someone has broken the encode setup lib. Guard it anyway. */ if(ci->floor_type[info->floorsubmap[submap]]!=1)return(-1); floor_posts[i][PACKETBLOBS/2]= floor1_fit(vb,b->flr[info->floorsubmap[submap]], logmdct, logmask); /* are we managing bitrate? If so, perform two more fits for later rate tweaking (fits represent hi/lo) */ if(vorbis_bitrate_managed(vb) && floor_posts[i][PACKETBLOBS/2]){ /* higher rate by way of lower noise curve */ _vp_offset_and_mix(psy_look, noise, tone, 2, logmask); #if 0 if(vi->channels==2){ if(i==0) _analysis_output("mask2L",seq,logmask,n/2,1,0,0); else _analysis_output("mask2R",seq,logmask,n/2,1,0,0); } #endif floor_posts[i][PACKETBLOBS-1]= floor1_fit(vb,b->flr[info->floorsubmap[submap]], logmdct, logmask); /* lower rate by way of higher noise curve */ _vp_offset_and_mix(psy_look, noise, tone, 0, logmask); #if 0 if(vi->channels==2) if(i==0) _analysis_output("mask0L",seq,logmask,n/2,1,0,0); else _analysis_output("mask0R",seq,logmask,n/2,1,0,0); #endif floor_posts[i][0]= floor1_fit(vb,b->flr[info->floorsubmap[submap]], logmdct, logmask); /* we also interpolate a range of intermediate curves for intermediate rates */ for(k=1;kflr[info->floorsubmap[submap]], floor_posts[i][0], floor_posts[i][PACKETBLOBS/2], k*65536/(PACKETBLOBS/2)); for(k=PACKETBLOBS/2+1;kflr[info->floorsubmap[submap]], floor_posts[i][PACKETBLOBS/2], floor_posts[i][PACKETBLOBS-1], (k-PACKETBLOBS/2)*65536/(PACKETBLOBS/2)); } } } vbi->ampmax=global_ampmax; /* the next phases are performed once for vbr-only and PACKETBLOB times for bitrate managed modes. 1) encode actual mode being used 2) encode the floor for each channel, compute coded mask curve/res 3) normalize and couple. 4) encode residue 5) save packet bytes to the packetblob vector */ /* iterate over the many masking curve fits we've created */ { float **res_bundle=alloca(sizeof(*res_bundle)*vi->channels); float **couple_bundle=alloca(sizeof(*couple_bundle)*vi->channels); int *zerobundle=alloca(sizeof(*zerobundle)*vi->channels); int **sortindex=alloca(sizeof(*sortindex)*vi->channels); float **mag_memo; int **mag_sort; if(info->coupling_steps){ mag_memo=_vp_quantize_couple_memo(vb, &ci->psy_g_param, psy_look, info, gmdct); mag_sort=_vp_quantize_couple_sort(vb, psy_look, info, mag_memo); } memset(sortindex,0,sizeof(*sortindex)*vi->channels); if(psy_look->vi->normal_channel_p){ for(i=0;ichannels;i++){ float *mdct =gmdct[i]; sortindex[i]=alloca(sizeof(**sortindex)*n/2); _vp_noise_normalize_sort(psy_look,mdct,sortindex[i]); } } for(k=(vorbis_bitrate_managed(vb)?0:PACKETBLOBS/2); k<=(vorbis_bitrate_managed(vb)?PACKETBLOBS-1:PACKETBLOBS/2); k++){ /* start out our new packet blob with packet type and mode */ /* Encode the packet type */ oggpack_write(&vb->opb,0,1); /* Encode the modenumber */ /* Encode frame mode, pre,post windowsize, then dispatch */ oggpack_write(&vb->opb,modenumber,b->modebits); if(vb->W){ oggpack_write(&vb->opb,vb->lW,1); oggpack_write(&vb->opb,vb->nW,1); } /* encode floor, compute masking curve, sep out residue */ for(i=0;ichannels;i++){ int submap=info->chmuxlist[i]; float *mdct =gmdct[i]; float *res =vb->pcm[i]; int *ilogmask=ilogmaskch[i]= _vorbis_block_alloc(vb,n/2*sizeof(**gmdct)); nonzero[i]=floor1_encode(vb,b->flr[info->floorsubmap[submap]], floor_posts[i][k], ilogmask); #if 0 { char buf[80]; sprintf(buf,"maskI%c%d",i?'R':'L',k); float work[n/2]; for(j=0;jpsy_g_param.sliding_lowpass[vb->W][k]); _vp_noise_normalize(psy_look,res,res+n/2,sortindex[i]); #if 0 { char buf[80]; float work[n/2]; for(j=0;jcoupling_steps){ _vp_couple(k, &ci->psy_g_param, psy_look, info, vb->pcm, mag_memo, mag_sort, ilogmaskch, nonzero, ci->psy_g_param.sliding_lowpass[vb->W][k]); } /* classify and encode by submap */ for(i=0;isubmaps;i++){ int ch_in_bundle=0; long **classifications; int resnum=info->residuesubmap[i]; for(j=0;jchannels;j++){ if(info->chmuxlist[j]==i){ zerobundle[ch_in_bundle]=0; if(nonzero[j])zerobundle[ch_in_bundle]=1; res_bundle[ch_in_bundle]=vb->pcm[j]; couple_bundle[ch_in_bundle++]=vb->pcm[j]+n/2; } } classifications=_residue_P[ci->residue_type[resnum]]-> class(vb,b->residue[resnum],couple_bundle,zerobundle,ch_in_bundle); _residue_P[ci->residue_type[resnum]]-> forward(vb,b->residue[resnum], couple_bundle,NULL,zerobundle,ch_in_bundle,classifications); } /* ok, done encoding. Mark this protopacket and prepare next. */ oggpack_writealign(&vb->opb); vbi->packetblob_markers[k]=oggpack_bytes(&vb->opb); } } #if 0 seq++; total+=ci->blocksizes[vb->W]/4+ci->blocksizes[vb->nW]/4; #endif return(0); } static int mapping0_inverse(vorbis_block *vb,vorbis_info_mapping *l){ vorbis_dsp_state *vd=vb->vd; vorbis_info *vi=vd->vi; codec_setup_info *ci=vi->codec_setup; private_state *b=vd->backend_state; vorbis_info_mapping0 *info=(vorbis_info_mapping0 *)l; int hs=ci->halfrate_flag; int i,j; long n=vb->pcmend=ci->blocksizes[vb->W]; float **pcmbundle=alloca(sizeof(*pcmbundle)*vi->channels); int *zerobundle=alloca(sizeof(*zerobundle)*vi->channels); int *nonzero =alloca(sizeof(*nonzero)*vi->channels); void **floormemo=alloca(sizeof(*floormemo)*vi->channels); /* recover the spectral envelope; store it in the PCM vector for now */ for(i=0;ichannels;i++){ int submap=info->chmuxlist[i]; floormemo[i]=_floor_P[ci->floor_type[info->floorsubmap[submap]]]-> inverse1(vb,b->flr[info->floorsubmap[submap]]); if(floormemo[i]) nonzero[i]=1; else nonzero[i]=0; memset(vb->pcm[i],0,sizeof(*vb->pcm[i])*n/2); } /* channel coupling can 'dirty' the nonzero listing */ for(i=0;icoupling_steps;i++){ if(nonzero[info->coupling_mag[i]] || nonzero[info->coupling_ang[i]]){ nonzero[info->coupling_mag[i]]=1; nonzero[info->coupling_ang[i]]=1; } } /* recover the residue into our working vectors */ for(i=0;isubmaps;i++){ int ch_in_bundle=0; for(j=0;jchannels;j++){ if(info->chmuxlist[j]==i){ if(nonzero[j]) zerobundle[ch_in_bundle]=1; else zerobundle[ch_in_bundle]=0; pcmbundle[ch_in_bundle++]=vb->pcm[j]; } } _residue_P[ci->residue_type[info->residuesubmap[i]]]-> inverse(vb,b->residue[info->residuesubmap[i]], pcmbundle,zerobundle,ch_in_bundle); } /* channel coupling */ for(i=info->coupling_steps-1;i>=0;i--){ float *pcmM=vb->pcm[info->coupling_mag[i]]; float *pcmA=vb->pcm[info->coupling_ang[i]]; for(j=0;j0) if(ang>0){ pcmM[j]=mag; pcmA[j]=mag-ang; }else{ pcmA[j]=mag; pcmM[j]=mag+ang; } else if(ang>0){ pcmM[j]=mag; pcmA[j]=mag+ang; }else{ pcmA[j]=mag; pcmM[j]=mag-ang; } } } /* compute and apply spectral envelope */ for(i=0;ichannels;i++){ float *pcm=vb->pcm[i]; int submap=info->chmuxlist[i]; _floor_P[ci->floor_type[info->floorsubmap[submap]]]-> inverse2(vb,b->flr[info->floorsubmap[submap]], floormemo[i],pcm); } /* transform the PCM data; takes PCM vector, vb; modifies PCM vector */ /* only MDCT right now.... */ for(i=0;ichannels;i++){ float *pcm=vb->pcm[i]; mdct_backward(b->transform[vb->W][0],pcm,pcm); } /* all done! */ return(0); } /* export hooks */ vorbis_func_mapping mapping0_exportbundle={ &mapping0_pack, &mapping0_unpack, &mapping0_free_info, &mapping0_forward, &mapping0_inverse }; libtritonus-java-20070428/src/lib/pvorbis/masking.h0000644000175000017500000011643310167052677022063 0ustar twernertwerner/******************************************************************** * * * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 * * by the XIPHOPHORUS Company http://www.xiph.org/ * * * ******************************************************************** function: masking curve data for psychoacoustics last mod: $Id: masking.h,v 1.1 2005/01/05 21:01:51 pfisterer Exp $ ********************************************************************/ #ifndef _V_MASKING_H_ #define _V_MASKING_H_ /* more detailed ATH; the bass if flat to save stressing the floor overly for only a bin or two of savings. */ #define MAX_ATH 88 static float ATH[]={ /*15*/ -51, -52, -53, -54, -55, -56, -57, -58, /*31*/ -59, -60, -61, -62, -63, -64, -65, -66, /*63*/ -67, -68, -69, -70, -71, -72, -73, -74, /*125*/ -75, -76, -77, -78, -80, -81, -82, -83, /*250*/ -84, -85, -86, -87, -88, -88, -89, -89, /*500*/ -90, -91, -91, -92, -93, -94, -95, -96, /*1k*/ -96, -97, -98, -98, -99, -99,-100,-100, /*2k*/ -101,-102,-103,-104,-106,-107,-107,-107, /*4k*/ -107,-105,-103,-102,-101, -99, -98, -96, /*8k*/ -95, -95, -96, -97, -96, -95, -93, -90, /*16k*/ -80, -70, -50, -40, -30, -30, -30, -30 }; /* The tone masking curves from Ehmer's and Fielder's papers have been replaced by an empirically collected data set. The previously published values were, far too often, simply on crack. */ #define EHMER_OFFSET 16 #define EHMER_MAX 56 /* masking tones from -50 to 0dB, 62.5 through 16kHz at half octaves test tones from -2 octaves to +5 octaves sampled at eighth octaves */ /* (Vorbis 0dB, the loudest possible tone, is assumed to be ~100dB SPL for collection of these curves) */ static float tonemasks[P_BANDS][6][EHMER_MAX]={ /* 62.5 Hz */ {{ -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, -62, -62, -65, -73, -69, -68, -68, -67, -70, -70, -72, -74, -75, -79, -79, -80, -83, -88, -93, -100, -110, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, { -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -53, -61, -66, -66, -68, -67, -70, -76, -76, -72, -73, -75, -76, -78, -79, -83, -88, -93, -100, -110, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, { -37, -37, -37, -37, -37, -37, -37, -37, -38, -40, -42, -46, -48, -53, -55, -62, -65, -58, -56, -56, -61, -60, -65, -67, -69, -71, -77, -77, -78, -80, -82, -84, -88, -93, -98, -106, -112, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, { -25, -25, -25, -25, -25, -25, -25, -25, -25, -26, -27, -29, -32, -38, -48, -52, -52, -50, -48, -48, -51, -52, -54, -60, -67, -67, -66, -68, -69, -73, -73, -76, -80, -81, -81, -85, -85, -86, -88, -93, -100, -110, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, { -16, -16, -16, -16, -16, -16, -16, -16, -17, -19, -20, -22, -26, -28, -31, -40, -47, -39, -39, -40, -42, -43, -47, -51, -57, -52, -55, -55, -60, -58, -62, -63, -70, -67, -69, -72, -73, -77, -80, -82, -83, -87, -90, -94, -98, -104, -115, -999, -999, -999, -999, -999, -999, -999, -999, -999}, { -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -10, -11, -15, -19, -25, -30, -34, -31, -30, -31, -29, -32, -35, -42, -48, -42, -44, -46, -50, -50, -51, -52, -59, -54, -55, -55, -58, -62, -63, -66, -72, -73, -76, -75, -78, -80, -80, -81, -84, -88, -90, -94, -98, -101, -106, -110}}, /* 88Hz */ {{ -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -67, -67, -67, -76, -72, -71, -74, -76, -76, -75, -78, -79, -79, -81, -83, -86, -89, -93, -97, -100, -105, -110, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, { -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -48, -51, -55, -59, -66, -66, -66, -67, -66, -68, -69, -70, -74, -79, -77, -77, -78, -80, -81, -82, -84, -86, -88, -91, -95, -100, -108, -116, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, { -36, -36, -36, -36, -36, -36, -36, -36, -36, -37, -37, -41, -44, -48, -51, -58, -62, -60, -57, -59, -59, -60, -63, -65, -72, -71, -70, -72, -74, -77, -76, -78, -81, -81, -80, -83, -86, -91, -96, -100, -105, -110, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, { -28, -28, -28, -28, -28, -28, -28, -28, -28, -30, -32, -32, -33, -35, -41, -49, -50, -49, -47, -48, -48, -52, -51, -57, -65, -61, -59, -61, -64, -69, -70, -74, -77, -77, -78, -81, -84, -85, -87, -90, -92, -96, -100, -107, -112, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, { -19, -19, -19, -19, -19, -19, -19, -19, -20, -21, -23, -27, -30, -35, -36, -41, -46, -44, -42, -40, -41, -41, -43, -48, -55, -53, -52, -53, -56, -59, -58, -60, -67, -66, -69, -71, -72, -75, -79, -81, -84, -87, -90, -93, -97, -101, -107, -114, -999, -999, -999, -999, -999, -999, -999, -999}, { -9, -9, -9, -9, -9, -9, -9, -9, -11, -12, -12, -15, -16, -20, -23, -30, -37, -34, -33, -34, -31, -32, -32, -38, -47, -44, -41, -40, -47, -49, -46, -46, -58, -50, -50, -54, -58, -62, -64, -67, -67, -70, -72, -76, -79, -83, -87, -91, -96, -100, -104, -110, -999, -999, -999, -999}}, /* 125 Hz */ {{ -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -63, -64, -66, -67, -66, -68, -75, -72, -76, -75, -76, -78, -79, -82, -84, -85, -90, -94, -101, -110, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, { -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -60, -60, -61, -63, -66, -71, -68, -70, -70, -71, -72, -72, -75, -81, -78, -79, -82, -83, -86, -90, -97, -103, -113, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, { -53, -53, -53, -53, -53, -53, -53, -53, -53, -54, -55, -57, -56, -57, -55, -61, -65, -60, -60, -62, -63, -63, -66, -68, -74, -73, -75, -75, -78, -80, -80, -82, -85, -90, -96, -101, -108, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, { -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -47, -47, -47, -47, -48, -51, -57, -51, -49, -50, -51, -53, -54, -59, -66, -60, -62, -67, -67, -70, -72, -75, -76, -78, -81, -85, -88, -94, -97, -104, -112, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, { -36, -36, -36, -36, -36, -36, -36, -36, -39, -41, -42, -42, -39, -38, -41, -43, -52, -44, -40, -39, -37, -37, -40, -47, -54, -50, -48, -50, -55, -61, -59, -62, -66, -66, -66, -69, -69, -73, -74, -74, -75, -77, -79, -82, -87, -91, -95, -100, -108, -115, -999, -999, -999, -999, -999, -999}, { -28, -26, -24, -22, -20, -20, -23, -29, -30, -31, -28, -27, -28, -28, -28, -35, -40, -33, -32, -29, -30, -30, -30, -37, -45, -41, -37, -38, -45, -47, -47, -48, -53, -49, -48, -50, -49, -49, -51, -52, -58, -56, -57, -56, -60, -61, -62, -70, -72, -74, -78, -83, -88, -93, -100, -106}}, /* 177 Hz */ {{-999, -999, -999, -999, -999, -999, -999, -999, -999, -110, -105, -100, -95, -91, -87, -83, -80, -78, -76, -78, -78, -81, -83, -85, -86, -85, -86, -87, -90, -97, -107, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -110, -105, -100, -95, -90, -85, -81, -77, -73, -70, -67, -67, -68, -75, -73, -70, -69, -70, -72, -75, -79, -84, -83, -84, -86, -88, -89, -89, -93, -98, -105, -112, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-105, -100, -95, -90, -85, -80, -76, -71, -68, -68, -65, -63, -63, -62, -62, -64, -65, -64, -61, -62, -63, -64, -66, -68, -73, -73, -74, -75, -76, -81, -83, -85, -88, -89, -92, -95, -100, -108, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, { -80, -75, -71, -68, -65, -63, -62, -61, -61, -61, -61, -59, -56, -57, -53, -50, -58, -52, -50, -50, -52, -53, -54, -58, -67, -63, -67, -68, -72, -75, -78, -80, -81, -81, -82, -85, -89, -90, -93, -97, -101, -107, -114, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, { -65, -61, -59, -57, -56, -55, -55, -56, -56, -57, -55, -53, -52, -47, -44, -44, -50, -44, -41, -39, -39, -42, -40, -46, -51, -49, -50, -53, -54, -63, -60, -61, -62, -66, -66, -66, -70, -73, -74, -75, -76, -75, -79, -85, -89, -91, -96, -102, -110, -999, -999, -999, -999, -999, -999, -999}, { -52, -50, -49, -49, -48, -48, -48, -49, -50, -50, -49, -46, -43, -39, -35, -33, -38, -36, -32, -29, -32, -32, -32, -35, -44, -39, -38, -38, -46, -50, -45, -46, -53, -50, -50, -50, -54, -54, -53, -53, -56, -57, -59, -66, -70, -72, -74, -79, -83, -85, -90, -97, -114, -999, -999, -999}}, /* 250 Hz */ {{-999, -999, -999, -999, -999, -999, -110, -105, -100, -95, -90, -86, -80, -75, -75, -79, -80, -79, -80, -81, -82, -88, -95, -103, -110, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -108, -103, -98, -93, -88, -83, -79, -78, -75, -71, -67, -68, -73, -73, -72, -73, -75, -77, -80, -82, -88, -93, -100, -107, -114, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -110, -105, -101, -96, -90, -86, -81, -77, -73, -69, -66, -61, -62, -66, -64, -62, -65, -66, -70, -72, -76, -81, -80, -84, -90, -95, -102, -110, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -107, -103, -97, -92, -88, -83, -79, -74, -70, -66, -59, -53, -58, -62, -55, -54, -54, -54, -58, -61, -62, -72, -70, -72, -75, -78, -80, -81, -80, -83, -83, -88, -93, -100, -107, -115, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -105, -100, -95, -90, -85, -80, -75, -70, -66, -62, -56, -48, -44, -48, -46, -46, -43, -46, -48, -48, -51, -58, -58, -59, -60, -62, -62, -61, -61, -65, -64, -65, -68, -70, -74, -75, -78, -81, -86, -95, -110, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -105, -100, -95, -90, -85, -80, -75, -70, -65, -61, -55, -49, -39, -33, -40, -35, -32, -38, -40, -33, -35, -37, -46, -41, -45, -44, -46, -42, -45, -46, -52, -50, -50, -50, -54, -54, -55, -57, -62, -64, -66, -68, -70, -76, -81, -90, -100, -110, -999, -999, -999, -999, -999, -999}}, /* 354 hz */ {{-999, -999, -999, -999, -999, -999, -999, -999, -105, -98, -90, -85, -82, -83, -80, -78, -84, -79, -80, -83, -87, -89, -91, -93, -99, -106, -117, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -999, -999, -999, -999, -105, -98, -90, -85, -80, -75, -70, -68, -74, -72, -74, -77, -80, -82, -85, -87, -92, -89, -91, -95, -100, -106, -112, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -999, -999, -999, -999, -105, -98, -90, -83, -75, -71, -63, -64, -67, -62, -64, -67, -70, -73, -77, -81, -84, -83, -85, -89, -90, -93, -98, -104, -109, -114, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -999, -999, -999, -999, -103, -96, -88, -81, -75, -68, -58, -54, -56, -54, -56, -56, -58, -60, -63, -66, -74, -69, -72, -72, -75, -74, -77, -81, -81, -82, -84, -87, -93, -96, -99, -104, -110, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -999, -108, -102, -96, -91, -85, -80, -74, -68, -60, -51, -46, -48, -46, -43, -45, -47, -47, -49, -48, -56, -53, -55, -58, -57, -63, -58, -60, -66, -64, -67, -70, -70, -74, -77, -84, -86, -89, -91, -93, -94, -101, -109, -118, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -108, -103, -98, -93, -88, -83, -78, -73, -68, -60, -53, -44, -35, -38, -38, -34, -34, -36, -40, -41, -44, -51, -45, -46, -47, -46, -54, -50, -49, -50, -50, -50, -51, -54, -57, -58, -60, -66, -66, -66, -64, -65, -68, -77, -82, -87, -95, -110, -999, -999, -999, -999, -999}}, /* 500 Hz */ {{-999, -999, -999, -999, -999, -999, -999, -999, -107, -102, -97, -92, -87, -83, -78, -75, -82, -79, -83, -85, -89, -92, -95, -98, -101, -105, -109, -113, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -999, -999, -999, -106, -100, -95, -90, -86, -81, -78, -74, -69, -74, -74, -76, -79, -83, -84, -86, -89, -92, -97, -93, -100, -103, -107, -110, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -999, -999, -106, -100, -95, -90, -87, -83, -80, -75, -69, -60, -66, -66, -68, -70, -74, -78, -79, -81, -81, -83, -84, -87, -93, -96, -99, -103, -107, -110, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -999, -108, -103, -98, -93, -89, -85, -82, -78, -71, -62, -55, -58, -58, -54, -54, -55, -59, -61, -62, -70, -66, -66, -67, -70, -72, -75, -78, -84, -84, -84, -88, -91, -90, -95, -98, -102, -103, -106, -110, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -108, -103, -98, -94, -90, -87, -82, -79, -73, -67, -58, -47, -50, -45, -41, -45, -48, -44, -44, -49, -54, -51, -48, -47, -49, -50, -51, -57, -58, -60, -63, -69, -70, -69, -71, -74, -78, -82, -90, -95, -101, -105, -110, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -105, -101, -97, -93, -90, -85, -80, -77, -72, -65, -56, -48, -37, -40, -36, -34, -40, -50, -47, -38, -41, -47, -38, -35, -39, -38, -43, -40, -45, -50, -45, -44, -47, -50, -55, -48, -48, -52, -66, -70, -76, -82, -90, -97, -105, -110, -999, -999, -999, -999, -999, -999, -999}}, /* 707 Hz */ {{-999, -999, -999, -999, -999, -999, -999, -999, -999, -108, -103, -98, -93, -86, -79, -76, -83, -81, -85, -87, -89, -93, -98, -102, -107, -112, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -999, -999, -999, -999, -999, -108, -103, -98, -93, -86, -79, -71, -77, -74, -77, -79, -81, -84, -85, -90, -92, -93, -92, -98, -101, -108, -112, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -999, -999, -999, -999, -108, -103, -98, -93, -87, -78, -68, -65, -66, -62, -65, -67, -70, -73, -75, -78, -82, -82, -83, -84, -91, -93, -98, -102, -106, -110, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -999, -999, -999, -999, -105, -100, -95, -90, -82, -74, -62, -57, -58, -56, -51, -52, -52, -54, -54, -58, -66, -59, -60, -63, -66, -69, -73, -79, -83, -84, -80, -81, -81, -82, -88, -92, -98, -105, -113, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -999, -999, -999, -107, -102, -97, -92, -84, -79, -69, -57, -47, -52, -47, -44, -45, -50, -52, -42, -42, -53, -43, -43, -48, -51, -56, -55, -52, -57, -59, -61, -62, -67, -71, -78, -83, -86, -94, -98, -103, -110, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -999, -999, -105, -100, -95, -90, -84, -78, -70, -61, -51, -41, -40, -38, -40, -46, -52, -51, -41, -40, -46, -40, -38, -38, -41, -46, -41, -46, -47, -43, -43, -45, -41, -45, -56, -67, -68, -83, -87, -90, -95, -102, -107, -113, -999, -999, -999, -999, -999, -999, -999, -999}}, /* 1000 Hz */ {{-999, -999, -999, -999, -999, -999, -999, -999, -999, -109, -105, -101, -96, -91, -84, -77, -82, -82, -85, -89, -94, -100, -106, -110, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -999, -999, -999, -999, -999, -106, -103, -98, -92, -85, -80, -71, -75, -72, -76, -80, -84, -86, -89, -93, -100, -107, -113, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -999, -999, -999, -107, -104, -101, -97, -92, -88, -84, -80, -64, -66, -63, -64, -66, -69, -73, -77, -83, -83, -86, -91, -98, -104, -111, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -999, -999, -999, -107, -104, -101, -97, -92, -90, -84, -74, -57, -58, -52, -55, -54, -50, -52, -50, -52, -63, -62, -69, -76, -77, -78, -78, -79, -82, -88, -94, -100, -106, -111, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -999, -999, -106, -102, -98, -95, -90, -85, -83, -78, -70, -50, -50, -41, -44, -49, -47, -50, -50, -44, -55, -46, -47, -48, -48, -54, -49, -49, -58, -62, -71, -81, -87, -92, -97, -102, -108, -114, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -999, -999, -106, -102, -98, -95, -90, -85, -83, -78, -70, -45, -43, -41, -47, -50, -51, -50, -49, -45, -47, -41, -44, -41, -39, -43, -38, -37, -40, -41, -44, -50, -58, -65, -73, -79, -85, -92, -97, -101, -105, -109, -113, -999, -999, -999, -999, -999, -999, -999, -999, -999}}, /* 1414 Hz */ {{-999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -107, -100, -95, -87, -81, -85, -83, -88, -93, -100, -107, -114, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -107, -101, -95, -88, -83, -76, -73, -72, -79, -84, -90, -95, -100, -105, -110, -115, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -104, -98, -92, -87, -81, -70, -65, -62, -67, -71, -74, -80, -85, -91, -95, -99, -103, -108, -111, -114, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -103, -97, -90, -85, -76, -60, -56, -54, -60, -62, -61, -56, -63, -65, -73, -74, -77, -75, -78, -81, -86, -87, -88, -91, -94, -98, -103, -110, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -999, -999, -999, -105, -100, -97, -92, -86, -81, -79, -70, -57, -51, -47, -51, -58, -60, -56, -53, -50, -58, -52, -50, -50, -53, -55, -64, -69, -71, -85, -82, -78, -81, -85, -95, -102, -112, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -999, -999, -999, -105, -100, -97, -92, -85, -83, -79, -72, -49, -40, -43, -43, -54, -56, -51, -50, -40, -43, -38, -36, -35, -37, -38, -37, -44, -54, -60, -57, -60, -70, -75, -84, -92, -103, -112, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}}, /* 2000 Hz */ {{-999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -110, -102, -95, -89, -82, -83, -84, -90, -92, -99, -107, -113, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -107, -101, -95, -89, -83, -72, -74, -78, -85, -88, -88, -90, -92, -98, -105, -111, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -999, -999, -999, -999, -999, -109, -103, -97, -93, -87, -81, -70, -70, -67, -75, -73, -76, -79, -81, -83, -88, -89, -97, -103, -110, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -999, -999, -999, -999, -999, -107, -100, -94, -88, -83, -75, -63, -59, -59, -63, -66, -60, -62, -67, -67, -77, -76, -81, -88, -86, -92, -96, -102, -109, -116, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -999, -999, -999, -999, -999, -105, -98, -92, -86, -81, -73, -56, -52, -47, -55, -60, -58, -52, -51, -45, -49, -50, -53, -54, -61, -71, -70, -69, -78, -79, -87, -90, -96, -104, -112, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -999, -999, -999, -999, -999, -103, -96, -90, -86, -78, -70, -51, -42, -47, -48, -55, -54, -54, -53, -42, -35, -28, -33, -38, -37, -44, -47, -49, -54, -63, -68, -78, -82, -89, -94, -99, -104, -109, -114, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}}, /* 2828 Hz */ {{-999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -110, -100, -90, -79, -85, -81, -82, -82, -89, -94, -99, -103, -109, -115, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -105, -97, -85, -72, -74, -70, -70, -70, -76, -85, -91, -93, -97, -103, -109, -115, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -112, -93, -81, -68, -62, -60, -60, -57, -63, -70, -77, -82, -90, -93, -98, -104, -109, -113, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -113, -100, -93, -84, -63, -58, -48, -53, -54, -52, -52, -57, -64, -66, -76, -83, -81, -85, -85, -90, -95, -98, -101, -103, -106, -108, -111, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -105, -95, -86, -74, -53, -50, -38, -43, -49, -43, -42, -39, -39, -46, -52, -57, -56, -72, -69, -74, -81, -87, -92, -94, -97, -99, -102, -105, -108, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -108, -99, -90, -76, -66, -45, -43, -41, -44, -47, -43, -47, -40, -30, -31, -31, -39, -33, -40, -41, -43, -53, -59, -70, -73, -77, -79, -82, -84, -87, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}}, /* 4000 Hz */ {{-999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -110, -91, -76, -75, -85, -93, -98, -104, -110, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -110, -91, -70, -70, -75, -86, -89, -94, -98, -101, -106, -110, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -110, -95, -80, -60, -65, -64, -74, -83, -88, -91, -95, -99, -103, -107, -110, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -110, -95, -80, -58, -55, -49, -66, -68, -71, -78, -78, -80, -88, -85, -89, -97, -100, -105, -110, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -110, -95, -80, -53, -52, -41, -59, -59, -49, -58, -56, -63, -86, -79, -90, -93, -98, -103, -107, -112, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -110, -97, -91, -73, -45, -40, -33, -53, -61, -49, -54, -50, -50, -60, -52, -67, -74, -81, -92, -96, -100, -105, -110, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}}, /* 5657 Hz */ {{-999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -113, -106, -99, -92, -77, -80, -88, -97, -106, -115, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -116, -109, -102, -95, -89, -74, -72, -88, -87, -95, -102, -109, -116, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -116, -109, -102, -95, -89, -75, -66, -74, -77, -78, -86, -87, -90, -96, -105, -115, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -115, -108, -101, -94, -88, -66, -56, -61, -70, -65, -78, -72, -83, -84, -93, -98, -105, -110, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -110, -105, -95, -89, -82, -57, -52, -52, -59, -56, -59, -58, -69, -67, -88, -82, -82, -89, -94, -100, -108, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -999, -999, -999, -999, -999, -110, -101, -96, -90, -83, -77, -54, -43, -38, -50, -48, -52, -48, -42, -42, -51, -52, -53, -59, -65, -71, -78, -85, -95, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}}, /* 8000 Hz */ {{-999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -120, -105, -86, -68, -78, -79, -90, -100, -110, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -120, -105, -86, -66, -73, -77, -88, -96, -105, -115, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -120, -105, -92, -80, -61, -64, -68, -80, -87, -92, -100, -110, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -120, -104, -91, -79, -52, -60, -54, -64, -69, -77, -80, -82, -84, -85, -87, -88, -90, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -118, -100, -87, -77, -49, -50, -44, -58, -61, -61, -67, -65, -62, -62, -62, -65, -68, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -115, -98, -84, -62, -49, -44, -38, -46, -49, -49, -46, -39, -37, -39, -40, -42, -43, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}}, /* 11314 Hz */ {{-999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -110, -88, -74, -77, -82, -82, -85, -90, -94, -99, -104, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -110, -88, -66, -70, -81, -80, -81, -84, -88, -91, -93, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -110, -88, -61, -63, -70, -71, -74, -77, -80, -83, -85, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -110, -86, -62, -63, -62, -62, -58, -52, -50, -50, -52, -54, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -118, -108, -84, -53, -50, -50, -50, -55, -47, -45, -40, -40, -40, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -118, -100, -73, -43, -37, -42, -43, -53, -38, -37, -35, -35, -38, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}}, /* 16000 Hz */ {{-999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -110, -100, -91, -84, -74, -80, -80, -80, -80, -80, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -110, -100, -91, -84, -74, -68, -68, -68, -68, -68, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -110, -100, -86, -78, -70, -60, -45, -30, -21, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -110, -100, -87, -78, -67, -48, -38, -29, -21, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -110, -100, -86, -69, -56, -45, -35, -33, -29, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -110, -100, -83, -71, -48, -27, -38, -37, -34, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}} }; #endif libtritonus-java-20070428/src/lib/pvorbis/mdct.c0000644000175000017500000003453710167052677021360 0ustar twernertwerner/******************************************************************** * * * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 * * by the XIPHOPHORUS Company http://www.xiph.org/ * * * ******************************************************************** function: normalized modified discrete cosine transform power of two length transform only [64 <= n ] last mod: $Id: mdct.c,v 1.1 2005/01/05 21:01:51 pfisterer Exp $ Original algorithm adapted long ago from _The use of multirate filter banks for coding of high quality digital audio_, by T. Sporer, K. Brandenburg and B. Edler, collection of the European Signal Processing Conference (EUSIPCO), Amsterdam, June 1992, Vol.1, pp 211-214 The below code implements an algorithm that no longer looks much like that presented in the paper, but the basic structure remains if you dig deep enough to see it. This module DOES NOT INCLUDE code to generate/apply the window function. Everybody has their own weird favorite including me... I happen to like the properties of y=sin(.5PI*sin^2(x)), but others may vehemently disagree. ********************************************************************/ /* this can also be run as an integer transform by uncommenting a define in mdct.h; the integerization is a first pass and although it's likely stable for Vorbis, the dynamic range is constrained and roundoff isn't done (so it's noisy). Consider it functional, but only a starting point. There's no point on a machine with an FPU */ #include #include #include #include #include "vorbis/codec.h" #include "mdct.h" #include "os.h" #include "misc.h" /* build lookups for trig functions; also pre-figure scaling and some window function algebra. */ void mdct_init(mdct_lookup *lookup,int n){ int *bitrev=_ogg_malloc(sizeof(*bitrev)*(n/4)); DATA_TYPE *T=_ogg_malloc(sizeof(*T)*(n+n/4)); int i; int n2=n>>1; int log2n=lookup->log2n=rint(log((float)n)/log(2.f)); lookup->n=n; lookup->trig=T; lookup->bitrev=bitrev; /* trig lookups... */ for(i=0;i>j;j++) if((msb>>j)&i)acc|=1<scale=FLOAT_CONV(4.f/n); } /* 8 point butterfly (in place, 4 register) */ STIN void mdct_butterfly_8(DATA_TYPE *x){ REG_TYPE r0 = x[6] + x[2]; REG_TYPE r1 = x[6] - x[2]; REG_TYPE r2 = x[4] + x[0]; REG_TYPE r3 = x[4] - x[0]; x[6] = r0 + r2; x[4] = r0 - r2; r0 = x[5] - x[1]; r2 = x[7] - x[3]; x[0] = r1 + r0; x[2] = r1 - r0; r0 = x[5] + x[1]; r1 = x[7] + x[3]; x[3] = r2 + r3; x[1] = r2 - r3; x[7] = r1 + r0; x[5] = r1 - r0; } /* 16 point butterfly (in place, 4 register) */ STIN void mdct_butterfly_16(DATA_TYPE *x){ REG_TYPE r0 = x[1] - x[9]; REG_TYPE r1 = x[0] - x[8]; x[8] += x[0]; x[9] += x[1]; x[0] = MULT_NORM((r0 + r1) * cPI2_8); x[1] = MULT_NORM((r0 - r1) * cPI2_8); r0 = x[3] - x[11]; r1 = x[10] - x[2]; x[10] += x[2]; x[11] += x[3]; x[2] = r0; x[3] = r1; r0 = x[12] - x[4]; r1 = x[13] - x[5]; x[12] += x[4]; x[13] += x[5]; x[4] = MULT_NORM((r0 - r1) * cPI2_8); x[5] = MULT_NORM((r0 + r1) * cPI2_8); r0 = x[14] - x[6]; r1 = x[15] - x[7]; x[14] += x[6]; x[15] += x[7]; x[6] = r0; x[7] = r1; mdct_butterfly_8(x); mdct_butterfly_8(x+8); } /* 32 point butterfly (in place, 4 register) */ STIN void mdct_butterfly_32(DATA_TYPE *x){ REG_TYPE r0 = x[30] - x[14]; REG_TYPE r1 = x[31] - x[15]; x[30] += x[14]; x[31] += x[15]; x[14] = r0; x[15] = r1; r0 = x[28] - x[12]; r1 = x[29] - x[13]; x[28] += x[12]; x[29] += x[13]; x[12] = MULT_NORM( r0 * cPI1_8 - r1 * cPI3_8 ); x[13] = MULT_NORM( r0 * cPI3_8 + r1 * cPI1_8 ); r0 = x[26] - x[10]; r1 = x[27] - x[11]; x[26] += x[10]; x[27] += x[11]; x[10] = MULT_NORM(( r0 - r1 ) * cPI2_8); x[11] = MULT_NORM(( r0 + r1 ) * cPI2_8); r0 = x[24] - x[8]; r1 = x[25] - x[9]; x[24] += x[8]; x[25] += x[9]; x[8] = MULT_NORM( r0 * cPI3_8 - r1 * cPI1_8 ); x[9] = MULT_NORM( r1 * cPI3_8 + r0 * cPI1_8 ); r0 = x[22] - x[6]; r1 = x[7] - x[23]; x[22] += x[6]; x[23] += x[7]; x[6] = r1; x[7] = r0; r0 = x[4] - x[20]; r1 = x[5] - x[21]; x[20] += x[4]; x[21] += x[5]; x[4] = MULT_NORM( r1 * cPI1_8 + r0 * cPI3_8 ); x[5] = MULT_NORM( r1 * cPI3_8 - r0 * cPI1_8 ); r0 = x[2] - x[18]; r1 = x[3] - x[19]; x[18] += x[2]; x[19] += x[3]; x[2] = MULT_NORM(( r1 + r0 ) * cPI2_8); x[3] = MULT_NORM(( r1 - r0 ) * cPI2_8); r0 = x[0] - x[16]; r1 = x[1] - x[17]; x[16] += x[0]; x[17] += x[1]; x[0] = MULT_NORM( r1 * cPI3_8 + r0 * cPI1_8 ); x[1] = MULT_NORM( r1 * cPI1_8 - r0 * cPI3_8 ); mdct_butterfly_16(x); mdct_butterfly_16(x+16); } /* N point first stage butterfly (in place, 2 register) */ STIN void mdct_butterfly_first(DATA_TYPE *T, DATA_TYPE *x, int points){ DATA_TYPE *x1 = x + points - 8; DATA_TYPE *x2 = x + (points>>1) - 8; REG_TYPE r0; REG_TYPE r1; do{ r0 = x1[6] - x2[6]; r1 = x1[7] - x2[7]; x1[6] += x2[6]; x1[7] += x2[7]; x2[6] = MULT_NORM(r1 * T[1] + r0 * T[0]); x2[7] = MULT_NORM(r1 * T[0] - r0 * T[1]); r0 = x1[4] - x2[4]; r1 = x1[5] - x2[5]; x1[4] += x2[4]; x1[5] += x2[5]; x2[4] = MULT_NORM(r1 * T[5] + r0 * T[4]); x2[5] = MULT_NORM(r1 * T[4] - r0 * T[5]); r0 = x1[2] - x2[2]; r1 = x1[3] - x2[3]; x1[2] += x2[2]; x1[3] += x2[3]; x2[2] = MULT_NORM(r1 * T[9] + r0 * T[8]); x2[3] = MULT_NORM(r1 * T[8] - r0 * T[9]); r0 = x1[0] - x2[0]; r1 = x1[1] - x2[1]; x1[0] += x2[0]; x1[1] += x2[1]; x2[0] = MULT_NORM(r1 * T[13] + r0 * T[12]); x2[1] = MULT_NORM(r1 * T[12] - r0 * T[13]); x1-=8; x2-=8; T+=16; }while(x2>=x); } /* N/stage point generic N stage butterfly (in place, 2 register) */ STIN void mdct_butterfly_generic(DATA_TYPE *T, DATA_TYPE *x, int points, int trigint){ DATA_TYPE *x1 = x + points - 8; DATA_TYPE *x2 = x + (points>>1) - 8; REG_TYPE r0; REG_TYPE r1; do{ r0 = x1[6] - x2[6]; r1 = x1[7] - x2[7]; x1[6] += x2[6]; x1[7] += x2[7]; x2[6] = MULT_NORM(r1 * T[1] + r0 * T[0]); x2[7] = MULT_NORM(r1 * T[0] - r0 * T[1]); T+=trigint; r0 = x1[4] - x2[4]; r1 = x1[5] - x2[5]; x1[4] += x2[4]; x1[5] += x2[5]; x2[4] = MULT_NORM(r1 * T[1] + r0 * T[0]); x2[5] = MULT_NORM(r1 * T[0] - r0 * T[1]); T+=trigint; r0 = x1[2] - x2[2]; r1 = x1[3] - x2[3]; x1[2] += x2[2]; x1[3] += x2[3]; x2[2] = MULT_NORM(r1 * T[1] + r0 * T[0]); x2[3] = MULT_NORM(r1 * T[0] - r0 * T[1]); T+=trigint; r0 = x1[0] - x2[0]; r1 = x1[1] - x2[1]; x1[0] += x2[0]; x1[1] += x2[1]; x2[0] = MULT_NORM(r1 * T[1] + r0 * T[0]); x2[1] = MULT_NORM(r1 * T[0] - r0 * T[1]); T+=trigint; x1-=8; x2-=8; }while(x2>=x); } STIN void mdct_butterflies(mdct_lookup *init, DATA_TYPE *x, int points){ DATA_TYPE *T=init->trig; int stages=init->log2n-5; int i,j; if(--stages>0){ mdct_butterfly_first(T,x,points); } for(i=1;--stages>0;i++){ for(j=0;j<(1<>i)*j,points>>i,4<trig)_ogg_free(l->trig); if(l->bitrev)_ogg_free(l->bitrev); memset(l,0,sizeof(*l)); } } STIN void mdct_bitreverse(mdct_lookup *init, DATA_TYPE *x){ int n = init->n; int *bit = init->bitrev; DATA_TYPE *w0 = x; DATA_TYPE *w1 = x = w0+(n>>1); DATA_TYPE *T = init->trig+n; do{ DATA_TYPE *x0 = x+bit[0]; DATA_TYPE *x1 = x+bit[1]; REG_TYPE r0 = x0[1] - x1[1]; REG_TYPE r1 = x0[0] + x1[0]; REG_TYPE r2 = MULT_NORM(r1 * T[0] + r0 * T[1]); REG_TYPE r3 = MULT_NORM(r1 * T[1] - r0 * T[0]); w1 -= 4; r0 = HALVE(x0[1] + x1[1]); r1 = HALVE(x0[0] - x1[0]); w0[0] = r0 + r2; w1[2] = r0 - r2; w0[1] = r1 + r3; w1[3] = r3 - r1; x0 = x+bit[2]; x1 = x+bit[3]; r0 = x0[1] - x1[1]; r1 = x0[0] + x1[0]; r2 = MULT_NORM(r1 * T[2] + r0 * T[3]); r3 = MULT_NORM(r1 * T[3] - r0 * T[2]); r0 = HALVE(x0[1] + x1[1]); r1 = HALVE(x0[0] - x1[0]); w0[2] = r0 + r2; w1[0] = r0 - r2; w0[3] = r1 + r3; w1[1] = r3 - r1; T += 4; bit += 4; w0 += 4; }while(w0n; int n2=n>>1; int n4=n>>2; /* rotate */ DATA_TYPE *iX = in+n2-7; DATA_TYPE *oX = out+n2+n4; DATA_TYPE *T = init->trig+n4; do{ oX -= 4; oX[0] = MULT_NORM(-iX[2] * T[3] - iX[0] * T[2]); oX[1] = MULT_NORM (iX[0] * T[3] - iX[2] * T[2]); oX[2] = MULT_NORM(-iX[6] * T[1] - iX[4] * T[0]); oX[3] = MULT_NORM (iX[4] * T[1] - iX[6] * T[0]); iX -= 8; T += 4; }while(iX>=in); iX = in+n2-8; oX = out+n2+n4; T = init->trig+n4; do{ T -= 4; oX[0] = MULT_NORM (iX[4] * T[3] + iX[6] * T[2]); oX[1] = MULT_NORM (iX[4] * T[2] - iX[6] * T[3]); oX[2] = MULT_NORM (iX[0] * T[1] + iX[2] * T[0]); oX[3] = MULT_NORM (iX[0] * T[0] - iX[2] * T[1]); iX -= 8; oX += 4; }while(iX>=in); mdct_butterflies(init,out+n2,n2); mdct_bitreverse(init,out); /* roatate + window */ { DATA_TYPE *oX1=out+n2+n4; DATA_TYPE *oX2=out+n2+n4; DATA_TYPE *iX =out; T =init->trig+n2; do{ oX1-=4; oX1[3] = MULT_NORM (iX[0] * T[1] - iX[1] * T[0]); oX2[0] = -MULT_NORM (iX[0] * T[0] + iX[1] * T[1]); oX1[2] = MULT_NORM (iX[2] * T[3] - iX[3] * T[2]); oX2[1] = -MULT_NORM (iX[2] * T[2] + iX[3] * T[3]); oX1[1] = MULT_NORM (iX[4] * T[5] - iX[5] * T[4]); oX2[2] = -MULT_NORM (iX[4] * T[4] + iX[5] * T[5]); oX1[0] = MULT_NORM (iX[6] * T[7] - iX[7] * T[6]); oX2[3] = -MULT_NORM (iX[6] * T[6] + iX[7] * T[7]); oX2+=4; iX += 8; T += 8; }while(iXoX2); } } void mdct_forward(mdct_lookup *init, DATA_TYPE *in, DATA_TYPE *out){ int n=init->n; int n2=n>>1; int n4=n>>2; int n8=n>>3; DATA_TYPE *w=alloca(n*sizeof(*w)); /* forward needs working space */ DATA_TYPE *w2=w+n2; /* rotate */ /* window + rotate + step 1 */ REG_TYPE r0; REG_TYPE r1; DATA_TYPE *x0=in+n2+n4; DATA_TYPE *x1=x0+1; DATA_TYPE *T=init->trig+n2; int i=0; for(i=0;itrig+n2; x0=out+n2; for(i=0;iscale); x0[0] =MULT_NORM((w[0]*T[1]-w[1]*T[0])*init->scale); w+=2; T+=2; } } libtritonus-java-20070428/src/lib/pvorbis/mdct.h0000644000175000017500000000376210167052677021361 0ustar twernertwerner/******************************************************************** * * * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 * * by the XIPHOPHORUS Company http://www.xiph.org/ * * * ******************************************************************** function: modified discrete cosine transform prototypes last mod: $Id: mdct.h,v 1.1 2005/01/05 21:01:51 pfisterer Exp $ ********************************************************************/ #ifndef _OGG_mdct_H_ #define _OGG_mdct_H_ #include "vorbis/codec.h" /*#define MDCT_INTEGERIZED <- be warned there could be some hurt left here*/ #ifdef MDCT_INTEGERIZED #define DATA_TYPE int #define REG_TYPE register int #define TRIGBITS 14 #define cPI3_8 6270 #define cPI2_8 11585 #define cPI1_8 15137 #define FLOAT_CONV(x) ((int)((x)*(1<>TRIGBITS) #define HALVE(x) ((x)>>1) #else #define DATA_TYPE float #define REG_TYPE float #define cPI3_8 .38268343236508977175F #define cPI2_8 .70710678118654752441F #define cPI1_8 .92387953251128675613F #define FLOAT_CONV(x) (x) #define MULT_NORM(x) (x) #define HALVE(x) ((x)*.5f) #endif typedef struct { int n; int log2n; DATA_TYPE *trig; int *bitrev; DATA_TYPE scale; } mdct_lookup; extern void mdct_init(mdct_lookup *lookup,int n); extern void mdct_clear(mdct_lookup *l); extern void mdct_forward(mdct_lookup *init, DATA_TYPE *in, DATA_TYPE *out); extern void mdct_backward(mdct_lookup *init, DATA_TYPE *in, DATA_TYPE *out); #endif libtritonus-java-20070428/src/lib/pvorbis/misc.h0000644000175000017500000000343510167052677021362 0ustar twernertwerner/******************************************************************** * * * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 * * by the XIPHOPHORUS Company http://www.xiph.org/ * * * ******************************************************************** function: miscellaneous prototypes last mod: $Id: misc.h,v 1.1 2005/01/05 21:01:51 pfisterer Exp $ ********************************************************************/ #ifndef _V_RANDOM_H_ #define _V_RANDOM_H_ #include "vorbis/codec.h" extern int analysis_noisy; extern void *_vorbis_block_alloc(vorbis_block *vb,long bytes); extern void _vorbis_block_ripcord(vorbis_block *vb); extern void _analysis_output(char *base,int i,float *v,int n,int bark,int dB, ogg_int64_t off); #ifdef DEBUG_MALLOC #define _VDBG_GRAPHFILE "malloc.m" extern void *_VDBG_malloc(void *ptr,long bytes,char *file,long line); extern void _VDBG_free(void *ptr,char *file,long line); #ifndef MISC_C #undef _ogg_malloc #undef _ogg_calloc #undef _ogg_realloc #undef _ogg_free #define _ogg_malloc(x) _VDBG_malloc(NULL,(x),__FILE__,__LINE__) #define _ogg_calloc(x,y) _VDBG_malloc(NULL,(x)*(y),__FILE__,__LINE__) #define _ogg_realloc(x,y) _VDBG_malloc((x),(y),__FILE__,__LINE__) #define _ogg_free(x) _VDBG_free((x),__FILE__,__LINE__) #endif #endif #endif libtritonus-java-20070428/src/lib/pvorbis/org_tritonus_lowlevel_pogg_Buffer.c0000644000175000017500000003112110171253130027345 0ustar twernertwerner/* * org_tritonus_lowlevel_pogg_Buffer.c */ /* * Copyright (c) 2003 - 2004 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ #include "common.h" #include "org_tritonus_lowlevel_pogg_StreamState.h" HandleFieldHandlerDeclaration(handler, oggpack_buffer*) oggpack_buffer* getBufferNativeHandle(JNIEnv *env, jobject obj) { return getHandle(env, obj); } /* * Class: org_tritonus_lowlevel_pogg_Buffer * Method: malloc * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_pogg_Buffer_malloc (JNIEnv* env, jobject obj) { oggpack_buffer* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pogg_Buffer_malloc(): begin\n"); } handle = malloc(sizeof(oggpack_buffer)); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pogg_Buffer_malloc(): handle: %p\n", handle); } setHandle(env, obj, handle); nReturn = (handle == NULL) ? -1 : 0; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pogg_Buffer_malloc(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_pogg_Buffer * Method: free * Signature: ()V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_pogg_Buffer_free (JNIEnv* env, jobject obj) { oggpack_buffer* handle; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pogg_Buffer_free(): begin\n"); } handle = getHandle(env, obj); free(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pogg_Buffer_free(): end\n"); } } /* * Class: org_tritonus_lowlevel_pogg_Buffer * Method: writeInit * Signature: ()V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_pogg_Buffer_writeInit (JNIEnv* env, jobject obj) { oggpack_buffer* handle; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pogg_Buffer_writeInit(): begin\n"); } handle = getHandle(env, obj); oggpack_writeinit(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pogg_Buffer_writeInit(): end\n"); } } /* * Class: org_tritonus_lowlevel_pogg_Buffer * Method: writeTrunc * Signature: (I)V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_pogg_Buffer_writeTrunc (JNIEnv* env, jobject obj, jint nBits) { oggpack_buffer* handle; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pogg_Buffer_writeTrunc(): begin\n"); } handle = getHandle(env, obj); oggpack_writetrunc(handle, nBits); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pogg_Buffer_writeTrunc(): end\n"); } } /* * Class: org_tritonus_lowlevel_pogg_Buffer * Method: writeAlign * Signature: ()V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_pogg_Buffer_writeAlign (JNIEnv* env, jobject obj) { oggpack_buffer* handle; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pogg_Buffer_writeAlign(): begin\n"); } handle = getHandle(env, obj); oggpack_writealign(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pogg_Buffer_writeAlign(): end\n"); } } /* * Class: org_tritonus_lowlevel_pogg_Buffer * Method: writeCopy * Signature: ([BI)V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_pogg_Buffer_writeCopy (JNIEnv* env, jobject obj, jbyteArray abSource, jint nBits) { oggpack_buffer* handle; jbyte* source; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pogg_Buffer_writeCopy(): begin\n"); } handle = getHandle(env, obj); source = (*env)->GetByteArrayElements(env, abSource, NULL); oggpack_writecopy(handle, source, nBits); (*env)->ReleaseByteArrayElements(env, abSource, source, 0); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pogg_Buffer_writeCopy(): end\n"); } } /* * Class: org_tritonus_lowlevel_pogg_Buffer * Method: reset * Signature: ()V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_pogg_Buffer_reset (JNIEnv* env, jobject obj) { oggpack_buffer* handle; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pogg_Buffer_reset(): begin\n"); } handle = getHandle(env, obj); oggpack_reset(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pogg_Buffer_reset(): end\n"); } } /* * Class: org_tritonus_lowlevel_pogg_Buffer * Method: writeClear * Signature: ()V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_pogg_Buffer_writeClear (JNIEnv* env, jobject obj) { oggpack_buffer* handle; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pogg_Buffer_writeClear(): begin\n"); } handle = getHandle(env, obj); oggpack_writeclear(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pogg_Buffer_writeClear(): end\n"); } } /* * Class: org_tritonus_lowlevel_pogg_Buffer * Method: readInit * Signature: ([BI)V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_pogg_Buffer_readInit (JNIEnv* env, jobject obj, jbyteArray abBuffer, jint nBytes) { oggpack_buffer* handle; jbyte* buffer; void* buffer2; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pogg_Buffer_readInit(): begin\n"); } if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pogg_Buffer_readInit(): nBytes: %d\n", nBytes); } handle = getHandle(env, obj); buffer = (*env)->GetByteArrayElements(env, abBuffer, NULL); /* ATTENTION!! The memory allocated here is never freed! So here, we have a memory leak!!! */ buffer2 = _ogg_malloc(nBytes); if (!buffer2) { if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pogg_Buffer_readInit(): malloc failed!!!\n"); } return; } (void) memcpy(buffer2, buffer, nBytes); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pogg_Buffer_readInit(): buffer[0]: %d\n", buffer[0]); } if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pogg_Buffer_readInit(): buffer[1]: %d\n", buffer[1]); } if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pogg_Buffer_readInit(): buffer[2]: %d\n", buffer[2]); } oggpack_readinit(handle, buffer2, nBytes); (*env)->ReleaseByteArrayElements(env, abBuffer, buffer, 0); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pogg_Buffer_readInit(): end\n"); } } /* * Class: org_tritonus_lowlevel_pogg_Buffer * Method: write * Signature: (II)V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_pogg_Buffer_write (JNIEnv* env, jobject obj, jint nValue, jint nBits) { oggpack_buffer* handle; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pogg_Buffer_write(): begin\n"); } handle = getHandle(env, obj); oggpack_write(handle, nValue, nBits); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pogg_Buffer_write(): end\n"); } } /* * Class: org_tritonus_lowlevel_pogg_Buffer * Method: look * Signature: (I)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_pogg_Buffer_look (JNIEnv* env, jobject obj, jint nBits) { oggpack_buffer* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pogg_Buffer_look(): begin\n"); } handle = getHandle(env, obj); nReturn = oggpack_look(handle, nBits); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pogg_Buffer_look(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_pogg_Buffer * Method: look1 * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_pogg_Buffer_look1 (JNIEnv* env, jobject obj) { oggpack_buffer* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pogg_Buffer_look1(): begin\n"); } handle = getHandle(env, obj); nReturn = oggpack_look1(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pogg_Buffer_look1(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_pogg_Buffer * Method: adv * Signature: (I)V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_pogg_Buffer_adv (JNIEnv* env, jobject obj, jint nBits) { oggpack_buffer* handle; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pogg_Buffer_adv(): begin\n"); } handle = getHandle(env, obj); oggpack_adv(handle, nBits); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pogg_Buffer_adv(): end\n"); } } /* * Class: org_tritonus_lowlevel_pogg_Buffer * Method: adv1 * Signature: ()V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_pogg_Buffer_adv1 (JNIEnv* env, jobject obj) { oggpack_buffer* handle; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pogg_Buffer_adv1(): begin\n"); } handle = getHandle(env, obj); oggpack_adv1(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pogg_Buffer_adv1(): end\n"); } } /* * Class: org_tritonus_lowlevel_pogg_Buffer * Method: read * Signature: (I)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_pogg_Buffer_read (JNIEnv* env, jobject obj, jint nBits) { oggpack_buffer* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pogg_Buffer_read(): begin\n"); } handle = getHandle(env, obj); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pogg_Buffer_read(): bits: %d\n", nBits); } nReturn = oggpack_read(handle, nBits); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pogg_Buffer_read(): value: %d\n", nReturn); } if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pogg_Buffer_read(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_pogg_Buffer * Method: read1 * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_pogg_Buffer_read1 (JNIEnv* env, jobject obj) { oggpack_buffer* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pogg_Buffer_read1(): begin\n"); } handle = getHandle(env, obj); nReturn = oggpack_read1(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pogg_Buffer_read1(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_pogg_Buffer * Method: bytes * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_pogg_Buffer_bytes (JNIEnv* env, jobject obj) { oggpack_buffer* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pogg_Buffer_bytes(): begin\n"); } handle = getHandle(env, obj); nReturn = oggpack_bytes(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pogg_Buffer_bytes(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_pogg_Buffer * Method: bits * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_pogg_Buffer_bits (JNIEnv* env, jobject obj) { oggpack_buffer* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pogg_Buffer_bits(): begin\n"); } handle = getHandle(env, obj); nReturn = oggpack_bits(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pogg_Buffer_bits(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_pogg_Buffer * Method: getBuffer * Signature: ()[B */ JNIEXPORT jbyteArray JNICALL Java_org_tritonus_lowlevel_pogg_Buffer_getBuffer (JNIEnv* env, jobject obj) { oggpack_buffer* handle; unsigned char* buffer; int bytes; jbyteArray abBuffer; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pogg_Buffer_getBuffer(): begin\n"); } handle = getHandle(env, obj); buffer = oggpack_get_buffer(handle); bytes = oggpack_bytes(handle); abBuffer = (*env)->NewByteArray(env, bytes); (*env)->SetByteArrayRegion(env, abBuffer, 0, bytes, buffer); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pogg_Buffer_getBuffer(): end\n"); } return abBuffer; } /* * Class: org_tritonus_lowlevel_pogg_Buffer * Method: setTrace * Signature: (Z)V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_pogg_Buffer_setTrace (JNIEnv* env, jclass cls, jboolean bTrace) { debug_flag = bTrace; debug_file = stderr; } /*** org_tritonus_lowlevel_pogg_Buffer.c ***/ libtritonus-java-20070428/src/lib/pvorbis/org_tritonus_lowlevel_pogg_Packet.c0000644000175000017500000001564610201213474027362 0ustar twernertwerner/* * org_tritonus_lowlevel_pogg_Packet.c */ /* * Copyright (c) 2003 - 2005 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ #include "common.h" #include "org_tritonus_lowlevel_pogg_Packet.h" HandleFieldHandlerDeclaration(handler, ogg_packet*) ogg_packet* getPacketNativeHandle(JNIEnv *env, jobject obj) { return getHandle(env, obj); } /* * Class: org_tritonus_lowlevel_pogg_Packet * Method: malloc * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_pogg_Packet_malloc (JNIEnv* env, jobject obj) { ogg_packet* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pogg_Packet_malloc(): begin\n"); } handle = malloc(sizeof(ogg_packet)); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pogg_Packet_malloc(): handle: %p\n", handle); } if (handle != NULL) memset(handle, 0, sizeof(*handle)); setHandle(env, obj, handle); nReturn = (handle == NULL) ? -1 : 0; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pogg_Packet_malloc(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_pogg_Packet * Method: free * Signature: ()V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_pogg_Packet_free (JNIEnv* env, jobject obj) { ogg_packet* handle; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pogg_Packet_free(): begin\n"); } handle = getHandle(env, obj); free(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pogg_Packet_free(): end\n"); } } /* * Class: org_tritonus_lowlevel_pogg_Packet * Method: clear * Signature: ()V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_pogg_Packet_clear (JNIEnv* env, jobject obj) { ogg_packet* handle; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pogg_Packet_clear(): begin\n"); } handle = getHandle(env, obj); ogg_packet_clear(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pogg_Packet_clear(): end\n"); } } /* * Class: org_tritonus_lowlevel_pogg_Packet * Method: getData * Signature: ()[B */ JNIEXPORT jbyteArray JNICALL Java_org_tritonus_lowlevel_pogg_Packet_getData (JNIEnv* env, jobject obj) { ogg_packet* handle; jbyteArray abData; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pogg_Packet_getData(): begin\n"); } handle = getHandle(env, obj); if (handle->packet == NULL) return 0; abData = (*env)->NewByteArray(env, handle->bytes); (*env)->SetByteArrayRegion(env, abData, 0, handle->bytes, handle->packet); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pogg_Packet_getData(): end\n"); } return abData; } /* * Class: org_tritonus_lowlevel_pogg_Packet * Method: isBos * Signature: ()Z */ JNIEXPORT jboolean JNICALL Java_org_tritonus_lowlevel_pogg_Packet_isBos (JNIEnv* env, jobject obj) { ogg_packet* handle; jboolean bReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pogg_Packet_isBos(): begin\n"); } handle = getHandle(env, obj); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pogg_Packet_isBos(): b_o_s: %d\n", (int) handle->b_o_s); } bReturn = (handle->b_o_s != 0) ? JNI_TRUE : JNI_FALSE; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pogg_Packet_isBos(): end\n"); } return bReturn; } /* * Class: org_tritonus_lowlevel_pogg_Packet * Method: isEos * Signature: ()Z */ JNIEXPORT jboolean JNICALL Java_org_tritonus_lowlevel_pogg_Packet_isEos (JNIEnv* env, jobject obj) { ogg_packet* handle; jboolean bReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pogg_Packet_isEos(): begin\n"); } handle = getHandle(env, obj); bReturn = (handle->e_o_s != 0) ? JNI_TRUE : JNI_FALSE; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pogg_Packet_isEos(): end\n"); } return bReturn; } /* * Class: org_tritonus_lowlevel_pogg_Packet * Method: getGranulePos * Signature: ()J */ JNIEXPORT jlong JNICALL Java_org_tritonus_lowlevel_pogg_Packet_getGranulePos (JNIEnv *env, jobject obj) { ogg_packet* handle = getHandle(env, obj); return handle->granulepos; } /* * Class: org_tritonus_lowlevel_pogg_Packet * Method: getPacketNo * Signature: ()J */ JNIEXPORT jlong JNICALL Java_org_tritonus_lowlevel_pogg_Packet_getPacketNo (JNIEnv *env, jobject obj) { ogg_packet* handle = getHandle(env, obj); return handle->packetno; } /* * Class: org_tritonus_lowlevel_pogg_Packet * Method: setData * Signature: ([BI)V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_pogg_Packet_setData (JNIEnv* env, jobject obj, jbyteArray abData, jint nOffset, jint nLength) { ogg_packet* handle; jbyte* data; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pogg_Packet_setData(): begin\n"); } handle = getHandle(env, obj); data = (*env)->GetByteArrayElements(env, abData, NULL); /* ATTENTION!! The memory allocated here is not freed! So we have * a memory leak here. */ handle->packet = malloc(nLength); (void) memcpy(handle->packet, data + nOffset, nLength); (*env)->ReleaseByteArrayElements(env, abData, data, JNI_ABORT); handle->bytes = nLength; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pogg_Packet_setData(): end\n"); } } /* * Class: org_tritonus_lowlevel_pogg_Packet * Method: setFlags * Signature: (ZZJ)V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_pogg_Packet_setFlags (JNIEnv* env, jobject obj, jboolean bBos, jboolean bEos, jlong lGranulePos, jlong lPacketNo) { ogg_packet* handle; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pogg_Packet_setFlags(): begin\n"); } handle = getHandle(env, obj); handle->b_o_s = bBos; handle->e_o_s = bEos; handle->granulepos = lGranulePos; handle->packetno = lPacketNo; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pogg_Packet_setFlags(): end\n"); } } /* * Class: org_tritonus_lowlevel_pogg_Packet * Method: setTrace * Signature: (Z)V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_pogg_Packet_setTrace (JNIEnv* env, jclass cls, jboolean bTrace) { debug_flag = bTrace; debug_file = stderr; } /*** org_tritonus_lowlevel_pogg_Packet.c ***/ libtritonus-java-20070428/src/lib/pvorbis/org_tritonus_lowlevel_pvorbis_Block.c0000644000175000017500000001413610167052700027732 0ustar twernertwerner/* * org_tritonus_lowlevel_pvorbis_Block.c */ /* * Copyright (c) 2003 - 2004 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ #include "common.h" #include "org_tritonus_lowlevel_pvorbis_Block.h" HandleFieldHandlerDeclaration(handler, vorbis_block*) vorbis_block* getBlockNativeHandle(JNIEnv *env, jobject obj) { return getHandle(env, obj); } vorbis_dsp_state* getDspStateNativeHandle(JNIEnv *env, jobject obj); ogg_packet* getPacketNativeHandle(JNIEnv *env, jobject obj); /* * Class: org_tritonus_lowlevel_pvorbis_Block * Method: malloc * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_pvorbis_Block_malloc (JNIEnv* env, jobject obj) { vorbis_block* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pvorbis_Block_malloc(): begin\n"); } handle = malloc(sizeof(vorbis_block)); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pvorbis_Block_malloc(): handle: %p\n", handle); } setHandle(env, obj, handle); nReturn = (handle == NULL) ? -1 : 0; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pvorbis_Block_malloc(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_pvorbis_Block * Method: free * Signature: ()V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_pvorbis_Block_free (JNIEnv* env, jobject obj) { vorbis_block* handle; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pvorbis_Block_free(): begin\n"); } handle = getHandle(env, obj); free(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pvorbis_Block_free(): end\n"); } } /* * Class: org_tritonus_lowlevel_pvorbis_Block * Method: init_1native * Signature: (Lorg/tritonus/lowlevel/vorbis/DspState;)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_pvorbis_Block_init_1native (JNIEnv* env, jobject obj, jobject dspState) { vorbis_block* handle; vorbis_dsp_state* dspStateHandle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pvorbis_Block_init(): begin\n"); } handle = getHandle(env, obj); dspStateHandle = getDspStateNativeHandle(env, dspState); nReturn = vorbis_block_init(dspStateHandle, handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pvorbis_Block_init(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_pvorbis_Block * Method: addBlock_1native * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_pvorbis_Block_addBlock_1native (JNIEnv* env, jobject obj) { vorbis_block* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pvorbis_Block_addBlock(): begin\n"); } handle = getHandle(env, obj); nReturn = vorbis_bitrate_addblock(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pvorbis_Block_addBlock(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_pvorbis_Block * Method: analysis_1native * Signature: (Lorg/tritonus/lowlevel/ogg/Packet;)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_pvorbis_Block_analysis_1native (JNIEnv* env, jobject obj, jobject packet) { vorbis_block* handle; ogg_packet* packetHandle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pvorbis_DspState_analysis(): begin\n"); } handle = getHandle(env, obj); packetHandle = NULL; if (packet != NULL) { packetHandle = getPacketNativeHandle(env, packet); } nReturn = vorbis_analysis(handle, packetHandle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pvorbis_DspState_analysis(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_pvorbis_Block * Method: synthesis_1native * Signature: (Lorg/tritonus/lowlevel/ogg/Packet;)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_pvorbis_Block_synthesis_1native (JNIEnv* env, jobject obj, jobject packet) { vorbis_block* handle; ogg_packet* packetHandle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pvorbis_Block_synthesis(): begin\n"); } handle = getHandle(env, obj); packetHandle = NULL; if (packet != NULL) { packetHandle = getPacketNativeHandle(env, packet); } if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pvorbis_Block_synthesis(): packet handle: %p\n", packetHandle); } nReturn = vorbis_synthesis(handle, packetHandle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pvorbis_Block_synthesis(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_pvorbis_Block * Method: clear_1native * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_pvorbis_Block_clear_1native (JNIEnv* env, jobject obj) { vorbis_block* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pvorbis_Block_clear(): begin\n"); } handle = getHandle(env, obj); nReturn = vorbis_block_clear(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pvorbis_Block_clear(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_pvorbis_Block * Method: setTrace * Signature: (Z)V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_pvorbis_Block_setTrace (JNIEnv* env, jclass cls, jboolean bTrace) { debug_flag = bTrace; debug_file = stderr; } /*** org_tritonus_lowlevel_pvorbis_Block.c ***/ libtritonus-java-20070428/src/lib/pvorbis/org_tritonus_lowlevel_pvorbis_DspState.c0000644000175000017500000002710410171714041030424 0ustar twernertwerner/* * org_tritonus_lowlevel_pvorbis_DspState.c */ /* * Copyright (c) 2003 - 2004 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ #include "common.h" #include "org_tritonus_lowlevel_pvorbis_DspState.h" HandleFieldHandlerDeclaration(handler, vorbis_dsp_state*) vorbis_dsp_state* getDspStateNativeHandle(JNIEnv *env, jobject obj) { return getHandle(env, obj); } vorbis_info* getInfoNativeHandle(JNIEnv *env, jobject obj); vorbis_block* getBlockNativeHandle(JNIEnv *env, jobject obj); ogg_packet* getPacketNativeHandle(JNIEnv *env, jobject obj); /* * Class: org_tritonus_lowlevel_pvorbis_DspState * Method: malloc * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_pvorbis_DspState_malloc (JNIEnv* env, jobject obj) { vorbis_dsp_state* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pvorbis_DspState_malloc(): begin\n"); } handle = malloc(sizeof(vorbis_dsp_state)); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pvorbis_DspState_malloc(): handle: %p\n", handle); } setHandle(env, obj, handle); nReturn = (handle == NULL) ? -1 : 0; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pvorbis_DspState_malloc(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_pvorbis_DspState * Method: free * Signature: ()V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_pvorbis_DspState_free (JNIEnv* env, jobject obj) { vorbis_dsp_state* handle; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pvorbis_DspState_free(): begin\n"); } handle = getHandle(env, obj); free(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pvorbis_DspState_free(): end\n"); } } /* * Class: org_tritonus_lowlevel_pvorbis_DspState * Method: initAnalysis_native * Signature: (Lorg/tritonus/lowlevel/vorbis/Info;)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_pvorbis_DspState_initAnalysis_1native (JNIEnv* env, jobject obj, jobject info) { vorbis_dsp_state* handle; vorbis_info* infoHandle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pvorbis_DspState_initAnalysis(): begin\n"); } handle = getHandle(env, obj); infoHandle = getInfoNativeHandle(env, info); nReturn = vorbis_analysis_init(handle, infoHandle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pvorbis_DspState_initAnalysis(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_pvorbis_DspState * Method: headerOut_native * Signature: (Lorg/tritonus/lowlevel/ogg/Packet;)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_pvorbis_DspState_headerOut_1native (JNIEnv* env, jobject obj, jobject codePacket) { vorbis_dsp_state* handle; ogg_packet* codePacketHandle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pvorbis_DspState_headerOut(): begin\n"); } handle = getHandle(env, obj); codePacketHandle = getPacketNativeHandle(env, codePacket); nReturn = vorbis_analysis_headerout(handle, codePacketHandle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pvorbis_DspState_headerOut(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_pvorbis_DspState * Method: write_native * Signature: ([[FI)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_pvorbis_DspState_write_1native (JNIEnv* env, jobject obj, jobjectArray afValues, jint nValues) { vorbis_dsp_state* handle; float* bufferPointer; int nObjectArrayLength; int i; jfloatArray floatArray; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pvorbis_DspState_write(): begin\n"); } handle = getHandle(env, obj); bufferPointer = vorbis_analysis_buffer(handle, nValues)[0]; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pvorbis_DspState_write(): bufferPointer: %p\n", bufferPointer); } if (afValues != NULL) { nObjectArrayLength = (*env)->GetArrayLength(env, afValues); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pvorbis_DspState_write(): objectArray length: %d\n", nObjectArrayLength); } for (i = 0; i < nObjectArrayLength; i++) { floatArray = (jfloatArray) (*env)->GetObjectArrayElement(env, afValues, i); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pvorbis_DspState_write(): floatArray: %p\n", floatArray); } (*env)->GetFloatArrayRegion(env, floatArray, 0, nValues, bufferPointer); bufferPointer += nValues; } } nReturn = vorbis_analysis_wrote(handle, nValues); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pvorbis_DspState_write(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_pvorbis_DspState * Method: blockOut_native * Signature: (Lorg/tritonus/lowlevel/vorbis/Block;)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_pvorbis_DspState_blockOut_1native (JNIEnv* env, jobject obj, jobject block) { vorbis_dsp_state* handle; vorbis_block* blockHandle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pvorbis_DspState_blockOut(): begin\n"); } handle = getHandle(env, obj); blockHandle = getBlockNativeHandle(env, block); nReturn = vorbis_analysis_blockout(handle, blockHandle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pvorbis_DspState_blockOut(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_pvorbis_DspState * Method: flushPacket_native * Signature: (Lorg/tritonus/lowlevel/ogg/Packet;)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_pvorbis_DspState_flushPacket_1native (JNIEnv* env, jobject obj, jobject packet) { vorbis_dsp_state* handle; ogg_packet* packetHandle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pvorbis_DspState_flushPacket(): begin\n"); } handle = getHandle(env, obj); packetHandle = getPacketNativeHandle(env, packet); nReturn = vorbis_bitrate_flushpacket(handle, packetHandle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pvorbis_DspState_flushPacket(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_pvorbis_DspState * Method: initSynthesis_native * Signature: (Lorg/tritonus/lowlevel/vorbis/Info;)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_pvorbis_DspState_initSynthesis_1native (JNIEnv* env, jobject obj, jobject info) { vorbis_dsp_state* handle; vorbis_info* infoHandle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pvorbis_DspState_initSynthesis(): begin\n"); } handle = getHandle(env, obj); infoHandle = getInfoNativeHandle(env, info); nReturn = vorbis_synthesis_init(handle, infoHandle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pvorbis_DspState_initSynthesis(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_pvorbis_DspState * Method: blockIn_native * Signature: (Lorg/tritonus/lowlevel/vorbis/Block;)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_pvorbis_DspState_blockIn_1native (JNIEnv* env, jobject obj, jobject block) { vorbis_dsp_state* handle; vorbis_block* blockHandle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pvorbis_DspState_blockIn(): begin\n"); } handle = getHandle(env, obj); blockHandle = getBlockNativeHandle(env, block); nReturn = vorbis_synthesis_blockin(handle, blockHandle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pvorbis_DspState_blockIn(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_pvorbis_DspState * Method: pcmOut_native * Signature: ([[F)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_pvorbis_DspState_pcmOut_1native (JNIEnv* env, jobject obj, jobjectArray afPcm) { vorbis_dsp_state* handle; float** pcm; int nSamples; int nChannels; int nChannel; jfloatArray floatArray; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pvorbis_DspState_pcmOut(): begin\n"); } handle = getHandle(env, obj); nSamples = vorbis_synthesis_pcmout(handle, &pcm); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pvorbis_DspState_pcmOut(): samples: %d\n", nSamples); } nChannels = handle->vi->channels; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pvorbis_DspState_pcmOut(): channels: %d\n", nChannels); } for (nChannel = 0; nChannel < nChannels; nChannel++) { floatArray = (*env)->NewFloatArray(env, nSamples); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pvorbis_DspState_pcmOut(): float array: %p\n", floatArray); } if (nSamples > 0) { (*env)->SetFloatArrayRegion(env, floatArray, 0, nSamples, pcm[nChannel]); } (*env)->SetObjectArrayElement(env, afPcm, nChannel, floatArray); } if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pvorbis_DspState_pcmOut(): end\n"); } return nSamples; } /* * Class: org_tritonus_lowlevel_pvorbis_DspState * Method: read_native * Signature: (I)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_pvorbis_DspState_read_1native (JNIEnv* env, jobject obj, jint nSamples) { vorbis_dsp_state* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pvorbis_DspState_read(): begin\n"); } handle = getHandle(env, obj); nReturn = vorbis_synthesis_read(handle, nSamples); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pvorbis_DspState_read(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_pvorbis_DspState * Method: getSequence_native * Signature: ()J */ JNIEXPORT jlong JNICALL Java_org_tritonus_lowlevel_pvorbis_DspState_getSequence_1native (JNIEnv* env, jobject obj) { vorbis_dsp_state* handle; jlong lReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pvorbis_DspState_getSequence(): begin\n"); } handle = getHandle(env, obj); lReturn = handle->sequence; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pvorbis_DspState_getSequence(): end\n"); } return lReturn; } /* * Class: org_tritonus_lowlevel_pvorbis_DspState * Method: clear_native * Signature: ()V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_pvorbis_DspState_clear_1native (JNIEnv* env, jobject obj) { vorbis_dsp_state* handle; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pvorbis_DspState_clear(): begin\n"); } handle = getHandle(env, obj); vorbis_dsp_clear(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pvorbis_DspState_clear(): end\n"); } } /* * Class: org_tritonus_lowlevel_pvorbis_DspState * Method: setTrace * Signature: (Z)V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_pvorbis_DspState_setTrace (JNIEnv* env, jclass cls, jboolean bTrace) { debug_flag = bTrace; debug_file = stderr; } /*** org_tritonus_lowlevel_pvorbis_DspState.c ***/ libtritonus-java-20070428/src/lib/pvorbis/org_tritonus_lowlevel_pvorbis_Info.c0000644000175000017500000002375010171714041027573 0ustar twernertwerner/* * org_tritonus_lowlevel_pvorbis_Info.c */ /* * Copyright (c) 2003 -2004 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ #include "common.h" #include "org_tritonus_lowlevel_pvorbis_Info.h" #include "codec_internal.h" HandleFieldHandlerDeclaration(handler, vorbis_info*) vorbis_info* getInfoNativeHandle(JNIEnv *env, jobject obj) { return getHandle(env, obj); } oggpack_buffer* getBufferNativeHandle(JNIEnv *env, jobject obj); ogg_packet* getPacketNativeHandle(JNIEnv *env, jobject obj); /* * Class: org_tritonus_lowlevel_pvorbis_Info * Method: malloc * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_pvorbis_Info_malloc (JNIEnv* env, jobject obj) { vorbis_info* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pvorbis_Info_malloc(): begin\n"); } handle = malloc(sizeof(vorbis_info)); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pvorbis_Info_malloc(): handle: %p\n", handle); } setHandle(env, obj, handle); nReturn = (handle == NULL) ? -1 : 0; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pvorbis_Info_malloc(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_pvorbis_Info * Method: free * Signature: ()V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_pvorbis_Info_free (JNIEnv* env, jobject obj) { vorbis_info* handle; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pvorbis_Info_free(): begin\n"); } handle = getHandle(env, obj); free(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pvorbis_Info_free(): end\n"); } } /* * Class: org_tritonus_lowlevel_pvorbis_Info * Method: init_1native * Signature: ()V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_pvorbis_Info_init_1native (JNIEnv* env, jobject obj) { vorbis_info* handle; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pvorbis_Info_init(): begin\n"); } handle = getHandle(env, obj); vorbis_info_init(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pvorbis_Info_init(): end\n"); } } /* * Class: org_tritonus_lowlevel_pvorbis_Info * Method: clear_1native * Signature: ()V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_pvorbis_Info_clear_1native (JNIEnv* env, jobject obj) { vorbis_info* handle; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pvorbis_Info_clear(): begin\n"); } handle = getHandle(env, obj); vorbis_info_clear(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pvorbis_Info_clear(): end\n"); } } /* * Class: org_tritonus_lowlevel_pvorbis_Info * Method: getVersion_native * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_pvorbis_Info_getVersion_1native (JNIEnv* env, jobject obj) { vorbis_info* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pvorbis_Info_getVersion_1native(): begin\n"); } handle = getHandle(env, obj); nReturn = handle->version; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pvorbis_Info_getVersion_1native(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_pvorbis_Info * Method: setValues_native * Signature: (IIIIIIII)V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_pvorbis_Info_setValues_1native (JNIEnv* env, jobject obj, jint nVersion, jint nChannels, jint nRate, jint nBitrateUpper, jint nBitrateNominal, jint nBitrateLower, jint nBlocksize0, jint nBlocksize1) { vorbis_info* handle; codec_setup_info* ci; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pvorbis_Info_setValues_1native(): begin\n"); } handle = getHandle(env, obj); handle->version = nVersion; handle->channels = nChannels; handle->rate = nRate; handle->bitrate_upper = nBitrateUpper; handle->bitrate_nominal = nBitrateNominal; handle->bitrate_lower = nBitrateLower; ci = handle->codec_setup; ci->blocksizes[0] = nBlocksize0; ci->blocksizes[1] = nBlocksize1; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pvorbis_Info_setValues_1native(): end\n"); } } /* * Class: org_tritonus_lowlevel_pvorbis_Info * Method: getBlocksize_native * Signature: (I)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_pvorbis_Info_getBlocksize_1native (JNIEnv* env, jobject obj, jint nIndex) { vorbis_info* handle; int nReturn; codec_setup_info* ci; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pvorbis_Info_getBlocksize_1native(): begin\n"); } handle = getHandle(env, obj); ci = handle->codec_setup; nReturn = ci->blocksizes[nIndex]; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pvorbis_Info_getBlocksize_1native(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_pvorbis_Info * Method: getChannels_1native * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_pvorbis_Info_getChannels_1native (JNIEnv* env, jobject obj) { vorbis_info* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pvorbis_Info_getChannels(): begin\n"); } handle = getHandle(env, obj); nReturn = handle->channels; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pvorbis_Info_getChannels(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_pvorbis_Info * Method: getRate_1native * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_pvorbis_Info_getRate_1native (JNIEnv* env, jobject obj) { vorbis_info* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pvorbis_Info_getRate(): begin\n"); } handle = getHandle(env, obj); nReturn = handle->rate; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pvorbis_Info_getRate(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_pvorbis_Info * Method: getBitrateUpper_native * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_pvorbis_Info_getBitrateUpper_1native (JNIEnv* env, jobject obj) { vorbis_info* handle = getHandle(env, obj); return handle->bitrate_upper; } /* * Class: org_tritonus_lowlevel_pvorbis_Info * Method: getBitrateNominal_native * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_pvorbis_Info_getBitrateNominal_1native (JNIEnv* env, jobject obj) { vorbis_info* handle = getHandle(env, obj); return handle->bitrate_nominal; } /* * Class: org_tritonus_lowlevel_pvorbis_Info * Method: getBitrateLower_native * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_pvorbis_Info_getBitrateLower_1native (JNIEnv* env, jobject obj) { vorbis_info* handle = getHandle(env, obj); return handle->bitrate_lower; } /* * Class: org_tritonus_lowlevel_pvorbis_Info * Method: encodeInit_1native * Signature: (IIIII)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_pvorbis_Info_encodeInit_1native (JNIEnv* env, jobject obj, jint nChannels, jint nRate, jint nMaxBitrate, jint nNominalBitrate, jint nMinBitrate) { vorbis_info* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pvorbis_Info_encodeInit(): begin\n"); } handle = getHandle(env, obj); nReturn = vorbis_encode_init(handle, nChannels, nRate, nMaxBitrate, nNominalBitrate, nMinBitrate); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pvorbis_Info_encodeInit(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_pvorbis_Info * Method: encodeInitVBR_1native * Signature: (IIF)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_pvorbis_Info_encodeInitVBR_1native (JNIEnv* env, jobject obj, jint nChannels, jint nRate, jfloat fQuality) { vorbis_info* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pvorbis_Info_encodeInitVBR(): begin\n"); } handle = getHandle(env, obj); nReturn = vorbis_encode_init_vbr(handle, nChannels, nRate, fQuality); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pvorbis_Info_encodeInitVBR(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_pvorbis_Info * Method: headerIn_native * Signature: (Lorg/tritonus/lowlevel/pogg/Buffer;ILorg/tritonus/lowlevel/pogg/Packet;)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_pvorbis_Info_headerIn_1native (JNIEnv* env, jobject obj, jobject buffer, jint nPacketType, jobject packet) { vorbis_info* handle; oggpack_buffer* bufferHandle; ogg_packet* packetHandle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pvorbis_Info_headerIn(): begin\n"); } handle = getHandle(env, obj); bufferHandle = getBufferNativeHandle(env, buffer); packetHandle = getPacketNativeHandle(env, packet); nReturn = vorbis_synthesis_headerin(handle, bufferHandle, nPacketType, packetHandle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_pvorbis_Info_headerIn(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_pvorbis_Info * Method: setTrace * Signature: (Z)V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_pvorbis_Info_setTrace (JNIEnv* env, jclass cls, jboolean bTrace) { debug_flag = bTrace; debug_file = stderr; } /*** org_tritonus_lowlevel_pvorbis_Info.c ***/ libtritonus-java-20070428/src/lib/pvorbis/os.h0000644000175000017500000000713210171253130021024 0ustar twernertwerner#ifndef _OS_H #define _OS_H /******************************************************************** * * * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 * * by the XIPHOPHORUS Company http://www.xiph.org/ * * * ******************************************************************** function: #ifdef jail to whip a few platforms into the UNIX ideal. last mod: $Id: os.h,v 1.2 2005/01/12 16:54:48 pfisterer Exp $ ********************************************************************/ #include #include "ogg/os_types.h" #include "misc.h" #ifndef _V_IFDEFJAIL_H_ # define _V_IFDEFJAIL_H_ # ifdef __GNUC__ # define STIN static __inline__ # elif _WIN32 # define STIN static __inline # else # define STIN static # endif #ifdef DJGPP # define rint(x) (floor((x)+0.5f)) #endif #ifndef M_PI # define M_PI (3.1415926536f) #endif #ifdef _WIN32 # include # define rint(x) (floor((x)+0.5f)) # define NO_FLOAT_MATH_LIB # define FAST_HYPOT(a, b) sqrt((a)*(a) + (b)*(b)) #endif #ifndef FAST_HYPOT # define FAST_HYPOT hypot #endif #endif #ifdef HAVE_ALLOCA_H # include #endif #ifdef USE_MEMORY_H # include #endif #ifndef min # define min(x,y) ((x)>(y)?(y):(x)) #endif #ifndef max # define max(x,y) ((x)<(y)?(y):(x)) #endif #if defined(__i386__) && defined(__GNUC__) && !defined(__BEOS__) # define VORBIS_FPU_CONTROL /* both GCC and MSVC are kinda stupid about rounding/casting to int. Because of encapsulation constraints (GCC can't see inside the asm block and so we end up doing stupid things like a store/load that is collectively a noop), we do it this way */ /* we must set up the fpu before this works!! */ typedef ogg_int16_t vorbis_fpu_control; static inline void vorbis_fpu_setround(vorbis_fpu_control *fpu){ ogg_int16_t ret; ogg_int16_t temp; __asm__ __volatile__("fnstcw %0\n\t" "movw %0,%%dx\n\t" "orw $62463,%%dx\n\t" "movw %%dx,%1\n\t" "fldcw %1\n\t":"=m"(ret):"m"(temp): "dx"); *fpu=ret; } static inline void vorbis_fpu_restore(vorbis_fpu_control fpu){ __asm__ __volatile__("fldcw %0":: "m"(fpu)); } /* assumes the FPU is in round mode! */ static inline int vorbis_ftoi(double f){ /* yes, double! Otherwise, we get extra fst/fld to truncate precision */ int i; __asm__("fistl %0": "=m"(i) : "t"(f)); return(i); } #endif #if defined(_WIN32) && !defined(__GNUC__) && !defined(__BORLANDC__) # define VORBIS_FPU_CONTROL typedef ogg_int16_t vorbis_fpu_control; static __inline int vorbis_ftoi(double f){ int i; __asm{ fld f fistp i } return i; } static __inline void vorbis_fpu_setround(vorbis_fpu_control *fpu){ } static __inline void vorbis_fpu_restore(vorbis_fpu_control fpu){ } #endif #ifndef VORBIS_FPU_CONTROL typedef int vorbis_fpu_control; static int vorbis_ftoi(double f){ return (int)(f+.5); } /* We don't have special code for this compiler/arch, so do it the slow way */ # define vorbis_fpu_setround(vorbis_fpu_control) {} # define vorbis_fpu_restore(vorbis_fpu_control) {} #endif #endif /* _OS_H */ libtritonus-java-20070428/src/lib/pvorbis/psy.c0000644000175000017500000007273610167052700021232 0ustar twernertwerner/******************************************************************** * * * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 * * by the XIPHOPHORUS Company http://www.xiph.org/ * * * ******************************************************************** function: psychoacoustics not including preecho last mod: $Id: psy.c,v 1.1 2005/01/05 21:01:52 pfisterer Exp $ ********************************************************************/ #include #include #include #include "vorbis/codec.h" #include "codec_internal.h" #include "masking.h" #include "psy.h" #include "os.h" #include "lpc.h" #include "smallft.h" #include "scales.h" #include "misc.h" #define NEGINF -9999.f static double stereo_threshholds[]={0.0, .5, 1.0, 1.5, 2.5, 4.5, 8.5, 16.5, 9e10}; vorbis_look_psy_global *_vp_global_look(vorbis_info *vi){ codec_setup_info *ci=vi->codec_setup; vorbis_info_psy_global *gi=&ci->psy_g_param; vorbis_look_psy_global *look=_ogg_calloc(1,sizeof(*look)); look->channels=vi->channels; look->ampmax=-9999.; look->gi=gi; return(look); } void _vp_global_free(vorbis_look_psy_global *look){ if(look){ memset(look,0,sizeof(*look)); _ogg_free(look); } } void _vi_gpsy_free(vorbis_info_psy_global *i){ if(i){ memset(i,0,sizeof(*i)); _ogg_free(i); } } void _vi_psy_free(vorbis_info_psy *i){ if(i){ memset(i,0,sizeof(*i)); _ogg_free(i); } } static void min_curve(float *c, float *c2){ int i; for(i=0;ic[i])c[i]=c2[i]; } static void attenuate_curve(float *c,float att){ int i; for(i=0;iATH[j+k+ath_offset])min=ATH[j+k+ath_offset]; }else{ if(min>ATH[MAX_ATH-1])min=ATH[MAX_ATH-1]; } ath[j]=min; } /* copy curves into working space, replicate the 50dB curve to 30 and 40, replicate the 100dB curve to 110 */ for(j=0;j<6;j++) memcpy(workc[i][j+2],tonemasks[i][j],EHMER_MAX*sizeof(*tonemasks[i][j])); memcpy(workc[i][0],tonemasks[i][0],EHMER_MAX*sizeof(*tonemasks[i][0])); memcpy(workc[i][1],tonemasks[i][0],EHMER_MAX*sizeof(*tonemasks[i][0])); /* apply centered curve boost/decay */ for(j=0;j0)adj=0.; if(adj>0. && center_boost<0)adj=0.; workc[i][j][k]+=adj; } } /* normalize curves so the driving amplitude is 0dB */ /* make temp curves with the ATH overlayed */ for(j=0;j an eighth of an octave and that the eighth octave values may also be composited. */ /* which octave curves will we be compositing? */ bin=floor(fromOC(i*.5)/binHz); lo_curve= ceil(toOC(bin*binHz+1)*2); hi_curve= floor(toOC((bin+1)*binHz)*2); if(lo_curve>i)lo_curve=i; if(lo_curve<0)lo_curve=0; if(hi_curve>=P_BANDS)hi_curve=P_BANDS-1; for(m=0;mn)lo_bin=n; if(lo_binn)hi_bin=n; for(;lworkc[k][m][j]) brute_buffer[l]=workc[k][m][j]; } for(;lworkc[k][m][EHMER_MAX-1]) brute_buffer[l]=workc[k][m][EHMER_MAX-1]; } /* be equally paranoid about being valid up to next half ocatve */ if(i+1n)lo_bin=n; if(lo_binn)hi_bin=n; for(;lworkc[k][m][j]) brute_buffer[l]=workc[k][m][j]; } for(;lworkc[k][m][EHMER_MAX-1]) brute_buffer[l]=workc[k][m][EHMER_MAX-1]; } for(j=0;j=n){ ret[i][m][j+2]=-999.; }else{ ret[i][m][j+2]=brute_buffer[bin]; } } } /* add fenceposts */ for(j=0;j-200.f)break; ret[i][m][0]=j; for(j=EHMER_MAX-1;j>EHMER_OFFSET+1;j--) if(ret[i][m][j+2]>-200.f) break; ret[i][m][1]=j; } } return(ret); } void _vp_psy_init(vorbis_look_psy *p,vorbis_info_psy *vi, vorbis_info_psy_global *gi,int n,long rate){ long i,j,lo=-99,hi=1; long maxoc; memset(p,0,sizeof(*p)); p->eighth_octave_lines=gi->eighth_octave_lines; p->shiftoc=rint(log(gi->eighth_octave_lines*8.f)/log(2.f))-1; p->firstoc=toOC(.25f*rate*.5/n)*(1<<(p->shiftoc+1))-gi->eighth_octave_lines; maxoc=toOC((n+.25f)*rate*.5/n)*(1<<(p->shiftoc+1))+.5f; p->total_octave_lines=maxoc-p->firstoc+1; p->ath=_ogg_malloc(n*sizeof(*p->ath)); p->octave=_ogg_malloc(n*sizeof(*p->octave)); p->bark=_ogg_malloc(n*sizeof(*p->bark)); p->vi=vi; p->n=n; p->rate=rate; /* set up the lookups for a given blocksize and sample rate */ for(i=0,j=0;iath[j]=base+100.; base+=delta; } } } for(i=0;inoisewindowlominnoisewindowlo);lo++); for(;hi<=n && (hinoisewindowhimin || toBARK(rate/(2*n)*hi)<(bark+vi->noisewindowhi));hi++); p->bark[i]=((lo-1)<<16)+(hi-1); } for(i=0;ioctave[i]=toOC((i+.25f)*.5*rate/n)*(1<<(p->shiftoc+1))+.5f; p->tonecurves=setup_tone_curves(vi->toneatt,rate*.5/n,n, vi->tone_centerboost,vi->tone_decay); /* set up rolling noise median */ p->noiseoffset=_ogg_malloc(P_NOISECURVES*sizeof(*p->noiseoffset)); for(i=0;inoiseoffset[i]=_ogg_malloc(n*sizeof(**p->noiseoffset)); for(i=0;i=P_BANDS-1)halfoc=P_BANDS-1; inthalfoc=(int)halfoc; del=halfoc-inthalfoc; for(j=0;jnoiseoffset[j][i]= p->vi->noiseoff[j][inthalfoc]*(1.-del) + p->vi->noiseoff[j][inthalfoc+1]*del; } #if 0 { static int ls=0; _analysis_output_always("noiseoff0",ls,p->noiseoffset[0],n,1,0,0); _analysis_output_always("noiseoff1",ls,p->noiseoffset[1],n,1,0,0); _analysis_output_always("noiseoff2",ls++,p->noiseoffset[2],n,1,0,0); } #endif } void _vp_psy_clear(vorbis_look_psy *p){ int i,j; if(p){ if(p->ath)_ogg_free(p->ath); if(p->octave)_ogg_free(p->octave); if(p->bark)_ogg_free(p->bark); if(p->tonecurves){ for(i=0;itonecurves[i][j]); } _ogg_free(p->tonecurves[i]); } _ogg_free(p->tonecurves); } if(p->noiseoffset){ for(i=0;inoiseoffset[i]); } _ogg_free(p->noiseoffset); } memset(p,0,sizeof(*p)); } } /* octave/(8*eighth_octave_lines) x scale and dB y scale */ static void seed_curve(float *seed, const float **curves, float amp, int oc, int n, int linesper,float dBoffset){ int i,post1; int seedptr; const float *posts,*curve; int choice=(int)((amp+dBoffset-P_LEVEL_0)*.1f); choice=max(choice,0); choice=min(choice,P_LEVELS-1); posts=curves[choice]; curve=posts+2; post1=(int)posts[1]; seedptr=oc+(posts[0]-EHMER_OFFSET)*linesper-(linesper>>1); for(i=posts[0];i0){ float lin=amp+curve[i]; if(seed[seedptr]=n)break; } } static void seed_loop(vorbis_look_psy *p, const float ***curves, const float *f, const float *flr, float *seed, float specmax){ vorbis_info_psy *vi=p->vi; long n=p->n,i; float dBoffset=vi->max_curve_dB-specmax; /* prime the working vector with peak values */ for(i=0;ioctave[i]; while(i+1octave[i+1]==oc){ i++; if(f[i]>max)max=f[i]; } if(max+6.f>flr[i]){ oc=oc>>p->shiftoc; if(oc>=P_BANDS)oc=P_BANDS-1; if(oc<0)oc=0; seed_curve(seed, curves[oc], max, p->octave[i]-p->firstoc, p->total_octave_lines, p->eighth_octave_lines, dBoffset); } } } static void seed_chase(float *seeds, int linesper, long n){ long *posstack=alloca(n*sizeof(*posstack)); float *ampstack=alloca(n*sizeof(*ampstack)); long stack=0; long pos=0; long i; for(i=0;i1 && ampstack[stack-1]<=ampstack[stack-2] && iampstack[i]){ endpos=posstack[i+1]; }else{ endpos=posstack[i]+linesper+1; /* +1 is important, else bin 0 is discarded in short frames */ } if(endpos>n)endpos=n; for(;pos static void max_seeds(vorbis_look_psy *p, float *seed, float *flr){ long n=p->total_octave_lines; int linesper=p->eighth_octave_lines; long linpos=0; long pos; seed_chase(seed,linesper,n); /* for masking */ pos=p->octave[0]-p->firstoc-(linesper>>1); while(linpos+1n){ float minV=seed[pos]; long end=((p->octave[linpos]+p->octave[linpos+1])>>1)-p->firstoc; if(minV>p->vi->tone_abs_limit)minV=p->vi->tone_abs_limit; while(pos+1<=end){ pos++; if((seed[pos]>NEGINF && seed[pos]firstoc; for(;linposn && p->octave[linpos]<=end;linpos++) if(flr[linpos]total_octave_lines-1]; for(;linposn;linpos++) if(flr[linpos]> 16; if( lo>=0 ) break; hi = b[i] & 0xffff; tN = N[hi] + N[-lo]; tX = X[hi] - X[-lo]; tXX = XX[hi] + XX[-lo]; tY = Y[hi] + Y[-lo]; tXY = XY[hi] - XY[-lo]; A = tY * tXX - tX * tXY; B = tN * tXY - tX * tY; D = tN * tXX - tX * tX; R = (A + x * B) / D; if (R < 0.f) R = 0.f; noise[i] = R - offset; } for ( ;; i++, x += 1.f) { lo = b[i] >> 16; hi = b[i] & 0xffff; if(hi>=n)break; tN = N[hi] - N[lo]; tX = X[hi] - X[lo]; tXX = XX[hi] - XX[lo]; tY = Y[hi] - Y[lo]; tXY = XY[hi] - XY[lo]; A = tY * tXX - tX * tXY; B = tN * tXY - tX * tY; D = tN * tXX - tX * tX; R = (A + x * B) / D; if (R < 0.f) R = 0.f; noise[i] = R - offset; } for ( ; i < n; i++, x += 1.f) { R = (A + x * B) / D; if (R < 0.f) R = 0.f; noise[i] = R - offset; } if (fixed <= 0) return; for (i = 0, x = 0.f;; i++, x += 1.f) { hi = i + fixed / 2; lo = hi - fixed; if(lo>=0)break; tN = N[hi] + N[-lo]; tX = X[hi] - X[-lo]; tXX = XX[hi] + XX[-lo]; tY = Y[hi] + Y[-lo]; tXY = XY[hi] - XY[-lo]; A = tY * tXX - tX * tXY; B = tN * tXY - tX * tY; D = tN * tXX - tX * tX; R = (A + x * B) / D; if (R - offset < noise[i]) noise[i] = R - offset; } for ( ;; i++, x += 1.f) { hi = i + fixed / 2; lo = hi - fixed; if(hi>=n)break; tN = N[hi] - N[lo]; tX = X[hi] - X[lo]; tXX = XX[hi] - XX[lo]; tY = Y[hi] - Y[lo]; tXY = XY[hi] - XY[lo]; A = tY * tXX - tX * tXY; B = tN * tXY - tX * tY; D = tN * tXX - tX * tX; R = (A + x * B) / D; if (R - offset < noise[i]) noise[i] = R - offset; } for ( ; i < n; i++, x += 1.f) { R = (A + x * B) / D; if (R - offset < noise[i]) noise[i] = R - offset; } } static float FLOOR1_fromdB_INV_LOOKUP[256]={ 0.F, 8.81683e+06F, 8.27882e+06F, 7.77365e+06F, 7.29930e+06F, 6.85389e+06F, 6.43567e+06F, 6.04296e+06F, 5.67422e+06F, 5.32798e+06F, 5.00286e+06F, 4.69759e+06F, 4.41094e+06F, 4.14178e+06F, 3.88905e+06F, 3.65174e+06F, 3.42891e+06F, 3.21968e+06F, 3.02321e+06F, 2.83873e+06F, 2.66551e+06F, 2.50286e+06F, 2.35014e+06F, 2.20673e+06F, 2.07208e+06F, 1.94564e+06F, 1.82692e+06F, 1.71544e+06F, 1.61076e+06F, 1.51247e+06F, 1.42018e+06F, 1.33352e+06F, 1.25215e+06F, 1.17574e+06F, 1.10400e+06F, 1.03663e+06F, 973377.F, 913981.F, 858210.F, 805842.F, 756669.F, 710497.F, 667142.F, 626433.F, 588208.F, 552316.F, 518613.F, 486967.F, 457252.F, 429351.F, 403152.F, 378551.F, 355452.F, 333762.F, 313396.F, 294273.F, 276316.F, 259455.F, 243623.F, 228757.F, 214798.F, 201691.F, 189384.F, 177828.F, 166977.F, 156788.F, 147221.F, 138237.F, 129802.F, 121881.F, 114444.F, 107461.F, 100903.F, 94746.3F, 88964.9F, 83536.2F, 78438.8F, 73652.5F, 69158.2F, 64938.1F, 60975.6F, 57254.9F, 53761.2F, 50480.6F, 47400.3F, 44507.9F, 41792.0F, 39241.9F, 36847.3F, 34598.9F, 32487.7F, 30505.3F, 28643.8F, 26896.0F, 25254.8F, 23713.7F, 22266.7F, 20908.0F, 19632.2F, 18434.2F, 17309.4F, 16253.1F, 15261.4F, 14330.1F, 13455.7F, 12634.6F, 11863.7F, 11139.7F, 10460.0F, 9821.72F, 9222.39F, 8659.64F, 8131.23F, 7635.06F, 7169.17F, 6731.70F, 6320.93F, 5935.23F, 5573.06F, 5232.99F, 4913.67F, 4613.84F, 4332.30F, 4067.94F, 3819.72F, 3586.64F, 3367.78F, 3162.28F, 2969.31F, 2788.13F, 2617.99F, 2458.24F, 2308.24F, 2167.39F, 2035.14F, 1910.95F, 1794.35F, 1684.85F, 1582.04F, 1485.51F, 1394.86F, 1309.75F, 1229.83F, 1154.78F, 1084.32F, 1018.15F, 956.024F, 897.687F, 842.910F, 791.475F, 743.179F, 697.830F, 655.249F, 615.265F, 577.722F, 542.469F, 509.367F, 478.286F, 449.101F, 421.696F, 395.964F, 371.803F, 349.115F, 327.812F, 307.809F, 289.026F, 271.390F, 254.830F, 239.280F, 224.679F, 210.969F, 198.096F, 186.008F, 174.658F, 164.000F, 153.993F, 144.596F, 135.773F, 127.488F, 119.708F, 112.404F, 105.545F, 99.1046F, 93.0572F, 87.3788F, 82.0469F, 77.0404F, 72.3394F, 67.9252F, 63.7804F, 59.8885F, 56.2341F, 52.8027F, 49.5807F, 46.5553F, 43.7144F, 41.0470F, 38.5423F, 36.1904F, 33.9821F, 31.9085F, 29.9614F, 28.1332F, 26.4165F, 24.8045F, 23.2910F, 21.8697F, 20.5352F, 19.2822F, 18.1056F, 17.0008F, 15.9634F, 14.9893F, 14.0746F, 13.2158F, 12.4094F, 11.6522F, 10.9411F, 10.2735F, 9.64662F, 9.05798F, 8.50526F, 7.98626F, 7.49894F, 7.04135F, 6.61169F, 6.20824F, 5.82941F, 5.47370F, 5.13970F, 4.82607F, 4.53158F, 4.25507F, 3.99542F, 3.75162F, 3.52269F, 3.30774F, 3.10590F, 2.91638F, 2.73842F, 2.57132F, 2.41442F, 2.26709F, 2.12875F, 1.99885F, 1.87688F, 1.76236F, 1.65482F, 1.55384F, 1.45902F, 1.36999F, 1.28640F, 1.20790F, 1.13419F, 1.06499F, 1.F }; void _vp_remove_floor(vorbis_look_psy *p, float *mdct, int *codedflr, float *residue, int sliding_lowpass){ int i,n=p->n; if(sliding_lowpass>n)sliding_lowpass=n; for(i=0;in; float *work=alloca(n*sizeof(*work)); bark_noise_hybridmp(n,p->bark,logmdct,logmask, 140.,-1); for(i=0;ibark,work,logmask,0., p->vi->noisewindowfixed); for(i=0;i=NOISE_COMPAND_LEVELS)dB=NOISE_COMPAND_LEVELS-1; if(dB<0)dB=0; logmask[i]= work[i]+p->vi->noisecompand[dB]; } } void _vp_tonemask(vorbis_look_psy *p, float *logfft, float *logmask, float global_specmax, float local_specmax){ int i,n=p->n; float *seed=alloca(sizeof(*seed)*p->total_octave_lines); float att=local_specmax+p->vi->ath_adjatt; for(i=0;itotal_octave_lines;i++)seed[i]=NEGINF; /* set the ATH (floating below localmax, not global max by a specified att) */ if(attvi->ath_maxatt)att=p->vi->ath_maxatt; for(i=0;iath[i]+att; /* tone masking */ seed_loop(p,(const float ***)p->tonecurves,logfft,logmask,seed,global_specmax); max_seeds(p,seed,logmask); } void _vp_offset_and_mix(vorbis_look_psy *p, float *noise, float *tone, int offset_select, float *logmask){ int i,n=p->n; float toneatt=p->vi->tone_masteratt[offset_select]; for(i=0;inoiseoffset[offset_select][i]; if(val>p->vi->noisemaxsupp)val=p->vi->noisemaxsupp; logmask[i]=max(val,tone[i]+toneatt); } } float _vp_ampmax_decay(float amp,vorbis_dsp_state *vd){ vorbis_info *vi=vd->vi; codec_setup_info *ci=vi->codec_setup; vorbis_info_psy_global *gi=&ci->psy_g_param; int n=ci->blocksizes[vd->W]/2; float secs=(float)n/vi->rate; amp+=secs*gi->ampmax_att_per_sec; if(amp<-9999)amp=-9999; return(amp); } static void couple_lossless(float A, float B, float *qA, float *qB){ int test1=fabs(*qA)>fabs(*qB); test1-= fabs(*qA)fabs(B))<<1)-1; if(test1==1){ *qB=(*qA>0.f?*qA-*qB:*qB-*qA); }else{ float temp=*qB; *qB=(*qB>0.f?*qA-*qB:*qB-*qA); *qA=temp; } if(*qB>fabs(*qA)*1.9999f){ *qB= -fabs(*qA)*2.f; *qA= -*qA; } } static float hypot_lookup[32]={ -0.009935, -0.011245, -0.012726, -0.014397, -0.016282, -0.018407, -0.020800, -0.023494, -0.026522, -0.029923, -0.033737, -0.038010, -0.042787, -0.048121, -0.054064, -0.060671, -0.068000, -0.076109, -0.085054, -0.094892, -0.105675, -0.117451, -0.130260, -0.144134, -0.159093, -0.175146, -0.192286, -0.210490, -0.229718, -0.249913, -0.271001, -0.292893}; static void precomputed_couple_point(float premag, int floorA,int floorB, float *mag, float *ang){ int test=(floorA>floorB)-1; int offset=31-abs(floorA-floorB); float floormag=hypot_lookup[((offset<0)-1)&offset]+1.f; floormag*=FLOOR1_fromdB_INV_LOOKUP[(floorB&test)|(floorA&(~test))]; *mag=premag*floormag; *ang=0.f; } /* just like below, this is currently set up to only do single-step-depth coupling. Otherwise, we'd have to do more copying (which will be inevitable later) */ /* doing the real circular magnitude calculation is audibly superior to (A+B)/sqrt(2) */ static float dipole_hypot(float a, float b){ if(a>0.){ if(b>0.)return sqrt(a*a+b*b); if(a>-b)return sqrt(a*a-b*b); return -sqrt(b*b-a*a); } if(b<0.)return -sqrt(a*a+b*b); if(-a>b)return -sqrt(a*a-b*b); return sqrt(b*b-a*a); } static float round_hypot(float a, float b){ if(a>0.){ if(b>0.)return sqrt(a*a+b*b); if(a>-b)return sqrt(a*a+b*b); return -sqrt(b*b+a*a); } if(b<0.)return -sqrt(a*a+b*b); if(-a>b)return -sqrt(a*a+b*b); return sqrt(b*b+a*a); } /* revert to round hypot for now */ float **_vp_quantize_couple_memo(vorbis_block *vb, vorbis_info_psy_global *g, vorbis_look_psy *p, vorbis_info_mapping0 *vi, float **mdct){ int i,j,n=p->n; float **ret=_vorbis_block_alloc(vb,vi->coupling_steps*sizeof(*ret)); int limit=g->coupling_pointlimit[p->vi->blockflag][PACKETBLOBS/2]; for(i=0;icoupling_steps;i++){ float *mdctM=mdct[vi->coupling_mag[i]]; float *mdctA=mdct[vi->coupling_ang[i]]; ret[i]=_vorbis_block_alloc(vb,n*sizeof(**ret)); for(j=0;jf2); } int **_vp_quantize_couple_sort(vorbis_block *vb, vorbis_look_psy *p, vorbis_info_mapping0 *vi, float **mags){ if(p->vi->normal_point_p){ int i,j,k,n=p->n; int **ret=_vorbis_block_alloc(vb,vi->coupling_steps*sizeof(*ret)); int partition=p->vi->normal_partition; float **work=alloca(sizeof(*work)*partition); for(i=0;icoupling_steps;i++){ ret[i]=_vorbis_block_alloc(vb,n*sizeof(**ret)); for(j=0;jn; vorbis_info_psy *vi=p->vi; int partition=vi->normal_partition; float **work=alloca(sizeof(*work)*partition); int start=vi->normal_start; for(j=start;jn)partition=n-j; for(i=0;in; vorbis_info_psy *vi=p->vi; int partition=vi->normal_partition; int start=vi->normal_start; if(start>n)start=n; if(vi->normal_channel_p){ for(;j=.25f){ out[k]=rint(in[k]); acc-=in[k]*in[k]; flag=1; }else{ if(accnormal_thresh)break; out[k]=unitnorm(in[k]); acc-=1.; } } for(;in; /* perform any requested channel coupling */ /* point stereo can only be used in a first stage (in this encoder) because of the dependency on floor lookups */ for(i=0;icoupling_steps;i++){ /* once we're doing multistage coupling in which a channel goes through more than one coupling step, the floor vector magnitudes will also have to be recalculated an propogated along with PCM. Right now, we're not (that will wait until 5.1 most likely), so the code isn't here yet. The memory management here is all assuming single depth couplings anyway. */ /* make sure coupling a zero and a nonzero channel results in two nonzero channels. */ if(nonzero[vi->coupling_mag[i]] || nonzero[vi->coupling_ang[i]]){ float *rM=res[vi->coupling_mag[i]]; float *rA=res[vi->coupling_ang[i]]; float *qM=rM+n; float *qA=rA+n; int *floorM=ifloor[vi->coupling_mag[i]]; int *floorA=ifloor[vi->coupling_ang[i]]; float prepoint=stereo_threshholds[g->coupling_prepointamp[blobno]]; float postpoint=stereo_threshholds[g->coupling_postpointamp[blobno]]; int partition=(p->vi->normal_point_p?p->vi->normal_partition:p->n); int limit=g->coupling_pointlimit[p->vi->blockflag][blobno]; int pointlimit=limit; nonzero[vi->coupling_mag[i]]=1; nonzero[vi->coupling_ang[i]]=1; for(j=0;jn;j+=partition){ float acc=0.f; for(k=0;k=limit && fabs(rM[l])vi->normal_point_p){ for(k=0;k=p->vi->normal_thresh;k++){ int l=mag_sort[i][j+k]; if(l=pointlimit && rint(qM[l])==0.f){ qM[l]=unitnorm(qM[l]); acc-=1.f; } } } } } } } libtritonus-java-20070428/src/lib/pvorbis/psy.h0000644000175000017500000001125210167052700021221 0ustar twernertwerner/******************************************************************** * * * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 * * by the XIPHOPHORUS Company http://www.xiph.org/ * * * ******************************************************************** function: random psychoacoustics (not including preecho) last mod: $Id: psy.h,v 1.1 2005/01/05 21:01:52 pfisterer Exp $ ********************************************************************/ #ifndef _V_PSY_H_ #define _V_PSY_H_ #include "smallft.h" #include "backends.h" #include "envelope.h" #ifndef EHMER_MAX #define EHMER_MAX 56 #endif /* psychoacoustic setup ********************************************/ #define P_BANDS 17 /* 62Hz to 16kHz */ #define P_LEVELS 8 /* 30dB to 100dB */ #define P_LEVEL_0 30. /* 30 dB */ #define P_NOISECURVES 3 #define NOISE_COMPAND_LEVELS 40 typedef struct vorbis_info_psy{ int blockflag; float ath_adjatt; float ath_maxatt; float tone_masteratt[P_NOISECURVES]; float tone_centerboost; float tone_decay; float tone_abs_limit; float toneatt[P_BANDS]; int noisemaskp; float noisemaxsupp; float noisewindowlo; float noisewindowhi; int noisewindowlomin; int noisewindowhimin; int noisewindowfixed; float noiseoff[P_NOISECURVES][P_BANDS]; float noisecompand[NOISE_COMPAND_LEVELS]; float max_curve_dB; int normal_channel_p; int normal_point_p; int normal_start; int normal_partition; double normal_thresh; } vorbis_info_psy; typedef struct{ int eighth_octave_lines; /* for block long/short tuning; encode only */ float preecho_thresh[VE_BANDS]; float postecho_thresh[VE_BANDS]; float stretch_penalty; float preecho_minenergy; float ampmax_att_per_sec; /* channel coupling config */ int coupling_pkHz[PACKETBLOBS]; int coupling_pointlimit[2][PACKETBLOBS]; int coupling_prepointamp[PACKETBLOBS]; int coupling_postpointamp[PACKETBLOBS]; int sliding_lowpass[2][PACKETBLOBS]; } vorbis_info_psy_global; typedef struct { float ampmax; int channels; vorbis_info_psy_global *gi; int coupling_pointlimit[2][P_NOISECURVES]; } vorbis_look_psy_global; typedef struct { int n; struct vorbis_info_psy *vi; float ***tonecurves; float **noiseoffset; float *ath; long *octave; /* in n.ocshift format */ long *bark; long firstoc; long shiftoc; int eighth_octave_lines; /* power of two, please */ int total_octave_lines; long rate; /* cache it */ } vorbis_look_psy; extern void _vp_psy_init(vorbis_look_psy *p,vorbis_info_psy *vi, vorbis_info_psy_global *gi,int n,long rate); extern void _vp_psy_clear(vorbis_look_psy *p); extern void *_vi_psy_dup(void *source); extern void _vi_psy_free(vorbis_info_psy *i); extern vorbis_info_psy *_vi_psy_copy(vorbis_info_psy *i); extern void _vp_remove_floor(vorbis_look_psy *p, float *mdct, int *icodedflr, float *residue, int sliding_lowpass); extern void _vp_noisemask(vorbis_look_psy *p, float *logmdct, float *logmask); extern void _vp_tonemask(vorbis_look_psy *p, float *logfft, float *logmask, float global_specmax, float local_specmax); extern void _vp_offset_and_mix(vorbis_look_psy *p, float *noise, float *tone, int offset_select, float *logmask); extern float _vp_ampmax_decay(float amp,vorbis_dsp_state *vd); extern float **_vp_quantize_couple_memo(vorbis_block *vb, vorbis_info_psy_global *g, vorbis_look_psy *p, vorbis_info_mapping0 *vi, float **mdct); extern void _vp_couple(int blobno, vorbis_info_psy_global *g, vorbis_look_psy *p, vorbis_info_mapping0 *vi, float **res, float **mag_memo, int **mag_sort, int **ifloor, int *nonzero, int sliding_lowpass); extern void _vp_noise_normalize(vorbis_look_psy *p, float *in,float *out,int *sortedindex); extern void _vp_noise_normalize_sort(vorbis_look_psy *p, float *magnitudes,int *sortedindex); extern int **_vp_quantize_couple_sort(vorbis_block *vb, vorbis_look_psy *p, vorbis_info_mapping0 *vi, float **mags); #endif libtritonus-java-20070428/src/lib/pvorbis/registry.c0000644000175000017500000000335210167052700022253 0ustar twernertwerner/******************************************************************** * * * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 * * by the XIPHOPHORUS Company http://www.xiph.org/ * * * ******************************************************************** function: registry for time, floor, res backends and channel mappings last mod: $Id: registry.c,v 1.1 2005/01/05 21:01:52 pfisterer Exp $ ********************************************************************/ #include "vorbis/codec.h" #include "codec_internal.h" #include "registry.h" #include "misc.h" /* seems like major overkill now; the backend numbers will grow into the infrastructure soon enough */ extern vorbis_func_floor floor0_exportbundle; extern vorbis_func_floor floor1_exportbundle; extern vorbis_func_residue residue0_exportbundle; extern vorbis_func_residue residue1_exportbundle; extern vorbis_func_residue residue2_exportbundle; extern vorbis_func_mapping mapping0_exportbundle; vorbis_func_floor *_floor_P[]={ &floor0_exportbundle, &floor1_exportbundle, }; vorbis_func_residue *_residue_P[]={ &residue0_exportbundle, &residue1_exportbundle, &residue2_exportbundle, }; vorbis_func_mapping *_mapping_P[]={ &mapping0_exportbundle, }; libtritonus-java-20070428/src/lib/pvorbis/registry.h0000644000175000017500000000240010167052701022252 0ustar twernertwerner/******************************************************************** * * * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 * * by the XIPHOPHORUS Company http://www.xiph.org/ * * * ******************************************************************** function: registry for time, floor, res backends and channel mappings last mod: $Id: registry.h,v 1.1 2005/01/05 21:01:53 pfisterer Exp $ ********************************************************************/ #ifndef _V_REG_H_ #define _V_REG_H_ #define VI_TRANSFORMB 1 #define VI_WINDOWB 1 #define VI_TIMEB 1 #define VI_FLOORB 2 #define VI_RESB 3 #define VI_MAPB 1 extern vorbis_func_floor *_floor_P[]; extern vorbis_func_residue *_residue_P[]; extern vorbis_func_mapping *_mapping_P[]; #endif libtritonus-java-20070428/src/lib/pvorbis/res0.c0000644000175000017500000005523210171253130021253 0ustar twernertwerner/******************************************************************** * * * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 * * by the XIPHOPHORUS Company http://www.xiph.org/ * * * ******************************************************************** function: residue backend 0, 1 and 2 implementation last mod: $Id: res0.c,v 1.2 2005/01/12 16:54:48 pfisterer Exp $ ********************************************************************/ /* Slow, slow, slow, simpleminded and did I mention it was slow? The encode/decode loops are coded for clarity and performance is not yet even a nagging little idea lurking in the shadows. Oh and BTW, it's slow. */ #include #include #include #include "ogg/ogg.h" #include "vorbis/codec.h" #include "codec_internal.h" #include "registry.h" #include "codebook.h" #include "misc.h" #include "os.h" #ifdef TRAIN_RES #include #endif typedef struct { vorbis_info_residue0 *info; int parts; int stages; codebook *fullbooks; codebook *phrasebook; codebook ***partbooks; int partvals; int **decodemap; long postbits; long phrasebits; long frames; #ifdef TRAIN_RES int train_seq; long *training_data[8][64]; float training_max[8][64]; float training_min[8][64]; float tmin; float tmax; #endif } vorbis_look_residue0; void res0_free_info(vorbis_info_residue *i){ vorbis_info_residue0 *info=(vorbis_info_residue0 *)i; if(info){ memset(info,0,sizeof(*info)); _ogg_free(info); } } void res0_free_look(vorbis_look_residue *i){ int j; if(i){ vorbis_look_residue0 *look=(vorbis_look_residue0 *)i; #ifdef TRAIN_RES { int j,k,l; for(j=0;jparts;j++){ /*fprintf(stderr,"partition %d: ",j);*/ for(k=0;k<8;k++) if(look->training_data[k][j]){ char buffer[80]; FILE *of; codebook *statebook=look->partbooks[j][k]; /* long and short into the same bucket by current convention */ sprintf(buffer,"res_part%d_pass%d.vqd",j,k); of=fopen(buffer,"a"); for(l=0;lentries;l++) fprintf(of,"%d:%ld\n",l,look->training_data[k][j][l]); fclose(of); /*fprintf(stderr,"%d(%.2f|%.2f) ",k, look->training_min[k][j],look->training_max[k][j]);*/ _ogg_free(look->training_data[k][j]); } /*fprintf(stderr,"\n");*/ } } fprintf(stderr,"min/max residue: %g::%g\n",look->tmin,look->tmax); /*fprintf(stderr,"residue bit usage %f:%f (%f total)\n", (float)look->phrasebits/look->frames, (float)look->postbits/look->frames, (float)(look->postbits+look->phrasebits)/look->frames);*/ #endif /*vorbis_info_residue0 *info=look->info; fprintf(stderr, "%ld frames encoded in %ld phrasebits and %ld residue bits " "(%g/frame) \n",look->frames,look->phrasebits, look->resbitsflat, (look->phrasebits+look->resbitsflat)/(float)look->frames); for(j=0;jparts;j++){ long acc=0; fprintf(stderr,"\t[%d] == ",j); for(k=0;kstages;k++) if((info->secondstages[j]>>k)&1){ fprintf(stderr,"%ld,",look->resbits[j][k]); acc+=look->resbits[j][k]; } fprintf(stderr,":: (%ld vals) %1.2fbits/sample\n",look->resvals[j], acc?(float)acc/(look->resvals[j]*info->grouping):0); } fprintf(stderr,"\n");*/ for(j=0;jparts;j++) if(look->partbooks[j])_ogg_free(look->partbooks[j]); _ogg_free(look->partbooks); for(j=0;jpartvals;j++) _ogg_free(look->decodemap[j]); _ogg_free(look->decodemap); memset(look,0,sizeof(*look)); _ogg_free(look); } } static int ilog(unsigned int v){ int ret=0; while(v){ ret++; v>>=1; } return(ret); } static int icount(unsigned int v){ int ret=0; while(v){ ret+=v&1; v>>=1; } return(ret); } void res0_pack(vorbis_info_residue *vr,oggpack_buffer *opb){ vorbis_info_residue0 *info=(vorbis_info_residue0 *)vr; int j,acc=0; oggpack_write(opb,info->begin,24); oggpack_write(opb,info->end,24); oggpack_write(opb,info->grouping-1,24); /* residue vectors to group and code with a partitioned book */ oggpack_write(opb,info->partitions-1,6); /* possible partition choices */ oggpack_write(opb,info->groupbook,8); /* group huffman book */ /* secondstages is a bitmask; as encoding progresses pass by pass, a bitmask of one indicates this partition class has bits to write this pass */ for(j=0;jpartitions;j++){ if(ilog(info->secondstages[j])>3){ /* yes, this is a minor hack due to not thinking ahead */ oggpack_write(opb,info->secondstages[j],3); oggpack_write(opb,1,1); oggpack_write(opb,info->secondstages[j]>>3,5); }else oggpack_write(opb,info->secondstages[j],4); /* trailing zero */ acc+=icount(info->secondstages[j]); } for(j=0;jbooklist[j],8); } /* vorbis_info is for range checking */ vorbis_info_residue *res0_unpack(vorbis_info *vi,oggpack_buffer *opb){ int j,acc=0; vorbis_info_residue0 *info=_ogg_calloc(1,sizeof(*info)); codec_setup_info *ci=vi->codec_setup; info->begin=oggpack_read(opb,24); info->end=oggpack_read(opb,24); info->grouping=oggpack_read(opb,24)+1; info->partitions=oggpack_read(opb,6)+1; info->groupbook=oggpack_read(opb,8); for(j=0;jpartitions;j++){ int cascade=oggpack_read(opb,3); if(oggpack_read(opb,1)) cascade|=(oggpack_read(opb,5)<<3); info->secondstages[j]=cascade; acc+=icount(cascade); } for(j=0;jbooklist[j]=oggpack_read(opb,8); if(info->groupbook>=ci->books)goto errout; for(j=0;jbooklist[j]>=ci->books)goto errout; return(info); errout: res0_free_info(info); return(NULL); } vorbis_look_residue *res0_look(vorbis_dsp_state *vd, vorbis_info_residue *vr){ vorbis_info_residue0 *info=(vorbis_info_residue0 *)vr; vorbis_look_residue0 *look=_ogg_calloc(1,sizeof(*look)); codec_setup_info *ci=vd->vi->codec_setup; int j,k,acc=0; int dim; int maxstage=0; look->info=info; look->parts=info->partitions; look->fullbooks=ci->fullbooks; look->phrasebook=ci->fullbooks+info->groupbook; dim=look->phrasebook->dim; look->partbooks=_ogg_calloc(look->parts,sizeof(*look->partbooks)); for(j=0;jparts;j++){ int stages=ilog(info->secondstages[j]); if(stages){ if(stages>maxstage)maxstage=stages; look->partbooks[j]=_ogg_calloc(stages,sizeof(*look->partbooks[j])); for(k=0;ksecondstages[j]&(1<partbooks[j][k]=ci->fullbooks+info->booklist[acc++]; #ifdef TRAIN_RES look->training_data[k][j]=calloc(look->partbooks[j][k]->entries, sizeof(***look->training_data)); #endif } } } look->partvals=rint(pow((float)look->parts,(float)dim)); look->stages=maxstage; look->decodemap=_ogg_malloc(look->partvals*sizeof(*look->decodemap)); for(j=0;jpartvals;j++){ long val=j; long mult=look->partvals/look->parts; look->decodemap[j]=_ogg_malloc(dim*sizeof(*look->decodemap[j])); for(k=0;kparts; look->decodemap[j][k]=deco; } } #ifdef TRAIN_RES { static int train_seq=0; look->train_seq=train_seq++; } #endif return(look); } /* break an abstraction and copy some code for performance purposes */ static int local_book_besterror(codebook *book,float *a){ int dim=book->dim,i,k,o; int best=0; encode_aux_threshmatch *tt=book->c->thresh_tree; /* find the quant val of each scalar */ for(k=0,o=dim;kthreshvals>>1; if(valquantthresh[i]){ if(valquantthresh[i-1]){ for(--i;i>0;--i) if(val>=tt->quantthresh[i-1]) break; } }else{ for(++i;ithreshvals-1;++i) if(valquantthresh[i])break; } best=(best*tt->quantvals)+tt->quantmap[i]; } /* regular lattices are easy :-) */ if(book->c->lengthlist[best]<=0){ const static_codebook *c=book->c; int i,j; float bestf=0.f; float *e=book->valuelist; best=-1; for(i=0;ientries;i++){ if(c->lengthlist[i]>0){ float this=0.f; for(j=0;jvaluelist+best*dim; for(i=0;idim; int step=n/dim; for(i=0;iinfo; vorbis_info *vi=vb->vd->vi; codec_setup_info *ci=vi->codec_setup; /* move all this setup out later */ int samples_per_partition=info->grouping; int possible_partitions=info->partitions; int n=info->end-info->begin; int partvals=n/samples_per_partition; long **partword=_vorbis_block_alloc(vb,ch*sizeof(*partword)); float scale=100./samples_per_partition; /* we find the partition type for each partition of each channel. We'll go back and do the interleaved encoding in a bit. For now, clarity */ for(i=0;ibegin; for(j=0;jmax)max=fabs(in[j][offset+k]); ent+=fabs(rint(in[j][offset+k])); } ent*=scale; for(k=0;kclassmetric1[k] && (info->classmetric2[k]<0 || (int)entclassmetric2[k])) break; partword[j][i]=k; } } #ifdef TRAIN_RESAUX { FILE *of; char buffer[80]; for(i=0;itrain_seq); of=fopen(buffer,"a"); for(j=0;jframes++; return(partword); } /* designed for stereo or other modes where the partition size is an integer multiple of the number of channels encoded in the current submap */ static long **_2class(vorbis_block *vb,vorbis_look_residue *vl,float **in, int ch){ long i,j,k,l; vorbis_look_residue0 *look=(vorbis_look_residue0 *)vl; vorbis_info_residue0 *info=look->info; /* move all this setup out later */ int samples_per_partition=info->grouping; int possible_partitions=info->partitions; int n=info->end-info->begin; int partvals=n/samples_per_partition; long **partword=_vorbis_block_alloc(vb,sizeof(*partword)); #ifdef TRAIN_RES FILE *of; char buffer[80]; #endif partword[0]=_vorbis_block_alloc(vb,n*ch/samples_per_partition*sizeof(*partword[0])); memset(partword[0],0,n*ch/samples_per_partition*sizeof(*partword[0])); for(i=0,l=info->begin/ch;imagmax)magmax=fabs(in[0][l]); for(k=1;kangmax)angmax=fabs(in[k][l]); l++; } for(j=0;jclassmetric1[j] && angmax<=info->classmetric2[j]) break; partword[0][i]=j; } #ifdef TRAIN_RESAUX sprintf(buffer,"resaux_%d.vqd",look->train_seq); of=fopen(buffer,"a"); for(i=0;iframes++; return(partword); } static int _01forward(vorbis_block *vb,vorbis_look_residue *vl, float **in,int ch, long **partword, int (*encode)(oggpack_buffer *,float *,int, codebook *,long *)){ long i,j,k,s; vorbis_look_residue0 *look=(vorbis_look_residue0 *)vl; vorbis_info_residue0 *info=look->info; vorbis_dsp_state *vd=vb->vd; /* move all this setup out later */ int samples_per_partition=info->grouping; int possible_partitions=info->partitions; int partitions_per_word=look->phrasebook->dim; int n=info->end-info->begin; int partvals=n/samples_per_partition; long resbits[128]; long resvals[128]; #ifdef TRAIN_RES for(i=0;ibegin;jend;j++){ if(in[i][j]>look->tmax)look->tmax=in[i][j]; if(in[i][j]tmin)look->tmin=in[i][j]; } #endif memset(resbits,0,sizeof(resbits)); memset(resvals,0,sizeof(resvals)); /* we code the partition words for each channel, then the residual words for a partition per channel until we've written all the residual words for that partition word. Then write the next partition channel words... */ for(s=0;sstages;s++){ for(i=0;iphrasebook->entries) look->phrasebits+=vorbis_book_encode(look->phrasebook,val,&vb->opb); #if 0 /*def TRAIN_RES*/ else fprintf(stderr,"!"); #endif } } /* now we encode interleaved residual values for the partitions */ for(k=0;kbegin; for(j=0;jsecondstages[partword[j][i]]&(1<partbooks[partword[j][i]][s]; if(statebook){ int ret; long *accumulator=NULL; #ifdef TRAIN_RES accumulator=look->training_data[s][partword[j][i]]; { int l; float *samples=in[j]+offset; for(l=0;ltraining_min[s][partword[j][i]]) look->training_min[s][partword[j][i]]=samples[l]; if(samples[l]>look->training_max[s][partword[j][i]]) look->training_max[s][partword[j][i]]=samples[l]; } } #endif ret=encode(&vb->opb,in[j]+offset,samples_per_partition, statebook,accumulator); look->postbits+=ret; resbits[partword[j][i]]+=ret; } } } } } } /*{ long total=0; long totalbits=0; fprintf(stderr,"%d :: ",vb->mode); for(k=0;kinfo; /* move all this setup out later */ int samples_per_partition=info->grouping; int partitions_per_word=look->phrasebook->dim; int n=info->end-info->begin; int partvals=n/samples_per_partition; int partwords=(partvals+partitions_per_word-1)/partitions_per_word; int ***partword=alloca(ch*sizeof(*partword)); for(j=0;jstages;s++){ /* each loop decodes on partition codeword containing partitions_pre_word partitions */ for(i=0,l=0;iphrasebook,&vb->opb); if(temp==-1)goto eopbreak; partword[j][l]=look->decodemap[temp]; if(partword[j][l]==NULL)goto errout; } } /* now we decode residual values for the partitions */ for(k=0;kbegin+i*samples_per_partition; if(info->secondstages[partword[j][l][k]]&(1<partbooks[partword[j][l][k]][s]; if(stagebook){ if(decodepart(stagebook,in[j]+offset,&vb->opb, samples_per_partition)==-1)goto eopbreak; } } } } } errout: eopbreak: return(0); } #if 0 /* residue 0 and 1 are just slight variants of one another. 0 is interleaved, 1 is not */ long **res0_class(vorbis_block *vb,vorbis_look_residue *vl, float **in,int *nonzero,int ch){ /* we encode only the nonzero parts of a bundle */ int i,used=0; for(i=0;ipcmend/2; for(i=0;ipcmend/2; for(i=0;ipcmend/2,used=0; /* don't duplicate the code; use a working vector hack for now and reshape ourselves into a single channel res1 */ /* ugly; reallocs for each coupling pass :-( */ float *work=_vorbis_block_alloc(vb,ch*n*sizeof(*work)); for(i=0;iinfo; /* move all this setup out later */ int samples_per_partition=info->grouping; int partitions_per_word=look->phrasebook->dim; int n=info->end-info->begin; int partvals=n/samples_per_partition; int partwords=(partvals+partitions_per_word-1)/partitions_per_word; int **partword=_vorbis_block_alloc(vb,partwords*sizeof(*partword)); for(i=0;istages;s++){ for(i=0,l=0;iphrasebook,&vb->opb); if(temp==-1)goto eopbreak; partword[l]=look->decodemap[temp]; if(partword[l]==NULL)goto errout; } /* now we decode residual values for the partitions */ for(k=0;ksecondstages[partword[l][k]]&(1<partbooks[partword[l][k]][s]; if(stagebook){ if(vorbis_book_decodevv_add(stagebook,in, i*samples_per_partition+info->begin,ch, &vb->opb,samples_per_partition)==-1) goto eopbreak; } } } } errout: eopbreak: return(0); } vorbis_func_residue residue0_exportbundle={ NULL, &res0_unpack, &res0_look, &res0_free_info, &res0_free_look, NULL, NULL, &res0_inverse }; vorbis_func_residue residue1_exportbundle={ &res0_pack, &res0_unpack, &res0_look, &res0_free_info, &res0_free_look, &res1_class, &res1_forward, &res1_inverse }; vorbis_func_residue residue2_exportbundle={ &res0_pack, &res0_unpack, &res0_look, &res0_free_info, &res0_free_look, &res2_class, &res2_forward, &res2_inverse }; libtritonus-java-20070428/src/lib/pvorbis/scales.h0000644000175000017500000000525110167052701021663 0ustar twernertwerner/******************************************************************** * * * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 * * by the XIPHOPHORUS Company http://www.xiph.org/ * * * ******************************************************************** function: linear scale -> dB, Bark and Mel scales last mod: $Id: scales.h,v 1.1 2005/01/05 21:01:53 pfisterer Exp $ ********************************************************************/ #ifndef _V_SCALES_H_ #define _V_SCALES_H_ #include #include "os.h" /* 20log10(x) */ #define VORBIS_IEEE_FLOAT32 1 #ifdef VORBIS_IEEE_FLOAT32 static float unitnorm(float x){ ogg_uint32_t *ix=(ogg_uint32_t *)&x; *ix=(*ix&0x80000000UL)|(0x3f800000UL); return(x); } static float FABS(float *x){ ogg_uint32_t *ix=(ogg_uint32_t *)x; *ix&=0x7fffffffUL; return(*x); } static float todB(const float *x){ float calc; ogg_int32_t *i=(ogg_int32_t *)x; calc = ((*i) & 0x7fffffff); calc *= 7.1771144e-7f; calc += -764.27118f; return calc; } #define todB_nn(x) todB(x) #else static float unitnorm(float x){ if(x<0)return(-1.f); return(1.f); } #define FABS(x) fabs(*(x)) #define todB(x) (*(x)==0?-400.f:log(*(x)**(x))*4.34294480f) #define todB_nn(x) (*(x)==0.f?-400.f:log(*(x))*8.6858896f) #endif #define fromdB(x) (exp((x)*.11512925f)) /* The bark scale equations are approximations, since the original table was somewhat hand rolled. The below are chosen to have the best possible fit to the rolled tables, thus their somewhat odd appearance (these are more accurate and over a longer range than the oft-quoted bark equations found in the texts I have). The approximations are valid from 0 - 30kHz (nyquist) or so. all f in Hz, z in Bark */ #define toBARK(n) (13.1f*atan(.00074f*(n))+2.24f*atan((n)*(n)*1.85e-8f)+1e-4f*(n)) #define fromBARK(z) (102.f*(z)-2.f*pow(z,2.f)+.4f*pow(z,3.f)+pow(1.46f,z)-1.f) #define toMEL(n) (log(1.f+(n)*.001f)*1442.695f) #define fromMEL(m) (1000.f*exp((m)/1442.695f)-1000.f) /* Frequency to octave. We arbitrarily declare 63.5 Hz to be octave 0.0 */ #define toOC(n) (log(n)*1.442695f-5.965784f) #define fromOC(o) (exp(((o)+5.965784f)*.693147f)) #endif libtritonus-java-20070428/src/lib/pvorbis/sharedbook.c0000644000175000017500000004641710171253130022530 0ustar twernertwerner/******************************************************************** * * * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 * * by the XIPHOPHORUS Company http://www.xiph.org/ * * * ******************************************************************** function: basic shared codebook operations last mod: $Id: sharedbook.c,v 1.2 2005/01/12 16:54:48 pfisterer Exp $ ********************************************************************/ #include #include #include #include "ogg/ogg.h" #include "os.h" #include "misc.h" #include "vorbis/codec.h" #include "codebook.h" #include "scales.h" /**** pack/unpack helpers ******************************************/ int _ilog(unsigned int v){ int ret=0; while(v){ ret++; v>>=1; } return(ret); } /* 32 bit float (not IEEE; nonnormalized mantissa + biased exponent) : neeeeeee eeemmmmm mmmmmmmm mmmmmmmm Why not IEEE? It's just not that important here. */ #define VQ_FEXP 10 #define VQ_FMAN 21 #define VQ_FEXP_BIAS 768 /* bias toward values smaller than 1. */ /* doesn't currently guard under/overflow */ long _float32_pack(float val){ int sign=0; long exp; long mant; if(val<0){ sign=0x80000000; val= -val; } exp= floor(log(val)/log(2.f)); mant=rint(ldexp(val,(VQ_FMAN-1)-exp)); exp=(exp+VQ_FEXP_BIAS)<>VQ_FMAN; if(sign)mant= -mant; return(ldexp(mant,exp-(VQ_FMAN-1)-VQ_FEXP_BIAS)); } /* given a list of word lengths, generate a list of codewords. Works for length ordered or unordered, always assigns the lowest valued codewords first. Extended to handle unused entries (length 0) */ ogg_uint32_t *_make_words(long *l,long n,long sparsecount){ long i,j,count=0; ogg_uint32_t marker[33]; ogg_uint32_t *r=_ogg_malloc((sparsecount?sparsecount:n)*sizeof(*r)); memset(marker,0,sizeof(marker)); for(i=0;i0){ ogg_uint32_t entry=marker[length]; /* when we claim a node for an entry, we also claim the nodes below it (pruning off the imagined tree that may have dangled from it) as well as blocking the use of any nodes directly above for leaves */ /* update ourself */ if(length<32 && (entry>>length)){ /* error condition; the lengths must specify an overpopulated tree */ _ogg_free(r); return(NULL); } r[count++]=entry; /* Look to see if the next shorter marker points to the node above. if so, update it and repeat. */ { for(j=length;j>0;j--){ if(marker[j]&1){ /* have to jump branches */ if(j==1) marker[1]++; else marker[j]=marker[j-1]<<1; break; /* invariant says next upper marker would already have been moved if it was on the same path */ } marker[j]++; } } /* prune the tree; the implicit invariant says all the longer markers were dangling from our just-taken node. Dangle them from our *new* node. */ for(j=length+1;j<33;j++) if((marker[j]>>1) == entry){ entry=marker[j]; marker[j]=marker[j-1]<<1; }else break; }else if(sparsecount==0)count++; } /* bitreverse the words because our bitwise packer/unpacker is LSb endian */ for(i=0,count=0;i>j)&1; } if(sparsecount){ if(l[i]) r[count++]=temp; }else r[count++]=temp; } return(r); } /* there might be a straightforward one-line way to do the below that's portable and totally safe against roundoff, but I haven't thought of it. Therefore, we opt on the side of caution */ long _book_maptype1_quantvals(const static_codebook *b){ long vals=floor(pow((float)b->entries,1.f/b->dim)); /* the above *should* be reliable, but we'll not assume that FP is ever reliable when bitstream sync is at stake; verify via integer means that vals really is the greatest value of dim for which vals^b->bim <= b->entries */ /* treat the above as an initial guess */ while(1){ long acc=1; long acc1=1; int i; for(i=0;idim;i++){ acc*=vals; acc1*=vals+1; } if(acc<=b->entries && acc1>b->entries){ return(vals); }else{ if(acc>b->entries){ vals--; }else{ vals++; } } } } /* unpack the quantized list of values for encode/decode ***********/ /* we need to deal with two map types: in map type 1, the values are generated algorithmically (each column of the vector counts through the values in the quant vector). in map type 2, all the values came in in an explicit list. Both value lists must be unpacked */ float *_book_unquantize(const static_codebook *b,int n,int *sparsemap){ long j,k,count=0; if(b->maptype==1 || b->maptype==2){ int quantvals; float mindel=_float32_unpack(b->q_min); float delta=_float32_unpack(b->q_delta); float *r=_ogg_calloc(n*b->dim,sizeof(*r)); /* maptype 1 and 2 both use a quantized value vector, but different sizes */ switch(b->maptype){ case 1: /* most of the time, entries%dimensions == 0, but we need to be well defined. We define that the possible vales at each scalar is values == entries/dim. If entries%dim != 0, we'll have 'too few' values (values*dimentries;j++){ if((sparsemap && b->lengthlist[j]) || !sparsemap){ float last=0.f; int indexdiv=1; for(k=0;kdim;k++){ int index= (j/indexdiv)%quantvals; float val=b->quantlist[index]; val=fabs(val)*delta+mindel+last; if(b->q_sequencep)last=val; if(sparsemap) r[sparsemap[count]*b->dim+k]=val; else r[count*b->dim+k]=val; indexdiv*=quantvals; } count++; } } break; case 2: for(j=0;jentries;j++){ if((sparsemap && b->lengthlist[j]) || !sparsemap){ float last=0.f; for(k=0;kdim;k++){ float val=b->quantlist[j*b->dim+k]; val=fabs(val)*delta+mindel+last; if(b->q_sequencep)last=val; if(sparsemap) r[sparsemap[count]*b->dim+k]=val; else r[count*b->dim+k]=val; } count++; } } break; } return(r); } return(NULL); } void vorbis_staticbook_clear(static_codebook *b){ if(b->allocedp){ if(b->quantlist)_ogg_free(b->quantlist); if(b->lengthlist)_ogg_free(b->lengthlist); if(b->nearest_tree){ _ogg_free(b->nearest_tree->ptr0); _ogg_free(b->nearest_tree->ptr1); _ogg_free(b->nearest_tree->p); _ogg_free(b->nearest_tree->q); memset(b->nearest_tree,0,sizeof(*b->nearest_tree)); _ogg_free(b->nearest_tree); } if(b->thresh_tree){ _ogg_free(b->thresh_tree->quantthresh); _ogg_free(b->thresh_tree->quantmap); memset(b->thresh_tree,0,sizeof(*b->thresh_tree)); _ogg_free(b->thresh_tree); } memset(b,0,sizeof(*b)); } } void vorbis_staticbook_destroy(static_codebook *b){ if(b->allocedp){ vorbis_staticbook_clear(b); _ogg_free(b); } } void vorbis_book_clear(codebook *b){ /* static book is not cleared; we're likely called on the lookup and the static codebook belongs to the info struct */ if(b->valuelist)_ogg_free(b->valuelist); if(b->codelist)_ogg_free(b->codelist); if(b->dec_index)_ogg_free(b->dec_index); if(b->dec_codelengths)_ogg_free(b->dec_codelengths); if(b->dec_firsttable)_ogg_free(b->dec_firsttable); memset(b,0,sizeof(*b)); } int vorbis_book_init_encode(codebook *c,const static_codebook *s){ memset(c,0,sizeof(*c)); c->c=s; c->entries=s->entries; c->used_entries=s->entries; c->dim=s->dim; c->codelist=_make_words(s->lengthlist,s->entries,0); c->valuelist=_book_unquantize(s,s->entries,NULL); return(0); } static ogg_uint32_t bitreverse(ogg_uint32_t x){ x= ((x>>16)&0x0000ffffUL) | ((x<<16)&0xffff0000UL); x= ((x>> 8)&0x00ff00ffUL) | ((x<< 8)&0xff00ff00UL); x= ((x>> 4)&0x0f0f0f0fUL) | ((x<< 4)&0xf0f0f0f0UL); x= ((x>> 2)&0x33333333UL) | ((x<< 2)&0xccccccccUL); return((x>> 1)&0x55555555UL) | ((x<< 1)&0xaaaaaaaaUL); } static int sort32a(const void *a,const void *b){ return ( **(ogg_uint32_t **)a>**(ogg_uint32_t **)b)- ( **(ogg_uint32_t **)a<**(ogg_uint32_t **)b); } /* decode codebook arrangement is more heavily optimized than encode */ int vorbis_book_init_decode(codebook *c,const static_codebook *s){ int i,j,n=0,tabn; int *sortindex; memset(c,0,sizeof(*c)); /* count actually used entries */ for(i=0;ientries;i++) if(s->lengthlist[i]>0) n++; c->entries=s->entries; c->used_entries=n; c->dim=s->dim; /* two different remappings go on here. First, we collapse the likely sparse codebook down only to actually represented values/words. This collapsing needs to be indexed as map-valueless books are used to encode original entry positions as integers. Second, we reorder all vectors, including the entry index above, by sorted bitreversed codeword to allow treeless decode. */ { /* perform sort */ ogg_uint32_t *codes=_make_words(s->lengthlist,s->entries,c->used_entries); ogg_uint32_t **codep=alloca(sizeof(*codep)*n); if(codes==NULL)goto err_out; for(i=0;icodelist=_ogg_malloc(n*sizeof(*c->codelist)); /* the index is a reverse index */ for(i=0;icodelist[sortindex[i]]=codes[i]; _ogg_free(codes); } c->valuelist=_book_unquantize(s,n,sortindex); c->dec_index=_ogg_malloc(n*sizeof(*c->dec_index)); for(n=0,i=0;ientries;i++) if(s->lengthlist[i]>0) c->dec_index[sortindex[n++]]=i; c->dec_codelengths=_ogg_malloc(n*sizeof(*c->dec_codelengths)); for(n=0,i=0;ientries;i++) if(s->lengthlist[i]>0) c->dec_codelengths[sortindex[n++]]=s->lengthlist[i]; c->dec_firsttablen=_ilog(c->used_entries)-4; /* this is magic */ if(c->dec_firsttablen<5)c->dec_firsttablen=5; if(c->dec_firsttablen>8)c->dec_firsttablen=8; tabn=1<dec_firsttablen; c->dec_firsttable=_ogg_calloc(tabn,sizeof(*c->dec_firsttable)); c->dec_maxlength=0; for(i=0;idec_maxlengthdec_codelengths[i]) c->dec_maxlength=c->dec_codelengths[i]; if(c->dec_codelengths[i]<=c->dec_firsttablen){ ogg_uint32_t orig=bitreverse(c->codelist[i]); for(j=0;j<(1<<(c->dec_firsttablen-c->dec_codelengths[i]));j++) c->dec_firsttable[orig|(j<dec_codelengths[i])]=i+1; } } /* now fill in 'unused' entries in the firsttable with hi/lo search hints for the non-direct-hits */ { ogg_uint32_t mask=0xfffffffeUL<<(31-c->dec_firsttablen); long lo=0,hi=0; for(i=0;idec_firsttablen); if(c->dec_firsttable[bitreverse(word)]==0){ while((lo+1)codelist[lo+1]<=word)lo++; while( hi=(c->codelist[hi]&mask))hi++; /* we only actually have 15 bits per hint to play with here. In order to overflow gracefully (nothing breaks, efficiency just drops), encode as the difference from the extremes. */ { unsigned long loval=lo; unsigned long hival=n-hi; if(loval>0x7fff)loval=0x7fff; if(hival>0x7fff)hival=0x7fff; c->dec_firsttable[bitreverse(word)]= 0x80000000UL | (loval<<15) | hival; } } } } return(0); err_out: vorbis_book_clear(c); return(-1); } static float _dist(int el,float *ref, float *b,int step){ int i; float acc=0.f; for(i=0;ic->thresh_tree; #if 0 encode_aux_nearestmatch *nt=book->c->nearest_tree; encode_aux_pigeonhole *pt=book->c->pigeon_tree; #endif int dim=book->dim; int k,o; /*int savebest=-1; float saverr;*/ /* do we have a threshhold encode hint? */ if(tt){ int index=0,i; /* find the quant val of each scalar */ for(k=0,o=step*(dim-1);kthreshvals>>1; if(a[o]quantthresh[i]){ for(;i>0;i--) if(a[o]>=tt->quantthresh[i-1]) break; }else{ for(i++;ithreshvals-1;i++) if(a[o]quantthresh[i])break; } index=(index*tt->quantvals)+tt->quantmap[i]; } /* regular lattices are easy :-) */ if(book->c->lengthlist[index]>0) /* is this unused? If so, we'll use a decision tree after all and fall through*/ return(index); } #if 0 /* do we have a pigeonhole encode hint? */ if(pt){ const static_codebook *c=book->c; int i,besti=-1; float best=0.f; int entry=0; /* dealing with sequentialness is a pain in the ass */ if(c->q_sequencep){ int pv; long mul=1; float qlast=0; for(k=0,o=0;kmin)/pt->del); if(pv<0 || pv>=pt->mapentries)break; entry+=pt->pigeonmap[pv]*mul; mul*=pt->quantvals; qlast+=pv*pt->del+pt->min; } }else{ for(k=0,o=step*(dim-1);kmin)/pt->del); if(pv<0 || pv>=pt->mapentries)break; entry=entry*pt->quantvals+pt->pigeonmap[pv]; } } /* must be within the pigeonholable range; if we quant outside (or in an entry that we define no list for), brute force it */ if(k==dim && pt->fitlength[entry]){ /* search the abbreviated list */ long *list=pt->fitlist+pt->fitmap[entry]; for(i=0;ifitlength[entry];i++){ float this=_dist(dim,book->valuelist+list[i]*dim,a,step); if(besti==-1 || thisvaluelist+nt->p[ptr]; float *q=book->valuelist+nt->q[ptr]; for(k=0,o=0;k0.f) /* in A */ ptr= -nt->ptr0[ptr]; else /* in B */ ptr= -nt->ptr1[ptr]; if(ptr<=0)break; } return(-ptr); } #endif /* brute force it! */ { const static_codebook *c=book->c; int i,besti=-1; float best=0.f; float *e=book->valuelist; for(i=0;ientries;i++){ if(c->lengthlist[i]>0){ float this=_dist(dim,e,a,step); if(besti==-1 || thisvaluelist+savebest*dim)[i]); fprintf(stderr,"\n" "bruteforce (entry %d, err %g):",besti,best); for(i=0;ivaluelist+besti*dim)[i]); fprintf(stderr,"\n"); }*/ return(besti); } } long vorbis_book_codeword(codebook *book,int entry){ if(book->c) /* only use with encode; decode optimizations are allowed to break this */ return book->codelist[entry]; return -1; } long vorbis_book_codelen(codebook *book,int entry){ if(book->c) /* only use with encode; decode optimizations are allowed to break this */ return book->c->lengthlist[entry]; return -1; } #ifdef _V_SELFTEST /* Unit tests of the dequantizer; this stuff will be OK cross-platform, I simply want to be sure that special mapping cases actually work properly; a bug could go unnoticed for a while */ #include /* cases: no mapping full, explicit mapping algorithmic mapping nonsequential sequential */ static long full_quantlist1[]={0,1,2,3, 4,5,6,7, 8,3,6,1}; static long partial_quantlist1[]={0,7,2}; /* no mapping */ static_codebook test1={ 4,16, NULL, 0, 0,0,0,0, NULL, NULL,NULL }; static float *test1_result=NULL; /* linear, full mapping, nonsequential */ static_codebook test2={ 4,3, NULL, 2, -533200896,1611661312,4,0, full_quantlist1, NULL,NULL }; static float test2_result[]={-3,-2,-1,0, 1,2,3,4, 5,0,3,-2}; /* linear, full mapping, sequential */ static_codebook test3={ 4,3, NULL, 2, -533200896,1611661312,4,1, full_quantlist1, NULL,NULL }; static float test3_result[]={-3,-5,-6,-6, 1,3,6,10, 5,5,8,6}; /* linear, algorithmic mapping, nonsequential */ static_codebook test4={ 3,27, NULL, 1, -533200896,1611661312,4,0, partial_quantlist1, NULL,NULL }; static float test4_result[]={-3,-3,-3, 4,-3,-3, -1,-3,-3, -3, 4,-3, 4, 4,-3, -1, 4,-3, -3,-1,-3, 4,-1,-3, -1,-1,-3, -3,-3, 4, 4,-3, 4, -1,-3, 4, -3, 4, 4, 4, 4, 4, -1, 4, 4, -3,-1, 4, 4,-1, 4, -1,-1, 4, -3,-3,-1, 4,-3,-1, -1,-3,-1, -3, 4,-1, 4, 4,-1, -1, 4,-1, -3,-1,-1, 4,-1,-1, -1,-1,-1}; /* linear, algorithmic mapping, sequential */ static_codebook test5={ 3,27, NULL, 1, -533200896,1611661312,4,1, partial_quantlist1, NULL,NULL }; static float test5_result[]={-3,-6,-9, 4, 1,-2, -1,-4,-7, -3, 1,-2, 4, 8, 5, -1, 3, 0, -3,-4,-7, 4, 3, 0, -1,-2,-5, -3,-6,-2, 4, 1, 5, -1,-4, 0, -3, 1, 5, 4, 8,12, -1, 3, 7, -3,-4, 0, 4, 3, 7, -1,-2, 2, -3,-6,-7, 4, 1, 0, -1,-4,-5, -3, 1, 0, 4, 8, 7, -1, 3, 2, -3,-4,-5, 4, 3, 2, -1,-2,-3}; void run_test(static_codebook *b,float *comp){ float *out=_book_unquantize(b,b->entries,NULL); int i; if(comp){ if(!out){ fprintf(stderr,"_book_unquantize incorrectly returned NULL\n"); exit(1); } for(i=0;ientries*b->dim;i++) if(fabs(out[i]-comp[i])>.0001){ fprintf(stderr,"disagreement in unquantized and reference data:\n" "position %d, %g != %g\n",i,out[i],comp[i]); exit(1); } }else{ if(out){ fprintf(stderr,"_book_unquantize returned a value array: \n" " correct result should have been NULL\n"); exit(1); } } } int main(){ /* run the nine dequant tests, and compare to the hand-rolled results */ fprintf(stderr,"Dequant test 1... "); run_test(&test1,test1_result); fprintf(stderr,"OK\nDequant test 2... "); run_test(&test2,test2_result); fprintf(stderr,"OK\nDequant test 3... "); run_test(&test3,test3_result); fprintf(stderr,"OK\nDequant test 4... "); run_test(&test4,test4_result); fprintf(stderr,"OK\nDequant test 5... "); run_test(&test5,test5_result); fprintf(stderr,"OK\n\n"); return(0); } #endif libtritonus-java-20070428/src/lib/pvorbis/smallft.c0000644000175000017500000005326610167052701022057 0ustar twernertwerner/******************************************************************** * * * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 * * by the XIPHOPHORUS Company http://www.xiph.org/ * * * ******************************************************************** function: *unnormalized* fft transform last mod: $Id: smallft.c,v 1.1 2005/01/05 21:01:53 pfisterer Exp $ ********************************************************************/ /* FFT implementation from OggSquish, minus cosine transforms, * minus all but radix 2/4 case. In Vorbis we only need this * cut-down version. * * To do more than just power-of-two sized vectors, see the full * version I wrote for NetLib. * * Note that the packing is a little strange; rather than the FFT r/i * packing following R_0, I_n, R_1, I_1, R_2, I_2 ... R_n-1, I_n-1, * it follows R_0, R_1, I_1, R_2, I_2 ... R_n-1, I_n-1, I_n like the * FORTRAN version */ #include #include #include #include "smallft.h" #include "misc.h" static void drfti1(int n, float *wa, int *ifac){ static int ntryh[4] = { 4,2,3,5 }; static float tpi = 6.28318530717958648f; float arg,argh,argld,fi; int ntry=0,i,j=-1; int k1, l1, l2, ib; int ld, ii, ip, is, nq, nr; int ido, ipm, nfm1; int nl=n; int nf=0; L101: j++; if (j < 4) ntry=ntryh[j]; else ntry+=2; L104: nq=nl/ntry; nr=nl-ntry*nq; if (nr!=0) goto L101; nf++; ifac[nf+1]=ntry; nl=nq; if(ntry!=2)goto L107; if(nf==1)goto L107; for (i=1;i>1; ipp2=ip; idp2=ido; nbd=(ido-1)>>1; t0=l1*ido; t10=ip*ido; if(ido==1)goto L119; for(ik=0;ikl1){ for(j=1;j>1; ipp2=ip; ipph=(ip+1)>>1; if(idol1)goto L139; is= -ido-1; t1=0; for(j=1;jn==1)return; drftf1(l->n,data,l->trigcache,l->trigcache+l->n,l->splitcache); } void drft_backward(drft_lookup *l,float *data){ if (l->n==1)return; drftb1(l->n,data,l->trigcache,l->trigcache+l->n,l->splitcache); } void drft_init(drft_lookup *l,int n){ l->n=n; l->trigcache=_ogg_calloc(3*n,sizeof(*l->trigcache)); l->splitcache=_ogg_calloc(32,sizeof(*l->splitcache)); fdrffti(n, l->trigcache, l->splitcache); } void drft_clear(drft_lookup *l){ if(l){ if(l->trigcache)_ogg_free(l->trigcache); if(l->splitcache)_ogg_free(l->splitcache); memset(l,0,sizeof(*l)); } } libtritonus-java-20070428/src/lib/pvorbis/smallft.h0000644000175000017500000000240610167052701022052 0ustar twernertwerner/******************************************************************** * * * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 * * by the XIPHOPHORUS Company http://www.xiph.org/ * * * ******************************************************************** function: fft transform last mod: $Id: smallft.h,v 1.1 2005/01/05 21:01:53 pfisterer Exp $ ********************************************************************/ #ifndef _V_SMFT_H_ #define _V_SMFT_H_ #include "vorbis/codec.h" typedef struct { int n; float *trigcache; int *splitcache; } drft_lookup; extern void drft_forward(drft_lookup *l,float *data); extern void drft_backward(drft_lookup *l,float *data); extern void drft_init(drft_lookup *l,int n); extern void drft_clear(drft_lookup *l); #endif libtritonus-java-20070428/src/lib/pvorbis/synthesis.c0000644000175000017500000001147310171253130022432 0ustar twernertwerner/******************************************************************** * * * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 * * by the XIPHOPHORUS Company http://www.xiph.org/ * * * ******************************************************************** function: single-block PCM synthesis last mod: $Id: synthesis.c,v 1.2 2005/01/12 16:54:48 pfisterer Exp $ ********************************************************************/ #include #include "ogg/ogg.h" #include "vorbis/codec.h" #include "codec_internal.h" #include "registry.h" #include "misc.h" #include "os.h" int vorbis_synthesis(vorbis_block *vb,ogg_packet *op){ vorbis_dsp_state *vd=vb->vd; private_state *b=vd->backend_state; vorbis_info *vi=vd->vi; codec_setup_info *ci=vi->codec_setup; oggpack_buffer *opb=&vb->opb; int type,mode,i; /* first things first. Make sure decode is ready */ _vorbis_block_ripcord(vb); oggpack_readinit(opb,op->packet,op->bytes); /* Check the packet type */ if(oggpack_read(opb,1)!=0){ /* Oops. This is not an audio data packet */ return(OV_ENOTAUDIO); } /* read our mode and pre/post windowsize */ mode=oggpack_read(opb,b->modebits); if(mode==-1)return(OV_EBADPACKET); vb->mode=mode; vb->W=ci->mode_param[mode]->blockflag; if(vb->W){ /* this doesn;t get mapped through mode selection as it's used only for window selection */ vb->lW=oggpack_read(opb,1); vb->nW=oggpack_read(opb,1); if(vb->nW==-1) return(OV_EBADPACKET); }else{ vb->lW=0; vb->nW=0; } /* more setup */ vb->granulepos=op->granulepos; vb->sequence=op->packetno; vb->eofflag=op->e_o_s; /* alloc pcm passback storage */ vb->pcmend=ci->blocksizes[vb->W]; vb->pcm=_vorbis_block_alloc(vb,sizeof(*vb->pcm)*vi->channels); for(i=0;ichannels;i++) vb->pcm[i]=_vorbis_block_alloc(vb,vb->pcmend*sizeof(*vb->pcm[i])); /* unpack_header enforces range checking */ type=ci->map_type[ci->mode_param[mode]->mapping]; return(_mapping_P[type]->inverse(vb,ci->map_param[ci->mode_param[mode]-> mapping])); } /* used to track pcm position without actually performing decode. Useful for sequential 'fast forward' */ int vorbis_synthesis_trackonly(vorbis_block *vb,ogg_packet *op){ vorbis_dsp_state *vd=vb->vd; private_state *b=vd->backend_state; vorbis_info *vi=vd->vi; codec_setup_info *ci=vi->codec_setup; oggpack_buffer *opb=&vb->opb; int mode; /* first things first. Make sure decode is ready */ _vorbis_block_ripcord(vb); oggpack_readinit(opb,op->packet,op->bytes); /* Check the packet type */ if(oggpack_read(opb,1)!=0){ /* Oops. This is not an audio data packet */ return(OV_ENOTAUDIO); } /* read our mode and pre/post windowsize */ mode=oggpack_read(opb,b->modebits); if(mode==-1)return(OV_EBADPACKET); vb->mode=mode; vb->W=ci->mode_param[mode]->blockflag; if(vb->W){ vb->lW=oggpack_read(opb,1); vb->nW=oggpack_read(opb,1); if(vb->nW==-1) return(OV_EBADPACKET); }else{ vb->lW=0; vb->nW=0; } /* more setup */ vb->granulepos=op->granulepos; vb->sequence=op->packetno; vb->eofflag=op->e_o_s; /* no pcm */ vb->pcmend=0; vb->pcm=NULL; return(0); } long vorbis_packet_blocksize(vorbis_info *vi,ogg_packet *op){ codec_setup_info *ci=vi->codec_setup; oggpack_buffer opb; int mode; oggpack_readinit(&opb,op->packet,op->bytes); /* Check the packet type */ if(oggpack_read(&opb,1)!=0){ /* Oops. This is not an audio data packet */ return(OV_ENOTAUDIO); } { int modebits=0; int v=ci->modes; while(v>1){ modebits++; v>>=1; } /* read our mode and pre/post windowsize */ mode=oggpack_read(&opb,modebits); } if(mode==-1)return(OV_EBADPACKET); return(ci->blocksizes[ci->mode_param[mode]->blockflag]); } int vorbis_synthesis_halfrate(vorbis_info *vi,int flag){ /* set / clear half-sample-rate mode */ codec_setup_info *ci=vi->codec_setup; /* right now, our MDCT can't handle < 64 sample windows. */ if(ci->blocksizes[0]<=64 && flag)return -1; ci->halfrate_flag=(flag?1:0); return 0; } int vorbis_synthesis_halfrate_p(vorbis_info *vi){ codec_setup_info *ci=vi->codec_setup; return ci->halfrate_flag; } libtritonus-java-20070428/src/lib/pvorbis/vorbisenc.c0000644000175000017500000007650210167052701022405 0ustar twernertwerner/******************************************************************** * * * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 * * by the XIPHOPHORUS Company http://www.xiph.org/ * * * ******************************************************************** function: simple programmatic interface for encoder mode setup last mod: $Id: vorbisenc.c,v 1.1 2005/01/05 21:01:53 pfisterer Exp $ ********************************************************************/ #include #include #include #include "vorbis/codec.h" #include "vorbis/vorbisenc.h" #include "codec_internal.h" #include "os.h" #include "misc.h" /* careful with this; it's using static array sizing to make managing all the modes a little less annoying. If we use a residue backend with > 12 partition types, or a different division of iteration, this needs to be updated. */ typedef struct { static_codebook *books[12][3]; } static_bookblock; typedef struct { int res_type; int limit_type; /* 0 lowpass limited, 1 point stereo limited */ vorbis_info_residue0 *res; static_codebook *book_aux; static_codebook *book_aux_managed; static_bookblock *books_base; static_bookblock *books_base_managed; } vorbis_residue_template; typedef struct { vorbis_info_mapping0 *map; vorbis_residue_template *res; } vorbis_mapping_template; typedef struct vp_adjblock{ int block[P_BANDS]; } vp_adjblock; typedef struct { int data[NOISE_COMPAND_LEVELS]; } compandblock; /* high level configuration information for setting things up step-by-step with the detailed vorbis_encode_ctl interface. There's a fair amount of redundancy such that interactive setup does not directly deal with any vorbis_info or codec_setup_info initialization; it's all stored (until full init) in this highlevel setup, then flushed out to the real codec setup structs later. */ typedef struct { int att[P_NOISECURVES]; float boost; float decay; } att3; typedef struct { int data[P_NOISECURVES]; } adj3; typedef struct { int pre[PACKETBLOBS]; int post[PACKETBLOBS]; float kHz[PACKETBLOBS]; float lowpasskHz[PACKETBLOBS]; } adj_stereo; typedef struct { int lo; int hi; int fixed; } noiseguard; typedef struct { int data[P_NOISECURVES][17]; } noise3; typedef struct { int mappings; double *rate_mapping; double *quality_mapping; int coupling_restriction; long samplerate_min_restriction; long samplerate_max_restriction; int *blocksize_short; int *blocksize_long; att3 *psy_tone_masteratt; int *psy_tone_0dB; int *psy_tone_dBsuppress; vp_adjblock *psy_tone_adj_impulse; vp_adjblock *psy_tone_adj_long; vp_adjblock *psy_tone_adj_other; noiseguard *psy_noiseguards; noise3 *psy_noise_bias_impulse; noise3 *psy_noise_bias_padding; noise3 *psy_noise_bias_trans; noise3 *psy_noise_bias_long; int *psy_noise_dBsuppress; compandblock *psy_noise_compand; double *psy_noise_compand_short_mapping; double *psy_noise_compand_long_mapping; int *psy_noise_normal_start[2]; int *psy_noise_normal_partition[2]; double *psy_noise_normal_thresh; int *psy_ath_float; int *psy_ath_abs; double *psy_lowpass; vorbis_info_psy_global *global_params; double *global_mapping; adj_stereo *stereo_modes; static_codebook ***floor_books; vorbis_info_floor1 *floor_params; int *floor_short_mapping; int *floor_long_mapping; vorbis_mapping_template *maps; } ve_setup_data_template; /* a few static coder conventions */ static vorbis_info_mode _mode_template[2]={ {0,0,0,0}, {1,0,0,1} }; static vorbis_info_mapping0 _map_nominal[2]={ {1, {0,0}, {0}, {0}, 1,{0},{1}}, {1, {0,0}, {1}, {1}, 1,{0},{1}} }; #include "modes/setup_44.h" #include "modes/setup_44u.h" #include "modes/setup_32.h" #include "modes/setup_8.h" #include "modes/setup_11.h" #include "modes/setup_16.h" #include "modes/setup_22.h" #include "modes/setup_X.h" static ve_setup_data_template *setup_list[]={ &ve_setup_44_stereo, &ve_setup_44_stereo_low, &ve_setup_44_uncoupled, &ve_setup_44_uncoupled_low, &ve_setup_32_stereo, &ve_setup_32_stereo_low, &ve_setup_32_uncoupled, &ve_setup_32_uncoupled_low, &ve_setup_22_stereo, &ve_setup_22_uncoupled, &ve_setup_16_stereo, &ve_setup_16_uncoupled, &ve_setup_11_stereo, &ve_setup_11_uncoupled, &ve_setup_8_stereo, &ve_setup_8_uncoupled, &ve_setup_X_stereo, &ve_setup_X_uncoupled, &ve_setup_X_stereo_low, &ve_setup_X_uncoupled_low, &ve_setup_XX_stereo, &ve_setup_XX_uncoupled, 0 }; static int vorbis_encode_toplevel_setup(vorbis_info *vi,int ch,long rate){ if(vi && vi->codec_setup){ vi->version=0; vi->channels=ch; vi->rate=rate; return(0); } return(OV_EINVAL); } static void vorbis_encode_floor_setup(vorbis_info *vi,double s,int block, static_codebook ***books, vorbis_info_floor1 *in, int *x){ int i,k,is=s; vorbis_info_floor1 *f=_ogg_calloc(1,sizeof(*f)); codec_setup_info *ci=vi->codec_setup; memcpy(f,in+x[is],sizeof(*f)); /* fill in the lowpass field, even if it's temporary */ f->n=ci->blocksizes[block]>>1; /* books */ { int partitions=f->partitions; int maxclass=-1; int maxbook=-1; for(i=0;ipartitionclass[i]>maxclass)maxclass=f->partitionclass[i]; for(i=0;i<=maxclass;i++){ if(f->class_book[i]>maxbook)maxbook=f->class_book[i]; f->class_book[i]+=ci->books; for(k=0;k<(1<class_subs[i]);k++){ if(f->class_subbook[i][k]>maxbook)maxbook=f->class_subbook[i][k]; if(f->class_subbook[i][k]>=0)f->class_subbook[i][k]+=ci->books; } } for(i=0;i<=maxbook;i++) ci->book_param[ci->books++]=books[x[is]][i]; } /* for now, we're only using floor 1 */ ci->floor_type[ci->floors]=1; ci->floor_param[ci->floors]=f; ci->floors++; return; } static void vorbis_encode_global_psych_setup(vorbis_info *vi,double s, vorbis_info_psy_global *in, double *x){ int i,is=s; double ds=s-is; codec_setup_info *ci=vi->codec_setup; vorbis_info_psy_global *g=&ci->psy_g_param; memcpy(g,in+(int)x[is],sizeof(*g)); ds=x[is]*(1.-ds)+x[is+1]*ds; is=(int)ds; ds-=is; if(ds==0 && is>0){ is--; ds=1.; } /* interpolate the trigger threshholds */ for(i=0;i<4;i++){ g->preecho_thresh[i]=in[is].preecho_thresh[i]*(1.-ds)+in[is+1].preecho_thresh[i]*ds; g->postecho_thresh[i]=in[is].postecho_thresh[i]*(1.-ds)+in[is+1].postecho_thresh[i]*ds; } g->ampmax_att_per_sec=ci->hi.amplitude_track_dBpersec; return; } static void vorbis_encode_global_stereo(vorbis_info *vi, highlevel_encode_setup *hi, adj_stereo *p){ float s=hi->stereo_point_setting; int i,is=s; double ds=s-is; codec_setup_info *ci=vi->codec_setup; vorbis_info_psy_global *g=&ci->psy_g_param; if(p){ memcpy(g->coupling_prepointamp,p[is].pre,sizeof(*p[is].pre)*PACKETBLOBS); memcpy(g->coupling_postpointamp,p[is].post,sizeof(*p[is].post)*PACKETBLOBS); if(hi->managed){ /* interpolate the kHz threshholds */ for(i=0;icoupling_pointlimit[0][i]=kHz*1000./vi->rate*ci->blocksizes[0]; g->coupling_pointlimit[1][i]=kHz*1000./vi->rate*ci->blocksizes[1]; g->coupling_pkHz[i]=kHz; kHz=p[is].lowpasskHz[i]*(1.-ds)+p[is+1].lowpasskHz[i]*ds; g->sliding_lowpass[0][i]=kHz*1000./vi->rate*ci->blocksizes[0]; g->sliding_lowpass[1][i]=kHz*1000./vi->rate*ci->blocksizes[1]; } }else{ float kHz=p[is].kHz[PACKETBLOBS/2]*(1.-ds)+p[is+1].kHz[PACKETBLOBS/2]*ds; for(i=0;icoupling_pointlimit[0][i]=kHz*1000./vi->rate*ci->blocksizes[0]; g->coupling_pointlimit[1][i]=kHz*1000./vi->rate*ci->blocksizes[1]; g->coupling_pkHz[i]=kHz; } kHz=p[is].lowpasskHz[PACKETBLOBS/2]*(1.-ds)+p[is+1].lowpasskHz[PACKETBLOBS/2]*ds; for(i=0;isliding_lowpass[0][i]=kHz*1000./vi->rate*ci->blocksizes[0]; g->sliding_lowpass[1][i]=kHz*1000./vi->rate*ci->blocksizes[1]; } } }else{ for(i=0;isliding_lowpass[0][i]=ci->blocksizes[0]; g->sliding_lowpass[1][i]=ci->blocksizes[1]; } } return; } static void vorbis_encode_psyset_setup(vorbis_info *vi,double s, int *nn_start, int *nn_partition, double *nn_thresh, int block){ codec_setup_info *ci=vi->codec_setup; vorbis_info_psy *p=ci->psy_param[block]; highlevel_encode_setup *hi=&ci->hi; int is=s; if(block>=ci->psys) ci->psys=block+1; if(!p){ p=_ogg_calloc(1,sizeof(*p)); ci->psy_param[block]=p; } memcpy(p,&_psy_info_template,sizeof(*p)); p->blockflag=block>>1; if(hi->noise_normalize_p){ p->normal_channel_p=1; p->normal_point_p=1; p->normal_start=nn_start[is]; p->normal_partition=nn_partition[is]; p->normal_thresh=nn_thresh[is]; } return; } static void vorbis_encode_tonemask_setup(vorbis_info *vi,double s,int block, att3 *att, int *max, vp_adjblock *in){ int i,is=s; double ds=s-is; codec_setup_info *ci=vi->codec_setup; vorbis_info_psy *p=ci->psy_param[block]; /* 0 and 2 are only used by bitmanagement, but there's no harm to always filling the values in here */ p->tone_masteratt[0]=att[is].att[0]*(1.-ds)+att[is+1].att[0]*ds; p->tone_masteratt[1]=att[is].att[1]*(1.-ds)+att[is+1].att[1]*ds; p->tone_masteratt[2]=att[is].att[2]*(1.-ds)+att[is+1].att[2]*ds; p->tone_centerboost=att[is].boost*(1.-ds)+att[is+1].boost*ds; p->tone_decay=att[is].decay*(1.-ds)+att[is+1].decay*ds; p->max_curve_dB=max[is]*(1.-ds)+max[is+1]*ds; for(i=0;itoneatt[i]=in[is].block[i]*(1.-ds)+in[is+1].block[i]*ds; return; } static void vorbis_encode_compand_setup(vorbis_info *vi,double s,int block, compandblock *in, double *x){ int i,is=s; double ds=s-is; codec_setup_info *ci=vi->codec_setup; vorbis_info_psy *p=ci->psy_param[block]; ds=x[is]*(1.-ds)+x[is+1]*ds; is=(int)ds; ds-=is; if(ds==0 && is>0){ is--; ds=1.; } /* interpolate the compander settings */ for(i=0;inoisecompand[i]=in[is].data[i]*(1.-ds)+in[is+1].data[i]*ds; return; } static void vorbis_encode_peak_setup(vorbis_info *vi,double s,int block, int *suppress){ int is=s; double ds=s-is; codec_setup_info *ci=vi->codec_setup; vorbis_info_psy *p=ci->psy_param[block]; p->tone_abs_limit=suppress[is]*(1.-ds)+suppress[is+1]*ds; return; } static void vorbis_encode_noisebias_setup(vorbis_info *vi,double s,int block, int *suppress, noise3 *in, noiseguard *guard, double userbias){ int i,is=s,j; double ds=s-is; codec_setup_info *ci=vi->codec_setup; vorbis_info_psy *p=ci->psy_param[block]; p->noisemaxsupp=suppress[is]*(1.-ds)+suppress[is+1]*ds; p->noisewindowlomin=guard[block].lo; p->noisewindowhimin=guard[block].hi; p->noisewindowfixed=guard[block].fixed; for(j=0;jnoiseoff[j][i]=in[is].data[j][i]*(1.-ds)+in[is+1].data[j][i]*ds; /* impulse blocks may take a user specified bias to boost the nominal/high noise encoding depth */ for(j=0;jnoiseoff[j][0]+6; /* the lowest it can go */ for(i=0;inoiseoff[j][i]+=userbias; if(p->noiseoff[j][i]noiseoff[j][i]=min; } } return; } static void vorbis_encode_ath_setup(vorbis_info *vi,int block){ codec_setup_info *ci=vi->codec_setup; vorbis_info_psy *p=ci->psy_param[block]; p->ath_adjatt=ci->hi.ath_floating_dB; p->ath_maxatt=ci->hi.ath_absolute_dB; return; } static int book_dup_or_new(codec_setup_info *ci,static_codebook *book){ int i; for(i=0;ibooks;i++) if(ci->book_param[i]==book)return(i); return(ci->books++); } static void vorbis_encode_blocksize_setup(vorbis_info *vi,double s, int *shortb,int *longb){ codec_setup_info *ci=vi->codec_setup; int is=s; int blockshort=shortb[is]; int blocklong=longb[is]; ci->blocksizes[0]=blockshort; ci->blocksizes[1]=blocklong; } static void vorbis_encode_residue_setup(vorbis_info *vi, int number, int block, vorbis_residue_template *res){ codec_setup_info *ci=vi->codec_setup; int i,n; vorbis_info_residue0 *r=ci->residue_param[number]= _ogg_malloc(sizeof(*r)); memcpy(r,res->res,sizeof(*r)); if(ci->residues<=number)ci->residues=number+1; switch(ci->blocksizes[block]){ case 64:case 128:case 256: r->grouping=16; break; default: r->grouping=32; break; } ci->residue_type[number]=res->res_type; /* to be adjusted by lowpass/pointlimit later */ n=r->end=ci->blocksizes[block]>>1; if(res->res_type==2) n=r->end*=vi->channels; /* fill in all the books */ { int booklist=0,k; if(ci->hi.managed){ for(i=0;ipartitions;i++) for(k=0;k<3;k++) if(res->books_base_managed->books[i][k]) r->secondstages[i]|=(1<groupbook=book_dup_or_new(ci,res->book_aux_managed); ci->book_param[r->groupbook]=res->book_aux_managed; for(i=0;ipartitions;i++){ for(k=0;k<3;k++){ if(res->books_base_managed->books[i][k]){ int bookid=book_dup_or_new(ci,res->books_base_managed->books[i][k]); r->booklist[booklist++]=bookid; ci->book_param[bookid]=res->books_base_managed->books[i][k]; } } } }else{ for(i=0;ipartitions;i++) for(k=0;k<3;k++) if(res->books_base->books[i][k]) r->secondstages[i]|=(1<groupbook=book_dup_or_new(ci,res->book_aux); ci->book_param[r->groupbook]=res->book_aux; for(i=0;ipartitions;i++){ for(k=0;k<3;k++){ if(res->books_base->books[i][k]){ int bookid=book_dup_or_new(ci,res->books_base->books[i][k]); r->booklist[booklist++]=bookid; ci->book_param[bookid]=res->books_base->books[i][k]; } } } } } /* lowpass setup/pointlimit */ { double freq=ci->hi.lowpass_kHz*1000.; vorbis_info_floor1 *f=ci->floor_param[block]; /* by convention */ double nyq=vi->rate/2.; long blocksize=ci->blocksizes[block]>>1; /* lowpass needs to be set in the floor and the residue. */ if(freq>nyq)freq=nyq; /* in the floor, the granularity can be very fine; it doesn't alter the encoding structure, only the samples used to fit the floor approximation */ f->n=freq/nyq*blocksize; /* this res may by limited by the maximum pointlimit of the mode, not the lowpass. the floor is always lowpass limited. */ if(res->limit_type){ if(ci->hi.managed) freq=ci->psy_g_param.coupling_pkHz[PACKETBLOBS-1]*1000.; else freq=ci->psy_g_param.coupling_pkHz[PACKETBLOBS/2]*1000.; if(freq>nyq)freq=nyq; } /* in the residue, we're constrained, physically, by partition boundaries. We still lowpass 'wherever', but we have to round up here to next boundary, or the vorbis spec will round it *down* to previous boundary in encode/decode */ if(ci->residue_type[block]==2) r->end=(int)((freq/nyq*blocksize*2)/r->grouping+.9)* /* round up only if we're well past */ r->grouping; else r->end=(int)((freq/nyq*blocksize)/r->grouping+.9)* /* round up only if we're well past */ r->grouping; } } /* we assume two maps in this encoder */ static void vorbis_encode_map_n_res_setup(vorbis_info *vi,double s, vorbis_mapping_template *maps){ codec_setup_info *ci=vi->codec_setup; int i,j,is=s,modes=2; vorbis_info_mapping0 *map=maps[is].map; vorbis_info_mode *mode=_mode_template; vorbis_residue_template *res=maps[is].res; if(ci->blocksizes[0]==ci->blocksizes[1])modes=1; for(i=0;imap_param[i]=_ogg_calloc(1,sizeof(*map)); ci->mode_param[i]=_ogg_calloc(1,sizeof(*mode)); memcpy(ci->mode_param[i],mode+i,sizeof(*_mode_template)); if(i>=ci->modes)ci->modes=i+1; ci->map_type[i]=0; memcpy(ci->map_param[i],map+i,sizeof(*map)); if(i>=ci->maps)ci->maps=i+1; for(j=0;jcodec_setup; highlevel_encode_setup *hi=&ci->hi; ve_setup_data_template *setup=(ve_setup_data_template *)hi->setup; int is=hi->base_setting; double ds=hi->base_setting-is; int ch=vi->channels; double *r=setup->rate_mapping; if(r==NULL) return(-1); return((r[is]*(1.-ds)+r[is+1]*ds)*ch); } static void get_setup_template(vorbis_info *vi, long ch,long srate, double req,int q_or_bitrate){ int i=0,j; codec_setup_info *ci=vi->codec_setup; highlevel_encode_setup *hi=&ci->hi; if(q_or_bitrate)req/=ch; while(setup_list[i]){ if(setup_list[i]->coupling_restriction==-1 || setup_list[i]->coupling_restriction==ch){ if(srate>=setup_list[i]->samplerate_min_restriction && srate<=setup_list[i]->samplerate_max_restriction){ int mappings=setup_list[i]->mappings; double *map=(q_or_bitrate? setup_list[i]->rate_mapping: setup_list[i]->quality_mapping); /* the template matches. Does the requested quality mode fall within this template's modes? */ if(reqmap[setup_list[i]->mappings]){++i;continue;} for(j=0;j=map[j] && reqsetup=setup_list[i]; if(j==mappings) hi->base_setting=j-.001; else{ float low=map[j]; float high=map[j+1]; float del=(req-low)/(high-low); hi->base_setting=j+del; } return; } } i++; } hi->setup=NULL; } /* encoders will need to use vorbis_info_init beforehand and call vorbis_info clear when all done */ /* two interfaces; this, more detailed one, and later a convenience layer on top */ /* the final setup call */ int vorbis_encode_setup_init(vorbis_info *vi){ int i0=0,singleblock=0; codec_setup_info *ci=vi->codec_setup; ve_setup_data_template *setup=NULL; highlevel_encode_setup *hi=&ci->hi; if(ci==NULL)return(OV_EINVAL); if(!hi->impulse_block_p)i0=1; /* too low/high an ATH floater is nonsensical, but doesn't break anything */ if(hi->ath_floating_dB>-80)hi->ath_floating_dB=-80; if(hi->ath_floating_dB<-200)hi->ath_floating_dB=-200; /* again, bound this to avoid the app shooting itself int he foot too badly */ if(hi->amplitude_track_dBpersec>0.)hi->amplitude_track_dBpersec=0.; if(hi->amplitude_track_dBpersec<-99999.)hi->amplitude_track_dBpersec=-99999.; /* get the appropriate setup template; matches the fetch in previous stages */ setup=(ve_setup_data_template *)hi->setup; if(setup==NULL)return(OV_EINVAL); hi->set_in_stone=1; /* choose block sizes from configured sizes as well as paying attention to long_block_p and short_block_p. If the configured short and long blocks are the same length, we set long_block_p and unset short_block_p */ vorbis_encode_blocksize_setup(vi,hi->base_setting, setup->blocksize_short, setup->blocksize_long); if(ci->blocksizes[0]==ci->blocksizes[1])singleblock=1; /* floor setup; choose proper floor params. Allocated on the floor stack in order; if we alloc only long floor, it's 0 */ vorbis_encode_floor_setup(vi,hi->short_setting,0, setup->floor_books, setup->floor_params, setup->floor_short_mapping); if(!singleblock) vorbis_encode_floor_setup(vi,hi->long_setting,1, setup->floor_books, setup->floor_params, setup->floor_long_mapping); /* setup of [mostly] short block detection and stereo*/ vorbis_encode_global_psych_setup(vi,hi->trigger_setting, setup->global_params, setup->global_mapping); vorbis_encode_global_stereo(vi,hi,setup->stereo_modes); /* basic psych setup and noise normalization */ vorbis_encode_psyset_setup(vi,hi->short_setting, setup->psy_noise_normal_start[0], setup->psy_noise_normal_partition[0], setup->psy_noise_normal_thresh, 0); vorbis_encode_psyset_setup(vi,hi->short_setting, setup->psy_noise_normal_start[0], setup->psy_noise_normal_partition[0], setup->psy_noise_normal_thresh, 1); if(!singleblock){ vorbis_encode_psyset_setup(vi,hi->long_setting, setup->psy_noise_normal_start[1], setup->psy_noise_normal_partition[1], setup->psy_noise_normal_thresh, 2); vorbis_encode_psyset_setup(vi,hi->long_setting, setup->psy_noise_normal_start[1], setup->psy_noise_normal_partition[1], setup->psy_noise_normal_thresh, 3); } /* tone masking setup */ vorbis_encode_tonemask_setup(vi,hi->block[i0].tone_mask_setting,0, setup->psy_tone_masteratt, setup->psy_tone_0dB, setup->psy_tone_adj_impulse); vorbis_encode_tonemask_setup(vi,hi->block[1].tone_mask_setting,1, setup->psy_tone_masteratt, setup->psy_tone_0dB, setup->psy_tone_adj_other); if(!singleblock){ vorbis_encode_tonemask_setup(vi,hi->block[2].tone_mask_setting,2, setup->psy_tone_masteratt, setup->psy_tone_0dB, setup->psy_tone_adj_other); vorbis_encode_tonemask_setup(vi,hi->block[3].tone_mask_setting,3, setup->psy_tone_masteratt, setup->psy_tone_0dB, setup->psy_tone_adj_long); } /* noise companding setup */ vorbis_encode_compand_setup(vi,hi->block[i0].noise_compand_setting,0, setup->psy_noise_compand, setup->psy_noise_compand_short_mapping); vorbis_encode_compand_setup(vi,hi->block[1].noise_compand_setting,1, setup->psy_noise_compand, setup->psy_noise_compand_short_mapping); if(!singleblock){ vorbis_encode_compand_setup(vi,hi->block[2].noise_compand_setting,2, setup->psy_noise_compand, setup->psy_noise_compand_long_mapping); vorbis_encode_compand_setup(vi,hi->block[3].noise_compand_setting,3, setup->psy_noise_compand, setup->psy_noise_compand_long_mapping); } /* peak guarding setup */ vorbis_encode_peak_setup(vi,hi->block[i0].tone_peaklimit_setting,0, setup->psy_tone_dBsuppress); vorbis_encode_peak_setup(vi,hi->block[1].tone_peaklimit_setting,1, setup->psy_tone_dBsuppress); if(!singleblock){ vorbis_encode_peak_setup(vi,hi->block[2].tone_peaklimit_setting,2, setup->psy_tone_dBsuppress); vorbis_encode_peak_setup(vi,hi->block[3].tone_peaklimit_setting,3, setup->psy_tone_dBsuppress); } /* noise bias setup */ vorbis_encode_noisebias_setup(vi,hi->block[i0].noise_bias_setting,0, setup->psy_noise_dBsuppress, setup->psy_noise_bias_impulse, setup->psy_noiseguards, (i0==0?hi->impulse_noisetune:0.)); vorbis_encode_noisebias_setup(vi,hi->block[1].noise_bias_setting,1, setup->psy_noise_dBsuppress, setup->psy_noise_bias_padding, setup->psy_noiseguards,0.); if(!singleblock){ vorbis_encode_noisebias_setup(vi,hi->block[2].noise_bias_setting,2, setup->psy_noise_dBsuppress, setup->psy_noise_bias_trans, setup->psy_noiseguards,0.); vorbis_encode_noisebias_setup(vi,hi->block[3].noise_bias_setting,3, setup->psy_noise_dBsuppress, setup->psy_noise_bias_long, setup->psy_noiseguards,0.); } vorbis_encode_ath_setup(vi,0); vorbis_encode_ath_setup(vi,1); if(!singleblock){ vorbis_encode_ath_setup(vi,2); vorbis_encode_ath_setup(vi,3); } vorbis_encode_map_n_res_setup(vi,hi->base_setting,setup->maps); /* set bitrate readonlies and management */ vi->bitrate_nominal=setting_to_approx_bitrate(vi); vi->bitrate_lower=hi->bitrate_min; vi->bitrate_upper=hi->bitrate_max; vi->bitrate_window=hi->bitrate_limit_window; if(hi->managed){ ci->bi.queue_avg_time=hi->bitrate_av_window; ci->bi.queue_avg_center=hi->bitrate_av_window_center; ci->bi.queue_minmax_time=hi->bitrate_limit_window; ci->bi.queue_hardmin=hi->bitrate_min; ci->bi.queue_hardmax=hi->bitrate_max; ci->bi.queue_avgmin=hi->bitrate_av_lo; ci->bi.queue_avgmax=hi->bitrate_av_hi; ci->bi.avgfloat_downslew_max=-999999.f; ci->bi.avgfloat_upslew_max=999999.f; } return(0); } static int vorbis_encode_setup_setting(vorbis_info *vi, long channels, long rate){ int ret=0,i,is; codec_setup_info *ci=vi->codec_setup; highlevel_encode_setup *hi=&ci->hi; ve_setup_data_template *setup=hi->setup; double ds; ret=vorbis_encode_toplevel_setup(vi,channels,rate); if(ret)return(ret); is=hi->base_setting; ds=hi->base_setting-is; hi->short_setting=hi->base_setting; hi->long_setting=hi->base_setting; hi->managed=0; hi->impulse_block_p=1; hi->noise_normalize_p=1; hi->stereo_point_setting=hi->base_setting; hi->lowpass_kHz= setup->psy_lowpass[is]*(1.-ds)+setup->psy_lowpass[is+1]*ds; hi->ath_floating_dB=setup->psy_ath_float[is]*(1.-ds)+ setup->psy_ath_float[is+1]*ds; hi->ath_absolute_dB=setup->psy_ath_abs[is]*(1.-ds)+ setup->psy_ath_abs[is+1]*ds; hi->amplitude_track_dBpersec=-6.; hi->trigger_setting=hi->base_setting; for(i=0;i<4;i++){ hi->block[i].tone_mask_setting=hi->base_setting; hi->block[i].tone_peaklimit_setting=hi->base_setting; hi->block[i].noise_bias_setting=hi->base_setting; hi->block[i].noise_compand_setting=hi->base_setting; } return(ret); } int vorbis_encode_setup_vbr(vorbis_info *vi, long channels, long rate, float quality){ codec_setup_info *ci=vi->codec_setup; highlevel_encode_setup *hi=&ci->hi; quality+=.00001; if(quality>=1.)quality=.9999; get_setup_template(vi,channels,rate,quality,0); if(!hi->setup)return OV_EIMPL; return vorbis_encode_setup_setting(vi,channels,rate); } int vorbis_encode_init_vbr(vorbis_info *vi, long channels, long rate, float base_quality /* 0. to 1. */ ){ int ret=0; ret=vorbis_encode_setup_vbr(vi,channels,rate,base_quality); if(ret){ vorbis_info_clear(vi); return ret; } ret=vorbis_encode_setup_init(vi); if(ret) vorbis_info_clear(vi); return(ret); } int vorbis_encode_setup_managed(vorbis_info *vi, long channels, long rate, long max_bitrate, long nominal_bitrate, long min_bitrate){ codec_setup_info *ci=vi->codec_setup; highlevel_encode_setup *hi=&ci->hi; double tnominal=nominal_bitrate; int ret=0; if(nominal_bitrate<=0.){ if(max_bitrate>0.){ nominal_bitrate=max_bitrate*.875; }else{ if(min_bitrate>0.){ nominal_bitrate=min_bitrate; }else{ return(OV_EINVAL); } } } get_setup_template(vi,channels,rate,nominal_bitrate,1); if(!hi->setup)return OV_EIMPL; ret=vorbis_encode_setup_setting(vi,channels,rate); if(ret){ vorbis_info_clear(vi); return ret; } /* initialize management with sane defaults */ /* initialize management with sane defaults */ hi->managed=1; hi->bitrate_av_window=4.; hi->bitrate_av_window_center=.5; hi->bitrate_limit_window=2.; hi->bitrate_min=min_bitrate; hi->bitrate_max=max_bitrate; hi->bitrate_av_lo=tnominal; hi->bitrate_av_hi=tnominal; return(ret); } int vorbis_encode_init(vorbis_info *vi, long channels, long rate, long max_bitrate, long nominal_bitrate, long min_bitrate){ int ret=vorbis_encode_setup_managed(vi,channels,rate, max_bitrate, nominal_bitrate, min_bitrate); if(ret){ vorbis_info_clear(vi); return(ret); } ret=vorbis_encode_setup_init(vi); if(ret) vorbis_info_clear(vi); return(ret); } int vorbis_encode_ctl(vorbis_info *vi,int number,void *arg){ if(vi){ codec_setup_info *ci=vi->codec_setup; highlevel_encode_setup *hi=&ci->hi; int setp=(number&0xf); /* a read request has a low nibble of 0 */ if(setp && hi->set_in_stone)return(OV_EINVAL); switch(number){ case OV_ECTL_RATEMANAGE_GET: { struct ovectl_ratemanage_arg *ai= (struct ovectl_ratemanage_arg *)arg; ai->management_active=hi->managed; ai->bitrate_av_window=hi->bitrate_av_window; ai->bitrate_av_window_center=hi->bitrate_av_window_center; ai->bitrate_hard_window=hi->bitrate_limit_window; ai->bitrate_hard_min=hi->bitrate_min; ai->bitrate_hard_max=hi->bitrate_max; ai->bitrate_av_lo=hi->bitrate_av_lo; ai->bitrate_av_hi=hi->bitrate_av_hi; } return(0); case OV_ECTL_RATEMANAGE_SET: { struct ovectl_ratemanage_arg *ai= (struct ovectl_ratemanage_arg *)arg; if(ai==NULL){ hi->managed=0; }else{ hi->managed=ai->management_active; vorbis_encode_ctl(vi,OV_ECTL_RATEMANAGE_AVG,arg); vorbis_encode_ctl(vi,OV_ECTL_RATEMANAGE_HARD,arg); } } return 0; case OV_ECTL_RATEMANAGE_AVG: { struct ovectl_ratemanage_arg *ai= (struct ovectl_ratemanage_arg *)arg; if(ai==NULL){ hi->bitrate_av_lo=0; hi->bitrate_av_hi=0; hi->bitrate_av_window=0; }else{ hi->bitrate_av_window=ai->bitrate_av_window; hi->bitrate_av_window_center=ai->bitrate_av_window_center; hi->bitrate_av_lo=ai->bitrate_av_lo; hi->bitrate_av_hi=ai->bitrate_av_hi; } if(hi->bitrate_av_window<.25)hi->bitrate_av_window=.25; if(hi->bitrate_av_window>10.)hi->bitrate_av_window=10.; if(hi->bitrate_av_window_center<0.)hi->bitrate_av_window=0.; if(hi->bitrate_av_window_center>1.)hi->bitrate_av_window=1.; if( ( (hi->bitrate_av_lo<=0 && hi->bitrate_av_hi<=0)|| (hi->bitrate_av_window<=0) ) && ( (hi->bitrate_min<=0 && hi->bitrate_max<=0)|| (hi->bitrate_limit_window<=0) )) hi->managed=0; } return(0); case OV_ECTL_RATEMANAGE_HARD: { struct ovectl_ratemanage_arg *ai= (struct ovectl_ratemanage_arg *)arg; if(ai==NULL){ hi->bitrate_min=0; hi->bitrate_max=0; hi->bitrate_limit_window=0; }else{ hi->bitrate_limit_window=ai->bitrate_hard_window; hi->bitrate_min=ai->bitrate_hard_min; hi->bitrate_max=ai->bitrate_hard_max; } if(hi->bitrate_limit_window<0.)hi->bitrate_limit_window=0.; if(hi->bitrate_limit_window>10.)hi->bitrate_limit_window=10.; if( ( (hi->bitrate_av_lo<=0 && hi->bitrate_av_hi<=0)|| (hi->bitrate_av_window<=0) ) && ( (hi->bitrate_min<=0 && hi->bitrate_max<=0)|| (hi->bitrate_limit_window<=0) )) hi->managed=0; } return(0); case OV_ECTL_LOWPASS_GET: { double *farg=(double *)arg; *farg=hi->lowpass_kHz; } return(0); case OV_ECTL_LOWPASS_SET: { double *farg=(double *)arg; hi->lowpass_kHz=*farg; if(hi->lowpass_kHz<2.)hi->lowpass_kHz=2.; if(hi->lowpass_kHz>99.)hi->lowpass_kHz=99.; } return(0); case OV_ECTL_IBLOCK_GET: { double *farg=(double *)arg; *farg=hi->impulse_noisetune; } return(0); case OV_ECTL_IBLOCK_SET: { double *farg=(double *)arg; hi->impulse_noisetune=*farg; if(hi->impulse_noisetune>0.)hi->impulse_noisetune=0.; if(hi->impulse_noisetune<-15.)hi->impulse_noisetune=-15.; } return(0); } return(OV_EIMPL); } return(OV_EINVAL); } libtritonus-java-20070428/src/lib/pvorbis/window.c0000644000175000017500000037715110167052701021726 0ustar twernertwerner/******************************************************************** * * * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 * * by the XIPHOPHORUS Company http://www.xiph.org/ * * * ******************************************************************** function: window functions last mod: $Id: window.c,v 1.1 2005/01/05 21:01:53 pfisterer Exp $ ********************************************************************/ #include #include #include "os.h" #include "misc.h" static float vwin64[32] = { 0.0009460463F, 0.0085006468F, 0.0235352254F, 0.0458950567F, 0.0753351908F, 0.1115073077F, 0.1539457973F, 0.2020557475F, 0.2551056759F, 0.3122276645F, 0.3724270287F, 0.4346027792F, 0.4975789974F, 0.5601459521F, 0.6211085051F, 0.6793382689F, 0.7338252629F, 0.7837245849F, 0.8283939355F, 0.8674186656F, 0.9006222429F, 0.9280614787F, 0.9500073081F, 0.9669131782F, 0.9793740220F, 0.9880792941F, 0.9937636139F, 0.9971582668F, 0.9989462667F, 0.9997230082F, 0.9999638688F, 0.9999995525F, }; static float vwin128[64] = { 0.0002365472F, 0.0021280687F, 0.0059065254F, 0.0115626550F, 0.0190823442F, 0.0284463735F, 0.0396300935F, 0.0526030430F, 0.0673285281F, 0.0837631763F, 0.1018564887F, 0.1215504095F, 0.1427789367F, 0.1654677960F, 0.1895342001F, 0.2148867160F, 0.2414252576F, 0.2690412240F, 0.2976177952F, 0.3270303960F, 0.3571473350F, 0.3878306189F, 0.4189369387F, 0.4503188188F, 0.4818259135F, 0.5133064334F, 0.5446086751F, 0.5755826278F, 0.6060816248F, 0.6359640047F, 0.6650947483F, 0.6933470543F, 0.7206038179F, 0.7467589810F, 0.7717187213F, 0.7954024542F, 0.8177436264F, 0.8386902831F, 0.8582053981F, 0.8762669622F, 0.8928678298F, 0.9080153310F, 0.9217306608F, 0.9340480615F, 0.9450138200F, 0.9546851041F, 0.9631286621F, 0.9704194171F, 0.9766389810F, 0.9818741197F, 0.9862151938F, 0.9897546035F, 0.9925852598F, 0.9947991032F, 0.9964856900F, 0.9977308602F, 0.9986155015F, 0.9992144193F, 0.9995953200F, 0.9998179155F, 0.9999331503F, 0.9999825563F, 0.9999977357F, 0.9999999720F, }; static float vwin256[128] = { 0.0000591390F, 0.0005321979F, 0.0014780301F, 0.0028960636F, 0.0047854363F, 0.0071449926F, 0.0099732775F, 0.0132685298F, 0.0170286741F, 0.0212513119F, 0.0259337111F, 0.0310727950F, 0.0366651302F, 0.0427069140F, 0.0491939614F, 0.0561216907F, 0.0634851102F, 0.0712788035F, 0.0794969160F, 0.0881331402F, 0.0971807028F, 0.1066323515F, 0.1164803426F, 0.1267164297F, 0.1373318534F, 0.1483173323F, 0.1596630553F, 0.1713586755F, 0.1833933062F, 0.1957555184F, 0.2084333404F, 0.2214142599F, 0.2346852280F, 0.2482326664F, 0.2620424757F, 0.2761000481F, 0.2903902813F, 0.3048975959F, 0.3196059553F, 0.3344988887F, 0.3495595160F, 0.3647705766F, 0.3801144597F, 0.3955732382F, 0.4111287047F, 0.4267624093F, 0.4424557009F, 0.4581897696F, 0.4739456913F, 0.4897044744F, 0.5054471075F, 0.5211546088F, 0.5368080763F, 0.5523887395F, 0.5678780103F, 0.5832575361F, 0.5985092508F, 0.6136154277F, 0.6285587300F, 0.6433222619F, 0.6578896175F, 0.6722449294F, 0.6863729144F, 0.7002589187F, 0.7138889597F, 0.7272497662F, 0.7403288154F, 0.7531143679F, 0.7655954985F, 0.7777621249F, 0.7896050322F, 0.8011158947F, 0.8122872932F, 0.8231127294F, 0.8335866365F, 0.8437043850F, 0.8534622861F, 0.8628575905F, 0.8718884835F, 0.8805540765F, 0.8888543947F, 0.8967903616F, 0.9043637797F, 0.9115773078F, 0.9184344360F, 0.9249394562F, 0.9310974312F, 0.9369141608F, 0.9423961446F, 0.9475505439F, 0.9523851406F, 0.9569082947F, 0.9611289005F, 0.9650563408F, 0.9687004405F, 0.9720714191F, 0.9751798427F, 0.9780365753F, 0.9806527301F, 0.9830396204F, 0.9852087111F, 0.9871715701F, 0.9889398207F, 0.9905250941F, 0.9919389832F, 0.9931929973F, 0.9942985174F, 0.9952667537F, 0.9961087037F, 0.9968351119F, 0.9974564312F, 0.9979827858F, 0.9984239359F, 0.9987892441F, 0.9990876435F, 0.9993276081F, 0.9995171241F, 0.9996636648F, 0.9997741654F, 0.9998550016F, 0.9999119692F, 0.9999502656F, 0.9999744742F, 0.9999885497F, 0.9999958064F, 0.9999989077F, 0.9999998584F, 0.9999999983F, }; static float vwin512[256] = { 0.0000147849F, 0.0001330607F, 0.0003695946F, 0.0007243509F, 0.0011972759F, 0.0017882983F, 0.0024973285F, 0.0033242588F, 0.0042689632F, 0.0053312973F, 0.0065110982F, 0.0078081841F, 0.0092223540F, 0.0107533880F, 0.0124010466F, 0.0141650703F, 0.0160451800F, 0.0180410758F, 0.0201524373F, 0.0223789233F, 0.0247201710F, 0.0271757958F, 0.0297453914F, 0.0324285286F, 0.0352247556F, 0.0381335972F, 0.0411545545F, 0.0442871045F, 0.0475306997F, 0.0508847676F, 0.0543487103F, 0.0579219038F, 0.0616036982F, 0.0653934164F, 0.0692903546F, 0.0732937809F, 0.0774029356F, 0.0816170305F, 0.0859352485F, 0.0903567428F, 0.0948806375F, 0.0995060259F, 0.1042319712F, 0.1090575056F, 0.1139816300F, 0.1190033137F, 0.1241214941F, 0.1293350764F, 0.1346429333F, 0.1400439046F, 0.1455367974F, 0.1511203852F, 0.1567934083F, 0.1625545735F, 0.1684025537F, 0.1743359881F, 0.1803534820F, 0.1864536069F, 0.1926349000F, 0.1988958650F, 0.2052349715F, 0.2116506555F, 0.2181413191F, 0.2247053313F, 0.2313410275F, 0.2380467105F, 0.2448206500F, 0.2516610835F, 0.2585662164F, 0.2655342226F, 0.2725632448F, 0.2796513950F, 0.2867967551F, 0.2939973773F, 0.3012512852F, 0.3085564739F, 0.3159109111F, 0.3233125375F, 0.3307592680F, 0.3382489922F, 0.3457795756F, 0.3533488602F, 0.3609546657F, 0.3685947904F, 0.3762670121F, 0.3839690896F, 0.3916987634F, 0.3994537572F, 0.4072317788F, 0.4150305215F, 0.4228476653F, 0.4306808783F, 0.4385278181F, 0.4463861329F, 0.4542534630F, 0.4621274424F, 0.4700057001F, 0.4778858615F, 0.4857655502F, 0.4936423891F, 0.5015140023F, 0.5093780165F, 0.5172320626F, 0.5250737772F, 0.5329008043F, 0.5407107971F, 0.5485014192F, 0.5562703465F, 0.5640152688F, 0.5717338914F, 0.5794239366F, 0.5870831457F, 0.5947092801F, 0.6023001235F, 0.6098534829F, 0.6173671907F, 0.6248391059F, 0.6322671161F, 0.6396491384F, 0.6469831217F, 0.6542670475F, 0.6614989319F, 0.6686768267F, 0.6757988210F, 0.6828630426F, 0.6898676592F, 0.6968108799F, 0.7036909564F, 0.7105061843F, 0.7172549043F, 0.7239355032F, 0.7305464154F, 0.7370861235F, 0.7435531598F, 0.7499461068F, 0.7562635986F, 0.7625043214F, 0.7686670148F, 0.7747504721F, 0.7807535410F, 0.7866751247F, 0.7925141825F, 0.7982697296F, 0.8039408387F, 0.8095266395F, 0.8150263196F, 0.8204391248F, 0.8257643590F, 0.8310013848F, 0.8361496236F, 0.8412085555F, 0.8461777194F, 0.8510567129F, 0.8558451924F, 0.8605428730F, 0.8651495278F, 0.8696649882F, 0.8740891432F, 0.8784219392F, 0.8826633797F, 0.8868135244F, 0.8908724888F, 0.8948404441F, 0.8987176157F, 0.9025042831F, 0.9062007791F, 0.9098074886F, 0.9133248482F, 0.9167533451F, 0.9200935163F, 0.9233459472F, 0.9265112712F, 0.9295901680F, 0.9325833632F, 0.9354916263F, 0.9383157705F, 0.9410566504F, 0.9437151618F, 0.9462922398F, 0.9487888576F, 0.9512060252F, 0.9535447882F, 0.9558062262F, 0.9579914516F, 0.9601016078F, 0.9621378683F, 0.9641014348F, 0.9659935361F, 0.9678154261F, 0.9695683830F, 0.9712537071F, 0.9728727198F, 0.9744267618F, 0.9759171916F, 0.9773453842F, 0.9787127293F, 0.9800206298F, 0.9812705006F, 0.9824637665F, 0.9836018613F, 0.9846862258F, 0.9857183066F, 0.9866995544F, 0.9876314227F, 0.9885153662F, 0.9893528393F, 0.9901452948F, 0.9908941823F, 0.9916009470F, 0.9922670279F, 0.9928938570F, 0.9934828574F, 0.9940354423F, 0.9945530133F, 0.9950369595F, 0.9954886562F, 0.9959094633F, 0.9963007242F, 0.9966637649F, 0.9969998925F, 0.9973103939F, 0.9975965351F, 0.9978595598F, 0.9981006885F, 0.9983211172F, 0.9985220166F, 0.9987045311F, 0.9988697776F, 0.9990188449F, 0.9991527924F, 0.9992726499F, 0.9993794157F, 0.9994740570F, 0.9995575079F, 0.9996306699F, 0.9996944099F, 0.9997495605F, 0.9997969190F, 0.9998372465F, 0.9998712678F, 0.9998996704F, 0.9999231041F, 0.9999421807F, 0.9999574732F, 0.9999695157F, 0.9999788026F, 0.9999857885F, 0.9999908879F, 0.9999944746F, 0.9999968817F, 0.9999984010F, 0.9999992833F, 0.9999997377F, 0.9999999317F, 0.9999999911F, 0.9999999999F, }; static float vwin1024[512] = { 0.0000036962F, 0.0000332659F, 0.0000924041F, 0.0001811086F, 0.0002993761F, 0.0004472021F, 0.0006245811F, 0.0008315063F, 0.0010679699F, 0.0013339631F, 0.0016294757F, 0.0019544965F, 0.0023090133F, 0.0026930125F, 0.0031064797F, 0.0035493989F, 0.0040217533F, 0.0045235250F, 0.0050546946F, 0.0056152418F, 0.0062051451F, 0.0068243817F, 0.0074729278F, 0.0081507582F, 0.0088578466F, 0.0095941655F, 0.0103596863F, 0.0111543789F, 0.0119782122F, 0.0128311538F, 0.0137131701F, 0.0146242260F, 0.0155642855F, 0.0165333111F, 0.0175312640F, 0.0185581042F, 0.0196137903F, 0.0206982797F, 0.0218115284F, 0.0229534910F, 0.0241241208F, 0.0253233698F, 0.0265511886F, 0.0278075263F, 0.0290923308F, 0.0304055484F, 0.0317471241F, 0.0331170013F, 0.0345151222F, 0.0359414274F, 0.0373958560F, 0.0388783456F, 0.0403888325F, 0.0419272511F, 0.0434935347F, 0.0450876148F, 0.0467094213F, 0.0483588828F, 0.0500359261F, 0.0517404765F, 0.0534724575F, 0.0552317913F, 0.0570183983F, 0.0588321971F, 0.0606731048F, 0.0625410369F, 0.0644359070F, 0.0663576272F, 0.0683061077F, 0.0702812571F, 0.0722829821F, 0.0743111878F, 0.0763657775F, 0.0784466526F, 0.0805537129F, 0.0826868561F, 0.0848459782F, 0.0870309736F, 0.0892417345F, 0.0914781514F, 0.0937401128F, 0.0960275056F, 0.0983402145F, 0.1006781223F, 0.1030411101F, 0.1054290568F, 0.1078418397F, 0.1102793336F, 0.1127414119F, 0.1152279457F, 0.1177388042F, 0.1202738544F, 0.1228329618F, 0.1254159892F, 0.1280227980F, 0.1306532471F, 0.1333071937F, 0.1359844927F, 0.1386849970F, 0.1414085575F, 0.1441550230F, 0.1469242403F, 0.1497160539F, 0.1525303063F, 0.1553668381F, 0.1582254875F, 0.1611060909F, 0.1640084822F, 0.1669324936F, 0.1698779549F, 0.1728446939F, 0.1758325362F, 0.1788413055F, 0.1818708232F, 0.1849209084F, 0.1879913785F, 0.1910820485F, 0.1941927312F, 0.1973232376F, 0.2004733764F, 0.2036429541F, 0.2068317752F, 0.2100396421F, 0.2132663552F, 0.2165117125F, 0.2197755102F, 0.2230575422F, 0.2263576007F, 0.2296754753F, 0.2330109540F, 0.2363638225F, 0.2397338646F, 0.2431208619F, 0.2465245941F, 0.2499448389F, 0.2533813719F, 0.2568339669F, 0.2603023956F, 0.2637864277F, 0.2672858312F, 0.2708003718F, 0.2743298135F, 0.2778739186F, 0.2814324472F, 0.2850051576F, 0.2885918065F, 0.2921921485F, 0.2958059366F, 0.2994329219F, 0.3030728538F, 0.3067254799F, 0.3103905462F, 0.3140677969F, 0.3177569747F, 0.3214578205F, 0.3251700736F, 0.3288934718F, 0.3326277513F, 0.3363726468F, 0.3401278914F, 0.3438932168F, 0.3476683533F, 0.3514530297F, 0.3552469734F, 0.3590499106F, 0.3628615659F, 0.3666816630F, 0.3705099239F, 0.3743460698F, 0.3781898204F, 0.3820408945F, 0.3858990095F, 0.3897638820F, 0.3936352274F, 0.3975127601F, 0.4013961936F, 0.4052852405F, 0.4091796123F, 0.4130790198F, 0.4169831732F, 0.4208917815F, 0.4248045534F, 0.4287211965F, 0.4326414181F, 0.4365649248F, 0.4404914225F, 0.4444206167F, 0.4483522125F, 0.4522859146F, 0.4562214270F, 0.4601584538F, 0.4640966984F, 0.4680358644F, 0.4719756548F, 0.4759157726F, 0.4798559209F, 0.4837958024F, 0.4877351199F, 0.4916735765F, 0.4956108751F, 0.4995467188F, 0.5034808109F, 0.5074128550F, 0.5113425550F, 0.5152696149F, 0.5191937395F, 0.5231146336F, 0.5270320028F, 0.5309455530F, 0.5348549910F, 0.5387600239F, 0.5426603597F, 0.5465557070F, 0.5504457754F, 0.5543302752F, 0.5582089175F, 0.5620814145F, 0.5659474793F, 0.5698068262F, 0.5736591704F, 0.5775042283F, 0.5813417176F, 0.5851713571F, 0.5889928670F, 0.5928059689F, 0.5966103856F, 0.6004058415F, 0.6041920626F, 0.6079687761F, 0.6117357113F, 0.6154925986F, 0.6192391705F, 0.6229751612F, 0.6267003064F, 0.6304143441F, 0.6341170137F, 0.6378080569F, 0.6414872173F, 0.6451542405F, 0.6488088741F, 0.6524508681F, 0.6560799742F, 0.6596959469F, 0.6632985424F, 0.6668875197F, 0.6704626398F, 0.6740236662F, 0.6775703649F, 0.6811025043F, 0.6846198554F, 0.6881221916F, 0.6916092892F, 0.6950809269F, 0.6985368861F, 0.7019769510F, 0.7054009085F, 0.7088085484F, 0.7121996632F, 0.7155740484F, 0.7189315023F, 0.7222718263F, 0.7255948245F, 0.7289003043F, 0.7321880760F, 0.7354579530F, 0.7387097518F, 0.7419432921F, 0.7451583966F, 0.7483548915F, 0.7515326059F, 0.7546913723F, 0.7578310265F, 0.7609514077F, 0.7640523581F, 0.7671337237F, 0.7701953535F, 0.7732371001F, 0.7762588195F, 0.7792603711F, 0.7822416178F, 0.7852024259F, 0.7881426654F, 0.7910622097F, 0.7939609356F, 0.7968387237F, 0.7996954579F, 0.8025310261F, 0.8053453193F, 0.8081382324F, 0.8109096638F, 0.8136595156F, 0.8163876936F, 0.8190941071F, 0.8217786690F, 0.8244412960F, 0.8270819086F, 0.8297004305F, 0.8322967896F, 0.8348709171F, 0.8374227481F, 0.8399522213F, 0.8424592789F, 0.8449438672F, 0.8474059356F, 0.8498454378F, 0.8522623306F, 0.8546565748F, 0.8570281348F, 0.8593769787F, 0.8617030779F, 0.8640064080F, 0.8662869477F, 0.8685446796F, 0.8707795899F, 0.8729916682F, 0.8751809079F, 0.8773473059F, 0.8794908626F, 0.8816115819F, 0.8837094713F, 0.8857845418F, 0.8878368079F, 0.8898662874F, 0.8918730019F, 0.8938569760F, 0.8958182380F, 0.8977568194F, 0.8996727552F, 0.9015660837F, 0.9034368465F, 0.9052850885F, 0.9071108577F, 0.9089142057F, 0.9106951869F, 0.9124538591F, 0.9141902832F, 0.9159045233F, 0.9175966464F, 0.9192667228F, 0.9209148257F, 0.9225410313F, 0.9241454187F, 0.9257280701F, 0.9272890704F, 0.9288285075F, 0.9303464720F, 0.9318430576F, 0.9333183603F, 0.9347724792F, 0.9362055158F, 0.9376175745F, 0.9390087622F, 0.9403791881F, 0.9417289644F, 0.9430582055F, 0.9443670283F, 0.9456555521F, 0.9469238986F, 0.9481721917F, 0.9494005577F, 0.9506091252F, 0.9517980248F, 0.9529673894F, 0.9541173540F, 0.9552480557F, 0.9563596334F, 0.9574522282F, 0.9585259830F, 0.9595810428F, 0.9606175542F, 0.9616356656F, 0.9626355274F, 0.9636172915F, 0.9645811114F, 0.9655271425F, 0.9664555414F, 0.9673664664F, 0.9682600774F, 0.9691365355F, 0.9699960034F, 0.9708386448F, 0.9716646250F, 0.9724741103F, 0.9732672685F, 0.9740442683F, 0.9748052795F, 0.9755504729F, 0.9762800205F, 0.9769940950F, 0.9776928703F, 0.9783765210F, 0.9790452223F, 0.9796991504F, 0.9803384823F, 0.9809633954F, 0.9815740679F, 0.9821706784F, 0.9827534063F, 0.9833224312F, 0.9838779332F, 0.9844200928F, 0.9849490910F, 0.9854651087F, 0.9859683274F, 0.9864589286F, 0.9869370940F, 0.9874030054F, 0.9878568447F, 0.9882987937F, 0.9887290343F, 0.9891477481F, 0.9895551169F, 0.9899513220F, 0.9903365446F, 0.9907109658F, 0.9910747662F, 0.9914281260F, 0.9917712252F, 0.9921042433F, 0.9924273593F, 0.9927407516F, 0.9930445982F, 0.9933390763F, 0.9936243626F, 0.9939006331F, 0.9941680631F, 0.9944268269F, 0.9946770982F, 0.9949190498F, 0.9951528537F, 0.9953786808F, 0.9955967011F, 0.9958070836F, 0.9960099963F, 0.9962056061F, 0.9963940787F, 0.9965755786F, 0.9967502693F, 0.9969183129F, 0.9970798704F, 0.9972351013F, 0.9973841640F, 0.9975272151F, 0.9976644103F, 0.9977959036F, 0.9979218476F, 0.9980423932F, 0.9981576901F, 0.9982678862F, 0.9983731278F, 0.9984735596F, 0.9985693247F, 0.9986605645F, 0.9987474186F, 0.9988300248F, 0.9989085193F, 0.9989830364F, 0.9990537085F, 0.9991206662F, 0.9991840382F, 0.9992439513F, 0.9993005303F, 0.9993538982F, 0.9994041757F, 0.9994514817F, 0.9994959330F, 0.9995376444F, 0.9995767286F, 0.9996132960F, 0.9996474550F, 0.9996793121F, 0.9997089710F, 0.9997365339F, 0.9997621003F, 0.9997857677F, 0.9998076311F, 0.9998277836F, 0.9998463156F, 0.9998633155F, 0.9998788692F, 0.9998930603F, 0.9999059701F, 0.9999176774F, 0.9999282586F, 0.9999377880F, 0.9999463370F, 0.9999539749F, 0.9999607685F, 0.9999667820F, 0.9999720773F, 0.9999767136F, 0.9999807479F, 0.9999842344F, 0.9999872249F, 0.9999897688F, 0.9999919127F, 0.9999937009F, 0.9999951749F, 0.9999963738F, 0.9999973342F, 0.9999980900F, 0.9999986724F, 0.9999991103F, 0.9999994297F, 0.9999996543F, 0.9999998049F, 0.9999999000F, 0.9999999552F, 0.9999999836F, 0.9999999957F, 0.9999999994F, 1.0000000000F, }; static float vwin2048[1024] = { 0.0000009241F, 0.0000083165F, 0.0000231014F, 0.0000452785F, 0.0000748476F, 0.0001118085F, 0.0001561608F, 0.0002079041F, 0.0002670379F, 0.0003335617F, 0.0004074748F, 0.0004887765F, 0.0005774661F, 0.0006735427F, 0.0007770054F, 0.0008878533F, 0.0010060853F, 0.0011317002F, 0.0012646969F, 0.0014050742F, 0.0015528307F, 0.0017079650F, 0.0018704756F, 0.0020403610F, 0.0022176196F, 0.0024022497F, 0.0025942495F, 0.0027936173F, 0.0030003511F, 0.0032144490F, 0.0034359088F, 0.0036647286F, 0.0039009061F, 0.0041444391F, 0.0043953253F, 0.0046535621F, 0.0049191472F, 0.0051920781F, 0.0054723520F, 0.0057599664F, 0.0060549184F, 0.0063572052F, 0.0066668239F, 0.0069837715F, 0.0073080449F, 0.0076396410F, 0.0079785566F, 0.0083247884F, 0.0086783330F, 0.0090391871F, 0.0094073470F, 0.0097828092F, 0.0101655700F, 0.0105556258F, 0.0109529726F, 0.0113576065F, 0.0117695237F, 0.0121887200F, 0.0126151913F, 0.0130489335F, 0.0134899422F, 0.0139382130F, 0.0143937415F, 0.0148565233F, 0.0153265536F, 0.0158038279F, 0.0162883413F, 0.0167800889F, 0.0172790660F, 0.0177852675F, 0.0182986882F, 0.0188193231F, 0.0193471668F, 0.0198822141F, 0.0204244594F, 0.0209738974F, 0.0215305225F, 0.0220943289F, 0.0226653109F, 0.0232434627F, 0.0238287784F, 0.0244212519F, 0.0250208772F, 0.0256276481F, 0.0262415582F, 0.0268626014F, 0.0274907711F, 0.0281260608F, 0.0287684638F, 0.0294179736F, 0.0300745833F, 0.0307382859F, 0.0314090747F, 0.0320869424F, 0.0327718819F, 0.0334638860F, 0.0341629474F, 0.0348690586F, 0.0355822122F, 0.0363024004F, 0.0370296157F, 0.0377638502F, 0.0385050960F, 0.0392533451F, 0.0400085896F, 0.0407708211F, 0.0415400315F, 0.0423162123F, 0.0430993552F, 0.0438894515F, 0.0446864926F, 0.0454904698F, 0.0463013742F, 0.0471191969F, 0.0479439288F, 0.0487755607F, 0.0496140836F, 0.0504594879F, 0.0513117642F, 0.0521709031F, 0.0530368949F, 0.0539097297F, 0.0547893979F, 0.0556758894F, 0.0565691941F, 0.0574693019F, 0.0583762026F, 0.0592898858F, 0.0602103410F, 0.0611375576F, 0.0620715250F, 0.0630122324F, 0.0639596688F, 0.0649138234F, 0.0658746848F, 0.0668422421F, 0.0678164838F, 0.0687973985F, 0.0697849746F, 0.0707792005F, 0.0717800645F, 0.0727875547F, 0.0738016591F, 0.0748223656F, 0.0758496620F, 0.0768835359F, 0.0779239751F, 0.0789709668F, 0.0800244985F, 0.0810845574F, 0.0821511306F, 0.0832242052F, 0.0843037679F, 0.0853898056F, 0.0864823050F, 0.0875812525F, 0.0886866347F, 0.0897984378F, 0.0909166480F, 0.0920412513F, 0.0931722338F, 0.0943095813F, 0.0954532795F, 0.0966033140F, 0.0977596702F, 0.0989223336F, 0.1000912894F, 0.1012665227F, 0.1024480185F, 0.1036357616F, 0.1048297369F, 0.1060299290F, 0.1072363224F, 0.1084489014F, 0.1096676504F, 0.1108925534F, 0.1121235946F, 0.1133607577F, 0.1146040267F, 0.1158533850F, 0.1171088163F, 0.1183703040F, 0.1196378312F, 0.1209113812F, 0.1221909370F, 0.1234764815F, 0.1247679974F, 0.1260654674F, 0.1273688740F, 0.1286781995F, 0.1299934263F, 0.1313145365F, 0.1326415121F, 0.1339743349F, 0.1353129866F, 0.1366574490F, 0.1380077035F, 0.1393637315F, 0.1407255141F, 0.1420930325F, 0.1434662677F, 0.1448452004F, 0.1462298115F, 0.1476200814F, 0.1490159906F, 0.1504175195F, 0.1518246482F, 0.1532373569F, 0.1546556253F, 0.1560794333F, 0.1575087606F, 0.1589435866F, 0.1603838909F, 0.1618296526F, 0.1632808509F, 0.1647374648F, 0.1661994731F, 0.1676668546F, 0.1691395880F, 0.1706176516F, 0.1721010238F, 0.1735896829F, 0.1750836068F, 0.1765827736F, 0.1780871610F, 0.1795967468F, 0.1811115084F, 0.1826314234F, 0.1841564689F, 0.1856866221F, 0.1872218600F, 0.1887621595F, 0.1903074974F, 0.1918578503F, 0.1934131947F, 0.1949735068F, 0.1965387630F, 0.1981089393F, 0.1996840117F, 0.2012639560F, 0.2028487479F, 0.2044383630F, 0.2060327766F, 0.2076319642F, 0.2092359007F, 0.2108445614F, 0.2124579211F, 0.2140759545F, 0.2156986364F, 0.2173259411F, 0.2189578432F, 0.2205943168F, 0.2222353361F, 0.2238808751F, 0.2255309076F, 0.2271854073F, 0.2288443480F, 0.2305077030F, 0.2321754457F, 0.2338475493F, 0.2355239869F, 0.2372047315F, 0.2388897560F, 0.2405790329F, 0.2422725350F, 0.2439702347F, 0.2456721043F, 0.2473781159F, 0.2490882418F, 0.2508024539F, 0.2525207240F, 0.2542430237F, 0.2559693248F, 0.2576995986F, 0.2594338166F, 0.2611719498F, 0.2629139695F, 0.2646598466F, 0.2664095520F, 0.2681630564F, 0.2699203304F, 0.2716813445F, 0.2734460691F, 0.2752144744F, 0.2769865307F, 0.2787622079F, 0.2805414760F, 0.2823243047F, 0.2841106637F, 0.2859005227F, 0.2876938509F, 0.2894906179F, 0.2912907928F, 0.2930943447F, 0.2949012426F, 0.2967114554F, 0.2985249520F, 0.3003417009F, 0.3021616708F, 0.3039848301F, 0.3058111471F, 0.3076405901F, 0.3094731273F, 0.3113087266F, 0.3131473560F, 0.3149889833F, 0.3168335762F, 0.3186811024F, 0.3205315294F, 0.3223848245F, 0.3242409552F, 0.3260998886F, 0.3279615918F, 0.3298260319F, 0.3316931758F, 0.3335629903F, 0.3354354423F, 0.3373104982F, 0.3391881247F, 0.3410682882F, 0.3429509551F, 0.3448360917F, 0.3467236642F, 0.3486136387F, 0.3505059811F, 0.3524006575F, 0.3542976336F, 0.3561968753F, 0.3580983482F, 0.3600020179F, 0.3619078499F, 0.3638158096F, 0.3657258625F, 0.3676379737F, 0.3695521086F, 0.3714682321F, 0.3733863094F, 0.3753063055F, 0.3772281852F, 0.3791519134F, 0.3810774548F, 0.3830047742F, 0.3849338362F, 0.3868646053F, 0.3887970459F, 0.3907311227F, 0.3926667998F, 0.3946040417F, 0.3965428125F, 0.3984830765F, 0.4004247978F, 0.4023679403F, 0.4043124683F, 0.4062583455F, 0.4082055359F, 0.4101540034F, 0.4121037117F, 0.4140546246F, 0.4160067058F, 0.4179599190F, 0.4199142277F, 0.4218695956F, 0.4238259861F, 0.4257833627F, 0.4277416888F, 0.4297009279F, 0.4316610433F, 0.4336219983F, 0.4355837562F, 0.4375462803F, 0.4395095337F, 0.4414734797F, 0.4434380815F, 0.4454033021F, 0.4473691046F, 0.4493354521F, 0.4513023078F, 0.4532696345F, 0.4552373954F, 0.4572055533F, 0.4591740713F, 0.4611429123F, 0.4631120393F, 0.4650814151F, 0.4670510028F, 0.4690207650F, 0.4709906649F, 0.4729606651F, 0.4749307287F, 0.4769008185F, 0.4788708972F, 0.4808409279F, 0.4828108732F, 0.4847806962F, 0.4867503597F, 0.4887198264F, 0.4906890593F, 0.4926580213F, 0.4946266753F, 0.4965949840F, 0.4985629105F, 0.5005304176F, 0.5024974683F, 0.5044640255F, 0.5064300522F, 0.5083955114F, 0.5103603659F, 0.5123245790F, 0.5142881136F, 0.5162509328F, 0.5182129997F, 0.5201742774F, 0.5221347290F, 0.5240943178F, 0.5260530070F, 0.5280107598F, 0.5299675395F, 0.5319233095F, 0.5338780330F, 0.5358316736F, 0.5377841946F, 0.5397355596F, 0.5416857320F, 0.5436346755F, 0.5455823538F, 0.5475287304F, 0.5494737691F, 0.5514174337F, 0.5533596881F, 0.5553004962F, 0.5572398218F, 0.5591776291F, 0.5611138821F, 0.5630485449F, 0.5649815818F, 0.5669129570F, 0.5688426349F, 0.5707705799F, 0.5726967564F, 0.5746211290F, 0.5765436624F, 0.5784643212F, 0.5803830702F, 0.5822998743F, 0.5842146984F, 0.5861275076F, 0.5880382669F, 0.5899469416F, 0.5918534968F, 0.5937578981F, 0.5956601107F, 0.5975601004F, 0.5994578326F, 0.6013532732F, 0.6032463880F, 0.6051371429F, 0.6070255039F, 0.6089114372F, 0.6107949090F, 0.6126758856F, 0.6145543334F, 0.6164302191F, 0.6183035092F, 0.6201741706F, 0.6220421700F, 0.6239074745F, 0.6257700513F, 0.6276298674F, 0.6294868903F, 0.6313410873F, 0.6331924262F, 0.6350408745F, 0.6368864001F, 0.6387289710F, 0.6405685552F, 0.6424051209F, 0.6442386364F, 0.6460690702F, 0.6478963910F, 0.6497205673F, 0.6515415682F, 0.6533593625F, 0.6551739194F, 0.6569852082F, 0.6587931984F, 0.6605978593F, 0.6623991609F, 0.6641970728F, 0.6659915652F, 0.6677826081F, 0.6695701718F, 0.6713542268F, 0.6731347437F, 0.6749116932F, 0.6766850461F, 0.6784547736F, 0.6802208469F, 0.6819832374F, 0.6837419164F, 0.6854968559F, 0.6872480275F, 0.6889954034F, 0.6907389556F, 0.6924786566F, 0.6942144788F, 0.6959463950F, 0.6976743780F, 0.6993984008F, 0.7011184365F, 0.7028344587F, 0.7045464407F, 0.7062543564F, 0.7079581796F, 0.7096578844F, 0.7113534450F, 0.7130448359F, 0.7147320316F, 0.7164150070F, 0.7180937371F, 0.7197681970F, 0.7214383620F, 0.7231042077F, 0.7247657098F, 0.7264228443F, 0.7280755871F, 0.7297239147F, 0.7313678035F, 0.7330072301F, 0.7346421715F, 0.7362726046F, 0.7378985069F, 0.7395198556F, 0.7411366285F, 0.7427488034F, 0.7443563584F, 0.7459592717F, 0.7475575218F, 0.7491510873F, 0.7507399471F, 0.7523240803F, 0.7539034661F, 0.7554780839F, 0.7570479136F, 0.7586129349F, 0.7601731279F, 0.7617284730F, 0.7632789506F, 0.7648245416F, 0.7663652267F, 0.7679009872F, 0.7694318044F, 0.7709576599F, 0.7724785354F, 0.7739944130F, 0.7755052749F, 0.7770111035F, 0.7785118815F, 0.7800075916F, 0.7814982170F, 0.7829837410F, 0.7844641472F, 0.7859394191F, 0.7874095408F, 0.7888744965F, 0.7903342706F, 0.7917888476F, 0.7932382124F, 0.7946823501F, 0.7961212460F, 0.7975548855F, 0.7989832544F, 0.8004063386F, 0.8018241244F, 0.8032365981F, 0.8046437463F, 0.8060455560F, 0.8074420141F, 0.8088331080F, 0.8102188253F, 0.8115991536F, 0.8129740810F, 0.8143435957F, 0.8157076861F, 0.8170663409F, 0.8184195489F, 0.8197672994F, 0.8211095817F, 0.8224463853F, 0.8237777001F, 0.8251035161F, 0.8264238235F, 0.8277386129F, 0.8290478750F, 0.8303516008F, 0.8316497814F, 0.8329424083F, 0.8342294731F, 0.8355109677F, 0.8367868841F, 0.8380572148F, 0.8393219523F, 0.8405810893F, 0.8418346190F, 0.8430825345F, 0.8443248294F, 0.8455614974F, 0.8467925323F, 0.8480179285F, 0.8492376802F, 0.8504517822F, 0.8516602292F, 0.8528630164F, 0.8540601391F, 0.8552515928F, 0.8564373733F, 0.8576174766F, 0.8587918990F, 0.8599606368F, 0.8611236868F, 0.8622810460F, 0.8634327113F, 0.8645786802F, 0.8657189504F, 0.8668535195F, 0.8679823857F, 0.8691055472F, 0.8702230025F, 0.8713347503F, 0.8724407896F, 0.8735411194F, 0.8746357394F, 0.8757246489F, 0.8768078479F, 0.8778853364F, 0.8789571146F, 0.8800231832F, 0.8810835427F, 0.8821381942F, 0.8831871387F, 0.8842303777F, 0.8852679127F, 0.8862997456F, 0.8873258784F, 0.8883463132F, 0.8893610527F, 0.8903700994F, 0.8913734562F, 0.8923711263F, 0.8933631129F, 0.8943494196F, 0.8953300500F, 0.8963050083F, 0.8972742985F, 0.8982379249F, 0.8991958922F, 0.9001482052F, 0.9010948688F, 0.9020358883F, 0.9029712690F, 0.9039010165F, 0.9048251367F, 0.9057436357F, 0.9066565195F, 0.9075637946F, 0.9084654678F, 0.9093615456F, 0.9102520353F, 0.9111369440F, 0.9120162792F, 0.9128900484F, 0.9137582595F, 0.9146209204F, 0.9154780394F, 0.9163296248F, 0.9171756853F, 0.9180162296F, 0.9188512667F, 0.9196808057F, 0.9205048559F, 0.9213234270F, 0.9221365285F, 0.9229441704F, 0.9237463629F, 0.9245431160F, 0.9253344404F, 0.9261203465F, 0.9269008453F, 0.9276759477F, 0.9284456648F, 0.9292100080F, 0.9299689889F, 0.9307226190F, 0.9314709103F, 0.9322138747F, 0.9329515245F, 0.9336838721F, 0.9344109300F, 0.9351327108F, 0.9358492275F, 0.9365604931F, 0.9372665208F, 0.9379673239F, 0.9386629160F, 0.9393533107F, 0.9400385220F, 0.9407185637F, 0.9413934501F, 0.9420631954F, 0.9427278141F, 0.9433873208F, 0.9440417304F, 0.9446910576F, 0.9453353176F, 0.9459745255F, 0.9466086968F, 0.9472378469F, 0.9478619915F, 0.9484811463F, 0.9490953274F, 0.9497045506F, 0.9503088323F, 0.9509081888F, 0.9515026365F, 0.9520921921F, 0.9526768723F, 0.9532566940F, 0.9538316742F, 0.9544018300F, 0.9549671786F, 0.9555277375F, 0.9560835241F, 0.9566345562F, 0.9571808513F, 0.9577224275F, 0.9582593027F, 0.9587914949F, 0.9593190225F, 0.9598419038F, 0.9603601571F, 0.9608738012F, 0.9613828546F, 0.9618873361F, 0.9623872646F, 0.9628826591F, 0.9633735388F, 0.9638599227F, 0.9643418303F, 0.9648192808F, 0.9652922939F, 0.9657608890F, 0.9662250860F, 0.9666849046F, 0.9671403646F, 0.9675914861F, 0.9680382891F, 0.9684807937F, 0.9689190202F, 0.9693529890F, 0.9697827203F, 0.9702082347F, 0.9706295529F, 0.9710466953F, 0.9714596828F, 0.9718685362F, 0.9722732762F, 0.9726739240F, 0.9730705005F, 0.9734630267F, 0.9738515239F, 0.9742360134F, 0.9746165163F, 0.9749930540F, 0.9753656481F, 0.9757343198F, 0.9760990909F, 0.9764599829F, 0.9768170175F, 0.9771702164F, 0.9775196013F, 0.9778651941F, 0.9782070167F, 0.9785450909F, 0.9788794388F, 0.9792100824F, 0.9795370437F, 0.9798603449F, 0.9801800080F, 0.9804960554F, 0.9808085092F, 0.9811173916F, 0.9814227251F, 0.9817245318F, 0.9820228343F, 0.9823176549F, 0.9826090160F, 0.9828969402F, 0.9831814498F, 0.9834625674F, 0.9837403156F, 0.9840147169F, 0.9842857939F, 0.9845535692F, 0.9848180654F, 0.9850793052F, 0.9853373113F, 0.9855921062F, 0.9858437127F, 0.9860921535F, 0.9863374512F, 0.9865796287F, 0.9868187085F, 0.9870547136F, 0.9872876664F, 0.9875175899F, 0.9877445067F, 0.9879684396F, 0.9881894112F, 0.9884074444F, 0.9886225619F, 0.9888347863F, 0.9890441404F, 0.9892506468F, 0.9894543284F, 0.9896552077F, 0.9898533074F, 0.9900486502F, 0.9902412587F, 0.9904311555F, 0.9906183633F, 0.9908029045F, 0.9909848019F, 0.9911640779F, 0.9913407550F, 0.9915148557F, 0.9916864025F, 0.9918554179F, 0.9920219241F, 0.9921859437F, 0.9923474989F, 0.9925066120F, 0.9926633054F, 0.9928176012F, 0.9929695218F, 0.9931190891F, 0.9932663254F, 0.9934112527F, 0.9935538932F, 0.9936942686F, 0.9938324012F, 0.9939683126F, 0.9941020248F, 0.9942335597F, 0.9943629388F, 0.9944901841F, 0.9946153170F, 0.9947383593F, 0.9948593325F, 0.9949782579F, 0.9950951572F, 0.9952100516F, 0.9953229625F, 0.9954339111F, 0.9955429186F, 0.9956500062F, 0.9957551948F, 0.9958585056F, 0.9959599593F, 0.9960595769F, 0.9961573792F, 0.9962533869F, 0.9963476206F, 0.9964401009F, 0.9965308483F, 0.9966198833F, 0.9967072261F, 0.9967928971F, 0.9968769164F, 0.9969593041F, 0.9970400804F, 0.9971192651F, 0.9971968781F, 0.9972729391F, 0.9973474680F, 0.9974204842F, 0.9974920074F, 0.9975620569F, 0.9976306521F, 0.9976978122F, 0.9977635565F, 0.9978279039F, 0.9978908736F, 0.9979524842F, 0.9980127547F, 0.9980717037F, 0.9981293499F, 0.9981857116F, 0.9982408073F, 0.9982946554F, 0.9983472739F, 0.9983986810F, 0.9984488947F, 0.9984979328F, 0.9985458132F, 0.9985925534F, 0.9986381711F, 0.9986826838F, 0.9987261086F, 0.9987684630F, 0.9988097640F, 0.9988500286F, 0.9988892738F, 0.9989275163F, 0.9989647727F, 0.9990010597F, 0.9990363938F, 0.9990707911F, 0.9991042679F, 0.9991368404F, 0.9991685244F, 0.9991993358F, 0.9992292905F, 0.9992584038F, 0.9992866914F, 0.9993141686F, 0.9993408506F, 0.9993667526F, 0.9993918895F, 0.9994162761F, 0.9994399273F, 0.9994628576F, 0.9994850815F, 0.9995066133F, 0.9995274672F, 0.9995476574F, 0.9995671978F, 0.9995861021F, 0.9996043841F, 0.9996220573F, 0.9996391352F, 0.9996556310F, 0.9996715579F, 0.9996869288F, 0.9997017568F, 0.9997160543F, 0.9997298342F, 0.9997431088F, 0.9997558905F, 0.9997681914F, 0.9997800236F, 0.9997913990F, 0.9998023292F, 0.9998128261F, 0.9998229009F, 0.9998325650F, 0.9998418296F, 0.9998507058F, 0.9998592044F, 0.9998673362F, 0.9998751117F, 0.9998825415F, 0.9998896358F, 0.9998964047F, 0.9999028584F, 0.9999090066F, 0.9999148590F, 0.9999204253F, 0.9999257148F, 0.9999307368F, 0.9999355003F, 0.9999400144F, 0.9999442878F, 0.9999483293F, 0.9999521472F, 0.9999557499F, 0.9999591457F, 0.9999623426F, 0.9999653483F, 0.9999681708F, 0.9999708175F, 0.9999732959F, 0.9999756132F, 0.9999777765F, 0.9999797928F, 0.9999816688F, 0.9999834113F, 0.9999850266F, 0.9999865211F, 0.9999879009F, 0.9999891721F, 0.9999903405F, 0.9999914118F, 0.9999923914F, 0.9999932849F, 0.9999940972F, 0.9999948336F, 0.9999954989F, 0.9999960978F, 0.9999966349F, 0.9999971146F, 0.9999975411F, 0.9999979185F, 0.9999982507F, 0.9999985414F, 0.9999987944F, 0.9999990129F, 0.9999992003F, 0.9999993596F, 0.9999994939F, 0.9999996059F, 0.9999996981F, 0.9999997732F, 0.9999998333F, 0.9999998805F, 0.9999999170F, 0.9999999444F, 0.9999999643F, 0.9999999784F, 0.9999999878F, 0.9999999937F, 0.9999999972F, 0.9999999990F, 0.9999999997F, 1.0000000000F, 1.0000000000F, }; static float vwin4096[2048] = { 0.0000002310F, 0.0000020791F, 0.0000057754F, 0.0000113197F, 0.0000187121F, 0.0000279526F, 0.0000390412F, 0.0000519777F, 0.0000667623F, 0.0000833949F, 0.0001018753F, 0.0001222036F, 0.0001443798F, 0.0001684037F, 0.0001942754F, 0.0002219947F, 0.0002515616F, 0.0002829761F, 0.0003162380F, 0.0003513472F, 0.0003883038F, 0.0004271076F, 0.0004677584F, 0.0005102563F, 0.0005546011F, 0.0006007928F, 0.0006488311F, 0.0006987160F, 0.0007504474F, 0.0008040251F, 0.0008594490F, 0.0009167191F, 0.0009758351F, 0.0010367969F, 0.0010996044F, 0.0011642574F, 0.0012307558F, 0.0012990994F, 0.0013692880F, 0.0014413216F, 0.0015151998F, 0.0015909226F, 0.0016684898F, 0.0017479011F, 0.0018291565F, 0.0019122556F, 0.0019971983F, 0.0020839845F, 0.0021726138F, 0.0022630861F, 0.0023554012F, 0.0024495588F, 0.0025455588F, 0.0026434008F, 0.0027430847F, 0.0028446103F, 0.0029479772F, 0.0030531853F, 0.0031602342F, 0.0032691238F, 0.0033798538F, 0.0034924239F, 0.0036068338F, 0.0037230833F, 0.0038411721F, 0.0039610999F, 0.0040828664F, 0.0042064714F, 0.0043319145F, 0.0044591954F, 0.0045883139F, 0.0047192696F, 0.0048520622F, 0.0049866914F, 0.0051231569F, 0.0052614583F, 0.0054015953F, 0.0055435676F, 0.0056873748F, 0.0058330166F, 0.0059804926F, 0.0061298026F, 0.0062809460F, 0.0064339226F, 0.0065887320F, 0.0067453738F, 0.0069038476F, 0.0070641531F, 0.0072262899F, 0.0073902575F, 0.0075560556F, 0.0077236838F, 0.0078931417F, 0.0080644288F, 0.0082375447F, 0.0084124891F, 0.0085892615F, 0.0087678614F, 0.0089482885F, 0.0091305422F, 0.0093146223F, 0.0095005281F, 0.0096882592F, 0.0098778153F, 0.0100691958F, 0.0102624002F, 0.0104574281F, 0.0106542791F, 0.0108529525F, 0.0110534480F, 0.0112557651F, 0.0114599032F, 0.0116658618F, 0.0118736405F, 0.0120832387F, 0.0122946560F, 0.0125078917F, 0.0127229454F, 0.0129398166F, 0.0131585046F, 0.0133790090F, 0.0136013292F, 0.0138254647F, 0.0140514149F, 0.0142791792F, 0.0145087572F, 0.0147401481F, 0.0149733515F, 0.0152083667F, 0.0154451932F, 0.0156838304F, 0.0159242777F, 0.0161665345F, 0.0164106001F, 0.0166564741F, 0.0169041557F, 0.0171536443F, 0.0174049393F, 0.0176580401F, 0.0179129461F, 0.0181696565F, 0.0184281708F, 0.0186884883F, 0.0189506084F, 0.0192145303F, 0.0194802535F, 0.0197477772F, 0.0200171008F, 0.0202882236F, 0.0205611449F, 0.0208358639F, 0.0211123801F, 0.0213906927F, 0.0216708011F, 0.0219527043F, 0.0222364019F, 0.0225218930F, 0.0228091769F, 0.0230982529F, 0.0233891203F, 0.0236817782F, 0.0239762259F, 0.0242724628F, 0.0245704880F, 0.0248703007F, 0.0251719002F, 0.0254752858F, 0.0257804565F, 0.0260874117F, 0.0263961506F, 0.0267066722F, 0.0270189760F, 0.0273330609F, 0.0276489263F, 0.0279665712F, 0.0282859949F, 0.0286071966F, 0.0289301753F, 0.0292549303F, 0.0295814607F, 0.0299097656F, 0.0302398442F, 0.0305716957F, 0.0309053191F, 0.0312407135F, 0.0315778782F, 0.0319168122F, 0.0322575145F, 0.0325999844F, 0.0329442209F, 0.0332902231F, 0.0336379900F, 0.0339875208F, 0.0343388146F, 0.0346918703F, 0.0350466871F, 0.0354032640F, 0.0357616000F, 0.0361216943F, 0.0364835458F, 0.0368471535F, 0.0372125166F, 0.0375796339F, 0.0379485046F, 0.0383191276F, 0.0386915020F, 0.0390656267F, 0.0394415008F, 0.0398191231F, 0.0401984927F, 0.0405796086F, 0.0409624698F, 0.0413470751F, 0.0417334235F, 0.0421215141F, 0.0425113457F, 0.0429029172F, 0.0432962277F, 0.0436912760F, 0.0440880610F, 0.0444865817F, 0.0448868370F, 0.0452888257F, 0.0456925468F, 0.0460979992F, 0.0465051816F, 0.0469140931F, 0.0473247325F, 0.0477370986F, 0.0481511902F, 0.0485670064F, 0.0489845458F, 0.0494038074F, 0.0498247899F, 0.0502474922F, 0.0506719131F, 0.0510980514F, 0.0515259060F, 0.0519554756F, 0.0523867590F, 0.0528197550F, 0.0532544624F, 0.0536908800F, 0.0541290066F, 0.0545688408F, 0.0550103815F, 0.0554536274F, 0.0558985772F, 0.0563452297F, 0.0567935837F, 0.0572436377F, 0.0576953907F, 0.0581488412F, 0.0586039880F, 0.0590608297F, 0.0595193651F, 0.0599795929F, 0.0604415117F, 0.0609051202F, 0.0613704170F, 0.0618374009F, 0.0623060704F, 0.0627764243F, 0.0632484611F, 0.0637221795F, 0.0641975781F, 0.0646746555F, 0.0651534104F, 0.0656338413F, 0.0661159469F, 0.0665997257F, 0.0670851763F, 0.0675722973F, 0.0680610873F, 0.0685515448F, 0.0690436684F, 0.0695374567F, 0.0700329081F, 0.0705300213F, 0.0710287947F, 0.0715292269F, 0.0720313163F, 0.0725350616F, 0.0730404612F, 0.0735475136F, 0.0740562172F, 0.0745665707F, 0.0750785723F, 0.0755922207F, 0.0761075143F, 0.0766244515F, 0.0771430307F, 0.0776632505F, 0.0781851092F, 0.0787086052F, 0.0792337371F, 0.0797605032F, 0.0802889018F, 0.0808189315F, 0.0813505905F, 0.0818838773F, 0.0824187903F, 0.0829553277F, 0.0834934881F, 0.0840332697F, 0.0845746708F, 0.0851176899F, 0.0856623252F, 0.0862085751F, 0.0867564379F, 0.0873059119F, 0.0878569954F, 0.0884096867F, 0.0889639840F, 0.0895198858F, 0.0900773902F, 0.0906364955F, 0.0911972000F, 0.0917595019F, 0.0923233995F, 0.0928888909F, 0.0934559745F, 0.0940246485F, 0.0945949110F, 0.0951667604F, 0.0957401946F, 0.0963152121F, 0.0968918109F, 0.0974699893F, 0.0980497454F, 0.0986310773F, 0.0992139832F, 0.0997984614F, 0.1003845098F, 0.1009721267F, 0.1015613101F, 0.1021520582F, 0.1027443692F, 0.1033382410F, 0.1039336718F, 0.1045306597F, 0.1051292027F, 0.1057292990F, 0.1063309466F, 0.1069341435F, 0.1075388878F, 0.1081451776F, 0.1087530108F, 0.1093623856F, 0.1099732998F, 0.1105857516F, 0.1111997389F, 0.1118152597F, 0.1124323121F, 0.1130508939F, 0.1136710032F, 0.1142926379F, 0.1149157960F, 0.1155404755F, 0.1161666742F, 0.1167943901F, 0.1174236211F, 0.1180543652F, 0.1186866202F, 0.1193203841F, 0.1199556548F, 0.1205924300F, 0.1212307078F, 0.1218704860F, 0.1225117624F, 0.1231545349F, 0.1237988013F, 0.1244445596F, 0.1250918074F, 0.1257405427F, 0.1263907632F, 0.1270424667F, 0.1276956512F, 0.1283503142F, 0.1290064537F, 0.1296640674F, 0.1303231530F, 0.1309837084F, 0.1316457312F, 0.1323092193F, 0.1329741703F, 0.1336405820F, 0.1343084520F, 0.1349777782F, 0.1356485582F, 0.1363207897F, 0.1369944704F, 0.1376695979F, 0.1383461700F, 0.1390241842F, 0.1397036384F, 0.1403845300F, 0.1410668567F, 0.1417506162F, 0.1424358061F, 0.1431224240F, 0.1438104674F, 0.1444999341F, 0.1451908216F, 0.1458831274F, 0.1465768492F, 0.1472719844F, 0.1479685308F, 0.1486664857F, 0.1493658468F, 0.1500666115F, 0.1507687775F, 0.1514723422F, 0.1521773031F, 0.1528836577F, 0.1535914035F, 0.1543005380F, 0.1550110587F, 0.1557229631F, 0.1564362485F, 0.1571509124F, 0.1578669524F, 0.1585843657F, 0.1593031499F, 0.1600233024F, 0.1607448205F, 0.1614677017F, 0.1621919433F, 0.1629175428F, 0.1636444975F, 0.1643728047F, 0.1651024619F, 0.1658334665F, 0.1665658156F, 0.1672995067F, 0.1680345371F, 0.1687709041F, 0.1695086050F, 0.1702476372F, 0.1709879978F, 0.1717296843F, 0.1724726938F, 0.1732170237F, 0.1739626711F, 0.1747096335F, 0.1754579079F, 0.1762074916F, 0.1769583819F, 0.1777105760F, 0.1784640710F, 0.1792188642F, 0.1799749529F, 0.1807323340F, 0.1814910049F, 0.1822509628F, 0.1830122046F, 0.1837747277F, 0.1845385292F, 0.1853036062F, 0.1860699558F, 0.1868375751F, 0.1876064613F, 0.1883766114F, 0.1891480226F, 0.1899206919F, 0.1906946164F, 0.1914697932F, 0.1922462194F, 0.1930238919F, 0.1938028079F, 0.1945829643F, 0.1953643583F, 0.1961469868F, 0.1969308468F, 0.1977159353F, 0.1985022494F, 0.1992897859F, 0.2000785420F, 0.2008685145F, 0.2016597005F, 0.2024520968F, 0.2032457005F, 0.2040405084F, 0.2048365175F, 0.2056337247F, 0.2064321269F, 0.2072317211F, 0.2080325041F, 0.2088344727F, 0.2096376240F, 0.2104419547F, 0.2112474618F, 0.2120541420F, 0.2128619923F, 0.2136710094F, 0.2144811902F, 0.2152925315F, 0.2161050301F, 0.2169186829F, 0.2177334866F, 0.2185494381F, 0.2193665340F, 0.2201847712F, 0.2210041465F, 0.2218246565F, 0.2226462981F, 0.2234690680F, 0.2242929629F, 0.2251179796F, 0.2259441147F, 0.2267713650F, 0.2275997272F, 0.2284291979F, 0.2292597739F, 0.2300914518F, 0.2309242283F, 0.2317581001F, 0.2325930638F, 0.2334291160F, 0.2342662534F, 0.2351044727F, 0.2359437703F, 0.2367841431F, 0.2376255875F, 0.2384681001F, 0.2393116776F, 0.2401563165F, 0.2410020134F, 0.2418487649F, 0.2426965675F, 0.2435454178F, 0.2443953122F, 0.2452462474F, 0.2460982199F, 0.2469512262F, 0.2478052628F, 0.2486603262F, 0.2495164129F, 0.2503735194F, 0.2512316421F, 0.2520907776F, 0.2529509222F, 0.2538120726F, 0.2546742250F, 0.2555373760F, 0.2564015219F, 0.2572666593F, 0.2581327845F, 0.2589998939F, 0.2598679840F, 0.2607370510F, 0.2616070916F, 0.2624781019F, 0.2633500783F, 0.2642230173F, 0.2650969152F, 0.2659717684F, 0.2668475731F, 0.2677243257F, 0.2686020226F, 0.2694806601F, 0.2703602344F, 0.2712407419F, 0.2721221789F, 0.2730045417F, 0.2738878265F, 0.2747720297F, 0.2756571474F, 0.2765431760F, 0.2774301117F, 0.2783179508F, 0.2792066895F, 0.2800963240F, 0.2809868505F, 0.2818782654F, 0.2827705647F, 0.2836637447F, 0.2845578016F, 0.2854527315F, 0.2863485307F, 0.2872451953F, 0.2881427215F, 0.2890411055F, 0.2899403433F, 0.2908404312F, 0.2917413654F, 0.2926431418F, 0.2935457567F, 0.2944492061F, 0.2953534863F, 0.2962585932F, 0.2971645230F, 0.2980712717F, 0.2989788356F, 0.2998872105F, 0.3007963927F, 0.3017063781F, 0.3026171629F, 0.3035287430F, 0.3044411145F, 0.3053542736F, 0.3062682161F, 0.3071829381F, 0.3080984356F, 0.3090147047F, 0.3099317413F, 0.3108495414F, 0.3117681011F, 0.3126874163F, 0.3136074830F, 0.3145282972F, 0.3154498548F, 0.3163721517F, 0.3172951841F, 0.3182189477F, 0.3191434385F, 0.3200686525F, 0.3209945856F, 0.3219212336F, 0.3228485927F, 0.3237766585F, 0.3247054271F, 0.3256348943F, 0.3265650560F, 0.3274959081F, 0.3284274465F, 0.3293596671F, 0.3302925657F, 0.3312261382F, 0.3321603804F, 0.3330952882F, 0.3340308574F, 0.3349670838F, 0.3359039634F, 0.3368414919F, 0.3377796651F, 0.3387184789F, 0.3396579290F, 0.3405980113F, 0.3415387216F, 0.3424800556F, 0.3434220091F, 0.3443645779F, 0.3453077578F, 0.3462515446F, 0.3471959340F, 0.3481409217F, 0.3490865036F, 0.3500326754F, 0.3509794328F, 0.3519267715F, 0.3528746873F, 0.3538231759F, 0.3547722330F, 0.3557218544F, 0.3566720357F, 0.3576227727F, 0.3585740610F, 0.3595258964F, 0.3604782745F, 0.3614311910F, 0.3623846417F, 0.3633386221F, 0.3642931280F, 0.3652481549F, 0.3662036987F, 0.3671597548F, 0.3681163191F, 0.3690733870F, 0.3700309544F, 0.3709890167F, 0.3719475696F, 0.3729066089F, 0.3738661299F, 0.3748261285F, 0.3757866002F, 0.3767475406F, 0.3777089453F, 0.3786708100F, 0.3796331302F, 0.3805959014F, 0.3815591194F, 0.3825227796F, 0.3834868777F, 0.3844514093F, 0.3854163698F, 0.3863817549F, 0.3873475601F, 0.3883137810F, 0.3892804131F, 0.3902474521F, 0.3912148933F, 0.3921827325F, 0.3931509650F, 0.3941195865F, 0.3950885925F, 0.3960579785F, 0.3970277400F, 0.3979978725F, 0.3989683716F, 0.3999392328F, 0.4009104516F, 0.4018820234F, 0.4028539438F, 0.4038262084F, 0.4047988125F, 0.4057717516F, 0.4067450214F, 0.4077186172F, 0.4086925345F, 0.4096667688F, 0.4106413155F, 0.4116161703F, 0.4125913284F, 0.4135667854F, 0.4145425368F, 0.4155185780F, 0.4164949044F, 0.4174715116F, 0.4184483949F, 0.4194255498F, 0.4204029718F, 0.4213806563F, 0.4223585987F, 0.4233367946F, 0.4243152392F, 0.4252939281F, 0.4262728566F, 0.4272520202F, 0.4282314144F, 0.4292110345F, 0.4301908760F, 0.4311709343F, 0.4321512047F, 0.4331316828F, 0.4341123639F, 0.4350932435F, 0.4360743168F, 0.4370555794F, 0.4380370267F, 0.4390186540F, 0.4400004567F, 0.4409824303F, 0.4419645701F, 0.4429468716F, 0.4439293300F, 0.4449119409F, 0.4458946996F, 0.4468776014F, 0.4478606418F, 0.4488438162F, 0.4498271199F, 0.4508105483F, 0.4517940967F, 0.4527777607F, 0.4537615355F, 0.4547454165F, 0.4557293991F, 0.4567134786F, 0.4576976505F, 0.4586819101F, 0.4596662527F, 0.4606506738F, 0.4616351687F, 0.4626197328F, 0.4636043614F, 0.4645890499F, 0.4655737936F, 0.4665585880F, 0.4675434284F, 0.4685283101F, 0.4695132286F, 0.4704981791F, 0.4714831570F, 0.4724681577F, 0.4734531766F, 0.4744382089F, 0.4754232501F, 0.4764082956F, 0.4773933406F, 0.4783783806F, 0.4793634108F, 0.4803484267F, 0.4813334237F, 0.4823183969F, 0.4833033419F, 0.4842882540F, 0.4852731285F, 0.4862579608F, 0.4872427462F, 0.4882274802F, 0.4892121580F, 0.4901967751F, 0.4911813267F, 0.4921658083F, 0.4931502151F, 0.4941345427F, 0.4951187863F, 0.4961029412F, 0.4970870029F, 0.4980709667F, 0.4990548280F, 0.5000385822F, 0.5010222245F, 0.5020057505F, 0.5029891553F, 0.5039724345F, 0.5049555834F, 0.5059385973F, 0.5069214716F, 0.5079042018F, 0.5088867831F, 0.5098692110F, 0.5108514808F, 0.5118335879F, 0.5128155277F, 0.5137972956F, 0.5147788869F, 0.5157602971F, 0.5167415215F, 0.5177225555F, 0.5187033945F, 0.5196840339F, 0.5206644692F, 0.5216446956F, 0.5226247086F, 0.5236045035F, 0.5245840759F, 0.5255634211F, 0.5265425344F, 0.5275214114F, 0.5285000474F, 0.5294784378F, 0.5304565781F, 0.5314344637F, 0.5324120899F, 0.5333894522F, 0.5343665461F, 0.5353433670F, 0.5363199102F, 0.5372961713F, 0.5382721457F, 0.5392478287F, 0.5402232159F, 0.5411983027F, 0.5421730845F, 0.5431475569F, 0.5441217151F, 0.5450955548F, 0.5460690714F, 0.5470422602F, 0.5480151169F, 0.5489876368F, 0.5499598155F, 0.5509316484F, 0.5519031310F, 0.5528742587F, 0.5538450271F, 0.5548154317F, 0.5557854680F, 0.5567551314F, 0.5577244174F, 0.5586933216F, 0.5596618395F, 0.5606299665F, 0.5615976983F, 0.5625650302F, 0.5635319580F, 0.5644984770F, 0.5654645828F, 0.5664302709F, 0.5673955370F, 0.5683603765F, 0.5693247850F, 0.5702887580F, 0.5712522912F, 0.5722153800F, 0.5731780200F, 0.5741402069F, 0.5751019362F, 0.5760632034F, 0.5770240042F, 0.5779843341F, 0.5789441889F, 0.5799035639F, 0.5808624549F, 0.5818208575F, 0.5827787673F, 0.5837361800F, 0.5846930910F, 0.5856494961F, 0.5866053910F, 0.5875607712F, 0.5885156324F, 0.5894699703F, 0.5904237804F, 0.5913770586F, 0.5923298004F, 0.5932820016F, 0.5942336578F, 0.5951847646F, 0.5961353179F, 0.5970853132F, 0.5980347464F, 0.5989836131F, 0.5999319090F, 0.6008796298F, 0.6018267713F, 0.6027733292F, 0.6037192993F, 0.6046646773F, 0.6056094589F, 0.6065536400F, 0.6074972162F, 0.6084401833F, 0.6093825372F, 0.6103242736F, 0.6112653884F, 0.6122058772F, 0.6131457359F, 0.6140849604F, 0.6150235464F, 0.6159614897F, 0.6168987862F, 0.6178354318F, 0.6187714223F, 0.6197067535F, 0.6206414213F, 0.6215754215F, 0.6225087501F, 0.6234414028F, 0.6243733757F, 0.6253046646F, 0.6262352654F, 0.6271651739F, 0.6280943862F, 0.6290228982F, 0.6299507057F, 0.6308778048F, 0.6318041913F, 0.6327298612F, 0.6336548105F, 0.6345790352F, 0.6355025312F, 0.6364252945F, 0.6373473211F, 0.6382686070F, 0.6391891483F, 0.6401089409F, 0.6410279808F, 0.6419462642F, 0.6428637869F, 0.6437805452F, 0.6446965350F, 0.6456117524F, 0.6465261935F, 0.6474398544F, 0.6483527311F, 0.6492648197F, 0.6501761165F, 0.6510866174F, 0.6519963186F, 0.6529052162F, 0.6538133064F, 0.6547205854F, 0.6556270492F, 0.6565326941F, 0.6574375162F, 0.6583415117F, 0.6592446769F, 0.6601470079F, 0.6610485009F, 0.6619491521F, 0.6628489578F, 0.6637479143F, 0.6646460177F, 0.6655432643F, 0.6664396505F, 0.6673351724F, 0.6682298264F, 0.6691236087F, 0.6700165157F, 0.6709085436F, 0.6717996889F, 0.6726899478F, 0.6735793167F, 0.6744677918F, 0.6753553697F, 0.6762420466F, 0.6771278190F, 0.6780126832F, 0.6788966357F, 0.6797796728F, 0.6806617909F, 0.6815429866F, 0.6824232562F, 0.6833025961F, 0.6841810030F, 0.6850584731F, 0.6859350031F, 0.6868105894F, 0.6876852284F, 0.6885589168F, 0.6894316510F, 0.6903034275F, 0.6911742430F, 0.6920440939F, 0.6929129769F, 0.6937808884F, 0.6946478251F, 0.6955137837F, 0.6963787606F, 0.6972427525F, 0.6981057560F, 0.6989677678F, 0.6998287845F, 0.7006888028F, 0.7015478194F, 0.7024058309F, 0.7032628340F, 0.7041188254F, 0.7049738019F, 0.7058277601F, 0.7066806969F, 0.7075326089F, 0.7083834929F, 0.7092333457F, 0.7100821640F, 0.7109299447F, 0.7117766846F, 0.7126223804F, 0.7134670291F, 0.7143106273F, 0.7151531721F, 0.7159946602F, 0.7168350885F, 0.7176744539F, 0.7185127534F, 0.7193499837F, 0.7201861418F, 0.7210212247F, 0.7218552293F, 0.7226881526F, 0.7235199914F, 0.7243507428F, 0.7251804039F, 0.7260089715F, 0.7268364426F, 0.7276628144F, 0.7284880839F, 0.7293122481F, 0.7301353040F, 0.7309572487F, 0.7317780794F, 0.7325977930F, 0.7334163868F, 0.7342338579F, 0.7350502033F, 0.7358654202F, 0.7366795059F, 0.7374924573F, 0.7383042718F, 0.7391149465F, 0.7399244787F, 0.7407328655F, 0.7415401041F, 0.7423461920F, 0.7431511261F, 0.7439549040F, 0.7447575227F, 0.7455589797F, 0.7463592723F, 0.7471583976F, 0.7479563532F, 0.7487531363F, 0.7495487443F, 0.7503431745F, 0.7511364244F, 0.7519284913F, 0.7527193726F, 0.7535090658F, 0.7542975683F, 0.7550848776F, 0.7558709910F, 0.7566559062F, 0.7574396205F, 0.7582221314F, 0.7590034366F, 0.7597835334F, 0.7605624194F, 0.7613400923F, 0.7621165495F, 0.7628917886F, 0.7636658072F, 0.7644386030F, 0.7652101735F, 0.7659805164F, 0.7667496292F, 0.7675175098F, 0.7682841556F, 0.7690495645F, 0.7698137341F, 0.7705766622F, 0.7713383463F, 0.7720987844F, 0.7728579741F, 0.7736159132F, 0.7743725994F, 0.7751280306F, 0.7758822046F, 0.7766351192F, 0.7773867722F, 0.7781371614F, 0.7788862848F, 0.7796341401F, 0.7803807253F, 0.7811260383F, 0.7818700769F, 0.7826128392F, 0.7833543230F, 0.7840945263F, 0.7848334471F, 0.7855710833F, 0.7863074330F, 0.7870424941F, 0.7877762647F, 0.7885087428F, 0.7892399264F, 0.7899698137F, 0.7906984026F, 0.7914256914F, 0.7921516780F, 0.7928763607F, 0.7935997375F, 0.7943218065F, 0.7950425661F, 0.7957620142F, 0.7964801492F, 0.7971969692F, 0.7979124724F, 0.7986266570F, 0.7993395214F, 0.8000510638F, 0.8007612823F, 0.8014701754F, 0.8021777413F, 0.8028839784F, 0.8035888849F, 0.8042924592F, 0.8049946997F, 0.8056956048F, 0.8063951727F, 0.8070934020F, 0.8077902910F, 0.8084858381F, 0.8091800419F, 0.8098729007F, 0.8105644130F, 0.8112545774F, 0.8119433922F, 0.8126308561F, 0.8133169676F, 0.8140017251F, 0.8146851272F, 0.8153671726F, 0.8160478598F, 0.8167271874F, 0.8174051539F, 0.8180817582F, 0.8187569986F, 0.8194308741F, 0.8201033831F, 0.8207745244F, 0.8214442966F, 0.8221126986F, 0.8227797290F, 0.8234453865F, 0.8241096700F, 0.8247725781F, 0.8254341097F, 0.8260942636F, 0.8267530385F, 0.8274104334F, 0.8280664470F, 0.8287210782F, 0.8293743259F, 0.8300261889F, 0.8306766662F, 0.8313257566F, 0.8319734591F, 0.8326197727F, 0.8332646963F, 0.8339082288F, 0.8345503692F, 0.8351911167F, 0.8358304700F, 0.8364684284F, 0.8371049907F, 0.8377401562F, 0.8383739238F, 0.8390062927F, 0.8396372618F, 0.8402668305F, 0.8408949977F, 0.8415217626F, 0.8421471245F, 0.8427710823F, 0.8433936354F, 0.8440147830F, 0.8446345242F, 0.8452528582F, 0.8458697844F, 0.8464853020F, 0.8470994102F, 0.8477121084F, 0.8483233958F, 0.8489332718F, 0.8495417356F, 0.8501487866F, 0.8507544243F, 0.8513586479F, 0.8519614568F, 0.8525628505F, 0.8531628283F, 0.8537613897F, 0.8543585341F, 0.8549542611F, 0.8555485699F, 0.8561414603F, 0.8567329315F, 0.8573229832F, 0.8579116149F, 0.8584988262F, 0.8590846165F, 0.8596689855F, 0.8602519327F, 0.8608334577F, 0.8614135603F, 0.8619922399F, 0.8625694962F, 0.8631453289F, 0.8637197377F, 0.8642927222F, 0.8648642821F, 0.8654344172F, 0.8660031272F, 0.8665704118F, 0.8671362708F, 0.8677007039F, 0.8682637109F, 0.8688252917F, 0.8693854460F, 0.8699441737F, 0.8705014745F, 0.8710573485F, 0.8716117953F, 0.8721648150F, 0.8727164073F, 0.8732665723F, 0.8738153098F, 0.8743626197F, 0.8749085021F, 0.8754529569F, 0.8759959840F, 0.8765375835F, 0.8770777553F, 0.8776164996F, 0.8781538162F, 0.8786897054F, 0.8792241670F, 0.8797572013F, 0.8802888082F, 0.8808189880F, 0.8813477407F, 0.8818750664F, 0.8824009653F, 0.8829254375F, 0.8834484833F, 0.8839701028F, 0.8844902961F, 0.8850090636F, 0.8855264054F, 0.8860423218F, 0.8865568131F, 0.8870698794F, 0.8875815212F, 0.8880917386F, 0.8886005319F, 0.8891079016F, 0.8896138479F, 0.8901183712F, 0.8906214719F, 0.8911231503F, 0.8916234067F, 0.8921222417F, 0.8926196556F, 0.8931156489F, 0.8936102219F, 0.8941033752F, 0.8945951092F, 0.8950854244F, 0.8955743212F, 0.8960618003F, 0.8965478621F, 0.8970325071F, 0.8975157359F, 0.8979975490F, 0.8984779471F, 0.8989569307F, 0.8994345004F, 0.8999106568F, 0.9003854005F, 0.9008587323F, 0.9013306526F, 0.9018011623F, 0.9022702619F, 0.9027379521F, 0.9032042337F, 0.9036691074F, 0.9041325739F, 0.9045946339F, 0.9050552882F, 0.9055145376F, 0.9059723828F, 0.9064288246F, 0.9068838638F, 0.9073375013F, 0.9077897379F, 0.9082405743F, 0.9086900115F, 0.9091380503F, 0.9095846917F, 0.9100299364F, 0.9104737854F, 0.9109162397F, 0.9113573001F, 0.9117969675F, 0.9122352430F, 0.9126721275F, 0.9131076219F, 0.9135417273F, 0.9139744447F, 0.9144057750F, 0.9148357194F, 0.9152642787F, 0.9156914542F, 0.9161172468F, 0.9165416576F, 0.9169646877F, 0.9173863382F, 0.9178066102F, 0.9182255048F, 0.9186430232F, 0.9190591665F, 0.9194739359F, 0.9198873324F, 0.9202993574F, 0.9207100120F, 0.9211192973F, 0.9215272147F, 0.9219337653F, 0.9223389504F, 0.9227427713F, 0.9231452290F, 0.9235463251F, 0.9239460607F, 0.9243444371F, 0.9247414557F, 0.9251371177F, 0.9255314245F, 0.9259243774F, 0.9263159778F, 0.9267062270F, 0.9270951264F, 0.9274826774F, 0.9278688814F, 0.9282537398F, 0.9286372540F, 0.9290194254F, 0.9294002555F, 0.9297797458F, 0.9301578976F, 0.9305347125F, 0.9309101919F, 0.9312843373F, 0.9316571503F, 0.9320286323F, 0.9323987849F, 0.9327676097F, 0.9331351080F, 0.9335012816F, 0.9338661320F, 0.9342296607F, 0.9345918694F, 0.9349527596F, 0.9353123330F, 0.9356705911F, 0.9360275357F, 0.9363831683F, 0.9367374905F, 0.9370905042F, 0.9374422108F, 0.9377926122F, 0.9381417099F, 0.9384895057F, 0.9388360014F, 0.9391811985F, 0.9395250989F, 0.9398677043F, 0.9402090165F, 0.9405490371F, 0.9408877680F, 0.9412252110F, 0.9415613678F, 0.9418962402F, 0.9422298301F, 0.9425621392F, 0.9428931695F, 0.9432229226F, 0.9435514005F, 0.9438786050F, 0.9442045381F, 0.9445292014F, 0.9448525971F, 0.9451747268F, 0.9454955926F, 0.9458151963F, 0.9461335399F, 0.9464506253F, 0.9467664545F, 0.9470810293F, 0.9473943517F, 0.9477064238F, 0.9480172474F, 0.9483268246F, 0.9486351573F, 0.9489422475F, 0.9492480973F, 0.9495527087F, 0.9498560837F, 0.9501582243F, 0.9504591325F, 0.9507588105F, 0.9510572603F, 0.9513544839F, 0.9516504834F, 0.9519452609F, 0.9522388186F, 0.9525311584F, 0.9528222826F, 0.9531121932F, 0.9534008923F, 0.9536883821F, 0.9539746647F, 0.9542597424F, 0.9545436171F, 0.9548262912F, 0.9551077667F, 0.9553880459F, 0.9556671309F, 0.9559450239F, 0.9562217272F, 0.9564972429F, 0.9567715733F, 0.9570447206F, 0.9573166871F, 0.9575874749F, 0.9578570863F, 0.9581255236F, 0.9583927890F, 0.9586588849F, 0.9589238134F, 0.9591875769F, 0.9594501777F, 0.9597116180F, 0.9599719003F, 0.9602310267F, 0.9604889995F, 0.9607458213F, 0.9610014942F, 0.9612560206F, 0.9615094028F, 0.9617616433F, 0.9620127443F, 0.9622627083F, 0.9625115376F, 0.9627592345F, 0.9630058016F, 0.9632512411F, 0.9634955555F, 0.9637387471F, 0.9639808185F, 0.9642217720F, 0.9644616100F, 0.9647003349F, 0.9649379493F, 0.9651744556F, 0.9654098561F, 0.9656441534F, 0.9658773499F, 0.9661094480F, 0.9663404504F, 0.9665703593F, 0.9667991774F, 0.9670269071F, 0.9672535509F, 0.9674791114F, 0.9677035909F, 0.9679269921F, 0.9681493174F, 0.9683705694F, 0.9685907506F, 0.9688098636F, 0.9690279108F, 0.9692448948F, 0.9694608182F, 0.9696756836F, 0.9698894934F, 0.9701022503F, 0.9703139569F, 0.9705246156F, 0.9707342291F, 0.9709428000F, 0.9711503309F, 0.9713568243F, 0.9715622829F, 0.9717667093F, 0.9719701060F, 0.9721724757F, 0.9723738210F, 0.9725741446F, 0.9727734490F, 0.9729717369F, 0.9731690109F, 0.9733652737F, 0.9735605279F, 0.9737547762F, 0.9739480212F, 0.9741402656F, 0.9743315120F, 0.9745217631F, 0.9747110216F, 0.9748992901F, 0.9750865714F, 0.9752728681F, 0.9754581829F, 0.9756425184F, 0.9758258775F, 0.9760082627F, 0.9761896768F, 0.9763701224F, 0.9765496024F, 0.9767281193F, 0.9769056760F, 0.9770822751F, 0.9772579193F, 0.9774326114F, 0.9776063542F, 0.9777791502F, 0.9779510023F, 0.9781219133F, 0.9782918858F, 0.9784609226F, 0.9786290264F, 0.9787962000F, 0.9789624461F, 0.9791277676F, 0.9792921671F, 0.9794556474F, 0.9796182113F, 0.9797798615F, 0.9799406009F, 0.9801004321F, 0.9802593580F, 0.9804173813F, 0.9805745049F, 0.9807307314F, 0.9808860637F, 0.9810405046F, 0.9811940568F, 0.9813467232F, 0.9814985065F, 0.9816494095F, 0.9817994351F, 0.9819485860F, 0.9820968650F, 0.9822442750F, 0.9823908186F, 0.9825364988F, 0.9826813184F, 0.9828252801F, 0.9829683868F, 0.9831106413F, 0.9832520463F, 0.9833926048F, 0.9835323195F, 0.9836711932F, 0.9838092288F, 0.9839464291F, 0.9840827969F, 0.9842183351F, 0.9843530464F, 0.9844869337F, 0.9846199998F, 0.9847522475F, 0.9848836798F, 0.9850142993F, 0.9851441090F, 0.9852731117F, 0.9854013101F, 0.9855287073F, 0.9856553058F, 0.9857811087F, 0.9859061188F, 0.9860303388F, 0.9861537717F, 0.9862764202F, 0.9863982872F, 0.9865193756F, 0.9866396882F, 0.9867592277F, 0.9868779972F, 0.9869959993F, 0.9871132370F, 0.9872297131F, 0.9873454304F, 0.9874603918F, 0.9875746001F, 0.9876880581F, 0.9878007688F, 0.9879127348F, 0.9880239592F, 0.9881344447F, 0.9882441941F, 0.9883532104F, 0.9884614962F, 0.9885690546F, 0.9886758883F, 0.9887820001F, 0.9888873930F, 0.9889920697F, 0.9890960331F, 0.9891992859F, 0.9893018312F, 0.9894036716F, 0.9895048100F, 0.9896052493F, 0.9897049923F, 0.9898040418F, 0.9899024006F, 0.9900000717F, 0.9900970577F, 0.9901933616F, 0.9902889862F, 0.9903839343F, 0.9904782087F, 0.9905718122F, 0.9906647477F, 0.9907570180F, 0.9908486259F, 0.9909395742F, 0.9910298658F, 0.9911195034F, 0.9912084899F, 0.9912968281F, 0.9913845208F, 0.9914715708F, 0.9915579810F, 0.9916437540F, 0.9917288928F, 0.9918134001F, 0.9918972788F, 0.9919805316F, 0.9920631613F, 0.9921451707F, 0.9922265626F, 0.9923073399F, 0.9923875052F, 0.9924670615F, 0.9925460114F, 0.9926243577F, 0.9927021033F, 0.9927792508F, 0.9928558032F, 0.9929317631F, 0.9930071333F, 0.9930819167F, 0.9931561158F, 0.9932297337F, 0.9933027728F, 0.9933752362F, 0.9934471264F, 0.9935184462F, 0.9935891985F, 0.9936593859F, 0.9937290112F, 0.9937980771F, 0.9938665864F, 0.9939345418F, 0.9940019460F, 0.9940688018F, 0.9941351118F, 0.9942008789F, 0.9942661057F, 0.9943307950F, 0.9943949494F, 0.9944585717F, 0.9945216645F, 0.9945842307F, 0.9946462728F, 0.9947077936F, 0.9947687957F, 0.9948292820F, 0.9948892550F, 0.9949487174F, 0.9950076719F, 0.9950661212F, 0.9951240679F, 0.9951815148F, 0.9952384645F, 0.9952949196F, 0.9953508828F, 0.9954063568F, 0.9954613442F, 0.9955158476F, 0.9955698697F, 0.9956234132F, 0.9956764806F, 0.9957290746F, 0.9957811978F, 0.9958328528F, 0.9958840423F, 0.9959347688F, 0.9959850351F, 0.9960348435F, 0.9960841969F, 0.9961330977F, 0.9961815486F, 0.9962295521F, 0.9962771108F, 0.9963242274F, 0.9963709043F, 0.9964171441F, 0.9964629494F, 0.9965083228F, 0.9965532668F, 0.9965977840F, 0.9966418768F, 0.9966855479F, 0.9967287998F, 0.9967716350F, 0.9968140559F, 0.9968560653F, 0.9968976655F, 0.9969388591F, 0.9969796485F, 0.9970200363F, 0.9970600250F, 0.9970996170F, 0.9971388149F, 0.9971776211F, 0.9972160380F, 0.9972540683F, 0.9972917142F, 0.9973289783F, 0.9973658631F, 0.9974023709F, 0.9974385042F, 0.9974742655F, 0.9975096571F, 0.9975446816F, 0.9975793413F, 0.9976136386F, 0.9976475759F, 0.9976811557F, 0.9977143803F, 0.9977472521F, 0.9977797736F, 0.9978119470F, 0.9978437748F, 0.9978752593F, 0.9979064029F, 0.9979372079F, 0.9979676768F, 0.9979978117F, 0.9980276151F, 0.9980570893F, 0.9980862367F, 0.9981150595F, 0.9981435600F, 0.9981717406F, 0.9981996035F, 0.9982271511F, 0.9982543856F, 0.9982813093F, 0.9983079246F, 0.9983342336F, 0.9983602386F, 0.9983859418F, 0.9984113456F, 0.9984364522F, 0.9984612638F, 0.9984857825F, 0.9985100108F, 0.9985339507F, 0.9985576044F, 0.9985809743F, 0.9986040624F, 0.9986268710F, 0.9986494022F, 0.9986716583F, 0.9986936413F, 0.9987153535F, 0.9987367969F, 0.9987579738F, 0.9987788864F, 0.9987995366F, 0.9988199267F, 0.9988400587F, 0.9988599348F, 0.9988795572F, 0.9988989278F, 0.9989180487F, 0.9989369222F, 0.9989555501F, 0.9989739347F, 0.9989920780F, 0.9990099820F, 0.9990276487F, 0.9990450803F, 0.9990622787F, 0.9990792460F, 0.9990959841F, 0.9991124952F, 0.9991287812F, 0.9991448440F, 0.9991606858F, 0.9991763084F, 0.9991917139F, 0.9992069042F, 0.9992218813F, 0.9992366471F, 0.9992512035F, 0.9992655525F, 0.9992796961F, 0.9992936361F, 0.9993073744F, 0.9993209131F, 0.9993342538F, 0.9993473987F, 0.9993603494F, 0.9993731080F, 0.9993856762F, 0.9993980559F, 0.9994102490F, 0.9994222573F, 0.9994340827F, 0.9994457269F, 0.9994571918F, 0.9994684793F, 0.9994795910F, 0.9994905288F, 0.9995012945F, 0.9995118898F, 0.9995223165F, 0.9995325765F, 0.9995426713F, 0.9995526029F, 0.9995623728F, 0.9995719829F, 0.9995814349F, 0.9995907304F, 0.9995998712F, 0.9996088590F, 0.9996176954F, 0.9996263821F, 0.9996349208F, 0.9996433132F, 0.9996515609F, 0.9996596656F, 0.9996676288F, 0.9996754522F, 0.9996831375F, 0.9996906862F, 0.9996981000F, 0.9997053804F, 0.9997125290F, 0.9997195474F, 0.9997264371F, 0.9997331998F, 0.9997398369F, 0.9997463500F, 0.9997527406F, 0.9997590103F, 0.9997651606F, 0.9997711930F, 0.9997771089F, 0.9997829098F, 0.9997885973F, 0.9997941728F, 0.9997996378F, 0.9998049936F, 0.9998102419F, 0.9998153839F, 0.9998204211F, 0.9998253550F, 0.9998301868F, 0.9998349182F, 0.9998395503F, 0.9998440847F, 0.9998485226F, 0.9998528654F, 0.9998571146F, 0.9998612713F, 0.9998653370F, 0.9998693130F, 0.9998732007F, 0.9998770012F, 0.9998807159F, 0.9998843461F, 0.9998878931F, 0.9998913581F, 0.9998947424F, 0.9998980473F, 0.9999012740F, 0.9999044237F, 0.9999074976F, 0.9999104971F, 0.9999134231F, 0.9999162771F, 0.9999190601F, 0.9999217733F, 0.9999244179F, 0.9999269950F, 0.9999295058F, 0.9999319515F, 0.9999343332F, 0.9999366519F, 0.9999389088F, 0.9999411050F, 0.9999432416F, 0.9999453196F, 0.9999473402F, 0.9999493044F, 0.9999512132F, 0.9999530677F, 0.9999548690F, 0.9999566180F, 0.9999583157F, 0.9999599633F, 0.9999615616F, 0.9999631116F, 0.9999646144F, 0.9999660709F, 0.9999674820F, 0.9999688487F, 0.9999701719F, 0.9999714526F, 0.9999726917F, 0.9999738900F, 0.9999750486F, 0.9999761682F, 0.9999772497F, 0.9999782941F, 0.9999793021F, 0.9999802747F, 0.9999812126F, 0.9999821167F, 0.9999829878F, 0.9999838268F, 0.9999846343F, 0.9999854113F, 0.9999861584F, 0.9999868765F, 0.9999875664F, 0.9999882287F, 0.9999888642F, 0.9999894736F, 0.9999900577F, 0.9999906172F, 0.9999911528F, 0.9999916651F, 0.9999921548F, 0.9999926227F, 0.9999930693F, 0.9999934954F, 0.9999939015F, 0.9999942883F, 0.9999946564F, 0.9999950064F, 0.9999953390F, 0.9999956547F, 0.9999959541F, 0.9999962377F, 0.9999965062F, 0.9999967601F, 0.9999969998F, 0.9999972260F, 0.9999974392F, 0.9999976399F, 0.9999978285F, 0.9999980056F, 0.9999981716F, 0.9999983271F, 0.9999984724F, 0.9999986081F, 0.9999987345F, 0.9999988521F, 0.9999989613F, 0.9999990625F, 0.9999991562F, 0.9999992426F, 0.9999993223F, 0.9999993954F, 0.9999994625F, 0.9999995239F, 0.9999995798F, 0.9999996307F, 0.9999996768F, 0.9999997184F, 0.9999997559F, 0.9999997895F, 0.9999998195F, 0.9999998462F, 0.9999998698F, 0.9999998906F, 0.9999999088F, 0.9999999246F, 0.9999999383F, 0.9999999500F, 0.9999999600F, 0.9999999684F, 0.9999999754F, 0.9999999811F, 0.9999999858F, 0.9999999896F, 0.9999999925F, 0.9999999948F, 0.9999999965F, 0.9999999978F, 0.9999999986F, 0.9999999992F, 0.9999999996F, 0.9999999998F, 0.9999999999F, 1.0000000000F, 1.0000000000F, 1.0000000000F, }; static float vwin8192[4096] = { 0.0000000578F, 0.0000005198F, 0.0000014438F, 0.0000028299F, 0.0000046780F, 0.0000069882F, 0.0000097604F, 0.0000129945F, 0.0000166908F, 0.0000208490F, 0.0000254692F, 0.0000305515F, 0.0000360958F, 0.0000421021F, 0.0000485704F, 0.0000555006F, 0.0000628929F, 0.0000707472F, 0.0000790635F, 0.0000878417F, 0.0000970820F, 0.0001067842F, 0.0001169483F, 0.0001275744F, 0.0001386625F, 0.0001502126F, 0.0001622245F, 0.0001746984F, 0.0001876343F, 0.0002010320F, 0.0002148917F, 0.0002292132F, 0.0002439967F, 0.0002592421F, 0.0002749493F, 0.0002911184F, 0.0003077493F, 0.0003248421F, 0.0003423967F, 0.0003604132F, 0.0003788915F, 0.0003978316F, 0.0004172335F, 0.0004370971F, 0.0004574226F, 0.0004782098F, 0.0004994587F, 0.0005211694F, 0.0005433418F, 0.0005659759F, 0.0005890717F, 0.0006126292F, 0.0006366484F, 0.0006611292F, 0.0006860716F, 0.0007114757F, 0.0007373414F, 0.0007636687F, 0.0007904576F, 0.0008177080F, 0.0008454200F, 0.0008735935F, 0.0009022285F, 0.0009313250F, 0.0009608830F, 0.0009909025F, 0.0010213834F, 0.0010523257F, 0.0010837295F, 0.0011155946F, 0.0011479211F, 0.0011807090F, 0.0012139582F, 0.0012476687F, 0.0012818405F, 0.0013164736F, 0.0013515679F, 0.0013871235F, 0.0014231402F, 0.0014596182F, 0.0014965573F, 0.0015339576F, 0.0015718190F, 0.0016101415F, 0.0016489251F, 0.0016881698F, 0.0017278754F, 0.0017680421F, 0.0018086698F, 0.0018497584F, 0.0018913080F, 0.0019333185F, 0.0019757898F, 0.0020187221F, 0.0020621151F, 0.0021059690F, 0.0021502837F, 0.0021950591F, 0.0022402953F, 0.0022859921F, 0.0023321497F, 0.0023787679F, 0.0024258467F, 0.0024733861F, 0.0025213861F, 0.0025698466F, 0.0026187676F, 0.0026681491F, 0.0027179911F, 0.0027682935F, 0.0028190562F, 0.0028702794F, 0.0029219628F, 0.0029741066F, 0.0030267107F, 0.0030797749F, 0.0031332994F, 0.0031872841F, 0.0032417289F, 0.0032966338F, 0.0033519988F, 0.0034078238F, 0.0034641089F, 0.0035208539F, 0.0035780589F, 0.0036357237F, 0.0036938485F, 0.0037524331F, 0.0038114775F, 0.0038709817F, 0.0039309456F, 0.0039913692F, 0.0040522524F, 0.0041135953F, 0.0041753978F, 0.0042376599F, 0.0043003814F, 0.0043635624F, 0.0044272029F, 0.0044913028F, 0.0045558620F, 0.0046208806F, 0.0046863585F, 0.0047522955F, 0.0048186919F, 0.0048855473F, 0.0049528619F, 0.0050206356F, 0.0050888684F, 0.0051575601F, 0.0052267108F, 0.0052963204F, 0.0053663890F, 0.0054369163F, 0.0055079025F, 0.0055793474F, 0.0056512510F, 0.0057236133F, 0.0057964342F, 0.0058697137F, 0.0059434517F, 0.0060176482F, 0.0060923032F, 0.0061674166F, 0.0062429883F, 0.0063190183F, 0.0063955066F, 0.0064724532F, 0.0065498579F, 0.0066277207F, 0.0067060416F, 0.0067848205F, 0.0068640575F, 0.0069437523F, 0.0070239051F, 0.0071045157F, 0.0071855840F, 0.0072671102F, 0.0073490940F, 0.0074315355F, 0.0075144345F, 0.0075977911F, 0.0076816052F, 0.0077658768F, 0.0078506057F, 0.0079357920F, 0.0080214355F, 0.0081075363F, 0.0081940943F, 0.0082811094F, 0.0083685816F, 0.0084565108F, 0.0085448970F, 0.0086337401F, 0.0087230401F, 0.0088127969F, 0.0089030104F, 0.0089936807F, 0.0090848076F, 0.0091763911F, 0.0092684311F, 0.0093609276F, 0.0094538805F, 0.0095472898F, 0.0096411554F, 0.0097354772F, 0.0098302552F, 0.0099254894F, 0.0100211796F, 0.0101173259F, 0.0102139281F, 0.0103109863F, 0.0104085002F, 0.0105064700F, 0.0106048955F, 0.0107037766F, 0.0108031133F, 0.0109029056F, 0.0110031534F, 0.0111038565F, 0.0112050151F, 0.0113066289F, 0.0114086980F, 0.0115112222F, 0.0116142015F, 0.0117176359F, 0.0118215252F, 0.0119258695F, 0.0120306686F, 0.0121359225F, 0.0122416312F, 0.0123477944F, 0.0124544123F, 0.0125614847F, 0.0126690116F, 0.0127769928F, 0.0128854284F, 0.0129943182F, 0.0131036623F, 0.0132134604F, 0.0133237126F, 0.0134344188F, 0.0135455790F, 0.0136571929F, 0.0137692607F, 0.0138817821F, 0.0139947572F, 0.0141081859F, 0.0142220681F, 0.0143364037F, 0.0144511927F, 0.0145664350F, 0.0146821304F, 0.0147982791F, 0.0149148808F, 0.0150319355F, 0.0151494431F, 0.0152674036F, 0.0153858168F, 0.0155046828F, 0.0156240014F, 0.0157437726F, 0.0158639962F, 0.0159846723F, 0.0161058007F, 0.0162273814F, 0.0163494142F, 0.0164718991F, 0.0165948361F, 0.0167182250F, 0.0168420658F, 0.0169663584F, 0.0170911027F, 0.0172162987F, 0.0173419462F, 0.0174680452F, 0.0175945956F, 0.0177215974F, 0.0178490504F, 0.0179769545F, 0.0181053098F, 0.0182341160F, 0.0183633732F, 0.0184930812F, 0.0186232399F, 0.0187538494F, 0.0188849094F, 0.0190164200F, 0.0191483809F, 0.0192807923F, 0.0194136539F, 0.0195469656F, 0.0196807275F, 0.0198149394F, 0.0199496012F, 0.0200847128F, 0.0202202742F, 0.0203562853F, 0.0204927460F, 0.0206296561F, 0.0207670157F, 0.0209048245F, 0.0210430826F, 0.0211817899F, 0.0213209462F, 0.0214605515F, 0.0216006057F, 0.0217411086F, 0.0218820603F, 0.0220234605F, 0.0221653093F, 0.0223076066F, 0.0224503521F, 0.0225935459F, 0.0227371879F, 0.0228812779F, 0.0230258160F, 0.0231708018F, 0.0233162355F, 0.0234621169F, 0.0236084459F, 0.0237552224F, 0.0239024462F, 0.0240501175F, 0.0241982359F, 0.0243468015F, 0.0244958141F, 0.0246452736F, 0.0247951800F, 0.0249455331F, 0.0250963329F, 0.0252475792F, 0.0253992720F, 0.0255514111F, 0.0257039965F, 0.0258570281F, 0.0260105057F, 0.0261644293F, 0.0263187987F, 0.0264736139F, 0.0266288747F, 0.0267845811F, 0.0269407330F, 0.0270973302F, 0.0272543727F, 0.0274118604F, 0.0275697930F, 0.0277281707F, 0.0278869932F, 0.0280462604F, 0.0282059723F, 0.0283661287F, 0.0285267295F, 0.0286877747F, 0.0288492641F, 0.0290111976F, 0.0291735751F, 0.0293363965F, 0.0294996617F, 0.0296633706F, 0.0298275231F, 0.0299921190F, 0.0301571583F, 0.0303226409F, 0.0304885667F, 0.0306549354F, 0.0308217472F, 0.0309890017F, 0.0311566989F, 0.0313248388F, 0.0314934211F, 0.0316624459F, 0.0318319128F, 0.0320018220F, 0.0321721732F, 0.0323429663F, 0.0325142013F, 0.0326858779F, 0.0328579962F, 0.0330305559F, 0.0332035570F, 0.0333769994F, 0.0335508829F, 0.0337252074F, 0.0338999728F, 0.0340751790F, 0.0342508259F, 0.0344269134F, 0.0346034412F, 0.0347804094F, 0.0349578178F, 0.0351356663F, 0.0353139548F, 0.0354926831F, 0.0356718511F, 0.0358514588F, 0.0360315059F, 0.0362119924F, 0.0363929182F, 0.0365742831F, 0.0367560870F, 0.0369383297F, 0.0371210113F, 0.0373041315F, 0.0374876902F, 0.0376716873F, 0.0378561226F, 0.0380409961F, 0.0382263077F, 0.0384120571F, 0.0385982443F, 0.0387848691F, 0.0389719315F, 0.0391594313F, 0.0393473683F, 0.0395357425F, 0.0397245537F, 0.0399138017F, 0.0401034866F, 0.0402936080F, 0.0404841660F, 0.0406751603F, 0.0408665909F, 0.0410584576F, 0.0412507603F, 0.0414434988F, 0.0416366731F, 0.0418302829F, 0.0420243282F, 0.0422188088F, 0.0424137246F, 0.0426090755F, 0.0428048613F, 0.0430010819F, 0.0431977371F, 0.0433948269F, 0.0435923511F, 0.0437903095F, 0.0439887020F, 0.0441875285F, 0.0443867889F, 0.0445864830F, 0.0447866106F, 0.0449871717F, 0.0451881661F, 0.0453895936F, 0.0455914542F, 0.0457937477F, 0.0459964738F, 0.0461996326F, 0.0464032239F, 0.0466072475F, 0.0468117032F, 0.0470165910F, 0.0472219107F, 0.0474276622F, 0.0476338452F, 0.0478404597F, 0.0480475056F, 0.0482549827F, 0.0484628907F, 0.0486712297F, 0.0488799994F, 0.0490891998F, 0.0492988306F, 0.0495088917F, 0.0497193830F, 0.0499303043F, 0.0501416554F, 0.0503534363F, 0.0505656468F, 0.0507782867F, 0.0509913559F, 0.0512048542F, 0.0514187815F, 0.0516331376F, 0.0518479225F, 0.0520631358F, 0.0522787775F, 0.0524948475F, 0.0527113455F, 0.0529282715F, 0.0531456252F, 0.0533634066F, 0.0535816154F, 0.0538002515F, 0.0540193148F, 0.0542388051F, 0.0544587222F, 0.0546790660F, 0.0548998364F, 0.0551210331F, 0.0553426561F, 0.0555647051F, 0.0557871801F, 0.0560100807F, 0.0562334070F, 0.0564571587F, 0.0566813357F, 0.0569059378F, 0.0571309649F, 0.0573564168F, 0.0575822933F, 0.0578085942F, 0.0580353195F, 0.0582624689F, 0.0584900423F, 0.0587180396F, 0.0589464605F, 0.0591753049F, 0.0594045726F, 0.0596342635F, 0.0598643774F, 0.0600949141F, 0.0603258735F, 0.0605572555F, 0.0607890597F, 0.0610212862F, 0.0612539346F, 0.0614870049F, 0.0617204968F, 0.0619544103F, 0.0621887451F, 0.0624235010F, 0.0626586780F, 0.0628942758F, 0.0631302942F, 0.0633667331F, 0.0636035923F, 0.0638408717F, 0.0640785710F, 0.0643166901F, 0.0645552288F, 0.0647941870F, 0.0650335645F, 0.0652733610F, 0.0655135765F, 0.0657542108F, 0.0659952636F, 0.0662367348F, 0.0664786242F, 0.0667209316F, 0.0669636570F, 0.0672068000F, 0.0674503605F, 0.0676943384F, 0.0679387334F, 0.0681835454F, 0.0684287742F, 0.0686744196F, 0.0689204814F, 0.0691669595F, 0.0694138536F, 0.0696611637F, 0.0699088894F, 0.0701570307F, 0.0704055873F, 0.0706545590F, 0.0709039458F, 0.0711537473F, 0.0714039634F, 0.0716545939F, 0.0719056387F, 0.0721570975F, 0.0724089702F, 0.0726612565F, 0.0729139563F, 0.0731670694F, 0.0734205956F, 0.0736745347F, 0.0739288866F, 0.0741836510F, 0.0744388277F, 0.0746944166F, 0.0749504175F, 0.0752068301F, 0.0754636543F, 0.0757208899F, 0.0759785367F, 0.0762365946F, 0.0764950632F, 0.0767539424F, 0.0770132320F, 0.0772729319F, 0.0775330418F, 0.0777935616F, 0.0780544909F, 0.0783158298F, 0.0785775778F, 0.0788397349F, 0.0791023009F, 0.0793652755F, 0.0796286585F, 0.0798924498F, 0.0801566492F, 0.0804212564F, 0.0806862712F, 0.0809516935F, 0.0812175231F, 0.0814837597F, 0.0817504031F, 0.0820174532F, 0.0822849097F, 0.0825527724F, 0.0828210412F, 0.0830897158F, 0.0833587960F, 0.0836282816F, 0.0838981724F, 0.0841684682F, 0.0844391688F, 0.0847102740F, 0.0849817835F, 0.0852536973F, 0.0855260150F, 0.0857987364F, 0.0860718614F, 0.0863453897F, 0.0866193211F, 0.0868936554F, 0.0871683924F, 0.0874435319F, 0.0877190737F, 0.0879950175F, 0.0882713632F, 0.0885481105F, 0.0888252592F, 0.0891028091F, 0.0893807600F, 0.0896591117F, 0.0899378639F, 0.0902170165F, 0.0904965692F, 0.0907765218F, 0.0910568740F, 0.0913376258F, 0.0916187767F, 0.0919003268F, 0.0921822756F, 0.0924646230F, 0.0927473687F, 0.0930305126F, 0.0933140545F, 0.0935979940F, 0.0938823310F, 0.0941670653F, 0.0944521966F, 0.0947377247F, 0.0950236494F, 0.0953099704F, 0.0955966876F, 0.0958838007F, 0.0961713094F, 0.0964592136F, 0.0967475131F, 0.0970362075F, 0.0973252967F, 0.0976147805F, 0.0979046585F, 0.0981949307F, 0.0984855967F, 0.0987766563F, 0.0990681093F, 0.0993599555F, 0.0996521945F, 0.0999448263F, 0.1002378506F, 0.1005312671F, 0.1008250755F, 0.1011192757F, 0.1014138675F, 0.1017088505F, 0.1020042246F, 0.1022999895F, 0.1025961450F, 0.1028926909F, 0.1031896268F, 0.1034869526F, 0.1037846680F, 0.1040827729F, 0.1043812668F, 0.1046801497F, 0.1049794213F, 0.1052790813F, 0.1055791294F, 0.1058795656F, 0.1061803894F, 0.1064816006F, 0.1067831991F, 0.1070851846F, 0.1073875568F, 0.1076903155F, 0.1079934604F, 0.1082969913F, 0.1086009079F, 0.1089052101F, 0.1092098975F, 0.1095149699F, 0.1098204270F, 0.1101262687F, 0.1104324946F, 0.1107391045F, 0.1110460982F, 0.1113534754F, 0.1116612359F, 0.1119693793F, 0.1122779055F, 0.1125868142F, 0.1128961052F, 0.1132057781F, 0.1135158328F, 0.1138262690F, 0.1141370863F, 0.1144482847F, 0.1147598638F, 0.1150718233F, 0.1153841631F, 0.1156968828F, 0.1160099822F, 0.1163234610F, 0.1166373190F, 0.1169515559F, 0.1172661714F, 0.1175811654F, 0.1178965374F, 0.1182122874F, 0.1185284149F, 0.1188449198F, 0.1191618018F, 0.1194790606F, 0.1197966960F, 0.1201147076F, 0.1204330953F, 0.1207518587F, 0.1210709976F, 0.1213905118F, 0.1217104009F, 0.1220306647F, 0.1223513029F, 0.1226723153F, 0.1229937016F, 0.1233154615F, 0.1236375948F, 0.1239601011F, 0.1242829803F, 0.1246062319F, 0.1249298559F, 0.1252538518F, 0.1255782195F, 0.1259029586F, 0.1262280689F, 0.1265535501F, 0.1268794019F, 0.1272056241F, 0.1275322163F, 0.1278591784F, 0.1281865099F, 0.1285142108F, 0.1288422805F, 0.1291707190F, 0.1294995259F, 0.1298287009F, 0.1301582437F, 0.1304881542F, 0.1308184319F, 0.1311490766F, 0.1314800881F, 0.1318114660F, 0.1321432100F, 0.1324753200F, 0.1328077955F, 0.1331406364F, 0.1334738422F, 0.1338074129F, 0.1341413479F, 0.1344756472F, 0.1348103103F, 0.1351453370F, 0.1354807270F, 0.1358164801F, 0.1361525959F, 0.1364890741F, 0.1368259145F, 0.1371631167F, 0.1375006805F, 0.1378386056F, 0.1381768917F, 0.1385155384F, 0.1388545456F, 0.1391939129F, 0.1395336400F, 0.1398737266F, 0.1402141724F, 0.1405549772F, 0.1408961406F, 0.1412376623F, 0.1415795421F, 0.1419217797F, 0.1422643746F, 0.1426073268F, 0.1429506358F, 0.1432943013F, 0.1436383231F, 0.1439827008F, 0.1443274342F, 0.1446725229F, 0.1450179667F, 0.1453637652F, 0.1457099181F, 0.1460564252F, 0.1464032861F, 0.1467505006F, 0.1470980682F, 0.1474459888F, 0.1477942620F, 0.1481428875F, 0.1484918651F, 0.1488411942F, 0.1491908748F, 0.1495409065F, 0.1498912889F, 0.1502420218F, 0.1505931048F, 0.1509445376F, 0.1512963200F, 0.1516484516F, 0.1520009321F, 0.1523537612F, 0.1527069385F, 0.1530604638F, 0.1534143368F, 0.1537685571F, 0.1541231244F, 0.1544780384F, 0.1548332987F, 0.1551889052F, 0.1555448574F, 0.1559011550F, 0.1562577978F, 0.1566147853F, 0.1569721173F, 0.1573297935F, 0.1576878135F, 0.1580461771F, 0.1584048838F, 0.1587639334F, 0.1591233255F, 0.1594830599F, 0.1598431361F, 0.1602035540F, 0.1605643131F, 0.1609254131F, 0.1612868537F, 0.1616486346F, 0.1620107555F, 0.1623732160F, 0.1627360158F, 0.1630991545F, 0.1634626319F, 0.1638264476F, 0.1641906013F, 0.1645550926F, 0.1649199212F, 0.1652850869F, 0.1656505892F, 0.1660164278F, 0.1663826024F, 0.1667491127F, 0.1671159583F, 0.1674831388F, 0.1678506541F, 0.1682185036F, 0.1685866872F, 0.1689552044F, 0.1693240549F, 0.1696932384F, 0.1700627545F, 0.1704326029F, 0.1708027833F, 0.1711732952F, 0.1715441385F, 0.1719153127F, 0.1722868175F, 0.1726586526F, 0.1730308176F, 0.1734033121F, 0.1737761359F, 0.1741492886F, 0.1745227698F, 0.1748965792F, 0.1752707164F, 0.1756451812F, 0.1760199731F, 0.1763950918F, 0.1767705370F, 0.1771463083F, 0.1775224054F, 0.1778988279F, 0.1782755754F, 0.1786526477F, 0.1790300444F, 0.1794077651F, 0.1797858094F, 0.1801641771F, 0.1805428677F, 0.1809218810F, 0.1813012165F, 0.1816808739F, 0.1820608528F, 0.1824411530F, 0.1828217739F, 0.1832027154F, 0.1835839770F, 0.1839655584F, 0.1843474592F, 0.1847296790F, 0.1851122175F, 0.1854950744F, 0.1858782492F, 0.1862617417F, 0.1866455514F, 0.1870296780F, 0.1874141211F, 0.1877988804F, 0.1881839555F, 0.1885693461F, 0.1889550517F, 0.1893410721F, 0.1897274068F, 0.1901140555F, 0.1905010178F, 0.1908882933F, 0.1912758818F, 0.1916637828F, 0.1920519959F, 0.1924405208F, 0.1928293571F, 0.1932185044F, 0.1936079625F, 0.1939977308F, 0.1943878091F, 0.1947781969F, 0.1951688939F, 0.1955598998F, 0.1959512141F, 0.1963428364F, 0.1967347665F, 0.1971270038F, 0.1975195482F, 0.1979123990F, 0.1983055561F, 0.1986990190F, 0.1990927873F, 0.1994868607F, 0.1998812388F, 0.2002759212F, 0.2006709075F, 0.2010661974F, 0.2014617904F, 0.2018576862F, 0.2022538844F, 0.2026503847F, 0.2030471865F, 0.2034442897F, 0.2038416937F, 0.2042393982F, 0.2046374028F, 0.2050357071F, 0.2054343107F, 0.2058332133F, 0.2062324145F, 0.2066319138F, 0.2070317110F, 0.2074318055F, 0.2078321970F, 0.2082328852F, 0.2086338696F, 0.2090351498F, 0.2094367255F, 0.2098385962F, 0.2102407617F, 0.2106432213F, 0.2110459749F, 0.2114490220F, 0.2118523621F, 0.2122559950F, 0.2126599202F, 0.2130641373F, 0.2134686459F, 0.2138734456F, 0.2142785361F, 0.2146839168F, 0.2150895875F, 0.2154955478F, 0.2159017972F, 0.2163083353F, 0.2167151617F, 0.2171222761F, 0.2175296780F, 0.2179373670F, 0.2183453428F, 0.2187536049F, 0.2191621529F, 0.2195709864F, 0.2199801051F, 0.2203895085F, 0.2207991961F, 0.2212091677F, 0.2216194228F, 0.2220299610F, 0.2224407818F, 0.2228518850F, 0.2232632699F, 0.2236749364F, 0.2240868839F, 0.2244991121F, 0.2249116204F, 0.2253244086F, 0.2257374763F, 0.2261508229F, 0.2265644481F, 0.2269783514F, 0.2273925326F, 0.2278069911F, 0.2282217265F, 0.2286367384F, 0.2290520265F, 0.2294675902F, 0.2298834292F, 0.2302995431F, 0.2307159314F, 0.2311325937F, 0.2315495297F, 0.2319667388F, 0.2323842207F, 0.2328019749F, 0.2332200011F, 0.2336382988F, 0.2340568675F, 0.2344757070F, 0.2348948166F, 0.2353141961F, 0.2357338450F, 0.2361537629F, 0.2365739493F, 0.2369944038F, 0.2374151261F, 0.2378361156F, 0.2382573720F, 0.2386788948F, 0.2391006836F, 0.2395227380F, 0.2399450575F, 0.2403676417F, 0.2407904902F, 0.2412136026F, 0.2416369783F, 0.2420606171F, 0.2424845185F, 0.2429086820F, 0.2433331072F, 0.2437577936F, 0.2441827409F, 0.2446079486F, 0.2450334163F, 0.2454591435F, 0.2458851298F, 0.2463113747F, 0.2467378779F, 0.2471646389F, 0.2475916573F, 0.2480189325F, 0.2484464643F, 0.2488742521F, 0.2493022955F, 0.2497305940F, 0.2501591473F, 0.2505879549F, 0.2510170163F, 0.2514463311F, 0.2518758989F, 0.2523057193F, 0.2527357916F, 0.2531661157F, 0.2535966909F, 0.2540275169F, 0.2544585931F, 0.2548899193F, 0.2553214948F, 0.2557533193F, 0.2561853924F, 0.2566177135F, 0.2570502822F, 0.2574830981F, 0.2579161608F, 0.2583494697F, 0.2587830245F, 0.2592168246F, 0.2596508697F, 0.2600851593F, 0.2605196929F, 0.2609544701F, 0.2613894904F, 0.2618247534F, 0.2622602586F, 0.2626960055F, 0.2631319938F, 0.2635682230F, 0.2640046925F, 0.2644414021F, 0.2648783511F, 0.2653155391F, 0.2657529657F, 0.2661906305F, 0.2666285329F, 0.2670666725F, 0.2675050489F, 0.2679436616F, 0.2683825101F, 0.2688215940F, 0.2692609127F, 0.2697004660F, 0.2701402532F, 0.2705802739F, 0.2710205278F, 0.2714610142F, 0.2719017327F, 0.2723426830F, 0.2727838644F, 0.2732252766F, 0.2736669191F, 0.2741087914F, 0.2745508930F, 0.2749932235F, 0.2754357824F, 0.2758785693F, 0.2763215837F, 0.2767648251F, 0.2772082930F, 0.2776519870F, 0.2780959066F, 0.2785400513F, 0.2789844207F, 0.2794290143F, 0.2798738316F, 0.2803188722F, 0.2807641355F, 0.2812096211F, 0.2816553286F, 0.2821012574F, 0.2825474071F, 0.2829937773F, 0.2834403673F, 0.2838871768F, 0.2843342053F, 0.2847814523F, 0.2852289174F, 0.2856765999F, 0.2861244996F, 0.2865726159F, 0.2870209482F, 0.2874694962F, 0.2879182594F, 0.2883672372F, 0.2888164293F, 0.2892658350F, 0.2897154540F, 0.2901652858F, 0.2906153298F, 0.2910655856F, 0.2915160527F, 0.2919667306F, 0.2924176189F, 0.2928687171F, 0.2933200246F, 0.2937715409F, 0.2942232657F, 0.2946751984F, 0.2951273386F, 0.2955796856F, 0.2960322391F, 0.2964849986F, 0.2969379636F, 0.2973911335F, 0.2978445080F, 0.2982980864F, 0.2987518684F, 0.2992058534F, 0.2996600409F, 0.3001144305F, 0.3005690217F, 0.3010238139F, 0.3014788067F, 0.3019339995F, 0.3023893920F, 0.3028449835F, 0.3033007736F, 0.3037567618F, 0.3042129477F, 0.3046693306F, 0.3051259102F, 0.3055826859F, 0.3060396572F, 0.3064968236F, 0.3069541847F, 0.3074117399F, 0.3078694887F, 0.3083274307F, 0.3087855653F, 0.3092438920F, 0.3097024104F, 0.3101611199F, 0.3106200200F, 0.3110791103F, 0.3115383902F, 0.3119978592F, 0.3124575169F, 0.3129173627F, 0.3133773961F, 0.3138376166F, 0.3142980238F, 0.3147586170F, 0.3152193959F, 0.3156803598F, 0.3161415084F, 0.3166028410F, 0.3170643573F, 0.3175260566F, 0.3179879384F, 0.3184500023F, 0.3189122478F, 0.3193746743F, 0.3198372814F, 0.3203000685F, 0.3207630351F, 0.3212261807F, 0.3216895048F, 0.3221530069F, 0.3226166865F, 0.3230805430F, 0.3235445760F, 0.3240087849F, 0.3244731693F, 0.3249377285F, 0.3254024622F, 0.3258673698F, 0.3263324507F, 0.3267977045F, 0.3272631306F, 0.3277287286F, 0.3281944978F, 0.3286604379F, 0.3291265482F, 0.3295928284F, 0.3300592777F, 0.3305258958F, 0.3309926821F, 0.3314596361F, 0.3319267573F, 0.3323940451F, 0.3328614990F, 0.3333291186F, 0.3337969033F, 0.3342648525F, 0.3347329658F, 0.3352012427F, 0.3356696825F, 0.3361382849F, 0.3366070492F, 0.3370759749F, 0.3375450616F, 0.3380143087F, 0.3384837156F, 0.3389532819F, 0.3394230071F, 0.3398928905F, 0.3403629317F, 0.3408331302F, 0.3413034854F, 0.3417739967F, 0.3422446638F, 0.3427154860F, 0.3431864628F, 0.3436575938F, 0.3441288782F, 0.3446003158F, 0.3450719058F, 0.3455436478F, 0.3460155412F, 0.3464875856F, 0.3469597804F, 0.3474321250F, 0.3479046189F, 0.3483772617F, 0.3488500527F, 0.3493229914F, 0.3497960774F, 0.3502693100F, 0.3507426887F, 0.3512162131F, 0.3516898825F, 0.3521636965F, 0.3526376545F, 0.3531117559F, 0.3535860003F, 0.3540603870F, 0.3545349157F, 0.3550095856F, 0.3554843964F, 0.3559593474F, 0.3564344381F, 0.3569096680F, 0.3573850366F, 0.3578605432F, 0.3583361875F, 0.3588119687F, 0.3592878865F, 0.3597639402F, 0.3602401293F, 0.3607164533F, 0.3611929117F, 0.3616695038F, 0.3621462292F, 0.3626230873F, 0.3631000776F, 0.3635771995F, 0.3640544525F, 0.3645318360F, 0.3650093496F, 0.3654869926F, 0.3659647645F, 0.3664426648F, 0.3669206930F, 0.3673988484F, 0.3678771306F, 0.3683555390F, 0.3688340731F, 0.3693127322F, 0.3697915160F, 0.3702704237F, 0.3707494549F, 0.3712286091F, 0.3717078857F, 0.3721872840F, 0.3726668037F, 0.3731464441F, 0.3736262047F, 0.3741060850F, 0.3745860843F, 0.3750662023F, 0.3755464382F, 0.3760267915F, 0.3765072618F, 0.3769878484F, 0.3774685509F, 0.3779493686F, 0.3784303010F, 0.3789113475F, 0.3793925076F, 0.3798737809F, 0.3803551666F, 0.3808366642F, 0.3813182733F, 0.3817999932F, 0.3822818234F, 0.3827637633F, 0.3832458124F, 0.3837279702F, 0.3842102360F, 0.3846926093F, 0.3851750897F, 0.3856576764F, 0.3861403690F, 0.3866231670F, 0.3871060696F, 0.3875890765F, 0.3880721870F, 0.3885554007F, 0.3890387168F, 0.3895221349F, 0.3900056544F, 0.3904892748F, 0.3909729955F, 0.3914568160F, 0.3919407356F, 0.3924247539F, 0.3929088702F, 0.3933930841F, 0.3938773949F, 0.3943618021F, 0.3948463052F, 0.3953309035F, 0.3958155966F, 0.3963003838F, 0.3967852646F, 0.3972702385F, 0.3977553048F, 0.3982404631F, 0.3987257127F, 0.3992110531F, 0.3996964838F, 0.4001820041F, 0.4006676136F, 0.4011533116F, 0.4016390976F, 0.4021249710F, 0.4026109313F, 0.4030969779F, 0.4035831102F, 0.4040693277F, 0.4045556299F, 0.4050420160F, 0.4055284857F, 0.4060150383F, 0.4065016732F, 0.4069883899F, 0.4074751879F, 0.4079620665F, 0.4084490252F, 0.4089360635F, 0.4094231807F, 0.4099103763F, 0.4103976498F, 0.4108850005F, 0.4113724280F, 0.4118599315F, 0.4123475107F, 0.4128351648F, 0.4133228934F, 0.4138106959F, 0.4142985716F, 0.4147865201F, 0.4152745408F, 0.4157626330F, 0.4162507963F, 0.4167390301F, 0.4172273337F, 0.4177157067F, 0.4182041484F, 0.4186926583F, 0.4191812359F, 0.4196698805F, 0.4201585915F, 0.4206473685F, 0.4211362108F, 0.4216251179F, 0.4221140892F, 0.4226031241F, 0.4230922221F, 0.4235813826F, 0.4240706050F, 0.4245598887F, 0.4250492332F, 0.4255386379F, 0.4260281022F, 0.4265176256F, 0.4270072075F, 0.4274968473F, 0.4279865445F, 0.4284762984F, 0.4289661086F, 0.4294559743F, 0.4299458951F, 0.4304358704F, 0.4309258996F, 0.4314159822F, 0.4319061175F, 0.4323963050F, 0.4328865441F, 0.4333768342F, 0.4338671749F, 0.4343575654F, 0.4348480052F, 0.4353384938F, 0.4358290306F, 0.4363196149F, 0.4368102463F, 0.4373009241F, 0.4377916478F, 0.4382824168F, 0.4387732305F, 0.4392640884F, 0.4397549899F, 0.4402459343F, 0.4407369212F, 0.4412279499F, 0.4417190198F, 0.4422101305F, 0.4427012813F, 0.4431924717F, 0.4436837010F, 0.4441749686F, 0.4446662742F, 0.4451576169F, 0.4456489963F, 0.4461404118F, 0.4466318628F, 0.4471233487F, 0.4476148690F, 0.4481064230F, 0.4485980103F, 0.4490896302F, 0.4495812821F, 0.4500729654F, 0.4505646797F, 0.4510564243F, 0.4515481986F, 0.4520400021F, 0.4525318341F, 0.4530236942F, 0.4535155816F, 0.4540074959F, 0.4544994365F, 0.4549914028F, 0.4554833941F, 0.4559754100F, 0.4564674499F, 0.4569595131F, 0.4574515991F, 0.4579437074F, 0.4584358372F, 0.4589279881F, 0.4594201595F, 0.4599123508F, 0.4604045615F, 0.4608967908F, 0.4613890383F, 0.4618813034F, 0.4623735855F, 0.4628658841F, 0.4633581984F, 0.4638505281F, 0.4643428724F, 0.4648352308F, 0.4653276028F, 0.4658199877F, 0.4663123849F, 0.4668047940F, 0.4672972143F, 0.4677896451F, 0.4682820861F, 0.4687745365F, 0.4692669958F, 0.4697594634F, 0.4702519387F, 0.4707444211F, 0.4712369102F, 0.4717294052F, 0.4722219056F, 0.4727144109F, 0.4732069204F, 0.4736994336F, 0.4741919498F, 0.4746844686F, 0.4751769893F, 0.4756695113F, 0.4761620341F, 0.4766545571F, 0.4771470797F, 0.4776396013F, 0.4781321213F, 0.4786246392F, 0.4791171544F, 0.4796096663F, 0.4801021744F, 0.4805946779F, 0.4810871765F, 0.4815796694F, 0.4820721561F, 0.4825646360F, 0.4830571086F, 0.4835495732F, 0.4840420293F, 0.4845344763F, 0.4850269136F, 0.4855193407F, 0.4860117569F, 0.4865041617F, 0.4869965545F, 0.4874889347F, 0.4879813018F, 0.4884736551F, 0.4889659941F, 0.4894583182F, 0.4899506268F, 0.4904429193F, 0.4909351952F, 0.4914274538F, 0.4919196947F, 0.4924119172F, 0.4929041207F, 0.4933963046F, 0.4938884685F, 0.4943806116F, 0.4948727335F, 0.4953648335F, 0.4958569110F, 0.4963489656F, 0.4968409965F, 0.4973330032F, 0.4978249852F, 0.4983169419F, 0.4988088726F, 0.4993007768F, 0.4997926539F, 0.5002845034F, 0.5007763247F, 0.5012681171F, 0.5017598801F, 0.5022516132F, 0.5027433157F, 0.5032349871F, 0.5037266268F, 0.5042182341F, 0.5047098086F, 0.5052013497F, 0.5056928567F, 0.5061843292F, 0.5066757664F, 0.5071671679F, 0.5076585330F, 0.5081498613F, 0.5086411520F, 0.5091324047F, 0.5096236187F, 0.5101147934F, 0.5106059284F, 0.5110970230F, 0.5115880766F, 0.5120790887F, 0.5125700587F, 0.5130609860F, 0.5135518700F, 0.5140427102F, 0.5145335059F, 0.5150242566F, 0.5155149618F, 0.5160056208F, 0.5164962331F, 0.5169867980F, 0.5174773151F, 0.5179677837F, 0.5184582033F, 0.5189485733F, 0.5194388931F, 0.5199291621F, 0.5204193798F, 0.5209095455F, 0.5213996588F, 0.5218897190F, 0.5223797256F, 0.5228696779F, 0.5233595755F, 0.5238494177F, 0.5243392039F, 0.5248289337F, 0.5253186063F, 0.5258082213F, 0.5262977781F, 0.5267872760F, 0.5272767146F, 0.5277660932F, 0.5282554112F, 0.5287446682F, 0.5292338635F, 0.5297229965F, 0.5302120667F, 0.5307010736F, 0.5311900164F, 0.5316788947F, 0.5321677079F, 0.5326564554F, 0.5331451366F, 0.5336337511F, 0.5341222981F, 0.5346107771F, 0.5350991876F, 0.5355875290F, 0.5360758007F, 0.5365640021F, 0.5370521327F, 0.5375401920F, 0.5380281792F, 0.5385160939F, 0.5390039355F, 0.5394917034F, 0.5399793971F, 0.5404670159F, 0.5409545594F, 0.5414420269F, 0.5419294179F, 0.5424167318F, 0.5429039680F, 0.5433911261F, 0.5438782053F, 0.5443652051F, 0.5448521250F, 0.5453389644F, 0.5458257228F, 0.5463123995F, 0.5467989940F, 0.5472855057F, 0.5477719341F, 0.5482582786F, 0.5487445387F, 0.5492307137F, 0.5497168031F, 0.5502028063F, 0.5506887228F, 0.5511745520F, 0.5516602934F, 0.5521459463F, 0.5526315103F, 0.5531169847F, 0.5536023690F, 0.5540876626F, 0.5545728649F, 0.5550579755F, 0.5555429937F, 0.5560279189F, 0.5565127507F, 0.5569974884F, 0.5574821315F, 0.5579666794F, 0.5584511316F, 0.5589354875F, 0.5594197465F, 0.5599039080F, 0.5603879716F, 0.5608719367F, 0.5613558026F, 0.5618395689F, 0.5623232350F, 0.5628068002F, 0.5632902642F, 0.5637736262F, 0.5642568858F, 0.5647400423F, 0.5652230953F, 0.5657060442F, 0.5661888883F, 0.5666716272F, 0.5671542603F, 0.5676367870F, 0.5681192069F, 0.5686015192F, 0.5690837235F, 0.5695658192F, 0.5700478058F, 0.5705296827F, 0.5710114494F, 0.5714931052F, 0.5719746497F, 0.5724560822F, 0.5729374023F, 0.5734186094F, 0.5738997029F, 0.5743806823F, 0.5748615470F, 0.5753422965F, 0.5758229301F, 0.5763034475F, 0.5767838480F, 0.5772641310F, 0.5777442960F, 0.5782243426F, 0.5787042700F, 0.5791840778F, 0.5796637654F, 0.5801433322F, 0.5806227778F, 0.5811021016F, 0.5815813029F, 0.5820603814F, 0.5825393363F, 0.5830181673F, 0.5834968737F, 0.5839754549F, 0.5844539105F, 0.5849322399F, 0.5854104425F, 0.5858885179F, 0.5863664653F, 0.5868442844F, 0.5873219746F, 0.5877995353F, 0.5882769660F, 0.5887542661F, 0.5892314351F, 0.5897084724F, 0.5901853776F, 0.5906621500F, 0.5911387892F, 0.5916152945F, 0.5920916655F, 0.5925679016F, 0.5930440022F, 0.5935199669F, 0.5939957950F, 0.5944714861F, 0.5949470396F, 0.5954224550F, 0.5958977317F, 0.5963728692F, 0.5968478669F, 0.5973227244F, 0.5977974411F, 0.5982720163F, 0.5987464497F, 0.5992207407F, 0.5996948887F, 0.6001688932F, 0.6006427537F, 0.6011164696F, 0.6015900405F, 0.6020634657F, 0.6025367447F, 0.6030098770F, 0.6034828621F, 0.6039556995F, 0.6044283885F, 0.6049009288F, 0.6053733196F, 0.6058455606F, 0.6063176512F, 0.6067895909F, 0.6072613790F, 0.6077330152F, 0.6082044989F, 0.6086758295F, 0.6091470065F, 0.6096180294F, 0.6100888977F, 0.6105596108F, 0.6110301682F, 0.6115005694F, 0.6119708139F, 0.6124409011F, 0.6129108305F, 0.6133806017F, 0.6138502139F, 0.6143196669F, 0.6147889599F, 0.6152580926F, 0.6157270643F, 0.6161958746F, 0.6166645230F, 0.6171330088F, 0.6176013317F, 0.6180694910F, 0.6185374863F, 0.6190053171F, 0.6194729827F, 0.6199404828F, 0.6204078167F, 0.6208749841F, 0.6213419842F, 0.6218088168F, 0.6222754811F, 0.6227419768F, 0.6232083032F, 0.6236744600F, 0.6241404465F, 0.6246062622F, 0.6250719067F, 0.6255373795F, 0.6260026799F, 0.6264678076F, 0.6269327619F, 0.6273975425F, 0.6278621487F, 0.6283265800F, 0.6287908361F, 0.6292549163F, 0.6297188201F, 0.6301825471F, 0.6306460966F, 0.6311094683F, 0.6315726617F, 0.6320356761F, 0.6324985111F, 0.6329611662F, 0.6334236410F, 0.6338859348F, 0.6343480472F, 0.6348099777F, 0.6352717257F, 0.6357332909F, 0.6361946726F, 0.6366558704F, 0.6371168837F, 0.6375777122F, 0.6380383552F, 0.6384988123F, 0.6389590830F, 0.6394191668F, 0.6398790631F, 0.6403387716F, 0.6407982916F, 0.6412576228F, 0.6417167645F, 0.6421757163F, 0.6426344778F, 0.6430930483F, 0.6435514275F, 0.6440096149F, 0.6444676098F, 0.6449254119F, 0.6453830207F, 0.6458404356F, 0.6462976562F, 0.6467546820F, 0.6472115125F, 0.6476681472F, 0.6481245856F, 0.6485808273F, 0.6490368717F, 0.6494927183F, 0.6499483667F, 0.6504038164F, 0.6508590670F, 0.6513141178F, 0.6517689684F, 0.6522236185F, 0.6526780673F, 0.6531323146F, 0.6535863598F, 0.6540402024F, 0.6544938419F, 0.6549472779F, 0.6554005099F, 0.6558535373F, 0.6563063598F, 0.6567589769F, 0.6572113880F, 0.6576635927F, 0.6581155906F, 0.6585673810F, 0.6590189637F, 0.6594703380F, 0.6599215035F, 0.6603724598F, 0.6608232064F, 0.6612737427F, 0.6617240684F, 0.6621741829F, 0.6626240859F, 0.6630737767F, 0.6635232550F, 0.6639725202F, 0.6644215720F, 0.6648704098F, 0.6653190332F, 0.6657674417F, 0.6662156348F, 0.6666636121F, 0.6671113731F, 0.6675589174F, 0.6680062445F, 0.6684533538F, 0.6689002450F, 0.6693469177F, 0.6697933712F, 0.6702396052F, 0.6706856193F, 0.6711314129F, 0.6715769855F, 0.6720223369F, 0.6724674664F, 0.6729123736F, 0.6733570581F, 0.6738015194F, 0.6742457570F, 0.6746897706F, 0.6751335596F, 0.6755771236F, 0.6760204621F, 0.6764635747F, 0.6769064609F, 0.6773491204F, 0.6777915525F, 0.6782337570F, 0.6786757332F, 0.6791174809F, 0.6795589995F, 0.6800002886F, 0.6804413477F, 0.6808821765F, 0.6813227743F, 0.6817631409F, 0.6822032758F, 0.6826431785F, 0.6830828485F, 0.6835222855F, 0.6839614890F, 0.6844004585F, 0.6848391936F, 0.6852776939F, 0.6857159589F, 0.6861539883F, 0.6865917815F, 0.6870293381F, 0.6874666576F, 0.6879037398F, 0.6883405840F, 0.6887771899F, 0.6892135571F, 0.6896496850F, 0.6900855733F, 0.6905212216F, 0.6909566294F, 0.6913917963F, 0.6918267218F, 0.6922614055F, 0.6926958471F, 0.6931300459F, 0.6935640018F, 0.6939977141F, 0.6944311825F, 0.6948644066F, 0.6952973859F, 0.6957301200F, 0.6961626085F, 0.6965948510F, 0.6970268470F, 0.6974585961F, 0.6978900980F, 0.6983213521F, 0.6987523580F, 0.6991831154F, 0.6996136238F, 0.7000438828F, 0.7004738921F, 0.7009036510F, 0.7013331594F, 0.7017624166F, 0.7021914224F, 0.7026201763F, 0.7030486779F, 0.7034769268F, 0.7039049226F, 0.7043326648F, 0.7047601531F, 0.7051873870F, 0.7056143662F, 0.7060410902F, 0.7064675586F, 0.7068937711F, 0.7073197271F, 0.7077454264F, 0.7081708684F, 0.7085960529F, 0.7090209793F, 0.7094456474F, 0.7098700566F, 0.7102942066F, 0.7107180970F, 0.7111417274F, 0.7115650974F, 0.7119882066F, 0.7124110545F, 0.7128336409F, 0.7132559653F, 0.7136780272F, 0.7140998264F, 0.7145213624F, 0.7149426348F, 0.7153636433F, 0.7157843874F, 0.7162048668F, 0.7166250810F, 0.7170450296F, 0.7174647124F, 0.7178841289F, 0.7183032786F, 0.7187221613F, 0.7191407765F, 0.7195591239F, 0.7199772030F, 0.7203950135F, 0.7208125550F, 0.7212298271F, 0.7216468294F, 0.7220635616F, 0.7224800233F, 0.7228962140F, 0.7233121335F, 0.7237277813F, 0.7241431571F, 0.7245582604F, 0.7249730910F, 0.7253876484F, 0.7258019322F, 0.7262159422F, 0.7266296778F, 0.7270431388F, 0.7274563247F, 0.7278692353F, 0.7282818700F, 0.7286942287F, 0.7291063108F, 0.7295181160F, 0.7299296440F, 0.7303408944F, 0.7307518669F, 0.7311625609F, 0.7315729763F, 0.7319831126F, 0.7323929695F, 0.7328025466F, 0.7332118435F, 0.7336208600F, 0.7340295955F, 0.7344380499F, 0.7348462226F, 0.7352541134F, 0.7356617220F, 0.7360690478F, 0.7364760907F, 0.7368828502F, 0.7372893259F, 0.7376955176F, 0.7381014249F, 0.7385070475F, 0.7389123849F, 0.7393174368F, 0.7397222029F, 0.7401266829F, 0.7405308763F, 0.7409347829F, 0.7413384023F, 0.7417417341F, 0.7421447780F, 0.7425475338F, 0.7429500009F, 0.7433521791F, 0.7437540681F, 0.7441556674F, 0.7445569769F, 0.7449579960F, 0.7453587245F, 0.7457591621F, 0.7461593084F, 0.7465591631F, 0.7469587259F, 0.7473579963F, 0.7477569741F, 0.7481556590F, 0.7485540506F, 0.7489521486F, 0.7493499526F, 0.7497474623F, 0.7501446775F, 0.7505415977F, 0.7509382227F, 0.7513345521F, 0.7517305856F, 0.7521263229F, 0.7525217636F, 0.7529169074F, 0.7533117541F, 0.7537063032F, 0.7541005545F, 0.7544945076F, 0.7548881623F, 0.7552815182F, 0.7556745749F, 0.7560673323F, 0.7564597899F, 0.7568519474F, 0.7572438046F, 0.7576353611F, 0.7580266166F, 0.7584175708F, 0.7588082235F, 0.7591985741F, 0.7595886226F, 0.7599783685F, 0.7603678116F, 0.7607569515F, 0.7611457879F, 0.7615343206F, 0.7619225493F, 0.7623104735F, 0.7626980931F, 0.7630854078F, 0.7634724171F, 0.7638591209F, 0.7642455188F, 0.7646316106F, 0.7650173959F, 0.7654028744F, 0.7657880459F, 0.7661729100F, 0.7665574664F, 0.7669417150F, 0.7673256553F, 0.7677092871F, 0.7680926100F, 0.7684756239F, 0.7688583284F, 0.7692407232F, 0.7696228080F, 0.7700045826F, 0.7703860467F, 0.7707671999F, 0.7711480420F, 0.7715285728F, 0.7719087918F, 0.7722886989F, 0.7726682938F, 0.7730475762F, 0.7734265458F, 0.7738052023F, 0.7741835454F, 0.7745615750F, 0.7749392906F, 0.7753166921F, 0.7756937791F, 0.7760705514F, 0.7764470087F, 0.7768231508F, 0.7771989773F, 0.7775744880F, 0.7779496827F, 0.7783245610F, 0.7786991227F, 0.7790733676F, 0.7794472953F, 0.7798209056F, 0.7801941982F, 0.7805671729F, 0.7809398294F, 0.7813121675F, 0.7816841869F, 0.7820558873F, 0.7824272684F, 0.7827983301F, 0.7831690720F, 0.7835394940F, 0.7839095957F, 0.7842793768F, 0.7846488373F, 0.7850179767F, 0.7853867948F, 0.7857552914F, 0.7861234663F, 0.7864913191F, 0.7868588497F, 0.7872260578F, 0.7875929431F, 0.7879595055F, 0.7883257445F, 0.7886916601F, 0.7890572520F, 0.7894225198F, 0.7897874635F, 0.7901520827F, 0.7905163772F, 0.7908803468F, 0.7912439912F, 0.7916073102F, 0.7919703035F, 0.7923329710F, 0.7926953124F, 0.7930573274F, 0.7934190158F, 0.7937803774F, 0.7941414120F, 0.7945021193F, 0.7948624991F, 0.7952225511F, 0.7955822752F, 0.7959416711F, 0.7963007387F, 0.7966594775F, 0.7970178875F, 0.7973759685F, 0.7977337201F, 0.7980911422F, 0.7984482346F, 0.7988049970F, 0.7991614292F, 0.7995175310F, 0.7998733022F, 0.8002287426F, 0.8005838519F, 0.8009386299F, 0.8012930765F, 0.8016471914F, 0.8020009744F, 0.8023544253F, 0.8027075438F, 0.8030603298F, 0.8034127831F, 0.8037649035F, 0.8041166906F, 0.8044681445F, 0.8048192647F, 0.8051700512F, 0.8055205038F, 0.8058706222F, 0.8062204062F, 0.8065698556F, 0.8069189702F, 0.8072677499F, 0.8076161944F, 0.8079643036F, 0.8083120772F, 0.8086595151F, 0.8090066170F, 0.8093533827F, 0.8096998122F, 0.8100459051F, 0.8103916613F, 0.8107370806F, 0.8110821628F, 0.8114269077F, 0.8117713151F, 0.8121153849F, 0.8124591169F, 0.8128025108F, 0.8131455666F, 0.8134882839F, 0.8138306627F, 0.8141727027F, 0.8145144038F, 0.8148557658F, 0.8151967886F, 0.8155374718F, 0.8158778154F, 0.8162178192F, 0.8165574830F, 0.8168968067F, 0.8172357900F, 0.8175744328F, 0.8179127349F, 0.8182506962F, 0.8185883164F, 0.8189255955F, 0.8192625332F, 0.8195991295F, 0.8199353840F, 0.8202712967F, 0.8206068673F, 0.8209420958F, 0.8212769820F, 0.8216115256F, 0.8219457266F, 0.8222795848F, 0.8226131000F, 0.8229462721F, 0.8232791009F, 0.8236115863F, 0.8239437280F, 0.8242755260F, 0.8246069801F, 0.8249380901F, 0.8252688559F, 0.8255992774F, 0.8259293544F, 0.8262590867F, 0.8265884741F, 0.8269175167F, 0.8272462141F, 0.8275745663F, 0.8279025732F, 0.8282302344F, 0.8285575501F, 0.8288845199F, 0.8292111437F, 0.8295374215F, 0.8298633530F, 0.8301889382F, 0.8305141768F, 0.8308390688F, 0.8311636141F, 0.8314878124F, 0.8318116637F, 0.8321351678F, 0.8324583246F, 0.8327811340F, 0.8331035957F, 0.8334257098F, 0.8337474761F, 0.8340688944F, 0.8343899647F, 0.8347106867F, 0.8350310605F, 0.8353510857F, 0.8356707624F, 0.8359900904F, 0.8363090696F, 0.8366276999F, 0.8369459811F, 0.8372639131F, 0.8375814958F, 0.8378987292F, 0.8382156130F, 0.8385321472F, 0.8388483316F, 0.8391641662F, 0.8394796508F, 0.8397947853F, 0.8401095697F, 0.8404240037F, 0.8407380873F, 0.8410518204F, 0.8413652029F, 0.8416782347F, 0.8419909156F, 0.8423032456F, 0.8426152245F, 0.8429268523F, 0.8432381289F, 0.8435490541F, 0.8438596279F, 0.8441698502F, 0.8444797208F, 0.8447892396F, 0.8450984067F, 0.8454072218F, 0.8457156849F, 0.8460237959F, 0.8463315547F, 0.8466389612F, 0.8469460154F, 0.8472527170F, 0.8475590661F, 0.8478650625F, 0.8481707063F, 0.8484759971F, 0.8487809351F, 0.8490855201F, 0.8493897521F, 0.8496936308F, 0.8499971564F, 0.8503003286F, 0.8506031474F, 0.8509056128F, 0.8512077246F, 0.8515094828F, 0.8518108872F, 0.8521119379F, 0.8524126348F, 0.8527129777F, 0.8530129666F, 0.8533126015F, 0.8536118822F, 0.8539108087F, 0.8542093809F, 0.8545075988F, 0.8548054623F, 0.8551029712F, 0.8554001257F, 0.8556969255F, 0.8559933707F, 0.8562894611F, 0.8565851968F, 0.8568805775F, 0.8571756034F, 0.8574702743F, 0.8577645902F, 0.8580585509F, 0.8583521566F, 0.8586454070F, 0.8589383021F, 0.8592308420F, 0.8595230265F, 0.8598148556F, 0.8601063292F, 0.8603974473F, 0.8606882098F, 0.8609786167F, 0.8612686680F, 0.8615583636F, 0.8618477034F, 0.8621366874F, 0.8624253156F, 0.8627135878F, 0.8630015042F, 0.8632890646F, 0.8635762690F, 0.8638631173F, 0.8641496096F, 0.8644357457F, 0.8647215257F, 0.8650069495F, 0.8652920171F, 0.8655767283F, 0.8658610833F, 0.8661450820F, 0.8664287243F, 0.8667120102F, 0.8669949397F, 0.8672775127F, 0.8675597293F, 0.8678415894F, 0.8681230929F, 0.8684042398F, 0.8686850302F, 0.8689654640F, 0.8692455412F, 0.8695252617F, 0.8698046255F, 0.8700836327F, 0.8703622831F, 0.8706405768F, 0.8709185138F, 0.8711960940F, 0.8714733174F, 0.8717501840F, 0.8720266939F, 0.8723028469F, 0.8725786430F, 0.8728540824F, 0.8731291648F, 0.8734038905F, 0.8736782592F, 0.8739522711F, 0.8742259261F, 0.8744992242F, 0.8747721653F, 0.8750447496F, 0.8753169770F, 0.8755888475F, 0.8758603611F, 0.8761315177F, 0.8764023175F, 0.8766727603F, 0.8769428462F, 0.8772125752F, 0.8774819474F, 0.8777509626F, 0.8780196209F, 0.8782879224F, 0.8785558669F, 0.8788234546F, 0.8790906854F, 0.8793575594F, 0.8796240765F, 0.8798902368F, 0.8801560403F, 0.8804214870F, 0.8806865768F, 0.8809513099F, 0.8812156863F, 0.8814797059F, 0.8817433687F, 0.8820066749F, 0.8822696243F, 0.8825322171F, 0.8827944532F, 0.8830563327F, 0.8833178556F, 0.8835790219F, 0.8838398316F, 0.8841002848F, 0.8843603815F, 0.8846201217F, 0.8848795054F, 0.8851385327F, 0.8853972036F, 0.8856555182F, 0.8859134764F, 0.8861710783F, 0.8864283239F, 0.8866852133F, 0.8869417464F, 0.8871979234F, 0.8874537443F, 0.8877092090F, 0.8879643177F, 0.8882190704F, 0.8884734671F, 0.8887275078F, 0.8889811927F, 0.8892345216F, 0.8894874948F, 0.8897401122F, 0.8899923738F, 0.8902442798F, 0.8904958301F, 0.8907470248F, 0.8909978640F, 0.8912483477F, 0.8914984759F, 0.8917482487F, 0.8919976662F, 0.8922467284F, 0.8924954353F, 0.8927437871F, 0.8929917837F, 0.8932394252F, 0.8934867118F, 0.8937336433F, 0.8939802199F, 0.8942264417F, 0.8944723087F, 0.8947178210F, 0.8949629785F, 0.8952077815F, 0.8954522299F, 0.8956963239F, 0.8959400634F, 0.8961834486F, 0.8964264795F, 0.8966691561F, 0.8969114786F, 0.8971534470F, 0.8973950614F, 0.8976363219F, 0.8978772284F, 0.8981177812F, 0.8983579802F, 0.8985978256F, 0.8988373174F, 0.8990764556F, 0.8993152405F, 0.8995536720F, 0.8997917502F, 0.9000294751F, 0.9002668470F, 0.9005038658F, 0.9007405317F, 0.9009768446F, 0.9012128048F, 0.9014484123F, 0.9016836671F, 0.9019185693F, 0.9021531191F, 0.9023873165F, 0.9026211616F, 0.9028546546F, 0.9030877954F, 0.9033205841F, 0.9035530210F, 0.9037851059F, 0.9040168392F, 0.9042482207F, 0.9044792507F, 0.9047099293F, 0.9049402564F, 0.9051702323F, 0.9053998569F, 0.9056291305F, 0.9058580531F, 0.9060866248F, 0.9063148457F, 0.9065427159F, 0.9067702355F, 0.9069974046F, 0.9072242233F, 0.9074506917F, 0.9076768100F, 0.9079025782F, 0.9081279964F, 0.9083530647F, 0.9085777833F, 0.9088021523F, 0.9090261717F, 0.9092498417F, 0.9094731623F, 0.9096961338F, 0.9099187561F, 0.9101410295F, 0.9103629540F, 0.9105845297F, 0.9108057568F, 0.9110266354F, 0.9112471656F, 0.9114673475F, 0.9116871812F, 0.9119066668F, 0.9121258046F, 0.9123445945F, 0.9125630367F, 0.9127811314F, 0.9129988786F, 0.9132162785F, 0.9134333312F, 0.9136500368F, 0.9138663954F, 0.9140824073F, 0.9142980724F, 0.9145133910F, 0.9147283632F, 0.9149429890F, 0.9151572687F, 0.9153712023F, 0.9155847900F, 0.9157980319F, 0.9160109282F, 0.9162234790F, 0.9164356844F, 0.9166475445F, 0.9168590595F, 0.9170702296F, 0.9172810548F, 0.9174915354F, 0.9177016714F, 0.9179114629F, 0.9181209102F, 0.9183300134F, 0.9185387726F, 0.9187471879F, 0.9189552595F, 0.9191629876F, 0.9193703723F, 0.9195774136F, 0.9197841119F, 0.9199904672F, 0.9201964797F, 0.9204021495F, 0.9206074767F, 0.9208124616F, 0.9210171043F, 0.9212214049F, 0.9214253636F, 0.9216289805F, 0.9218322558F, 0.9220351896F, 0.9222377821F, 0.9224400335F, 0.9226419439F, 0.9228435134F, 0.9230447423F, 0.9232456307F, 0.9234461787F, 0.9236463865F, 0.9238462543F, 0.9240457822F, 0.9242449704F, 0.9244438190F, 0.9246423282F, 0.9248404983F, 0.9250383293F, 0.9252358214F, 0.9254329747F, 0.9256297896F, 0.9258262660F, 0.9260224042F, 0.9262182044F, 0.9264136667F, 0.9266087913F, 0.9268035783F, 0.9269980280F, 0.9271921405F, 0.9273859160F, 0.9275793546F, 0.9277724566F, 0.9279652221F, 0.9281576513F, 0.9283497443F, 0.9285415014F, 0.9287329227F, 0.9289240084F, 0.9291147586F, 0.9293051737F, 0.9294952536F, 0.9296849987F, 0.9298744091F, 0.9300634850F, 0.9302522266F, 0.9304406340F, 0.9306287074F, 0.9308164471F, 0.9310038532F, 0.9311909259F, 0.9313776654F, 0.9315640719F, 0.9317501455F, 0.9319358865F, 0.9321212951F, 0.9323063713F, 0.9324911155F, 0.9326755279F, 0.9328596085F, 0.9330433577F, 0.9332267756F, 0.9334098623F, 0.9335926182F, 0.9337750434F, 0.9339571380F, 0.9341389023F, 0.9343203366F, 0.9345014409F, 0.9346822155F, 0.9348626606F, 0.9350427763F, 0.9352225630F, 0.9354020207F, 0.9355811498F, 0.9357599503F, 0.9359384226F, 0.9361165667F, 0.9362943830F, 0.9364718716F, 0.9366490327F, 0.9368258666F, 0.9370023733F, 0.9371785533F, 0.9373544066F, 0.9375299335F, 0.9377051341F, 0.9378800087F, 0.9380545576F, 0.9382287809F, 0.9384026787F, 0.9385762515F, 0.9387494993F, 0.9389224223F, 0.9390950209F, 0.9392672951F, 0.9394392453F, 0.9396108716F, 0.9397821743F, 0.9399531536F, 0.9401238096F, 0.9402941427F, 0.9404641530F, 0.9406338407F, 0.9408032061F, 0.9409722495F, 0.9411409709F, 0.9413093707F, 0.9414774491F, 0.9416452062F, 0.9418126424F, 0.9419797579F, 0.9421465528F, 0.9423130274F, 0.9424791819F, 0.9426450166F, 0.9428105317F, 0.9429757274F, 0.9431406039F, 0.9433051616F, 0.9434694005F, 0.9436333209F, 0.9437969232F, 0.9439602074F, 0.9441231739F, 0.9442858229F, 0.9444481545F, 0.9446101691F, 0.9447718669F, 0.9449332481F, 0.9450943129F, 0.9452550617F, 0.9454154945F, 0.9455756118F, 0.9457354136F, 0.9458949003F, 0.9460540721F, 0.9462129292F, 0.9463714719F, 0.9465297003F, 0.9466876149F, 0.9468452157F, 0.9470025031F, 0.9471594772F, 0.9473161384F, 0.9474724869F, 0.9476285229F, 0.9477842466F, 0.9479396584F, 0.9480947585F, 0.9482495470F, 0.9484040243F, 0.9485581906F, 0.9487120462F, 0.9488655913F, 0.9490188262F, 0.9491717511F, 0.9493243662F, 0.9494766718F, 0.9496286683F, 0.9497803557F, 0.9499317345F, 0.9500828047F, 0.9502335668F, 0.9503840209F, 0.9505341673F, 0.9506840062F, 0.9508335380F, 0.9509827629F, 0.9511316810F, 0.9512802928F, 0.9514285984F, 0.9515765982F, 0.9517242923F, 0.9518716810F, 0.9520187646F, 0.9521655434F, 0.9523120176F, 0.9524581875F, 0.9526040534F, 0.9527496154F, 0.9528948739F, 0.9530398292F, 0.9531844814F, 0.9533288310F, 0.9534728780F, 0.9536166229F, 0.9537600659F, 0.9539032071F, 0.9540460470F, 0.9541885858F, 0.9543308237F, 0.9544727611F, 0.9546143981F, 0.9547557351F, 0.9548967723F, 0.9550375100F, 0.9551779485F, 0.9553180881F, 0.9554579290F, 0.9555974714F, 0.9557367158F, 0.9558756623F, 0.9560143112F, 0.9561526628F, 0.9562907174F, 0.9564284752F, 0.9565659366F, 0.9567031017F, 0.9568399710F, 0.9569765446F, 0.9571128229F, 0.9572488061F, 0.9573844944F, 0.9575198883F, 0.9576549879F, 0.9577897936F, 0.9579243056F, 0.9580585242F, 0.9581924497F, 0.9583260824F, 0.9584594226F, 0.9585924705F, 0.9587252264F, 0.9588576906F, 0.9589898634F, 0.9591217452F, 0.9592533360F, 0.9593846364F, 0.9595156465F, 0.9596463666F, 0.9597767971F, 0.9599069382F, 0.9600367901F, 0.9601663533F, 0.9602956279F, 0.9604246143F, 0.9605533128F, 0.9606817236F, 0.9608098471F, 0.9609376835F, 0.9610652332F, 0.9611924963F, 0.9613194733F, 0.9614461644F, 0.9615725699F, 0.9616986901F, 0.9618245253F, 0.9619500757F, 0.9620753418F, 0.9622003238F, 0.9623250219F, 0.9624494365F, 0.9625735679F, 0.9626974163F, 0.9628209821F, 0.9629442656F, 0.9630672671F, 0.9631899868F, 0.9633124251F, 0.9634345822F, 0.9635564585F, 0.9636780543F, 0.9637993699F, 0.9639204056F, 0.9640411616F, 0.9641616383F, 0.9642818359F, 0.9644017549F, 0.9645213955F, 0.9646407579F, 0.9647598426F, 0.9648786497F, 0.9649971797F, 0.9651154328F, 0.9652334092F, 0.9653511095F, 0.9654685337F, 0.9655856823F, 0.9657025556F, 0.9658191538F, 0.9659354773F, 0.9660515263F, 0.9661673013F, 0.9662828024F, 0.9663980300F, 0.9665129845F, 0.9666276660F, 0.9667420750F, 0.9668562118F, 0.9669700766F, 0.9670836698F, 0.9671969917F, 0.9673100425F, 0.9674228227F, 0.9675353325F, 0.9676475722F, 0.9677595422F, 0.9678712428F, 0.9679826742F, 0.9680938368F, 0.9682047309F, 0.9683153569F, 0.9684257150F, 0.9685358056F, 0.9686456289F, 0.9687551853F, 0.9688644752F, 0.9689734987F, 0.9690822564F, 0.9691907483F, 0.9692989750F, 0.9694069367F, 0.9695146337F, 0.9696220663F, 0.9697292349F, 0.9698361398F, 0.9699427813F, 0.9700491597F, 0.9701552754F, 0.9702611286F, 0.9703667197F, 0.9704720490F, 0.9705771169F, 0.9706819236F, 0.9707864695F, 0.9708907549F, 0.9709947802F, 0.9710985456F, 0.9712020514F, 0.9713052981F, 0.9714082859F, 0.9715110151F, 0.9716134862F, 0.9717156993F, 0.9718176549F, 0.9719193532F, 0.9720207946F, 0.9721219794F, 0.9722229080F, 0.9723235806F, 0.9724239976F, 0.9725241593F, 0.9726240661F, 0.9727237183F, 0.9728231161F, 0.9729222601F, 0.9730211503F, 0.9731197873F, 0.9732181713F, 0.9733163027F, 0.9734141817F, 0.9735118088F, 0.9736091842F, 0.9737063083F, 0.9738031814F, 0.9738998039F, 0.9739961760F, 0.9740922981F, 0.9741881706F, 0.9742837938F, 0.9743791680F, 0.9744742935F, 0.9745691707F, 0.9746637999F, 0.9747581814F, 0.9748523157F, 0.9749462029F, 0.9750398435F, 0.9751332378F, 0.9752263861F, 0.9753192887F, 0.9754119461F, 0.9755043585F, 0.9755965262F, 0.9756884496F, 0.9757801291F, 0.9758715650F, 0.9759627575F, 0.9760537071F, 0.9761444141F, 0.9762348789F, 0.9763251016F, 0.9764150828F, 0.9765048228F, 0.9765943218F, 0.9766835802F, 0.9767725984F, 0.9768613767F, 0.9769499154F, 0.9770382149F, 0.9771262755F, 0.9772140976F, 0.9773016815F, 0.9773890275F, 0.9774761360F, 0.9775630073F, 0.9776496418F, 0.9777360398F, 0.9778222016F, 0.9779081277F, 0.9779938182F, 0.9780792736F, 0.9781644943F, 0.9782494805F, 0.9783342326F, 0.9784187509F, 0.9785030359F, 0.9785870877F, 0.9786709069F, 0.9787544936F, 0.9788378484F, 0.9789209714F, 0.9790038631F, 0.9790865238F, 0.9791689538F, 0.9792511535F, 0.9793331232F, 0.9794148633F, 0.9794963742F, 0.9795776561F, 0.9796587094F, 0.9797395345F, 0.9798201316F, 0.9799005013F, 0.9799806437F, 0.9800605593F, 0.9801402483F, 0.9802197112F, 0.9802989483F, 0.9803779600F, 0.9804567465F, 0.9805353082F, 0.9806136455F, 0.9806917587F, 0.9807696482F, 0.9808473143F, 0.9809247574F, 0.9810019778F, 0.9810789759F, 0.9811557519F, 0.9812323064F, 0.9813086395F, 0.9813847517F, 0.9814606433F, 0.9815363147F, 0.9816117662F, 0.9816869981F, 0.9817620108F, 0.9818368047F, 0.9819113801F, 0.9819857374F, 0.9820598769F, 0.9821337989F, 0.9822075038F, 0.9822809920F, 0.9823542638F, 0.9824273195F, 0.9825001596F, 0.9825727843F, 0.9826451940F, 0.9827173891F, 0.9827893700F, 0.9828611368F, 0.9829326901F, 0.9830040302F, 0.9830751574F, 0.9831460720F, 0.9832167745F, 0.9832872652F, 0.9833575444F, 0.9834276124F, 0.9834974697F, 0.9835671166F, 0.9836365535F, 0.9837057806F, 0.9837747983F, 0.9838436071F, 0.9839122072F, 0.9839805990F, 0.9840487829F, 0.9841167591F, 0.9841845282F, 0.9842520903F, 0.9843194459F, 0.9843865953F, 0.9844535389F, 0.9845202771F, 0.9845868101F, 0.9846531383F, 0.9847192622F, 0.9847851820F, 0.9848508980F, 0.9849164108F, 0.9849817205F, 0.9850468276F, 0.9851117324F, 0.9851764352F, 0.9852409365F, 0.9853052366F, 0.9853693358F, 0.9854332344F, 0.9854969330F, 0.9855604317F, 0.9856237309F, 0.9856868310F, 0.9857497325F, 0.9858124355F, 0.9858749404F, 0.9859372477F, 0.9859993577F, 0.9860612707F, 0.9861229871F, 0.9861845072F, 0.9862458315F, 0.9863069601F, 0.9863678936F, 0.9864286322F, 0.9864891764F, 0.9865495264F, 0.9866096826F, 0.9866696454F, 0.9867294152F, 0.9867889922F, 0.9868483769F, 0.9869075695F, 0.9869665706F, 0.9870253803F, 0.9870839991F, 0.9871424273F, 0.9872006653F, 0.9872587135F, 0.9873165721F, 0.9873742415F, 0.9874317222F, 0.9874890144F, 0.9875461185F, 0.9876030348F, 0.9876597638F, 0.9877163057F, 0.9877726610F, 0.9878288300F, 0.9878848130F, 0.9879406104F, 0.9879962225F, 0.9880516497F, 0.9881068924F, 0.9881619509F, 0.9882168256F, 0.9882715168F, 0.9883260249F, 0.9883803502F, 0.9884344931F, 0.9884884539F, 0.9885422331F, 0.9885958309F, 0.9886492477F, 0.9887024838F, 0.9887555397F, 0.9888084157F, 0.9888611120F, 0.9889136292F, 0.9889659675F, 0.9890181273F, 0.9890701089F, 0.9891219128F, 0.9891735392F, 0.9892249885F, 0.9892762610F, 0.9893273572F, 0.9893782774F, 0.9894290219F, 0.9894795911F, 0.9895299853F, 0.9895802049F, 0.9896302502F, 0.9896801217F, 0.9897298196F, 0.9897793443F, 0.9898286961F, 0.9898778755F, 0.9899268828F, 0.9899757183F, 0.9900243823F, 0.9900728753F, 0.9901211976F, 0.9901693495F, 0.9902173314F, 0.9902651436F, 0.9903127865F, 0.9903602605F, 0.9904075659F, 0.9904547031F, 0.9905016723F, 0.9905484740F, 0.9905951086F, 0.9906415763F, 0.9906878775F, 0.9907340126F, 0.9907799819F, 0.9908257858F, 0.9908714247F, 0.9909168988F, 0.9909622086F, 0.9910073543F, 0.9910523364F, 0.9910971552F, 0.9911418110F, 0.9911863042F, 0.9912306351F, 0.9912748042F, 0.9913188117F, 0.9913626580F, 0.9914063435F, 0.9914498684F, 0.9914932333F, 0.9915364383F, 0.9915794839F, 0.9916223703F, 0.9916650981F, 0.9917076674F, 0.9917500787F, 0.9917923323F, 0.9918344286F, 0.9918763679F, 0.9919181505F, 0.9919597769F, 0.9920012473F, 0.9920425621F, 0.9920837217F, 0.9921247263F, 0.9921655765F, 0.9922062724F, 0.9922468145F, 0.9922872030F, 0.9923274385F, 0.9923675211F, 0.9924074513F, 0.9924472294F, 0.9924868557F, 0.9925263306F, 0.9925656544F, 0.9926048275F, 0.9926438503F, 0.9926827230F, 0.9927214461F, 0.9927600199F, 0.9927984446F, 0.9928367208F, 0.9928748486F, 0.9929128285F, 0.9929506608F, 0.9929883459F, 0.9930258841F, 0.9930632757F, 0.9931005211F, 0.9931376207F, 0.9931745747F, 0.9932113836F, 0.9932480476F, 0.9932845671F, 0.9933209425F, 0.9933571742F, 0.9933932623F, 0.9934292074F, 0.9934650097F, 0.9935006696F, 0.9935361874F, 0.9935715635F, 0.9936067982F, 0.9936418919F, 0.9936768448F, 0.9937116574F, 0.9937463300F, 0.9937808629F, 0.9938152565F, 0.9938495111F, 0.9938836271F, 0.9939176047F, 0.9939514444F, 0.9939851465F, 0.9940187112F, 0.9940521391F, 0.9940854303F, 0.9941185853F, 0.9941516044F, 0.9941844879F, 0.9942172361F, 0.9942498495F, 0.9942823283F, 0.9943146729F, 0.9943468836F, 0.9943789608F, 0.9944109047F, 0.9944427158F, 0.9944743944F, 0.9945059408F, 0.9945373553F, 0.9945686384F, 0.9945997902F, 0.9946308112F, 0.9946617017F, 0.9946924621F, 0.9947230926F, 0.9947535937F, 0.9947839656F, 0.9948142086F, 0.9948443232F, 0.9948743097F, 0.9949041683F, 0.9949338995F, 0.9949635035F, 0.9949929807F, 0.9950223315F, 0.9950515561F, 0.9950806549F, 0.9951096282F, 0.9951384764F, 0.9951671998F, 0.9951957987F, 0.9952242735F, 0.9952526245F, 0.9952808520F, 0.9953089564F, 0.9953369380F, 0.9953647971F, 0.9953925340F, 0.9954201491F, 0.9954476428F, 0.9954750153F, 0.9955022670F, 0.9955293981F, 0.9955564092F, 0.9955833003F, 0.9956100720F, 0.9956367245F, 0.9956632582F, 0.9956896733F, 0.9957159703F, 0.9957421494F, 0.9957682110F, 0.9957941553F, 0.9958199828F, 0.9958456937F, 0.9958712884F, 0.9958967672F, 0.9959221305F, 0.9959473784F, 0.9959725115F, 0.9959975300F, 0.9960224342F, 0.9960472244F, 0.9960719011F, 0.9960964644F, 0.9961209148F, 0.9961452525F, 0.9961694779F, 0.9961935913F, 0.9962175930F, 0.9962414834F, 0.9962652627F, 0.9962889313F, 0.9963124895F, 0.9963359377F, 0.9963592761F, 0.9963825051F, 0.9964056250F, 0.9964286361F, 0.9964515387F, 0.9964743332F, 0.9964970198F, 0.9965195990F, 0.9965420709F, 0.9965644360F, 0.9965866946F, 0.9966088469F, 0.9966308932F, 0.9966528340F, 0.9966746695F, 0.9966964001F, 0.9967180260F, 0.9967395475F, 0.9967609651F, 0.9967822789F, 0.9968034894F, 0.9968245968F, 0.9968456014F, 0.9968665036F, 0.9968873037F, 0.9969080019F, 0.9969285987F, 0.9969490942F, 0.9969694889F, 0.9969897830F, 0.9970099769F, 0.9970300708F, 0.9970500651F, 0.9970699601F, 0.9970897561F, 0.9971094533F, 0.9971290522F, 0.9971485531F, 0.9971679561F, 0.9971872617F, 0.9972064702F, 0.9972255818F, 0.9972445968F, 0.9972635157F, 0.9972823386F, 0.9973010659F, 0.9973196980F, 0.9973382350F, 0.9973566773F, 0.9973750253F, 0.9973932791F, 0.9974114392F, 0.9974295059F, 0.9974474793F, 0.9974653599F, 0.9974831480F, 0.9975008438F, 0.9975184476F, 0.9975359598F, 0.9975533806F, 0.9975707104F, 0.9975879495F, 0.9976050981F, 0.9976221566F, 0.9976391252F, 0.9976560043F, 0.9976727941F, 0.9976894950F, 0.9977061073F, 0.9977226312F, 0.9977390671F, 0.9977554152F, 0.9977716759F, 0.9977878495F, 0.9978039361F, 0.9978199363F, 0.9978358501F, 0.9978516780F, 0.9978674202F, 0.9978830771F, 0.9978986488F, 0.9979141358F, 0.9979295383F, 0.9979448566F, 0.9979600909F, 0.9979752417F, 0.9979903091F, 0.9980052936F, 0.9980201952F, 0.9980350145F, 0.9980497515F, 0.9980644067F, 0.9980789804F, 0.9980934727F, 0.9981078841F, 0.9981222147F, 0.9981364649F, 0.9981506350F, 0.9981647253F, 0.9981787360F, 0.9981926674F, 0.9982065199F, 0.9982202936F, 0.9982339890F, 0.9982476062F, 0.9982611456F, 0.9982746074F, 0.9982879920F, 0.9983012996F, 0.9983145304F, 0.9983276849F, 0.9983407632F, 0.9983537657F, 0.9983666926F, 0.9983795442F, 0.9983923208F, 0.9984050226F, 0.9984176501F, 0.9984302033F, 0.9984426827F, 0.9984550884F, 0.9984674208F, 0.9984796802F, 0.9984918667F, 0.9985039808F, 0.9985160227F, 0.9985279926F, 0.9985398909F, 0.9985517177F, 0.9985634734F, 0.9985751583F, 0.9985867727F, 0.9985983167F, 0.9986097907F, 0.9986211949F, 0.9986325297F, 0.9986437953F, 0.9986549919F, 0.9986661199F, 0.9986771795F, 0.9986881710F, 0.9986990946F, 0.9987099507F, 0.9987207394F, 0.9987314611F, 0.9987421161F, 0.9987527045F, 0.9987632267F, 0.9987736829F, 0.9987840734F, 0.9987943985F, 0.9988046584F, 0.9988148534F, 0.9988249838F, 0.9988350498F, 0.9988450516F, 0.9988549897F, 0.9988648641F, 0.9988746753F, 0.9988844233F, 0.9988941086F, 0.9989037313F, 0.9989132918F, 0.9989227902F, 0.9989322269F, 0.9989416021F, 0.9989509160F, 0.9989601690F, 0.9989693613F, 0.9989784931F, 0.9989875647F, 0.9989965763F, 0.9990055283F, 0.9990144208F, 0.9990232541F, 0.9990320286F, 0.9990407443F, 0.9990494016F, 0.9990580008F, 0.9990665421F, 0.9990750257F, 0.9990834519F, 0.9990918209F, 0.9991001331F, 0.9991083886F, 0.9991165877F, 0.9991247307F, 0.9991328177F, 0.9991408491F, 0.9991488251F, 0.9991567460F, 0.9991646119F, 0.9991724232F, 0.9991801801F, 0.9991878828F, 0.9991955316F, 0.9992031267F, 0.9992106684F, 0.9992181569F, 0.9992255925F, 0.9992329753F, 0.9992403057F, 0.9992475839F, 0.9992548101F, 0.9992619846F, 0.9992691076F, 0.9992761793F, 0.9992832001F, 0.9992901701F, 0.9992970895F, 0.9993039587F, 0.9993107777F, 0.9993175470F, 0.9993242667F, 0.9993309371F, 0.9993375583F, 0.9993441307F, 0.9993506545F, 0.9993571298F, 0.9993635570F, 0.9993699362F, 0.9993762678F, 0.9993825519F, 0.9993887887F, 0.9993949785F, 0.9994011216F, 0.9994072181F, 0.9994132683F, 0.9994192725F, 0.9994252307F, 0.9994311434F, 0.9994370107F, 0.9994428327F, 0.9994486099F, 0.9994543423F, 0.9994600303F, 0.9994656739F, 0.9994712736F, 0.9994768294F, 0.9994823417F, 0.9994878105F, 0.9994932363F, 0.9994986191F, 0.9995039592F, 0.9995092568F, 0.9995145122F, 0.9995197256F, 0.9995248971F, 0.9995300270F, 0.9995351156F, 0.9995401630F, 0.9995451695F, 0.9995501352F, 0.9995550604F, 0.9995599454F, 0.9995647903F, 0.9995695953F, 0.9995743607F, 0.9995790866F, 0.9995837734F, 0.9995884211F, 0.9995930300F, 0.9995976004F, 0.9996021324F, 0.9996066263F, 0.9996110822F, 0.9996155004F, 0.9996198810F, 0.9996242244F, 0.9996285306F, 0.9996327999F, 0.9996370326F, 0.9996412287F, 0.9996453886F, 0.9996495125F, 0.9996536004F, 0.9996576527F, 0.9996616696F, 0.9996656512F, 0.9996695977F, 0.9996735094F, 0.9996773865F, 0.9996812291F, 0.9996850374F, 0.9996888118F, 0.9996925523F, 0.9996962591F, 0.9996999325F, 0.9997035727F, 0.9997071798F, 0.9997107541F, 0.9997142957F, 0.9997178049F, 0.9997212818F, 0.9997247266F, 0.9997281396F, 0.9997315209F, 0.9997348708F, 0.9997381893F, 0.9997414767F, 0.9997447333F, 0.9997479591F, 0.9997511544F, 0.9997543194F, 0.9997574542F, 0.9997605591F, 0.9997636342F, 0.9997666797F, 0.9997696958F, 0.9997726828F, 0.9997756407F, 0.9997785698F, 0.9997814703F, 0.9997843423F, 0.9997871860F, 0.9997900016F, 0.9997927894F, 0.9997955494F, 0.9997982818F, 0.9998009869F, 0.9998036648F, 0.9998063157F, 0.9998089398F, 0.9998115373F, 0.9998141082F, 0.9998166529F, 0.9998191715F, 0.9998216642F, 0.9998241311F, 0.9998265724F, 0.9998289884F, 0.9998313790F, 0.9998337447F, 0.9998360854F, 0.9998384015F, 0.9998406930F, 0.9998429602F, 0.9998452031F, 0.9998474221F, 0.9998496171F, 0.9998517885F, 0.9998539364F, 0.9998560610F, 0.9998581624F, 0.9998602407F, 0.9998622962F, 0.9998643291F, 0.9998663394F, 0.9998683274F, 0.9998702932F, 0.9998722370F, 0.9998741589F, 0.9998760591F, 0.9998779378F, 0.9998797952F, 0.9998816313F, 0.9998834464F, 0.9998852406F, 0.9998870141F, 0.9998887670F, 0.9998904995F, 0.9998922117F, 0.9998939039F, 0.9998955761F, 0.9998972285F, 0.9998988613F, 0.9999004746F, 0.9999020686F, 0.9999036434F, 0.9999051992F, 0.9999067362F, 0.9999082544F, 0.9999097541F, 0.9999112354F, 0.9999126984F, 0.9999141433F, 0.9999155703F, 0.9999169794F, 0.9999183709F, 0.9999197449F, 0.9999211014F, 0.9999224408F, 0.9999237631F, 0.9999250684F, 0.9999263570F, 0.9999276289F, 0.9999288843F, 0.9999301233F, 0.9999313461F, 0.9999325529F, 0.9999337437F, 0.9999349187F, 0.9999360780F, 0.9999372218F, 0.9999383503F, 0.9999394635F, 0.9999405616F, 0.9999416447F, 0.9999427129F, 0.9999437665F, 0.9999448055F, 0.9999458301F, 0.9999468404F, 0.9999478365F, 0.9999488185F, 0.9999497867F, 0.9999507411F, 0.9999516819F, 0.9999526091F, 0.9999535230F, 0.9999544236F, 0.9999553111F, 0.9999561856F, 0.9999570472F, 0.9999578960F, 0.9999587323F, 0.9999595560F, 0.9999603674F, 0.9999611666F, 0.9999619536F, 0.9999627286F, 0.9999634917F, 0.9999642431F, 0.9999649828F, 0.9999657110F, 0.9999664278F, 0.9999671334F, 0.9999678278F, 0.9999685111F, 0.9999691835F, 0.9999698451F, 0.9999704960F, 0.9999711364F, 0.9999717662F, 0.9999723858F, 0.9999729950F, 0.9999735942F, 0.9999741834F, 0.9999747626F, 0.9999753321F, 0.9999758919F, 0.9999764421F, 0.9999769828F, 0.9999775143F, 0.9999780364F, 0.9999785495F, 0.9999790535F, 0.9999795485F, 0.9999800348F, 0.9999805124F, 0.9999809813F, 0.9999814417F, 0.9999818938F, 0.9999823375F, 0.9999827731F, 0.9999832005F, 0.9999836200F, 0.9999840316F, 0.9999844353F, 0.9999848314F, 0.9999852199F, 0.9999856008F, 0.9999859744F, 0.9999863407F, 0.9999866997F, 0.9999870516F, 0.9999873965F, 0.9999877345F, 0.9999880656F, 0.9999883900F, 0.9999887078F, 0.9999890190F, 0.9999893237F, 0.9999896220F, 0.9999899140F, 0.9999901999F, 0.9999904796F, 0.9999907533F, 0.9999910211F, 0.9999912830F, 0.9999915391F, 0.9999917896F, 0.9999920345F, 0.9999922738F, 0.9999925077F, 0.9999927363F, 0.9999929596F, 0.9999931777F, 0.9999933907F, 0.9999935987F, 0.9999938018F, 0.9999940000F, 0.9999941934F, 0.9999943820F, 0.9999945661F, 0.9999947456F, 0.9999949206F, 0.9999950912F, 0.9999952575F, 0.9999954195F, 0.9999955773F, 0.9999957311F, 0.9999958807F, 0.9999960265F, 0.9999961683F, 0.9999963063F, 0.9999964405F, 0.9999965710F, 0.9999966979F, 0.9999968213F, 0.9999969412F, 0.9999970576F, 0.9999971707F, 0.9999972805F, 0.9999973871F, 0.9999974905F, 0.9999975909F, 0.9999976881F, 0.9999977824F, 0.9999978738F, 0.9999979624F, 0.9999980481F, 0.9999981311F, 0.9999982115F, 0.9999982892F, 0.9999983644F, 0.9999984370F, 0.9999985072F, 0.9999985750F, 0.9999986405F, 0.9999987037F, 0.9999987647F, 0.9999988235F, 0.9999988802F, 0.9999989348F, 0.9999989873F, 0.9999990379F, 0.9999990866F, 0.9999991334F, 0.9999991784F, 0.9999992217F, 0.9999992632F, 0.9999993030F, 0.9999993411F, 0.9999993777F, 0.9999994128F, 0.9999994463F, 0.9999994784F, 0.9999995091F, 0.9999995384F, 0.9999995663F, 0.9999995930F, 0.9999996184F, 0.9999996426F, 0.9999996657F, 0.9999996876F, 0.9999997084F, 0.9999997282F, 0.9999997469F, 0.9999997647F, 0.9999997815F, 0.9999997973F, 0.9999998123F, 0.9999998265F, 0.9999998398F, 0.9999998524F, 0.9999998642F, 0.9999998753F, 0.9999998857F, 0.9999998954F, 0.9999999045F, 0.9999999130F, 0.9999999209F, 0.9999999282F, 0.9999999351F, 0.9999999414F, 0.9999999472F, 0.9999999526F, 0.9999999576F, 0.9999999622F, 0.9999999664F, 0.9999999702F, 0.9999999737F, 0.9999999769F, 0.9999999798F, 0.9999999824F, 0.9999999847F, 0.9999999868F, 0.9999999887F, 0.9999999904F, 0.9999999919F, 0.9999999932F, 0.9999999943F, 0.9999999953F, 0.9999999961F, 0.9999999969F, 0.9999999975F, 0.9999999980F, 0.9999999985F, 0.9999999988F, 0.9999999991F, 0.9999999993F, 0.9999999995F, 0.9999999997F, 0.9999999998F, 0.9999999999F, 0.9999999999F, 1.0000000000F, 1.0000000000F, 1.0000000000F, 1.0000000000F, 1.0000000000F, 1.0000000000F, 1.0000000000F, }; static float *vwin[8] = { vwin64, vwin128, vwin256, vwin512, vwin1024, vwin2048, vwin4096, vwin8192, }; float *_vorbis_window_get(int n){ return vwin[n]; } void _vorbis_apply_window(float *d,int *winno,long *blocksizes, int lW,int W,int nW){ lW=(W?lW:0); nW=(W?nW:0); { float *windowLW=vwin[winno[lW]]; float *windowNW=vwin[winno[nW]]; long n=blocksizes[W]; long ln=blocksizes[lW]; long rn=blocksizes[nW]; long leftbegin=n/4-ln/4; long leftend=leftbegin+ln/2; long rightbegin=n/2+n/4-rn/4; long rightend=rightbegin+rn/2; int i,p; for(i=0;i typedef _G_int64_t ogg_int64_t; typedef _G_int32_t ogg_int32_t; typedef _G_uint32_t ogg_uint32_t; typedef _G_int16_t ogg_int16_t; typedef _G_uint16_t ogg_uint16_t; # endif #elif defined(__MACOS__) # include typedef SInt16 ogg_int16_t; typedef UInt16 ogg_uint16_t; typedef SInt32 ogg_int32_t; typedef UInt32 ogg_uint32_t; typedef SInt64 ogg_int64_t; #elif defined(__MACOSX__) /* MacOS X Framework build */ # include typedef int16_t ogg_int16_t; typedef u_int16_t ogg_uint16_t; typedef int32_t ogg_int32_t; typedef u_int32_t ogg_uint32_t; typedef int64_t ogg_int64_t; #elif defined(__BEOS__) /* Be */ # include typedef int16_t ogg_int16_t; typedef u_int16_t ogg_uint16_t; typedef int32_t ogg_int32_t; typedef u_int32_t ogg_uint32_t; typedef int64_t ogg_int64_t; #elif defined (__EMX__) /* OS/2 GCC */ typedef short ogg_int16_t; typedef unsigned short ogg_uint16_t; typedef int ogg_int32_t; typedef unsigned int ogg_uint32_t; typedef long long ogg_int64_t; #elif defined (DJGPP) /* DJGPP */ typedef short ogg_int16_t; typedef int ogg_int32_t; typedef unsigned int ogg_uint32_t; typedef long long ogg_int64_t; #elif defined(R5900) /* PS2 EE */ typedef long ogg_int64_t; typedef int ogg_int32_t; typedef unsigned ogg_uint32_t; typedef short ogg_int16_t; #else # include # include "ogg/config_types.h" #endif #endif /* _OS_TYPES_H */ libtritonus-java-20070428/src/lib/pvorbis/vorbis/0000755000175000017500000000000010621572600021541 5ustar twernertwernerlibtritonus-java-20070428/src/lib/pvorbis/vorbis/vorbisenc.h0000644000175000017500000000503210167055537023716 0ustar twernertwerner/******************************************************************** * * * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2001 * * by the XIPHOPHORUS Company http://www.xiph.org/ * * * ******************************************************************** function: vorbis encode-engine setup last mod: $Id: vorbisenc.h,v 1.1 2005/01/05 21:25:51 pfisterer Exp $ ********************************************************************/ #ifndef _OV_ENC_H_ #define _OV_ENC_H_ #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ #include "codec.h" extern int vorbis_encode_init(vorbis_info *vi, long channels, long rate, long max_bitrate, long nominal_bitrate, long min_bitrate); extern int vorbis_encode_setup_managed(vorbis_info *vi, long channels, long rate, long max_bitrate, long nominal_bitrate, long min_bitrate); extern int vorbis_encode_setup_vbr(vorbis_info *vi, long channels, long rate, float /* quality level from 0. (lo) to 1. (hi) */ ); extern int vorbis_encode_init_vbr(vorbis_info *vi, long channels, long rate, float base_quality /* quality level from 0. (lo) to 1. (hi) */ ); extern int vorbis_encode_setup_init(vorbis_info *vi); extern int vorbis_encode_ctl(vorbis_info *vi,int number,void *arg); #define OV_ECTL_RATEMANAGE_GET 0x10 #define OV_ECTL_RATEMANAGE_SET 0x11 #define OV_ECTL_RATEMANAGE_AVG 0x12 #define OV_ECTL_RATEMANAGE_HARD 0x13 #define OV_ECTL_LOWPASS_GET 0x20 #define OV_ECTL_LOWPASS_SET 0x21 #define OV_ECTL_IBLOCK_GET 0x30 #define OV_ECTL_IBLOCK_SET 0x31 struct ovectl_ratemanage_arg { int management_active; long bitrate_hard_min; long bitrate_hard_max; double bitrate_hard_window; long bitrate_av_lo; long bitrate_av_hi; double bitrate_av_window; double bitrate_av_window_center; }; #ifdef __cplusplus } #endif /* __cplusplus */ #endif libtritonus-java-20070428/src/lib/pvorbis/vorbis/codec.h0000644000175000017500000001574210171714041022775 0ustar twernertwerner/******************************************************************** * * * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2001 * * by the XIPHOPHORUS Company http://www.xiph.org/ * ******************************************************************** function: libvorbis codec headers last mod: $Id: codec.h,v 1.5 2005/01/14 10:00:01 pfisterer Exp $ ********************************************************************/ #ifndef _vorbis_codec_h_ #define _vorbis_codec_h_ #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ #include typedef struct vorbis_info{ int version; int channels; long rate; /* The below bitrate declarations are *hints*. Combinations of the three values carry the following implications: all three set to the same value: implies a fixed rate bitstream only nominal set: implies a VBR stream that averages the nominal bitrate. No hard upper/lower limit upper and or lower set: implies a VBR bitstream that obeys the bitrate limits. nominal may also be set to give a nominal rate. none set: the coder does not care to speculate. */ long bitrate_upper; long bitrate_nominal; long bitrate_lower; long bitrate_window; void *codec_setup; } vorbis_info; /* vorbis_dsp_state buffers the current vorbis audio analysis/synthesis state. The DSP state belongs to a specific logical bitstream ****************************************************/ typedef struct vorbis_dsp_state{ int analysisp; vorbis_info *vi; float **pcm; float **pcmret; int pcm_storage; int pcm_current; int pcm_returned; int preextrapolate; int eofflag; long lW; long W; long nW; long centerW; ogg_int64_t granulepos; ogg_int64_t sequence; ogg_int64_t glue_bits; ogg_int64_t time_bits; ogg_int64_t floor_bits; ogg_int64_t res_bits; void *backend_state; } vorbis_dsp_state; typedef struct vorbis_block{ /* necessary stream state for linking to the framing abstraction */ float **pcm; /* this is a pointer into local storage */ oggpack_buffer opb; long lW; long W; long nW; int pcmend; int mode; int eofflag; ogg_int64_t granulepos; ogg_int64_t sequence; vorbis_dsp_state *vd; /* For read-only access of configuration */ /* local storage to avoid remallocing; it's up to the mapping to structure it */ void *localstore; long localtop; long localalloc; long totaluse; struct alloc_chain *reap; /* bitmetrics for the frame */ long glue_bits; long time_bits; long floor_bits; long res_bits; void *internal; } vorbis_block; /* vorbis_block is a single block of data to be processed as part of the analysis/synthesis stream; it belongs to a specific logical bitstream, but is independant from other vorbis_blocks belonging to that logical bitstream. *************************************************/ struct alloc_chain{ void *ptr; struct alloc_chain *next; }; /* vorbis_info contains all the setup information specific to the specific compression/decompression mode in progress (eg, psychoacoustic settings, channel setup, options, codebook etc). vorbis_info and substructures are in backends.h. *********************************************************************/ /* libvorbis encodes in two abstraction layers; first we perform DSP and produce a packet (see docs/analysis.txt). The packet is then coded into a framed OggSquish bitstream by the second layer (see docs/framing.txt). Decode is the reverse process; we sync/frame the bitstream and extract individual packets, then decode the packet back into PCM audio. The extra framing/packetizing is used in streaming formats, such as files. Over the net (such as with UDP), the framing and packetization aren't necessary as they're provided by the transport and the streaming layer is not used */ /* Vorbis PRIMITIVES: general ***************************************/ extern void vorbis_info_init(vorbis_info *vi); extern void vorbis_info_clear(vorbis_info *vi); extern int vorbis_info_blocksize(vorbis_info *vi,int zo); extern int vorbis_block_init(vorbis_dsp_state *v, vorbis_block *vb); extern int vorbis_block_clear(vorbis_block *vb); extern void vorbis_dsp_clear(vorbis_dsp_state *v); extern double vorbis_granule_time(vorbis_dsp_state *v, ogg_int64_t granulepos); /* Vorbis PRIMITIVES: analysis/DSP layer ****************************/ extern int vorbis_analysis_init(vorbis_dsp_state *v,vorbis_info *vi); extern int vorbis_analysis_headerout(vorbis_dsp_state *v, ogg_packet *op_code); extern float **vorbis_analysis_buffer(vorbis_dsp_state *v,int vals); extern int vorbis_analysis_wrote(vorbis_dsp_state *v,int vals); extern int vorbis_analysis_blockout(vorbis_dsp_state *v,vorbis_block *vb); extern int vorbis_analysis(vorbis_block *vb,ogg_packet *op); extern int vorbis_bitrate_addblock(vorbis_block *vb); extern int vorbis_bitrate_flushpacket(vorbis_dsp_state *vd, ogg_packet *op); /* Vorbis PRIMITIVES: synthesis layer *******************************/ extern int vorbis_synthesis_headerin(vorbis_info *vi,oggpack_buffer *opb, int packtype, ogg_packet *op); extern int vorbis_synthesis_init(vorbis_dsp_state *v,vorbis_info *vi); extern int vorbis_synthesis_restart(vorbis_dsp_state *v); extern int vorbis_synthesis(vorbis_block *vb,ogg_packet *op); extern int vorbis_synthesis_trackonly(vorbis_block *vb,ogg_packet *op); extern int vorbis_synthesis_blockin(vorbis_dsp_state *v,vorbis_block *vb); extern int vorbis_synthesis_pcmout(vorbis_dsp_state *v,float ***pcm); extern int vorbis_synthesis_lapout(vorbis_dsp_state *v,float ***pcm); extern int vorbis_synthesis_read(vorbis_dsp_state *v,int samples); extern long vorbis_packet_blocksize(vorbis_info *vi,ogg_packet *op); extern int vorbis_synthesis_halfrate(vorbis_info *v,int flag); extern int vorbis_synthesis_halfrate_p(vorbis_info *v); /* Vorbis ERRORS and return codes ***********************************/ #define OV_FALSE -1 #define OV_EOF -2 #define OV_HOLE -3 #define OV_EREAD -128 #define OV_EFAULT -129 #define OV_EIMPL -130 #define OV_EINVAL -131 #define OV_ENOTVORBIS -132 #define OV_EBADHEADER -133 #define OV_EVERSION -134 #define OV_ENOTAUDIO -135 #define OV_EBADPACKET -136 #define OV_EBADLINK -137 #define OV_ENOSEEK -138 #ifdef __cplusplus } #endif /* __cplusplus */ #endif libtritonus-java-20070428/src/lib/vorbis/0000755000175000017500000000000010621572601020056 5ustar twernertwernerlibtritonus-java-20070428/src/lib/vorbis/.cvsignore0000644000175000017500000000005207757626315022075 0ustar twernertwernerMakefile org_tritonus_*.h *.o *.so* .libs libtritonus-java-20070428/src/lib/vorbis/Makefile.in0000644000175000017500000000677707776243530022161 0ustar twernertwerner# compilation and packing of the native library for vorbis # SHELL = /bin/sh prefix=@prefix@ JAVADIR=$(prefix) REL_JAVAEXTLIBPATH=@REL_JAVAEXTLIBPATH@ JAVAEXTLIBPATH=$(JAVADIR)/$(REL_JAVAEXTLIBPATH) OSNAME=@OSNAME@ ARCHNAME=@ARCHNAME@ CC=@CC@ CPPFLAGS=-g -Wall -Werror -I$(JAVADIR)/include -I$(JAVADIR)/include/$(OSNAME) -fPIC -D_REENTRANT #-pedantic INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ LN_S=@LN_S@ RM_F=@RM_F@ MKDIR_P=@MKDIR_P@ OBJDIR=../../../@BUILD_DIR@ vpath %.class $(OBJDIR)/org/tritonus/lowlevel/ogg vpath %.class $(OBJDIR)/org/tritonus/lowlevel/vorbis LIBBASENAME=libtritonusvorbis LIBDEST=$(LIBBASENAME).so.1.0 LIBDEST_ABSOLUTE=@SRC_ABSOLUTE_PATH@/src/lib/vorbis/$(LIBDEST) #or LIBDEST_ABSOLUTE=$(CURDIR)/$(LIBDEST) LIBS=-logg -lvorbis -lvorbisenc JAVAH = @JAVAH@ JNIOBJ=\ org_tritonus_lowlevel_ogg_Buffer.o \ org_tritonus_lowlevel_ogg_Packet.o \ org_tritonus_lowlevel_ogg_Page.o \ org_tritonus_lowlevel_ogg_StreamState.o \ org_tritonus_lowlevel_ogg_SyncState.o \ org_tritonus_lowlevel_vorbis_Block.o \ org_tritonus_lowlevel_vorbis_Comment.o \ org_tritonus_lowlevel_vorbis_DspState.o \ org_tritonus_lowlevel_vorbis_Info.o OBJ=\ $(JNIOBJ) \ ../common/common.o JNIHEADERS:=$(JNIOBJ:.o=.h) JNICLASSFILES=\ Buffer.class \ Packet.class \ Page.class \ StreamState.class \ SyncState.class \ Block.class \ Comment.class \ DspState.class \ Info.class JNICLASSES=\ org.tritonus.lowlevel.ogg.Buffer \ org.tritonus.lowlevel.ogg.Packet \ org.tritonus.lowlevel.ogg.Page \ org.tritonus.lowlevel.ogg.StreamState \ org.tritonus.lowlevel.ogg.SyncState \ org.tritonus.lowlevel.vorbis.Block \ org.tritonus.lowlevel.vorbis.Comment \ org.tritonus.lowlevel.vorbis.DspState \ org.tritonus.lowlevel.vorbis.Info #----------------- rules ------------------- .PHONY: all all: $(LIBDEST) $(LIBDEST): $(OBJ) $(CC) -nostartfiles -shared -Wl,-soname,$(LIBBASENAME).so.1 -o $(LIBDEST) $(OBJ) -L/usr/lib $(LIBS) $(RM_F) $(LIBBASENAME).so.1 $(LN_S) $(LIBBASENAME).so.1.0 $(LIBBASENAME).so.1 $(RM_F) $(LIBBASENAME).so $(LN_S) $(LIBBASENAME).so.1 $(LIBBASENAME).so $(OBJ): $(JNIHEADERS) $(JNIHEADERS): $(JNICLASSFILES) $(RM_F) $(JNIHEADERS) $(JAVAH) -d . $(JNICLASSES) .PHONY: install install: @echo "Installing $(LIBBASENAME) in $(JAVAEXTLIBPATH)" @$(MKDIR_P) $(JAVAEXTLIBPATH) @$(RM_F) $(JAVAEXTLIBPATH)/$(LIBBASENAME).so.1.0 @$(RM_F) $(JAVAEXTLIBPATH)/$(LIBBASENAME).so.1 @$(RM_F) $(JAVAEXTLIBPATH)/$(LIBBASENAME).so $(INSTALL_PROGRAM) $(LIBDEST) $(JAVAEXTLIBPATH) @(cd $(JAVAEXTLIBPATH) && $(LN_S) $(LIBBASENAME).so.1.0 $(LIBBASENAME).so.1) @(cd $(JAVAEXTLIBPATH) && $(LN_S) $(LIBBASENAME).so.1 $(LIBBASENAME).so) .PHONY: install-link install-link: @echo "Creating links for $(LIBBASENAME) in $(JAVAEXTLIBPATH)" @$(MKDIR_P) $(JAVAEXTLIBPATH) @$(RM_F) $(JAVAEXTLIBPATH)/$(LIBBASENAME).so.1.0 @$(RM_F) $(JAVAEXTLIBPATH)/$(LIBBASENAME).so.1 @$(RM_F) $(JAVAEXTLIBPATH)/$(LIBBASENAME).so @(cd $(JAVAEXTLIBPATH) && $(LN_S) $(LIBDEST_ABSOLUTE) $(LIBBASENAME).so.1.0) @(cd $(JAVAEXTLIBPATH) && $(LN_S) $(LIBBASENAME).so.1.0 $(LIBBASENAME).so.1) @(cd $(JAVAEXTLIBPATH) && $(LN_S) $(LIBBASENAME).so.1 $(LIBBASENAME).so) .PHONY: uninstall uninstall: @echo "Removing $(LIBBASENAME) from $(JAVAEXTLIBPATH)" @$(RM_F) $(JAVAEXTLIBPATH)/$(LIBBASENAME).so.1.0 @$(RM_F) $(JAVAEXTLIBPATH)/$(LIBBASENAME).so.1 @$(RM_F) $(JAVAEXTLIBPATH)/$(LIBBASENAME).so .PHONY: uninstall-link uninstall-link: uninstall .PHONY: clean clean: rm -rf $(LIBDEST) $(JNIHEADERS) *.o *~ libtritonus-java-20070428/src/lib/vorbis/common.h0000644000175000017500000000206107672160004021520 0ustar twernertwerner/* * common.h */ /* * Copyright (c) 1999 - 2001 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "../common/HandleFieldHandler.h" #include "../common/common.h" #include "../common/debug.h" #include #include #include #include /*** common.h ***/ libtritonus-java-20070428/src/lib/vorbis/org_tritonus_lowlevel_ogg_Buffer.c0000644000175000017500000002760010370106025027015 0ustar twernertwerner/* * org_tritonus_lowlevel_ogg_Buffer.c */ /* * Copyright (c) 2003 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ #include "common.h" #include "org_tritonus_lowlevel_ogg_StreamState.h" HandleFieldHandlerDeclaration(handler, oggpack_buffer*) /* * Class: org_tritonus_lowlevel_ogg_Buffer * Method: malloc * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_ogg_Buffer_malloc (JNIEnv* env, jobject obj) { oggpack_buffer* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_Buffer_malloc(): begin\n"); } handle = malloc(sizeof(oggpack_buffer)); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_Buffer_malloc(): handle: %p\n", handle); } setHandle(env, obj, handle); nReturn = (handle == NULL) ? -1 : 0; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_Buffer_malloc(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_ogg_Buffer * Method: free * Signature: ()V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_ogg_Buffer_free (JNIEnv* env, jobject obj) { oggpack_buffer* handle; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_Buffer_free(): begin\n"); } handle = getHandle(env, obj); free(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_Buffer_free(): end\n"); } } /* * Class: org_tritonus_lowlevel_ogg_Buffer * Method: writeInit * Signature: ()V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_ogg_Buffer_writeInit (JNIEnv* env, jobject obj) { oggpack_buffer* handle; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_Buffer_writeInit(): begin\n"); } handle = getHandle(env, obj); oggpack_writeinit(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_Buffer_writeInit(): end\n"); } } /* * Class: org_tritonus_lowlevel_ogg_Buffer * Method: writeTrunc * Signature: (I)V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_ogg_Buffer_writeTrunc (JNIEnv* env, jobject obj, jint nBits) { oggpack_buffer* handle; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_Buffer_writeTrunc(): begin\n"); } handle = getHandle(env, obj); oggpack_writetrunc(handle, nBits); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_Buffer_writeTrunc(): end\n"); } } /* * Class: org_tritonus_lowlevel_ogg_Buffer * Method: writeAlign * Signature: ()V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_ogg_Buffer_writeAlign (JNIEnv* env, jobject obj) { oggpack_buffer* handle; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_Buffer_writeAlign(): begin\n"); } handle = getHandle(env, obj); oggpack_writealign(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_Buffer_writeAlign(): end\n"); } } /* * Class: org_tritonus_lowlevel_ogg_Buffer * Method: writeCopy * Signature: ([BI)V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_ogg_Buffer_writeCopy (JNIEnv* env, jobject obj, jbyteArray abSource, jint nBits) { oggpack_buffer* handle; jbyte* source; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_Buffer_writeCopy(): begin\n"); } handle = getHandle(env, obj); source = (*env)->GetByteArrayElements(env, abSource, NULL); oggpack_writecopy(handle, source, nBits); (*env)->ReleaseByteArrayElements(env, abSource, source, 0); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_Buffer_writeCopy(): end\n"); } } /* * Class: org_tritonus_lowlevel_ogg_Buffer * Method: reset * Signature: ()V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_ogg_Buffer_reset (JNIEnv* env, jobject obj) { oggpack_buffer* handle; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_Buffer_reset(): begin\n"); } handle = getHandle(env, obj); oggpack_reset(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_Buffer_reset(): end\n"); } } /* * Class: org_tritonus_lowlevel_ogg_Buffer * Method: writeClear * Signature: ()V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_ogg_Buffer_writeClear (JNIEnv* env, jobject obj) { oggpack_buffer* handle; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_Buffer_writeClear(): begin\n"); } handle = getHandle(env, obj); oggpack_writeclear(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_Buffer_writeClear(): end\n"); } } /* * Class: org_tritonus_lowlevel_ogg_Buffer * Method: readInit * Signature: ([BI)V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_ogg_Buffer_readInit (JNIEnv* env, jobject obj, jbyteArray abBuffer, jint nBytes) { oggpack_buffer* handle; jbyte* buffer; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_Buffer_readInit(): begin\n"); } if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_Buffer_readInit(): nBytes: %d\n", nBytes); } handle = getHandle(env, obj); buffer = (*env)->GetByteArrayElements(env, abBuffer, NULL); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_Buffer_readInit(): buffer[0]: %d\n", buffer[0]); } if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_Buffer_readInit(): buffer[1]: %d\n", buffer[1]); } if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_Buffer_readInit(): buffer[2]: %d\n", buffer[2]); } oggpack_readinit(handle, (unsigned char*) buffer, nBytes); (*env)->ReleaseByteArrayElements(env, abBuffer, buffer, 0); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_Buffer_readInit(): end\n"); } } /* * Class: org_tritonus_lowlevel_ogg_Buffer * Method: write * Signature: (II)V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_ogg_Buffer_write (JNIEnv* env, jobject obj, jint nValue, jint nBits) { oggpack_buffer* handle; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_Buffer_write(): begin\n"); } handle = getHandle(env, obj); oggpack_write(handle, nValue, nBits); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_Buffer_write(): end\n"); } } /* * Class: org_tritonus_lowlevel_ogg_Buffer * Method: look * Signature: (I)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_ogg_Buffer_look (JNIEnv* env, jobject obj, jint nBits) { oggpack_buffer* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_Buffer_look(): begin\n"); } handle = getHandle(env, obj); nReturn = oggpack_look(handle, nBits); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_Buffer_look(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_ogg_Buffer * Method: look1 * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_ogg_Buffer_look1 (JNIEnv* env, jobject obj) { oggpack_buffer* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_Buffer_look1(): begin\n"); } handle = getHandle(env, obj); nReturn = oggpack_look1(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_Buffer_look1(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_ogg_Buffer * Method: adv * Signature: (I)V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_ogg_Buffer_adv (JNIEnv* env, jobject obj, jint nBits) { oggpack_buffer* handle; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_Buffer_adv(): begin\n"); } handle = getHandle(env, obj); oggpack_adv(handle, nBits); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_Buffer_adv(): end\n"); } } /* * Class: org_tritonus_lowlevel_ogg_Buffer * Method: adv1 * Signature: ()V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_ogg_Buffer_adv1 (JNIEnv* env, jobject obj) { oggpack_buffer* handle; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_Buffer_adv1(): begin\n"); } handle = getHandle(env, obj); oggpack_adv1(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_Buffer_adv1(): end\n"); } } /* * Class: org_tritonus_lowlevel_ogg_Buffer * Method: read * Signature: (I)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_ogg_Buffer_read (JNIEnv* env, jobject obj, jint nBits) { oggpack_buffer* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_Buffer_read(): begin\n"); } handle = getHandle(env, obj); nReturn = oggpack_read(handle, nBits); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_Buffer_read(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_ogg_Buffer * Method: read1 * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_ogg_Buffer_read1 (JNIEnv* env, jobject obj) { oggpack_buffer* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_Buffer_read1(): begin\n"); } handle = getHandle(env, obj); nReturn = oggpack_read1(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_Buffer_read1(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_ogg_Buffer * Method: bytes * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_ogg_Buffer_bytes (JNIEnv* env, jobject obj) { oggpack_buffer* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_Buffer_bytes(): begin\n"); } handle = getHandle(env, obj); nReturn = oggpack_bytes(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_Buffer_bytes(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_ogg_Buffer * Method: bits * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_ogg_Buffer_bits (JNIEnv* env, jobject obj) { oggpack_buffer* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_Buffer_bits(): begin\n"); } handle = getHandle(env, obj); nReturn = oggpack_bits(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_Buffer_bits(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_ogg_Buffer * Method: getBuffer * Signature: ()[B */ JNIEXPORT jbyteArray JNICALL Java_org_tritonus_lowlevel_ogg_Buffer_getBuffer (JNIEnv* env, jobject obj) { oggpack_buffer* handle; unsigned char* buffer; jbyteArray abBuffer; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_Buffer_getBuffer(): begin\n"); } handle = getHandle(env, obj); buffer = oggpack_get_buffer(handle); abBuffer = (*env)->NewByteArray(env, handle->storage); (*env)->SetByteArrayRegion(env, abBuffer, 0, handle->storage, (jbyte*) buffer); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_Buffer_getBuffer(): end\n"); } return abBuffer; } /* * Class: org_tritonus_lowlevel_ogg_Buffer * Method: setTrace * Signature: (Z)V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_ogg_Buffer_setTrace (JNIEnv* env, jclass cls, jboolean bTrace) { debug_flag = bTrace; debug_file = stderr; } /*** org_tritonus_lowlevel_ogg_Buffer.c ***/ libtritonus-java-20070428/src/lib/vorbis/org_tritonus_lowlevel_ogg_Packet.c0000644000175000017500000001150610370106025027011 0ustar twernertwerner/* * org_tritonus_lowlevel_ogg_Packet.c */ /* * Copyright (c) 2003 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ #include "common.h" #include "org_tritonus_lowlevel_ogg_Packet.h" HandleFieldHandlerDeclaration(handler, ogg_packet*) ogg_packet* getPacketNativeHandle(JNIEnv *env, jobject obj) { return getHandle(env, obj); } /* * Class: org_tritonus_lowlevel_ogg_Packet * Method: malloc * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_ogg_Packet_malloc (JNIEnv* env, jobject obj) { ogg_packet* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_Packet_malloc(): begin\n"); } handle = malloc(sizeof(ogg_packet)); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_Packet_malloc(): handle: %p\n", handle); } setHandle(env, obj, handle); nReturn = (handle == NULL) ? -1 : 0; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_Packet_malloc(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_ogg_Packet * Method: free * Signature: ()V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_ogg_Packet_free (JNIEnv* env, jobject obj) { ogg_packet* handle; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_Packet_free(): begin\n"); } handle = getHandle(env, obj); free(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_Packet_free(): end\n"); } } /* * Class: org_tritonus_lowlevel_ogg_Packet * Method: clear * Signature: ()V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_ogg_Packet_clear (JNIEnv* env, jobject obj) { ogg_packet* handle; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_Packet_clear(): begin\n"); } handle = getHandle(env, obj); ogg_packet_clear(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_Packet_clear(): end\n"); } } /* * Class: org_tritonus_lowlevel_ogg_Packet * Method: getData * Signature: ()[B */ JNIEXPORT jbyteArray JNICALL Java_org_tritonus_lowlevel_ogg_Packet_getData (JNIEnv* env, jobject obj) { ogg_packet* handle; jbyteArray abData; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_Packet_getData(): begin\n"); } handle = getHandle(env, obj); abData = (*env)->NewByteArray(env, handle->bytes); (*env)->SetByteArrayRegion(env, abData, 0, handle->bytes, (jbyte*) (handle->packet)); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_Packet_getData(): end\n"); } return abData; } /* * Class: org_tritonus_lowlevel_ogg_Packet * Method: isBos * Signature: ()Z */ JNIEXPORT jboolean JNICALL Java_org_tritonus_lowlevel_ogg_Packet_isBos (JNIEnv* env, jobject obj) { ogg_packet* handle; jboolean bReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_Packet_isBos(): begin\n"); } handle = getHandle(env, obj); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_Packet_isBos(): b_o_s: %d\n", (int) handle->b_o_s); } bReturn = (handle->b_o_s != 0) ? JNI_TRUE : JNI_FALSE; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_Packet_isBos(): end\n"); } return bReturn; } /* * Class: org_tritonus_lowlevel_ogg_Packet * Method: isEos * Signature: ()Z */ JNIEXPORT jboolean JNICALL Java_org_tritonus_lowlevel_ogg_Packet_isEos (JNIEnv* env, jobject obj) { ogg_packet* handle; jboolean bReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_Packet_isEos(): begin\n"); } handle = getHandle(env, obj); bReturn = (handle->e_o_s != 0) ? JNI_TRUE : JNI_FALSE; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_Packet_isEos(): end\n"); } return bReturn; } /* * Class: org_tritonus_lowlevel_ogg_Packet * Method: setTrace * Signature: (Z)V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_ogg_Packet_setTrace (JNIEnv* env, jclass cls, jboolean bTrace) { debug_flag = bTrace; debug_file = stderr; } /*** org_tritonus_lowlevel_ogg_Packet.c ***/ libtritonus-java-20070428/src/lib/vorbis/org_tritonus_lowlevel_ogg_Page.c0000644000175000017500000002054310370106025026457 0ustar twernertwerner/* * org_tritonus_lowlevel_ogg_Page */ /* * Copyright (c) 2003 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ #include "common.h" #include "org_tritonus_lowlevel_ogg_Page.h" HandleFieldHandlerDeclaration(handler, ogg_page*) ogg_page* getPageNativeHandle(JNIEnv *env, jobject obj) { return getHandle(env, obj); } /* * Class: org_tritonus_lowlevel_ogg_Page * Method: malloc * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_ogg_Page_malloc (JNIEnv* env, jobject obj) { ogg_page* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_Page_malloc(): begin\n"); } handle = malloc(sizeof(ogg_page)); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_Page_malloc(): handle: %p\n", handle); } setHandle(env, obj, handle); nReturn = (handle == NULL) ? -1 : 0; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_Page_malloc(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_ogg_Page * Method: free * Signature: ()V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_ogg_Page_free (JNIEnv* env, jobject obj) { ogg_page* handle; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_Page_free(): begin\n"); } handle = getHandle(env, obj); free(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_Page_free(): end\n"); } } /* * Class: org_tritonus_lowlevel_ogg_Page * Method: getVersion * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_ogg_Page_getVersion (JNIEnv* env, jobject obj) { ogg_page* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_Page_getVersion(): begin\n"); } handle = getHandle(env, obj); nReturn = ogg_page_version(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_Page_getVersion(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_ogg_Page * Method: isContinued * Signature: ()Z */ JNIEXPORT jboolean JNICALL Java_org_tritonus_lowlevel_ogg_Page_isContinued (JNIEnv* env, jobject obj) { ogg_page* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_Page_isContinued(): begin\n"); } handle = getHandle(env, obj); nReturn = ogg_page_continued(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_Page_isContinued(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_ogg_Page * Method: getPackets * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_ogg_Page_getPackets (JNIEnv* env, jobject obj) { ogg_page* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_Page_getPackets(): begin\n"); } handle = getHandle(env, obj); nReturn = ogg_page_packets(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_Page_getPackets(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_ogg_Page * Method: isBos * Signature: ()Z */ JNIEXPORT jboolean JNICALL Java_org_tritonus_lowlevel_ogg_Page_isBos (JNIEnv* env, jobject obj) { ogg_page* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_Page_isBos(): begin\n"); } handle = getHandle(env, obj); nReturn = ogg_page_bos(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_Page_isBos(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_ogg_Page * Method: isEos * Signature: ()Z */ JNIEXPORT jboolean JNICALL Java_org_tritonus_lowlevel_ogg_Page_isEos (JNIEnv* env, jobject obj) { ogg_page* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_Page_isEos(): begin\n"); } handle = getHandle(env, obj); nReturn = ogg_page_eos(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_Page_isEos(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_ogg_Page * Method: getGranulePos * Signature: ()J */ JNIEXPORT jlong JNICALL Java_org_tritonus_lowlevel_ogg_Page_getGranulePos (JNIEnv* env, jobject obj) { ogg_page* handle; jlong lReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_Page_getGranulePos(): begin\n"); } handle = getHandle(env, obj); lReturn = ogg_page_granulepos(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_Page_getGranulePos(): end\n"); } return lReturn; } /* * Class: org_tritonus_lowlevel_ogg_Page * Method: getSerialNo * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_ogg_Page_getSerialNo (JNIEnv* env, jobject obj) { ogg_page* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_Page_getSerialNo(): begin\n"); } handle = getHandle(env, obj); nReturn = ogg_page_serialno(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_Page_getSerialNo(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_ogg_Page * Method: getPageNo * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_ogg_Page_getPageNo (JNIEnv* env, jobject obj) { ogg_page* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_Page_getPageNo(): begin\n"); } handle = getHandle(env, obj); nReturn = ogg_page_pageno(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_Page_getPageNo(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_ogg_Page * Method: setChecksum * Signature: ()V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_ogg_Page_setChecksum (JNIEnv* env, jobject obj) { ogg_page* handle; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_Page_setChecksum(): begin\n"); } handle = getHandle(env, obj); ogg_page_checksum_set(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_Page_setChecksum(): end\n"); } } /* * Class: org_tritonus_lowlevel_ogg_Page * Method: getHeader * Signature: ()[B */ JNIEXPORT jbyteArray JNICALL Java_org_tritonus_lowlevel_ogg_Page_getHeader (JNIEnv* env, jobject obj) { ogg_page* handle; jbyteArray byteArray; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_Page_getHeader(): begin\n"); } handle = getHandle(env, obj); byteArray = (*env)->NewByteArray(env, handle->header_len); (*env)->SetByteArrayRegion(env, byteArray, 0, handle->header_len, (jbyte*) (handle->header)); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_Page_getHeader(): end\n"); } return byteArray; } /* * Class: org_tritonus_lowlevel_ogg_Page * Method: getBody * Signature: ()[B */ JNIEXPORT jbyteArray JNICALL Java_org_tritonus_lowlevel_ogg_Page_getBody (JNIEnv* env, jobject obj) { ogg_page* handle; jbyteArray byteArray; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_Page_getBody(): begin\n"); } handle = getHandle(env, obj); byteArray = (*env)->NewByteArray(env, handle->body_len); (*env)->SetByteArrayRegion(env, byteArray, 0, handle->body_len, (jbyte*) (handle->body)); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_Page_getBody(): end\n"); } return byteArray; } /* * Class: org_tritonus_lowlevel_ogg_Page * Method: setTrace * Signature: (Z)V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_ogg_Page_setTrace (JNIEnv* env, jclass cls, jboolean bTrace) { debug_flag = bTrace; debug_file = stderr; } /*** org_tritonus_lowlevel_ogg_Page.c ***/ libtritonus-java-20070428/src/lib/vorbis/org_tritonus_lowlevel_ogg_StreamState.c0000644000175000017500000002262507672160004030052 0ustar twernertwerner/* * org_tritonus_lowlevel_ogg_StreamState.c */ /* * Copyright (c) 2003 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ #include "common.h" #include "org_tritonus_lowlevel_ogg_StreamState.h" HandleFieldHandlerDeclaration(handler, ogg_stream_state*) ogg_packet* getPacketNativeHandle(JNIEnv *env, jobject obj); ogg_page* getPageNativeHandle(JNIEnv *env, jobject obj); /* * Class: org_tritonus_lowlevel_ogg_StreamState * Method: malloc * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_ogg_StreamState_malloc (JNIEnv* env, jobject obj) { ogg_stream_state* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_StreamState_malloc(): begin\n"); } handle = malloc(sizeof(ogg_stream_state)); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_StreamState_malloc(): handle: %p\n", handle); } setHandle(env, obj, handle); nReturn = (handle == NULL) ? -1 : 0; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_StreamState_malloc(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_ogg_StreamState * Method: free * Signature: ()V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_ogg_StreamState_free (JNIEnv* env, jobject obj) { ogg_stream_state* handle; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_StreamState_free(): begin\n"); } handle = getHandle(env, obj); free(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_StreamState_free(): end\n"); } } /* * Class: org_tritonus_lowlevel_ogg_StreamState * Method: init * Signature: (I)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_ogg_StreamState_init (JNIEnv* env, jobject obj, jint nSerialNo) { ogg_stream_state* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_StreamState_init(): begin\n"); } handle = getHandle(env, obj); nReturn = ogg_stream_init(handle, nSerialNo); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_StreamState_init(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_ogg_StreamState * Method: clear * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_ogg_StreamState_clear (JNIEnv* env, jobject obj) { ogg_stream_state* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_StreamState_clear(): begin\n"); } handle = getHandle(env, obj); nReturn = ogg_stream_clear(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_StreamState_clear(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_ogg_StreamState * Method: reset * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_ogg_StreamState_reset (JNIEnv* env, jobject obj) { ogg_stream_state* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_StreamState_reset(): begin\n"); } handle = getHandle(env, obj); nReturn = ogg_stream_reset(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_StreamState_reset(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_ogg_StreamState * Method: destroy * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_ogg_StreamState_destroy (JNIEnv* env, jobject obj) { ogg_stream_state* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_StreamState_destroy(): begin\n"); } handle = getHandle(env, obj); nReturn = ogg_stream_destroy(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_StreamState_destroy(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_ogg_StreamState * Method: isEOSReached * Signature: ()Z */ JNIEXPORT jboolean JNICALL Java_org_tritonus_lowlevel_ogg_StreamState_isEOSReached (JNIEnv* env, jobject obj) { ogg_stream_state* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_StreamState_isEOSReached(): begin\n"); } handle = getHandle(env, obj); nReturn = ogg_stream_eos(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_StreamState_isEOSReached(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_ogg_StreamState * Method: packetIn * Signature: (Lorg/tritonus/lowlevel/ogg/Packet;)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_ogg_StreamState_packetIn (JNIEnv* env, jobject obj, jobject packet) { ogg_stream_state* handle; ogg_packet* packetHandle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_StreamState_packetIn(): begin\n"); } handle = getHandle(env, obj); packetHandle = getPacketNativeHandle(env, packet); nReturn = ogg_stream_packetin(handle, packetHandle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_StreamState_packetIn(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_ogg_StreamState * Method: pageOut * Signature: (Lorg/tritonus/lowlevel/ogg/Page;)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_ogg_StreamState_pageOut (JNIEnv* env, jobject obj, jobject page) { ogg_stream_state* handle; ogg_page* pageHandle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_StreamState_pageOut(): begin\n"); } handle = getHandle(env, obj); pageHandle = getPageNativeHandle(env, page); nReturn = ogg_stream_pageout(handle, pageHandle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_StreamState_pageOut(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_ogg_StreamState * Method: flush * Signature: (Lorg/tritonus/lowlevel/ogg/Page;)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_ogg_StreamState_flush (JNIEnv* env, jobject obj, jobject page) { ogg_stream_state* handle; ogg_page* pageHandle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_StreamState_flush(): begin\n"); } handle = getHandle(env, obj); pageHandle = getPageNativeHandle(env, page); nReturn = ogg_stream_flush(handle, pageHandle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_StreamState_flush(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_ogg_StreamState * Method: pageIn * Signature: (Lorg/tritonus/lowlevel/ogg/Page;)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_ogg_StreamState_pageIn (JNIEnv* env, jobject obj, jobject page) { ogg_stream_state* handle; ogg_page* pageHandle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_StreamState_pageIn(): begin\n"); } handle = getHandle(env, obj); pageHandle = getPageNativeHandle(env, page); nReturn = ogg_stream_pagein(handle, pageHandle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_StreamState_pageIn(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_ogg_StreamState * Method: packetOut * Signature: (Lorg/tritonus/lowlevel/ogg/Packet;)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_ogg_StreamState_packetOut (JNIEnv* env, jobject obj, jobject packet) { ogg_stream_state* handle; ogg_packet* packetHandle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_StreamState_packetOut(): begin\n"); } handle = getHandle(env, obj); packetHandle = getPacketNativeHandle(env, packet); nReturn = ogg_stream_packetout(handle, packetHandle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_StreamState_packetOut(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_ogg_StreamState * Method: packetPeek * Signature: (Lorg/tritonus/lowlevel/ogg/Packet;)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_ogg_StreamState_packetPeek (JNIEnv* env, jobject obj, jobject packet) { ogg_stream_state* handle; ogg_packet* packetHandle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_StreamState_packetPeek(): begin\n"); } handle = getHandle(env, obj); packetHandle = getPacketNativeHandle(env, packet); nReturn = ogg_stream_packetpeek(handle, packetHandle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_StreamState_packetPeek(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_ogg_StreamState * Method: setTrace * Signature: (Z)V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_ogg_StreamState_setTrace (JNIEnv* env, jclass cls, jboolean bTrace) { debug_flag = bTrace; debug_file = stderr; } /*** org_tritonus_lowlevel_ogg_StreamState.c ***/ libtritonus-java-20070428/src/lib/vorbis/org_tritonus_lowlevel_ogg_SyncState.c0000644000175000017500000001474110370106025027523 0ustar twernertwerner/* * org_tritonus_lowlevel_ogg_SyncState.c */ /* * Copyright (c) 2003 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ #include "common.h" #include "org_tritonus_lowlevel_ogg_SyncState.h" HandleFieldHandlerDeclaration(handler, ogg_sync_state*) ogg_page* getPageNativeHandle(JNIEnv *env, jobject obj); /* * Class: org_tritonus_lowlevel_ogg_SyncState * Method: malloc * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_ogg_SyncState_malloc (JNIEnv* env, jobject obj) { ogg_sync_state* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_SyncState_malloc(): begin\n"); } handle = malloc(sizeof(ogg_sync_state)); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_SyncState_malloc(): handle: %p\n", handle); } setHandle(env, obj, handle); nReturn = (handle == NULL) ? -1 : 0; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_SyncState_malloc(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_ogg_SyncState * Method: free * Signature: ()V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_ogg_SyncState_free (JNIEnv* env, jobject obj) { ogg_sync_state* handle; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_SyncState_free(): begin\n"); } handle = getHandle(env, obj); free(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_SyncState_free(): end\n"); } } /* * Class: org_tritonus_lowlevel_ogg_SyncState * Method: init * Signature: ()V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_ogg_SyncState_init (JNIEnv* env, jobject obj) { ogg_sync_state* handle; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_SyncState_init(): begin\n"); } handle = getHandle(env, obj); ogg_sync_init(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_SyncState_init(): end\n"); } } /* * Class: org_tritonus_lowlevel_ogg_SyncState * Method: clear * Signature: ()V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_ogg_SyncState_clear (JNIEnv* env, jobject obj) { ogg_sync_state* handle; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_SyncState_clear(): begin\n"); } handle = getHandle(env, obj); ogg_sync_clear(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_SyncState_clear(): end\n"); } } /* * Class: org_tritonus_lowlevel_ogg_SyncState * Method: reset * Signature: ()V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_ogg_SyncState_reset (JNIEnv* env, jobject obj) { ogg_sync_state* handle; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_SyncState_reset(): begin\n"); } handle = getHandle(env, obj); ogg_sync_reset(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_SyncState_reset(): end\n"); } } /* * Class: org_tritonus_lowlevel_ogg_SyncState * Method: destroy * Signature: ()V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_ogg_SyncState_destroy (JNIEnv* env, jobject obj) { ogg_sync_state* handle; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_SyncState_destroy(): begin\n"); } handle = getHandle(env, obj); ogg_sync_destroy(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_SyncState_destroy(): end\n"); } } /* * Class: org_tritonus_lowlevel_ogg_SyncState * Method: write * Signature: ([BI)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_ogg_SyncState_write (JNIEnv* env, jobject obj, jbyteArray abBuffer, jint nBytes) { ogg_sync_state* handle; char* buffer; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_SyncState_write(): begin\n"); } handle = getHandle(env, obj); buffer = ogg_sync_buffer(handle, nBytes); (*env)->GetByteArrayRegion(env, abBuffer, 0, nBytes, (jbyte*) buffer); nReturn = ogg_sync_wrote(handle, nBytes); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_SyncState_write(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_ogg_SyncState * Method: pageseek * Signature: (Lorg/tritonus/lowlevel/ogg/Page;)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_ogg_SyncState_pageseek (JNIEnv* env, jobject obj, jobject page) { ogg_sync_state* handle; ogg_page* pageHandle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_SyncState_pageseek(): begin\n"); } handle = getHandle(env, obj); pageHandle = getPageNativeHandle(env, page); nReturn = ogg_sync_pageseek(handle, pageHandle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_SyncState_pageseek(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_ogg_SyncState * Method: pageOut * Signature: (Lorg/tritonus/lowlevel/ogg/Page;)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_ogg_SyncState_pageOut (JNIEnv* env, jobject obj, jobject page) { ogg_sync_state* handle; ogg_page* pageHandle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_SyncState_pageOut(): begin\n"); } handle = getHandle(env, obj); pageHandle = getPageNativeHandle(env, page); nReturn = ogg_sync_pageout(handle, pageHandle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_ogg_SyncState_pageOut(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_ogg_SyncState * Method: setTrace * Signature: (Z)V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_ogg_SyncState_setTrace (JNIEnv* env, jclass cls, jboolean bTrace) { debug_flag = bTrace; debug_file = stderr; } /*** org_tritonus_lowlevel_ogg_SyncState.c ***/ libtritonus-java-20070428/src/lib/vorbis/org_tritonus_lowlevel_vorbis_Block.c0000644000175000017500000001400007672160004027364 0ustar twernertwerner/* * org_tritonus_lowlevel_vorbis_Block.c */ /* * Copyright (c) 2003 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ #include "common.h" #include "org_tritonus_lowlevel_vorbis_Block.h" HandleFieldHandlerDeclaration(handler, vorbis_block*) vorbis_block* getBlockNativeHandle(JNIEnv *env, jobject obj) { return getHandle(env, obj); } vorbis_dsp_state* getDspStateNativeHandle(JNIEnv *env, jobject obj); ogg_packet* getPacketNativeHandle(JNIEnv *env, jobject obj); /* * Class: org_tritonus_lowlevel_vorbis_Block * Method: malloc * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_vorbis_Block_malloc (JNIEnv* env, jobject obj) { vorbis_block* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_vorbis_Block_malloc(): begin\n"); } handle = malloc(sizeof(vorbis_block)); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_vorbis_Block_malloc(): handle: %p\n", handle); } setHandle(env, obj, handle); nReturn = (handle == NULL) ? -1 : 0; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_vorbis_Block_malloc(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_vorbis_Block * Method: free * Signature: ()V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_vorbis_Block_free (JNIEnv* env, jobject obj) { vorbis_block* handle; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_vorbis_Block_free(): begin\n"); } handle = getHandle(env, obj); free(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_vorbis_Block_free(): end\n"); } } /* * Class: org_tritonus_lowlevel_vorbis_Block * Method: init * Signature: (Lorg/tritonus/lowlevel/vorbis/DspState;)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_vorbis_Block_init (JNIEnv* env, jobject obj, jobject dspState) { vorbis_block* handle; vorbis_dsp_state* dspStateHandle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_vorbis_Block_init(): begin\n"); } handle = getHandle(env, obj); dspStateHandle = getDspStateNativeHandle(env, dspState); nReturn = vorbis_block_init(dspStateHandle, handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_vorbis_Block_init(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_vorbis_Block * Method: addBlock * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_vorbis_Block_addBlock (JNIEnv* env, jobject obj) { vorbis_block* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_vorbis_Block_addBlock(): begin\n"); } handle = getHandle(env, obj); nReturn = vorbis_bitrate_addblock(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_vorbis_Block_addBlock(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_vorbis_Block * Method: analysis * Signature: (Lorg/tritonus/lowlevel/ogg/Packet;)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_vorbis_Block_analysis (JNIEnv* env, jobject obj, jobject packet) { vorbis_block* handle; ogg_packet* packetHandle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_vorbis_DspState_analysis(): begin\n"); } handle = getHandle(env, obj); packetHandle = NULL; if (packet != NULL) { packetHandle = getPacketNativeHandle(env, packet); } nReturn = vorbis_analysis(handle, packetHandle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_vorbis_DspState_analysis(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_vorbis_Block * Method: synthesis * Signature: (Lorg/tritonus/lowlevel/ogg/Packet;)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_vorbis_Block_synthesis (JNIEnv* env, jobject obj, jobject packet) { vorbis_block* handle; ogg_packet* packetHandle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_vorbis_Block_synthesis(): begin\n"); } handle = getHandle(env, obj); packetHandle = NULL; if (packet != NULL) { packetHandle = getPacketNativeHandle(env, packet); } if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_vorbis_Block_synthesis(): packet handle: %p\n", packetHandle); } nReturn = vorbis_synthesis(handle, packetHandle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_vorbis_Block_synthesis(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_vorbis_Block * Method: clear * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_vorbis_Block_clear (JNIEnv* env, jobject obj) { vorbis_block* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_vorbis_Block_clear(): begin\n"); } handle = getHandle(env, obj); nReturn = vorbis_block_clear(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_vorbis_Block_clear(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_vorbis_Block * Method: setTrace * Signature: (Z)V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_vorbis_Block_setTrace (JNIEnv* env, jclass cls, jboolean bTrace) { debug_flag = bTrace; debug_file = stderr; } /*** org_tritonus_lowlevel_vorbis_Block.c ***/ libtritonus-java-20070428/src/lib/vorbis/org_tritonus_lowlevel_vorbis_Comment.c0000644000175000017500000002023407672160004027742 0ustar twernertwerner/* * org_tritonus_lowlevel_vorbis_Comment.c */ /* * Copyright (c) 2003 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ #include "common.h" #include "org_tritonus_lowlevel_vorbis_Comment.h" HandleFieldHandlerDeclaration(handler, vorbis_comment*) vorbis_comment* getCommentNativeHandle(JNIEnv *env, jobject obj) { return getHandle(env, obj); } /* * Class: org_tritonus_lowlevel_vorbis_Comment * Method: malloc * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_vorbis_Comment_malloc (JNIEnv* env, jobject obj) { vorbis_comment* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_vorbis_Comment_malloc(): begin\n"); } handle = malloc(sizeof(vorbis_comment)); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_vorbis_Comment_malloc(): handle: %p\n", handle); } setHandle(env, obj, handle); nReturn = (handle == NULL) ? -1 : 0; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_vorbis_Comment_malloc(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_vorbis_Comment * Method: free * Signature: ()V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_vorbis_Comment_free (JNIEnv* env, jobject obj) { vorbis_comment* handle; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_vorbis_Comment_free(): begin\n"); } handle = getHandle(env, obj); free(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_vorbis_Comment_free(): end\n"); } } /* * Class: org_tritonus_lowlevel_vorbis_Comment * Method: init * Signature: ()V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_vorbis_Comment_init (JNIEnv* env, jobject obj) { vorbis_comment* handle; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_vorbis_Comment_init(): begin\n"); } handle = getHandle(env, obj); vorbis_comment_init(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_vorbis_Comment_init(): end\n"); } } /* * Class: org_tritonus_lowlevel_vorbis_Comment * Method: addComment * Signature: (Ljava/lang/String;)V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_vorbis_Comment_addComment (JNIEnv* env, jobject obj, jstring strComment) { vorbis_comment* handle; const char* comment; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_vorbis_Comment_addComment(): begin\n"); } handle = getHandle(env, obj); comment = (*env)->GetStringUTFChars(env, strComment, NULL); vorbis_comment_add(handle, (char*) comment); (*env)->ReleaseStringUTFChars(env, strComment, comment); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_vorbis_Comment_addComment(): end\n"); } } /* * Class: org_tritonus_lowlevel_vorbis_Comment * Method: addTag * Signature: (Ljava/lang/String;Ljava/lang/String;)V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_vorbis_Comment_addTag (JNIEnv* env, jobject obj, jstring strTag, jstring strComment) { vorbis_comment* handle; const char* tag; const char* comment; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_vorbis_Comment_addTag(): begin\n"); } handle = getHandle(env, obj); tag = (*env)->GetStringUTFChars(env, strTag, NULL); comment = (*env)->GetStringUTFChars(env, strComment, NULL); vorbis_comment_add_tag(handle, (char*) tag, (char*) comment); (*env)->ReleaseStringUTFChars(env, strComment, comment); (*env)->ReleaseStringUTFChars(env, strTag, tag); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_vorbis_Comment_addTag(): end\n"); } } /* * Class: org_tritonus_lowlevel_vorbis_Comment * Method: queryCount * Signature: (Ljava/lang/String;)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_vorbis_Comment_queryCount (JNIEnv* env, jobject obj, jstring strTag) { vorbis_comment* handle; const char* tag; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_vorbis_Comment_queryCount(): begin\n"); } handle = getHandle(env, obj); tag = (*env)->GetStringUTFChars(env, strTag, NULL); nReturn = vorbis_comment_query_count(handle, (char*) tag); (*env)->ReleaseStringUTFChars(env, strTag, tag); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_vorbis_Comment_queryCount(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_vorbis_Comment * Method: query * Signature: (Ljava/lang/String;I)Ljava/lang/String; */ JNIEXPORT jstring JNICALL Java_org_tritonus_lowlevel_vorbis_Comment_query (JNIEnv* env, jobject obj, jstring strTag, jint nIndex) { vorbis_comment* handle; const char* tag; char* result; jstring strReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_vorbis_Comment_query(): begin\n"); } handle = getHandle(env, obj); tag = (*env)->GetStringUTFChars(env, strTag, NULL); result = vorbis_comment_query(handle, (char*) tag, nIndex); (*env)->ReleaseStringUTFChars(env, strTag, tag); strReturn = (*env)->NewStringUTF(env, result); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_vorbis_Comment_query(): end\n"); } return strReturn; } /* * Class: org_tritonus_lowlevel_vorbis_Comment * Method: getUserComments * Signature: ()[Ljava/lang/String; */ JNIEXPORT jobjectArray JNICALL Java_org_tritonus_lowlevel_vorbis_Comment_getUserComments (JNIEnv* env, jobject obj) { vorbis_comment* handle; jclass stringClass; jobjectArray stringArray; int i; jstring string; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_vorbis_Comment_getUserComments(): begin\n"); } stringClass = (*env)->FindClass(env, "java/lang/String"); handle = getHandle(env, obj); stringArray = (*env)->NewObjectArray(env, handle->comments, stringClass, NULL); for (i = 0; i < handle->comments; i++) { string = (*env)->NewStringUTF(env, handle->user_comments[i]); (*env)->SetObjectArrayElement(env, stringArray, i, string); } if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_vorbis_Comment_getUserComments(): end\n"); } return stringArray; } /* * Class: org_tritonus_lowlevel_vorbis_Comment * Method: getVendor * Signature: ()Ljava/lang/String; */ JNIEXPORT jstring JNICALL Java_org_tritonus_lowlevel_vorbis_Comment_getVendor (JNIEnv* env, jobject obj) { vorbis_comment* handle; jstring strReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_vorbis_Comment_getVendor(): begin\n"); } handle = getHandle(env, obj); strReturn = (*env)->NewStringUTF(env, handle->vendor); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_vorbis_Comment_getVendor(): end\n"); } return strReturn; } /* * Class: org_tritonus_lowlevel_vorbis_Comment * Method: clear * Signature: ()V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_vorbis_Comment_clear (JNIEnv* env, jobject obj) { vorbis_comment* handle; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_vorbis_Comment_clear(): begin\n"); } handle = getHandle(env, obj); vorbis_comment_clear(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_vorbis_Comment_clear(): end\n"); } } /* * Class: org_tritonus_lowlevel_vorbis_Comment * Method: setTrace * Signature: (Z)V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_vorbis_Comment_setTrace (JNIEnv* env, jclass cls, jboolean bTrace) { debug_flag = bTrace; debug_file = stderr; } /*** org_tritonus_lowlevel_vorbis_Comment.c ***/ libtritonus-java-20070428/src/lib/vorbis/org_tritonus_lowlevel_vorbis_DspState.c0000644000175000017500000002767707677507701030127 0ustar twernertwerner/* * org_tritonus_lowlevel_vorbis_DspState.c */ /* * Copyright (c) 2003 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ #include "common.h" #include "org_tritonus_lowlevel_vorbis_DspState.h" HandleFieldHandlerDeclaration(handler, vorbis_dsp_state*) vorbis_dsp_state* getDspStateNativeHandle(JNIEnv *env, jobject obj) { return getHandle(env, obj); } vorbis_info* getInfoNativeHandle(JNIEnv *env, jobject obj); vorbis_comment* getCommentNativeHandle(JNIEnv *env, jobject obj); vorbis_block* getBlockNativeHandle(JNIEnv *env, jobject obj); ogg_packet* getPacketNativeHandle(JNIEnv *env, jobject obj); /* * Class: org_tritonus_lowlevel_vorbis_DspState * Method: malloc * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_vorbis_DspState_malloc (JNIEnv* env, jobject obj) { vorbis_dsp_state* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_vorbis_DspState_malloc(): begin\n"); } handle = malloc(sizeof(vorbis_dsp_state)); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_vorbis_DspState_malloc(): handle: %p\n", handle); } setHandle(env, obj, handle); nReturn = (handle == NULL) ? -1 : 0; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_vorbis_DspState_malloc(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_vorbis_DspState * Method: free * Signature: ()V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_vorbis_DspState_free (JNIEnv* env, jobject obj) { vorbis_dsp_state* handle; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_vorbis_DspState_free(): begin\n"); } handle = getHandle(env, obj); free(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_vorbis_DspState_free(): end\n"); } } /* * Class: org_tritonus_lowlevel_vorbis_DspState * Method: initAnalysis * Signature: (Lorg/tritonus/lowlevel/vorbis/Info;)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_vorbis_DspState_initAnalysis (JNIEnv* env, jobject obj, jobject info) { vorbis_dsp_state* handle; vorbis_info* infoHandle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_vorbis_DspState_initAnalysis(): begin\n"); } handle = getHandle(env, obj); infoHandle = getInfoNativeHandle(env, info); nReturn = vorbis_analysis_init(handle, infoHandle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_vorbis_DspState_initAnalysis(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_vorbis_DspState * Method: headerOut * Signature: (Lorg/tritonus/lowlevel/vorbis/Comment;Lorg/tritonus/lowlevel/ogg/Packet;Lorg/tritonus/lowlevel/ogg/Packet;Lorg/tritonus/lowlevel/ogg/Packet;)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_vorbis_DspState_headerOut (JNIEnv* env, jobject obj, jobject comment, jobject packet, jobject commentPacket, jobject codePacket) { vorbis_dsp_state* handle; vorbis_comment* commentHandle; ogg_packet* packetHandle; ogg_packet* commentPacketHandle; ogg_packet* codePacketHandle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_vorbis_DspState_headerOut(): begin\n"); } handle = getHandle(env, obj); commentHandle = getCommentNativeHandle(env, comment); packetHandle = getPacketNativeHandle(env, packet); commentPacketHandle = getPacketNativeHandle(env, commentPacket); codePacketHandle = getPacketNativeHandle(env, codePacket); nReturn = vorbis_analysis_headerout(handle, commentHandle, packetHandle, commentPacketHandle, codePacketHandle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_vorbis_DspState_headerOut(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_vorbis_DspState * Method: write * Signature: ([[FI)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_vorbis_DspState_write (JNIEnv* env, jobject obj, jobjectArray afValues, jint nValues) { vorbis_dsp_state* handle; float* bufferPointer; int nObjectArrayLength; int i; jfloatArray floatArray; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_vorbis_DspState_write(): begin\n"); } handle = getHandle(env, obj); bufferPointer = vorbis_analysis_buffer(handle, nValues)[0]; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_vorbis_DspState_write(): bufferPointer: %p\n", bufferPointer); } if (afValues != NULL) { nObjectArrayLength = (*env)->GetArrayLength(env, afValues); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_vorbis_DspState_write(): objectArray length: %d\n", nObjectArrayLength); } for (i = 0; i < nObjectArrayLength; i++) { floatArray = (jfloatArray) (*env)->GetObjectArrayElement(env, afValues, i); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_vorbis_DspState_write(): floatArray: %p\n", floatArray); } (*env)->GetFloatArrayRegion(env, floatArray, 0, nValues, bufferPointer); bufferPointer += nValues; } } nReturn = vorbis_analysis_wrote(handle, nValues); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_vorbis_DspState_write(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_vorbis_DspState * Method: blockOut * Signature: (Lorg/tritonus/lowlevel/vorbis/Block;)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_vorbis_DspState_blockOut (JNIEnv* env, jobject obj, jobject block) { vorbis_dsp_state* handle; vorbis_block* blockHandle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_vorbis_DspState_blockOut(): begin\n"); } handle = getHandle(env, obj); blockHandle = getBlockNativeHandle(env, block); nReturn = vorbis_analysis_blockout(handle, blockHandle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_vorbis_DspState_blockOut(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_vorbis_DspState * Method: flushPacket * Signature: (Lorg/tritonus/lowlevel/ogg/Packet;)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_vorbis_DspState_flushPacket (JNIEnv* env, jobject obj, jobject packet) { vorbis_dsp_state* handle; ogg_packet* packetHandle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_vorbis_DspState_flushPacket(): begin\n"); } handle = getHandle(env, obj); packetHandle = getPacketNativeHandle(env, packet); nReturn = vorbis_bitrate_flushpacket(handle, packetHandle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_vorbis_DspState_flushPacket(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_vorbis_DspState * Method: initSynthesis * Signature: (Lorg/tritonus/lowlevel/vorbis/Info;)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_vorbis_DspState_initSynthesis (JNIEnv* env, jobject obj, jobject info) { vorbis_dsp_state* handle; vorbis_info* infoHandle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_vorbis_DspState_initSynthesis(): begin\n"); } handle = getHandle(env, obj); infoHandle = getInfoNativeHandle(env, info); nReturn = vorbis_synthesis_init(handle, infoHandle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_vorbis_DspState_initSynthesis(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_vorbis_DspState * Method: blockIn * Signature: (Lorg/tritonus/lowlevel/vorbis/Block;)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_vorbis_DspState_blockIn (JNIEnv* env, jobject obj, jobject block) { vorbis_dsp_state* handle; vorbis_block* blockHandle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_vorbis_DspState_blockIn(): begin\n"); } handle = getHandle(env, obj); blockHandle = getBlockNativeHandle(env, block); nReturn = vorbis_synthesis_blockin(handle, blockHandle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_vorbis_DspState_blockIn(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_vorbis_DspState * Method: pcmOut * Signature: ([[F)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_vorbis_DspState_pcmOut (JNIEnv* env, jobject obj, jobjectArray afPcm) { vorbis_dsp_state* handle; float** pcm; int nSamples; int nChannels; int nChannel; jfloatArray floatArray; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_vorbis_DspState_pcmOut(): begin\n"); } handle = getHandle(env, obj); nSamples = vorbis_synthesis_pcmout(handle, &pcm); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_vorbis_DspState_pcmOut(): samples: %d\n", nSamples); } nChannels = handle->vi->channels; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_vorbis_DspState_pcmOut(): channels: %d\n", nChannels); } for (nChannel = 0; nChannel < nChannels; nChannel++) { floatArray = (*env)->NewFloatArray(env, nSamples); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_vorbis_DspState_pcmOut(): float array: %p\n", floatArray); } if (nSamples > 0) { (*env)->SetFloatArrayRegion(env, floatArray, 0, nSamples, pcm[nChannel]); } (*env)->SetObjectArrayElement(env, afPcm, nChannel, floatArray); } if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_vorbis_DspState_pcmOut(): end\n"); } return nSamples; } /* * Class: org_tritonus_lowlevel_vorbis_DspState * Method: read * Signature: (I)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_vorbis_DspState_read (JNIEnv* env, jobject obj, jint nSamples) { vorbis_dsp_state* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_vorbis_DspState_read(): begin\n"); } handle = getHandle(env, obj); nReturn = vorbis_synthesis_read(handle, nSamples); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_vorbis_DspState_read(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_vorbis_DspState * Method: getSequence * Signature: ()J */ JNIEXPORT jlong JNICALL Java_org_tritonus_lowlevel_vorbis_DspState_getSequence (JNIEnv* env, jobject obj) { vorbis_dsp_state* handle; jlong lReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_vorbis_DspState_getSequence(): begin\n"); } handle = getHandle(env, obj); lReturn = handle->sequence; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_vorbis_DspState_getSequence(): end\n"); } return lReturn; } /* * Class: org_tritonus_lowlevel_vorbis_DspState * Method: clear * Signature: ()V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_vorbis_DspState_clear (JNIEnv* env, jobject obj) { vorbis_dsp_state* handle; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_vorbis_DspState_clear(): begin\n"); } handle = getHandle(env, obj); vorbis_dsp_clear(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_vorbis_DspState_clear(): end\n"); } } /* * Class: org_tritonus_lowlevel_vorbis_DspState * Method: setTrace * Signature: (Z)V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_vorbis_DspState_setTrace (JNIEnv* env, jclass cls, jboolean bTrace) { debug_flag = bTrace; debug_file = stderr; } /*** org_tritonus_lowlevel_vorbis_DspState.c ***/ libtritonus-java-20070428/src/lib/vorbis/org_tritonus_lowlevel_vorbis_Info.c0000644000175000017500000001542307672160004027237 0ustar twernertwerner/* * org_tritonus_lowlevel_vorbis_Info.c */ /* * Copyright (c) 2003 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ #include "common.h" #include "org_tritonus_lowlevel_vorbis_Info.h" HandleFieldHandlerDeclaration(handler, vorbis_info*) vorbis_info* getInfoNativeHandle(JNIEnv *env, jobject obj) { return getHandle(env, obj); } vorbis_comment* getCommentNativeHandle(JNIEnv *env, jobject obj); ogg_packet* getPacketNativeHandle(JNIEnv *env, jobject obj); /* * Class: org_tritonus_lowlevel_vorbis_Info * Method: malloc * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_vorbis_Info_malloc (JNIEnv* env, jobject obj) { vorbis_info* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_vorbis_Info_malloc(): begin\n"); } handle = malloc(sizeof(vorbis_info)); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_vorbis_Info_malloc(): handle: %p\n", handle); } setHandle(env, obj, handle); nReturn = (handle == NULL) ? -1 : 0; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_vorbis_Info_malloc(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_vorbis_Info * Method: free * Signature: ()V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_vorbis_Info_free (JNIEnv* env, jobject obj) { vorbis_info* handle; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_vorbis_Info_free(): begin\n"); } handle = getHandle(env, obj); free(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_vorbis_Info_free(): end\n"); } } /* * Class: org_tritonus_lowlevel_vorbis_Info * Method: init * Signature: ()V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_vorbis_Info_init (JNIEnv* env, jobject obj) { vorbis_info* handle; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_vorbis_Info_init(): begin\n"); } handle = getHandle(env, obj); vorbis_info_init(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_vorbis_Info_init(): end\n"); } } /* * Class: org_tritonus_lowlevel_vorbis_Info * Method: clear * Signature: ()V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_vorbis_Info_clear (JNIEnv* env, jobject obj) { vorbis_info* handle; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_vorbis_Info_clear(): begin\n"); } handle = getHandle(env, obj); vorbis_info_clear(handle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_vorbis_Info_clear(): end\n"); } } /* * Class: org_tritonus_lowlevel_vorbis_Info * Method: getChannels * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_vorbis_Info_getChannels (JNIEnv* env, jobject obj) { vorbis_info* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_vorbis_Info_getChannels(): begin\n"); } handle = getHandle(env, obj); nReturn = handle->channels; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_vorbis_Info_getChannels(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_vorbis_Info * Method: getRate * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_vorbis_Info_getRate (JNIEnv* env, jobject obj) { vorbis_info* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_vorbis_Info_getRate(): begin\n"); } handle = getHandle(env, obj); nReturn = handle->rate; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_vorbis_Info_getRate(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_vorbis_Info * Method: encodeInit * Signature: (IIIII)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_vorbis_Info_encodeInit (JNIEnv* env, jobject obj, jint nChannels, jint nRate, jint nMaxBitrate, jint nNominalBitrate, jint nMinBitrate) { vorbis_info* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_vorbis_Info_encodeInit(): begin\n"); } handle = getHandle(env, obj); nReturn = vorbis_encode_init(handle, nChannels, nRate, nMaxBitrate, nNominalBitrate, nMinBitrate); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_vorbis_Info_encodeInit(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_vorbis_Info * Method: encodeInitVBR * Signature: (IIF)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_vorbis_Info_encodeInitVBR (JNIEnv* env, jobject obj, jint nChannels, jint nRate, jfloat fQuality) { vorbis_info* handle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_vorbis_Info_encodeInitVBR(): begin\n"); } handle = getHandle(env, obj); nReturn = vorbis_encode_init_vbr(handle, nChannels, nRate, fQuality); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_vorbis_Info_encodeInitVBR(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_vorbis_Info * Method: headerIn * Signature: (Lorg/tritonus/lowlevel/vorbis/Comment;Lorg/tritonus/lowlevel/ogg/Packet;)I */ JNIEXPORT jint JNICALL Java_org_tritonus_lowlevel_vorbis_Info_headerIn (JNIEnv* env, jobject obj, jobject comment, jobject packet) { vorbis_info* handle; vorbis_comment* commentHandle; ogg_packet* packetHandle; int nReturn; if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_vorbis_Info_headerIn(): begin\n"); } handle = getHandle(env, obj); commentHandle = getCommentNativeHandle(env, comment); packetHandle = getPacketNativeHandle(env, packet); nReturn = vorbis_synthesis_headerin(handle, commentHandle, packetHandle); if (debug_flag) { fprintf(debug_file, "Java_org_tritonus_lowlevel_vorbis_Info_headerIn(): end\n"); } return nReturn; } /* * Class: org_tritonus_lowlevel_vorbis_Info * Method: setTrace * Signature: (Z)V */ JNIEXPORT void JNICALL Java_org_tritonus_lowlevel_vorbis_Info_setTrace (JNIEnv* env, jclass cls, jboolean bTrace) { debug_flag = bTrace; debug_file = stderr; } /*** org_tritonus_lowlevel_vorbis_Info.c ***/ libtritonus-java-20070428/src/misc/0000755000175000017500000000000010621572602016740 5ustar twernertwernerlibtritonus-java-20070428/src/misc/saol.grammar0000644000175000017500000001615707472111331021256 0ustar twernertwernerPackage org.tritonus.saol.sablecc; Helpers all = [0 .. 127]; tab = 9; lf = 10; cr = 13; digit = ['0' .. '9']; nondigit = ['_' + [['a' .. 'z'] + ['A' .. 'Z']]]; s_char = [all - ['"' + ['\' + [cr + lf]]]]; s_char_sequence = s_char+; Tokens aopcode = 'aopcode'; asig = 'asig'; else = 'else'; exports = 'exports'; extend = 'extend'; global = 'global'; if = 'if'; imports = 'imports'; inchannels = 'inchannels'; instr = 'instr'; interp = 'interp'; iopcode = 'iopcode'; ivar = 'ivar'; kopcode = 'kopcode'; krate = 'krate'; ksig = 'ksig'; map = 'map'; oparray = 'oparray'; opcode = 'opcode'; outbus = 'outbus'; outchannels = 'outchannels'; output = 'output'; preset = 'preset'; return = 'return'; route = 'route'; send = 'send'; sequence = 'sequence'; sasbf = 'sasbf'; spatialize = 'spatialize'; srate = 'srate'; table = 'table'; tablemap = 'tablemap'; template = 'template'; turnoff = 'turnoff'; while = 'while'; with = 'with'; xsig = 'xsig'; and = '&&'; or = '||'; gteq = '>='; lteq = '<='; neq = '!='; eq = '=='; minus = '-'; mult = '*'; div = '/'; plus = '+'; gt = '>'; lt = '<'; quest_mark = '?'; colon = ':'; l_par = '('; r_par = ')'; l_brace = '{'; r_brace = '}'; l_bracket = '['; r_bracket = ']'; semicolon = ';'; comma = ','; assign = '='; excl_mark = '!'; comment = '/' '/' [all - [lf + cr]]* (lf | cr | cr lf); string = '"' s_char_sequence '"'; identifier = nondigit (digit | nondigit)*; integer = digit+; number = digit+ ('.' digit*)?; blank = (' ' | tab | cr | lf)+; Ignored Tokens blank, comment; Productions // - orcfile = {orcfile} proc*; // - proc = {instrdecl} instrdecl | {opcodedecl} opcodedecl | {globaldecl} globaldecl | {templatedecl} templatedecl; // I instrdecl = {instrdecl} instr identifier l_par identlist? r_par miditag? l_brace vardecl* block r_brace; // I miditag = {miditag} preset int_list; // I int_list = {int_list} integer*; // O opcodedecl = {opcodedecl} optype identifier l_par paramlist? r_par l_brace opvardecl* block r_brace; // O optype = {aopcode} aopcode | {kopcode} kopcode | {iopcode} iopcode | {opcode} opcode; // O paramlist = {paramlist} paramdecl paramlist_tail*; // O paramlist_tail = {paramlist_tail} comma paramdecl; // O paramdecl = {paramdecl} stype name; // G globaldecl = {globaldecl} global l_brace globaldef* r_brace; // G globaldef = {rtparam} rtparam | {routedef} routedef| {senddef} senddef | {seqdef} seqdef | {vardecl} vardecl; // G rtparam = {srate} srate integer semicolon | {krate} krate integer semicolon | {inchannels} inchannels integer semicolon | {outchannels} outchannels integer semicolon | {interp} interp integer semicolon; // G routedef = {routedef} route l_par identifier comma identlist? r_par semicolon; // G senddef = {senddef} send l_par identifier [semicolon1]: semicolon exprlist? [semicolon2]: semicolon identlist? r_par [semicolon3]: semicolon; // G seqdef = {seqdef} sequence l_par identlist? r_par semicolon; // T templatedecl = {templatedecl} template lt [identlist1]: identlist? gt preset_clause? l_par [identlist2]: identlist? r_par map [l_brace1]: l_brace [identlist3]: identlist? [r_brace1]: r_brace with [l_brace2]: l_brace mapblock? [r_brace2]: r_brace [l_brace3]: l_brace vardecl* block [r_brace3]: r_brace; // T preset_clause = {preset_clause} preset mapblock?; // T mapblock = {mapblock} lt terminal_list gt mapblock_tail*; // T mapblock_tail = {mapblock_tail} comma lt terminal_list gt; // T terminal_list = {terminal_list} terminal terminal_list_tail*; // T terminal_list_tail = {terminal_list_tail} comma terminal; // T terminal = {identifier} identifier | {constant} const | {string} string; // IOT block = {block} statement*; // IOT statement = {assignment} lvalue assign expr semicolon | {expression} expr semicolon | {if} if l_par expr r_par l_brace block r_brace | {if_else} if l_par expr r_par [l_brace1]: l_brace [block1]: block [r_brace1]: r_brace else [l_brace2]: l_brace [block2]: block [r_brace2]: r_brace | {while} while l_par expr r_par l_brace block r_brace | {instrument} instr identifier l_par exprlist? r_par semicolon | {output} output l_par exprlist? r_par semicolon | {spatialize} spatialize l_par exprlist? r_par semicolon | {outbus} outbus l_par identifier comma exprlist? r_par semicolon | {extend} extend l_par expr r_par semicolon | {turnoff} turnoff semicolon | {return} return l_par expr r_par semicolon; // IOT lvalue = {simple} identifier | {indexed} identifier l_bracket expr r_bracket; // IGT (-> IOGT) identlist = {identlist} identifier identlist_tail*; // IGT (-> IOGT) identlist_tail = {identlist_tail} comma identifier; // IGT (-> IOGT) vardecl = {opvardecl} opvardecl | {tablemap} tablemap identifier l_par identlist? r_par semicolon; // IOGT opvardecl = {sigvar} taglist? stype namelist semicolon | {tablevar} taglist table namelist semicolon | {table} tabledecl semicolon; // IOGT taglist = {imports} imports | {exports} exports | {importsexports} imports exports | {exportsimports} exports imports; // IOGT stype = {ivar} ivar | {ksig} ksig | {asig} asig | {xsig} xsig | {oparray} oparray; // IOGT tabledecl = {tabledecl} table [identifier1]: identifier l_par [identifier2]: identifier comma exprstrlist r_par; // IOGT namelist = {namelist} name namelist_tail*; // IOGT namelist_tail = {namelist_tail} comma name; // IOGT name = {simple} identifier | {indexed} identifier l_bracket integer r_bracket | {inchannels} identifier l_bracket inchannels r_bracket | {outchannels} identifier l_bracket outchannels r_bracket; // IOGT expr = {orexpr} orexpr | {alt} [orexpr1]: orexpr quest_mark [orexpr2]: orexpr colon [orexpr3]: orexpr; // IOGT orexpr = {andexpr} andexpr | {or} orexpr or andexpr; // IOGT andexpr = {equalityexpr} equalityexpr | {and} andexpr and equalityexpr; // IOGT equalityexpr = {relationalexpr} relationalexpr | {neq} equalityexpr neq relationalexpr | {eq} equalityexpr eq relationalexpr; // IOGT relationalexpr = {addexpr} addexpr | {gt} relationalexpr gt addexpr | {lt} relationalexpr lt addexpr | {lteq} relationalexpr lteq addexpr | {gteq} relationalexpr gteq addexpr; // IOGT addexpr = {factor} factor | {plus} addexpr plus factor | {minus} addexpr minus factor; // IOGT factor = {term} unaryminusterm | {mult} factor mult unaryminusterm | {div} factor div unaryminusterm; // IOGT unaryminusterm = {term} notterm | {not} minus notterm; // IOGT notterm = {term} term | {not} excl_mark term; // IOGT term = {identifier} identifier | {constant} const | {indexed} identifier l_bracket expr r_bracket | {sasbf} sasbf l_par exprlist? r_par | {function} identifier l_par exprlist? r_par | {indexedfunction} identifier l_bracket expr r_bracket l_par exprlist? r_par | {paren} l_par expr r_par; // IOGT exprlist = {exprlist} expr exprlist_tail*; // IOGT exprlist_tail = {exprlist_tail} comma expr; // IOGT exprstrlist = {exprstrlist} expr_or_string exprstrlist_tail*; // IOGT exprstrlist_tail = {exprstrlist_tail} comma expr_or_string; // IOGT expr_or_string = {expr} expr | {string} string; // IOGT const = {integer} integer | {number} number; // end libtritonus-java-20070428/src/org/0000755000175000017500000000000010621572627016603 5ustar twernertwernerlibtritonus-java-20070428/src/org/tritonus/0000755000175000017500000000000010621572627020472 5ustar twernertwernerlibtritonus-java-20070428/src/org/tritonus/sampled/0000755000175000017500000000000010621572635022116 5ustar twernertwernerlibtritonus-java-20070428/src/org/tritonus/sampled/cdda/0000755000175000017500000000000010621572630023004 5ustar twernertwernerlibtritonus-java-20070428/src/org/tritonus/sampled/cdda/CddaDataConnection.java0000644000175000017500000000564710374176126027335 0ustar twernertwerner/* * CddaDataConnection.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2001 - 2002 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.sampled.cdda; import java.io.InputStream; import java.io.IOException; import java.net.URL; import java.net.URLConnection; import javax.sound.sampled.AudioFormat; import org.tritonus.lowlevel.cdda.CddaMidLevel; import org.tritonus.lowlevel.cdda.CddaUtils; import org.tritonus.share.TDebug; public class CddaDataConnection extends URLConnection { private static int PCM_FRAMES_PER_CDDA_FRAME = 588; private static AudioFormat CDDA_FORMAT = new AudioFormat( AudioFormat.Encoding.PCM_SIGNED, 44100.0F, 16, 2, 4, 44100.0F, false); /** The cdda device name to read from. */ private String m_strDevice; /** Track to read from the CD. */ private int m_nTrack; private CddaMidLevel m_cddaMidLevel; public CddaDataConnection(URL url) { super(url); if (TDebug.TraceCdda) { TDebug.out("CddaDataConnection.(): begin"); } m_strDevice = url.getFile(); String strTrack = url.getRef(); m_nTrack = Integer.parseInt(strTrack); if (TDebug.TraceCdda) { TDebug.out("CddaDataConnection.(): end"); } } public void connect() { if (TDebug.TraceCdda) { TDebug.out("CddaDataConnection.connect(): begin"); } if (! connected) { m_cddaMidLevel = CddaUtils.getCddaMidLevel(); if (m_strDevice.equals("")) { m_strDevice = m_cddaMidLevel.getDefaultDevice(); } connected = true; } if (TDebug.TraceCdda) { TDebug.out("CddaDataConnection.connect(): end"); } } public InputStream getInputStream() throws IOException { if (TDebug.TraceCdda) { TDebug.out("CddaDataConnection.getInputStream(): begin"); } connect(); String strDevice = getDevice(); int nTrack = getTrack(); InputStream inputStream = m_cddaMidLevel.getTrack(strDevice, nTrack); if (TDebug.TraceCdda) { TDebug.out("CddaDataConnection.getInputStream(): end"); } return inputStream; } private String getDevice() { return m_strDevice; } private int getTrack() { return m_nTrack; } } /*** CddaDataConnection.java ****/ libtritonus-java-20070428/src/org/tritonus/sampled/cdda/CddaDriveListConnection.java0000644000175000017500000000533210150707571030354 0ustar twernertwerner/* * CddaDriveListConnection.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2001 - 2002 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.sampled.cdda; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.InputStream; import java.io.IOException; import java.io.PrintStream; import java.net.URL; import java.net.URLConnection; import java.util.Iterator; import org.tritonus.lowlevel.cdda.CddaMidLevel; import org.tritonus.lowlevel.cdda.CddaUtils; import org.tritonus.share.TDebug; public class CddaDriveListConnection extends URLConnection { private CddaMidLevel m_cddaMidLevel; // TODO: m_cdda.close(); public CddaDriveListConnection(URL url) { super(url); if (TDebug.TraceCdda) { TDebug.out("CddaDriveListConnection.(): begin"); } if (TDebug.TraceCdda) { TDebug.out("CddaDriveListConnection.(): end"); } } public void connect() { if (TDebug.TraceCdda) { TDebug.out("CddaDriveListConnection.connect(): begin"); } if (! connected) { m_cddaMidLevel = CddaUtils.getCddaMidLevel(); connected = true; } if (TDebug.TraceCdda) { TDebug.out("CddaDriveListConnection.connect(): end"); } } public InputStream getInputStream() throws IOException { if (TDebug.TraceCdda) { TDebug.out("CddaDriveListConnection.getInputStream(): begin"); } connect(); Iterator drivesIterator = m_cddaMidLevel.getDevices(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); PrintStream out = new PrintStream(baos); while (drivesIterator.hasNext()) { String strDrive = (String) drivesIterator.next(); out.print(strDrive + "\n"); } byte[] abData = baos.toByteArray(); baos.close(); ByteArrayInputStream bais = new ByteArrayInputStream(abData); if (TDebug.TraceCdda) { TDebug.out("CddaDriveListConnection.getInputStream(): end"); } return bais; } } /*** CddaDriveListConnection.java ****/ libtritonus-java-20070428/src/org/tritonus/sampled/cdda/CddaStreamHandler.java0000644000175000017500000000333410150707571027160 0ustar twernertwerner/* * CddaStreamHandler.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2001 - 2002 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.sampled.cdda; import java.net.URL; import java.net.URLConnection; import java.net.URLStreamHandler; import org.tritonus.share.TDebug; public class CddaStreamHandler extends URLStreamHandler { public URLConnection openConnection(URL url) { if (TDebug.TraceCdda) { TDebug.out("CddaStreamHandler.openConnection():begin"); } URLConnection connection = null; if (url.getFile().equals("")) { connection = new CddaDriveListConnection(url); } else if (url.getRef() == null) { connection = new CddaTocConnection(url); } else { connection = new CddaDataConnection(url); } if (TDebug.TraceCdda) { TDebug.out("CddaStreamHandler.openConnection():end"); } return connection; } } /*** CddaStreamHandler.java ****/ libtritonus-java-20070428/src/org/tritonus/sampled/cdda/CddaTocConnection.java0000644000175000017500000000476510150707571027205 0ustar twernertwerner/* * CddaTocConnection.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2001 - 2002 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.sampled.cdda; import java.io.InputStream; import java.io.IOException; import java.net.URL; import java.net.URLConnection; import org.tritonus.lowlevel.cdda.CddaMidLevel; import org.tritonus.lowlevel.cdda.CddaUtils; import org.tritonus.share.TDebug; public class CddaTocConnection extends URLConnection { /** The cdda device name to read from. */ private String m_strDevice; private CddaMidLevel m_cddaMidLevel; // TODO: m_cdda.close(); public CddaTocConnection(URL url) { super(url); if (TDebug.TraceCdda) { TDebug.out("CddaTocConnection.(): begin"); } m_strDevice = url.getPath(); if (TDebug.TraceCdda) { TDebug.out("CddaTocConnection.(): end"); } } public void connect() { if (TDebug.TraceCdda) { TDebug.out("CddaTocConnection.connect(): begin"); } if (! connected) { m_cddaMidLevel = CddaUtils.getCddaMidLevel(); if (m_strDevice.equals("")) { m_strDevice = m_cddaMidLevel.getDefaultDevice(); } connected = true; } if (TDebug.TraceCdda) { TDebug.out("CddaTocConnection.connect(): end"); } } public InputStream getInputStream() throws IOException { if (TDebug.TraceCdda) { TDebug.out("CddaTocConnection.getInputStream(): begin"); } connect(); String strDevice = getDevice(); InputStream inputStream = m_cddaMidLevel.getTocAsXml(strDevice); if (TDebug.TraceCdda) { TDebug.out("CddaTocConnection.getInputStream(): end"); } return inputStream; } private String getDevice() { return m_strDevice; } } /*** CddaTocConnection.java ****/ libtritonus-java-20070428/src/org/tritonus/sampled/cdda/CddaURLStreamHandlerFactory.java0000644000175000017500000000305610150707571031074 0ustar twernertwerner/* * CddaURLStreamHandlerFactory.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 2001 - 2002 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.sampled.cdda; import java.net.URLStreamHandler; import java.net.URLStreamHandlerFactory; public class CddaURLStreamHandlerFactory implements URLStreamHandlerFactory { private static URLStreamHandler m_cddaHandler = null; public URLStreamHandler createURLStreamHandler(String strProtocol) { URLStreamHandler handler = null; if (strProtocol.equals("cdda")) { if (m_cddaHandler == null) { m_cddaHandler = new CddaStreamHandler(); } handler = m_cddaHandler; } return handler; } } /*** CddaURLStreamHandlerFactory.java ****/ libtritonus-java-20070428/src/org/tritonus/sampled/cdda/package.html0000644000175000017500000000036007676563224025303 0ustar twernertwerner

"High-level" interface to CDDA reading. The classes provided here .

@see org.tritonus.lowlevel.cdda libtritonus-java-20070428/src/org/tritonus/sampled/README0000644000175000017500000000063007413322202022761 0ustar twernertwernercdda/ Classes that implement the high-level (URL based) interface to reading of audio CDs. convert/ Classes derived from javax.sound.sampled.spi.FormatConversionProvider. file/ Classes derived from javax.sound.sampled.spi.AudioFileReader or javax.sound.sampled.spi.AudioFileWriter. mixer/ Classes that implement javax.sound.sampled.Mixer and classes derived from javax.sound.sampled.spi.MixerProvider.libtritonus-java-20070428/src/org/tritonus/sampled/convert/0000755000175000017500000000000010621572631023572 5ustar twernertwernerlibtritonus-java-20070428/src/org/tritonus/sampled/convert/javalayer/0000755000175000017500000000000010621572631025550 5ustar twernertwerner././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootlibtritonus-java-20070428/src/org/tritonus/sampled/convert/javalayer/MpegFormatConversionProvider.javalibtritonus-java-20070428/src/org/tritonus/sampled/convert/javalayer/MpegFormatConversionProvider.ja0000644000175000017500000003121610375317046033714 0ustar twernertwerner/* * MpegFormatConversionProvider.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999 - 2004 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.sampled.convert.javalayer; import java.io.InputStream; import java.io.IOException; import java.util.Arrays; import javax.sound.sampled.AudioFormat; import javax.sound.sampled.AudioInputStream; import javax.sound.sampled.AudioSystem; import org.tritonus.share.TDebug; import org.tritonus.share.sampled.TConversionTool; import org.tritonus.share.sampled.convert.TEncodingFormatConversionProvider; import org.tritonus.share.sampled.convert.TAsynchronousFilteredAudioInputStream; import javazoom.jl.decoder.Bitstream; import javazoom.jl.decoder.BitstreamException; import javazoom.jl.decoder.Decoder; import javazoom.jl.decoder.DecoderException; import javazoom.jl.decoder.Header; import javazoom.jl.decoder.Obuffer; /** * ConversionProvider for decoding of mp3 files. * * @author Matthias Pfisterer */ public class MpegFormatConversionProvider extends TEncodingFormatConversionProvider { // only used as abbreviation public static final AudioFormat.Encoding MPEG1L1 = new AudioFormat.Encoding("MPEG1L1"); public static final AudioFormat.Encoding MPEG1L2 = new AudioFormat.Encoding("MPEG1L2"); public static final AudioFormat.Encoding MPEG1L3 = new AudioFormat.Encoding("MPEG1L3"); public static final AudioFormat.Encoding MPEG2L1 = new AudioFormat.Encoding("MPEG2L1"); public static final AudioFormat.Encoding MPEG2L2 = new AudioFormat.Encoding("MPEG2L2"); public static final AudioFormat.Encoding MPEG2L3 = new AudioFormat.Encoding("MPEG2L3"); public static final AudioFormat.Encoding MPEG2DOT5L1 = new AudioFormat.Encoding("MPEG2DOT5L1"); public static final AudioFormat.Encoding MPEG2DOT5L2 = new AudioFormat.Encoding("MPEG2DOT5L2"); public static final AudioFormat.Encoding MPEG2DOT5L3 = new AudioFormat.Encoding("MPEG2DOT5L3"); private static final AudioFormat.Encoding PCM_SIGNED = AudioFormat.Encoding.PCM_SIGNED; /* TODO: mechanism to make the double specification with different endianess obsolete. */ private static final AudioFormat[] INPUT_FORMATS = { // mono new AudioFormat(MPEG1L1, -1.0F, -1, 1, -1, -1.0F, false), new AudioFormat(MPEG1L1, -1.0F, -1, 1, -1, -1.0F, true), // stereo new AudioFormat(MPEG1L1, -1.0F, -1, 2, -1, -1.0F, false), new AudioFormat(MPEG1L1, -1.0F, -1, 2, -1, -1.0F, true), // mono new AudioFormat(MPEG1L2, -1.0F, -1, 1, -1, -1.0F, false), new AudioFormat(MPEG1L2, -1.0F, -1, 1, -1, -1.0F, true), // stereo new AudioFormat(MPEG1L2, -1.0F, -1, 2, -1, -1.0F, false), new AudioFormat(MPEG1L2, -1.0F, -1, 2, -1, -1.0F, true), // mono new AudioFormat(MPEG1L3, -1.0F, -1, 1, -1, -1.0F, false), new AudioFormat(MPEG1L3, -1.0F, -1, 1, -1, -1.0F, true), // stereo new AudioFormat(MPEG1L3, -1.0F, -1, 2, -1, -1.0F, false), new AudioFormat(MPEG1L3, -1.0F, -1, 2, -1, -1.0F, true), // mono new AudioFormat(MPEG2L1, -1.0F, -1, 1, -1, -1.0F, false), new AudioFormat(MPEG2L1, -1.0F, -1, 1, -1, -1.0F, true), // stereo new AudioFormat(MPEG2L1, -1.0F, -1, 2, -1, -1.0F, false), new AudioFormat(MPEG2L1, -1.0F, -1, 2, -1, -1.0F, true), // mono new AudioFormat(MPEG2L2, -1.0F, -1, 1, -1, -1.0F, false), new AudioFormat(MPEG2L2, -1.0F, -1, 1, -1, -1.0F, true), // stereo new AudioFormat(MPEG2L2, -1.0F, -1, 2, -1, -1.0F, false), new AudioFormat(MPEG2L2, -1.0F, -1, 2, -1, -1.0F, true), // mono new AudioFormat(MPEG2L3, -1.0F, -1, 1, -1, -1.0F, false), new AudioFormat(MPEG2L3, -1.0F, -1, 1, -1, -1.0F, true), // stereo new AudioFormat(MPEG2L3, -1.0F, -1, 2, -1, -1.0F, false), new AudioFormat(MPEG2L3, -1.0F, -1, 2, -1, -1.0F, true), // mono new AudioFormat(MPEG2DOT5L1, -1.0F, -1, 1, -1, -1.0F, false), new AudioFormat(MPEG2DOT5L1, -1.0F, -1, 1, -1, -1.0F, true), // stereo new AudioFormat(MPEG2DOT5L1, -1.0F, -1, 2, -1, -1.0F, false), new AudioFormat(MPEG2DOT5L1, -1.0F, -1, 2, -1, -1.0F, true), // mono new AudioFormat(MPEG2DOT5L2, -1.0F, -1, 1, -1, -1.0F, false), new AudioFormat(MPEG2DOT5L2, -1.0F, -1, 1, -1, -1.0F, true), // stereo new AudioFormat(MPEG2DOT5L2, -1.0F, -1, 2, -1, -1.0F, false), new AudioFormat(MPEG2DOT5L2, -1.0F, -1, 2, -1, -1.0F, true), // mono new AudioFormat(MPEG2DOT5L3, -1.0F, -1, 1, -1, -1.0F, false), new AudioFormat(MPEG2DOT5L3, -1.0F, -1, 1, -1, -1.0F, true), // stereo new AudioFormat(MPEG2DOT5L3, -1.0F, -1, 2, -1, -1.0F, false), new AudioFormat(MPEG2DOT5L3, -1.0F, -1, 2, -1, -1.0F, true), }; private static final AudioFormat[] OUTPUT_FORMATS = { // mono, 16 bit signed new AudioFormat(PCM_SIGNED, -1.0F, 16, 1, 2, -1.0F, false), new AudioFormat(PCM_SIGNED, -1.0F, 16, 1, 2, -1.0F, true), // stereo, 16 bit signed new AudioFormat(PCM_SIGNED, -1.0F, 16, 2, 4, -1.0F, false), new AudioFormat(PCM_SIGNED, -1.0F, 16, 2, 4, -1.0F, true), /* 24 and 32 bit not yet possible // mono, 24 bit signed new AudioFormat(PCM_SIGNED, -1.0F, 24, 1, 3, -1.0F, false), new AudioFormat(PCM_SIGNED, -1.0F, 24, 1, 3, -1.0F, true), // stereo, 24 bit signed new AudioFormat(PCM_SIGNED, -1.0F, 24, 2, 6, -1.0F, false), new AudioFormat(PCM_SIGNED, -1.0F, 24, 2, 6, -1.0F, true), // mono, 32 bit signed new AudioFormat(PCM_SIGNED, -1.0F, 32, 1, 4, -1.0F, false), new AudioFormat(PCM_SIGNED, -1.0F, 32, 1, 4, -1.0F, true), // stereo, 32 bit signed new AudioFormat(PCM_SIGNED, -1.0F, 32, 2, 8, -1.0F, false), new AudioFormat(PCM_SIGNED, -1.0F, 32, 2, 8, -1.0F, true), */ }; // private static final boolean t = true; // private static final boolean f = false; /** Constructor. */ public MpegFormatConversionProvider() { super(Arrays.asList(INPUT_FORMATS), Arrays.asList(OUTPUT_FORMATS)/*, true, // new behaviour false*/); // bidirectional .. constants UNIDIR../BIDIR..? if (TDebug.TraceAudioConverter) { TDebug.out("MpegFormatConversionProvider.(): begin"); } if (TDebug.TraceAudioConverter) { TDebug.out("MpegFormatConversionProvider.(): end"); } } public AudioInputStream getAudioInputStream(AudioFormat targetFormat, AudioInputStream audioInputStream) { if (TDebug.TraceAudioConverter) { TDebug.out("MpegFormatConversionProvider.getAudioInputStream(AudioFormat, AudioInputStream):"); TDebug.out("trying to convert"); TDebug.out("\tfrom: " + audioInputStream.getFormat()); TDebug.out("\tto: " + targetFormat); } AudioFormat matchingFormat = getMatchingFormat( targetFormat, audioInputStream.getFormat()); // if (isConversionSupported(targetFormat, // audioInputStream.getFormat())) if (matchingFormat != null) { if (TDebug.TraceAudioConverter) { TDebug.out("MpegFormatConversionProvider.getAudioInputStream(AudioFormat, AudioInputStream):"); TDebug.out("\tisConversionSupported() accepted it; now setting up the conversion"); } targetFormat = setUnspecifiedFieldsFromProto(targetFormat, matchingFormat); if (TDebug.TraceAudioConverter) { TDebug.out("MpegFormatConversionProvider.getAudioInputStream(AudioFormat, AudioInputStream):"); TDebug.out("\tcompleted target format (1. stage): " + targetFormat); } targetFormat = setUnspecifiedFieldsFromProto(targetFormat, audioInputStream.getFormat()); if (TDebug.TraceAudioConverter) { TDebug.out("MpegFormatConversionProvider.getAudioInputStream(AudioFormat, AudioInputStream):"); TDebug.out("\tcompleted target format (2. stage): " + targetFormat); } return new DecodedMpegAudioInputStream( targetFormat, audioInputStream); } else { throw new IllegalArgumentException("conversion not supported"); } } // TODO: ask Florian if these methods are of general interest private static AudioFormat setUnspecifiedFieldsFromProto( AudioFormat incomplete, AudioFormat prototype) { AudioFormat format = new AudioFormat( incomplete.getEncoding(), getSpecificValue(incomplete.getSampleRate(), prototype.getSampleRate()), getSpecificValue(incomplete.getSampleSizeInBits(), prototype.getSampleSizeInBits()), getSpecificValue(incomplete.getChannels(), prototype.getChannels()), getSpecificValue(incomplete.getFrameSize(), prototype.getFrameSize()), getSpecificValue(incomplete.getFrameRate(), prototype.getFrameRate()), incomplete.isBigEndian()); return format; } private static float getSpecificValue(float fIncomplete, float fProto) { return (fIncomplete == AudioSystem.NOT_SPECIFIED) ? fProto : fIncomplete; } private static int getSpecificValue(int nIncomplete, int nProto) { return (nIncomplete == AudioSystem.NOT_SPECIFIED) ? nProto : nIncomplete; } public static class DecodedMpegAudioInputStream extends TAsynchronousFilteredAudioInputStream { private InputStream m_encodedStream; private Bitstream m_bitstream; private Decoder m_decoder; private DMAISObuffer m_oBuffer; public DecodedMpegAudioInputStream(AudioFormat outputFormat, AudioInputStream inputStream) { // TODO: try to find out length (possible?) super(outputFormat, AudioSystem.NOT_SPECIFIED); m_encodedStream = inputStream; m_bitstream = new Bitstream(inputStream); m_decoder = new Decoder(null); m_oBuffer = new DMAISObuffer(outputFormat.getChannels()); m_decoder.setOutputBuffer(m_oBuffer); } public void execute() { try { Header header = m_bitstream.readFrame(); if (header == null) { if (TDebug.TraceAudioConverter) { TDebug.out("header is null (end of mpeg stream)"); } getCircularBuffer().close(); return; } Obuffer decoderOutput = m_decoder.decodeFrame(header, m_bitstream); m_bitstream.closeFrame(); getCircularBuffer().write(m_oBuffer.getBuffer(), 0, m_oBuffer.getCurrentBufferSize()); m_oBuffer.reset(); } catch (BitstreamException e) { if (TDebug.TraceAudioConverter || TDebug.TraceAllExceptions) { TDebug.out(e); } } catch (DecoderException e) { if (TDebug.TraceAudioConverter || TDebug.TraceAllExceptions) { TDebug.out(e); } } } protected boolean isBigEndian() { return getFormat().isBigEndian(); } public void close() throws IOException { super.close(); m_encodedStream.close(); } private class DMAISObuffer extends Obuffer { private int m_nChannels; private byte[] m_abBuffer; private int[] m_anBufferPointers; private boolean m_bIsBigEndian; public DMAISObuffer(int nChannels) { m_nChannels = nChannels; m_abBuffer = new byte[OBUFFERSIZE * nChannels]; m_anBufferPointers = new int[nChannels]; reset(); m_bIsBigEndian = DecodedMpegAudioInputStream.this.isBigEndian(); } public void append(int nChannel, short sValue) { // TODO: replace by TConversionTool methods /* byte bFirstByte; byte bSecondByte; if (m_bIsBigEndian) { bFirstByte = (byte) ((sValue >>> 8) & 0xFF); bSecondByte = (byte) (sValue & 0xFF); } else // little endian { bFirstByte = (byte) (sValue & 0xFF); bSecondByte = (byte) ((sValue >>> 8) & 0xFF); } m_abBuffer[m_anBufferPointers[nChannel]] = bFirstByte; m_abBuffer[m_anBufferPointers[nChannel] + 1] = bSecondByte; */ TConversionTool.shortToBytes16(sValue, m_abBuffer, m_anBufferPointers[nChannel], m_bIsBigEndian); m_anBufferPointers[nChannel] += m_nChannels * 2; } public void set_stop_flag() { } public void close() { } public void write_buffer(int nValue) { } public void clear_buffer() { } public byte[] getBuffer() { return m_abBuffer; } public int getCurrentBufferSize() { return m_anBufferPointers[0]; } public void reset() { for (int i = 0; i < m_nChannels; i++) { /* Points to byte location, * implicitely assuming 16 bit * samples. */ m_anBufferPointers[i] = i * 2; } } } } } /*** MpegFormatConversionProvider.java ***/ libtritonus-java-20070428/src/org/tritonus/sampled/file/0000755000175000017500000000000010621572635023035 5ustar twernertwernerlibtritonus-java-20070428/src/org/tritonus/sampled/file/mpeg/0000755000175000017500000000000010621572635023765 5ustar twernertwernerlibtritonus-java-20070428/src/org/tritonus/sampled/file/mpeg/MpegAudioFileReader.java0000644000175000017500000001230610150707574030426 0ustar twernertwerner/* * MpegAudioFileReader.java * * This file is part of Tritonus: http://www.tritonus.org/ */ /* * Copyright (c) 1999 -2001 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* |<--- this code is formatted to fit into 80 columns --->| */ package org.tritonus.sampled.file.mpeg; import java.io.InputStream; import java.io.IOException; import java.io.EOFException; import javax.sound.sampled.AudioSystem; import javax.sound.sampled.AudioFormat; import javax.sound.sampled.AudioFileFormat; import javax.sound.sampled.UnsupportedAudioFileException; import org.tritonus.share.TDebug; import org.tritonus.share.sampled.file.TAudioFileFormat; import org.tritonus.share.sampled.file.TAudioFileReader; /* * @author Matthias Pfisterer */ public class MpegAudioFileReader extends TAudioFileReader { private static final int SYNC = 0xFFE00000; private static final AudioFormat.Encoding[][] sm_aEncodings = { {new AudioFormat.Encoding("MPEG2DOT5L3"), new AudioFormat.Encoding("MPEG2DOT5L2"), new AudioFormat.Encoding("MPEG2DOT5L1")}, {null, null, null}, /* reserved */ {new AudioFormat.Encoding("MPEG2L3"), new AudioFormat.Encoding("MPEG2L2"), new AudioFormat.Encoding("MPEG2L1")}, {new AudioFormat.Encoding("MPEG1L3"), new AudioFormat.Encoding("MPEG1L2"), new AudioFormat.Encoding("MPEG1L1")}, }; private static final float[][] sm_afSamplingRates = { {11025.0F, 12000.0F, 8000.0F}, {0.0F, 0.0F, 0.0F}, /* reserved */ {22050.0F, 24000.0F, 16000.0F}, {44100.0F, 48000.0F, 32000.0F}, }; private static final int MARK_LIMIT = 4; public MpegAudioFileReader() { super(MARK_LIMIT, true); } protected AudioFileFormat getAudioFileFormat(InputStream inputStream, long lFileSizeInBytes) throws UnsupportedAudioFileException, IOException { if (TDebug.TraceAudioFileReader) { TDebug.out("MpegAudioFileReader.getAudioFileFormat(): begin"); } int b0 = inputStream.read(); int b1 = inputStream.read(); int b2 = inputStream.read(); int b3 = inputStream.read(); if ((b0 | b1 | b2 | b3) < 0) { throw new EOFException(); } int nHeader = (b0 << 24) + (b1 << 16) + (b2 << 8) + (b3 << 0); /* * We check for the sync bits. If they are present, we * assume that we have an MPEG bitstream. */ if ((nHeader & SYNC) != SYNC) { throw new UnsupportedAudioFileException("not a MPEG stream: no sync bits"); } int nVersion = (nHeader >> 19) & 0x3; if (nVersion == 1) { throw new UnsupportedAudioFileException("not a MPEG stream: wrong version"); } int nLayer = (nHeader >> 17) & 0x3; if (nLayer == 0) { throw new UnsupportedAudioFileException("not a MPEG stream: wrong layer"); } AudioFormat.Encoding encoding = sm_aEncodings[nVersion][nLayer - 1]; // TODO: bit rate, protection int nSFIndex = (nHeader >> 10) & 0x3; if (nSFIndex == 3) { throw new UnsupportedAudioFileException("not a MPEG stream: wrong sampling rate"); } float fSamplingRate = sm_afSamplingRates[nVersion][nSFIndex]; int nMode = (nHeader >> 6) & 0x3; int nChannels = nMode == 3 ? 1 : 2; AudioFormat format = new AudioFormat( encoding, fSamplingRate, AudioSystem.NOT_SPECIFIED /*???*/, nChannels, AudioSystem.NOT_SPECIFIED /*????*/, AudioSystem.NOT_SPECIFIED /*????*/, true); //$$fb 2000-08-15: workaround for the fixed extension problem in AudioFileFormat.Type // see org.tritonus.share.sampled.AudioFileTypes.java AudioFileFormat.Type type = new AudioFileFormat.Type("MPEG", "mpeg"); if (encoding.equals(new AudioFormat.Encoding("MPEG1L3"))) { type = new AudioFileFormat.Type("MP3", "mp3"); } /* If the file size is known, we derive the number of frames ('frame size') from it. If the values don't fit into integers, we leave them at NOT_SPECIFIED. 'Unknown' is considered less incorrect than a wrong value. */ // [fb] not specifying it causes Sun's Wave file writer to write rubbish int nByteSize = AudioSystem.NOT_SPECIFIED; int nFrameSize = AudioSystem.NOT_SPECIFIED; if (lFileSizeInBytes != AudioSystem.NOT_SPECIFIED && lFileSizeInBytes <= Integer.MAX_VALUE) { nByteSize = (int) lFileSizeInBytes; // TODO: check if we can calculate a useful value here // nFrameSize = (int) (lFileSizeInBytes / 33); } AudioFileFormat audioFileFormat = new TAudioFileFormat( type, format, nFrameSize, nByteSize); if (TDebug.TraceAudioFileReader) { TDebug.out("MpegAudioFileReader.getAudioFileFormat(): end"); } return audioFileFormat; } } /*** MpegAudioFileReader.java ***/ libtritonus-java-20070428/src/packaging/0000755000175000017500000000000010621573005017727 5ustar twernertwernerlibtritonus-java-20070428/src/packaging/tritonus_alsa/0000755000175000017500000000000010621572732022624 5ustar twernertwernerlibtritonus-java-20070428/src/packaging/tritonus_alsa/META-INF/0000755000175000017500000000000010621572732023764 5ustar twernertwernerlibtritonus-java-20070428/src/packaging/tritonus_alsa/META-INF/services/0000755000175000017500000000000010621572732025607 5ustar twernertwerner././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootlibtritonus-java-20070428/src/packaging/tritonus_alsa/META-INF/services/javax.sound.midi.spi.MidiDeviceProviderlibtritonus-java-20070428/src/packaging/tritonus_alsa/META-INF/services/javax.sound.midi.spi.MidiDev0000644000175000017500000000024307452716726033037 0ustar twernertwerner# configuration file for the tritonus library # org.tritonus.midi.device.alsa.AlsaSequencerProvider org.tritonus.midi.device.alsa.AlsaMidiDeviceProvider # end # ././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootlibtritonus-java-20070428/src/packaging/tritonus_alsa/META-INF/services/javax.sound.sampled.spi.MixerProviderlibtritonus-java-20070428/src/packaging/tritonus_alsa/META-INF/services/javax.sound.sampled.spi.Mixe0000644000175000017500000000025207452716726033123 0ustar twernertwerner# configuration file for the tritonus library # org.tritonus.sampled.mixer.alsa.AlsaDataLineMixerProvider org.tritonus.sampled.mixer.alsa.AlsaPortMixerProvider # end # libtritonus-java-20070428/src/packaging/tritonus_alsa/manifest.mf0000644000175000017500000000011407452716726024765 0ustar twernertwernerManifest-Version: 1.0 Class-Path: tritonus_share.jar tritonus_remaining.jar libtritonus-java-20070428/src/packaging/tritonus_core/0000755000175000017500000000000010621572737022641 5ustar twernertwernerlibtritonus-java-20070428/src/packaging/tritonus_core/META-INF/0000755000175000017500000000000010621572737024001 5ustar twernertwernerlibtritonus-java-20070428/src/packaging/tritonus_core/META-INF/services/0000755000175000017500000000000010621572737025624 5ustar twernertwerner././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootlibtritonus-java-20070428/src/packaging/tritonus_core/META-INF/services/javax.sound.midi.spi.MidiDeviceProviderlibtritonus-java-20070428/src/packaging/tritonus_core/META-INF/services/javax.sound.midi.spi.MidiDev0000644000175000017500000000007207452711155033036 0ustar twernertwerner# configuration file for the tritonus library # # end # ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootlibtritonus-java-20070428/src/packaging/tritonus_core/META-INF/services/javax.sound.midi.spi.MidiFileReaderlibtritonus-java-20070428/src/packaging/tritonus_core/META-INF/services/javax.sound.midi.spi.MidiFil0000644000175000017500000000015007144606575033036 0ustar twernertwerner# configuration file for the tritonus library # org.tritonus.midi.file.StandardMidiFileReader # end # ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootlibtritonus-java-20070428/src/packaging/tritonus_core/META-INF/services/javax.sound.midi.spi.MidiFileWriterlibtritonus-java-20070428/src/packaging/tritonus_core/META-INF/services/javax.sound.midi.spi.MidiFil0000644000175000017500000000015007144606575033036 0ustar twernertwerner# configuration file for the tritonus library # org.tritonus.midi.file.StandardMidiFileWriter # end # ././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootlibtritonus-java-20070428/src/packaging/tritonus_core/META-INF/services/javax.sound.midi.spi.SoundbankReaderlibtritonus-java-20070428/src/packaging/tritonus_core/META-INF/services/javax.sound.midi.spi.Soundba0000644000175000017500000000007207452711155033110 0ustar twernertwerner# configuration file for the tritonus library # # end # ././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootlibtritonus-java-20070428/src/packaging/tritonus_core/META-INF/services/javax.sound.sampled.spi.AudioFileReaderlibtritonus-java-20070428/src/packaging/tritonus_core/META-INF/services/javax.sound.sampled.spi.Audi0000644000175000017500000000030207266367212033102 0ustar twernertwerner# configuration file for the tritonus library # org.tritonus.sampled.file.AuAudioFileReader org.tritonus.sampled.file.WaveAudioFileReader org.tritonus.sampled.file.AiffAudioFileReader # end # ././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootlibtritonus-java-20070428/src/packaging/tritonus_core/META-INF/services/javax.sound.sampled.spi.AudioFileWriterlibtritonus-java-20070428/src/packaging/tritonus_core/META-INF/services/javax.sound.sampled.spi.Audi0000644000175000017500000000030207266367212033102 0ustar twernertwerner# configuration file for the tritonus library # org.tritonus.sampled.file.AuAudioFileWriter org.tritonus.sampled.file.WaveAudioFileWriter org.tritonus.sampled.file.AiffAudioFileWriter # end # ././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootlibtritonus-java-20070428/src/packaging/tritonus_core/META-INF/services/javax.sound.sampled.spi.FormatConversionProviderlibtritonus-java-20070428/src/packaging/tritonus_core/META-INF/services/javax.sound.sampled.spi.Form0000644000175000017500000000063210042676347033127 0ustar twernertwerner# configuration file for the tritonus library # org.tritonus.sampled.convert.UlawFormatConversionProvider org.tritonus.sampled.convert.AlawFormatConversionProvider org.tritonus.sampled.convert.PCM2PCMConversionProvider #org.tritonus.sampled.convert.SmartFormatConversionProvider org.tritonus.sampled.convert.SampleRateConversionProvider #org.tritonus.sampled.convert.ImaAdpcmFormatConversionProvider # end # ././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootlibtritonus-java-20070428/src/packaging/tritonus_core/META-INF/services/javax.sound.sampled.spi.MixerProviderlibtritonus-java-20070428/src/packaging/tritonus_core/META-INF/services/javax.sound.sampled.spi.Mixe0000644000175000017500000000007207452711155033122 0ustar twernertwerner# configuration file for the tritonus library # # end # libtritonus-java-20070428/src/packaging/tritonus_core/manifest.mf0000644000175000017500000000013207177144236024770 0ustar twernertwernerManifest-Version: 1.0 Class-Path: tritonus_share.jar tritonus_remaining.jar javalayer.jar libtritonus-java-20070428/src/packaging/tritonus_esd/0000755000175000017500000000000010621572743022461 5ustar twernertwernerlibtritonus-java-20070428/src/packaging/tritonus_esd/META-INF/0000755000175000017500000000000010621572743023621 5ustar twernertwernerlibtritonus-java-20070428/src/packaging/tritonus_esd/META-INF/services/0000755000175000017500000000000010621572743025444 5ustar twernertwerner././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootlibtritonus-java-20070428/src/packaging/tritonus_esd/META-INF/services/javax.sound.sampled.spi.MixerProviderlibtritonus-java-20070428/src/packaging/tritonus_esd/META-INF/services/javax.sound.sampled.spi.Mixer0000644000175000017500000000015207452716726033137 0ustar twernertwerner# configuration file for the tritonus library # org.tritonus.sampled.mixer.esd.EsdMixerProvider # end # libtritonus-java-20070428/src/packaging/tritonus_esd/manifest.mf0000644000175000017500000000011307452716726024617 0ustar twernertwernerManifest-Version: 1.0 Class-Path: tritonus_share.jar tritonus_remaining.jarlibtritonus-java-20070428/src/packaging/tritonus_fluidsynth/0000755000175000017500000000000010621572746024102 5ustar twernertwernerlibtritonus-java-20070428/src/packaging/tritonus_fluidsynth/META-INF/0000755000175000017500000000000010621572746025242 5ustar twernertwernerlibtritonus-java-20070428/src/packaging/tritonus_fluidsynth/META-INF/services/0000755000175000017500000000000010621572746027065 5ustar twernertwerner././@LongLink0000000000000000000000000000016600000000000011570 Lustar rootrootlibtritonus-java-20070428/src/packaging/tritonus_fluidsynth/META-INF/services/javax.sound.midi.spi.MidiDeviceProviderlibtritonus-java-20070428/src/packaging/tritonus_fluidsynth/META-INF/services/javax.sound.midi.spi.M0000644000175000017500000000013610372177773033162 0ustar twernertwerner# for the fluidsynth synthesizer org.tritonus.midi.device.fluidsynth.FluidSynthesizerProvider libtritonus-java-20070428/src/packaging/tritonus_fluidsynth/manifest.mf0000644000175000017500000000006510372177772026240 0ustar twernertwernerManifest-Version: 1.0 Class-Path: tritonus_share.jar libtritonus-java-20070428/src/packaging/tritonus_gsm/0000755000175000017500000000000010621572754022476 5ustar twernertwernerlibtritonus-java-20070428/src/packaging/tritonus_gsm/META-INF/0000755000175000017500000000000010621572754023636 5ustar twernertwernerlibtritonus-java-20070428/src/packaging/tritonus_gsm/META-INF/services/0000755000175000017500000000000010621572755025462 5ustar twernertwerner././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootlibtritonus-java-20070428/src/packaging/tritonus_gsm/META-INF/services/javax.sound.sampled.spi.AudioFileReaderlibtritonus-java-20070428/src/packaging/tritonus_gsm/META-INF/services/javax.sound.sampled.spi.Audio0000644000175000017500000000010607144610525033112 0ustar twernertwerner# for the gsm codec org.tritonus.sampled.file.gsm.GSMAudioFileReader ././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootlibtritonus-java-20070428/src/packaging/tritonus_gsm/META-INF/services/javax.sound.sampled.spi.AudioFileWriterlibtritonus-java-20070428/src/packaging/tritonus_gsm/META-INF/services/javax.sound.sampled.spi.Audio0000644000175000017500000000010607145322133033106 0ustar twernertwerner# for the gsm codec org.tritonus.sampled.file.gsm.GSMAudioFileWriter ././@LongLink0000000000000000000000000000017000000000000011563 Lustar rootrootlibtritonus-java-20070428/src/packaging/tritonus_gsm/META-INF/services/javax.sound.sampled.spi.FormatConversionProviderlibtritonus-java-20070428/src/packaging/tritonus_gsm/META-INF/services/javax.sound.sampled.spi.Forma0000644000175000017500000000012107144610525033112 0ustar twernertwerner# for the gsm codec org.tritonus.sampled.convert.gsm.GSMFormatConversionProvider libtritonus-java-20070428/src/packaging/tritonus_gsm/manifest.mf0000644000175000017500000000006507177144236024633 0ustar twernertwernerManifest-Version: 1.0 Class-Path: tritonus_share.jar libtritonus-java-20070428/src/packaging/tritonus_javasequencer/0000755000175000017500000000000010621572762024543 5ustar twernertwernerlibtritonus-java-20070428/src/packaging/tritonus_javasequencer/META-INF/0000755000175000017500000000000010621572762025703 5ustar twernertwernerlibtritonus-java-20070428/src/packaging/tritonus_javasequencer/META-INF/services/0000755000175000017500000000000010621572762027526 5ustar twernertwerner././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootlibtritonus-java-20070428/src/packaging/tritonus_javasequencer/META-INF/services/javax.sound.midi.spi.MidiDeviceProviderlibtritonus-java-20070428/src/packaging/tritonus_javasequencer/META-INF/services/javax.sound.midi.sp0000644000175000017500000000011707332362163033247 0ustar twernertwerner# for the 'Java' Sequencer org.tritonus.midi.device.java.JavaSequencerProvider libtritonus-java-20070428/src/packaging/tritonus_javasequencer/manifest.mf0000644000175000017500000000006507332356323026674 0ustar twernertwernerManifest-Version: 1.0 Class-Path: tritonus_share.jar libtritonus-java-20070428/src/packaging/tritonus_jorbis/0000755000175000017500000000000010621572764023201 5ustar twernertwernerlibtritonus-java-20070428/src/packaging/tritonus_jorbis/META-INF/0000755000175000017500000000000010621572764024341 5ustar twernertwernerlibtritonus-java-20070428/src/packaging/tritonus_jorbis/META-INF/services/0000755000175000017500000000000010621572764026164 5ustar twernertwerner././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootlibtritonus-java-20070428/src/packaging/tritonus_jorbis/META-INF/services/javax.sound.sampled.spi.AudioFileReaderlibtritonus-java-20070428/src/packaging/tritonus_jorbis/META-INF/services/javax.sound.sampled.spi.Au0000644000175000017500000000011707672161117033126 0ustar twernertwerner# for the vorbis codec org.tritonus.sampled.file.jorbis.JorbisAudioFileReader ././@LongLink0000000000000000000000000000017300000000000011566 Lustar rootrootlibtritonus-java-20070428/src/packaging/tritonus_jorbis/META-INF/services/javax.sound.sampled.spi.FormatConversionProviderlibtritonus-java-20070428/src/packaging/tritonus_jorbis/META-INF/services/javax.sound.sampled.spi.Fo0000644000175000017500000000014307672161117033124 0ustar twernertwerner# for the jorbis decoder org.tritonus.sampled.convert.jorbis.JorbisFormatConversionProvider #end libtritonus-java-20070428/src/packaging/tritonus_jorbis/manifest.mf0000644000175000017500000000006507672161117025332 0ustar twernertwernerManifest-Version: 1.0 Class-Path: tritonus_share.jar libtritonus-java-20070428/src/packaging/tritonus_midishare/0000755000175000017500000000000010621572767023661 5ustar twernertwernerlibtritonus-java-20070428/src/packaging/tritonus_midishare/META-INF/0000755000175000017500000000000010621572767025021 5ustar twernertwernerlibtritonus-java-20070428/src/packaging/tritonus_midishare/META-INF/services/0000755000175000017500000000000010621572767026644 5ustar twernertwerner././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootlibtritonus-java-20070428/src/packaging/tritonus_midishare/META-INF/services/javax.sound.midi.spi.MidiDeviceProviderlibtritonus-java-20070428/src/packaging/tritonus_midishare/META-INF/services/javax.sound.midi.spi.Mi0000644000175000017500000000025307452716726033111 0ustar twernertwerner# configuration file for the tritonus library # org.tritonus.midi.device.midishare.MshSequencerProvider org.tritonus.midi.device.midishare.MshMidiDeviceProvider # end # libtritonus-java-20070428/src/packaging/tritonus_midishare/manifest.mf0000644000175000017500000000011407452716726026012 0ustar twernertwernerManifest-Version: 1.0 Class-Path: tritonus_share.jar tritonus_remaining.jar libtritonus-java-20070428/src/packaging/tritonus_mp3/0000755000175000017500000000000010621572773022410 5ustar twernertwernerlibtritonus-java-20070428/src/packaging/tritonus_mp3/META-INF/0000755000175000017500000000000010621572773023550 5ustar twernertwernerlibtritonus-java-20070428/src/packaging/tritonus_mp3/META-INF/services/0000755000175000017500000000000010621572773025373 5ustar twernertwerner././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootlibtritonus-java-20070428/src/packaging/tritonus_mp3/META-INF/services/javax.sound.sampled.spi.AudioFileReaderlibtritonus-java-20070428/src/packaging/tritonus_mp3/META-INF/services/javax.sound.sampled.spi.Audio0000644000175000017500000000012407266367212033032 0ustar twernertwerner# for the javalayer mp3 decoder org.tritonus.sampled.file.mpeg.MpegAudioFileReader ././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootlibtritonus-java-20070428/src/packaging/tritonus_mp3/META-INF/services/javax.sound.sampled.spi.AudioFileWriterlibtritonus-java-20070428/src/packaging/tritonus_mp3/META-INF/services/javax.sound.sampled.spi.Audio0000644000175000017500000000011707266367212033034 0ustar twernertwerner# for the lame mp3 encoder org.tritonus.sampled.file.mpeg.MpegAudioFileWriter ././@LongLink0000000000000000000000000000017000000000000011563 Lustar rootrootlibtritonus-java-20070428/src/packaging/tritonus_mp3/META-INF/services/javax.sound.sampled.spi.FormatConversionProviderlibtritonus-java-20070428/src/packaging/tritonus_mp3/META-INF/services/javax.sound.sampled.spi.Forma0000644000175000017500000000030107266367212033032 0ustar twernertwerner# for the javalayer mp3 decoder # and the lame mp3 encoder org.tritonus.sampled.convert.javalayer.MpegFormatConversionProvider org.tritonus.sampled.convert.lame.Mp3LameFormatConversionProvider libtritonus-java-20070428/src/packaging/tritonus_mp3/manifest.mf0000644000175000017500000000010307177144236024535 0ustar twernertwernerManifest-Version: 1.0 Class-Path: tritonus_share.jar javalayer.jar libtritonus-java-20070428/src/packaging/tritonus_pvorbis/0000755000175000017500000000000010621572776023400 5ustar twernertwernerlibtritonus-java-20070428/src/packaging/tritonus_pvorbis/META-INF/0000755000175000017500000000000010621572776024540 5ustar twernertwernerlibtritonus-java-20070428/src/packaging/tritonus_pvorbis/META-INF/services/0000755000175000017500000000000010621572776026363 5ustar twernertwerner././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootlibtritonus-java-20070428/src/packaging/tritonus_pvorbis/META-INF/services/javax.sound.sampled.spi.AudioFileReaderlibtritonus-java-20070428/src/packaging/tritonus_pvorbis/META-INF/services/javax.sound.sampled.spi.A0000644000175000017500000000012010167047446033130 0ustar twernertwerner# for the vorbis codec org.tritonus.sampled.file.pvorbis.VorbisAudioFileReader ././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootlibtritonus-java-20070428/src/packaging/tritonus_pvorbis/META-INF/services/javax.sound.sampled.spi.AudioFileWriterlibtritonus-java-20070428/src/packaging/tritonus_pvorbis/META-INF/services/javax.sound.sampled.spi.A0000644000175000017500000000012010167047447033131 0ustar twernertwerner# for the vorbis codec org.tritonus.sampled.file.pvorbis.VorbisAudioFileWriter ././@LongLink0000000000000000000000000000017400000000000011567 Lustar rootrootlibtritonus-java-20070428/src/packaging/tritonus_pvorbis/META-INF/services/javax.sound.sampled.spi.FormatConversionProviderlibtritonus-java-20070428/src/packaging/tritonus_pvorbis/META-INF/services/javax.sound.sampled.spi.F0000644000175000017500000000014210167047447033142 0ustar twernertwerner# for the vorbis codec org.tritonus.sampled.convert.pvorbis.VorbisFormatConversionProvider #end libtritonus-java-20070428/src/packaging/tritonus_pvorbis/manifest.mf0000644000175000017500000000006510167047446025527 0ustar twernertwernerManifest-Version: 1.0 Class-Path: tritonus_share.jar libtritonus-java-20070428/src/packaging/tritonus_src/0000755000175000017500000000000010621573001022461 5ustar twernertwernerlibtritonus-java-20070428/src/packaging/tritonus_src/META-INF/0000755000175000017500000000000010621573001023621 5ustar twernertwernerlibtritonus-java-20070428/src/packaging/tritonus_src/META-INF/services/0000755000175000017500000000000010621573001025444 5ustar twernertwerner././@LongLink0000000000000000000000000000017000000000000011563 Lustar rootrootlibtritonus-java-20070428/src/packaging/tritonus_src/META-INF/services/javax.sound.sampled.spi.FormatConversionProviderlibtritonus-java-20070428/src/packaging/tritonus_src/META-INF/services/javax.sound.sampled.spi.Forma0000644000175000017500000000016407453044217033124 0ustar twernertwerner# configuration file for the tritonus library # org.tritonus.sampled.convert.SampleRateConversionProvider # end # libtritonus-java-20070428/src/packaging/tritonus_src/manifest.mf0000644000175000017500000000013207452716726024634 0ustar twernertwernerManifest-Version: 1.0 Class-Path: tritonus_share.jar tritonus_remaining.jar javalayer.jar libtritonus-java-20070428/src/packaging/tritonus_vorbis/0000755000175000017500000000000010621573007023204 5ustar twernertwernerlibtritonus-java-20070428/src/packaging/tritonus_vorbis/META-INF/0000755000175000017500000000000010621573007024344 5ustar twernertwernerlibtritonus-java-20070428/src/packaging/tritonus_vorbis/META-INF/services/0000755000175000017500000000000010621573010026161 5ustar twernertwerner././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootlibtritonus-java-20070428/src/packaging/tritonus_vorbis/META-INF/services/javax.sound.sampled.spi.AudioFileReaderlibtritonus-java-20070428/src/packaging/tritonus_vorbis/META-INF/services/javax.sound.sampled.spi.Au0000644000175000017500000000011707424206670033141 0ustar twernertwerner# for the vorbis codec org.tritonus.sampled.file.vorbis.VorbisAudioFileReader ././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootlibtritonus-java-20070428/src/packaging/tritonus_vorbis/META-INF/services/javax.sound.sampled.spi.AudioFileWriterlibtritonus-java-20070428/src/packaging/tritonus_vorbis/META-INF/services/javax.sound.sampled.spi.Au0000644000175000017500000000011707424206670033141 0ustar twernertwerner# for the vorbis codec org.tritonus.sampled.file.vorbis.VorbisAudioFileWriter ././@LongLink0000000000000000000000000000017300000000000011566 Lustar rootrootlibtritonus-java-20070428/src/packaging/tritonus_vorbis/META-INF/services/javax.sound.sampled.spi.FormatConversionProviderlibtritonus-java-20070428/src/packaging/tritonus_vorbis/META-INF/services/javax.sound.sampled.spi.Fo0000644000175000017500000000014107672156570033145 0ustar twernertwerner# for the vorbis codec org.tritonus.sampled.convert.vorbis.VorbisFormatConversionProvider #end libtritonus-java-20070428/src/packaging/tritonus_vorbis/manifest.mf0000644000175000017500000000006507424206667025353 0ustar twernertwernerManifest-Version: 1.0 Class-Path: tritonus_share.jar libtritonus-java-20070428/.cvsignore0000644000175000017500000000030210540343310017201 0ustar twernertwernerMakefile config.cache config.status config.log configure *.jar dist build ChangeLog *.log autom4te.cache tritonus-*.tar.gz project.dtd aclocal.m4 .classpath .project .settings eclipse_build.xml libtritonus-java-20070428/ConvertJDK1170000755000175000017500000001653507075416165017372 0ustar twernertwerner#!/bin/bash # # Bourne Shell Script # # Description: # Convert Tritonus 1.81 java source code # so that it work with Java Development Kit 1.1.7 and # the Collections API for JDK 1.1 # # Author: # Peter Pilgrim # Wed Jan 05 21:15:56 GMT 2000 # # ******************************************************************************** PrintUsage() # ******************************************************************************** { cat << EOF USAGE: $myname [ --classpath (-cp) ] [ --dryrun (-dr) ] [ --force ] [ --verbose (-v) | --noverbose (+v) ] [ --help (-h) | --usage (-u) ] OPTIONS: '--dryrun' dry run and test the configuration, do not configure the '-dr' the run-time stub file. '--verbose' generates verbose output also. '-v' '--help' produces this brief text and exits gracefully. '-h' '-u' DESCRIPTION: This program '$myname' converts Tritonus 1.81 Java source code so that it compiles with Java Development Kit 1.1.7 and the Collections API for JDK 1.1 The Collections API for JDK1.1 can be found on the Javasoft web pages under the InfoBus product line. Peter Pilgrim Wed Jan 05 21:18:41 GMT 2000 EOF echo '$RCSfile: ConvertJDK117,v $ $Revision: 1.1.1.1 $ $Author: pfisterer $ $Date: 2000/04/13 19:13:57 $' exit 0 } # ******************************************************************************** BackupFile () # ******************************************************************************** { # Backup a file by renaming it. ThisFile=$1 if [ -f ${ThisFile} ]; then if [ -f ${ThisFile}.bak ]; then (set $VerboseOpt; ${PrefixCmd} /bin/rm -f ${ThisFile}.bak ) fi (set $VerboseOpt; ${PrefixCmd} mv ${ThisFile} ${ThisFile}.bak ) fi } # ******************************************************************************** SysWarn() # ******************************************************************************** { # Log an message string to the standard out and do NOT exit echo "$myname: *WARNING* : $1" 1>&2 } # ******************************************************************************** SysError() # ******************************************************************************** { # Log an message string to the standard error and exit echo "$myname: *ERROR* : $1" 1>&2 exit 1 } # ******************************************************************************** SignalCatcher() # ******************************************************************************** { # A generic signal handler for the shell script. echo echo "$myname: Got Signal $1" exit 3 } # ******************************************************************************** CleanUp () # ******************************************************************************** { echo "$myname:Finished (total:$total, errors:$errors, cmpltd:$cmpltd, ignored:$ignored, counter:$counter )" /bin/rm -f DUMMY_FILE $TempFile1 $TempFile2 } # ******************************************************************************** # MAIN MAIN MAIN MAIN MAIN MAIN MAIN MAIN MAIN MAIN MAIN MAIN MAIN MAIN MAIN # ******************************************************************************** myname=`basename $0` debug= verbose= silent= VerboseOpt="+x" PrefixCmd="" DryRunFlag=0 cmpltd=0 errors=0 total=0 ignored=0 counter=0 # # Interpret the command line arguments (the GNU way!) # while [ $# -gt 0 ] do # # Interpret cli argument # case $1 in # **** The standard CLI options begin here **** -silent | -quiet | \ --silence | --silenc | --silenc | --silen | --sile | --sil | \ --quiet | --quie | --qui | --qu | --q | -q ) silent=yes verbose= VerboseOpt="+x" ;; -verbose | --verbose | --verbos | --verbo | --verb | \ --ver | --ve | --v | -v ) verbose=yes VerboseOpt="-x" ;; --debug | --debu | --deb | -debug | -debu | -deb ) debug=yes ;; --dryrun | --dryru | --dryr | --dry | --dr | -dr | \ -dryrun | -dryru | -dryr | -dry | -dr | -dr ) PrefixCmd="echo =>" DryRunFlag=1 ;; --help | --hel | --he | --h | -help | -hel | -he | -h | \ --usage | --usag | --usa | --us | --u | \ -usage | -usag | -usa | -us | -u ) PrintUsage exit 0 ;; --* | -*) SysError "unknown cli option: '$1'. Try '--help' for more info" break;; *) break;; esac shift done # # Trap any signals # trap 'CleanUp "Cleaning"' 0 trap 'SignalCatcher "(SIGHUP)"' 1 trap 'SignalCatcher "(SIGINT)"' 2 trap 'SignalCatcher "(SIGQUIT)"' 3 trap 'SignalCatcher "(SIGTERM)"' 15 echo "$myname: converting to JDK 1.1.7 and compatible Collections API" JavaSourceFiles=`find . -name "*.java" -print` # Create a `sed(1)' file to replace SedFile=collections.sed /bin/rm -f $SedFile # List of Collections API ReplaceClassList=" Collection Comparable Comparator Iterator List ListIterator Map Set SortedMap SortedSet AbstractCollection AbstractList AbstractMap AbstractSequentialList AbstractSet ArrayList Arrays Collections HashMap HashSet Hashtable LinkedList Random SubList TreeMap TreeSet Vector ConcurrentModificationException NoSuchElementException UnsupportedOperationException" # Create the sed script file for Class in $ReplaceClassList do ## ============================================================ ## WARNING EMBEDDED TABS HERE!!! ## ============================================================ echo "s/ java.util.$Class/ com.sun.java.util.collections.$Class/g" >> $SedFile echo "s/ java.util.$Class/ com.sun.java.util.collections.$Class/g" >> $SedFile ## ============================================================ ## added to convert ConcurrentModificationException, ## NoSuchElementException and UnsupportedOperationException ## MP20000326 ## ============================================================ echo "s/ java.lang.$Class/ com.sun.java.util.collections.$Class/g" >> $SedFile echo "s/ java.lang.$Class/ com.sun.java.util.collections.$Class/g" >> $SedFile done # find all java source file and run sed script through them for SrcFile in $JavaSourceFiles do let total=total+1 temp=`grep "java.util." $SrcFile` if [ "x$temp" != "x" ]; then echo -n " [$counter] $SrcFile " NewFile=${SrcFile}.new BackFile=${SrcFile}.bak [ -f $NewFile ] && /bin/rm -f $NewFile sed -f $SedFile $SrcFile > $NewFile status=$? let counter=counter+1 if [ $DryRunFlag -ne 0 ]; then echo "*DRYRUN*" continue fi if [ $status -eq 0 ]; then # backup the original original [ -f $BackFile ] && /bin/rm -f $BackFile mv $SrcFile $BackFile; status=$? if [ $status -ne 0 ]; then let errors=errors+1 echo "*FAILED*" SysError "command failed mv $SrcFile $BackFile (status:$status)" fi # the output sed file becomes the new Java source file mv $NewFile $SrcFile; status=$? if [ $status -ne 0 ]; then let errors=errors+1 echo "*FAILED*" SysError "command failed mv $NewFile $SrcFile (status:$status)" fi let cmpltd=cmpltd+1 echo "*DONE*" else let errors=errors+1 echo "*FAILED*" fi ## echo "**** DEATH 69 ****"; exit 69 else let ignored=ignored+1 fi done if [ $DryRunFlag -ne 0 ]; then echo "*DRYRUN*" continue fi if [ $errors -eq 0 ]; then cat < autoconf ../tritonus> ./configure ../tritonus> ant -f build-dtd.xml ../tritonus> ant ../tritonus> make -C src/lib/alsa ../tritonus> make -C src/lib/vorbis ../tritonus> make -C src/lib/... If you want ant to use jikes, issue: ../tritonus> ant -Dbuild.compiler=jikes [IDEA: options to configure: build-prefix, install-prefix] Installation never worked really well. I did (by hand): > cd /usr/local/java/j2sdk1.4.0/jre/lib/ext > ln -s /home/matthias/java/tritonus/dist/tritonus_xxx.jar ... > cd i386 > ln -s /home/matthias/java/tritonus/src/lib/alsa/libtritonusalsa.so ... (Of course adapt the paths to your system.) --------------------- OLD 1. Unpack the distribution. It should unpack into a directory tritonus-. cd into the top-level directory. 2. Issue 'configure' ('./configure' if you build as root) in the top-level directory. If you are building from the cvs, you have to create configure from configure.in by calling 'autoconf'. Note that autoconf 2.52 hat a bug that prevents Tritonus' configure from working correctely. Tested (and working) versions are 2.53 and 2.13. THE OLD WAY 3. Issue 'make' or 'make compileinitial' (the second one is faster). There are spurious compilation errors with some jdk1.1 versions. Just restart with 'make' (even if you originally said 'make compileinitial') and they will go away. This may be necessary several times. THE NEW WAY 3. Issue 'ant'. -- following needs to be updated -- 4. Issue 'make install'. This will copy the files tritonus.jar, javalayer.jar, libesdtritonus.so.1.0 and libtritonusalsa.so.1.0 into the directory tree of the jdk, thereby installing it as an extension. Note that this works only if you have a jdk/jre1.2 or higher and java is accessible in the path. If you have jdk/jre1.1.x, you have to set the CLASSPATH and LD_LIBRARY_PATH to include the above files. The important files are: - tritonus-x.y.z/tritonus.jar - this contains the java classes and should be in your CLASSPATH - tritonus-x.y.z/javalayer.jar - this contains the java classes for the mp3 decoder (seperated because of legal reasons). They should be in your CLASSPATH, too. - tritonus-x.y.z/src/lib/alsa/libtritonusalsa.so.1.0 (if you use the MIDI stuff) - tritonus-x.y.z/src/lib/esd/libtritonusesd.so.1.0 this contains the native code and should be in your LD_LIBRARY_PATH USING TRITONUS WITH SUN/IBM/BLACKDOWN JDK 1.3/1.4 If you are using Tritonus with a jdk/jre that already has an implementation of the Java Sound API (this is true for 1.3/1.4), you have two choices: 1. Use only the components of Tritonus that are not available/not working correctely in the native Java Sound implementation. 2. Completely replace the Java Sound implementation by Tritonus. Since 1.3 and 1.4 behave sligtly different with respect to this issue, there are even more pitfalls. If you just want to use one of Tritonus' FormatconversionProviders, MixerProviders or MidiDeviceProviders (these are the most common cases), put the respective tritonus_xxx.jar into either the user class path or the extension class path. Using the user class path can be convenient for quick tests. However, for permanent installation it is not recommanded. The reason is that executing a VM with 'java -jar ...' overrides the user class path with the location of the .jar given on the command line. So Tritonus .jars put into the user class path become unavailable. Manipulating the boot class path is generally highly discouraged (see below for a useful, but still critical use of the boot class path). The remaining (and recommanded) way is to use the extension class path. Additionally, put native libs of .jar that need one into a generally system-accessible location (for instance /usr/lib/, /usr/local/lib, ...). To install native libs in a custom location, you typically need to change the value of the environment variable LD_LIBRARY_PATH. This done, the components should be available to Java Sound. MixerProviders contribute to the list of Mixers (AudioSystem.getMixerInfo()). MidiDeviceProviders contribute to the list of MidiDevices (MidiSystem.getMidiDeviceInfo()). FormatConversionProviders are considered implicitely (by AudioSystem.getTargetEncodings(), AudioSystem.getTargetFormats(), AudioSystem.isConversionSupported(), AudioSystem.getAudioInputStream()). With jdk 1.3.X, the pitfall is that making the providers available does NOT automatically change the default devices (as returned/used by AudioSystem.getLine(), MidiSystem.getSynthesizer(), MidiSystem.getReceiver(), MidiSystem.getTransmitter(), MidiSystem.getSequencer(), MidiSystem.getSynthesizer()). The jdk searches the class paths for available providers in this order: boot class path, extension class path, user class path. Since the 'built-in' providers appear in rt.jar, which appears in the boot class path, its devices act as defaults. Devices provided by additionally installed providers are available on explicit request (AudioSystem.getMixer(), MidiSystem.getMidiDevice()). With jdk 1.4, the defaults change without asking you, and exactely this can be a pitfal, too. This is due to the fact that the the search order for provider is reversed. Here, it is: user class path, extension class path, boot class path. So devices provided by additional providers can act as default devices. So with jdk1.4, your job is easy, while with jdk1.3 you have to explicitely name alternative Mixers and MidiDevices. Note that it is not a good idea to hard-code Tritonus' Mixer or MidiDevice names. The recommanded practice (anyway) is to give the user a list of available Mixers and MidiDevices and let her/him select an appropriate one. These choices may be stored as preferences. If the user doesn't explicitely select devices, default devices should be used (as provided by the Java Sound implementation, not hard-coded ones). You may want to opt to completely replace the jdk's Java Sound implementation by Tritonus. There are not many cases where this does make sense. It can be necessary to shadow severe bugs, but there are few of them. For now, it's mainly an option for testing Tritonus. It is not recommanded for normal users. Here is how it works: Since the native versions of the javax.sound.* classes are in the boot class path, it is necessary to alter the boot class path. Start the VM with the following options: java -Xbootclasspath/p:/path/to/tritonus_core.jar:/path/to/tritonus_share.jar This prepends some of the Tritonus .jars to the boot class path, resulting in Tritonus' versions of javax.sound.* shadowing the native ones. Note that this still does not remove the native service providers. To remove them, you have to edit or remove configuration files packaged in rt.jar. The easiest way is to just remove them. So, remove the following files from rt.jar: META-INF/services/javax.sound.midi.spi.MidiDeviceProvider META-INF/services/javax.sound.midi.spi.MidiFileReader META-INF/services/javax.sound.midi.spi.MidiFileWriter META-INF/services/javax.sound.midi.spi.SoundbankReader META-INF/services/javax.sound.sampled.spi.AudioFileReader META-INF/services/javax.sound.sampled.spi.AudioFileWriter META-INF/services/javax.sound.sampled.spi.FormatConversionProvider META-INF/services/javax.sound.sampled.spi.MixerProvider Be sure to keep a copy of the original rt.jar, so that you can easily restore the original state. And again: Be warned that this is a guru-level option. Don't dare to ask for help on a mailing list if something fails. You have to know what you are doing. TODO [table: which provider in which .jar] MISCELLANEOUS If you found bugs, have suggestions, want to contribute or whatever, you can contact the authors of this library: mailto:tritonus-devel@lists.sourceforge.net Further information on Tritonus: http://www.tritonus.org/ You may also have a look at the Tritonus developer page: http://tritonus.sourceforge.net/developer.html Have fun!! %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Material not yet integrated (may be out of date) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% README.midi ----------- ALSA ---- The MIDI stuff of tritonus makes heavy use of the ALSA sequencer. ALSA is the Advanced Linux Sound Architecture (http://www.alsa-project.org), a new soundcard driver system intended to replace the OSS/Free driver in future kernels. HOW TO MAKE IT WORK ------------------- Use a recent 2.2 kernel. The developer of this stuff uses 2.2.10 and 2.2.14 kernels; every kernel newer than 2.2.3 should work. In the kernel configuration, enable sound support, but do not include any concrete driver. Enabling kernel symbol versioning helps if you recompile kernels frequently. Download and install the ALSA drivers/lib/utils version 0.5.x. You cannot use earlier versions of ALSA due to incompatible changes. Be sure to configure '--with-sequencer=yes' in the driver part. Install the modules and load the new versions. Load the sequencer modules. For help on installing ALSA, see the alsa-user mailing list (visit the ALSA web site). Installation check ------------------ > cat /proc/asound/seq/clients The result should be similar to this: Client info cur clients : 2 peak clients : 2 max clients : 192 Client 0 : "System" [Kernel] Port 0 : "Timer" (system:Rwe:Rwe) Port 1 : "Announce" (system:R-e:R-e) Client 64 : "0: MIDI Synth" [Kernel] Port 0 : "MIDI 0-0" (device:RWe:RWe) If the file doesn't exist at all, load the sequencer module: modprobe snd-seq If the file exists, but the "MIDI Synth" doesn't show up, load the MIDI client module: modprobe snd-seq-midi If the internal synthesizer of your card is supported (not all cards), you can load the synth support, too: modprobe snd-seq-synth There may be additional lines if you have more than one soundcard, your soundcard has more than one MIDI port or the internal synth of the soundcard is supported. Second install check -------------------- Install pmidi (http://www.parabola.demon.co.uk/alsa/pmidi.html). You need version 1.4.0 or later. Call 'pmidi -l'. The output should be similar to this: Port Client name Port name 64:0 0: MIDI Synth MIDI 0-0 Connect a synthesizer to the MIDI out of your computer. Call 'pmidi -p 64:0 '. '64:0' should be the number shown in the first column of the output from 'pmidi -l'. The MIDI file should be played on your synth. (Hopefully) finished! --------------------- Now you should be able to use Tritonus with the ALSA sequencer.libtritonus-java-20070428/LGPL0000644000175000017500000006127307075416173015721 0ustar twernertwerner GNU LIBRARY GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. [This is the first released version of the library GPL. It is numbered 2 because it goes with version 2 of the ordinary GPL.] Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Library General Public License, applies to some specially designated Free Software Foundation software, and to any other libraries whose authors decide to use it. You can use it for your libraries, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library, or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link a program with the library, you must provide complete object files to the recipients so that they can relink them with the library, after making changes to the library and recompiling it. And you must show them these terms so they know their rights. Our method of protecting your rights has two steps: (1) copyright the library, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the library. Also, for each distributor's protection, we want to make certain that everyone understands that there is no warranty for this free library. If the library is modified by someone else and passed on, we want its recipients to know that what they have is not the original version, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that companies distributing free software will individually obtain patent licenses, thus in effect transforming the program into proprietary software. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License, which was designed for utility programs. This license, the GNU Library General Public License, applies to certain designated libraries. This license is quite different from the ordinary one; be sure to read it in full, and don't assume that anything in it is the same as in the ordinary license. The reason we have a separate public license for some libraries is that they blur the distinction we usually make between modifying or adding to a program and simply using it. Linking a program with a library, without changing the library, is in some sense simply using the library, and is analogous to running a utility program or application program. However, in a textual and legal sense, the linked executable is a combined work, a derivative of the original library, and the ordinary General Public License treats it as such. Because of this blurred distinction, using the ordinary General Public License for libraries did not effectively promote software sharing, because most developers did not use the libraries. We concluded that weaker conditions might promote sharing better. However, unrestricted linking of non-free programs would deprive the users of those programs of all benefit from the free status of the libraries themselves. This Library General Public License is intended to permit developers of non-free programs to use free libraries, while preserving your freedom as a user of such programs to change the free libraries that are incorporated in them. (We have not seen how to achieve this as regards changes in header files, but we have achieved it as regards changes in the actual functions of the Library.) The hope is that this will lead to faster development of free libraries. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, while the latter only works together with the library. Note that it is possible for a library to be covered by the ordinary General Public License rather than by this special one. GNU LIBRARY GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Library General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. 6. As an exception to the Sections above, you may also compile or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. c) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. d) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Library General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Libraries If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License). To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Also add information on how to contact you by electronic and paper mail. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the library `Frob' (a library for tweaking knobs) written by James Random Hacker. , 1 April 1990 Ty Coon, President of Vice That's all there is to it! libtritonus-java-20070428/Makefile.in0000755000175000017500000003236307637207012017300 0ustar twernertwerner# compilation and packing for the tritonus library # SHELL = /bin/sh prefix=@prefix@ JAVADIR=$(prefix) JAVAEXTPATH=$(JAVADIR)/@REL_JAVAEXTPATH@ JAVAC=@COMPILER@ DEF_CLASSPATH=@DEF_CLASSPATH@ INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ LN_S = @LN_S@ RM_F = @RM_F@ MKDIR_P = @MKDIR_P@ DESTDIR = @BUILD_DIR@ DISTDIR = @DIST_DIR@ JL_SRC = @JL_DIR@ %.class: %.java $(JAVAC) -classpath $(DEF_CLASSPATH):$(JL_SRC):src:$$CLASSPATH -d $(DESTDIR) $< @#export CLASSPATH=$(DEF_CLASSPATH):$(JL_SRC):src:$$CLASSPATH; $(JAVAC) -d $(DESTDIR) $< SRCDIR_PUB = src/javax/sound SRCDIR_PRIV = src/org/tritonus SRCDIR_JL = $(JL_SRC)/javazoom/jl/decoder SRCDIR_JESD = src/com/jcraft/jesd OBJDIR_PUB = $(DESTDIR)/javax/sound OBJDIR_PRIV = $(DESTDIR)/org/tritonus OBJDIR_JL = $(DESTDIR)/javazoom/jl/decoder OBJDIR_JESD = $(DESTDIR)/com/jcraft/jesd PACKAGING_ABSOLUTE_DIR=@SRC_ABSOLUTE_PATH@/src/packaging PACKSRCDIR_CORE = javax/sound org/tritonus/core PACKSRCDIR_SHARE = org/tritonus/share PACKSRCDIR_REMAINING = \ org/tritonus/lowlevel/alsa \ org/tritonus/lowlevel/esd \ org/tritonus/lowlevel/saint \ org/tritonus/midi \ org/tritonus/sampled/convert/*.class \ org/tritonus/sampled/file/*.class \ org/tritonus/sampled/mixer PACKSRCDIR_MP3 = \ org/tritonus/sampled/convert/lame \ org/tritonus/sampled/convert/javalayer \ org/tritonus/sampled/file/mpeg \ org/tritonus/lowlevel/lame PACKSRCDIR_GSM = \ org/tritonus/lowlevel/gsm \ org/tritonus/sampled/file/gsm \ org/tritonus/sampled/convert/gsm PACKSRCDIR_JL = javazoom LIBDEST_CORE=tritonus_core.jar LIBDEST_SHARE=tritonus_share.jar LIBDEST_REMAINING=tritonus_remaining.jar LIBDEST_MP3=tritonus_mp3.jar LIBDEST_GSM=tritonus_gsm.jar PLUGINS=$(LIBDEST_MP3) $(LIBDEST_GSM) $(LIBDEST_SHARE) tritonus_aos.jar LIBS=$(LIBDEST_CORE) $(LIBDEST_SHARE) $(LIBDEST_REMAINING) $(LIBDEST_MP3) $(LIBDEST_GSM) LIBDEST_ABSOLUTE_PREFIX=@SRC_ABSOLUTE_PATH@/$(DISTDIR) META_INF_DIR=$(DESTDIR)/META-INF/services vpath %.jar $(DISTDIR) vpath %.java $(SRCDIR_PUB)/midi vpath %.java $(SRCDIR_PUB)/midi/spi vpath %.java $(SRCDIR_PUB)/sampled vpath %.java $(SRCDIR_PUB)/sampled/spi vpath %.java $(SRCDIR_PRIV) vpath %.java $(SRCDIR_PRIV)/core vpath %.java $(SRCDIR_PRIV)/lowlevel/alsa vpath %.java $(SRCDIR_PRIV)/lowlevel/cdda vpath %.java $(SRCDIR_PRIV)/lowlevel/cdda/cdparanoia vpath %.java $(SRCDIR_PRIV)/lowlevel/cdda/cooked_ioctl vpath %.java $(SRCDIR_PRIV)/lowlevel/esd vpath %.java $(SRCDIR_PRIV)/lowlevel/gsm vpath %.java $(SRCDIR_PRIV)/lowlevel/saint vpath %.java $(SRCDIR_PRIV)/lowlevel/lame vpath %.java $(SRCDIR_PRIV)/share vpath %.java $(SRCDIR_PRIV)/share/sampled vpath %.java $(SRCDIR_PRIV)/share/sampled/convert vpath %.java $(SRCDIR_PRIV)/share/sampled/file vpath %.java $(SRCDIR_PRIV)/share/sampled/mixer vpath %.java $(SRCDIR_PRIV)/share/midi vpath %.java $(SRCDIR_PRIV)/sampled/cdda vpath %.java $(SRCDIR_PRIV)/sampled/convert vpath %.java $(SRCDIR_PRIV)/sampled/convert/gsm vpath %.java $(SRCDIR_PRIV)/sampled/convert/javalayer vpath %.java $(SRCDIR_PRIV)/sampled/convert/lame vpath %.java $(SRCDIR_PRIV)/sampled/file vpath %.java $(SRCDIR_PRIV)/sampled/file/gsm vpath %.java $(SRCDIR_PRIV)/sampled/file/mpeg vpath %.java $(SRCDIR_PRIV)/sampled/mixer vpath %.java $(SRCDIR_PRIV)/sampled/mixer/alsa vpath %.java $(SRCDIR_PRIV)/sampled/mixer/esd vpath %.java $(SRCDIR_PRIV)/sampled/mixer/jesd vpath %.java $(SRCDIR_PRIV)/midi/device vpath %.java $(SRCDIR_PRIV)/midi/device/alsa vpath %.java $(SRCDIR_PRIV)/midi/device/midishare vpath %.java $(SRCDIR_PRIV)/midi/device/saint vpath %.java $(SRCDIR_PRIV)/midi/file vpath %.java $(SRCDIR_JL) vpath %.java $(SRCDIR_JESD) vpath %.class $(OBJDIR_PUB)/midi vpath %.class $(OBJDIR_PUB)/midi/spi vpath %.class $(OBJDIR_PUB)/sampled vpath %.class $(OBJDIR_PUB)/sampled/spi vpath %.class $(OBJDIR_PRIV) vpath %.class $(OBJDIR_PRIV)/core vpath %.class $(OBJDIR_PRIV)/lowlevel/alsa vpath %.class $(OBJDIR_PRIV)/lowlevel/cdda vpath %.class $(OBJDIR_PRIV)/lowlevel/cdda/cdparanoia vpath %.class $(OBJDIR_PRIV)/lowlevel/cdda/cooked_ioctl vpath %.class $(OBJDIR_PRIV)/lowlevel/esd vpath %.class $(OBJDIR_PRIV)/lowlevel/gsm vpath %.class $(OBJDIR_PRIV)/lowlevel/saint vpath %.class $(OBJDIR_PRIV)/lowlevel/lame vpath %.class $(OBJDIR_PRIV)/share vpath %.class $(OBJDIR_PRIV)/share/sampled vpath %.class $(OBJDIR_PRIV)/share/sampled/convert vpath %.class $(OBJDIR_PRIV)/share/sampled/file vpath %.class $(OBJDIR_PRIV)/share/sampled/mixer vpath %.class $(OBJDIR_PRIV)/share/midi vpath %.class $(OBJDIR_PRIV)/sampled/cdda vpath %.class $(OBJDIR_PRIV)/sampled/convert vpath %.class $(OBJDIR_PRIV)/sampled/convert/gsm vpath %.class $(OBJDIR_PRIV)/sampled/convert/javalayer vpath %.class $(OBJDIR_PRIV)/sampled/convert/lame vpath %.class $(OBJDIR_PRIV)/sampled/file vpath %.class $(OBJDIR_PRIV)/sampled/file/gsm vpath %.class $(OBJDIR_PRIV)/sampled/file/mpeg vpath %.class $(OBJDIR_PRIV)/sampled/mixer vpath %.class $(OBJDIR_PRIV)/sampled/mixer/alsa vpath %.class $(OBJDIR_PRIV)/sampled/mixer/esd vpath %.class $(OBJDIR_PRIV)/sampled/mixer/jesd vpath %.class $(OBJDIR_PRIV)/midi/device vpath %.class $(OBJDIR_PRIV)/midi/device/alsa vpath %.class $(OBJDIR_PRIV)/midi/device/midishare vpath %.class $(OBJDIR_PRIV)/midi/device/saint vpath %.class $(OBJDIR_PRIV)/midi/file vpath %.class $(OBJDIR_JL) vpath %.class $(OBJDIR_JESD) SRCTMP:=$(wildcard \ $(SRCDIR_PUB)/midi/*.java \ $(SRCDIR_PUB)/midi/spi/*.java \ $(SRCDIR_PUB)/sampled/*.java \ $(SRCDIR_PUB)/sampled/spi/*.java \ $(SRCDIR_PRIV)/*.java \ $(SRCDIR_PRIV)/core/*.java \ $(SRCDIR_PRIV)/share/*.java \ $(SRCDIR_PRIV)/share/midi/*.java \ $(SRCDIR_PRIV)/share/sampled/*.java \ $(SRCDIR_PRIV)/share/sampled/convert/*.java \ $(SRCDIR_PRIV)/share/sampled/file/*.java \ $(SRCDIR_PRIV)/share/sampled/mixer/*.java \ $(SRCDIR_PRIV)/lowlevel/alsa/*.java \ $(SRCDIR_PRIV)/lowlevel/cdda/*.java \ $(SRCDIR_PRIV)/lowlevel/cdda/cdparanoia/*.java \ $(SRCDIR_PRIV)/lowlevel/cdda/cooked_ioctl/*.java \ $(SRCDIR_PRIV)/lowlevel/esd/*.java \ $(SRCDIR_PRIV)/lowlevel/gsm/*.java \ $(SRCDIR_PRIV)/lowlevel/saint/*.java \ $(SRCDIR_PRIV)/lowlevel/lame/*.java \ $(SRCDIR_PRIV)/sampled/cdda/*.java \ $(SRCDIR_PRIV)/sampled/convert/*.java \ $(SRCDIR_PRIV)/sampled/convert/gsm/*.java \ $(SRCDIR_PRIV)/sampled/convert/javalayer/*.java \ $(SRCDIR_PRIV)/sampled/convert/lame/*.java \ $(SRCDIR_PRIV)/sampled/file/*.java \ $(SRCDIR_PRIV)/sampled/file/gsm/*.java \ $(SRCDIR_PRIV)/sampled/file/mpeg/*.java \ $(SRCDIR_PRIV)/sampled/mixer/alsa/*.java \ $(SRCDIR_PRIV)/sampled/mixer/jesd/*.java \ $(SRCDIR_PRIV)/sampled/mixer/esd/*.java \ $(SRCDIR_PRIV)/midi/device/alsa/*.java \ $(SRCDIR_PRIV)/midi/file/*.java \ $(SRCDIR_JL)/*.java \ $(SRCDIR_JESD)/*.java \ ) # $(SRCDIR_PRIV)/midi/device/saint/*.java \ # $(SRCDIR_PRIV)/midi/device/midishare/*.java \ needs e.g. class grame.midishare.MidiException SRC:=$(notdir $(SRCTMP)) OBJ:=$(SRC:.java=.class) srcdir=. DISTFILES=ConvertJDK117 INSTALL LGPL Makefile.in NEWS README README_mp3 configure.in configure doc src test util #new SUBDIRS=@SUBDIRS@ CONVERTTARGETS = @CONVERTTARGETS@ #----------------- rules ------------------- .PHONY: all # $$fb do not compile the java classes #all: builddir $(CONVERTTARGETS) $(LIBS) @JAR_INDEX@ # @for d in $(SUBDIRS); do $(MAKE) -C $$d; done # @rm -rf $(DESTDIR)/META-INF all: builddir @for d in $(SUBDIRS); do $(MAKE) -C $$d; done .PHONY: convert convert: @if [ ! -f .converted ]; then ./ConvertJDK117; echo "" > .converted; fi .PHONY: builddir builddir: @$(MKDIR_P) $(DESTDIR) #.PHONY: $(DISTDIR) #$(DISTDIR): # @$(MKDIR_P) $(DISTDIR) #.PHONY: $(META_INF_DIR) #$(META_INF_DIR): # @rm -rf $(DESTDIR)/META-INF # @$(MKDIR_P) $(DESTDIR)/META-INF # @$(MKDIR_P) $(DESTDIR)/META-INF/services #.PHONY: $(LIBDEST_CORE) $(LIBDEST_CORE): $(OBJ) @echo Creating $(LIBDEST_CORE) @$(MKDIR_P) $(DISTDIR) @cd $(DESTDIR) ; jar cmf $(PACKAGING_ABSOLUTE_DIR)/tritonus_core/manifest.mf \ $(LIBDEST_ABSOLUTE_PREFIX)/$(LIBDEST_CORE) $(PACKSRCDIR_CORE) #.PHONY: $(LIBDEST_SHARE) $(LIBDEST_SHARE): $(OBJ) @echo Creating $(LIBDEST_SHARE) @$(MKDIR_P) $(DISTDIR) @cd $(DESTDIR) ; jar cf $(LIBDEST_ABSOLUTE_PREFIX)/$(LIBDEST_SHARE) $(PACKSRCDIR_SHARE) #.PHONY: $(LIBDEST_REMAINING) $(LIBDEST_REMAINING): $(OBJ) @echo Creating $(LIBDEST_REMAINING) @$(MKDIR_P) $(DISTDIR) @rm -rf $(DESTDIR)/META-INF @$(MKDIR_P) $(DESTDIR)/META-INF @$(MKDIR_P) $(DESTDIR)/META-INF/services @#$(RM_F) $(DESTDIR)/META-INF/services/javax* @cp src/packaging/tritonus_core/META-INF/services/javax* $(META_INF_DIR)/ @cd $(DESTDIR) ; jar cf $(LIBDEST_ABSOLUTE_PREFIX)/$(LIBDEST_REMAINING) \ $(PACKSRCDIR_REMAINING) META-INF/services/ #.PHONY: $(LIBDEST_MP3) $(LIBDEST_MP3): $(OBJ) @echo Creating $(LIBDEST_MP3) @$(MKDIR_P) $(DISTDIR) @rm -rf $(DESTDIR)/META-INF @$(MKDIR_P) $(DESTDIR)/META-INF @$(MKDIR_P) $(DESTDIR)/META-INF/services @#$(RM_F) $(DESTDIR)/META-INF/services/javax* @cp src/packaging/tritonus_mp3/META-INF/services/javax* $(META_INF_DIR)/ @cd $(DESTDIR) ; jar cmf $(PACKAGING_ABSOLUTE_DIR)/tritonus_mp3/manifest.mf \ $(LIBDEST_ABSOLUTE_PREFIX)/$(LIBDEST_MP3) $(PACKSRCDIR_MP3) META-INF/services/ #.PHONY: $(LIBDEST_GSM) $(LIBDEST_GSM): $(OBJ) @echo Creating $(LIBDEST_GSM) @$(MKDIR_P) $(DISTDIR) @rm -rf $(DESTDIR)/META-INF @$(MKDIR_P) $(DESTDIR)/META-INF @$(MKDIR_P) $(DESTDIR)/META-INF/services @#$(RM_F) $(DESTDIR)/META-INF/services/javax* @cp src/packaging/tritonus_gsm/META-INF/services/javax* $(META_INF_DIR)/ @cd $(DESTDIR) ; jar cmf $(PACKAGING_ABSOLUTE_DIR)/tritonus_gsm/manifest.mf \ $(LIBDEST_ABSOLUTE_PREFIX)/$(LIBDEST_GSM) $(PACKSRCDIR_GSM) META-INF/services/ .PHONY: jar_index jar_index: $(LIBS) @echo Creating indexes for $(LIBDEST_CORE), $(LIBDEST_MP3), and $(LIBDEST_GSM) @cd $(DISTDIR) ; jar -i $(LIBDEST_CORE) @cd $(DISTDIR) ; jar -i $(LIBDEST_MP3) @cd $(DISTDIR) ; jar -i $(LIBDEST_GSM) .PHONY: jikesinc jikesinc: builddir $(SRC) @(if test "$(JAVAC)" != "jikes" ; then \ echo "This is only available with jikes as compiler." ; exit 1 ; fi) @echo "This will not build the jars. You need to include the directory \"$(DESTDIR)\" in the CLASSPATH." @export CLASSPATH=$(DEF_CLASSPATH):$$CLASSPATH; $(JAVAC) ++ -d $(DESTDIR) $(SRCTMP) .PHONY: doc doc: all $(MAKE) -C doc .PHONY: test test: all $(MAKE) -C all .PHONY: install install: all @for l in $(LIBS) ; do \ echo "Installing $$l in $(JAVAEXTPATH)" ; \ $(INSTALL_DATA) $(DISTDIR)/$$l $(JAVAEXTPATH) ; done @for d in $(SUBDIRS); do $(MAKE) -C $$d install; done .PHONY: install-link install-link: all @for l in $(LIBS) ; do \ echo "Installing link for $$l in $(JAVAEXTPATH)" ; \ $(RM_F) $(JAVAEXTPATH)/$$l ; \ (cd $(JAVAEXTPATH) && $(LN_S) $(LIBDEST_ABSOLUTE_PREFIX)/$$l $$l) ; done @for d in $(SUBDIRS); do $(MAKE) -C $$d install-link; done # TODO: install-link-usc #links /usr/share/common/tritonus_*.jar to build version; links .../jre/lib/ext/... to /u/s/j .PHONY: uninstall uninstall: @for l in $(LIBS) ; do \ echo "Removing $$l from $(JAVAEXTPATH)" ; \ $(RM_F) $(JAVAEXTPATH)/$$l ; done @for d in $(SUBDIRS); do $(MAKE) -C $$d uninstall; done .PHONY: uninstall-link uninstall-link: uninstall .PHONY: clean clean: cd $(DISTDIR) ; $(RM_F) $(LIBS) rm -rf $(DESTDIR)/org $(DESTDIR)/javax $(DESTDIR)/javazoom $(DESTDIR)/com $(DESTDIR)/META-INF find . -name '*~' -exec rm '{}' ';' find . -name '*.class' -exec rm '{}' ';' find . -name '*.bak' -exec rm '{}' ';' find . -name '.directory' -exec rm '{}' ';' @for d in $(SUBDIRS); do $(MAKE) -C $$d clean; done .PHONY: veryclean veryclean: clean rm -rf TAGS .PHONY:tags tags: TAGS TAGS: $(SRCTMP) etags $(SRCTMP) userdist: echo tritonus-`cat VERSION` >.fname -rm -rf `cat .fname` mkdir `cat .fname` dst=`cat .fname`; for f in $(DISTFILES); do \ ln $(srcdir)/$$f $$dst/$$f || { echo copying $$f; \ cp -pr $(srcdir)/$$f $$dst/$$f; } \ done tar czhf `cat .fname`.tar.gz `cat .fname` -rm -rf `cat .fname` .fname devdist: echo tritonus-`date +%Y-%m-%d` >.fname -rm -rf `cat .fname` mkdir `cat .fname` dst=`cat .fname`; for f in $(DISTFILES); do \ ln $(srcdir)/$$f $$dst/$$f || { echo copying $$f; \ cp -pr $(srcdir)/$$f $$dst/$$f; } \ done tar czhf `cat .fname`.tar.gz `cat .fname` -rm -rf `cat .fname` .fname bindist: bindist-esd bindist-alsa #TODO: dependancies, readme bindist-esd: tar czf tritonus-esd-linux-x86-`date +%Y-%m-%d`.tar.gz \ -C doc/bindists/esd readme.txt \ -C ../../../dist tritonus_share.jar tritonus_esd.jar \ -C ../src/lib/esd libtritonusesd.so libtritonusesd.so.1 libtritonusesd.so.1.0 #TODO: dependancies, readme bindist-alsa: tar czf tritonus-alsa-linux-x86-`date +%Y-%m-%d`.tar.gz \ -C doc/bindists/alsa readme.txt \ -C ../../../dist tritonus_share.jar tritonus_alsa.jar \ -C ../src/lib/alsa libtritonusalsa.so libtritonusalsa.so.1 libtritonusalsa.so.1.0 bindist-upload: bindist scp tritonus-esd-linux-x86-`date +%Y-%m-%d`.tar.gz tritonus-alsa-linux-x86-`date +%Y-%m-%d`.tar.gz www.tritonus.org:vtritonus/htdocs devdist-upload: devdist echo tritonus-`date +%Y-%m-%d.tar.gz` >.fname scp `cat .fname` tritonus.sourceforge.net:/home/groups/ftp/pub/tritonus/ -rm -f .fname plugins-upload: $(PLUGINS) cd $(DISTDIR) ; scp $(PLUGINS) www.tritonus.org:vtritonus/htdocs # doesn't work on www.tritonus.org plugins-rsync: $(PLUGINS) cd $(DISTDIR) ; rsync $(PLUGINS) www.tritonus.org:vtritonus/htdocs #------- EXPERIMENTAL ---------------- nativelibs: $(MAKE) -C src/lib/alsa $(MAKE) -C src/lib/greatlysimplifiedvorbis libtritonus-java-20070428/NEWS0000644000175000017500000000352707075416174015736 0ustar twernertwernerNEWS for Tritonus version 0.2.0: - bug fixes in audio file writers - improved A-law and u-law converters - bug fixes in installation procedure version 0.1.92: - file writers for .aiff and .wav - improved file readers - a-law and u-law converters - installation with jdk1.1.x now possible again version 0.1.91: - MIDI OUT is working (exception: sysex events) - major improvements in handling of 8-bit sound data version 0.1.90: many, many new things. Only key points here: - Java Sound API 1.0 interface - mp3 decoder fully integrated - recording works, even full-duplex - MIDI stuff: Sequencer (playback), Synthesizer (some advanced features missing), external MIDI IN, external MIDI OUT (only together with Sequencer) - NAS support removed version 0.1.82: - automatic configuration with configure - builds on jdk1.1.x (many thanks to Peter Pilgrim) - new base class TMixerProvider - NasMixer now has Mixer.Info object - interface of PanControl changed to 0.90 API - AudioInputStream can now handle streams with indefinite length - basis support for mp3 decoding by integration of javalayer - MidiDevice.Info.getVersion() added, constructor adapted - GroupLine added - Port.Info added version 0.1.81: - audio file writing for .au files - Clips for esd - several bugs fixed version 0.1.80: - JavaSound 0.90 API - support for esd - AudioInputStreamProviders for au, aiff and wave files version 0.1.003: - pause() and resume() are implemented - channels send start, stop and eom events - workaround for buggy fileparsers (now all work) version 0.1.002: - works with AuParser of Sun (other parser do not work/are not tested) - circular buffer in output channel has been eliminated - honors passed AudioFormat in Mixer.getOutputChannel() - Mixer.get*Formats() work Please report bugs to the author of this library: Matthias Pfisterer Have fun! libtritonus-java-20070428/README0000644000175000017500000000160107757626216016115 0ustar twernertwernerThis is Tritonus, version 0.3.1 Tritonus is an implementation of the Java Sound API 1.0. What you see here is an implementaion for GNU/Linux i386 and GNU/Linux PowerPC. It is intended to support different plattforms in the future. Several components are written purely in Java. They can be used to extend any known Java Sound implementation. For pre-compiled versions of these components, see: http://www.tritonus.org/plugins.html Tritonus is distributed under the terms of the GNU Library General Public License. See the file LGPL for details. For installing instructions, see the file INSTALL. For new features and bug fixes, see file NEWS Please report bugs in Tritonus: http://sourceforge.net/bugs/?group_id=1390 or send mail to the developer mailing list: mailto:tritonus-devel@lists.sourceforge.net You may also have a look at the Tritonus page: http://www.tritonus.org/ Have fun! libtritonus-java-20070428/README_mp30000644000175000017500000000650107266367211016670 0ustar twernertwernerREADME.mp3 ---------- MP3 DECODING ------------ This version of Tritonus includes mp3 decoding support. This is due to using javalayer 0.0.8, a pure-java mp3 decoder developed by the javalayer project. The big credit for this goes to Eric B. who wrote the decoder. The javalayer code is no longer duplicated in Tritonus. To compile from scratch, you need to check out javalayer from its own cvs (see http://sourceforge.net/projects/javalayer/). Make sure javalayer is in a directory 'javalayer' that is in the same directory as 'tritonus'. In this case, if you issue ant int Tritonus, it will build javalayer, too. Alternatively, if you want a different location, change the path to javalayer in build.xml. For a runnable program, see DecodingAudioPlayer.java or AudioPlayer.java from the Java Sound Examples. The decoder can also be used as plug-in for any Java Sound implementation (like the Sun jdk1.3). Precompiled jar files are at http://www.tritonus.org/plugins.html JavaLayer project: http://www.javazoom.net/javalayer/javalayer.html MP3 ENCODING ------------ MP3 file creation is supported with native access to the LAME library. A pure Java MP3 encoder does not exist in our knowledge and would probably be too slow - nowadays. LAME is acknowledged to provide high quality mp3 encoding. Additionally, it is completely open source (LGPL) and does not use 3rd party source code. As LAME is accessed via JNI, the current implementation in Tritonus can only be used under Linux. In future, a port to Windows and other systems is possible. Capabilities in Tritonus: The encoder creates MPEG1 layer III, MPEG2 layer III or MPEG2.5 layer III files and chooses automatically the right encoding. Bit rates may vary from 8 to 320KBit/s, VBR (variable bit rate) is supported, too. Different quality levels may be choosen which affect - encoding speed for CBR (constant bit rate) - mp3 file size for VBR. Downloading LAME: LAME has to be installed on your system. You need at least LAME V3.88beta or later. You can get LAME from http://sourceforge.net/projects/lame/ To get the latest CVS version of lame, issue these 2 commands: cvs -d:pserver:anonymous@cvs.lame.sourceforge.net:/cvsroot/lame login (Password empty) cvs -z3 -d:pserver:anonymous@cvs.lame.sourceforge.net:/cvsroot/lame co lame Installation of LAME: In the main directory of lame, issue "./configure --enable-shared" and "make". As root, invoke "make install". This copies the library to /usr/local/lib. You may need to include /usr/local/lib to /etc/ld.so.conf and then run "ldconfig" Integration in Tritonus: You must re-run "configure" after installation of LAME. Be sure to remove "config.cache" before. "configure" outputs a line like "Will build stuff for LAME encoder" when everything is fine. Call "make" and as root "make install" (or make install-link). Testing: A simple command line tool for converting any audio file to mp3 is included in the directory test: Mp3Encoder.java. Run it without parameters to see brief usage instructions. Looking at its source code will show you how it works (and the problems...). Please send problems or bugs to florian@tritonus.org or submit them to the bug database on sourceforge. Thanks: Many thanks to Mark Taylor, who leads development of LAME. He was open to my (Florians) proposals and let me work on LAME to make the integration into Tritonus possible. libtritonus-java-20070428/build-common.xml0000644000175000017500000003307110372203030020316 0ustar twernertwerner libtritonus-java-20070428/build-debug.xml0000644000175000017500000000505510002561550020121 0ustar twernertwerner ]> &common; libtritonus-java-20070428/build-dtd.xml0000644000175000017500000000055407610631637017624 0ustar twernertwerner libtritonus-java-20070428/build.xml0000644000175000017500000000523610367403451017047 0ustar twernertwerner ]> &common; libtritonus-java-20070428/configure.in0000644000175000017500000001562510373574100017537 0ustar twernertwernerdnl Process this file with autoconf to produce a configure script. dnl dnl This script does not work with autoconf 2.52 (bug in autoconf). dnl AC_INIT(src/classes/javax/sound/sampled/AudioSystem.java) AC_CONFIG_AUX_DIR(util) JAR_INDEX= # JDK Version Check automatic checker. # This is Sun JVM specific when looking the # release number at least # Peter Pilgrim Wed Jan 12 00:20:42 GMT 2000 AC_MSG_CHECKING(JDK version) # Temporary directory : ${TMPDIR:=/tmp} # Your Java VM might be JIKES : ${JAVA:=java} TEMPFILE=${TMPDIR}/javaver.lst /bin/rm -f $TEMPFILE ${JAVA} -version 2> $TEMPFILE JdkVersion=`cat $TEMPFILE | head -n 1 | cut -d" " -f3 | sed 's!"!!g'` JAVA_VERSION=${JdkVersion} AC_MSG_RESULT($JAVA_VERSION) JDK_OK=yes case $JAVA_VERSION in 1.6* ) ;; 1.5* ) ;; 1.4* ) JDK_OK=no ;; 1.3* ) #bug in jar -i ... #JAR_INDEX=jar_index JDK_OK=no ;; 1.2* ) JDK_OK=no ;; 1.1* ) JDK_OK=no ;; 1.0* ) JDK_OK=no ;; *) echo "No JDK Version detected. " echo "Please make sure a J2SDK is in your CLASSPATH." echo "For more information read the file INSTALL" JDK_OK=no ;; esac # fini # We only support 1.5 or higher now if test $JDK_OK != "yes" ; then AC_MSG_ERROR(Need JDK 1.5 or higher!) exit 1 fi # need to convert targets for 1.1? (legacy) AC_SUBST(JAVAH) AC_SUBST(CONVERTTARGETS) JAVAH='javah -force -classpath $(OBJDIR)' CONVERTTARGETS= dnl case "$JAVA_VERSION" in dnl 1.1*) JAVAH='javah -classpath $(OBJDIR):$(CLASSPATH)'; CONVERTTARGETS=convert;; dnl *) JAVAH='javah -force -classpath $(OBJDIR)'; CONVERTTARGETS= ;; dnl esac AC_SUBST(OSNAME) AC_SUBST(ARCHNAME) AC_CANONICAL_HOST dnl AC_MSG_RESULT(cpu: ${host_cpu}) dnl AC_MSG_RESULT(vendor: ${host_vendor}) dnl AC_MSG_RESULT(os: ${host_os}) case "$host_cpu" in i386 | i486 | i586 | i686) ARCHNAME=i386;; esac case "$host_os" in linux*) case "$JAVA_VERSION" in 1.1.7*) OSNAME=genunix;; *) OSNAME=linux;; esac;; cygwin) OSNAME=win32;; esac AC_PREFIX_PROGRAM(javac) dnl check for jikes. Note: cannot use variable "JAVAC" as it is already used dnl in the check for prefix above AC_CHECK_PROG(COMPILER, jikes, jikes, javac) # set installation directory of plug-ins (extension directory) REL_JAVAEXTPATH=jre/lib/ext AC_SUBST(REL_JAVAEXTPATH) # set installation directory for native libraries REL_JAVAEXTLIBPATH=jre/lib/$ARCHNAME AC_SUBST(REL_JAVAEXTLIBPATH) dnl Checks for programs. AC_PROG_CC AC_PROG_INSTALL AC_PROG_LN_S AC_DISABLE_STATIC AC_PROG_LIBTOOL AC_SUBST(SUBDIRS) dnl Checks for libraries. SUBDIRS= AC_CHECK_LIB(asound, snd_seq_open,[SUBDIRS="$SUBDIRS src/lib/alsa"; AC_MSG_RESULT(Information: will build stuff for ALSA sequencer)],[AC_MSG_RESULT(Information: will not build stuff for ALSA sequencer)],) AC_CHECK_LIB(esd,esd_open_sound,[SUBDIRS="$SUBDIRS src/lib/esd"; AC_MSG_RESULT(Information: will build stuff for Enlightened Sound Daemon)],[AC_MSG_RESULT(Information: will not build stuff for Enlightened Sound Daemon)]) AC_CHECK_LIB(mp3lame,lame_init_params,[SUBDIRS="$SUBDIRS src/lib/lame"; AC_MSG_RESULT(Information: will build stuff for LAME mp3 encoder)],[AC_MSG_RESULT(Information: will not build stuff for LAME mp3 encoder)]) AC_CHECK_HEADER(linux/cdrom.h,[SUBDIRS="$SUBDIRS src/lib/cooked_ioctl"; AC_MSG_RESULT(Information: will build stuff for 'cooked ioctl' cdda)],[AC_MSG_RESULT(Information: will not build stuff for 'cooked ioctl' cdda)]) AC_CHECK_HEADER(cdda_interface.h,[SUBDIRS="$SUBDIRS src/lib/cdparanoia"; AC_MSG_RESULT(Information: will build stuff for cdparanoia)],[AC_MSG_RESULT(Information: will not build stuff for cdparanoia)]) AC_CHECK_HEADER(ogg/ogg.h,[SUBDIRS="$SUBDIRS src/lib/vorbis"; AC_MSG_RESULT(Information: will build stuff for vorbis)],[AC_MSG_RESULT(Information: will not build stuff for vorbis)]) AC_CHECK_HEADER(fluidsynth.h,[SUBDIRS="$SUBDIRS src/lib/fluidsynth"; AC_MSG_RESULT(Information: will build stuff for fluidsynth)],[AC_MSG_RESULT(Information: will NOT build stuff for fluidsynth)]) dnl AC_MSG_RESULT(hallo x${SUBDIRS}x) dnl check for javalayer decoder code AC_MSG_CHECKING(installed javalayer MP3 decoder) JL_LIB= JL_DIR= JL_TESTFILE=Decoder.java JL_TESTFILEPATH=jl/decoder JL_TESTPATH="javalayer ../javalayer javazoom ../javazoom" for JL_TESTDIR in $JL_TESTPATH; do dnl use PATH in order if test ".$JL_DIR" = "." && test -f "$JL_TESTDIR/$JL_TESTFILEPATH/$JL_TESTFILE"; then JL_DIR=$JL_TESTDIR fi done if test ".$JL_DIR" = "." ; then AC_MSG_RESULT(no) dnl AC_MSG_WARN(** You haven't downloaded the javalayer MP3 decoder. **) dnl AC_MSG_WARN(** MP3 decoding will not be possible. **) dnl AC_MSG_WARN(** Download the mp3 decoder with the following **) dnl AC_MSG_WARN(** commands: **) dnl AC_MSG_WARN(** SERVER=anonymous@cvs.javalayer.sourceforge.net **) dnl AC_MSG_WARN(** SERVERPATH=/cvsroot/javalayer **) dnl AC_MSG_WARN(** cvs -d:pserver:\$SERVER:\$SERVERPATH login **) dnl AC_MSG_WARN(** (press ENTER key for password) **) dnl AC_MSG_WARN(** cvs -z3 -d:pserver:\$SERVER:\$SERVERPATH co javalayer **) dnl better to exit here... dnl AC_MSG_ERROR(Exit.) else AC_MSG_RESULT(yes) JL_LIB=javalayer.jar dnl HACK: create a symbolic link for java layer code (cd $JL_DIR ; rm -f javazoom ; ln -sf `pwd` javazoom) fi AC_SUBST(JL_LIB) AC_SUBST(JL_DIR) dnl Checks for header files. AC_HEADER_STDC AC_CHECK_HEADERS(unistd.h) dnl Checks for typedefs, structures, and compiler characteristics. dnl AC_C_CONST dnl $$fb added SRC_ABSOLUTE_PATH=`pwd` AC_SUBST(SRC_ABSOLUTE_PATH) RM_F="rm -f" AC_SUBST(RM_F) MKDIR_P="mkdir -p" AC_SUBST(MKDIR_P) BUILD_DIR="build" DIST_DIR="dist" AC_SUBST(BUILD_DIR) AC_SUBST(DIST_DIR) AC_SUBST(JAR_INDEX) dnl set default for classpath. This may be changed below if Jikes is used DEF_CLASSPATH=${BUILD_DIR} AC_SUBST(DEF_CLASSPATH) dnl $$fb added dnl -------------- Features --------- dnl Compiler user option WARN_MSG= AC_MSG_CHECKING(use of jikes compiler) AC_ARG_WITH(jikes, [ --without-jikes Do not use jikes compiler] [ [default: use jikes if available]], CONFIG_JIKES="${withval}", CONFIG_JIKES="default") if test "${CONFIG_JIKES}" = "default" ; then if test "${COMPILER}" = "jikes" ; then CONFIG_JIKES="yes" else CONFIG_JIKES="no" fi elif test "${CONFIG_JIKES}" = "yes" && test "${COMPILER}" != "jikes" ; then WARN_MSG="you have selected jikes, but it is not available on your system !" CONFIG_JIKES="no" elif test "${CONFIG_JIKES}" = "no" ; then COMPILER=javac fi AC_MSG_RESULT(${CONFIG_JIKES}) if test "x${WARN_MSG}" != "x" ; then AC_MSG_WARN(${WARN_MSG}) fi if test "${CONFIG_JIKES}" = "yes" ; then DEF_CLASSPATH=${DEF_CLASSPATH}:${prefix}/jre/lib/rt.jar fi AC_OUTPUT(Makefile src/lib/common/Makefile src/lib/alsa/Makefile src/lib/cdparanoia/Makefile src/lib/cooked_ioctl/Makefile src/lib/esd/Makefile src/lib/lame/Makefile src/lib/vorbis/Makefile src/lib/pvorbis/Makefile src/lib/fluidsynth/Makefile doc/Makefile test/Makefile) libtritonus-java-20070428/version0000644000175000017500000000000510154074171016620 0ustar twernertwerner0.3.6libtritonus-java-20070428/test/0000755000175000017500000000000010621573032016173 5ustar twernertwernerlibtritonus-java-20070428/test/applets/0000755000175000017500000000000010621573012017641 5ustar twernertwernerlibtritonus-java-20070428/test/applets/ClipPlayerApplet.html0000644000175000017500000000202607075416457023763 0ustar twernertwerner ClipPlayerApplet

ClipPlayerApplet

No JDK 1.2 support for APPLET!!
Matthias Pfisterer
Last modified: Tue Nov 9 12:00:41 CET 1999 libtritonus-java-20070428/test/applets/ClipPlayerApplet.java0000644000175000017500000001123307075416457023740 0ustar twernertwerner/* * ClipPlayerApplet.java */ /* * Copyright (c) 1999 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.IOException; import java.net.URL; import java.net.MalformedURLException; import javax.media.sound.sampled.AudioFormat; import javax.media.sound.sampled.AudioInputStream; import javax.media.sound.sampled.AudioSystem; import javax.media.sound.sampled.Clip; import javax.media.sound.sampled.DataLine; import javax.media.sound.sampled.LineEvent; import javax.media.sound.sampled.LineListener; import javax.media.sound.sampled.LineUnavailableException; import javax.swing.JApplet; import javax.swing.JButton; import javax.swing.JPanel; public class ClipPlayerApplet extends JApplet implements LineListener { private AudioInputStream m_audioInputStream; private AudioFormat m_format; private Clip m_clip; private JPanel m_panel; private JButton m_loopButton; private JButton m_stopButton; public ClipPlayerApplet() { } public void init() { System.out.println("ClipPlayerApplet.init(): context class loader: " + Thread.currentThread().getContextClassLoader()); System.out.println("ClipPlayerApplet.init(): system class loader: " + ClassLoader.getSystemClassLoader()); String strClipURL = getParameter("clipurl"); System.out.println("URL str: " + strClipURL); URL clipURL = null; try { clipURL = new URL(getDocumentBase(), strClipURL); } catch (MalformedURLException e) { e.printStackTrace(); } System.out.println("URL: " + clipURL); loadClip(clipURL); JPanel panel = new JPanel(); this.getContentPane().add(panel); // TODO: label showing the url m_loopButton = new JButton("Loop"); m_loopButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { m_clip.loop(Clip.LOOP_CONTINUOUSLY); } }); panel.add(m_loopButton); m_stopButton = new JButton("Stop"); m_stopButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { m_clip.loop(0); } }); m_stopButton.setEnabled(false); panel.add(m_stopButton); } public void destroy() { if (m_clip != null) { m_clip.close(); } } private void loadClip(URL clipURL) { System.out.println("ClipPlayerApplet.loadClip(): setting another class loader"); ClassLoader originalClassLoader = Thread.currentThread().getContextClassLoader(); Thread.currentThread().setContextClassLoader(ClassLoader.getSystemClassLoader()); try { m_audioInputStream = AudioSystem.getAudioInputStream(clipURL); } catch (Exception e) { e.printStackTrace(); } if (m_audioInputStream != null) { m_format = m_audioInputStream.getFormat(); DataLine.Info info = new DataLine.Info(Clip.class, null, null, null, m_format, AudioSystem.NOT_SPECIFIED); try { m_clip = (Clip) AudioSystem.getLine(info); m_clip.addLineListener(this); m_clip.open(m_audioInputStream); } catch (LineUnavailableException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } // m_clip.loop(nLoopCount); } else { // TODO: popup (also for other error conditions) System.out.println("ClipPlayerApplet.(): can't get data from URL " + clipURL); } Thread.currentThread().setContextClassLoader(originalClassLoader); System.out.println("ClipPlayerApplet.loadClip(): restored the original class loader"); } public void update(LineEvent event) { System.out.println("ClipPlayerApplet.update(): received event: " + event); if (event.getType().equals(LineEvent.START)) { m_loopButton.setEnabled(false); m_stopButton.setEnabled(true); } if (event.getType().equals(LineEvent.STOP)) { m_loopButton.setEnabled(true); m_stopButton.setEnabled(false); } } } /*** ClipPlayerApplet.java ***/ libtritonus-java-20070428/test/.cvsignore0000644000175000017500000000003707672245572020214 0ustar twernertwernerMakefile *.class jswat.session libtritonus-java-20070428/test/AlsaCtlTest.java0000644000175000017500000000171707533234144021235 0ustar twernertwerner/* * AlsaCtlTest.java * * For testing the ALSA ctl low-level. */ import org.tritonus.lowlevel.alsa.AlsaCtl; import org.tritonus.lowlevel.alsa.AlsaCtlCardInfo; // TODO: dump pcm info public class AlsaCtlTest { public static void main(String[] args) throws Exception { String strCtlName = "hw:0"; if (args.length > 0) { strCtlName = args[0]; } System.out.println("Card: " + strCtlName); AlsaCtl ctl = new AlsaCtl(strCtlName, 0); AlsaCtlCardInfo cardInfo = new AlsaCtlCardInfo(); ctl.getCardInfo(cardInfo); ctl.close(); output(cardInfo); } private static void output(AlsaCtlCardInfo cardInfo) { System.out.println("card: " + cardInfo.getCard()); System.out.println("id: " + cardInfo.getId()); System.out.println("driver: " + cardInfo.getDriver()); System.out.println("name: " + cardInfo.getName()); System.out.println("longname: " + cardInfo.getLongname()); System.out.println("components: " + cardInfo.getComponents()); } } libtritonus-java-20070428/test/AlsaMixerTest.java0000644000175000017500000001004207533234144021566 0ustar twernertwerner/* * AlsaMixerTest.java */ import org.tritonus.lowlevel.alsa.AlsaMixer; import org.tritonus.lowlevel.alsa.AlsaMixerElement; public class AlsaMixerTest { private static boolean sm_bShowInactiveElements; public static void main(String[] args) throws Exception { String strMixerName = "hw:0"; if (args.length > 0) { strMixerName = args[0]; } out("Mixer: " + strMixerName); AlsaMixer mixer = new AlsaMixer(strMixerName); int[] anIndices = new int[200]; String[] astrNames = new String[200]; int nReturn = mixer.readControlList(anIndices, astrNames); out("readControlList() returns: " + nReturn); if (nReturn > 0) { out("Mixer controls:"); for (int i = 0; i < nReturn; i++) { out("" + i + " " + anIndices[i] + " " + astrNames[i]); AlsaMixerElement element = new AlsaMixerElement(mixer, anIndices[i], astrNames[i]); if (element.isActive() || sm_bShowInactiveElements) { out("--------------------------------------------------------------------------------"); output(element); } } out("--------------------------------------------------------------------------------"); } mixer.close(); } private static void output(AlsaMixerElement element) { out(" name: " + element.getName()); out(" index: " + element.getName()); out(" active: " + element.isActive()); if (hasPlaybackChannels(element)) { outputPlayback(element); } else { out("* no playback channels"); } if (hasCaptureChannels(element)) { outputCapture(element); } else { out("* no capture channels"); } } private static void outputPlayback(AlsaMixerElement element) { out(" playback mono: " + element.isPlaybackMono()); for (int nChannel = AlsaMixerElement.SND_MIXER_SCHN_FRONT_LEFT; nChannel <= AlsaMixerElement.SND_MIXER_SCHN_WOOFER; nChannel++) { out(" playback channel (" + AlsaMixerElement.getChannelName(nChannel) + "): " + element.hasPlaybackChannel(nChannel)); } out(" common volume: " + element.hasCommonVolume()); out(" playback volume: " + element.hasPlaybackVolume()); out(" playback volume joined: " + element.hasPlaybackVolumeJoined()); out(" common switch: " + element.hasCommonSwitch()); out(" playback switch: " + element.hasPlaybackSwitch()); out(" playback switch joined: " + element.hasPlaybackSwitchJoined()); } private static void outputCapture(AlsaMixerElement element) { out(" capture mono: " + element.isCaptureMono()); for (int nChannel = AlsaMixerElement.SND_MIXER_SCHN_FRONT_LEFT; nChannel <= AlsaMixerElement.SND_MIXER_SCHN_WOOFER; nChannel++) { out(" capture channel (" + AlsaMixerElement.getChannelName(nChannel) + "): " + element.hasCaptureChannel(nChannel)); } out(" common volume: " + element.hasCommonVolume()); out(" capture volume: " + element.hasCaptureVolume()); out(" capture volume joined: " + element.hasCaptureVolumeJoined()); out(" common switch: " + element.hasCommonSwitch()); out(" capture switch: " + element.hasCaptureSwitch()); out(" capture switch joined: " + element.hasCaptureSwitchJoinded()); out(" capture switch exclusive: " + element.hasCaptureSwitchExclusive()); if (element.hasCaptureSwitchExclusive()) { out(" capture group: " + element.getCaptureGroup()); } } private static boolean hasPlaybackChannels(AlsaMixerElement element) { boolean bHasChannels = false; for (int nChannel = AlsaMixerElement.SND_MIXER_SCHN_FRONT_LEFT; nChannel <= AlsaMixerElement.SND_MIXER_SCHN_WOOFER; nChannel++) { bHasChannels |= element.hasPlaybackChannel(nChannel); } return bHasChannels; } private static boolean hasCaptureChannels(AlsaMixerElement element) { boolean bHasChannels = false; for (int nChannel = AlsaMixerElement.SND_MIXER_SCHN_FRONT_LEFT; nChannel <= AlsaMixerElement.SND_MIXER_SCHN_WOOFER; nChannel++) { bHasChannels |= element.hasCaptureChannel(nChannel); } return bHasChannels; } private static void out(String strMessage) { System.out.println(strMessage); } } /*** AlsaMixerTest.java ***/ libtritonus-java-20070428/test/BufferingTest.java0000644000175000017500000000412707433153551021620 0ustar twernertwerner/* * BufferingTest.java */ /* * Copyright (c) 1999, 2000 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ import java.io.BufferedInputStream; import java.io.ByteArrayInputStream; import java.io.FileInputStream; import java.io.InputStream; import java.io.IOException; public class BufferingTest { public static void main(String[] args) throws IOException { // byte[] abData = new byte[]{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; // ByteArrayInputStream bais = new ByteArrayInputStream(abData); // System.out.println(bais.markSupported()); // bais.mark(15); // bais.reset(); FileInputStream fis = new FileInputStream("BufferingTest.java"); System.out.println("FileInputStream supports mark: " + fis.markSupported()); BufferedInputStream bis = new BufferedInputStream(fis, 5); byte[] abRead1 = new byte[9]; byte[] abRead2 = new byte[9]; byte[] abRead3 = new byte[9]; byte[] abRead4 = new byte[9]; bis.mark(9); bis.read(abRead1); bis.mark(9); bis.read(abRead2); bis.reset(); bis.read(abRead3); bis.reset(); bis.read(abRead4); for (int i = 0; i < abRead1.length; i++) { if (abRead1[i] != abRead4[i]) { System.out.println("1 difference!!"); } } for (int i = 0; i < abRead1.length; i++) { if (abRead2[i] != abRead3[i]) { System.out.println("2 difference!!"); } } } } /*** BufferingTest.java ***/ libtritonus-java-20070428/test/CddaMidLevelTest.java0000644000175000017500000000566507422010434022164 0ustar twernertwerner/* * CddaMidLevelTest.java */ /* * Copyright (c) 2001 - 2002 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* programs related to cdda: command-line extractor cd player extractor/mp3 encoder */ import java.io.InputStream; import java.io.IOException; import javax.sound.sampled.AudioFormat; import javax.sound.sampled.AudioInputStream; import javax.sound.sampled.AudioSystem; import javax.sound.sampled.SourceDataLine; import javax.sound.sampled.DataLine; import javax.sound.sampled.Line; import javax.sound.sampled.LineUnavailableException; import org.tritonus.lowlevel.cdda.CddaMidLevel; import org.tritonus.lowlevel.cdda.CddaUtils; public class CddaMidLevelTest { public static void main(String[] args) { boolean bTocOnly = true; int nTrack = 0; if (args.length < 1) { bTocOnly = true; } else if (args.length == 1) { nTrack = Integer.parseInt(args[0]); bTocOnly = false; } CddaMidLevel cddaMidLevel = CddaUtils.getCddaMidLevel(); InputStream tocInputStream = null; try { tocInputStream = cddaMidLevel.getTocAsXml("TODO:"); } catch (IOException e) { e.printStackTrace(); } byte[] abData = new byte[4096]; int nRead; try { while ((tocInputStream.read(abData)) >= 0) { System.out.print(new String(abData)); } } catch (IOException e) { e.printStackTrace(); } System.out.print("\n"); if (! bTocOnly) { AudioInputStream track = null; SourceDataLine line = null; AudioFormat audioFormat = new AudioFormat( AudioFormat.Encoding.PCM_SIGNED, 44100.0F, 16, 2, 4, 44100.0F, false); Line.Info info = new DataLine.Info(SourceDataLine.class, audioFormat); abData = new byte[2352 * 8]; try { track = cddaMidLevel.getTrack("TODO:", nTrack); } catch (IOException e) { e.printStackTrace(); } try { line = (SourceDataLine) AudioSystem.getLine(info); line.open(); line.start(); } catch (LineUnavailableException e) { e.printStackTrace(); } try { while ((nRead = track.read(abData)) >= 0) { line.write(abData, 0, nRead); } } catch (IOException e) { e.printStackTrace(); } } // cdda.close(); } } /*** CddaMidLevelTest.java ****/ libtritonus-java-20070428/test/CdparanoiaTest.java0000644000175000017500000000453707414607217021761 0ustar twernertwerner/* * CdparanoiaTest.java */ import javax.sound.sampled.AudioFormat; import javax.sound.sampled.AudioSystem; import javax.sound.sampled.SourceDataLine; import javax.sound.sampled.DataLine; import javax.sound.sampled.Line; import javax.sound.sampled.LineUnavailableException; import org.tritonus.lowlevel.cdda.cdparanoia.Cdparanoia; public class CdparanoiaTest { public static void main(String[] args) { String strDevice = "/dev/cdrom"; boolean bTocOnly = true; int nTrack = 0; if (args.length < 1) { bTocOnly = true; } else if (args.length == 1) { nTrack = Integer.parseInt(args[0]); bTocOnly = false; } Cdparanoia cdparanoia = new Cdparanoia(strDevice); int[] anValues = new int[2]; int[] anStartFrame = new int[100]; int[] anLength = new int[100]; int[] anType = new int[100]; boolean[] abCopy = new boolean[100]; boolean[] abPre = new boolean[100]; int[] anChannels = new int[100]; cdparanoia.readTOC(anValues, anStartFrame, anLength, anType, abCopy, abPre, anChannels); System.out.println("First track: " + anValues[0]); System.out.println("last track: " + anValues[1]); int nTracks = anValues[1] - anValues[0] + 1; for (int i = 0; i < nTracks; i++) { System.out.println("Track " + (i + anValues[0]) + " start frame: " + anStartFrame[i]); System.out.println("Track " + (i + anValues[0]) + " length: " + anLength[i]); System.out.println("Track " + (i + anValues[0]) + " type: " + anType[i]); System.out.println("Track " + (i + anValues[0]) + " copy: " + abCopy[i]); System.out.println("Track " + (i + anValues[0]) + " pre: " + abPre[i]); System.out.println("Track " + (i + anValues[0]) + " channels: " + anChannels[i]); } if (! bTocOnly) { SourceDataLine line = null; AudioFormat audioFormat = new AudioFormat( AudioFormat.Encoding.PCM_SIGNED, 44100.0F, 16, 2, 4, 44100.0F, false); Line.Info info = new DataLine.Info(SourceDataLine.class, audioFormat); byte[] abData = new byte[2352 * 8]; try { line = (SourceDataLine) AudioSystem.getLine(info); line.open(); line.start(); } catch (LineUnavailableException e) { e.printStackTrace(); } for (int i = anStart[nTrack - 1]; i < anStart[nTrack ]; i++) { cdparanoia.readFrame(i, 1, abData); line.write(abData, 0, 2352); } } cdparanoia.close(); } } /*** CdparanoiaTest.java ****/ libtritonus-java-20070428/test/CookedIoctlTest.java0000644000175000017500000000467407414607217022121 0ustar twernertwerner/* * CookedIoctlTest.java */ import javax.sound.sampled.AudioFormat; import javax.sound.sampled.AudioSystem; import javax.sound.sampled.SourceDataLine; import javax.sound.sampled.DataLine; import javax.sound.sampled.Line; import javax.sound.sampled.LineUnavailableException; import org.tritonus.lowlevel.cdda.cooked_ioctl.CookedIoctl; public class CookedIoctlTest { public static void main(String[] args) { String strDevice = "/dev/cdrom"; boolean bTocOnly = true; int nTrack = 0; if (args.length < 1) { bTocOnly = true; } else if (args.length == 1) { nTrack = Integer.parseInt(args[0]); bTocOnly = false; } CookedIoctl cookedIoctl = new CookedIoctl(strDevice); int[] anValues = new int[2]; int[] anStartFrame = new int[100]; int[] anLength = new int[100]; int[] anType = new int[100]; boolean[] abCopy = new boolean[100]; boolean[] abPre = new boolean[100]; int[] anChannels = new int[100]; cookedIoctl.readTOC(anValues, anStartFrame, anLength, anType, abCopy, abPre, anChannels); System.out.println("First track: " + anValues[0]); System.out.println("last track: " + anValues[1]); int nTracks = anValues[1] - anValues[0] + 1; for (int i = 0; i < nTracks; i++) { System.out.println("Track " + (i + anValues[0]) + " start frame: " + anStartFrame[i]); System.out.println("Track " + (i + anValues[0]) + " length: " + anLength[i]); System.out.println("Track " + (i + anValues[0]) + " type: " + anType[i]); System.out.println("Track " + (i + anValues[0]) + " copy: " + abCopy[i]); System.out.println("Track " + (i + anValues[0]) + " pre: " + abPre[i]); System.out.println("Track " + (i + anValues[0]) + " channels: " + anChannels[i]); } if (! bTocOnly) { SourceDataLine line = null; AudioFormat audioFormat = new AudioFormat( AudioFormat.Encoding.PCM_SIGNED, 44100.0F, 16, 2, 4, 44100.0F, false); Line.Info info = new DataLine.Info(SourceDataLine.class, audioFormat); byte[] abData = new byte[2352 * 8]; try { line = (SourceDataLine) AudioSystem.getLine(info); line.open(); line.start(); } catch (LineUnavailableException e) { e.printStackTrace(); } int nStart = anStartFrame[nTrack - anValues[0]]; int nEnd = nStart + anLength[nTrack - anValues[0]]; for (int i = nStart; i < nEnd; i++) { cookedIoctl.readFrame(i, 1, abData); line.write(abData, 0, 2352); } } cookedIoctl.close(); } } /*** CookedIoctlTest.java ****/ libtritonus-java-20070428/test/CreateEmptySequence.java0000644000175000017500000000535007417034626022766 0ustar twernertwerner/* * CreateEmptySequence.java * * TODO: short description */ /* * Copyright (c) 2000 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ import java.io.File; import java.io.IOException; import javax.sound.midi.Sequence; import javax.sound.midi.MetaMessage; import javax.sound.midi.MidiEvent; import javax.sound.midi.MidiSystem; import javax.sound.midi.Track; import javax.sound.midi.InvalidMidiDataException; /** Creates a Sequence with only a end-of-track message. */ public class CreateEmptySequence { public static void main(String[] args) { if (args.length != 4) { out("usage:"); out("java CreateEmptySequence "); System.exit(1); } long lDuration = Long.parseLong(args[0]); int nTempoInMPQ = Integer.parseInt(args[1]); int nResolution = Integer.parseInt(args[2]); String strFilename = args[3]; out("Clock distance (s): " + nTempoInMPQ / 24); out("Tick distance (s): " + nTempoInMPQ / nResolution); Sequence sequence = null; try { sequence = new Sequence(Sequence.PPQ, nResolution); Track track = sequence.createTrack(); MetaMessage mm = null; MidiEvent me = null; mm = new MetaMessage(); byte[] abTempo = new byte[3]; abTempo[0] = (byte) ((nTempoInMPQ >> 16) & 0xFF); abTempo[1] = (byte) ((nTempoInMPQ >> 8) & 0xFF); abTempo[2] = (byte) ((nTempoInMPQ) & 0xFF); mm.setMessage(0x51, abTempo, 3); me = new MidiEvent(mm, 0); track.add(me); mm = new MetaMessage(); mm.setMessage(0x2F, new byte[0], 0); me = new MidiEvent(mm, lDuration); track.add(me); } catch (InvalidMidiDataException e) { e.printStackTrace(); System.exit(1); } try { MidiSystem.write(sequence, 0, new File(strFilename)); } catch (IOException e) { e.printStackTrace(); System.exit(1); } /* * This is only necessary because of a bug in the Sun jdk1.3 */ System.exit(0); } private static void out(String strMessage) { System.out.println(strMessage); } } /*** CreateEmptySequence.java ***/ libtritonus-java-20070428/test/CreateSysexSequence.java0000644000175000017500000000752707535604216023012 0ustar twernertwerner/* * CreateSysexSequence.java * * TODO: short description */ /* * Copyright (c) 2000 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ import java.io.File; import java.io.IOException; import javax.sound.midi.Sequence; import javax.sound.midi.SysexMessage; import javax.sound.midi.MetaMessage; import javax.sound.midi.MidiEvent; import javax.sound.midi.MidiSystem; import javax.sound.midi.Track; import javax.sound.midi.InvalidMidiDataException; /** Creates a Sequence with some sysex messages. [F0 01 F7] [F0 F7] [F0 02] [F7 F7] [F0 03] ?? [F7] ?? [F7 F0 04 F7] */ public class CreateSysexSequence { public static void main(String[] args) throws IOException, InvalidMidiDataException { if (args.length != 1) { out("usage:"); out("java CreateSysexSequence "); System.exit(1); } int nResolution = 480; String strFilename = args[0]; Sequence sequence = new Sequence(Sequence.PPQ, nResolution); Track track = sequence.createTrack(); SysexMessage sm = null; MetaMessage mm = null; MidiEvent me = null; byte[] abData; // [F0 01 F7] sm = new SysexMessage(); abData = new byte[]{(byte) 0xF0, (byte) 0x01, (byte) 0xF7}; sm.setMessage(abData, abData.length); me = new MidiEvent(sm, 0); track.add(me); // // [F0 F7] // sm = new SysexMessage(); // abData = new byte[]{(byte) 0xF0, (byte) 0xF7}; // sm.setMessage(abData, abData.length); // me = new MidiEvent(sm, 0); // track.add(me); // [F0 02] sm = new SysexMessage(); abData = new byte[]{(byte) 0xF0, (byte) 0x02}; sm.setMessage(abData, abData.length); me = new MidiEvent(sm, 0); track.add(me); // [F7 02 F7] sm = new SysexMessage(); abData = new byte[]{(byte) 0xF7, (byte) 0x02, (byte) 0xF7}; sm.setMessage(abData, abData.length); me = new MidiEvent(sm, 0); track.add(me); // // [F0 02] // sm = new SysexMessage(); // abData = new byte[]{(byte) 0xF0, (byte) 0x02}; // sm.setMessage(abData, abData.length); // me = new MidiEvent(sm, 0); // track.add(me); // // [F7 F7] // sm = new SysexMessage(); // abData = new byte[]{(byte) 0xF7, (byte) 0xF7}; // sm.setMessage(abData, abData.length); // me = new MidiEvent(sm, 0); // track.add(me); // // [F0 03] // sm = new SysexMessage(); // abData = new byte[]{(byte) 0xF0, (byte) 0x03}; // sm.setMessage(abData, abData.length); // me = new MidiEvent(sm, 0); // track.add(me); // // [F7] // sm = new SysexMessage(); // abData = new byte[]{(byte) 0xF7}; // sm.setMessage(abData, abData.length); // me = new MidiEvent(sm, 0); // track.add(me); // [F7 F0 04 F7] sm = new SysexMessage(); abData = new byte[]{(byte) 0xF7, (byte) 0xF0, (byte) 0x04, (byte) 0xF7}; sm.setMessage(abData, abData.length); me = new MidiEvent(sm, 0); track.add(me); mm = new MetaMessage(); mm.setMessage(0x2F, new byte[0], 0); me = new MidiEvent(mm, 10); track.add(me); MidiSystem.write(sequence, 0, new File(strFilename)); /* * This is only necessary because of a bug in the Sun jdk1.3 */ System.exit(0); } private static void out(String strMessage) { System.out.println(strMessage); } } /*** CreateSysexSequence.java ***/ libtritonus-java-20070428/test/DefaultMixer.java0000644000175000017500000000036407171000410021421 0ustar twernertwernerimport javax.sound.sampled.AudioSystem; import javax.sound.sampled.Mixer; public class DefaultMixer { public static void main(String[] args) { Mixer mixer = AudioSystem.getMixer(null); System.out.println("default mixer:" + mixer); } } libtritonus-java-20070428/test/FormatConversionProviderTest.java0000644000175000017500000001423307615320136024716 0ustar twernertwerner/* * FormatConversionProviderTest.java */ import java.util.ArrayList; import java.util.List; import javax.sound.sampled.AudioFormat; import javax.sound.sampled.AudioFormat.Encoding; import javax.sound.sampled.AudioSystem; import javax.sound.sampled.spi.FormatConversionProvider; public class FormatConversionProviderTest { private static final float[] COMMON_SAMPLE_RATES = { 8000.0F, 11025.0F, 16000.0F, 22050.0F, 32000.0F, 44100.0F, 48000.0F, 96000.0F, }; private static final int[] COMMON_SAMPLE_SIZES = { 8, 16, 24, 32, }; private static final int[] COMMON_CHANNELS = { 1, 2, }; public static void main(String[] args) throws Exception { String strProviderClassName = args[0]; FormatConversionProvider provider = getProvider(strProviderClassName); outSeparator(); out("FormatConversionProvider: " + provider.getClass().getName()); outSeparator(); Encoding[] aSourceEncodings = provider.getSourceEncodings(); out("Source Encodings:"); out(aSourceEncodings); outSeparator(); Encoding[] aTargetEncodings = provider.getTargetEncodings(); out("Target Encodings:"); out(aTargetEncodings); outSeparator(); for (int i = 0; i < aSourceEncodings.length; i++) { outTargetEncodingsForFormat(provider, aSourceEncodings[i]); } // test getAudioInputStream(AudioFormat.Encoding targetEncoding, AudioInputStream sourceStream) for (int nSourceEncoding = 0; nSourceEncoding < aSourceEncodings.length; nSourceEncoding++) { Encoding sourceEncoding = aSourceEncodings[nSourceEncoding]; AudioFormat[] aSourceFormats = createAudioFormatsForEncoding(sourceEncoding); for (int nSourceFormat = 0; nSourceFormat < aSourceFormats.length; nSourceFormat++) { AudioFormat sourceFormat = aSourceFormats[nSourceFormat]; for (int nTargetEncoding = 0; nTargetEncoding < aTargetEncodings.length; nTargetEncoding++) { Encoding targetEncoding = aTargetEncodings[nTargetEncoding]; boolean bSupported = provider.isConversionSupported(targetEncoding, sourceFormat); out("conversion supported " + getAudioFormatString(sourceFormat) + " --> " + targetEncoding + ": " + bSupported); } } } } private static void outTargetEncodingsForFormat( FormatConversionProvider provider, Encoding sourceEncoding) { AudioFormat audioFormat = new AudioFormat( sourceEncoding, AudioSystem.NOT_SPECIFIED, AudioSystem.NOT_SPECIFIED, AudioSystem.NOT_SPECIFIED, AudioSystem.NOT_SPECIFIED, AudioSystem.NOT_SPECIFIED, false); Encoding[] aTargetEncodingsForFormat = provider.getTargetEncodings(); out("Target Encodings for " + getAudioFormatString(audioFormat)); out(aTargetEncodingsForFormat); outSeparator(); } private static AudioFormat[] createAudioFormatsForEncoding(Encoding encoding) { List formats = new ArrayList(); if (encoding == Encoding.PCM_SIGNED || encoding == Encoding.PCM_UNSIGNED) { for (int nSampleSizeIndex = 0; nSampleSizeIndex < COMMON_SAMPLE_SIZES.length; nSampleSizeIndex++) { createAudioFormatsForEncodingSub(formats, encoding, COMMON_SAMPLE_SIZES[nSampleSizeIndex]); } } else if (encoding == Encoding.ALAW || encoding == Encoding.ULAW) { createAudioFormatsForEncodingSub(formats, encoding, 8); } return (AudioFormat[]) formats.toArray(new AudioFormat[0]); } private static void createAudioFormatsForEncodingSub(List formats, Encoding encoding, int nSampleSizeInBits) { for (int nSampleRateIndex = 0; nSampleRateIndex < COMMON_SAMPLE_RATES.length; nSampleRateIndex++) { for (int nChannelIndex = 0; nChannelIndex < COMMON_CHANNELS.length; nChannelIndex++) { for (int nEndianess = 0; nEndianess <= 1; nEndianess++) { boolean bEndianess = (nEndianess == 0); AudioFormat format = new AudioFormat( encoding, COMMON_SAMPLE_RATES[nSampleRateIndex], nSampleSizeInBits, COMMON_CHANNELS[nChannelIndex], nSampleSizeInBits * COMMON_CHANNELS[nChannelIndex] / 8, COMMON_SAMPLE_RATES[nSampleRateIndex], bEndianess); formats.add(format); } } } } private static FormatConversionProvider getProvider(String strProviderClassName) throws Exception { Class providerClass = Class.forName(strProviderClassName); FormatConversionProvider provider = (FormatConversionProvider) providerClass.newInstance(); return provider; } private static String getAudioFormatString(AudioFormat audioFormat) { return getAudioFormatStringImpl0(audioFormat); } private static String getAudioFormatStringImpl0(AudioFormat audioFormat) { StringBuffer strBuf = new StringBuffer(); strBuf.append(audioFormat.getEncoding().toString()); strBuf.append(", "); strBuf.append(audioFormat.getSampleRate()); strBuf.append(" Hz , "); strBuf.append(audioFormat.getSampleSizeInBits()); strBuf.append(" bit , "); strBuf.append(audioFormat.getChannels()); strBuf.append(" ch, "); strBuf.append(audioFormat.getFrameSize()); strBuf.append(" byte, "); strBuf.append(audioFormat.getFrameRate()); strBuf.append(" Hz, "); strBuf.append(audioFormat.isBigEndian() ? "BE" : "le"); return strBuf.toString(); } private static String getAudioFormatStringImpl1(AudioFormat audioFormat) { StringBuffer strBuf = new StringBuffer(); strBuf.append("enc: "); strBuf.append(audioFormat.getEncoding().toString()); strBuf.append(", sr: "); strBuf.append(audioFormat.getSampleRate()); strBuf.append(", ss: "); strBuf.append(audioFormat.getSampleSizeInBits()); strBuf.append(", ch: "); strBuf.append(audioFormat.getChannels()); strBuf.append(", fs: "); strBuf.append(audioFormat.getFrameSize()); strBuf.append(", fr: "); strBuf.append(audioFormat.getFrameRate()); strBuf.append(audioFormat.isBigEndian() ? ", BE" : ", le"); return strBuf.toString(); } private static void out(Encoding[] aEncodings) { for (int i = 0; i < aEncodings.length; i++) { out(aEncodings[i].toString()); } } private static void outSeparator() { out("------------------------------------------------------------------------------"); } private static void out(String strMessage) { System.out.println(strMessage); } } /*** FormatConversionProviderTest.java ****/ libtritonus-java-20070428/test/Makefile.in0000644000175000017500000000233707424210111020236 0ustar twernertwerner# test of tritonus lib # # NOTE: to run these programs successfully, you must have Tritonus already # installed. See the file INSTALL. # TESTCLASS=Sine #SOUNDFILE=../../sounds/flute+hrn+mrmba.au #SOUNDFILE=../../sounds/22-new.aif #SOUNDFILE=../../sounds/welcome.wav SOUNDFILE=../../sounds/spacemusic.au # u-law #SOUNDFILE=welcome.wav JAVAC=javac %.class: %.java $(JAVAC) -d $(DESTDIR) $< #JAVAFLAGS=-Djava.compiler=NONE PATHSETTINGS=export CLASSPATH=.:../tritonus.jar:$(CLASSPATH); export LD_LIBRARY_PATH=../src/lib/nas:../src/lib/esd SRCDIR=. DESTDIR=. OBJDIR=$(DESTDIR) vpath %.class $(OBJDIR) vpath %.java $(SRCDIR) SRCTMP:=$(wildcard \ $(SRCDIR)/*.java \ ) SRC:=$(notdir $(SRCTMP)) OBJ:=$(SRC:.java=.class) #----------------- rules ------------------- .PHONY: all all: $(OBJ) .PHONY: test test: all $(PATHSETTINGS); java $(JAVAFLAGS) Sine .PHONY: testsaint testsaint: saint.class java $(JAVAFLAGS) saint -c ../../../sounds/sa/equalizer.saol -s ../../../sounds/sa/eq.sasl -o test.out cksum *.out .PHONY: testsaint2 testsaint2: saint.class SourceDataLineOutputStream.class java $(JAVAFLAGS) saint -c ../../../sounds/sa/equalizer.saol -s ../../../sounds/sa/eq.sasl -f s16l -o + .PHONY: clean clean: rm -rf *.class *~ .\#* libtritonus-java-20070428/test/MeasureThreadSleep.java0000644000175000017500000000254707747433023022602 0ustar twernertwerner/* * MeasureThreadSleep.java */ /* Sun JDK 1.4.2 or later is required to compile and run this program. */ import sun.misc.Perf; public class MeasureThreadSleep { public static void main(String[] args) { if (args.length == 0 || args.length > 2) { printUsageAndExit(); } int millis = Integer.parseInt(args[0]); int nanos = -1; if (args.length== 2) { nanos = Integer.parseInt(args[1]); } Perf perf = Perf.getPerf(); // may throw SecurityException long ticksPerSecond = perf.highResFrequency(); for (int i = 0; i < 10; i++) { try { long start; long end; if (nanos != -1) { start = (perf.highResCounter() * 1000) / ticksPerSecond; Thread.sleep(millis, nanos); end = (perf.highResCounter() * 1000) / ticksPerSecond; } else { start = (perf.highResCounter() * 1000) / ticksPerSecond; Thread.sleep(millis); end = (perf.highResCounter() * 1000) / ticksPerSecond; } out("measured duration (ms): " + (end - start)); } catch (InterruptedException e) { // IGNORE } } } private static void printUsageAndExit() { out("MeasureThreadSleep: usage:"); out("\tjava MeasureThreadSleep []"); System.exit(1); } private static void out(String strMessage) { System.out.println(strMessage); } } /*** MeasureThreadSleep.java ***/ libtritonus-java-20070428/test/MidiMessageTest.java0000644000175000017500000001362207507256564022112 0ustar twernertwerner/* * MidiMessageTest.java */ import javax.sound.midi.InvalidMidiDataException; import javax.sound.midi.MidiMessage; import javax.sound.midi.ShortMessage; import javax.sound.midi.MetaMessage; import javax.sound.midi.SysexMessage; public class MidiMessageTest { public static void main(String[] args) { String strType = args[0]; if (strType.equals("base")) { baseMessage(); } else if (strType.equals("short")) { shortMessage(); } else if (strType.equals("sysex")) { sysexMessage(); } else if (strType.equals("meta")) { metaMessage(); } else { System.out.println("use one of 'base', 'short', 'sysex' and 'meta'"); } } private static void baseMessage() { byte[] data = new byte[1]; MidiMessage m; byte[] t1; byte[] t2; int l1; data[0] = 5; m = new TestMessage(data); t1 = m.getMessage(); l1 = m.getLength(); if (t1.length == data.length) { out("MidiMessage.getMessage() returns length of the array passed to MidiMessage.(byte[])"); } else { out("MidiMessage.getMessage() returns length different from the array passed to MidiMessage.(byte[])"); } if (l1 == t1.length) { out("MidiMessage.getLength() returns length of the array returned by MidiMessage.getMessage()"); } else { out("MidiMessage.getLength() returns length different from the array returned by MidiMessage.getMessage()"); } if (l1 == data.length) { out("MidiMessage.getLength() returns length of the array passed to MidiMessage.(byte[])"); } else { out("MidiMessage.getLength() returns length different from the array passed to MidiMessage.(byte[])"); } if (data[0] != t1[0]) { out("MidiMessage.getMessage() returns wrong data; cannot test copying"); } data[0] = 77; t2 = m.getMessage(); if (data[0] == t2[0]) { out("MidiMessage.(byte[]) does not copy"); } else if (t2[0] != 5) { out("MidiMessage.(byte[]) or MidiMessage.getMessage() do something obscure"); } else { out("MidiMessage.(byte[]) does copy"); } data[0] = 5; m = new TestMessage(data); t1 = m.getMessage(); t1[0] = 88; t2 = m.getMessage(); if (t1 == t2) { out("MidiMessage.getMessage() returns the same reference on subsequent invocations (indicates not copying)"); } else { out("MidiMessage.getMessage() returns the different reference on subsequent invocations (indicates copying)"); } if (t1[0] == t2[0]) { out("MidiMessage.getMessage() does not copy"); } else if (t2[0] != 5) { out("MidiMessage.getMessage() or MidiMessage.getMessage() do something obscure"); } else { out("MidiMessage.getMessage() does copy"); } out("----------------------------------------"); } private static void shortMessage() { byte[] data = new byte[1]; MidiMessage m; byte[] t1; byte[] t2; int l1; ShortMessage sm = new ShortMessage(); t1 = sm.getMessage(); l1 = sm.getLength(); out("ShortMessage() data: "); out(t1); out("ShortMessage().getLength(): " + l1); out("ShortMessage().getStatus(): " + sm.getStatus()); out("ShortMessage().getData1(): " + sm.getData1()); out("ShortMessage().getData2(): " + sm.getData2()); out("----------------------------------------"); } private static void sysexMessage() { byte[] data = new byte[1]; MidiMessage m; byte[] t1; byte[] t2; int l1; SysexMessage sxm = new SysexMessage(); t1 = sxm.getMessage(); l1 = sxm.getLength(); out("SysexMessage() data: "); out(t1); out("SysexMessage().getLength(): " + l1); out("----------------------------------------"); sxm = new SysexMessage(); byte[] databytes ={(byte) 240,120,100,100,(byte) 247}; try { sxm.setMessage(databytes,5); } catch (InvalidMidiDataException e) { e.printStackTrace(); } out("SysexMessage.getMessage(): "); out(sxm.getMessage()); out("SysexMessage.getData(): "); out(sxm.getData()); out("SysexMessage.getLength(): " + sxm.getLength()); out("SysexMessage.getStatus(): " + sxm.getStatus()); } private static void metaMessage() { byte[] data = new byte[1]; MidiMessage m; byte[] t1; byte[] t2; int l1; MetaMessage mm = new MetaMessage(); t1 = mm.getMessage(); l1 = mm.getLength(); out("MetaMessage() data: "); out(t1); out("MetaMessage().getLength(): " + l1); out("----------------------------------------"); mm = new MetaMessage(); String strTitle = "no name"; while (strTitle.length() < 200) { strTitle += strTitle; } // setting sequence/track name try { mm.setMessage(3, strTitle.getBytes(), strTitle.length() - 1); } catch (InvalidMidiDataException e) { e.printStackTrace(); } out("MetaMessage() getMessage(): "); out(mm.getMessage()); out("MetaMessage() getData(): "); out(mm.getData()); out("MetaMessage().getLength(): " + mm.getLength()); out("MetaMessage().getStatus(): " + mm.getStatus()); out("MetaMessage().getType(): " + mm.getType()); out("----------------------------------------"); } public static class TestMessage extends MidiMessage { /* This constructor passes null to the superclass constructor. This can be used to test the behaviour if the message content is not set correctely. */ public TestMessage() { super(null); } /* This constructor passes the passed byte array reference straight ahead to the superclass constructor. This can be used to test if the MidiMessage constructor copies the passed array. */ public TestMessage(byte[] abData) { super(abData); } /* not implemented for now. */ public Object clone() { return null; } } /* only for lazy people. */ private static void out(String strMessage) { System.out.println(strMessage); } private static void out(byte[] abArray) { out("data length: " + abArray.length); for (int i = 0; i < abArray.length; i++) { out("" + abArray[i]); } } } /*** MidiMessageTest.java ***/ libtritonus-java-20070428/test/PrintJavaHome.java0000644000175000017500000000020207322675746021562 0ustar twernertwernerpublic class PrintJavaHome { public static void main(String[] args) { System.out.print(System.getProperty("java.home")); } } libtritonus-java-20070428/test/README.txt0000644000175000017500000000112707534234427017705 0ustar twernertwernerREADME for tritonus/test Most programs in this directory have been developed for special purposes during the implementation of Tritonus. They are not intended as general tests. Some are outdated and won't compile. As reference programs for testing Tritonus installations, use programs from the Java Sound Examples: http://www.jsresources.org/exampes/ Especially recommanded are AudioPlayer and MidiPlayer. The directory suite contains a test suite for Tritonus. It is based on junit. Parts of the test suite are of general nature, so that other Java Sound implementations can be tested with it. libtritonus-java-20070428/test/SkipTest.java0000644000175000017500000001216507177050541020620 0ustar twernertwerner/* * SkipTest.java */ /* * Copyright (c) 1999, 2000 by Matthias Pfisterer * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ import java.io.InputStream; import java.io.IOException; import java.io.FileNotFoundException; import java.io.File; import java.net.URL; import javax.sound.sampled.AudioFileFormat; import javax.sound.sampled.AudioFormat; import javax.sound.sampled.AudioInputStream; import javax.sound.sampled.AudioSystem; public class SkipTest { private static final int LOAD_METHOD_STREAM = 1; private static final int LOAD_METHOD_FILE = 2; private static final int LOAD_METHOD_URL = 3; public static void main(String[] args) { if (args.length == 0) { printUsageAndExit(); } int nLoadMethod = LOAD_METHOD_FILE; boolean bCheckAudioInputStream = false; int nCurrentArg = 0; while (nCurrentArg < args.length) { if (args[nCurrentArg].equals("-h")) { printUsageAndExit(); } /* else if (args[nCurrentArg].equals("-s")) { nLoadMethod = LOAD_METHOD_STREAM; } else if (args[nCurrentArg].equals("-f")) { nLoadMethod = LOAD_METHOD_FILE; } else if (args[nCurrentArg].equals("-u")) { nLoadMethod = LOAD_METHOD_URL; } else if (args[nCurrentArg].equals("-i")) { bCheckAudioInputStream = true; } */ nCurrentArg++; } bCheckAudioInputStream = true; String strSource = args[nCurrentArg - 2]; long lSkip = Long.parseLong(args[nCurrentArg - 1]); String strFilename = null; AudioFileFormat aff = null; AudioInputStream ais = null; try { switch (nLoadMethod) { case LOAD_METHOD_STREAM: InputStream inputStream = System.in; aff = AudioSystem.getAudioFileFormat(inputStream); strFilename = ""; if (bCheckAudioInputStream) { ais = AudioSystem.getAudioInputStream(inputStream); } break; case LOAD_METHOD_FILE: File file = new File(strSource); aff = AudioSystem.getAudioFileFormat(file); strFilename = file.getCanonicalPath(); if (bCheckAudioInputStream) { ais = AudioSystem.getAudioInputStream(file); } break; case LOAD_METHOD_URL: URL url = new URL(strSource); aff = AudioSystem.getAudioFileFormat(url); strFilename = url.toString(); if (bCheckAudioInputStream) { ais = AudioSystem.getAudioInputStream(url); } break; } } catch (Exception e) { e.printStackTrace(); System.exit(1); } if (aff == null) { System.out.println("Cannot determine format"); } else { /* AudioFormat format = aff.getFormat(); System.out.println("---------------------------------------------------------------------------"); System.out.println("Source: " + strFilename); System.out.println("Type: " + aff.getType()); System.out.println("AudioFormat: " + format); System.out.println("---------------------------------------------------------------------------"); String strAudioLength = null; if (aff.getFrameLength() != AudioSystem.NOT_SPECIFIED) { strAudioLength = "" + aff.getFrameLength() + " frames (= " + aff.getFrameLength() * format.getFrameSize() + " bytes)"; } else { strAudioLength = "unknown"; } System.out.println("Length of audio data: " + strAudioLength); String strFileLength = null; if (aff.getByteLength() != AudioSystem.NOT_SPECIFIED) { strFileLength = "" + aff.getByteLength() + " bytes)"; } else { strFileLength = "unknown"; } System.out.println("Total length of file (including headers): " + strFileLength); */ if (bCheckAudioInputStream) { // System.out.println("[AudioInputStream says:] Length of audio data: " + ais.getFrameLength() + " frames (= " + ais.getFrameLength() * ais.getFormat().getFrameSize() + " bytes)"); System.out.println("frame length: " + ais.getFrameLength()); System.out.println("frame size: " + ais.getFormat().getFrameSize()); System.out.println("AIS class:" + ais); System.out.println("now skipping..."); long lSkipped = 0; try { lSkipped = ais.skip(lSkip); } catch (IOException e) { e.printStackTrace(); } System.out.println("skipped: " + lSkipped); } System.out.println("---------------------------------------------------------------------------"); } } private static void printUsageAndExit() { System.out.println("SkipTest: usage:"); System.out.println("\tjava SkipTest "); System.exit(1); } } /*** SkipTest.java ***/ libtritonus-java-20070428/test/SourceDataLineOutputStream.java0000644000175000017500000000240407173771315024311 0ustar twernertwerner/* * SourceDataLineOutputStream.java * * Helper class for saint. */ import java.io.InputStream; import java.io.IOException; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.OutputStream; import javax.sound.sampled.SourceDataLine; public class SourceDataLineOutputStream extends OutputStream { private static final boolean DEBUG = true; private SourceDataLine m_line; public SourceDataLineOutputStream(SourceDataLine line) { m_line = line; } public void write(int nByte) { if (DEBUG) { System.err.println("SourceDataLineOutputStream.write(int): called"); } byte[] abOneByte = new byte[1]; abOneByte[0] = (byte) nByte; m_line.write(abOneByte, 0, 1); } public void write(byte[] abBuffer, int nOffset, int nLength) throws IOException { if (DEBUG) { System.err.println("SourceDataLineOutputStream.write(byte[], int, int): called"); } int nWritten = m_line.write(abBuffer, nOffset, nLength); if (DEBUG) { System.err.println("SourceDataLineOutputStream.write(byte[], int, int): written: " + nWritten); } } public void flush() { if (DEBUG) { System.err.println("SourceDataLineOutputStream.flush(): called"); } // m_line.drain(); } } /*** SourceDataLineOutputStream.java ***/ libtritonus-java-20070428/test/SynthTest.java0000644000175000017500000000135110375320111020775 0ustar twernertwernerimport javax.sound.midi.Synthesizer; import javax.sound.midi.MidiSystem; import javax.sound.midi.MidiChannel; public class SynthTest { public static void main(String[] args) throws Exception { Synthesizer synth = MidiSystem.getSynthesizer(); out("Synthesizer: " + synth); synth.open(); MidiChannel channel = synth.getChannels()[0]; for (int i = 121; i <= 127; i++) { out("controller " + i + ": " + channel.getController(i)); } out("Mono: " + channel.getMono()); channel.setMono(true); for (int i = 121; i <= 127; i++) { out("controller " + i + ": " + channel.getController(i)); } out("Mono: " + channel.getMono()); synth.close(); } private static void out(String msg) { System.out.println(msg); } } libtritonus-java-20070428/test/URLTest.java0000644000175000017500000000162007413261623020344 0ustar twernertwernerimport java.net.URL; import java.net.MalformedURLException; import org.tritonus.sampled.cdda.CddaURLStreamHandlerFactory; public class URLTest { static { URL.setURLStreamHandlerFactory(new CddaURLStreamHandlerFactory()); } public static void main(String[] args) { String strURL = args[0]; URL url = null; try { url = new URL(strURL); } catch (MalformedURLException e) { e.printStackTrace(); System.exit(1); } System.out.println("authority: " + url.getAuthority()); System.out.println("file: " + url.getFile()); System.out.println("host: " + url.getHost()); System.out.println("path: " + url.getPath()); System.out.println("port: " + url.getPort()); System.out.println("protocol: " + url.getProtocol()); System.out.println("query: " + url.getQuery()); System.out.println("ref: " + url.getRef()); System.out.println("user info: " + url.getUserInfo()); } } libtritonus-java-20070428/test/VorbisDecoder.java0000644000175000017500000002363107672161316021607 0ustar twernertwerner/* * VorbisDecoder.java */ import java.io.IOException; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.InputStream; import java.io.OutputStream; // import java.util.Random; import javax.sound.sampled.AudioFormat; import javax.sound.sampled.AudioInputStream; import javax.sound.sampled.AudioSystem; import javax.sound.sampled.UnsupportedAudioFileException; import org.tritonus.lowlevel.ogg.Packet; import org.tritonus.lowlevel.ogg.Page; import org.tritonus.lowlevel.ogg.StreamState; import org.tritonus.lowlevel.ogg.SyncState; import org.tritonus.lowlevel.vorbis.Block; import org.tritonus.lowlevel.vorbis.Comment; import org.tritonus.lowlevel.vorbis.DspState; import org.tritonus.lowlevel.vorbis.Info; public class VorbisDecoder { private static int convsize = 4096; public static void main(String[] args) throws IOException { SyncState oy; /* sync and verify incoming physical bitstream */ StreamState os; /* take physical pages, weld into a logical stream of packets */ Page og; /* one Ogg bitstream page. Vorbis packets are inside */ Packet op; /* one raw packet of data for decode */ Info vi; /* struct that stores all the static vorbis bitstream settings */ Comment vc; /* struct that stores all the bitstream user comments */ DspState vd; /* central working state for the packet->PCM decoder */ Block vb; /* local working space for packet->PCM decode */ oy = new SyncState(); os = new StreamState(); og = new Page(); op = new Packet(); vi = new Info(); vc = new Comment(); vd = new DspState(); vb = new Block (); int[] convbuffer = new int[convsize]; byte[] buffer; int bytes; File inputFile = new File(args[0]); File outputFile = new File(args[1]); InputStream inputStream = new FileInputStream(inputFile); OutputStream outputStream = new FileOutputStream(outputFile); buffer = new byte[4096]; /********** Decode setup ************/ oy.init(); /* Now we can read pages */ while (true) { /* we repeat if the bitstream is chained */ boolean eos = false; int i; /* grab some data at the head of the stream. We want the first page (which is guaranteed to be small and only contain the Vorbis stream initial header) We need the first page to get the stream serialno. */ /* submit a 4k block to libvorbis' Ogg layer */ bytes = inputStream.read(buffer); oy.write(buffer, bytes); /* Get the first page. */ if (oy.pageOut(og) != 1) { /* have we simply run out of data? If so, we're done. */ if (bytes < 4096) { break; } /* error case. Must not be Vorbis data */ System.err.print("Input does not appear to be an Ogg bitstream.\n"); System.exit(1); } /* Get the serial number and set up the rest of decode. */ /* serialno first; use it to set up a logical stream */ os.init(og.getSerialNo()); /* extract the initial header from the first page and verify that the Ogg bitstream is in fact Vorbis data */ /* I handle the initial header first instead of just having the code read all three Vorbis headers at once because reading the initial header is an easy way to identify a Vorbis bitstream and it's useful to see that functionality seperated out. */ vi.init(); vc.init(); if (os.pageIn(og) < 0) { /* error; stream version mismatch perhaps */ System.err.print("Error reading first page of Ogg bitstream data.\n"); System.exit(1); } if(os.packetOut(op) != 1) { /* no page? must not be vorbis */ System.err.print("Error reading initial header packet.\n"); System.exit(1); } if(vi.headerIn(vc, op) < 0) { /* error case; not a vorbis header */ System.err.print("This Ogg bitstream does not contain Vorbis audio data.\n"); System.exit(1); } /* At this point, we're sure we're Vorbis. We've set up the logical (Ogg) bitstream decoder. Get the comment and codebook headers and set up the Vorbis decoder */ /* The next two packets in order are the comment and codebook headers. They're likely large and may span multiple pages. Thus we reead and submit data until we get our two pacakets, watching that no pages are missing. If a page is missing, error out; losing a header page is the only place where missing data is fatal. */ i = 0; while (i < 2) { while (i < 2) { int result = oy.pageOut(og); if (result == 0) { break; /* Need more data */ } /* Don't complain about missing or corrupt data yet. We'll catch it at the packet output phase */ if (result == 1) { os.pageIn(og); /* we can ignore any errors here as they'll also become apparent at packetout */ while (i < 2) { result = os.packetOut(op); if (result == 0) { break; } if (result < 0) { /* Uh oh; data at some point was corrupted or missing! We can't tolerate that in a header. Die. */ System.err.print("Corrupt secondary header. Exiting.\n"); System.exit(1); } vi.headerIn(vc, op); i++; } } } /* no harm in not checking before adding more */ bytes = inputStream.read(buffer); if (bytes == 0 && i < 2) { System.err.print("End of file before finding all Vorbis headers!\n"); System.exit(1); } oy.write(buffer, bytes); } /* Throw the comments plus a few lines about the bitstream we're decoding */ { String[] astrComments = vc.getUserComments(); for (i = 0; i < astrComments.length; i++) { System.err.println(astrComments[i]); } System.err.print("\nBitstream is " + vi.getChannels() + " channel, " + vi.getRate() + " Hz\n"); System.err.print("Encoded by: " + vc.getVendor() + "\n\n"); } int nChannels = vi.getChannels(); convsize = 4096 / nChannels; /* OK, got and parsed all three headers. Initialize the Vorbis packet->PCM decoder. */ vd.init(vi); /* central decode state */ vb.init(vd); /* local state for most of the decode so multiple block decodes can proceed in parallel. We could init multiple vorbis_block structures for vd here */ /* The rest is just a straight decode loop until end of stream */ while (!eos) { while (!eos) { int result = oy.pageOut(og); if (result == 0) { break; /* need more data */ } if (result < 0) { /* missing or corrupt data at this page position */ System.err.print("Corrupt or missing data in bitstream; continuing...\n"); } else { os.pageIn(og); /* can safely ignore errors at this point */ while (true) { result = os.packetOut(op); if (result == 0) { break; /* need more data */ } if (result < 0) { /* missing or corrupt data at this page position */ /* no reason to complain; already complained above */ } else { /* we have a packet. Decode it */ float[][] pcm = new float[nChannels][0]; int samples; if (vb.synthesis(op) == 0) /* test for success! */ { vd.blockIn(vb); } /* **pcm is a multichannel float vector. In stereo, for example, pcm[0] is left, and pcm[1] is right. samples is the size of each channel. Convert the float values (-1.<=range<=1.) to whatever PCM format and write it out */ while ((samples = vd.pcmOut(pcm)) > 0) { int j; boolean clipflag = false; int bout = (samples < convsize ? samples : convsize); /* convert floats to 16 bit signed ints (host order) and interleave */ for(i = 0; i < nChannels; i++) { int ptr = i; // float *mono=pcm[i]; for(j = 0; j < bout; j++) { int val = Math.round(pcm[i][j] * 32767.0F); /* might as well guard against clipping */ if (val > 32767) { val = 32767; clipflag = true; } if(val<-32768) { val = -32768; clipflag = true; } convbuffer[ptr] = val; ptr += nChannels; } } if (clipflag) { System.err.print("Clipping in frame " + vd.getSequence() + "\n"); } byte[] abBuffer = new byte[2 * nChannels * bout]; int byteOffset = 0; boolean bigEndian = false; for (int nSample = 0; nSample < nChannels * bout; nSample++) { int sample = convbuffer[nSample]; if (bigEndian) { abBuffer[byteOffset++]=(byte) (sample >> 8); abBuffer[byteOffset++]=(byte) (sample & 0xFF); } else { abBuffer[byteOffset++]=(byte) (sample & 0xFF); abBuffer[byteOffset++]=(byte) (sample >> 8); } } outputStream.write(abBuffer); vd.read(bout); /* tell libvorbis how many samples we actually consumed */ } } } if (og.isEos()) { eos = true; } } } if (!eos) { bytes = inputStream.read(buffer); oy.write(buffer, bytes); if (bytes == 0) { eos = true; } } } /* clean up this logical bitstream; before exit we see if we're followed by another [chained] */ os.clear(); /* ogg_page and ogg_packet structs always point to storage in libvorbis. They're never freed or manipulated directly */ vb.clear(); vd.clear(); vc.clear(); vi.clear(); /* must be called last */ } /* OK, clean up the framer */ oy.clear(); System.err.print("Done.\n"); System.exit(0); } } /*** VorbisDecoder.java ***/ libtritonus-java-20070428/test/VorbisEncoder.java0000644000175000017500000001424207700365741021617 0ustar twernertwerner/* * VorbisEncoder.java */ import java.io.IOException; import java.io.File; import java.io.FileOutputStream; import java.io.OutputStream; import java.util.Random; import javax.sound.sampled.AudioFormat; import javax.sound.sampled.AudioInputStream; import javax.sound.sampled.AudioSystem; import javax.sound.sampled.UnsupportedAudioFileException; import org.tritonus.lowlevel.ogg.StreamState; import org.tritonus.lowlevel.ogg.Packet; import org.tritonus.lowlevel.ogg.Page; import org.tritonus.lowlevel.vorbis.Block; import org.tritonus.lowlevel.vorbis.Comment; import org.tritonus.lowlevel.vorbis.DspState; import org.tritonus.lowlevel.vorbis.Info; public class VorbisEncoder { private static final int READ = 1024; private static byte[] readbuffer = new byte[READ * 4 + 44]; /* out of the data segment, not the stack */ public static void main(String[] args) throws IOException { StreamState os = new StreamState(); /* take physical pages, weld into a logical stream of packets */ Page og = new Page(); /* one Ogg bitstream page. Vorbis packets are inside */ Packet op = new Packet(); /* one raw packet of data for decode */ Info vi = new Info(); /* struct that stores all the static vorbis bitstream settings */ Comment vc = new Comment(); /* struct that stores all the user comments */ DspState vd = new DspState(); /* central working state for the packet->PCM decoder */ Block vb = new Block(); /* local working space for packet->PCM decode */ boolean eos = false; int i; int founddata; /* we cheat on the WAV header; we just bypass 44 bytes and never verify that it matches 16bit/stereo/44.1kHz. This is just an example, after all. */ AudioInputStream ais = null; try { ais = AudioSystem.getAudioInputStream(new File(args[0])); } catch (UnsupportedAudioFileException e) { e.printStackTrace(); } AudioFormat format = ais.getFormat(); if (format.getChannels() != 2 || format.getSampleSizeInBits() != 16) { System.out.println("need 16 bit stereo!"); System.exit(1); } File outputFile = new File(args[1]); OutputStream output = new FileOutputStream(outputFile); /********** Encode setup ************/ /* choose an encoding mode */ /* (quality mode .4: 44kHz stereo coupled, roughly 128kbps VBR) */ vi.init(); vi.encodeInitVBR(format.getChannels(), (int) format.getSampleRate(), 0.1F); // max compression /* add a comment */ vc.init(); vc.addTag("ENCODER","encoder_example.c"); /* set up the analysis state and auxiliary encoding storage */ vd.initAnalysis(vi); vb.init(vd); /* set up our packet->stream encoder */ /* pick a random serial number; that way we can more likely build chained streams just by concatenation */ Random random = new Random(System.currentTimeMillis()); os.init(random.nextInt()); /* Vorbis streams begin with three headers; the initial header (with most of the codec setup parameters) which is mandated by the Ogg bitstream spec. The second header holds any comment fields. The third header holds the bitstream codebook. We merely need to make the headers, then pass them to libvorbis one at a time; libvorbis handles the additional Ogg bitstream constraints */ Packet header = new Packet(); Packet header_comm = new Packet(); Packet header_code = new Packet(); vd.headerOut(vc, header, header_comm, header_code); os.packetIn(header); /* automatically placed in its own page */ os.packetIn(header_comm); os.packetIn(header_code); /* We don't have to write out here, but doing so makes streaming * much easier, so we do, flushing ALL pages. This ensures the actual * audio data will start on a new page */ while (!eos) { int result = os.flush(og); if(result == 0) break; output.write(og.getHeader()); output.write(og.getBody()); } while (!eos) { int bytes = ais.read(readbuffer, 0, READ * 4); /* stereo hardwired here */ if (bytes == 0 || bytes == -1) { /* end of file. this can be done implicitly in the mainline, but it's easier to see here in non-clever fashion. Tell the library we're at end of stream so that it can handle the last frame and mark end of stream in the output properly */ vd.write(null, 0); } else { /* data to encode */ /* expose the buffer to submit data */ float[][] buffer = new float[format.getChannels()][READ]; // float[][] buffer = vd.buffer(READ); /* uninterleave samples */ for (i = 0;i < bytes/4;i++) { int nSample; float fSample; nSample = (readbuffer[i * 4 + 1] << 8) | (0x00ff & readbuffer[i * 4 + 0]); fSample = nSample / 32768.0F; buffer[0][i] = fSample; nSample = (readbuffer[i * 4 + 3] << 8) | (0x00ff & readbuffer[i * 4 + 2]); fSample = nSample / 32768.f; buffer[1][i] = fSample; } /* tell the library how much we actually submitted */ vd.write(buffer, bytes/4); } /* vorbis does some data preanalysis, then divvies up blocks for more involved (potentially parallel) processing. Get a single block for encoding now */ while (vd.blockOut(vb) == 1) { /* analysis, assume we want to use bitrate management */ vb.analysis(null); vb.addBlock(); while (vd.flushPacket(op) != 0) { /* weld the packet into the bitstream */ os.packetIn(op); /* write out pages (if any) */ while (!eos) { int result = os.pageOut(og); if(result == 0) break; output.write(og.getHeader()); output.write(og.getBody()); /* this could be set above, but for illustrative purposes, I do it here (to show that vorbis does know where the stream ends) */ if (og.isEos()) { eos = true; } } } } } /* clean up and exit. vorbis_info_clear() must be called last */ os.clear(); vb.clear(); vd.clear(); vc.clear(); vi.clear(); output.close(); /* ogg_page and ogg_packet structs always point to storage in libvorbis. They're never freed or manipulated directly */ // fprintf(stderr,"Done.\n"); // return(0); } } /*** VorbisEncoder.java ***/ libtritonus-java-20070428/test/saint.java0000644000175000017500000001524607413261007020165 0ustar twernertwerner/* * saint.java * * Standalone program to demonstrate the usage of the Saint class. */ import java.io.InputStream; import java.io.IOException; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.OutputStream; import javax.sound.sampled.AudioFormat; import javax.sound.sampled.AudioSystem; import javax.sound.sampled.DataLine; import javax.sound.sampled.SourceDataLine; import javax.sound.sampled.LineUnavailableException; import gnu.getopt.Getopt; import org.tritonus.lowlevel.saint.Saint; public class saint { private static class SupportedFormat { private String m_strName; private int m_nNumber; private AudioFormat.Encoding m_encoding; private int m_nSampleSize; private boolean m_bBigEndian; // sample size is in bits public SupportedFormat(String strName, int nNumber, AudioFormat.Encoding encoding, int nSampleSize, boolean bBigEndian) { m_strName = strName; m_nNumber = nNumber; m_encoding = encoding; m_nSampleSize = nSampleSize; } public String getName() { return m_strName; } public int getNumber() { return m_nNumber; } public AudioFormat.Encoding getEncoding() { return m_encoding; } public int getSampleSize() { return m_nSampleSize; } public boolean getBigEndian() { return m_bBigEndian; } } private static final SupportedFormat[] SUPPORTED_FORMATS = { new SupportedFormat("s8", Saint.SND_PCM_SFMT_S8, AudioFormat.Encoding.PCM_SIGNED, 8, true), new SupportedFormat("u8", Saint.SND_PCM_SFMT_U8, AudioFormat.Encoding.PCM_UNSIGNED, 8, true), new SupportedFormat("s16l", Saint.SND_PCM_SFMT_S16_LE, AudioFormat.Encoding.PCM_SIGNED, 16, false), new SupportedFormat("s16b", Saint.SND_PCM_SFMT_S16_BE, AudioFormat.Encoding.PCM_SIGNED, 16, true), new SupportedFormat("u16l", Saint.SND_PCM_SFMT_U16_LE, AudioFormat.Encoding.PCM_UNSIGNED, 16, false), new SupportedFormat("u16b", Saint.SND_PCM_SFMT_U16_BE, AudioFormat.Encoding.PCM_UNSIGNED, 16, true), new SupportedFormat("s24l", Saint.SND_PCM_SFMT_S24_LE, AudioFormat.Encoding.PCM_SIGNED, 24, false), new SupportedFormat("s24b", Saint.SND_PCM_SFMT_S24_BE, AudioFormat.Encoding.PCM_SIGNED, 24, true), new SupportedFormat("u24l", Saint.SND_PCM_SFMT_U24_LE, AudioFormat.Encoding.PCM_UNSIGNED, 24, false), new SupportedFormat("u24b", Saint.SND_PCM_SFMT_U24_BE, AudioFormat.Encoding.PCM_UNSIGNED, 24, true), new SupportedFormat("s32l", Saint.SND_PCM_SFMT_S32_LE, AudioFormat.Encoding.PCM_SIGNED, 32, false), new SupportedFormat("s32b", Saint.SND_PCM_SFMT_S32_BE, AudioFormat.Encoding.PCM_SIGNED, 32, true), new SupportedFormat("u32l", Saint.SND_PCM_SFMT_U32_LE, AudioFormat.Encoding.PCM_UNSIGNED, 32, false), new SupportedFormat("u32b", Saint.SND_PCM_SFMT_U32_BE, AudioFormat.Encoding.PCM_UNSIGNED, 32, true), new SupportedFormat("f32l", Saint.SND_PCM_SFMT_S32_LE, AudioFormat.Encoding.PCM_SIGNED /* obviously wrong */, 32, false), new SupportedFormat("f32b", Saint.SND_PCM_SFMT_S32_BE, AudioFormat.Encoding.PCM_SIGNED /* obviously wrong */, 32, true), }; private static final int DEFAULT_FORMAT = 2; public static void main(String[] args) throws IOException { InputStream bitstream = null; InputStream orchestra = null; InputStream score = null; OutputStream output = null; int nOutputFormatIndex = DEFAULT_FORMAT; boolean bLineOutput = false; int c; Getopt g = new Getopt("saint", args, "hVb:c:s:o:f:"); while ((c = g.getopt()) != -1) { switch (c) { case 'h': printUsageAndExit(); case 'V': printVersionAndExit(); case 'b': bitstream = new FileInputStream(g.getOptarg()); break; case 'c': orchestra = new FileInputStream(g.getOptarg()); break; case 's': score = new FileInputStream(g.getOptarg()); break; case 'o': if (g.getOptarg().equals("-")) { output = System.out; } if (g.getOptarg().equals("+")) { bLineOutput = true; } else { output = new FileOutputStream(g.getOptarg()); } break; case 'f': int nNewOutputFormatIndex = -1; for (int i = 0; i < SUPPORTED_FORMATS.length; i++) { if (SUPPORTED_FORMATS[i].getName().equals(g.getOptarg())) { nNewOutputFormatIndex = i; // nNewOutputFormat = SUPPORTED_FORMATS[i].getNumber(); } } if (nNewOutputFormatIndex != -1) { nOutputFormatIndex = nNewOutputFormatIndex; } else { System.err.println("warning: output format " + g.getOptarg() + "not supported; using default output format"); } break; } } if (output == null && ! bLineOutput) { System.out.println("no output specified!"); printUsageAndExit(); } Saint saint = null; // specifying a bitstream overrides specifying orchestra & score files. if (bitstream != null) { saint = new Saint(bitstream); } else if (orchestra != null) { if (score != null) { saint = new Saint(orchestra, score); } else { System.out.println("no score file specified!"); printUsageAndExit(); } } else { System.out.println("neither bitstream nor orchestra specified!"); printUsageAndExit(); } System.err.println("output will be produces with " + saint.getChannelCount() + " channel(s) at " + saint.getSamplingRate() + " Hz\n"); if (bLineOutput) { AudioFormat format = new AudioFormat( SUPPORTED_FORMATS[nOutputFormatIndex].getEncoding(), saint.getSamplingRate(), SUPPORTED_FORMATS[nOutputFormatIndex].getSampleSize(), saint.getChannelCount(), // TODO: 24 bit is not handled correctely!!! saint.getChannelCount() * SUPPORTED_FORMATS[nOutputFormatIndex].getSampleSize() / 8, saint.getSamplingRate(), SUPPORTED_FORMATS[nOutputFormatIndex].getBigEndian()); DataLine.Info info = new DataLine.Info( SourceDataLine.class, format); SourceDataLine line = null; try { line = (SourceDataLine) AudioSystem.getLine(info); // TODO: (Tritonus) check if calling without arguments should work line.open(format); line.start(); } catch (LineUnavailableException e) { } output = new SourceDataLineOutputStream(line); } saint.setOutput(output, SUPPORTED_FORMATS[nOutputFormatIndex].getNumber()); saint.run(); try { output.close(); } catch (IOException e) { e.printStackTrace(); } } public static void printUsageAndExit() { System.out.println("usage:"); System.out.println("\t[TODO]:"); System.exit(1); } public static void printVersionAndExit() { System.out.println("saint (new) version 0.1"); System.exit(0); } } /*** saint.java ***/ libtritonus-java-20070428/test/misc/0000755000175000017500000000000010621573022017125 5ustar twernertwernerlibtritonus-java-20070428/test/misc/.cvsignore0000644000175000017500000000002607757627021021142 0ustar twernertwerner*.class oggstreamtest libtritonus-java-20070428/test/misc/MapTest.java0000644000175000017500000000030107757626525021366 0ustar twernertwernerimport java.util.Map; public class MapTest { public Map properties() { return null; } } class MapTest2 extends MapTest { public Map properties() { return null; } } libtritonus-java-20070428/test/misc/PrintProperties.java0000644000175000017500000000027607765033641023163 0ustar twernertwernerimport java.util.Properties; public class PrintProperties { public static void main(String[] args) { Properties properties = System.getProperties(); properties.list(System.out); } } libtritonus-java-20070428/test/misc/SleepTest.java0000644000175000017500000000064107672244071021714 0ustar twernertwerner public class SleepTest { public static void main(String[] args) throws InterruptedException { long lRequestedSleepDuration = Long.parseLong(args[0]); for (int i = 0; i < 100; i++) { long lTimeBefore = System.currentTimeMillis(); Thread.sleep(lRequestedSleepDuration, 0); long lTimeAfter = System.currentTimeMillis(); System.out.println("actual sleep: " + (lTimeAfter - lTimeBefore)); } } } libtritonus-java-20070428/test/misc/oggstreamtest.c0000644000175000017500000000460407700366073022177 0ustar twernertwerner/* * oggstreamtest.c */ #include #include void output_page(ogg_page* page) { printf("Page:\n"); printf(" version: %d\n", ogg_page_version(page)); printf(" continued: %d\n", ogg_page_continued(page)); printf(" bos: %d\n", ogg_page_bos(page)); printf(" eos: %d\n", ogg_page_eos(page)); printf(" granule position: %d\n", ogg_page_granulepos(page)); printf(" stream serial number: %d\n", ogg_page_serialno(page)); printf(" page sequence number: %d\n", ogg_page_pageno(page)); } void read_from_stream(ogg_sync_state* sync_state) { char* buffer; int bytes; buffer = ogg_sync_buffer(sync_state, 4096); bytes = fread(buffer, 1, 4096, stdin); ogg_sync_wrote(sync_state, bytes); } void output_packet(ogg_packet* packet) { printf(" Packet: "); printf("bos: %d ", packet->b_o_s); printf("eos: %d ", packet->e_o_s); printf("granule position: %d\n", packet->granulepos); printf(" packet number: %d ", packet->packetno); printf("data length: %d\n", packet->bytes); } void process_packets(ogg_stream_state* stream_state) { int nResult; ogg_packet packet; while (1) { nResult = ogg_stream_packetout(stream_state, &packet); if (nResult == 0) { return; } else if (nResult == -1) { printf("corrupt data; can't get packet\n"); } else { output_packet(&packet); } } } void process_pages(ogg_sync_state* sync_state, ogg_stream_state* stream_state) { int nResult; ogg_page page; while (1) { nResult = ogg_sync_pageout(sync_state, &page); if (nResult == 0) { // need more data return; } else if (nResult == -1) { printf("sync lost; can't get page\n"); } else { output_page(&page); nResult = ogg_stream_pagein(stream_state, &page); if (nResult == -1) { printf("can't add page to stream"); } process_packets(stream_state); } } } main() { ogg_sync_state sync_state; ogg_stream_state stream_state; ogg_page page; int nResult; ogg_sync_init(&sync_state); read_from_stream(&sync_state); ogg_sync_pageout(&sync_state, &page); output_page(&page); ogg_stream_init(&stream_state, ogg_page_serialno(&page)); nResult = ogg_stream_pagein(&stream_state, &page); if (nResult == -1) { printf("can't add page to stream"); } process_packets(&stream_state); while (1) { process_pages(&sync_state, &stream_state); read_from_stream(&sync_state); } } /*** oggstreamtest.c ***/ libtritonus-java-20070428/test/old/0000755000175000017500000000000010621573024016752 5ustar twernertwernerlibtritonus-java-20070428/test/old/Capture.java0000644000175000017500000000767207075416457021253 0ustar twernertwerner/***********************************************************************/ import javax.media.sound.sampled.*; import java.applet.*; import java.awt.*; import java.io.*; /* * Reads data from the input channel and writes to the output stream */ public class Capture extends Applet implements Runnable{ TargetDataLine line; Thread thread; private Button startCaptureButton, stopCaptureButton; public void init() { System.out.println("init"); this.setBackground(Color.white); startCaptureButton = new Button("Start Capture"); startCaptureButton.setForeground(Color.black); startCaptureButton.setBackground(Color.lightGray); this.add(startCaptureButton); stopCaptureButton = new Button("Stop Capture"); stopCaptureButton.setForeground(Color.black); stopCaptureButton.setBackground(Color.lightGray); this.add(stopCaptureButton); } public boolean action(Event event, Object arg) { System.out.println("action"); if(event.target == startCaptureButton) { this.debut(); return true; } else if(event.target == stopCaptureButton) { this.fin(); return true; } else return super.action(event, arg); } public void debut() { System.out.println("start1"); thread = new Thread(this); thread.setName("Capture"); System.out.println("start2"); thread.start(); } public void fin() { System.out.println("stop"); thread = null; } public void run() { // define the required attributes for our line, // and make sure a compatible line is supported. Type encoding = AudioFormat.PCM_SIGNED; float rate = 44100; int sampleSize = 16; int channels = 2; boolean bigEndian = true; AudioFormat format = new AudioFormat(encoding, rate, sampleSize, channels, (sampleSize/8)*channels, rate, bigEndian); DataLine.Info info = new DataLine.Info(TargetDataLine.class, null, null, new Class[0], format, AudioSystem.NOT_SPECIFIED); System.out.println("run"); if (!AudioSystem.isSupportedLine(info)) { System.out.println("Line matching " + info + " not supported."); return; } System.out.println("supported"); // get and open the target data line for capture. try { line = (TargetDataLine) AudioSystem.getLine(info); System.out.println("line_open?"); line.open(format, 5000); //line.getBufferSize()); } catch (LineUnavailableException ex) { System.out.println("Unable to open the line: " + ex); return; } catch (SecurityException ex) { System.out.println("Unable to open the line: " + ex); } System.out.println("open"); // play back the captured audio data ByteArrayOutputStream out = new ByteArrayOutputStream(); int frameSizeInBytes = format.getFrameSize(); int bufferLengthInFrames = line.getBufferSize() / 8; int bufferLengthInBytes = bufferLengthInFrames * frameSizeInBytes; byte[] data = new byte[bufferLengthInBytes]; int numFramesRead; line.start(); System.out.println("line start"); while (thread != null) { if ((numFramesRead = line.read(data, 0, bufferLengthInFrames)) == -1) { break; } out.write(data, 0, (numFramesRead * frameSizeInBytes)); } System.out.println("line stop"); // we reached the end of the stream. stop and close the line. line.stop(); line.close(); line = null; System.out.println("line null"); // stop and close the output stream try { out.flush(); out.close(); } catch (IOException ex) { ex.printStackTrace(); } System.out.println("stream close"); // load bytes into the audio input stream for playback byte audioBytes[] = out.toByteArray(); ByteArrayInputStream bais = new ByteArrayInputStream(audioBytes); AudioInputStream audioInputStream = new AudioInputStream(bais, format, audioBytes.length / frameSizeInBytes); try { audioInputStream.reset(); } catch (Exception ex) { ex.printStackTrace(); } System.out.println("end"); } } /***********************************************************************/ libtritonus-java-20070428/test/saol/0000755000175000017500000000000010621573031017130 5ustar twernertwernerlibtritonus-java-20070428/test/saol/BCELTest.java0000644000175000017500000001161707460523447021363 0ustar twernertwerner/* * BCELTest.java */ /* * Copyright (c) 2002 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ package org.tritonus.saol.compiler; import java.io.IOException; import org.apache.bcel.Constants; import org.apache.bcel.classfile.Field; import org.apache.bcel.classfile.JavaClass; import org.apache.bcel.generic.*; /** Example program using the BCEL. BCEL is the Byte Code Engineering Library, part of the jakarta project (http://jakarta.apache.org/bcel/). */ public class BCELTest { public static void main(String[] args) { String strClassName = "tone"; ClassGen classGen = new ClassGen(strClassName, "AbstractInstrument", "", Constants.ACC_PUBLIC | Constants.ACC_SUPER, null); ConstantPoolGen constantPoolGen = classGen.getConstantPool(); int nAInitValueIndex = constantPoolGen.addFloat(0.196307F); int nXInitValueIndex = constantPoolGen.addFloat(0.5F); FieldGen fieldGen; fieldGen = new FieldGen(Constants.ACC_PRIVATE, Type.FLOAT, "a", constantPoolGen); classGen.addField(fieldGen.getField()); fieldGen = new FieldGen(Constants.ACC_PRIVATE, Type.FLOAT, "x", constantPoolGen); classGen.addField(fieldGen.getField()); fieldGen = new FieldGen(Constants.ACC_PRIVATE, Type.FLOAT, "y", constantPoolGen); classGen.addField(fieldGen.getField()); fieldGen = new FieldGen(Constants.ACC_PRIVATE, Type.FLOAT, "init", constantPoolGen); classGen.addField(fieldGen.getField()); InstructionList il = new InstructionList(); MethodGen methodGen; methodGen = new MethodGen(Constants.ACC_PUBLIC, Type.VOID, new Type[]{new ObjectType("RTSystem")}, new String[]{"rtSystem"}, "doAPass", strClassName, il, constantPoolGen); InstructionFactory ifac = new InstructionFactory(constantPoolGen); il.append(InstructionConstants.ALOAD_0); il.append(new LDC(nAInitValueIndex)); il.append(ifac.createPutField(strClassName, "a", Type.FLOAT)); il.append(InstructionConstants.ALOAD_0); il.append(ifac.createGetField(strClassName, "init", Type.FLOAT)); il.append(InstructionConstants.FCONST_0); il.append(InstructionConstants.FCMPL); IFNE ifne0 = new IFNE(null); il.append(ifne0); il.append(InstructionConstants.ALOAD_0); il.append(InstructionConstants.FCONST_1); il.append(ifac.createPutField(strClassName, "init", Type.FLOAT)); il.append(InstructionConstants.ALOAD_0); il.append(new LDC(nXInitValueIndex)); il.append(ifac.createPutField(strClassName, "x", Type.FLOAT)); InstructionHandle ih0 = il.append(InstructionConstants.ALOAD_0); ifne0.setTarget(ih0); il.append(InstructionConstants.ALOAD_0); il.append(ifac.createGetField(strClassName, "x", Type.FLOAT)); il.append(InstructionConstants.ALOAD_0); il.append(ifac.createGetField(strClassName, "a", Type.FLOAT)); il.append(InstructionConstants.ALOAD_0); il.append(ifac.createGetField(strClassName, "y", Type.FLOAT)); il.append(InstructionConstants.FMUL); il.append(InstructionConstants.FSUB); il.append(ifac.createPutField(strClassName, "x", Type.FLOAT)); il.append(InstructionConstants.ALOAD_0); il.append(InstructionConstants.ALOAD_0); il.append(ifac.createGetField(strClassName, "y", Type.FLOAT)); il.append(InstructionConstants.ALOAD_0); il.append(ifac.createGetField(strClassName, "a", Type.FLOAT)); il.append(InstructionConstants.ALOAD_0); il.append(ifac.createGetField(strClassName, "x", Type.FLOAT)); il.append(InstructionConstants.FMUL); il.append(InstructionConstants.FADD); il.append(ifac.createPutField(strClassName, "y", Type.FLOAT)); il.append(InstructionConstants.ALOAD_1); il.append(InstructionConstants.ALOAD_0); il.append(ifac.createGetField(strClassName, "y", Type.FLOAT)); il.append(ifac.createInvoke("RTSystem", "output", Type.VOID, new Type[]{Type.FLOAT}, Constants.INVOKEVIRTUAL)); il.append(InstructionConstants.RETURN); methodGen.setMaxStack(); classGen.addMethod(methodGen.getMethod()); classGen.addEmptyConstructor(Constants.ACC_PUBLIC); JavaClass javaClass = classGen.getJavaClass(); try { javaClass.dump("tone.class"); } catch (IOException e) { e.printStackTrace(); } } } /*** BCELTest.java ***/ libtritonus-java-20070428/test/saol/Instrument_tone.java0000644000175000017500000000114707461547735023217 0ustar twernertwerner/* * Instrument_tone.java */ import org.tritonus.share.TDebug; public class Instrument_tone extends AbstractInstrument { private float a; private float x; private float y; private float init; public Instrument_tone() { a = 0.0F; x = 0.0F; y = 0.0F; init = 0.0F; } // public void doIPass() // { // } // public void doKPass() // { // } public void doAPass(RTSystem rtSystem) { // TDebug.out("doAPass()"); a = 0.196307F; if (init == 0.0F) { init = 1.0F; x = 0.5F; } x = x - a * y; y = y + a * x; rtSystem.output(y); } } /*** Instrument_tone.java ***/ libtritonus-java-20070428/test/suite/0000755000175000017500000000000010621573042017325 5ustar twernertwernerlibtritonus-java-20070428/test/suite/sounds/0000755000175000017500000000000010621573037020644 5ustar twernertwernerlibtritonus-java-20070428/test/suite/sounds/sampleSize12.aiff0000644000175000017500000000037607731242665023770 0ustar twernertwernerFORMAIFFCOMMd @SSND 0@P`p 0@P`p 0@P`p 0@P`p 0@P`p 0@P`p 0libtritonus-java-20070428/test/suite/sounds/test.aiff0000644000175000017500000025427607423332117022470 0ustar twernertwernerFORMXAIFFCOMMD@DSSNDXlibtritonus-java-20070428/test/suite/sounds/test.au0000644000175000017500000025425107423332117022161 0ustar twernertwerner.snd!XDtest.wavlibtritonus-java-20070428/test/suite/sounds/test.gsm0000644000175000017500000000316207423621027022334 0ustar twernertwerner ZPI$I$PI$I$PI$I$PI$I$ ZPI$I$PI$I$PI$I$PI$I$ ZPI$I$PI$I$PI$I$PI$I$ ZPI$I$PI$I$PI$I$PI$I$ ZPI$I$PI$I$PI$I$PI$I$ ZPI$I$PI$I$PI$I$PI$I$ ZPI$I$PI$I$PI$I$PI$I$ ZPI$I$PI$I$PI$I$PI$I$ ZPI$I$PI$I$PI$I$PI$I$ ZPI$I$PI$I$PI$I$PI$I$ ZPI$I$PI$I$PI$I$PI$I$ ZPI$I$PI$I$PI$I$PI$I$ ZPI$I$PI$I$PI$I$PI$I$ ZPI$I$PI$I$PI$I$PI$I$ ZPI$I$PI$I$PI$I$PI$I$ ZPI$I$PI$I$PI$I$PI$I$ ZPI$I$PI$I$PI$I$PI$I$ ZPI$I$PI$I$PI$I$PI$I$ ZPI$I$PI$I$PI$I$PI$I$ ZPI$I$PI$I$PI$I$PI$I$ ZPI$I$PI$I$PI$I$PI$I$ ZPI$I$PI$I$PI$I$PI$I$ ZPI$I$PI$I$PI$I$PI$I$ ZPI$I$PI$I$PI$I$PI$I$ ZPI$I$PI$I$PI$I$PI$I$ Z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'WλƵ%VywmE ̏4: V\F1^"vu=FgѩX͗j72ڊ.^Ce!sO*Y$G>sg@U9 b#x2w ϲygY!.mB}l-#oj[&1^P5l~)m15"V:g,եr"#odJ1 dT{#/ݢl(&jL. QSkRTu&=6i;*ӫfU}1rB -+`*nᜎ]|T%Q_U@=N|f6槺^sU"ǻoߘ}z>/X6^6lTXaZD ""\圀da)@ nkƝOggS+zAlibtritonus-java-20070428/test/suite/sounds/testtruncate.ogg0000644000175000017500000006421407753241635024106 0ustar twernertwernerOggSU"וvorbis"V>OggSUN5 -1vorbisXiph.Org libVorbis I 20020717vorbisBCV ƀАUBFPGPPj xJaɘkB{Ͻ{ 4d@b1 B Q)Ba9 r: B .r Y0!B!B )R)b1s1 :褓N22ɨZJ-SlXk5kPc1c1c1BCV AdB!R)s1ǀАU Gɑɑ$I$K$,,O5QSEUuU۵}ۗ}wuٷ}vuYeYwm[uWu]u]u]u]u]u 4d #9#9#9#)d(8#9cIIYi&j((#Ii穞(iiiiiiiiiiii@h*@@qQqɑ$  YPG˱$,43=WMU YO$$O4M4M4M4M4M4M4M4M4M4M4M4M4M4MӀА$ gsf $c J 4dEC!眔NR䜓Ii :Jj1TjK6:J!RQ+ p YD R1 s1Ơc9sRtAI c9RUBIu,BCVqI4K<}Uceׅ_Xn]~u}]ecXev7cmcm:a}ڶmayuۨ?6~nn 﫲ll ʱ>s]_XeYV[Yׅejq /4~_m,n o q0`B(4dE'`$ϳ,K-EUUEU4453MML4MMSu-M3MLS44UUMӔM4]TMUUUWeuuY4MWUӕMSueu]Yu]Y4453MLTMW6Mu-SMMEUUMUuMU]L=DQUMהUSUeTM[6MUMWeW]Yve6UUMteu]u]ueW%M3MLS<4MuMUueTEUxyrH$h9H 5X}i;~Sk8nl=Wpj{Br:R,ڿGz?Cgmz*!RBZD2%.K$7fL994SR=4vm)힮9.o+Zk*;4&+\[tu -^ss urXp1n*5mvyI2:+HbH]egFYGJ3Á˄+nzzTe)h'tikӄ6-Da ^<Ӂ 5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{B-IUy8q$g}Ĵ'N+ qT9Ғpܖ|w0_|/ QzkԵ(@yŵQ>sUahPn˱'z\ Mf4ng UBSlO +^y+:p9%8gusVn˳'T9$W[Ӗ#;:6"bM}Y0q@`g\ ]mtѢ-[Qt&u)qim]d*Dڞ,wf- b**u\A, cy kTKjp\橶;KfjJh)0~Ay nU]fhX!tkUG Hr,YlbN+" 4R]+SxYQ?R i^hPv,}f jmEt8&" 5g얏&'Pg&qjSQA]V+0`ؗY?jBSHvM4leq'ZϪUgӍ@J&[S֘^8|Ljk9W7(J'=ݜ0DVhd{{%DxJ--=Q+ֺ9B`ԉFMnt {c[eJ7di\B!h|-5c`IKM">bN;)G+?>MJ?# 0__{) z[ٍԶcfs_6e%'Θ! p' 5P󲬈Պn-[s-Ѧ['O'*-5_+=yl2K';L! ^?>m 'awZ'VkD8Rd㕅nK!WxVj<#VbQ}lK `;>ag 'eu^i{ҼunuTKPLIr[WĞ| Dw+x&sU:4 n(vz ќe+S@/:E47?e*{3ɑ:bFck7/LP@u@bcyO"XBXBeVmuDvP i@QIJ@;5?Wy0ihuB[d@|S˵׋+Q߮ G^3mBдr9O/@`Wȡa #lX_䝘QK*-]&{[ pr_\,$P&AM4ڰ5~c WX_ob+}-zN_S%®({D~5$`NW:ԃ mZvi _D*/XG|c9tv̵ K$KT^`}Kjim;E%9|ap*[E{Uʄ }o/]3 fi1pzp@7w{6퉸^c }h2!OU$fks+gx%lL$G"ՐIm"Y-R{&`*jq&&B[|!D^"WR=E֚?SݾkmI5<[3hlcR+.js>*\q^NNPD ECPt-jsD,YqƣǞʼnȯ7HԠI'(BcjsiВ)EulM9_S@xnsIV4Ơlibtritonus-java-20070428/test/suite/sounds/zero_data_length.au0000644000175000017500000000004007423621027024475 0ustar twernertwerner.snd Dtest.wavlibtritonus-java-20070428/test/suite/.cvsignore0000644000175000017500000000001507700365462021332 0ustar twernertwerner*.txt .build libtritonus-java-20070428/test/suite/audiofilereader.properties0000644000175000017500000000565007731242665024611 0ustar twernertwerner# # wave.class=org.tritonus.sampled.file.WaveAudioFileReader wave.filename=sounds/test.wav wave.type=WAVE wave.byteLength=88246 wave.format.encoding=PCM_SIGNED wave.format.sampleRate=44100.0 wave.format.sampleSizeInBits=16 wave.format.channels=1 wave.format.frameSize=2 wave.format.frameRate=44100.0 wave.format.bigEndian=false wave.frameLength=44100 aiff.class=org.tritonus.sampled.file.AiffAudioFileReader aiff.filename=sounds/test.aiff aiff.type=AIFF aiff.byteLength=88254 aiff.format.encoding=PCM_SIGNED aiff.format.sampleRate=44100.0 aiff.format.sampleSizeInBits=16 aiff.format.channels=1 aiff.format.frameSize=2 aiff.format.frameRate=44100.0 aiff.format.bigEndian=true aiff.frameLength=44100 aiff12bit.class=org.tritonus.sampled.file.AiffAudioFileReader aiff12bit.filename=sounds/sampleSize12.aiff aiff12bit.type=AIFF aiff12bit.byteLength=254 aiff12bit.format.encoding=PCM_SIGNED aiff12bit.format.sampleRate=1000.0 aiff12bit.format.sampleSizeInBits=12 aiff12bit.format.channels=1 aiff12bit.format.frameSize=2 aiff12bit.format.frameRate=1000.0 aiff12bit.format.bigEndian=true aiff12bit.frameLength=100 au.class=org.tritonus.sampled.file.AuAudioFileReader au.filename=sounds/test.au au.type=AU au.byteLength=88233 au.format.encoding=PCM_SIGNED au.format.sampleRate=44100.0 au.format.sampleSizeInBits=16 au.format.channels=1 au.format.frameSize=2 au.format.frameRate=44100.0 au.format.bigEndian=true au.frameLength=44100 au_zero_data_length.class=org.tritonus.sampled.file.AuAudioFileReader au_zero_data_length.filename=sounds/zero_data_length.au au_zero_data_length.type=AU au_zero_data_length.byteLength=32 au_zero_data_length.format.encoding=PCM_SIGNED au_zero_data_length.format.sampleRate=44100.0 au_zero_data_length.format.sampleSizeInBits=16 au_zero_data_length.format.channels=1 au_zero_data_length.format.frameSize=2 au_zero_data_length.format.frameRate=44100.0 au_zero_data_length.format.bigEndian=true au_zero_data_length.frameLength=0 gsm.class=org.tritonus.sampled.file.gsm.GSMAudioFileReader gsm.filename=sounds/test.gsm gsm.type=GSM gsm.byteLength=1650 gsm.format.encoding=GSM0610 gsm.format.sampleRate=8000.0 gsm.format.sampleSizeInBits=-1 gsm.format.channels=1 gsm.format.frameSize=33 gsm.format.frameRate=50.0 gsm.format.bigEndian=true gsm.frameLength=50 mp3.class=org.tritonus.sampled.file.mpeg.MpegAudioFileReader mp3.filename=sounds/test.mp3 mp3.type=MP3 mp3.byteLength=8567 mp3.format.encoding=MPEG1L3 mp3.format.sampleRate=44100.0 mp3.format.sampleSizeInBits=-1 mp3.format.channels=1 mp3.format.frameSize=-1 mp3.format.frameRate=-1 mp3.format.bigEndian=true mp3.frameLength=-1 vorbis.class=org.tritonus.sampled.file.vorbis.VorbisAudioFileReader vorbis.filename=sounds/test.ogg vorbis.type=Ogg vorbis.byteLength=3102 vorbis.format.encoding=VORBIS vorbis.format.sampleRate=44100.0 vorbis.format.sampleSizeInBits=-1 vorbis.format.channels=1 vorbis.format.frameSize=-1 vorbis.format.frameRate=-1 vorbis.format.bigEndian=true vorbis.frameLength=-1 # end libtritonus-java-20070428/test/suite/audiooutputstream.properties0000644000175000017500000000501507435716372025260 0ustar twernertwerner# # wave.class=org.tritonus.sampled.file.WaveAudioFileReader wave.filename=sounds/test.wav wave.type=WAVE wave.byteLength=88246 wave.format.encoding=PCM_SIGNED wave.format.sampleRate=44100.0 wave.format.sampleSizeInBits=16 wave.format.channels=2 wave.format.frameSize=4 wave.format.frameRate=44100.0 wave.format.bigEndian=false wave.frameLength=44100 aiff.class=org.tritonus.sampled.file.AiffAudioFileReader aiff.filename=sounds/test.aiff aiff.type=AIFF aiff.byteLength=88254 aiff.format.encoding=PCM_SIGNED aiff.format.sampleRate=44100.0 aiff.format.sampleSizeInBits=16 aiff.format.channels=2 aiff.format.frameSize=4 aiff.format.frameRate=44100.0 aiff.format.bigEndian=true aiff.frameLength=44100 au.class=org.tritonus.sampled.file.AuAudioFileReader au.filename=tmp.au au.type=AU au.byteLength=88233 au.format.encoding=PCM_SIGNED au.format.sampleRate=44100.0 au.format.sampleSizeInBits=16 au.format.channels=2 au.format.frameSize=4 au.format.frameRate=44100.0 au.format.bigEndian=true au.frameLength=44100 au_zero_data_length.class=org.tritonus.sampled.file.AuAudioFileReader au_zero_data_length.filename=sounds/zero_data_length.au au_zero_data_length.type=AU au_zero_data_length.byteLength=32 au_zero_data_length.format.encoding=PCM_SIGNED au_zero_data_length.format.sampleRate=44100.0 au_zero_data_length.format.sampleSizeInBits=16 au_zero_data_length.format.channels=1 au_zero_data_length.format.frameSize=2 au_zero_data_length.format.frameRate=44100.0 au_zero_data_length.format.bigEndian=true au_zero_data_length.frameLength=0 gsm.class=org.tritonus.sampled.file.gsm.GSMAudioFileReader gsm.filename=sounds/test.gsm gsm.type=GSM gsm.byteLength=1650 gsm.format.encoding=GSM0610 gsm.format.sampleRate=8000.0 gsm.format.sampleSizeInBits=-1 gsm.format.channels=1 gsm.format.frameSize=33 gsm.format.frameRate=50.0 gsm.format.bigEndian=true gsm.frameLength=50 mp3.class=org.tritonus.sampled.file.mpeg.MpegAudioFileReader mp3.filename=sounds/test.mp3 mp3.type=MP3 mp3.byteLength=8567 mp3.format.encoding=MPEG1L3 mp3.format.sampleRate=44100.0 mp3.format.sampleSizeInBits=-1 mp3.format.channels=1 mp3.format.frameSize=-1 mp3.format.frameRate=-1 mp3.format.bigEndian=true mp3.frameLength=-1 vorbis.class=org.tritonus.sampled.file.vorbis.VorbisAudioFileReader vorbis.filename=sounds/test.ogg vorbis.type=Vorbis vorbis.byteLength=3102 vorbis.format.encoding=OGG_VORBIS vorbis.format.sampleRate=44100.0 vorbis.format.sampleSizeInBits=-1 vorbis.format.channels=1 vorbis.format.frameSize=-1 vorbis.format.frameRate=-1 vorbis.format.bigEndian=true vorbis.frameLength=-1 # end libtritonus-java-20070428/test/suite/build.xml0000644000175000017500000003246110377142061021155 0ustar twernertwerner libtritonus-java-20070428/test/suite/formatconversionprovider.properties0000644000175000017500000000357707703056675026647 0ustar twernertwerner# # alaw.class=org.tritonus.sampled.convert.AlawFormatConversionProvider alaw.sourceEncodings=PCM_SIGNED PCM_UNSIGNED ALAW ULAW alaw.targetEncodings=PCM_SIGNED PCM_UNSIGNED ALAW ULAW #alaw.numSourceFormats=2 ulaw.class=org.tritonus.sampled.convert.UlawFormatConversionProvider ulaw.sourceEncodings=PCM_SIGNED PCM_UNSIGNED ALAW ULAW ulaw.targetEncodings=PCM_SIGNED PCM_UNSIGNED ALAW ULAW pcm2pcm.class=org.tritonus.sampled.convert.PCM2PCMConversionProvider pcm2pcm.sourceEncodings=PCM_SIGNED PCM_UNSIGNED pcm2pcm.targetEncodings=PCM_SIGNED PCM_UNSIGNED samplerate.class=org.tritonus.sampled.convert.SampleRateConversionProvider samplerate.sourceEncodings=PCM_SIGNED PCM_UNSIGNED samplerate.targetEncodings=PCM_SIGNED PCM_UNSIGNED imaadpcm.class=org.tritonus.sampled.convert.ImaAdpcmFormatConversionProvider imaadpcm.sourceEncodings=PCM_SIGNED IMA_ADPCM imaadpcm.targetEncodings=PCM_SIGNED IMA_ADPCM gsm.class=org.tritonus.sampled.convert.gsm.GSMFormatConversionProvider gsm.sourceEncodings=GSM0610 PCM_SIGNED gsm.targetEncodings=GSM0610 PCM_SIGNED jorbis.class=org.tritonus.sampled.convert.jorbis.JorbisFormatConversionProvider jorbis.sourceEncodings=VORBIS jorbis.targetEncodings=PCM_SIGNED vorbis.class=org.tritonus.sampled.convert.vorbis.VorbisFormatConversionProvider vorbis.sourceEncodings=VORBIS PCM_SIGNED vorbis.targetEncodings=VORBIS PCM_SIGNED # old gsm.filename=sounds/test.gsm gsm.byteLength=1650 gsm.format.encoding=GSM0610 gsm.format.sampleRate=8000.0 gsm.format.sampleSizeInBits=-1 gsm.format.channels=1 gsm.format.frameSize=33 gsm.format.frameRate=50.0 gsm.format.bigEndian=true gsm.frameLength=50 # old vorbis.filename=sounds/test.ogg vorbis.byteLength=3102 vorbis.format.encoding=VORBIS vorbis.format.sampleRate=44100.0 vorbis.format.sampleSizeInBits=-1 vorbis.format.channels=1 vorbis.format.frameSize=-1 vorbis.format.frameRate=-1 vorbis.format.bigEndian=true vorbis.frameLength=-1 # end libtritonus-java-20070428/test/suite/src/0000755000175000017500000000000010621573042020114 5ustar twernertwernerlibtritonus-java-20070428/test/suite/src/classes/0000755000175000017500000000000010621573042021551 5ustar twernertwernerlibtritonus-java-20070428/test/suite/src/classes/org/0000755000175000017500000000000010621573042022340 5ustar twernertwernerlibtritonus-java-20070428/test/suite/src/classes/org/tritonus/0000755000175000017500000000000010621573042024227 5ustar twernertwernerlibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/0000755000175000017500000000000010621573056025213 5ustar twernertwernerlibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/alsa/0000755000175000017500000000000010621573044026130 5ustar twernertwernerlibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/alsa/AlsaCtlTestCase.java0000644000175000017500000000457407700472626031774 0ustar twernertwerner/* * AlsaCtlTestCase.java */ /* * Copyright (c) 2001 - 2002 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ package org.tritonus.test.alsa; import junit.framework.TestCase; import org.tritonus.lowlevel.alsa.AlsaCtl; public class AlsaCtlTestCase extends TestCase { private static final boolean DEBUG = false; private static final String CARD_NAME_FOR_INDEX_TEST = "LIFE"; public AlsaCtlTestCase(String strName) { super(strName); } public void testGetCards() { int[] anCards = AlsaCtl.getCards(); assertTrue(anCards != null); assertTrue(anCards.length == 1); assertTrue(anCards[0] >= 0); } public void testLoadCards() { int[] anCards = AlsaCtl.getCards(); for (int i = 0; i < anCards.length; i++) { int nError = AlsaCtl.loadCard(anCards[i]); assertTrue(nError >= 0); } } public void testGetIndex() { int nIndex = AlsaCtl.getCardIndex(CARD_NAME_FOR_INDEX_TEST); if (DEBUG) { System.out.println("card index: " + nIndex); } assertTrue(nIndex >= 0); int[] anCards = AlsaCtl.getCards(); if (DEBUG) { System.out.println("card index: " + anCards[0]); } assertTrue(nIndex == anCards[0]); } public void testGetNames() { int[] anCards = AlsaCtl.getCards(); String strName = AlsaCtl.getCardName(anCards[0]); assertTrue(strName != null && !strName.equals("")); String strLongName = AlsaCtl.getCardLongName(anCards[0]); assertTrue(strLongName != null && !strLongName.equals("")); assertTrue(!strName.equals(strLongName)); if (DEBUG) { System.out.println("card name: " + strName); System.out.println("card long name: " + strLongName); } } } /*** AlsaCtlTestCase.java ***/ libtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/alsa/AlsaMixerTestCase.java0000644000175000017500000000355107700472626032330 0ustar twernertwerner/* * AlsaMixerTestCase.java */ /* * Copyright (c) 2001 - 2002 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ package org.tritonus.test.alsa; import java.util.List; import junit.framework.TestCase; //import org.tritonus.lowlevel.alsa.AlsaCtl; import org.tritonus.lowlevel.alsa.AlsaMixer; public class AlsaMixerTestCase extends TestCase { private static final boolean DEBUG = true; public AlsaMixerTestCase(String strName) { super(strName); } public void testOpenClose() throws Exception { int nDefaultMixerCard = 0; String strMixerName = "hw:" + nDefaultMixerCard; AlsaMixer mixer = new AlsaMixer(strMixerName); assertTrue(mixer != null); mixer.close(); // Intentionally a second time to test idempotence of close(). mixer.close(); } public void testControls() throws Exception { int nDefaultMixerCard = 0; String strMixerName = "hw:" + nDefaultMixerCard; AlsaMixer mixer = new AlsaMixer(strMixerName); List controlsList = null; // mixer.getControls(); assertTrue(controlsList != null); assertTrue(controlsList.size() > 0); mixer.close(); } } /*** AlsaMixerTestCase.java ***/ libtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/alsa/AlsaSeqTestCase.java0000644000175000017500000000351610374203233031760 0ustar twernertwerner/* * AlsaSeqTestCase.java */ package org.tritonus.test.alsa; //import org.tritonus.lowlevel.alsa.AlsaSeq; public class AlsaSeqTestCase { // public static void main(String[] args) // { // AlsaSeq seq = new AlsaSeq(); // System.out.println("Client ID: " + seq.getClientId()); // AlsaSeq.SystemInfo systemInfo = seq.getSystemInfo(); // System.out.println("Max. queues: " + systemInfo.getMaxQueues()); // System.out.println("Max. clients: " + systemInfo.getMaxClients()); // System.out.println("Max. ports per client: " + systemInfo.getMaxPortsPerClient()); // System.out.println("Max. channels per port: " + systemInfo.getMaxChannelsPerPort()); // AlsaSeq.ClientInfo clientInfo = seq.getClientInfo(); // outputClientInfo(clientInfo); // for (int nClient = 0; nClient < systemInfo.getMaxClients(); nClient++) // { // AlsaSeq.ClientInfo clientInfo2 = seq.getClientInfo(nClient); // if (clientInfo2 != null) // { // System.out.println("-----------------------------------------------"); // outputClientInfo(clientInfo2); // } // } // seq.sendNoteOnEvent(0, 0, 61, 30); // seq.sendNoteOnEvent(1000, 0, 61, 20); // seq.startTimer(); // try // { // Thread.sleep(10000); // } // catch (InterruptedException e) // { // } // // seq.stopTimer(); // seq.close(); // } // private static void outputClientInfo(AlsaSeq.ClientInfo clientInfo) // { // System.out.println("Client id: " + clientInfo.getClientId()); // System.out.println("Client type: " + clientInfo.getClientType()); // System.out.println("Client name: " + clientInfo.getName()); // /* // System.out.println("Client id: " + clientInfo.getClientId()); // System.out.println("Client id: " + clientInfo.getClientId()); // System.out.println("Client id: " + clientInfo.getClientId()); // */ // } } /*** AlsaSeqTestCase.java ***/ libtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/api/0000755000175000017500000000000010621573053025761 5ustar twernertwernerlibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/api/midi/0000755000175000017500000000000010621573051026701 5ustar twernertwernerlibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/api/midi/device/0000755000175000017500000000000010621573045030143 5ustar twernertwerner././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootlibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/api/midi/device/BaseMidiDeviceTestCase.javalibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/api/midi/device/BaseMidiDeviceTes0000644000175000017500000000353510374203233033337 0ustar twernertwerner/* * BaseMidiDeviceTestCase.java */ /* * Copyright (c) 2003 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ package org.tritonus.test.api.midi.device; import javax.sound.midi.MidiDevice; import javax.sound.midi.MidiSystem; import junit.framework.TestCase; /** Base class for tests of javax.sound.midi.MidiDevice. */ public abstract class BaseMidiDeviceTestCase extends TestCase { protected BaseMidiDeviceTestCase(String strName) { super(strName); } /** Iterate over all available MidiDevices. */ protected void checkMidiDevice(Check check) throws Exception { MidiDevice.Info[] infos = MidiSystem.getMidiDeviceInfo(); for (int i = 0; i < infos.length; i++) { MidiDevice device = MidiSystem.getMidiDevice(infos[i]); System.out.println("testing device: " + device); check.check(device); } } /** Get the prefix for error messages (containing the sequencer's name). */ protected static String getMessagePrefix(MidiDevice device) { return device.getDeviceInfo().getName(); } protected interface Check { public void check(MidiDevice device) throws Exception; } } /*** BaseMidiDeviceTestCase.java ***/ ././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootlibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/api/midi/device/MidiDeviceTestCase.javalibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/api/midi/device/MidiDeviceTestCas0000644000175000017500000001550610374203233033360 0ustar twernertwerner/* * MidiDeviceTestCase.java */ /* * Copyright (c) 2003 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ package org.tritonus.test.api.midi.device; import javax.sound.midi.MidiDevice; import javax.sound.midi.Receiver; import javax.sound.midi.Transmitter; /** Class for tests of javax.sound.midi.MidiDevice. */ public class MidiDeviceTestCase extends BaseMidiDeviceTestCase { public MidiDeviceTestCase(String strName) { super(strName); } public void testGetDeviceInfo() throws Exception { Check check = new Check() { public void check(MidiDevice device) throws Exception { MidiDevice.Info info = device.getDeviceInfo(); assertNotNull("getDeviceInfo()", info); assertNotNull("DeviceInfo.getName()", info.getName()); assertNotNull("DeviceInfo.getVendor()", info.getVendor()); assertNotNull("DeviceInfo.getDescription()", info.getDescription()); assertNotNull("DeviceInfo.getVersion()", info.getVersion()); } }; checkMidiDevice(check); } public void testOpenClose() throws Exception { Check check = new Check() { public void check(MidiDevice device) throws Exception { assertTrue("closed", ! device.isOpen()); device.open(); assertTrue("open", device.isOpen()); device.close(); assertTrue("closed", ! device.isOpen()); } }; checkMidiDevice(check); } public void testGetMicrosecondPosition() throws Exception { Check check = new Check() { public void check(MidiDevice device) throws Exception { long lPosition = device.getMicrosecondPosition(); assertTrue("getMicrosecondPosition() before open", lPosition == -1 || lPosition == 0); device.open(); lPosition = device.getMicrosecondPosition(); assertTrue("getMicrosecondPosition() after open", lPosition == -1 || lPosition >= 0); device.close(); lPosition = device.getMicrosecondPosition(); assertTrue("getMicrosecondPosition() after close", lPosition == -1 || lPosition == 0); } }; checkMidiDevice(check); } public void testGetMaxReceivers() throws Exception { Check check = new Check() { public void check(MidiDevice device) { int nMax = device.getMaxReceivers(); assertTrue("getMaxReceivers()", nMax == -1 || nMax == 0); } }; checkMidiDevice(check); } public void testGetMaxTransmitters() throws Exception { Check check = new Check() { public void check(MidiDevice device) { int nMax = device.getMaxTransmitters(); assertTrue("getMaxTransmitters()", nMax == -1 || nMax == 0); } }; checkMidiDevice(check); } public void testGetReceiver() throws Exception { Check check = new Check() { public void check(MidiDevice device) throws Exception { int nMax = device.getMaxReceivers(); if (nMax != 0) { nMax = (nMax == -1) ? 100: nMax; Receiver[] aReceivers = new Receiver[nMax]; for (int i = 0; i < nMax; i++) { aReceivers[i] = device.getReceiver(); assertNotNull("getReceiver()", aReceivers[i]); for (int j = 0; j < i - 1; j++) { assertTrue("Receiver objects unique", aReceivers[i] != aReceivers[j]); } } for (int i = 0; i < nMax; i++) { aReceivers[i].close(); } } } }; checkMidiDevice(check); } public void testGetReceivers() throws Exception { Check check = new Check() { public void check(MidiDevice device) throws Exception { assertEquals("getReceivers() length", 0, device.getReceivers().size()); int nMax = device.getMaxReceivers(); if (nMax != 0) { nMax = (nMax == -1) ? 100: nMax; Receiver[] aReceivers = new Receiver[nMax]; for (int i = 0; i < nMax; i++) { aReceivers[i] = device.getReceiver(); assertTrue("Receiver in getReceivers()", device.getReceivers().contains(aReceivers[i])); } assertEquals("getReceivers() length", nMax, device.getReceivers().size()); for (int i = 0; i < nMax; i++) { aReceivers[i].close(); assertTrue("Receiver not in getReceivers()", ! device.getReceivers().contains(aReceivers[i])); } } assertEquals("getReceivers() length", 0, device.getReceivers().size()); } }; checkMidiDevice(check); } public void testGetTransmitter() throws Exception { Check check = new Check() { public void check(MidiDevice device) throws Exception { int nMax = device.getMaxTransmitters(); if (nMax != 0) { nMax = (nMax == -1) ? 100: nMax; Transmitter[] aTransmitters = new Transmitter[nMax]; for (int i = 0; i < nMax; i++) { aTransmitters[i] = device.getTransmitter(); assertNotNull("getTransmitter()", aTransmitters[i]); for (int j = 0; j < i - 1; j++) { assertTrue("Transmitter objects unique", aTransmitters[i] != aTransmitters[j]); } } for (int i = 0; i < nMax; i++) { aTransmitters[i].close(); } } } }; checkMidiDevice(check); } public void testGetTransmitters() throws Exception { Check check = new Check() { public void check(MidiDevice device) throws Exception { assertEquals("getTransmitters() length", 0, device.getTransmitters().size()); int nMax = device.getMaxTransmitters(); if (nMax != 0) { nMax = (nMax == -1) ? 100: nMax; Transmitter[] aTransmitters = new Transmitter[nMax]; for (int i = 0; i < nMax; i++) { aTransmitters[i] = device.getTransmitter(); assertTrue("Transmitter in getTransmitters()", device.getTransmitters().contains(aTransmitters[i])); } assertEquals("getTransmitters() length", nMax, device.getTransmitters().size()); for (int i = 0; i < nMax; i++) { aTransmitters[i].close(); assertTrue("Transmitter not in getTransmitters()", ! device.getTransmitters().contains(aTransmitters[i])); } } assertEquals("getTransmitters() length", 0, device.getTransmitters().size()); } }; checkMidiDevice(check); } } /*** MidiDeviceTestCase.java ***/ libtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/api/midi/message/0000755000175000017500000000000010621573046030331 5ustar twernertwerner././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootlibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/api/midi/message/MidiMessageTestCase.javalibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/api/midi/message/MidiMessageTestC0000644000175000017500000001264410374203233033406 0ustar twernertwerner/* * MidiMessageTestCase.java */ /* * Copyright (c) 2001 - 2002 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ package org.tritonus.test.api.midi.message; import junit.framework.TestCase; import javax.sound.midi.MidiMessage; import javax.sound.midi.InvalidMidiDataException; import org.tritonus.test.Util; /** Tests for class javax.sound.midi.MidiMessage. */ public class MidiMessageTestCase extends TestCase { public MidiMessageTestCase(String strName) { super(strName); } /** Checks the constructor. The test checks for four things:
  1. if the content of data follows the passed array (note that it is legal for data to be longer than the passed array).
  2. if the value of length follows the length of the passed array.
  3. if the constructor makes a copy of the passed array.
  4. if the constructor does (not) use setMessage().
*/ public void testConstructor() throws Exception { byte[] abData = new byte[]{(byte) 144, 127, 0}; TestMidiMessage message = new TestMidiMessage(abData); assertTrue("data content", Util.compareByteArrays(abData, 0, message.getDataField(), 0, abData.length)); assertEquals("length field", abData.length, message.getLengthField()); assertTrue("array copying", abData != message.getDataField()); assertEquals("setMessage() usage", false, message.getSetMessageUsed()); } /** Checks setMessage(byte[], int). The test checks for three things:
  1. if the content of data follows the passed array (note that it is legal for data to be longer than the passed array).
  2. if the value of length follows the length of the passed array.
  3. if the method makes a copy of the passed array.
*/ public void testSetMessage() throws Exception { byte[] abData = new byte[]{(byte) 144, 127, 0}; TestMidiMessage message = new TestMidiMessage(abData); byte[] abData2 = new byte[]{(byte) 128, 31, 1}; message.setMessage(abData2, abData2.length); assertTrue("data content", Util.compareByteArrays(abData2, 0, message.getDataField(), 0, abData.length)); assertEquals("length field", abData2.length, message.getLengthField()); assertTrue("array copying", abData2 != message.getDataField()); byte[] abData3 = new byte[]{(byte) 128, 31, 1, 55, 55, 55}; int nDesiredLength = 3; message.setMessage(abData3, nDesiredLength); assertTrue("data content", Util.compareByteArrays(abData3, 0, message.getDataField(), 0, nDesiredLength)); assertEquals("length field", nDesiredLength, message.getLengthField()); } /** Checks getMessage(). The test checks for three things:
  1. if the returned array has the correct length.
  2. if the returned array has the correct content (note that it is legal for stored data to be longer than the returned array).
  3. if the returned array is a copy of the stored array.
*/ public void testGetMessage() throws Exception { byte[] abData = new byte[]{(byte) 144, 127, 0}; TestMidiMessage message = new TestMidiMessage(abData); byte[] abReturned = message.getMessage(); assertEquals("length", abData.length, abReturned.length); assertTrue("data content", Util.compareByteArrays(abData, 0, abReturned, 0, abData.length)); assertTrue("array copying", abReturned != message.getDataField()); } /** Checks getStatus(). The test checks if the returned status byte is correct. */ public void testGetStatus() throws Exception { int nStatus = 144; byte[] abData = new byte[]{(byte) nStatus, 127, 0}; TestMidiMessage message = new TestMidiMessage(abData); int nReturnedStatus = message.getStatus(); assertEquals("status byte", nStatus, nReturnedStatus); } /** Checks setMessage(byte[], int). The test checks if the returned length is correct. */ public void testGetLength() throws Exception { byte[] abData = new byte[]{(byte) 144, 127, 0}; TestMidiMessage message = new TestMidiMessage(abData); int nReturnedLength = message.getLength(); assertEquals("length", abData.length, nReturnedLength); } /** Inner class used to access protected fields of MidiMessage. */ private class TestMidiMessage extends MidiMessage { private boolean m_bSetMessageUsed; public TestMidiMessage(byte[] abData) { super(abData); } public byte[] getDataField() { return data; } public int getLengthField() { return length; } public boolean getSetMessageUsed() { return m_bSetMessageUsed; } protected void setMessage(byte[] abData, int nLength) throws InvalidMidiDataException { super.setMessage(abData, nLength); m_bSetMessageUsed = true; } /** Not used here. */ public Object clone() { return null; } } } /*** MidiMessageTestCase.java ***/ libtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/api/midi/midisystem/0000755000175000017500000000000010621573046031074 5ustar twernertwerner././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootlibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/api/midi/midisystem/MidiSystemTestCase.javalibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/api/midi/midisystem/MidiSystemTes0000644000175000017500000000475610374203233033567 0ustar twernertwerner/* * MidiSystemTestCase.java */ /* * Copyright (c) 2004 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ package org.tritonus.test.api.midi.midisystem; import junit.framework.TestCase; import javax.sound.midi.MidiSystem; import javax.sound.midi.MidiDevice; //import javax.sound.midi.Sequencer; //import javax.sound.midi.Synthesizer; public class MidiSystemTestCase extends TestCase { private static final float DELTA = 1E-9F; public MidiSystemTestCase(String strName) { super(strName); } public void testGetDevices() throws Exception { assertNotNull("getSynthesizer()", MidiSystem.getSynthesizer()); assertNotNull("getSequencer()", MidiSystem.getSequencer()); assertNotNull("getSequencer(true)", MidiSystem.getSequencer(true)); assertNotNull("getSequencer(false)", MidiSystem.getSequencer(false)); assertNotNull("getReceiver()", MidiSystem.getReceiver()); assertNotNull("getTransmitter()", MidiSystem.getTransmitter()); } public void testGetEachMidiDevice() throws Exception { MidiDevice.Info[] infos = MidiSystem.getMidiDeviceInfo(); assertTrue("MidiDevice.Info array", infos.length > 0); for (int i = 0; i < infos.length; i++) { assertNotNull("getMidiDevice()", MidiSystem.getMidiDevice(infos[i])); } } public void testGetWrongMidiDevice() throws Exception { MidiDevice.Info info = new TestInfo("name", "vendor", "description", "version"); try { MidiSystem.getMidiDevice(info); fail("wrong MidiDevice.Info should throw exception"); } catch (IllegalArgumentException e) { } } private class TestInfo extends MidiDevice.Info { public TestInfo(String name, String vendor, String description, String version) { super(name, vendor, description, version); } } } /*** MidiSystemTestCase.java ***/ libtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/api/midi/misc/0000755000175000017500000000000010621573050027633 5ustar twernertwerner././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootlibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/api/midi/misc/MidiFileFormatTestCase.javalibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/api/midi/misc/MidiFileFormatTestC0000644000175000017500000001100510010143752033343 0ustar twernertwerner/* * MidiFileFormatTestCase.java */ /* * Copyright (c) 2003 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ package org.tritonus.test.api.midi.misc; import junit.framework.TestCase; import java.util.HashMap; import java.util.Map; import javax.sound.midi.MidiFileFormat; public class MidiFileFormatTestCase extends TestCase { private static final float DELTA = 1E-9F; public MidiFileFormatTestCase(String strName) { super(strName); } public void testGetValues() { checkGetValues(0, 0.0F, 0, 0, 0L, false); checkGetValues(0, 0.0F, 0, 0, 0L, true); checkGetValues(2, -1.0F, 25, 725, 600000L, false); checkGetValues(2, -1.0F, 25, 725, 600000L, true); } private void checkGetValues(int nType, float fDivisionType, int nResolution, int nByteLength, long lMicrosecondLength, boolean bWithMap) { MidiFileFormat fileFormat; if (bWithMap) { Map prop = new HashMap(); fileFormat = new MidiFileFormat(nType, fDivisionType, nResolution, nByteLength, lMicrosecondLength, prop); } else { fileFormat = new MidiFileFormat(nType, fDivisionType, nResolution, nByteLength, lMicrosecondLength); } assertEquals("type", nType, fileFormat.getType()); assertEquals("division type", fDivisionType, fileFormat.getDivisionType(), DELTA); assertEquals("resolution", nResolution, fileFormat.getResolution()); assertEquals("byte length", nByteLength, fileFormat.getByteLength()); assertEquals("microsecond length", lMicrosecondLength, fileFormat.getMicrosecondLength()); } public void testNoMap() { MidiFileFormat fileFormat = new MidiFileFormat(0, 0.0F, 0, 0, 0L); Map propReturn = fileFormat.properties(); assertNotNull(propReturn); assertTrue(propReturn.isEmpty()); Object result = propReturn.get("bitrate"); assertNull(result); } public void testNullMap() { MidiFileFormat fileFormat = new MidiFileFormat(0, 0.0F, 0, 0, 0L, null); Map propReturn = fileFormat.properties(); assertTrue(propReturn.isEmpty()); Object result = propReturn.get("bitrate"); assertNull(result); } public void testEmptyMap() { Map prop = new HashMap(); MidiFileFormat fileFormat = new MidiFileFormat(0, 0.0F, 0, 0, 0L, prop); Map propReturn = fileFormat.properties(); assertTrue(propReturn.isEmpty()); Object result = propReturn.get("bitrate"); assertNull(result); } public void testCopying() { Map prop = new HashMap(); prop.put("bitrate", new Float(22.5F)); MidiFileFormat fileFormat = new MidiFileFormat(0, 0, 0, 0, 0, prop); Map propReturn = fileFormat.properties(); assertTrue(prop != propReturn); prop.put("bitrate", new Float(42.5F)); Object result = propReturn.get("bitrate"); assertEquals(new Float(22.5F), result); } public void testUnmodifiable() { Map prop = new HashMap(); MidiFileFormat fileFormat = new MidiFileFormat(0, 0.0F, 0, 0, 0L, prop); Map propReturn = fileFormat.properties(); try { propReturn.put("author", "Matthias Pfisterer"); fail("returned Map allows modifications"); } catch (UnsupportedOperationException e) { } } public void testGet() { Map prop = new HashMap(); prop.put("bitrate", new Float(22.5F)); prop.put("author", "Matthias Pfisterer"); MidiFileFormat fileFormat = new MidiFileFormat(0, 0.0F, 0, 0, 0L, prop); Map propReturn = fileFormat.properties(); assertEquals(new Float(22.5F), propReturn.get("bitrate")); assertEquals("Matthias Pfisterer", propReturn.get("author")); } } /*** MidiFileFormatTestCase.java ***/ libtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/api/midi/sequencer/0000755000175000017500000000000010621573051030673 5ustar twernertwerner././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootlibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/api/midi/sequencer/BaseSequencerTestCase.javalibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/api/midi/sequencer/BaseSequencerT0000644000175000017500000000405410374203233033467 0ustar twernertwerner/* * BaseSequencerTestCase.java */ /* * Copyright (c) 2003 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ package org.tritonus.test.api.midi.sequencer; import javax.sound.midi.MidiDevice; import javax.sound.midi.MidiSystem; import javax.sound.midi.Sequencer; import junit.framework.TestCase; /** Base class for testsof javax.sound.midi.Sequencer. */ public abstract class BaseSequencerTestCase extends TestCase { private static final boolean IGNORE_SUN_SEQUENCER = true; protected BaseSequencerTestCase(String strName) { super(strName); } /** Iterate over all available Sequencers. */ public void testSeqencer() throws Exception { MidiDevice.Info[] infos = MidiSystem.getMidiDeviceInfo(); for (int i = 0; i < infos.length; i++) { MidiDevice device = MidiSystem.getMidiDevice(infos[i]); if (device instanceof Sequencer && ! (IGNORE_SUN_SEQUENCER && device.getDeviceInfo().getVendor().indexOf("Sun") != -1)) { System.out.println("testing seq: " + device); checkSequencer((Sequencer) device); } } } protected abstract void checkSequencer(Sequencer seq) throws Exception; /** Get the prefix for error messages (containing the sequencer's name). */ protected static String getMessagePrefix(Sequencer seq) { return seq.getDeviceInfo().getName(); } } /*** BaseSequencerTestCase.java ***/ ././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootlibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/api/midi/sequencer/IllegalStateTestCase.javalibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/api/midi/sequencer/IllegalStateTe0000644000175000017500000002307510374203233033465 0ustar twernertwerner/* * IllegalStateTestCase.java */ /* * Copyright (c) 2003 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ package org.tritonus.test.api.midi.sequencer; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.InputStream; import javax.sound.midi.ControllerEventListener; import javax.sound.midi.MetaEventListener; import javax.sound.midi.MidiSystem; import javax.sound.midi.Sequence; import javax.sound.midi.Sequencer; import javax.sound.midi.ShortMessage; import javax.sound.midi.MetaMessage; /** Tests for class javax.sound.midi.MidiMessage. */ public class IllegalStateTestCase extends BaseSequencerTestCase { public IllegalStateTestCase(String strName) { super(strName); } protected void checkSequencer(Sequencer seq) throws Exception { // Sequencer is closed checkOpenRequired(seq, false); checkOpenNotRequired(seq, false); // sequencer open seq.open(); checkOpenRequired(seq, true); checkOpenNotRequired(seq, true); // clean up seq.close(); } private void checkOpenRequired(Sequencer seq, boolean bOpen) throws Exception { boolean bExpectingException = ! bOpen; checkMethod(seq, "start()", bExpectingException, bOpen); checkMethod(seq, "stop()", bExpectingException, bOpen); checkMethod(seq, "startRecording()", bExpectingException, bOpen); checkMethod(seq, "stopRecording()", bExpectingException, bOpen); } private void checkOpenNotRequired(Sequencer seq, boolean bOpen) throws Exception { boolean bExpectingException = false; checkMethod(seq, "setSequence(Sequence)", bExpectingException, bOpen); checkMethod(seq, "setSequence(InputStream)", bExpectingException, bOpen); checkMethod(seq, "getSequence()", bExpectingException, bOpen); checkMethod(seq, "isRunning()", bExpectingException, bOpen); checkMethod(seq, "isRecording()", bExpectingException, bOpen); checkMethod(seq, "recordEnable()", bExpectingException, bOpen); checkMethod(seq, "recordDisable()", bExpectingException, bOpen); checkMethod(seq, "getTempoInBPM()", bExpectingException, bOpen); checkMethod(seq, "setTempoInBPM()", bExpectingException, bOpen); checkMethod(seq, "getTempoInMPQ()", bExpectingException, bOpen); checkMethod(seq, "setTempoInMPQ()", bExpectingException, bOpen); checkMethod(seq, "setTempoFactor()", bExpectingException, bOpen); checkMethod(seq, "getTempoFactor()", bExpectingException, bOpen); checkMethod(seq, "getTickLength()", bExpectingException, bOpen); checkMethod(seq, "getTickPosition()", bExpectingException, bOpen); checkMethod(seq, "setTickPosition()", bExpectingException, bOpen); checkMethod(seq, "getMicrosecondLength()", bExpectingException, bOpen); checkMethod(seq, "getMicrosecondPosition()", bExpectingException, bOpen); checkMethod(seq, "setMicrosecondPosition()", bExpectingException, bOpen); checkMethod(seq, "setMasterSyncMode()", bExpectingException, bOpen); checkMethod(seq, "getMasterSyncMode()", bExpectingException, bOpen); checkMethod(seq, "getMasterSyncModes()", bExpectingException, bOpen); checkMethod(seq, "setSlaveSyncMode()", bExpectingException, bOpen); checkMethod(seq, "getSlaveSyncMode()", bExpectingException, bOpen); checkMethod(seq, "getSlaveSyncModes()", bExpectingException, bOpen); checkMethod(seq, "setTrackMute()", bExpectingException, bOpen); checkMethod(seq, "getTrackMute()", bExpectingException, bOpen); checkMethod(seq, "setTrackSolo()", bExpectingException, bOpen); checkMethod(seq, "getTrackSolo()", bExpectingException, bOpen); checkMethod(seq, "addMetaEventListener()", bExpectingException, bOpen); checkMethod(seq, "removeMetaEventListener()", bExpectingException, bOpen); checkMethod(seq, "addControllerEventListener()", bExpectingException, bOpen); checkMethod(seq, "removeControllerEventListener()", bExpectingException, bOpen); } private void checkMethod(Sequencer seq, String strMethodName, boolean bExceptionExpected, boolean bOpen) throws Exception { try { if ("start()".equals(strMethodName)) seq.start(); else if ("stop()".equals(strMethodName)) seq.stop(); else if ("startRecording()".equals(strMethodName)) seq.startRecording(); else if ("stopRecording()".equals(strMethodName)) seq.stopRecording(); else if ("setSequence(Sequence)".equals(strMethodName)) seq.setSequence(createSequence()); else if ("setSequence(InputStream)".equals(strMethodName)) seq.setSequence(createSequenceInputStream()); else if ("getSequence()".equals(strMethodName)) seq.getSequence(); else if ("isRunning()".equals(strMethodName)) seq.isRunning(); else if ("isRecording()".equals(strMethodName)) seq.isRecording(); else if ("recordEnable()".equals(strMethodName)) seq.recordEnable(seq.getSequence().getTracks()[0], -1); else if ("recordDisable()".equals(strMethodName)) seq.recordDisable(seq.getSequence().getTracks()[0]); else if ("getTempoInBPM()".equals(strMethodName)) seq.getTempoInBPM(); else if ("setTempoInBPM()".equals(strMethodName)) seq.setTempoInBPM(122); else if ("getTempoInMPQ()".equals(strMethodName)) seq.getTempoInMPQ(); else if ("setTempoInMPQ()".equals(strMethodName)) seq.setTempoInMPQ(300000); else if ("setTempoFactor()".equals(strMethodName)) seq.setTempoFactor(2.0F); else if ("getTempoFactor()".equals(strMethodName)) seq.getTempoFactor(); else if ("getTickLength()".equals(strMethodName)) seq.getTickLength(); else if ("getTickPosition()".equals(strMethodName)) seq.getTickPosition(); else if ("setTickPosition()".equals(strMethodName)) seq.setTickPosition(1); else if ("getMicrosecondLength()".equals(strMethodName)) seq.getMicrosecondLength(); else if ("getMicrosecondPosition()".equals(strMethodName)) seq.getMicrosecondPosition(); else if ("setMicrosecondPosition()".equals(strMethodName)) seq.setMicrosecondPosition(1); else if ("setMasterSyncMode()".equals(strMethodName)) seq.setMasterSyncMode(Sequencer.SyncMode.INTERNAL_CLOCK); else if ("getMasterSyncMode()".equals(strMethodName)) seq.getMasterSyncMode(); else if ("getMasterSyncModes()".equals(strMethodName)) seq.getMasterSyncModes(); else if ("setSlaveSyncMode()".equals(strMethodName)) seq.setSlaveSyncMode(Sequencer.SyncMode.NO_SYNC); else if ("getSlaveSyncMode()".equals(strMethodName)) seq.getSlaveSyncMode(); else if ("getSlaveSyncModes()".equals(strMethodName)) seq.getSlaveSyncModes(); else if ("setTrackMute()".equals(strMethodName)) seq.setTrackMute(0, true); else if ("getTrackMute()".equals(strMethodName)) seq.getTrackMute(0); else if ("setTrackSolo()".equals(strMethodName)) seq.setTrackSolo(0, true); else if ("getTrackSolo()".equals(strMethodName)) seq.getTrackSolo(0); else if ("addMetaEventListener()".equals(strMethodName)) seq.addMetaEventListener(new DummyMetaEventListener()); else if ("removeMetaEventListener()".equals(strMethodName)) seq.removeMetaEventListener(new DummyMetaEventListener()); else if ("addControllerEventListener()".equals(strMethodName)) seq.addControllerEventListener( new DummyControllerEventListener(), new int[]{0}); else if ("removeControllerEventListener()".equals(strMethodName)) seq.removeControllerEventListener( new DummyControllerEventListener(), new int[]{0}); else throw new RuntimeException("unknown method name"); if (bExceptionExpected) { fail(constructErrorMessage(seq, strMethodName, bExceptionExpected, bOpen)); } } catch (IllegalStateException e) { if (! bExceptionExpected) { fail(constructErrorMessage(seq, strMethodName, bExceptionExpected, bOpen)); } } } private static Sequence createSequence() throws Exception { Sequence sequence = new Sequence(Sequence.PPQ, 480); sequence.createTrack(); return sequence; } private static InputStream createSequenceInputStream() throws Exception { Sequence sequence = createSequence(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); MidiSystem.write(sequence, 0, baos); byte[] data = baos.toByteArray(); InputStream inputStream = new ByteArrayInputStream(data); return inputStream; } private static String constructErrorMessage(Sequencer seq, String strMethodName, boolean bExceptionExpected, boolean bOpen) { String strMessage = getMessagePrefix(seq) + ": IllegalStateException "; strMessage += (bExceptionExpected ? "not thrown" : "thrown"); strMessage += " on " + strMethodName + " in "; strMessage += (bOpen ? "open" : "closed"); strMessage += " state"; return strMessage; } private static class DummyMetaEventListener implements MetaEventListener { public void meta(MetaMessage meta) { // DO NOTHING } } private static class DummyControllerEventListener implements ControllerEventListener { public void controlChange(ShortMessage event) { // DO NOTHING } } } /*** IllegalStateTestCase.java ***/ ././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootlibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/api/midi/sequencer/SequenceLengthTestCase.javalibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/api/midi/sequencer/SequenceLength0000644000175000017500000000354410374203233033533 0ustar twernertwerner/* * SequenceLengthTestCase.java */ /* * Copyright (c) 2003 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ package org.tritonus.test.api.midi.sequencer; import java.io.File; import javax.sound.midi.MidiSystem; import javax.sound.midi.Sequence; import javax.sound.midi.Sequencer; /** Tests for class javax.sound.midi.MidiMessage. */ public class SequenceLengthTestCase extends BaseSequencerTestCase { private static final String MIDI_FILENAME = "trippygaia1.mid"; public SequenceLengthTestCase(String strName) { super(strName); } protected void checkSequencer(Sequencer seq) throws Exception { seq.open(); Sequence sequence = MidiSystem.getSequence(getMediaFile(MIDI_FILENAME)); seq.setSequence(sequence); assertEquals(getMessagePrefix(seq) + ": tick length", sequence.getTickLength(), seq.getTickLength()); assertEquals(getMessagePrefix(seq) + ": time length", sequence.getMicrosecondLength(), seq.getMicrosecondLength()); // clean up seq.close(); } private static File getMediaFile(String strFilename) { return new File("sounds/" + strFilename); } } /*** SequenceLengthTestCase.java ***/ ././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootlibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/api/midi/sequencer/SyncModesTestCase.javalibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/api/midi/sequencer/SyncModesTestC0000644000175000017500000000761210374203233033470 0ustar twernertwerner/* * SyncModesTestCase.java */ /* * Copyright (c) 2003 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ package org.tritonus.test.api.midi.sequencer; import javax.sound.midi.Sequencer; import javax.sound.midi.Sequencer.SyncMode; /** Tests for class javax.sound.midi.MidiMessage. */ public class SyncModesTestCase extends BaseSequencerTestCase { private static final Sequencer.SyncMode[] MASTER_SYNC_MODES = { Sequencer.SyncMode.INTERNAL_CLOCK, Sequencer.SyncMode.MIDI_SYNC, Sequencer.SyncMode.MIDI_TIME_CODE }; private static final Sequencer.SyncMode[] SLAVE_SYNC_MODES = { Sequencer.SyncMode.NO_SYNC, Sequencer.SyncMode.MIDI_SYNC, Sequencer.SyncMode.MIDI_TIME_CODE }; public SyncModesTestCase(String strName) { super(strName); } protected void checkSequencer(Sequencer seq) throws Exception { Sequencer.SyncMode syncMode; Sequencer.SyncMode[] syncModes; // slave sync modes syncMode = seq.getSlaveSyncMode(); assertNotNull("initial slave sync mode", syncMode); assertTrue(isSlaveSyncMode(syncMode)); syncModes = seq.getSlaveSyncModes(); assertNotNull("available slave sync modes", syncModes); assertTrue("number of available slave sync modes", syncModes.length >= 1); for (int i = 0; i < syncModes.length; i++) { assertTrue(isSlaveSyncMode(syncModes[i])); checkSyncModeAccepted(seq, syncModes[i], false); } checkSyncModeAccepted(seq, Sequencer.SyncMode.NO_SYNC, false); // master sync modes syncMode = seq.getMasterSyncMode(); assertNotNull("initial master sync mode", syncMode); assertTrue(isMasterSyncMode(syncMode)); syncModes = seq.getMasterSyncModes(); assertNotNull("available master sync modes", syncModes); assertTrue("number of available master sync modes", syncModes.length >= 1); for (int i = 0; i < syncModes.length; i++) { assertTrue(isMasterSyncMode(syncModes[i])); checkSyncModeAccepted(seq, syncModes[i], true); } checkSyncModeAccepted(seq, Sequencer.SyncMode.INTERNAL_CLOCK, true); } private void checkSyncModeAccepted(Sequencer seq, Sequencer.SyncMode syncMode, boolean bMaster) { String strErrorMessage = constructErrorMessage(seq, syncMode, bMaster); if (bMaster) { seq.setMasterSyncMode(syncMode); assertSame(strErrorMessage, syncMode, seq.getMasterSyncMode()); } else { seq.setSlaveSyncMode(syncMode); assertSame(strErrorMessage, syncMode, seq.getSlaveSyncMode()); } } private boolean isMasterSyncMode(SyncMode syncMode) { return contains(MASTER_SYNC_MODES, syncMode); } private boolean isSlaveSyncMode(SyncMode syncMode) { return contains(SLAVE_SYNC_MODES, syncMode); } private boolean contains(SyncMode[] list, SyncMode test) { for (int i = 0; i < list.length; i++) { if (list[i].equals(test)) { return true; } } return false; } private static String constructErrorMessage(Sequencer seq, Sequencer.SyncMode syncMode, boolean bMaster) { String strMessage = seq.getDeviceInfo().getName() + ": "; strMessage += syncMode.toString(); strMessage += bMaster ? " as master " : " as slave "; return strMessage; } } /*** SyncModesTestCase.java ***/ ././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootlibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/api/midi/sequencer/TempoTestCase.javalibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/api/midi/sequencer/TempoTestCase.0000644000175000017500000001124310374203233033412 0ustar twernertwerner/* * TempoTestCase.java */ /* * Copyright (c) 2003 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ package org.tritonus.test.api.midi.sequencer; import javax.sound.midi.MetaEventListener; import javax.sound.midi.MetaMessage; import javax.sound.midi.MidiEvent; import javax.sound.midi.Sequence; import javax.sound.midi.Sequencer; import javax.sound.midi.Track; //import javax.sound.midi.InvalidMidiDataException; /** Tests for class javax.sound.midi.MidiMessage. */ public class TempoTestCase extends BaseSequencerTestCase { private static final float DELTA = 1.0E-9F; private static final float MPQ0 = 500000; private static final float BPM0 = 120; private static final float MPQ1 = 600000; private static final float BPM1 = 100; private static final float MPQ2 = 416666.66F; private static final float BPM2 = 144; private static final byte[] TEMPOTEXT = { 't', 'e', 'm', 'p', 'o' }; public TempoTestCase(String strName) { super(strName); } protected void checkSequencer(Sequencer seq) throws Exception { // initial tempo checkTempoValues("initial", seq, MPQ0, BPM0, 1.0F); // setting values in closed state seq.setTempoInMPQ(MPQ1); checkTempoValues("closed: setMPQ", seq, MPQ1, BPM1, 1.0F); seq.setTempoInBPM(BPM2); checkTempoValues("closed: setBPM", seq, MPQ2, BPM2, 1.0F); seq.setTempoFactor(2.0F); checkTempoValues("closed: setFactor", seq, MPQ2, BPM2, 2.0F); seq.setSequence(createSequence()); checkTempoValues("closed: after setSequence()", seq, MPQ2, BPM2, 1.0F); seq.open(); checkTempoValues("after open()", seq, MPQ2, BPM2, 1.0F); // setting values in open state seq.setTempoInMPQ(MPQ1); checkTempoValues("open: setMPQ", seq, MPQ1, BPM1, 1.0F); seq.setTempoInBPM(BPM2); checkTempoValues("open: setBPM", seq, MPQ2, BPM2, 1.0F); seq.setTempoFactor(3.0F); checkTempoValues("open: setFactor", seq, MPQ2, BPM2, 3.0F); seq.start(); checkTempoValues("after start()", seq, MPQ2, BPM2, 3.0F); // setting values in start state seq.setTempoInMPQ(MPQ1); checkTempoValues("started: setMPQ", seq, MPQ1, BPM1, 3.0F); seq.setTempoInBPM(BPM2); checkTempoValues("started: setBPM", seq, MPQ2, BPM2, 3.0F); seq.setTempoFactor(2.0F); checkTempoValues("started: setFactor", seq, MPQ2, BPM2, 2.0F); seq.stop(); checkTempoValues("after stop()", seq, MPQ2, BPM2, 2.0F); // setting values in start state seq.setTempoInMPQ(MPQ1); checkTempoValues("stopped: setMPQ", seq, MPQ1, BPM1, 2.0F); seq.setTempoInBPM(BPM2); checkTempoValues("stopped: setBPM", seq, MPQ2, BPM2, 2.0F); seq.setTempoFactor(3.0F); checkTempoValues("stopped: setFactor", seq, MPQ2, BPM2, 3.0F); seq.close(); checkTempoValues("after close()", seq, MPQ2, BPM2, 3.0F); } private void checkTempoValues(String strMessagePrefix, Sequencer seq, float fExpectedMPQ, float fExpectedBPM, float fExpectedFactor) { assertEquals(strMessagePrefix + " tempo in MPQ", fExpectedMPQ, seq.getTempoInMPQ(), DELTA); assertEquals(strMessagePrefix + " tempo in BPM", fExpectedBPM, seq.getTempoInBPM(), DELTA); assertEquals(strMessagePrefix + " tempo factor", fExpectedFactor, seq.getTempoFactor(), DELTA); } private static Sequence createSequence() throws Exception { Sequence sequence = new Sequence(Sequence.PPQ, 480); Track track = sequence.createTrack(); for (long lTick = 0; lTick < 100000; lTick += 1000) { MetaMessage mm = new MetaMessage(); mm.setMessage(6, TEMPOTEXT, TEMPOTEXT.length); MidiEvent me = new MidiEvent(mm, lTick); track.add(me); } return sequence; } private static class TempoDetector implements MetaEventListener { private long[] m_alArrivalTimes; public void meta(MetaMessage message) { if (message.getType() == 6) { System.arraycopy(m_alArrivalTimes, 0, m_alArrivalTimes, 1, 9); m_alArrivalTimes[0] = System.currentTimeMillis(); } } public float getTempoInMPQ() { return 0.0F; } } } /*** TempoTestCase.java ***/ libtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/api/midi/spi/0000755000175000017500000000000010621573051027474 5ustar twernertwerner././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootlibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/api/midi/spi/MidiDeviceProviderTestCase.javalibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/api/midi/spi/MidiDeviceProviderTe0000644000175000017500000000514110374203233033423 0ustar twernertwerner/* * MidiDeviceProviderTestCase.java */ /* * Copyright (c) 2001 - 2002 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ package org.tritonus.test.api.midi.spi; import junit.framework.TestCase; import javax.sound.midi.MidiDevice; import javax.sound.midi.spi.MidiDeviceProvider; /** Tests for class javax.sound.midi.spi.MidiDeviceProvider. */ public class MidiDeviceProviderTestCase extends TestCase { public MidiDeviceProviderTestCase(String strName) { super(strName); } public void testIsDeviceSupported() throws Exception { MidiDevice.Info info = new TestInfo("name", "vendor", "description", "version"); checkIsDeviceSupported(new MidiDevice.Info[0], info, false); checkIsDeviceSupported(new MidiDevice.Info[]{info}, info, true); checkIsDeviceSupported(new MidiDevice.Info[]{info}, null, false); } private void checkIsDeviceSupported(MidiDevice.Info[] aSupportedInfos, MidiDevice.Info testInfo, boolean bExpectedResult) throws Exception { MidiDeviceProvider provider = new TestMidiDeviceProvider(aSupportedInfos); assertTrue("empty supported array", ! (bExpectedResult ^ provider.isDeviceSupported(testInfo))); } /** Concrete subclass of MidiDeviceProvider. */ private class TestMidiDeviceProvider extends MidiDeviceProvider { MidiDevice.Info[] m_aSupportedInfos; public TestMidiDeviceProvider(MidiDevice.Info[] aSupportedInfos) { m_aSupportedInfos = aSupportedInfos; } public MidiDevice.Info[] getDeviceInfo() { return m_aSupportedInfos; } public MidiDevice getDevice(MidiDevice.Info info) { return null; } } /** Accessible subclass of MidiDevice.Info. */ private class TestInfo extends MidiDevice.Info { public TestInfo(String name, String vendor, String description, String version) { super(name, vendor, description, version); } } } /*** MidiDeviceProviderTestCase.java ***/ ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootlibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/api/midi/spi/MidiFileWriterTestCase.javalibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/api/midi/spi/MidiFileWriterTestCa0000644000175000017500000000536510374203233033410 0ustar twernertwerner/* * MidiFileWriterTestCase.java */ /* * Copyright (c) 2001 - 2002 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ package org.tritonus.test.api.midi.spi; import junit.framework.TestCase; /* import javax.sound.midi.InvalidMidiDataException; import javax.sound.midi.MidiDevice; import javax.sound.midi.spi.MidiFileWriter; */ /** Tests for class javax.sound.midi.spi.MidiFileWriter. */ public class MidiFileWriterTestCase extends TestCase { public MidiFileWriterTestCase(String strName) { super(strName); } // public void testIsDeviceSupported() // throws Exception // { // MidiDevice.Info info = new TestInfo("name", "vendor", // "description", "version"); // checkIsDeviceSupported(new MidiDevice.Info[0], info, false); // checkIsDeviceSupported(new MidiDevice.Info[]{info}, info, true); // checkIsDeviceSupported(new MidiDevice.Info[]{info}, null, false); // } // private void checkIsDeviceSupported(MidiDevice.Info[] aSupportedInfos, // MidiDevice.Info testInfo, // boolean bExpectedResult) // throws Exception // { // MidiFileWriter provider = new TestMidiFileWriter(aSupportedInfos); // assertTrue("empty supported array", ! (bExpectedResult ^ provider.isDeviceSupported(testInfo))); // } // /** Concrete subclass of MidiFileWriter. // */ // private class TestMidiFileWriter // extends MidiFileWriter // { // MidiDevice.Info[] m_aSupportedInfos; // public TestMidiFileWriter(MidiDevice.Info[] aSupportedInfos) // { // m_aSupportedInfos = aSupportedInfos; // } // public MidiDevice.Info[] getDeviceInfo() // { // return m_aSupportedInfos; // } // public MidiDevice getDevice(MidiDevice.Info info) // { // return null; // } // } // /** Accessible subclass of MidiDevice.Info. // */ // private class TestInfo // extends MidiDevice.Info // { // public TestInfo(String name, String vendor, String description, // String version) // { // super(name, vendor, description, version); // } // } } /*** MidiFileWriterTestCase.java ***/ libtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/api/midi/synthesizer/0000755000175000017500000000000010621573052031271 5ustar twernertwerner././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootlibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/api/midi/synthesizer/BaseSynthesizerTestCase.javalibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/api/midi/synthesizer/BaseSynthesi0000644000175000017500000000452410400050673033614 0ustar twernertwerner/* * BaseSynthesizerTestCase.java */ /* * Copyright (c) 2006 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ package org.tritonus.test.api.midi.synthesizer; import javax.sound.midi.MidiDevice; import javax.sound.midi.MidiSystem; import javax.sound.midi.Synthesizer; import junit.framework.TestCase; /** Base class for testsof javax.sound.midi.Synthesizer. */ public abstract class BaseSynthesizerTestCase extends TestCase { private static final boolean IGNORE_SUN_SYNTHESIZER = false; protected BaseSynthesizerTestCase(String strName) { super(strName); } /** Iterate over all available Sequencers. */ public void testSeqencer() throws Exception { MidiDevice.Info[] infos = MidiSystem.getMidiDeviceInfo(); for (int i = 0; i < infos.length; i++) { MidiDevice device = MidiSystem.getMidiDevice(infos[i]); if (device instanceof Synthesizer && ! (IGNORE_SUN_SYNTHESIZER && device.getDeviceInfo().getVendor().indexOf("Sun") != -1)) { System.out.println("testing synth: " + device); checkSynthesizer((Synthesizer) device); } } } protected abstract void checkSynthesizer(Synthesizer seq) throws Exception; protected static String constructErrorMessage(Synthesizer synth, String strMessage, boolean bOpen) { String strAll = getMessagePrefix(synth) + strMessage; strAll += " in " + (bOpen ? "open" : "closed") + " state"; return strAll; } /** Get the prefix for error messages (containing the Synthesizer's name). */ protected static String getMessagePrefix(Synthesizer seq) { return seq.getDeviceInfo().getName() + ": "; } } /*** BaseSynthesizerTestCase.java ***/ ././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootlibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/api/midi/synthesizer/GetChannelsTestCase.javalibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/api/midi/synthesizer/GetChannelsT0000644000175000017500000000343410374567173033553 0ustar twernertwerner/* * GetChannelsTestCase.java */ /* * Copyright (c) 2006 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ package org.tritonus.test.api.midi.synthesizer; import javax.sound.midi.Synthesizer; import javax.sound.midi.MidiChannel; /** Test for javax.sound.midi.Synthesizer.getLatency(). */ public class GetChannelsTestCase extends BaseSynthesizerTestCase { public GetChannelsTestCase(String strName) { super(strName); } protected void checkSynthesizer(Synthesizer synth) throws Exception { MidiChannel[] channels; synth.open(); try { channels = synth.getChannels(); assertNotNull(constructErrorMessage(synth, "getChannels() result null", true), channels); int numChannels = channels.length; assertTrue(constructErrorMessage(synth, "getChannels() result has wrong length", true), numChannels == 16); for (int i = 0; i < channels.length; i++) { assertNotNull(constructErrorMessage(synth, "getChannels() result element null", true), channels[i]); } } finally { synth.close(); } } } /*** GetChannelsTestCase.java ***/ ././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootlibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/api/midi/synthesizer/GetDefaultSoundbankTestCase.javalibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/api/midi/synthesizer/GetDefaultSo0000644000175000017500000000310110374567173033551 0ustar twernertwerner/* * GetDefaultSoundbankTestCase.java */ /* * Copyright (c) 2006 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ package org.tritonus.test.api.midi.synthesizer; import javax.sound.midi.Synthesizer; import javax.sound.midi.Soundbank; /** Test for javax.sound.midi.Synthesizer.getDefaultSoundbank(). */ public class GetDefaultSoundbankTestCase extends BaseSynthesizerTestCase { public GetDefaultSoundbankTestCase(String strName) { super(strName); } protected void checkSynthesizer(Synthesizer synth) throws Exception { synth.open(); try { Soundbank sb = synth.getDefaultSoundbank(); if (sb != null) { assertTrue(constructErrorMessage(synth, "default soundbank not supported by isSoundbankSupported()", true), synth.isSoundbankSupported(sb)); } } finally { synth.close(); } } } /*** GetDefaultSoundbankTestCase ***/ ././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootlibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/api/midi/synthesizer/GetLatencyTestCase.javalibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/api/midi/synthesizer/GetLatencyTe0000644000175000017500000000313410374567173033561 0ustar twernertwerner/* * GetLatencyTestCase.java */ /* * Copyright (c) 2006 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ package org.tritonus.test.api.midi.synthesizer; import javax.sound.midi.Synthesizer; /** Test for javax.sound.midi.Synthesizer.getLatency(). */ public class GetLatencyTestCase extends BaseSynthesizerTestCase { public GetLatencyTestCase(String strName) { super(strName); } protected void checkSynthesizer(Synthesizer synth) throws Exception { long latency; synth.open(); try { latency = synth.getLatency(); assertTrue(constructErrorMessage(synth, true), latency >= 0); } finally { synth.close(); } } private static String constructErrorMessage(Synthesizer synth, boolean bOpen) { return BaseSynthesizerTestCase.constructErrorMessage(synth, "getLatency() result not positive", bOpen); } } /*** GetLatencyTestCase.java ***/ ././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootlibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/api/midi/synthesizer/GetMaxPolyphonyTestCase.javalibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/api/midi/synthesizer/GetMaxPolyph0000644000175000017500000000315110374567173033611 0ustar twernertwerner/* * GetMaxPolyphonyTestCase.java */ /* * Copyright (c) 2006 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ package org.tritonus.test.api.midi.synthesizer; import javax.sound.midi.Synthesizer; /** Tests for class javax.sound.midi.Synthesizer. */ public class GetMaxPolyphonyTestCase extends BaseSynthesizerTestCase { public GetMaxPolyphonyTestCase(String strName) { super(strName); } protected void checkSynthesizer(Synthesizer synth) throws Exception { int poly; synth.open(); try { poly = synth.getMaxPolyphony(); assertTrue(constructErrorMessage(synth, true), poly > 0); } finally { synth.close(); } } private static String constructErrorMessage(Synthesizer synth, boolean bOpen) { return BaseSynthesizerTestCase.constructErrorMessage(synth, "getMaxPolyphony() result not positive", bOpen); } } /*** GetMaxPolyphonyTestCase.java ***/ ././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootlibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/api/midi/synthesizer/GetVoiceStatusTestCase.javalibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/api/midi/synthesizer/GetVoiceStat0000644000175000017500000000324610374567173033576 0ustar twernertwerner/* * GetVoiceStatusTestCase.java */ /* * Copyright (c) 2006 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ package org.tritonus.test.api.midi.synthesizer; import javax.sound.midi.Synthesizer; import javax.sound.midi.VoiceStatus; /** Test for javax.sound.midi.Synthesizer.getLatency(). */ public class GetVoiceStatusTestCase extends BaseSynthesizerTestCase { public GetVoiceStatusTestCase(String strName) { super(strName); } protected void checkSynthesizer(Synthesizer synth) throws Exception { VoiceStatus[] status; synth.open(); try { status = synth.getVoiceStatus(); assertNotNull(constructErrorMessage(synth, "getVoiceStatus() result null", true), status); int numVoices = status.length; assertTrue(constructErrorMessage(synth, "getVoiceStatus() result has wrong length", true), numVoices == 0 || numVoices == synth.getMaxPolyphony()); } finally { synth.close(); } } } /*** GetVoiceStatusTestCase.java ***/ ././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootlibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/api/midi/synthesizer/IllegalStateTestCase.javalibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/api/midi/synthesizer/IllegalState0000644000175000017500000000672310374567173033612 0ustar twernertwerner/* * IllegalStateTestCase.java */ /* * Copyright (c) 2006 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ package org.tritonus.test.api.midi.synthesizer; import javax.sound.midi.Synthesizer; /** Tests for class javax.sound.midi.Synthesizer. */ public class IllegalStateTestCase extends BaseSynthesizerTestCase { public IllegalStateTestCase(String strName) { super(strName); } protected void checkSynthesizer(Synthesizer synth) throws Exception { // Synthesizer is closed checkMethods(synth, false); // Synthesizer open synth.open(); checkMethods(synth, true); // clean up synth.close(); } private void checkMethods(Synthesizer synth, boolean bOpen) throws Exception { boolean bExpectingException = false; checkMethod(synth, "getMaxPolyphony()", bExpectingException, bOpen); checkMethod(synth, "getLatency()", bExpectingException, bOpen); checkMethod(synth, "getChannels()", bExpectingException, bOpen); checkMethod(synth, "getVoiceStatus()", bExpectingException, bOpen); checkMethod(synth, "getDefaultSoundbank()", bExpectingException, bOpen); checkMethod(synth, "getAvailableInstruments()", bExpectingException, bOpen); checkMethod(synth, "getLoadedInstruments()", bExpectingException, bOpen); } private void checkMethod(Synthesizer synth, String strMethodName, boolean bExceptionExpected, boolean bOpen) throws Exception { try { if ("getMaxPolyphony()".equals(strMethodName)) synth.getMaxPolyphony(); else if ("getLatency()".equals(strMethodName)) synth.getLatency(); else if ("getChannels()".equals(strMethodName)) synth.getChannels(); else if ("getVoiceStatus()".equals(strMethodName)) synth.getVoiceStatus(); else if ("getDefaultSoundbank()".equals(strMethodName)) synth.getDefaultSoundbank(); else if ("getAvailableInstruments()".equals(strMethodName)) synth.getAvailableInstruments(); else if ("getLoadedInstruments()".equals(strMethodName)) synth.getLoadedInstruments(); else throw new RuntimeException("unknown method name"); if (bExceptionExpected) { fail(constructErrorMessage(synth, strMethodName, bExceptionExpected, bOpen)); } } catch (IllegalStateException e) { if (! bExceptionExpected) { fail(constructErrorMessage(synth, strMethodName, bExceptionExpected, bOpen)); } } } private static String constructErrorMessage(Synthesizer synth, String strMethodName, boolean bExceptionExpected, boolean bOpen) { String strMessage = ": IllegalStateException "; strMessage += (bExceptionExpected ? "not thrown" : "thrown"); strMessage += " on " + strMethodName; return BaseSynthesizerTestCase.constructErrorMessage(synth, strMessage, bOpen); } } /*** IllegalStateTestCase.java ***/ ././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootlibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/api/midi/synthesizer/MidiChannelTestCase.javalibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/api/midi/synthesizer/MidiChannelT0000644000175000017500000001137210377142062033520 0ustar twernertwerner/* * MidiChannelTestCase.java */ /* * Copyright (c) 2006 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ package org.tritonus.test.api.midi.synthesizer; import javax.sound.midi.Synthesizer; import javax.sound.midi.MidiChannel; /** Test for javax.sound.midi.Synthesizer.getLatency(). */ public class MidiChannelTestCase extends BaseSynthesizerTestCase { public MidiChannelTestCase(String strName) { super(strName); } protected void checkSynthesizer(Synthesizer synth) throws Exception { MidiChannel channel; synth.open(); try { channel = synth.getChannels()[0]; checkNotes(synth, channel); checkNotes2(synth, channel); checkPolyPressure(synth, channel); checkChannelPressure(synth, channel); checkProgramChange(synth, channel); checkProgramChange2(synth, channel); checkPitchbend(synth, channel); } finally { synth.close(); } } private void checkNotes(Synthesizer synth, MidiChannel channel) { for (int i = 0; i < 127; i++) { channel.noteOn(i, i); } for (int i = 0; i < 127; i++) { channel.noteOff(i); } } private void checkNotes2(Synthesizer synth, MidiChannel channel) { for (int i = 0; i < 127; i++) { channel.noteOn(i, i); } for (int i = 0; i < 127; i++) { channel.noteOff(i, 0); } } private void checkPolyPressure(Synthesizer synth, MidiChannel channel) { for (int i = 0; i < 127; i++) { channel.setPolyPressure(i, i); int value = channel.getPolyPressure(i); assertTrue(constructErrorMessage(synth, "poly pressure[" + i + "]", true), i == value || value == 0); } } private void checkChannelPressure(Synthesizer synth, MidiChannel channel) { checkChannelPressure(synth, channel, 0); checkChannelPressure(synth, channel, 77); checkChannelPressure(synth, channel, 127); } private void checkChannelPressure(Synthesizer synth, MidiChannel channel, int nPressure) { channel.setChannelPressure(nPressure); int value = channel.getChannelPressure(); assertTrue(constructErrorMessage(synth, "channel pressure", true), nPressure == value || value == 0); } private void checkControlChange(Synthesizer synth, MidiChannel channel) { for (int i = 0; i < 127; i++) { channel.controlChange(i, i); int value = channel.getController(i); assertTrue(constructErrorMessage(synth, "control change[" + i + "]", true), i == value || value == 0); } } private void checkProgramChange(Synthesizer synth, MidiChannel channel) { for (int i = 0; i < 127; i++) { channel.programChange(i); int value = channel.getProgram(); assertEquals(constructErrorMessage(synth, "program change [" + i + "]", true), i, value); } } private void checkProgramChange2(Synthesizer synth, MidiChannel channel) { checkProgramChange2(synth, channel, 0, 0); checkProgramChange2(synth, channel, 12000, 102); checkProgramChange2(synth, channel, 16383, 127); } private void checkProgramChange2(Synthesizer synth, MidiChannel channel, int nBank, int nProgram) { channel.programChange(nBank, nProgram); int programValue = channel.getProgram(); int bankValue = channel.getController(0) * 128 + channel.getController(32); assertTrue(constructErrorMessage(synth, "program change [" + nBank + ", " + nProgram + "]: bank", true), nBank == bankValue || bankValue == 0); assertEquals(constructErrorMessage(synth, "program change [" + nBank + ", " + nProgram + "]: program", true), nProgram, programValue); } private void checkPitchbend(Synthesizer synth, MidiChannel channel) { checkPitchbend(synth, channel, 0); checkPitchbend(synth, channel, 127); checkPitchbend(synth, channel, 128); checkPitchbend(synth, channel, 8192); checkPitchbend(synth, channel, 16383); } private void checkPitchbend(Synthesizer synth, MidiChannel channel, int nBend) { channel.setPitchBend(nBend); int value = channel.getPitchBend(); assertTrue(constructErrorMessage(synth, "pitch bend [" + nBend + "]", true), nBend == value || value == 8192); } } /*** MidiChannelTestCase.java ***/ ././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootlibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/api/midi/synthesizer/WrongSoundbankTestCase.javalibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/api/midi/synthesizer/WrongSoundba0000644000175000017500000001042310376653642033637 0ustar twernertwerner/* * WrongSoundbankTestCase.java */ /* * Copyright (c) 2006 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ package org.tritonus.test.api.midi.synthesizer; import javax.sound.midi.Patch; import javax.sound.midi.SoundbankResource; import javax.sound.midi.Synthesizer; import javax.sound.midi.Soundbank; import javax.sound.midi.Instrument; /** Test for javax.sound.midi.Synthesizer.getLatency(). */ public class WrongSoundbankTestCase extends BaseSynthesizerTestCase { public WrongSoundbankTestCase(String strName) { super(strName); } protected void checkSynthesizer(Synthesizer synth) throws Exception { WrongSoundbank sb = new WrongSoundbank(); Instrument instr = sb.new WrongInstrument(); Patch[] patchlist = new Patch[1]; patchlist[0] = new Patch(0, 0); synth.open(); boolean bOpen = true; try { assertTrue(constructErrorMessage(synth, "isSoundbankSupported() result wrong", true), ! synth.isSoundbankSupported(sb)); try { synth.loadInstrument(instr); fail(constructErrorMessage(synth, "loadInstrument()", bOpen)); } catch (IllegalArgumentException e) { // We expect this exception. } try { synth.unloadInstrument(instr); fail(constructErrorMessage(synth, "unloadInstrument()", bOpen)); } catch (IllegalArgumentException e) { // We expect this exception. } try { synth.remapInstrument(instr, instr); fail(constructErrorMessage(synth, "remapInstrument()", bOpen)); } catch (IllegalArgumentException e) { // We expect this exception. } try { synth.loadAllInstruments(sb); fail(constructErrorMessage(synth, "loadAllInstruments()", bOpen)); } catch (IllegalArgumentException e) { // We expect this exception. } try { synth.unloadAllInstruments(sb); fail(constructErrorMessage(synth, "unloadAllInstruments()", bOpen)); } catch (IllegalArgumentException e) { // We expect this exception. } try { synth.loadInstruments(sb, patchlist); fail(constructErrorMessage(synth, "loadInstruments()", bOpen)); } catch (IllegalArgumentException e) { // We expect this exception. } try { synth.unloadInstruments(sb, patchlist); fail(constructErrorMessage(synth, "unloadInstruments()", bOpen)); } catch (IllegalArgumentException e) { // We expect this exception. } } finally { synth.close(); } } protected static String constructErrorMessage(Synthesizer synth, String strMethodName, boolean bOpen) { String strMessage = ": " + "IllegalArgumentException not thrown"; strMessage += " on " + strMethodName; return BaseSynthesizerTestCase.constructErrorMessage(synth, strMessage, bOpen); } private class WrongSoundbank implements Soundbank { public class WrongInstrument extends Instrument { public WrongInstrument() { super(WrongSoundbank.this, null, null, null); } public Object getData() { return null; } } public String getDescription() { return null; } public Instrument getInstrument(Patch patch) { return new WrongInstrument(); } public Instrument[] getInstruments() { Instrument[] instruments = new Instrument[1]; instruments[0] = new WrongInstrument(); return instruments; } public String getName() { return null; } public SoundbankResource[] getResources() { return null; } public String getVendor() { return null; } public String getVersion() { return null; } } } /*** WrongSoundbankTestCase.java ***/ libtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/api/sampled/0000755000175000017500000000000010621573054027407 5ustar twernertwernerlibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/api/sampled/line/0000755000175000017500000000000010621573053030335 5ustar twernertwerner././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootlibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/api/sampled/line/DataLineInfoTestCase.javalibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/api/sampled/line/DataLineInfoTest0000644000175000017500000000451310374203233033413 0ustar twernertwerner/* * DataLineInfoTestCase.java */ /* * Copyright (c) 2001 - 2002 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ package org.tritonus.test.api.sampled.line; import junit.framework.TestCase; import javax.sound.sampled.AudioFormat; import javax.sound.sampled.DataLine; import javax.sound.sampled.Line; import javax.sound.sampled.SourceDataLine; public class DataLineInfoTestCase extends TestCase { public DataLineInfoTestCase(String strName) { super(strName); } public void testConstructors() { DataLine.Info info; info = new DataLine.Info(String.class, new AudioFormat[0], 123, 456); checkInfo(info, String.class, 0, 123, 456); } private void checkInfo(DataLine.Info info, Class expectedLineClass, int nExpectedFormatsArrayLength, int nExpectedMinBufferSize, int nExpectedMaxBufferSize) { assertEquals("lineClass", expectedLineClass, info.getLineClass()); assertEquals("AudioFormat array length", nExpectedFormatsArrayLength, info.getFormats().length); assertEquals("min buffer size", nExpectedMinBufferSize, info.getMinBufferSize()); assertEquals("max buffer size", nExpectedMaxBufferSize, info.getMaxBufferSize()); } public void testMatches() { DataLine.Info info1 = new DataLine.Info(SourceDataLine.class, null); Line.Info info2 = new Line.Info(SourceDataLine.class); assertTrue("DataLine.Info against Line.Info", ! info1.matches(info2)); assertTrue("Line.Info against DataLine.Info", info2.matches(info1)); } public void testToString() { } } /*** DataLineInfoTestCase.java ***/ libtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/api/sampled/misc/0000755000175000017500000000000010621573054030342 5ustar twernertwerner././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootlibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/api/sampled/misc/AudioFileFormatTestCase.javalibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/api/sampled/misc/AudioFileFormatT0000644000175000017500000000665110374203233033425 0ustar twernertwerner/* * AudioFileFormatTestCase.java */ /* * Copyright (c) 2003 - 2004 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ package org.tritonus.test.api.sampled.misc; import junit.framework.TestCase; import java.util.HashMap; import java.util.Map; import javax.sound.sampled.AudioFileFormat; /* import javax.sound.sampled.AudioFormat; import javax.sound.sampled.AudioSystem; */ public class AudioFileFormatTestCase extends TestCase { public AudioFileFormatTestCase(String strName) { super(strName); } public void testNoMap() { AudioFileFormat fileFormat = new AudioFileFormat(null, null, 0); Map propReturn = fileFormat.properties(); assertNotNull(propReturn); assertTrue(propReturn.isEmpty()); Object result = propReturn.get("bitrate"); assertNull(result); } public void testNullMap() { AudioFileFormat fileFormat = new AudioFileFormat(null, null, 0, null); Map propReturn = fileFormat.properties(); assertTrue(propReturn.isEmpty()); Object result = propReturn.get("bitrate"); assertNull(result); } public void testEmptyMap() { Map prop = new HashMap(); AudioFileFormat fileFormat = new AudioFileFormat(null, null, 0, prop); Map propReturn = fileFormat.properties(); assertTrue(propReturn.isEmpty()); Object result = propReturn.get("bitrate"); assertNull(result); } public void testCopying() { Map prop = new HashMap(); prop.put("bitrate", new Float(22.5F)); AudioFileFormat fileFormat = new AudioFileFormat(null, null, 0, prop); Map propReturn = fileFormat.properties(); assertTrue(prop != propReturn); prop.put("bitrate", new Float(42.5F)); Object result = propReturn.get("bitrate"); assertEquals(new Float(22.5F), result); } public void testUnmodifiable() { Map prop = new HashMap(); AudioFileFormat fileFormat = new AudioFileFormat(null, null, 0, prop); Map propReturn = fileFormat.properties(); try { propReturn.put("author", "Matthias Pfisterer"); fail("returned Map allows modifications"); } catch (UnsupportedOperationException e) { } } public void testGet() { Map prop = new HashMap(); prop.put("bitrate", new Float(22.5F)); prop.put("author", "Matthias Pfisterer"); AudioFileFormat fileFormat = new AudioFileFormat(null, null, 0, prop); Map propReturn = fileFormat.properties(); assertEquals(new Float(22.5F), propReturn.get("bitrate")); assertEquals("Matthias Pfisterer", propReturn.get("author")); } } /*** AudioFileFormatTestCase.java ***/ ././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootlibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/api/sampled/misc/AudioFormatTestCase.javalibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/api/sampled/misc/AudioFormatTestC0000644000175000017500000000647610010125633033443 0ustar twernertwerner/* * AudioFormatTestCase.java */ /* * Copyright (c) 2003 - 2004 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ package org.tritonus.test.api.sampled.misc; import junit.framework.TestCase; import java.util.HashMap; import java.util.Map; import javax.sound.sampled.AudioFormat; public class AudioFormatTestCase extends TestCase { public AudioFormatTestCase(String strName) { super(strName); } public void testNoMap() { AudioFormat fileFormat = new AudioFormat( null, 0.0F, 0, 0, 0, 0.0F, false); Map propReturn = fileFormat.properties(); assertNotNull(propReturn); assertTrue(propReturn.isEmpty()); Object result = propReturn.get("bitrate"); assertNull(result); } public void testNullMap() { AudioFormat fileFormat = new AudioFormat( null, 0.0F, 0, 0, 0, 0.0F, false, null); Map propReturn = fileFormat.properties(); assertTrue(propReturn.isEmpty()); Object result = propReturn.get("bitrate"); assertNull(result); } public void testEmptyMap() { Map prop = new HashMap(); AudioFormat format = new AudioFormat( null, 0.0F, 0, 0, 0, 0.0F, false, prop); Map propReturn = format.properties(); assertTrue(propReturn.isEmpty()); Object result = propReturn.get("bitrate"); assertNull(result); } public void testCopying() { Map prop = new HashMap(); prop.put("bitrate", new Float(22.5F)); AudioFormat format = new AudioFormat( null, 0.0F, 0, 0, 0, 0.0F, false, prop); Map propReturn = format.properties(); assertTrue(prop != propReturn); prop.put("bitrate", new Float(42.5F)); Object result = propReturn.get("bitrate"); assertEquals(new Float(22.5F), result); } public void testUnmodifiable() { Map prop = new HashMap(); AudioFormat format = new AudioFormat( null, 0.0F, 0, 0, 0, 0.0F, false, prop); Map propReturn = format.properties(); try { propReturn.put("author", "Matthias Pfisterer"); fail("returned Map allows modifications"); } catch (UnsupportedOperationException e) { } } public void testGet() { Map prop = new HashMap(); prop.put("bitrate", new Float(22.5F)); prop.put("author", "Matthias Pfisterer"); AudioFormat format = new AudioFormat( null, 0.0F, 0, 0, 0, 0.0F, false, prop); Map propReturn = format.properties(); assertEquals(new Float(22.5F), propReturn.get("bitrate")); assertEquals("Matthias Pfisterer", propReturn.get("author")); } } /*** AudioFormatTestCase.java ***/ ././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootlibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/api/sampled/misc/EncodingTestCase.javalibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/api/sampled/misc/EncodingTestCase0000644000175000017500000000601710007765020033445 0ustar twernertwerner/* * EncodingTestCase.java */ /* * Copyright (c) 2003 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ package org.tritonus.test.api.sampled.misc; import junit.framework.TestCase; import javax.sound.sampled.AudioFormat.Encoding; public class EncodingTestCase extends TestCase { public EncodingTestCase(String strName) { super(strName); } public void testEquals() { assertTrue("equals(null)", ! Encoding.ALAW.equals(null)); assertTrue("equals() for same Encoding", Encoding.ALAW.equals(Encoding.ALAW)); assertTrue("equals() for different Encodings", ! Encoding.ALAW.equals(Encoding.ULAW)); String strEncodingName = "my fancy encoding"; String strOtherEncodingName = "my other fancy encoding"; Encoding encoding1 = new Encoding(strEncodingName); Encoding encoding2 = new Encoding(strEncodingName); Encoding encoding3 = new Encoding(strOtherEncodingName); assertTrue("equals() for equal custom encodings", encoding1.equals(encoding2)); assertTrue("equals() for equal custom encodings", encoding2.equals(encoding1)); assertTrue("equals() for different custom encodings", ! encoding1.equals(encoding3)); assertTrue("equals() for different custom encodings", ! encoding3.equals(encoding1)); } public void testHashCode() { assertEquals("hashCode() for multiple invocations", Encoding.ALAW.hashCode(), Encoding.ALAW.hashCode()); String strEncodingName1 = "my fancy encoding"; String strEncodingName2 = "my fancy encoding"; Encoding encoding1 = new Encoding(strEncodingName1); Encoding encoding2 = new Encoding(strEncodingName2); assertEquals("hashCode() for same custom Encoding", encoding1.hashCode(), encoding2.hashCode()); } public void testToString() { String strEncodingName = "my fancy encoding"; Encoding encoding = new Encoding(strEncodingName); assertEquals("toString()", strEncodingName, encoding.toString()); } public void testStaticInstances() { assertEquals("PCM_SIGNED.toString()", "PCM_SIGNED", Encoding.PCM_SIGNED.toString()); assertEquals("PCM_UNSIGNED.toString()", "PCM_UNSIGNED", Encoding.PCM_UNSIGNED.toString()); assertEquals("ALAW.toString()", "ALAW", Encoding.ALAW.toString()); assertEquals("ULAW.toString()", "ULAW", Encoding.ULAW.toString()); } } /*** EncodingTestCase.java ***/ ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootlibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/api/sampled/misc/TypeTestCase.javalibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/api/sampled/misc/TypeTestCase.jav0000644000175000017500000000571110374203233033417 0ustar twernertwerner/* * TypeTestCase.java */ /* * Copyright (c) 2004 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ package org.tritonus.test.api.sampled.misc; import junit.framework.TestCase; //import javax.sound.sampled.AudioFileFormat.Type; public class TypeTestCase extends TestCase { public TypeTestCase(String strName) { super(strName); } // public void testEquals() // { // assertTrue("equals(null)", ! Type.ALAW.equals(null)); // assertTrue("equals() for same Type", // Type.ALAW.equals(Type.ALAW)); // assertTrue("equals() for different Types", // ! Type.ALAW.equals(Type.ULAW)); // String strTypeName = "my fancy encoding"; // String strOtherTypeName = "my other fancy encoding"; // Type encoding1 = new Type(strTypeName); // Type encoding2 = new Type(strTypeName); // Type encoding3 = new Type(strOtherTypeName); // assertTrue("equals() for equal custom encodings", // encoding1.equals(encoding2)); // assertTrue("equals() for equal custom encodings", // encoding2.equals(encoding1)); // assertTrue("equals() for different custom encodings", // ! encoding1.equals(encoding3)); // assertTrue("equals() for different custom encodings", // ! encoding3.equals(encoding1)); // } // public void testHashCode() // { // assertEquals("hashCode() for multiple invocations", // Type.ALAW.hashCode(), Type.ALAW.hashCode()); // String strTypeName = "my fancy encoding"; // Type encoding1 = new Type(strTypeName); // Type encoding2 = new Type(strTypeName); // assertEquals("hashCode() for same custom Type", // encoding1.hashCode(), encoding2.hashCode()); // } // public void testToString() // { // String strTypeName = "my fancy encoding"; // Type encoding = new Type(strTypeName); // assertEquals("toString()", strTypeName, encoding.toString()); // } // public void testStaticInstances() // { // assertEquals("PCM_SIGNED.toString()", "PCM_SIGNED", // Type.PCM_SIGNED.toString()); // assertEquals("PCM_UNSIGNED.toString()", "PCM_UNSIGNED", // Type.PCM_UNSIGNED.toString()); // assertEquals("ALAW.toString()", "ALAW", // Type.ALAW.toString()); // assertEquals("ULAW.toString()", "ULAW", // Type.ULAW.toString()); // } } /*** TypeTestCase.java ***/ libtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/api/sampled/mixer/0000755000175000017500000000000010621573054030533 5ustar twernertwerner././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootlibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/api/sampled/mixer/BaseMixerTestCase.javalibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/api/sampled/mixer/BaseMixerTestCa0000644000175000017500000000343510374203233033440 0ustar twernertwerner/* * BaseMixerTestCase.java */ /* * Copyright (c) 2003 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ package org.tritonus.test.api.sampled.mixer; import javax.sound.sampled.Mixer; import javax.sound.sampled.AudioSystem; import junit.framework.TestCase; /** Base class for tests of javax.sound.sampled.Mixer. */ public abstract class BaseMixerTestCase extends TestCase { protected BaseMixerTestCase(String strName) { super(strName); } /** Iterate over all available Mixers. */ protected void checkMixer(Check check) throws Exception { Mixer.Info[] infos = AudioSystem.getMixerInfo(); for (int i = 0; i < infos.length; i++) { Mixer mixer = AudioSystem.getMixer(infos[i]); System.out.println("testing mixer: " + mixer); check.check(mixer); } } /** Get the prefix for error messages (containing the sequencer's name). */ protected static String getMessagePrefix(Mixer mixer) { return mixer.getMixerInfo().getName(); } protected interface Check { public void check(Mixer mixer) throws Exception; } } /*** BaseMixerTestCase.java ***/ ././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootlibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/api/sampled/mixer/MixerTestCase.javalibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/api/sampled/mixer/MixerTestCase.j0000644000175000017500000000404510374203233033423 0ustar twernertwerner/* * MixerTestCase.java */ /* * Copyright (c) 2004 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ package org.tritonus.test.api.sampled.mixer; import javax.sound.sampled.Mixer; //import javax.sound.sampled.DataLine; //import javax.sound.sampled.Line; /** Class for tests of javax.sound.sampled.Mixer. */ public class MixerTestCase extends BaseMixerTestCase { public MixerTestCase(String strName) { super(strName); } public void testGetMixerInfo() throws Exception { Check check = new Check() { public void check(Mixer mixer) throws Exception { Mixer.Info info = mixer.getMixerInfo(); assertNotNull("getMixerInfo()", info); assertNotNull("MixerInfo.getName()", info.getName()); assertNotNull("MixerInfo.getVendor()", info.getVendor()); assertNotNull("MixerInfo.getDescription()", info.getDescription()); assertNotNull("MixerInfo.getVersion()", info.getVersion()); } }; checkMixer(check); } public void testOpenClose() throws Exception { Check check = new Check() { public void check(Mixer mixer) throws Exception { assertTrue("closed", ! mixer.isOpen()); mixer.open(); assertTrue("open", mixer.isOpen()); mixer.close(); assertTrue("closed", ! mixer.isOpen()); } }; checkMixer(check); } } /*** MixerTestCase.java ***/ ././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootlibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/Aiff12bitAudioFileReaderTestCase.javalibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/Aiff12bitAudioFileReaderTestCase.0000644000175000017500000000221007731242665033266 0ustar twernertwerner/* * Aiff12bitAudioFileReaderTestCase.java */ /* * Copyright (c) 2001 - 2002 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ package org.tritonus.test; public class Aiff12bitAudioFileReaderTestCase extends BaseAudioFileReaderTestCase { public Aiff12bitAudioFileReaderTestCase(String strName) { super(strName); setResourcePrefix("aiff12bit"); } } /*** AiffAudioFileReaderTestCase.java ***/ libtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/AiffAudioFileReaderTestCase.java0000644000175000017500000000216407677753637033315 0ustar twernertwerner/* * AiffAudioFileReaderTestCase.java */ /* * Copyright (c) 2001 - 2002 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ package org.tritonus.test; public class AiffAudioFileReaderTestCase extends BaseAudioFileReaderTestCase { public AiffAudioFileReaderTestCase(String strName) { super(strName); setResourcePrefix("aiff"); } } /*** AiffAudioFileReaderTestCase.java ***/ ././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootlibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/AlawFormatConversionProviderTestCase.javalibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/AlawFormatConversionProviderTestC0000644000175000017500000000224107702477534033730 0ustar twernertwerner/* * AlawFormatConversionProviderTestCase.java */ /* * Copyright (c) 2001 - 2002 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ package org.tritonus.test; public class AlawFormatConversionProviderTestCase extends BaseFormatConversionProviderTestCase { public AlawFormatConversionProviderTestCase(String strName) { super(strName); setResourcePrefix("alaw"); } } /*** AlawFormatConversionProviderTestCase.java ***/ libtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/AuAudioFileReaderTestCase.java0000644000175000017500000000215207677753637033012 0ustar twernertwerner/* * AuAudioFileReaderTestCase.java */ /* * Copyright (c) 2001 - 2002 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ package org.tritonus.test; public class AuAudioFileReaderTestCase extends BaseAudioFileReaderTestCase { public AuAudioFileReaderTestCase(String strName) { super(strName); setResourcePrefix("au"); } } /*** AuAudioFileReaderTestCase.java ***/ ././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootlibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/AuZeroDataLengthAudioFileReaderTestCase.javalibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/AuZeroDataLengthAudioFileReaderTe0000644000175000017500000000226307677753637033526 0ustar twernertwerner/* * AuZeroDataLengthAudioFileReaderTestCase.java */ /* * Copyright (c) 2001 - 2002 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ package org.tritonus.test; public class AuZeroDataLengthAudioFileReaderTestCase extends BaseAudioFileReaderTestCase { public AuZeroDataLengthAudioFileReaderTestCase(String strName) { super(strName); setResourcePrefix("au_zero_data_length"); } } /*** AuZeroDataLengthAudioFileReaderTestCase.java ***/ libtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/AudioInputStreamTestCase.java0000644000175000017500000000643310374203233032745 0ustar twernertwerner/* * AudioInputStreamTestCase.java */ /* * Copyright (c) 2003 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ package org.tritonus.test; import java.io.ByteArrayInputStream; import java.io.InputStream; import javax.sound.sampled.AudioFormat; import javax.sound.sampled.AudioInputStream; import javax.sound.sampled.AudioSystem; import junit.framework.TestCase; public class AudioInputStreamTestCase extends TestCase { public AudioInputStreamTestCase(String strName) { super(strName); } public void testConstructorNullPointers() { @SuppressWarnings("unused") AudioInputStream ais = null; InputStream is = new ByteArrayInputStream(new byte[0]); AudioFormat format = new AudioFormat(44100.0F, 16, 2, true, false); try { ais = new AudioInputStream(null, format, AudioSystem.NOT_SPECIFIED); fail("no NullpointerException thrown for null InputStream"); } catch (NullPointerException e) { } try { ais = new AudioInputStream(is, null, AudioSystem.NOT_SPECIFIED); fail("no NullpointerException thrown for null AudioFormat"); } catch (NullPointerException e) { } } // public void testLength() // { // Map prop = new HashMap(); // prop.put("bitrate", new Float(22.5F)); // AudioInputStream format = new AudioInputStream(AudioFormat.Encoding.PCM_SIGNED, // 44100.0F, 16, 2, 4, 44100.0F, // true, prop); // Map propReturn = format.properties(); // assertTrue(prop != propReturn); // prop.put("bitrate", new Float(42.5F)); // Object result = propReturn.get("bitrate"); // assertEquals(new Float(22.5F), result); // } // public void testUnmodifiable() // { // Map prop = new HashMap(); // AudioInputStream format = new AudioInputStream(AudioFormat.Encoding.PCM_SIGNED, // 44100.0F, 16, 2, 4, 44100.0F, // true, prop); // Map propReturn = format.properties(); // try // { // propReturn.put("author", "Matthias Pfisterer"); // fail("returned Map allows modifications"); // } // catch (UnsupportedOperationException e) // { // } // } // public void testGet() // { // Map prop = new HashMap(); // prop.put("bitrate", new Float(22.5F)); // prop.put("author", "Matthias Pfisterer"); // AudioInputStream format = new AudioInputStream(AudioFormat.Encoding.PCM_SIGNED, // 44100.0F, 16, 2, 4, 44100.0F, // true, prop); // Map propReturn = format.properties(); // assertEquals(new Float(22.5F), propReturn.get("bitrate")); // assertEquals("Matthias Pfisterer", propReturn.get("author")); // } } /*** AudioInputStreamTestCase.java ***/ libtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/BaseAudioFileReaderTestCase.java0000644000175000017500000002605007731242614033275 0ustar twernertwerner/* * BaseAudioFileReaderTestCase.java */ /* * Copyright (c) 2001 - 2002 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ package org.tritonus.test; import java.io.BufferedInputStream; import java.io.File; import java.io.FileInputStream; import java.io.InputStream; import java.net.URL; import javax.sound.sampled.AudioFileFormat; import javax.sound.sampled.AudioFormat; import javax.sound.sampled.AudioInputStream; import javax.sound.sampled.AudioSystem; import javax.sound.sampled.spi.AudioFileReader; import org.tritonus.share.sampled.AudioFileTypes; import org.tritonus.share.sampled.Encodings; public class BaseAudioFileReaderTestCase extends BaseProviderTestCase { private static final boolean DEBUG = true; private static final String RESOURCE_BASENAME = "audiofilereader"; private static final String PROVIDER_PREFIX = "(Provider:) "; private static final String AUDIOSYSTEM_PREFIX = "(AudioSystem:) "; private boolean m_bCheckRealLengths; public BaseAudioFileReaderTestCase(String strName) { super(strName, RESOURCE_BASENAME); setCheckRealLengths(true); } protected void setCheckRealLengths(boolean bCheckRealLengths) { m_bCheckRealLengths = bCheckRealLengths; } private boolean getCheckRealLengths() { return m_bCheckRealLengths; } protected AudioFileReader getAudioFileReader() { return (AudioFileReader) getProvider(); } public void testAudioFileFormatFile() throws Exception { File file = new File(getFilename()); AudioFileFormat audioFileFormat = null; if (getTestProvider()) { audioFileFormat = getAudioFileReader().getAudioFileFormat(file); checkAudioFileFormat(audioFileFormat, true, true); } if (getTestAudioSystem()) { audioFileFormat = AudioSystem.getAudioFileFormat(file); checkAudioFileFormat(audioFileFormat, true, false); } } public void testAudioFileFormatURL() throws Exception { URL url = new URL("file:" + getFilename()); AudioFileFormat audioFileFormat = null; if (getTestProvider()) { audioFileFormat = getAudioFileReader().getAudioFileFormat(url); checkAudioFileFormat(audioFileFormat, false, true); } if (getTestAudioSystem()) { audioFileFormat = AudioSystem.getAudioFileFormat(url); checkAudioFileFormat(audioFileFormat, false, false); } } public void testAudioFileFormatInputStream() throws Exception { InputStream inputStream = new FileInputStream(getFilename()); BufferedInputStream bufferedInputStream = new BufferedInputStream(inputStream); AudioFileFormat audioFileFormat = null; if (getTestProvider()) { audioFileFormat = getAudioFileReader().getAudioFileFormat(bufferedInputStream); checkAudioFileFormat(audioFileFormat, false, true); } inputStream = new FileInputStream(getFilename()); bufferedInputStream = new BufferedInputStream(inputStream); if (getTestAudioSystem()) { audioFileFormat = AudioSystem.getAudioFileFormat(bufferedInputStream); checkAudioFileFormat(audioFileFormat, false, false); } } public void testAudioInputStreamFile() throws Exception { File file = new File(getFilename()); AudioInputStream audioInputStream = null; if (getTestProvider()) { audioInputStream = getAudioFileReader().getAudioInputStream(file); checkAudioInputStream(audioInputStream, true, true); } if (getTestAudioSystem()) { audioInputStream = AudioSystem.getAudioInputStream(file); checkAudioInputStream(audioInputStream, true, false); } } public void testAudioInputStreamURL() throws Exception { URL url = new URL("file:" + getFilename()); AudioInputStream audioInputStream = null; if (getTestProvider()) { audioInputStream = getAudioFileReader().getAudioInputStream(url); checkAudioInputStream(audioInputStream, false, true); } if (getTestAudioSystem()) { audioInputStream = AudioSystem.getAudioInputStream(url); checkAudioInputStream(audioInputStream, false, false); } } public void testAudioInputStreamInputStream() throws Exception { InputStream inputStream = new FileInputStream(getFilename()); BufferedInputStream bufferedInputStream = new BufferedInputStream(inputStream); AudioInputStream audioInputStream = null; if (getTestProvider()) { audioInputStream = getAudioFileReader().getAudioInputStream(bufferedInputStream); checkAudioInputStream(audioInputStream, false, true); } inputStream = new FileInputStream(getFilename()); bufferedInputStream = new BufferedInputStream(inputStream); if (getTestAudioSystem()) { audioInputStream = AudioSystem.getAudioInputStream(bufferedInputStream); checkAudioInputStream(audioInputStream, false, false); } } private void checkAudioFileFormat(AudioFileFormat audioFileFormat, boolean bRealLengthExpected, boolean bProviderDirect) throws Exception { if (bProviderDirect) { checkAudioFileFormat(audioFileFormat, bRealLengthExpected, PROVIDER_PREFIX); } else { checkAudioFileFormat(audioFileFormat, bRealLengthExpected, AUDIOSYSTEM_PREFIX); } } private void checkAudioFileFormat(AudioFileFormat audioFileFormat, boolean bRealLengthExpected, String strMessagePrefix) throws Exception { assertEquals(strMessagePrefix + "type", getType(), audioFileFormat.getType()); checkAudioFormat(audioFileFormat.getFormat(), strMessagePrefix); long lExpectedByteLength = AudioSystem.NOT_SPECIFIED; long lExpectedFrameLength = AudioSystem.NOT_SPECIFIED; if (getCheckRealLengths() || bRealLengthExpected) { lExpectedByteLength = getByteLength(); lExpectedFrameLength = getFrameLength(); } assertEquals(strMessagePrefix + "byte length", lExpectedByteLength, audioFileFormat.getByteLength()); assertEquals(strMessagePrefix + "frame length", lExpectedFrameLength, audioFileFormat.getFrameLength()); } private void checkAudioInputStream(AudioInputStream audioInputStream, boolean bRealLengthExpected, boolean bProviderDirect) throws Exception { if (bProviderDirect) { checkAudioInputStream(audioInputStream, bRealLengthExpected, PROVIDER_PREFIX); } else { checkAudioInputStream(audioInputStream, bRealLengthExpected, AUDIOSYSTEM_PREFIX); } } private void checkAudioInputStream(AudioInputStream audioInputStream, boolean bRealLengthExpected, String strMessagePrefix) throws Exception { checkAudioFormat(audioInputStream.getFormat(), strMessagePrefix); long lExpectedFrameLength = AudioSystem.NOT_SPECIFIED; if (getCheckRealLengths() || bRealLengthExpected) { lExpectedFrameLength = getFrameLength(); } assertEquals(strMessagePrefix + "frame length", lExpectedFrameLength, audioInputStream.getFrameLength()); if (getCheckRealLengths() || bRealLengthExpected) { int nExpectedDataLength = (int) (lExpectedFrameLength * getFrameSize()); byte[] abRetrievedData = new byte[nExpectedDataLength]; int nRead = audioInputStream.read(abRetrievedData); assertEquals(strMessagePrefix + "reading data", nExpectedDataLength, nRead); // for (int i = 0; i < nExpectedDataLength; i++) // { // assertEquals(strMessagePrefix + "data content", 0, abRetrievedData[i]); // } } else { // TODO: try to at least read some bytes? } } private void checkAudioFormat(AudioFormat audioFormat, String strMessagePrefix) throws Exception { assertEquals(strMessagePrefix + "encoding", getEncoding(), audioFormat.getEncoding()); assertEquals(strMessagePrefix + "sample rate", getSampleRate(), audioFormat.getSampleRate(), DELTA); assertEquals(strMessagePrefix + "sample size (bits)", getSampleSizeInBits(), audioFormat.getSampleSizeInBits()); assertEquals(strMessagePrefix + "channels", getChannels(), audioFormat.getChannels()); assertEquals(strMessagePrefix + "frame size", getFrameSize(), audioFormat.getFrameSize()); assertEquals(strMessagePrefix + "frame rate", getFrameRate(), audioFormat.getFrameRate(), DELTA); assertEquals(strMessagePrefix + "big endian", getBigEndian(), audioFormat.isBigEndian()); } private String getFilename() { String strFileName = getResourceString(getResourcePrefix() + ".filename"); return strFileName; } private AudioFileFormat.Type getType() { String strTypeName = getResourceString(getResourcePrefix() + ".type"); AudioFileFormat.Type type = AudioFileTypes.getType(strTypeName); return type; } private long getByteLength() { String strByteLength = getResourceString(getResourcePrefix() + ".byteLength"); long lByteLength = Long.parseLong(strByteLength); return lByteLength; } private AudioFormat.Encoding getEncoding() { String strEncodingName = getResourceString(getResourcePrefix() + ".format.encoding"); AudioFormat.Encoding encoding = Encodings.getEncoding(strEncodingName); return encoding; } private float getSampleRate() { String strSampleRate = getResourceString(getResourcePrefix() + ".format.sampleRate"); float fSampleRate = Float.parseFloat(strSampleRate); return fSampleRate; } private int getSampleSizeInBits() { String strSampleSizeInBits = getResourceString(getResourcePrefix() + ".format.sampleSizeInBits"); int nSampleSizeInBits = Integer.parseInt(strSampleSizeInBits); return nSampleSizeInBits; } private int getChannels() { String strChannels = getResourceString(getResourcePrefix() + ".format.channels"); int nChannels = Integer.parseInt(strChannels); return nChannels; } private int getFrameSize() { String strFrameSize = getResourceString(getResourcePrefix() + ".format.frameSize"); int nFrameSize = Integer.parseInt(strFrameSize); return nFrameSize; } private float getFrameRate() { String strFrameRate = getResourceString(getResourcePrefix() + ".format.frameRate"); float fFrameRate = Float.parseFloat(strFrameRate); return fFrameRate; } private boolean getBigEndian() { String strBigEndian = getResourceString(getResourcePrefix() + ".format.bigEndian"); boolean bBigEndian = strBigEndian.equals("true"); return bBigEndian; } private long getFrameLength() { String strFrameLength = getResourceString(getResourcePrefix() + ".frameLength"); long lFrameLength = Long.parseLong(strFrameLength); return lFrameLength; } } /*** BaseAudioFileReaderTestCase.java ***/ ././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootlibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/BaseFormatConversionProviderTestCase.javalibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/BaseFormatConversionProviderTestC0000644000175000017500000002373510374203233033707 0ustar twernertwerner/* * BaseAudioFileReaderTestCase.java */ /* * Copyright (c) 2001 - 2003 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ package org.tritonus.test; import java.util.ArrayList; import java.util.Arrays; import java.util.Iterator; import java.util.List; import java.util.StringTokenizer; import javax.sound.sampled.AudioFormat; import javax.sound.sampled.AudioInputStream; import javax.sound.sampled.AudioSystem; import javax.sound.sampled.spi.FormatConversionProvider; import org.tritonus.share.sampled.Encodings; public class BaseFormatConversionProviderTestCase extends BaseProviderTestCase { private static final AudioFormat.Encoding[] EMPTY_ENCODING_ARRAY = new AudioFormat.Encoding[0]; private static final AudioFormat.Encoding[] ALL_ENCODINGS = new AudioFormat.Encoding[] { AudioFormat.Encoding.PCM_SIGNED, AudioFormat.Encoding.PCM_UNSIGNED, AudioFormat.Encoding.ULAW, AudioFormat.Encoding.ALAW, Encodings.getEncoding("GSM0610"), Encodings.getEncoding("MPEG1L1"), Encodings.getEncoding("MPEG1L2"), Encodings.getEncoding("MPEG1L3"), Encodings.getEncoding("MPEG2L1"), Encodings.getEncoding("MPEG2L2"), Encodings.getEncoding("MPEG2L3"), Encodings.getEncoding("MPEG2DOT5L1"), Encodings.getEncoding("MPEG2DOT5L2"), Encodings.getEncoding("MPEG2DOT5L3"), Encodings.getEncoding("VORBIS"), Encodings.getEncoding("IMA_ADPCM"), }; private static final boolean DEBUG = true; private static final String RESOURCE_BASENAME = "formatconversionprovider"; public BaseFormatConversionProviderTestCase(String strName) { super(strName, RESOURCE_BASENAME); } protected FormatConversionProvider getFormatConversionProvider() { return (FormatConversionProvider) getProvider(); } public void testGetSourceEncodings() { AudioFormat.Encoding[] aEncodings = null; if (getTestProvider()) { aEncodings = getFormatConversionProvider().getSourceEncodings(); checkEncodings(aEncodings, true); } } public void testGetTargetEncodings() { AudioFormat.Encoding[] aEncodings = null; if (getTestProvider()) { aEncodings = getFormatConversionProvider().getTargetEncodings(); checkEncodings(aEncodings, false); } } private void checkEncodings(AudioFormat.Encoding[] aEncodings, boolean bSource) { AudioFormat.Encoding[] aExpectedEncodings = getEncodings(bSource); Iterator iter; List encodings = Arrays.asList(aEncodings); List expectedEncodings = Arrays.asList(aExpectedEncodings); iter = encodings.iterator(); while (iter.hasNext()) { Object encoding = iter.next(); assertTrue("returned encoding in expected encodings", expectedEncodings.contains(encoding)); } iter = expectedEncodings.iterator(); while (iter.hasNext()) { Object encoding = iter.next(); assertTrue("expected encoding in returned encodings", encodings.contains(encoding)); } } public void testIsSourceEncodingsSupported() { implTestIsEncodingSupported(true); } public void testIsTargetEncodingsSupported() { implTestIsEncodingSupported(false); } private void implTestIsEncodingSupported(boolean bSource) { if (getTestProvider()) { AudioFormat.Encoding[] aExpectedEncodings = getEncodings(bSource); for (int i = 0; i < aExpectedEncodings.length; i++) { boolean bSupported; if (bSource) { bSupported = getFormatConversionProvider().isSourceEncodingSupported(aExpectedEncodings[i]); } else { bSupported = getFormatConversionProvider().isTargetEncodingSupported(aExpectedEncodings[i]); } assertTrue("expected encoding supported", bSupported); } AudioFormat.Encoding[] aUnexpectedEncodings = getUnexpectedEncodings(bSource); for (int i = 0; i < aUnexpectedEncodings.length; i++) { boolean bSupported; if (bSource) { bSupported = getFormatConversionProvider().isSourceEncodingSupported(aUnexpectedEncodings[i]); } else { bSupported = getFormatConversionProvider().isTargetEncodingSupported(aUnexpectedEncodings[i]); } assertTrue("unexpected encoding supported", ! bSupported); } } } private void checkAudioInputStream(AudioInputStream audioInputStream, boolean bRealLengthExpected) throws Exception { checkAudioFormat(audioInputStream.getFormat()); long lExpectedFrameLength = AudioSystem.NOT_SPECIFIED; if (/*getCheckRealLengths() ||*/ bRealLengthExpected) { lExpectedFrameLength = getFrameLength(); } assertEquals("frame length", lExpectedFrameLength, audioInputStream.getFrameLength()); if (/*getCheckRealLengths() ||*/ bRealLengthExpected) { int nExpectedDataLength = (int) (lExpectedFrameLength * getFrameSize()); byte[] abRetrievedData = new byte[nExpectedDataLength]; int nRead = audioInputStream.read(abRetrievedData); assertEquals("reading data", nExpectedDataLength, nRead); // for (int i = 0; i < nExpectedDataLength; i++) // { // assertEquals("data content", 0, abRetrievedData[i]); // } } else { // TODO: try to at least read some bytes? } } private void checkAudioFormat(AudioFormat audioFormat) throws Exception { assertEquals("encoding", getEncoding(), audioFormat.getEncoding()); assertEquals("sample rate", getSampleRate(), audioFormat.getSampleRate(), DELTA); assertEquals("sample size (bits)", getSampleSizeInBits(), audioFormat.getSampleSizeInBits()); assertEquals("channels", getChannels(), audioFormat.getChannels()); assertEquals("frame size", getFrameSize(), audioFormat.getFrameSize()); assertEquals("frame rate", getFrameRate(), audioFormat.getFrameRate(), DELTA); assertEquals("big endian", getBigEndian(), audioFormat.isBigEndian()); } private String getFilename() { String strFileName = getResourceString(getResourcePrefix() + ".filename"); return strFileName; } private long getByteLength() { String strByteLength = getResourceString(getResourcePrefix() + ".byteLength"); long lByteLength = Long.parseLong(strByteLength); return lByteLength; } private AudioFormat.Encoding getEncoding() { String strEncodingName = getResourceString(getResourcePrefix() + ".format.encoding"); AudioFormat.Encoding encoding = Encodings.getEncoding(strEncodingName); return encoding; } private float getSampleRate() { String strSampleRate = getResourceString(getResourcePrefix() + ".format.sampleRate"); float fSampleRate = Float.parseFloat(strSampleRate); return fSampleRate; } private int getSampleSizeInBits() { String strSampleSizeInBits = getResourceString(getResourcePrefix() + ".format.sampleSizeInBits"); int nSampleSizeInBits = Integer.parseInt(strSampleSizeInBits); return nSampleSizeInBits; } private int getChannels() { String strChannels = getResourceString(getResourcePrefix() + ".format.channels"); int nChannels = Integer.parseInt(strChannels); return nChannels; } private int getFrameSize() { String strFrameSize = getResourceString(getResourcePrefix() + ".format.frameSize"); int nFrameSize = Integer.parseInt(strFrameSize); return nFrameSize; } private float getFrameRate() { String strFrameRate = getResourceString(getResourcePrefix() + ".format.frameRate"); float fFrameRate = Float.parseFloat(strFrameRate); return fFrameRate; } private boolean getBigEndian() { String strBigEndian = getResourceString(getResourcePrefix() + ".format.bigEndian"); boolean bBigEndian = strBigEndian.equals("true"); return bBigEndian; } private long getFrameLength() { String strFrameLength = getResourceString(getResourcePrefix() + ".frameLength"); long lFrameLength = Long.parseLong(strFrameLength); return lFrameLength; } private AudioFormat.Encoding[] getEncodings(boolean bSource) { if (bSource) { return getEncodings("sourceEncodings"); } else { return getEncodings("targetEncodings"); } } private AudioFormat.Encoding[] getUnexpectedEncodings(boolean bSource) { AudioFormat.Encoding[] aExpectedEncodings; if (bSource) { aExpectedEncodings = getEncodings("sourceEncodings"); } else { aExpectedEncodings = getEncodings("targetEncodings"); } List expectedEncodings = Arrays.asList(aExpectedEncodings); AudioFormat.Encoding[] aAllEncodings = ALL_ENCODINGS; AudioFormat.Encoding[] aUnexpectedEncodings = new AudioFormat.Encoding[aAllEncodings.length - aExpectedEncodings.length]; int nIndex = 0; for (int i = 0; i < aAllEncodings.length; i++) { if (! expectedEncodings.contains(aAllEncodings[i])) { aUnexpectedEncodings[nIndex] = aAllEncodings[i]; nIndex++; } } return aUnexpectedEncodings; } private AudioFormat.Encoding[] getEncodings(String strKey) { String strEncodings = getResourceString(getResourcePrefix() + "." + strKey); List encodingsList = new ArrayList(); StringTokenizer tokenizer = new StringTokenizer(strEncodings); while (tokenizer.hasMoreTokens()) { String strEncodingName = tokenizer.nextToken(); AudioFormat.Encoding encoding = Encodings.getEncoding(strEncodingName); encodingsList.add(encoding); } return (AudioFormat.Encoding[]) encodingsList.toArray(EMPTY_ENCODING_ARRAY); } } /*** BaseFormatConversionProviderTestCase.java ***/ libtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/BaseProviderTestCase.java0000644000175000017500000001711310374203233032072 0ustar twernertwerner/* * BaseProviderTestCase.java */ /* * Copyright (c) 2001 - 2002 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ package org.tritonus.test; import java.util.MissingResourceException; import java.util.ResourceBundle; import javax.sound.sampled.AudioFileFormat; import javax.sound.sampled.AudioFormat; import junit.framework.TestCase; import org.tritonus.share.sampled.AudioFileTypes; import org.tritonus.share.sampled.Encodings; public class BaseProviderTestCase extends TestCase { private static final boolean DEBUG = true; /** Precision for float comparisons. */ protected static final float DELTA = 0.1F; private ResourceBundle m_resourceBundle; private String m_strResourcePrefix; private Object m_provider; private boolean m_bCheckRealLengths; public BaseProviderTestCase(String strName, String strResourceBasename) { super(strName); m_resourceBundle = loadResourceBundle(strResourceBasename); } protected void setResourcePrefix(String strResourcePrefix) { m_strResourcePrefix = strResourcePrefix; } protected String getResourcePrefix() { return m_strResourcePrefix; } protected void setUp() throws Exception { if (getTestProvider()) { String strClassName = getClassName(); Class cls = Class.forName(strClassName); m_provider = cls.newInstance(); } } protected Object getProvider() { return m_provider; } protected boolean getTestProvider() { return true; } protected boolean getTestAudioSystem() { return true; } // private void checkAudioFileFormat(AudioFileFormat audioFileFormat, boolean bRealLengthExpected) // throws Exception // { // assertEquals("type", // getType(), // audioFileFormat.getType()); // checkAudioFormat(audioFileFormat.getFormat()); // long lExpectedByteLength = AudioSystem.NOT_SPECIFIED; // long lExpectedFrameLength = AudioSystem.NOT_SPECIFIED; // if (getCheckRealLengths() || bRealLengthExpected) // { // lExpectedByteLength = getByteLength(); // lExpectedFrameLength = getFrameLength(); // } // assertEquals("byte length", // lExpectedByteLength, // audioFileFormat.getByteLength()); // assertEquals("frame length", // lExpectedFrameLength, // audioFileFormat.getFrameLength()); // } // private void checkAudioInputStream(AudioInputStream audioInputStream, boolean bRealLengthExpected) // throws Exception // { // checkAudioFormat(audioInputStream.getFormat()); // long lExpectedFrameLength = AudioSystem.NOT_SPECIFIED; // if (getCheckRealLengths() || bRealLengthExpected) // { // lExpectedFrameLength = getFrameLength(); // } // assertEquals("frame length", // lExpectedFrameLength, // audioInputStream.getFrameLength()); // if (getCheckRealLengths() || bRealLengthExpected) // { // int nExpectedDataLength = (int) (lExpectedFrameLength * getFrameSize()); // byte[] abRetrievedData = new byte[nExpectedDataLength]; // int nRead = audioInputStream.read(abRetrievedData); // assertEquals("reading data", // nExpectedDataLength, // nRead); // // for (int i = 0; i < nExpectedDataLength; i++) // // { // // assertEquals("data content", 0, abRetrievedData[i]); // // } // } // else // { // // TODO: try to at least read some bytes? // } // } private void checkAudioFormat(AudioFormat audioFormat) throws Exception { assertEquals("encoding", getEncoding(), audioFormat.getEncoding()); assertEquals("sample rate", getSampleRate(), audioFormat.getSampleRate(), DELTA); assertEquals("sample size (bits)", getSampleSizeInBits(), audioFormat.getSampleSizeInBits()); assertEquals("channels", getChannels(), audioFormat.getChannels()); assertEquals("frame size", getFrameSize(), audioFormat.getFrameSize()); assertEquals("frame rate", getFrameRate(), audioFormat.getFrameRate(), DELTA); assertEquals("big endian", getBigEndian(), audioFormat.isBigEndian()); } private ResourceBundle loadResourceBundle(String sResourceBasename) { ResourceBundle resourceBundle = null; try { resourceBundle = ResourceBundle.getBundle(sResourceBasename); } catch (MissingResourceException e) { e.printStackTrace(); /* System.err.println("ActionManager.loadResourceBundle(): cannot find property file!"); System.exit(1); */ } return resourceBundle; } protected String getResourceString(String strKey) { return m_resourceBundle.getString(strKey); } private String getClassName() { String strClassName = getResourceString(getResourcePrefix() + ".class"); return strClassName; } private String getFilename() { String strFileName = getResourceString(getResourcePrefix() + ".filename"); return strFileName; } private AudioFileFormat.Type getType() { String strTypeName = getResourceString(getResourcePrefix() + ".type"); AudioFileFormat.Type type = AudioFileTypes.getType(strTypeName); return type; } private long getByteLength() { String strByteLength = getResourceString(getResourcePrefix() + ".byteLength"); long lByteLength = Long.parseLong(strByteLength); return lByteLength; } private AudioFormat.Encoding getEncoding() { String strEncodingName = getResourceString(getResourcePrefix() + ".format.encoding"); AudioFormat.Encoding encoding = Encodings.getEncoding(strEncodingName); return encoding; } private float getSampleRate() { String strSampleRate = getResourceString(getResourcePrefix() + ".format.sampleRate"); float fSampleRate = Float.parseFloat(strSampleRate); return fSampleRate; } private int getSampleSizeInBits() { String strSampleSizeInBits = getResourceString(getResourcePrefix() + ".format.sampleSizeInBits"); int nSampleSizeInBits = Integer.parseInt(strSampleSizeInBits); return nSampleSizeInBits; } private int getChannels() { String strChannels = getResourceString(getResourcePrefix() + ".format.channels"); int nChannels = Integer.parseInt(strChannels); return nChannels; } private int getFrameSize() { String strFrameSize = getResourceString(getResourcePrefix() + ".format.frameSize"); int nFrameSize = Integer.parseInt(strFrameSize); return nFrameSize; } private float getFrameRate() { String strFrameRate = getResourceString(getResourcePrefix() + ".format.frameRate"); float fFrameRate = Float.parseFloat(strFrameRate); return fFrameRate; } private boolean getBigEndian() { String strBigEndian = getResourceString(getResourcePrefix() + ".format.bigEndian"); boolean bBigEndian = strBigEndian.equals("true"); return bBigEndian; } private long getFrameLength() { String strFrameLength = getResourceString(getResourcePrefix() + ".frameLength"); long lFrameLength = Long.parseLong(strFrameLength); return lFrameLength; } } /*** BaseProviderTestCase.java ***/ libtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/ControlTestCase.java0000644000175000017500000000473607677621466031164 0ustar twernertwerner/* * ControlTestCase.java */ /* * Copyright (c) 2002 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ package org.tritonus.test; import junit.framework.TestCase; import javax.sound.sampled.Control; import javax.sound.sampled.BooleanControl; /** Tests for class javax.sound.sampled.Control. */ public class ControlTestCase extends TestCase { public ControlTestCase(String strName) { super(strName); } /** Checks getType(). The test checks if the object returned by getType() is the one passed to the constructor. */ public void testGetTypeObject() throws Exception { Control.Type type = BooleanControl.Type.MUTE; Control control = new TestControl(type); Control.Type returnedType = control.getType(); assertEquals("type object", type, returnedType); } /** Checks getType(). The test checks if the object returned by getType() is null, as is passed to the constructor. */ public void testGetTypeNull() throws Exception { Control.Type type = null; Control control = new TestControl(type); Control.Type returnedType = control.getType(); assertEquals("type object (null)", type, returnedType); } /** Checks toString(). The test checks if the string returned by toString() contains characters (and doesn't throw an exception). */ public void testToString() throws Exception { Control.Type type = BooleanControl.Type.MUTE; Control control = new TestControl(type); String strReturnedString = control.toString(); assertTrue("toString() result", strReturnedString.length() > 0); } /** Inner class used to get around protected constructor. */ private class TestControl extends Control { public TestControl(Control.Type type) { super(type); } } } /*** ControlTestCase.java ***/ libtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/ControlTypeTestCase.java0000644000175000017500000000606710374203233031775 0ustar twernertwerner/* * ControlTypeTestCase.java */ /* * Copyright (c) 2002 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ package org.tritonus.test; import junit.framework.TestCase; import javax.sound.sampled.Control; // import javax.sound.sampled.BooleanControl; /** Tests for class javax.sound.sampled.Control. */ public class ControlTypeTestCase extends TestCase { public ControlTypeTestCase(String strName) { super(strName); } /** Checks the constructor(). The test checks if the constructor does not throw an exception. */ public void testConstructor() throws Exception { String strTypeName = "TeSt"; @SuppressWarnings("unused") Control.Type type = new TestControlType(strTypeName); } /** Checks equals(). The test checks if an object is considered equal to itself. */ public void testEqualsSelfIdentity() throws Exception { String strTypeName = "TeSt"; Control.Type type = new TestControlType(strTypeName); assertTrue("self-identity", type.equals(type)); } /** Checks equals(). The test checks if two objects are considered unequal, even if they have the same type string. */ public void testEqualsSelfUnequality() throws Exception { String strTypeName = "TeSt"; Control.Type type0 = new TestControlType(strTypeName); Control.Type type1 = new TestControlType(strTypeName); assertTrue("unequality", ! type0.equals(type1)); } /** Checks hashCode(). The test checks if two calls to hashCode() on the same object return the same value. */ public void testHashCode() throws Exception { String strTypeName = "TeSt"; Control.Type type = new TestControlType(strTypeName); assertTrue("hash code", type.hashCode() == type.hashCode()); } /** Checks toString(). The test checks if the string returned by toString() equals the one passed in the constructor (and doesn't throw an exception). */ public void testToString() throws Exception { String strTypeName = "TeSt"; Control.Type type = new TestControlType(strTypeName); String strReturnedTypeName = type.toString(); assertEquals("toString() result", strTypeName, strReturnedTypeName); } /** Inner class used to get around protected constructor. */ private class TestControlType extends Control.Type { public TestControlType(String strName) { super(strName); } } } /*** ControlTypeTestCase.java ***/ libtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/EncodingsTestCase.java0000644000175000017500000000260407702605066031430 0ustar twernertwerner/* * EncodingsTestCase.java */ /* * Copyright (c) 2001 - 2002 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ package org.tritonus.test; import junit.framework.TestCase; import javax.sound.sampled.AudioFormat; import org.tritonus.share.sampled.Encodings; /** Tests for class org.tritonus.share.sampled.Encodings. */ public class EncodingsTestCase extends TestCase { public EncodingsTestCase(String strName) { super(strName); } public void testGetEncodings() { AudioFormat.Encoding[] aEncodings = Encodings.getEncodings(); assertTrue(aEncodings != null); assertTrue(aEncodings.length > 0); } } /*** EncodingsTestCase.java ***/ libtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/GSMAudioFileReaderTestCase.java0000644000175000017500000000221507677753637033073 0ustar twernertwerner/* * GSMAudioFileReaderTestCase.java */ /* * Copyright (c) 2001 - 2002 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ package org.tritonus.test; public class GSMAudioFileReaderTestCase extends BaseAudioFileReaderTestCase { public GSMAudioFileReaderTestCase(String strName) { super(strName); setResourcePrefix("gsm"); setCheckRealLengths(false); } } /*** GSMAudioFileReaderTestCase.java ***/ ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootlibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/GSMFormatConversionProviderTestCase.javalibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/GSMFormatConversionProviderTestCa0000644000175000017500000000223407702477534033635 0ustar twernertwerner/* * GSMFormatConversionProviderTestCase.java */ /* * Copyright (c) 2001 - 2002 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ package org.tritonus.test; public class GSMFormatConversionProviderTestCase extends BaseFormatConversionProviderTestCase { public GSMFormatConversionProviderTestCase(String strName) { super(strName); setResourcePrefix("gsm"); } } /*** GSMFormatConversionProviderTestCase.java ***/ ././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootlibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/ImaAdpcmFormatConversionProviderTestCase.javalibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/ImaAdpcmFormatConversionProviderT0000644000175000017500000000226507703056675033706 0ustar twernertwerner/* * ImaAdpcmFormatConversionProviderTestCase.java */ /* * Copyright (c) 2001 - 2002 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ package org.tritonus.test; public class ImaAdpcmFormatConversionProviderTestCase extends BaseFormatConversionProviderTestCase { public ImaAdpcmFormatConversionProviderTestCase(String strName) { super(strName); setResourcePrefix("imaadpcm"); } } /*** ImaAdpcmFormatConversionProviderTestCase.java ***/ ././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootlibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/JorbisFormatConversionProviderTestCase.javalibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/JorbisFormatConversionProviderTes0000644000175000017500000000225307702477534034010 0ustar twernertwerner/* * JorbisFormatConversionProviderTestCase.java */ /* * Copyright (c) 2001 - 2002 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ package org.tritonus.test; public class JorbisFormatConversionProviderTestCase extends BaseFormatConversionProviderTestCase { public JorbisFormatConversionProviderTestCase(String strName) { super(strName); setResourcePrefix("jorbis"); } } /*** JorbisFormatConversionProviderTestCase.java ***/ libtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/Mp3AudioFileReaderTestCase.java0000644000175000017500000000221507677753637033104 0ustar twernertwerner/* * Mp3AudioFileReaderTestCase.java */ /* * Copyright (c) 2001 - 2002 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ package org.tritonus.test; public class Mp3AudioFileReaderTestCase extends BaseAudioFileReaderTestCase { public Mp3AudioFileReaderTestCase(String strName) { super(strName); setResourcePrefix("mp3"); setCheckRealLengths(false); } } /*** Mp3AudioFileReaderTestCase.java ***/ ././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootlibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/PCM2PCMConversionProviderTestCase.javalibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/PCM2PCMConversionProviderTestCase0000644000175000017500000000223007702477534033423 0ustar twernertwerner/* * PCM2PCMConversionProviderTestCase.java */ /* * Copyright (c) 2001 - 2002 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ package org.tritonus.test; public class PCM2PCMConversionProviderTestCase extends BaseFormatConversionProviderTestCase { public PCM2PCMConversionProviderTestCase(String strName) { super(strName); setResourcePrefix("pcm2pcm"); } } /*** PCM2PCMConversionProviderTestCase.java ***/ ././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootlibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/SampleRateConversionProviderTestCase.javalibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/SampleRateConversionProviderTestC0000644000175000017500000000224707702477534033736 0ustar twernertwerner/* * SampleRateConversionProviderTestCase.java */ /* * Copyright (c) 2001 - 2002 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ package org.tritonus.test; public class SampleRateConversionProviderTestCase extends BaseFormatConversionProviderTestCase { public SampleRateConversionProviderTestCase(String strName) { super(strName); setResourcePrefix("samplerate"); } } /*** SampleRateConversionProviderTestCase.java ***/ libtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/TAudioFileFormatTestCase.java0000644000175000017500000000601310374203233032640 0ustar twernertwerner/* * TAudioFileFormatTestCase.java */ /* * Copyright (c) 2003 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ package org.tritonus.test; import junit.framework.TestCase; import java.util.HashMap; import java.util.Map; import org.tritonus.share.sampled.file.TAudioFileFormat; import javax.sound.sampled.AudioSystem; public class TAudioFileFormatTestCase extends TestCase { public TAudioFileFormatTestCase(String strName) { super(strName); } public void testEmptyMap() { Map prop = new HashMap(); TAudioFileFormat fileFormat = new TAudioFileFormat( null, null, AudioSystem.NOT_SPECIFIED, AudioSystem.NOT_SPECIFIED, prop); Map propReturn = fileFormat.properties(); assertTrue(propReturn.isEmpty()); Object result = propReturn.get("bitrate"); assertNull(result); } public void testCopying() { Map prop = new HashMap(); prop.put("bitrate", new Float(22.5F)); TAudioFileFormat fileFormat = new TAudioFileFormat( null, null, AudioSystem.NOT_SPECIFIED, AudioSystem.NOT_SPECIFIED, prop); Map propReturn = fileFormat.properties(); assertTrue(prop != propReturn); prop.put("bitrate", new Float(42.5F)); Object result = propReturn.get("bitrate"); assertEquals(new Float(22.5F), result); } public void testUnmodifiable() { Map prop = new HashMap(); TAudioFileFormat fileFormat = new TAudioFileFormat( null, null, AudioSystem.NOT_SPECIFIED, AudioSystem.NOT_SPECIFIED, prop); Map propReturn = fileFormat.properties(); try { propReturn.put("author", "Matthias Pfisterer"); fail("returned Map allows modifications"); } catch (UnsupportedOperationException e) { } } public void testGet() { Map prop = new HashMap(); prop.put("bitrate", new Float(22.5F)); prop.put("author", "Matthias Pfisterer"); TAudioFileFormat fileFormat = new TAudioFileFormat( null, null, AudioSystem.NOT_SPECIFIED, AudioSystem.NOT_SPECIFIED, prop); Map propReturn = fileFormat.properties(); assertEquals(new Float(22.5F), propReturn.get("bitrate")); assertEquals("Matthias Pfisterer", propReturn.get("author")); } } /*** TAudioFileFormatTestCase.java ***/ libtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/TAudioFormatTestCase.java0000644000175000017500000000577210010144064032044 0ustar twernertwerner/* * TAudioFormatTestCase.java */ /* * Copyright (c) 2003 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ package org.tritonus.test; import junit.framework.TestCase; import java.util.HashMap; import java.util.Map; import org.tritonus.share.sampled.TAudioFormat; import javax.sound.sampled.AudioFormat; public class TAudioFormatTestCase extends TestCase { public TAudioFormatTestCase(String strName) { super(strName); } public void testEmptyMap() { Map prop = new HashMap(); TAudioFormat format = new TAudioFormat(AudioFormat.Encoding.PCM_SIGNED, 44100.0F, 16, 2, 4, 44100.0F, true, prop); Map propReturn = format.properties(); assertTrue(propReturn.isEmpty()); Object result = propReturn.get("bitrate"); assertNull(result); } public void testCopying() { Map prop = new HashMap(); prop.put("bitrate", new Float(22.5F)); TAudioFormat format = new TAudioFormat(AudioFormat.Encoding.PCM_SIGNED, 44100.0F, 16, 2, 4, 44100.0F, true, prop); Map propReturn = format.properties(); assertTrue(prop != propReturn); prop.put("bitrate", new Float(42.5F)); Object result = propReturn.get("bitrate"); assertEquals(new Float(22.5F), result); } public void testUnmodifiable() { Map prop = new HashMap(); TAudioFormat format = new TAudioFormat(AudioFormat.Encoding.PCM_SIGNED, 44100.0F, 16, 2, 4, 44100.0F, true, prop); Map propReturn = format.properties(); try { propReturn.put("author", "Matthias Pfisterer"); fail("returned Map allows modifications"); } catch (UnsupportedOperationException e) { } } public void testGet() { Map prop = new HashMap(); prop.put("bitrate", new Float(22.5F)); prop.put("author", "Matthias Pfisterer"); TAudioFormat format = new TAudioFormat(AudioFormat.Encoding.PCM_SIGNED, 44100.0F, 16, 2, 4, 44100.0F, true, prop); Map propReturn = format.properties(); assertEquals(new Float(22.5F), propReturn.get("bitrate")); assertEquals("Matthias Pfisterer", propReturn.get("author")); } } /*** TAudioFormatTestCase.java ***/ libtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/TAudioInputStreamTestCase.java0000644000175000017500000000556310374203233033074 0ustar twernertwerner/* * TAudioInputStreamTestCase.java */ /* * Copyright (c) 2003 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ package org.tritonus.test; import junit.framework.TestCase; import java.util.HashMap; import java.util.Map; import org.tritonus.share.sampled.convert.TAudioInputStream; import javax.sound.sampled.AudioSystem; public class TAudioInputStreamTestCase extends TestCase { public TAudioInputStreamTestCase(String strName) { super(strName); } public void testEmptyMap() { Map prop = new HashMap(); TAudioInputStream fileFormat = new TAudioInputStream( null, null, AudioSystem.NOT_SPECIFIED, prop); Map propReturn = fileFormat.properties(); assertTrue(propReturn.isEmpty()); Object result = propReturn.get("bitrate"); assertNull(result); } public void testCopying() { Map prop = new HashMap(); prop.put("bitrate", new Float(22.5F)); TAudioInputStream fileFormat = new TAudioInputStream( null, null, AudioSystem.NOT_SPECIFIED, prop); Map propReturn = fileFormat.properties(); assertTrue(prop != propReturn); prop.put("bitrate", new Float(42.5F)); Object result = propReturn.get("bitrate"); assertEquals(new Float(22.5F), result); } public void testUnmodifiable() { Map prop = new HashMap(); TAudioInputStream fileFormat = new TAudioInputStream( null, null, AudioSystem.NOT_SPECIFIED, prop); Map propReturn = fileFormat.properties(); try { propReturn.put("author", "Matthias Pfisterer"); fail("returned Map allows modifications"); } catch (UnsupportedOperationException e) { } } public void testGet() { Map prop = new HashMap(); prop.put("bitrate", new Float(22.5F)); prop.put("author", "Matthias Pfisterer"); TAudioInputStream fileFormat = new TAudioInputStream( null, null, AudioSystem.NOT_SPECIFIED, prop); Map propReturn = fileFormat.properties(); assertEquals(new Float(22.5F), propReturn.get("bitrate")); assertEquals("Matthias Pfisterer", propReturn.get("author")); } } /*** TAudioInputStreamTestCase.java ***/ libtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/TCircularBufferTestCase.java0000644000175000017500000001362407677746357032571 0ustar twernertwerner/* * TCircularBufferTestCase.java */ /* * Copyright (c) 2001 - 2002 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ package org.tritonus.test; import junit.framework.TestCase; import org.tritonus.share.TCircularBuffer; public class TCircularBufferTestCase extends TestCase { public TCircularBufferTestCase(String strName) { super(strName); } public void testBufferSize() { int nSize = 45678; TCircularBuffer buffer = new TCircularBuffer( nSize, false, false, null); assertEquals("buffer size", nSize, buffer.availableWrite()); nSize = 0; buffer = new TCircularBuffer( nSize, false, false, null); assertEquals("buffer size", nSize, buffer.availableWrite()); } public void testAvailable() { int nBufferSize = 45678; int nWriteSize1 = nBufferSize / 2; int nWriteSize2 = nBufferSize / 5; int nReadSize1 = nBufferSize / 10; int nReadSize2 = nBufferSize / 3; TCircularBuffer buffer = new TCircularBuffer( nBufferSize, true, true, null); assertEquals("availableWrite()", nBufferSize, buffer.availableWrite()); assertEquals("availableRead()", 0, buffer.availableRead()); buffer.write(new byte[nBufferSize]); assertEquals("availableWrite()", 0, buffer.availableWrite()); assertEquals("availableRead()", nBufferSize, buffer.availableRead()); buffer.read(new byte[nBufferSize]); assertEquals("availableWrite()", nBufferSize, buffer.availableWrite()); assertEquals("availableRead()", 0, buffer.availableRead()); buffer.write(new byte[nWriteSize1]); assertEquals("availableWrite()", nBufferSize - nWriteSize1, buffer.availableWrite()); assertEquals("availableRead()", nWriteSize1, buffer.availableRead()); buffer.write(new byte[nWriteSize2]); assertEquals("availableWrite()", nBufferSize - nWriteSize1 - nWriteSize2, buffer.availableWrite()); assertEquals("availableRead()", nWriteSize1 + nWriteSize2, buffer.availableRead()); buffer.read(new byte[nReadSize1]); assertEquals("availableWrite()", nBufferSize - nWriteSize1 - nWriteSize2 + nReadSize1, buffer.availableWrite()); assertEquals("availableRead()", nWriteSize1 + nWriteSize2 - nReadSize1, buffer.availableRead()); buffer.read(new byte[nReadSize2]); assertEquals("availableWrite()", nBufferSize - nWriteSize1 - nWriteSize2 + nReadSize1 + nReadSize2, buffer.availableWrite()); assertEquals("availableRead()", nWriteSize1 + nWriteSize2 - nReadSize1 - nReadSize2, buffer.availableRead()); } public void testReadWrite() { int nBufferSize = 8901 * 4; int nResult; byte[] abWriteArray = new byte[nBufferSize]; byte[] abReadArray = new byte[nBufferSize]; TCircularBuffer buffer = new TCircularBuffer( nBufferSize, true, true, null); for (int i = 0 ; i < abWriteArray.length; i++) { abWriteArray[i] = (byte)(i % 256); } nResult = buffer.write(abWriteArray); assertEquals("written length", abWriteArray.length, nResult); nResult = buffer.read(abReadArray); assertEquals("read length", abReadArray.length, nResult); assertTrue("data content", Util.compareByteArrays(abReadArray, 0, abWriteArray, 0, abReadArray.length)); buffer.write(new byte[nBufferSize / 3]); nResult = buffer.write(abWriteArray, nBufferSize / 4, nBufferSize / 2); assertEquals("written length", nBufferSize / 2, nResult); buffer.read(new byte[nBufferSize / 3]); nResult = buffer.read(abReadArray, 0, nBufferSize / 2); assertEquals("read length", nBufferSize / 2, nResult); assertTrue("data content", Util.compareByteArrays(abReadArray, 0, abWriteArray, nBufferSize / 4, nBufferSize / 2)); } public void testTrigger() { TestTrigger trigger = new TestTrigger(); int nBufferSize = 45678; TCircularBuffer buffer = new TCircularBuffer( nBufferSize, false, true, trigger); buffer.read(new byte[10]); assertTrue("trigger called", trigger.isCalled()); trigger.reset(); buffer.write(new byte[nBufferSize / 3]); buffer.read(new byte[nBufferSize / 2]); assertTrue("trigger called", trigger.isCalled()); } public void testClose() { int nResult; int nBufferSize = 45678; TestTrigger trigger = new TestTrigger(); TCircularBuffer buffer = new TCircularBuffer( nBufferSize, true, true, trigger); buffer.write(new byte[nBufferSize / 2]); assertEquals("availableWrite()", nBufferSize / 2, buffer.availableWrite()); assertEquals("availableRead()", nBufferSize / 2, buffer.availableRead()); buffer.close(); assertEquals("availableWrite()", nBufferSize / 2, buffer.availableWrite()); assertEquals("availableRead()", nBufferSize / 2, buffer.availableRead()); nResult = buffer.read(new byte[nBufferSize / 2]); assertEquals("read length", nBufferSize / 2, nResult); assertEquals("availableWrite()", nBufferSize, buffer.availableWrite()); assertEquals("availableRead()", 0, buffer.availableRead()); nResult = buffer.read(new byte[nBufferSize / 2]); assertEquals("read length", -1, nResult); assertTrue("trigger invocation", !trigger.isCalled()); } private static class TestTrigger implements TCircularBuffer.Trigger { private boolean m_bCalled = false; public void execute() { m_bCalled = true; } public boolean isCalled() { return m_bCalled; } public void reset() { m_bCalled = false; } } } /*** TCircularBufferTestCase.java ***/ ././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootlibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/UlawFormatConversionProviderTestCase.javalibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/UlawFormatConversionProviderTestC0000644000175000017500000000224107702477534033754 0ustar twernertwerner/* * UlawFormatConversionProviderTestCase.java */ /* * Copyright (c) 2001 - 2002 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ package org.tritonus.test; public class UlawFormatConversionProviderTestCase extends BaseFormatConversionProviderTestCase { public UlawFormatConversionProviderTestCase(String strName) { super(strName); setResourcePrefix("ulaw"); } } /*** UlawFormatConversionProviderTestCase.java ***/ libtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/Util.java0000644000175000017500000000401307753241276027001 0ustar twernertwerner/* * Util.java */ /* * Copyright (c) 2001 - 2002 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ package org.tritonus.test; import java.io.File; import java.io.FileInputStream; import java.io.IOException; public class Util { public static void dumpByteArray(byte[] ab) { for (int i = 0; i < ab.length; i++) { System.out.print(" " + ab[i]); } System.out.println(""); } // returns true if equal public static boolean compareByteArrays(byte[] ab1, int nOffset1, byte[] ab2, int nOffset2, int nLength) { for (int i = 0; i < nLength; i++) { if (ab1[i + nOffset1] != ab2[i + nOffset2]) { return false; } } return true; } public static byte[] getByteArrayFromFile(File file) throws IOException { long lLength = file.length(); byte[] abData = new byte[(int) lLength]; FileInputStream fis = new FileInputStream(file); int nBytesRemaining = (int) lLength; int nWriteStart = 0; while (nBytesRemaining > 0) { int nBytesRead = fis.read(abData, nWriteStart, nBytesRemaining); nBytesRemaining -= nBytesRead; nWriteStart += nBytesRead; } fis.close(); return abData; } public static void sleep(long milliseconds) { try { Thread.sleep(milliseconds); } catch (InterruptedException e) { } } } /*** Util.java ***/ ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootlibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/VorbisAudioFileReaderTestCase.javalibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/VorbisAudioFileReaderTestCase.jav0000644000175000017500000000223407677753637033551 0ustar twernertwerner/* * VorbisAudioFileReaderTestCase.java */ /* * Copyright (c) 2001 - 2002 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ package org.tritonus.test; public class VorbisAudioFileReaderTestCase extends BaseAudioFileReaderTestCase { public VorbisAudioFileReaderTestCase(String strName) { super(strName); setResourcePrefix("vorbis"); setCheckRealLengths(false); } } /*** VorbisAudioFileReaderTestCase.java ***/ ././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootlibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/VorbisFormatConversionProviderTestCase.javalibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/VorbisFormatConversionProviderTes0000644000175000017500000000225307700366234034014 0ustar twernertwerner/* * VorbisFormatConversionProviderTestCase.java */ /* * Copyright (c) 2001 - 2002 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ package org.tritonus.test; public class VorbisFormatConversionProviderTestCase extends BaseFormatConversionProviderTestCase { public VorbisFormatConversionProviderTestCase(String strName) { super(strName); setResourcePrefix("vorbis"); } } /*** VorbisFormatConversionProviderTestCase.java ***/ libtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/VorbisSilenceTestCase.java0000644000175000017500000001407007735406362032272 0ustar twernertwerner/* * VorbisSilenceTestCase.java */ /* * Copyright (c) 2003 by Dan Rollo * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ package org.tritonus.test; import java.io.File; import java.io.IOException; import junit.framework.TestCase; import org.tritonus.share.sampled.file.AudioOutputStream; import org.tritonus.share.sampled.AudioSystemShadow; import javax.sound.sampled.*; /** Tests conversion of Ogg files with long silence at the start of the file. * NOTE: These tests create a large (26mb) temporary audio file in the sounds dir * which is deleted after the test completes, but be sure you have sufficient disk space. */ public class VorbisSilenceTestCase extends TestCase { private File _sourceFileOgg = new File("sounds/testsilence.ogg"); private File _destFileWav = new File("sounds/testsilenceout.wav"); public VorbisSilenceTestCase(String strName) { super(strName); } protected void setUp() { assertTrue("Missing required test file: " + _sourceFileOgg.getAbsolutePath(), _sourceFileOgg.exists()); _destFileWav.deleteOnExit(); } protected void tearDown() { assertTrue("Deleted required test file: " + _sourceFileOgg.getAbsolutePath(), _sourceFileOgg.exists()); if (_destFileWav.exists()) { // remove converted file assertTrue("Couldn't delete file: " + _destFileWav.getAbsolutePath() + "; size: " + _destFileWav.length() + ". (0 size may mean file is locked by buffer loop.)", _destFileWav.delete()); } } public void testConvertSilentOggWithAudioOutStream() throws Exception { final AudioInputStream inAIStreamOgg = AudioSystem.getAudioInputStream(_sourceFileOgg); final AudioFormat destAudioFormatPCM = new AudioFormat(44100.0F, 16, 1, true, false); final AudioInputStream inAIStreamPCM = AudioSystem.getAudioInputStream(destAudioFormatPCM, inAIStreamOgg); final AudioOutputStream outAOStreamWavPCM = AudioSystemShadow.getAudioOutputStream( AudioFileFormat.Type.WAVE, destAudioFormatPCM, AudioSystem.NOT_SPECIFIED, _destFileWav); class StreamPump extends Thread { boolean isRunFinished; StreamPump() { super("SilenceTest-StreamPump"); } public void run() { // pump the streams int readCnt; final byte[] buf = new byte[65536]; int cnt = 0; try { while ((readCnt = inAIStreamPCM.read(buf, 0, buf.length)) != -1) { outAOStreamWavPCM.write(buf, 0, readCnt); cnt++; //System.out.println("readCnt: " + readCnt + " after write, loop cnt: " + cnt); } } catch (IOException e) { e.printStackTrace(); fail("Exception pumping streams: " + e.getMessage()); } isRunFinished = true; } }; StreamPump t = new StreamPump(); t.start(); // wait for conversion to finish, within reasonable time final int maxWait = 60; int waitCnt = 0; while (t.isAlive() && waitCnt++ < maxWait) { Thread.sleep(1000); } outAOStreamWavPCM.close(); inAIStreamPCM.close(); inAIStreamOgg.close(); assertTrue("Converted wav file is empty: " + _destFileWav.getAbsolutePath(), _destFileWav.length() > 0); assertTrue("Conversion never finished run() method", t.isRunFinished); assertTrue("Conversion timeout expired", waitCnt < maxWait); // attempt to read the resulting wav file final AudioInputStream aisDest = AudioSystem.getAudioInputStream(_destFileWav); // attempt to play the resulting wav file - 5 minutes of silence playStream(aisDest); } public void testConvertSilentOggWithAudioSystem() throws Exception { final AudioInputStream inAIStreamOgg = AudioSystem.getAudioInputStream(_sourceFileOgg); final AudioFormat destAudioFormatPCM = new AudioFormat(44100.0F, 16, 1, true, false); final AudioInputStream inAIStreamPCM = AudioSystem.getAudioInputStream(destAudioFormatPCM, inAIStreamOgg); AudioSystem.write(inAIStreamPCM, AudioFileFormat.Type.WAVE, _destFileWav); inAIStreamPCM.close(); inAIStreamOgg.close(); assertTrue("Converted wav file is empty: " + _destFileWav.getAbsolutePath(), _destFileWav.length() > 0); // attempt to read the resulting wav file final AudioInputStream aisDest = AudioSystem.getAudioInputStream(_destFileWav); // attempt to play the resulting wav file - 5 minutes of silence playStream(aisDest); } /** Play the given audio stream. Closes the stream when finised. * @param streamToPlay the audio stream to play * @throws LineUnavailableException if can't get line for stream's format * @throws IOException if problem occurs reading the stream */ private static void playStream(final AudioInputStream streamToPlay) throws LineUnavailableException, IOException { // @todo Comment this out to really play the file if (1==1) { streamToPlay.close(); // @todo Why is GC required to get AudioSytem to release these files??? // To see the error (under Win2K, jdk 1.3.1_02-b02), just comment out the gc below. System.gc(); return; } final SourceDataLine line = (SourceDataLine)AudioSystem.getLine( new DataLine.Info(SourceDataLine.class, streamToPlay.getFormat())); line.open(); line.start(); try { byte[] buf = new byte[1024]; int readCnt; while ((readCnt = streamToPlay.read(buf, 0, buf.length)) != -1) { line.write(buf, 0, readCnt); } } finally { // kludge to get last bit played try { Thread.sleep(1000); } catch(InterruptedException e) {} streamToPlay.close(); line.stop(); line.close(); } } } /*** VorbisSilenceTestCase.java ***/ libtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/VorbisTruncateTestCase.java0000644000175000017500000001321307757666244032506 0ustar twernertwerner/* * VorbisTruncateTestCase.java */ /* * Copyright (c) 2003 by Dan Rollo * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ package org.tritonus.test; import java.io.File; import java.io.IOException; import junit.framework.TestCase; import org.tritonus.share.sampled.file.AudioOutputStream; import org.tritonus.share.sampled.AudioSystemShadow; import javax.sound.sampled.*; /** Tests conversion of Ogg files with long silence at the start of the file. * NOTE: These tests create a large (26mb) temporary audio file in the sounds dir * which is deleted after the test completes, but be sure you have sufficient disk space. */ public class VorbisTruncateTestCase extends TestCase { private static final File _sourceFileOgg = new File("sounds/testtruncate.ogg"); private static final File _destFileWav = new File("sounds/testtruncate.wav"); public VorbisTruncateTestCase(String strName) { super(strName); } protected void setUp() { assertTrue("Missing required test file: " + _sourceFileOgg.getAbsolutePath(), _sourceFileOgg.exists()); _destFileWav.deleteOnExit(); } protected void tearDown() { assertTrue("Deleted required test file: " + _sourceFileOgg.getAbsolutePath(), _sourceFileOgg.exists()); if (_destFileWav.exists()) { // remove converted file assertTrue("Couldn't delete file: " + _destFileWav.getAbsolutePath() + "; size: " + _destFileWav.length() + ". (0 size may mean file is locked by buffer loop.)", _destFileWav.delete()); } } public void testConvertTruncateOggWithAudioOutStream() throws Exception { final AudioInputStream inAIStreamOgg = AudioSystem.getAudioInputStream(_sourceFileOgg); final AudioFormat destAudioFormatPCM = new AudioFormat(22050.0F, 16, 1, true, false); final AudioInputStream inAIStreamPCM = AudioSystem.getAudioInputStream(destAudioFormatPCM, inAIStreamOgg); final AudioOutputStream outAOStreamWavPCM = AudioSystemShadow.getAudioOutputStream( AudioFileFormat.Type.WAVE, destAudioFormatPCM, AudioSystem.NOT_SPECIFIED, _destFileWav); /** The total number of decoded bytes read */ long readCntPCMTotal = 0; // pump the streams int readCnt; final byte[] buf = new byte[4 * 1024]; try { while ((readCnt = inAIStreamPCM.read(buf, 0, buf.length)) != -1) { readCntPCMTotal += readCnt; outAOStreamWavPCM.write(buf, 0, readCnt); } // System.out.println("Total PCM read count: " + readCntPCMTotal); } catch (IOException e) { e.printStackTrace(); fail("Exception pumping streams: " + e.getMessage()); } outAOStreamWavPCM.close(); inAIStreamPCM.close(); inAIStreamOgg.close(); assertTrue("Converted wav file is empty: " + _destFileWav.getAbsolutePath(), _destFileWav.length() > 0); // attempt to play the resulting wav file - end of file shouldn't be truncated playStream(_destFileWav); assertEquals("Missing some PCM data from decoded Vorbis stream.", 369664, // total PCM bytes resulting when ogg data is NOT truncated readCntPCMTotal); } public void testConvertTruncateOggWithAudioSystem() throws Exception { final AudioInputStream inAIStreamOgg = AudioSystem.getAudioInputStream(_sourceFileOgg); final AudioFormat destAudioFormatPCM = new AudioFormat(22050.0F, 16, 1, true, false); final AudioInputStream inAIStreamPCM = AudioSystem.getAudioInputStream(destAudioFormatPCM, inAIStreamOgg); AudioSystem.write(inAIStreamPCM, AudioFileFormat.Type.WAVE, _destFileWav); inAIStreamPCM.close(); inAIStreamOgg.close(); assertTrue("Converted wav file is empty: " + _destFileWav.getAbsolutePath(), _destFileWav.length() > 0); // attempt to play the resulting wav file - end of file shouldn't be truncated playStream(_destFileWav); assertEquals("Missing some PCM data from decoded Vorbis stream.", 369708, // known file size Wave file built using native Windoze oggdec.exe _destFileWav.length()); } /** Play the given audio stream. Closes the stream when finised. * @param fileToPlay the audio file to play * @throws LineUnavailableException if can't get line for stream's format * @throws IOException if problem occurs reading the stream */ private static void playStream(final File fileToPlay) throws LineUnavailableException, IOException, UnsupportedAudioFileException { final AudioInputStream streamToPlay = AudioSystem.getAudioInputStream(fileToPlay); final SourceDataLine line = (SourceDataLine)AudioSystem.getLine( new DataLine.Info(SourceDataLine.class, streamToPlay.getFormat())); line.open(); line.start(); try { byte[] buf = new byte[1024]; int readCnt; while ((readCnt = streamToPlay.read(buf, 0, buf.length)) != -1) { line.write(buf, 0, readCnt); } } finally { line.drain(); streamToPlay.close(); line.stop(); line.close(); } } } /*** VorbisTruncateTestCase.java ***/ libtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/WaveAudioFileReaderTestCase.java0000644000175000017500000000216407677753637033352 0ustar twernertwerner/* * WaveAudioFileReaderTestCase.java */ /* * Copyright (c) 2001 - 2002 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ package org.tritonus.test; public class WaveAudioFileReaderTestCase extends BaseAudioFileReaderTestCase { public WaveAudioFileReaderTestCase(String strName) { super(strName); setResourcePrefix("wave"); } } /*** WaveAudioFileReaderTestCase.java ***/ libtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/sequencer/0000755000175000017500000000000010621573055027204 5ustar twernertwerner././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootlibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/sequencer/BaseSequencerTestCase.javalibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/sequencer/BaseSequencerTestCase.j0000644000175000017500000000404310374203233033532 0ustar twernertwerner/* * BaseSequencerTestCase.java */ /* * Copyright (c) 2003 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ package org.tritonus.test.sequencer; import javax.sound.midi.MidiDevice; import javax.sound.midi.MidiSystem; import javax.sound.midi.Sequencer; import junit.framework.TestCase; /** Base class for testsof javax.sound.midi.Sequencer. */ public abstract class BaseSequencerTestCase extends TestCase { private static final boolean IGNORE_SUN_SEQUENCER = true; protected BaseSequencerTestCase(String strName) { super(strName); } /** Iterate over all available Sequencers. */ public void testSeqencer() throws Exception { MidiDevice.Info[] infos = MidiSystem.getMidiDeviceInfo(); for (int i = 0; i < infos.length; i++) { MidiDevice device = MidiSystem.getMidiDevice(infos[i]); if (device instanceof Sequencer && ! (IGNORE_SUN_SEQUENCER && device.getDeviceInfo().getVendor().indexOf("Sun") != -1)) { System.out.println("testing seq: " + device); checkSequencer((Sequencer) device); } } } protected abstract void checkSequencer(Sequencer seq) throws Exception; /** Get the prefix for error messages (containing the sequencer's name). */ protected static String getMessagePrefix(Sequencer seq) { return seq.getDeviceInfo().getName(); } } /*** BaseSequencerTestCase.java ***/ ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootlibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/sequencer/IllegalStateTestCase.javalibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/sequencer/IllegalStateTestCase.ja0000644000175000017500000002306410374203233033524 0ustar twernertwerner/* * IllegalStateTestCase.java */ /* * Copyright (c) 2003 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ package org.tritonus.test.sequencer; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.InputStream; import javax.sound.midi.ControllerEventListener; import javax.sound.midi.MetaEventListener; import javax.sound.midi.MidiSystem; import javax.sound.midi.Sequence; import javax.sound.midi.Sequencer; import javax.sound.midi.ShortMessage; import javax.sound.midi.MetaMessage; /** Tests for class javax.sound.midi.MidiMessage. */ public class IllegalStateTestCase extends BaseSequencerTestCase { public IllegalStateTestCase(String strName) { super(strName); } protected void checkSequencer(Sequencer seq) throws Exception { // Sequencer is closed checkOpenRequired(seq, false); checkOpenNotRequired(seq, false); // sequencer open seq.open(); checkOpenRequired(seq, true); checkOpenNotRequired(seq, true); // clean up seq.close(); } private void checkOpenRequired(Sequencer seq, boolean bOpen) throws Exception { boolean bExpectingException = ! bOpen; checkMethod(seq, "start()", bExpectingException, bOpen); checkMethod(seq, "stop()", bExpectingException, bOpen); checkMethod(seq, "startRecording()", bExpectingException, bOpen); checkMethod(seq, "stopRecording()", bExpectingException, bOpen); } private void checkOpenNotRequired(Sequencer seq, boolean bOpen) throws Exception { boolean bExpectingException = false; checkMethod(seq, "setSequence(Sequence)", bExpectingException, bOpen); checkMethod(seq, "setSequence(InputStream)", bExpectingException, bOpen); checkMethod(seq, "getSequence()", bExpectingException, bOpen); checkMethod(seq, "isRunning()", bExpectingException, bOpen); checkMethod(seq, "isRecording()", bExpectingException, bOpen); checkMethod(seq, "recordEnable()", bExpectingException, bOpen); checkMethod(seq, "recordDisable()", bExpectingException, bOpen); checkMethod(seq, "getTempoInBPM()", bExpectingException, bOpen); checkMethod(seq, "setTempoInBPM()", bExpectingException, bOpen); checkMethod(seq, "getTempoInMPQ()", bExpectingException, bOpen); checkMethod(seq, "setTempoInMPQ()", bExpectingException, bOpen); checkMethod(seq, "setTempoFactor()", bExpectingException, bOpen); checkMethod(seq, "getTempoFactor()", bExpectingException, bOpen); checkMethod(seq, "getTickLength()", bExpectingException, bOpen); checkMethod(seq, "getTickPosition()", bExpectingException, bOpen); checkMethod(seq, "setTickPosition()", bExpectingException, bOpen); checkMethod(seq, "getMicrosecondLength()", bExpectingException, bOpen); checkMethod(seq, "getMicrosecondPosition()", bExpectingException, bOpen); checkMethod(seq, "setMicrosecondPosition()", bExpectingException, bOpen); checkMethod(seq, "setMasterSyncMode()", bExpectingException, bOpen); checkMethod(seq, "getMasterSyncMode()", bExpectingException, bOpen); checkMethod(seq, "getMasterSyncModes()", bExpectingException, bOpen); checkMethod(seq, "setSlaveSyncMode()", bExpectingException, bOpen); checkMethod(seq, "getSlaveSyncMode()", bExpectingException, bOpen); checkMethod(seq, "getSlaveSyncModes()", bExpectingException, bOpen); checkMethod(seq, "setTrackMute()", bExpectingException, bOpen); checkMethod(seq, "getTrackMute()", bExpectingException, bOpen); checkMethod(seq, "setTrackSolo()", bExpectingException, bOpen); checkMethod(seq, "getTrackSolo()", bExpectingException, bOpen); checkMethod(seq, "addMetaEventListener()", bExpectingException, bOpen); checkMethod(seq, "removeMetaEventListener()", bExpectingException, bOpen); checkMethod(seq, "addControllerEventListener()", bExpectingException, bOpen); checkMethod(seq, "removeControllerEventListener()", bExpectingException, bOpen); } private void checkMethod(Sequencer seq, String strMethodName, boolean bExceptionExpected, boolean bOpen) throws Exception { try { if ("start()".equals(strMethodName)) seq.start(); else if ("stop()".equals(strMethodName)) seq.stop(); else if ("startRecording()".equals(strMethodName)) seq.startRecording(); else if ("stopRecording()".equals(strMethodName)) seq.stopRecording(); else if ("setSequence(Sequence)".equals(strMethodName)) seq.setSequence(createSequence()); else if ("setSequence(InputStream)".equals(strMethodName)) seq.setSequence(createSequenceInputStream()); else if ("getSequence()".equals(strMethodName)) seq.getSequence(); else if ("isRunning()".equals(strMethodName)) seq.isRunning(); else if ("isRecording()".equals(strMethodName)) seq.isRecording(); else if ("recordEnable()".equals(strMethodName)) seq.recordEnable(seq.getSequence().getTracks()[0], -1); else if ("recordDisable()".equals(strMethodName)) seq.recordDisable(seq.getSequence().getTracks()[0]); else if ("getTempoInBPM()".equals(strMethodName)) seq.getTempoInBPM(); else if ("setTempoInBPM()".equals(strMethodName)) seq.setTempoInBPM(122); else if ("getTempoInMPQ()".equals(strMethodName)) seq.getTempoInMPQ(); else if ("setTempoInMPQ()".equals(strMethodName)) seq.setTempoInMPQ(300000); else if ("setTempoFactor()".equals(strMethodName)) seq.setTempoFactor(2.0F); else if ("getTempoFactor()".equals(strMethodName)) seq.getTempoFactor(); else if ("getTickLength()".equals(strMethodName)) seq.getTickLength(); else if ("getTickPosition()".equals(strMethodName)) seq.getTickPosition(); else if ("setTickPosition()".equals(strMethodName)) seq.setTickPosition(1); else if ("getMicrosecondLength()".equals(strMethodName)) seq.getMicrosecondLength(); else if ("getMicrosecondPosition()".equals(strMethodName)) seq.getMicrosecondPosition(); else if ("setMicrosecondPosition()".equals(strMethodName)) seq.setMicrosecondPosition(1); else if ("setMasterSyncMode()".equals(strMethodName)) seq.setMasterSyncMode(Sequencer.SyncMode.INTERNAL_CLOCK); else if ("getMasterSyncMode()".equals(strMethodName)) seq.getMasterSyncMode(); else if ("getMasterSyncModes()".equals(strMethodName)) seq.getMasterSyncModes(); else if ("setSlaveSyncMode()".equals(strMethodName)) seq.setSlaveSyncMode(Sequencer.SyncMode.NO_SYNC); else if ("getSlaveSyncMode()".equals(strMethodName)) seq.getSlaveSyncMode(); else if ("getSlaveSyncModes()".equals(strMethodName)) seq.getSlaveSyncModes(); else if ("setTrackMute()".equals(strMethodName)) seq.setTrackMute(0, true); else if ("getTrackMute()".equals(strMethodName)) seq.getTrackMute(0); else if ("setTrackSolo()".equals(strMethodName)) seq.setTrackSolo(0, true); else if ("getTrackSolo()".equals(strMethodName)) seq.getTrackSolo(0); else if ("addMetaEventListener()".equals(strMethodName)) seq.addMetaEventListener(new DummyMetaEventListener()); else if ("removeMetaEventListener()".equals(strMethodName)) seq.removeMetaEventListener(new DummyMetaEventListener()); else if ("addControllerEventListener()".equals(strMethodName)) seq.addControllerEventListener( new DummyControllerEventListener(), new int[]{0}); else if ("removeControllerEventListener()".equals(strMethodName)) seq.removeControllerEventListener( new DummyControllerEventListener(), new int[]{0}); else throw new RuntimeException("unknown method name"); if (bExceptionExpected) { fail(constructErrorMessage(seq, strMethodName, bExceptionExpected, bOpen)); } } catch (IllegalStateException e) { if (! bExceptionExpected) { fail(constructErrorMessage(seq, strMethodName, bExceptionExpected, bOpen)); } } } private static Sequence createSequence() throws Exception { Sequence sequence = new Sequence(Sequence.PPQ, 480); sequence.createTrack(); return sequence; } private static InputStream createSequenceInputStream() throws Exception { Sequence sequence = createSequence(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); MidiSystem.write(sequence, 0, baos); byte[] data = baos.toByteArray(); InputStream inputStream = new ByteArrayInputStream(data); return inputStream; } private static String constructErrorMessage(Sequencer seq, String strMethodName, boolean bExceptionExpected, boolean bOpen) { String strMessage = getMessagePrefix(seq) + ": IllegalStateException "; strMessage += (bExceptionExpected ? "not thrown" : "thrown"); strMessage += " on " + strMethodName + " in "; strMessage += (bOpen ? "open" : "closed"); strMessage += " state"; return strMessage; } private static class DummyMetaEventListener implements MetaEventListener { public void meta(MetaMessage meta) { // DO NOTHING } } private static class DummyControllerEventListener implements ControllerEventListener { public void controlChange(ShortMessage event) { // DO NOTHING } } } /*** IllegalStateTestCase.java ***/ ././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootlibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/sequencer/JavaSequencerClockTestCase.javalibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/sequencer/JavaSequencerClockTestC0000644000175000017500000000565307753242300033611 0ustar twernertwerner/* * JavaSequencerClockTestCase.java */ /* * Copyright (c) 2003 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ package org.tritonus.test.sequencer; import org.tritonus.midi.device.java.JavaSequencer; import org.tritonus.midi.device.java.SystemCurrentTimeMillisClock; import org.tritonus.midi.device.java.SunMiscPerfClock; import junit.framework.TestCase; import org.tritonus.test.Util; /** Base class for testsof javax.sound.midi.Sequencer. */ public class JavaSequencerClockTestCase extends TestCase { private static final boolean IGNORE_SUN_SEQUENCER = true; public JavaSequencerClockTestCase(String strName) { super(strName); } public void testSunMiscPerfClock() throws Exception { checkClock(new SunMiscPerfClock()); } public void testSystemCurrentTimeMillisClock() throws Exception { checkClock(new SystemCurrentTimeMillisClock()); } private void checkClock(JavaSequencer.Clock clock) throws Exception { long lSystemStartTime = System.currentTimeMillis() * 1000; long lClockStartTime = clock.getMicroseconds(); for (int i = 1; i <= 4; i++) { System.out.println("testing at " + System.currentTimeMillis()); long lSystemElapsedTime = System.currentTimeMillis() * 1000 - lSystemStartTime; long lClockElapsedTime = clock.getMicroseconds() - lClockStartTime; long lTimeDelta = lClockElapsedTime - lSystemElapsedTime; /* Here, we allow 1 millisecond difference. This test is supposed to fail on platforms that have a low-resolution implementation of System.currentTimeMillis(). */ assertTrue("clock precision", Math.abs(lTimeDelta) <= 1000); Util.sleep((long) Math.pow(10, i)); } } public void testSetGetClock() throws Exception { JavaSequencer seq = getSequencer(); assertNotNull("initial clock", seq.getClock()); JavaSequencer.Clock clock = new TestClock(); seq.setClock(clock); assertSame("setClock", clock, seq.getClock()); } // TODO: setClock() in open state throws IllegalStateException private JavaSequencer getSequencer() { return new JavaSequencer(null); } private static class TestClock implements JavaSequencer.Clock { public long getMicroseconds() { return -1; } } } /*** JavaSequencerClockTestCase.java ***/ ././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootlibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/sequencer/SequenceLengthTestCase.javalibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/sequencer/SequenceLengthTestCase.0000644000175000017500000000353310374203233033550 0ustar twernertwerner/* * SequenceLengthTestCase.java */ /* * Copyright (c) 2003 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ package org.tritonus.test.sequencer; import java.io.File; import javax.sound.midi.MidiSystem; import javax.sound.midi.Sequence; import javax.sound.midi.Sequencer; /** Tests for class javax.sound.midi.MidiMessage. */ public class SequenceLengthTestCase extends BaseSequencerTestCase { private static final String MIDI_FILENAME = "trippygaia1.mid"; public SequenceLengthTestCase(String strName) { super(strName); } protected void checkSequencer(Sequencer seq) throws Exception { seq.open(); Sequence sequence = MidiSystem.getSequence(getMediaFile(MIDI_FILENAME)); seq.setSequence(sequence); assertEquals(getMessagePrefix(seq) + ": tick length", sequence.getTickLength(), seq.getTickLength()); assertEquals(getMessagePrefix(seq) + ": time length", sequence.getMicrosecondLength(), seq.getMicrosecondLength()); // clean up seq.close(); } private static File getMediaFile(String strFilename) { return new File("sounds/" + strFilename); } } /*** SequenceLengthTestCase.java ***/ libtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/sequencer/SyncModesTestCase.java0000644000175000017500000000760110374203233033404 0ustar twernertwerner/* * SyncModesTestCase.java */ /* * Copyright (c) 2003 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ package org.tritonus.test.sequencer; import javax.sound.midi.Sequencer; import javax.sound.midi.Sequencer.SyncMode; /** Tests for class javax.sound.midi.MidiMessage. */ public class SyncModesTestCase extends BaseSequencerTestCase { private static final Sequencer.SyncMode[] MASTER_SYNC_MODES = { Sequencer.SyncMode.INTERNAL_CLOCK, Sequencer.SyncMode.MIDI_SYNC, Sequencer.SyncMode.MIDI_TIME_CODE }; private static final Sequencer.SyncMode[] SLAVE_SYNC_MODES = { Sequencer.SyncMode.NO_SYNC, Sequencer.SyncMode.MIDI_SYNC, Sequencer.SyncMode.MIDI_TIME_CODE }; public SyncModesTestCase(String strName) { super(strName); } protected void checkSequencer(Sequencer seq) throws Exception { Sequencer.SyncMode syncMode; Sequencer.SyncMode[] syncModes; // slave sync modes syncMode = seq.getSlaveSyncMode(); assertNotNull("initial slave sync mode", syncMode); assertTrue(isSlaveSyncMode(syncMode)); syncModes = seq.getSlaveSyncModes(); assertNotNull("available slave sync modes", syncModes); assertTrue("number of available slave sync modes", syncModes.length >= 1); for (int i = 0; i < syncModes.length; i++) { assertTrue(isSlaveSyncMode(syncModes[i])); checkSyncModeAccepted(seq, syncModes[i], false); } checkSyncModeAccepted(seq, Sequencer.SyncMode.NO_SYNC, false); // master sync modes syncMode = seq.getMasterSyncMode(); assertNotNull("initial master sync mode", syncMode); assertTrue(isMasterSyncMode(syncMode)); syncModes = seq.getMasterSyncModes(); assertNotNull("available master sync modes", syncModes); assertTrue("number of available master sync modes", syncModes.length >= 1); for (int i = 0; i < syncModes.length; i++) { assertTrue(isMasterSyncMode(syncModes[i])); checkSyncModeAccepted(seq, syncModes[i], true); } checkSyncModeAccepted(seq, Sequencer.SyncMode.INTERNAL_CLOCK, true); } private void checkSyncModeAccepted(Sequencer seq, Sequencer.SyncMode syncMode, boolean bMaster) { String strErrorMessage = constructErrorMessage(seq, syncMode, bMaster); if (bMaster) { seq.setMasterSyncMode(syncMode); assertSame(strErrorMessage, syncMode, seq.getMasterSyncMode()); } else { seq.setSlaveSyncMode(syncMode); assertSame(strErrorMessage, syncMode, seq.getSlaveSyncMode()); } } private boolean isMasterSyncMode(SyncMode syncMode) { return contains(MASTER_SYNC_MODES, syncMode); } private boolean isSlaveSyncMode(SyncMode syncMode) { return contains(SLAVE_SYNC_MODES, syncMode); } private boolean contains(SyncMode[] list, SyncMode test) { for (int i = 0; i < list.length; i++) { if (list[i].equals(test)) { return true; } } return false; } private static String constructErrorMessage(Sequencer seq, Sequencer.SyncMode syncMode, boolean bMaster) { String strMessage = seq.getDeviceInfo().getName() + ": "; strMessage += syncMode.toString(); strMessage += bMaster ? " as master " : " as slave "; return strMessage; } } /*** SyncModesTestCase.java ***/ libtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/sequencer/TempoTestCase.java0000644000175000017500000001114610374203233032563 0ustar twernertwerner/* * TempoTestCase.java */ /* * Copyright (c) 2003 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ package org.tritonus.test.sequencer; import javax.sound.midi.MetaEventListener; import javax.sound.midi.MetaMessage; import javax.sound.midi.MidiEvent; import javax.sound.midi.Sequence; import javax.sound.midi.Sequencer; import javax.sound.midi.Track; /** Tests for class javax.sound.midi.MidiMessage. */ public class TempoTestCase extends BaseSequencerTestCase { private static final float DELTA = 1.0E-9F; private static final float MPQ0 = 500000; private static final float BPM0 = 120; private static final float MPQ1 = 600000; private static final float BPM1 = 100; private static final float MPQ2 = 416666.66F; private static final float BPM2 = 144; private static final byte[] TEMPOTEXT = { 't', 'e', 'm', 'p', 'o' }; public TempoTestCase(String strName) { super(strName); } protected void checkSequencer(Sequencer seq) throws Exception { // initial tempo checkTempoValues("initial", seq, MPQ0, BPM0, 1.0F); // setting values in closed state seq.setTempoInMPQ(MPQ1); checkTempoValues("closed: setMPQ", seq, MPQ1, BPM1, 1.0F); seq.setTempoInBPM(BPM2); checkTempoValues("closed: setBPM", seq, MPQ2, BPM2, 1.0F); seq.setTempoFactor(2.0F); checkTempoValues("closed: setFactor", seq, MPQ2, BPM2, 2.0F); seq.setSequence(createSequence()); checkTempoValues("closed: after setSequence()", seq, MPQ2, BPM2, 1.0F); seq.open(); checkTempoValues("after open()", seq, MPQ2, BPM2, 1.0F); // setting values in open state seq.setTempoInMPQ(MPQ1); checkTempoValues("open: setMPQ", seq, MPQ1, BPM1, 1.0F); seq.setTempoInBPM(BPM2); checkTempoValues("open: setBPM", seq, MPQ2, BPM2, 1.0F); seq.setTempoFactor(3.0F); checkTempoValues("open: setFactor", seq, MPQ2, BPM2, 3.0F); seq.start(); checkTempoValues("after start()", seq, MPQ2, BPM2, 3.0F); // setting values in start state seq.setTempoInMPQ(MPQ1); checkTempoValues("started: setMPQ", seq, MPQ1, BPM1, 3.0F); seq.setTempoInBPM(BPM2); checkTempoValues("started: setBPM", seq, MPQ2, BPM2, 3.0F); seq.setTempoFactor(2.0F); checkTempoValues("started: setFactor", seq, MPQ2, BPM2, 2.0F); seq.stop(); checkTempoValues("after stop()", seq, MPQ2, BPM2, 2.0F); // setting values in start state seq.setTempoInMPQ(MPQ1); checkTempoValues("stopped: setMPQ", seq, MPQ1, BPM1, 2.0F); seq.setTempoInBPM(BPM2); checkTempoValues("stopped: setBPM", seq, MPQ2, BPM2, 2.0F); seq.setTempoFactor(3.0F); checkTempoValues("stopped: setFactor", seq, MPQ2, BPM2, 3.0F); seq.close(); checkTempoValues("after close()", seq, MPQ2, BPM2, 3.0F); } private void checkTempoValues(String strMessagePrefix, Sequencer seq, float fExpectedMPQ, float fExpectedBPM, float fExpectedFactor) { assertEquals(strMessagePrefix + " tempo in MPQ", fExpectedMPQ, seq.getTempoInMPQ(), DELTA); assertEquals(strMessagePrefix + " tempo in BPM", fExpectedBPM, seq.getTempoInBPM(), DELTA); assertEquals(strMessagePrefix + " tempo factor", fExpectedFactor, seq.getTempoFactor(), DELTA); } private static Sequence createSequence() throws Exception { Sequence sequence = new Sequence(Sequence.PPQ, 480); Track track = sequence.createTrack(); for (long lTick = 0; lTick < 100000; lTick += 1000) { MetaMessage mm = new MetaMessage(); mm.setMessage(6, TEMPOTEXT, TEMPOTEXT.length); MidiEvent me = new MidiEvent(mm, lTick); track.add(me); } return sequence; } private static class TempoDetector implements MetaEventListener { private long[] m_alArrivalTimes; public void meta(MetaMessage message) { if (message.getType() == 6) { System.arraycopy(m_alArrivalTimes, 0, m_alArrivalTimes, 1, 9); m_alArrivalTimes[0] = System.currentTimeMillis(); } } public float getTempoInMPQ() { return 0.0F; } } } /*** TempoTestCase.java ***/ libtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/tritonus/0000755000175000017500000000000010621573060027075 5ustar twernertwernerlibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/tritonus/lowlevel/0000755000175000017500000000000010621573056030733 5ustar twernertwernerlibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/tritonus/lowlevel/pogg/0000755000175000017500000000000010621573056031667 5ustar twernertwerner././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootlibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/tritonus/lowlevel/pogg/BufferTestCase.javalibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/tritonus/lowlevel/pogg/BufferTest0000644000175000017500000002044010374203233033653 0ustar twernertwerner/* * BufferTestCase.java */ /* * Copyright (c) 2005 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ package org.tritonus.test.tritonus.lowlevel.pogg; import junit.framework.TestCase; import org.tritonus.lowlevel.pogg.Buffer; /** Tests for class org.tritonus.lowlevel.pogg.Buffer. */ public class BufferTestCase extends TestCase { private static final int mask[]= { 0x00000000, 0x00000001, 0x00000003, 0x00000007, 0x0000000f, 0x0000001f, 0x0000003f, 0x0000007f, 0x000000ff, 0x000001ff, 0x000003ff, 0x000007ff, 0x00000fff, 0x00001fff, 0x00003fff, 0x00007fff, 0x0000ffff, 0x0001ffff, 0x0003ffff, 0x0007ffff, 0x000fffff, 0x001fffff, 0x003fffff, 0x007fffff, 0x00ffffff, 0x01ffffff, 0x03ffffff, 0x07ffffff, 0x0fffffff, 0x1fffffff, 0x3fffffff, 0x7fffffff, 0xffffffff }; private static final int[] testbuffer1 = { 18, 12, 103948, 4325, 543, 76, 432, 52, 3, 65, 4, 56, 32, 42, 34, 21, 1, 23, 32, 546, 456, 7, 567, 56, 8, 8, 55, 3, 52, 342, 341, 4, 265, 7, 67, 86, 2199, 21, 7, 1, 5, 1, 4 }; private static final int test1size = testbuffer1.length; private static final int testbuffer2[]= { 216531625, 1237861823, 56732452, 131, 3212421, 12325343, 34547562, 12313212, 1233432, 534, 5, 346435231, 14436467, 7869299, 76326614, 167548585, 85525151, 0, 12321, 1, 349528352 }; private static final int test2size=21; private static final int testbuffer3[]= { 1, 0, 14, 0, 1, 0, 12, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 1, 0, 1, 30, 1, 1, 1, 0, 0, 1, 0, 0, 0, 12, 0, 11, 0, 1, 0, 0, 1 }; private static final int test3size=56; private static final int large[]= { 2136531625, 2137861823, 56732452, 131, 3212421, 12325343, 34547562, 12313212, 1233432, 534, 5, 2146435231, 14436467, 7869299, 76326614, 167548585, 85525151, 0, 12321, 1, 2146528352 }; private static final int onesize=33; private static byte[] one = { (byte) 146, 25, 44, (byte) 151, (byte) 195, 15, (byte) 153, (byte) 176, (byte) 233, (byte) 131, (byte) 196, 65, 85, (byte) 172, 47, 40, 34, (byte) 242, (byte) 223, (byte) 136, 35, (byte) 222, (byte) 211, 86, (byte) 171, 50, (byte) 225, (byte) 135, (byte) 214, 75, (byte) 172, (byte) 223, 4 }; private static final int twosize=6; private static byte[] two = { 61, (byte) 255, (byte) 255, (byte) 251, (byte) 231, 29 }; private static final int threesize=54; private static final byte[] three = { (byte) 169, 2, (byte) 232, (byte) 252, 91, (byte) 132, (byte) 156, 36, 89, 13, 123, (byte) 176, (byte) 144, 32, (byte) 254, (byte) 142, (byte) 224, 85, 59, 121, (byte) 144, 79, 124, 23, 67, 90, 90, (byte) 216, 79, 23, 83, 58, (byte) 135, (byte) 196, 61, 55, (byte) 129, (byte) 183, 54, 101, 100, (byte) 170, 37, 127, 126, 10, 100, 52, 4, 14, 18, 86, 77, 1 }; private static final int foursize=38; private static byte[] four = { 18, 6, (byte) 163, (byte) 252, 97, (byte) 194, 104, (byte) 131, 32, 1, 7, 82, (byte) 137, 42, (byte) 129, 11, 72, (byte) 132, 60, (byte) 220, 112, 8, (byte) 196, 109, 64, (byte) 179, 86, 9, (byte) 137, (byte) 195, (byte) 208, 122, (byte) 169, 28, 2, (byte) 133, 0, 1 }; private static final int fivesize=45; private static final byte[] five = { (byte) 169, 2, (byte) 126, (byte) 139, (byte) 144, (byte) 172, 30, 4, 80, 72, (byte) 240, 59, (byte) 130, (byte) 218, 73, 62, (byte) 241, 24, (byte) 210, 44, 4, 20, 0, (byte) 248, 116, 49, (byte) 135, 100, 110, (byte) 130, (byte) 181, (byte) 169, 84, 75, (byte) 159, 2, 1, 0, (byte) 132, (byte) 192, 8, 0, 0, 18, 22 }; private static final int sixsize=7; private static final byte[] six = { 17, (byte) 177, (byte) 170, (byte) 242, (byte) 169, 19, (byte) 148 }; private Buffer o; private Buffer r; public BufferTestCase(String strName) { super(strName); } private static int ilog(int v) { int ret = 0; while (v > 0) { ret++; v >>>= 1; } return ret; } private void cliptest(int[] b, int bits, byte[] comp,int compsize) { int bytes; int i; byte[] buffer; o.reset(); for (i = 0; i < b.length; i++) { o.write(b[i], (bits != 0) ? bits : ilog(b[i])); } buffer = o.getBuffer(); bytes = o.bytes(); assertEquals("wrong number of bytes!\n", compsize, bytes); for (i = 0; i < bytes; i++) { assertEquals("wrote incorrect value!\n", comp[i], buffer[i]); { //for (i = 0; i < bytes; i++) //fprintf(stderr,"%x %x\n",(int)buffer[i],(int)comp[i]); } } r.readInit(buffer, bytes); for (i = 0; i < b.length; i++) { int tbit = (bits != 0) ? bits : ilog(b[i]); assertTrue("out of data!\n", r.look(tbit) != -1); assertEquals("looked at incorrect value!\n", b[i] & mask[tbit], r.look(tbit)); if (tbit == 1) assertEquals("looked at single bit incorrect value!\n", b[i] & mask[tbit], r.look1()); if (tbit == 1) { assertEquals("read incorrect single bit value!\n", b[i] & mask[tbit], r.read1()); } else { assertEquals("read incorrect value!\n", b[i] & mask[tbit], r.read(tbit)); } } assertTrue("leftover bytes after read!\n", r.bytes() == bytes); } public void testBuffer() throws Exception { byte[] buffer; int bytes,i; // TODO: should free them o = new Buffer(); r = new Buffer(); /* Test read/write together */ /* Later we test against pregenerated bitstreams */ o.writeInit(); //fprintf(stderr,"\nSmall preclipped packing (LSb): "); cliptest(testbuffer1, 0,one,onesize); //fprintf(stderr,"ok."); // fprintf(stderr,"\nNull bit call (LSb): "); cliptest(testbuffer3, 0,two,twosize); // fprintf(stderr,"ok."); // fprintf(stderr,"\nLarge preclipped packing (LSb): "); cliptest(testbuffer2, 0,three,threesize); // fprintf(stderr,"ok."); // fprintf(stderr,"\n32 bit preclipped packing (LSb): "); o.reset(); for (i = 0; i < test2size; i++) { o.write(large[i], 32); } buffer = o.getBuffer(); bytes = o.bytes(); r.readInit(buffer, bytes); for (i = 0; i < test2size; i++) { assertTrue("out of data. failed!", r.look(32) != -1); assertEquals("read incorrect value!\n", large[i], r.look(32)); { // fprintf(stderr,"%ld != %ld (%lx!=%lx):",oggpack_look(&r, 32),large[i], // oggpack_look(&r, 32),large[i]); } r.adv(32); } assertEquals("leftover bytes after read!\n", bytes, r.bytes()); // fprintf(stderr,"ok."); // fprintf(stderr,"\nSmall unclipped packing (LSb): "); cliptest(testbuffer1, 7,four,foursize); // fprintf(stderr,"ok."); // fprintf(stderr,"\nLarge unclipped packing (LSb): "); cliptest(testbuffer2, 17,five,fivesize); // fprintf(stderr,"ok."); // fprintf(stderr,"\nSingle bit unclipped packing (LSb): "); cliptest(testbuffer3, 1,six,sixsize); // fprintf(stderr,"ok."); // fprintf(stderr,"\nTesting read past end (LSb): "); r.readInit(new byte[8], 8); for (i = 0; i < 64; i++) { assertEquals("failed; got -1 prematurely.\n", 0, r.read(1)); } assertEquals("failed; lookahead past end without -1.\n", -1, r.look(1)); assertEquals("failed; read past end without -1.\n", -1, r.read(1)); r.readInit(new byte[8], 8); assertEquals("failed 2; got -1 prematurely.\n", 0, r.read(30)); assertEquals("failed 2; got -1 prematurely.\n", 0, r.read(16)); assertEquals("failed 3; got -1 prematurely.\n", 0, r.look(18)); assertEquals("failed 3; got -1 prematurely.\n", 0, r.look(18)); assertTrue("failed; read past end without -1.\n", r.look(19) == -1 && r.look(19) == -1); assertEquals("failed; read past end without -1.\n", -1, r.look(32)); // fprintf(stderr,"ok.\n"); } } /*** BufferTestCase.java ***/ ././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootlibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/tritonus/lowlevel/pogg/FramingTestCase.javalibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/tritonus/lowlevel/pogg/FramingTes0000644000175000017500000006021710374203233033647 0ustar twernertwerner/* * FramingTestCase.java */ /* * Copyright (c) 2005 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ package org.tritonus.test.tritonus.lowlevel.pogg; import java.util.Arrays; import junit.framework.TestCase; import org.tritonus.lowlevel.pogg.Page; import org.tritonus.lowlevel.pogg.Packet; import org.tritonus.lowlevel.pogg.StreamState; import org.tritonus.lowlevel.pogg.SyncState; /** Tests for classes org.tritonus.lowlevel.pogg.* except Buffer. */ public class FramingTestCase extends TestCase { /* 17 only */ private static final int head1_0[] = {0x4f,0x67,0x67,0x53,0,0x06, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x01,0x02,0x03,0x04,0,0,0,0, 0x15,0xed,0xec,0x91, 1, 17}; /* 17, 254, 255, 256, 500, 510, 600 byte, pad */ private static final int head1_1[] = {0x4f,0x67,0x67,0x53,0,0x02, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x01,0x02,0x03,0x04,0,0,0,0, 0x59,0x10,0x6c,0x2c, 1, 17}; private static final int head2_1[] = {0x4f,0x67,0x67,0x53,0,0x04, 0x07,0x18,0x00,0x00,0x00,0x00,0x00,0x00, 0x01,0x02,0x03,0x04,1,0,0,0, 0x89,0x33,0x85,0xce, 13, 254,255,0,255,1,255,245,255,255,0, 255,255,90}; /* nil packets; beginning,middle,end */ private static final int head1_2[] = {0x4f,0x67,0x67,0x53,0,0x02, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x01,0x02,0x03,0x04,0,0,0,0, 0xff,0x7b,0x23,0x17, 1, 0}; private static final int head2_2[] = {0x4f,0x67,0x67,0x53,0,0x04, 0x07,0x28,0x00,0x00,0x00,0x00,0x00,0x00, 0x01,0x02,0x03,0x04,1,0,0,0, 0x5c,0x3f,0x66,0xcb, 17, 17,254,255,0,0,255,1,0,255,245,255,255,0, 255,255,90,0}; /* large initial packet */ private static final int head1_3[] = {0x4f,0x67,0x67,0x53,0,0x02, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x01,0x02,0x03,0x04,0,0,0,0, 0x01,0x27,0x31,0xaa, 18, 255,255,255,255,255,255,255,255, 255,255,255,255,255,255,255,255,255,10}; private static final int head2_3[] = {0x4f,0x67,0x67,0x53,0,0x04, 0x07,0x08,0x00,0x00,0x00,0x00,0x00,0x00, 0x01,0x02,0x03,0x04,1,0,0,0, 0x7f,0x4e,0x8a,0xd2, 4, 255,4,255,0}; /* continuing packet test */ private static final int head1_4[] = {0x4f,0x67,0x67,0x53,0,0x02, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x01,0x02,0x03,0x04,0,0,0,0, 0xff,0x7b,0x23,0x17, 1, 0}; private static final int head2_4[] = {0x4f,0x67,0x67,0x53,0,0x00, 0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x01,0x02,0x03,0x04,1,0,0,0, 0x34,0x24,0xd5,0x29, 17, 255,255,255,255,255,255,255,255, 255,255,255,255,255,255,255,255,255}; private static final int head3_4[] = {0x4f,0x67,0x67,0x53,0,0x05, 0x07,0x0c,0x00,0x00,0x00,0x00,0x00,0x00, 0x01,0x02,0x03,0x04,2,0,0,0, 0xc8,0xc3,0xcb,0xed, 5, 10,255,4,255,0}; /* page with the 255 segment limit */ private static final int head1_5[] = {0x4f,0x67,0x67,0x53,0,0x02, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x01,0x02,0x03,0x04,0,0,0,0, 0xff,0x7b,0x23,0x17, 1, 0}; private static final int head2_5[] = {0x4f,0x67,0x67,0x53,0,0x00, 0x07,0xfc,0x03,0x00,0x00,0x00,0x00,0x00, 0x01,0x02,0x03,0x04,1,0,0,0, 0xed,0x2a,0x2e,0xa7, 255, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10}; private static final int head3_5[] = {0x4f,0x67,0x67,0x53,0,0x04, 0x07,0x00,0x04,0x00,0x00,0x00,0x00,0x00, 0x01,0x02,0x03,0x04,2,0,0,0, 0x6c,0x3b,0x82,0x3d, 1, 50}; /* packet that overspans over an entire page */ private static final int head1_6[] = {0x4f,0x67,0x67,0x53,0,0x02, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x01,0x02,0x03,0x04,0,0,0,0, 0xff,0x7b,0x23,0x17, 1, 0}; private static final int head2_6[] = {0x4f,0x67,0x67,0x53,0,0x00, 0x07,0x04,0x00,0x00,0x00,0x00,0x00,0x00, 0x01,0x02,0x03,0x04,1,0,0,0, 0x3c,0xd9,0x4d,0x3f, 17, 100,255,255,255,255,255,255,255,255, 255,255,255,255,255,255,255,255}; private static final int head3_6[] = {0x4f,0x67,0x67,0x53,0,0x01, 0x07,0x04,0x00,0x00,0x00,0x00,0x00,0x00, 0x01,0x02,0x03,0x04,2,0,0,0, 0xbd,0xd5,0xb5,0x8b, 17, 255,255,255,255,255,255,255,255, 255,255,255,255,255,255,255,255,255}; private static final int head4_6[] = {0x4f,0x67,0x67,0x53,0,0x05, 0x07,0x10,0x00,0x00,0x00,0x00,0x00,0x00, 0x01,0x02,0x03,0x04,3,0,0,0, 0xef,0xdd,0x88,0xde, 7, 255,255,75,255,4,255,0}; /* packet that overspans over an entire page */ private static final int head1_7[] = {0x4f,0x67,0x67,0x53,0,0x02, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x01,0x02,0x03,0x04,0,0,0,0, 0xff,0x7b,0x23,0x17, 1, 0}; private static final int head2_7[] = {0x4f,0x67,0x67,0x53,0,0x00, 0x07,0x04,0x00,0x00,0x00,0x00,0x00,0x00, 0x01,0x02,0x03,0x04,1,0,0,0, 0x3c,0xd9,0x4d,0x3f, 17, 100,255,255,255,255,255,255,255,255, 255,255,255,255,255,255,255,255}; private static final int head3_7[] = {0x4f,0x67,0x67,0x53,0,0x05, 0x07,0x08,0x00,0x00,0x00,0x00,0x00,0x00, 0x01,0x02,0x03,0x04,2,0,0,0, 0xd4,0xe0,0x60,0xe5, 1,0}; private static int sequence = 0; private static int lastno = 0; public FramingTestCase(String strName) { super(strName); } private void checkpacket(Packet op, int len, int no, int pos) { assertEquals("incorrect packet length!\n", len, op.getData().length); assertEquals("incorrect packet position!\n", pos, op.getGranulePos()); /* packet number just follows sequence/gap; adjust the input number for that */ if (no == 0) { sequence = 0; } else { sequence++; if (no > lastno + 1) sequence++; } lastno = no; assertEquals("incorrect packet sequence", sequence, op.getPacketNo()); /* Test data */ byte[] abContent = op.getData(); for (int j = 0; j < abContent.length; j++) { assertEquals("body data mismatch (1) at pos " + j + ":", (j + no) & 0xFF, abContent[j] & 0xFF); } } void check_page(byte[] data, int nOffset, int[] header, Page og) { int j; byte[] abHeader = og.getHeader(); byte[] abBody = og.getBody(); /* Test data */ for (j = 0; j < abBody.length; j++) { assertEquals("body data mismatch (2) at pos %ld:", data[j + nOffset], abBody[j]); } /* Test header */ for (j = 0; j < abHeader.length; j++) { assertEquals("header content mismatch at pos " + j + ":", header[j], (abHeader[j] & 0xFF)); } assertEquals("header length incorrect! (%ld!=%d)\n", header[26] + 27, abHeader.length); } private void copy_page(Page og) { byte[] abHeader = og.getHeader(); byte[] abBody = og.getBody(); og.setData(abHeader, 0, abHeader.length, abBody, 0, abBody.length); } private void writePageToSyncState(Page page, SyncState sync) { byte[] abPageHeader = page.getHeader(); byte[] abPageBody = page.getBody(); sync.write(abPageHeader, abPageHeader.length); sync.write(abPageBody, abPageBody.length); } private void writeToSyncState(byte[] abData, int nOffset, int nLength, SyncState sync) { if (nOffset > 0) { byte[] abTmp = new byte[nLength]; System.arraycopy(abData, nOffset, abTmp, 0, abTmp.length); abData = abTmp; } sync.write(abData, nLength); } private boolean equals(Packet p1, Packet p2) { return Arrays.equals(p1.getData(), p2.getData()) && p1.isBos() == p2.isBos() && p1.isEos() == p2.isEos() && p1.getGranulePos() == p2.getGranulePos() && p1.getPacketNo() == p2.getPacketNo(); } private boolean equals(byte[] b1, int nOffset1, byte[] b2, int nOffset2, int nLength) { if (nOffset1 + nLength > b1.length || nOffset2 + nLength > b2.length) return false; for (int i = 0; i < nLength; i++) { if (b1[nOffset1 + i] != b2[nOffset2 + i]) return false; } return true; } private void test_pack(int[] pl, int[][] headers) { StreamState os_en = new StreamState(); StreamState os_de = new StreamState(); SyncState oy = new SyncState(); byte[] data = new byte[1024 * 1024]; /* for scripted test cases only */ int inptr = 0; int outptr = 0; int deptr = 0; int depacket = 0; long granule_pos = 7; int pageno = 0; int i,j,packets; int pageout = 0; boolean eosflag = false; boolean bosflag = false; os_en.init(0x04030201); os_de.init(0x04030201); oy.init(); os_en.reset(); os_de.reset(); oy.reset(); packets = pl.length; //System.out.println("packets: " + packets); for (i = 0; i < packets; i++) { /* construct a test packet */ Packet op = new Packet(); int len = pl[i]; byte[] abPacketData = new byte[len]; for (j = 0; j < len; j++) abPacketData[j] = (byte)(i + j); System.arraycopy(abPacketData, 0, data, inptr, len); inptr += len; op.setData(abPacketData, 0, len); op.setFlags(false, i + 1 == packets, granule_pos, 0); granule_pos += 1024; /* submit the test packet */ os_en.packetIn(op); /* retrieve any finished pages */ Page og = new Page(); while (os_en.pageOut(og) != 0) { /* We have a page. Check it carefully */ //fprintf(stderr,"%ld, ",pageno); assertTrue("coded too many pages!\n", pageno < headers.length); check_page(data, outptr, headers[pageno], og); outptr += og.getBody().length; pageno++; /* have a complete page; submit it to sync/decode */ Page og_de = new Page(); Packet op_de = new Packet(); Packet op_de2 = new Packet(); writePageToSyncState(og, oy); while (oy.pageOut(og_de) > 0) { /* got a page. Happy happy. Verify that it's good. */ // temporarily inserted og_de.setChecksum(); // end insertion check_page(data, deptr, headers[pageout], og_de); deptr += og_de.getBody().length; pageout++; /* submit it to deconstitution */ os_de.pageIn(og_de); /* packets out? */ while (os_de.packetPeek(op_de2) > 0) { os_de.packetPeek(null); os_de.packetOut(op_de); /* just catching them all */ /* verify peek and out match */ assertTrue("packetout != packetpeek! pos=%ld\n", equals(op_de, op_de2)); /* verify the packet! */ /* check data */ assertTrue("packet data mismatch in decode! pos=%ld\n", equals(data, depacket, op_de.getData(), 0, op_de.getData().length)); /* check bos flag */ if (bosflag) { assertTrue("b_o_s flag incorrectly set on packet!\n", ! op_de.isBos()); } else { assertTrue("b_o_s flag not set on packet!\n", op_de.isBos()); } bosflag = true; depacket += op_de.getData().length; /* check eos flag */ assertTrue("Multiple decoded packets with eos flag!\n", !eosflag); if (op_de.isEos()) eosflag = true; /* check granulepos flag */ // if (op_de.granulepos!=-1) // { // fprintf(stderr," granule:%ld ",(long)op_de.granulepos); // } } } } } data = null; assertTrue("did not write last page!", pageno == headers.length); assertTrue("did not decode last page!", pageout == headers.length); assertEquals("encoded page data incomplete!\n", inptr, outptr); assertEquals("decoded page data incomplete!\n", inptr, deptr); assertEquals("decoded packet data incomplete!\n", inptr, depacket); assertTrue("Never got a packet with EOS set!\n", eosflag); } public void testStreamEncoding0() throws Exception { /* 17 only */ // fprintf(stderr,"testing single page encoding... "); test_pack(new int[]{17}, new int[][]{head1_0}); } public void testStreamEncoding1() throws Exception { /* 17, 254, 255, 256, 500, 510, 600 byte, pad */ // fprintf(stderr,"testing basic page encoding... "); test_pack(new int[]{17, 254, 255, 256, 500, 510, 600}, new int[][]{head1_1,head2_1}); } public void testStreamEncoding2() throws Exception { /* nil packets; beginning,middle,end */ // fprintf(stderr,"testing basic nil packets... "); test_pack(new int[]{0,17, 254, 255, 0, 256, 0, 500, 510, 600, 0}, new int[][]{head1_2,head2_2}); } public void testStreamEncoding3() throws Exception { /* large initial packet */ // fprintf(stderr,"testing initial-packet lacing > 4k... "); test_pack(new int[]{4345,259,255}, new int[][]{head1_3,head2_3}); } public void testStreamEncoding4() throws Exception { /* continuing packet test */ // fprintf(stderr,"testing single packet page span... "); test_pack(new int[]{0,4345,259,255}, new int[][]{head1_4,head2_4,head3_4}); } public void testStreamEncoding5() throws Exception { /* page with the 255 segment limit */ int[] packets = new int[] { 0,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,50 }; // fprintf(stderr,"testing max packet segments... "); test_pack(packets, new int[][]{head1_5,head2_5,head3_5}); } public void testStreamEncoding6() throws Exception { /* packet that overspans over an entire page */ // fprintf(stderr,"testing very large packets... "); test_pack(new int[]{0,100,9000,259,255}, new int[][]{head1_6,head2_6,head3_6,head4_6}); } public void testStreamEncoding7() throws Exception { /* term only page. why not? */ // fprintf(stderr,"testing zero data page (1 nil packet)... "); test_pack(new int[]{0,100,4080}, new int[][]{head1_7,head2_7,head3_7}); } /** Create six pages containing 12 packets for testing. */ private Page[] createPages() throws Exception { StreamState os_en = new StreamState(); os_en.init(0x04030201); /* build a bunch of pages for testing */ int pl[] = new int[]{0,100,4079,2956,2057,76,34,912,0,234,1000,1000,1000,300}; Page[] og = new Page[5]; for (int i = 0; i < og.length; i++) og[i] = new Page(); os_en.reset(); for (int i = 0; i < pl.length; i++) { Packet op = new Packet(); int len = pl[i]; byte[] abPacketData = new byte[len]; for (int j = 0; j < len; j++) { abPacketData[j]= (byte) (i + j); } op.setData(abPacketData, 0, len); op.setFlags(false, i + 1 == pl.length, (i + 1) * 1000, 0); os_en.packetIn(op); } /* retrieve finished pages */ for (int i = 0; i < 5; i++) { assertTrue("Too few pages output building sync tests", os_en.pageOut(og[i]) != 0); copy_page(og[i]); } return og; } public void testFraming() throws Exception { StreamState os_de = new StreamState(); SyncState oy = new SyncState(); os_de.init(0x04030201); oy.init(); Page[] og = createPages(); } /* Test lost pages on pagein/packetout: no rollback */ public void testFraming1() throws Exception { StreamState os_de = new StreamState(); SyncState oy = new SyncState(); os_de.init(0x04030201); oy.init(); Page[] og = createPages(); Page temp = new Page(); Packet test = new Packet(); // fprintf(stderr,"Testing loss of pages... "); oy.reset(); os_de.reset(); for (int i = 0; i < og.length; i++) { writePageToSyncState(og[i], oy); } oy.pageOut(temp); os_de.pageIn(temp); oy.pageOut(temp); os_de.pageIn(temp); oy.pageOut(temp); /* skip */ oy.pageOut(temp); os_de.pageIn(temp); /* do we get the expected results/packets? */ assertEquals("retrieving packet after lost page", 1, os_de.packetOut(test)); checkpacket(test,0,0,0); assertEquals("retrieving packet after lost page", 1, os_de.packetOut(test)); checkpacket(test,100,1,-1); assertEquals("retrieving packet after lost page", 1, os_de.packetOut(test)); checkpacket(test,4079,2,3000); assertEquals("loss of page did not return error", -1, os_de.packetOut(test)); assertEquals("retrieving packet after lost page", 1, os_de.packetOut(test)); checkpacket(test,76,5,-1); assertEquals("retrieving packet after lost page", 1, os_de.packetOut(test)); checkpacket(test,34,6,-1); } /* Test lost pages on pagein/packetout: rollback with continuation */ public void testFraming2() throws Exception { StreamState os_de = new StreamState(); SyncState oy = new SyncState(); os_de.init(0x04030201); oy.init(); Page[] og = createPages(); Page temp = new Page(); Packet test = new Packet(); //fprintf(stderr,"Testing loss of pages (rollback required)... "); oy.reset(); os_de.reset(); for (int i=0;i<5;i++) { writePageToSyncState(og[i], oy); } oy.pageOut(temp); os_de.pageIn(temp); oy.pageOut(temp); os_de.pageIn(temp); oy.pageOut(temp); os_de.pageIn(temp); oy.pageOut(temp); /* skip */ oy.pageOut(temp); os_de.pageIn(temp); /* do we get the expected results/packets? */ assertEquals("retrieving packet after lost page", 1, os_de.packetOut(test)); checkpacket(test,0,0,0); assertEquals("retrieving packet after lost page", 1, os_de.packetOut(test)); checkpacket(test,100,1,-1); assertEquals("retrieving packet after lost page", 1, os_de.packetOut(test)); checkpacket(test,4079,2,3000); assertEquals("retrieving packet after lost page", 1, os_de.packetOut(test)); checkpacket(test,2956,3,4000); assertEquals("retrieving packet after lost page did not return error", -1, os_de.packetOut(test)); assertEquals("retrieving packet after lost page", 1, os_de.packetOut(test)); checkpacket(test,300,13,14000); } /* the rest only test sync */ public void testFraming3() throws Exception { StreamState os_de = new StreamState(); SyncState oy = new SyncState(); os_de.init(0x04030201); oy.init(); Page[] og = createPages(); Page og_de = new Page(); /* Test fractional page inputs: incomplete capture */ //fprintf(stderr,"Testing sync on partial inputs... "); oy.reset(); byte[] abHeader = og[1].getHeader(); oy.write(abHeader, 3); assertTrue("sync on incomplete capture", oy.pageOut(og_de) <= 0); /* Test fractional page inputs: incomplete fixed header */ writeToSyncState(abHeader, 3, 20, oy); assertTrue("sync on incomplete fixed header", oy.pageOut(og_de) <= 0); /* Test fractional page inputs: incomplete header */ writeToSyncState(abHeader, 23, 5, oy); assertTrue("sync on incomplete header", oy.pageOut(og_de) <= 0); /* Test fractional page inputs: incomplete body */ writeToSyncState(abHeader, 28, abHeader.length - 28, oy); assertTrue("sync on incomplete body", oy.pageOut(og_de) <= 0); byte[] abBody = og[1].getBody(); oy.write(abBody, 1000); assertTrue("sync on incomplete body", oy.pageOut(og_de) <= 0); writeToSyncState(abBody, 1000, abBody.length - 1000, oy); assertTrue("sync on complete body", oy.pageOut(og_de) > 0); } /* Test fractional page inputs: page + incomplete capture */ public void testFraming4() throws Exception { StreamState os_de = new StreamState(); SyncState oy = new SyncState(); os_de.init(0x04030201); oy.init(); Page[] og = createPages(); Page og_de = new Page(); //fprintf(stderr,"Testing sync on 1+partial inputs... "); oy.reset(); writePageToSyncState(og[1], oy); byte[] abHeader = og[1].getHeader(); oy.write(abHeader, 20); assertTrue("", oy.pageOut(og_de) > 0); assertTrue("", oy.pageOut(og_de) <= 0); writeToSyncState(abHeader, 20, abHeader.length - 20, oy); byte[] abBody = og[1].getBody(); oy.write(abBody, abBody.length); assertTrue("", oy.pageOut(og_de) > 0); } /* Test recapture: garbage + page */ public void testFraming5() throws Exception { StreamState os_de = new StreamState(); SyncState oy = new SyncState(); os_de.init(0x04030201); oy.init(); Page[] og = createPages(); Page og_de = new Page(); //fprintf(stderr,"Testing search for capture... "); oy.reset(); /* 'garbage' */ byte[] abBody = og[1].getBody(); writeToSyncState(abBody, 0, abBody.length, oy); writePageToSyncState(og[1], oy); byte[] abHeader = og[2].getHeader(); writeToSyncState(abHeader, 0, 20, oy); assertTrue("", oy.pageOut(og_de) <= 0); assertTrue("", oy.pageOut(og_de) > 0); assertTrue("", oy.pageOut(og_de) <= 0); writeToSyncState(abHeader, 20, abHeader.length - 20, oy); abBody = og[2].getBody(); writeToSyncState(abBody, 0, abBody.length, oy); assertTrue("", oy.pageOut(og_de) > 0); } /* Test recapture: page + garbage + page */ public void testFraming6() throws Exception { StreamState os_de = new StreamState(); SyncState oy = new SyncState(); os_de.init(0x04030201); oy.init(); Page[] og = createPages(); Page og_de = new Page(); //fprintf(stderr,"Testing recapture... "); oy.reset(); writePageToSyncState(og[1], oy); byte[] abHeader = og[2].getHeader(); writeToSyncState(abHeader, 0, abHeader.length, oy); assertTrue("", oy.pageOut(og_de) > 0); byte[] abBody = og[2].getBody(); writeToSyncState(abBody, 0, abBody.length - 5, oy); writePageToSyncState(og[3], oy); assertTrue("", oy.pageOut(og_de) <= 0); assertTrue("", oy.pageOut(og_de) > 0); } } /*** FramingTestCase.java ***/ ././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootlibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/tritonus/lowlevel/pogg/PacketTestCase.javalibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/tritonus/lowlevel/pogg/PacketTest0000644000175000017500000001110410374203233033646 0ustar twernertwerner/* * PacketTestCase.java */ /* * Copyright (c) 2005 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ package org.tritonus.test.tritonus.lowlevel.pogg; import java.util.Arrays; import junit.framework.TestCase; import org.tritonus.lowlevel.pogg.Packet; /** Tests for classes org.tritonus.lowlevel.pogg.Packet. */ public class PacketTestCase extends TestCase { public PacketTestCase(String strName) { super(strName); } // public void testClear() // throws Exception // { // Packet p = new Packet(); // p.clear(); // checkPacket(p, "clear test", false, false, 0, 0, null); // } public void testClear() throws Exception { Packet p = new Packet(); p.setData(new byte[3], 0, 3); p.setFlags(true, true, 99, 100); p.clear(); checkPacket(p, "clear test", false, false, 0, 0, null); } public void testSetData() throws Exception { Packet p = new Packet(); byte[] abData = new byte[1024]; for (int i = 0; i < abData.length; i++) { abData[i] = (byte) i; } p.setData(abData, 0, abData.length); checkPacket(p, "set data test", false, false, 0, 0, abData); } public void testSetDataTruncated() throws Exception { Packet p = new Packet(); byte[] abData = new byte[1024]; for (int i = 0; i < abData.length; i++) { abData[i] = (byte) i; } p.setData(abData, 0, abData.length / 2); byte[] abCompare = new byte[abData.length / 2]; System.arraycopy(abData, 0, abCompare, 0, abData.length / 2); checkPacket(p, "set data truncated test", false, false, 0, 0, abCompare); } public void testSetFlags() throws Exception { checkFlags("set flags test 1", true, false, 65555L, 0); checkFlags("set flags test 2", false, true, 0, 0); checkFlags("set flags test 3", false, false, Long.MAX_VALUE, 0); checkFlags("set flags test 4", true, true, Long.MIN_VALUE, 0); } private void checkFlags(String strMessage, boolean bBos, boolean bEos, long lGranulePos, long lPacketNo) throws Exception { Packet p = new Packet(); byte[] abData = new byte[0]; p.setData(abData, 0, abData.length); p.setFlags(bBos, bEos, lGranulePos, lPacketNo); checkPacket(p, strMessage, bBos, bEos, lGranulePos, lPacketNo, abData); } private void checkPacket(Packet p, String strMessage, boolean bBosExpected, boolean bEosExpected, long lGranulePosExpected, long lPacketNoExpected, byte[] abDataExpected) throws Exception { assertEquals(constructErrorMessage(strMessage, "bos flag"), bBosExpected, p.isBos()); assertEquals(constructErrorMessage(strMessage, "eos flag"), bEosExpected, p.isEos()); assertEquals(constructErrorMessage(strMessage, "granulepos"), lGranulePosExpected, p.getGranulePos()); assertEquals(constructErrorMessage(strMessage, "packetno"), lPacketNoExpected, p.getPacketNo()); System.out.println("data: " + p.getData()); assertTrue(constructErrorMessage(strMessage, "data content"), equals(abDataExpected, p.getData())); } private static boolean equals(Packet p1, Packet p2) { return Arrays.equals(p1.getData(), p2.getData()) && p1.isBos() == p2.isBos() && p1.isEos() == p2.isEos() && p1.getGranulePos() == p2.getGranulePos() && p1.getPacketNo() == p2.getPacketNo(); } private static boolean equals(byte[] b1, byte[] b2) { if (b1 == null && b2 == null) return true; if (b1 != null) return equals(b1, 0, b2, 0, b1.length); return false; } private static boolean equals(byte[] b1, int nOffset1, byte[] b2, int nOffset2, int nLength) { if (b1 == null && b2 == null) return true; if (nOffset1 + nLength > b1.length || nOffset2 + nLength > b2.length) return false; for (int i = 0; i < nLength; i++) { if (b1[nOffset1 + i] != b2[nOffset2 + i]) return false; } return true; } private static String constructErrorMessage(String s1, String s2) { return s1 + ": " + s2; } } /*** PacketTestCase.java ***/ ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootlibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/tritonus/lowlevel/pogg/PageTestCase.javalibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/tritonus/lowlevel/pogg/PageTestCa0000644000175000017500000001276310374203233033573 0ustar twernertwerner/* * PageTestCase.java */ /* * Copyright (c) 2005 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ package org.tritonus.test.tritonus.lowlevel.pogg; import junit.framework.TestCase; import org.tritonus.lowlevel.pogg.Page; /** Tests for classes org.tritonus.lowlevel.pogg.Page. */ public class PageTestCase extends TestCase { /* First and last, uncontinued, pos 0, serial 0x04030201, page 0, 1 segment, 1 packet */ private static final byte[] HEADER1 = new byte[] { 0x4f, 0x67, 0x67, 0x53, 0, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03, 0x04, 0, 0, 0, 0, 0x15, (byte) 0xed, (byte) 0xec, (byte) 0x91, 1, 17 }; /* First , uncontinued, pos -1, serial 0x04030201, page 8, 7 segments, 1 packet */ private static final byte[] HEADER2 = new byte[] { 0x4f, 0x67, 0x67, 0x53, 0, 0x02, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, 0x01, 0x02, 0x03, 0x04, 8, 0, 0, 0, 0x15, (byte) 0xed, (byte) 0xec, (byte) 0x91, 7, (byte) 255, (byte) 255, (byte) 255, (byte) 255, (byte) 255, (byte) 255, 12 }; public PageTestCase(String strName) { super(strName); } public void testSetData() throws Exception { Page p = new Page(); byte[] abHeader = new byte[1024]; for (int i = 0; i < abHeader.length; i++) { abHeader[i] = (byte) (i + 128); } byte[] abBody = new byte[1024]; for (int i = 0; i < abBody.length; i++) { abBody[i] = (byte) i; } p.setData(abHeader, 0, abHeader.length, abBody, 0, abBody.length); checkData(p, "set data test", abHeader, abBody); } public void testSetDataOffset() throws Exception { Page p = new Page(); byte[] abHeader = new byte[102]; for (int i = 0; i < abHeader.length; i++) { abHeader[i] = (byte) (i + 128); } byte[] abBody = new byte[1024]; for (int i = 0; i < abBody.length; i++) { abBody[i] = (byte) i; } p.setData(abHeader, 12, 88, abBody, 511, 513); byte[] abHeaderCompare = new byte[88]; System.arraycopy(abHeader, 12, abHeaderCompare, 0, 88); byte[] abBodyCompare = new byte[513]; System.arraycopy(abBody, 511, abBodyCompare, 0, 513); checkData(p, "set data offset test", abHeaderCompare, abBodyCompare); } public void testHeaderProperties() throws Exception { checkHeaderProperties("header properties test 1", HEADER1, 0, false, 1, true, true, 0L, 0x04030201, 0); checkHeaderProperties("header properties test 2", HEADER2, 0, false, 1, true, false, -1L, 0x04030201, 8); } private void checkHeaderProperties( String strMessage, byte[] abHeader, int nVersionExpected, boolean bContinuedExpected, int nPacketsExpected, boolean bBosExpected, boolean bEosExpected, long lGranulePosExpected, int nSerialNoExpected, int nPageNoExpected) throws Exception { Page p = new Page(); byte[] abData = new byte[12]; p.setData(abHeader, 0, abHeader.length, abData, 0, abData.length); assertEquals(constructErrorMessage(strMessage, "version"), nVersionExpected, p.getVersion()); assertEquals(constructErrorMessage(strMessage, "continued flag"), bContinuedExpected, p.isContinued()); assertEquals(constructErrorMessage(strMessage, "packets"), nPacketsExpected, p.getPackets()); assertEquals(constructErrorMessage(strMessage, "bos flag"), bBosExpected, p.isBos()); assertEquals(constructErrorMessage(strMessage, "eos flag"), bEosExpected, p.isEos()); assertEquals(constructErrorMessage(strMessage, "granulepos"), lGranulePosExpected, p.getGranulePos()); assertEquals(constructErrorMessage(strMessage, "serialno"), nSerialNoExpected, p.getSerialNo()); assertEquals(constructErrorMessage(strMessage, "pageno"), nPageNoExpected, p.getPageNo()); } private void checkData(Page p, String strMessage, byte[] abHeaderExpected, byte[] abBodyExpected) throws Exception { assertTrue(constructErrorMessage(strMessage, "header content"), equals(abHeaderExpected, p.getHeader())); assertTrue(constructErrorMessage(strMessage, "body content"), equals(abBodyExpected, p.getBody())); } private static boolean equals(byte[] b1, byte[] b2) { if (b1 == null && b2 == null) return true; if (b1 != null) return equals(b1, 0, b2, 0, b1.length); return false; } private static boolean equals(byte[] b1, int nOffset1, byte[] b2, int nOffset2, int nLength) { if (b1 == null && b2 == null) return true; if (nOffset1 + nLength > b1.length || nOffset2 + nLength > b2.length) return false; for (int i = 0; i < nLength; i++) { if (b1[nOffset1 + i] != b2[nOffset2 + i]) return false; } return true; } private static String constructErrorMessage(String s1, String s2) { return s1 + ": " + s2; } } /*** PageTestCase.java ***/ libtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/tritonus/sampled/0000755000175000017500000000000010621573060030522 5ustar twernertwernerlibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/tritonus/sampled/file/0000755000175000017500000000000010621573060031441 5ustar twernertwerner././@LongLink0000000000000000000000000000017200000000000011565 Lustar rootrootlibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/tritonus/sampled/file/AuAudioOutputStreamTestCase.javalibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/tritonus/sampled/file/AuAudioOutp0000644000175000017500000000570510374203234033570 0ustar twernertwerner/* * AuAudioOutputStreamTestCase.java */ /* * Copyright (c) 2001 - 2002 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ package org.tritonus.test.tritonus.sampled.file; import javax.sound.sampled.AudioFormat; import org.tritonus.share.sampled.file.AudioOutputStream; import org.tritonus.share.sampled.file.TDataOutputStream; import org.tritonus.sampled.file.AuAudioOutputStream; public class AuAudioOutputStreamTestCase extends BaseAudioOutputStreamTestCase { private static final int EXPECTED_ADDITIONAL_HEADER_LENGTH = 20; public AuAudioOutputStreamTestCase(String strName) { super(strName); } protected AudioOutputStream createAudioOutputStreamImpl( AudioFormat audioFormat, long nLength, TDataOutputStream dataOutputStream) throws Exception { return new AuAudioOutputStream(audioFormat, nLength, dataOutputStream); } /* nLength has to be < 255, or the implementation of this method has to be changed */ protected byte[] getExpectedHeaderData(AudioFormat audioFormat, int nLength, boolean bSeekable, boolean bLengthGiven) { int nSampleRate = (int) audioFormat.getSampleRate(); byte[] abExpectedHeaderData = new byte[]{ 0x2e, 0x73, 0x6e, 0x64, 0, 0, 0, (byte) (24 + getExpectedAdditionalHeaderLength()), 0, 0, 0, 0, // <-- not yet populated 0, 0, 0, getEncoding(audioFormat), 0, (byte) (nSampleRate / 65536), (byte) (nSampleRate / 256), (byte) nSampleRate, 0, 0, 0, (byte) audioFormat.getChannels() }; if (bLengthGiven || bSeekable) { abExpectedHeaderData[11] = (byte) nLength; } else { abExpectedHeaderData[8] = (byte) 0xff; abExpectedHeaderData[9] = (byte) 0xff; abExpectedHeaderData[10] = (byte) 0xff; abExpectedHeaderData[11] = (byte) 0xff; } return abExpectedHeaderData; } private byte getEncoding(AudioFormat format) { // works only for simple cases return (byte)(format.getSampleSizeInBits() / 8 + 1); } protected int getExpectedAdditionalHeaderLength() { return EXPECTED_ADDITIONAL_HEADER_LENGTH; } protected boolean getBigEndian() { return true; } protected boolean is8bitUnsigned() { return false; } } /*** AuAudioOutputStreamTestCase.java ***/ ././@LongLink0000000000000000000000000000017400000000000011567 Lustar rootrootlibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/tritonus/sampled/file/BaseAudioOutputStreamTestCase.javalibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/tritonus/sampled/file/BaseAudioOu0000644000175000017500000001544510374203234033533 0ustar twernertwerner/* * BaseAudioOutputStreamTestCase.java */ /* * Copyright (c) 2001 - 2002 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ package org.tritonus.test.tritonus.sampled.file; import java.io.ByteArrayOutputStream; import java.io.File; import javax.sound.sampled.AudioFormat; import javax.sound.sampled.AudioSystem; import junit.framework.TestCase; import org.tritonus.share.sampled.file.AudioOutputStream; import org.tritonus.share.sampled.file.TDataOutputStream; import org.tritonus.share.sampled.file.TSeekableDataOutputStream; import org.tritonus.share.sampled.file.TNonSeekableDataOutputStream; import org.tritonus.test.Util; /* TEST: - length (not) given/ (not) seekable - illegal cases should throw exception - formats: signed 16 bit signed 24 bit signed 32 bit unsigned 8 bit signed 8 bit? check for exception? always: stereo and mono either big or little, depending on file format - illegal endianess should throw exception */ public abstract class BaseAudioOutputStreamTestCase extends TestCase { private static final boolean DEBUG = true; /** List of sample rates that are used for testing. */ private static final int[] SAMPLE_RATES = { 8000, 11025, 12000, 16000, 22050, 24000, 32000, 44100, 48000, 96000, 192000 }; /** List of sample sizes that are used for testing. */ private static final int[] SAMPLE_SIZES = { 8, 16, 24, 32 }; /** List of (number of) channels that are used for testing. */ private static final int[] CHANNEL_COUNTS = {1, 2}; private File m_file; private ByteArrayOutputStream m_baos; public BaseAudioOutputStreamTestCase(String strName) { super(strName); } // non-seekable, given length public void testAOS1() throws Exception { doTest(false, true); } // non-seekable, unknown length public void testAOS2() throws Exception { doTest(false, false); } // seekable, given length public void testAOS3() throws Exception { doTest(true, true); } // seekable, unknown length public void testAOS4() throws Exception { doTest(true, false); } private void doTest(boolean bSeekable, boolean bLengthGiven) throws Exception { for (int nSampleRateIndex = 0; nSampleRateIndex < SAMPLE_RATES.length; nSampleRateIndex++) { if (DEBUG) out("sample rate: " + SAMPLE_RATES[nSampleRateIndex]); for (int nSampleSizeIndex = 0; nSampleSizeIndex < SAMPLE_SIZES.length; nSampleSizeIndex++) { if (DEBUG) out("sample size: " + SAMPLE_SIZES[nSampleSizeIndex]); for (int nChannelCountIndex = 0; nChannelCountIndex < CHANNEL_COUNTS.length; nChannelCountIndex++) { if (DEBUG) out("sample size: " + CHANNEL_COUNTS[nChannelCountIndex]); boolean bSigned = ! (SAMPLE_SIZES[nSampleSizeIndex] == 8 && is8bitUnsigned()); AudioFormat audioFormat = new AudioFormat( SAMPLE_RATES[nSampleRateIndex], SAMPLE_SIZES[nSampleSizeIndex], CHANNEL_COUNTS[nChannelCountIndex], bSigned, getBigEndian()); if (DEBUG) out("AudioFormat: " + audioFormat); doTest(audioFormat, bSeekable, bLengthGiven); } } } } private void doTest(AudioFormat audioFormat, boolean bSeekable, boolean bLengthGiven) throws Exception { byte[] abData = createAudioData(audioFormat.getFrameSize()); int nStatedLength = 0; if (bLengthGiven) { nStatedLength = abData.length; } else { nStatedLength = AudioSystem.NOT_SPECIFIED; } AudioOutputStream aos = createAudioOutputStream(audioFormat, nStatedLength, bSeekable); aos.write(abData, 0, abData.length); aos.close(); byte[] abExpectedHeaderData = getExpectedHeaderData(audioFormat, abData.length, bSeekable, bLengthGiven); byte[] abResultingData = getWrittenData(bSeekable); if (DEBUG) { out("expected:"); Util.dumpByteArray(abExpectedHeaderData); out("actual:"); Util.dumpByteArray(abResultingData); } boolean bHeaderDataOk = Util.compareByteArrays(abExpectedHeaderData, 0, abResultingData, 0, abExpectedHeaderData.length); if (DEBUG) out("headerok: " + bHeaderDataOk); assertTrue("header data", bHeaderDataOk); assertTrue("audio data", Util.compareByteArrays(abData, 0, abResultingData, abExpectedHeaderData.length + getExpectedAdditionalHeaderLength(), abData.length)); if (m_file != null) { m_file.delete(); m_file = null; } } private byte[] createAudioData(int nFrameSize) { byte[] abData = new byte[8 * nFrameSize]; for (int i = 0; i < abData.length; i++) { abData[i] = (byte) i; } return abData; } private TDataOutputStream createDataOutputStream(boolean bSeekable) throws Exception { TDataOutputStream dataOutputStream; if (bSeekable) { m_file = File.createTempFile("aos", "au"); dataOutputStream = new TSeekableDataOutputStream(m_file); } else { m_baos = new ByteArrayOutputStream(); dataOutputStream = new TNonSeekableDataOutputStream(m_baos); } return dataOutputStream; } private AudioOutputStream createAudioOutputStream( AudioFormat audioFormat, long nLength, boolean bSeekable) throws Exception { TDataOutputStream dataOutputStream = createDataOutputStream(bSeekable); return createAudioOutputStreamImpl(audioFormat, nLength, dataOutputStream); } protected abstract AudioOutputStream createAudioOutputStreamImpl( AudioFormat audioFormat, long nLength, TDataOutputStream dataOutputStream) throws Exception; private byte[] getWrittenData(boolean bSeekable) throws Exception { byte[] abResultingData = null; if (bSeekable) { abResultingData = Util.getByteArrayFromFile(m_file); } else { abResultingData = m_baos.toByteArray(); } return abResultingData; } protected abstract byte[] getExpectedHeaderData(AudioFormat audioFormat, int nLength, boolean bSeekable, boolean bLengthGiven); protected abstract int getExpectedAdditionalHeaderLength(); protected abstract boolean getBigEndian(); protected abstract boolean is8bitUnsigned(); protected void out(String strMessage) { System.out.println(strMessage); } } /*** BaseAudioOutputStreamTestCase.java ***/ ././@LongLink0000000000000000000000000000017400000000000011567 Lustar rootrootlibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/tritonus/sampled/file/WaveAudioOutputStreamTestCase.javalibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/tritonus/sampled/file/WaveAudioOu0000644000175000017500000000653510374203234033563 0ustar twernertwerner/* * WaveAudioOutputStreamTestCase.java */ /* * Copyright (c) 2001 - 2002 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ package org.tritonus.test.tritonus.sampled.file; import javax.sound.sampled.AudioFormat; import org.tritonus.share.sampled.file.AudioOutputStream; import org.tritonus.share.sampled.file.TDataOutputStream; import org.tritonus.sampled.file.WaveAudioOutputStream; public class WaveAudioOutputStreamTestCase extends BaseAudioOutputStreamTestCase { private static final int EXPECTED_ADDITIONAL_HEADER_LENGTH = 0; public WaveAudioOutputStreamTestCase(String strName) { super(strName); } protected AudioOutputStream createAudioOutputStreamImpl( AudioFormat audioFormat, long nLength, TDataOutputStream dataOutputStream) throws Exception { return new WaveAudioOutputStream(audioFormat, nLength, dataOutputStream); } /* nLength has to be < 255, or the implementation of this method has to be changed */ protected byte[] getExpectedHeaderData(AudioFormat audioFormat, int nLength, boolean bSeekable, boolean bLengthGiven) { int nTotalLength = 38 + nLength; int nSampleRate = (int) audioFormat.getSampleRate(); int nBytesPerSecond = nSampleRate * audioFormat.getFrameSize(); byte[] abExpectedHeaderData = new byte[]{ 0x52, 0x49, 0x46, 0x46, (byte) nTotalLength, 0, 0, 0, 0x57, 0x41, 0x56, 0x45, 0x66, 0x6d, 0x74, 0x20, 18, 0, 0, 0, 1, 0, (byte) audioFormat.getChannels(), 0, (byte) nSampleRate, (byte) (nSampleRate / 256), (byte) (nSampleRate / 65536), 0, (byte) nBytesPerSecond, (byte) (nBytesPerSecond / 256), (byte) (nBytesPerSecond / 65536), 0, (byte) audioFormat.getFrameSize(), 0, (byte) audioFormat.getSampleSizeInBits(), 0, 0, 0, 0x64, 0x61, 0x74, 0x61, (byte) nLength, (byte) (nLength / 256), (byte) (nLength / 65536), 0, }; // if (bLengthGiven || bSeekable) // { // abExpectedHeaderData[11] = (byte) nLength; // } // else // { // abExpectedHeaderData[8] = (byte) 0xff; // abExpectedHeaderData[9] = (byte) 0xff; // abExpectedHeaderData[10] = (byte) 0xff; // abExpectedHeaderData[11] = (byte) 0xff; // } return abExpectedHeaderData; } private byte getEncoding(AudioFormat format) { // works only for simple cases return (byte)(format.getSampleSizeInBits() / 8 + 1); } protected int getExpectedAdditionalHeaderLength() { return EXPECTED_ADDITIONAL_HEADER_LENGTH; } protected boolean getBigEndian() { return false; } protected boolean is8bitUnsigned() { return true; } } /*** WaveAudioOutputStreamTestCase.java ***/ libtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/tritonus/share/0000755000175000017500000000000010621573061030200 5ustar twernertwernerlibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/tritonus/share/midi/0000755000175000017500000000000010621573060031121 5ustar twernertwerner././@LongLink0000000000000000000000000000016700000000000011571 Lustar rootrootlibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/tritonus/share/midi/TDirectSynthesizerTestCase.javalibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/tritonus/share/midi/TDirectSynthe0000644000175000017500000002314610377041714033607 0ustar twernertwerner/* * TDirectSynthesizerTestCase.java */ /* * Copyright (c) 2003 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ package org.tritonus.test.tritonus.share.midi; import junit.framework.TestCase; import javax.sound.midi.Synthesizer; import javax.sound.midi.Instrument; import javax.sound.midi.Patch; import javax.sound.midi.Soundbank; import javax.sound.midi.MidiChannel; import javax.sound.midi.VoiceStatus; import javax.sound.midi.Receiver; import javax.sound.midi.ShortMessage; //import javax.sound.midi.MidiMessage; import org.tritonus.share.midi.TDirectSynthesizer; public class TDirectSynthesizerTestCase extends TestCase { public TDirectSynthesizerTestCase(String strName) { super(strName); } public void testNoteOn() throws Exception { checkMessage2(Type.NOTEON); } public void testNoteOff() throws Exception { checkMessage2(Type.NOTEOFF); } public void testPolyPressure() throws Exception { checkMessage2(Type.POLY_PRESSURE); } public void testControlChange() throws Exception { checkMessage2(Type.CONTROL_CHANGE); } public void testProgramChange() throws Exception { checkMessage1(Type.PROGRAM); } public void testChannelPressure() throws Exception { checkMessage1(Type.CHANNEL_PRESSURE); } public void testPitchbend() throws Exception { Synthesizer synth = new TestSynthesizer(); synth.open(); TestSynthesizer.TestChannel[] channels = (TestSynthesizer.TestChannel[]) synth.getChannels(); try { Receiver r = synth.getReceiver(); checkPitchbend(channels, r, 0, 0); checkPitchbend(channels, r, 5, 127); checkPitchbend(channels, r, 7, 128); checkPitchbend(channels, r, 15, 16383); } finally { synth.close(); } } private void checkPitchbend(TestSynthesizer.TestChannel[] channels, Receiver r, int nChannel, int nBend) throws Exception { Type type = Type.PITCHBEND; ShortMessage shMsg = new ShortMessage(); shMsg.setMessage(type.getCommand(), nChannel, nBend & 0x7F, nBend >> 7); resetResults(channels); r.send(shMsg, -1); checkResult(channels, nChannel, type, nBend, -1); } /** * * @param bOn if true, note on is tested. If false, note off is tested. * @throws Exception */ private void checkMessage2(Type type) throws Exception { Synthesizer synth = new TestSynthesizer(); synth.open(); TestSynthesizer.TestChannel[] channels = (TestSynthesizer.TestChannel[]) synth.getChannels(); try { Receiver r = synth.getReceiver(); checkMessage(type, channels, r, 0, 17, 55); checkMessage(type, channels, r, 15, 0, 0); checkMessage(type, channels, r, 5, 127, 127); } finally { synth.close(); } } /** * * @param type * @throws Exception */ private void checkMessage1(Type type) throws Exception { Synthesizer synth = new TestSynthesizer(); synth.open(); TestSynthesizer.TestChannel[] channels = (TestSynthesizer.TestChannel[]) synth.getChannels(); try { Receiver r = synth.getReceiver(); checkMessage(type, channels, r, 0, 57, 0); checkMessage(type, channels, r, 15, 0, 0); checkMessage(type, channels, r, 5, 127, 0); } finally { synth.close(); } } private void checkMessage(Type type, TestSynthesizer.TestChannel[] channels, Receiver r, int nChannel, int nValue1, int nValue2) throws Exception { ShortMessage shMsg = new ShortMessage(); shMsg.setMessage(type.getCommand(), nChannel, nValue1, nValue2); resetResults(channels); r.send(shMsg, -1); checkResult(channels, nChannel, type, nValue1, nValue2); } private void resetResults(TestSynthesizer.TestChannel[] channels) { for (int i = 0; i < channels.length; i++) { channels[i].resetValues(); } } private void checkResult(TestSynthesizer.TestChannel[] channels, int channel, Type type, int value1, int value2) { for (int i = 0; i < channels.length; i++) { TestSynthesizer.TestChannel ch = channels[i]; if (i == channel) { assertEquals("affected channel: type", type, ch.getType()); assertEquals("affected channel: value1", value1, ch.getValue1()); assertEquals("affected channel: value2", value2, ch.getValue2()); } else { assertEquals("unaffected channel: type", Type.NONE, ch.getType()); assertEquals("unaffected channel: value1", -1, ch.getValue1()); assertEquals("unaffected channel: value2", -1, ch.getValue2()); } } } private static class TestSynthesizer extends TDirectSynthesizer { private MidiChannel[] m_channels; public TestSynthesizer() { // no MidiDevice.Info super(null); m_channels = new TestChannel[16]; for (int i = 0; i < 16; i++) { m_channels[i] = new TestChannel(i); } } public int getMaxPolyphony() { return 16; } public long getLatency() { return 0; } public MidiChannel[] getChannels() { return m_channels; } public VoiceStatus[] getVoiceStatus() { return null; } public boolean isSoundbankSupported(Soundbank soundbank) { return false; } public boolean loadInstrument(Instrument instrument) { return false; } public void unloadInstrument(Instrument instrument) { } public boolean remapInstrument(Instrument from, Instrument to) { return false; } public Soundbank getDefaultSoundbank() { return null; } public Instrument[] getAvailableInstruments() { return null; } public Instrument[] getLoadedInstruments() { return null; } public boolean loadAllInstruments(Soundbank soundbank) { return false; } public void unloadAllInstruments(Soundbank soundbank) { } public boolean loadInstruments(Soundbank soundbank, Patch[] patchList) { return false; } public void unloadInstruments(Soundbank soundbank, Patch[] patchList) { } public class TestChannel implements MidiChannel { private Type m_nType; private int m_nValue1; private int m_nValue2; public TestChannel(int nChannel) { } public void resetValues() { m_nType = Type.NONE; m_nValue1 = -1; m_nValue2 = -1; } public Type getType() { return m_nType; } public int getValue1() { return m_nValue1; } public int getValue2() { return m_nValue2; } public void allNotesOff() { } public void allSoundOff() { } public void controlChange(int nController, int nValue) { m_nType = Type.CONTROL_CHANGE; m_nValue1 = nController; m_nValue2 = nValue; } public int getChannelPressure() { return 0; } public int getController(int nController) { return 0; } public boolean getMono() { return false; } public boolean getMute() { return false; } public boolean getOmni() { return false; } public int getPitchBend() { return 0; } public int getPolyPressure(int nNoteNumber) { return 0; } public int getProgram() { return 0; } public boolean getSolo() { return false; } public boolean localControl(boolean bOn) { return false; } public void noteOff(int nNoteNumber, int nVelocity) { m_nType = Type.NOTEOFF; m_nValue1 = nNoteNumber; m_nValue2 = nVelocity; } public void noteOff(int nNoteNumber) { } public void noteOn(int nNoteNumber, int nVelocity) { m_nType = Type.NOTEON; m_nValue1 = nNoteNumber; m_nValue2 = nVelocity; } public void programChange(int nBank, int nProgram) { m_nType = Type.BANK_PROGRAM; m_nValue1 = nBank; m_nValue2 = nProgram; } public void programChange(int nProgram) { m_nType = Type.PROGRAM; m_nValue1 = nProgram; m_nValue2 = 0; } public void resetAllControllers() { } public void setChannelPressure(int nPressure) { m_nType = Type.CHANNEL_PRESSURE; m_nValue1 = nPressure; m_nValue2 = 0; } public void setMono(boolean bMono) { } public void setMute(boolean bMute) { } public void setOmni(boolean bOmni) { } public void setPitchBend(int nBend) { m_nType = Type.PITCHBEND; m_nValue1 = nBend; } public void setPolyPressure(int nNoteNumber, int nPressure) { m_nType = Type.POLY_PRESSURE; m_nValue1 = nNoteNumber; m_nValue2 = nPressure; } public void setSolo(boolean bSolo) { } } } public static enum Type { NONE, CONTROL_CHANGE(ShortMessage.CONTROL_CHANGE), NOTEON(ShortMessage.NOTE_ON), NOTEOFF(ShortMessage.NOTE_OFF), PROGRAM(ShortMessage.PROGRAM_CHANGE), BANK_PROGRAM(ShortMessage.PROGRAM_CHANGE), PITCHBEND(ShortMessage.PITCH_BEND), POLY_PRESSURE(ShortMessage.POLY_PRESSURE), CHANNEL_PRESSURE(ShortMessage.CHANNEL_PRESSURE); private int m_nCommand; private Type() { this(0); } private Type(int nCommand) { m_nCommand = nCommand; } public int getCommand() { return m_nCommand; } } } /*** TDirectSynthesizerTestCase.java ***/ ././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootlibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/tritonus/share/midi/TMidiChannelTestCase.javalibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/tritonus/share/midi/TMidiChannelT0000644000175000017500000001622110375317730033477 0ustar twernertwerner/* * TDirectSynthesizerTestCase.java */ /* * Copyright (c) 2003 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ package org.tritonus.test.tritonus.share.midi; import junit.framework.TestCase; import org.tritonus.share.midi.TMidiChannel; public class TMidiChannelTestCase extends TestCase { public TMidiChannelTestCase(String strName) { super(strName); } public void testChannelNumber() { int CHANNEL = 19; TestMidiChannel channel = new TestMidiChannel(CHANNEL); assertEquals("channel number", CHANNEL, channel.getChannelNumber()); } public void testNoteOff() { TestMidiChannel channel = new TestMidiChannel(0); int KEY; channel.resetCachedValues(); KEY = 0; channel.noteOff(KEY); assertEquals("noteOff() key", KEY, channel.getNoteOffKey()); assertEquals("noteOff() velocity", 0, channel.getNoteOffVelocity()); channel.resetCachedValues(); KEY = 11; channel.noteOff(KEY); assertEquals("noteOff() key", KEY, channel.getNoteOffKey()); assertEquals("noteOff() velocity", 0, channel.getNoteOffVelocity()); channel.resetCachedValues(); KEY = 127; channel.noteOff(KEY); assertEquals("noteOff() key", KEY, channel.getNoteOffKey()); assertEquals("noteOff() velocity", 0, channel.getNoteOffVelocity()); } public void testProgramChange() { TestMidiChannel channel = new TestMidiChannel(0); doTestProgramChange(channel, 0, 0, 0); doTestProgramChange(channel, 127, 127, 127); } private void doTestProgramChange(TestMidiChannel channel, int nBankHigh, int nBankLow, int nProgram) { channel.resetCachedValues(); int nBank = (nBankHigh << 7) | nBankLow; channel.programChange(nBank, nProgram); System.out.println("(c)" + channel.getSetControllerNumber()); System.out.println("(v)" + channel.getSetControllerValue()); System.out.println("(c2)" + channel.getSetControllerNumber2()); System.out.println("(v2)" + channel.getSetControllerValue2()); assertEquals("programChange() bank high (c)", 0, channel.getSetControllerNumber()); assertEquals("programChange() bank high (v)", nBankHigh, channel.getSetControllerValue()); assertEquals("programChange() bank low (c)", 32, channel.getSetControllerNumber2()); assertEquals("programChange() bank low (v)", nBankLow, channel.getSetControllerValue2()); assertEquals("programChange() program", nProgram, channel.getProgramChangeValue()); } public void testResetAllControllers() { TestMidiChannel channel = new TestMidiChannel(0); channel.resetAllControllers(); assertEquals("resetAllControllers(): controller", 121, channel.getSetControllerNumber()); assertEquals("resetAllControllers(): value", 0, channel.getSetControllerValue()); } public void testAllNotesOff() { TestMidiChannel channel = new TestMidiChannel(0); channel.allNotesOff(); assertEquals("allNotesOff(): controller", 123, channel.getSetControllerNumber()); assertEquals("allNotesOff(): value", 0, channel.getSetControllerValue()); } public void testAllSoundOff() { TestMidiChannel channel = new TestMidiChannel(0); channel.allSoundOff(); assertEquals("allSoundOff(): controller", 120, channel.getSetControllerNumber()); assertEquals("allSoundOff(): value", 0, channel.getSetControllerValue()); } public void testLocalControl() { TestMidiChannel channel = new TestMidiChannel(0); channel.localControl(true); assertEquals("localControl(true): controller", 122, channel.getSetControllerNumber()); assertEquals("localControl(true): value", 127, channel.getSetControllerValue()); channel.resetCachedValues(); channel.localControl(false); assertEquals("localControl(false): controller", 122, channel.getSetControllerNumber()); assertEquals("localControl(false): value", 0, channel.getSetControllerValue()); } private static class TestMidiChannel extends TMidiChannel { private int m_nNoteOffKey; private int m_nNoteOffVelocity; private int m_nSetControllerNumber; private int m_nSetControllerValue; private int m_nSetControllerNumber2; private int m_nSetControllerValue2; private int m_nGetControllerNumber; private int m_nProgramChangeValue; public TestMidiChannel(int nChannel) { super(nChannel); resetCachedValues(); } /** * Used to obtain the return value of the protected super class method. * @return */ public int getChannelNumber() { return getChannel(); } public void resetCachedValues() { m_nNoteOffKey = -1; m_nNoteOffVelocity = -1; m_nSetControllerNumber = -1; m_nSetControllerValue = -1; m_nSetControllerNumber2 = -1; m_nSetControllerValue2 = -1; m_nGetControllerNumber = -1; m_nProgramChangeValue = -1; } public int getNoteOffKey() { return m_nNoteOffKey; } public int getNoteOffVelocity() { return m_nNoteOffVelocity; } public int getSetControllerNumber() { return m_nSetControllerNumber; } public int getSetControllerValue() { return m_nSetControllerValue; } public int getSetControllerNumber2() { return m_nSetControllerNumber2; } public int getSetControllerValue2() { return m_nSetControllerValue2; } public int getProgramChangeValue() { return m_nProgramChangeValue; } /** * Records the passed values. */ public void controlChange(int nController, int nValue) { System.out.println("CC: " + nController + ": " + nValue); if (m_nSetControllerNumber != -1) { m_nSetControllerNumber2 = nController; m_nSetControllerValue2 = nValue; } else { m_nSetControllerNumber = nController; m_nSetControllerValue = nValue; } } public int getChannelPressure() { return 0; } public int getController(int nController) { return 0; } public boolean getMute() { return false; } public int getPitchBend() { return 0; } public int getPolyPressure(int nNoteNumber) { return 0; } public int getProgram() { return 0; } public boolean getSolo() { return false; } public void noteOff(int nNoteNumber, int nVelocity) { m_nNoteOffKey = nNoteNumber; m_nNoteOffVelocity = nVelocity; } public void noteOn(int nNoteNumber, int nVelocity) { } public void programChange(int nProgram) { m_nProgramChangeValue = nProgram; } public void setChannelPressure(int nPressure) { } public void setMute(boolean bMute) { } public void setPitchBend(int nBend) { } public void setPolyPressure(int nNoteNumber, int nPressure) { } public void setSolo(boolean bSolo) { } } } /*** TDirectSynthesizerTestCase.java ***/ libtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/tritonus/share/sampled/0000755000175000017500000000000010621573061031625 5ustar twernertwernerlibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/tritonus/share/sampled/file/0000755000175000017500000000000010621573061032544 5ustar twernertwerner././@LongLink0000000000000000000000000000020100000000000011556 Lustar rootrootlibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/tritonus/share/sampled/file/BaseDataOutputStreamTestCase.javalibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/tritonus/share/sampled/file/BaseD0000644000175000017500000000463610374203234033453 0ustar twernertwerner/* * BaseDataOutputStreamTestCase.java */ /* * Copyright (c) 2001 - 2004 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ package org.tritonus.test.tritonus.share.sampled.file; import junit.framework.TestCase; import org.tritonus.share.sampled.file.TDataOutputStream; import org.tritonus.test.Util; public abstract class BaseDataOutputStreamTestCase extends TestCase { private boolean m_bSeekable; protected BaseDataOutputStreamTestCase(String strName, boolean bSeekable) { super(strName); m_bSeekable = bSeekable; } protected abstract TDataOutputStream createDataOutputStream() throws Exception; protected abstract byte[] getWrittenData() throws Exception; public void testWriting() throws Exception { TDataOutputStream dataOutputStream = createDataOutputStream(); checkTDataOutputStream(dataOutputStream); byte[] abResultingData = getWrittenData(); // Util.dumpByteArray(abResultingData); checkTDataOutputStream2(abResultingData); } public void testSupportsSeek() throws Exception { TDataOutputStream dataOutputStream = createDataOutputStream(); assertEquals("seekability", m_bSeekable, dataOutputStream.supportsSeek()); } private void checkTDataOutputStream(TDataOutputStream dataOutputStream) throws Exception { dataOutputStream.writeLittleEndian32(0x12345678); dataOutputStream.writeLittleEndian16((short) 0x2345); dataOutputStream.close(); } private void checkTDataOutputStream2(byte[] abResultingData) throws Exception { byte[] abExpectedData = new byte[]{0x78, 0x56, 0x34, 0x12, 0x45, 0x23}; assertTrue(Util.compareByteArrays(abExpectedData, 0, abResultingData, 0, abExpectedData.length)); } } /*** BaseDataOutputStreamTestCase.java ***/ ././@LongLink0000000000000000000000000000021100000000000011557 Lustar rootrootlibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/tritonus/share/sampled/file/TNonSeekableDataOutputStreamTestCase.javalibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/tritonus/share/sampled/file/TNonS0000644000175000017500000000314410374203234033467 0ustar twernertwerner/* * TNonSeekableDataOutputStreamTestCase.java */ /* * Copyright (c) 2004 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ package org.tritonus.test.tritonus.share.sampled.file; import java.io.ByteArrayOutputStream; import org.tritonus.share.sampled.file.TNonSeekableDataOutputStream; import org.tritonus.share.sampled.file.TDataOutputStream; public class TNonSeekableDataOutputStreamTestCase extends BaseDataOutputStreamTestCase { ByteArrayOutputStream m_baos; public TNonSeekableDataOutputStreamTestCase(String strName) { super(strName, false); // non seekable } protected TDataOutputStream createDataOutputStream() throws Exception { m_baos = new ByteArrayOutputStream(); return new TNonSeekableDataOutputStream(m_baos); } protected byte[] getWrittenData() throws Exception { return m_baos.toByteArray(); } } /*** TNonSeekableDataOutputStreamTestCase.java ***/ ././@LongLink0000000000000000000000000000020600000000000011563 Lustar rootrootlibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/tritonus/share/sampled/file/TSeekableDataOutputStreamTestCase.javalibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/tritonus/share/sampled/file/TSeek0000644000175000017500000000315110374203234033477 0ustar twernertwerner/* * TSeekableDataOutputStreamTestCase.java */ /* * Copyright (c) 2004 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ package org.tritonus.test.tritonus.share.sampled.file; import java.io.File; import org.tritonus.share.sampled.file.TSeekableDataOutputStream; import org.tritonus.share.sampled.file.TDataOutputStream; import org.tritonus.test.Util; public class TSeekableDataOutputStreamTestCase extends BaseDataOutputStreamTestCase { private File m_file; public TSeekableDataOutputStreamTestCase(String strName) { super(strName, true); // seekable } protected TDataOutputStream createDataOutputStream() throws Exception { m_file = new File("/tmp/dataoutputstream.tmp"); return new TSeekableDataOutputStream(m_file); } protected byte[] getWrittenData() throws Exception { return Util.getByteArrayFromFile(m_file); } } /*** TSeekableDataOutputStreamTestCase.java ***/ ././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootlibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/tritonus/share/sampled/AudioSystemShadowTestCase.javalibtritonus-java-20070428/test/suite/src/classes/org/tritonus/test/tritonus/share/sampled/AudioSyste0000644000175000017500000000533310374203234033642 0ustar twernertwerner/* * AudioSystemShadowTestCase.java */ /* * Copyright (c) 2001 - 2002 by Matthias Pfisterer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published * by the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ package org.tritonus.test.tritonus.share.sampled; import java.io.ByteArrayOutputStream; import java.io.File; import junit.framework.TestCase; import org.tritonus.share.sampled.AudioSystemShadow; import org.tritonus.share.sampled.file.TDataOutputStream; import org.tritonus.test.Util; public class AudioSystemShadowTestCase extends TestCase { public AudioSystemShadowTestCase(String strName) { super(strName); } public void testGetDataOutputStreamFile() throws Exception { File file = new File("/tmp/dataoutputstream.tmp"); TDataOutputStream dataOutputStream = AudioSystemShadow.getDataOutputStream(file); checkTDataOutputStream(dataOutputStream, true); byte[] abResultingData = Util.getByteArrayFromFile(file); // Util.dumpByteArray(abResultingData); checkTDataOutputStream2(abResultingData); } public void testGetDataOutputStreamOutputStream() throws Exception { ByteArrayOutputStream baos = new ByteArrayOutputStream(); TDataOutputStream dataOutputStream = AudioSystemShadow.getDataOutputStream(baos); checkTDataOutputStream(dataOutputStream, false); byte[] abResultingData = baos.toByteArray(); // Util.dumpByteArray(abResultingData); checkTDataOutputStream2(abResultingData); } private void checkTDataOutputStream(TDataOutputStream dataOutputStream, boolean bSeekable) throws Exception { assertNotNull(dataOutputStream); assertEquals("seekable", bSeekable, dataOutputStream.supportsSeek()); dataOutputStream.writeLittleEndian32(0x12345678); dataOutputStream.writeLittleEndian16((short) 0x2345); dataOutputStream.close(); } private void checkTDataOutputStream2(byte[] abResultingData) throws Exception { byte[] abExpectedData = new byte[]{0x78, 0x56, 0x34, 0x12, 0x45, 0x23}; assertTrue("data ok", Util.compareByteArrays(abExpectedData, 0, abResultingData, 0, abExpectedData.length)); } } /*** AudioSystemShadowTestCase.java ***/ libtritonus-java-20070428/util/0000755000175000017500000000000010621573070016173 5ustar twernertwernerlibtritonus-java-20070428/util/config.guess0000755000175000017500000012744010400142275020515 0ustar twernertwerner#! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. timestamp='2005-05-27' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA # 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Per Bothner . # Please send patches to . Submit a context # diff and a properly formatted ChangeLog entry. # # This script attempts to guess a canonical system name similar to # config.sub. If it succeeds, it prints the system name on stdout, and # exits with 0. Otherwise, it exits with 1. # # The plan is that this can be called by configure scripts if you # don't specify an explicit build system type. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi trap 'exit 1' 1 2 15 # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. set_cc_for_build=' trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; : ${TMPDIR=/tmp} ; { tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; dummy=$tmp/dummy ; tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int x;" > $dummy.c ; for c in cc gcc c89 c99 ; do if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown if [ "${UNAME_SYSTEM}" = "Linux" ] ; then eval $set_cc_for_build cat << EOF > $dummy.c #include #ifdef __UCLIBC__ # ifdef __UCLIBC_CONFIG_VERSION__ LIBC=uclibc __UCLIBC_CONFIG_VERSION__ # else LIBC=uclibc # endif #else LIBC=gnu #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep LIBC= | sed -e 's: ::g'` fi # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ /usr/sbin/$sysctl 2>/dev/null || echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE_ARCH}" in arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep __ELF__ >/dev/null then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case "${UNAME_VERSION}" in Debian*) release='-gnu' ;; *) release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit ;; amd64:OpenBSD:*:*) echo x86_64-unknown-openbsd${UNAME_RELEASE} exit ;; amiga:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit ;; cats:OpenBSD:*:*) echo arm-unknown-openbsd${UNAME_RELEASE} exit ;; hp300:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit ;; luna88k:OpenBSD:*:*) echo m88k-unknown-openbsd${UNAME_RELEASE} exit ;; mac68k:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit ;; macppc:OpenBSD:*:*) echo powerpc-unknown-openbsd${UNAME_RELEASE} exit ;; mvme68k:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit ;; mvme88k:OpenBSD:*:*) echo m88k-unknown-openbsd${UNAME_RELEASE} exit ;; mvmeppc:OpenBSD:*:*) echo powerpc-unknown-openbsd${UNAME_RELEASE} exit ;; sgi:OpenBSD:*:*) echo mips64-unknown-openbsd${UNAME_RELEASE} exit ;; sun3:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit ;; *:OpenBSD:*:*) echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE} exit ;; *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} exit ;; macppc:MirBSD:*:*) echo powerppc-unknown-mirbsd${UNAME_RELEASE} exit ;; *:MirBSD:*:*) echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") UNAME_MACHINE="alpha" ;; "EV4.5 (21064)") UNAME_MACHINE="alpha" ;; "LCA4 (21066/21068)") UNAME_MACHINE="alpha" ;; "EV5 (21164)") UNAME_MACHINE="alphaev5" ;; "EV5.6 (21164A)") UNAME_MACHINE="alphaev56" ;; "EV5.6 (21164PC)") UNAME_MACHINE="alphapca56" ;; "EV5.7 (21164PC)") UNAME_MACHINE="alphapca57" ;; "EV6 (21264)") UNAME_MACHINE="alphaev6" ;; "EV6.7 (21264A)") UNAME_MACHINE="alphaev67" ;; "EV6.8CB (21264C)") UNAME_MACHINE="alphaev68" ;; "EV6.8AL (21264B)") UNAME_MACHINE="alphaev68" ;; "EV6.8CX (21264D)") UNAME_MACHINE="alphaev68" ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE="alphaev69" ;; "EV7 (21364)") UNAME_MACHINE="alphaev7" ;; "EV7.9 (21364A)") UNAME_MACHINE="alphaev79" ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` exit ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix exit ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-morphos exit ;; *:OS/390:*:*) echo i370-ibm-openedition exit ;; *:z/VM:*:*) echo s390-ibm-zvmoe exit ;; *:OS400:*:*) echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit ;; arm:riscos:*:*|arm:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 exit ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7; exit ;; esac ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; i86pc:SunOS:5.*:*) echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} ;; sun4) echo sparc-sun-sunos${UNAME_RELEASE} ;; esac exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit ;; m68k:machten:*:*) echo m68k-apple-machten${UNAME_RELEASE} exit ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && SYSTEM_NAME=`$dummy $dummyarg` && { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos${UNAME_RELEASE} exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ [ ${TARGET_BINARY_INTERFACE}x = x ] then echo m88k-dg-dgux${UNAME_RELEASE} else echo m88k-dg-dguxbcs${UNAME_RELEASE} fi else echo i586-dg-dgux${UNAME_RELEASE} fi exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` then echo "$SYSTEM_NAME" else echo rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit ;; *:AIX:*:[45]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit ;; *:AIX:*:*) echo rs6000-ibm-aix exit ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in 32) HP_ARCH="hppa2.0n" ;; 64) HP_ARCH="hppa2.0w" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 esac ;; esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if [ ${HP_ARCH} = "hppa2.0w" ] then # avoid double evaluation of $set_cc_for_build test -n "$CC_FOR_BUILD" || eval $set_cc_for_build # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler # generating 64-bit code. GNU and HP use different nomenclature: # # $ CC_FOR_BUILD=cc ./config.guess # => hppa2.0w-hp-hpux11.23 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | grep __LP64__ >/dev/null then HP_ARCH="hppa2.0w" else HP_ARCH="hppa64" fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} exit ;; 3050*:HI-UX:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; *:UNICOS/mp:*:*) echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit ;; *:FreeBSD:*:*) echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit ;; i*:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; i*:windows32*:*) # uname -m includes "-pc" on this system. echo ${UNAME_MACHINE}-mingw32 exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit ;; x86:Interix*:[34]*) echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//' exit ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks exit ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i586-pc-interix exit ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit ;; amd64:CYGWIN*:*:*) echo x86_64-unknown-cygwin exit ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; *:GNU:*:*) # the GNU system echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; arm*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; cris:Linux:*:*) echo cris-axis-linux-${LIBC} exit ;; crisv32:Linux:*:*) echo crisv32-axis-linux-${LIBC} exit ;; frv:Linux:*:*) echo frv-unknown-linux-${LIBC} exit ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; m32r*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; mips:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef mips #undef mipsel #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=mipsel #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=mips #else CPU= #endif #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; } ;; mips64:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef mips64 #undef mips64el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=mips64el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=mips64 #else CPU= #endif #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; } ;; ppc:Linux:*:*) echo powerpc-unknown-linux-${LIBC} exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-${LIBC} exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null if test "$?" = 0 ; then LIBC="gnulibc1" ; fi echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-${LIBC} ;; PA8*) echo hppa2.0-unknown-linux-${LIBC} ;; *) echo hppa-unknown-linux-${LIBC} ;; esac exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-${LIBC} exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux exit ;; sh64*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; x86_64:Linux:*:*) echo x86_64-unknown-linux-${LIBC} exit ;; i*86:Linux:*:*) # The BFD linker knows what the default object file format is, so # first see if it will tell us. cd to the root directory to prevent # problems with other programs or directories called `ld' in the path. # Set LC_ALL=C to ensure ld outputs messages in English. ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ | sed -ne '/supported targets:/!d s/[ ][ ]*/ /g s/.*supported targets: *// s/ .*// p'` case "$ld_supported_targets" in elf32-i386) TENTATIVE="${UNAME_MACHINE}-pc-linux-${LIBC}" ;; a.out-i386-linux) echo "${UNAME_MACHINE}-pc-linux-${LIBC}aout" exit ;; coff-i386) echo "${UNAME_MACHINE}-pc-linux-${LIBC}coff" exit ;; "") # Either a pre-BFD a.out linker (linux-gnuoldld) or # one that does not give us useful --help. echo "${UNAME_MACHINE}-pc-linux-${LIBC}oldld" exit ;; esac if [ "$LIBC" != "gnu" ] ; then echo "$TENTATIVE" && exit 0 ; fi # Determine whether the default compiler is a.out or elf eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include #ifdef __ELF__ # ifdef __GLIBC__ # if __GLIBC__ >= 2 LIBC=gnu # else LIBC=gnulibc1 # endif # else LIBC=gnulibc1 # endif #else #ifdef __INTEL_COMPILER LIBC=gnu #else LIBC=gnuaout #endif #endif #ifdef __dietlibc__ LIBC=dietlibc #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` test x"${LIBC}" != x && { echo "${UNAME_MACHINE}-pc-linux-${LIBC}" exit } test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; } ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo ${UNAME_MACHINE}-pc-os2-emx exit ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop exit ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos exit ;; i*86:syllable:*:*) echo ${UNAME_MACHINE}-pc-syllable exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp exit ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i386. echo i386-pc-msdosdjgpp exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; paragon:*:*:*) echo i860-intel-osf1 exit ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi exit ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo ${UNAME_MACHINE}-sni-sysv4 else echo ns32k-sni-sysv fi exit ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. echo ${UNAME_MACHINE}-stratus-vos exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown case $UNAME_PROCESSOR in *86) UNAME_PROCESSOR=i686 ;; unknown) UNAME_PROCESSOR=powerpc ;; esac echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = "x86"; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} exit ;; *:QNX:*:4*) echo i386-pc-qnx exit ;; NSE-?:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit ;; NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "$cputype" = "386"; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit ;; *:ITS:*:*) echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) echo mips-sei-seiux${UNAME_RELEASE} exit ;; *:DragonFly:*:*) echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case "${UNAME_MACHINE}" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; V*) echo vax-dec-vms ; exit ;; esac ;; *:XENIX:*:SysV) echo i386-pc-xenix exit ;; i*86:skyos:*:*) echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' exit ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 eval $set_cc_for_build cat >$dummy.c < # include #endif main () { #if defined (sony) #if defined (MIPSEB) /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, I don't know.... */ printf ("mips-sony-bsd\n"); exit (0); #else #include printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 "4" #else "" #endif ); exit (0); #endif #endif #if defined (__arm) && defined (__acorn) && defined (__unix) printf ("arm-acorn-riscix\n"); exit (0); #endif #if defined (hp300) && !defined (hpux) printf ("m68k-hp-bsd\n"); exit (0); #endif #if defined (NeXT) #if !defined (__ARCHITECTURE__) #define __ARCHITECTURE__ "m68k" #endif int version; version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; if (version < 4) printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); else printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); exit (0); #endif #if defined (MULTIMAX) || defined (n16) #if defined (UMAXV) printf ("ns32k-encore-sysv\n"); exit (0); #else #if defined (CMU) printf ("ns32k-encore-mach\n"); exit (0); #else printf ("ns32k-encore-bsd\n"); exit (0); #endif #endif #endif #if defined (__386BSD__) printf ("i386-pc-bsd\n"); exit (0); #endif #if defined (sequent) #if defined (i386) printf ("i386-sequent-dynix\n"); exit (0); #endif #if defined (ns32000) printf ("ns32k-sequent-dynix\n"); exit (0); #endif #endif #if defined (_SEQUENT_) struct utsname un; uname(&un); if (strncmp(un.version, "V2", 2) == 0) { printf ("i386-sequent-ptx2\n"); exit (0); } if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ printf ("i386-sequent-ptx1\n"); exit (0); } printf ("i386-sequent-ptx\n"); exit (0); #endif #if defined (vax) # if !defined (ultrix) # include # if defined (BSD) # if BSD == 43 printf ("vax-dec-bsd4.3\n"); exit (0); # else # if BSD == 199006 printf ("vax-dec-bsd4.3reno\n"); exit (0); # else printf ("vax-dec-bsd\n"); exit (0); # endif # endif # else printf ("vax-dec-bsd\n"); exit (0); # endif # else printf ("vax-dec-ultrix\n"); exit (0); # endif #endif #if defined (alliant) && defined (i860) printf ("i860-alliant-bsd\n"); exit (0); #endif exit (1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } # Apollos put the system type in the environment. test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } # Convex versions that predate uname can use getsysinfo(1) if [ -x /usr/convex/getsysinfo ] then case `getsysinfo -f cpu_type` in c1*) echo c1-convex-bsd exit ;; c2*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; c34*) echo c34-convex-bsd exit ;; c38*) echo c38-convex-bsd exit ;; c4*) echo c4-convex-bsd exit ;; esac fi cat >&2 < in order to provide the needed information to handle your system. config.guess timestamp = $timestamp uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = ${UNAME_MACHINE} UNAME_RELEASE = ${UNAME_RELEASE} UNAME_SYSTEM = ${UNAME_SYSTEM} UNAME_VERSION = ${UNAME_VERSION} EOF exit 1 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: libtritonus-java-20070428/util/config.sub0000755000175000017500000007632310400142275020163 0ustar twernertwerner#! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. timestamp='2005-06-02' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software # can handle that machine. It does not imply ALL GNU software can. # # This file is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA # 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Please send patches to . Submit a context # diff and a properly formatted ChangeLog entry. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS $0 [OPTION] ALIAS Canonicalize a configuration name. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo $1 exit ;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-dietlibc | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | \ kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple | -axis | -knuth | -cray) os= basic_machine=$1 ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` ;; -windowsnt*) os=`echo $os | sed -e 's/windowsnt/winnt/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \ | bfin \ | c4x | clipper \ | d10v | d30v | dlx | dsp16xx | dvp \ | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ | m32r | m32rle | m68000 | m68k | m88k | maxq | mcore \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64vr | mips64vrel \ | mips64orion | mips64orionel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mips64r5900 | mips64r5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | ms1 \ | msp430 \ | ns16k | ns32k \ | openrisc | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ | pyramid \ | sh | sh[1234] | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b \ | strongarm \ | tahoe | thumb | tic4x | tic80 | tron \ | v850 | v850e \ | we32k \ | x86 | xscale | xscalee[bl] | xstormy16 | xtensa \ | z8k) basic_machine=$basic_machine-unknown ;; m32c) basic_machine=$basic_machine-unknown ;; m6811 | m68hc11 | m6812 | m68hc12) # Motorola 68HC11/12. basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | maxq-* | mcore-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64vr-* | mips64vrel-* \ | mips64orion-* | mips64orionel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mips64r5900-* | mips64r5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | ms1-* \ | msp430-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ | pyramid-* \ | romp-* | rs6000-* \ | sh-* | sh[1234]-* | sh[23]e-* | sh[34]eb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc86x-* | sparclet-* \ | sparclite-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \ | tahoe-* | thumb-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tron-* \ | v850-* | v850e-* | vax-* \ | we32k-* \ | x86-* | x86_64-* | xps100-* | xscale-* | xscalee[bl]-* \ | xstormy16-* | xtensa-* \ | ymp-* \ | z8k-*) ;; m32c-*) ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) basic_machine=i386-unknown os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; a29khif) basic_machine=a29k-amd os=-udi ;; abacus) basic_machine=abacus-unknown ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amd64) basic_machine=x86_64-pc ;; amd64-*) basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; c90) basic_machine=c90-cray os=-unicos ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | j90) basic_machine=j90-cray os=-unicos ;; craynv) basic_machine=craynv-cray os=-unicosmp ;; cr16c) basic_machine=cr16c-unknown os=-elf ;; crds | unos) basic_machine=m68k-crds ;; crisv32 | crisv32-* | etraxfs*) basic_machine=crisv32-axis ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; crx) basic_machine=crx-unknown os=-elf ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec os=-tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; djgpp) basic_machine=i586-pc os=-msdosdjgpp ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppa-next) os=-nextstep3 ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; # I'm not sure what "Sysv32" means. Should this be sysv3.2? i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; i386-vsta | vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; m88k-omron*) basic_machine=m88k-omron ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; mingw32) basic_machine=i386-pc os=-mingw32 ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mipsEE* | ee | ps2) basic_machine=mips64r5900el-scei case $os in -linux*) ;; *) os=-elf ;; esac ;; iop) basic_machine=mipsel-scei os=-irx ;; dvp) basic_machine=dvp-scei os=-elf ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; monitor) basic_machine=m68k-rom68k os=-coff ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; msdos) basic_machine=i386-pc os=-msdos ;; mvs) basic_machine=i370-ibm os=-mvs ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) basic_machine=i386-unknown os=-netbsd ;; netwinder) basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next ) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; mon960) basic_machine=i960-intel os=-mon960 ;; nonstopux) basic_machine=mips-compaq os=-nonstopux ;; np1) basic_machine=np1-gould ;; nsr-tandem) basic_machine=nsr-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; or32 | or32-*) basic_machine=or32-unknown os=-coff ;; os400) basic_machine=powerpc-ibm os=-os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; pentium4) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium4-*) basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc) basic_machine=powerpc-unknown ;; ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little | ppc64-le | powerpc64-little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sb1) basic_machine=mipsisa64sb1-unknown ;; sb1el) basic_machine=mipsisa64sb1el-unknown ;; sei) basic_machine=mips-sei os=-seiux ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sh64) basic_machine=sh64-unknown ;; sparclite-wrs | simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; sv1) basic_machine=sv1-cray os=-unicos ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3e) basic_machine=alphaev5-cray os=-unicos ;; t90) basic_machine=t90-cray os=-unicos ;; tic54x | c54x*) basic_machine=tic54x-unknown os=-coff ;; tic55x | c55x*) basic_machine=tic55x-unknown os=-coff ;; tic6x | c6x*) basic_machine=tic6x-unknown os=-coff ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; toad1) basic_machine=pdp10-xkl os=-tops20 ;; tower | tower-32) basic_machine=m68k-ncr ;; tpf) basic_machine=s390x-ibm os=-tpf ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; xbox) basic_machine=i686-pc os=-mingw32 ;; xps | xps100) basic_machine=xps100-honeywell ;; ymp) basic_machine=ymp-cray os=-unicos ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; romp) basic_machine=romp-ibm ;; mmix) basic_machine=mmix-knuth ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp10) # there are many clones, so DEC is not a safe bet basic_machine=pdp10-unknown ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh3 | sh4 | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; sh64) basic_machine=sh64-unknown ;; sparc | sparcv8 | sparcv9 | sparcv9b) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -svr4*) os=-sysv4 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # First accept the basic system types. # The portable systems comes first. # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* | -openbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -linux-gnu* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* | -skyos* \ | -irx* ) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto-qnx*) ;; -nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; -linux-dietlibc) os=-linux-dietlibc ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -os400*) os=-os400 ;; -wince*) os=-wince ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -syllable*) os=-syllable ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -nova*) os=-rtmk-nova ;; -ns2 ) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -tpf*) os=-tpf ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -es1800*) os=-ose ;; -xenix) os=-xenix ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -aros*) os=-aros ;; -kaos*) os=-kaos ;; -zvmoe) os=-zvmoe ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; c4x-* | tic4x-*) os=-coff ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 # This also exists in the configure program, but was not the # default. # os=-sunos4 ;; m68*-cisco) os=-aout ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; or32-*) os=-coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; *-be) os=-beos ;; *-ibm) os=-aix ;; *-knuth) os=-mmixware ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next ) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-next) os=-nextstep3 ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -aix*) vendor=ibm ;; -beos*) vendor=be ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs* | -opened*) vendor=ibm ;; -os400*) vendor=ibm ;; -ptx*) vendor=sequent ;; -tpf*) vendor=ibm ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os exit # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: libtritonus-java-20070428/util/install-sh0000755000175000017500000001272107075416465020217 0ustar twernertwerner#! /bin/sh # # install - install a program, script, or datafile # This comes from X11R5 (mit/util/scripts/install.sh). # # Copyright 1991 by the Massachusetts Institute of Technology # # Permission to use, copy, modify, distribute, and sell this software and its # documentation for any purpose is hereby granted without fee, provided that # the above copyright notice appear in all copies and that both that # copyright notice and this permission notice appear in supporting # documentation, and that the name of M.I.T. not be used in advertising or # publicity pertaining to distribution of the software without specific, # written prior permission. M.I.T. makes no representations about the # suitability of this software for any purpose. It is provided "as is" # without express or implied warranty. # # Calling this script install-sh is preferred over install.sh, to prevent # `make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. It can only install one file at a time, a restriction # shared with many OS's install programs. # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit="${DOITPROG-}" # put in absolute paths if you don't have them in your path; or use env. vars. mvprog="${MVPROG-mv}" cpprog="${CPPROG-cp}" chmodprog="${CHMODPROG-chmod}" chownprog="${CHOWNPROG-chown}" chgrpprog="${CHGRPPROG-chgrp}" stripprog="${STRIPPROG-strip}" rmprog="${RMPROG-rm}" mkdirprog="${MKDIRPROG-mkdir}" transformbasename="" transform_arg="" instcmd="$mvprog" chmodcmd="$chmodprog 0755" chowncmd="" chgrpcmd="" stripcmd="" rmcmd="$rmprog -f" mvcmd="$mvprog" src="" dst="" dir_arg="" while [ x"$1" != x ]; do case $1 in -c) instcmd="$cpprog" shift continue;; -d) dir_arg=true shift continue;; -m) chmodcmd="$chmodprog $2" shift shift continue;; -o) chowncmd="$chownprog $2" shift shift continue;; -g) chgrpcmd="$chgrpprog $2" shift shift continue;; -s) stripcmd="$stripprog" shift continue;; -t=*) transformarg=`echo $1 | sed 's/-t=//'` shift continue;; -b=*) transformbasename=`echo $1 | sed 's/-b=//'` shift continue;; *) if [ x"$src" = x ] then src=$1 else # this colon is to work around a 386BSD /bin/sh bug : dst=$1 fi shift continue;; esac done if [ x"$src" = x ] then echo "install: no input file specified" exit 1 else true fi if [ x"$dir_arg" != x ]; then dst=$src src="" if [ -d $dst ]; then instcmd=: else instcmd=mkdir fi else # Waiting for this to be detected by the "$instcmd $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if [ -f $src -o -d $src ] then true else echo "install: $src does not exist" exit 1 fi if [ x"$dst" = x ] then echo "install: no destination specified" exit 1 else true fi # If destination is a directory, append the input filename; if your system # does not like double slashes in filenames, you may need to add some logic if [ -d $dst ] then dst="$dst"/`basename $src` else true fi fi ## this sed command emulates the dirname command dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` # Make sure that the destination directory exists. # this part is taken from Noah Friedman's mkinstalldirs script # Skip lots of stat calls in the usual case. if [ ! -d "$dstdir" ]; then defaultIFS=' ' IFS="${IFS-${defaultIFS}}" oIFS="${IFS}" # Some sh's can't handle IFS=/ for some reason. IFS='%' set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` IFS="${oIFS}" pathcomp='' while [ $# -ne 0 ] ; do pathcomp="${pathcomp}${1}" shift if [ ! -d "${pathcomp}" ] ; then $mkdirprog "${pathcomp}" else true fi pathcomp="${pathcomp}/" done fi if [ x"$dir_arg" != x ] then $doit $instcmd $dst && if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi else # If we're going to rename the final executable, determine the name now. if [ x"$transformarg" = x ] then dstfile=`basename $dst` else dstfile=`basename $dst $transformbasename | sed $transformarg`$transformbasename fi # don't allow the sed command to completely eliminate the filename if [ x"$dstfile" = x ] then dstfile=`basename $dst` else true fi # Make a temp file name in the proper directory. dsttmp=$dstdir/#inst.$$# # Move or copy the file name to the temp name $doit $instcmd $src $dsttmp && trap "rm -f ${dsttmp}" 0 && # and set any options; do chmod last to preserve setuid bits # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $instcmd $src $dsttmp" command. if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && # Now rename the file to the real destination. $doit $rmcmd -f $dstdir/$dstfile && $doit $mvcmd $dsttmp $dstdir/$dstfile fi && exit 0 libtritonus-java-20070428/util/link_all.sh0000755000175000017500000000007707444345372020336 0ustar twernertwerner#!/bin/sh for i in /usr/share/java/*.jar do ln -sf $i done libtritonus-java-20070428/util/link_native_tritonus.sh0000644000175000017500000000010207444345372023005 0ustar twernertwerner#!/bin/sh for i in /usr/lib/libtritonus*.so do ln -sf $i done libtritonus-java-20070428/util/link_tritonus.sh0000644000175000017500000000011007444345372021436 0ustar twernertwerner#!/bin/sh for i in /usr/share/java/tritonus_*.jar do ln -sf $i done libtritonus-java-20070428/util/remove_tritonus_from_rt_jar.sh0000755000175000017500000000102607614202134024357 0ustar twernertwerner#! /bin/sh # This script removes all Tritonus components from rt.jar. # The removal includes the javax.sound.* classes and the # service provider configuration files. # Note that it does not remove Sun implementation components. # The location of the rt.jar file to remove from. # The value below is for newer kaffe installations. # Adapt to your needs. rt_jar=/usr/local/kaffe/jre/lib/rt.jar # now remove... zip -d ${rt_jar} org/tritonus/\* zip -d ${rt_jar} javax/sound/\* zip -d ${rt_jar} META-INF/services/javax.sound.\* # end