当前位置: 首页>>代码示例>>Java>>正文


Java Header类代码示例

本文整理汇总了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();
		}
	}
}
 
开发者ID:EndlessBot,项目名称:jLib,代码行数:24,代码来源:Converter.java

示例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);
	}
}
 
开发者ID:Xemiru,项目名称:Undertailor,代码行数:18,代码来源:Mp3.java

示例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);
    }
}
 
开发者ID:kovertopz,项目名称:libGDX-LWJGL-Audio,代码行数:21,代码来源:Mp3.java

示例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();
		}
	}
}
 
开发者ID:kuhnmi,项目名称:jukefox,代码行数:24,代码来源:Converter.java

示例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();
		}
	}
}
 
开发者ID:philjord,项目名称:3DTools,代码行数:25,代码来源:ConverterBB.java

示例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;
}
 
开发者ID:EndlessBot,项目名称:jLib,代码行数:36,代码来源:AdvancedPlayer.java

示例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;
}
 
开发者ID:EndlessBot,项目名称:jLib,代码行数:12,代码来源:AdvancedPlayer.java

示例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;
}
 
开发者ID:fredsa,项目名称:forplay,代码行数:34,代码来源:DecodedMpegAudioInputStream.java

示例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;
}
 
开发者ID:Dynious,项目名称:SoundsCool,代码行数:34,代码来源:DecodedMpegAudioInputStream.java

示例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;
    }
}
 
开发者ID:jindrapetrik,项目名称:jpexs-decompiler,代码行数:34,代码来源:MP3FRAME.java

示例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;
    }
}
 
开发者ID:jindrapetrik,项目名称:jpexs-decompiler,代码行数:34,代码来源:MP3Decoder.java

示例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;
}
 
开发者ID:kuhnmi,项目名称:jukefox,代码行数:32,代码来源:AdvancedPlayer.java


注:本文中的javazoom.jl.decoder.Header类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。