javazoom.jl.decoder.Header.layer()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(8.2k)|赞(0)|评价(0)|浏览(103)

本文整理了Java中javazoom.jl.decoder.Header.layer()方法的一些代码示例,展示了Header.layer()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Header.layer()方法的具体详情如下:
包路径:javazoom.jl.decoder.Header
类名称:Header
方法名:layer

Header.layer介绍

[英]Returns Layer ID.
[中]返回图层ID。

代码示例

代码示例来源:origin: com.badlogicgames.jlayer/jlayer

/**
 * Returns ms/frame.
 * @return milliseconds per frame
 */
public float ms_per_frame () // E.B
{
  if (h_vbr == true) {
    double tpf = h_vbr_time_per_frame[layer()] / frequency();
    if (h_version == MPEG2_LSF || h_version == MPEG25_LSF) tpf /= 2;
    return (float)(tpf * 1000);
  } else {
    float ms_per_frame_array[][] = { {8.707483f, 8.0f, 12.0f}, {26.12245f, 24.0f, 36.0f}, {26.12245f, 24.0f, 36.0f}};
    return ms_per_frame_array[h_layer - 1][h_sample_frequency];
  }
}

代码示例来源:origin: javazoom/jlayer

/**
 * Returns ms/frame.
 * @return milliseconds per frame
 */
public float ms_per_frame() // E.B
{
  if (h_vbr == true)
  {            
    double tpf = h_vbr_time_per_frame[layer()] / frequency();
    if ((h_version == MPEG2_LSF) || (h_version == MPEG25_LSF)) tpf /= 2;
    return ((float) (tpf * 1000));
  }
  else
  {
    float ms_per_frame_array[][] = {{8.707483f,  8.0f, 12.0f},
                    {26.12245f, 24.0f, 36.0f},
                    {26.12245f, 24.0f, 36.0f}};
    return(ms_per_frame_array[h_layer-1][h_sample_frequency]);
  }
}

代码示例来源:origin: com.googlecode.soundlibs/jlayer

/**
 * Returns ms/frame.
 * @return milliseconds per frame
 */
public float ms_per_frame() // E.B
{
  if (h_vbr == true)
  {            
    double tpf = h_vbr_time_per_frame[layer()] / frequency();
    if ((h_version == MPEG2_LSF) || (h_version == MPEG25_LSF)) tpf /= 2;
    return ((float) (tpf * 1000));
  }
  else
  {
    float ms_per_frame_array[][] = {{8.707483f,  8.0f, 12.0f},
                    {26.12245f, 24.0f, 36.0f},
                    {26.12245f, 24.0f, 36.0f}};
    return(ms_per_frame_array[h_layer-1][h_sample_frequency]);
  }
}

代码示例来源:origin: tulskiy/musique

/**
 * Returns ms/frame.
 *
 * @return milliseconds per frame
 */
public float ms_per_frame() // E.B
{
  if (h_vbr) {
    double tpf = h_vbr_time_per_frame[layer()] / frequency();
    if ((h_version == MPEG2_LSF) || (h_version == MPEG25_LSF)) {
      tpf /= 2;
    }
    return ((float) (tpf * 1000));
  } else {
    float ms_per_frame_array[][] = {{8.707483f, 8.0f, 12.0f},
        {26.12245f, 24.0f, 36.0f},
        {26.12245f, 24.0f, 36.0f}};
    return (ms_per_frame_array[h_layer - 1][h_sample_frequency]);
  }
}

代码示例来源:origin: pdudits/soundlibs

/**
 * Returns ms/frame.
 * @return milliseconds per frame
 */
public float ms_per_frame() // E.B
{
  if (h_vbr == true)
  {            
    double tpf = h_vbr_time_per_frame[layer()] / frequency();
    if ((h_version == MPEG2_LSF) || (h_version == MPEG25_LSF)) tpf /= 2;
    return ((float) (tpf * 1000));
  }
  else
  {
    float ms_per_frame_array[][] = {{8.707483f,  8.0f, 12.0f},
                    {26.12245f, 24.0f, 36.0f},
                    {26.12245f, 24.0f, 36.0f}};
    return(ms_per_frame_array[h_layer-1][h_sample_frequency]);
  }
}

