From: Jaroslav Kysela Date: Sat, 21 Jun 2003 08:55:40 +0000 (+0000) Subject: Initial version of simple pcm + mixer interfaces X-Git-Tag: v1.0.3~162 X-Git-Url: https://git.alsa-project.org/?a=commitdiff_plain;h=501342abbbaa20af87ad18c83c688225edbba3e8;p=alsa-lib.git Initial version of simple pcm + mixer interfaces --- diff --git a/include/mixer_simple.h b/include/mixer_simple.h new file mode 100644 index 00000000..e2db7f35 --- /dev/null +++ b/include/mixer_simple.h @@ -0,0 +1,114 @@ +/** + * \file + * \brief Application interface library for the ALSA driver + * \author Jaroslav Kysela + * \date 2003 + * + * Application interface library for the ALSA driver. + * See the \ref mixer_simple page for more details. + * + * + * This library is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +#ifndef __ALSA_MIXER_SIMPLE_H +#define __ALSA_MIXER_SIMPLE_H + +/** Simple Mixer latency type */ +enum snds_mixer_io_type { + + /** master volume - left (0-1000) */ + SNDS_MIO_MASTER_LVOL = 0, + /** master volume - right (0-1000) */ + SNDS_MIO_MASTER_RVOL, + /** master volume - left mute (0 = off, 1 = on) */ + SNDS_MIO_MASTER_LMUTE, + /** master volume - right mute (0 = off, 1 = on) */ + SNDS_MIO_MASTER_RMUTE, + + /** pcm volume - left (0-1000) */ + SNDS_MIO_Mixer_LVOL, + /** pcm volume - right (0-1000) */ + SNDS_MIO_Mixer_RVOL, + /** pcm volume - left mute (0 = off, 1 = on) */ + SNDS_MIO_Mixer_LMUTE, + /** pcm volume - right mute (0 = off, 1 = on) */ + SNDS_MIO_Mixer_RMUTE, + + /** CD volume - left (0-1000) */ + SNDS_MIO_CD_LVOL, + /** CD volume - right (0-1000) */ + SNDS_MIO_CD_RVOL, + /** CD volume - left mute (0 = off, 1 = on) */ + SNDS_MIO_CD_LMUTE, + /** CD volume - right mute (0 = off, 1 = on) */ + SNDS_MIO_CD_RMUTE, + + /** AUX volume - left (0-1000) */ + SNDS_MIO_AUX_LVOL, + /** CD volume - right (0-1000) */ + SNDS_MIO_AUX_RVOL, + /** CD volume - left mute (0 = off, 1 = on) */ + SNDS_MIO_AUX_LMUTE, + /** CD volume - right mute (0 = off, 1 = on) */ + SNDS_MIO_AUX_RMUTE, + + + /** capture gain - left (0-1000) */ + SNDS_MIO_CGAIN_LVOL = 0x1000, + /** capture gain - right (0-1000) */ + SNDS_MIO_CGAIN_RVOL, + + + /** capture source - mic switch (0 = off, 1 = on) */ + SNDS_MIO_CSOURCE_MIC = 0x1100, + /** capture source - line switch (0 = off, 1 = on)*/ + SNDS_MIO_CSOURCE_LINE, + /** capture source - CD switch (0 = off, 1 = on) */ + SNDS_MIO_CSOURCE_CD, + /** capture source - AUX switch (0 = off, 1 = on) */ + SNDS_MIO_CSOURCE_AUX, + /** capture source - mix switch (0 = off, 1 = on) */ + SNDS_MIO_CSOURCE_MIX +}; + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * \defgroup Mixer_simple Mixer Simple Interface + * See the \ref mixer_simple page for more details. + * \{ + */ + +int snds_mixer_open(snds_mixer_t **pcm, const char *playback_name, const char *capture_name); +int snds_mixer_open_lconf(snds_mixer_t **pcm, const char *plaback_name, const char *capture_name, snd_config_t *lconf); +int snds_mixer_close(snds_mixer_t *pcm); +int snds_mixer_poll_descriptors_count(snds_mixer_t *pcm); +int snds_mixer_poll_descriptors(snds_mixer_t *pcm, struct pollfd *pfds, unsigned int space); +int snds_mixer_poll_descriptors_revents(snds_mixer_t *pcm, struct pollfd *pfds, unsigned int nfds, unsigned short *revents); +int snds_mixer_io_get(snds_mixer_t *pcm, enum snds_mixer_io_type type, int *val); +int snds_mixer_io_set(snds_mixer_t *pcm, enum snds_mixer_io_type type, int val); +int snds_mixer_io_change(snds_mixer_t *mixer, enum snds_mixer_io_type *changed, int changed_array_size); + +/** \} */ + +#ifdef __cplusplus +} +#endif + +#endif /* __ALSA_MIXER_SIMPLE_H */ diff --git a/include/pcm_simple.h b/include/pcm_simple.h new file mode 100644 index 00000000..38a8d070 --- /dev/null +++ b/include/pcm_simple.h @@ -0,0 +1,117 @@ +/** + * \file + * \brief Application interface library for the ALSA driver + * \author Jaroslav Kysela + * \date 2003 + * + * Application interface library for the ALSA driver. + * See the \ref pcm_simple page for more details. + * + * + * This library is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +#ifndef __ALSA_PCM_SIMPLE_H +#define __ALSA_PCM_SIMPLE_H + +#include + +/** Simple PCM latency type */ +enum snds_pcm_latency_type { + /** normal latency - for standard playback or capture + (estimated latency in one direction 350ms) */ + SNDS_PCM_LATENCY_NORMAL = 0, + /** medium latency - software phones etc. + (estimated latency in one direction 50ms) */ + SNDS_PCM_LATENCY_MEDIUM, + /** realtime latency - realtime applications (effect processors etc.) + (estimated latency in one direction 5ms) */ + SNDS_PCM_LATENCY_REALTIME +}; + +/** Simple PCM access type */ +enum snds_pcm_access_type { + /** interleaved access - channels are interleaved without any gaps among samples */ + SNDS_PCM_ACCESS_INTERLEAVED = 0, + /** noninterleaved access - channels are separate without any gaps among samples */ + SNDS_PCM_ACCESS_NONINTERLEAVED +}; + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * \defgroup PCM_simple PCM Simple Interface + * See the \ref pcm_simple page for more details. + * \{ + */ + +int snds_pcm_open(snds_pcm_t **pcm, const char *playback_name, const char *capture_name); +int snds_pcm_open_lconf(snds_pcm_t **pcm, const char *plaback_name, const char *capture_name, snd_config_t *lconf); +int snds_pcm_close(snds_pcm_t *pcm); +int snds_pcm_poll_descriptors_count(snds_pcm_t *pcm); +int snds_pcm_poll_descriptors(snds_pcm_t *pcm, struct pollfd *pfds, unsigned int space); +int snds_pcm_poll_descriptors_revents(snds_pcm_t *pcm, struct pollfd *pfds, unsigned int nfds, unsigned short *revents); +int snds_pcm_start(snds_pcm_t *pcm); +int snds_pcm_drop(snds_pcm_t *pcm); +int snds_pcm_drain(snds_pcm_t *pcm); +int snds_pcm_delay(snds_pcm_t *pcm, snd_pcm_sframes_t *delayp); +int snds_pcm_resume(snd_pcm_t *pcm); +int snds_pcm_wait(snds_pcm_t *pcm, int timeout); +snd_pcm_t *snds_pcm_raw_playback(snds_pcm_t *pcm); +snd_pcm_t *snds_pcm_raw_capture(snds_pcm_t *pcm); + +/** + * \defgroup PCM_simple_params Parameters Functions + * \ingroup PCM_simple + * See the \ref pcm_simple page for more details. + * \{ + */ + +int snds_pcm_param_rate(snds_pcm_t *pcm, unsigned int rate, unsigned int *used_rate); +int snds_pcm_param_channels(snds_pcm_t *pcm, unsigned int channels, unsigned int *used_channels); +int snds_pcm_param_format(snds_pcm_t *pcm, snd_pcm_format_t format, snd_pcm_subformat_t subformat); +int snds_pcm_param_latency(snds_pcm_t *pcm, enum snds_pcm_latency_type latency); +int snds_pcm_param_access(snds_pcm_t *pcm, enum snds_pcm_access_type access); + +/** \} */ + +/** + * \defgroup PCM_simple_access Ring Buffer I/O Functions + * \ingroup PCM_simple + * See the \ref pcm_simple page for more details. + * \{ + */ + +/* playback */ +int snds_pcm_pio_ibegin(snds_pcm_t *pcm, void *ring_buffer, snd_pcm_uframes_t *frames); +int snds_pcm_pio_iend(snds_pcm_t *pcm, snd_pcm_uframes_t frames); +int snds_pcm_pio_nbegin(snds_pcm_t *pcm, void **ring_buffer, snd_pcm_uframes_t *frames); +int snds_pcm_pio_nend(snds_pcm_t *pcm, snd_pcm_uframes_t frames); +/* capture */ +int snds_pcm_cio_ibegin(snds_pcm_t *pcm, void *ring_buffer, snd_pcm_uframes_t *frames); +int snds_pcm_cio_iend(snds_pcm_t *pcm, snd_pcm_uframes_t frames); +int snds_pcm_cio_nbegin(snds_pcm_t *pcm, void **ring_buffer, snd_pcm_uframes_t *frames); +int snds_pcm_cio_nend(snds_pcm_t *pcm, snd_pcm_uframes_t frames); + +/** \} */ + +#ifdef __cplusplus +} +#endif + +#endif /* __ALSA_PCM_SIMPLE_H */