本文整理汇总了Java中javazoom.jl.decoder.Header类的典型用法代码示例。如果您正苦于以下问题:Java Header类的具体用法?Java Header怎么用?Java Header使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Header类属于javazoom.jl.decoder包,在下文中一共展示了Header类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: decodedFrame
import javazoom.jl.decoder.Header; //导入依赖的package包/类
public void decodedFrame(int frameNo, Header header, Obuffer o)
{
if (isDetail(MAX_DETAIL))
{
String headerString = header.toString();
pw.println("Decoded frame "+frameNo+": "+headerString);
pw.println("Output: "+o);
}
else if (isDetail(VERBOSE_DETAIL))
{
if (frameNo==0)
{
pw.print("Converting.");
pw.flush();
}
if ((frameNo % 10)==0)
{
pw.print('.');
pw.flush();
}
}
}
示例2: Music
import javazoom.jl.decoder.Header; //导入依赖的package包/类
public Music (OpenALAudio audio, FileHandle file) {
super(audio, file);
if (audio.noDevice) return;
bitstream = new Bitstream(file.read());
decoder = new MP3Decoder();
bufferOverhead = 4096;
try {
Header header = bitstream.readFrame();
if (header == null) throw new GdxRuntimeException("Empty MP3");
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);
}
}
示例3: Music
import javazoom.jl.decoder.Header; //导入依赖的package包/类
public Music(OpenALAudio audio, FileHandle file) {
super(audio, file);
if (audio.noDevice) {
return;
}
bitstream = new Bitstream(file.read());
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);
}
}
示例4: decodedFrame
import javazoom.jl.decoder.Header; //导入依赖的package包/类
public void decodedFrame(int frameNo, Header header, Obuffer o)
{
if (isDetail(MAX_DETAIL))
{
String headerString = header.toString();
pw.println("Decoded frame " + frameNo + ": " + headerString);
pw.println("Output: " + o);
}
else if (isDetail(VERBOSE_DETAIL))
{
if (frameNo == 0)
{
pw.print("Converting.");
pw.flush();
}
if ((frameNo % 10) == 0)
{
pw.print('.');
pw.flush();
}
}
}
示例5: decodedFrame
import javazoom.jl.decoder.Header; //导入依赖的package包/类
@Override
public void decodedFrame(int frameNo, Header header, Obuffer o)
{
if (isDetail(MAX_DETAIL))
{
String headerString = header.toString();
pw.println("Decoded frame " + frameNo + ": " + headerString);
pw.println("Output: " + o);
}
else if (isDetail(VERBOSE_DETAIL))
{
if (frameNo == 0)
{
pw.print("Converting.");
pw.flush();
}
if ((frameNo % 10) == 0)
{
pw.print('.');
pw.flush();
}
}
}
示例6: decodeFrame
import javazoom.jl.decoder.Header; //导入依赖的package包/类
/**
* Decodes a single frame.
*
* @return true if there are no more frames to decode, false otherwise.
*/
protected boolean decodeFrame() throws JavaLayerException
{
try
{
AudioDevice out = audio;
if (out == null) return false;
Header h = bitstream.readFrame();
if (h == null) return false;
// sample buffer set when decoder constructed
SampleBuffer output = (SampleBuffer) decoder.decodeFrame(h, bitstream);
synchronized (this)
{
out = audio;
if(out != null)
{
out.write(output.getBuffer(), 0, output.getBufferLength());
}
}
bitstream.closeFrame();
}
catch (RuntimeException ex)
{
throw new JavaLayerException("Exception decoding audio frame", ex);
}
return true;
}
示例7: skipFrame
import javazoom.jl.decoder.Header; //导入依赖的package包/类
/**
* skips over a single frame
* @return false if there are no more frames to decode, true otherwise.
*/
protected boolean skipFrame() throws JavaLayerException
{
Header h = bitstream.readFrame();
if (h == null) return false;
bitstream.closeFrame();
return true;
}
示例8: skipFrames
import javazoom.jl.decoder.Header; //导入依赖的package包/类
/**
* Skip frames.
* You don't need to call it severals times, it will exactly skip given frames number.
* @param frames
* @return bytes length skipped matching to frames skipped.
*/
public long skipFrames(long frames)
{
if (TDebug.TraceAudioConverter) TDebug.out("skip(long frames) : begin");
int framesRead = 0;
int bytesReads = 0;
try
{
for (int i=0;i<frames;i++)
{
Header header = m_bitstream.readFrame();
if (header != null)
{
int fsize = header.calculate_framesize();
bytesReads = bytesReads + fsize;
}
m_bitstream.closeFrame();
framesRead++;
}
}
catch (BitstreamException e)
{
if (TDebug.TraceAudioConverter) TDebug.out(e);
}
if (TDebug.TraceAudioConverter) TDebug.out("skip(long frames) : end");
currentFrame = currentFrame + framesRead;
return bytesReads;
}
示例9: skipFrames
import javazoom.jl.decoder.Header; //导入依赖的package包/类
/**
* Skip frames. You don't need to call it severals times, it will exactly
* skip given frames number.
*
* @param frames
* @return bytes length skipped matching to frames skipped.
*/
public long skipFrames(long frames)
{
int framesRead = 0;
int bytesReads = 0;
try
{
for(int i = 0; i < frames; i++)
{
Header header = m_bitstream.readFrame();
if(header != null)
{
int fsize = header.calculate_framesize();
bytesReads = bytesReads + fsize;
}
m_bitstream.closeFrame();
framesRead++;
}
} catch (BitstreamException e)
{
}
currentFrame = currentFrame + framesRead;
return bytesReads;
}
示例10: getSamplingRate
import javazoom.jl.decoder.Header; //导入依赖的package包/类
public int getSamplingRate() {
switch (h.sample_frequency()) {
case Header.THIRTYTWO:
if (h.version() == Header.MPEG1) {
return 32000;
} else if (h.version() == Header.MPEG2_LSF) {
return 16000;
} else // SZD
{
return 8000;
}
case Header.FOURTYFOUR_POINT_ONE:
if (h.version() == Header.MPEG1) {
return 44100;
} else if (h.version() == Header.MPEG2_LSF) {
return 22050;
} else // SZD
{
return 11025;
}
case Header.FOURTYEIGHT:
if (h.version() == Header.MPEG1) {
return 48000;
} else if (h.version() == Header.MPEG2_LSF) {
return 24000;
} else // SZD
{
return 12000;
}
default:
return 0;
}
}
示例11: getSamplingRate
import javazoom.jl.decoder.Header; //导入依赖的package包/类
private static int getSamplingRate(Header h) {
switch (h.sample_frequency()) {
case Header.THIRTYTWO:
if (h.version() == Header.MPEG1) {
return 32000;
} else if (h.version() == Header.MPEG2_LSF) {
return 16000;
} else // SZD
{
return 8000;
}
case Header.FOURTYFOUR_POINT_ONE:
if (h.version() == Header.MPEG1) {
return 44100;
} else if (h.version() == Header.MPEG2_LSF) {
return 22050;
} else // SZD
{
return 11025;
}
case Header.FOURTYEIGHT:
if (h.version() == Header.MPEG1) {
return 48000;
} else if (h.version() == Header.MPEG2_LSF) {
return 24000;
} else // SZD
{
return 12000;
}
default:
return 0;
}
}
示例12: decodeFrame
import javazoom.jl.decoder.Header; //导入依赖的package包/类
/**
* Decodes a single frame.
*
* @return true if there are no more frames to decode, false otherwise.
*/
protected boolean decodeFrame() throws JavaLayerException {
try {
AudioDevice out = audio;
if (out == null)
return false;
Header h = bitstream.readFrame();
if (h == null)
return false;
// sample buffer set when decoder constructed
SampleBuffer output = (SampleBuffer) decoder.decodeFrame(h, bitstream);
synchronized (this) {
out = audio;
if (out != null) {
out.write(output.getBuffer(), 0, output.getBufferLength());
}
}
bitstream.closeFrame();
} catch (RuntimeException ex) {
throw new JavaLayerException("Exception decoding audio frame", ex);
}
return true;
}