/// Read audio from the "short" type.
virtual std::size_t
read16(std::int16_t * array, std::size_t length);
+
+ /// Start the audio device.
+ /// Input devices: start digitizing samples for the program to
+ /// subsequently read.
+ virtual void
+ start();
+
+ /// Stop the audio device.
+ /// Input devices: stop digitizing samples.
+ virtual void
+ stop();
};
AudioInALSA::AudioInALSA(const char * p)
int error;
if ( !started ) {
- snd_pcm_drop(handle);
- snd_pcm_prepare(handle);
- snd_pcm_start(handle);
- started = true;
+ start();
return AudioFrameSamples;
}
do_throw(error, "Get Frames Available for Read");
}
+ void
+ AudioInALSA::start()
+ {
+ snd_pcm_drop(handle);
+ snd_pcm_prepare(handle);
+ snd_pcm_start(handle);
+ started = true;
+ }
+
+ void
+ AudioInALSA::stop()
+ {
+ snd_pcm_drop(handle);
+ }
+
static bool
initializer()
{
virtual std::size_t
ready();
+ /// Start the audio device.
+ /// Output devices: prepare for samples to be sent.
+ virtual void
+ start();
+
+ /// Stop the audio device.
+ /// Output devices: stop playing samples.
+ virtual void
+ stop();
+
/// Write audio from the "short" type.
virtual std::size_t
write16(const std::int16_t * array, std::size_t length);
do_throw(error, "Get Frames Available for Write");
}
+ void
+ AudioOutALSA::start()
+ {
+ snd_pcm_drop(handle);
+ snd_pcm_prepare(handle);
+ started = true;
+ }
+
+ void
+ AudioOutALSA::stop()
+ {
+ snd_pcm_drop(handle);
+ }
+
static bool
initializer()
{