【问题标题】:Java Sound on OSX no Port.Info Type supportedOSX 上的 Java 声音不支持 Port.Info 类型
【发布时间】:2014-09-03 16:29:20
【问题描述】:

我尝试使用 AudioSystem.Mixer 接口简单地播放 wav 文件 首先我尝试确定哪个混音器(设备)必须是我的输出。结果是不支持任何端口类型。怎么了?

import java.io.*;
import javax.sound.sampled.*;

public class STest12{
    public static void main(String[] args) {
        try {
            Mixer.Info[] mi = AudioSystem.getMixerInfo();
            Port.Info[] allePorts = {
                Port.Info.COMPACT_DISC,
                Port.Info.HEADPHONE,
                Port.Info.LINE_IN,
                Port.Info.LINE_OUT,
                Port.Info.MICROPHONE,
                Port.Info.SPEAKER
            };

            for (Mixer.Info mixerInfo : mi) {
                Mixer mixer = AudioSystem.getMixer(mixerInfo);
                System.out.println("---------------------------------");
                System.out.println(mixer.getMixerInfo().toString());

                for (Port.Info i : allePorts) {
                    System.out.println(i.toString() + " supported: " + mixer.isLineSupported(i));
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }//main
}//class

【问题讨论】:

  • 请正确格式化您的代码。

标签: java macos audio port


【解决方案1】:

一切正常,但 Java Sound API 未在 OSX 上正确实现。

【讨论】:

  • 这更像是一个评论而不是一个解决方案。
猜你喜欢
  • 2012-08-08
  • 2013-10-08
  • 2012-05-15
  • 1970-01-01
  • 2011-04-20
  • 2019-05-17
  • 1970-01-01
  • 2012-08-26
  • 2011-06-10
相关资源
最近更新 更多