Java voice chat room prototype
Originally, it is very complicated from the microphone to get audio input, and it is very simple to have Javasound already packaged. You can use AUDIOCAPTURE to complete.
The playback of chat room audio is generally completed: The AudioPlayStream class is responsible. The chat room is more complicated or the combination of audio flow and multi-threaded. 1 A session that needs to be created for each chat, is a client connection. 2 Need to create a thread corresponding to the session to send an audio stream. 3 Create a thread that receives the audio stream, after receiving, play. Technical difficulties: 1. Look at the following code: while (! Thread.currentthread (). Interrupted ())) {Try {nbr = pbis.read (data); if (nbr == -1) {c = true; Break;} PBL.Write (DATA, 0, NBREAD);} catch (ioexception e) {system.exit (1);}}
The above is: while (! Thread.currentthread (). Interrupted ())) This sentence, what is the case? Is SYSTEM.EXIT (1) this is not exiting the current thread?
2, while ((! Thread.currentthread (). Interrupted ())) {b = mis.read (CV, 0, BS); SS.WRITE (CV, 0, B);} Taking voice using this way Input, if the line is computed, print an error message.
http://www-106.ibm.com/developerWorks/websphere/zones/voice/
Http://openjavaproject.blogdriver.com/diary/openjavaproject/index.html