I submit a first draft of my model for audio components and the related
unified API. It's a further elaboration of my previous proposal limited
to plugins.
Comments, review, suggestions to give up are welcome.
--
Abramo Bagnara mailto:[EMAIL PROTECTED]
Opera Unica Phone: +39.546.656023
Via Emilia Interna, 140
48014 Castel Bolognese (RA) - Italy
ALSA project http://www.alsa-project.org
It sounds good!
/*
* All-in-one sound boxes API
* Copyright (c) 2001 by Abramo Bagnara <[EMAIL PROTECTED]>
*
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
/* TODO: check parallelization model */
/************/
/* SOUNDBOX */
/************/
int soundbox_open(soundbox_t **soundbox, soundbox_id_t id);
int soundbox_close(soundbox_t *soundbox);
int soundbox_prepare(soundbox_t *soundbox);
int soundbox_relax(soundbox_t *soundbox);
int soundbox_set_property(soundbox_t *soundbox,
soundbox_property_id_t property,
const soundbox_property_value_t *value);
int soundbox_get_property(soundbox_t *soundbox,
soundbox_property_id_t property,
soundbox_property_value_t *value);
int soundbox_query_property(soundbox_t *soundbox,
soundbox_property_id_t property,
soundbox_property_info_t *info);
int soundbox_get_port(soundbox_t *soundbox, int idx, soundbox_port_t **port);
#define SOUNDBOX_PROPERTY_TIME /* box is time related */
#define SOUNDBOX_PROPERTY_STATE /* running, stopped, disabled */
#define SOUNDBOX_PROPERTY_PORTS /* ports count */
#define SOUNDBOX_PROPERTY_PANELS /* panels count */
#define SOUNDBOX_PROPERTY_WORKERS_MODE /* parallelization split: channel, frame */
#define SOUNDBOX_PROPERTY_WORKERS /* workers count */
/********/
/* PORT */
/********/
int soundbox_port_set_property(soundbox_port_t *port,
soundbox_port_property_id_t property,
const soundbox_port_property_value_t *value);
int soundbox_port_get_property(soundbox_port_t *port,
soundbox_port_property_id_t property,
soundbox_port_property_value_t *value);
int soundbox_port_query_property(soundbox_port_t *port,
soundbox_port_property_id_t property,
soundbox_port_property_info_t *info);
int soundbox_port_link(soundbox_port_t *port1, soundbox_port_t *port2);
#define SOUNDBOX_PORT_PROPERTY_POLL /* port has poll */
#define SOUNDBOX_PORT_PROPERTY_POLL_FD /* poll file descriptor */
#define SOUNDBOX_PORT_PROPERTY_CHANNELS /* channels count */
#define SOUNDBOX_PORT_PROPERTY_RATE /* frame rate */
#define SOUNDBOX_PORT_PROPERTY_FORMAT /* sampel format */
#define SOUNDBOX_PORT_PROPERTY_DIRECTION /* input, output */
#define SOUNDBOX_PORT_PROPERTY_INPUT_REUSE /* buffer reused for output */
#define SOUNDBOX_PORT_PROPERTY_OUTPUT_MODE /* set, add */
#define SOUNDBOX_PORT_PROPERTY_BUFFER_SHAPE /* interleaved, noninterleaved,
complex */
#define SOUNDBOX_PORT_PROPERTY_BUFFER_SIZE /* size of buffer */
#define SOUNDBOX_PORT_PROPERTY_AVAIL_MIN /* frames for ready condition */
/********/
/* FLOW */
/********/
int soundbox_flow_open(soundbox_flow_t **flow, soundbox_port_t *port, int worker);
int soundbox_flow_close(soundbox_flow_t *flow);
int soundbox_flow_wait(soundbox_flow_t *flow);
sframes_t sounbox_flow_avail(soundbox_flow_t *flow);
int soundbox_flow_begin(soundbox_flow_t *flow, channel_area_t **areas,
uframes_t *offset, uframes_t *frames);
/* xruns are reported here */
int soundbox_flow_commit(soundbox_flow_t *flow, uframes_t offset,
uframes_t frames);
int soundbox_flow_set_property(soundbox_flow_t *flow,
soundbox_flow_property_id_t property,
const soundbox_flow_property_value_t *value);
int soundbox_flow_get_property(soundbox_flow_t *flow,
soundbox_flow_property_id_t property,
soundbox_flow_property_value_t *value);
int soundbox_flow_query_property(soundbox_flow_t *flow,
soundbox_flow_property_id_t property,
soundbox_flow_property_info_t *info);
/*********/
/* PANEL */
/*********/
int soundbox_panel_open(soundbox_panel_t **panel, soundbox_t *box,
soundbox_panel_id_t *id);
int soundbox_panel_close(soundbox_panel_t *panel);
int soundbox_panel_set_property(soundbox_panel_t *panel,
soundbox_panel_property_id_t property,
const soundbox_panel_property_value_t *value);
int soundbox_panel_get_property(soundbox_panel_t *panel,
soundbox_panel_property_id_t property,
soundbox_panel_property_value_t *value);
int soundbox_panel_query_property(soundbox_panel_t *panel,
soundbox_panel_property_id_t property,
soundbox_panel_property_info_t *info);
int soundbox_panel_write_begin(soundbox_panel_t *panel);
int soundbox_panel_write_commit(soundbox_panel_t *panel);
int soundbox_panel_read_begin(soundbox_panel_t *panel);
int soundbox_panel_read_commit(soundbox_panel_t *panel);
int soundbox_panel_get_control(soundbox_panel_t *panel, int idx,
control_t **control);
#define SOUNDBOX_PANEL_PROPERTY_CONTROLS /* controls count */
#define SOUNDBOX_PANEL_PROPERTY_SHM /* available for use from other
processes */
#define SOUNDBOX_PANEL_PROPERTY_SHM_RO_KEY /* key_t */
#define SOUNDBOX_PANEL_PROPERTY_SHM_RO_SIZE /* area size */
#define SOUNDBOX_PANEL_PROPERTY_SHM_RO_PERMS /* permissions */
#define SOUNDBOX_PANEL_PROPERTY_SHM_RW_KEY /* key_t */
#define SOUNDBOX_PANEL_PROPERTY_SHM_RW_SIZE /* area size */
#define SOUNDBOX_PANEL_PROPERTY_SHM_RW_PERMS /* permissions */
/***********/
/* CONTROL */
/***********/
int soundbox_control_set_property(soundbox_control_t *control,
soundbox_control_property_id_t property,
const soundbox_control_property_value_t *value);
int soundbox_control_get_property(soundbox_control_t *control,
soundbox_control_property_id_t property,
soundbox_control_property_value_t *value);
int soundbox_control_query_property(soundbox_control_t *control,
soundbox_control_property_id_t property,
soundbox_control_property_info_t *info);
#define SOUNDBOX_CONTROL_TYPE /* enum */
#define SOUNDBOX_CONTROL_WIDGET /* widget hint */
#define SOUNDBOX_CONTROL_SLOTS /* slots count */
#define SOUNDBOX_CONTROL_VALUE(slot)