jAudioFeatureExtractor.jAudioTools
Class AudioMethodsPlayback

java.lang.Object
  extended by jAudioFeatureExtractor.jAudioTools.AudioMethodsPlayback

public class AudioMethodsPlayback
extends java.lang.Object

A holder class for static methods and internal classes relating to playing back audio recordings.

Author:
Cory McKay

Nested Class Summary
static class AudioMethodsPlayback.PlayThread
          A thread for playing an AudioInputStream directly to a SourceDataLine.
 
Constructor Summary
AudioMethodsPlayback()
           
 
Method Summary
static void playAudioInputStream(javax.sound.sampled.AudioInputStream audio_input_stream, javax.sound.sampled.SourceDataLine source_data_line)
          Plays the samples in the given AudioInputStream to the specified SourceDataLine.
static AudioMethodsPlayback.PlayThread playAudioInputStreamInterruptible(javax.sound.sampled.AudioInputStream audio_input_stream, javax.sound.sampled.SourceDataLine source_data_line)
          Plays the samples in the given AudioInputStream to the specified SourceDataLine.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AudioMethodsPlayback

public AudioMethodsPlayback()
Method Detail

playAudioInputStreamInterruptible

public static AudioMethodsPlayback.PlayThread playAudioInputStreamInterruptible(javax.sound.sampled.AudioInputStream audio_input_stream,
                                                                                javax.sound.sampled.SourceDataLine source_data_line)
                                                                         throws java.lang.Exception
Plays the samples in the given AudioInputStream to the specified SourceDataLine.

The thread performing the playback is returned to the user, so the user has the option of interrupting it if he or she wishes.

Note that the same AudioFormat must be used by both the AudioInputStream and the SourceDataLine.

Parameters:
audio_input_stream - The audio stream to be played.
source_data_line - Where the samples are to be played to.
Throws:
java.lang.Exception - Throws an exception if the AudioFormat of the audio_input_stream parameter does not match that of the source_data_line parameter.

playAudioInputStream

public static void playAudioInputStream(javax.sound.sampled.AudioInputStream audio_input_stream,
                                        javax.sound.sampled.SourceDataLine source_data_line)
                                 throws java.lang.Exception
Plays the samples in the given AudioInputStream to the specified SourceDataLine.

This playback is not interruptible by the user, and will continue until the AudioInputStream is empty. The playAudioInputStreamInterruptible method should be called instead if the user wishes to be able to interrupt playback.

Note that the same AudioFormat must be used by both the AudioInputStream and the SourceDataLine.

Parameters:
audio_input_stream - The audio stream to be played.
source_data_line - Where the samples are to be played to.
Throws:
java.lang.Exception - Throws an exception if the AudioFormat of the audio_input_stream parameter does not match that of the source_data_line parameter.