代码示例来源:origin: com.badlogicgames.jlayer/jlayer

/**
 * Decodes one frame from an MPEG audio bitstream.
 * 
 * @param header The header describing the frame to decode.
 * @param bitstream The bistream that provides the bits for te body of the frame.
 * 
 * @return A SampleBuffer containing the decoded samples.
 */
public OutputBuffer decodeFrame (Header header, Bitstream stream) throws DecoderException {
  if (!initialized) initialize(header);
  int layer = header.layer();
  FrameDecoder decoder = retrieveDecoder(header, stream, layer);
  decoder.decodeFrame();
  return output;
}

代码示例来源:origin: com.badlogicgames.jlayer/jlayer

private void initialize (Header header) throws DecoderException {
  // REVIEW: allow customizable scale factor
  float scalefactor = 32700.0f;
  int mode = header.mode();
  header.layer();
  int channels = mode == Header.SINGLE_CHANNEL ? 1 : 2;
  // set up output buffer if not set up by client.
  if (output == null) throw new RuntimeException("Output buffer was not set.");
  filter1 = new SynthesisFilter(0, scalefactor, null);
  // REVIEW: allow mono output for stereo
  if (channels == 2) filter2 = new SynthesisFilter(1, scalefactor, null);
  outputChannels = channels;
  outputFrequency = header.frequency();
  initialized = true;
}

代码示例来源:origin: tulskiy/musique

/**
 * Decodes one frame from an MPEG audio bitstream.
 *
 * @param header The header describing the frame to decode.
 * @param stream The bistream that provides the bits for te body of the frame.
 * @return A SampleBuffer containing the decoded samples.
 */
public Obuffer decodeFrame(Header header, Bitstream stream)
    throws DecoderException {
  if (!initialized) {
    initialize(header);
  }
  int layer = header.layer();
  output.clear_buffer();
  FrameDecoder decoder = retrieveDecoder(header, stream, layer);
  decoder.decodeFrame();
  output.write_buffer(1);
  return output;
}

代码示例来源:origin: javazoom/jlayer

/**
 * Decodes one frame from an MPEG audio bitstream.
 * 
 * @param header        The header describing the frame to decode.
 * @param bitstream        The bistream that provides the bits for te body of the frame. 
 * 
 * @return A SampleBuffer containing the decoded samples.
 */
public Obuffer decodeFrame(Header header, Bitstream stream)
  throws DecoderException
{
  if (!initialized)
  {
    initialize(header);
  }
  
  int layer = header.layer();
  
  output.clear_buffer();
  
  FrameDecoder decoder = retrieveDecoder(header, stream, layer);
  
  decoder.decodeFrame();
      
  output.write_buffer(1);
  
  return output;	
}

代码示例来源:origin: com.googlecode.soundlibs/jlayer

/**
 * Decodes one frame from an MPEG audio bitstream.
 * 
 * @param header        The header describing the frame to decode.
 * @param bitstream        The bistream that provides the bits for te body of the frame. 
 * 
 * @return A SampleBuffer containing the decoded samples.
 */
public Obuffer decodeFrame(Header header, Bitstream stream)
  throws DecoderException
{
  if (!initialized)
  {
    initialize(header);
  }
  
  int layer = header.layer();
  
  output.clear_buffer();
  
  FrameDecoder decoder = retrieveDecoder(header, stream, layer);
  
  decoder.decodeFrame();
      
  output.write_buffer(1);
  
  return output;	
}

代码示例来源:origin: ddf/Minim

Integer.toString(2 - nVersion));
nLayer = m_header.layer();
aff_properties.put("mp3.version.layer", Integer.toString(nLayer));

代码示例来源:origin: pdudits/soundlibs

