返回首页

嘿!
我想另一种声音的设备,比标准的声音设备上播放声音。

通常我会做这样的事情(在Java):


	Info inf[]=AudioSystem.getMixerInfo();

	Mixer myOutputMixer=null;

	// find sound device with fancy name	

	for(int i=0;i<inf.length;i++){>

		String a=inf[i].getDescription();

		String name=inf[i].getName();		

		if(name.startsWith("USB HAMA (USB Sound Device)     ")){

			myOutputMixer=AudioSystem.getMixer(inf[i]);

		}	

	}

 

	// play sound

	File soundFile = new File("Sounds/chord.wav");

	AudioInputStream sound = AudioSystem.getAudioInputStream(soundFile);

	

	try {

		Clip sline = (Clip)myOutputMixer.getLine(

			new DataLine.Info(Clip.class,sound.getFormat())

		);

		sline.open(sound);

		sline.start();

	} catch (LineUnavailableException ex) {  }


但是,这并不工作,因为我的Win 7专业版(64位),只提供"港口龙头"和没有"混合器设备"条目。

我怎样才能找到正确的设备调​​音台?它可以在XP的机器,并在WIN 7旗舰 - 但是,没有太大的帮助时,没有给。

回答

评论会员: 时间:2