FloatSampleBuffer.java 文件源码

java
阅读 22 收藏 0 点赞 0 评论 0

项目:romanov 作者:
/**
 * Resets this buffer with the audio data specified in the arguments. This
 * FloatSampleBuffer's sample count will be set to
 * <code>byteCount / format.getFrameSize()</code>.
 * 
 * @param lazy if true, then existing channels will be tried to be re-used
 *            to minimize garbage collection.
 * @throws IllegalArgumentException
 */
public void initFromByteArray(byte[] buffer, int offset, int byteCount,
        AudioFormat format, boolean lazy) {
    if (offset + byteCount > buffer.length) {
        throw new IllegalArgumentException(
                "FloatSampleBuffer.initFromByteArray: buffer too small.");
    }

    int thisSampleCount = byteCount / format.getFrameSize();
    init(format.getChannels(), thisSampleCount, format.getSampleRate(),
            lazy);

    // save format for automatic dithering mode
    originalFormatType = FloatSampleTools.getFormatType(format);

    FloatSampleTools.byte2float(buffer, offset, channels, 0, sampleCount,
            format);
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号