From 9fee0ec4ca0c5b7a334cc29dbb58e76c7a4c736e Mon Sep 17 00:00:00 2001 From: Michiel Van Der Kolk Date: Mon, 11 Jul 2005 15:42:37 +0000 Subject: Songdb java version, source. only 1.5 compatible git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7101 a1c6a512-1295-4272-9138-f99709370657 --- songdbj/de/jarnbjo/vorbis/Mapping0.java | 146 ++++++++++++++++++++++++++++++++ 1 file changed, 146 insertions(+) create mode 100644 songdbj/de/jarnbjo/vorbis/Mapping0.java (limited to 'songdbj/de/jarnbjo/vorbis/Mapping0.java') diff --git a/songdbj/de/jarnbjo/vorbis/Mapping0.java b/songdbj/de/jarnbjo/vorbis/Mapping0.java new file mode 100644 index 0000000000..e8fde4686f --- /dev/null +++ b/songdbj/de/jarnbjo/vorbis/Mapping0.java @@ -0,0 +1,146 @@ +/* + * $ProjectName$ + * $ProjectRevision$ + * ----------------------------------------------------------- + * $Id$ + * ----------------------------------------------------------- + * + * $Author$ + * + * Description: + * + * Copyright 2002-2003 Tor-Einar Jarnbjo + * ----------------------------------------------------------- + * + * Change History + * ----------------------------------------------------------- + * $Log$ + * Revision 1.1 2005/07/11 15:42:36 hcl + * Songdb java version, source. only 1.5 compatible + * + * Revision 1.1.1.1 2004/04/04 22:09:12 shred + * First Import + * + * Revision 1.2 2003/03/16 01:11:12 jarnbjo + * no message + * + * + */ + +package de.jarnbjo.vorbis; + +import java.io.IOException; + +import de.jarnbjo.util.io.BitInputStream; + +class Mapping0 extends Mapping { + + private int[] magnitudes, angles, mux, submapFloors, submapResidues; + + protected Mapping0(VorbisStream vorbis, BitInputStream source, SetupHeader header) throws VorbisFormatException, IOException { + + int submaps=1; + + if(source.getBit()) { + submaps=source.getInt(4)+1; + } + + //System.out.println("submaps: "+submaps); + + int channels=vorbis.getIdentificationHeader().getChannels(); + int ilogChannels=Util.ilog(channels-1); + + //System.out.println("ilogChannels: "+ilogChannels); + + if(source.getBit()) { + int couplingSteps=source.getInt(8)+1; + magnitudes=new int[couplingSteps]; + angles=new int[couplingSteps]; + + for(int i=0; i=channels || angles[i]>=channels) { + System.err.println(magnitudes[i]); + System.err.println(angles[i]); + throw new VorbisFormatException("The channel magnitude and/or angle mismatch."); + } + } + } + else { + magnitudes=new int[0]; + angles=new int[0]; + } + + if(source.getInt(2)!=0) { + throw new VorbisFormatException("A reserved mapping field has an invalid value."); + } + + mux=new int[channels]; + if(submaps>1) { + for(int i=0; isubmaps) { + throw new VorbisFormatException("A mapping mux value is higher than the number of submaps"); + } + } + } + else { + for(int i=0; ifloorCount) { + throw new VorbisFormatException("A mapping floor value is higher than the number of floors."); + } + + if(submapResidues[i]>residueCount) { + throw new VorbisFormatException("A mapping residue value is higher than the number of residues."); + } + } + } + + protected int getType() { + return 0; + } + + protected int[] getAngles() { + return angles; + } + + protected int[] getMagnitudes() { + return magnitudes; + } + + protected int[] getMux() { + return mux; + } + + protected int[] getSubmapFloors() { + return submapFloors; + } + + protected int[] getSubmapResidues() { + return submapResidues; + } + + protected int getCouplingSteps() { + return angles.length; + } + + protected int getSubmaps() { + return submapFloors.length; + } +} \ No newline at end of file -- cgit v1.2.3