音声サーバーを作成しようとしていますが、サーバーがこのエラーをスローしています"javax.sound.sampled.LineUnavailableException: line with format PCM_SIGNED 8000.0 Hz, 8 bit, mono, 1 bytes/frame, not supported." . これが私のコードです、よろしくお願いします
public class VoiceUser extends Thread { // CHAT USER
private ObjectOutputStream clientOutput;
public VoiceUser(Socket sv) {
try {
System.out.println("VSTART");
clientOutput = new ObjectOutputStream(sv.getOutputStream());
outputArray.add(clientOutput);
} catch (IOException e) {
System.out.println("Can't create stable connection between server and client");
}
}
public void run() {
try {
AudioFormat af = new AudioFormat(8000.0f,8,1,true,false);
DataLine.Info info = new DataLine.Info(TargetDataLine.class, af);
TargetDataLine microphone = (TargetDataLine)AudioSystem.getLine(info);
microphone.open(af);
microphone.start();
int bytesRead = 0;
byte[] soundData = new byte[1];
while(bytesRead != -1)
{
bytesRead = microphone.read(soundData, 0, soundData.length);
System.out.println(soundData.length);
if(bytesRead >= 0)
{
for(ObjectOutputStream o : outputArray) {
o.write(soundData, 0, bytesRead);
}
}
}
} catch (IOException | LineUnavailableException e) {
e.printStackTrace();
}
}
}