Package javazoom.jl.decoder

Examples of javazoom.jl.decoder.OutputBuffer


      decoder = new MP3Decoder();
      try {
        Header header = bitstream.readFrame();
        if (header == null) throw new GdxRuntimeException("empty ogg");
        int channels = header.mode() == Header.SINGLE_CHANNEL ? 1 : 2;
        outputBuffer = new OutputBuffer(channels, false);
        decoder.setOutputBuffer(outputBuffer);
        setup(channels, header.getSampleRate());
      } catch (BitstreamException e) {
        throw new GdxRuntimeException("error while preloading mp3", e);
      }
View Full Code Here


        while (totalLength <= minRequiredLength) {
          Header header = bitstream.readFrame();
          if (header == null) break;
          if (setup) {
            int channels = header.mode() == Header.SINGLE_CHANNEL ? 1 : 2;
            outputBuffer = new OutputBuffer(channels, false);
            decoder.setOutputBuffer(outputBuffer);
            setup(channels, header.getSampleRate());
            setup = false;
          }
          try {
View Full Code Here

      Bitstream bitstream = new Bitstream(file.read());
      MP3Decoder decoder = new MP3Decoder();

      try {
        OutputBuffer outputBuffer = null;
        int sampleRate = -1, channels = -1;
        while (true) {
          Header header = bitstream.readFrame();
          if (header == null) break;
          if (outputBuffer == null) {
            channels = header.mode() == Header.SINGLE_CHANNEL ? 1 : 2;
            outputBuffer = new OutputBuffer(channels, false);
            decoder.setOutputBuffer(outputBuffer);
            sampleRate = header.getSampleRate();
          }
          try {
            decoder.decodeFrame(header, bitstream);
          } catch (Exception ignored) {
            // JLayer's decoder throws ArrayIndexOutOfBoundsException sometimes!?
          }
          bitstream.closeFrame();
          output.write(outputBuffer.getBuffer(), 0, outputBuffer.reset());
        }
        bitstream.close();
        setup(output.toByteArray(), channels, sampleRate);
      } catch (Throwable ex) {
        throw new GdxRuntimeException("Error reading audio data.", ex);
View Full Code Here

TOP

Related Classes of javazoom.jl.decoder.OutputBuffer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.