我在模拟器上尝试一个小程序
int frequency=8000;
int channelConfiguration = AudioFormat.CHANNEL_CONFIGURATION_MONO;
int audioEncoding = AudioFormat.ENCODING_PCM_8BIT;
bufferSize = AudioRecord.getMinBufferSize(frequency,
channelConfiguration, audioEncoding);
I keep getting bufferSize -2.
hwaudioInput:为模拟器设置了yes。
这应该是什么价值?或者你有任何其他想法为什么这不起作用? 有没有办法检查为什么getMinBufferSize失败?什么是确切的错误消息?
谢谢。
答案 0 :(得分:0)
尝试audioEncoding = AudioFormat.ENCODING_PCM_16BIT;
int frequency = 8000;
int channelConfiguration = AudioFormat.CHANNEL_CONFIGURATION_MONO;
int audioEncoding = AudioFormat.ENCODING_PCM_16BIT;
bufferSize = AudioRecord.getMinBufferSize(frequency,
channelConfiguration, audioEncoding);