java javax.sound.sampled.LineUnavailableException :我得到了什么异常?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/15852254/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-31 21:03:19  来源:igfitidea点击:

javax.sound.sampled.LineUnavailableException : What am I getting this exception?

javajavasound

提问by saplingPro

As the following method is called :

由于调用了以下方法:

private void beep_player_1() {
    try {
        //clip_Player_2.close();
        clip_Player_1 = AudioSystem.getClip();
        ais = AudioSystem.getAudioInputStream(new File(Constants.Player1_Default_Tone)); // PATH FOR THE .WAV FILE
        clip_Player_1.open(ais);
        clip_Player_1.loop(0); // PLAY ONCE
    }catch(Exception exc) {
        System.out.println(exc);
     }
}

LineUnavailableExceptionget thrown. What could be the reason for this ?

LineUnavailableException被抛出。这可能是什么原因?

javax.sound.sampled.LineUnavailableException: line with format PCM_SIGNED 44100.0 Hz, 24 bit, stereo, 6 bytes/frame, little-endian not supported.

采纳答案by Andrew Thompson

What could be the reason for this ?

这可能是什么原因?

javax.sound.sampled.LineUnavailableException: line with format 
  PCM_SIGNED 44100.0 Hz, 
  24 bit, 
  stereo, 
  6 bytes/frame, 
  little-endian not supported.

I don't know about the rest, but most PCs I've encountered use 8 or 16 bit 'bit depth' while that uses 24 bits. It indicates a very finely nuanced recording quality. If 8 bit is 'phone quality' and 16 bit is 'CD quality', then 24 bit would be 'master recording quality'.

我不知道其余的,但我遇到的大多数 PC 使用 8 或 16 位“位深度”,而使用 24 位。它表示非常细致入微的录音质量。如果 8 位是“手机质量”,16 位是“CD 质量”,那么 24 位将是“母带录音质量”。