Package net.avadeaux.klipspringer.decoder
package net.avadeaux.klipspringer.decoder
Classes for decoding audio data, which supports FLAC by integrating integrating libFLAC via the Java Native Interface. Also provides interfaces for handling the formats that Java supports natively (WAV, AIFF and Au). Provides two alternative APIs:
- The
AudioDecoderinterface, which ties in with the libFLAC API directly. You implement aAudioDecoder.Targetclass for whatever you want to do with the decoded PCM data, and pass an instance of it on to a decoder, either directly as a constructor argument toFlacDecoderor usingAudioDecoderFactory. - The
FlacAudioInputStreamclass, which is subclass ofAudioInputStream.
Here is a minimal example that plays a FLAC file using FlacAudioInputStream:
AudioInputStream stream = FlacAudioInputStream.getInstance("file_to_play.flac");
SourceDataLine line = AudioSystem.getSourceDataLine(stream.getFormat());
line.open(stream.getFormat());
line.start();
byte[] b = new byte[2048 * 3];
while (true) {
int n = stream.read(b);
if (n < 0) { break; }
line.write(b, 0, n);
}
line.drain();
Other examples are can be found in the examples directory available with the
distribution of this package.
This is part of the Klipspringer music playing software
© 2014–2024 Jesper
Larsson, released as free software under GPL version 3 or later.
See klipspringer.avadeaux.net for more information.
-
ClassDescriptionInterface for audio decoding.Audio decoding target interface.Interface for getting AudioDecoder given file name and target.Error thrown if an unexpected (potentially fatal) problem arises in decoding.Exception originating from audio decoding.Audio decoder that reads from an AudioInputStream.Wrapper for
FlacDecoderthat allows reading a FLAC file as a javax.sound.sampled.AudioInputStream.Class that interfaces to FLAC library for decoding.