Crossfire JXClient, Trunk
|
Public Member Functions | |
Processor (@NotNull final CharSequence name, @NotNull final AudioFileLoader audioFileLoader) | |
void | run () |
void | terminate (final boolean fadeOut) |
Private Member Functions | |
void | convertSample (final byte @NotNull[] buf, final int i) |
AudioInputStream | openAudioInputStream () throws IOException, UnsupportedAudioFileException |
Private Attributes | |
final AudioFileLoader | audioFileLoader |
final CharSequence | name |
int | state |
float | volume = MIN_VALUE |
Static Private Attributes | |
static final float | MAX_VOLUME = 0.2F |
static final float | MIN_VALUE = 1.0E-3F |
static final float | VOLUME_STEP_PER_SAMPLE = 1.00005F |
A thread that plays a music file over and over until terminated.
Definition at line 39 of file Processor.java.
com.realtime.crossfire.jxclient.sound.Processor.Processor | ( | @NotNull final CharSequence | name, |
@NotNull final AudioFileLoader | audioFileLoader | ||
) |
Creates a new instance.
name | the music name to play |
audioFileLoader | the audio file loader for loading audio files |
Definition at line 86 of file Processor.java.
References com.realtime.crossfire.jxclient.sound.Processor.audioFileLoader, and com.realtime.crossfire.jxclient.sound.Processor.name.
|
private |
Converts one audio sample according to the current volume.
buf | the buffer holding the sample |
i | the sample offset |
Definition at line 202 of file Processor.java.
References com.realtime.crossfire.jxclient.sound.Processor.MAX_VOLUME, and com.realtime.crossfire.jxclient.sound.Processor.volume.
Referenced by com.realtime.crossfire.jxclient.sound.Processor.run().
|
private |
Opens and returns an audio stream for name.
IOException | if the file cannot be opened |
UnsupportedAudioFileException | if the file cannot be decoded |
Definition at line 221 of file Processor.java.
References com.realtime.crossfire.jxclient.sound.Processor.audioFileLoader, com.realtime.crossfire.jxclient.sound.AudioFileLoader.getInputStream(), and com.realtime.crossfire.jxclient.sound.Processor.name.
Referenced by com.realtime.crossfire.jxclient.sound.Processor.run().
void com.realtime.crossfire.jxclient.sound.Processor.run | ( | ) |
Definition at line 101 of file Processor.java.
References com.realtime.crossfire.jxclient.sound.Processor.convertSample(), com.realtime.crossfire.jxclient.sound.Processor.MIN_VALUE, com.realtime.crossfire.jxclient.sound.Processor.name, com.realtime.crossfire.jxclient.sound.Processor.openAudioInputStream(), com.realtime.crossfire.jxclient.sound.Processor.state, com.realtime.crossfire.jxclient.sound.Processor.volume, and com.realtime.crossfire.jxclient.sound.Processor.VOLUME_STEP_PER_SAMPLE.
void com.realtime.crossfire.jxclient.sound.Processor.terminate | ( | final boolean | fadeOut | ) |
Stops playing music. The music is faded out rather than cut off.
fadeOut | Whether tp fade out the music ( true
false
|
Definition at line 96 of file Processor.java.
References com.realtime.crossfire.jxclient.sound.Processor.state.
Referenced by com.realtime.crossfire.jxclient.sound.MusicManager.restart(), and com.realtime.crossfire.jxclient.sound.MusicManager.shutdown().
|
private |
The AudioFileLoader for loading audio files.
Definition at line 67 of file Processor.java.
Referenced by com.realtime.crossfire.jxclient.sound.Processor.openAudioInputStream(), and com.realtime.crossfire.jxclient.sound.Processor.Processor().
|
staticprivate |
The maximum volume.
Definition at line 49 of file Processor.java.
Referenced by com.realtime.crossfire.jxclient.sound.Processor.convertSample().
|
staticprivate |
The minimum factor for fading in/out effects.
Definition at line 44 of file Processor.java.
Referenced by com.realtime.crossfire.jxclient.sound.Processor.run().
|
private |
The name of the music to play.
Definition at line 61 of file Processor.java.
Referenced by com.realtime.crossfire.jxclient.sound.Processor.openAudioInputStream(), com.realtime.crossfire.jxclient.sound.Processor.Processor(), and com.realtime.crossfire.jxclient.sound.Processor.run().
|
private |
The current state: 0=fade in, 1=playing, 2=fade out, 3=terminate, 4=terminate immediately.
Definition at line 73 of file Processor.java.
Referenced by com.realtime.crossfire.jxclient.sound.Processor.run(), and com.realtime.crossfire.jxclient.sound.Processor.terminate().
|
private |
The current volume. It is a factor that is multiplied to all sample values while fading in/out.
Definition at line 79 of file Processor.java.
Referenced by com.realtime.crossfire.jxclient.sound.Processor.convertSample(), and com.realtime.crossfire.jxclient.sound.Processor.run().
|
staticprivate |
The step for the fading in/out factor. It is multiplied to the current value for each sample.
Definition at line 55 of file Processor.java.
Referenced by com.realtime.crossfire.jxclient.sound.Processor.run().