OSX上的Java Sound没有支持Port.Info类型

时间:2014-07-13 16:44:20

标签: java macos audio port

我尝试使用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

1 个答案:

答案 0 :(得分:-1)

没有错,但是在OSX上没有正确实现Java Sound API。

相关问题