/**
 * Decodes one frame from an MPEG audio bitstream.
 * 
 * @param header        The header describing the frame to decode.
 * @param bitstream        The bistream that provides the bits for te body of the frame. 
 * 
 * @return A SampleBuffer containing the decoded samples.
 */
public Obuffer decodeFrame(Header header, Bitstream stream)
  throws DecoderException
{
  if (!initialized)
  {
    initialize(header);
  }
  
  int layer = header.layer();
  
  output.clear_buffer();
  
  FrameDecoder decoder = retrieveDecoder(header, stream, layer);
  
  decoder.decodeFrame();
      
  output.write_buffer(1);
  
  return output;	
}

代码示例来源:origin: pdudits/soundlibs

private void initialize(Header header)
  throws DecoderException
{
  
  // REVIEW: allow customizable scale factor
  float scalefactor = 32700.0f;
  
  int mode = header.mode();
  int layer = header.layer();
  int channels = mode==Header.SINGLE_CHANNEL ? 1 : 2;
        
  // set up output buffer if not set up by client.
  if (output==null)
    output = new SampleBuffer(header.frequency(), channels);
  
  float[] factors = equalizer.getBandFactors();
  filter1 = new SynthesisFilter(0, scalefactor, factors);
      // REVIEW: allow mono output for stereo
  if (channels==2) 
    filter2 = new SynthesisFilter(1, scalefactor, factors);
  outputChannels = channels;
  outputFrequency = header.frequency();
  
  initialized = true;
}

代码示例来源:origin: tulskiy/musique

private void initialize(Header header)
    throws DecoderException {
  // REVIEW: allow customizable scale factor
  float scalefactor = 32700.0f;
  int mode = header.mode();
  int layer = header.layer();
  int channels = mode == Header.SINGLE_CHANNEL ? 1 : 2;
  // set up output buffer if not set up by client.
  if (output == null)
    output = new SampleBuffer(header.frequency(), channels);
  float[] factors = equalizer.getBandFactors();
  filter1 = new SynthesisFilter(0, scalefactor, factors);
  // REVIEW: allow mono output for stereo
  if (channels == 2)
    filter2 = new SynthesisFilter(1, scalefactor, factors);
  outputChannels = channels;
  outputFrequency = header.frequency();
  initialized = true;
}

代码示例来源:origin: javazoom/jlayer

private void initialize(Header header)
  throws DecoderException
{
  
  // REVIEW: allow customizable scale factor
  float scalefactor = 32700.0f;
  
  int mode = header.mode();
  int layer = header.layer();
  int channels = mode==Header.SINGLE_CHANNEL ? 1 : 2;
        
  // set up output buffer if not set up by client.
  if (output==null)
    output = new SampleBuffer(header.frequency(), channels);
  
  float[] factors = equalizer.getBandFactors();
  filter1 = new SynthesisFilter(0, scalefactor, factors);
      // REVIEW: allow mono output for stereo
  if (channels==2) 
    filter2 = new SynthesisFilter(1, scalefactor, factors);
  outputChannels = channels;
  outputFrequency = header.frequency();
  
  initialized = true;
}

代码示例来源:origin: com.googlecode.soundlibs/jlayer

private void initialize(Header header)
  throws DecoderException
{
  
  // REVIEW: allow customizable scale factor
  float scalefactor = 32700.0f;
  
  int mode = header.mode();
  int layer = header.layer();
  int channels = mode==Header.SINGLE_CHANNEL ? 1 : 2;
        
  // set up output buffer if not set up by client.
  if (output==null)
    output = new SampleBuffer(header.frequency(), channels);
  
  float[] factors = equalizer.getBandFactors();
  filter1 = new SynthesisFilter(0, scalefactor, factors);
      // REVIEW: allow mono output for stereo
  if (channels==2) 
    filter2 = new SynthesisFilter(1, scalefactor, factors);
  outputChannels = channels;
  outputFrequency = header.frequency();
  
  initialized = true;
}

相关文章