Android AudioTrack buffering problems

前端 未结 3 1793
梦如初夏
梦如初夏 2021-01-31 11:25

Ok so I have a frequency generator which uses AudioTrack to send PCM data to the hardware. Here\'s the code I\'m using for that:

private class playSoundTask ext         


        
3条回答
  •  臣服心动
    2021-01-31 12:05

    In case anyone stumbles across this with the same problem (as I did), the solution actually has nothing to do with buffers, it has to do with the sine function. Try replacing angle += increment with angle += (increment % (2.0f * (float) Math.PI));. Also, for efficiency, try using FloatMath.sin() instead of Math.sin().

提交回复
热议问题