-/** @brief Structure of a backend */
-struct speaker_backend {
- /** @brief Which backend this is
- *
- * @c -1 terminates the list.
- */
- int backend;
-
- /** @brief Flags
- *
- * Possible values
- * - @ref FIXED_FORMAT
- */
- unsigned flags;
-/** @brief Lock to configured sample format */
-#define FIXED_FORMAT 0x0001
-
- /** @brief Initialization
- *
- * Called once at startup. This is responsible for one-time setup
- * operations, for instance opening a network socket to transmit to.
- *
- * When writing to a native sound API this might @b not imply opening the
- * native sound device - that might be done by @c activate below.
- */
- void (*init)(void);
-
- /** @brief Activation
- * @return 0 on success, non-0 on error
- *
- * Called to activate the output device.
- *
- * After this function succeeds, @ref ready should be non-0. As well as
- * opening the audio device, this function is responsible for reconfiguring
- * if it necessary to cope with different samples formats (for backends that
- * don't demand a single fixed sample format for the lifetime of the server).
- */
- int (*activate)(void);
-
- /** @brief Play sound
- * @param frames Number of frames to play
- * @return Number of frames actually played
- */
- size_t (*play)(size_t frames);
-
- /** @brief Deactivation
- *
- * Called to deactivate the sound device. This is the inverse of
- * @c activate above.
- */
- void (*deactivate)(void);
-
- /** @brief Called before poll()
- *
- * Called before the call to poll(). Should call addfd() to update the FD
- * array and stash the slot number somewhere safe.
- */
- void (*beforepoll)(void);
-
- /** @brief Called after poll()
- * @return 0 if we could play, non-0 if not
- *
- * Called after the call to poll(). Should arrange to play some audio if the
- * output device is ready.
- *
- * The return value should be 0 if the device was ready to play, or nonzero
- * if it was not.
- */
- int (*afterpoll)(void);
-};
-