关于android的audiotrack播放声音断断续续的问题

int bufsize = AudioTrack.getMinBufferSize(22050, AudioFormat.CHANNEL_CONFIGURATION_MONO,

AudioFormat.ENCODING_PCM_16BIT);

audioplayer = new AudioTrack(AudioManager.STREAM_MUSIC, 22050, AudioFormat.CHANNEL_CONFIGURATION_MONO,

AudioFormat.ENCODING_PCM_16BIT, bufsize, AudioTrack.MODE_STREAM);

主要是因为buffer设置的太小了,将其改为:

AudioFormat.CHANNEL_CONFIGURATION_MONO,

AudioFormat.ENCODING_PCM_16BIT, bufsize*4, AudioTrack.MODE_STREAM);

即可

你可能感兴趣的:(android)