/// All drivers present a unidirectional interface.
/// If the underlying device is bidirectional that detail is hidden and
/// we present one or more separate read and write drivers.
+ /// \return The number of audio samples or bytes that can be read or
+ /// written.
virtual std::size_t ready() = 0;
+ ///
+ virtual int poll_fds(struct pollfd * array, int space) = 0;
+
virtual ~IODevice() = 0;
};
AudioOutALSA(const char * parameters);
~AudioOutALSA();
+ /// Return file descriptors for poll()
+ /// \param size The address of a variable that will be written
+ /// with the number of file descriptors in the array.
+ /// \return The address of an array of integers containing the
+ /// file descriptors.
+ virtual int
+ poll_fds(struct pollfd * array, int space);
+
/// Return the number of audio samples the device can handle in
/// a write without blocking.
virtual std::size_t
return ALSAEnumerate(stream, SND_PCM_STREAM_PLAYBACK);
}
+ int
+ AudioOutALSA::poll_fds(struct pollfd * array, int space)
+ {
+ const int size = snd_pcm_poll_descriptors_count(handle);
+
+ snd_pcm_poll_descriptors(
+ handle,
+ array,
+ space);
+
+ return size;
+ }
+
std::size_t
AudioOutALSA::ready()
{