有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java音频剪辑:javax。声音抽样调查。LineUnavailableException

我试图用音频剪辑向我的扬声器播放一个文件。我在docker容器上运行这个

在这里,我从我的服务器获取音频文件信息,并尝试播放它

int length = fromServer.readInt();//takes audio file length from socket
if (length > 0) {
  byte[] message = new byte[length];
  fromServer.readFully(message, 0, message.length);//reads the data in socket into array "message"

  AudioInputStream oAIS = new AudioInputStream(
  new ByteArrayInputStream(message),
  new AudioFormat(44100.0f, 16, 2, true, false),length); 
  //creates an AudioInputStream which can be used for playing the data
  AudioPlayer.main(oAIS);
 }

当我的程序进入这个函数时,我得到

javax.sound.sampled.LineUnavailableException
        at org.classpath.icedtea.pulseaudio.PulseAudioMixer.openImpl(PulseAudioMixer.java:714)
        at org.classpath.icedtea.pulseaudio.PulseAudioMixer.openLocal(PulseAudioMixer.java:588)
        at org.classpath.icedtea.pulseaudio.PulseAudioMixer.openLocal(PulseAudioMixer.java:584)
        at org.classpath.icedtea.pulseaudio.PulseAudioMixer.open(PulseAudioMixer.java:579)
        at org.classpath.icedtea.pulseaudio.PulseAudioDataLine.open(PulseAudioDataLine.java:94)
        at org.classpath.icedtea.pulseaudio.PulseAudioDataLine.open(PulseAudioDataLine.java:283)
        at org.classpath.icedtea.pulseaudio.PulseAudioClip.open(PulseAudioClip.java:402)
        at org.classpath.icedtea.pulseaudio.PulseAudioClip.open(PulseAudioClip.java:453)

可能有什么问题?如果我必须提供任何其他信息,请告诉我


共 (0) 个答案