Package snap.swing
Class SwingSoundClip
java.lang.Object
snap.gfx.SoundClip
snap.swing.SwingSoundClip
Manages sound data from sound file bytes.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
static final int
static final int
static final int
static final int
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
bitRate()
Returns the bit rate.static boolean
Returns whether sound data can read given extension.boolean
Standard equals implementation.int
Returns the bits per sample.byte[]
getBytes()
Returns the sound bytes.int
Returns the channel count.getClip()
Returns the clip, creating it if requested.int
Returns the sound length in milliseconds.byte[]
Returns the sample bytes.int
Returns the sample count.int
Returns the samples per second.int
getTime()
Returns the sound time in milliseconds.boolean
Returns whether sound is playing.boolean
Whether file is recording.void
pause()
Pauses a sound.void
play()
Plays the sound.void
play
(int aCount) Plays the sound repeatedly for given count.void
Record start.void
Record stop.void
save()
Override to clear modified.void
setBytes
(byte[] theBytes) Sets the sound bytes.void
setTime
(int aTime) Sets the sound time in milliseconds.void
stop()
Tells sound to stop playing.Methods inherited from class snap.gfx.SoundClip
create, get, get, getSoundURL
-
Field Details
-
BitRate5k
public static final int BitRate5k- See Also:
-
BitRate11k
public static final int BitRate11k- See Also:
-
BitRate22k
public static final int BitRate22k- See Also:
-
BitRate44k
public static final int BitRate44k- See Also:
-
BitRateUndefined
public static final int BitRateUndefined- See Also:
-
-
Constructor Details
-
SwingSoundClip
Creates a new sound data for given source.
-
-
Method Details
-
getBytes
public byte[] getBytes()Returns the sound bytes. -
setBytes
public void setBytes(byte[] theBytes) Sets the sound bytes. -
getBitsPerSample
public int getBitsPerSample()Returns the bits per sample. -
getSamplesPerSecond
public int getSamplesPerSecond()Returns the samples per second. -
getChannelCount
public int getChannelCount()Returns the channel count. -
getSampleCount
public int getSampleCount()Returns the sample count. -
getSampleBytes
public byte[] getSampleBytes()Returns the sample bytes. -
bitRate
public int bitRate()Returns the bit rate. -
isPlaying
public boolean isPlaying()Returns whether sound is playing. -
play
public void play()Plays the sound. -
play
public void play(int aCount) Plays the sound repeatedly for given count. -
stop
public void stop()Tells sound to stop playing. -
pause
public void pause()Pauses a sound. -
getLength
public int getLength()Returns the sound length in milliseconds. -
getTime
public int getTime()Returns the sound time in milliseconds. -
setTime
public void setTime(int aTime) Sets the sound time in milliseconds. -
getClip
Returns the clip, creating it if requested. -
isRecording
public boolean isRecording()Whether file is recording.- Specified by:
isRecording
in classSoundClip
-
recordStart
public void recordStart()Record start.- Specified by:
recordStart
in classSoundClip
-
recordStop
public void recordStop()Record stop.- Specified by:
recordStop
in classSoundClip
-
save
Override to clear modified.- Specified by:
save
in classSoundClip
- Throws:
IOException
-
equals
Standard equals implementation. -
canRead
Returns whether sound data can read given extension.
-