Archive for September, 2007

Web site management - Chapter 22 Java Media Framework and Java Sound

Saturday, September 15th, 2007

Chapter 22 Java Media Framework and Java Sound (on CD) 1281 122 // if replay set, replay forever 123 else 124 125 if ( lineEvent.getType() == LineEvent.Type.STOP && 126 replay ) { 127 128 System.out.println( “replay” ); 129 130 // replay clip forever 131 clip.loop( Clip.LOOP_CONTINUOUSLY ); 132 } 133 } 134 135 // set replay of clip 136 public void setReplay( boolean value ) 137 { 138 replay = value; 139 } 140 141 // stop and close clip, returning system resources 142 public void close() 143 { 144 if( clip != null ) { 145 clip.stop(); 146 clip.close(); 147 } 148 } 149 150 } // end class ClipPlayer Fig. 22.5 ClipPlayerplays an audio file (part 4 of 4). All Lines generate LineEvents, which can be handled by LineListeners. LineEvents occur when starting, stopping, playing and closing a Lineobject. Although a Linestops playback automatically when it reaches the end of an audio file, class Clip- Playerimplements interface LineListener(line 10) and can close the Clippermanently or replay the Clip(discussed shortly). LineListeners are useful for tasks that must be synchronized with the LineEventstates of a line. The Clip reads audio data from an AudioInputStream (a subclass of Input- Stream), which provides access to the stream s data content. This example loads clips of the audio data before attempting to play it, and therefore is able to determine the length of the clip in frames. Each frame represents data at a specific time interval in the audio file. To play sampled audio files using Java Sound, a program must obtain an AudioInput- Stream from an audio file, obtain a formatted Clip line, load the AudioInput- Streaminto the Clip line and start the data flow in the Clip line. To play back sampled audio, the audio stream must be obtained from an audio file. ClipPlayermethod openFile(lines 31 54) obtains audio from soundFile(initialized in the ClipPlayer constructor at lines 25 28). Lines 35 36 call AudioSystem static method getAudioInputStream to obtain an AudioInputStream for soundFile. Class AudioSystemfacilitates access to many of the resources needed to play and manipulate sound files. Method getAudioInputStreamthrows an Unsup
We would like to recommend you tested and proved virtual web hosting services, which you will surely find to be of great quality.

1280 Java Media Framework and Java Sound (on (Abyss web server)

Friday, September 14th, 2007

Chapter 22 Java Media Framework (Web site development) and Java Sound

Friday, September 14th, 2007

1278 Java Media Framework and Java Sound (on (Java web server)

Thursday, September 13th, 2007

Chapter 22 Java Media (Web site counters) Framework and Java Sound

Thursday, September 13th, 2007

1276 Java Media Framework and Java Sound (on (Web server extensions)

Wednesday, September 12th, 2007

Web hosting e commerce - Chapter 22 Java Media Framework and Java Sound

Wednesday, September 12th, 2007

1274 Java Media Framework and Java Sound (on (Vps web hosting)

Wednesday, September 12th, 2007

Web design service - Chapter 22 Java Media Framework and Java Sound

Tuesday, September 11th, 2007

1272 Java Media Framework and Java Sound (on (Web hosting plans)

Tuesday, September 11th, 2007