开发者

What audio encodings are supported on Android Emulator?

开发者 https://www.devze.com 2023-01-10 21:29 出处:网络
I am trying a small program on the emulator int frequency=8000; int channelConfiguration = AudioFormat.CHANNEL_CONFIGURATION_MONO;

I am trying a small program on the emulator

  int frequency=8000;   
    int channelConfiguration = AudioFormat.CHANNEL_CONFIGURATION_MONO;
    int audi开发者_开发问答oEncoding = AudioFormat.ENCODING_PCM_8BIT;
    bufferSize = AudioRecord.getMinBufferSize(frequency,
                        channelConfiguration, audioEncoding);

I keep getting bufferSize -2.

hwaudioInput:yes is set for the emulator.

For what values should this work? Or do you have any other ideas why this is not working? Is there way to check why getMinBufferSize fails? What is the exact error message?

Thank you.


Try 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);
0

精彩评论

暂无评论...
验证码 换一张
取 消