codesimian
Class AllSound

java.lang.Object
  extended by java.lang.Thread
      extended by codesimian.AllSound
All Implemented Interfaces:
java.lang.Runnable

public class AllSound
extends java.lang.Thread


Nested Class Summary
static interface AllSound.ByteMaker
          Provides the bytes to be played through audio output.
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Method Summary
static byte[] doubleToByte(double[] soundData, int bytesPerDouble, boolean bigEndian)
          double range is -1 to 1.
static byte[] floatsToBytes(float[] soundData, int bytesPerFloat)
          double range is -1 to 1.
static javax.sound.sampled.AudioFormat makeAudioFormat()
           
static void play(AllSound.ByteMaker playMeContinuously)
          plays until playMeContinuously.getBytes() returns null
static void play(byte[] playTheseBytes)
          interruptes a ByteMaker if its playing, but will wait on other byte arrays to play
static void play(byte[] playTheseBytes, int preferredThreadPriority)
           
static void play(double[] convertToBytesThenPlay)
          similar to play(byte[])
static void r(javax.sound.sampled.AudioFormat f)
          I removed this stuff from run() so I could call it from other places
static void removeByteMaker()
           
 void run()
          Thread
static void silent()
          erases all sound from the buffer asap and stops playing sound
static int soundBufSiz()
          quantity of audio samples.
static void startIfNotStarted()
           
 
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
 

Method Detail

soundBufSiz

public static int soundBufSiz()
quantity of audio samples. 1 sample may include 2 bytes per channel and multiple channels


run

public void run()
Thread

Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread

play

public static void play(AllSound.ByteMaker playMeContinuously)
plays until playMeContinuously.getBytes() returns null


removeByteMaker

public static void removeByteMaker()

silent

public static void silent()
erases all sound from the buffer asap and stops playing sound


play

public static void play(byte[] playTheseBytes)
interruptes a ByteMaker if its playing, but will wait on other byte arrays to play


play

public static void play(byte[] playTheseBytes,
                        int preferredThreadPriority)

play

public static void play(double[] convertToBytesThenPlay)
similar to play(byte[])


makeAudioFormat

public static javax.sound.sampled.AudioFormat makeAudioFormat()

doubleToByte

public static byte[] doubleToByte(double[] soundData,
                                  int bytesPerDouble,
                                  boolean bigEndian)
double range is -1 to 1. Most parts of AudioFormat are not used.


floatsToBytes

public static byte[] floatsToBytes(float[] soundData,
                                   int bytesPerFloat)
double range is -1 to 1. Most features of AudioFormat are not used. WARNING: does this function assume signed numbers? looks like it doesnt.


r

public static void r(javax.sound.sampled.AudioFormat f)
I removed this stuff from run() so I could call it from other places


startIfNotStarted

public static void startIfNotStarted()