Minim index
Name AudioSample
Examples
None available
Description An AudioSample is a special kind of file playback that allows you to repeatedly trigger an audio file. It does this by keeping the entire file in an internal buffer and then keeping a list of trigger points. It is {@link Recordable} and {@link Effectable} so access to the samples is available and AudioEffects can be attached to it, but there are not the cueing abilities found on an AudioSnippet and AudioPlayer. All you can do is trigger() the sound. However, you can trigger the sound even if it is still playing back. It is not advised that you use this class for long sounds (like entire songs, for example) because the entire file is kept in memory.
Constructors
AudioSample(output);
AudioSource(istream);
Controller(cntrls);
Parameters
stream   the stream that will provide the audio
istream   the AudioStream to subscribe to and wrap
cntrls   an array of Controls that this Controller will manipulate
Fields
BALANCE   The balance control type.

GAIN   The gain control type.

MUTE   The mute control type.

PAN   The pan control type.

SAMPLE_RATE   The sample rate control type.

VOLUME   The volume control type.

left   The buffer containing the left channel samples. If this is a mono AudioSource, it contains the single channel of audio.

mix   The buffer containing the mix of the left and right channels. If this is a mono AudioSource, mix contains the same samples as left.

right   The buffer containing the right channel samples. If this is a mono AudioSource, right contains the same samples as left.

Methods
balance ( )   Gets the balance control for the Line, if it exists. You should check for the availability of a balance control by using {@link #hasControl(javax.sound.sampled.Control.Type)} before calling this method.

close ( )   Closes the AudioStream this was constructed with.

gain ( )   Gets the gain control for the Line, if it exists. You should check for the availability of a gain control by using {@link #hasControl(javax.sound.sampled.Control.Type)} before calling this method.

getBalance ( )   Returns the current balance of the line. This will be in the range [-1, 1]. If a balance control is not available, this will do nothing.

getControls ( )   Returns an array of all the available Controls for the DataLine being controlled. You can use this if you want to access the controls directly, rather than using the convenience methods provided by this class.

getGain ( )   Returns the current gain. If a gain control is not available, this returns 0. Note that the gain is not the same thing as the level() of an AudioBuffer!

getPan ( )   Returns the current pan value. This will be in the range [-1, 1]. If the pan control is not available

getVolume ( )   Returns the current volume. If a volume control is not available, this returns 0. Note that the volume is not the same thing as the level() of an AudioBuffer!

hasControl ( )   Returns whether or not the particular control type is supported by the Line being controlled.

isMuted ( )   Returns true if the line is muted.

mute ( )   Mutes the line.

pan ( )   Gets the pan control for the Line, if it exists. You should check for the availability of a pan control by using {@link #hasControl(javax.sound.sampled.Control.Type)} before calling this method.

printControls ( )   Prints the available controls and their ranges to the console. Not all lines have all of the controls available on them so this is a way to find out what is available.

setBalance ( )   Sets the balance of the line to v. The provided value should be in the range [-1, 1]. If a balance control is not available, this will do nothing.

setGain ( )   Sets the gain to v. If a gain control is not available, this does nothing.

setPan ( )   Sets the pan of the line to v. The provided value should be in the range [-1, 1].

setVolume ( )   Sets the volume to v. If a volume control is not available, this does nothing.

shiftBalance ( )   Shifts the value of the balance from from to to in the space of millis milliseconds.

shiftGain ( )   Shifts the value of the gain from from to to in the space of millis

shiftPan ( )   Shifts the value of the pan from from to to in the space of millis milliseconds.

shiftVolume ( )   Shifts the value of the volume from from to to in the space of millis milliseconds.

unmute ( )   Unmutes the line.

volume ( )   Gets the volume control for the Line, if it exists. You should check for the availability of a volume control by using {@link #hasControl(javax.sound.sampled.Control.Type)} before calling this method.

Usage Web & Application
Related