0
netbeans 자체가 다음과 같이 말합니다 : "AWT-EventQueue-0"스레드의 예외 java.lang.IllegalArgumentException : 형식이 일치하지 않는 TargetDataLine 인터페이스 PCM_SIGNED 44100.0 Hz, 16 비트, 모노 , 2 바이트/프레임, 빅 엔디안이 지원됩니다. " 회선이 지원되지 않으면 "회선이 지원되지 않습니다"라는 오류 메시지가 나타납니다. 대신, 아무 일도 일어나지 않습니다. 어떻게해야합니까? 당신은 당신이 먼저라고하기 때문에메시지 대화 상자가 실행되고 있지 않습니다
AudioSystem.getLine(info);
if (!AudioSystem.isLineSupported(info)) {...
getLine
가 지원되지 않는 예외를 던지고 가능성이 있는지 확인하기 전에 AudioLine
을 얻기 위해 노력하고있어 기본적으로 어떤
public class Ouvir extends NewJFrame{
AudioFormat audioFormat;
TargetDataLine targetDataLine;
TargetDataLine line;
void captureAudio(){
Listen.setEnabled(false);
try{
audioFormat = getAudioFormat();
DataLine.Info info = new DataLine.Info(TargetDataLine.class, audioFormat);
line = (TargetDataLine) AudioSystem.getLine(info);
AudioSystem.getLine(info);
if (!AudioSystem.isLineSupported(info)) {
String error = "Line not supported";
JOptionPane.showMessageDialog(null,error,"+",JOptionPane.ERROR_MESSAGE);
line.close();
}
line.open();
line.start();
}
catch (LineUnavailableException e) {}
}
void stopCapture(){
if(line != null)
{
line.stop();
line.close();
}
if(!Stop.getModel().isPressed())
{
line.stop();
line.close();
}
}
private AudioFormat getAudioFormat(){
return new AudioFormat(44100,16,1,true,true);
}
}
지원되는 경우 테스트하기 전에'AudioLine'을 얻을 수 있습니다. – MadProgrammer
어떻게 해결할 수 있습니까? 꽤 얻지 못했습니다 –
'AudioSystem.isLineSupported (info)'를'AudioSystem.getLine (info)'보다 먼저 호출해야합니다. 그렇지 않으면, 지원할 수 있는지 어떻게 알 수 있습니까? – MadProgrammer