Android AudioTrack.write()返回-38

时间:2016-11-08 11:57:06

标签: android audiotrack

    int bufSizeMin = AudioTrack.getMinBufferSize(
                                            44100,
                                            AudioFormat.CHANNEL_OUT_STEREO,
                                            AudioFormat.ENCODING_PCM_16BIT);

    audioTrack = new AudioTrack(
                                            AudioManager.STREAM_MUSIC,
                                            44100,
                                            AudioFormat.CHANNEL_OUT_STEREO,
                                            AudioFormat.ENCODING_PCM_16BIT,
                                            bufSizeMin,
                                            AudioTrack.MODE_STREAM);


    short[] audioData =  new short[2000];
    int writecount = audioTrack.write(audioData, 0, audioData.length);

有时返回2000(audiodata的长度),有时返回-38。 如果生成错误,它应返回0或正值或-1 -2或-3。但什么是-38?请帮忙......

0 个答案:

没有答案