ddf.mimin.javasound
Class JSBaseAudioRecordingStream

java.lang.Object
  extended by ddf.mimin.javasound.JSBaseAudioRecordingStream
All Implemented Interfaces:
AudioRecording, AudioRecordingStream, AudioResource, AudioStream, java.lang.Runnable
Direct Known Subclasses:
JSMPEGAudioRecordingStream, JSPCMAudioRecordingStream

public abstract class JSBaseAudioRecordingStream
extends java.lang.Object
implements java.lang.Runnable, AudioRecordingStream


Field Summary
protected  javax.sound.sampled.AudioInputStream ais
           
protected  javax.sound.sampled.AudioFormat format
           
protected  JSMinim system
           
 
Method Summary
 int bufferSize()
          The size of the buffer that will be sent to listeners and effects.
 void close()
          Closes the resource, releasing any memory.
 javax.sound.sampled.Control[] getControls()
          Returns the Controls available for this AudioResource.
 javax.sound.sampled.AudioFormat getFormat()
          Returns the AudioFormat of this AudioResource.
 int getLoopCount()
          How many loops are left to go.
 int getMillisecondPosition()
          Gets the current millisecond position of the source.
 boolean isPlaying()
           
 void loop(int n)
          Starts looping playback from the current position.
 void open()
          Opens the resource to be used.
 void pause()
          Stops playback of the source.
 void play()
          Starts playback of the source.
protected abstract  void rewind()
           
 void run()
           
 void setAudioEffect(AudioEffect effect)
          Set the AudioEffect to apply to this stream.
 void setAudioListener(AudioListener listener)
          Set the AudioListener to receive samples from this source.
 void setLoopPoints(int start, int stop)
          Sets the loops points in the source, in milliseconds
 void setMillisecondPosition(int millis)
          Sets the current millisecond position of the source.
protected abstract  int skip(int millis)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface ddf.minim.spi.AudioRecording
getMetaData, getMillisecondLength
 

Field Detail

ais

protected javax.sound.sampled.AudioInputStream ais

format

protected javax.sound.sampled.AudioFormat format

system

protected JSMinim system
Method Detail

run

public void run()
Specified by:
run in interface java.lang.Runnable

play

public void play()
Description copied from interface: AudioRecording
Starts playback of the source.

Specified by:
play in interface AudioRecording

isPlaying

public boolean isPlaying()
Specified by:
isPlaying in interface AudioRecording

pause

public void pause()
Description copied from interface: AudioRecording
Stops playback of the source.

Specified by:
pause in interface AudioRecording

loop

public void loop(int n)
Description copied from interface: AudioRecording
Starts looping playback from the current position. Playback will continue to the loop's end point, then loop back to the loop start point count times, and finally continue playback to the end of the clip. If the current position when this method is invoked is greater than the loop end point, playback simply continues to the end of the source without looping. A count value of 0 indicates that any current looping should cease and playback should continue to the end of the clip. The behavior is undefined when this method is invoked with any other value during a loop operation. If playback is stopped during looping, the current loop status is cleared; the behavior of subsequent loop and start requests is not affected by an interrupted loop operation.

Specified by:
loop in interface AudioRecording
Parameters:
n - the number of times playback should loop back from the loop's end position to the loop's start position, or Minim.LOOP_CONTINUOUSLY to indicate that looping should continue until interrupted

open

public void open()
Description copied from interface: AudioResource
Opens the resource to be used.

Specified by:
open in interface AudioResource

close

public void close()
Description copied from interface: AudioResource
Closes the resource, releasing any memory.

Specified by:
close in interface AudioResource

bufferSize

public int bufferSize()
Description copied from interface: AudioStream
The size of the buffer that will be sent to listeners and effects.

Specified by:
bufferSize in interface AudioStream
Returns:
the size of the buffer sent to listeners

getFormat

public javax.sound.sampled.AudioFormat getFormat()
Description copied from interface: AudioResource
Returns the AudioFormat of this AudioResource.

Specified by:
getFormat in interface AudioResource
Returns:
the AudioFormat of this AudioResource

getLoopCount

public int getLoopCount()
Description copied from interface: AudioRecording
How many loops are left to go. 0 means this isn't looping and -1 means that it is looping continuously.

Specified by:
getLoopCount in interface AudioRecording
Returns:
how many loops left

setLoopPoints

public void setLoopPoints(int start,
                          int stop)
Description copied from interface: AudioRecording
Sets the loops points in the source, in milliseconds

Specified by:
setLoopPoints in interface AudioRecording
Parameters:
start - the position of the beginning of the loop
stop - the position of the end of the loop

getMillisecondPosition

public int getMillisecondPosition()
Description copied from interface: AudioRecording
Gets the current millisecond position of the source.

Specified by:
getMillisecondPosition in interface AudioRecording
Returns:
the current possition, in milliseconds in the source

setMillisecondPosition

public void setMillisecondPosition(int millis)
Description copied from interface: AudioRecording
Sets the current millisecond position of the source.

Specified by:
setMillisecondPosition in interface AudioRecording
Parameters:
millis - the posititon to cue the playback head to

getControls

public javax.sound.sampled.Control[] getControls()
Description copied from interface: AudioResource
Returns the Controls available for this AudioResource.

Specified by:
getControls in interface AudioResource
Returns:
an array of Control objects, that can be used to manipulate the resource

setAudioEffect

public void setAudioEffect(AudioEffect effect)
Description copied from interface: AudioStream
Set the AudioEffect to apply to this stream.

Specified by:
setAudioEffect in interface AudioStream
Parameters:
effect - the AudioEffect to apply to the stream

setAudioListener

public void setAudioListener(AudioListener listener)
Description copied from interface: AudioStream
Set the AudioListener to receive samples from this source.

Specified by:
setAudioListener in interface AudioStream
Parameters:
listener - the AudioListener to receive samples

rewind

protected abstract void rewind()

skip

protected abstract int skip(int millis)