Saturday 15 March 2014

java - Why can I only get the Audio Input of the "primary/standard" audio device? -



java - Why can I only get the Audio Input of the "primary/standard" audio device? -

i have written java programme sound input of selected sound device. works primary/standard sound device (primary/standard selected in operation system).

start(); starts sound input streaming:

public void run() { while (continueloop) { n = targetdataline.read(tempbuffer, 0, tempbuffer.length); updatemeter(); seek { object_output_stream.writeobject(tempbuffer); object_output_stream.reset(); } grab (ioexception ex) { ex.printstacktrace(); continueloop = false; } } }

if seek select sound source returns noise. can tell me why?

if (e.getsource() == combo1) { system.out.println("gewählter input: " + combo1.getselecteditem()); mixer.info[] mixerinfo = audiosystem.getmixerinfo(); (int cnt = 0; cnt < mixerinfo.length; cnt++) { mixer currentmixer = audiosystem.getmixer(mixerinfo[cnt]); if (mixerinfo[cnt].getname() == combo1.getselecteditem().tostring()) { system.out.println("gewählter input gefunden"); if ( !first_time) { if (targetdataline.isrunning()) targetdataline.stop(); if (targetdataline.isopen()) targetdataline.close(); } datalineinfo = new dataline.info(targetdataline.class, getaudioformat()); seek { targetdataline = (targetdataline) currentmixer.getline(datalineinfo); targetdataline.open(getaudioformat()); targetdataline.start(); if (first_time) { start(); first_time = false; } } grab (lineunavailableexception e1) { e1.printstacktrace(); } } } }

sooooo spended days of headache find java bug , turns out windows bug. code works on pc perfectly...

java audio

No comments:

Post a Comment