/** * Get a Java Sound API AudioFormat object using this object's * properties. * * @return The Java Sound API Audio Format object. */ public javax.sound.sampled.AudioFormat getJavaAudioFormat() { // Convert the OpenIMAJ audio format to a Java Sound audio format object return new javax.sound.sampled.AudioFormat( (int)this.getSampleRateKHz() * 1000, this.getNBits(), this.getNumChannels(), this.isSigned(), this.isBigEndian() ); } }
/** * Get a Java Sound API AudioFormat object using this object's * properties. * * @return The Java Sound API Audio Format object. */ public javax.sound.sampled.AudioFormat getJavaAudioFormat() { // Convert the OpenIMAJ audio format to a Java Sound audio format object return new javax.sound.sampled.AudioFormat( (int)this.getSampleRateKHz() * 1000, this.getNBits(), this.getNumChannels(), this.isSigned(), this.isBigEndian() ); } }
/** * Open a line to the Java Sound APIs. * * @throws Exception * if the Java sound system could not be initialised. */ private void openJavaSound() throws Exception { // Convert the OpenIMAJ audio format to a Java Sound audio format object final javax.sound.sampled.AudioFormat audioFormat = new javax.sound.sampled.AudioFormat( (int) (this.getFormat().getSampleRateKHz() * 1000), this .getFormat().getNBits(), this.getFormat() .getNumChannels(), this.getFormat().isSigned(), this .getFormat().isBigEndian()); System.out.println("Creating Java Sound Line with " + this.getFormat()); // Create info to create an output data line final DataLine.Info info = new DataLine.Info(TargetDataLine.class, audioFormat); try { // Get the output line to write to using the given // sample format we just created. this.mLine = (TargetDataLine) AudioSystem.getLine(info); // If no exception has been thrown we open the line. this.mLine.open(audioFormat); } catch (final LineUnavailableException e) { throw new Exception("Could not open Java Sound audio line for" + " the audio format " + this.getFormat()); } }
/** * Open a line to the Java Sound APIs. * * @throws Exception * if the Java sound system could not be initialised. */ private void openJavaSound() throws Exception { // Convert the OpenIMAJ audio format to a Java Sound audio format object final javax.sound.sampled.AudioFormat audioFormat = new javax.sound.sampled.AudioFormat( (int) (this.getFormat().getSampleRateKHz() * 1000), this .getFormat().getNBits(), this.getFormat() .getNumChannels(), this.getFormat().isSigned(), this .getFormat().isBigEndian()); System.out.println("Creating Java Sound Line with " + this.getFormat()); // Create info to create an output data line final DataLine.Info info = new DataLine.Info(TargetDataLine.class, audioFormat); try { // Get the output line to write to using the given // sample format we just created. this.mLine = (TargetDataLine) AudioSystem.getLine(info); // If no exception has been thrown we open the line. this.mLine.open(audioFormat); } catch (final LineUnavailableException e) { throw new Exception("Could not open Java Sound audio line for" + " the audio format " + this.getFormat()); } }
XuggleAudio.this.getFormat().isSigned());
XuggleAudio.this.getFormat().isSigned());