当通过音频采样的数据数量超过"bufferSizeInBytes"时,将发生什么?在AudioRecord构造函数中设置了哪一个? [英] what will happen when the number of data which is sampled through audio exceed the "bufferSizeInBytes" which is set in AudioRecord constructor?

查看:124
本文介绍了当通过音频采样的数据数量超过"bufferSizeInBytes"时,将发生什么?在AudioRecord构造函数中设置了哪一个?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

public AudioRecord (int audioSource, int sampleRateInHz, int channelConfig, int audioFormat, int bufferSizeInBytes)

这是 AudioRecord 的公共构造函数,您可以找到最后一个名为 bufferSizeInBytes 的参数,它的意思是音频缓冲区的总大小(以字节为单位)记录期间将数据写入."在android docs中.

This is the Public Constructor of AudioRecord, you can find the last parameter called bufferSizeInBytes , and it means "the total size (in bytes) of the buffer where audio data is written to during the recording." in android docs.

我认为这是一个缓冲区,用于存储从音频硬件采样的所有数据.我有一个问题:

I thought this is a buffer for storing all data which is sampled from audio hardware. i have a question :

如果通过音频采样的数据数量超过"bufferSizeInBytes",将会发生什么,停止采样?否则

If the number of data which is sampled through audio exceed the "bufferSizeInBytes" , what will happen, stop sampling or else?

我做了一些测试,发现没有任何事情发生(它一直在记录),即使样本数据已经超过了.为什么?

I did some test , and found that nothing happened (it kept recording)even if the number of the sample data has exceeded. why?

So  can anyone tell me what's the meaning about  "bufferSizeInBytes"

推荐答案

这是在录制过程中缓冲的音频数据量.它确定您必须通过 read() AudioRecord 对象的频率,而不是在 Audiorecord 对象的操作期间可以记录的总数量.一生.

It's the amount of audiodata which is buffered during recording. It determines how often you have to pull the AudioRecord object via read(), and not the total amount which can get recorded during the Audiorecord object's lifetime.

如果不从 AudioRecord 对象中读出,则记录的数据将丢失.它会继续录音,但是会删除超出缓冲区级别的音频帧.

If you don't read out of the AudioRecord object, recorded data is lost. It keeps recording, but audioframes which exceed the buffer-level are dropped.

如果从对象读取音频数据,则缓冲区填充级别会降低.

If you read audio data from the object, the buffer fill-level is decreased.

这篇关于当通过音频采样的数据数量超过"bufferSizeInBytes"时,将发生什么?在AudioRecord构造函数中设置了哪一个?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