Hello!
I need help!
I try to write a file from a microphone flats. The file is written, but the program does not stop. I'm trying to stop the recording by line.stop () in another thread. Here's part of my program:
public void getDataFromLine(TargetDataLine line, File file){
AudioInputStream ais = new AudioInputStream(line);
I'm not able to test this at the moment, but try closing the input stream, rather than stopping the line. I'll try to look at it soon if this doesn't help(sorry for the delay).
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
My code was expecting it to reach end-of-stream, rather than just return zero samples. Try the latest build(0.3.1). It should work for you now, but let me know if it doesn't. Good luck :)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello!
I need help!
I try to write a file from a microphone flats. The file is written, but the program does not stop. I'm trying to stop the recording by line.stop () in another thread. Here's part of my program:
public void getDataFromLine(TargetDataLine line, File file){
AudioInputStream ais = new AudioInputStream(line);
I did a debug on your code and saw that the loop is in the method encodeAudioInputStream of class AudioStreamEncoder. In line:
while((samplesRead = sin.read(samplesIn, 0, maxRead)!= -1) {
framesRead = samplesRead/(frameSize);
.....
.....
condition in the loop is never executed. After I do line.stop () is returned array of zeros.
Maybe I'm doing something wrong? Sorry for my English!
I'm not able to test this at the moment, but try closing the input stream, rather than stopping the line. I'll try to look at it soon if this doesn't help(sorry for the delay).
Thanks for the help. I've tried to close the inputstream result is the same
My code was expecting it to reach end-of-stream, rather than just return zero samples. Try the latest build(0.3.1). It should work for you now, but let me know if it doesn't. Good luck :)
Thank you very much. With the new version, everything works perfectly :))