public abstract class AudioBuffer extends Object
AudioBuffer
supplies sound
recording and playing services. Audio data is discarded
when the AudioBuffer
object is destroyed.JavaSoundAudioBuffer
Modifier and Type | Field and Description |
---|---|
protected static AudioBuffer |
activeAudioBuffer
Currently running
AudioBuffer (static object, because only one can be
running). |
protected static Cursor |
backMainOwnerCursor
Original
Cursor of the main owner of the
active AudioBuffer . |
protected static Cursor |
backOwnerCursor
Original
Cursor used by the active AudioBuffer . |
protected int |
m_seconds
Maximum recording length, in seconds.
|
protected static Component |
mainOwner
Main owner (usually a
Frame ) of the active AudioBuffer . |
static int |
MAX_RECORD_LENGTH
Default maximum length of recordings (in seconds).
|
protected static Component |
owner
Owner of the active
AudioBuffer . |
protected static Cursor |
recCursor
Cursor displayed when recording.
|
Constructor and Description |
---|
AudioBuffer(int seconds)
Creates new AudioBuffer
|
Modifier and Type | Method and Description |
---|---|
static boolean |
busy()
Checks if the
AudioBuffer is currently recording
or playing sound. |
protected abstract void |
clear()
Performs cleanup of recorded audio data.
|
protected void |
finalize()
Performs explicit cleanup of recorded audio data before
destroying the object.
|
protected static void |
forceStop()
The usual way to stop the recording or playnig processes is to place a flag in
their thread and wait to next cycle.
|
protected static AudioBuffer |
getActiveAudioBuffer()
Only one
AudioBuffer can be "active", because the
sound recording hardware cannot be shared between processes. |
protected static void |
hideRecordingCursor()
Resets the mouse cursor to its original state.
|
abstract void |
play()
Plays the recorded audio data, if any.
|
protected abstract void |
record()
Starts the recording of sound, without any visual indication.
|
void |
record(PlayStation ps,
ActiveBox bx)
Starts sound recording with visual indications: the mouse cursor switchs a
microphone.
|
protected static void |
showRecordingCursor()
Displays the recording cursor.
|
abstract void |
stop()
Stops playing or recording, if running.
|
public static final int MAX_RECORD_LENGTH
protected int m_seconds
protected static Cursor recCursor
protected static AudioBuffer activeAudioBuffer
AudioBuffer
(static object, because only one can be
running).protected static Component owner
AudioBuffer
.protected static Cursor backOwnerCursor
Cursor
used by the active AudioBuffer
.protected static Component mainOwner
Frame
) of the active AudioBuffer
.public abstract void play() throws Exception
Exception
- If something goes wrongpublic abstract void stop()
protected abstract void clear()
protected void finalize() throws Throwable
public static boolean busy()
AudioBuffer
is currently recording
or playing sound.true
if recording or playing, false
otherwise.protected static AudioBuffer getActiveAudioBuffer()
AudioBuffer
can be "active", because the
sound recording hardware cannot be shared between processes.
This method returns the currently active AudioBuffer
, if any.AudioBuffer
, or null
if none is active.public void record(PlayStation ps, ActiveBox bx) throws Exception
ps
- A valid PlayStation
, used to retrieve the recording cursor image and to
determine the main component associated to this AudioBuffer
.bx
- The ActiveBox
associated to this recording. If null
, the
default Component
for the provided PlayStation
will be used.Exception
- If someting goes wrongprotected abstract void record() throws Exception
AudioBuffer
must implement this method.Exception
- If something goes wrong.protected static void forceStop() throws Exception
Exception
- If something goes wrongprotected static void showRecordingCursor()
protected static void hideRecordingCursor()
Copyright © 2004-15 Francesc Busquets (fbusquets@xtec.cat) & Departament d'Educació de la Generalitat de Catalunya (info@xtec.cat)
Licensed under the terms of the GNU General Public License.