ch.claudio.audio
Class Playback

java.lang.Object
  extended by java.lang.Thread
      extended by ch.claudio.audio.Playback
All Implemented Interfaces:
java.lang.Runnable

public class Playback
extends java.lang.Thread

Version:
$Id: Playback.java 148 2006-09-14 20:52:32Z claudio $
Author:
Claudio Nieder

Copyright (C) 2006 Claudio Nieder <private@claudio.ch>, CH-8610 Uster

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA


Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
static int bufferSize
          Expected size of a one second buffer.
static int channels
          Number of channels used
static int sampleRate
          Sample rate of this playback
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
Playback()
          Default constructor
 
Method Summary
static void main(java.lang.String[] args)
          Print license.
 void play(byte[] buffer, int sizeArg)
          Play the given buffer.
 void run()
           
 void stopPlaying()
          Stop playing the current buffer
 void terminateThread()
          Terminate the thread.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

sampleRate

public static final int sampleRate
Sample rate of this playback

See Also:
Constant Field Values

channels

public static final int channels
Number of channels used

See Also:
Constant Field Values

bufferSize

public static final int bufferSize
Expected size of a one second buffer.

See Also:
Constant Field Values
Constructor Detail

Playback

public Playback()
Default constructor

Method Detail

run

public void run()
Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread
See Also:
Thread.run()

stopPlaying

public void stopPlaying()
Stop playing the current buffer


terminateThread

public void terminateThread()
Terminate the thread.


play

public void play(byte[] buffer,
                 int sizeArg)
Play the given buffer. It is not copied.

Parameters:
buffer - Buffer with data to play as little-endian two channel two byte values
sizeArg - size of the part of the array to play.

main

public static void main(java.lang.String[] args)
Print license.

Parameters:
args - ignored