diff options
Diffstat (limited to 'songdbj/de/jarnbjo/vorbis/Mapping0.java')
-rw-r--r-- | songdbj/de/jarnbjo/vorbis/Mapping0.java | 146 |
1 files changed, 0 insertions, 146 deletions
diff --git a/songdbj/de/jarnbjo/vorbis/Mapping0.java b/songdbj/de/jarnbjo/vorbis/Mapping0.java deleted file mode 100644 index e8fde4686f..0000000000 --- a/songdbj/de/jarnbjo/vorbis/Mapping0.java +++ /dev/null | |||
@@ -1,146 +0,0 @@ | |||
1 | /* | ||
2 | * $ProjectName$ | ||
3 | * $ProjectRevision$ | ||
4 | * ----------------------------------------------------------- | ||
5 | * $Id$ | ||
6 | * ----------------------------------------------------------- | ||
7 | * | ||
8 | * $Author$ | ||
9 | * | ||
10 | * Description: | ||
11 | * | ||
12 | * Copyright 2002-2003 Tor-Einar Jarnbjo | ||
13 | * ----------------------------------------------------------- | ||
14 | * | ||
15 | * Change History | ||
16 | * ----------------------------------------------------------- | ||
17 | * $Log$ | ||
18 | * Revision 1.1 2005/07/11 15:42:36 hcl | ||
19 | * Songdb java version, source. only 1.5 compatible | ||
20 | * | ||
21 | * Revision 1.1.1.1 2004/04/04 22:09:12 shred | ||
22 | * First Import | ||
23 | * | ||
24 | * Revision 1.2 2003/03/16 01:11:12 jarnbjo | ||
25 | * no message | ||
26 | * | ||
27 | * | ||
28 | */ | ||
29 | |||
30 | package de.jarnbjo.vorbis; | ||
31 | |||
32 | import java.io.IOException; | ||
33 | |||
34 | import de.jarnbjo.util.io.BitInputStream; | ||
35 | |||
36 | class Mapping0 extends Mapping { | ||
37 | |||
38 | private int[] magnitudes, angles, mux, submapFloors, submapResidues; | ||
39 | |||
40 | protected Mapping0(VorbisStream vorbis, BitInputStream source, SetupHeader header) throws VorbisFormatException, IOException { | ||
41 | |||
42 | int submaps=1; | ||
43 | |||
44 | if(source.getBit()) { | ||
45 | submaps=source.getInt(4)+1; | ||
46 | } | ||
47 | |||
48 | //System.out.println("submaps: "+submaps); | ||
49 | |||
50 | int channels=vorbis.getIdentificationHeader().getChannels(); | ||
51 | int ilogChannels=Util.ilog(channels-1); | ||
52 | |||
53 | //System.out.println("ilogChannels: "+ilogChannels); | ||
54 | |||
55 | if(source.getBit()) { | ||
56 | int couplingSteps=source.getInt(8)+1; | ||
57 | magnitudes=new int[couplingSteps]; | ||
58 | angles=new int[couplingSteps]; | ||
59 | |||
60 | for(int i=0; i<couplingSteps; i++) { | ||
61 | magnitudes[i]=source.getInt(ilogChannels); | ||
62 | angles[i]=source.getInt(ilogChannels); | ||
63 | if(magnitudes[i]==angles[i] || magnitudes[i]>=channels || angles[i]>=channels) { | ||
64 | System.err.println(magnitudes[i]); | ||
65 | System.err.println(angles[i]); | ||
66 | throw new VorbisFormatException("The channel magnitude and/or angle mismatch."); | ||
67 | } | ||
68 | } | ||
69 | } | ||
70 | else { | ||
71 | magnitudes=new int[0]; | ||
72 | angles=new int[0]; | ||
73 | } | ||
74 | |||
75 | if(source.getInt(2)!=0) { | ||
76 | throw new VorbisFormatException("A reserved mapping field has an invalid value."); | ||
77 | } | ||
78 | |||
79 | mux=new int[channels]; | ||
80 | if(submaps>1) { | ||
81 | for(int i=0; i<channels; i++) { | ||
82 | mux[i]=source.getInt(4); | ||
83 | if(mux[i]>submaps) { | ||
84 | throw new VorbisFormatException("A mapping mux value is higher than the number of submaps"); | ||
85 | } | ||
86 | } | ||
87 | } | ||
88 | else { | ||
89 | for(int i=0; i<channels; i++) { | ||
90 | mux[i]=0; | ||
91 | } | ||
92 | } | ||
93 | |||
94 | submapFloors=new int[submaps]; | ||
95 | submapResidues=new int[submaps]; | ||
96 | |||
97 | int floorCount=header.getFloors().length; | ||
98 | int residueCount=header.getResidues().length; | ||
99 | |||
100 | for(int i=0; i<submaps; i++) { | ||
101 | source.getInt(8); // discard time placeholder | ||
102 | submapFloors[i]=source.getInt(8); | ||
103 | submapResidues[i]=source.getInt(8); | ||
104 | |||
105 | if(submapFloors[i]>floorCount) { | ||
106 | throw new VorbisFormatException("A mapping floor value is higher than the number of floors."); | ||
107 | } | ||
108 | |||
109 | if(submapResidues[i]>residueCount) { | ||
110 | throw new VorbisFormatException("A mapping residue value is higher than the number of residues."); | ||
111 | } | ||
112 | } | ||
113 | } | ||
114 | |||
115 | protected int getType() { | ||
116 | return 0; | ||
117 | } | ||
118 | |||
119 | protected int[] getAngles() { | ||
120 | return angles; | ||
121 | } | ||
122 | |||
123 | protected int[] getMagnitudes() { | ||
124 | return magnitudes; | ||
125 | } | ||
126 | |||
127 | protected int[] getMux() { | ||
128 | return mux; | ||
129 | } | ||
130 | |||
131 | protected int[] getSubmapFloors() { | ||
132 | return submapFloors; | ||
133 | } | ||
134 | |||
135 | protected int[] getSubmapResidues() { | ||
136 | return submapResidues; | ||
137 | } | ||
138 | |||
139 | protected int getCouplingSteps() { | ||
140 | return angles.length; | ||
141 | } | ||
142 | |||
143 | protected int getSubmaps() { | ||
144 | return submapFloors.length; | ||
145 | } | ||
146 | } \ No newline at end of file | ||