【发布时间】: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
【问题讨论】:
-
请正确格式化您的代码。