diff --git a/README.md b/README.md
new file mode 100644
index 00000000..6ea8fa0c
--- /dev/null
+++ b/README.md
@@ -0,0 +1,50 @@
+#djoom3 - a Doom 3 Java port.
+
+####05-02-15:
+-Initial non playable release.
+
+![http://wiki.djoom3.googlecode.com/git/init_menus.png](http://wiki.djoom3.googlecode.com/git/init_menus.png)
+
+![http://wiki.djoom3.googlecode.com/git/title.png](http://wiki.djoom3.googlecode.com/git/title.png)
+
+
+
+
+----------
+
+#README.md#
+
+####Enable OpenAL
+Add/edit the following settings to the **DoomConfig.cfg** file:
+
+- seta s_useOpenAL "1"
+- seta s_libOpenAL "openal.dylib"
+
+####How to build:
+TODO
+
+####How to run in an IDE:
+#####IntelliJ
+1. [https://www.jetbrains.com/idea/help/opening-reopening-and-closing-projects.html](https://www.jetbrains.com/idea/help/opening-reopening-and-closing-projects.html)
+2. [Create a run configuration](https://www.jetbrains.com/idea/help/creating-and-editing-run-debug-configurations.html) for **neo.sys.win_main.java**
+3. Add **-Djava.library.path=/bla/natives**(location of the lwjgl native dll/so files) to the VM parameters of the [run configuration] (https://www.jetbrains.com/idea/help/setting-configuration-options.html)
+4. Add **"+set fs_basepath '~/.local/share/Steam/steamapps/common/doom 3' +set com_allowConsole 1 +set si_pure 0"**(with quotes) to the program arguments of the [run configuration] (https://www.jetbrains.com/idea/help/setting-configuration-options.html)
+
+###Important
+####Operator Overloading:####
+|c++|java|
+|---------|------------|
+|operator=| oSet(value)|
+|operator[]| oSet(x, value)|
+|operator[]|oGet(x)|
+|operator[][]| oGet(x, y)|
+|operator[][]| oSet(x, y, value)|
+|operator+| oPlus|
+|operator-| oMinus|
+|operator*| oMultiply|
+|operator/| oDivide|
+|operator-()| oNegative|
+|operator+=| oPluSet|
+|operator-=| oMinSet|
+|operator*=| oMulSet|
+|operator/=| oDivSet|
diff --git a/pom.xml b/pom.xml
index 4e847b9b..ac24dc53 100644
--- a/pom.xml
+++ b/pom.xml
@@ -3,22 +3,25 @@
4.0.0
com.djoom3
djoom3
- 0.1-SNAPSHOT
+ 0.2-SNAPSHOT
+
jar
1.9.1
+ 0.0.17-2
2.9.3
+
1.7
1.7
1.3.2
2.5
0.0.7
2.7
-
+
/bla
-
+
UTF-8
@@ -118,6 +121,11 @@
uk.com.robust-it
cloning
${cloning.version}
-
+
+
+ com.googlecode.soundlibs
+ jorbis
+ ${jorbis.version}
+
\ No newline at end of file
diff --git a/src/main/java/TODOS b/src/main/java/TODOS
index 5911abf4..a7bb0da4 100644
--- a/src/main/java/TODOS
+++ b/src/main/java/TODOS
@@ -43,4 +43,6 @@
-at a certain point you start a massive campaign of TODO-inserts, which makes you feel a little fuzzy inside.
--LAZY: take the idWinStr classes for example; normally we would create nice and cool encapsulation functions to hide all the stuff from the outside world. but we just go lazy and use the "data" subtype.
\ No newline at end of file
+-LAZY: take the idWinStr classes for example; normally we would create nice and cool encapsulation functions to hide all the stuff from the outside world. but we just go lazy and use the "data" subtype.
+-replace \n with %n
+-replace Float.SIZE with Float.BYTES...etc.
\ No newline at end of file
diff --git a/src/main/java/com/jcraft/jogg/Buffer.java b/src/main/java/com/jcraft/jogg/Buffer.java
new file mode 100644
index 00000000..1e5c92eb
--- /dev/null
+++ b/src/main/java/com/jcraft/jogg/Buffer.java
@@ -0,0 +1,294 @@
+/* -*-mode:java; c-basic-offset:2; indent-tabs-mode:nil -*- */
+/* JOrbis
+ * Copyright (C) 2000 ymnk, JCraft,Inc.
+ *
+ * Written by: 2000 ymnk
+ *
+ * Many thanks to
+ * Monty and
+ * The XIPHOPHORUS Company http://www.xiph.org/ .
+ * JOrbis has been based on their awesome works, Vorbis codec.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License
+ * as published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU 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 com.jcraft.jogg;
+
+public class Buffer{
+ private static final int BUFFER_INCREMENT=256;
+
+ 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};
+
+ int ptr=0;
+ byte[] buffer=null;
+ int endbit=0;
+ int endbyte=0;
+ int storage=0;
+
+ public void writeinit(){
+ buffer=new byte[BUFFER_INCREMENT];
+ ptr=0;
+ buffer[0]=(byte)'\0';
+ storage=BUFFER_INCREMENT;
+ }
+
+ public void write(byte[] s){
+ for(int i=0; i=storage){
+ byte[] foo=new byte[storage+BUFFER_INCREMENT];
+ System.arraycopy(buffer, 0, foo, 0, storage);
+ buffer=foo;
+ storage+=BUFFER_INCREMENT;
+ }
+
+ value&=mask[bits];
+ bits+=endbit;
+ buffer[ptr]|=(byte)(value<=8){
+ buffer[ptr+1]=(byte)(value>>>(8-endbit));
+ if(bits>=16){
+ buffer[ptr+2]=(byte)(value>>>(16-endbit));
+ if(bits>=24){
+ buffer[ptr+3]=(byte)(value>>>(24-endbit));
+ if(bits>=32){
+ if(endbit>0)
+ buffer[ptr+4]=(byte)(value>>>(32-endbit));
+ else
+ buffer[ptr+4]=0;
+ }
+ }
+ }
+ }
+
+ endbyte+=bits/8;
+ ptr+=bits/8;
+ endbit=bits&7;
+ }
+
+ public int look(int bits){
+ int ret;
+ int m=mask[bits];
+
+ bits+=endbit;
+
+ if(endbyte+4>=storage){
+ if(endbyte+(bits-1)/8>=storage)
+ return (-1);
+ }
+
+ ret=((buffer[ptr])&0xff)>>>endbit;
+ if(bits>8){
+ ret|=((buffer[ptr+1])&0xff)<<(8-endbit);
+ if(bits>16){
+ ret|=((buffer[ptr+2])&0xff)<<(16-endbit);
+ if(bits>24){
+ ret|=((buffer[ptr+3])&0xff)<<(24-endbit);
+ if(bits>32&&endbit!=0){
+ ret|=((buffer[ptr+4])&0xff)<<(32-endbit);
+ }
+ }
+ }
+ }
+ return (m&ret);
+ }
+
+ public int look1(){
+ if(endbyte>=storage)
+ return (-1);
+ return ((buffer[ptr]>>endbit)&1);
+ }
+
+ public void adv(int bits){
+ bits+=endbit;
+ ptr+=bits/8;
+ endbyte+=bits/8;
+ endbit=bits&7;
+ }
+
+ public void adv1(){
+ ++endbit;
+ if(endbit>7){
+ endbit=0;
+ ptr++;
+ endbyte++;
+ }
+ }
+
+ public int read(int bits){
+ int ret;
+ int m=mask[bits];
+
+ bits+=endbit;
+
+ if(endbyte+4>=storage){
+ ret=-1;
+ if(endbyte+(bits-1)/8>=storage){
+ ptr+=bits/8;
+ endbyte+=bits/8;
+ endbit=bits&7;
+ return (ret);
+ }
+ }
+
+ ret=((buffer[ptr])&0xff)>>>endbit;
+ if(bits>8){
+ ret|=((buffer[ptr+1])&0xff)<<(8-endbit);
+ if(bits>16){
+ ret|=((buffer[ptr+2])&0xff)<<(16-endbit);
+ if(bits>24){
+ ret|=((buffer[ptr+3])&0xff)<<(24-endbit);
+ if(bits>32&&endbit!=0){
+ ret|=((buffer[ptr+4])&0xff)<<(32-endbit);
+ }
+ }
+ }
+ }
+
+ ret&=m;
+
+ ptr+=bits/8;
+ endbyte+=bits/8;
+ endbit=bits&7;
+ return (ret);
+ }
+
+ public int readB(int bits){
+ int ret;
+ int m=32-bits;
+
+ bits+=endbit;
+
+ if(endbyte+4>=storage){
+ /* not the main path */
+ ret=-1;
+ if(endbyte*8+bits>storage*8){
+ ptr+=bits/8;
+ endbyte+=bits/8;
+ endbit=bits&7;
+ return (ret);
+ }
+ }
+
+ ret=(buffer[ptr]&0xff)<<(24+endbit);
+ if(bits>8){
+ ret|=(buffer[ptr+1]&0xff)<<(16+endbit);
+ if(bits>16){
+ ret|=(buffer[ptr+2]&0xff)<<(8+endbit);
+ if(bits>24){
+ ret|=(buffer[ptr+3]&0xff)<<(endbit);
+ if(bits>32&&(endbit!=0))
+ ret|=(buffer[ptr+4]&0xff)>>(8-endbit);
+ }
+ }
+ }
+ ret=(ret>>>(m>>1))>>>((m+1)>>1);
+
+ ptr+=bits/8;
+ endbyte+=bits/8;
+ endbit=bits&7;
+ return (ret);
+ }
+
+ public int read1(){
+ int ret;
+ if(endbyte>=storage){
+ ret=-1;
+ endbit++;
+ if(endbit>7){
+ endbit=0;
+ ptr++;
+ endbyte++;
+ }
+ return (ret);
+ }
+
+ ret=(buffer[ptr]>>endbit)&1;
+
+ endbit++;
+ if(endbit>7){
+ endbit=0;
+ ptr++;
+ endbyte++;
+ }
+ return (ret);
+ }
+
+ public int bytes(){
+ return (endbyte+(endbit+7)/8);
+ }
+
+ public int bits(){
+ return (endbyte*8+endbit);
+ }
+
+ public byte[] buffer(){
+ return (buffer);
+ }
+
+ public static int ilog(int v){
+ int ret=0;
+ while(v>0){
+ ret++;
+ v>>>=1;
+ }
+ return (ret);
+ }
+
+ public static void report(String in){
+ System.err.println(in);
+ System.exit(1);
+ }
+}
diff --git a/src/main/java/com/jcraft/jogg/Packet.java b/src/main/java/com/jcraft/jogg/Packet.java
new file mode 100644
index 00000000..7df75d10
--- /dev/null
+++ b/src/main/java/com/jcraft/jogg/Packet.java
@@ -0,0 +1,47 @@
+/* -*-mode:java; c-basic-offset:2; indent-tabs-mode:nil -*- */
+/* JOrbis
+ * Copyright (C) 2000 ymnk, JCraft,Inc.
+ *
+ * Written by: 2000 ymnk
+ *
+ * Many thanks to
+ * Monty and
+ * The XIPHOPHORUS Company http://www.xiph.org/ .
+ * JOrbis has been based on their awesome works, Vorbis codec.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License
+ * as published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU 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 com.jcraft.jogg;
+
+public class Packet{
+ public byte[] packet_base;
+ public int packet;
+ public int bytes;
+ public int b_o_s;
+ public int e_o_s;
+
+ public long granulepos;
+
+ /**
+ * sequence number for decode; the framing
+ * knows where there's a hole in the data,
+ * but we need coupling so that the codec
+ * (which is in a seperate abstraction
+ * layer) also knows about the gap
+ */
+ public long packetno;
+
+}
diff --git a/src/main/java/com/jcraft/jogg/Page.java b/src/main/java/com/jcraft/jogg/Page.java
new file mode 100644
index 00000000..60427c9d
--- /dev/null
+++ b/src/main/java/com/jcraft/jogg/Page.java
@@ -0,0 +1,135 @@
+/* -*-mode:java; c-basic-offset:2; indent-tabs-mode:nil -*- */
+/* JOrbis
+ * Copyright (C) 2000 ymnk, JCraft,Inc.
+ *
+ * Written by: 2000 ymnk
+ *
+ * Many thanks to
+ * Monty and
+ * The XIPHOPHORUS Company http://www.xiph.org/ .
+ * JOrbis has been based on their awesome works, Vorbis codec.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License
+ * as published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU 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 com.jcraft.jogg;
+
+public class Page{
+ private static int[] crc_lookup=new int[256];
+ static{
+ for(int i=0; i>>24)&0xff)^(header_base[header+i]&0xff)];
+ }
+ for(int i=0; i>>24)&0xff)^(body_base[body+i]&0xff)];
+ }
+ header_base[header+22]=(byte)crc_reg;
+ header_base[header+23]=(byte)(crc_reg>>>8);
+ header_base[header+24]=(byte)(crc_reg>>>16);
+ header_base[header+25]=(byte)(crc_reg>>>24);
+ }
+
+ public Page copy(){
+ return copy(new Page());
+ }
+
+ public Page copy(Page p){
+ byte[] tmp=new byte[header_len];
+ System.arraycopy(header_base, header, tmp, 0, header_len);
+ p.header_len=header_len;
+ p.header_base=tmp;
+ p.header=0;
+ tmp=new byte[body_len];
+ System.arraycopy(body_base, body, tmp, 0, body_len);
+ p.body_len=body_len;
+ p.body_base=tmp;
+ p.body=0;
+ return p;
+ }
+
+}
diff --git a/src/main/java/com/jcraft/jogg/StreamState.java b/src/main/java/com/jcraft/jogg/StreamState.java
new file mode 100644
index 00000000..7111c9f8
--- /dev/null
+++ b/src/main/java/com/jcraft/jogg/StreamState.java
@@ -0,0 +1,551 @@
+/* -*-mode:java; c-basic-offset:2; indent-tabs-mode:nil -*- */
+/* JOrbis
+ * Copyright (C) 2000 ymnk, JCraft,Inc.
+ *
+ * Written by: 2000 ymnk
+ *
+ * Many thanks to
+ * Monty and
+ * The XIPHOPHORUS Company http://www.xiph.org/ .
+ * JOrbis has been based on their awesome works, Vorbis codec.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License
+ * as published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU 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 com.jcraft.jogg;
+
+public class StreamState{
+ byte[] body_data; /* bytes from packet bodies */
+ int body_storage; /* storage elements allocated */
+ int body_fill; /* elements stored; fill mark */
+ private int body_returned; /* elements of fill returned */
+
+ int[] lacing_vals; /* The values that will go to the segment table */
+ long[] granule_vals; /* pcm_pos values for headers. Not compact
+ this way, but it is simple coupled to the
+ lacing fifo */
+ int lacing_storage;
+ int lacing_fill;
+ int lacing_packet;
+ int lacing_returned;
+
+ byte[] header=new byte[282]; /* working space for header encode */
+ int header_fill;
+
+ public int e_o_s; /* set when we have buffered the last packet in the
+ logical bitstream */
+ int b_o_s; /* set after we've written the initial page
+ of a logical bitstream */
+ long serialno;
+ int pageno;
+ long packetno; /* sequence number for decode; the framing
+ knows where there's a hole in the data,
+ but we need coupling so that the codec
+ (which is in a seperate abstraction
+ layer) also knows about the gap */
+ long granulepos;
+
+ public StreamState(){
+ init();
+ }
+
+ StreamState(int serialno){
+ this();
+ init(serialno);
+ }
+
+ void init(){
+ body_storage=16*1024;
+ body_data=new byte[body_storage];
+ lacing_storage=1024;
+ lacing_vals=new int[lacing_storage];
+ granule_vals=new long[lacing_storage];
+ }
+
+ public void init(long serialno){
+ if(body_data==null){
+ init();
+ }
+ else{
+ for(int i=0; i0)
+ return (-1);
+
+ lacing_expand(segments+1);
+
+ // are we in sequence?
+ if(_pageno!=pageno){
+ int i;
+
+ // unroll previous partial packet (if any)
+ for(i=lacing_packet; i0)
+ lacing_vals[lacing_fill-1]|=0x200;
+ }
+
+ pageno=_pageno+1;
+ return (0);
+ }
+
+ /* 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 gurantee that all packets have flushed.
+ Only a return value of 0 from ogg_stream_flush indicates all packet
+ data is flushed into pages.
+
+ ogg_stream_page 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 need to flush an undersized
+ page in the middle of a stream for some reason. */
+
+ public int flush(Page og){
+
+ int i;
+ int vals=0;
+ int maxvals=(lacing_fill>255 ? 255 : lacing_fill);
+ int bytes=0;
+ int acc=0;
+ long granule_pos=granule_vals[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(b_o_s==0){ /* 'initial header page' case */
+ granule_pos=0;
+ for(vals=0; vals4096)
+ break;
+ acc+=(lacing_vals[vals]&0x0ff);
+ granule_pos=granule_vals[vals];
+ }
+ }
+
+ /* construct the header in temp storage */
+ System.arraycopy("OggS".getBytes(), 0, header, 0, 4);
+
+ /* stream structure version */
+ header[4]=0x00;
+
+ /* continued packet flag? */
+ header[5]=0x00;
+ if((lacing_vals[0]&0x100)==0)
+ header[5]|=0x01;
+ /* first page flag? */
+ if(b_o_s==0)
+ header[5]|=0x02;
+ /* last page flag? */
+ if(e_o_s!=0&&lacing_fill==vals)
+ header[5]|=0x04;
+ b_o_s=1;
+
+ /* 64 bits of PCM position */
+ for(i=6; i<14; i++){
+ header[i]=(byte)granule_pos;
+ granule_pos>>>=8;
+ }
+
+ /* 32 bits of stream serial number */
+ {
+ long _serialno=serialno;
+ for(i=14; i<18; i++){
+ header[i]=(byte)_serialno;
+ _serialno>>>=8;
+ }
+ }
+
+ /* 32 bits of page counter (we have both counter and page header
+ because this val can roll over) */
+ if(pageno==-1)
+ pageno=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=pageno++;
+ for(i=18; i<22; i++){
+ header[i]=(byte)_pageno;
+ _pageno>>>=8;
+ }
+ }
+
+ /* zero for computation; filled in later */
+ header[22]=0;
+ header[23]=0;
+ header[24]=0;
+ header[25]=0;
+
+ /* segment table */
+ header[26]=(byte)vals;
+ for(i=0; i4096|| /* 'page nominal size' case */
+ lacing_fill>=255|| /* 'segment table full' case */
+ (lacing_fill!=0&&b_o_s==0)){ /* 'initial header page' case */
+ return flush(og);
+ }
+ return 0;
+ }
+
+ public int eof(){
+ return e_o_s;
+ }
+
+ public int reset(){
+ body_fill=0;
+ body_returned=0;
+
+ lacing_fill=0;
+ lacing_packet=0;
+ lacing_returned=0;
+
+ header_fill=0;
+
+ e_o_s=0;
+ b_o_s=0;
+ pageno=-1;
+ packetno=0;
+ granulepos=0;
+ return (0);
+ }
+
+ public int reset_serialno(long serialno) {
+ reset();
+ this.serialno = serialno;
+ return 0;
+ }
+}
diff --git a/src/main/java/com/jcraft/jogg/SyncState.java b/src/main/java/com/jcraft/jogg/SyncState.java
new file mode 100644
index 00000000..f9d34066
--- /dev/null
+++ b/src/main/java/com/jcraft/jogg/SyncState.java
@@ -0,0 +1,275 @@
+/* -*-mode:java; c-basic-offset:2; indent-tabs-mode:nil -*- */
+/* JOrbis
+ * Copyright (C) 2000 ymnk, JCraft,Inc.
+ *
+ * Written by: 2000 ymnk
+ *
+ * Many thanks to
+ * Monty and
+ * The XIPHOPHORUS Company http://www.xiph.org/ .
+ * JOrbis has been based on their awesome works, Vorbis codec.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License
+ * as published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU 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 com.jcraft.jogg;
+
+// 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_decode_buffer(). The app either copies into the
+// buffer, or passes it directly to read(), etc. We then call
+// ogg_decode_wrote() to tell how many bytes we just added.
+//
+// Pages are returned (pointers into the buffer in ogg_sync_state)
+// by ogg_decode_stream(). The page is then submitted to
+// ogg_decode_page() along with the appropriate
+// ogg_stream_state* (ie, matching serialno). We then get raw
+// packets out calling ogg_stream_packet() with a
+// ogg_stream_state. See the 'frame-prog.txt' docs for details and
+// example code.
+
+public class SyncState{
+
+ public byte[] data;
+ int storage;
+ int fill;
+ int returned;
+
+ int unsynced;
+ int headerbytes;
+ int bodybytes;
+
+ public int clear(){
+ data=null;
+ return (0);
+ }
+
+ public int buffer(int size){
+ // first, clear out any space that has been previously returned
+ if(returned!=0){
+ fill-=returned;
+ if(fill>0){
+ System.arraycopy(data, returned, data, 0, fill);
+ }
+ returned=0;
+ }
+
+ if(size>storage-fill){
+ // We need to extend the internal buffer
+ int newsize=size+fill+4096; // an extra page to be nice
+ if(data!=null){
+ byte[] foo=new byte[newsize];
+ System.arraycopy(data, 0, foo, 0, data.length);
+ data=foo;
+ }
+ else{
+ data=new byte[newsize];
+ }
+ storage=newsize;
+ }
+
+ return (fill);
+ }
+
+ public int wrote(int bytes){
+ if(fill+bytes>storage)
+ return (-1);
+ fill+=bytes;
+ return (0);
+ }
+
+ // sync the stream. This is meant to be useful for finding page
+ // boundaries.
+ //
+ // return values for this:
+ // -n) skipped n bytes
+ // 0) page not ready; more data (no bytes skipped)
+ // n) page synced at current location; page length n bytes
+ private Page pageseek=new Page();
+ private byte[] chksum=new byte[4];
+
+ public int pageseek(Page og){
+ int page=returned;
+ int next;
+ int bytes=fill-returned;
+
+ if(headerbytes==0){
+ int _headerbytes, i;
+ if(bytes<27)
+ return (0); // not enough for a header
+
+ /* verify capture pattern */
+ if(data[page]!='O'||data[page+1]!='g'||data[page+2]!='g'
+ ||data[page+3]!='S'){
+ headerbytes=0;
+ bodybytes=0;
+
+ // search for possible capture
+ next=0;
+ for(int ii=0; iibytes)
+ return (0);
+
+ // The whole test page is buffered. Verify the checksum
+ synchronized(chksum){
+ // Grab the checksum bytes, set the header field to zero
+
+ System.arraycopy(data, page+22, chksum, 0, 4);
+ data[page+22]=0;
+ data[page+23]=0;
+ data[page+24]=0;
+ data[page+25]=0;
+
+ // set up a temp page struct and recompute the checksum
+ Page log=pageseek;
+ log.header_base=data;
+ log.header=page;
+ log.header_len=headerbytes;
+
+ log.body_base=data;
+ log.body=page+headerbytes;
+ log.body_len=bodybytes;
+ log.checksum();
+
+ // Compare
+ if(chksum[0]!=data[page+22]||chksum[1]!=data[page+23]
+ ||chksum[2]!=data[page+24]||chksum[3]!=data[page+25]){
+ // D'oh. Mismatch! Corrupt page (or miscapture and not a page at all)
+ // replace the computed checksum with the one actually read in
+ System.arraycopy(chksum, 0, data, page+22, 4);
+ // Bad checksum. Lose sync */
+
+ headerbytes=0;
+ bodybytes=0;
+ // search for possible capture
+ next=0;
+ for(int ii=0; ii0){
+ // have a page
+ return (1);
+ }
+ if(ret==0){
+ // need more data
+ return (0);
+ }
+
+ // head did not start a synced page... skipped some bytes
+ if(unsynced==0){
+ unsynced=1;
+ return (-1);
+ }
+ // loop. keep looking
+ }
+ }
+
+ // clear things to an initial state. Good to call, eg, before seeking
+ public int reset(){
+ fill=0;
+ returned=0;
+ unsynced=0;
+ headerbytes=0;
+ bodybytes=0;
+ return (0);
+ }
+
+ public void init(){
+ }
+
+ public int getDataOffset(){
+ return returned;
+ }
+
+ public int getBufferOffset(){
+ return fill;
+ }
+}
diff --git a/src/main/java/com/jcraft/jorbis/Block.java b/src/main/java/com/jcraft/jorbis/Block.java
new file mode 100644
index 00000000..f1d86787
--- /dev/null
+++ b/src/main/java/com/jcraft/jorbis/Block.java
@@ -0,0 +1,128 @@
+/* -*-mode:java; c-basic-offset:2; indent-tabs-mode:nil -*- */
+/* JOrbis
+ * Copyright (C) 2000 ymnk, JCraft,Inc.
+ *
+ * Written by: 2000 ymnk
+ *
+ * Many thanks to
+ * Monty and
+ * The XIPHOPHORUS Company http://www.xiph.org/ .
+ * JOrbis has been based on their awesome works, Vorbis codec.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License
+ * as published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU 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 com.jcraft.jorbis;
+
+import com.jcraft.jogg.*;
+
+public class Block{
+ ///necessary stream state for linking to the framing abstraction
+ float[][] pcm=new float[0][]; // this is a pointer into local storage
+ Buffer opb=new Buffer();
+
+ int lW;
+ int W;
+ int nW;
+ int pcmend;
+ int mode;
+
+ int eofflag;
+ long granulepos;
+ long sequence;
+ DspState vd; // For read-only access of configuration
+
+ // bitmetrics for the frame
+ int glue_bits;
+ int time_bits;
+ int floor_bits;
+ int res_bits;
+
+ public Block(DspState vd){
+ this.vd=vd;
+ if(vd.analysisp!=0){
+ opb.writeinit();
+ }
+ }
+
+ public void init(DspState vd){
+ this.vd=vd;
+ }
+
+ public int clear(){
+ if(vd!=null){
+ if(vd.analysisp!=0){
+ opb.writeclear();
+ }
+ }
+ return (0);
+ }
+
+ public int synthesis(Packet op){
+ Info vi=vd.vi;
+
+ // first things first. Make sure decode is ready
+ opb.readinit(op.packet_base, op.packet, op.bytes);
+
+ // Check the packet type
+ if(opb.read(1)!=0){
+ // Oops. This is not an audio data packet
+ return (-1);
+ }
+
+ // read our mode and pre/post windowsize
+ int _mode=opb.read(vd.modebits);
+ if(_mode==-1)
+ return (-1);
+
+ mode=_mode;
+ W=vi.mode_param[mode].blockflag;
+ if(W!=0){
+ lW=opb.read(1);
+ nW=opb.read(1);
+ if(nW==-1)
+ return (-1);
+ }
+ else{
+ lW=0;
+ nW=0;
+ }
+
+ // more setup
+ granulepos=op.granulepos;
+ sequence=op.packetno-3; // first block is third packet
+ eofflag=op.e_o_s;
+
+ // alloc pcm passback storage
+ pcmend=vi.blocksizes[W];
+ if(pcm.length
+ *
+ * Many thanks to
+ * Monty and
+ * The XIPHOPHORUS Company http://www.xiph.org/ .
+ * JOrbis has been based on their awesome works, Vorbis codec.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License
+ * as published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU 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 com.jcraft.jorbis;
+
+import com.jcraft.jogg.*;
+
+class CodeBook{
+ int dim; // codebook dimensions (elements per vector)
+ int entries; // codebook entries
+ StaticCodeBook c=new StaticCodeBook();
+
+ float[] valuelist; // list of dim*entries actual entry values
+ int[] codelist; // list of bitstream codewords for each entry
+ DecodeAux decode_tree;
+
+ // returns the number of bits
+ int encode(int a, Buffer b){
+ b.write(codelist[a], c.lengthlist[a]);
+ return (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 threshhold, 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 errorv(float[] a){
+ int best=best(a, 1);
+ for(int k=0; k8){
+ for(i=0; i declarative (set the value)
+ // stage==1 -> additive
+ // stage==2 -> multiplicitive
+
+ // returns the entry number or -1 on eof
+ int decode(Buffer b){
+ int ptr=0;
+ DecodeAux t=decode_tree;
+ int lok=b.look(t.tabn);
+
+ if(lok>=0){
+ ptr=t.tab[lok];
+ b.adv(t.tabl[lok]);
+ if(ptr<=0){
+ return -ptr;
+ }
+ }
+ do{
+ switch(b.read1()){
+ case 0:
+ ptr=t.ptr0[ptr];
+ break;
+ case 1:
+ ptr=t.ptr1[ptr];
+ break;
+ case -1:
+ default:
+ return (-1);
+ }
+ }
+ while(ptr>0);
+ return (-ptr);
+ }
+
+ // returns the entry number or -1 on eof
+ int decodevs(float[] a, int index, Buffer b, int step, int addmul){
+ int entry=decode(b);
+ if(entry==-1)
+ return (-1);
+ switch(addmul){
+ case -1:
+ for(int i=0, o=0; i=u1&&u1>='A')
+ u1=(byte)(u1-'A'+'a');
+ if('Z'>=u2&&u2>='A')
+ u2=(byte)(u2-'A'+'a');
+ if(u1!=u2){
+ return false;
+ }
+ c++;
+ }
+ return true;
+ }
+
+ public String query(String tag){
+ return query(tag, 0);
+ }
+
+ public String query(String tag, int count){
+ int foo=query(tag.getBytes(), count);
+ if(foo==-1)
+ return null;
+ byte[] comment=user_comments[foo];
+ for(int i=0; i
+ *
+ * Many thanks to
+ * Monty and
+ * The XIPHOPHORUS Company http://www.xiph.org/ .
+ * JOrbis has been based on their awesome works, Vorbis codec.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License
+ * as published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU 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 com.jcraft.jorbis;
+
+class Drft{
+ int n;
+ float[] trigcache;
+ int[] splitcache;
+
+ void backward(float[] data){
+ if(n==1)
+ return;
+ drftb1(n, data, trigcache, trigcache, n, splitcache);
+ }
+
+ void init(int n){
+ this.n=n;
+ trigcache=new float[3*n];
+ splitcache=new int[32];
+ fdrffti(n, trigcache, splitcache);
+ }
+
+ void clear(){
+ if(trigcache!=null)
+ trigcache=null;
+ if(splitcache!=null)
+ splitcache=null;
+ }
+
+ static int[] ntryh= {4, 2, 3, 5};
+ static float tpi=6.28318530717958647692528676655900577f;
+ static float hsqt2=.70710678118654752440084436210485f;
+ static float taui=.86602540378443864676372317075293618f;
+ static float taur=-.5f;
+ static float sqrt2=1.4142135623730950488016887242097f;
+
+ static void drfti1(int n, float[] wa, int index, int[] ifac){
+ 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;
+
+ int state=101;
+
+ loop: while(true){
+ switch(state){
+ case 101:
+ j++;
+ if(j<4)
+ ntry=ntryh[j];
+ else
+ ntry+=2;
+ case 104:
+ nq=nl/ntry;
+ nr=nl-ntry*nq;
+ if(nr!=0){
+ state=101;
+ break;
+ }
+ nf++;
+ ifac[nf+1]=ntry;
+ nl=nq;
+ if(ntry!=2){
+ state=107;
+ break;
+ }
+ if(nf==1){
+ state=107;
+ break;
+ }
+
+ for(i=1; i>1;
+ ipp2=ip;
+ idp2=ido;
+ nbd=(ido-1)>>1;
+ t0=l1*ido;
+ t10=ip*ido;
+
+ int state=100;
+ loop: while(true){
+ switch(state){
+ case 101:
+ if(ido==1){
+ state=119;
+ break;
+ }
+ for(ik=0; ikl1){
+ for(j=1; j>>1;
+ ipp2=ip;
+ ipph=(ip+1)>>>1;
+ if(idol1){
+ state=139;
+ break;
+ }
+
+ is=-ido-1;
+ t1=0;
+ for(j=1; j
+ *
+ * Many thanks to
+ * Monty and
+ * The XIPHOPHORUS Company http://www.xiph.org/ .
+ * JOrbis has been based on their awesome works, Vorbis codec.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License
+ * as published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU 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 com.jcraft.jorbis;
+
+public class DspState {
+ static final float M_PI = 3.1415926539f;
+ static final int VI_TRANSFORMB = 1;
+ static final int VI_WINDOWB = 1;
+
+ int analysisp;
+ Info vi;
+ int modebits;
+
+ float[][] pcm;
+ int pcm_storage;
+ int pcm_current;
+ int pcm_returned;
+
+ float[] multipliers;
+ int envelope_storage;
+ int envelope_current;
+
+ int eofflag;
+
+ int lW;
+ int W;
+ int nW;
+ int centerW;
+
+ long granulepos;
+ long sequence;
+
+ long glue_bits;
+ long time_bits;
+ long floor_bits;
+ long res_bits;
+
+ // local lookup storage
+ float[][][][][] window; // block, leadin, leadout, type
+ Object[][] transform;
+ CodeBook[] fullbooks;
+ // backend lookups are tied to the mode, not the backend or naked mapping
+ Object[] mode;
+
+ // 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
+ byte[] header;
+ byte[] header1;
+ byte[] header2;
+
+ public DspState() {
+ transform = new Object[2][];
+ window = new float[2][][][][];
+ window[0] = new float[2][][][];
+ window[0][0] = new float[2][][];
+ window[0][1] = new float[2][][];
+ window[0][0][0] = new float[2][];
+ window[0][0][1] = new float[2][];
+ window[0][1][0] = new float[2][];
+ window[0][1][1] = new float[2][];
+ window[1] = new float[2][][][];
+ window[1][0] = new float[2][][];
+ window[1][1] = new float[2][][];
+ window[1][0][0] = new float[2][];
+ window[1][0][1] = new float[2][];
+ window[1][1][0] = new float[2][];
+ window[1][1][1] = new float[2][];
+ }
+
+ static float[] window(int type, int window, int left, int right) {
+ float[] ret = new float[window];
+ switch (type) {
+ case 0:
+ // The 'vorbis window' (window 0) is sin(sin(x)*sin(x)*2pi)
+ {
+ int leftbegin = window / 4 - left / 2;
+ int rightbegin = window - window / 4 - right / 2;
+
+ for (int i = 0; i < left; i++) {
+ float x = (float) ((i + .5) / left * M_PI / 2.);
+ x = (float) Math.sin(x);
+ x *= x;
+ x *= M_PI / 2.;
+ x = (float) Math.sin(x);
+ ret[i + leftbegin] = x;
+ }
+
+ for (int i = leftbegin + left; i < rightbegin; i++) {
+ ret[i] = 1.f;
+ }
+
+ for (int i = 0; i < right; i++) {
+ float x = (float) ((right - i - .5) / right * M_PI / 2.);
+ x = (float) Math.sin(x);
+ x *= x;
+ x *= M_PI / 2.;
+ x = (float) Math.sin(x);
+ ret[i + rightbegin] = x;
+ }
+ }
+ break;
+ default:
+ //free(ret);
+ return (null);
+ }
+ return (ret);
+ }
+
+ // 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
+
+ int init(Info vi, boolean encp) {
+ this.vi = vi;
+ modebits = Util.ilog2(vi.modes);
+
+ transform[0] = new Object[VI_TRANSFORMB];
+ transform[1] = new Object[VI_TRANSFORMB];
+
+ // MDCT is tranform 0
+
+ transform[0][0] = new Mdct();
+ transform[1][0] = new Mdct();
+ ((Mdct) transform[0][0]).init(vi.blocksizes[0]);
+ ((Mdct) transform[1][0]).init(vi.blocksizes[1]);
+
+ window[0][0][0] = new float[VI_WINDOWB][];
+ window[0][0][1] = window[0][0][0];
+ window[0][1][0] = window[0][0][0];
+ window[0][1][1] = window[0][0][0];
+ window[1][0][0] = new float[VI_WINDOWB][];
+ window[1][0][1] = new float[VI_WINDOWB][];
+ window[1][1][0] = new float[VI_WINDOWB][];
+ window[1][1][1] = new float[VI_WINDOWB][];
+
+ for (int i = 0; i < VI_WINDOWB; i++) {
+ window[0][0][0][i] = window(i, vi.blocksizes[0], vi.blocksizes[0] / 2,
+ vi.blocksizes[0] / 2);
+ window[1][0][0][i] = window(i, vi.blocksizes[1], vi.blocksizes[0] / 2,
+ vi.blocksizes[0] / 2);
+ window[1][0][1][i] = window(i, vi.blocksizes[1], vi.blocksizes[0] / 2,
+ vi.blocksizes[1] / 2);
+ window[1][1][0][i] = window(i, vi.blocksizes[1], vi.blocksizes[1] / 2,
+ vi.blocksizes[0] / 2);
+ window[1][1][1][i] = window(i, vi.blocksizes[1], vi.blocksizes[1] / 2,
+ vi.blocksizes[1] / 2);
+ }
+
+ fullbooks = new CodeBook[vi.books];
+ for (int i = 0; i < vi.books; i++) {
+ fullbooks[i] = new CodeBook();
+ fullbooks[i].init_decode(vi.book_param[i]);
+ }
+
+ // initialize the storage vectors to a decent size greater than the
+ // minimum
+
+ pcm_storage = 8192; // we'll assume later that we have
+ // a minimum of twice the blocksize of
+ // accumulated samples in analysis
+ pcm = new float[vi.channels][];
+ {
+ for (int i = 0; i < vi.channels; i++) {
+ pcm[i] = new float[pcm_storage];
+ }
+ }
+
+ // all 1 (large block) or 0 (small block)
+ // explicitly set for the sake of clarity
+ lW = 0; // previous window size
+ W = 0; // current window size
+
+ // all vector indexes; multiples of samples_per_envelope_step
+ centerW = vi.blocksizes[1] / 2;
+
+ pcm_current = centerW;
+
+ // initialize all the mapping/backend lookups
+ mode = new Object[vi.modes];
+ for (int i = 0; i < vi.modes; i++) {
+ int mapnum = vi.mode_param[i].mapping;
+ int maptype = vi.map_type[mapnum];
+ mode[i] = FuncMapping.mapping_P[maptype].look(this, vi.mode_param[i],
+ vi.map_param[mapnum]);
+ }
+ return (0);
+ }
+
+ public int synthesis_init(Info vi) {
+ init(vi, false);
+ // Adjust centerW to allow an easier mechanism for determining output
+ pcm_returned = centerW;
+ centerW -= vi.blocksizes[W] / 4 + vi.blocksizes[lW] / 4;
+ granulepos = -1;
+ sequence = -1;
+ return (0);
+ }
+
+ DspState(Info vi) {
+ this();
+ init(vi, false);
+ // Adjust centerW to allow an easier mechanism for determining output
+ pcm_returned = centerW;
+ centerW -= vi.blocksizes[W] / 4 + vi.blocksizes[lW] / 4;
+ granulepos = -1;
+ sequence = -1;
+ }
+
+ // Unike 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).
+
+ public int synthesis_blockin(Block vb) {
+ // Shift out any PCM/multipliers that we returned previously
+ // centerW is currently the center of the last block added
+ if (centerW > vi.blocksizes[1] / 2 && pcm_returned > 8192) {
+ // don't shift too much; we need to have a minimum PCM buffer of
+ // 1/2 long block
+
+ int shiftPCM = centerW - vi.blocksizes[1] / 2;
+ shiftPCM = (pcm_returned < shiftPCM ? pcm_returned : shiftPCM);
+
+ pcm_current -= shiftPCM;
+ centerW -= shiftPCM;
+ pcm_returned -= shiftPCM;
+ if (shiftPCM != 0) {
+ for (int i = 0; i < vi.channels; i++) {
+ System.arraycopy(pcm[i], shiftPCM, pcm[i], 0, pcm_current);
+ }
+ }
+ }
+
+ lW = W;
+ W = vb.W;
+ nW = -1;
+
+ glue_bits += vb.glue_bits;
+ time_bits += vb.time_bits;
+ floor_bits += vb.floor_bits;
+ res_bits += vb.res_bits;
+
+ if (sequence + 1 != vb.sequence)
+ granulepos = -1; // out of sequence; lose count
+
+ sequence = vb.sequence;
+
+ {
+ int sizeW = vi.blocksizes[W];
+ int _centerW = centerW + vi.blocksizes[lW] / 4 + sizeW / 4;
+ int beginW = _centerW - sizeW / 2;
+ int endW = beginW + sizeW;
+ int beginSl = 0;
+ int endSl = 0;
+
+ // Do we have enough PCM/mult storage for the block?
+ if (endW > pcm_storage) {
+ // expand the storage
+ pcm_storage = endW + vi.blocksizes[1];
+ for (int i = 0; i < vi.channels; i++) {
+ float[] foo = new float[pcm_storage];
+ System.arraycopy(pcm[i], 0, foo, 0, pcm[i].length);
+ pcm[i] = foo;
+ }
+ }
+
+ // overlap/add PCM
+ switch (W) {
+ case 0:
+ beginSl = 0;
+ endSl = vi.blocksizes[0] / 2;
+ break;
+ case 1:
+ beginSl = vi.blocksizes[1] / 4 - vi.blocksizes[lW] / 4;
+ endSl = beginSl + vi.blocksizes[lW] / 2;
+ break;
+ }
+
+ for (int j = 0; j < vi.channels; j++) {
+ int _pcm = beginW;
+ // the overlap/add section
+ int i = 0;
+ for (i = beginSl; i < endSl; i++) {
+ pcm[j][_pcm + i] += vb.pcm[j][i];
+ }
+ // the remaining section
+ for (; i < sizeW; i++) {
+ pcm[j][_pcm + i] = vb.pcm[j][i];
+ }
+ }
+
+ // 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 (granulepos == -1) {
+ granulepos = vb.granulepos;
+ } else {
+ granulepos += (_centerW - centerW);
+ if (vb.granulepos != -1 && granulepos != vb.granulepos) {
+ if (granulepos > vb.granulepos && vb.eofflag != 0) {
+ // partial last frame. Strip the padding off
+ _centerW -= (granulepos - vb.granulepos);
+ }// else{ Shouldn't happen *unless* the bitstream is out of
+ // spec. Either way, believe the bitstream }
+ granulepos = vb.granulepos;
+ }
+ }
+
+ // Update, cleanup
+
+ centerW = _centerW;
+ pcm_current = endW;
+ if (vb.eofflag != 0)
+ eofflag = 1;
+ }
+ return (0);
+ }
+
+ // pcm==NULL indicates we just want the pending samples, no more
+ public int synthesis_pcmout(float[][][] _pcm) {
+ if (pcm_returned < centerW) {
+ if (_pcm != null) {
+ _pcm[0] = new float[pcm.length][pcm[0].length];
+ for (int i = 0; i < vi.channels; i++) {
+ System.arraycopy(pcm[i], pcm_returned, _pcm[0][i], 0, centerW - pcm_returned);
+ }
+ }
+ return (centerW - pcm_returned);
+ }
+ return (0);
+ }
+
+ public int synthesis_read(int bytes) {
+ if (bytes != 0 && pcm_returned + bytes > centerW)
+ return (-1);
+ pcm_returned += bytes;
+ return (0);
+ }
+
+ public void clear() {
+ }
+}
diff --git a/src/main/java/com/jcraft/jorbis/Floor0.java b/src/main/java/com/jcraft/jorbis/Floor0.java
new file mode 100644
index 00000000..02e8393e
--- /dev/null
+++ b/src/main/java/com/jcraft/jorbis/Floor0.java
@@ -0,0 +1,335 @@
+/* -*-mode:java; c-basic-offset:2; indent-tabs-mode:nil -*- */
+/* JOrbis
+ * Copyright (C) 2000 ymnk, JCraft,Inc.
+ *
+ * Written by: 2000 ymnk
+ *
+ * Many thanks to
+ * Monty and
+ * The XIPHOPHORUS Company http://www.xiph.org/ .
+ * JOrbis has been based on their awesome works, Vorbis codec.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License
+ * as published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU 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 com.jcraft.jorbis;
+
+import com.jcraft.jogg.*;
+
+class Floor0 extends FuncFloor{
+
+ void pack(Object i, Buffer opb){
+ InfoFloor0 info=(InfoFloor0)i;
+ opb.write(info.order, 8);
+ opb.write(info.rate, 16);
+ opb.write(info.barkmap, 16);
+ opb.write(info.ampbits, 6);
+ opb.write(info.ampdB, 8);
+ opb.write(info.numbooks-1, 4);
+ for(int j=0; j=vi.books){
+ return (null);
+ }
+ }
+ return (info);
+ }
+
+ Object look(DspState vd, InfoMode mi, Object i){
+ float scale;
+ Info vi=vd.vi;
+ InfoFloor0 info=(InfoFloor0)i;
+ LookFloor0 look=new LookFloor0();
+ look.m=info.order;
+ look.n=vi.blocksizes[mi.blockflag]/2;
+ look.ln=info.barkmap;
+ look.vi=info;
+ look.lpclook.init(look.ln, look.m);
+
+ // we choose a scaling constant so that:
+ scale=look.ln/toBARK((float)(info.rate/2.));
+
+ // 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=new int[look.n];
+ for(int j=0; j=look.ln)
+ val=look.ln; // guard against the approximation
+ look.linearmap[j]=val;
+ }
+ return look;
+ }
+
+ static float toBARK(float f){
+ return (float)(13.1*Math.atan(.00074*(f))+2.24*Math.atan((f)*(f)*1.85e-8)+1e-4*(f));
+ }
+
+ Object state(Object i){
+ EchstateFloor0 state=new EchstateFloor0();
+ InfoFloor0 info=(InfoFloor0)i;
+
+ // a safe size if usually too big (dim==1)
+ state.codewords=new int[info.order];
+ state.curve=new float[info.barkmap];
+ state.frameno=-1;
+ return (state);
+ }
+
+ void free_info(Object i){
+ }
+
+ void free_look(Object i){
+ }
+
+ void free_state(Object vs){
+ }
+
+ int forward(Block vb, Object i, float[] in, float[] out, Object vs){
+ return 0;
+ }
+
+ float[] lsp=null;
+
+ int inverse(Block vb, Object i, float[] out){
+ //System.err.println("Floor0.inverse "+i.getClass()+"]");
+ LookFloor0 look=(LookFloor0)i;
+ InfoFloor0 info=look.vi;
+ int ampraw=vb.opb.read(info.ampbits);
+ if(ampraw>0){ // also handles the -1 out of data case
+ int maxval=(1<0){ // also handles the -1 out of data case
+ int maxval=(1<m+1 must be less than l->ln, but guard in case we get a bad stream
+ float[] lcurve=new float[Math.max(l.ln*2, l.m*2+2)];
+
+ if(amp==0){
+ for(int j=0; j
+ *
+ * Many thanks to
+ * Monty and
+ * The XIPHOPHORUS Company http://www.xiph.org/ .
+ * JOrbis has been based on their awesome works, Vorbis codec.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License
+ * as published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU 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 com.jcraft.jorbis;
+
+import com.jcraft.jogg.*;
+
+class Floor1 extends FuncFloor{
+ static final int floor1_rangedb=140;
+ static final int VIF_POSIT=63;
+
+ void pack(Object i, Buffer opb){
+ InfoFloor1 info=(InfoFloor1)i;
+
+ int count=0;
+ int rangebits;
+ int maxposit=info.postlist[1];
+ int maxclass=-1;
+
+ /* save out partitions */
+ opb.write(info.partitions, 5); /* only 0 to 31 legal */
+ for(int j=0; j=vi.books){
+ info.free();
+ return (null);
+ }
+ for(int k=0; k<(1<=vi.books){
+ info.free();
+ return (null);
+ }
+ }
+ }
+
+ /* read the post list */
+ info.mult=opb.read(2)+1; /* only 1,2,3,4 legal now */
+ rangebits=opb.read(4);
+
+ for(int j=0, k=0; j=(1<info.postlist[sortpointer[k]]){
+ foo=sortpointer[k];
+ sortpointer[k]=sortpointer[j];
+ sortpointer[j]=foo;
+ }
+ }
+ }
+
+ /* points from sort order back to range number */
+ for(int j=0; j<_n; j++){
+ look.forward_index[j]=sortpointer[j];
+ }
+ /* points from range order to sorted position */
+ for(int j=0; j<_n; j++){
+ look.reverse_index[look.forward_index[j]]=j;
+ }
+ /* we actually need the post values too */
+ for(int j=0; j<_n; j++){
+ look.sorted_index[j]=info.postlist[look.forward_index[j]];
+ }
+
+ /* 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;
+ default:
+ look.quant_q=-1;
+ }
+
+ /* discover our neighbors for decode where we don't use fit flags
+ (that would push the neighbors outward) */
+ for(int j=0; j<_n-2; j++){
+ int lo=0;
+ int hi=1;
+ int lx=0;
+ int hx=look.n;
+ int currentx=info.postlist[j+2];
+ for(int k=0; klx&&xcurrentx){
+ hi=k;
+ hx=x;
+ }
+ }
+ look.loneighbor[j]=lo;
+ look.hineighbor[j]=hi;
+ }
+
+ return look;
+ }
+
+ void free_info(Object i){
+ }
+
+ void free_look(Object i){
+ }
+
+ void free_state(Object vs){
+ }
+
+ int forward(Block vb, Object i, float[] in, float[] out, Object vs){
+ return 0;
+ }
+
+ Object inverse1(Block vb, Object ii, Object memo){
+ LookFloor1 look=(LookFloor1)ii;
+ InfoFloor1 info=look.vi;
+ CodeBook[] books=vb.vd.fullbooks;
+
+ /* unpack wrapped/predicted values from stream */
+ if(vb.opb.read(1)==1){
+ int[] fit_value=null;
+ if(memo instanceof int[]){
+ fit_value=(int[])memo;
+ }
+ if(fit_value==null||fit_value.length>>=csubbits;
+ if(book>=0){
+ if((fit_value[j+k]=books[book].decode(vb.opb))==-1){
+ return (null);
+ }
+ }
+ else{
+ fit_value[j+k]=0;
+ }
+ }
+ j+=cdim;
+ }
+
+ /* unwrap positive values and reconsitute via linear interpolation */
+ for(int i=2; i=room){
+ if(hiroom>loroom){
+ val=val-loroom;
+ }
+ else{
+ val=-1-(val-hiroom);
+ }
+ }
+ else{
+ if((val&1)!=0){
+ 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);
+ }
+
+ return (null);
+ }
+
+ private 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=Math.abs(dy);
+ int err=ady*(x-x0);
+
+ int off=(int)(err/adx);
+ if(dy<0)
+ return (y0-off);
+ return (y0+off);
+ }
+ }
+
+ int inverse2(Block vb, Object i, Object memo, float[] out){
+ LookFloor1 look=(LookFloor1)i;
+ InfoFloor1 info=look.vi;
+ int n=vb.vd.vi.blocksizes[vb.mode]/2;
+
+ if(memo!=null){
+ /* render the lines */
+ int[] fit_value=(int[])memo;
+ int hx=0;
+ int lx=0;
+ int ly=fit_value[0]*info.mult;
+ for(int j=1; j=adx){
+ err-=adx;
+ y+=sy;
+ }
+ else{
+ y+=base;
+ }
+ d[x]*=FLOOR_fromdB_LOOKUP[y];
+ }
+ }
+
+ class InfoFloor1{
+ static final int VIF_POSIT=63;
+ static final int VIF_CLASS=16;
+ static final int VIF_PARTS=31;
+
+ int partitions; /* 0 to 31 */
+ int[] partitionclass=new int[VIF_PARTS]; /* 0 to 15 */
+
+ int[] class_dim=new int[VIF_CLASS]; /* 1 to 8 */
+ int[] class_subs=new int[VIF_CLASS]; /* 0,1,2,3 (bits: 1<
+ *
+ * Many thanks to
+ * Monty and
+ * The XIPHOPHORUS Company http://www.xiph.org/ .
+ * JOrbis has been based on their awesome works, Vorbis codec.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License
+ * as published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU 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 com.jcraft.jorbis;
+
+import com.jcraft.jogg.*;
+
+abstract class FuncFloor{
+
+ public static FuncFloor[] floor_P= {new Floor0(), new Floor1()};
+
+ abstract void pack(Object i, Buffer opb);
+
+ abstract Object unpack(Info vi, Buffer opb);
+
+ abstract Object look(DspState vd, InfoMode mi, Object i);
+
+ abstract void free_info(Object i);
+
+ abstract void free_look(Object i);
+
+ abstract void free_state(Object vs);
+
+ abstract int forward(Block vb, Object i, float[] in, float[] out, Object vs);
+
+ abstract Object inverse1(Block vb, Object i, Object memo);
+
+ abstract int inverse2(Block vb, Object i, Object memo, float[] out);
+}
diff --git a/src/main/java/com/jcraft/jorbis/FuncMapping.java b/src/main/java/com/jcraft/jorbis/FuncMapping.java
new file mode 100644
index 00000000..50c1028c
--- /dev/null
+++ b/src/main/java/com/jcraft/jorbis/FuncMapping.java
@@ -0,0 +1,45 @@
+/* -*-mode:java; c-basic-offset:2; indent-tabs-mode:nil -*- */
+/* JOrbis
+ * Copyright (C) 2000 ymnk, JCraft,Inc.
+ *
+ * Written by: 2000 ymnk
+ *
+ * Many thanks to
+ * Monty and
+ * The XIPHOPHORUS Company http://www.xiph.org/ .
+ * JOrbis has been based on their awesome works, Vorbis codec.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License
+ * as published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU 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 com.jcraft.jorbis;
+
+import com.jcraft.jogg.*;
+
+abstract class FuncMapping{
+ public static FuncMapping[] mapping_P= {new Mapping0()};
+
+ abstract void pack(Info info, Object imap, Buffer buffer);
+
+ abstract Object unpack(Info info, Buffer buffer);
+
+ abstract Object look(DspState vd, InfoMode vm, Object m);
+
+ abstract void free_info(Object imap);
+
+ abstract void free_look(Object imap);
+
+ abstract int inverse(Block vd, Object lm);
+}
diff --git a/src/main/java/com/jcraft/jorbis/FuncResidue.java b/src/main/java/com/jcraft/jorbis/FuncResidue.java
new file mode 100644
index 00000000..e3819756
--- /dev/null
+++ b/src/main/java/com/jcraft/jorbis/FuncResidue.java
@@ -0,0 +1,46 @@
+/* -*-mode:java; c-basic-offset:2; indent-tabs-mode:nil -*- */
+/* JOrbis
+ * Copyright (C) 2000 ymnk, JCraft,Inc.
+ *
+ * Written by: 2000 ymnk
+ *
+ * Many thanks to
+ * Monty and
+ * The XIPHOPHORUS Company http://www.xiph.org/ .
+ * JOrbis has been based on their awesome works, Vorbis codec.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License
+ * as published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU 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 com.jcraft.jorbis;
+
+import com.jcraft.jogg.*;
+
+abstract class FuncResidue{
+ public static FuncResidue[] residue_P= {new Residue0(), new Residue1(),
+ new Residue2()};
+
+ abstract void pack(Object vr, Buffer opb);
+
+ abstract Object unpack(Info vi, Buffer opb);
+
+ abstract Object look(DspState vd, InfoMode vm, Object vr);
+
+ abstract void free_info(Object i);
+
+ abstract void free_look(Object i);
+
+ abstract int inverse(Block vb, Object vl, float[][] in, int[] nonzero, int ch);
+}
diff --git a/src/main/java/com/jcraft/jorbis/FuncTime.java b/src/main/java/com/jcraft/jorbis/FuncTime.java
new file mode 100644
index 00000000..37b868be
--- /dev/null
+++ b/src/main/java/com/jcraft/jorbis/FuncTime.java
@@ -0,0 +1,45 @@
+/* -*-mode:java; c-basic-offset:2; indent-tabs-mode:nil -*- */
+/* JOrbis
+ * Copyright (C) 2000 ymnk, JCraft,Inc.
+ *
+ * Written by: 2000 ymnk
+ *
+ * Many thanks to
+ * Monty and
+ * The XIPHOPHORUS Company http://www.xiph.org/ .
+ * JOrbis has been based on their awesome works, Vorbis codec.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License
+ * as published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU 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 com.jcraft.jorbis;
+
+import com.jcraft.jogg.*;
+
+abstract class FuncTime{
+ public static FuncTime[] time_P= {new Time0()};
+
+ abstract void pack(Object i, Buffer opb);
+
+ abstract Object unpack(Info vi, Buffer opb);
+
+ abstract Object look(DspState vd, InfoMode vm, Object i);
+
+ abstract void free_info(Object i);
+
+ abstract void free_look(Object i);
+
+ abstract int inverse(Block vb, Object i, float[] in, float[] out);
+}
diff --git a/src/main/java/com/jcraft/jorbis/Info.java b/src/main/java/com/jcraft/jorbis/Info.java
new file mode 100644
index 00000000..77cf7697
--- /dev/null
+++ b/src/main/java/com/jcraft/jorbis/Info.java
@@ -0,0 +1,469 @@
+/* -*-mode:java; c-basic-offset:2; indent-tabs-mode:nil -*- */
+/* JOrbis
+ * Copyright (C) 2000 ymnk, JCraft,Inc.
+ *
+ * Written by: 2000 ymnk
+ *
+ * Many thanks to
+ * Monty and
+ * The XIPHOPHORUS Company http://www.xiph.org/ .
+ * JOrbis has been based on their awesome works, Vorbis codec.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License
+ * as published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU 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 com.jcraft.jorbis;
+
+import com.jcraft.jogg.*;
+
+public class Info{
+ private static final int OV_EBADPACKET=-136;
+ private static final int OV_ENOTAUDIO=-135;
+
+ private static byte[] _vorbis="vorbis".getBytes();
+ private static final int VI_TIMEB=1;
+ // private static final int VI_FLOORB=1;
+ private static final int VI_FLOORB=2;
+ // private static final int VI_RESB=1;
+ private static final int VI_RESB=3;
+ private static final int VI_MAPB=1;
+ private static final int VI_WINDOWB=1;
+
+ public int version;
+ public int channels;
+ public int 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.
+
+ int bitrate_upper;
+ int bitrate_nominal;
+ int bitrate_lower;
+
+ // Vorbis supports only short and long blocks, but allows the
+ // encoder to choose the sizes
+
+ int[] blocksizes=new int[2];
+
+ // modes are the primary means of supporting on-the-fly different
+ // blocksizes, different channel mappings (LR or mid-side),
+ // different residue backends, etc. Each mode consists of a
+ // blocksize flag and a mapping (along with the mapping setup
+
+ int modes;
+ int maps;
+ int times;
+ int floors;
+ int residues;
+ int books;
+ int psys; // encode only
+
+ InfoMode[] mode_param=null;
+
+ int[] map_type=null;
+ Object[] map_param=null;
+
+ int[] time_type=null;
+ Object[] time_param=null;
+
+ int[] floor_type=null;
+ Object[] floor_param=null;
+
+ int[] residue_type=null;
+ Object[] residue_param=null;
+
+ StaticCodeBook[] book_param=null;
+
+ PsyInfo[] psy_param=new PsyInfo[64]; // encode only
+
+ // for block long/sort tuning; encode only
+ int envelopesa;
+ float preecho_thresh;
+ float preecho_clamp;
+
+ // used by synthesis, which has a full, alloced vi
+ public void init(){
+ rate=0;
+ }
+
+ public void clear(){
+ for(int i=0; ibook_param)free(vi->book_param);
+ book_param=null;
+
+ for(int i=0; i=VI_TIMEB){
+ clear();
+ return (-1);
+ }
+ time_param[i]=FuncTime.time_P[time_type[i]].unpack(this, opb);
+ if(time_param[i]==null){
+ clear();
+ return (-1);
+ }
+ }
+
+ // floor backend settings
+ floors=opb.read(6)+1;
+ if(floor_type==null||floor_type.length!=floors)
+ floor_type=new int[floors];
+ if(floor_param==null||floor_param.length!=floors)
+ floor_param=new Object[floors];
+
+ for(int i=0; i=VI_FLOORB){
+ clear();
+ return (-1);
+ }
+
+ floor_param[i]=FuncFloor.floor_P[floor_type[i]].unpack(this, opb);
+ if(floor_param[i]==null){
+ clear();
+ return (-1);
+ }
+ }
+
+ // residue backend settings
+ residues=opb.read(6)+1;
+
+ if(residue_type==null||residue_type.length!=residues)
+ residue_type=new int[residues];
+
+ if(residue_param==null||residue_param.length!=residues)
+ residue_param=new Object[residues];
+
+ for(int i=0; i=VI_RESB){
+ clear();
+ return (-1);
+ }
+ residue_param[i]=FuncResidue.residue_P[residue_type[i]].unpack(this, opb);
+ if(residue_param[i]==null){
+ clear();
+ return (-1);
+ }
+ }
+
+ // map backend settings
+ maps=opb.read(6)+1;
+ if(map_type==null||map_type.length!=maps)
+ map_type=new int[maps];
+ if(map_param==null||map_param.length!=maps)
+ map_param=new Object[maps];
+ for(int i=0; i=VI_MAPB){
+ clear();
+ return (-1);
+ }
+ map_param[i]=FuncMapping.mapping_P[map_type[i]].unpack(this, opb);
+ if(map_param[i]==null){
+ clear();
+ return (-1);
+ }
+ }
+
+ // mode settings
+ modes=opb.read(6)+1;
+ if(mode_param==null||mode_param.length!=modes)
+ mode_param=new InfoMode[modes];
+ for(int i=0; i=VI_WINDOWB)
+ ||(mode_param[i].transformtype>=VI_WINDOWB)
+ ||(mode_param[i].mapping>=maps)){
+ clear();
+ return (-1);
+ }
+ }
+
+ if(opb.read(1)!=1){
+ clear();
+ return (-1);
+ }
+
+ return (0);
+ }
+
+ // 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.
+
+ public int synthesis_headerin(Comment vc, Packet op){
+ Buffer opb=new Buffer();
+
+ if(op!=null){
+ opb.readinit(op.packet_base, op.packet, op.bytes);
+
+ // Which of the three types of header is this?
+ // Also verify header-ness, vorbis
+ {
+ byte[] buffer=new byte[6];
+ int packtype=opb.read(8);
+ opb.read(buffer, 6);
+ if(buffer[0]!='v'||buffer[1]!='o'||buffer[2]!='r'||buffer[3]!='b'
+ ||buffer[4]!='i'||buffer[5]!='s'){
+ // not a vorbis header
+ return (-1);
+ }
+ switch(packtype){
+ case 0x01: // least significant *bit* is read first
+ if(op.b_o_s==0){
+ // Not the initial packet
+ return (-1);
+ }
+ if(rate!=0){
+ // previously initialized info header
+ return (-1);
+ }
+ return (unpack_info(opb));
+ case 0x03: // least significant *bit* is read first
+ if(rate==0){
+ // um... we didn't get the initial header
+ return (-1);
+ }
+ return (vc.unpack(opb));
+ case 0x05: // least significant *bit* is read first
+ if(rate==0||vc.vendor==null){
+ // um... we didn;t get the initial header or comments yet
+ return (-1);
+ }
+ return (unpack_books(opb));
+ default:
+ // Not a valid vorbis header type
+ //return(-1);
+ break;
+ }
+ }
+ }
+ return (-1);
+ }
+
+ // pack side
+ int pack_info(Buffer opb){
+ // preamble
+ opb.write(0x01, 8);
+ opb.write(_vorbis);
+
+ // basic information about the stream
+ opb.write(0x00, 32);
+ opb.write(channels, 8);
+ opb.write(rate, 32);
+
+ opb.write(bitrate_upper, 32);
+ opb.write(bitrate_nominal, 32);
+ opb.write(bitrate_lower, 32);
+
+ opb.write(Util.ilog2(blocksizes[0]), 4);
+ opb.write(Util.ilog2(blocksizes[1]), 4);
+ opb.write(1, 1);
+ return (0);
+ }
+
+ int pack_books(Buffer opb){
+ opb.write(0x05, 8);
+ opb.write(_vorbis);
+
+ // books
+ opb.write(books-1, 8);
+ for(int i=0; i1){
+ modebits++;
+ v>>>=1;
+ }
+
+ /* read our mode and pre/post windowsize */
+ mode=opb.read(modebits);
+ }
+ if(mode==-1)
+ return (OV_EBADPACKET);
+ return (blocksizes[mode_param[mode].blockflag]);
+ }
+
+ public String toString(){
+ return "version:"+new Integer(version)+", channels:"+new Integer(channels)
+ +", rate:"+new Integer(rate)+", bitrate:"+new Integer(bitrate_upper)
+ +","+new Integer(bitrate_nominal)+","+new Integer(bitrate_lower);
+ }
+}
diff --git a/src/main/java/com/jcraft/jorbis/InfoMode.java b/src/main/java/com/jcraft/jorbis/InfoMode.java
new file mode 100644
index 00000000..e8641741
--- /dev/null
+++ b/src/main/java/com/jcraft/jorbis/InfoMode.java
@@ -0,0 +1,34 @@
+/* -*-mode:java; c-basic-offset:2; indent-tabs-mode:nil -*- */
+/* JOrbis
+ * Copyright (C) 2000 ymnk, JCraft,Inc.
+ *
+ * Written by: 2000 ymnk
+ *
+ * Many thanks to
+ * Monty and
+ * The XIPHOPHORUS Company http://www.xiph.org/ .
+ * JOrbis has been based on their awesome works, Vorbis codec.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License
+ * as published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU 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 com.jcraft.jorbis;
+
+class InfoMode{
+ int blockflag;
+ int windowtype;
+ int transformtype;
+ int mapping;
+}
diff --git a/src/main/java/com/jcraft/jorbis/JOrbisException.java b/src/main/java/com/jcraft/jorbis/JOrbisException.java
new file mode 100644
index 00000000..98c95a43
--- /dev/null
+++ b/src/main/java/com/jcraft/jorbis/JOrbisException.java
@@ -0,0 +1,40 @@
+/* -*-mode:java; c-basic-offset:2; indent-tabs-mode:nil -*- */
+/* JOrbis
+ * Copyright (C) 2000 ymnk, JCraft,Inc.
+ *
+ * Written by: 2000 ymnk
+ *
+ * Many thanks to
+ * Monty and
+ * The XIPHOPHORUS Company http://www.xiph.org/ .
+ * JOrbis has been based on their awesome works, Vorbis codec.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License
+ * as published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU 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 com.jcraft.jorbis;
+
+public class JOrbisException extends Exception{
+
+ private static final long serialVersionUID=1L;
+
+ public JOrbisException(){
+ super();
+ }
+
+ public JOrbisException(String s){
+ super("JOrbis: "+s);
+ }
+}
diff --git a/src/main/java/com/jcraft/jorbis/Lookup.java b/src/main/java/com/jcraft/jorbis/Lookup.java
new file mode 100644
index 00000000..0d152669
--- /dev/null
+++ b/src/main/java/com/jcraft/jorbis/Lookup.java
@@ -0,0 +1,152 @@
+/* -*-mode:java; c-basic-offset:2; indent-tabs-mode:nil -*- */
+/* JOrbis
+ * Copyright (C) 2000 ymnk, JCraft,Inc.
+ *
+ * Written by: 2000 ymnk
+ *
+ * Many thanks to
+ * Monty and
+ * The XIPHOPHORUS Company http://www.xiph.org/ .
+ * JOrbis has been based on their awesome works, Vorbis codec.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License
+ * as published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU 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 com.jcraft.jorbis;
+
+class Lookup{
+ static final int COS_LOOKUP_SZ=128;
+ static final float[] COS_LOOKUP= {+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,};
+
+ /* interpolated lookup based cos function, domain 0 to PI only */
+ static float coslook(float a){
+ double d=a*(.31830989*(float)COS_LOOKUP_SZ);
+ int i=(int)d;
+ return COS_LOOKUP[i]+((float)(d-i))*(COS_LOOKUP[i+1]-COS_LOOKUP[i]);
+ }
+
+ static final int INVSQ_LOOKUP_SZ=32;
+ static final float[] INVSQ_LOOKUP= {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,};
+
+ /* interpolated 1./sqrt(p) where .5 <= p < 1. */
+ static float invsqlook(float a){
+ double d=a*(2.f*(float)INVSQ_LOOKUP_SZ)-(float)INVSQ_LOOKUP_SZ;
+ int i=(int)d;
+ return INVSQ_LOOKUP[i]+((float)(d-i))*(INVSQ_LOOKUP[i+1]-INVSQ_LOOKUP[i]);
+ }
+
+ static final int INVSQ2EXP_LOOKUP_MIN=-32;
+ static final int INVSQ2EXP_LOOKUP_MAX=32;
+ static final float[] INVSQ2EXP_LOOKUP= {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,};
+
+ /* interpolated 1./sqrt(p) where .5 <= p < 1. */
+ static float invsq2explook(int a){
+ return INVSQ2EXP_LOOKUP[a-INVSQ2EXP_LOOKUP_MIN];
+ }
+
+ static final int FROMdB_LOOKUP_SZ=35;
+ static final int FROMdB2_LOOKUP_SZ=32;
+ static final int FROMdB_SHIFT=5;
+ static final int FROMdB2_SHIFT=3;
+ static final int FROMdB2_MASK=31;
+ static final float[] FROMdB_LOOKUP= {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 final float[] FROMdB2_LOOKUP= {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,};
+
+ /* interpolated lookup based fromdB function, domain -140dB to 0dB only */
+ static float fromdBlook(float a){
+ int i=(int)(a*((float)(-(1<=(FROMdB_LOOKUP_SZ<>>FROMdB_SHIFT]*FROMdB2_LOOKUP[i&FROMdB2_MASK]);
+ }
+
+}
diff --git a/src/main/java/com/jcraft/jorbis/Lpc.java b/src/main/java/com/jcraft/jorbis/Lpc.java
new file mode 100644
index 00000000..aef5e990
--- /dev/null
+++ b/src/main/java/com/jcraft/jorbis/Lpc.java
@@ -0,0 +1,188 @@
+/* -*-mode:java; c-basic-offset:2; indent-tabs-mode:nil -*- */
+/* JOrbis
+ * Copyright (C) 2000 ymnk, JCraft,Inc.
+ *
+ * Written by: 2000 ymnk
+ *
+ * Many thanks to
+ * Monty and
+ * The XIPHOPHORUS Company http://www.xiph.org/ .
+ * JOrbis has been based on their awesome works, Vorbis codec.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License
+ * as published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU 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 com.jcraft.jorbis;
+
+class Lpc{
+ // en/decode lookups
+ Drft fft=new Drft();;
+
+ int ln;
+ int m;
+
+ // 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
+
+ static float lpc_from_data(float[] data, float[] lpc, int n, int m){
+ float[] aut=new float[m+1];
+ float error;
+ int i, j;
+
+ // autocorrelation, p+1 lag coefficients
+
+ j=m+1;
+ while(j--!=0){
+ float d=0;
+ for(i=j; i
+ *
+ * Many thanks to
+ * Monty and
+ * The XIPHOPHORUS Company http://www.xiph.org/ .
+ * JOrbis has been based on their awesome works, Vorbis codec.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License
+ * as published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU 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 com.jcraft.jorbis;
+
+/*
+ function: LSP (also called LSF) conversion routines
+
+ The LSP generation code is taken (with minimal modification) from
+ "On the Computation of the LSP Frequencies" by Joseph Rothweiler
+ , available at:
+
+ http://www2.xtdl.com/~rothwlr/lsfpaper/lsfpage.html
+ ********************************************************************/
+
+class Lsp{
+
+ static final float M_PI=(float)(3.1415926539);
+
+ static void 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=0x7f800000||(ix==0)){
+ // 0,inf,nan
+ }
+ else{
+ if(ix<0x00800000){ // subnormal
+ q*=3.3554432000e+07; // 0x4c000000
+ hx=Float.floatToIntBits(q);
+ ix=0x7fffffff&hx;
+ qexp=-25;
+ }
+ qexp+=((ix>>>23)-126);
+ hx=(hx&0x807fffff)|0x3f000000;
+ q=Float.intBitsToFloat(hx);
+ }
+
+ q=Lookup.fromdBlook(amp*Lookup.invsqlook(q)*Lookup.invsq2explook(qexp+m)
+ -ampoffset);
+
+ do{
+ curve[i++]*=q;
+ }
+ while(i
+ *
+ * Many thanks to
+ * Monty and
+ * The XIPHOPHORUS Company http://www.xiph.org/ .
+ * JOrbis has been based on their awesome works, Vorbis codec.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License
+ * as published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU 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 com.jcraft.jorbis;
+
+import com.jcraft.jogg.*;
+
+class Mapping0 extends FuncMapping{
+ static int seq=0;
+
+ void free_info(Object imap){
+ };
+
+ void free_look(Object imap){
+ }
+
+ Object look(DspState vd, InfoMode vm, Object m){
+ //System.err.println("Mapping0.look");
+ Info vi=vd.vi;
+ LookMapping0 look=new LookMapping0();
+ InfoMapping0 info=look.map=(InfoMapping0)m;
+ look.mode=vm;
+
+ look.time_look=new Object[info.submaps];
+ look.floor_look=new Object[info.submaps];
+ look.residue_look=new Object[info.submaps];
+
+ look.time_func=new FuncTime[info.submaps];
+ look.floor_func=new FuncFloor[info.submaps];
+ look.residue_func=new FuncResidue[info.submaps];
+
+ for(int i=0; i1){
+ opb.write(1, 1);
+ opb.write(info.submaps-1, 4);
+ }
+ else{
+ opb.write(0, 1);
+ }
+
+ if(info.coupling_steps>0){
+ opb.write(1, 1);
+ opb.write(info.coupling_steps-1, 8);
+ for(int i=0; i1){
+ for(int i=0; i=vi.channels
+ ||testA>=vi.channels){
+ //goto err_out;
+ info.free();
+ return (null);
+ }
+ }
+ }
+
+ if(opb.read(2)>0){ /* 2,3:reserved */
+ info.free();
+ return (null);
+ }
+
+ if(info.submaps>1){
+ for(int i=0; i=info.submaps){
+ info.free();
+ return (null);
+ }
+ }
+ }
+
+ for(int i=0; i=vi.times){
+ info.free();
+ return (null);
+ }
+ info.floorsubmap[i]=opb.read(8);
+ if(info.floorsubmap[i]>=vi.floors){
+ info.free();
+ return (null);
+ }
+ info.residuesubmap[i]=opb.read(8);
+ if(info.residuesubmap[i]>=vi.residues){
+ info.free();
+ return (null);
+ }
+ }
+ return info;
+ }
+
+ float[][] pcmbundle=null;
+ int[] zerobundle=null;
+ int[] nonzero=null;
+ Object[] floormemo=null;
+
+ synchronized int inverse(Block vb, Object l){
+ DspState vd=vb.vd;
+ Info vi=vd.vi;
+ LookMapping0 look=(LookMapping0)l;
+ InfoMapping0 info=look.map;
+ InfoMode mode=look.mode;
+ int n=vb.pcmend=vi.blocksizes[vb.W];
+
+ float[] window=vd.window[vb.W][vb.lW][vb.nW][mode.windowtype];
+ if(pcmbundle==null||pcmbundle.length=0; i--){
+ float[] pcmM=vb.pcm[info.coupling_mag[i]];
+ float[] pcmA=vb.pcm[info.coupling_ang[i]];
+
+ for(int 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(int i=0; i
+ *
+ * Many thanks to
+ * Monty and
+ * The XIPHOPHORUS Company http://www.xiph.org/ .
+ * JOrbis has been based on their awesome works, Vorbis codec.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License
+ * as published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU 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 com.jcraft.jorbis;
+
+class Mdct{
+
+ int n;
+ int log2n;
+
+ float[] trig;
+ int[] bitrev;
+
+ float scale;
+
+ void init(int n){
+ bitrev=new int[n/4];
+ trig=new float[n+n/4];
+
+ log2n=(int)Math.rint(Math.log(n)/Math.log(2));
+ this.n=n;
+
+ int AE=0;
+ int AO=1;
+ int BE=AE+n/2;
+ int BO=BE+1;
+ int CE=BE+n/2;
+ int CO=CE+1;
+ // trig lookups...
+ for(int i=0; i>>j!=0; j++)
+ if(((msb>>>j)&i)!=0)
+ acc|=1<>>1;
+ int n4=n>>>2;
+ int n8=n>>>3;
+
+ // rotate + step 1
+ {
+ int inO=1;
+ int xO=0;
+ int A=n2;
+
+ int i;
+ for(i=0; i>>(i+2);
+ int k1=1<<(i+3);
+ int wbase=n2-2;
+
+ A=0;
+ float[] temp;
+
+ for(int r=0; r<(k0>>>2); r++){
+ int w1=wbase;
+ w2=w1-(k0>>1);
+ float AEv=trig[A], wA;
+ float AOv=trig[A+1], wB;
+ wbase-=2;
+
+ k0++;
+ for(int s=0; s<(2<
+ *
+ * Many thanks to
+ * Monty and
+ * The XIPHOPHORUS Company http://www.xiph.org/ .
+ * JOrbis has been based on their awesome works, Vorbis codec.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License
+ * as published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU 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 com.jcraft.jorbis;
+
+// psychoacoustic setup
+class PsyInfo{
+ int athp;
+ int decayp;
+ int smoothp;
+ int noisefitp;
+ int noisefit_subblock;
+ float noisefit_threshdB;
+
+ float ath_att;
+
+ int tonemaskp;
+ float[] toneatt_125Hz=new float[5];
+ float[] toneatt_250Hz=new float[5];
+ float[] toneatt_500Hz=new float[5];
+ float[] toneatt_1000Hz=new float[5];
+ float[] toneatt_2000Hz=new float[5];
+ float[] toneatt_4000Hz=new float[5];
+ float[] toneatt_8000Hz=new float[5];
+
+ int peakattp;
+ float[] peakatt_125Hz=new float[5];
+ float[] peakatt_250Hz=new float[5];
+ float[] peakatt_500Hz=new float[5];
+ float[] peakatt_1000Hz=new float[5];
+ float[] peakatt_2000Hz=new float[5];
+ float[] peakatt_4000Hz=new float[5];
+ float[] peakatt_8000Hz=new float[5];
+
+ int noisemaskp;
+ float[] noiseatt_125Hz=new float[5];
+ float[] noiseatt_250Hz=new float[5];
+ float[] noiseatt_500Hz=new float[5];
+ float[] noiseatt_1000Hz=new float[5];
+ float[] noiseatt_2000Hz=new float[5];
+ float[] noiseatt_4000Hz=new float[5];
+ float[] noiseatt_8000Hz=new float[5];
+
+ float max_curve_dB;
+
+ float attack_coeff;
+ float decay_coeff;
+
+ void free(){
+ }
+}
diff --git a/src/main/java/com/jcraft/jorbis/PsyLook.java b/src/main/java/com/jcraft/jorbis/PsyLook.java
new file mode 100644
index 00000000..ff30571e
--- /dev/null
+++ b/src/main/java/com/jcraft/jorbis/PsyLook.java
@@ -0,0 +1,42 @@
+/* -*-mode:java; c-basic-offset:2; indent-tabs-mode:nil -*- */
+/* JOrbis
+ * Copyright (C) 2000 ymnk, JCraft,Inc.
+ *
+ * Written by: 2000 ymnk
+ *
+ * Many thanks to
+ * Monty and
+ * The XIPHOPHORUS Company http://www.xiph.org/ .
+ * JOrbis has been based on their awesome works, Vorbis codec.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License
+ * as published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU 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 com.jcraft.jorbis;
+
+class PsyLook{
+ int n;
+ PsyInfo vi;
+
+ float[][][] tonecurves;
+ float[][] peakatt;
+ float[][][] noisecurves;
+
+ float[] ath;
+ int[] octave;
+
+ void init(PsyInfo vi, int n, int rate){
+ }
+}
diff --git a/src/main/java/com/jcraft/jorbis/Residue0.java b/src/main/java/com/jcraft/jorbis/Residue0.java
new file mode 100644
index 00000000..46ca59a0
--- /dev/null
+++ b/src/main/java/com/jcraft/jorbis/Residue0.java
@@ -0,0 +1,330 @@
+/* -*-mode:java; c-basic-offset:2; indent-tabs-mode:nil -*- */
+/* JOrbis
+ * Copyright (C) 2000 ymnk, JCraft,Inc.
+ *
+ * Written by: 2000 ymnk
+ *
+ * Many thanks to
+ * Monty and
+ * The XIPHOPHORUS Company http://www.xiph.org/ .
+ * JOrbis has been based on their awesome works, Vorbis codec.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License
+ * as published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU 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 com.jcraft.jorbis;
+
+import com.jcraft.jogg.*;
+
+class Residue0 extends FuncResidue{
+ void pack(Object vr, Buffer opb){
+ InfoResidue0 info=(InfoResidue0)vr;
+ int acc=0;
+ opb.write(info.begin, 24);
+ opb.write(info.end, 24);
+
+ opb.write(info.grouping-1, 24); /* residue vectors to group and
+ code with a partitioned book */
+ opb.write(info.partitions-1, 6); /* possible partition choices */
+ opb.write(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(int j=0; j3){
+ /* yes, this is a minor hack due to not thinking ahead */
+ opb.write(i, 3);
+ opb.write(1, 1);
+ opb.write(i>>>3, 5);
+ }
+ else{
+ opb.write(i, 4); /* trailing zero */
+ }
+ acc+=Util.icount(i);
+ }
+ for(int j=0; j=vi.books){
+ free_info(info);
+ return (null);
+ }
+
+ for(int j=0; j=vi.books){
+ free_info(info);
+ return (null);
+ }
+ }
+ return (info);
+ }
+
+ Object look(DspState vd, InfoMode vm, Object vr){
+ InfoResidue0 info=(InfoResidue0)vr;
+ LookResidue0 look=new LookResidue0();
+ int acc=0;
+ int dim;
+ int maxstage=0;
+ look.info=info;
+ look.map=vm.mapping;
+
+ look.parts=info.partitions;
+ look.fullbooks=vd.fullbooks;
+ look.phrasebook=vd.fullbooks[info.groupbook];
+
+ dim=look.phrasebook.dim;
+
+ look.partbooks=new int[look.parts][];
+
+ for(int j=0; jmaxstage)
+ maxstage=stages;
+ look.partbooks[j]=new int[stages];
+ for(int k=0; k
+ *
+ * Many thanks to
+ * Monty and
+ * The XIPHOPHORUS Company http://www.xiph.org/ .
+ * JOrbis has been based on their awesome works, Vorbis codec.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License
+ * as published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU 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 com.jcraft.jorbis;
+
+class Residue1 extends Residue0{
+
+ int inverse(Block vb, Object vl, float[][] in, int[] nonzero, int ch){
+ int used=0;
+ for(int i=0; i
+ *
+ * Many thanks to
+ * Monty and
+ * The XIPHOPHORUS Company http://www.xiph.org/ .
+ * JOrbis has been based on their awesome works, Vorbis codec.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License
+ * as published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU 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 com.jcraft.jorbis;
+
+class Residue2 extends Residue0{
+
+ int inverse(Block vb, Object vl, float[][] in, int[] nonzero, int ch){
+ int i=0;
+ for(i=0; i
+ *
+ * Many thanks to
+ * Monty and
+ * The XIPHOPHORUS Company http://www.xiph.org/ .
+ * JOrbis has been based on their awesome works, Vorbis codec.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License
+ * as published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU 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 com.jcraft.jorbis;
+
+import com.jcraft.jogg.*;
+
+class StaticCodeBook{
+ int dim; // codebook dimensions (elements per vector)
+ int entries; // codebook entries
+ int[] 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.
+ int q_min; // packed 32 bit float; quant value 0 maps to minval
+ int q_delta; // packed 32 bit float; val 1 - val 0 == delta
+ int q_quant; // bits: 0 < quant <= 16
+ int q_sequencep; // bitflag
+
+ // additional information for log (dB) mapping; the linear mapping
+ // is assumed to actually be values in dB. encodebias is used to
+ // assign an error weight to 0 dB. We have two additional flags:
+ // zeroflag indicates if entry zero is to represent -Inf dB; negflag
+ // indicates if we're to represent negative linear values in a
+ // mirror of the positive mapping.
+
+ int[] quantlist; // map == 1: (int)(entries/dim) element column map
+ // map == 2: list of dim*entries quantized entry vals
+
+ StaticCodeBook(){
+ }
+
+ int pack(Buffer opb){
+ int i;
+ boolean ordered=false;
+
+ opb.write(0x564342, 24);
+ opb.write(dim, 16);
+ opb.write(entries, 24);
+
+ // pack the codewords. There are two packings; length ordered and
+ // length random. Decide between the two now.
+
+ for(i=1; i_last){
+ for(int j=_last; j<_this; j++){
+ opb.write(i-count, Util.ilog(entries-count));
+ count=i;
+ }
+ }
+ }
+ opb.write(i-count, Util.ilog(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
+ opb.write(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/c->dim) quantized values for
+ // building a full value list algorithmically (square lattice)
+ quantvals=maptype1_quantvals();
+ break;
+ case 2:
+ // every value (c->entries*c->dim total) specified explicitly
+ quantvals=entries*dim;
+ break;
+ }
+
+ // quantized values
+ for(i=0; ibim <= b->entries
+ // treat the above as an initial guess
+ while(true){
+ int acc=1;
+ int acc1=1;
+ for(int i=0; ientries){
+ return (vals);
+ }
+ else{
+ if(acc>entries){
+ vals--;
+ }
+ else{
+ vals++;
+ }
+ }
+ }
+ }
+
+ void clear(){
+ }
+
+ // 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[] unquantize(){
+
+ if(maptype==1||maptype==2){
+ int quantvals;
+ float mindel=float32_unpack(q_min);
+ float delta=float32_unpack(q_delta);
+ float[] r=new float[entries*dim];
+
+ // maptype 1 and 2 both use a quantized value vector, but
+ // different sizes
+ switch(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*dim "+val+" | ");}
+ val=Math.abs(val)*delta+mindel+last;
+ if(q_sequencep!=0)
+ last=val;
+ r[j*dim+k]=val;
+ //if((j*dim+k)==0){System.err.println(" $ r[0] -> "+r[0]+" | ");}
+ }
+ }
+ //System.err.println("\nr[0]="+r[0]);
+ }
+ return (r);
+ }
+ return (null);
+ }
+
+ // 32 bit float (not IEEE; nonnormalized mantissa +
+ // biased exponent) : neeeeeee eeemmmmm mmmmmmmm mmmmmmmm
+ // Why not IEEE? It's just not that important here.
+
+ static final int VQ_FEXP=10;
+ static final int VQ_FMAN=21;
+ static final int VQ_FEXP_BIAS=768; // bias toward values smaller than 1.
+
+ // doesn't currently guard under/overflow
+ static long float32_pack(float val){
+ int sign=0;
+ int exp;
+ int mant;
+ if(val<0){
+ sign=0x80000000;
+ val=-val;
+ }
+ exp=(int)Math.floor(Math.log(val)/Math.log(2));
+ mant=(int)Math.rint(Math.pow(val, (VQ_FMAN-1)-exp));
+ exp=(exp+VQ_FEXP_BIAS)<>>VQ_FMAN;
+ if((val&0x80000000)!=0)
+ mant=-mant;
+ return (ldexp(mant, ((int)exp)-(VQ_FMAN-1)-VQ_FEXP_BIAS));
+ }
+
+ static float ldexp(float foo, int e){
+ return (float)(foo*Math.pow(2, e));
+ }
+}
diff --git a/src/main/java/com/jcraft/jorbis/Time0.java b/src/main/java/com/jcraft/jorbis/Time0.java
new file mode 100644
index 00000000..fef65499
--- /dev/null
+++ b/src/main/java/com/jcraft/jorbis/Time0.java
@@ -0,0 +1,52 @@
+/* -*-mode:java; c-basic-offset:2; indent-tabs-mode:nil -*- */
+/* JOrbis
+ * Copyright (C) 2000 ymnk, JCraft,Inc.
+ *
+ * Written by: 2000 ymnk
+ *
+ * Many thanks to
+ * Monty and
+ * The XIPHOPHORUS Company http://www.xiph.org/ .
+ * JOrbis has been based on their awesome works, Vorbis codec.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License
+ * as published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU 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 com.jcraft.jorbis;
+
+import com.jcraft.jogg.*;
+
+class Time0 extends FuncTime{
+ void pack(Object i, Buffer opb){
+ }
+
+ Object unpack(Info vi, Buffer opb){
+ return "";
+ }
+
+ Object look(DspState vd, InfoMode mi, Object i){
+ return "";
+ }
+
+ void free_info(Object i){
+ }
+
+ void free_look(Object i){
+ }
+
+ int inverse(Block vb, Object i, float[] in, float[] out){
+ return 0;
+ }
+}
diff --git a/src/main/java/com/jcraft/jorbis/Util.java b/src/main/java/com/jcraft/jorbis/Util.java
new file mode 100644
index 00000000..983c568e
--- /dev/null
+++ b/src/main/java/com/jcraft/jorbis/Util.java
@@ -0,0 +1,30 @@
+package com.jcraft.jorbis;
+
+class Util{
+ static int ilog(int v){
+ int ret=0;
+ while(v!=0){
+ ret++;
+ v>>>=1;
+ }
+ return (ret);
+ }
+
+ static int ilog2(int v){
+ int ret=0;
+ while(v>1){
+ ret++;
+ v>>>=1;
+ }
+ return (ret);
+ }
+
+ static int icount(int v){
+ int ret=0;
+ while(v!=0){
+ ret+=(v&1);
+ v>>>=1;
+ }
+ return (ret);
+ }
+}
diff --git a/src/main/java/com/jcraft/jorbis/VorbisFile.java b/src/main/java/com/jcraft/jorbis/VorbisFile.java
new file mode 100644
index 00000000..0b2890c1
--- /dev/null
+++ b/src/main/java/com/jcraft/jorbis/VorbisFile.java
@@ -0,0 +1,1332 @@
+/* -*-mode:java; c-basic-offset:2; indent-tabs-mode:nil -*- */
+/* -*-mode:java; c-basic-offset:2; indent-tabs-mode:nil -*- */
+/* JOrbis
+ * Copyright (C) 2000 ymnk, JCraft,Inc.
+ *
+ * Written by: 2000 ymnk
+ *
+ * Many thanks to
+ * Monty and
+ * The XIPHOPHORUS Company http://www.xiph.org/ .
+ * JOrbis has been based on their awesome works, Vorbis codec.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License
+ * as published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU 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 com.jcraft.jorbis;
+
+import com.jcraft.jogg.Packet;
+import com.jcraft.jogg.Page;
+import com.jcraft.jogg.StreamState;
+import com.jcraft.jogg.SyncState;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.nio.channels.FileChannel;
+import java.nio.file.Paths;
+
+public class VorbisFile implements AutoCloseable {
+ static final int CHUNK_SIZE = 8500;
+ static final int SEEK_SET = 0;
+ static final int SEEK_CUR = 1;
+ static final int SEEK_END = 2;
+
+ static final int OV_FALSE = -1;
+ static final int OV_EOF = -2;
+ static final int OV_HOLE = -3;
+
+ static final int OV_EREAD = -128;
+ static final int OV_EFAULT = -129;
+ static final int OV_EIMPL = -130;
+ static final int OV_EINVAL = -131;
+ static final int OV_ENOTVORBIS = -132;
+ static final int OV_EBADHEADER = -133;
+ static final int OV_EVERSION = -134;
+ static final int OV_ENOTAUDIO = -135;
+ static final int OV_EBADPACKET = -136;
+ static final int OV_EBADLINK = -137;
+ static final int OV_ENOSEEK = -138;
+
+ ByteBuffer datasource;
+ boolean seekable = false;
+ long offset;
+ long end;
+
+ SyncState oy = new SyncState();
+
+ int links;
+ long[] offsets;
+ long[] dataoffsets;
+ int[] serialnos;
+ long[] pcmlengths;
+ Info[] vi;
+ Comment[] vc;
+
+ // Decoding working state local storage
+ long pcm_offset;
+ boolean decode_ready = false;
+
+ int current_serialno;
+ int current_link;
+
+ float bittrack;
+ float samptrack;
+
+ StreamState os = new StreamState(); // take physical pages, weld into a logical
+ // stream of packets
+ DspState vd = new DspState(); // central working state for
+ // the packet->PCM decoder
+ Block vb = new Block(vd); // local working space for packet->PCM decode
+
+ //ov_callbacks callbacks;
+
+ public VorbisFile(String file) throws JOrbisException {
+ try (FileChannel channel = FileChannel.open(Paths.get(file))) {
+ ByteBuffer is = ByteBuffer.allocate((int) channel.size());
+ channel.read(is);
+ is.rewind();
+ int ret = open(is, null, -1);
+ if (ret == -1) {
+ throw new JOrbisException("VorbisFile: open return -1");
+ }
+ } catch (IOException | JOrbisException e) {
+ throw new JOrbisException("VorbisFile: " + e.toString());
+ }
+ }
+
+ public VorbisFile(ByteBuffer is) throws JOrbisException {
+ int ret = open(is, null, -1);
+ if (ret == -1) {
+ }
+ }
+
+ public VorbisFile(ByteBuffer is, byte[] initial, int ibytes) throws JOrbisException {
+ int ret = open(is, initial, ibytes);
+ if (ret == -1) {
+ }
+ }
+
+ private int get_data() {
+ if (datasource != null) {
+ final int index = oy.buffer(CHUNK_SIZE);
+ byte[] buffer = oy.data;
+ final int remainingChunk = datasource.remaining();
+ final int chunkSize;
+
+ if (remainingChunk >= CHUNK_SIZE) {
+ chunkSize = CHUNK_SIZE;
+ } else {
+ chunkSize = remainingChunk;
+ }
+
+ datasource.get(buffer, index, chunkSize);
+ oy.wrote(chunkSize);
+ return chunkSize;
+ }
+ return 0;
+ }
+
+ private void seek_helper(long offst) {
+ if (datasource != null) {
+ fseek(datasource, offst, SEEK_SET);
+ this.offset = offst;
+ oy.reset();
+ } else {
+ // shouldn't happen unless someone writes a broken callback
+ }
+ }
+
+ private int get_next_page(Page page, long boundary) {
+ if (boundary > 0)
+ boundary += offset;
+ while (true) {
+ int more;
+ if (boundary > 0 && offset >= boundary)
+ return OV_FALSE;
+ more = oy.pageseek(page);
+ if (more < 0) {
+ offset -= more;
+ } else {
+ if (more == 0) {
+ if (boundary == 0)
+ return OV_FALSE;
+ int ret = get_data();
+ if (ret == 0)
+ return OV_EOF;
+ if (ret < 0)
+ return OV_EREAD;
+ } else {
+ int ret = (int) offset; //!!!
+ offset += more;
+ return ret;
+ }
+ }
+ }
+ }
+
+ private int get_prev_page(Page page) throws JOrbisException {
+ long begin = offset; //!!!
+ int ret;
+ int offst = -1;
+ while (offst == -1) {
+ begin -= CHUNK_SIZE;
+ if (begin < 0)
+ begin = 0;
+ seek_helper(begin);
+ while (offset < begin + CHUNK_SIZE) {
+ ret = get_next_page(page, begin + CHUNK_SIZE - offset);
+ if (ret == OV_EREAD) {
+ return OV_EREAD;
+ }
+ if (ret < 0) {
+ if (offst == -1)
+ throw new JOrbisException();
+ break;
+ } else {
+ offst = ret;
+ }
+ }
+ }
+ seek_helper(offst); //!!!
+ ret = get_next_page(page, CHUNK_SIZE);
+ if (ret < 0) {
+ return OV_EFAULT;
+ }
+ return offst;
+ }
+
+ int bisect_forward_serialno(long begin, long searched, long end,
+ int currentno, int m) {
+ long endsearched = end;
+ long next = end;
+ Page page = new Page();
+ int ret;
+
+ while (searched < endsearched) {
+ long bisect;
+ if (endsearched - searched < CHUNK_SIZE) {
+ bisect = searched;
+ } else {
+ bisect = (searched + endsearched) / 2;
+ }
+
+ seek_helper(bisect);
+ ret = get_next_page(page, -1);
+ if (ret == OV_EREAD)
+ return OV_EREAD;
+ if (ret < 0 || page.serialno() != currentno) {
+ endsearched = bisect;
+ if (ret >= 0)
+ next = ret;
+ } else {
+ searched = ret + page.header_len + page.body_len;
+ }
+ }
+ seek_helper(next);
+ ret = get_next_page(page, -1);
+ if (ret == OV_EREAD)
+ return OV_EREAD;
+
+ if (searched >= end || ret == -1) {
+ links = m + 1;
+ offsets = new long[m + 2];
+ offsets[m + 1] = searched;
+ } else {
+ ret = bisect_forward_serialno(next, offset, end, page.serialno(), m + 1);
+ if (ret == OV_EREAD)
+ return OV_EREAD;
+ }
+ offsets[m] = begin;
+ return 0;
+ }
+
+ // uses the local ogg_stream storage in vf; this is important for
+ // non-streaming input sources
+ int fetch_headers(Info vi, Comment vc, int[] serialno, Page og_ptr) {
+ Page og = new Page();
+ Packet op = new Packet();
+ int ret;
+
+ if (og_ptr == null) {
+ ret = get_next_page(og, CHUNK_SIZE);
+ if (ret == OV_EREAD)
+ return OV_EREAD;
+ if (ret < 0)
+ return OV_ENOTVORBIS;
+ og_ptr = og;
+ }
+
+ if (serialno != null)
+ serialno[0] = og_ptr.serialno();
+
+ os.init(og_ptr.serialno());
+
+ // extract the initial header from the first page and verify that the
+ // Ogg bitstream is in fact Vorbis data
+
+ vi.init();
+ vc.init();
+
+ int i = 0;
+ while (i < 3) {
+ os.pagein(og_ptr);
+ while (i < 3) {
+ int result = os.packetout(op);
+ if (result == 0)
+ break;
+ if (result == -1) {
+ vi.clear();
+ vc.clear();
+ os.clear();
+ return -1;
+ }
+ if (vi.synthesis_headerin(vc, op) != 0) {
+ vi.clear();
+ vc.clear();
+ os.clear();
+ return -1;
+ }
+ i++;
+ }
+ if (i < 3)
+ if (get_next_page(og_ptr, 1) < 0) {
+ vi.clear();
+ vc.clear();
+ os.clear();
+ return -1;
+ }
+ }
+ return 0;
+ }
+
+ // last step of the OggVorbis_File initialization; get all the
+ // vorbis_info structs and PCM positions. Only called by the seekable
+ // initialization (local stream storage is hacked slightly; pay
+ // attention to how that's done)
+ void prefetch_all_headers(Info first_i, Comment first_c, int dataoffset)
+ throws JOrbisException {
+ Page og = new Page();
+ int ret;
+
+ vi = new Info[links];
+ vc = new Comment[links];
+ dataoffsets = new long[links];
+ pcmlengths = new long[links];
+ serialnos = new int[links];
+
+ for (int i = 0; i < links; i++) {
+ if (first_i != null && first_c != null && i == 0) {
+ // we already grabbed the initial header earlier. This just
+ // saves the waste of grabbing it again
+ vi[i] = first_i;
+ vc[i] = first_c;
+ dataoffsets[i] = dataoffset;
+ } else {
+ // seek to the location of the initial header
+ seek_helper(offsets[i]); //!!!
+ vi[i] = new Info();
+ vc[i] = new Comment();
+ if (fetch_headers(vi[i], vc[i], null, null) == -1) {
+ dataoffsets[i] = -1;
+ } else {
+ dataoffsets[i] = offset;
+ os.clear();
+ }
+ }
+
+ // get the serial number and PCM length of this link. To do this,
+ // get the last page of the stream
+ {
+ long end = offsets[i + 1]; //!!!
+ seek_helper(end);
+
+ while (true) {
+ ret = get_prev_page(og);
+ if (ret == -1) {
+ // this should not be possible
+ vi[i].clear();
+ vc[i].clear();
+ break;
+ }
+ if (og.granulepos() != -1) {
+ serialnos[i] = og.serialno();
+ pcmlengths[i] = og.granulepos();
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ private int make_decode_ready() {
+ if (decode_ready)
+ System.exit(1);
+ vd.synthesis_init(vi[0]);
+ vb.init(vd);
+ decode_ready = true;
+ return (0);
+ }
+
+ int open_seekable() throws JOrbisException {
+ Info initial_i = new Info();
+ Comment initial_c = new Comment();
+ int serialno;
+ long end;
+ int ret;
+ int dataoffset;
+ Page og = new Page();
+
+ // is this even vorbis...?
+ int[] foo = new int[1];
+ ret = fetch_headers(initial_i, initial_c, foo, null);
+ serialno = foo[0];
+ dataoffset = (int) offset; //!!
+ os.clear();
+ if (ret == -1)
+ return (-1);
+ if (ret < 0)
+ return (ret);
+
+ // we can seek, so set out learning all about this file
+ seekable = true;
+ fseek(datasource, 0, SEEK_END);
+ offset = end = ftell(datasource);
+
+ // We get the offset for the last page of the physical bitstream.
+ // Most OggVorbis files will contain a single logical bitstream
+ end = get_prev_page(og);
+
+ // moer than one logical bitstream?
+ if (og.serialno() != serialno) {
+ // Chained bitstream. Bisect-search each logical bitstream
+ // section. Do so based on serial number only
+ if (bisect_forward_serialno(0, 0, end + 1, serialno, 0) < 0) {
+ clear();
+ return OV_EREAD;
+ }
+ } else {
+ // Only one logical bitstream
+ if (bisect_forward_serialno(0, end, end + 1, serialno, 0) < 0) {
+ clear();
+ return OV_EREAD;
+ }
+ }
+ prefetch_all_headers(initial_i, initial_c, dataoffset);
+ raw_seek(0);
+ return 0;
+ }
+
+ @Deprecated
+ private int open_nonseekable() {
+ // we cannot seek. Set up a 'single' (current) logical bitstream entry
+ links = 1;
+ vi = new Info[links];
+ vi[0] = new Info(); // ??
+ vc = new Comment[links];
+ vc[0] = new Comment(); // ?? bug?
+
+ // Try to fetch the headers, maintaining all the storage
+ int[] foo = new int[1];
+ if (fetch_headers(vi[0], vc[0], foo, null) == -1)
+ return (-1);
+ current_serialno = foo[0];
+ make_decode_ready();
+ return 0;
+ }
+
+ // clear out the current logical bitstream decoder
+ void decode_clear() {
+ os.clear();
+ vd.clear();
+ vb.clear();
+ decode_ready = false;
+ bittrack = 0.f;
+ samptrack = 0.f;
+ }
+
+ // fetch and process a packet. Handles the case where we're at a
+ // bitstream boundary and dumps the decoding machine. If the decoding
+ // machine is unloaded, it loads it. It also keeps pcm_offset up to
+ // date (seek and read both use this. seek uses a special hack with
+ // readp).
+ //
+ // return: -1) hole in the data (lost packet)
+ // 0) need more data (only if readp==0)/eof
+ // 1) got a packet
+
+ int process_packet(int readp) {
+ Page og = new Page();
+
+ // handle one packet. Try to fetch it from current stream state
+ // extract packets from page
+ while (true) {
+ // process a packet if we can. If the machine isn't loaded,
+ // neither is a page
+ if (decode_ready) {
+ Packet op = new Packet();
+ int result = os.packetout(op);
+ long granulepos;
+ // if(result==-1)return(-1); // hole in the data. For now, swallow
+ // and go. We'll need to add a real
+ // error code in a bit.
+ if (result > 0) {
+ // got a packet. process it
+ granulepos = op.granulepos;
+ if (vb.synthesis(op) == 0) { // lazy check for lazy
+ // header handling. The
+ // header packets aren't
+ // audio, so if/when we
+ // submit them,
+ // vorbis_synthesis will
+ // reject them
+ // suck in the synthesis data and track bitrate
+ {
+ int oldsamples = vd.synthesis_pcmout(null);
+ vd.synthesis_blockin(vb);
+ samptrack += vd.synthesis_pcmout(null) - oldsamples;
+ bittrack += op.bytes * 8;
+ }
+
+ // update the pcm offset.
+ if (granulepos != -1 && op.e_o_s == 0) {
+ int link = (seekable ? current_link : 0);
+ int samples;
+ // this packet has a pcm_offset on it (the last packet
+ // completed on a page carries the offset) After processing
+ // (above), we know the pcm position of the *last* sample
+ // ready to be returned. Find the offset of the *first*
+ //
+ // As an aside, this trick is inaccurate if we begin
+ // reading anew right at the last page; the end-of-stream
+ // granulepos declares the last frame in the stream, and the
+ // last packet of the last page may be a partial frame.
+ // So, we need a previous granulepos from an in-sequence page
+ // to have a reference point. Thus the !op.e_o_s clause above
+
+ samples = vd.synthesis_pcmout(null);
+ granulepos -= samples;
+ for (int i = 0; i < link; i++) {
+ granulepos += pcmlengths[i];
+ }
+ pcm_offset = granulepos;
+ }
+ return (1);
+ }
+ }
+ }
+
+ if (readp == 0)
+ return (0);
+ if (get_next_page(og, -1) < 0)
+ return (0); // eof. leave unitialized
+
+ // bitrate tracking; add the header's bytes here, the body bytes
+ // are done by packet above
+ bittrack += og.header_len * 8;
+
+ // has our decoding just traversed a bitstream boundary?
+ if (decode_ready) {
+ if (current_serialno != og.serialno()) {
+ decode_clear();
+ }
+ }
+
+ // Do we need to load a new machine before submitting the page?
+ // This is different in the seekable and non-seekable cases.
+ //
+ // In the seekable case, we already have all the header
+ // information loaded and cached; we just initialize the machine
+ // with it and continue on our merry way.
+ //
+ // In the non-seekable (streaming) case, we'll only be at a
+ // boundary if we just left the previous logical bitstream and
+ // we're now nominally at the header of the next bitstream
+
+ if (!decode_ready) {
+ int i;
+ if (seekable) {
+ current_serialno = og.serialno();
+
+ // match the serialno to bitstream section. We use this rather than
+ // offset positions to avoid problems near logical bitstream
+ // boundaries
+ for (i = 0; i < links; i++) {
+ if (serialnos[i] == current_serialno)
+ break;
+ }
+ if (i == links)
+ return (-1); // sign of a bogus stream. error out,
+ // leave machine uninitialized
+ current_link = i;
+
+ os.init(current_serialno);
+ os.reset();
+
+ } else {
+ // we're streaming
+ // fetch the three header packets, build the info struct
+ int foo[] = new int[1];
+ int ret = fetch_headers(vi[0], vc[0], foo, og);
+ current_serialno = foo[0];
+ if (ret != 0)
+ return ret;
+ current_link++;
+ i = 0;
+ }
+ make_decode_ready();
+ }
+ os.pagein(og);
+ }
+ }
+
+ // The helpers are over; it's all toplevel interface from here on out
+ // clear out the OggVorbis_File struct
+ int clear() {
+ vb.clear();
+ vd.clear();
+ os.clear();
+
+ if (vi != null && links != 0) {
+ for (int i = 0; i < links; i++) {
+ vi[i].clear();
+ vc[i].clear();
+ }
+ vi = null;
+ vc = null;
+ }
+ if (dataoffsets != null)
+ dataoffsets = null;
+ if (pcmlengths != null)
+ pcmlengths = null;
+ if (serialnos != null)
+ serialnos = null;
+ if (offsets != null)
+ offsets = null;
+ oy.clear();
+
+ return (0);
+ }
+
+ static void fseek(ByteBuffer fis, long off, int origin) {
+ switch (origin) {
+ case SEEK_SET:
+ origin = 0;
+ break;
+ case SEEK_CUR:
+ origin = fis.position();
+ break;
+ case SEEK_END:
+ origin = fis.capacity();
+ }
+ fis.position((int) (off + origin));
+ }
+
+ static long ftell(ByteBuffer fis) {
+ return fis.position();
+ }
+
+ // inspects the OggVorbis file and finds/documents all the logical
+ // bitstreams contained in it. Tries to be tolerant of logical
+ // bitstream sections that are truncated/woogie.
+ //
+ // return: -1) error
+ // 0) OK
+ int open(ByteBuffer is, byte[] initial, int ibytes) throws JOrbisException {
+ return open_callbacks(is, initial, ibytes);
+ }
+
+ int open_callbacks(ByteBuffer is, byte[] initial, int ibytes) throws JOrbisException {
+ final int ret;
+ datasource = is;
+
+ oy.init();
+
+ // perhaps some data was previously read into a buffer for testing
+ // against other stream types. Allow initialization from this
+ // previously read data (as we may be reading from a non-seekable
+ // stream)
+ if (initial != null) {
+ int index = oy.buffer(ibytes);
+ System.arraycopy(initial, 0, oy.data, index, ibytes);
+ oy.wrote(ibytes);
+ }
+ // can we seek? Stevens suggests the seek test was portable
+// if (is instanceof SeekableInputStream) {
+ ret = open_seekable();
+// } else {
+// ret = open_nonseekable();
+// }
+ if (ret != 0) {
+ datasource = null;
+ clear();
+ }
+ return ret;
+ }
+
+ // How many logical bitstreams in this physical bitstream?
+ public int streams() {
+ return links;
+ }
+
+ // Is the FILE * associated with vf seekable?
+ public boolean seekable() {
+ return seekable;
+ }
+
+ // returns the bitrate for a given logical bitstream or the entire
+ // physical bitstream. If the file is open for random access, it will
+ // find the *actual* average bitrate. If the file is streaming, it
+ // returns the nominal bitrate (if set) else the average of the
+ // upper/lower bounds (if set) else -1 (unset).
+ //
+ // If you want the actual bitrate field settings, get them from the
+ // vorbis_info structs
+
+ public int bitrate(int i) {
+ if (i >= links)
+ return (-1);
+ if (!seekable && i != 0)
+ return (bitrate(0));
+ if (i < 0) {
+ long bits = 0;
+ for (int j = 0; j < links; j++) {
+ bits += (offsets[j + 1] - dataoffsets[j]) * 8;
+ }
+ return ((int) Math.rint(bits / time_total(-1)));
+ } else {
+ if (seekable) {
+ // return the actual bitrate
+ return ((int) Math.rint((offsets[i + 1] - dataoffsets[i]) * 8 / time_total(i)));
+ } else {
+ // return nominal if set
+ if (vi[i].bitrate_nominal > 0) {
+ return vi[i].bitrate_nominal;
+ } else {
+ if (vi[i].bitrate_upper > 0) {
+ if (vi[i].bitrate_lower > 0) {
+ return (vi[i].bitrate_upper + vi[i].bitrate_lower) / 2;
+ } else {
+ return vi[i].bitrate_upper;
+ }
+ }
+ return (-1);
+ }
+ }
+ }
+ }
+
+ // returns the actual bitrate since last call. returns -1 if no
+ // additional data to offer since last call (or at beginning of stream)
+ public int bitrate_instant() {
+ int _link = (seekable ? current_link : 0);
+ if (samptrack == 0)
+ return (-1);
+ int ret = (int) (bittrack / samptrack * vi[_link].rate + .5);
+ bittrack = 0.f;
+ samptrack = 0.f;
+ return (ret);
+ }
+
+ public int serialnumber(int i) {
+ if (i >= links)
+ return (-1);
+ if (!seekable && i >= 0)
+ return (serialnumber(-1));
+ if (i < 0) {
+ return (current_serialno);
+ } else {
+ return (serialnos[i]);
+ }
+ }
+
+ // returns: total raw (compressed) length of content if i==-1
+ // raw (compressed) length of that logical bitstream for i==0 to n
+ // -1 if the stream is not seekable (we can't know the length)
+
+ public long raw_total(int i) {
+ if (!seekable || i >= links)
+ return (-1);
+ if (i < 0) {
+ long acc = 0; // bug?
+ for (int j = 0; j < links; j++) {
+ acc += raw_total(j);
+ }
+ return (acc);
+ } else {
+ return (offsets[i + 1] - offsets[i]);
+ }
+ }
+
+ // returns: total PCM length (samples) of content if i==-1
+ // PCM length (samples) of that logical bitstream for i==0 to n
+ // -1 if the stream is not seekable (we can't know the length)
+ public long pcm_total(int i) {
+ if (!seekable || i >= links)
+ return (-1);
+ if (i < 0) {
+ long acc = 0;
+ for (int j = 0; j < links; j++) {
+ acc += pcm_total(j);
+ }
+ return (acc);
+ } else {
+ return (pcmlengths[i]);
+ }
+ }
+
+ // returns: total seconds of content if i==-1
+ // seconds in that logical bitstream for i==0 to n
+ // -1 if the stream is not seekable (we can't know the length)
+ public float time_total(int i) {
+ if (!seekable || i >= links)
+ return (-1);
+ if (i < 0) {
+ float acc = 0;
+ for (int j = 0; j < links; j++) {
+ acc += time_total(j);
+ }
+ return (acc);
+ } else {
+ return ((float) (pcmlengths[i]) / vi[i].rate);
+ }
+ }
+
+ // seek to an offset relative to the *compressed* data. This also
+ // immediately sucks in and decodes pages to update the PCM cursor. It
+ // will cross a logical bitstream boundary, but only if it can't get
+ // any packets out of the tail of the bitstream we seek to (so no
+ // surprises).
+ //
+ // returns zero on success, nonzero on failure
+
+ public int raw_seek(int pos) {
+ if (!seekable)
+ return (-1); // don't dump machine if we can't seek
+ if (pos < 0 || pos > offsets[links]) {
+ //goto seek_error;
+ pcm_offset = -1;
+ decode_clear();
+ return -1;
+ }
+
+ // clear out decoding machine state
+ pcm_offset = -1;
+ decode_clear();
+
+ // seek
+ seek_helper(pos);
+
+ // we need to make sure the pcm_offset is set. We use the
+ // _fetch_packet helper to process one packet with readp set, then
+ // call it until it returns '0' with readp not set (the last packet
+ // from a page has the 'granulepos' field set, and that's how the
+ // helper updates the offset
+
+ switch (process_packet(1)) {
+ case 0:
+ // oh, eof. There are no packets remaining. Set the pcm offset to
+ // the end of file
+ pcm_offset = pcm_total(-1);
+ return (0);
+ case -1:
+ // error! missing data or invalid bitstream structure
+ //goto seek_error;
+ pcm_offset = -1;
+ decode_clear();
+ return -1;
+ default:
+ // all OK
+ break;
+ }
+ while (true) {
+ switch (process_packet(0)) {
+ case 0:
+ // the offset is set. If it's a bogus bitstream with no offset
+ // information, it's not but that's not our fault. We still run
+ // gracefully, we're just missing the offset
+ return (0);
+ case -1:
+ // error! missing data or invalid bitstream structure
+ //goto seek_error;
+ pcm_offset = -1;
+ decode_clear();
+ return -1;
+ default:
+ // continue processing packets
+ break;
+ }
+ }
+
+ // seek_error:
+ // dump the machine so we're in a known state
+ //pcm_offset=-1;
+ //decode_clear();
+ //return -1;
+ }
+
+ // seek to a sample offset relative to the decompressed pcm stream
+ // returns zero on success, nonzero on failure
+
+ public int pcm_seek(long pos) {
+ int link = -1;
+ long total = pcm_total(-1);
+
+ if (!seekable)
+ return (-1); // don't dump machine if we can't seek
+ if (pos < 0 || pos > total) {
+ //goto seek_error;
+ pcm_offset = -1;
+ decode_clear();
+ return -1;
+ }
+
+ // which bitstream section does this pcm offset occur in?
+ for (link = links - 1; link >= 0; link--) {
+ total -= pcmlengths[link];
+ if (pos >= total)
+ break;
+ }
+
+ // search within the logical bitstream for the page with the highest
+ // pcm_pos preceeding (or equal to) pos. There is a danger here;
+ // missing pages or incorrect frame number information in the
+ // bitstream could make our task impossible. Account for that (it
+ // would be an error condition)
+ {
+ long target = pos - total;
+ long end = offsets[link + 1];
+ long begin = offsets[link];
+ int best = (int) begin;
+
+ Page og = new Page();
+ while (begin < end) {
+ long bisect;
+ int ret;
+
+ if (end - begin < CHUNK_SIZE) {
+ bisect = begin;
+ } else {
+ bisect = (end + begin) / 2;
+ }
+
+ seek_helper(bisect);
+ ret = get_next_page(og, end - bisect);
+
+ if (ret == -1) {
+ end = bisect;
+ } else {
+ long granulepos = og.granulepos();
+ if (granulepos < target) {
+ best = ret; // raw offset of packet with granulepos
+ begin = offset; // raw offset of next packet
+ } else {
+ end = bisect;
+ }
+ }
+ }
+ // found our page. seek to it (call raw_seek).
+ if (raw_seek(best) != 0) {
+ //goto seek_error;
+ pcm_offset = -1;
+ decode_clear();
+ return -1;
+ }
+ }
+
+ // verify result
+ if (pcm_offset >= pos) {
+ //goto seek_error;
+ pcm_offset = -1;
+ decode_clear();
+ return -1;
+ }
+ if (pos > pcm_total(-1)) {
+ //goto seek_error;
+ pcm_offset = -1;
+ decode_clear();
+ return -1;
+ }
+
+ // discard samples until we reach the desired position. Crossing a
+ // logical bitstream boundary with abandon is OK.
+ while (pcm_offset < pos) {
+ int target = (int) (pos - pcm_offset);
+ float[][][] _pcm = new float[1][][];
+ int[] _index = new int[getInfo(-1).channels];
+ int samples = vd.synthesis_pcmout(_pcm);
+
+ if (samples > target)
+ samples = target;
+ vd.synthesis_read(samples);
+ pcm_offset += samples;
+
+ if (samples < target)
+ if (process_packet(1) == 0) {
+ pcm_offset = pcm_total(-1); // eof
+ }
+ }
+ return 0;
+
+ // seek_error:
+ // dump machine so we're in a known state
+ //pcm_offset=-1;
+ //decode_clear();
+ //return -1;
+ }
+
+ // seek to a playback time relative to the decompressed pcm stream
+ // returns zero on success, nonzero on failure
+ int time_seek(float seconds) {
+ // translate time to PCM position and call pcm_seek
+
+ int link = -1;
+ long pcm_total = pcm_total(-1);
+ float time_total = time_total(-1);
+
+ if (!seekable)
+ return (-1); // don't dump machine if we can't seek
+ if (seconds < 0 || seconds > time_total) {
+ //goto seek_error;
+ pcm_offset = -1;
+ decode_clear();
+ return -1;
+ }
+
+ // which bitstream section does this time offset occur in?
+ for (link = links - 1; link >= 0; link--) {
+ pcm_total -= pcmlengths[link];
+ time_total -= time_total(link);
+ if (seconds >= time_total)
+ break;
+ }
+
+ // enough information to convert time offset to pcm offset
+ {
+ long target = (long) (pcm_total + (seconds - time_total) * vi[link].rate);
+ return (pcm_seek(target));
+ }
+
+ //seek_error:
+ // dump machine so we're in a known state
+ //pcm_offset=-1;
+ //decode_clear();
+ //return -1;
+ }
+
+ // tell the current stream offset cursor. Note that seek followed by
+ // tell will likely not give the set offset due to caching
+ public long raw_tell() {
+ return (offset);
+ }
+
+ // return PCM offset (sample) of next PCM sample to be read
+ public long pcm_tell() {
+ return (pcm_offset);
+ }
+
+ // return time offset (seconds) of next PCM sample to be read
+ public float time_tell() {
+ // translate time to PCM position and call pcm_seek
+
+ int link = -1;
+ long pcm_total = 0;
+ float time_total = 0.f;
+
+ if (seekable) {
+ pcm_total = pcm_total(-1);
+ time_total = time_total(-1);
+
+ // which bitstream section does this time offset occur in?
+ for (link = links - 1; link >= 0; link--) {
+ pcm_total -= pcmlengths[link];
+ time_total -= time_total(link);
+ if (pcm_offset >= pcm_total)
+ break;
+ }
+ }
+
+ return (time_total + (float) (pcm_offset - pcm_total) / vi[link].rate);
+ }
+
+ // link: -1) return the vorbis_info struct for the bitstream section
+ // currently being decoded
+ // 0-n) to request information for a specific bitstream section
+ //
+ // In the case of a non-seekable bitstream, any call returns the
+ // current bitstream. NULL in the case that the machine is not
+ // initialized
+
+ public Info getInfo(int link) {
+ if (seekable) {
+ if (link < 0) {
+ if (decode_ready) {
+ return vi[current_link];
+ } else {
+ return null;
+ }
+ } else {
+ if (link >= links) {
+ return null;
+ } else {
+ return vi[link];
+ }
+ }
+ } else {
+ if (decode_ready) {
+ return vi[0];
+ } else {
+ return null;
+ }
+ }
+ }
+
+ public Comment getComment(int link) {
+ if (seekable) {
+ if (link < 0) {
+ if (decode_ready) {
+ return vc[current_link];
+ } else {
+ return null;
+ }
+ } else {
+ if (link >= links) {
+ return null;
+ } else {
+ return vc[link];
+ }
+ }
+ } else {
+ if (decode_ready) {
+ return vc[0];
+ } else {
+ return null;
+ }
+ }
+ }
+
+ int host_is_big_endian() {
+ return 1;
+ // short pattern = 0xbabe;
+ // unsigned char *bytewise = (unsigned char *)&pattern;
+ // if (bytewise[0] == 0xba) return 1;
+ // assert(bytewise[0] == 0xbe);
+ // return 0;
+ }
+
+ // up to this point, everything could more or less hide the multiple
+ // logical bitstream nature of chaining from the toplevel application
+ // if the toplevel application didn't particularly care. However, at
+ // the point that we actually read audio back, the multiple-section
+ // nature must surface: Multiple bitstream sections do not necessarily
+ // have to have the same number of channels or sampling rate.
+ //
+ // read returns the sequential logical bitstream number currently
+ // being decoded along with the PCM data in order that the toplevel
+ // application can take action on channel/sample rate changes. This
+ // number will be incremented even for streamed (non-seekable) streams
+ // (for seekable streams, it represents the actual logical bitstream
+ // index within the physical bitstream. Note that the accessor
+ // functions above are aware of this dichotomy).
+ //
+ // input values: buffer) a buffer to hold packed PCM data for return
+ // length) the byte length requested to be placed into buffer
+ // bigendianp) should the data be packed LSB first (0) or
+ // MSB first (1)
+ // word) word size for output. currently 1 (byte) or
+ // 2 (16 bit short)
+ //
+ // return values: -1) error/hole in data
+ // 0) EOF
+ // n) number of bytes of PCM actually returned. The
+ // below works on a packet-by-packet basis, so the
+ // return length is not related to the 'length' passed
+ // in, just guaranteed to fit.
+ //
+ // *section) set to the logical bitstream number
+ int read(byte[] buffer, int length, int bigendianp, int word, int sgned, int[] bitstream) {
+ int host_endian = host_is_big_endian();
+ int index = 0;
+
+ while (true) {
+ if (decode_ready) {
+ float[][] pcm;
+ float[][][] _pcm = new float[1][][];
+ int[] _index = new int[getInfo(-1).channels];
+ int samples = vd.synthesis_pcmout(_pcm);
+ pcm = _pcm[0];
+ if (samples != 0) {
+ // yay! proceed to pack data into the byte buffer
+ int channels = getInfo(-1).channels;
+ int bytespersample = word * channels;
+ if (samples > length / bytespersample)
+ samples = length / bytespersample;
+
+ // a tight loop to pack each size
+ {
+ int val;
+ if (word == 1) {
+ int off = (sgned != 0 ? 0 : 128);
+ for (int j = 0; j < samples; j++) {
+ for (int i = 0; i < channels; i++) {
+ val = (int) (pcm[i][_index[i] + j] * 128. + 0.5);
+ if (val > 127)
+ val = 127;
+ else if (val < -128)
+ val = -128;
+ buffer[index++] = (byte) (val + off);
+ }
+ }
+ } else {
+ int off = (sgned != 0 ? 0 : 32768);
+
+ if (host_endian == bigendianp) {
+ if (sgned != 0) {
+ for (int i = 0; i < channels; i++) { // It's faster in this order
+ int src = _index[i];
+ int dest = i;
+ for (int j = 0; j < samples; j++) {
+ val = (int) (pcm[i][src + j] * 32768. + 0.5);
+ if (val > 32767)
+ val = 32767;
+ else if (val < -32768)
+ val = -32768;
+ buffer[dest] = (byte) (val >>> 8);
+ buffer[dest + 1] = (byte) (val);
+ dest += channels * 2;
+ }
+ }
+ } else {
+ for (int i = 0; i < channels; i++) {
+ float[] src = pcm[i];
+ int dest = i;
+ for (int j = 0; j < samples; j++) {
+ val = (int) (src[j] * 32768. + 0.5);
+ if (val > 32767)
+ val = 32767;
+ else if (val < -32768)
+ val = -32768;
+ buffer[dest] = (byte) ((val + off) >>> 8);
+ buffer[dest + 1] = (byte) (val + off);
+ dest += channels * 2;
+ }
+ }
+ }
+ } else if (bigendianp != 0) {
+ for (int j = 0; j < samples; j++) {
+ for (int i = 0; i < channels; i++) {
+ val = (int) (pcm[i][j] * 32768. + 0.5);
+ if (val > 32767)
+ val = 32767;
+ else if (val < -32768)
+ val = -32768;
+ val += off;
+ buffer[index++] = (byte) (val >>> 8);
+ buffer[index++] = (byte) val;
+ }
+ }
+ } else {
+ //int val;
+ for (int j = 0; j < samples; j++) {
+ for (int i = 0; i < channels; i++) {
+ val = (int) (pcm[i][j] * 32768. + 0.5);
+ if (val > 32767)
+ val = 32767;
+ else if (val < -32768)
+ val = -32768;
+ val += off;
+ buffer[index++] = (byte) val;
+ buffer[index++] = (byte) (val >>> 8);
+ }
+ }
+ }
+ }
+ }
+
+ vd.synthesis_read(samples);
+ pcm_offset += samples;
+ if (bitstream != null)
+ bitstream[0] = current_link;
+ return (samples * bytespersample);
+ }
+ }
+
+ // suck in another packet
+ switch (process_packet(1)) {
+ case 0:
+ return (0);
+ case -1:
+ return -1;
+ default:
+ break;
+ }
+ }
+ }
+
+ /* input values: pcm_channels) a float vector per channel of output
+ length) the sample length being read by the app
+
+ return values: <0) error/hole in data (OV_HOLE), partial open (OV_EINVAL)
+ 0) EOF
+ n) number of samples of PCM actually returned. The
+ below works on a packet-by-packet basis, so the
+ return length is not related to the 'length' passed
+ in, just guaranteed to fit.
+
+ *section) set to the logical bitstream number
+ @see ov_read_float */
+ public int read_float(float[][][] pcm_channels, int length) {
+ while (true) {
+ float[][][] _pcm = new float[1][][];
+ int samples = vd.synthesis_pcmout(_pcm);
+
+ if (samples != 0) {
+ if (pcm_channels != null) {
+ pcm_channels[0] = _pcm[0];
+ }
+ if (samples > length) {
+ samples = length;
+ }
+ vd.synthesis_read(samples);
+ this.pcm_offset += samples;
+
+ return samples;
+ }
+
+ /* suck in another packet */
+ {
+ int ret = this.process_packet(1);
+ if (ret == OV_EOF) {
+ return 0;
+ }
+ if (ret <= 0) {
+ return ret;
+ }
+ }
+ }
+ }
+
+ public Info[] getInfo() {
+ return vi;
+ }
+
+ public Comment[] getComment() {
+ return vc;
+ }
+
+ @Override
+ public void close() throws IOException {
+ datasource.clear();
+ }
+}
diff --git a/src/main/java/com/jcraft/jorbis/WindowVb.java b/src/main/java/com/jcraft/jorbis/WindowVb.java
new file mode 100644
index 00000000..57f3a2c3
--- /dev/null
+++ b/src/main/java/com/jcraft/jorbis/WindowVb.java
@@ -0,0 +1,2128 @@
+/********************************************************************
+ * *
+ * 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.23 2003/09/01 22:59:54 xiphmont Exp $
+
+ ********************************************************************/
+package com.jcraft.jorbis;
+
+public class WindowVb {
+
+ private static final float[] vwin64 = {
+ 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};
+
+ private static final float[] vwin128 = {
+ 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};
+
+ private static final float[] vwin256 = {
+ 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};
+
+ private static final float[] vwin512 = {
+ 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};
+
+ private static final float[] vwin1024 = {
+ 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};
+
+ private static final float[] vwin2048 = {
+ 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};
+
+ private static final float[] vwin4096 = {
+ 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};
+
+ private static final float[] vwin8192 = {
+ 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};
+
+ private static final float[][] vwin = {
+ vwin64,
+ vwin128,
+ vwin256,
+ vwin512,
+ vwin1024,
+ vwin2048,
+ vwin4096,
+ vwin8192};
+
+ public static float[] _vorbis_window_get(int n) {
+ return vwin[n];
+ }
+
+ public static void _vorbis_apply_window(float[] d, int[] winno, long[] blocksizes, int lW, int W, int nW) {
+ lW = (W != 0 ? lW : 0);
+ nW = (W != 0 ? 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 < leftbegin; i++) {
+ d[i] = 0.f;
+ }
+
+ for (p = 0; i < leftend; i++, p++) {
+ d[i] *= windowLW[p];
+ }
+
+ for (i = (int) rightbegin, p = (int) (rn / 2 - 1); i < rightend; i++, p--) {
+ d[i] *= windowNW[p];
+ }
+
+ for (; i < n; i++) {
+ d[i] = 0.f;
+ }
+ }
+ }
+}
diff --git a/src/main/java/neo/Renderer/Image_files.java b/src/main/java/neo/Renderer/Image_files.java
index 49cac886..c66ca7c1 100644
--- a/src/main/java/neo/Renderer/Image_files.java
+++ b/src/main/java/neo/Renderer/Image_files.java
@@ -1,8 +1,3 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
package neo.Renderer;
import java.awt.image.BufferedImage;
diff --git a/src/main/java/neo/Renderer/Image_init.java b/src/main/java/neo/Renderer/Image_init.java
index 65327b91..eecae396 100644
--- a/src/main/java/neo/Renderer/Image_init.java
+++ b/src/main/java/neo/Renderer/Image_init.java
@@ -1,8 +1,3 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
package neo.Renderer;
import java.nio.ByteBuffer;
diff --git a/src/main/java/neo/Renderer/Image_load.java b/src/main/java/neo/Renderer/Image_load.java
index 04012fd7..1412a726 100644
--- a/src/main/java/neo/Renderer/Image_load.java
+++ b/src/main/java/neo/Renderer/Image_load.java
@@ -1,8 +1,3 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
package neo.Renderer;
import static org.lwjgl.opengl.NVTextureCompressionVTC.GL_COMPRESSED_RGBA_S3TC_DXT5_EXT;
diff --git a/src/main/java/neo/Renderer/Image_process.java b/src/main/java/neo/Renderer/Image_process.java
index 21c197c0..67fed3bc 100644
--- a/src/main/java/neo/Renderer/Image_process.java
+++ b/src/main/java/neo/Renderer/Image_process.java
@@ -1,8 +1,3 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
package neo.Renderer;
import java.nio.ByteBuffer;
diff --git a/src/main/java/neo/Renderer/Image_program.java b/src/main/java/neo/Renderer/Image_program.java
index deb8ac48..d61702bb 100644
--- a/src/main/java/neo/Renderer/Image_program.java
+++ b/src/main/java/neo/Renderer/Image_program.java
@@ -1,8 +1,3 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
package neo.Renderer;
import java.nio.ByteBuffer;
diff --git a/src/main/java/neo/Renderer/RenderWorld_demo.java b/src/main/java/neo/Renderer/RenderWorld_demo.java
index 3462cceb..561ef353 100644
--- a/src/main/java/neo/Renderer/RenderWorld_demo.java
+++ b/src/main/java/neo/Renderer/RenderWorld_demo.java
@@ -1,8 +1,3 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
package neo.Renderer;
/**
diff --git a/src/main/java/neo/Renderer/RenderWorld_local.java b/src/main/java/neo/Renderer/RenderWorld_local.java
index c35208d8..f8ee8276 100644
--- a/src/main/java/neo/Renderer/RenderWorld_local.java
+++ b/src/main/java/neo/Renderer/RenderWorld_local.java
@@ -975,10 +975,10 @@ public int PointInArea(idVec3 point) {
int nodeNum;
float d;
- node = areaNodes[0];
- if (null == node) {
+ if (null == areaNodes) {
return -1;
}
+ node = areaNodes[0];
while (true) {
d = node.plane.Normal().oMultiply(point) + node.plane.oGet(3);
if (d > 0) {
diff --git a/src/main/java/neo/Renderer/RenderWorld_portals.java b/src/main/java/neo/Renderer/RenderWorld_portals.java
index 3eeeda9f..cdbbe6fc 100644
--- a/src/main/java/neo/Renderer/RenderWorld_portals.java
+++ b/src/main/java/neo/Renderer/RenderWorld_portals.java
@@ -1,8 +1,3 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
package neo.Renderer;
import neo.Renderer.RenderWorld_local.portal_s;
diff --git a/src/main/java/neo/Renderer/cg_explicit.java b/src/main/java/neo/Renderer/cg_explicit.java
index 35e75a36..bcdec9d8 100644
--- a/src/main/java/neo/Renderer/cg_explicit.java
+++ b/src/main/java/neo/Renderer/cg_explicit.java
@@ -1,8 +1,3 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
package neo.Renderer;
/**
@@ -12,371 +7,371 @@ public class cg_explicit {
// typedef enum
// {
- static final int CG_UNKNOWN_TYPE = 0;
- static final int CG_STRUCT = 1;
- static final int CG_ARRAY = 2;
+ static final int CG_UNKNOWN_TYPE = 0;
+ static final int CG_STRUCT = 1;
+ static final int CG_ARRAY = 2;
//
- static final int CG_TYPE_START_ENUM = 1024;
+ static final int CG_TYPE_START_ENUM = 1024;
//
//
- static final int CG_HALF = 1025;
- static final int CG_HALF2 = 1026;
- static final int CG_HALF3 = 1027;
- static final int CG_HALF4 = 1028;
- static final int CG_HALF1x1 = 1029;
- static final int CG_HALF1x2 = 1030;
- static final int CG_HALF1x3 = 1031;
- static final int CG_HALF1x4 = 1032;
- static final int CG_HALF2x1 = 1033;
- static final int CG_HALF2x2 = 1034;
- static final int CG_HALF2x3 = 1035;
- static final int CG_HALF2x4 = 1036;
- static final int CG_HALF3x1 = 1037;
- static final int CG_HALF3x2 = 1038;
- static final int CG_HALF3x3 = 1039;
- static final int CG_HALF3x4 = 1040;
- static final int CG_HALF4x1 = 1041;
- static final int CG_HALF4x2 = 1042;
- static final int CG_HALF4x3 = 1043;
- static final int CG_HALF4x4 = 1044;
- static final int CG_FLOAT = 1045;
- static final int CG_FLOAT2 = 1046;
- static final int CG_FLOAT3 = 1047;
- static final int CG_FLOAT4 = 1048;
- static final int CG_FLOAT1x1 = 1049;
- static final int CG_FLOAT1x2 = 1050;
- static final int CG_FLOAT1x3 = 1051;
- static final int CG_FLOAT1x4 = 1052;
- static final int CG_FLOAT2x1 = 1053;
- static final int CG_FLOAT2x2 = 1054;
- static final int CG_FLOAT2x3 = 1055;
- static final int CG_FLOAT2x4 = 1056;
- static final int CG_FLOAT3x1 = 1057;
- static final int CG_FLOAT3x2 = 1058;
- static final int CG_FLOAT3x3 = 1059;
- static final int CG_FLOAT3x4 = 1060;
- static final int CG_FLOAT4x1 = 1061;
- static final int CG_FLOAT4x2 = 1062;
- static final int CG_FLOAT4x3 = 1063;
- static final int CG_FLOAT4x4 = 1064;
- static final int CG_SAMPLER1D = 1065;
- static final int CG_SAMPLER2D = 1066;
- static final int CG_SAMPLER3D = 1067;
- static final int CG_SAMPLERRECT = 1068;
- static final int CG_SAMPLERCUBE = 1069;
- static final int CG_FIXED = 1070;
- static final int CG_FIXED2 = 1071;
- static final int CG_FIXED3 = 1072;
- static final int CG_FIXED4 = 1073;
- static final int CG_FIXED1x1 = 1074;
- static final int CG_FIXED1x2 = 1075;
- static final int CG_FIXED1x3 = 1076;
- static final int CG_FIXED1x4 = 1077;
- static final int CG_FIXED2x1 = 1078;
- static final int CG_FIXED2x2 = 1079;
- static final int CG_FIXED2x3 = 1080;
- static final int CG_FIXED2x4 = 1081;
- static final int CG_FIXED3x1 = 1082;
- static final int CG_FIXED3x2 = 1083;
- static final int CG_FIXED3x3 = 1084;
- static final int CG_FIXED3x4 = 1085;
- static final int CG_FIXED4x1 = 1086;
- static final int CG_FIXED4x2 = 1087;
- static final int CG_FIXED4x3 = 1088;
- static final int CG_FIXED4x4 = 1089;
- static final int CG_HALF1 = 1090;
- static final int CG_FLOAT1 = 1091;
- static final int CG_FIXED1 = 1092;
+ static final int CG_HALF = 1025;
+ static final int CG_HALF2 = 1026;
+ static final int CG_HALF3 = 1027;
+ static final int CG_HALF4 = 1028;
+ static final int CG_HALF1x1 = 1029;
+ static final int CG_HALF1x2 = 1030;
+ static final int CG_HALF1x3 = 1031;
+ static final int CG_HALF1x4 = 1032;
+ static final int CG_HALF2x1 = 1033;
+ static final int CG_HALF2x2 = 1034;
+ static final int CG_HALF2x3 = 1035;
+ static final int CG_HALF2x4 = 1036;
+ static final int CG_HALF3x1 = 1037;
+ static final int CG_HALF3x2 = 1038;
+ static final int CG_HALF3x3 = 1039;
+ static final int CG_HALF3x4 = 1040;
+ static final int CG_HALF4x1 = 1041;
+ static final int CG_HALF4x2 = 1042;
+ static final int CG_HALF4x3 = 1043;
+ static final int CG_HALF4x4 = 1044;
+ static final int CG_FLOAT = 1045;
+ static final int CG_FLOAT2 = 1046;
+ static final int CG_FLOAT3 = 1047;
+ static final int CG_FLOAT4 = 1048;
+ static final int CG_FLOAT1x1 = 1049;
+ static final int CG_FLOAT1x2 = 1050;
+ static final int CG_FLOAT1x3 = 1051;
+ static final int CG_FLOAT1x4 = 1052;
+ static final int CG_FLOAT2x1 = 1053;
+ static final int CG_FLOAT2x2 = 1054;
+ static final int CG_FLOAT2x3 = 1055;
+ static final int CG_FLOAT2x4 = 1056;
+ static final int CG_FLOAT3x1 = 1057;
+ static final int CG_FLOAT3x2 = 1058;
+ static final int CG_FLOAT3x3 = 1059;
+ static final int CG_FLOAT3x4 = 1060;
+ static final int CG_FLOAT4x1 = 1061;
+ static final int CG_FLOAT4x2 = 1062;
+ static final int CG_FLOAT4x3 = 1063;
+ static final int CG_FLOAT4x4 = 1064;
+ static final int CG_SAMPLER1D = 1065;
+ static final int CG_SAMPLER2D = 1066;
+ static final int CG_SAMPLER3D = 1067;
+ static final int CG_SAMPLERRECT = 1068;
+ static final int CG_SAMPLERCUBE = 1069;
+ static final int CG_FIXED = 1070;
+ static final int CG_FIXED2 = 1071;
+ static final int CG_FIXED3 = 1072;
+ static final int CG_FIXED4 = 1073;
+ static final int CG_FIXED1x1 = 1074;
+ static final int CG_FIXED1x2 = 1075;
+ static final int CG_FIXED1x3 = 1076;
+ static final int CG_FIXED1x4 = 1077;
+ static final int CG_FIXED2x1 = 1078;
+ static final int CG_FIXED2x2 = 1079;
+ static final int CG_FIXED2x3 = 1080;
+ static final int CG_FIXED2x4 = 1081;
+ static final int CG_FIXED3x1 = 1082;
+ static final int CG_FIXED3x2 = 1083;
+ static final int CG_FIXED3x3 = 1084;
+ static final int CG_FIXED3x4 = 1085;
+ static final int CG_FIXED4x1 = 1086;
+ static final int CG_FIXED4x2 = 1087;
+ static final int CG_FIXED4x3 = 1088;
+ static final int CG_FIXED4x4 = 1089;
+ static final int CG_HALF1 = 1090;
+ static final int CG_FLOAT1 = 1091;
+ static final int CG_FIXED1 = 1092;
// } CGtype;
// typedef enum
// {
- static final int CG_TEXUNIT0 = 2048;
- static final int CG_TEXUNIT1 = 2049;
- static final int CG_TEXUNIT2 = 2050;
- static final int CG_TEXUNIT3 = 2051;
- static final int CG_TEXUNIT4 = 2052;
- static final int CG_TEXUNIT5 = 2053;
- static final int CG_TEXUNIT6 = 2054;
- static final int CG_TEXUNIT7 = 2055;
- static final int CG_TEXUNIT8 = 2056;
- static final int CG_TEXUNIT9 = 2057;
- static final int CG_TEXUNIT10 = 2058;
- static final int CG_TEXUNIT11 = 2059;
- static final int CG_TEXUNIT12 = 2060;
- static final int CG_TEXUNIT13 = 2061;
- static final int CG_TEXUNIT14 = 2062;
- static final int CG_TEXUNIT15 = 2063;
+ static final int CG_TEXUNIT0 = 2048;
+ static final int CG_TEXUNIT1 = 2049;
+ static final int CG_TEXUNIT2 = 2050;
+ static final int CG_TEXUNIT3 = 2051;
+ static final int CG_TEXUNIT4 = 2052;
+ static final int CG_TEXUNIT5 = 2053;
+ static final int CG_TEXUNIT6 = 2054;
+ static final int CG_TEXUNIT7 = 2055;
+ static final int CG_TEXUNIT8 = 2056;
+ static final int CG_TEXUNIT9 = 2057;
+ static final int CG_TEXUNIT10 = 2058;
+ static final int CG_TEXUNIT11 = 2059;
+ static final int CG_TEXUNIT12 = 2060;
+ static final int CG_TEXUNIT13 = 2061;
+ static final int CG_TEXUNIT14 = 2062;
+ static final int CG_TEXUNIT15 = 2063;
//
- static final int CG_ATTR0 = 2113;
- static final int CG_ATTR1 = 2114;
- static final int CG_ATTR2 = 2115;
- static final int CG_ATTR3 = 2116;
- static final int CG_ATTR4 = 2117;
- static final int CG_ATTR5 = 2118;
- static final int CG_ATTR6 = 2119;
- static final int CG_ATTR7 = 2120;
- static final int CG_ATTR8 = 2121;
- static final int CG_ATTR9 = 2122;
- static final int CG_ATTR10 = 2123;
- static final int CG_ATTR11 = 2124;
- static final int CG_ATTR12 = 2125;
- static final int CG_ATTR13 = 2126;
- static final int CG_ATTR14 = 2127;
- static final int CG_ATTR15 = 2128;
+ static final int CG_ATTR0 = 2113;
+ static final int CG_ATTR1 = 2114;
+ static final int CG_ATTR2 = 2115;
+ static final int CG_ATTR3 = 2116;
+ static final int CG_ATTR4 = 2117;
+ static final int CG_ATTR5 = 2118;
+ static final int CG_ATTR6 = 2119;
+ static final int CG_ATTR7 = 2120;
+ static final int CG_ATTR8 = 2121;
+ static final int CG_ATTR9 = 2122;
+ static final int CG_ATTR10 = 2123;
+ static final int CG_ATTR11 = 2124;
+ static final int CG_ATTR12 = 2125;
+ static final int CG_ATTR13 = 2126;
+ static final int CG_ATTR14 = 2127;
+ static final int CG_ATTR15 = 2128;
//
- static final int CG_C = 2178;
+ static final int CG_C = 2178;
//
- static final int CG_TEX0 = 2179;
- static final int CG_TEX1 = 2180;
- static final int CG_TEX2 = 2181;
- static final int CG_TEX3 = 2192;
- static final int CG_TEX4 = 2193;
- static final int CG_TEX5 = 2194;
- static final int CG_TEX6 = 2195;
- static final int CG_TEX7 = 2196;
+ static final int CG_TEX0 = 2179;
+ static final int CG_TEX1 = 2180;
+ static final int CG_TEX2 = 2181;
+ static final int CG_TEX3 = 2192;
+ static final int CG_TEX4 = 2193;
+ static final int CG_TEX5 = 2194;
+ static final int CG_TEX6 = 2195;
+ static final int CG_TEX7 = 2196;
//
- static final int CG_HPOS = 2243;
- static final int CG_COL0 = 2245;
- static final int CG_COL1 = 2246;
- static final int CG_COL2 = 2247;
- static final int CG_COL3 = 2248;
- static final int CG_PSIZ = 2309;
- static final int CG_WPOS = 2373;
+ static final int CG_HPOS = 2243;
+ static final int CG_COL0 = 2245;
+ static final int CG_COL1 = 2246;
+ static final int CG_COL2 = 2247;
+ static final int CG_COL3 = 2248;
+ static final int CG_PSIZ = 2309;
+ static final int CG_WPOS = 2373;
//
- static final int CG_POSITION0 = 2437;
- static final int CG_POSITION1 = 2438;
- static final int CG_POSITION2 = 2439;
- static final int CG_POSITION3 = 2440;
- static final int CG_POSITION4 = 2441;
- static final int CG_POSITION5 = 2442;
- static final int CG_POSITION6 = 2443;
- static final int CG_POSITION7 = 2444;
- static final int CG_POSITION8 = 2445;
- static final int CG_POSITION9 = 2446;
- static final int CG_POSITION10 = 2447;
- static final int CG_POSITION11 = 2448;
- static final int CG_POSITION12 = 2449;
- static final int CG_POSITION13 = 2450;
- static final int CG_POSITION14 = 2451;
- static final int CG_POSITION15 = 2452;
- static final int CG_DIFFUSE0 = 2501;
- static final int CG_TANGENT0 = 2565;
- static final int CG_TANGENT1 = 2566;
- static final int CG_TANGENT2 = 2567;
- static final int CG_TANGENT3 = 2568;
- static final int CG_TANGENT4 = 2569;
- static final int CG_TANGENT5 = 2570;
- static final int CG_TANGENT6 = 2571;
- static final int CG_TANGENT7 = 2572;
- static final int CG_TANGENT8 = 2573;
- static final int CG_TANGENT9 = 2574;
- static final int CG_TANGENT10 = 2575;
- static final int CG_TANGENT11 = 2576;
- static final int CG_TANGENT12 = 2577;
- static final int CG_TANGENT13 = 2578;
- static final int CG_TANGENT14 = 2579;
- static final int CG_TANGENT15 = 2580;
- static final int CG_SPECULAR0 = 2629;
- static final int CG_BLENDINDICES0 = 2693;
- static final int CG_BLENDINDICES1 = 2694;
- static final int CG_BLENDINDICES2 = 2695;
- static final int CG_BLENDINDICES3 = 2696;
- static final int CG_BLENDINDICES4 = 2697;
- static final int CG_BLENDINDICES5 = 2698;
- static final int CG_BLENDINDICES6 = 2699;
- static final int CG_BLENDINDICES7 = 2700;
- static final int CG_BLENDINDICES8 = 2701;
- static final int CG_BLENDINDICES9 = 2702;
- static final int CG_BLENDINDICES10 = 2703;
- static final int CG_BLENDINDICES11 = 2704;
- static final int CG_BLENDINDICES12 = 2705;
- static final int CG_BLENDINDICES13 = 2706;
- static final int CG_BLENDINDICES14 = 2707;
- static final int CG_BLENDINDICES15 = 2708;
- static final int CG_COLOR0 = 2757;
- static final int CG_COLOR1 = 2758;
- static final int CG_COLOR2 = 2759;
- static final int CG_COLOR3 = 2760;
- static final int CG_COLOR4 = 2761;
- static final int CG_COLOR5 = 2762;
- static final int CG_COLOR6 = 2763;
- static final int CG_COLOR7 = 2764;
- static final int CG_COLOR8 = 2765;
- static final int CG_COLOR9 = 2766;
- static final int CG_COLOR10 = 2767;
- static final int CG_COLOR11 = 2768;
- static final int CG_COLOR12 = 2769;
- static final int CG_COLOR13 = 2770;
- static final int CG_COLOR14 = 2771;
- static final int CG_COLOR15 = 2772;
- static final int CG_PSIZE0 = 2821;
- static final int CG_PSIZE1 = 2822;
- static final int CG_PSIZE2 = 2823;
- static final int CG_PSIZE3 = 2824;
- static final int CG_PSIZE4 = 2825;
- static final int CG_PSIZE5 = 2826;
- static final int CG_PSIZE6 = 2827;
- static final int CG_PSIZE7 = 2828;
- static final int CG_PSIZE8 = 2829;
- static final int CG_PSIZE9 = 2830;
- static final int CG_PSIZE10 = 2831;
- static final int CG_PSIZE11 = 2832;
- static final int CG_PSIZE12 = 2833;
- static final int CG_PSIZE13 = 2834;
- static final int CG_PSIZE14 = 2835;
- static final int CG_PSIZE15 = 2836;
- static final int CG_BINORMAL0 = 2885;
- static final int CG_BINORMAL1 = 2886;
- static final int CG_BINORMAL2 = 2887;
- static final int CG_BINORMAL3 = 2888;
- static final int CG_BINORMAL4 = 2889;
- static final int CG_BINORMAL5 = 2890;
- static final int CG_BINORMAL6 = 2891;
- static final int CG_BINORMAL7 = 2892;
- static final int CG_BINORMAL8 = 2893;
- static final int CG_BINORMAL9 = 2894;
- static final int CG_BINORMAL10 = 2895;
- static final int CG_BINORMAL11 = 2896;
- static final int CG_BINORMAL12 = 2897;
- static final int CG_BINORMAL13 = 2898;
- static final int CG_BINORMAL14 = 2899;
- static final int CG_BINORMAL15 = 2900;
- static final int CG_FOG0 = 2917;
- static final int CG_FOG1 = 2918;
- static final int CG_FOG2 = 2919;
- static final int CG_FOG3 = 2920;
- static final int CG_FOG4 = 2921;
- static final int CG_FOG5 = 2922;
- static final int CG_FOG6 = 2923;
- static final int CG_FOG7 = 2924;
- static final int CG_FOG8 = 2925;
- static final int CG_FOG9 = 2926;
- static final int CG_FOG10 = 2927;
- static final int CG_FOG11 = 2928;
- static final int CG_FOG12 = 2929;
- static final int CG_FOG13 = 2930;
- static final int CG_FOG14 = 2931;
- static final int CG_FOG15 = 2932;
- static final int CG_DEPTH0 = 2933;
- static final int CG_DEPTH1 = 2934;
- static final int CG_DEPTH2 = 2935;
- static final int CG_DEPTH3 = 2936;
- static final int CG_DEPTH4 = 2937;
- static final int CG_DEPTH5 = 2938;
- static final int CG_DEPTH6 = 2939;
- static final int CG_DEPTH7 = 2940;
- static final int CG_DEPTH8 = 2941;
- static final int CG_DEPTH9 = 29542;
- static final int CG_DEPTH10 = 2943;
- static final int CG_DEPTH11 = 2944;
- static final int CG_DEPTH12 = 2945;
- static final int CG_DEPTH13 = 2946;
- static final int CG_DEPTH14 = 2947;
- static final int CG_DEPTH15 = 2948;
- static final int CG_SAMPLE0 = 2949;
- static final int CG_SAMPLE1 = 2950;
- static final int CG_SAMPLE2 = 2951;
- static final int CG_SAMPLE3 = 2952;
- static final int CG_SAMPLE4 = 2953;
- static final int CG_SAMPLE5 = 2954;
- static final int CG_SAMPLE6 = 2955;
- static final int CG_SAMPLE7 = 2956;
- static final int CG_SAMPLE8 = 2957;
- static final int CG_SAMPLE9 = 2958;
- static final int CG_SAMPLE10 = 2959;
- static final int CG_SAMPLE11 = 2960;
- static final int CG_SAMPLE12 = 2961;
- static final int CG_SAMPLE13 = 2962;
- static final int CG_SAMPLE14 = 2963;
- static final int CG_SAMPLE15 = 2964;
- static final int CG_BLENDWEIGHT0 = 3028;
- static final int CG_BLENDWEIGHT1 = 3029;
- static final int CG_BLENDWEIGHT2 = 3030;
- static final int CG_BLENDWEIGHT3 = 3031;
- static final int CG_BLENDWEIGHT4 = 3032;
- static final int CG_BLENDWEIGHT5 = 3033;
- static final int CG_BLENDWEIGHT6 = 3034;
- static final int CG_BLENDWEIGHT7 = 3035;
- static final int CG_BLENDWEIGHT8 = 3036;
- static final int CG_BLENDWEIGHT9 = 3037;
- static final int CG_BLENDWEIGHT10 = 3038;
- static final int CG_BLENDWEIGHT11 = 3039;
- static final int CG_BLENDWEIGHT12 = 3040;
- static final int CG_BLENDWEIGHT13 = 3041;
- static final int CG_BLENDWEIGHT14 = 3042;
- static final int CG_BLENDWEIGHT15 = 3043;
- static final int CG_NORMAL0 = 3092;
- static final int CG_NORMAL1 = 3093;
- static final int CG_NORMAL2 = 3094;
- static final int CG_NORMAL3 = 3095;
- static final int CG_NORMAL4 = 3096;
- static final int CG_NORMAL5 = 3097;
- static final int CG_NORMAL6 = 3098;
- static final int CG_NORMAL7 = 3099;
- static final int CG_NORMAL8 = 3100;
- static final int CG_NORMAL9 = 3101;
- static final int CG_NORMAL10 = 3102;
- static final int CG_NORMAL11 = 3103;
- static final int CG_NORMAL12 = 3104;
- static final int CG_NORMAL13 = 3105;
- static final int CG_NORMAL14 = 3106;
- static final int CG_NORMAL15 = 3107;
- static final int CG_FOGCOORD = 3156;
- static final int CG_TEXCOORD0 = 3220;
- static final int CG_TEXCOORD1 = 3221;
- static final int CG_TEXCOORD2 = 3222;
- static final int CG_TEXCOORD3 = 3223;
- static final int CG_TEXCOORD4 = 3224;
- static final int CG_TEXCOORD5 = 3225;
- static final int CG_TEXCOORD6 = 3226;
- static final int CG_TEXCOORD7 = 3227;
- static final int CG_TEXCOORD8 = 3228;
- static final int CG_TEXCOORD9 = 3229;
- static final int CG_TEXCOORD10 = 3230;
- static final int CG_TEXCOORD11 = 3231;
- static final int CG_TEXCOORD12 = 3232;
- static final int CG_TEXCOORD13 = 3233;
- static final int CG_TEXCOORD14 = 3234;
- static final int CG_TEXCOORD15 = 3235;
- static final int CG_COMBINER_CONST0 = 3284;
- static final int CG_COMBINER_CONST1 = 3285;
+ static final int CG_POSITION0 = 2437;
+ static final int CG_POSITION1 = 2438;
+ static final int CG_POSITION2 = 2439;
+ static final int CG_POSITION3 = 2440;
+ static final int CG_POSITION4 = 2441;
+ static final int CG_POSITION5 = 2442;
+ static final int CG_POSITION6 = 2443;
+ static final int CG_POSITION7 = 2444;
+ static final int CG_POSITION8 = 2445;
+ static final int CG_POSITION9 = 2446;
+ static final int CG_POSITION10 = 2447;
+ static final int CG_POSITION11 = 2448;
+ static final int CG_POSITION12 = 2449;
+ static final int CG_POSITION13 = 2450;
+ static final int CG_POSITION14 = 2451;
+ static final int CG_POSITION15 = 2452;
+ static final int CG_DIFFUSE0 = 2501;
+ static final int CG_TANGENT0 = 2565;
+ static final int CG_TANGENT1 = 2566;
+ static final int CG_TANGENT2 = 2567;
+ static final int CG_TANGENT3 = 2568;
+ static final int CG_TANGENT4 = 2569;
+ static final int CG_TANGENT5 = 2570;
+ static final int CG_TANGENT6 = 2571;
+ static final int CG_TANGENT7 = 2572;
+ static final int CG_TANGENT8 = 2573;
+ static final int CG_TANGENT9 = 2574;
+ static final int CG_TANGENT10 = 2575;
+ static final int CG_TANGENT11 = 2576;
+ static final int CG_TANGENT12 = 2577;
+ static final int CG_TANGENT13 = 2578;
+ static final int CG_TANGENT14 = 2579;
+ static final int CG_TANGENT15 = 2580;
+ static final int CG_SPECULAR0 = 2629;
+ static final int CG_BLENDINDICES0 = 2693;
+ static final int CG_BLENDINDICES1 = 2694;
+ static final int CG_BLENDINDICES2 = 2695;
+ static final int CG_BLENDINDICES3 = 2696;
+ static final int CG_BLENDINDICES4 = 2697;
+ static final int CG_BLENDINDICES5 = 2698;
+ static final int CG_BLENDINDICES6 = 2699;
+ static final int CG_BLENDINDICES7 = 2700;
+ static final int CG_BLENDINDICES8 = 2701;
+ static final int CG_BLENDINDICES9 = 2702;
+ static final int CG_BLENDINDICES10 = 2703;
+ static final int CG_BLENDINDICES11 = 2704;
+ static final int CG_BLENDINDICES12 = 2705;
+ static final int CG_BLENDINDICES13 = 2706;
+ static final int CG_BLENDINDICES14 = 2707;
+ static final int CG_BLENDINDICES15 = 2708;
+ static final int CG_COLOR0 = 2757;
+ static final int CG_COLOR1 = 2758;
+ static final int CG_COLOR2 = 2759;
+ static final int CG_COLOR3 = 2760;
+ static final int CG_COLOR4 = 2761;
+ static final int CG_COLOR5 = 2762;
+ static final int CG_COLOR6 = 2763;
+ static final int CG_COLOR7 = 2764;
+ static final int CG_COLOR8 = 2765;
+ static final int CG_COLOR9 = 2766;
+ static final int CG_COLOR10 = 2767;
+ static final int CG_COLOR11 = 2768;
+ static final int CG_COLOR12 = 2769;
+ static final int CG_COLOR13 = 2770;
+ static final int CG_COLOR14 = 2771;
+ static final int CG_COLOR15 = 2772;
+ static final int CG_PSIZE0 = 2821;
+ static final int CG_PSIZE1 = 2822;
+ static final int CG_PSIZE2 = 2823;
+ static final int CG_PSIZE3 = 2824;
+ static final int CG_PSIZE4 = 2825;
+ static final int CG_PSIZE5 = 2826;
+ static final int CG_PSIZE6 = 2827;
+ static final int CG_PSIZE7 = 2828;
+ static final int CG_PSIZE8 = 2829;
+ static final int CG_PSIZE9 = 2830;
+ static final int CG_PSIZE10 = 2831;
+ static final int CG_PSIZE11 = 2832;
+ static final int CG_PSIZE12 = 2833;
+ static final int CG_PSIZE13 = 2834;
+ static final int CG_PSIZE14 = 2835;
+ static final int CG_PSIZE15 = 2836;
+ static final int CG_BINORMAL0 = 2885;
+ static final int CG_BINORMAL1 = 2886;
+ static final int CG_BINORMAL2 = 2887;
+ static final int CG_BINORMAL3 = 2888;
+ static final int CG_BINORMAL4 = 2889;
+ static final int CG_BINORMAL5 = 2890;
+ static final int CG_BINORMAL6 = 2891;
+ static final int CG_BINORMAL7 = 2892;
+ static final int CG_BINORMAL8 = 2893;
+ static final int CG_BINORMAL9 = 2894;
+ static final int CG_BINORMAL10 = 2895;
+ static final int CG_BINORMAL11 = 2896;
+ static final int CG_BINORMAL12 = 2897;
+ static final int CG_BINORMAL13 = 2898;
+ static final int CG_BINORMAL14 = 2899;
+ static final int CG_BINORMAL15 = 2900;
+ static final int CG_FOG0 = 2917;
+ static final int CG_FOG1 = 2918;
+ static final int CG_FOG2 = 2919;
+ static final int CG_FOG3 = 2920;
+ static final int CG_FOG4 = 2921;
+ static final int CG_FOG5 = 2922;
+ static final int CG_FOG6 = 2923;
+ static final int CG_FOG7 = 2924;
+ static final int CG_FOG8 = 2925;
+ static final int CG_FOG9 = 2926;
+ static final int CG_FOG10 = 2927;
+ static final int CG_FOG11 = 2928;
+ static final int CG_FOG12 = 2929;
+ static final int CG_FOG13 = 2930;
+ static final int CG_FOG14 = 2931;
+ static final int CG_FOG15 = 2932;
+ static final int CG_DEPTH0 = 2933;
+ static final int CG_DEPTH1 = 2934;
+ static final int CG_DEPTH2 = 2935;
+ static final int CG_DEPTH3 = 2936;
+ static final int CG_DEPTH4 = 2937;
+ static final int CG_DEPTH5 = 2938;
+ static final int CG_DEPTH6 = 2939;
+ static final int CG_DEPTH7 = 2940;
+ static final int CG_DEPTH8 = 2941;
+ static final int CG_DEPTH9 = 29542;
+ static final int CG_DEPTH10 = 2943;
+ static final int CG_DEPTH11 = 2944;
+ static final int CG_DEPTH12 = 2945;
+ static final int CG_DEPTH13 = 2946;
+ static final int CG_DEPTH14 = 2947;
+ static final int CG_DEPTH15 = 2948;
+ static final int CG_SAMPLE0 = 2949;
+ static final int CG_SAMPLE1 = 2950;
+ static final int CG_SAMPLE2 = 2951;
+ static final int CG_SAMPLE3 = 2952;
+ static final int CG_SAMPLE4 = 2953;
+ static final int CG_SAMPLE5 = 2954;
+ static final int CG_SAMPLE6 = 2955;
+ static final int CG_SAMPLE7 = 2956;
+ static final int CG_SAMPLE8 = 2957;
+ static final int CG_SAMPLE9 = 2958;
+ static final int CG_SAMPLE10 = 2959;
+ static final int CG_SAMPLE11 = 2960;
+ static final int CG_SAMPLE12 = 2961;
+ static final int CG_SAMPLE13 = 2962;
+ static final int CG_SAMPLE14 = 2963;
+ static final int CG_SAMPLE15 = 2964;
+ static final int CG_BLENDWEIGHT0 = 3028;
+ static final int CG_BLENDWEIGHT1 = 3029;
+ static final int CG_BLENDWEIGHT2 = 3030;
+ static final int CG_BLENDWEIGHT3 = 3031;
+ static final int CG_BLENDWEIGHT4 = 3032;
+ static final int CG_BLENDWEIGHT5 = 3033;
+ static final int CG_BLENDWEIGHT6 = 3034;
+ static final int CG_BLENDWEIGHT7 = 3035;
+ static final int CG_BLENDWEIGHT8 = 3036;
+ static final int CG_BLENDWEIGHT9 = 3037;
+ static final int CG_BLENDWEIGHT10 = 3038;
+ static final int CG_BLENDWEIGHT11 = 3039;
+ static final int CG_BLENDWEIGHT12 = 3040;
+ static final int CG_BLENDWEIGHT13 = 3041;
+ static final int CG_BLENDWEIGHT14 = 3042;
+ static final int CG_BLENDWEIGHT15 = 3043;
+ static final int CG_NORMAL0 = 3092;
+ static final int CG_NORMAL1 = 3093;
+ static final int CG_NORMAL2 = 3094;
+ static final int CG_NORMAL3 = 3095;
+ static final int CG_NORMAL4 = 3096;
+ static final int CG_NORMAL5 = 3097;
+ static final int CG_NORMAL6 = 3098;
+ static final int CG_NORMAL7 = 3099;
+ static final int CG_NORMAL8 = 3100;
+ static final int CG_NORMAL9 = 3101;
+ static final int CG_NORMAL10 = 3102;
+ static final int CG_NORMAL11 = 3103;
+ static final int CG_NORMAL12 = 3104;
+ static final int CG_NORMAL13 = 3105;
+ static final int CG_NORMAL14 = 3106;
+ static final int CG_NORMAL15 = 3107;
+ static final int CG_FOGCOORD = 3156;
+ static final int CG_TEXCOORD0 = 3220;
+ static final int CG_TEXCOORD1 = 3221;
+ static final int CG_TEXCOORD2 = 3222;
+ static final int CG_TEXCOORD3 = 3223;
+ static final int CG_TEXCOORD4 = 3224;
+ static final int CG_TEXCOORD5 = 3225;
+ static final int CG_TEXCOORD6 = 3226;
+ static final int CG_TEXCOORD7 = 3227;
+ static final int CG_TEXCOORD8 = 3228;
+ static final int CG_TEXCOORD9 = 3229;
+ static final int CG_TEXCOORD10 = 3230;
+ static final int CG_TEXCOORD11 = 3231;
+ static final int CG_TEXCOORD12 = 3232;
+ static final int CG_TEXCOORD13 = 3233;
+ static final int CG_TEXCOORD14 = 3234;
+ static final int CG_TEXCOORD15 = 3235;
+ static final int CG_COMBINER_CONST0 = 3284;
+ static final int CG_COMBINER_CONST1 = 3285;
static final int CG_COMBINER_STAGE_CONST0 = 3286;
static final int CG_COMBINER_STAGE_CONST1 = 3287;
static final int CG_OFFSET_TEXTURE_MATRIX = 3288;
- static final int CG_OFFSET_TEXTURE_SCALE = 3289;
- static final int CG_OFFSET_TEXTURE_BIAS = 3290;
- static final int CG_CONST_EYE = 3291;
- static final int CG_TESSFACTOR = 3255;
+ static final int CG_OFFSET_TEXTURE_SCALE = 3289;
+ static final int CG_OFFSET_TEXTURE_BIAS = 3290;
+ static final int CG_CONST_EYE = 3291;
+ static final int CG_TESSFACTOR = 3255;
//
//
- static final int CG_UNDEFINED = 3256;
+ static final int CG_UNDEFINED = 3256;
// } CGresource;
// typedef enum
// {
- static final int CG_PROFILE_START = 6144;
+ static final int CG_PROFILE_START = 6144;
static final int CG_PROFILE_UNKNOWN = 6145;
//
- static final int CG_PROFILE_VP20 = 6146;
- static final int CG_PROFILE_FP20 = 6147;
- static final int CG_PROFILE_VP30 = 6148;
- static final int CG_PROFILE_FP30 = 6149;
- static final int CG_PROFILE_ARBVP1 = 6150;
- static final int CG_PROFILE_ARBFP1 = 7000;
+ static final int CG_PROFILE_VP20 = 6146;
+ static final int CG_PROFILE_FP20 = 6147;
+ static final int CG_PROFILE_VP30 = 6148;
+ static final int CG_PROFILE_FP30 = 6149;
+ static final int CG_PROFILE_ARBVP1 = 6150;
+ static final int CG_PROFILE_ARBFP1 = 7000;
//
//
- static final int CG_PROFILE_VS_1_1 = 6153;
- static final int CG_PROFILE_VS_2_0 = 6154;
- static final int CG_PROFILE_VS_2_X = 6155;
+ static final int CG_PROFILE_VS_1_1 = 6153;
+ static final int CG_PROFILE_VS_2_0 = 6154;
+ static final int CG_PROFILE_VS_2_X = 6155;
//
- static final int CG_PROFILE_PS_1_1 = 6159;
- static final int CG_PROFILE_PS_1_2 = 6160;
- static final int CG_PROFILE_PS_1_3 = 6161;
- static final int CG_PROFILE_PS_2_0 = 6162;
- static final int CG_PROFILE_PS_2_X = 6163;
+ static final int CG_PROFILE_PS_1_1 = 6159;
+ static final int CG_PROFILE_PS_1_2 = 6160;
+ static final int CG_PROFILE_PS_1_3 = 6161;
+ static final int CG_PROFILE_PS_2_0 = 6162;
+ static final int CG_PROFILE_PS_2_X = 6163;
//
- static final int CG_PROFILE_MAX = 6164;
+ static final int CG_PROFILE_MAX = 6164;
// } CGprofile;
public enum CGerror {
@@ -409,27 +404,27 @@ public enum CGerror {
// typedef enum
// {
- static final int CG_UNKNOWN = 4096;
- static final int CG_IN = 4097;
- static final int CG_OUT = 4098;
- static final int CG_INOUT = 4099;
- static final int CG_MIXED = 4101;
- static final int CG_VARYING = 4102;
- static final int CG_UNIFORM = 4103;
- static final int CG_CONSTANT = 4104;
- static final int CG_PROGRAM_SOURCE = 4105;
- static final int CG_PROGRAM_ENTRY = 4106;
+ static final int CG_UNKNOWN = 4096;
+ static final int CG_IN = 4097;
+ static final int CG_OUT = 4098;
+ static final int CG_INOUT = 4099;
+ static final int CG_MIXED = 4101;
+ static final int CG_VARYING = 4102;
+ static final int CG_UNIFORM = 4103;
+ static final int CG_CONSTANT = 4104;
+ static final int CG_PROGRAM_SOURCE = 4105;
+ static final int CG_PROGRAM_ENTRY = 4106;
static final int CG_COMPILED_PROGRAM = 4107;
- static final int CG_PROGRAM_PROFILE = 4108;
+ static final int CG_PROGRAM_PROFILE = 4108;
//
- static final int CG_GLOBAL = 4109;
- static final int CG_PROGRAM = 4110;
+ static final int CG_GLOBAL = 4109;
+ static final int CG_PROGRAM = 4110;
//
- static final int CG_DEFAULT = 4111;
- static final int CG_ERROR = 4112;
+ static final int CG_DEFAULT = 4111;
+ static final int CG_ERROR = 4112;
//
- static final int CG_SOURCE = 4113;
- static final int CG_OBJECT = 4114;
+ static final int CG_SOURCE = 4113;
+ static final int CG_OBJECT = 4114;
// } CGenum;
public enum CGGLenum {
diff --git a/src/main/java/neo/Renderer/draw_common.java b/src/main/java/neo/Renderer/draw_common.java
index e75b9710..580f1bd4 100644
--- a/src/main/java/neo/Renderer/draw_common.java
+++ b/src/main/java/neo/Renderer/draw_common.java
@@ -956,7 +956,7 @@ public static void RB_STD_T_RenderShaderPasses(final drawSurf_s surf) {
for (stage = 0; stage < shader.GetNumStages(); stage++) {
if (stage > 1) {
// System.out.printf("RB_STD_T_RenderShaderPasses(%d)\n", DBG_RB_STD_T_RenderShaderPasses++);
- continue;//HACKME::4:our blending doesn't seem to work properly.
+// continue;//HACKME::4:our blending doesn't seem to work properly.
}
pStage = shader.GetStage(stage);
diff --git a/src/main/java/neo/Renderer/qgl.java b/src/main/java/neo/Renderer/qgl.java
index aca54490..e629d696 100644
--- a/src/main/java/neo/Renderer/qgl.java
+++ b/src/main/java/neo/Renderer/qgl.java
@@ -1,8 +1,3 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
package neo.Renderer;
import java.nio.ByteBuffer;
diff --git a/src/main/java/neo/Sound/snd_cache.java b/src/main/java/neo/Sound/snd_cache.java
index 899f869d..3b34ac8c 100644
--- a/src/main/java/neo/Sound/snd_cache.java
+++ b/src/main/java/neo/Sound/snd_cache.java
@@ -7,6 +7,7 @@
import static neo.Sound.snd_local.WAVE_FORMAT_TAG_OGG;
import static neo.Sound.snd_local.WAVE_FORMAT_TAG_PCM;
import neo.Sound.snd_local.idSampleDecoder;
+import neo.Sound.snd_local.waveformatex_s;
import neo.Sound.snd_system.idSoundSystemLocal;
import neo.Sound.snd_wavefile.idWaveFile;
import static neo.TempDump.NOT;
@@ -35,17 +36,7 @@
*
*/
public class snd_cache {
-
- static class waveformatex_s {
-
- int/*word*/ wFormatTag; // format type
- int/*word*/ nChannels; // number of channels (i.e. mono, stereo...)
- int/*dword*/ nSamplesPerSec; // sample rate
- long/*dword*/ nAvgBytesPerSec; // for buffer estimation
- int/*word*/ nBlockAlign; // block size of data
- int/*word*/ wBitsPerSample; // Number of bits per sample of mono data
- int/*word*/ cbSize; // The count in bytes of the size of extra information (after cbSize)
- }
+
// static final boolean USE_SOUND_CACHE_ALLOCATOR = true;
// static final idDynamicBlockAlloc soundCacheAllocator;
//
@@ -117,7 +108,7 @@ public int LengthIn44kHzSamples() {
fileSystem.ReadFile(name.toString(), null, timestamp);
if (timestamp[0] == FILE_NOT_FOUND_TIMESTAMP) {
- idStr oggName = name;
+ idStr oggName = new idStr(name);
oggName.SetFileExtension(".ogg");
fileSystem.ReadFile(oggName.toString(), null, timestamp);
}
@@ -161,7 +152,7 @@ public void MakeDefault() {
alGetError();
// alBufferData(openalBuffer, objectInfo.nChannels == 1 ? AL_FORMAT_MONO16 : AL_FORMAT_STEREO16, nonCacheData, objectMemSize, objectInfo.nSamplesPerSec);
- AL10.alBufferData(openalBuffer/* <> */, objectInfo.nChannels == 1 ? AL_FORMAT_MONO16 : AL_FORMAT_STEREO16, nonCacheData, objectInfo.nSamplesPerSec);
+ AL10.alBufferData(openalBuffer/* <> */, objectInfo.nChannels == 1 ? AL_FORMAT_MONO16 : AL_FORMAT_STEREO16, nonCacheData, (int) objectInfo.nSamplesPerSec);
if (alGetError() != AL_NO_ERROR) {
common.Error("idSoundCache: error loading data into OpenAL hardware buffer");
} else {
@@ -195,7 +186,7 @@ public void Load() {
// load it
idWaveFile fh = new idWaveFile();
- waveformatex_s info = new waveformatex_s();
+ waveformatex_s[] info = {null};
if (fh.Open(name.toString(), info) == -1) {
common.Warning("Couldn't load sound '%s' using default", name);
@@ -203,32 +194,32 @@ public void Load() {
return;
}
- if (info.nChannels != 1 && info.nChannels != 2) {
- common.Warning("idSoundSample: %s has %d channels, using default", name, info.nChannels);
+ if (info[0].nChannels != 1 && info[0].nChannels != 2) {
+ common.Warning("idSoundSample: %s has %d channels, using default", name, info[0].nChannels);
fh.Close();
MakeDefault();
return;
}
- if (info.wBitsPerSample != 16) {
- common.Warning("idSoundSample: %s is %dbits, expected 16bits using default", name, info.wBitsPerSample);
+ if (info[0].wBitsPerSample != 16) {
+ common.Warning("idSoundSample: %s is %dbits, expected 16bits using default", name, info[0].wBitsPerSample);
fh.Close();
MakeDefault();
return;
}
- if (info.nSamplesPerSec != 44100 && info.nSamplesPerSec != 22050 && info.nSamplesPerSec != 11025) {
- common.Warning("idSoundCache: %s is %dHz, expected 11025, 22050 or 44100 Hz. Using default", name, info.nSamplesPerSec);
+ if (info[0].nSamplesPerSec != 44100 && info[0].nSamplesPerSec != 22050 && info[0].nSamplesPerSec != 11025) {
+ common.Warning("idSoundCache: %s is %dHz, expected 11025, 22050 or 44100 Hz. Using default", name, info[0].nSamplesPerSec);
fh.Close();
MakeDefault();
return;
}
- objectInfo = info;
+ objectInfo = info[0];
objectSize = fh.GetOutputSize();
objectMemSize = fh.GetMemorySize();
- nonCacheData = BufferUtils.createByteBuffer(objectMemSize);//soundCacheAllocator.Alloc( objectMemSize );
+ nonCacheData = ByteBuffer.allocate(objectMemSize);//soundCacheAllocator.Alloc( objectMemSize );
fh.Read(nonCacheData, objectMemSize, null);
// optionally convert it to 22kHz to save memory
@@ -236,7 +227,7 @@ public void Load() {
// create hardware audio buffers
if (idSoundSystemLocal.useOpenAL) {
- // PCM loads directly
+ // PCM loads directly;
if (objectInfo.wFormatTag == WAVE_FORMAT_TAG_PCM) {
alGetError();
// alGenBuffers(1, openalBuffer);
@@ -248,7 +239,7 @@ public void Load() {
if (AL10.alIsBuffer(openalBuffer)) {
alGetError();
// alBufferData(openalBuffer, objectInfo.nChannels == 1 ? AL_FORMAT_MONO16 : AL_FORMAT_STEREO16, nonCacheData, objectMemSize, objectInfo.nSamplesPerSec);
- AL10.alBufferData(openalBuffer, objectInfo.nChannels == 1 ? AL_FORMAT_MONO16 : AL_FORMAT_STEREO16, nonCacheData, objectInfo.nSamplesPerSec);
+ AL10.alBufferData(openalBuffer, objectInfo.nChannels == 1 ? AL_FORMAT_MONO16 : AL_FORMAT_STEREO16, nonCacheData, (int) objectInfo.nSamplesPerSec);
if (alGetError() != AL_NO_ERROR) {
common.Error("idSoundCache: error loading data into OpenAL hardware buffer");
} else {
@@ -256,7 +247,7 @@ public void Load() {
int blockSize = (int) (512 * objectInfo.nSamplesPerSec / 44100);
// Allocate amplitude data array
- amplitudeData = BufferUtils.createByteBuffer((objectSize / blockSize + 1) * 2);//soundCacheAllocator.Alloc( ( objectSize / blockSize + 1 ) * 2 * sizeof( short) );
+ amplitudeData = BufferUtils.createByteBuffer((objectSize / blockSize + 1) * 2 * Short.BYTES);//soundCacheAllocator.Alloc( ( objectSize / blockSize + 1 ) * 2 * sizeof( short) );
// Creating array of min/max amplitude pairs per blockSize samples
int i;
@@ -281,18 +272,16 @@ public void Load() {
// OGG decompressed at load time (when smaller than s_decompressionLimit seconds, 6 seconds by default)
if (objectInfo.wFormatTag == WAVE_FORMAT_TAG_OGG) {
- if ((MACOS_X && (objectSize < ((int) objectInfo.nSamplesPerSec * idSoundSystemLocal.s_decompressionLimit.GetInteger())))
- || ((alIsExtensionPresent(/*ID_ALCHAR+*/"EAX-RAM")) && (objectSize < ((int) objectInfo.nSamplesPerSec * idSoundSystemLocal.s_decompressionLimit.GetInteger())))) {
+ if ((MACOS_X && (objectSize < (objectInfo.nSamplesPerSec * idSoundSystemLocal.s_decompressionLimit.GetInteger())))
+ || (alIsExtensionPresent("EAX-RAM") && (objectSize < (objectInfo.nSamplesPerSec * idSoundSystemLocal.s_decompressionLimit.GetInteger())))) {
alGetError();
-// alGenBuffers(1, openalBuffer);
openalBuffer = AL10.alGenBuffers();
if (alGetError() != AL_NO_ERROR) {
common.Error("idSoundCache: error generating OpenAL hardware buffer");
}
-// if (alIsBuffer(openalBuffer)) {
if (AL10.alIsBuffer(openalBuffer)) {
idSampleDecoder decoder = idSampleDecoder.Alloc();
- ByteBuffer destData = BufferUtils.createByteBuffer((LengthIn44kHzSamples() + 1) * 4);//soundCacheAllocator.Alloc( ( LengthIn44kHzSamples() + 1 ) * sizeof( float ) );
+ ByteBuffer destData = BufferUtils.createByteBuffer((LengthIn44kHzSamples() + 1) * Float.BYTES);//soundCacheAllocator.Alloc( ( LengthIn44kHzSamples() + 1 ) * sizeof( float ) );
// Decoder *always* outputs 44 kHz data
decoder.Decode(this, 0, LengthIn44kHzSamples(), destData.asFloatBuffer());
@@ -332,7 +321,7 @@ public void Load() {
alGetError();
// alBufferData(openalBuffer, objectInfo.nChannels == 1 ? AL_FORMAT_MONO16 : AL_FORMAT_STEREO16, destData, objectSize * sizeof(short), objectInfo.nSamplesPerSec);
- AL10.alBufferData(openalBuffer, objectInfo.nChannels == 1 ? AL_FORMAT_MONO16 : AL_FORMAT_STEREO16, destData, objectInfo.nSamplesPerSec);
+ AL10.alBufferData(openalBuffer, objectInfo.nChannels == 1 ? AL_FORMAT_MONO16 : AL_FORMAT_STEREO16, destData, (int) objectInfo.nSamplesPerSec);
if (alGetError() != AL_NO_ERROR) {
common.Error("idSoundCache: error loading data into OpenAL hardware buffer");
} else {
@@ -340,7 +329,7 @@ public void Load() {
int blockSize = (int) (512 * objectInfo.nSamplesPerSec / 44100);
// Allocate amplitude data array
- amplitudeData = BufferUtils.createByteBuffer((objectSize / blockSize + 1) * 2);//soundCacheAllocator.Alloc( ( objectSize / blockSize + 1 ) * 2 * sizeof( short ) );
+ amplitudeData = BufferUtils.createByteBuffer((objectSize / blockSize + 1) * 2 * Short.BYTES);//soundCacheAllocator.Alloc( ( objectSize / blockSize + 1 ) * 2 * sizeof( short ) );
// Creating array of min/max amplitude pairs per blockSize samples
int i;
@@ -472,12 +461,12 @@ public boolean FetchFromCache(int offset, final ByteBuffer output, int[] positio
}
if (output != null) {
- int pos = nonCacheData.position();
+ nonCacheData.mark();
nonCacheData.position(offset);
output.put(nonCacheData);
- nonCacheData.position(pos);
+ nonCacheData.reset();
}
if (position != null) {
position[0] = 0;
@@ -526,7 +515,7 @@ public idSoundCache() {
public idSoundSample FindSound(final idStr filename, boolean loadOnDemandOnly) {
idStr fname;
- fname = filename;
+ fname = new idStr(filename);
fname.BackSlashesToSlashes();
fname.ToLower();
diff --git a/src/main/java/neo/Sound/snd_decoder.java b/src/main/java/neo/Sound/snd_decoder.java
index ee913b3b..60db7eab 100644
--- a/src/main/java/neo/Sound/snd_decoder.java
+++ b/src/main/java/neo/Sound/snd_decoder.java
@@ -1,17 +1,28 @@
package neo.Sound;
+import com.jcraft.jorbis.JOrbisException;
+import com.jcraft.jorbis.VorbisFile;
+
import java.nio.ByteBuffer;
import java.nio.FloatBuffer;
import java.util.Arrays;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
import neo.Sound.snd_cache.idSoundSample;
+
import static neo.Sound.snd_local.WAVE_FORMAT_TAG_OGG;
import static neo.Sound.snd_local.WAVE_FORMAT_TAG_PCM;
+
import neo.Sound.snd_local.idSampleDecoder;
+
import static neo.Sound.snd_system.soundSystemLocal;
+
import neo.TempDump.TODO_Exception;
-import static neo.TempDump.sizeof;
import neo.framework.File_h.idFile;
import neo.framework.File_h.idFile_Memory;
+
+import static neo.idlib.math.Simd.SIMDProcessor;
import static neo.sys.sys_public.CRITICAL_SECTION_ONE;
import static neo.sys.win_main.Sys_EnterCriticalSection;
import static neo.sys.win_main.Sys_LeaveCriticalSection;
@@ -124,8 +135,18 @@ static long FS_TellOGG(Object fh) {
ov_openFile
====================
*/
- static int ov_openFile(idFile f, OggVorbis_File vf) {
- throw new TODO_Exception();
+ static VorbisFile ov_openFile(idFile f) throws JOrbisException {
+ ByteBuffer fileBuffer = ByteBuffer.allocate(f.Length());
+// final int curPtr = f.Tell();
+// f.Seek(0, FS_SEEK_SET);
+ f.Read(fileBuffer);
+// System.out.println(Arrays.toString(fileBuffer.array()));
+// f.Seek(curPtr, FS_SEEK_SET);
+// OggPacketReader oggPacketReader = new OggPacketReader(new ByteArrayInputStream(buffer.array()));
+// return new VorbisFile(oggPacketReader);
+// return new VorbisFile(new OggFile(new ByteArrayInputStream(fileBuffer.array())));
+ return new VorbisFile(fileBuffer);
+// throw new TODO_Exception();
// ov_callbacks callbacks;
//
// memset(vf, 0, sizeof(OggVorbis_File));
@@ -146,17 +167,23 @@ static int ov_openFile(idFile f, OggVorbis_File vf) {
*/
public static class idSampleDecoderLocal extends idSampleDecoder {
- private boolean failed; // set if decoding failed
- private int lastFormat; // last format being decoded
- private idSoundSample lastSample; // last sample being decoded
- private int lastSampleOffset; // last offset into the decoded sample
- private int lastDecodeTime; // last time decoding sound
- private idFile_Memory file; // encoded file in memory
+ private boolean failed; // set if decoding failed
+ private int lastFormat; // last format being decoded
+ private idSoundSample lastSample; // last sample being decoded
+ private int lastSampleOffset; // last offset into the decoded sample
+ private int lastDecodeTime; // last time decoding sound
+ private idFile_Memory file; // encoded file in memory
//
- private OggVorbis_File ogg; // OggVorbis file
+ private VorbisFile ogg; // OggVorbis file
//
//
+ idSampleDecoderLocal() {
+ this.file = new idFile_Memory();
+ }
+
+ private static int DBG_Decode = 0;
+
@Override
public void Decode(idSoundSample sample, int sampleOffset44k, int sampleCount44k, FloatBuffer dest) {
int readSamples44k;
@@ -176,23 +203,26 @@ public void Decode(idSoundSample sample, int sampleOffset44k, int sampleCount44k
// samples can be decoded both from the sound thread and the main thread for shakes
Sys_EnterCriticalSection(CRITICAL_SECTION_ONE);
- switch (sample.objectInfo.wFormatTag) {
- case WAVE_FORMAT_TAG_PCM: {
- readSamples44k = DecodePCM(sample, sampleOffset44k, sampleCount44k, dest.array());//TODO:fix with offset
- break;
- }
- case WAVE_FORMAT_TAG_OGG: {
- readSamples44k = DecodeOGG(sample, sampleOffset44k, sampleCount44k, dest.array());
- break;
- }
- default: {
- readSamples44k = 0;
- break;
+ try {
+ switch (sample.objectInfo.wFormatTag) {
+ case WAVE_FORMAT_TAG_PCM: {
+ readSamples44k = DecodePCM(sample, sampleOffset44k, sampleCount44k, dest.array());//TODO:fix with offset
+ break;
+ }
+ case WAVE_FORMAT_TAG_OGG: {
+ DBG_Decode++;
+ readSamples44k = DecodeOGG(sample, sampleOffset44k, sampleCount44k, dest);
+ break;
+ }
+ default: {
+ readSamples44k = 0;
+ break;
+ }
}
+ } finally {
+ Sys_LeaveCriticalSection(CRITICAL_SECTION_ONE);
}
- Sys_LeaveCriticalSection(CRITICAL_SECTION_ONE);
-
if (readSamples44k < sampleCount44k) {
// memset(dest + readSamples44k, 0, (sampleCount44k - readSamples44k) * sizeof(dest[0]));
Arrays.fill(dest.array(), readSamples44k, (sampleCount44k - readSamples44k), 0);
@@ -203,21 +233,23 @@ public void Decode(idSoundSample sample, int sampleOffset44k, int sampleCount44k
public void ClearDecoder() {
Sys_EnterCriticalSection(CRITICAL_SECTION_ONE);
- switch (lastFormat) {
- case WAVE_FORMAT_TAG_PCM: {
- break;
- }
- case WAVE_FORMAT_TAG_OGG: {
+ try {
+ switch (lastFormat) {
+ case WAVE_FORMAT_TAG_PCM: {
+ break;
+ }
+ case WAVE_FORMAT_TAG_OGG: {
// ov_clear(ogg);
// memset(ogg, 0, sizeof(ogg));
- ogg = new OggVorbis_File();
- break;
+ ogg = null;
+ break;
+ }
}
- }
-
- Clear();
- Sys_LeaveCriticalSection(CRITICAL_SECTION_ONE);
+ Clear();
+ } finally {
+ Sys_LeaveCriticalSection(CRITICAL_SECTION_ONE);
+ }
}
@Override
@@ -275,77 +307,73 @@ public int DecodePCM(idSoundSample sample, int sampleOffset44k, int sampleCount4
// return (readSamples << shift);
}
- public int DecodeOGG(idSoundSample sample, int sampleOffset44k, int sampleCount44k, float[] dest) {
- throw new TODO_Exception();
-// int readSamples, totalSamples;
-//
-// int shift = (int) (22050 / sample.objectInfo.nSamplesPerSec);
-// int sampleOffset = sampleOffset44k >> shift;
-// int sampleCount = sampleCount44k >> shift;
-//
-// // open OGG file if not yet opened
-// if (lastSample == null) {
-// // make sure there is enough space for another decoder
+ public int DecodeOGG(idSoundSample sample, int sampleOffset44k, int sampleCount44k, FloatBuffer dest) {
+ int readSamples, totalSamples;
+
+ int shift = (int) (22050 / sample.objectInfo.nSamplesPerSec);
+ int sampleOffset = sampleOffset44k >> shift;
+ int sampleCount = sampleCount44k >> shift;
+
+ // open OGG file if not yet opened
+ if (lastSample == null) {
+ // make sure there is enough space for another decoder
// if (decoderMemoryAllocator.GetFreeBlockMemory() < MIN_OGGVORBIS_MEMORY) {
// return 0;
// }
-// if (sample.nonCacheData == null) {
-// assert (false); // this should never happen
-// failed = true;
-// return 0;
-// }
-// file.SetData( /*const char *)*/sample.nonCacheData, sample.objectMemSize);
-// if (ov_openFile(file, ogg) < 0) {
-// failed = true;
-// return 0;
-// }
-// lastFormat = WAVE_FORMAT_TAG_OGG;
-// lastSample = sample;
-// }
-//
-// // seek to the right offset if necessary
-// if (sampleOffset != lastSampleOffset) {
-// if (ov_pcm_seek(ogg, sampleOffset / sample.objectInfo.nChannels) != 0) {
-// failed = true;
-// return 0;
-// }
-// }
-//
-// lastSampleOffset = sampleOffset;
-//
-// // decode OGG samples
-// totalSamples = sampleCount;
-// readSamples = 0;
-// do {
-// float[] samples = {0};
-// int ret = ov_read_float(ogg, samples, totalSamples / sample.objectInfo.nChannels, ogg.stream);
-// if (ret == 0) {
-// failed = true;
-// break;
-// }
-// if (ret < 0) {
-// failed = true;
-// return 0;
-// }
-// ret *= sample.objectInfo.nChannels;
-//
-// SIMDProcessor.UpSampleOGGTo44kHz(dest + (readSamples << shift), samples, ret, sample.objectInfo.nSamplesPerSec, sample.objectInfo.nChannels);
-//
-// readSamples += ret;
-// totalSamples -= ret;
-// } while (totalSamples > 0);
-//
-// lastSampleOffset += readSamples;
-//
-// return (readSamples << shift);
- }
- };
-// static final idBlockAlloc sampleDecoderAllocator = new idBlockAlloc<>(64);
+ if (sample.nonCacheData == null) {
+ assert (false); // this should never happen
+ failed = true;
+ return 0;
+ }
+ file.SetData(sample.nonCacheData, sample.objectMemSize);
+ try {
+ ogg = ov_openFile(file);
+ } catch (JOrbisException ex) {
+ Logger.getLogger(snd_decoder.class.getName()).log(Level.SEVERE, null, ex);
+ failed = true;
+ return 0;
+ }
+ lastFormat = WAVE_FORMAT_TAG_OGG;
+ lastSample = sample;
+ }
- private static class OggVorbis_File {
+ // seek to the right offset if necessary
+ if (sampleOffset != lastSampleOffset) {
+ if (ogg.pcm_seek((sampleOffset / sample.objectInfo.nChannels)) != 0) {
+ failed = true;
+ return 0;
+ }
+ }
- public OggVorbis_File() {
- throw new TODO_Exception();
+ lastSampleOffset = sampleOffset;
+
+ // decode OGG samples
+ totalSamples = sampleCount;
+ readSamples = 0;
+ do {
+ float[][][] samples = new float[1][][];
+ int ret = ogg.read_float(samples, totalSamples / sample.objectInfo.nChannels);
+ if (ret == 0) {
+ failed = true;
+ break;
+ }
+ if (ret < 0) {
+ failed = true;
+ return 0;
+ }
+
+ ret *= sample.objectInfo.nChannels;
+
+ SIMDProcessor.UpSampleOGGTo44kHz(dest, (readSamples << shift), samples[0], ret, sample.objectInfo.nSamplesPerSec, sample.objectInfo.nChannels);
+ readSamples += ret;
+ totalSamples -= ret;
+ } while (totalSamples > 0);
+
+ lastSampleOffset += readSamples;
+
+ return (readSamples << shift);
}
}
+
+// static final idBlockAlloc sampleDecoderAllocator = new idBlockAlloc<>(64);
}
diff --git a/src/main/java/neo/Sound/snd_efxfile.java b/src/main/java/neo/Sound/snd_efxfile.java
index daccc97b..14e10421 100644
--- a/src/main/java/neo/Sound/snd_efxfile.java
+++ b/src/main/java/neo/Sound/snd_efxfile.java
@@ -1,8 +1,3 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
package neo.Sound;
import java.nio.ByteBuffer;
diff --git a/src/main/java/neo/Sound/snd_emitter.java b/src/main/java/neo/Sound/snd_emitter.java
index 8b09d555..8ba1d1bb 100644
--- a/src/main/java/neo/Sound/snd_emitter.java
+++ b/src/main/java/neo/Sound/snd_emitter.java
@@ -3,12 +3,16 @@
import java.nio.ByteBuffer;
import java.nio.FloatBuffer;
import java.nio.IntBuffer;
+
import neo.Renderer.RenderWorld.idRenderWorld;
import neo.Sound.snd_cache.idSoundSample;
+
import static neo.Sound.snd_local.PRIMARYFREQ;
import static neo.Sound.snd_local.SOUND_DECODER_FREE_DELAY;
import static neo.Sound.snd_local.SOUND_MAX_CHANNELS;
+
import neo.Sound.snd_local.idSampleDecoder;
+
import static neo.Sound.snd_local.soundDemoCommand_t.SCMD_FADE;
import static neo.Sound.snd_local.soundDemoCommand_t.SCMD_FREE;
import static neo.Sound.snd_local.soundDemoCommand_t.SCMD_MODIFY;
@@ -20,25 +24,36 @@
import static neo.Sound.snd_shader.SSF_LOOPING;
import static neo.Sound.snd_shader.SSF_NO_DUPS;
import static neo.Sound.snd_shader.SSF_PLAY_ONCE;
+
import neo.Sound.snd_shader.idSoundShader;
import neo.Sound.snd_shader.soundShaderParms_t;
import neo.Sound.snd_system.idSoundSystemLocal;
+
import static neo.Sound.snd_system.soundSystemLocal;
+
import neo.Sound.snd_world.idSoundWorldLocal;
import neo.Sound.sound.idSoundEmitter;
+
import static neo.TempDump.NOT;
import static neo.TempDump.btoi;
import static neo.TempDump.indexOf;
import static neo.framework.Common.common;
import static neo.framework.DemoFile.demoSystem_t.DS_SOUND;
import static neo.framework.Session.session;
+
import neo.idlib.math.Math_h.idMath;
+
import static neo.idlib.math.Simd.MIXBUFFER_SAMPLES;
+
import neo.idlib.math.Vector.idVec3;
+
import static neo.sys.win_main.Sys_EnterCriticalSection;
import static neo.sys.win_main.Sys_LeaveCriticalSection;
import static neo.sys.win_shared.Sys_Milliseconds;
+import org.lwjgl.BufferUtils;
+
import org.lwjgl.openal.AL10;
+
import static org.lwjgl.openal.AL10.AL_BUFFER;
import static org.lwjgl.openal.AL10.AL_NO_ERROR;
import static org.lwjgl.openal.AL10.AL_PLAYING;
@@ -65,7 +80,7 @@ static class idSoundFade {
public int fadeStart44kHz;
public int fadeEnd44kHz;
- public float fadeStartVolume; // in dB
+ public float fadeStartVolume; // in dB
public float fadeEndVolume; // in dB
//
//
@@ -115,7 +130,7 @@ public SoundFX() {
// memset(continuitySamples, 0, sizeof(float) * 4);
}
-// virtual ~SoundFX() { if ( buffer ) delete buffer; };
+ // virtual ~SoundFX() { if ( buffer ) delete buffer; };
public void Initialize() {
}
@@ -268,7 +283,7 @@ public void ProcessSample(float[] in, int in_offset, float[] out, int out_offset
static class FracTime {
- public int time;
+ public int time;
public float frac;
//
//
@@ -286,25 +301,26 @@ public void Increment(float val) {
}
}
};
-//enum {
- public static final int PLAYBACK_RESET = 0;
+
+ //enum {
+ public static final int PLAYBACK_RESET = 0;
public static final int PLAYBACK_ADVANCING = 1;
//};
static class idSlowChannel {
- boolean active;
+ boolean active;
idSoundChannel chan;
-//
- int playbackState;
- int triggerOffset;
-//
- FracTime newPosition;
+ //
+ int playbackState;
+ int triggerOffset;
+ //
+ FracTime newPosition = new FracTime();
int newSampleOffset;
-//
- FracTime curPosition;
- int curSampleOffset;
-//
+ //
+ FracTime curPosition = new FracTime();
+ int curSampleOffset;
+ //
SoundFX_LowpassFast lowpass;
//
//
@@ -440,33 +456,33 @@ public FracTime GetCurrentPosition() {
static class idSoundChannel {
- public boolean triggerState;
- public int trigger44kHzTime; // hardware time sample the channel started
- public int triggerGame44kHzTime; // game time sample time the channel started
- public soundShaderParms_t parms; // combines the shader parms and the per-channel overrides
- public idSoundSample leadinSample; // if not looped, this is the only sample
+ public boolean triggerState;
+ public int trigger44kHzTime; // hardware time sample the channel started
+ public int triggerGame44kHzTime; // game time sample time the channel started
+ public soundShaderParms_t parms; // combines the shader parms and the per-channel overrides
+ public idSoundSample leadinSample; // if not looped, this is the only sample
public int/*s_channelType*/ triggerChannel;
- public idSoundShader soundShader;
- public idSampleDecoder decoder;
- public float diversity;
- public float lastVolume; // last calculated volume based on distance
- public float[] lastV = new float[6]; // last calculated volume for each speaker, so we can smoothly fade
- public idSoundFade channelFade;
- public boolean triggered;
- public int/*ALuint*/ openalSource;
- public int/*ALuint*/ openalStreamingOffset;
+ public idSoundShader soundShader;
+ public idSampleDecoder decoder;
+ public float diversity;
+ public float lastVolume; // last calculated volume based on distance
+ public float[] lastV = new float[6]; // last calculated volume for each speaker, so we can smoothly fade
+ public idSoundFade channelFade;
+ public boolean triggered;
+ public int/*ALuint*/ openalSource;
+ public int/*ALuint*/ openalStreamingOffset;
public IntBuffer/*ALuint*/ openalStreamingBuffer;
public IntBuffer/*ALuint*/ lastopenalStreamingBuffer;
//
- public boolean disallowSlow;
+ public boolean disallowSlow;
//
//
public idSoundChannel() {
decoder = null;
this.channelFade = new idSoundFade();
- this.openalStreamingBuffer = IntBuffer.allocate(3);
- this.lastopenalStreamingBuffer = IntBuffer.allocate(3);
+ this.openalStreamingBuffer = BufferUtils.createIntBuffer(3);
+ this.lastopenalStreamingBuffer = BufferUtils.createIntBuffer(3);
Clear();
}
// ~idSoundChannel( void );
@@ -533,7 +549,7 @@ public void GatherChannelSamples(int sampleOffset44k, int sampleCount44k, FloatB
len = sampleCount44k;
}
// memset( dest_p, 0, len * sizeof( dest_p[0] ) );
- dest.clear();
+// dest.clear();
dest_p += len;
sampleCount44k -= len;
sampleOffset44k += len;
@@ -543,7 +559,7 @@ public void GatherChannelSamples(int sampleOffset44k, int sampleCount44k, FloatB
idSoundSample leadin = leadinSample;
if (NOT(leadin) || sampleOffset44k < 0 || sampleCount44k <= 0) {
// memset( dest_p, 0, sampleCount44k * sizeof( dest_p[0] ) );
- dest.clear();
+// dest.clear();
return;
}
@@ -564,7 +580,7 @@ public void GatherChannelSamples(int sampleOffset44k, int sampleCount44k, FloatB
// if not looping, zero fill any remaining spots
if (null == soundShader || 0 == (parms.soundShaderFlags & SSF_LOOPING)) {
// memset( dest_p, 0, sampleCount44k * sizeof( dest_p[0] ) );
- dest.clear();
+// dest.clear();
return;
}
@@ -573,7 +589,7 @@ public void GatherChannelSamples(int sampleOffset44k, int sampleCount44k, FloatB
if (null == loop) {
// memset( dest_p, 0, sampleCount44k * sizeof( dest_p[0] ) );
- dest.clear();
+// dest.clear();
return;
}
@@ -627,6 +643,7 @@ public void ALStop() { // free OpenAL resources if any
}
}
};
+
/*
===============================================================================
@@ -635,56 +652,58 @@ public void ALStop() { // free OpenAL resources if any
===============================================================================
*/
// sound channels
- static final int SCHANNEL_ANY = 0; // used in queries and commands to effect every channel at once, in
+ static final int SCHANNEL_ANY = 0; // used in queries and commands to effect every channel at once, in
// startSound to have it not override any other channel
- static final int SCHANNEL_ONE = 1; // any following integer can be used as a channel number
- // typedef int s_channelType; // the game uses its own series of enums, and we don't want to require casts
+ static final int SCHANNEL_ONE = 1; // any following integer can be used as a channel number
+ // typedef int s_channelType; // the game uses its own series of enums, and we don't want to require casts
static class idSoundEmitterLocal extends idSoundEmitter {
- public idSoundWorldLocal soundWorld; // the world that holds this emitter
+ public idSoundWorldLocal soundWorld; // the world that holds this emitter
//
- public int index; // in world emitter list
+ public int index; // in world emitter list
public int/*removeStatus_t*/ removeStatus;
//
- public idVec3 origin;
- public int listenerId;
- public soundShaderParms_t parms; // default overrides for all channels
+ public idVec3 origin;
+ public int listenerId;
+ public soundShaderParms_t parms; // default overrides for all channels
//
//
// the following are calculated in UpdateEmitter, and don't need to be archived
- public float maxDistance; // greatest of all playing channel distances
- public int lastValidPortalArea; // so an emitter that slides out of the world continues playing
- public boolean playing; // if false, no channel is active
- public boolean hasShakes;
- public idVec3 spatializedOrigin; // the virtual sound origin, either the real sound origin,
- // // or a point through a portal chain
- public float realDistance; // in meters
- public float distance; // in meters, this may be the straight-line distance, or
- // // it may go through a chain of portals. If there
- // // is not an open-portal path, distance will be > maxDistance
- //
- // a single soundEmitter can have many channels playing from the same point
- public idSoundChannel[] channels = new idSoundChannel[SOUND_MAX_CHANNELS];
- //
- public idSlowChannel[] slowChannels = new idSlowChannel[SOUND_MAX_CHANNELS];
+ public float maxDistance; // greatest of all playing channel distances
+ public int lastValidPortalArea; // so an emitter that slides out of the world continues playing
+ public boolean playing; // if false, no channel is active
+ public boolean hasShakes;
+ public idVec3 spatializedOrigin; // the virtual sound origin, either the real sound origin,
+ // // or a point through a portal chain
+ public float realDistance; // in meters
+ public float distance; // in meters, this may be the straight-line distance, or
+ public idSoundChannel[] channels;
+ public idSlowChannel[] slowChannels;
//
// this is just used for feedback to the game or rendering system:
// flashing lights and screen shakes. Because the material expression
// evaluation doesn't do common subexpression removal, we cache the
// last generated value
- public int ampTime;
+ public int ampTime;
public float amplitude;
//
//
public idSoundEmitterLocal() {
soundWorld = null;
+ this.origin = new idVec3();
this.spatializedOrigin = new idVec3();
+ this.channels = new idSoundChannel[SOUND_MAX_CHANNELS];
for (int c = 0; c < channels.length; c++) {
channels[c] = new idSoundChannel();
}
+
+ this.slowChannels = new idSlowChannel[SOUND_MAX_CHANNELS];
+ for (int s = 0; s < slowChannels.length; s++) {
+ slowChannels[s] = new idSlowChannel();
+ }
Clear();
}
//----------------------------------------------
@@ -906,9 +925,9 @@ public int StartSound(final idSoundShader shader, final int channel, float diver
chan = channels[i];
if (shader.leadins[choice] != null) {
- chan.leadinSample = shader.leadins[ choice];
+ chan.leadinSample = shader.leadins[choice];
} else {
- chan.leadinSample = shader.entries[ choice];
+ chan.leadinSample = shader.entries[choice];
}
// if the sample is onDemand (voice mails, etc), load it now
@@ -1263,7 +1282,7 @@ public void CheckForCompletion(int current44kHzTime) {
if (idSoundSystemLocal.useOpenAL && alIsSource(chan.openalSource)) {
// alGetSourcei(chan.openalSource, AL_SOURCE_STATE, state);
- AL10.alGetSourcei(chan.openalSource, AL_SOURCE_STATE);
+ state = AL10.alGetSourcei(chan.openalSource, AL_SOURCE_STATE);
}
idSlowChannel slow = GetSlowChannel(chan);
diff --git a/src/main/java/neo/Sound/snd_local.java b/src/main/java/neo/Sound/snd_local.java
index 877662cc..de99becd 100644
--- a/src/main/java/neo/Sound/snd_local.java
+++ b/src/main/java/neo/Sound/snd_local.java
@@ -4,6 +4,7 @@
import java.nio.FloatBuffer;
import neo.Sound.snd_cache.idSoundSample;
import neo.Sound.snd_decoder.idSampleDecoderLocal;
+import neo.TempDump.SERiAL;
import neo.TempDump.TODO_Exception;
import static neo.framework.UsercmdGen.USERCMD_MSEC;
import static neo.idlib.math.Simd.MIXBUFFER_SAMPLES;
@@ -64,13 +65,27 @@ static class waveformatex_s {
private static final int SIZE_B = SIZE / Byte.SIZE;
//byte offsets
- private static final int/*word*/ wFormatTag = 0; // format type
- private static final int/*word*/ nChannels = wFormatTag + (Short.SIZE / Byte.SIZE); // number of channels (i.e. mono, stereo...)
- private static final int/*dword*/ nSamplesPerSec = nChannels + (Integer.SIZE / Byte.SIZE); // sample rate
- private static final int/*dword*/ nAvgBytesPerSec = nSamplesPerSec + (Integer.SIZE / Byte.SIZE);// for buffer estimation
- private static final int/*word*/ nBlockAlign = nAvgBytesPerSec + (Short.SIZE / Byte.SIZE); // block size of data
- private static final int/*word*/ wBitsPerSample = nBlockAlign + (Short.SIZE / Byte.SIZE); // Number of bits per sample of mono data
- private static final int/*word*/ cbSize = wBitsPerSample + (Short.SIZE / Byte.SIZE); // The count in bytes of the size of extra information (after cbSize)
+ public int wFormatTag; // format type
+ public int nChannels; // number of channels (i.e. mono, stereo...)
+ public int nSamplesPerSec; // sample rate
+ public int nAvgBytesPerSec; // for buffer estimation
+ public int nBlockAlign; // block size of data
+ public int wBitsPerSample; // Number of bits per sample of mono data
+ public int cbSize; // The count in bytes of the size of extra information (after cbSize)
+
+ waveformatex_s() {
+ }
+
+ waveformatex_s(waveformatex_s mpwfx) {
+ this.wFormatTag = mpwfx.wFormatTag;
+ this.nChannels = mpwfx.nChannels;
+ this.nSamplesPerSec = mpwfx.nSamplesPerSec;
+ this.nAvgBytesPerSec = mpwfx.nAvgBytesPerSec;
+ this.nBlockAlign = mpwfx.nBlockAlign;
+ this.wBitsPerSample = mpwfx.wBitsPerSample;
+ this.cbSize = mpwfx.cbSize;
+ }
+
};
@@ -86,11 +101,11 @@ static class waveformat_s {
private static final int SIZE_B = SIZE / Byte.SIZE;
//offsets
- private static final int/*word*/ wFormatTag = 0; // format type
- private static final int/*word*/ nChannels = Short.SIZE / Byte.SIZE; // number of channels (i.e. mono, stereo, etc.)
- private static final int/*dword*/ nSamplesPerSec = nChannels + Short.SIZE / Byte.SIZE; // sample rate
- private static final int/*dword*/ nAvgBytesPerSec = nSamplesPerSec + Integer.SIZE / Byte.SIZE; // for buffer estimation
- private static final int/*word*/ nBlockAlign = nAvgBytesPerSec + Integer.SIZE / Byte.SIZE; // block size of data
+ public int/*word*/ wFormatTag; // format type
+ public int/*word*/ nChannels; // number of channels (i.e. mono, stereo, etc.)
+ public int/*dword*/nSamplesPerSec; // sample rate
+ public int/*dword*/nAvgBytesPerSec; // for buffer estimation
+ public int/*word*/ nBlockAlign; // block size of data
};
@@ -101,72 +116,37 @@ static class waveformat_s {
// };
/* specific waveform format structure for PCM data */
- static class pcmwaveformat_s {
+ static class pcmwaveformat_s implements SERiAL{
private static final int SIZE
= waveformat_s.SIZE
+ Short.SIZE;
static final int SIZE_B = SIZE / Byte.SIZE;
- private waveformat_s wf;
- private static final int/*word*/ wBitsPerSample = waveformat_s.SIZE_B;
- //
- final ByteBuffer buffer = ByteBuffer.allocate(SIZE_B);
- //
- //
+ public waveformat_s wf;
+ public int/*word*/ wBitsPerSample;
- public int getwBitsPerSample() {
- return buffer.getShort(wBitsPerSample) & 0xFFFF;
+ @Override
+ public ByteBuffer AllocBuffer() {
+ return ByteBuffer.allocate(SIZE_B);
}
- public void setwBitsPerSample(int wBitsPerSample) {
- buffer.putShort(wBitsPerSample, (short) wBitsPerSample);
- }
- //
- //
- //
- //
+ @Override
+ public void Read(ByteBuffer buffer) {
+ this.wf = new waveformat_s();
+ this.wf.wFormatTag = buffer.getShort();
+ this.wf.nChannels = buffer.getShort();
+ this.wf.nSamplesPerSec = buffer.getInt();
+ this.wf.nAvgBytesPerSec = buffer.getInt();
+ this.wf.nBlockAlign = buffer.getShort();
- public int getWf_wFormatTag() {
- return buffer.getShort(waveformat_s.wFormatTag) & 0xFFFF;
+ this.wBitsPerSample = buffer.getShort();
}
- public void setWf_wFormatTag(int wFormatTag) {
- buffer.putShort(waveformat_s.wFormatTag, (short) wFormatTag);
+ @Override
+ public ByteBuffer Write() {
+ throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
-
- public int getWf_nChannels() {
- return buffer.getShort(waveformat_s.nChannels) & 0xFFFF;
- }
-
- public void setWf_nChannels(int nChannels) {
- buffer.putShort(waveformat_s.nChannels, (short) nChannels);
- }
-
- public long getWf_nSamplesPerSec() {
- return buffer.getInt(waveformat_s.nSamplesPerSec) & 0xFFFF_FFFFL;
- }
-
- public void setWf_nSamplesPerSec(long nSamplesPerSec) {
- buffer.putInt(waveformat_s.nSamplesPerSec, (int) nSamplesPerSec);
- }
-
- public long getWf_nAvgBytesPerSec() {
- return buffer.getInt(waveformat_s.nAvgBytesPerSec) & 0xFFFF_FFFFL;
- }
-
- public void setWf_nAvgBytesPerSec(long nAvgBytesPerSec) {
- buffer.putInt(waveformat_s.nAvgBytesPerSec, (int) nAvgBytesPerSec);
- }
-
- public int getWf_nBlockAlign() {
- return buffer.getShort(waveformat_s.nBlockAlign) & 0xFFFF;
- }
-
- public void setWf_nBlockAlign(int nBlockAlign) {
- buffer.putShort(waveformat_s.nBlockAlign, (short) nBlockAlign);
- }
-
};
// #ifndef mmioFOURCC
@@ -184,168 +164,70 @@ static class waveformatextensible_s {
+ Integer.SIZE;
private static final int SIZE_B = SIZE / Byte.SIZE;
-// waveformatex_s Format;
-// // union {
- private static final int/*word*/ wValidBitsPerSample = waveformatex_s.SIZE_B;// bits of precision
-// int/*word*/ wSamplesPerBlock; // valid if wBitsPerSample==0
-// int/*word*/ wReserved; // If neither applies, set to zero
-// // } Samples;
- private static final int/*dword*/ dwChannelMask = wValidBitsPerSample + (Short.SIZE / Byte.SIZE);// which channels are */
-// // present in stream */
- private static final int SubFormat = dwChannelMask + (Integer.SIZE / Byte.SIZE);
- //
- final ByteBuffer buffer = ByteBuffer.allocate(SIZE_B);
- //
- //
-
- public int getwValidBitsPerSample() {
- return buffer.getShort(this.wValidBitsPerSample) & 0xFFFF;
- }
-
- public void setwValidBitsPerSample(int wValidBitsPerSample) {
- buffer.putShort(this.wValidBitsPerSample, (short) wValidBitsPerSample);
- }
-
- public int getwSamplesPerBlock() {
- return getwValidBitsPerSample();
- }
-
- public void setwSamplesPerBlock(int wSamplesPerBlock) {
- this.setwValidBitsPerSample(wSamplesPerBlock);
- }
-
- public int getwReserved() {
- return getwValidBitsPerSample();
- }
-
- public void setwReserved(int wReserved) {
- this.setwValidBitsPerSample(wReserved);
- }
- //
- //
-
- public long getDwChannelMask() {
- return buffer.getInt(this.dwChannelMask) & 0xFFFF_FFFFL;
- }
-
- public void setDwChannelMask(long dwChannelMask) {
- buffer.putInt(this.dwChannelMask, (int) dwChannelMask);
- }
-
- public int getSubFormat() {
- return buffer.getInt(this.SubFormat);
- }
-
- public void setSubFormat(int SubFormat) {
- buffer.putInt(this.SubFormat, SubFormat);
- }
- //
- //
- //
- //
-
- public int getFormat_wFormatTag() {
- return buffer.getShort(waveformatex_s.wFormatTag) & 0xFFFF;
- }
-
- public void setFormat_wFormatTag(int wFormatTag) {
- buffer.putInt(waveformatex_s.wFormatTag, wFormatTag);
- }
-
- public int getFormat_nChannels() {
- return buffer.getShort(waveformatex_s.nChannels) & 0xFFFF;
- }
-
- public void setFormat_nChannels(int nChannels) {
- buffer.putInt(waveformatex_s.nChannels, nChannels);
- }
-
- public long getFormat_nSamplesPerSec() {
- return buffer.getInt(waveformatex_s.nSamplesPerSec) & 0xFFFF_FFFFL;
- }
-
- public void setFormat_nSamplesPerSec(long nSamplesPerSec) {
- buffer.putInt(waveformatex_s.nSamplesPerSec, (int) nSamplesPerSec);
- }
-
- public long getFormat_nAvgBytesPerSec() {
- return buffer.getInt(waveformatex_s.nAvgBytesPerSec) & 0xFFFF_FFFFL;
- }
-
- public void setFormat_nAvgBytesPerSec(long nAvgBytesPerSec) {
- buffer.putInt(waveformatex_s.nAvgBytesPerSec, (int) nAvgBytesPerSec);
- }
-
- public int getFormat_nBlockAlign() {
- return buffer.getShort(waveformatex_s.nBlockAlign) & 0xFFFF;
- }
-
- public void setFormat_nBlockAlign(int nBlockAlign) {
- buffer.putInt(waveformatex_s.nBlockAlign, nBlockAlign);
- }
-
- public int getFormat_wBitsPerSample() {
- return buffer.getShort(waveformatex_s.wBitsPerSample) & 0xFFFF;
- }
-
- public void setFormat_wBitsPerSample(int wBitsPerSample) {
- buffer.putInt(waveformatex_s.wBitsPerSample, wBitsPerSample);
- }
-
- public int getFormat_CbSize() {
- return buffer.getShort(waveformatex_s.cbSize) & 0xFFFF;
- }
-
- public void setFormat_CbSize(int cbSize) {
- buffer.putInt(waveformatex_s.cbSize, cbSize);
+ public waveformatex_s Format;
+// union {
+// word wValidBitsPerSample; /* bits of precision */
+// word wSamplesPerBlock; /* valid if wBitsPerSample==0*/
+// word wReserved; /* If neither applies, set to zero*/
+// } Samples;
+ public int/*word*/ Samples;
+ public int/*dword*/ dwChannelMask; // which channels are */
+// // present in stream */
+ public int SubFormat;
+
+ waveformatextensible_s(){
+ this.Format = new waveformatex_s();
+ }
+
+ waveformatextensible_s(pcmwaveformat_s pcmWaveFormat) {
+ this();
+ this.Format.wFormatTag = pcmWaveFormat.wf.wFormatTag;
+ this.Format.nChannels = pcmWaveFormat.wf.nChannels;
+ this.Format.nSamplesPerSec = pcmWaveFormat.wf.nSamplesPerSec;
+ this.Format.nAvgBytesPerSec = pcmWaveFormat.wf.nAvgBytesPerSec;
+ this.Format.nBlockAlign = pcmWaveFormat.wf.nBlockAlign;
+ this.Format.wBitsPerSample = pcmWaveFormat.wBitsPerSample;
}
};
// typedef dword fourcc;
/* RIFF chunk information data structure */
- static class mminfo_s {
-
- //offsets
- private static final int/*fourcc*/ ckid = 0; // chunk ID
- private static final int/*dword*/ cksize = Integer.SIZE / Byte.SIZE; // chunk size
- private static final int/*fourcc*/ fccType = cksize * 2; // form type or list type
- private static final int/*dword*/ dwDataOffset = cksize * 3; // offset of data portion of chunk
- //
- final ByteBuffer buffer = ByteBuffer.allocate(Integer.SIZE * 4 / Byte.SIZE);
- //
- //
-
- public long getCkid() {
- return buffer.getInt(ckid) & 0xFFFF_FFFFL;
- }
-
- public void setCkid(long ckid) {
- buffer.putInt(this.ckid, (int) ckid);
- }
+ static class mminfo_s implements SERiAL{
+ private static final int SIZE
+ = Integer.SIZE
+ + Integer.SIZE
+ + Integer.SIZE
+ + Integer.SIZE;
+ private static final int SIZE_B = SIZE / Byte.SIZE;
- public long getCksize() {
- return buffer.getInt(cksize) & 0xFFFF_FFFFL;
- }
+ int/*fourcc*/ckid; // chunk ID
+ int/*dword*/ cksize; // chunk size
+ int/*fourcc*/fccType; // form type or list type
+ int/*dword*/ dwDataOffset; // offset of data portion of chunk
- public void setCksize(long cksize) {
- buffer.putInt(this.cksize, (int) cksize);
+ @Override
+ public ByteBuffer AllocBuffer() {
+ return ByteBuffer.allocate(SIZE_B);
}
- public long getFccType() {
- return buffer.getInt(fccType) & 0xFFFF_FFFFL;
- }
+ @Override
+ public void Read(ByteBuffer buffer) {
+ this.ckid = buffer.getInt();
+ this.cksize = buffer.getInt();
- public void setFccType(long fccType) {
- buffer.putInt(this.fccType, (int) fccType);
- }
+ if (buffer.hasRemaining()) {
+ this.fccType = buffer.getInt();
+ }
- public long getDwDataOffset() {
- return buffer.getInt(dwDataOffset) & 0xFFFF_FFFFL;
+ if (buffer.hasRemaining()) {
+ this.dwDataOffset = buffer.getInt();
+ }
}
- public void setDwDataOffset(long dwDataOffset) {
- buffer.putInt(this.dwDataOffset, (int) dwDataOffset);
+ @Override
+ public ByteBuffer Write() {
+ throw new UnsupportedOperationException("Not supported yet.");
}
};
diff --git a/src/main/java/neo/Sound/snd_shader.java b/src/main/java/neo/Sound/snd_shader.java
index 7eb8e1ee..c8566c7b 100644
--- a/src/main/java/neo/Sound/snd_shader.java
+++ b/src/main/java/neo/Sound/snd_shader.java
@@ -317,7 +317,7 @@ else if (0 == token.Icmp("minSamples")) {
} // description
else if (0 == token.Icmp("description")) {
src.ReadTokenOnLine(token);
- desc = token;
+ desc.oSet(token);
} // mindistance
else if (0 == token.Icmp("mindistance")) {
parms.minDistance = src.ParseFloat();
@@ -436,7 +436,7 @@ else if (0 == token.Icmp("leadin")) {
token.BackSlashesToSlashes();
idStr lang = new idStr(cvarSystem.GetCVarString("sys_lang"));
if (lang.Icmp("english") != 0 && token.Find("sound/vo/", false) >= 0) {
- idStr work = token;
+ idStr work = new idStr(token);
work.ToLower();
work.StripLeading("sound/vo/");
work.oSet(va("sound/vo/%s/%s", lang.toString(), work.toString()));
diff --git a/src/main/java/neo/Sound/snd_system.java b/src/main/java/neo/Sound/snd_system.java
index 49848fe5..c52d4f54 100644
--- a/src/main/java/neo/Sound/snd_system.java
+++ b/src/main/java/neo/Sound/snd_system.java
@@ -7,7 +7,6 @@
import neo.Renderer.RenderWorld.idRenderWorld;
import neo.Sound.snd_cache.idSoundCache;
import neo.Sound.snd_cache.idSoundSample;
-import neo.Sound.snd_cache.waveformatex_s;
import neo.Sound.snd_efxfile.idEFXFile;
import neo.Sound.snd_emitter.SoundFX;
import neo.Sound.snd_emitter.SoundFX_Comb;
@@ -21,6 +20,7 @@
import static neo.Sound.snd_local.WAVE_FORMAT_TAG_OGG;
import neo.Sound.snd_local.idAudioHardware;
import neo.Sound.snd_local.idSampleDecoder;
+import neo.Sound.snd_local.waveformatex_s;
import static neo.Sound.snd_shader.SSF_LOOPING;
import neo.Sound.snd_world.idSoundWorldLocal;
import neo.Sound.snd_world.s_stats;
@@ -144,14 +144,14 @@ public static class idSoundSystemLocal extends neo.Sound.sound.idSoundSystem {
public ALCcontext openalContext;
public int/*ALsizei*/ openalSourceCount;
public openalSource_t[] openalSources = new openalSource_t[256];
- public boolean alEAXSet;
- public boolean alEAXGet;
- public boolean alEAXSetBufferMode;
- public boolean alEAXGetBufferMode;
+// public boolean alEAXSet;
+// public boolean alEAXGet;
+// public boolean alEAXSetBufferMode;
+// public boolean alEAXGetBufferMode;
public idEFXFile EFXDatabase = new idEFXFile();
public boolean efxloaded;
// latches
- public static boolean useOpenAL = false;
+ public static boolean useOpenAL;
public static boolean useEAXReverb = false;
// mark available during initialization, or through an explicit test
public static int EAXAvailable = -1;
@@ -210,8 +210,8 @@ public static class idSoundSystemLocal extends neo.Sound.sound.idSoundSystem {
if (ID_OPENAL) {//TODO: turn on the rest of our openAL extensions.
// off by default. OpenAL DLL gets loaded on-demand. EDIT: not anymore.
s_libOpenAL = new idCVar("s_libOpenAL", "openal32.dll", CVAR_SOUND | CVAR_ARCHIVE, "OpenAL DLL name/path");
- s_useOpenAL = new idCVar("s_useOpenAL", "0", CVAR_SOUND | CVAR_BOOL | CVAR_ARCHIVE, "use OpenAL");
- s_useEAXReverb = new idCVar("s_useEAXReverb", "0", CVAR_SOUND | CVAR_BOOL | CVAR_ARCHIVE, "use EAX reverb");
+ s_useOpenAL = new idCVar("s_useOpenAL", "1", CVAR_SOUND | CVAR_BOOL | CVAR_ARCHIVE, "use OpenAL");
+ s_useEAXReverb = new idCVar("s_useEAXReverb", "1", CVAR_SOUND | CVAR_BOOL | CVAR_ARCHIVE, "use EAX reverb");
s_muteEAXReverb = new idCVar("s_muteEAXReverb", "0", CVAR_SOUND | CVAR_BOOL, "mute eax reverb");
s_decompressionLimit = new idCVar("s_decompressionLimit", "6", CVAR_SOUND | CVAR_INTEGER | CVAR_ARCHIVE, "specifies maximum uncompressed sample length in seconds");
} else {
@@ -292,26 +292,26 @@ public void Init() {
// try to obtain EAX extensions
if (idSoundSystemLocal.s_useEAXReverb.GetBool() && alIsExtensionPresent(/*ID_ALCHAR*/"EAX4.0")) {
idSoundSystemLocal.s_useOpenAL.SetBool(true); // EAX presence causes AL enable
- alEAXSet = true;//(EAXSet) alGetProcAddress(/*ID_ALCHAR*/"EAXSet");
- alEAXGet = true;//(EAXGet) alGetProcAddress(/*ID_ALCHAR*/"EAXGet");
+// alEAXSet = true;//(EAXSet) alGetProcAddress(/*ID_ALCHAR*/"EAXSet");
+// alEAXGet = true;//(EAXGet) alGetProcAddress(/*ID_ALCHAR*/"EAXGet");
common.Printf("OpenAL: found EAX 4.0 extension\n");
} else {
common.Printf("OpenAL: EAX 4.0 extension not found\n");
idSoundSystemLocal.s_useEAXReverb.SetBool(false);
- alEAXSet = false;//(EAXSet) null;
- alEAXGet = false;//(EAXGet) null;
+// alEAXSet = false;//(EAXSet) null;
+// alEAXGet = false;//(EAXGet) null;
}
// try to obtain EAX-RAM extension - not required for operation
- if (alIsExtensionPresent(/*ID_ALCHAR*/"EAX-RAM")) {
- alEAXSetBufferMode = true;//(EAXSetBufferMode) alGetProcAddress(/*ID_ALCHAR*/"EAXSetBufferMode");
- alEAXGetBufferMode = true;//(EAXGetBufferMode) alGetProcAddress(/*ID_ALCHAR*/"EAXGetBufferMode");
- common.Printf("OpenAL: found EAX-RAM extension, %dkB\\%dkB\n", alGetInteger(alGetEnumValue(/*ID_ALCHAR*/"AL_EAX_RAM_FREE")) / 1024, alGetInteger(alGetEnumValue(/*ID_ALCHAR*/"AL_EAX_RAM_SIZE")) / 1024);
- } else {
- alEAXSetBufferMode = false;//(EAXSetBufferMode) null;
- alEAXGetBufferMode = false;//(EAXGetBufferMode) null;
- common.Printf("OpenAL: no EAX-RAM extension\n");
- }
+// if (alIsExtensionPresent(/*ID_ALCHAR*/"EAX-RAM")) {
+// alEAXSetBufferMode = true;//(EAXSetBufferMode) alGetProcAddress(/*ID_ALCHAR*/"EAXSetBufferMode");
+// alEAXGetBufferMode = true;//(EAXGetBufferMode) alGetProcAddress(/*ID_ALCHAR*/"EAXGetBufferMode");
+// common.Printf("OpenAL: found EAX-RAM extension, %dkB\\%dkB\n", alGetInteger(alGetEnumValue(/*ID_ALCHAR*/"AL_EAX_RAM_FREE")) / 1024, alGetInteger(alGetEnumValue(/*ID_ALCHAR*/"AL_EAX_RAM_SIZE")) / 1024);
+// } else {
+// alEAXSetBufferMode = false;//(EAXSetBufferMode) null;
+// alEAXGetBufferMode = false;//(EAXGetBufferMode) null;
+// common.Printf("OpenAL: no EAX-RAM extension\n");
+// }
if (!idSoundSystemLocal.s_useOpenAL.GetBool()) {
common.Printf("OpenAL: disabling ( no EAX ). Using legacy mixer.\n");
@@ -530,7 +530,7 @@ public int AsyncUpdate(int time) {
// If not using openal, get actual playback position from sound hardware
if (useOpenAL) {
// here we do it in samples ( overflows in 27 hours or so )
- dwCurrentWritePos = idMath.Ftol((float) Sys_Milliseconds() * 44.1f) % (MIXBUFFER_SAMPLES * ROOM_SLICES_IN_BUFFER);
+ dwCurrentWritePos = idMath.Ftol(Sys_Milliseconds() * 44.1f) % (MIXBUFFER_SAMPLES * ROOM_SLICES_IN_BUFFER);
dwCurrentBlock = (int) (dwCurrentWritePos / MIXBUFFER_SAMPLES);
} else {
// and here in bytes
@@ -1067,7 +1067,7 @@ public int GetCurrent44kHzTime() {
} else {
// NOTE: this would overflow 31bits within about 1h20 ( not that important since we get a snd_audio_hw right away pbly )
//return ( ( Sys_Milliseconds()*441 ) / 10 ) * 4;
- return idMath.FtoiFast((float) Sys_Milliseconds() * 176.4f);
+ return idMath.FtoiFast(Sys_Milliseconds() * 176.4f);
}
}
diff --git a/src/main/java/neo/Sound/snd_wavefile.java b/src/main/java/neo/Sound/snd_wavefile.java
index 123cf1b9..912a0302 100644
--- a/src/main/java/neo/Sound/snd_wavefile.java
+++ b/src/main/java/neo/Sound/snd_wavefile.java
@@ -1,17 +1,30 @@
package neo.Sound;
+import com.jcraft.jorbis.Info;
+import com.jcraft.jorbis.JOrbisException;
+import com.jcraft.jorbis.VorbisFile;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
import java.nio.ByteBuffer;
-import neo.Sound.snd_cache.waveformatex_s;
+import static neo.Sound.snd_local.WAVE_FORMAT_TAG_OGG;
import static neo.Sound.snd_local.WAVE_FORMAT_TAG_PCM;
import neo.Sound.snd_local.mminfo_s;
import neo.Sound.snd_local.pcmwaveformat_s;
+import neo.Sound.snd_local.waveformatex_s;
import neo.Sound.snd_local.waveformatextensible_s;
+import static neo.Sound.snd_system.idSoundSystemLocal.s_realTimeDecoding;
import neo.TempDump.TODO_Exception;
+import static neo.TempDump.stobb;
import static neo.framework.FileSystem_h.fileSystem;
import neo.framework.File_h.idFile;
import static neo.idlib.Lib.LittleLong;
+import static neo.idlib.Lib.LittleRevBytes;
import static neo.idlib.Lib.LittleShort;
import neo.idlib.Text.Str.idStr;
+import static neo.idlib.math.Simd.SIMDProcessor;
+import static neo.sys.sys_public.CRITICAL_SECTION_ONE;
+import static neo.sys.win_main.Sys_EnterCriticalSection;
+import static neo.sys.win_main.Sys_LeaveCriticalSection;
/**
*
@@ -47,8 +60,8 @@ public static class idWaveFile {
private long/*ID_TIME_T*/ mfileTime;
//
private boolean mbIsReadingFromMemory;
- private short[] mpbData;
- private short[] mpbDataCur;
+ private ByteBuffer mpbData;
+ private ByteBuffer mpbDataCur;
private long/*dword*/ mulDataSize;
//
private Object ogg; // only !NULL when !s_realTimeDecoding
@@ -79,7 +92,7 @@ public idWaveFile() {
// Name: idWaveFile::Open()
// Desc: Opens a wave file for reading
//-----------------------------------------------------------------------------
- public int Open(final String strFileName, waveformatex_s pwfx /*= NULL*/) {
+ public int Open(final String strFileName, waveformatex_s[] pwfx /*= NULL*/) {
mbIsReadingFromMemory = false;
@@ -124,10 +137,10 @@ public int Open(final String strFileName, waveformatex_s pwfx /*= NULL*/) {
}
// After the reset, the size of the wav file is mck.cksize so store it now
- mdwSize = mck.getCksize() / 2;//sizeof(short);
- mMemSize = mck.getCksize();
+ mdwSize = mck.cksize / 2;//sizeof(short);
+ mMemSize = mck.cksize;
- if (mck.getCksize() != 0xffffffff) {
+ if (mck.cksize != 0xffffffff) {
if (pwfx != null) {
// pwfx = mpwfx;//memcpy(pwfx, (waveformatex_t *) & mpwfx, sizeof(waveformatex_t));
throw new TODO_Exception();
@@ -144,8 +157,8 @@ public int Open(final String strFileName, waveformatex_s pwfx /*= NULL*/) {
public int OpenFromMemory(short[] pbData, int ulDataSize, waveformatextensible_s pwfx) {
mpwfx = pwfx;
mulDataSize = ulDataSize;
- mpbData = pbData;
- mpbDataCur = mpbData;
+ mpbData = stobb(pbData);
+ mpbDataCur = mpbData.duplicate();
mdwSize = ulDataSize / 2;//sizeof(short);
mMemSize = ulDataSize;
mbIsReadingFromMemory = true;
@@ -162,50 +175,50 @@ public int OpenFromMemory(short[] pbData, int ulDataSize, waveformatextensible_s
// Reset() is called.
//-----------------------------------------------------------------------------
public int Read(ByteBuffer pBuffer, int dwSizeToRead, int[] pdwSizeRead) {
- throw new TODO_Exception();
-//
-// if (ogg != null) {
-//
-// return ReadOGG(pBuffer.array(), dwSizeToRead, pdwSizeRead);
-//
-// } else if (mbIsReadingFromMemory) {
-//
-// if (mpbDataCur == null) {
-// return -1;
-// }
-// if ((byte[]) (mpbDataCur + dwSizeToRead) > (byte[]) (mpbData + mulDataSize)) {
-// dwSizeToRead = mulDataSize - (int) (mpbDataCur - mpbData);
-// }
-// SIMDProcessor.Memcpy(pBuffer, mpbDataCur, dwSizeToRead);
-// mpbDataCur += dwSizeToRead;
-//
-// if (pdwSizeRead != null) {
-// pdwSizeRead[0] = dwSizeToRead;
-// }
-//
-// return dwSizeToRead;
-//
-// } else {
-//
-// if (mhmmio == null) {
-// return -1;
-// }
-// if (pBuffer == null) {
-// return -1;
-// }
-//
-// dwSizeToRead = mhmmio.Read(pBuffer, dwSizeToRead);
-// // this is hit by ogg code, which does it's own byte swapping internally
-// if (!isOgg) {
-// LittleRevBytes(pBuffer, 2, dwSizeToRead / 2);
-// }
-//
-// if (pdwSizeRead != null) {
-// pdwSizeRead[0] = dwSizeToRead;
-// }
-//
-// return dwSizeToRead;
-// }
+
+ if (ogg != null) {
+
+ return ReadOGG(pBuffer.array(), dwSizeToRead, pdwSizeRead);
+
+ } else if (mbIsReadingFromMemory) {
+
+ if (mpbDataCur == null) {
+ return -1;
+ }
+ final int pos = dwSizeToRead + mpbDataCur.position();//add current offset
+ if (mpbDataCur.get(dwSizeToRead) > mpbData.get((int) mulDataSize)) {
+ dwSizeToRead = (int) (mulDataSize - mpbDataCur.position());
+ }
+ SIMDProcessor.Memcpy(pBuffer, mpbDataCur, dwSizeToRead);
+ mpbDataCur.position(pos);
+
+ if (pdwSizeRead != null) {
+ pdwSizeRead[0] = dwSizeToRead;
+ }
+
+ return dwSizeToRead;
+
+ } else {
+
+ if (mhmmio == null) {
+ return -1;
+ }
+ if (pBuffer == null) {
+ return -1;
+ }
+
+ dwSizeToRead = mhmmio.Read(pBuffer, dwSizeToRead);
+ // this is hit by ogg code, which does it's own byte swapping internally
+ if (!isOgg) {
+ LittleRevBytes(pBuffer.array(), 2, dwSizeToRead / 2);
+ }
+
+ if (pdwSizeRead != null) {
+ pdwSizeRead[0] = dwSizeToRead;
+ }
+
+ return dwSizeToRead;
+ }
}
public int Seek(int offset) {
@@ -306,55 +319,55 @@ private int ReadMMIO() {
mpwfx = new waveformatextensible_s();//memset( &mpwfx, 0, sizeof( waveformatextensible_t ) );
- mhmmio.Read(mckRiff.buffer, 12);
+ mhmmio.Read(mckRiff, 12);
assert (!isOgg);
- mckRiff.setCkid(LittleLong(mckRiff.getCkid()));
- mckRiff.setCksize(LittleLong(mckRiff.getCksize()));
- mckRiff.setFccType(LittleLong(mckRiff.getFccType()));
- mckRiff.setDwDataOffset(12);
+ mckRiff.ckid = LittleLong(mckRiff.ckid);
+ mckRiff.cksize = LittleLong(mckRiff.cksize);
+ mckRiff.fccType = LittleLong(mckRiff.fccType);
+ mckRiff.dwDataOffset = 12;
// Check to make sure this is a valid wave file
- if ((mckRiff.getCkid() != fourcc_riff) || (mckRiff.getFccType() != mmioFOURCC('W', 'A', 'V', 'E'))) {
+ if ((mckRiff.ckid != fourcc_riff) || (mckRiff.fccType != mmioFOURCC('W', 'A', 'V', 'E'))) {
return -1;
}
// Search the input file for for the 'fmt ' chunk.
- ckIn.setDwDataOffset(12);
+ ckIn.dwDataOffset = 12;
do {
- if (8 != mhmmio.Read(ckIn.buffer, 8)) {
+ if (8 != mhmmio.Read(ckIn, 8)) {
return -1;
}
assert (!isOgg);
- ckIn.setCkid(LittleLong(ckIn.getCkid()));
- ckIn.setCksize(LittleLong(ckIn.getCksize()));
- ckIn.setDwDataOffset(ckIn.getDwDataOffset() + ckIn.getCksize() - 8);
- } while (ckIn.getCkid() != mmioFOURCC('f', 'm', 't', ' '));
+ ckIn.ckid = LittleLong(ckIn.ckid);
+ ckIn.cksize = LittleLong(ckIn.cksize);
+ ckIn.dwDataOffset += ckIn.cksize - 8;
+ } while (ckIn.ckid != mmioFOURCC('f', 'm', 't', ' '));
// Expect the 'fmt' chunk to be at least as large as ;
// if there are extra parameters at the end, we'll ignore them
- if (ckIn.getCksize() < pcmwaveformat_s.SIZE_B) {
+ if (ckIn.cksize < pcmwaveformat_s.SIZE_B) {
return -1;
}
// Read the 'fmt ' chunk into .
- if (mhmmio.Read(pcmWaveFormat.buffer, pcmwaveformat_s.SIZE_B) != pcmwaveformat_s.SIZE_B) {
+ if (mhmmio.Read(pcmWaveFormat) != pcmwaveformat_s.SIZE_B) {
return -1;
}
assert (!isOgg);
- pcmWaveFormat.setWf_wFormatTag(LittleShort((short) pcmWaveFormat.getWf_wFormatTag()));
- pcmWaveFormat.setWf_nChannels(LittleShort((short) pcmWaveFormat.getWf_nChannels()));
- pcmWaveFormat.setWf_nSamplesPerSec(LittleLong((int) pcmWaveFormat.getWf_nSamplesPerSec()));
- pcmWaveFormat.setWf_nAvgBytesPerSec(LittleLong((int) pcmWaveFormat.getWf_nAvgBytesPerSec()));
- pcmWaveFormat.setWf_nBlockAlign(LittleShort((short) pcmWaveFormat.getWf_nBlockAlign()));
- pcmWaveFormat.setwBitsPerSample(LittleShort((short) pcmWaveFormat.getwBitsPerSample()));
+ pcmWaveFormat.wf.wFormatTag = LittleShort((short) pcmWaveFormat.wf.wFormatTag);
+ pcmWaveFormat.wf.nChannels = LittleShort((short) pcmWaveFormat.wf.nChannels);
+ pcmWaveFormat.wf.nSamplesPerSec = LittleLong(pcmWaveFormat.wf.nSamplesPerSec);
+ pcmWaveFormat.wf.nAvgBytesPerSec = LittleLong(pcmWaveFormat.wf.nAvgBytesPerSec);
+ pcmWaveFormat.wf.nBlockAlign = LittleShort((short) pcmWaveFormat.wf.nBlockAlign);
+ pcmWaveFormat.wBitsPerSample = LittleShort((short) pcmWaveFormat.wBitsPerSample);
// Copy the bytes from the pcm structure to the waveformatex_t structure
- System.arraycopy(pcmWaveFormat.buffer.array(), 0, mpwfx.buffer, 0, pcmwaveformat_s.SIZE_B);
+ mpwfx = new waveformatextensible_s(pcmWaveFormat);
// Allocate the waveformatex_t, but if its not pcm format, read the next
// word, and thats how many extra bytes to allocate.
- if (pcmWaveFormat.getWf_wFormatTag() == WAVE_FORMAT_TAG_PCM) {
- mpwfx.setFormat_CbSize(0);
+ if (pcmWaveFormat.wf.wFormatTag == WAVE_FORMAT_TAG_PCM) {
+ mpwfx.Format.cbSize = 0;
} else {
return -1; // we don't handle these (32 bit wavefiles, etc)
// #if 0
@@ -375,65 +388,57 @@ private int ReadMMIO() {
return 0;
}
- private int OpenOGG(final String strFileName, waveformatex_s pwfx /*= NULL*/) {
- throw new TODO_Exception();
-// OggVorbis_File ov;
-//
+ private int OpenOGG(final String strFileName, waveformatex_s[] pwfx /*= NULL*/) {
// memset(pwfx, 0, sizeof(waveformatex_t));
-//
-// mhmmio = fileSystem.OpenFileRead(strFileName);
-// if (null == mhmmio) {
-// return -1;
-// }
-//
-// Sys_EnterCriticalSection(CRITICAL_SECTION_ONE);
-//
-// ov = new OggVorbis_File();
-//
-// if (ov_openFile(mhmmio, ov) < 0) {
-//// delete ov;
-// Sys_LeaveCriticalSection(CRITICAL_SECTION_ONE);
-// fileSystem.CloseFile(mhmmio);
-// mhmmio = null;
-// return -1;
-// }
-//
-// mfileTime = mhmmio.Timestamp();
-//
-// vorbis_info vi = ov_info(ov, -1);
-//
-// mpwfx.Format.nSamplesPerSec = vi.rate;
-// mpwfx.Format.nChannels = vi.channels;
-// mpwfx.Format.wBitsPerSample = sizeof(short) * 8;
-// mdwSize = ov_pcm_total(ov, -1) * vi.channels; // pcm samples * num channels
-// mbIsReadingFromMemory = false;
-//
-// if (idSoundSystemLocal.s_realTimeDecoding.GetBool()) {
-//
-// ov_clear(ov);
-// fileSystem.CloseFile(mhmmio);
-// mhmmio = null;
-//// delete ov;
-//
-// mpwfx.Format.wFormatTag = WAVE_FORMAT_TAG_OGG;
-// mhmmio = fileSystem.OpenFileRead(strFileName);
-// mMemSize = mhmmio.Length();
-//
-// } else {
-//
-// ogg = ov;
-//
-// mpwfx.Format.wFormatTag = WAVE_FORMAT_TAG_PCM;
-// mMemSize = mdwSize * sizeof(short);
-// }
-//
-// memcpy(pwfx, mpwfx, sizeof(waveformatex_t));
-//
-// Sys_LeaveCriticalSection(CRITICAL_SECTION_ONE);
-//
-// isOgg = true;
-//
-// return 0;
+ mhmmio = fileSystem.OpenFileRead(strFileName);
+ if (null == mhmmio) {
+ return -1;
+ }
+
+ Sys_EnterCriticalSection(CRITICAL_SECTION_ONE);
+
+ ByteBuffer buffer = ByteBuffer.allocate(mhmmio.Length());
+ mhmmio.Read(buffer);
+ try (VorbisFile ov = new VorbisFile(buffer)) {
+ mfileTime = mhmmio.Timestamp();
+
+ Info vi = ov.getInfo()[0];
+
+ mpwfx.Format.nSamplesPerSec = vi.rate;
+ mpwfx.Format.nChannels = vi.channels;
+ mpwfx.Format.wBitsPerSample = Short.SIZE;
+ mdwSize = ov.pcm_total(-1) * vi.channels; // pcm samples * num channels
+ mbIsReadingFromMemory = false;
+
+ if (s_realTimeDecoding.GetBool()) {
+ fileSystem.CloseFile(mhmmio);
+ mhmmio = null;
+
+ mpwfx.Format.wFormatTag = WAVE_FORMAT_TAG_OGG;
+ mhmmio = fileSystem.OpenFileRead(strFileName);
+ mMemSize = mhmmio.Length();
+
+ } else {
+ ogg = ov;
+
+ mpwfx.Format.wFormatTag = WAVE_FORMAT_TAG_PCM;
+ mMemSize = mdwSize * Short.SIZE / Byte.SIZE;
+ }
+
+ if (pwfx != null) {
+ pwfx[0] = new waveformatex_s(mpwfx.Format);
+ }
+ } catch (JOrbisException | IOException ex) {
+ fileSystem.CloseFile(mhmmio);
+ mhmmio = null;
+ return -1;
+ } finally {
+ Sys_LeaveCriticalSection(CRITICAL_SECTION_ONE);
+ }
+
+ isOgg = true;
+
+ return 0;
}
private int ReadOGG(byte[] pBuffer, int dwSizeToRead, int[] pdwSizeRead) {
diff --git a/src/main/java/neo/Sound/snd_world.java b/src/main/java/neo/Sound/snd_world.java
index 2ae93bae..ef055251 100644
--- a/src/main/java/neo/Sound/snd_world.java
+++ b/src/main/java/neo/Sound/snd_world.java
@@ -1,24 +1,43 @@
package neo.Sound;
import static java.lang.Math.atan;
+
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.FloatBuffer;
+import java.nio.IntBuffer;
import java.nio.ShortBuffer;
+import java.nio.channels.FileChannel;
+import java.nio.file.Paths;
+import java.nio.file.StandardOpenOption;
+
import neo.Renderer.Cinematic.idSndWindow;
import neo.Renderer.Material.idMaterial;
import neo.Renderer.Material.shaderStage_t;
import neo.Renderer.RenderWorld.exitPortal_t;
import neo.Renderer.RenderWorld.idRenderWorld;
+
import static neo.Renderer.RenderWorld.portalConnection_t.PS_BLOCK_AIR;
import static neo.Renderer.RenderWorld.portalConnection_t.PS_BLOCK_VIEW;
+
+import neo.Sound.snd_cache.idSoundSample;
+
import static neo.Sound.snd_emitter.REMOVE_STATUS_ALIVE;
import static neo.Sound.snd_emitter.REMOVE_STATUS_SAMPLEFINISHED;
+
+import neo.Sound.snd_emitter.idSlowChannel;
import neo.Sound.snd_emitter.idSoundChannel;
import neo.Sound.snd_emitter.idSoundEmitterLocal;
import neo.Sound.snd_emitter.idSoundFade;
+
+import static neo.Sound.snd_local.SND_EPSILON;
import static neo.Sound.snd_local.SOUND_MAX_CHANNELS;
+
import neo.Sound.snd_local.idSampleDecoder;
import neo.Sound.snd_local.soundDemoCommand_t;
+
import static neo.Sound.snd_local.soundDemoCommand_t.SCMD_ALLOC_EMITTER;
import static neo.Sound.snd_local.soundDemoCommand_t.SCMD_FADE;
import static neo.Sound.snd_local.soundDemoCommand_t.SCMD_FREE;
@@ -30,49 +49,105 @@
import static neo.Sound.snd_local.soundDemoCommand_t.SCMD_UPDATE;
import static neo.Sound.snd_shader.DOOM_TO_METERS;
import static neo.Sound.snd_shader.SOUND_MAX_CLASSES;
+import static neo.Sound.snd_shader.SSF_ANTI_PRIVATE_SOUND;
import static neo.Sound.snd_shader.SSF_GLOBAL;
import static neo.Sound.snd_shader.SSF_LOOPING;
import static neo.Sound.snd_shader.SSF_NO_FLICKER;
+import static neo.Sound.snd_shader.SSF_NO_OCCLUSION;
+import static neo.Sound.snd_shader.SSF_OMNIDIRECTIONAL;
+import static neo.Sound.snd_shader.SSF_PRIVATE_SOUND;
+import static neo.Sound.snd_shader.SSF_UNCLAMPED;
+
import neo.Sound.snd_shader.idSoundShader;
import neo.Sound.snd_shader.soundShaderParms_t;
import neo.Sound.snd_system.idSoundSystemLocal;
+
import static neo.Sound.snd_system.idSoundSystemLocal.s_showLevelMeter;
import static neo.Sound.snd_system.soundSystemLocal;
import static neo.Sound.sound.SCHANNEL_ANY;
import static neo.Sound.sound.SCHANNEL_ONE;
+
import neo.Sound.sound.idSoundEmitter;
import neo.Sound.sound.idSoundWorld;
+
import static neo.TempDump.NOT;
+
import neo.TempDump.TODO_Exception;
+
import static neo.TempDump.etoi;
import static neo.TempDump.isNotNullOrEmpty;
+import static neo.framework.BuildDefines.MACOS_X;
import static neo.framework.Common.common;
import static neo.framework.DeclManager.declManager;
import static neo.framework.DemoFile.demoSystem_t.DS_SOUND;
+
import neo.framework.DemoFile.idDemoFile;
+
import static neo.framework.FileSystem_h.fileSystem;
+
import neo.framework.File_h.idFile;
+
import static neo.framework.Session.session;
+
import neo.idlib.BV.Bounds.idBounds;
+
import static neo.idlib.Lib.colorRed;
+
import neo.idlib.Text.Str.idStr;
+
import static neo.idlib.Text.Str.va;
+
import neo.idlib.containers.List.idList;
+
import static neo.idlib.math.Math_h.DEG2RAD;
+
import neo.idlib.math.Math_h.idMath;
import neo.idlib.math.Matrix.idMat3;
import neo.idlib.math.Plane.idPlane;
import neo.idlib.math.Random.idRandom;
+
import static neo.idlib.math.Simd.MIXBUFFER_SAMPLES;
+import static neo.idlib.math.Simd.SIMDProcessor;
+
import neo.idlib.math.Vector.idVec3;
import neo.idlib.math.Vector.idVec4;
+
import static neo.sys.win_main.Sys_EnterCriticalSection;
import static neo.sys.win_main.Sys_LeaveCriticalSection;
+
+import org.lwjgl.BufferUtils;
+import org.lwjgl.openal.AL10;
+
+import static org.lwjgl.openal.AL10.AL_BUFFER;
+import static org.lwjgl.openal.AL10.AL_BUFFERS_PROCESSED;
+import static org.lwjgl.openal.AL10.AL_FALSE;
+import static org.lwjgl.openal.AL10.AL_FORMAT_MONO16;
+import static org.lwjgl.openal.AL10.AL_FORMAT_STEREO16;
import static org.lwjgl.openal.AL10.AL_GAIN;
+import static org.lwjgl.openal.AL10.AL_INVALID_NAME;
+import static org.lwjgl.openal.AL10.AL_LOOPING;
+import static org.lwjgl.openal.AL10.AL_MAX_DISTANCE;
import static org.lwjgl.openal.AL10.AL_ORIENTATION;
+import static org.lwjgl.openal.AL10.AL_PITCH;
import static org.lwjgl.openal.AL10.AL_POSITION;
+import static org.lwjgl.openal.AL10.AL_REFERENCE_DISTANCE;
+import static org.lwjgl.openal.AL10.AL_SOURCE_RELATIVE;
+import static org.lwjgl.openal.AL10.AL_TRUE;
+import static org.lwjgl.openal.AL10.alBufferData;
+import static org.lwjgl.openal.AL10.alDeleteBuffers;
+import static org.lwjgl.openal.AL10.alGenBuffers;
+import static org.lwjgl.openal.AL10.alGetSourcei;
+import static org.lwjgl.openal.AL10.alIsSource;
+import static org.lwjgl.openal.AL10.alListener;
import static org.lwjgl.openal.AL10.alListener3f;
import static org.lwjgl.openal.AL10.alListenerf;
+import static org.lwjgl.openal.AL10.alSource3f;
+import static org.lwjgl.openal.AL10.alSourcePlay;
+import static org.lwjgl.openal.AL10.alSourceQueueBuffers;
+import static org.lwjgl.openal.AL10.alSourceStop;
+import static org.lwjgl.openal.AL10.alSourceUnqueueBuffers;
+import static org.lwjgl.openal.AL10.alSourcef;
+import static org.lwjgl.openal.AL10.alSourcei;
/**
*
@@ -96,13 +171,17 @@ public s_stats() {
missedUpdateWindow = 0;
activeSounds = 0;
}
- };
+ }
+
+ ;
static class soundPortalTrace_s {
- int portalArea;
+ int portalArea;
soundPortalTrace_s prevStack;
- };
+ }
+
+ ;
public static class idSoundWorldLocal extends idSoundWorld {
@@ -303,14 +382,14 @@ public void PlaceListener(final idVec3 origin, final idMat3 axis, final int list
listenerPrivateId = listenerId;
- listenerQU = origin; // Doom units
- listenerPos = origin.oMultiply(DOOM_TO_METERS); // meters
+ listenerQU = origin; // Doom units
+ listenerPos = origin.oMultiply(DOOM_TO_METERS); // meters
listenerAxis = axis;
listenerAreaName = areaName;
listenerAreaName.ToLower();
if (rw != null) {
- listenerArea = rw.PointInArea(listenerQU); // where are we?
+ listenerArea = rw.PointInArea(listenerQU); // where are we?
} else {
listenerArea = 0;
}
@@ -336,7 +415,7 @@ public void FadeSoundClasses(final int soundClass, final float to, final float o
common.Error("idSoundWorldLocal::FadeSoundClasses: bad soundClass %d", soundClass);
}
- idSoundFade fade = soundClassFade[ soundClass];
+ idSoundFade fade = soundClassFade[soundClass];
int length44kHz = soundSystemLocal.MillisecondsToSamples((int) (over * 1000));
@@ -532,6 +611,7 @@ public void ProcessDemoCommand(idDemoFile readDemo) {
break;
}
}
+
// background music
/*
===============
@@ -542,7 +622,7 @@ public void ProcessDemoCommand(idDemoFile readDemo) {
this is called from the main thread
===============
*/
- private static idRandom rnd;
+ private static final idRandom rnd = new idRandom();
@Override
public void PlayShaderDirectly(final String shaderName, int channel /*= -1*/) {
@@ -784,7 +864,7 @@ public void WriteToSaveGame(idFile savefile) {
// write the channel data
for (j = 0; j < SOUND_MAX_CHANNELS; j++) {
- idSoundChannel chan = def.channels[ j];
+ idSoundChannel chan = def.channels[j];
// Write out any sound commands for this def
if (chan.triggerState && chan.soundShader != null && chan.leadinSample != null) {
@@ -863,7 +943,7 @@ public void ReadFromSaveGame(idFile savefile) {
def = emitters.oGet(i);
def.removeStatus = REMOVE_STATUS_ALIVE;
- def.playing = true; // may be reset by the first UpdateListener
+ def.playing = true; // may be reset by the first UpdateListener
savefile.ReadVec3(def.origin);
def.listenerId = savefile.ReadInt();
@@ -1219,7 +1299,7 @@ public void OffsetSoundTime(int offset44kHz) {
continue;
}
for (j = 0; j < SOUND_MAX_CHANNELS; j++) {
- idSoundChannel chan = emitters.oGet(i).channels[ j];
+ idSoundChannel chan = emitters.oGet(i).channels[j];
if (!chan.triggerState) {
continue;
@@ -1280,12 +1360,12 @@ public idSoundEmitterLocal AllocLocalSoundEmitter() {
===============
*/
private static final idVec3[] speakerVector = {
- new idVec3(0.707f, 0.707f, 0.0f), // front left
- new idVec3(0.707f, -0.707f, 0.0f), // front right
- new idVec3(0.707f, 0.0f, 0.0f), // front center
- new idVec3(0.0f, 0.0f, 0.0f), // sub
- new idVec3(-0.707f, 0.707f, 0.0f), // rear left
- new idVec3(-0.707f, -0.707f, 0.0f) // rear right
+ new idVec3(0.707f, 0.707f, 0.0f), // front left
+ new idVec3(0.707f, -0.707f, 0.0f), // front right
+ new idVec3(0.707f, 0.0f, 0.0f), // front center
+ new idVec3(0.0f, 0.0f, 0.0f), // sub
+ new idVec3(-0.707f, 0.707f, 0.0f), // rear left
+ new idVec3(-0.707f, -0.707f, 0.0f) // rear right
};
public void CalcEars(int numSpeakers, idVec3 spatializedOrigin, idVec3 listenerPos, idMat3 listenerAxis, float[] ears/*[6]*/, float spatialize) {
@@ -1297,7 +1377,7 @@ public void CalcEars(int numSpeakers, idVec3 spatializedOrigin, idVec3 listenerP
if (numSpeakers == 6) {
for (int i = 0; i < 6; i++) {
if (i == 3) {
- ears[i] = idSoundSystemLocal.s_subFraction.GetFloat(); // subwoofer
+ ears[i] = idSoundSystemLocal.s_subFraction.GetFloat(); // subwoofer
continue;
}
float dot = ovec.oMultiply(speakerVector[i]);
@@ -1338,349 +1418,358 @@ public void CalcEars(int numSpeakers, idVec3 spatializedOrigin, idVec3 listenerP
Mixes MIXBUFFER_SAMPLES samples starting at current44kHz sample time into
finalMixBuffer
===============
- */
+ */private static int DBG_AddChannelContribution = 0;
+
public void AddChannelContribution(idSoundEmitterLocal sound, idSoundChannel chan, int current44kHz, int numSpeakers, float[] finalMixBuffer) {
- throw new TODO_Exception();
-// int j;
-// float volume;
-//
-// //
-// // get the sound definition and parameters from the entity
-// //
-// soundShaderParms_t parms = chan.parms;
-//
-// // assume we have a sound triggered on this channel
-// assert (chan.triggerState);
-//
-// // fetch the actual wave file and see if it's valid
-// idSoundSample sample = chan.leadinSample;
-// if (sample == null) {
-// return;
-// }
-//
-// // if you don't want to hear all the beeps from missing sounds
-// if (sample.defaultSound && !idSoundSystemLocal.s_playDefaultSound.GetBool()) {
-// return;
-// }
-//
-// // get the actual shader
-// final idSoundShader shader = chan.soundShader;
-//
-// // this might happen if the foreground thread just deleted the sound emitter
-// if (null == shader) {
-// return;
-// }
-//
-// float maxd = parms.maxDistance;
-// float mind = parms.minDistance;
-//
-// int mask = shader.speakerMask;
-// boolean omni = (parms.soundShaderFlags & SSF_OMNIDIRECTIONAL) != 0;
-// boolean looping = (parms.soundShaderFlags & SSF_LOOPING) != 0;
-// boolean global = (parms.soundShaderFlags & SSF_GLOBAL) != 0;
-// boolean noOcclusion = ((parms.soundShaderFlags & SSF_NO_OCCLUSION) != 0) || !idSoundSystemLocal.s_useOcclusion.GetBool();
-//
-// // speed goes from 1 to 0.2
-// if (idSoundSystemLocal.s_slowAttenuate.GetBool() && slowmoActive && !chan.disallowSlow) {
-// maxd *= slowmoSpeed;
-// }
-//
-// // stereo samples are always omni
-// if (sample.objectInfo.nChannels == 2) {
-// omni = true;
-// }
-//
-// // if the sound is playing from the current listener, it will not be spatialized at all
-// if (sound.listenerId == listenerPrivateId) {
-// global = true;
-// }
-//
-// //
-// // see if it's in range
-// //
-// // convert volumes from decibels to float scale
-// // leadin volume scale for shattering lights
-// // this isn't exactly correct, because the modified volume will get applied to
-// // some initial chunk of the loop as well, because the volume is scaled for the
-// // entire mix buffer
-// if (shader.leadinVolume != 0 && current44kHz - chan.trigger44kHzTime < sample.LengthIn44kHzSamples()) {
-// volume = soundSystemLocal.dB2Scale(shader.leadinVolume);
-// } else {
-// volume = soundSystemLocal.dB2Scale(parms.volume);
-// }
-//
-// // global volume scale
-// volume *= soundSystemLocal.dB2Scale(idSoundSystemLocal.s_volume.GetFloat());
-//
-// // volume fading
-// float fadeDb = chan.channelFade.FadeDbAt44kHz(current44kHz);
-// volume *= soundSystemLocal.dB2Scale(fadeDb);
-//
-// fadeDb = soundClassFade[parms.soundClass].FadeDbAt44kHz(current44kHz);
-// volume *= soundSystemLocal.dB2Scale(fadeDb);
-//
-// //
-// // if it's a global sound then
-// // it's not affected by distance or occlusion
-// //
-// float spatialize = 1;
-// idVec3 spatializedOriginInMeters = new idVec3();
-// if (!global) {
-// float dlen;
-//
-// if (noOcclusion) {
-// // use the real origin and distance
-// spatializedOriginInMeters = sound.origin.oMultiply(DOOM_TO_METERS);
-// dlen = sound.realDistance;
-// } else {
-// // use the possibly portal-occluded origin and distance
-// spatializedOriginInMeters = sound.spatializedOrigin.oMultiply(DOOM_TO_METERS);
-// dlen = sound.distance;
-// }
-//
-// // reduce volume based on distance
-// if (dlen >= maxd) {
-// volume = 0.0f;
-// } else if (dlen > mind) {
-// float frac = idMath.ClampFloat(0.0f, 1.0f, 1.0f - ((dlen - mind) / (maxd - mind)));
-// if (idSoundSystemLocal.s_quadraticFalloff.GetBool()) {
-// frac *= frac;
-// }
-// volume *= frac;
-// } else if (mind > 0.0f) {
-// // we tweak the spatialization bias when you are inside the minDistance
-// spatialize = dlen / mind;
-// }
-// }
-//
-// //
-// // if it is a private sound, set the volume to zero
-// // unless we match the listenerId
-// //
-// if ((parms.soundShaderFlags & SSF_PRIVATE_SOUND) != 0) {
-// if (sound.listenerId != listenerPrivateId) {
-// volume = 0;
-// }
-// }
-// if ((parms.soundShaderFlags & SSF_ANTI_PRIVATE_SOUND) != 0) {
-// if (sound.listenerId == listenerPrivateId) {
-// volume = 0;
-// }
-// }
-//
-// //
-// // do we have anything to add?
-// //
-// if (volume < SND_EPSILON && chan.lastVolume < SND_EPSILON) {
-// return;
-// }
-// chan.lastVolume = volume;
-//
-// //
-// // fetch the sound from the cache as 44kHz, 16 bit samples
-// //
-// int offset = current44kHz - chan.trigger44kHzTime;
-//// float[] inputSamples = new float[MIXBUFFER_SAMPLES * 2 + 16];
-//// float[] alignedInputSamples = (float[]) ((((int) inputSamples) + 15) & ~15);
-// float[] alignedInputSamples = new float[MIXBUFFER_SAMPLES * 2 + 16];
-//
-// //
-// // allocate and initialize hardware source
-// //
-// if (idSoundSystemLocal.useOpenAL && sound.removeStatus < REMOVE_STATUS_SAMPLEFINISHED) {
-// if (!alIsSource(chan.openalSource)) {
-// chan.openalSource = soundSystemLocal.AllocOpenALSource(chan, !chan.leadinSample.hardwareBuffer || !chan.soundShader.entries[0].hardwareBuffer || looping, chan.leadinSample.objectInfo.nChannels == 2);
-// }
-//
-// if (alIsSource(chan.openalSource)) {
-//
-// // stop source if needed..
-// if (chan.triggered) {
-// alSourceStop(chan.openalSource);
-// }
-//
-// // update source parameters
-// if (global || omni) {
-// alSourcei(chan.openalSource, AL_SOURCE_RELATIVE, AL_TRUE);
-// alSource3f(chan.openalSource, AL_POSITION, 0.0f, 0.0f, 0.0f);
-// alSourcef(chan.openalSource, AL_GAIN, (volume) < (1.0f) ? (volume) : (1.0f));
-// } else {
-// alSourcei(chan.openalSource, AL_SOURCE_RELATIVE, AL_FALSE);
-// alSource3f(chan.openalSource, AL_POSITION, -spatializedOriginInMeters.y, spatializedOriginInMeters.z, -spatializedOriginInMeters.x);
-// alSourcef(chan.openalSource, AL_GAIN, (volume) < (1.0f) ? (volume) : (1.0f));
-// }
-// alSourcei(chan.openalSource, AL_LOOPING, (looping && chan.soundShader.entries[0].hardwareBuffer) ? AL_TRUE : AL_FALSE);
-// if (!MACOS_X) {
-// alSourcef(chan.openalSource, AL_REFERENCE_DISTANCE, mind);
-// alSourcef(chan.openalSource, AL_MAX_DISTANCE, maxd);
-// }
-// alSourcef(chan.openalSource, AL_PITCH, (slowmoActive && !chan.disallowSlow) ? (slowmoSpeed) : (1.0f));
+ int j;
+ float volume;
+
+ //
+ // get the sound definition and parameters from the entity
+ //
+ soundShaderParms_t parms = chan.parms;
+
+ // assume we have a sound triggered on this channel
+ assert (chan.triggerState);
+
+ // fetch the actual wave file and see if it's valid
+ idSoundSample sample = chan.leadinSample;
+ if (sample == null) {
+ return;
+ }
+
+ // if you don't want to hear all the beeps from missing sounds
+ if (sample.defaultSound && !idSoundSystemLocal.s_playDefaultSound.GetBool()) {
+ return;
+ }
+
+ // get the actual shader
+ final idSoundShader shader = chan.soundShader;
+
+ // this might happen if the foreground thread just deleted the sound emitter
+ if (null == shader) {
+ return;
+ }
+
+ float maxD = parms.maxDistance;
+ float minD = parms.minDistance;
+
+ int mask = shader.speakerMask;
+ boolean omni = (parms.soundShaderFlags & SSF_OMNIDIRECTIONAL) != 0;
+ boolean looping = (parms.soundShaderFlags & SSF_LOOPING) != 0;
+ boolean global = (parms.soundShaderFlags & SSF_GLOBAL) != 0;
+ boolean noOcclusion = ((parms.soundShaderFlags & SSF_NO_OCCLUSION) != 0) || !idSoundSystemLocal.s_useOcclusion.GetBool();
+
+ // speed goes from 1 to 0.2
+ if (idSoundSystemLocal.s_slowAttenuate.GetBool() && slowmoActive && !chan.disallowSlow) {
+ maxD *= slowmoSpeed;
+ }
+
+ // stereo samples are always omni
+ if (sample.objectInfo.nChannels == 2) {
+ omni = true;
+ }
+
+ // if the sound is playing from the current listener, it will not be spatialized at all
+ if (sound.listenerId == listenerPrivateId) {
+ global = true;
+ }
+
+ //
+ // see if it's in range
+ //
+ // convert volumes from decibels to float scale
+ // leadin volume scale for shattering lights
+ // this isn't exactly correct, because the modified volume will get applied to
+ // some initial chunk of the loop as well, because the volume is scaled for the
+ // entire mix buffer
+ if (shader.leadinVolume != 0 && current44kHz - chan.trigger44kHzTime < sample.LengthIn44kHzSamples()) {
+ volume = soundSystemLocal.dB2Scale(shader.leadinVolume);
+ } else {
+ volume = soundSystemLocal.dB2Scale(parms.volume);
+ }
+
+ // global volume scale
+ volume *= soundSystemLocal.dB2Scale(idSoundSystemLocal.s_volume.GetFloat());
+
+ // volume fading
+ float fadeDb = chan.channelFade.FadeDbAt44kHz(current44kHz);
+ volume *= soundSystemLocal.dB2Scale(fadeDb);
+
+ fadeDb = soundClassFade[parms.soundClass].FadeDbAt44kHz(current44kHz);
+ volume *= soundSystemLocal.dB2Scale(fadeDb);
+
+ //
+ // if it's a global sound then
+ // it's not affected by distance or occlusion
+ //
+ float spatialize = 1;
+ idVec3 spatializedOriginInMeters = new idVec3();
+ if (!global) {
+ float dlen;
+
+ if (noOcclusion) {
+ // use the real origin and distance
+ spatializedOriginInMeters = sound.origin.oMultiply(DOOM_TO_METERS);
+ dlen = sound.realDistance;
+ } else {
+ // use the possibly portal-occluded origin and distance
+ spatializedOriginInMeters = sound.spatializedOrigin.oMultiply(DOOM_TO_METERS);
+ dlen = sound.distance;
+ }
+
+ // reduce volume based on distance
+ if (dlen >= maxD) {
+ volume = 0.0f;
+ } else if (dlen > minD) {
+ float frac = idMath.ClampFloat(0.0f, 1.0f, 1.0f - ((dlen - minD) / (maxD - minD)));
+ if (idSoundSystemLocal.s_quadraticFalloff.GetBool()) {
+ frac *= frac;
+ }
+ volume *= frac;
+ } else if (minD > 0.0f) {
+ // we tweak the spatialization bias when you are inside the minDistance
+ spatialize = dlen / minD;
+ }
+ }
+
+ //
+ // if it is a private sound, set the volume to zero
+ // unless we match the listenerId
+ //
+ if ((parms.soundShaderFlags & SSF_PRIVATE_SOUND) != 0) {
+ if (sound.listenerId != listenerPrivateId) {
+ volume = 0;
+ }
+ }
+ if ((parms.soundShaderFlags & SSF_ANTI_PRIVATE_SOUND) != 0) {
+ if (sound.listenerId == listenerPrivateId) {
+ volume = 0;
+ }
+ }
+
+ //
+ // do we have anything to add?
+ //
+ if (volume < SND_EPSILON && chan.lastVolume < SND_EPSILON) {
+ return;
+ }
+ chan.lastVolume = volume;
+
+ //
+ // fetch the sound from the cache as 44kHz, 16 bit samples
+ //
+ int offset = current44kHz - chan.trigger44kHzTime;
+// float[] inputSamples = new float[MIXBUFFER_SAMPLES * 2 + 16];
+// float[] alignedInputSamples = (float[]) ((((int) inputSamples) + 15) & ~15);
+ float[] alignedInputSamples = new float[MIXBUFFER_SAMPLES * 2 + 16];
+
+ //
+ // allocate and initialize hardware source
+ //
+ if (idSoundSystemLocal.useOpenAL && sound.removeStatus < REMOVE_STATUS_SAMPLEFINISHED) {
+ if (!alIsSource(chan.openalSource)) {
+ chan.openalSource = soundSystemLocal.AllocOpenALSource(chan, !chan.leadinSample.hardwareBuffer || !chan.soundShader.entries[0].hardwareBuffer || looping, chan.leadinSample.objectInfo.nChannels == 2);
+ }
+
+ if (alIsSource(chan.openalSource)) {
+
+ // stop source if needed..
+ if (chan.triggered) {
+ alSourceStop(chan.openalSource);
+ }
+
+ // update source parameters
+ if (global || omni) {
+ alSourcei(chan.openalSource, AL_SOURCE_RELATIVE, AL_TRUE);
+ alSource3f(chan.openalSource, AL_POSITION, 0.0f, 0.0f, 0.0f);
+ alSourcef(chan.openalSource, AL_GAIN, (volume) < (1.0f) ? (volume) : (1.0f));
+ } else {
+ alSourcei(chan.openalSource, AL_SOURCE_RELATIVE, AL_FALSE);
+ alSource3f(chan.openalSource, AL_POSITION, -spatializedOriginInMeters.y, spatializedOriginInMeters.z, -spatializedOriginInMeters.x);
+ alSourcef(chan.openalSource, AL_GAIN, (volume) < (1.0f) ? (volume) : (1.0f));
+ }
+ alSourcei(chan.openalSource, AL_LOOPING, (looping && chan.soundShader.entries[0].hardwareBuffer) ? AL_TRUE : AL_FALSE);
+ if (!MACOS_X) {
+ alSourcef(chan.openalSource, AL_REFERENCE_DISTANCE, minD);
+ alSourcef(chan.openalSource, AL_MAX_DISTANCE, maxD);
+ }
+ alSourcef(chan.openalSource, AL_PITCH, (slowmoActive && !chan.disallowSlow) ? (slowmoSpeed) : (1.0f));
// if (ID_OPENAL) {
// long lOcclusion = (enviroSuitActive ? -1150 : 0);
// if (soundSystemLocal.alEAXSet) {
// soundSystemLocal.alEAXSet(EAXPROPERTYID_EAX_Source, EAXSOURCE_OCCLUSION, chan.openalSource, lOcclusion, sizeof(lOcclusion));
// }
// }
-// if ((!looping && chan.leadinSample.hardwareBuffer) || (looping && chan.soundShader.entries[0].hardwareBuffer)) {
-// // handle uncompressed (non streaming) single shot and looping sounds
-// if (chan.triggered) {
-// alSourcei(chan.openalSource, AL_BUFFER, looping ? chan.soundShader.entries[0].openalBuffer : chan.leadinSample.openalBuffer);
-// }
-// } else {
-// int/*ALint*/ finishedbuffers = 0;
-// int/*ALuint*/[] buffers = new int[3];
-//
-// // handle streaming sounds (decode on the fly) both single shot AND looping
-// if (chan.triggered) {
-// alSourcei(chan.openalSource, AL_BUFFER, 0);
-// alDeleteBuffers(chan.lastopenalStreamingBuffer);//alDeleteBuffers(3, chan.lastopenalStreamingBuffer[0]);
-// chan.lastopenalStreamingBuffer.put(0, chan.openalStreamingBuffer.get(0));
-// chan.lastopenalStreamingBuffer.put(1, chan.openalStreamingBuffer.get(1));
-// chan.lastopenalStreamingBuffer.put(2, chan.openalStreamingBuffer.get(2));
-// alGenBuffers(chan.openalStreamingBuffer);//alGenBuffers(3, chan.openalStreamingBuffer[0]);
+ if ((!looping && chan.leadinSample.hardwareBuffer) || (looping && chan.soundShader.entries[0].hardwareBuffer)) {
+ // handle uncompressed (non streaming) single shot and looping sounds
+ if (chan.triggered) {
+ alSourcei(chan.openalSource, AL_BUFFER, looping ? chan.soundShader.entries[0].openalBuffer : chan.leadinSample.openalBuffer);
+ }
+ } else {
+ final int/*ALint*/ finishedbuffers;
+ IntBuffer buffers = BufferUtils.createIntBuffer(3);
+
+ // handle streaming sounds (decode on the fly) both single shot AND looping
+ if (chan.triggered) {
+ alSourcei(chan.openalSource, AL_BUFFER, 0);
+ alDeleteBuffers(chan.lastopenalStreamingBuffer);//alDeleteBuffers(3, chan.lastopenalStreamingBuffer[0]);
+ chan.lastopenalStreamingBuffer.put(0, chan.openalStreamingBuffer.get(0));
+ chan.lastopenalStreamingBuffer.put(1, chan.openalStreamingBuffer.get(1));
+ chan.lastopenalStreamingBuffer.put(2, chan.openalStreamingBuffer.get(2));
+ alGenBuffers(chan.openalStreamingBuffer);//alGenBuffers(3, chan.openalStreamingBuffer[0]);
// if (soundSystemLocal.alEAXSetBufferMode) {
// soundSystemLocal.alEAXSetBufferMode(3, chan.openalStreamingBuffer[0], alGetEnumValue(ID_ALCHAR + "AL_STORAGE_ACCESSIBLE"));
// }
-// buffers[0] = chan.openalStreamingBuffer.get(0);
-// buffers[1] = chan.openalStreamingBuffer.get(1);
-// buffers[2] = chan.openalStreamingBuffer.get(2);
-// finishedbuffers = 3;
-// } else {
-// alGetSourcei(chan.openalSource, AL_BUFFERS_PROCESSED);//alGetSourcei(chan.openalSource, AL_BUFFERS_PROCESSED, finishedbuffers);
-// alSourceUnqueueBuffers(chan.openalSource, IntBuffer.wrap(buffers));//alSourceUnqueueBuffers(chan.openalSource, finishedbuffers, buffers[0]);
-// if (finishedbuffers == 3) {
-// chan.triggered = true;
-// }
-// }
-//
-// for (j = 0; j < finishedbuffers; j++) {
-// chan.GatherChannelSamples(chan.openalStreamingOffset * sample.objectInfo.nChannels, MIXBUFFER_SAMPLES * sample.objectInfo.nChannels, FloatBuffer.wrap(alignedInputSamples));
-// for (int i = 0; i < (MIXBUFFER_SAMPLES * sample.objectInfo.nChannels); i++) {
-// if (alignedInputSamples[i] < -32768.0f) {
-// alignedInputSamples[i] = -32768;
-// } else if (alignedInputSamples[i] > 32767.0f) {
-// alignedInputSamples[i] = 32767;
-// } else {
-// alignedInputSamples[i] = idMath.FtoiFast(alignedInputSamples[i]);
-// }
-// }
-// ByteBuffer data = ByteBuffer.allocate(MIXBUFFER_SAMPLES * sample.objectInfo.nChannels * 2);
-// data.asFloatBuffer().put(alignedInputSamples);
-// alBufferData(buffers[j], chan.leadinSample.objectInfo.nChannels == 1 ? AL_FORMAT_MONO16 : AL_FORMAT_STEREO16,
-// data, /*MIXBUFFER_SAMPLES * sample.objectInfo.nChannels * sizeof(short),*/ 44100);
-// chan.openalStreamingOffset += MIXBUFFER_SAMPLES;
-// }
-//
-// if (finishedbuffers != 0) {
-// alSourceQueueBuffers(chan.openalSource, /*finishedbuffers,*/ IntBuffer.wrap(buffers));
-// }
-// }
-//
-// // (re)start if needed..
-// if (chan.triggered) {
-// alSourcePlay(chan.openalSource);
-// chan.triggered = false;
-// }
-// }
-// } else {
-//
-// if (slowmoActive && !chan.disallowSlow) {
-// idSlowChannel slow = sound.GetSlowChannel(chan);
-//
-// slow.AttachSoundChannel(chan);
-//
-// if (sample.objectInfo.nChannels == 2) {
-// // need to add a stereo path, but very few samples go through this
-//// memset(alignedInputSamples, 0, sizeof(alignedInputSamples[0]) * MIXBUFFER_SAMPLES * 2);
-// Arrays.fill(alignedInputSamples, 0);
-// } else {
-// slow.GatherChannelSamples(offset, MIXBUFFER_SAMPLES, alignedInputSamples);
-// }
-//
-// sound.SetSlowChannel(chan, slow);
-// } else {
-// sound.ResetSlowChannel(chan);
-//
-// // if we are getting a stereo sample adjust accordingly
-// if (sample.objectInfo.nChannels == 2) {
-// // we should probably check to make sure any looping is also to a stereo sample...
-// chan.GatherChannelSamples(offset * 2, MIXBUFFER_SAMPLES * 2, FloatBuffer.wrap(alignedInputSamples));
-// } else {
-// chan.GatherChannelSamples(offset, MIXBUFFER_SAMPLES, FloatBuffer.wrap(alignedInputSamples));
-// }
-// }
-//
-// //
-// // work out the left / right ear values
-// //
-// float[] ears = new float[6];
-// if (global || omni) {
-// // same for all speakers
-// for (int i = 0; i < 6; i++) {
-// ears[i] = idSoundSystemLocal.s_globalFraction.GetFloat() * volume;
-// }
-// ears[3] = idSoundSystemLocal.s_subFraction.GetFloat() * volume; // subwoofer
-//
-// } else {
-// CalcEars(numSpeakers, spatializedOriginInMeters, listenerPos, listenerAxis, ears, spatialize);
-//
-// for (int i = 0; i < 6; i++) {
-// ears[i] *= volume;
-// }
-// }
-//
-// // if the mask is 0, it really means do every channel
-// if (0 == mask) {
-// mask = 255;
-// }
-// // cleared mask bits set the mix volume to zero
-// for (int i = 0; i < 6; i++) {
-// if (0 == (mask & (1 << i))) {
-// ears[i] = 0;
-// }
-// }
-//
-// // if sounds are generally normalized, using a mixing volume over 1.0 will
-// // almost always cause clipping noise. If samples aren't normalized, there
-// // is a good call to allow overvolumes
-// if (idSoundSystemLocal.s_clipVolumes.GetBool() && 0 == (parms.soundShaderFlags & SSF_UNCLAMPED)) {
-// for (int i = 0; i < 6; i++) {
-// if (ears[i] > 1.0f) {
-// ears[i] = 1.0f;
-// }
-// }
-// }
-//
-// // if this is the very first mixing block, set the lastV
-// // to the current volume
-// if (current44kHz == chan.trigger44kHzTime) {
-// for (j = 0; j < 6; j++) {
-// chan.lastV[j] = ears[j];
-// }
-// }
-//
-// if (numSpeakers == 6) {
-// if (sample.objectInfo.nChannels == 1) {
-// SIMDProcessor.MixSoundSixSpeakerMono(finalMixBuffer, alignedInputSamples, MIXBUFFER_SAMPLES, chan.lastV, ears);
-// } else {
-// SIMDProcessor.MixSoundSixSpeakerStereo(finalMixBuffer, alignedInputSamples, MIXBUFFER_SAMPLES, chan.lastV, ears);
-// }
-// } else {
-// if (sample.objectInfo.nChannels == 1) {
-// SIMDProcessor.MixSoundTwoSpeakerMono(finalMixBuffer, alignedInputSamples, MIXBUFFER_SAMPLES, chan.lastV, ears);
-// } else {
-// SIMDProcessor.MixSoundTwoSpeakerStereo(finalMixBuffer, alignedInputSamples, MIXBUFFER_SAMPLES, chan.lastV, ears);
-// }
-// }
-//
-// for (j = 0; j < 6; j++) {
-// chan.lastV[j] = ears[j];
-// }
-//
-// }
-//
-// soundSystemLocal.soundStats.activeSounds++;
-//
+ buffers.put(0, chan.openalStreamingBuffer.get(0));
+ buffers.put(1, chan.openalStreamingBuffer.get(1));
+ buffers.put(2, chan.openalStreamingBuffer.get(2));
+ finishedbuffers = 3;
+ } else {
+ finishedbuffers = alGetSourcei(chan.openalSource, AL_BUFFERS_PROCESSED);//alGetSourcei(chan.openalSource, AL_BUFFERS_PROCESSED, finishedbuffers);
+ DBG_AddChannelContribution++;
+ for (int i = 0; i < finishedbuffers; i++) {//jake2
+ buffers.put(i, alSourceUnqueueBuffers(chan.openalSource));//alSourceUnqueueBuffers(chan.openalSource, finishedbuffers, buffers[0]);
+ }
+// System.out.println("====" + AL10.alGetError());
+ if (finishedbuffers == 3) {
+ chan.triggered = true;
+ }
+ }
+
+ final int length = MIXBUFFER_SAMPLES * sample.objectInfo.nChannels;
+ for (j = 0; j < finishedbuffers; j++) {
+ FloatBuffer samples = FloatBuffer.wrap(alignedInputSamples);
+ chan.GatherChannelSamples(chan.openalStreamingOffset * sample.objectInfo.nChannels, length, samples);
+ ByteBuffer data = BufferUtils.createByteBuffer(length * Short.BYTES);
+ ShortBuffer dataS = data.asShortBuffer();
+ for (int i = 0; i < length; i++) {
+ if (alignedInputSamples[i] < -32768.0f) {
+ dataS.put(i, Short.MIN_VALUE);
+ } else if (alignedInputSamples[i] > 32767.0f) {
+ dataS.put(i, Short.MAX_VALUE);
+ } else {
+ final short bla = (short) idMath.FtoiFast(alignedInputSamples[i]);
+ dataS.put(i, bla);
+// System.out.println("<<" + bla);
+ }
+ }
+ ByteBuffer d = (ByteBuffer) data.duplicate().position(0);
+// System.out.printf(">>\n%f\n%f\n%f\n%f\n%f\n%f\n%f\n%f\n%f\n%f\n", d.get(), d.get(), d.get(), d.get(), d.get(), d.get(), d.get(), d.get(), d.get(), d.get());
+// System.out.printf(">>\n%f\n%f\n%f\n%f\n%f\n%f\n%f\n%f\n%f\n%f\n", d.getFloat(), d.getFloat(), d.getFloat(), d.getFloat(), d.getFloat(), d.getFloat(), d.getFloat(), d.getFloat(), d.getFloat(), d.getFloat());
+ alBufferData(buffers.get(j), chan.leadinSample.objectInfo.nChannels == 1 ? AL_FORMAT_MONO16 : AL_FORMAT_STEREO16, data, 44100);
+// fc.write(d);
+// System.out.println(" buffers2 " + AL10.alGetError());
+ chan.openalStreamingOffset += MIXBUFFER_SAMPLES;
+ }
+
+ for (int i = 0; i < finishedbuffers; i++) {
+ alSourceQueueBuffers(chan.openalSource, buffers.get(i));
+ }
+ }
+
+ // (re)start if needed..
+ if (chan.triggered) {
+ alSourcePlay(chan.openalSource);
+ chan.triggered = false;
+ }
+ }
+ } else {
+
+ if (slowmoActive && !chan.disallowSlow) {
+ idSlowChannel slow = sound.GetSlowChannel(chan);
+
+ slow.AttachSoundChannel(chan);
+
+ if (sample.objectInfo.nChannels == 2) {
+ // need to add a stereo path, but very few samples go through this
+ alignedInputSamples = new float[MIXBUFFER_SAMPLES * 2];//memset(alignedInputSamples, 0, sizeof(alignedInputSamples[0]) * MIXBUFFER_SAMPLES * 2);
+ } else {
+ slow.GatherChannelSamples(offset, MIXBUFFER_SAMPLES, alignedInputSamples);
+ }
+
+ sound.SetSlowChannel(chan, slow);
+ } else {
+ sound.ResetSlowChannel(chan);
+
+ // if we are getting a stereo sample adjust accordingly
+ if (sample.objectInfo.nChannels == 2) {
+ // we should probably check to make sure any looping is also to a stereo sample...
+ chan.GatherChannelSamples(offset * 2, MIXBUFFER_SAMPLES * 2, FloatBuffer.wrap(alignedInputSamples));
+ } else {
+ chan.GatherChannelSamples(offset, MIXBUFFER_SAMPLES, FloatBuffer.wrap(alignedInputSamples));
+ }
+ }
+
+ //
+ // work out the left / right ear values
+ //
+ float[] ears = new float[6];
+ if (global || omni) {
+ // same for all speakers
+ for (int i = 0; i < 6; i++) {
+ ears[i] = idSoundSystemLocal.s_globalFraction.GetFloat() * volume;
+ }
+ ears[3] = idSoundSystemLocal.s_subFraction.GetFloat() * volume;// subwoofer
+
+ } else {
+ CalcEars(numSpeakers, spatializedOriginInMeters, listenerPos, listenerAxis, ears, spatialize);
+
+ for (int i = 0; i < 6; i++) {
+ ears[i] *= volume;
+ }
+ }
+
+ // if the mask is 0, it really means do every channel
+ if (0 == mask) {
+ mask = 255;
+ }
+ // cleared mask bits set the mix volume to zero
+ for (int i = 0; i < 6; i++) {
+ if (0 == (mask & (1 << i))) {
+ ears[i] = 0;
+ }
+ }
+
+ // if sounds are generally normalized, using a mixing volume over 1.0 will
+ // almost always cause clipping noise. If samples aren't normalized, there
+ // is a good call to allow overvolumes
+ if (idSoundSystemLocal.s_clipVolumes.GetBool() && 0 == (parms.soundShaderFlags & SSF_UNCLAMPED)) {
+ for (int i = 0; i < 6; i++) {
+ if (ears[i] > 1.0f) {
+ ears[i] = 1.0f;
+ }
+ }
+ }
+
+ // if this is the very first mixing block, set the lastV
+ // to the current volume
+ if (current44kHz == chan.trigger44kHzTime) {
+ for (j = 0; j < 6; j++) {
+ chan.lastV[j] = ears[j];
+ }
+ }
+
+ if (numSpeakers == 6) {
+ if (sample.objectInfo.nChannels == 1) {
+ SIMDProcessor.MixSoundSixSpeakerMono(finalMixBuffer, alignedInputSamples, MIXBUFFER_SAMPLES, chan.lastV, ears);
+ } else {
+ SIMDProcessor.MixSoundSixSpeakerStereo(finalMixBuffer, alignedInputSamples, MIXBUFFER_SAMPLES, chan.lastV, ears);
+ }
+ } else {
+ if (sample.objectInfo.nChannels == 1) {
+ SIMDProcessor.MixSoundTwoSpeakerMono(finalMixBuffer, alignedInputSamples, MIXBUFFER_SAMPLES, chan.lastV, ears);
+ } else {
+ SIMDProcessor.MixSoundTwoSpeakerStereo(finalMixBuffer, alignedInputSamples, MIXBUFFER_SAMPLES, chan.lastV, ears);
+ }
+ }
+
+ for (j = 0; j < 6; j++) {
+ chan.lastV[j] = ears[j];
+ }
+
+ }
+ soundSystemLocal.soundStats.activeSounds++;
}
/*
@@ -1715,19 +1804,19 @@ public void MixLoop(int current44kHz, int numSpeakers, float[] finalMixBuffer) {
listenerPosition[1] = listenerPos.z;
listenerPosition[2] = -listenerPos.x;
- float/*ALfloat*/[] listenerOrientation = new float[6];
+ FloatBuffer listenerOrientation = BufferUtils.createFloatBuffer(6);
- listenerOrientation[0] = -listenerAxis.oGet(0).y;
- listenerOrientation[1] = listenerAxis.oGet(0).z;
- listenerOrientation[2] = -listenerAxis.oGet(0).x;
+ listenerOrientation.put(0, -listenerAxis.oGet(0).y);
+ listenerOrientation.put(1, +listenerAxis.oGet(0).z);
+ listenerOrientation.put(2, -listenerAxis.oGet(0).x);
- listenerOrientation[3] = -listenerAxis.oGet(2).y;
- listenerOrientation[4] = listenerAxis.oGet(2).z;
- listenerOrientation[5] = -listenerAxis.oGet(2).x;
+ listenerOrientation.put(3, -listenerAxis.oGet(2).y);
+ listenerOrientation.put(4, +listenerAxis.oGet(2).z);
+ listenerOrientation.put(5, -listenerAxis.oGet(2).x);
alListenerf(AL_GAIN, 1.0f);
alListener3f(AL_POSITION, listenerPosition[0], listenerPosition[1], listenerPosition[2]);
- alListener3f(AL_ORIENTATION, listenerOrientation[0], listenerOrientation[1], listenerOrientation[2]);
+ alListener(AL_ORIENTATION, listenerOrientation);//SO6874122
// #if ID_OPENAL
// if ( soundSystemLocal.s_useEAXReverb.GetBool() ) {
@@ -1741,7 +1830,7 @@ public void MixLoop(int current44kHz, int numSpeakers, float[] finalMixBuffer) {
// soundSystemLocal.EFXDatabase.FindEffect( listenerAreaName, &effect, &EnvironmentID );
// if (!effect)
// soundSystemLocal.EFXDatabase.FindEffect( defaultStr, &effect, &EnvironmentID );
- // // only update if change in settings
+ // // only update if change in settings
// if ( soundSystemLocal.s_muteEAXReverb.GetBool() || ( listenerEnvironmentID != EnvironmentID ) ) {
// EAXREVERBPROPERTIES EnvironmentParameters;
// // get area reverb setting from EAX Manager
@@ -1749,7 +1838,7 @@ public void MixLoop(int current44kHz, int numSpeakers, float[] finalMixBuffer) {
// if ( soundSystemLocal.s_muteEAXReverb.GetBool() ) {
// EnvironmentParameters.lRoom = -10000;
// EnvironmentID = -2;
- // }
+// }
// if ( soundSystemLocal.alEAXSet ) {
// soundSystemLocal.alEAXSet( &EAXPROPERTYID_EAX_FXSlot0, EAXREVERB_ALLPARAMETERS, 0, &EnvironmentParameters, sizeof( EnvironmentParameters ) );
// }
@@ -1838,14 +1927,14 @@ public void AVIUpdate() {
float[] mix_p = new float[MIXBUFFER_SAMPLES * 6 + 16];
// SIMDProcessor.Memset(mix_p, 0, MIXBUFFER_SAMPLES * sizeof(float) * numSpeakers);
-//
+//
MixLoop(lastAVI44kHz, numSpeakers, mix_p);
for (int i = 0; i < numSpeakers; i++) {
ByteBuffer outD = ByteBuffer.allocate(MIXBUFFER_SAMPLES * 2);
for (int j = 0; j < MIXBUFFER_SAMPLES; j++) {
- float s = mix_p[ j * numSpeakers + i];
+ float s = mix_p[j * numSpeakers + i];
if (s < -32768.0f) {
outD.putShort(Short.MIN_VALUE);
} else if (s > 32767.0f) {
@@ -2059,7 +2148,7 @@ public float FindAmplitude(idSoundEmitterLocal sound, final int localTime, final
activeChannelCount = 0;
for (i = 0; i < SOUND_MAX_CHANNELS; i++) {
- idSoundChannel chan = sound.channels[ i];
+ idSoundChannel chan = sound.channels[i];
if (!chan.triggerState) {
continue;
@@ -2126,7 +2215,7 @@ public float FindAmplitude(idSoundEmitterLocal sound, final int localTime, final
sourceBuffer[j] = (j & 1) == 1 ? 32767.0f : -32767.0f;
}
} else {
- int offset = (localTime - localTriggerTimes); // offset in samples
+ int offset = (localTime - localTriggerTimes); // offset in samples
int size = (looping ? chan.soundShader.entries[0].LengthIn44kHzSamples() : chan.leadinSample.LengthIn44kHzSamples());
ShortBuffer amplitudeData = (looping ? chan.soundShader.entries[0].amplitudeData : chan.leadinSample.amplitudeData).asShortBuffer();
@@ -2150,12 +2239,12 @@ public float FindAmplitude(idSoundEmitterLocal sound, final int localTime, final
if (activeChannelCount == 1) {
// store to the buffer
for (j = 0; j < AMPLITUDE_SAMPLES; j++) {
- sumBuffer[ j] = volume * sourceBuffer[ j];
+ sumBuffer[j] = volume * sourceBuffer[j];
}
} else {
// add to the buffer
for (j = 0; j < AMPLITUDE_SAMPLES; j++) {
- sumBuffer[ j] += volume * sourceBuffer[ j];
+ sumBuffer[j] += volume * sourceBuffer[j];
}
}
}
@@ -2184,5 +2273,7 @@ public float FindAmplitude(idSoundEmitterLocal sound, final int localTime, final
return sout;
}
- };
+ }
+
+ ;
}
diff --git a/src/main/java/neo/Sound/sound.java b/src/main/java/neo/Sound/sound.java
index 0c37af7d..94e1cbc2 100644
--- a/src/main/java/neo/Sound/sound.java
+++ b/src/main/java/neo/Sound/sound.java
@@ -171,7 +171,7 @@ public static class soundDecoderInfo_t {
public idStr name;
public idStr format;
public int numChannels;
- public int numSamplesPerSecond;
+ public long numSamplesPerSecond;
public int num44kHzSamples;
public int numBytes;
public boolean looping;
diff --git a/src/main/java/neo/TempDump.java b/src/main/java/neo/TempDump.java
index 2782768c..14e5d354 100644
--- a/src/main/java/neo/TempDump.java
+++ b/src/main/java/neo/TempDump.java
@@ -7,6 +7,7 @@
import java.lang.reflect.Method;
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
+import java.nio.FloatBuffer;
import java.nio.channels.FileChannel;
import java.nio.charset.Charset;
import java.nio.file.StandardOpenOption;
@@ -40,6 +41,7 @@
import neo.idlib.math.Vector.idVec3;
import neo.ui.UserInterface.idUserInterface;
import org.lwjgl.BufferUtils;
+import org.lwjgl.openal.AL10;
/**
*
@@ -368,6 +370,18 @@ public static ByteBuffer atobb(char[] ascii) {
return atobb(ctos(ascii));
}
+ public static ByteBuffer stobb(short[] arrau) {
+ ByteBuffer buffer;
+
+ if (NOT(arrau)) {
+ return null;
+ }
+ buffer = ByteBuffer.allocate(arrau.length * 2);
+ buffer.asShortBuffer().put(arrau);
+
+ return (ByteBuffer) buffer.flip();
+ }
+
public static CharBuffer atocb(String ascii) {
if (NOT(ascii)) {
@@ -530,6 +544,13 @@ public static void countCallStack() {
}
}
}
+
+ private static void breakOnALError() {
+ final int e;
+ if ((e = AL10.alGetError()) != 0) {
+ throw new RuntimeException(e + " minutes, to miiiiiiiidnight!");
+ }
+ }
public static void printCallStackCount() {
System.out.println(Arrays.toString(CALL_STACK_MAP.entrySet().toArray()));
@@ -558,7 +579,7 @@ public static void printCallStackCount() {
*
*/
@Deprecated
- public static interface SERiAL extends Serializable {
+ public static interface SERiAL extends Serializable {//TODO:remove Serializable
public static final int SIZE = Integer.MIN_VALUE;
public static final int SIZE_B = SIZE / Byte.SIZE;
diff --git a/src/main/java/neo/framework/Async/AsyncServer.java b/src/main/java/neo/framework/Async/AsyncServer.java
index 1e28b8c1..0643870d 100644
--- a/src/main/java/neo/framework/Async/AsyncServer.java
+++ b/src/main/java/neo/framework/Async/AsyncServer.java
@@ -461,7 +461,7 @@ public void Kill() {
session.Stop();
}
- public void ExecuteMapChange() throws Lib.idException {
+ public void ExecuteMapChange() throws idException {
int i;
idBitMsg msg = new idBitMsg();
ByteBuffer msgBuf = ByteBuffer.allocate(MAX_MESSAGE_SIZE);
@@ -761,7 +761,7 @@ public int GetLocalClientNum() {
}
//
- public void RunFrame() throws Lib.idException {
+ public void RunFrame() throws idException {
int i, msec;
int[] size = new int[1];
boolean newPacket;
@@ -1650,7 +1650,7 @@ private boolean SendSnapshotToClient(int clientNum) {
return true;
}
- private void ProcessUnreliableClientMessage(int clientNum, final idBitMsg msg) throws Lib.idException {
+ private void ProcessUnreliableClientMessage(int clientNum, final idBitMsg msg) throws idException {
int i, id, acknowledgeSequence, clientGameInitId, clientGameFrame, numUsercmds, index;
usercmd_t last;
@@ -1818,7 +1818,7 @@ private void ProcessReliableClientMessages(int clientNum) {
}
}
- private void ProcessChallengeMessage(final netadr_t from, final idBitMsg msg) throws Lib.idException {
+ private void ProcessChallengeMessage(final netadr_t from, final idBitMsg msg) throws idException {
int i, clientId, oldest, oldestTime;
idBitMsg outMsg = new idBitMsg();
ByteBuffer msgBuf = ByteBuffer.allocate(MAX_MESSAGE_SIZE);
diff --git a/src/main/java/neo/framework/Async/ServerScan.java b/src/main/java/neo/framework/Async/ServerScan.java
index 4324e8aa..43cffd71 100644
--- a/src/main/java/neo/framework/Async/ServerScan.java
+++ b/src/main/java/neo/framework/Async/ServerScan.java
@@ -269,7 +269,7 @@ public void StartServers(boolean timeout) {
public void EndServers() {
incoming_net = false;
l_serverScan = this;
- m_sortedServers.Sort(new idServerScan.Cmp());
+ m_sortedServers.Sort(new Cmp());
ApplyFilter();
}
//
@@ -496,7 +496,7 @@ public void SetSorting(serverSort_t sort) {
} else {
m_sort = sort;
m_sortAscending = true; // is the default for any new sort
- m_sortedServers.Sort(new idServerScan.Cmp());
+ m_sortedServers.Sort(new Cmp());
}
// trigger a redraw
ApplyFilter();
diff --git a/src/main/java/neo/framework/BuildDefines.java b/src/main/java/neo/framework/BuildDefines.java
index bb0035e8..61869505 100644
--- a/src/main/java/neo/framework/BuildDefines.java
+++ b/src/main/java/neo/framework/BuildDefines.java
@@ -1,8 +1,3 @@
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
package neo.framework;
/**
@@ -10,12 +5,12 @@
*/
public class BuildDefines {
- public static final boolean _DEBUG = false;
+ public static final boolean _DEBUG = false;
//
- public static final boolean _WIN32 = System.getProperty("os.name").startsWith("Windows");
- public static final boolean WIN32 = _WIN32;
- public static final boolean MACOS_X = System.getProperty("os.name").equals("MacOSX");
- public static final boolean __ppc__ = MACOS_X;//TODO:can macosx run on non ppc?
+ public static final boolean _WIN32 = System.getProperty("os.name").startsWith("Windows");
+ public static final boolean WIN32 = _WIN32;
+ public static final boolean MACOS_X = System.getProperty("os.name").equals("MacOSX");
+ public static final boolean __ppc__ = MACOS_X;//TODO:can macosx run on non ppc?
public static final boolean __linux__ = System.getProperty("os.name").equals("Linux");
/*
@@ -47,18 +42,18 @@ public class BuildDefines {
}
// useful for network debugging, turns off 'LAN' checks, all IPs are classified 'internet'
- public static final boolean ID_NOLANADDRESS = false;
+ public static final boolean ID_NOLANADDRESS = false;
// let .dds be loaded from FS without altering pure state. only for developement.
- public static final boolean ID_PURE_ALLOWDDS = false;
+ public static final boolean ID_PURE_ALLOWDDS = false;
// build an exe with no CVAR_CHEAT controls
- public static final boolean ID_ALLOW_CHEATS = false;
+ public static final boolean ID_ALLOW_CHEATS = false;
- public static final boolean ID_ENABLE_CURL = true;
+ public static final boolean ID_ENABLE_CURL = true;
// fake a pure client. useful to connect an all-debug client to a server
- public static final boolean ID_FAKE_PURE = false;
+ public static final boolean ID_FAKE_PURE = false;
// verify checksums in clientinfo traffic
// NOTE: this makes the network protocol incompatible
@@ -66,11 +61,11 @@ public class BuildDefines {
// for win32 this is defined in preprocessor settings so that MFC can be
// compiled out.
- public static final boolean ID_DEDICATED = false;
+ public static final boolean ID_DEDICATED = false;
// if this is defined, the executable positively won't work with any paks other
// than the demo pak, even if productid is present.
- public static final boolean ID_DEMO_BUILD = false;
+ public static final boolean ID_DEMO_BUILD = false;
// don't define ID_ALLOW_TOOLS when we don't want tool code in the executable.
public static final boolean ID_ALLOW_TOOLS;
@@ -110,15 +105,15 @@ public class BuildDefines {
}
}
- public static final boolean ID_OPENAL;
+ public static final boolean ID_OPENAL = true;
- static {
- if ((_WIN32 || MACOS_X) && !ID_DEDICATED) {
- ID_OPENAL = true;
- } else {
- ID_OPENAL = false;
- }
- }
+// static {
+// if ((_WIN32 || MACOS_X) && !ID_DEDICATED) {
+// ID_OPENAL = true;
+// } else {
+// ID_OPENAL = false;
+// }
+// }
public static final boolean ID_ALLOW_D3XP = true;
diff --git a/src/main/java/neo/framework/CmdSystem.java b/src/main/java/neo/framework/CmdSystem.java
index 175894a2..276da6a0 100644
--- a/src/main/java/neo/framework/CmdSystem.java
+++ b/src/main/java/neo/framework/CmdSystem.java
@@ -518,16 +518,18 @@ public void BufferCommandText(cmdExecution_t exec, String text) throws idExcepti
}
}
+ private static int DBG_ExecuteCommandBuffer = 0;
@Override
public void ExecuteCommandBuffer() throws idException {
- int i, j = 0;
+ int i;
char[] text = null;
- byte[] textBuf2 = null;
String txt;
int quotes;
idCmdArgs args = new idCmdArgs();
+
while (textLength != 0) {
+ DBG_ExecuteCommandBuffer++;
if (wait != 0) {
// skip out while text still remains in buffer, leaving it for next frame
@@ -535,11 +537,9 @@ public void ExecuteCommandBuffer() throws idException {
break;
}
- if (null == text//TODO: Arrays.equals has too much overhead.
- || !Arrays.equals(textBuf, textBuf2)) {//first iteration, or buffer was changed.
- // find a \n or ; line break
- text = new String(textBuf).toCharArray();//TODO:??
- }
+ // find a \n or ; line break
+ text = new String(textBuf).toCharArray();//TODO:??
+
quotes = 0;
for (i = 0; i < textLength; i++) {
if (text[i] == '"') {
@@ -554,8 +554,8 @@ public void ExecuteCommandBuffer() throws idException {
}
// text[i] = 0;
- j++;
- txt = new String(text).substring(0, i);//do not use ctos!
+ String bla = new String(text);
+ txt = bla.substring(0, i);//do not use ctos!
if (0 == idStr.Cmp(txt, "_execTokenized")) {
args = tokenizedCmds.oGet(0);
tokenizedCmds.RemoveIndex(0);
@@ -569,11 +569,11 @@ public void ExecuteCommandBuffer() throws idException {
if (i == textLength) {
textLength = 0;
} else {
+ final byte[] textBuf2 = textBuf;
i++;
textLength -= i;
-// memmove(text, text + i, textLength);
- System.arraycopy(text, i, text, 0, textLength);
- textBuf2 = textBuf.clone();
+ textBuf = new byte[textBuf.length];//memmove(text, text + i, textLength);
+ System.arraycopy(textBuf2, i, textBuf, 0, textLength);
}
// execute the command line that we have already tokenized
diff --git a/src/main/java/neo/framework/Common.java b/src/main/java/neo/framework/Common.java
index 0d94ecdc..92de80fe 100644
--- a/src/main/java/neo/framework/Common.java
+++ b/src/main/java/neo/framework/Common.java
@@ -3,8 +3,6 @@
import java.io.IOException;
import java.nio.ByteBuffer;
import java.util.Date;
-import java.util.concurrent.locks.Lock;
-import java.util.concurrent.locks.ReentrantLock;
import java.util.logging.Level;
import java.util.logging.Logger;
import static neo.Game.GameSys.SysCvar.__DATE__;
@@ -151,10 +149,12 @@
import static neo.sys.win_main.DEBUG;
import static neo.sys.win_main.Sys_AlreadyRunning;
import static neo.sys.win_main.Sys_DoPreferences;
+import static neo.sys.win_main.Sys_EnterCriticalSection;
import static neo.sys.win_main.Sys_Error;
import static neo.sys.win_main.Sys_GenerateEvents;
import static neo.sys.win_main.Sys_GetProcessorId;
import static neo.sys.win_main.Sys_Init;
+import static neo.sys.win_main.Sys_LeaveCriticalSection;
import static neo.sys.win_main.Sys_Printf;
import static neo.sys.win_main.Sys_Quit;
import static neo.sys.win_main.Sys_SetClipboardData;
@@ -412,7 +412,7 @@ public static class idCommonLocal extends idCommon {
//#ifdef ID_WRITE_VERSION
idCompressor config_compressor;
//#endif
- private static final Lock SINGLE_ASYNC_TIC_LOCK = new ReentrantLock();//TODO:collect the locks into a single bundle.
+// private static final Lock SINGLE_ASYNC_TIC_LOCK = new ReentrantLock();//TODO:collect the locks into a single bundle.
//
//
@@ -2053,36 +2053,35 @@ private void DumpWarnings() {
}
}
- private void SingleAsyncTic() {
+ private /*synchronized*/ void SingleAsyncTic() {
// main thread code can prevent this from happening while modifying
// critical data structures
- if (SINGLE_ASYNC_TIC_LOCK.tryLock()) {//Sys_EnterCriticalSection();
- try {
- asyncStats_t stat = com_asyncStats[com_ticNumber & (MAX_ASYNC_STATS - 1)];//memset( stat, 0, sizeof( *stat ) );
- stat.milliseconds = Sys_Milliseconds();
- stat.deltaMsec = stat.milliseconds - com_asyncStats[(com_ticNumber - 1) & (MAX_ASYNC_STATS - 1)].milliseconds;
-
- if (usercmdGen != null && com_asyncInput.GetBool()) {
- usercmdGen.UsercmdInterrupt();
- }
+ Sys_EnterCriticalSection();
+ try {
+ asyncStats_t stat = com_asyncStats[com_ticNumber & (MAX_ASYNC_STATS - 1)];//memset( stat, 0, sizeof( *stat ) );
+ stat.milliseconds = Sys_Milliseconds();
+ stat.deltaMsec = stat.milliseconds - com_asyncStats[(com_ticNumber - 1) & (MAX_ASYNC_STATS - 1)].milliseconds;
- switch (com_asyncSound.GetInteger()) {
- case 1:
- soundSystem.AsyncUpdate(stat.milliseconds);
- break;
- case 3:
- soundSystem.AsyncUpdateWrite(stat.milliseconds);
- break;
- }
+ if (usercmdGen != null && com_asyncInput.GetBool()) {
+ usercmdGen.UsercmdInterrupt();
+ }
- // we update com_ticNumber after all the background tasks
- // have completed their work for this tic
- com_ticNumber++;
-// System.out.println(com_ticNumber);
- stat.timeConsumed = Sys_Milliseconds() - stat.milliseconds;
- } finally {
- SINGLE_ASYNC_TIC_LOCK.unlock();//Sys_LeaveCriticalSection();
+ switch (com_asyncSound.GetInteger()) {
+ case 1:
+ soundSystem.AsyncUpdate(stat.milliseconds);
+ break;
+ case 3:
+ soundSystem.AsyncUpdateWrite(stat.milliseconds);
+ break;
}
+
+ // we update com_ticNumber after all the background tasks
+ // have completed their work for this tic
+ com_ticNumber++;
+// System.out.println(com_ticNumber);
+ stat.timeConsumed = Sys_Milliseconds() - stat.milliseconds;
+ } finally {
+ Sys_LeaveCriticalSection();
}
}
static float DEBUG_fraction = 0;
diff --git a/src/main/java/neo/framework/File_h.java b/src/main/java/neo/framework/File_h.java
index 5be090b0..91a45712 100644
--- a/src/main/java/neo/framework/File_h.java
+++ b/src/main/java/neo/framework/File_h.java
@@ -245,6 +245,14 @@ public final int Read(SERiAL object) {
return reads;
}
+
+ public final int Read(SERiAL object, int len) {
+ ByteBuffer buffer = object.AllocBuffer();
+ int reads = Read(buffer, len);
+ object.Read(buffer);
+
+ return reads;
+ }
@Deprecated// Read data from the file to the buffer.
public int Read(ByteBuffer buffer, int len) {
@@ -855,14 +863,14 @@ public void Clear(boolean freeMemory /*= true*/) {
}
// set data for reading
- public void SetData(final ByteBuffer data) {
+ public void SetData(final ByteBuffer data, final int length) {
maxSize = 0;
- fileSize = data.capacity();
+ fileSize = length;
allocated = 0;
granularity = 16384;
mode = (1 << etoi(FS_READ));
- filePtr.put(data);
+ filePtr = data.duplicate();
curPtr = 0;
}
diff --git a/src/main/java/neo/framework/KeyInput.java b/src/main/java/neo/framework/KeyInput.java
index 52e7ab6b..3b0033b4 100644
--- a/src/main/java/neo/framework/KeyInput.java
+++ b/src/main/java/neo/framework/KeyInput.java
@@ -208,7 +208,6 @@ public static void Shutdown() {
// delete [] keys;
keys = null;
}
-//
public static class ArgCompletion_KeyName extends argCompletion_t {
diff --git a/src/main/java/neo/framework/Session.java b/src/main/java/neo/framework/Session.java
index b8ffde7a..5ccd2a4b 100644
--- a/src/main/java/neo/framework/Session.java
+++ b/src/main/java/neo/framework/Session.java
@@ -30,6 +30,8 @@
import static neo.framework.Session_local.timeDemo_t.TD_YES;
import static neo.framework.Session_local.timeDemo_t.TD_YES_THEN_QUIT;
import neo.idlib.CmdArgs.idCmdArgs;
+import neo.idlib.Dict_h;
+import neo.idlib.LangDict;
import neo.idlib.Lib.idException;
import neo.idlib.Text.Str.idStr;
import static neo.idlib.Text.Str.va;
@@ -487,6 +489,10 @@ public void run(idCmdArgs args) throws idException {
if (prompt_msg.isEmpty()/*[ 0 ] == '\0'*/) {
prompt_msg = common.GetLanguageDict().GetString("#str_04308");
}
+// for (int d = 0; d < common.GetLanguageDict().args.Size(); d++) {
+// LangDict.idLangKeyValue bla = common.GetLanguageDict().args.oGet(d);
+// System.out.println(bla.key + " >>> " + bla.value);
+// }
retkey = sessLocal.MessageBox(MSG_CDKEY, prompt_msg, common.GetLanguageDict().GetString("#str_04305"), true, null, null, true);
if (retkey != null) {
if (sessLocal.CheckKey(retkey, false, valid)) {
diff --git a/src/main/java/neo/framework/Session_local.java b/src/main/java/neo/framework/Session_local.java
index 6632aadb..b2544f92 100644
--- a/src/main/java/neo/framework/Session_local.java
+++ b/src/main/java/neo/framework/Session_local.java
@@ -2,6 +2,7 @@
import java.nio.ByteBuffer;
import java.util.Arrays;
+import java.util.concurrent.locks.ReentrantLock;
import neo.Game.Game.escReply_t;
import static neo.Game.Game.escReply_t.ESC_GUI;
import static neo.Game.Game.escReply_t.ESC_IGNORE;
@@ -133,8 +134,10 @@
import neo.framework.Session.idSession;
import neo.framework.Session.logStats_t;
import neo.framework.Session.msgBoxType_t;
+import static neo.framework.Session.msgBoxType_t.MSG_CDKEY;
import static neo.framework.Session.msgBoxType_t.MSG_OK;
import static neo.framework.Session.msgBoxType_t.MSG_OKCANCEL;
+import static neo.framework.Session.msgBoxType_t.MSG_PROMPT;
import static neo.framework.Session.msgBoxType_t.MSG_WAIT;
import static neo.framework.Session.msgBoxType_t.MSG_YESNO;
import static neo.framework.Session.sessLocal;
@@ -178,6 +181,7 @@
import static neo.sys.sys_public.sysEventType_t.SE_NONE;
import neo.sys.sys_public.sysEvent_s;
import static neo.sys.win_input.Sys_GrabMouseCursor;
+import neo.sys.win_main;
import static neo.sys.win_main.Sys_ClearEvents;
import static neo.sys.win_main.Sys_GenerateEvents;
import static neo.sys.win_main.Sys_IsWindowVisible;
@@ -742,6 +746,7 @@ public void Frame() throws idException {
break;
}
Sys_Sleep(1);
+ win_main.hTimer.isTerminated();
// if (win_main.DEBUG) {
// //TODO:the debugger slows the code too much at this point, so we shall manually move to the next frame.
// com_ticNumber = minTic;
@@ -1083,7 +1088,144 @@ public String MessageBox(msgBoxType_t type, String message, String title, boolea
@Override
public String MessageBox(msgBoxType_t type, String message, String title, boolean wait, String fire_yes, String fire_no, boolean network) {
- throw new UnsupportedOperationException("Not supported yet.");
+ common.DPrintf("MessageBox: %s - %s\n", "" + title, "" + message);
+
+ if (!BoxDialogSanityCheck()) {
+ return null;
+ }
+
+ guiMsg.SetStateString("title", "" + title);
+ guiMsg.SetStateString("message", "" + message);
+ if (type == MSG_WAIT) {
+ guiMsg.SetStateString("visible_msgbox", "0");
+ guiMsg.SetStateString("visible_waitbox", "1");
+ } else {
+ guiMsg.SetStateString("visible_msgbox", "1");
+ guiMsg.SetStateString("visible_waitbox", "0");
+ }
+
+ guiMsg.SetStateString("visible_entry", "0");
+ guiMsg.SetStateString("visible_cdkey", "0");
+ switch (type) {
+ case MSG_INFO:
+ guiMsg.SetStateString("mid", "");
+ guiMsg.SetStateString("visible_mid", "0");
+ guiMsg.SetStateString("visible_left", "0");
+ guiMsg.SetStateString("visible_right", "0");
+ break;
+ case MSG_OK:
+ guiMsg.SetStateString("mid", common.GetLanguageDict().GetString("#str_04339"));
+ guiMsg.SetStateString("visible_mid", "1");
+ guiMsg.SetStateString("visible_left", "0");
+ guiMsg.SetStateString("visible_right", "0");
+ break;
+ case MSG_ABORT:
+ guiMsg.SetStateString("mid", common.GetLanguageDict().GetString("#str_04340"));
+ guiMsg.SetStateString("visible_mid", "1");
+ guiMsg.SetStateString("visible_left", "0");
+ guiMsg.SetStateString("visible_right", "0");
+ break;
+ case MSG_OKCANCEL:
+ guiMsg.SetStateString("left", common.GetLanguageDict().GetString("#str_04339"));
+ guiMsg.SetStateString("right", common.GetLanguageDict().GetString("#str_04340"));
+ guiMsg.SetStateString("visible_mid", "0");
+ guiMsg.SetStateString("visible_left", "1");
+ guiMsg.SetStateString("visible_right", "1");
+ break;
+ case MSG_YESNO:
+ guiMsg.SetStateString("left", common.GetLanguageDict().GetString("#str_04341"));
+ guiMsg.SetStateString("right", common.GetLanguageDict().GetString("#str_04342"));
+ guiMsg.SetStateString("visible_mid", "0");
+ guiMsg.SetStateString("visible_left", "1");
+ guiMsg.SetStateString("visible_right", "1");
+ break;
+ case MSG_PROMPT:
+ guiMsg.SetStateString("left", common.GetLanguageDict().GetString("#str_04339"));
+ guiMsg.SetStateString("right", common.GetLanguageDict().GetString("#str_04340"));
+ guiMsg.SetStateString("visible_mid", "0");
+ guiMsg.SetStateString("visible_left", "1");
+ guiMsg.SetStateString("visible_right", "1");
+ guiMsg.SetStateString("visible_entry", "1");
+ guiMsg.HandleNamedEvent("Prompt");
+ break;
+ case MSG_CDKEY:
+ guiMsg.SetStateString("left", common.GetLanguageDict().GetString("#str_04339"));
+ guiMsg.SetStateString("right", common.GetLanguageDict().GetString("#str_04340"));
+ guiMsg.SetStateString("visible_msgbox", "0");
+ guiMsg.SetStateString("visible_cdkey", "1");
+ guiMsg.SetStateString("visible_hasxp", fileSystem.HasD3XP() ? "1" : "0");
+ // the current cdkey / xpkey values may have bad/random data in them
+ // it's best to avoid printing them completely, unless the key is good
+ if (cdkey_state == CDKEY_OK) {
+ guiMsg.SetStateString("str_cdkey", new String(cdkey));
+ guiMsg.SetStateString("visible_cdchk", "0");
+ } else {
+ guiMsg.SetStateString("str_cdkey", "");
+ guiMsg.SetStateString("visible_cdchk", "1");
+ }
+ guiMsg.SetStateString("str_cdchk", "");
+ if (xpkey_state == CDKEY_OK) {
+ guiMsg.SetStateString("str_xpkey", new String(xpkey));
+ guiMsg.SetStateString("visible_xpchk", "0");
+ } else {
+ guiMsg.SetStateString("str_xpkey", "");
+ guiMsg.SetStateString("visible_xpchk", "1");
+ }
+ guiMsg.SetStateString("str_xpchk", "");
+ guiMsg.HandleNamedEvent("CDKey");
+ break;
+ case MSG_WAIT:
+ break;
+ default:
+ common.Printf("idSessionLocal::MessageBox: unknown msg box type\n");
+ }
+ msgFireBack[0].oSet(fire_yes != null ? fire_yes : "");
+ msgFireBack[1].oSet(fire_no != null ? fire_no : "");
+ guiMsgRestore = guiActive;
+ guiActive = guiMsg;
+ guiMsg.SetCursor(325, 290);
+ guiActive.Activate(true, com_frameTime);
+ msgRunning = true;
+ msgRetIndex = -1;
+
+ if (wait) {
+ // play one frame ignoring events so we don't get confused by parasite button releases
+ msgIgnoreButtons = true;
+ common.GUIFrame(true, network);
+ msgIgnoreButtons = false;
+ while (msgRunning) {
+ common.GUIFrame(true, network);
+ }
+ if (msgRetIndex < 0) {
+ // MSG_WAIT and other StopBox calls
+ return null;
+ }
+ if (type == MSG_PROMPT) {
+ if (msgRetIndex == 0) {
+ guiMsg.State().GetString("str_entry", "", msgFireBack[0]);
+ return msgFireBack[0].toString();
+ } else {
+ return null;
+ }
+ } else if (type == MSG_CDKEY) {
+ if (msgRetIndex == 0) {
+ // the visible_ values distinguish looking at a valid key, or editing it
+ msgFireBack[0].oSet(String.format("%1s;%16s;%2s;%1s;%16s;%2s",
+ guiMsg.State().GetString("visible_cdchk"),
+ guiMsg.State().GetString("str_cdkey"),
+ guiMsg.State().GetString("str_cdchk"),
+ guiMsg.State().GetString("visible_xpchk"),
+ guiMsg.State().GetString("str_xpkey"),
+ guiMsg.State().GetString("str_xpchk")));
+ return msgFireBack[0].toString();
+ } else {
+ return null;
+ }
+ } else {
+ return msgFireBack[msgRetIndex].toString();
+ }
+ }
+ return null;
}
@Override
@@ -4217,7 +4359,6 @@ public void UpdateMPLevelShot() {
fileSystem.FindMapScreenshot(cvarSystem.GetCVarString("si_map"), screenshot, MAX_STRING_CHARS);
guiMainMenu.SetStateString("current_levelshot", screenshot[0]);
}
-//
public void SetSaveGameGuiVars() {
int i;
@@ -4348,8 +4489,6 @@ public void SetMainMenuSkin() {
public void SetPbMenuGuiVars() {
}
-//
-//
private boolean BoxDialogSanityCheck() {
if (!common.IsInitialized()) {
diff --git a/src/main/java/neo/framework/Session_menu.java b/src/main/java/neo/framework/Session_menu.java
index 7cdf3eb6..49b7247c 100644
--- a/src/main/java/neo/framework/Session_menu.java
+++ b/src/main/java/neo/framework/Session_menu.java
@@ -1,8 +1,3 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
package neo.framework;
import neo.framework.Session_local.fileTIME_T;
@@ -20,8 +15,23 @@ public class Session_menu {
*/
static class idListSaveGameCompare implements cmp_t {
+ /**
+ * Ordinary sort, but with null objects at the end.
+ */
@Override
public int compare(final fileTIME_T a, final fileTIME_T b) {
+ //nulls should come at the end
+ if (null == a) {
+ if (null == b) {
+ return 0;
+ }
+ return 1;
+ }
+
+ if (null == b) {
+ return -1;
+ }
+
return (int) (b.timeStamp - a.timeStamp);
}
};
diff --git a/src/main/java/neo/idlib/Dict_h.java b/src/main/java/neo/idlib/Dict_h.java
index e775d15b..475c018b 100644
--- a/src/main/java/neo/idlib/Dict_h.java
+++ b/src/main/java/neo/idlib/Dict_h.java
@@ -103,6 +103,11 @@ public boolean equals(Object obj) {
return Objects.equals(this.value, other.value);
}
+
+ @Override
+ public String toString() {
+ return "idKeyValue{" + "key=" + key + ", value=" + value + '}';
+ }
}
public static class idDict {
diff --git a/src/main/java/neo/idlib/LangDict.java b/src/main/java/neo/idlib/LangDict.java
index 6391ed2b..8e0ef3c5 100644
--- a/src/main/java/neo/idlib/LangDict.java
+++ b/src/main/java/neo/idlib/LangDict.java
@@ -38,7 +38,7 @@ public static class idLangKeyValue {
public static class idLangDict {
- private idList args = new idList<>();
+ public idList args = new idList<>();
private idHashIndex hash = new idHashIndex();
//
private int baseID;
@@ -96,6 +96,9 @@ public boolean Load(final String fileName, boolean clear) throws idException {
kv.key = tok;
kv.value = tok2;
assert (kv.key.Cmpn(STRTABLE_ID, STRTABLE_ID_LENGTH) == 0);
+// if (tok.equals("#str_07184")) {
+// tok2.oSet("006");
+// }
hash.Add(GetHashKey(kv.key), args.Append(kv));
}
}
@@ -157,11 +160,16 @@ public String AddString(String str) {
return args.oGet(c).key.toString();
}
+ private static int DBG_GetString = 1;
public String GetString(final String str) throws idException {
+ if ("#str_07184".equals(str)) {
+// System.out.printf("GetString#%d\n", DBG_GetString);
+// return (DBG_GetString++) + "bnlaaaaaaaaaaa";
+ }
if (str == null || str.isEmpty()) {
return "";
- }
+ }
if (idStr.Cmpn(str, STRTABLE_ID, STRTABLE_ID_LENGTH) != 0) {
return str;
@@ -191,7 +199,6 @@ public void AddKeyVal(final String key, final String val) {
hash.Add(GetHashKey(kv.key), args.Append(kv));
}
-//
public int GetNumKeyVals() {
return args.Num();
}
diff --git a/src/main/java/neo/idlib/Text/Lexer.java b/src/main/java/neo/idlib/Text/Lexer.java
index 87caf145..aa76414d 100644
--- a/src/main/java/neo/idlib/Text/Lexer.java
+++ b/src/main/java/neo/idlib/Text/Lexer.java
@@ -234,7 +234,7 @@ public static class idLexer {
private int length; // length of the script in bytes
private int line; // current line in script
private int lastline; // line before reading token
- private boolean tokenavailable; // set by unreadToken
+ private boolean tokenAvailable; // set by unreadToken
private long flags; // several script flags
private punctuation_t[] punctuations; // the punctuations used in the script
private int[] punctuationTable; // ASCII table with punctuations
@@ -259,7 +259,7 @@ public idLexer() {
this.length = 0;
this.line = 0;
this.lastline = 0;
- this.tokenavailable = false;
+ this.tokenAvailable = false;
this.token = new idToken();
this.next = null;
this.hadError = false;
@@ -275,7 +275,7 @@ public idLexer(long flags) {
this.length = 0;
this.line = 0;
this.lastline = 0;
- this.tokenavailable = false;
+ this.tokenAvailable = false;
this.token = new idToken();
this.next = null;
this.hadError = false;
@@ -394,7 +394,7 @@ public boolean LoadFile(final String filename, boolean OSPath /*= false*/) throw
// pointer to end of script buffer
this.end_p = this.buffer.length();//(this.buffer[length]);
- this.tokenavailable = false;//0;
+ this.tokenAvailable = false;//0;
this.line = 1;
this.lastline = 1;
this.allocated = true;
@@ -434,7 +434,7 @@ public boolean LoadMemory(final CharBuffer ptr, int length, final String name, i
// pointer to end of script buffer
this.end_p = this.buffer.length();//(this.buffer[length]);
- this.tokenavailable = false;//0;
+ this.tokenAvailable = false;//0;
this.line = startLine;
this.lastline = startLine;
this.allocated = false;
@@ -468,7 +468,7 @@ public void FreeSource() {
this.buffer = null;
this.allocated = false;
}
- this.tokenavailable = false;//0;
+ this.tokenAvailable = false;//0;
this.token = null;
this.loaded = false;
}
@@ -488,8 +488,8 @@ public boolean ReadToken(idToken token) throws idException {
}
// if there is a token available (from unreadToken)
- if (tokenavailable) {
- tokenavailable = false;
+ if (tokenAvailable) {
+ tokenAvailable = false;
token.oSet(this.token);
return true;
}
@@ -800,11 +800,11 @@ public boolean SkipBracedSection(boolean parseFirstBrace) throws idException {
// unread the given token
public void UnreadToken(final idToken token) throws idException {
- if (this.tokenavailable) {
+ if (this.tokenAvailable) {
idLib.common.FatalError("idLexer::unreadToken, unread token twice\n");
}
this.token = token;
- this.tokenavailable = true;
+ this.tokenAvailable = true;
}
// read a token only if on the same line
@@ -1274,7 +1274,7 @@ public void Reset() {
// end of white space
this.whiteSpaceEnd_p = 0;
// set if there's a token available in this.token
- this.tokenavailable = false;
+ this.tokenAvailable = false;
this.line = 1;
this.lastline = 1;
diff --git a/src/main/java/neo/idlib/Text/Str.java b/src/main/java/neo/idlib/Text/Str.java
index 51637af5..77a0f88d 100644
--- a/src/main/java/neo/idlib/Text/Str.java
+++ b/src/main/java/neo/idlib/Text/Str.java
@@ -1063,15 +1063,20 @@ public idStr SetFileExtension(final idStr extension) {
}
public idStr StripFileExtension() {// remove any file extension
- int i;
+ final int i;
- for (i = len - 1; i >= 0; i--) {
- if (data.charAt(i) == '.') {
-// data[i] = '\0';
- len = i;
- data = data.substring(0, len - 1);
- break;
- }
+// for (i = len - 1; i >= 0; i--) {
+// if (data.charAt(i) == '.') {
+//// data[i] = '\0';
+// len = i;
+// data = data.substring(0, len);
+// break;
+// }
+// }
+ i = data.lastIndexOf('.');
+ if (i > -1) {
+ len = i;
+ data = data.substring(0, len);
}
return this;
}
@@ -1414,8 +1419,12 @@ public static int Cmp(final String s1, final String s2) {
char[] s2Array = s2.toCharArray();
int c1 = 0, c2 = 0, d;
- if (s1.length() == 0) {//when s1 is empty.
- return (INTSIGNBITNOTSET(-s2Array[c2]) << 1) - 1;
+ if (s1.isEmpty()) {//when s1 is empty.
+ if(s2.isEmpty()){
+ return 0;
+ }
+ d = 0 - s2Array[c2];
+ return (INTSIGNBITNOTSET(d) << 1) - 1;
}
do {
@@ -2603,7 +2612,7 @@ protected void Init() {
alloced = STR_ALLOC_BASE;
// data = baseBuffer;
// data[ 0 ] = '\0';
- data = "\0";
+ data = "";
//#ifdef ID_DEBUG_UNINITIALIZED_MEMORY
// memset( baseBuffer, 0, sizeof( baseBuffer ) );
//#endif
diff --git a/src/main/java/neo/idlib/containers/StrPool.java b/src/main/java/neo/idlib/containers/StrPool.java
index 119f0c74..f37cb9a0 100644
--- a/src/main/java/neo/idlib/containers/StrPool.java
+++ b/src/main/java/neo/idlib/containers/StrPool.java
@@ -111,6 +111,7 @@ public idPoolStr AllocString(final String string) {
for (i = poolHash.First(hash); i != -1; i = poolHash.Next(i)) {
if (pool.oGet(i).Icmp(string) == 0) {
pool.oGet(i).numUsers++;
+// System.out.printf("AllocString, i = %d\n", i);
return pool.oGet(i);
}
}
diff --git a/src/main/java/neo/idlib/math/Matrix/idMat0.java b/src/main/java/neo/idlib/math/Matrix/idMat0.java
index c0190f54..26a2b7fe 100644
--- a/src/main/java/neo/idlib/math/Matrix/idMat0.java
+++ b/src/main/java/neo/idlib/math/Matrix/idMat0.java
@@ -1,8 +1,3 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
package neo.idlib.math.Matrix;
/**
@@ -11,7 +6,7 @@
public class idMat0 {
public static final double MATRIX_INVERSE_EPSILON = 1.0E-14;
- public static final double MATRIX_EPSILON = 1.0E-6;//TODO: re-type to float.
+ public static final double MATRIX_EPSILON = 1.0E-6;//TODO: re-type to float.
public static void matrixPrint(idMatX x, String label) {
int rows = x.GetNumRows();
diff --git a/src/main/java/neo/idlib/math/Matrix/idMat2.java b/src/main/java/neo/idlib/math/Matrix/idMat2.java
index 770110e4..9abbca17 100644
--- a/src/main/java/neo/idlib/math/Matrix/idMat2.java
+++ b/src/main/java/neo/idlib/math/Matrix/idMat2.java
@@ -1,8 +1,3 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
package neo.idlib.math.Matrix;
import java.util.Arrays;
diff --git a/src/main/java/neo/idlib/math/Matrix/idMat3.java b/src/main/java/neo/idlib/math/Matrix/idMat3.java
index e5307af6..05657387 100644
--- a/src/main/java/neo/idlib/math/Matrix/idMat3.java
+++ b/src/main/java/neo/idlib/math/Matrix/idMat3.java
@@ -1,8 +1,3 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
package neo.idlib.math.Matrix;
import java.io.Serializable;
diff --git a/src/main/java/neo/idlib/math/Matrix/idMat4.java b/src/main/java/neo/idlib/math/Matrix/idMat4.java
index d3f5e80d..2f0db807 100644
--- a/src/main/java/neo/idlib/math/Matrix/idMat4.java
+++ b/src/main/java/neo/idlib/math/Matrix/idMat4.java
@@ -1,8 +1,3 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
package neo.idlib.math.Matrix;
import java.util.Arrays;
diff --git a/src/main/java/neo/idlib/math/Matrix/idMat5.java b/src/main/java/neo/idlib/math/Matrix/idMat5.java
index 896d5222..ba98d9f6 100644
--- a/src/main/java/neo/idlib/math/Matrix/idMat5.java
+++ b/src/main/java/neo/idlib/math/Matrix/idMat5.java
@@ -1,8 +1,3 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
package neo.idlib.math.Matrix;
import java.util.Arrays;
diff --git a/src/main/java/neo/idlib/math/Matrix/idMat6.java b/src/main/java/neo/idlib/math/Matrix/idMat6.java
index 925651b8..c25233c0 100644
--- a/src/main/java/neo/idlib/math/Matrix/idMat6.java
+++ b/src/main/java/neo/idlib/math/Matrix/idMat6.java
@@ -1,8 +1,3 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
package neo.idlib.math.Matrix;
import java.util.Arrays;
diff --git a/src/main/java/neo/idlib/math/Matrix/idMatX.java b/src/main/java/neo/idlib/math/Matrix/idMatX.java
index 12483f14..9c37dc22 100644
--- a/src/main/java/neo/idlib/math/Matrix/idMatX.java
+++ b/src/main/java/neo/idlib/math/Matrix/idMatX.java
@@ -1,8 +1,3 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
package neo.idlib.math.Matrix;
import java.util.Arrays;
diff --git a/src/main/java/neo/idlib/math/Simd.java b/src/main/java/neo/idlib/math/Simd.java
index 99fc0c39..3acec4fc 100644
--- a/src/main/java/neo/idlib/math/Simd.java
+++ b/src/main/java/neo/idlib/math/Simd.java
@@ -1,5 +1,6 @@
package neo.idlib.math;
+import java.nio.FloatBuffer;
import java.util.Arrays;
import neo.Renderer.Model.dominantTri_s;
import neo.TempDump.TODO_Exception;
@@ -458,7 +459,13 @@ public void CreateVertexProgramShadowCache(idVec4 vertexCache, final idDrawVert[
public abstract void /*VPCALL*/ UpSamplePCMTo44kHz(float[] dest, final short[] pcm, final int numSamples, final int kHz, final int numChannels);
- public abstract void /*VPCALL*/ UpSampleOGGTo44kHz(float[] dest, final float[][] ogg, final int numSamples, final int kHz, final int numChannels);
+ public void /*VPCALL*/ UpSampleOGGTo44kHz(float[] dest, final float[][] ogg, final int numSamples, final int kHz, final int numChannels) {
+ this.UpSampleOGGTo44kHz(dest, 0, ogg, numSamples, kHz, numChannels);
+ }
+
+ public abstract void /*VPCALL*/ UpSampleOGGTo44kHz(float[] dest, int offset, final float[][] ogg, final int numSamples, final int kHz, final int numChannels);
+
+ public abstract void /*VPCALL*/ UpSampleOGGTo44kHz(FloatBuffer dest, int offset, final float[][] ogg, final int numSamples, final int kHz, final int numChannels);
public abstract void /*VPCALL*/ MixSoundTwoSpeakerMono(float[] mixBuffer, final float[] samples, final int numSamples, final float lastV[], final float currentV[]);
diff --git a/src/main/java/neo/idlib/math/Simd_Generic.java b/src/main/java/neo/idlib/math/Simd_Generic.java
index cca87316..008cd28d 100644
--- a/src/main/java/neo/idlib/math/Simd_Generic.java
+++ b/src/main/java/neo/idlib/math/Simd_Generic.java
@@ -1,5 +1,6 @@
package neo.idlib.math;
+import java.nio.FloatBuffer;
import java.util.Arrays;
import neo.Renderer.Model.dominantTri_s;
import neo.idlib.geometry.DrawVert.idDrawVert;
@@ -3066,42 +3067,94 @@ public void UpSamplePCMTo44kHz(float[] dest, short[] pcm, int numSamples, int kH
============
*/
@Override
- public void UpSampleOGGTo44kHz(float[] dest, float[][] ogg, int numSamples, int kHz, int numChannels) {
+ public void UpSampleOGGTo44kHz(float[] dest, int offset, float[][] ogg, int numSamples, int kHz, int numChannels) {
if (kHz == 11025) {
if (numChannels == 1) {
for (int i = 0; i < numSamples; i++) {
- dest[i * 4 + 0] = dest[i * 4 + 1] = dest[i * 4 + 2] = dest[i * 4 + 3] = ogg[0][i] * 32768.0f;
+ dest[offset + (i * 4 + 0)] = dest[offset + (i * 4 + 1)] = dest[offset + (i * 4 + 2)] = dest[offset + (i * 4 + 3)] = ogg[0][i] * 32768.0f;
}
} else {
for (int i = 0; i < numSamples >> 1; i++) {
- dest[i * 8 + 0] = dest[i * 8 + 2] = dest[i * 8 + 4] = dest[i * 8 + 6] = ogg[0][i] * 32768.0f;
- dest[i * 8 + 1] = dest[i * 8 + 3] = dest[i * 8 + 5] = dest[i * 8 + 7] = ogg[1][i] * 32768.0f;
+ dest[offset + (i * 8 + 0)] = dest[offset + (i * 8 + 2)] = dest[offset + (i * 8 + 4)] = dest[offset + (i * 8 + 6)] = ogg[0][i] * 32768.0f;
+ dest[offset + (i * 8 + 1)] = dest[offset + (i * 8 + 3)] = dest[offset + (i * 8 + 5)] = dest[offset + (i * 8 + 7)] = ogg[1][i] * 32768.0f;
}
}
} else if (kHz == 22050) {
if (numChannels == 1) {
for (int i = 0; i < numSamples; i++) {
- dest[i * 2 + 0] = dest[i * 2 + 1] = ogg[0][i] * 32768.0f;
+ dest[offset + (i * 2 + 0)] = dest[offset + (i * 2 + 1)] = ogg[0][i] * 32768.0f;
}
} else {
for (int i = 0; i < numSamples >> 1; i++) {
- dest[i * 4 + 0] = dest[i * 4 + 2] = ogg[0][i] * 32768.0f;
- dest[i * 4 + 1] = dest[i * 4 + 3] = ogg[1][i] * 32768.0f;
+ dest[offset + (i * 4 + 0)] = dest[offset + (i * 4 + 2)] = ogg[0][i] * 32768.0f;
+ dest[offset + (i * 4 + 1)] = dest[offset + (i * 4 + 3)] = ogg[1][i] * 32768.0f;
}
}
} else if (kHz == 44100) {
if (numChannels == 1) {
for (int i = 0; i < numSamples; i++) {
- dest[i * 1 + 0] = ogg[0][i] * 32768.0f;
+ dest[offset + (i * 1 + 0)] = ogg[0][i] * 32768.0f;
}
} else {
for (int i = 0; i < numSamples >> 1; i++) {
- dest[i * 2 + 0] = ogg[0][i] * 32768.0f;
- dest[i * 2 + 1] = ogg[1][i] * 32768.0f;
+ dest[offset + (i * 2 + 0)] = ogg[0][i] * 32768.0f;
+ dest[offset + (i * 2 + 1)] = ogg[1][i] * 32768.0f;
+ }
+ }
+ } else {
+ assert (false);
+ }
+ }
+
+ @Override
+ public void UpSampleOGGTo44kHz(FloatBuffer dest, int offset, float[][] ogg, int numSamples, int kHz, int numChannels) {
+ offset += dest.position();
+ if (kHz == 11025) {
+ if (numChannels == 1) {
+ for (int i = 0; i < numSamples; i++) {
+ dest.put(offset + (i * 4 + 0), ogg[0][i] * 32768.0f)
+ .put(offset + (i * 4 + 1), ogg[0][i] * 32768.0f)
+ .put(offset + (i * 4 + 2), ogg[0][i] * 32768.0f)
+ .put(offset + (i * 4 + 3), ogg[0][i] * 32768.0f);
+ }
+ } else {
+ for (int i = 0; i < numSamples >> 1; i++) {
+ dest.put(offset + (i * 8 + 0), ogg[0][i] * 32768.0f)
+ .put(offset + (i * 8 + 2), ogg[0][i] * 32768.0f)
+ .put(offset + (i * 8 + 4), ogg[0][i] * 32768.0f)
+ .put(offset + (i * 8 + 6), ogg[0][i] * 32768.0f);
+ dest.put(offset + (i * 8 + 1), ogg[1][i] * 32768.0f)
+ .put(offset + (i * 8 + 3), ogg[1][i] * 32768.0f)
+ .put(offset + (i * 8 + 5), ogg[1][i] * 32768.0f)
+ .put(offset + (i * 8 + 7), ogg[1][i] * 32768.0f);
+ }
+ }
+ } else if (kHz == 22050) {
+ if (numChannels == 1) {
+ for (int i = 0; i < numSamples; i++) {
+ dest.put(offset + (i * 2 + 0), ogg[0][i] * 32768.0f)
+ .put(offset + (i * 2 + 1), ogg[0][i] * 32768.0f);
+ }
+ } else {
+ for (int i = 0; i < numSamples >> 1; i++) {
+ dest.put(offset + (i * 4 + 0), ogg[0][i] * 32768.0f)
+ .put(offset + (i * 4 + 2), ogg[0][i] * 32768.0f);
+ dest.put(offset + (i * 4 + 1), ogg[1][i] * 32768.0f)
+ .put(offset + (i * 4 + 3), ogg[1][i] * 32768.0f);
+ }
+ }
+ } else if (kHz == 44100) {
+ if (numChannels == 1) {
+ for (int i = 0; i < numSamples; i++) {
+ dest.put(offset + (i * 1 + 0), ogg[0][i] * 32768.0f);
+ }
+ } else {
+ for (int i = 0; i < numSamples >> 1; i++) {
+ dest.put(offset + (i * 2 + 0), ogg[0][i] * 32768.0f)
+ .put(offset + (i * 2 + 1), ogg[1][i] * 32768.0f);
}
}
} else {
-// assert( 0 );
assert (false);
}
}
diff --git a/src/main/java/neo/idlib/math/Simd_SSE.java b/src/main/java/neo/idlib/math/Simd_SSE.java
index 053bd8ea..0203e7f3 100644
--- a/src/main/java/neo/idlib/math/Simd_SSE.java
+++ b/src/main/java/neo/idlib/math/Simd_SSE.java
@@ -1,8 +1,3 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
package neo.idlib.math;
import neo.idlib.math.Simd_MMX.idSIMD_MMX;
diff --git a/src/main/java/neo/sys/RC/CreateResourceIDs_f.java b/src/main/java/neo/sys/RC/CreateResourceIDs_f.java
index 8190c925..69a1416b 100644
--- a/src/main/java/neo/sys/RC/CreateResourceIDs_f.java
+++ b/src/main/java/neo/sys/RC/CreateResourceIDs_f.java
@@ -1,8 +1,3 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
package neo.sys.RC;
import neo.TempDump.TODO_Exception;
diff --git a/src/main/java/neo/sys/RC/doom_resource.java b/src/main/java/neo/sys/RC/doom_resource.java
index 75c6c012..6c4cc543 100644
--- a/src/main/java/neo/sys/RC/doom_resource.java
+++ b/src/main/java/neo/sys/RC/doom_resource.java
@@ -1,8 +1,3 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
package neo.sys.RC;
import java.awt.Image;
diff --git a/src/main/java/neo/sys/win_cpu.java b/src/main/java/neo/sys/win_cpu.java
index 02a929cc..2798bc0b 100644
--- a/src/main/java/neo/sys/win_cpu.java
+++ b/src/main/java/neo/sys/win_cpu.java
@@ -1,8 +1,3 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
package neo.sys;
import java.io.BufferedReader;
diff --git a/src/main/java/neo/sys/win_glimp.java b/src/main/java/neo/sys/win_glimp.java
index 936f48fa..379b3e24 100644
--- a/src/main/java/neo/sys/win_glimp.java
+++ b/src/main/java/neo/sys/win_glimp.java
@@ -1,8 +1,3 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
package neo.sys;
import java.io.IOException;
@@ -97,7 +92,7 @@ public int compare(DisplayMode o1, DisplayMode o2) {
// return false;
// }
if (devmode.getWidth() >= parms.width
- && (int) devmode.getHeight() >= parms.height
+ && devmode.getHeight() >= parms.height
&& devmode.getBitsPerPixel() == 32) {
matched = true;
@@ -127,8 +122,8 @@ public int compare(DisplayMode o1, DisplayMode o2) {
// try setting the exact mode requested, because some drivers don't report
// the low res modes in EnumDisplaySettings, but still work
if (dm != null) {
- Display.setDisplayModeAndFullscreen(dm);
-// Display.setDisplayMode(dm);//TODO: change this back to setDisplayModeAndFullscreen.
+// Display.setDisplayModeAndFullscreen(dm);
+ Display.setDisplayMode(dm);//TODO: change this back to setDisplayModeAndFullscreen.
Display.setVSyncEnabled(true);
Display.setTitle("BLAAAAAAAAAAAAAAAAAArrrGGGGHH!!");
if (Display.getDisplayMode().equals(dm)) {
diff --git a/src/main/java/neo/sys/win_input.java b/src/main/java/neo/sys/win_input.java
index 04b488b2..ccb65b48 100644
--- a/src/main/java/neo/sys/win_input.java
+++ b/src/main/java/neo/sys/win_input.java
@@ -1,8 +1,3 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
package neo.sys;
import java.awt.event.InputEvent;
@@ -1135,8 +1130,7 @@ public static void Sys_EndMouseInputEvents() {
}
public static char Sys_MapCharForKey(int key) {
- throw new TODO_Exception();
-// return (unsigned char)key;
+ return (char) (key & 0xFF);
}
}
diff --git a/src/main/java/neo/sys/win_main.java b/src/main/java/neo/sys/win_main.java
index 0c328bd5..c6c65449 100644
--- a/src/main/java/neo/sys/win_main.java
+++ b/src/main/java/neo/sys/win_main.java
@@ -1,8 +1,3 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
package neo.sys;
import java.awt.Toolkit;
@@ -21,6 +16,7 @@
import java.util.concurrent.locks.ReentrantLock;
import java.util.logging.Level;
import java.util.logging.Logger;
+import neo.Sound.snd_decoder;
import static neo.TempDump.NOT;
import neo.TempDump.TODO_Exception;
import static neo.TempDump.atobb;
@@ -82,8 +78,6 @@
import static neo.sys.sys_public.MAX_CRITICAL_SECTIONS;
import static neo.sys.sys_public.MAX_THREADS;
import static neo.sys.sys_public.TRIGGER_EVENT_ZERO;
-import static neo.sys.sys_public.g_thread_count;
-import static neo.sys.sys_public.g_threads;
import neo.sys.sys_public.sysEventType_t;
import static neo.sys.sys_public.sysEventType_t.SE_CONSOLE;
import neo.sys.sys_public.sysEvent_s;
@@ -96,7 +90,6 @@
import static neo.sys.win_cpu.Sys_ClockTicksPerSecond;
import static neo.sys.win_cpu.Sys_GetCPUId;
import static neo.sys.win_glimp.GLimp_Shutdown;
-import static neo.sys.win_input.IN_Frame;
import static neo.sys.win_input.Sys_InitInput;
import static neo.sys.win_input.Sys_ShutdownInput;
import neo.sys.win_local.Win32Vars_t;
@@ -131,7 +124,7 @@ public class win_main {//TODO: rename to plain "main" or something.
static final StringBuilder sys_cmdline = new StringBuilder(MAX_STRING_CHARS);
static xthreadInfo threadInfo;
- static ScheduledExecutorService /*HANDLE*/ hTimer;
+ public static ScheduledExecutorService /*HANDLE*/ hTimer;
static /*unsigned*/ int debug_total_alloc = 0;
static /*unsigned*/ int debug_total_alloc_count = 0;
@@ -225,18 +218,14 @@ public static String Sys_GetThreadName(int[] index) {
Sys_EnterCriticalSection
==================
*/
- @Deprecated
- public static void Sys_EnterCriticalSection(int index) {
+ public static boolean Sys_EnterCriticalSection(int index) {
assert (index >= 0 && index < MAX_CRITICAL_SECTIONS);
- if (win32.criticalSections[index].tryLock()) {
- win32.criticalSections[index].lock();
// Sys_DebugPrintf( "busy lock '%s' in thread '%s'\n", lock->name, Sys_GetThreadName() );
- }
+ return win32.criticalSections[index].tryLock();
}
- @Deprecated
- public static void Sys_EnterCriticalSection() {
- Sys_EnterCriticalSection(CRITICAL_SECTION_ZERO);
+ public static boolean Sys_EnterCriticalSection() {
+ return Sys_EnterCriticalSection(CRITICAL_SECTION_ZERO);
}
/*
@@ -244,13 +233,13 @@ public static void Sys_EnterCriticalSection() {
Sys_LeaveCriticalSection
==================
*/
- @Deprecated
public static void Sys_LeaveCriticalSection(int index) {
assert (index >= 0 && index < MAX_CRITICAL_SECTIONS);
- win32.criticalSections[index].unlock();
+ if (((ReentrantLock) win32.criticalSections[index]).isLocked()) {
+ win32.criticalSections[index].unlock();
+ }
}
- @Deprecated
public static void Sys_LeaveCriticalSection() {
Sys_LeaveCriticalSection(CRITICAL_SECTION_ZERO);
}
@@ -829,7 +818,7 @@ public static void Sys_GenerateEvents() {
// Sys_PumpEvents();
//
// make sure mouse and joystick are only called once a frame
- IN_Frame();
+// IN_Frame();//TODO:do we need this function?
// check for console commands
s = Sys_ConsoleInput();
@@ -969,7 +958,12 @@ public static void Sys_StartAsyncThread() {
@Override
public void run() {
// if (!DEBUG) {//TODO:Session_local.java::742
- common.Async();
+ try {
+ common.Async();
+ } catch (Exception e) {
+ Logger.getLogger(win_main.class.getName()).log(Level.SEVERE, null, e);
+ System.err.println("AsyncThread terminated.");
+ }
// }
}
}, 0, USERCMD_MSEC, TimeUnit.MILLISECONDS);
diff --git a/src/main/java/neo/sys/win_net.java b/src/main/java/neo/sys/win_net.java
index c90dbe37..8fe2c7e2 100644
--- a/src/main/java/neo/sys/win_net.java
+++ b/src/main/java/neo/sys/win_net.java
@@ -1,8 +1,3 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
package neo.sys;
import java.net.Inet6Address;
@@ -30,13 +25,13 @@
public class win_net {
// static WSADATA winsockdata;
- static boolean winsockInitialized = false;
- static boolean usingSocks = false;
+ static boolean winsockInitialized = false;
+ static boolean usingSocks = false;
- static final idCVar net_ip = new idCVar("net_ip", "localhost", CVAR_SYSTEM, "local IP address");
- static final idCVar net_port = new idCVar("net_port", "0", CVAR_SYSTEM | CVAR_INTEGER, "local IP port number");
- static final idCVar net_forceLatency = new idCVar("net_forceLatency", "0", CVAR_SYSTEM | CVAR_INTEGER, "milliseconds latency");
- static final idCVar net_forceDrop = new idCVar("net_forceDrop", "0", CVAR_SYSTEM | CVAR_INTEGER, "percentage packet loss");
+ static final idCVar net_ip = new idCVar("net_ip", "localhost", CVAR_SYSTEM, "local IP address");
+ static final idCVar net_port = new idCVar("net_port", "0", CVAR_SYSTEM | CVAR_INTEGER, "local IP port number");
+ static final idCVar net_forceLatency = new idCVar("net_forceLatency", "0", CVAR_SYSTEM | CVAR_INTEGER, "milliseconds latency");
+ static final idCVar net_forceDrop = new idCVar("net_forceDrop", "0", CVAR_SYSTEM | CVAR_INTEGER, "percentage packet loss");
static final idCVar net_socksEnabled = new idCVar("net_socksEnabled", "0", CVAR_SYSTEM | CVAR_ARCHIVE | CVAR_BOOL, "");
static final idCVar net_socksServer = new idCVar("net_socksServer", "", CVAR_SYSTEM | CVAR_ARCHIVE, "");
diff --git a/src/main/java/neo/sys/win_shared.java b/src/main/java/neo/sys/win_shared.java
index c217515f..cceb08bc 100644
--- a/src/main/java/neo/sys/win_shared.java
+++ b/src/main/java/neo/sys/win_shared.java
@@ -1,8 +1,3 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
package neo.sys;
import com.sun.management.OperatingSystemMXBean;
diff --git a/src/main/java/neo/sys/win_snd.java b/src/main/java/neo/sys/win_snd.java
index 959ef8bb..04f0b5ef 100644
--- a/src/main/java/neo/sys/win_snd.java
+++ b/src/main/java/neo/sys/win_snd.java
@@ -1,12 +1,9 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
package neo.sys;
import java.util.logging.Level;
import java.util.logging.Logger;
+import javax.sound.sampled.SourceDataLine;
+import static neo.Sound.snd_local.PRIMARYFREQ;
import neo.Sound.snd_local.idAudioHardware;
import neo.Sound.snd_system.idSoundSystemLocal;
import neo.TempDump.TODO_Exception;
@@ -33,19 +30,113 @@ public static class idAudioHardwareWIN32 extends idAudioHardware {
private int blockAlign; // channels * bits per sample / 8: sound frame size
public idAudioHardwareWIN32() {
-
}
// ~idAudioHardwareWIN32();
-// public boolean Initialize( );
// public boolean InitializeSpeakers( byte *buffer, int bufferSize, dword dwPrimaryFreq, dword dwPrimaryBitRate, dword dwSpeakers );
-// public void SetPrimaryBufferFormat( dword dwPrimaryFreq, dword dwPrimaryBitRate, dword dwSpeakers );
+
+ /*
+ ===============
+ idAudioHardwareWIN32::SetPrimaryBufferFormat
+ Set primary buffer to a specified format
+ For example, to set the primary buffer format to 22kHz stereo, 16-bit
+ then: dwPrimaryChannels = 2
+ dwPrimaryFreq = 22050,
+ dwPrimaryBitRate = 16
+ ===============
+ */
+ public void SetPrimaryBufferFormat(int dwPrimaryFreq, int dwPrimaryBitRate, int dwSpeakers) {
+// HRESULT hr;
+//
+// if( m_pDS == null ) {
+// return;
+// }
+//
+// ulong cfgSpeakers;
+// m_pDS->GetSpeakerConfig( &cfgSpeakers );
+//
+// DSCAPS dscaps;
+// dscaps.dwSize = sizeof(DSCAPS);
+// m_pDS->GetCaps(&dscaps);
+//
+// if (dscaps.dwFlags & DSCAPS_EMULDRIVER) {
+// return;
+// }
+//
+// // Get the primary buffer
+// DSBUFFERDESC dsbd;
+// ZeroMemory( &dsbd, sizeof(DSBUFFERDESC) );
+// dsbd.dwSize = sizeof(DSBUFFERDESC);
+// dsbd.dwFlags = DSBCAPS_PRIMARYBUFFER;
+// dsbd.dwBufferBytes = 0;
+// dsbd.lpwfxFormat = NULL;
+//
+// // Obtain write-primary cooperative level.
+// if( FAILED( hr = m_pDS->SetCooperativeLevel(win32.hWnd, DSSCL_PRIORITY ) ) ) {
+// DXTRACE_ERR( TEXT("SetPrimaryBufferFormat"), hr );
+// return;
+// }
+//
+// if( FAILED( hr = m_pDS->CreateSoundBuffer( &dsbd, &pDSBPrimary, NULL ) ) ) {
+// return;
+// }
+//
+// if ( dwSpeakers == 6 && (cfgSpeakers == DSSPEAKER_5POINT1 || cfgSpeakers == DSSPEAKER_SURROUND) ) {
+// WAVEFORMATEXTENSIBLE waveFormatPCMEx;
+// ZeroMemory( &waveFormatPCMEx, sizeof(WAVEFORMATEXTENSIBLE) );
+//
+// waveFormatPCMEx.Format.wFormatTag = WAVE_FORMAT_EXTENSIBLE;
+// waveFormatPCMEx.Format.nChannels = 6;
+// waveFormatPCMEx.Format.nSamplesPerSec = dwPrimaryFreq;
+// waveFormatPCMEx.Format.wBitsPerSample = (WORD) dwPrimaryBitRate;
+// waveFormatPCMEx.Format.nBlockAlign = waveFormatPCMEx.Format.wBitsPerSample / 8 * waveFormatPCMEx.Format.nChannels;
+// waveFormatPCMEx.Format.nAvgBytesPerSec = waveFormatPCMEx.Format.nSamplesPerSec * waveFormatPCMEx.Format.nBlockAlign;
+// waveFormatPCMEx.dwChannelMask = KSAUDIO_SPEAKER_5POINT1;
+// // SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT |
+// // SPEAKER_FRONT_CENTER | SPEAKER_LOW_FREQUENCY |
+// // SPEAKER_BACK_LEFT | SPEAKER_BACK_RIGHT
+// waveFormatPCMEx.SubFormat = KSDATAFORMAT_SUBTYPE_PCM; // Specify PCM
+// waveFormatPCMEx.Format.cbSize = sizeof(WAVEFORMATEXTENSIBLE);
+// waveFormatPCMEx.Samples.wValidBitsPerSample = 16;
+//
+// if( FAILED( hr = pDSBPrimary->SetFormat((WAVEFORMATEX*)&waveFormatPCMEx) ) ) {
+// DXTRACE_ERR( TEXT("SetPrimaryBufferFormat"), hr );
+// return;
+// }
+// numSpeakers = 6; // force it to think 5.1
+// blockAlign = waveFormatPCMEx.Format.nBlockAlign;
+// } else {
+// if (dwSpeakers == 6) {
+// common->Printf("sound: hardware reported unable to use multisound, defaulted to stereo\n");
+// }
+// WAVEFORMATEX wfx;
+// ZeroMemory( &wfx, sizeof(WAVEFORMATEX) );
+// wfx.wFormatTag = WAVE_FORMAT_PCM;
+// wfx.nChannels = 2;
+// wfx.nSamplesPerSec = dwPrimaryFreq;
+// wfx.wBitsPerSample = (WORD) dwPrimaryBitRate;
+// wfx.nBlockAlign = wfx.wBitsPerSample / 8 * wfx.nChannels;
+// wfx.nAvgBytesPerSec = wfx.nSamplesPerSec * wfx.nBlockAlign;
+// wfx.cbSize = sizeof(WAVEFORMATEX);
+//
+// if( FAILED( hr = pDSBPrimary->SetFormat(&wfx) ) ) {
+// return;
+// }
+// numSpeakers = 2; // force it to think stereo
+// blockAlign = wfx.nBlockAlign;
+// }
+//
+// byte *speakerData;
+// bufferSize = MIXBUFFER_SAMPLES * sizeof(word) * numSpeakers * ROOM_SLICES_IN_BUFFER;
+// speakerData = (byte *)Mem_Alloc( bufferSize );
+// memset( speakerData, 0, bufferSize );
+//
+// InitializeSpeakers( speakerData, bufferSize, dwPrimaryFreq, dwPrimaryBitRate, numSpeakers );
+ }
// public int Create( idWaveFile* pWaveFile, idAudioBuffer** ppiab );
// public int Create( idAudioBuffer** ppSound, const char* strWaveFileName, dword dwCreationFlags = 0 );
// public int CreateFromMemory( idAudioBufferWIN32** ppSound, byte* pbData, ulong ulDataSize, waveformatextensible_t *pwfx, dword dwCreationFlags = 0 );
-// public boolean Lock( void **pDSLockedBuffer, ulong *dwDSLockedBufferSize );
-// public boolean Unlock( void *pDSLockedBuffer, dword dwDSLockedBufferSize );
-// public boolean GetCurrentPosition( ulong *pdwCurrentWriteCursor );
+
@Override
public int GetNumberOfSpeakers() {
return numSpeakers;
@@ -73,30 +164,26 @@ public short[] GetMixBuffer() {
@Override
public boolean Initialize() {
- try {
- AL.create(/*null, PRIMARYFREQ, idSoundSystemLocal.s_numberOfSpeakers.GetInteger(), false*/);
// throw new TODO_Exception();
-// int hr;
-//
-// bufferSize = 0;
-// numSpeakers = 0;
-// blockAlign = 0;
+ SourceDataLine dataLine;//for streaming
+ int hr;
+// AudioInputStream audioInputStream = AudioSystem.getAudioInputStream(null);
+// dataLine.
//
-// SAFE_RELEASE( m_pDS );
+// bufferSize = 0;
+// numSpeakers = 0;
+// blockAlign = 0;
//
-// // Create IDirectSound using the primary sound device
-// if( FAILED( hr = DirectSoundCreate( NULL, &m_pDS, NULL ) )) {
-// return false;
-// }
+// SAFE_RELEASE(m_pDS);
//
-// // Set primary buffer format
-// SetPrimaryBufferFormat( PRIMARYFREQ, 16, idSoundSystemLocal::s_numberOfSpeakers.GetInteger() );
-// return true;
- } catch (LWJGLException ex) {
- Logger.getLogger(win_snd.class.getName()).log(Level.SEVERE, null, ex);
- }
+// // Create IDirectSound using the primary sound device
+// if (FAILED(hr = DirectSoundCreate(NULL, & m_pDS, null))) {
+// return false;
+// }
- return AL.isCreated();
+ // Set primary buffer format
+ SetPrimaryBufferFormat(PRIMARYFREQ, 16, idSoundSystemLocal.s_numberOfSpeakers.GetInteger());
+ return true;
}
@Override
diff --git a/src/main/java/neo/sys/win_syscon.java b/src/main/java/neo/sys/win_syscon.java
index 1c2d1f7b..cdc2b9f9 100644
--- a/src/main/java/neo/sys/win_syscon.java
+++ b/src/main/java/neo/sys/win_syscon.java
@@ -1,8 +1,3 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
package neo.sys;
import java.awt.Color;
@@ -41,15 +36,15 @@
*/
public class win_syscon {
- static final int COPY_ID = 1;
- static final int QUIT_ID = 2;
- static final int CLEAR_ID = 3;
+ static final int COPY_ID = 1;
+ static final int QUIT_ID = 2;
+ static final int CLEAR_ID = 3;
static final int ERRORBOX_ID = 10;
static final int ERRORTEXT_ID = 11;
- static final int EDIT_ID = 100;
- static final int INPUT_ID = 101;
+ static final int EDIT_ID = 100;
+ static final int INPUT_ID = 101;
static final int COMMAND_HISTORY = 64;
@@ -588,6 +583,7 @@ void Sys_CreateConsole( void ) {
}
}
*/
+
/**
* ******
*
@@ -642,7 +638,7 @@ public static void Sys_ShowConsole(int visLevel, boolean quitOnClose) {
** Sys_ConsoleInput
*/
static String Sys_ConsoleInput() {
- throw new TODO_Exception();
+ return null;
//
// if ( s_wcd.consoleText[0] == 0 ) {
// return NULL;
diff --git a/src/main/java/neo/sys/win_wndproc.java b/src/main/java/neo/sys/win_wndproc.java
index 89ff57ab..539155b0 100644
--- a/src/main/java/neo/sys/win_wndproc.java
+++ b/src/main/java/neo/sys/win_wndproc.java
@@ -1,8 +1,3 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
package neo.sys;
diff --git a/src/main/java/neo/ui/BindWindow.java b/src/main/java/neo/ui/BindWindow.java
index 02521dcd..cb15507e 100644
--- a/src/main/java/neo/ui/BindWindow.java
+++ b/src/main/java/neo/ui/BindWindow.java
@@ -77,7 +77,7 @@ public String HandleEvent(sysEvent_s event, boolean[] updateVisuals) {
@Override
public void PostParse() {
super.PostParse();
- bindName.SetGuiInfo(gui.GetStateDict(), bindName.toString());
+ bindName.SetGuiInfo(gui.GetStateDict(), bindName.c_str());
bindName.Update();
//bindName = state.GetString("bind");
flags |= (WIN_HOLDCAPTURE | WIN_CANFOCUS);
diff --git a/src/main/java/neo/ui/GuiScript.java b/src/main/java/neo/ui/GuiScript.java
index 0328962b..7ba8be60 100644
--- a/src/main/java/neo/ui/GuiScript.java
+++ b/src/main/java/neo/ui/GuiScript.java
@@ -467,26 +467,24 @@ public static Handler getInstance() {
@Override
public void run(idWindow window, idList src) {
scriptSetTotal++;
- String[] key, val = {null};
+ String key, val;
idWinStr dest = (idWinStr) dynamic_cast(idWinStr.class, src.oGet(0).var);
if (dest != null) {
if (idStr.Icmp(dest.data, "cmd") == 0) {
dest = (idWinStr) src.oGet(1).var;
int parmCount = src.Num();
if (parmCount > 2) {
- val[0] = dest.c_str();
+ val = dest.c_str();
int i = 2;
while (i < parmCount) {
- val[0] += " \"";
- val[0] += src.oGet(i).var.c_str();
- val[0] += "\"";
+ val += " \"";
+ val += src.oGet(i).var.c_str();
+ val += "\"";
i++;
}
window.AddCommand(val);
} else {
- String[] d = {dest.data.toString()};
- window.AddCommand(d);
- dest.data.oSet(d[0]);
+ window.AddCommand(dest.data.toString());
}
return;
}
diff --git a/src/main/java/neo/ui/RegExp.java b/src/main/java/neo/ui/RegExp.java
index 4b8962ef..1bf96036 100644
--- a/src/main/java/neo/ui/RegExp.java
+++ b/src/main/java/neo/ui/RegExp.java
@@ -29,6 +29,7 @@
import neo.ui.Winvar.idWinFloat;
import neo.ui.Winvar.idWinInt;
import neo.ui.Winvar.idWinRectangle;
+import neo.ui.Winvar.idWinStr;
import neo.ui.Winvar.idWinVar;
import neo.ui.Winvar.idWinVec2;
import neo.ui.Winvar.idWinVec3;
@@ -58,6 +59,7 @@ public enum REGTYPE {
public int regCount;
public /*unsigned*/ final short[] regs = new short[4];
public idWinVar var;
+ public boolean DBG_D3_KEY = false;
//
//
@@ -273,6 +275,9 @@ public void AddReg(final String name, int type, idParser src, idWindow win, idWi
if (type == idRegister.REGTYPE.STRING.ordinal()) {
idToken tok = new idToken();
if (src.ReadToken(tok)) {
+ if("#str_07184".equals(tok.toString())){
+ reg.DBG_D3_KEY = true;
+ }
tok.oSet(common.GetLanguageDict().GetString(tok.toString()));
var.Init(tok.toString(), win);
}
@@ -318,12 +323,12 @@ public void AddReg(final String name, int type, idVec4 data, idWindow win, idWin
regHash.Add(hash, regs.Append(reg));
}
}
-//
public idRegister FindReg(final String name) {
int hash = regHash.GenerateKey(name, false);
for (int i = regHash.First(hash); i != -1; i = regHash.Next(i)) {
if (regs.oGet(i).name.Icmp(name) == 0) {
+// System.out.println(regs.oGet(i));
return regs.oGet(i);
}
}
diff --git a/src/main/java/neo/ui/Window.java b/src/main/java/neo/ui/Window.java
index 59924bb1..cceb15da 100644
--- a/src/main/java/neo/ui/Window.java
+++ b/src/main/java/neo/ui/Window.java
@@ -411,7 +411,11 @@ public idWindow(idDeviceContext d, idUserInterfaceLocal ui) {
gui = ui;
CommonInit();
}
-// abstract ~idWindow();
+
+ /** ~idWindow() */
+ public void close() {
+ CleanUp();
+ }
public enum ON {
@@ -1044,7 +1048,7 @@ public void CommonInit() {
matColor.oSet(new idVec4(1, 1, 1, 1));
borderColor.Zero();
background = null;
- backGroundName.data.oSet("");
+ backGroundName.oSet(new idStr(""));
focusedChild = null;
captureChild = null;
overChild = null;
@@ -1172,6 +1176,7 @@ public boolean Parse(idParser src, boolean rebuild /*= true*/) {
}
src.ExpectTokenType(TT_NAME, 0, token);
token2 = token;
+// System.out.printf(">>>>>>>>%s\n", token.toString());
src.UnreadToken(token);
drawWin_t dw = FindChildByName(token2.toString());
if (dw != null && dw.win != null) {
@@ -1190,7 +1195,7 @@ public boolean Parse(idParser src, boolean rebuild /*= true*/) {
idSimpleWindow simple = new idSimpleWindow(win);
dwt.simp = simple;
drawWindows.Append(dwt);
-// delete win;
+ win.close();//delete win;
simpleCount++;
} else {
AddChild(win);
@@ -2053,7 +2058,7 @@ public void DrawBackground(final idRectangle drawRect) {
}
public String RouteMouseCoords(float xd, float yd) {
- String[] str = {null};
+ String str;
if (GetCaptureChild() != null) {
//FIXME: unkludge this whole mechanism
return GetCaptureChild().RouteMouseCoords(xd, yd);
@@ -2074,16 +2079,16 @@ public String RouteMouseCoords(float xd, float yd) {
if (overChild != child) {
if (overChild != null) {
overChild.MouseExit();
- str[0] = overChild.cmd.toString();
- if (isNotNullOrEmpty(str[0])) {
+ str = overChild.cmd.toString();
+ if (isNotNullOrEmpty(str)) {
gui.GetDesktop().AddCommand(str);
overChild.cmd.oSet("");
}
}
overChild = child;
overChild.MouseEnter();
- str[0] = overChild.cmd.toString();
- if (isNotNullOrEmpty(str[0])) {
+ str = overChild.cmd.toString();
+ if (isNotNullOrEmpty(str)) {
gui.GetDesktop().AddCommand(str);
overChild.cmd.oSet("");
}
@@ -2097,8 +2102,8 @@ public String RouteMouseCoords(float xd, float yd) {
}
if (overChild != null) {
overChild.MouseExit();
- str[0] = overChild.cmd.toString();
- if (isNotNullOrEmpty(str[0])) {
+ str = overChild.cmd.toString();
+ if (isNotNullOrEmpty(str)) {
gui.GetDesktop().AddCommand(str);
overChild.cmd.oSet("");
}
@@ -3054,15 +3059,15 @@ public idRegisterList RegList() {
return regList;
}
- public void AddCommand(final String[] _cmd) {
+ public void AddCommand(final String _cmd) {
String str = cmd.toString();
if (!str.isEmpty()) {
str += " ; ";
- str += _cmd[0];
+ str += _cmd;
} else {
- str = _cmd[0];
+ str = _cmd;
}
- _cmd[0] = str;
+ cmd.oSet(str);
}
static int DEBUG_updateVars = 0;