org.log4jfugue
Class SoundBuilder

java.lang.Object
  extended by java.lang.Thread
      extended by org.log4jfugue.SoundBuilder
All Implemented Interfaces:
java.lang.Runnable
Direct Known Subclasses:
RhythmSoundBuilder

public class SoundBuilder
extends java.lang.Thread

One of the two primary threads of the system, this class builds and plays the actual music strings.

Author:
btarbox

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
protected  Music music
           
protected  Player player
           
protected  com.sun.media.sound.SoftSynthesizer synth
           
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
SoundBuilder()
           
 
Method Summary
protected  java.lang.String buildMusicString(java.lang.String allVoices)
           
 void run()
          Build the music string to send to JFugue.
 void setMusic(Music music)
          likely set by spring
 void setPlayer(Player player)
          set by spring
 
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

music

protected Music music

synth

protected com.sun.media.sound.SoftSynthesizer synth

player

protected Player player
Constructor Detail

SoundBuilder

public SoundBuilder()
Method Detail

setMusic

public void setMusic(Music music)
likely set by spring

Parameters:
music -

setPlayer

public void setPlayer(Player player)
set by spring

Parameters:
player -

run

public void run()
Build the music string to send to JFugue. On each iteration it swaps the accumulator indexes, then starts converting the music counts into music strings. Once the music strings are built they are sent to JFugue. The JFugue call blocks for the duration of the play, which is the only delay in the main for-ever loop of this method.

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

buildMusicString

protected java.lang.String buildMusicString(java.lang.String allVoices)