Open lcsongxp opened 6 years ago
I met this problem too ! Did you find a solution ?
I found this into the SSRC class source code :
rawoutbuf.limit((int) (dbps nch (Math.floor((double) sumread * dfrq / sfrq) + 2 + sumwrite + nsmplwrt2 - delay))); //TODO fails with short signals (think that fixed this)
Any idea to fix this ByteBuffer limit calculation ?
pull requests are welcome
I solved this problem:
int limit = bps nch toberead; if (limit > rawinbuf.capacity()) { rawinbuf.clear(); rawinbuf = ByteBuffer.allocate(limit); } rawinbuf.position(0); rawinbuf.limit(limit);
@hubin858130 , can you create a pull request?
Hi, I'm a rookie on pcm process, would you please help resolve the issue in your project? Thanks Alex Logs are following:
file name is /mono_short_test.wav channels is 1 frame size is 2 frame rate is 44100.0 Exception in thread "Thread-0" java.lang.IllegalArgumentException at java.nio.Buffer.limit(Unknown Source) at vavi.sound.pcm.resampling.ssrc.SSRC.downsample(SSRC.java:1579) at vavi.sound.pcm.resampling.ssrc.SSRC.(SSRC.java:2440)
at com.jssrc.resample.JSSRCResampler$1.run(JSSRCResampler.java:66)
at java.lang.Thread.run(Unknown Source)
file name is /stereo_long_test.wav channels is 2 frame size is 4 frame rate is 44100.0 Exception in thread "Thread-3" java.lang.IllegalArgumentException at java.nio.Buffer.limit(Unknown Source) at vavi.sound.pcm.resampling.ssrc.SSRC.upsample(SSRC.java:648) at vavi.sound.pcm.resampling.ssrc.SSRC.(SSRC.java:2438)
at com.jssrc.resample.JSSRCResampler$1.run(JSSRCResampler.java:66)
at java.lang.Thread.run(Unknown Source)