public class SoundBufferRecorder extends SoundRecorder
SoundRecorder
which stores captured audio data into a SoundBuffer
.Constructor and Description |
---|
SoundBufferRecorder()
Constructs a sound buffer recorder.
|
Modifier and Type | Method and Description |
---|---|
ConstSoundBuffer |
getBuffer()
Gets the sound buffer containing the captured audio data.
|
protected long |
nativeCreate()
Deprecated.
|
protected void |
nativeDelete()
Deprecated.
|
protected void |
nativeSetExPtr()
Deprecated.
|
protected boolean |
onProcessSamples(short[] samples)
Called when a new batch of audio samples comes in.
|
protected boolean |
onStart()
Called when the sound recorder starts recording.
|
protected void |
onStop()
Called when the audio capture has stopped.
|
getSampleRate, isAvailable, start, start, stop
finalize
public SoundBufferRecorder()
@Deprecated protected long nativeCreate()
SFMLNativeObject
nativeCreate
in class SoundRecorder
@Deprecated protected void nativeSetExPtr()
SFMLNativeObject
It is called after the object has been created or wrapped around an already existing pointer.
nativeSetExPtr
in class SoundRecorder
@Deprecated protected void nativeDelete()
SFMLNativeObject
nativeDelete
in class SoundRecorder
public ConstSoundBuffer getBuffer()
The sound buffer will remain empty until any sound has been successfully captured
using the SoundRecorder.start(int)
and SoundRecorder.stop()
methods.
protected final boolean onStart()
SoundRecorder
This method can be implemented by deriving classes to perform any actions necessary before audio recording actually starts.
onStart
in class SoundRecorder
true
to start recording after this method is done, false
to cancel.protected final boolean onProcessSamples(short[] samples)
SoundRecorder
Implementing classes can then process the captured audio data.
Note that this method will be called in a separate audio capturing thread.
Also note that this method is currently hardcoded to be called every 100ms, which might be changed in the future.
onProcessSamples
in class SoundRecorder
samples
- the 16-bit mono samples that were captured.true
to continue recording after this method is done, false
to stop recording.protected final void onStop()
SoundRecorder
Note that this method will be called in a separate audio capturing thread.
onStop
in class SoundRecorder