From 66a3d542ace67f52b3bf70e6679e9e69e83df69a Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Fri, 7 Nov 2025 14:27:38 +0100 Subject: [PATCH] huge correction of tabulators and whitespaces Signed-off-by: Jaroslav Kysela --- aserver/aserver.c | 12 +- include/alsa-symbols.h | 4 +- include/aserver.h | 4 +- include/conf.h | 16 +- include/control.h | 6 +- include/global.h | 2 +- include/local.h | 2 +- include/mixer.h | 16 +- include/mixer_abst.h | 12 +- include/pcm.h | 28 +- include/pcm_extplug.h | 2 +- include/pcm_ioplug.h | 4 +- include/pcm_plugin.h | 12 +- include/seq.h | 2 +- include/seq_event.h | 6 +- include/seqmid.h | 4 +- include/sound/uapi/asequencer.h | 10 +- include/sound/uapi/asound.h | 2 +- include/sound/uapi/emu10k1.h | 2 +- include/sound/uapi/hdsp.h | 4 +- include/sound/uapi/sb16_csp.h | 2 +- include/timer.h | 4 +- include/use-case.h | 20 +- modules/mixer/simple/ac97.c | 2 +- modules/mixer/simple/hda.c | 2 +- modules/mixer/simple/python.c | 224 ++++---- modules/mixer/simple/sbase.c | 32 +- modules/mixer/simple/sbasedl.c | 4 +- src/async.c | 2 +- src/conf.c | 78 +-- src/confmisc.c | 84 +-- src/control/cards.c | 6 +- src/control/control.c | 16 +- src/control/control_ext.c | 10 +- src/control/control_hw.c | 8 +- src/control/control_local.h | 2 +- src/control/control_shm.c | 6 +- src/control/control_symbols.c | 2 +- src/control/ctlparse.c | 8 +- src/control/hcontrol.c | 10 +- src/control/namehint.c | 60 +-- src/control/setup.c | 4 +- src/dlmisc.c | 6 +- src/hwdep/hwdep.c | 18 +- src/hwdep/hwdep_hw.c | 2 +- src/hwdep/hwdep_symbols.c | 2 +- src/input.c | 10 +- src/mixer/mixer.c | 4 +- src/mixer/mixer_local.h | 2 +- src/mixer/simple.c | 6 +- src/mixer/simple_abst.c | 4 +- src/mixer/simple_none.c | 28 +- src/names.c | 2 +- src/output.c | 8 +- src/pcm/interval.c | 6 +- src/pcm/interval.h | 6 +- src/pcm/interval_inline.h | 8 +- src/pcm/ladspa.h | 68 +-- src/pcm/mask.c | 2 +- src/pcm/mask.h | 2 +- src/pcm/mask_inline.h | 52 +- src/pcm/pcm.c | 256 ++++----- src/pcm/pcm_adpcm.c | 32 +- src/pcm/pcm_alaw.c | 38 +- src/pcm/pcm_asym.c | 30 +- src/pcm/pcm_copy.c | 10 +- src/pcm/pcm_direct.c | 46 +- src/pcm/pcm_direct.h | 6 +- src/pcm/pcm_dmix.c | 54 +- src/pcm/pcm_dmix_generic.c | 24 +- src/pcm/pcm_dmix_i386.c | 8 +- src/pcm/pcm_dmix_i386.h | 2 +- src/pcm/pcm_dmix_x86_64.c | 6 +- src/pcm/pcm_dmix_x86_64.h | 6 +- src/pcm/pcm_dshare.c | 36 +- src/pcm/pcm_dsnoop.c | 40 +- src/pcm/pcm_empty.c | 6 +- src/pcm/pcm_extplug.c | 12 +- src/pcm/pcm_file.c | 30 +- src/pcm/pcm_generic.c | 6 +- src/pcm/pcm_generic.h | 4 +- src/pcm/pcm_hooks.c | 8 +- src/pcm/pcm_hw.c | 20 +- src/pcm/pcm_iec958.c | 34 +- src/pcm/pcm_ioplug.c | 10 +- src/pcm/pcm_ladspa.c | 908 ++++++++++++++++---------------- src/pcm/pcm_lfloat.c | 34 +- src/pcm/pcm_linear.c | 38 +- src/pcm/pcm_local.h | 10 +- src/pcm/pcm_meter.c | 28 +- src/pcm/pcm_misc.c | 6 +- src/pcm/pcm_mmap.c | 26 +- src/pcm/pcm_mmap_emul.c | 2 +- src/pcm/pcm_mulaw.c | 30 +- src/pcm/pcm_multi.c | 22 +- src/pcm/pcm_null.c | 18 +- src/pcm/pcm_params.c | 92 ++-- src/pcm/pcm_plug.c | 40 +- src/pcm/pcm_plugin.c | 26 +- src/pcm/pcm_plugin.h | 10 +- src/pcm/pcm_rate.c | 54 +- src/pcm/pcm_rate_linear.c | 18 +- src/pcm/pcm_route.c | 68 +-- src/pcm/pcm_share.c | 42 +- src/pcm/pcm_shm.c | 14 +- src/pcm/pcm_simple.c | 14 +- src/pcm/pcm_softvol.c | 48 +- src/pcm/pcm_symbols.c | 2 +- src/pcm/plugin_ops.h | 26 +- src/pcm/scopes/level.c | 2 +- src/rawmidi/rawmidi.c | 18 +- src/rawmidi/rawmidi_hw.c | 14 +- src/rawmidi/rawmidi_symbols.c | 2 +- src/rawmidi/rawmidi_virt.c | 2 +- src/seq/seq.c | 234 ++++---- src/seq/seq_hw.c | 2 +- src/seq/seq_symbols.c | 2 +- src/seq/seqmid.c | 10 +- src/socket.c | 4 +- src/timer/timer.c | 20 +- src/timer/timer_hw.c | 2 +- src/timer/timer_query.c | 22 +- src/timer/timer_query_hw.c | 2 +- src/timer/timer_symbols.c | 4 +- src/topology/builder.c | 6 +- src/topology/channel.c | 4 +- src/topology/ctl.c | 4 +- src/topology/dapm.c | 4 +- src/topology/data.c | 6 +- src/topology/elem.c | 4 +- src/topology/ops.c | 4 +- src/topology/parser.c | 4 +- src/topology/pcm.c | 4 +- src/topology/text.c | 4 +- src/ucm/main.c | 12 +- src/ucm/parser.c | 10 +- src/ucm/ucm_local.h | 8 +- src/ucm/utils.c | 14 +- src/userfile.c | 2 +- test/audio_time.c | 2 +- test/control.c | 2 +- test/latency.c | 46 +- test/midifile.c | 14 +- test/midifile.h | 4 +- test/midiloop.c | 16 +- test/mixtest.c | 44 +- test/omixer.c | 2 +- test/pcm.c | 38 +- test/pcm_min.c | 2 +- test/playmidi1.c | 34 +- test/queue_timer.c | 2 +- test/rawmidi.c | 46 +- test/seq-decoder.c | 20 +- test/seq-sender.c | 10 +- test/seq.c | 24 +- test/timer.c | 6 +- test/user-ctl-element-set.c | 2 +- 157 files changed, 2008 insertions(+), 2008 deletions(-) diff --git a/aserver/aserver.c b/aserver/aserver.c index 1924021c..823b345c 100644 --- a/aserver/aserver.c +++ b/aserver/aserver.c @@ -50,7 +50,7 @@ char *command; fprintf(stderr, ##args); \ putc('\n', stderr); \ } while (0) -#endif +#endif #define SYSERROR(string) ERROR(string ": %s", strerror(errno)) @@ -67,7 +67,7 @@ static int make_local_socket(const char *filename) SYSERROR("socket failed"); return result; } - + unlink(filename); addr->sun_family = AF_LOCAL; @@ -94,7 +94,7 @@ static int make_inet_socket(int port) SYSERROR("socket failed"); return result; } - + memset(&addr, 0, sizeof(addr)); addr.sin_family = AF_INET; addr.sin_port = htons(port); @@ -329,7 +329,7 @@ static int pcm_shm_close(client_t *client) } err = snd_pcm_close(client->device.pcm.handle); ctrl->result = err; - if (err < 0) + if (err < 0) ERROR("snd_pcm_close"); if (client->transport.shm.ctrl) { err = shmdt((void *)client->transport.shm.ctrl); @@ -592,7 +592,7 @@ static int ctl_shm_close(client_t *client) } err = snd_ctl_close(client->device.ctl.handle); ctrl->result = err; - if (err < 0) + if (err < 0) ERROR("snd_ctl_close"); if (client->transport.shm.ctrl) { err = shmdt((void *)client->transport.shm.ctrl); @@ -1005,7 +1005,7 @@ static int server(const char *sockname, int port) free(waiters); return result; } - + static void usage(void) { diff --git a/include/alsa-symbols.h b/include/alsa-symbols.h index 2298cb50..6d5b5895 100644 --- a/include/alsa-symbols.h +++ b/include/alsa-symbols.h @@ -56,8 +56,8 @@ #define use_symbol_version(real, name, version) /* nothing */ #if defined(__alpha__) || defined(__mips__) #define use_default_symbol_version(real, name, version) \ - __asm__ (".weak " ASM_NAME(#name)); \ - __asm__ (ASM_NAME(#name) " = " ASM_NAME(#real)) + __asm__ (".weak " ASM_NAME(#name)); \ + __asm__ (ASM_NAME(#name) " = " ASM_NAME(#real)) #else #define use_default_symbol_version(real, name, version) \ __asm__ (".weak " ASM_NAME(#name)); \ diff --git a/include/aserver.h b/include/aserver.h index ffddf2b4..dc31706c 100644 --- a/include/aserver.h +++ b/include/aserver.h @@ -17,7 +17,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ - + #include "../src/pcm/pcm_local.h" #include "../src/control/control_local.h" #include @@ -106,7 +106,7 @@ typedef struct { } snd_pcm_shm_ctrl_t; #define PCM_SHM_SIZE sizeof(snd_pcm_shm_ctrl_t) - + #define SND_CTL_IOCTL_READ _IOR('U', 0xf1, snd_ctl_event_t) #define SND_CTL_IOCTL_CLOSE _IO ('U', 0xf2) #define SND_CTL_IOCTL_POLL_DESCRIPTOR _IO ('U', 0xf3) diff --git a/include/conf.h b/include/conf.h index 327659c9..2a6d8296 100644 --- a/include/conf.h +++ b/include/conf.h @@ -52,15 +52,15 @@ extern "C" { /** \brief Configuration node type. */ typedef enum _snd_config_type { /** Integer number. */ - SND_CONFIG_TYPE_INTEGER, + SND_CONFIG_TYPE_INTEGER, /** 64-bit integer number. */ - SND_CONFIG_TYPE_INTEGER64, + SND_CONFIG_TYPE_INTEGER64, /** Real number. */ - SND_CONFIG_TYPE_REAL, + SND_CONFIG_TYPE_REAL, /** Character string. */ - SND_CONFIG_TYPE_STRING, - /** Pointer (runtime only, cannot be saved). */ - SND_CONFIG_TYPE_POINTER, + SND_CONFIG_TYPE_STRING, + /** Pointer (runtime only, cannot be saved). */ + SND_CONFIG_TYPE_POINTER, /** Compound node. */ SND_CONFIG_TYPE_COMPOUND = 1024 } snd_config_type_t; @@ -108,7 +108,7 @@ void snd_config_unref(snd_config_t *top); int snd_config_search(snd_config_t *config, const char *key, snd_config_t **result); -int snd_config_searchv(snd_config_t *config, +int snd_config_searchv(snd_config_t *config, snd_config_t **result, ...); int snd_config_search_definition(snd_config_t *config, const char *base, const char *key, @@ -122,7 +122,7 @@ int snd_config_search_definition(snd_config_t *config, * \param[in] private_data Handle to the \c private_data node. * \return A non-negative value if successful, otherwise a negative error code. * - * Use a function of this type to define a custom expansion + * Use a function of this type to define a custom expansion */ typedef int (*snd_config_expand_fcn_t)(snd_config_t **dst, const char *s, void *private_data); diff --git a/include/control.h b/include/control.h index b206fbb0..e670e6c1 100644 --- a/include/control.h +++ b/include/control.h @@ -386,7 +386,7 @@ int snd_ctl_open_fallback(snd_ctl_t **ctl, snd_config_t *root, const char *name, int snd_ctl_close(snd_ctl_t *ctl); int snd_ctl_nonblock(snd_ctl_t *ctl, int nonblock); static __inline__ int snd_ctl_abort(snd_ctl_t *ctl) { return snd_ctl_nonblock(ctl, 2); } -int snd_async_add_ctl_handler(snd_async_handler_t **handler, snd_ctl_t *ctl, +int snd_async_add_ctl_handler(snd_async_handler_t **handler, snd_ctl_t *ctl, snd_async_callback_t callback, void *private_data); snd_ctl_t *snd_async_handler_get_ctl(snd_async_handler_t *handler); int snd_ctl_poll_descriptors_count(snd_ctl_t *ctl); @@ -718,7 +718,7 @@ typedef int (*snd_hctl_compare_t)(const snd_hctl_elem_t *e1, const snd_hctl_elem_t *e2); int snd_hctl_compare_fast(const snd_hctl_elem_t *c1, const snd_hctl_elem_t *c2); -/** +/** * \brief HCTL callback function * \param hctl HCTL handle * \param mask event mask @@ -728,7 +728,7 @@ int snd_hctl_compare_fast(const snd_hctl_elem_t *c1, typedef int (*snd_hctl_callback_t)(snd_hctl_t *hctl, unsigned int mask, snd_hctl_elem_t *elem); -/** +/** * \brief HCTL element callback function * \param elem HCTL element * \param mask event mask diff --git a/include/global.h b/include/global.h index 84a40557..ae706133 100644 --- a/include/global.h +++ b/include/global.h @@ -124,7 +124,7 @@ typedef struct _snd_async_handler snd_async_handler_t; */ typedef void (*snd_async_callback_t)(snd_async_handler_t *handler); -int snd_async_add_handler(snd_async_handler_t **handler, int fd, +int snd_async_add_handler(snd_async_handler_t **handler, int fd, snd_async_callback_t callback, void *private_data); int snd_async_del_handler(snd_async_handler_t *handler); int snd_async_handler_get_fd(snd_async_handler_t *handler); diff --git a/include/local.h b/include/local.h index da70cf52..a9f8c126 100644 --- a/include/local.h +++ b/include/local.h @@ -385,7 +385,7 @@ int snd_config_check_hop(snd_config_t *conf); #define SND_CONF_MAX_HOPS 64 int snd_config_search_alias_hooks(snd_config_t *config, - const char *base, const char *key, + const char *base, const char *key, snd_config_t **result); int _snd_conf_generic_id(const char *id); diff --git a/include/mixer.h b/include/mixer.h index 93dd70cd..f9c6026c 100644 --- a/include/mixer.h +++ b/include/mixer.h @@ -51,7 +51,7 @@ typedef struct _snd_mixer_class snd_mixer_class_t; /** Mixer element handle */ typedef struct _snd_mixer_elem snd_mixer_elem_t; -/** +/** * \brief Mixer callback function * \param ctl Mixer handle * \param mask event mask @@ -62,7 +62,7 @@ typedef int (*snd_mixer_callback_t)(snd_mixer_t *ctl, unsigned int mask, snd_mixer_elem_t *elem); -/** +/** * \brief Mixer element callback function * \param elem Mixer element * \param mask event mask @@ -276,17 +276,17 @@ int snd_mixer_selem_set_playback_switch(snd_mixer_elem_t *elem, snd_mixer_selem_ int snd_mixer_selem_set_capture_switch(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, int value); int snd_mixer_selem_set_playback_switch_all(snd_mixer_elem_t *elem, int value); int snd_mixer_selem_set_capture_switch_all(snd_mixer_elem_t *elem, int value); -int snd_mixer_selem_get_playback_volume_range(snd_mixer_elem_t *elem, +int snd_mixer_selem_get_playback_volume_range(snd_mixer_elem_t *elem, long *min, long *max); -int snd_mixer_selem_get_playback_dB_range(snd_mixer_elem_t *elem, +int snd_mixer_selem_get_playback_dB_range(snd_mixer_elem_t *elem, long *min, long *max); -int snd_mixer_selem_set_playback_volume_range(snd_mixer_elem_t *elem, +int snd_mixer_selem_set_playback_volume_range(snd_mixer_elem_t *elem, long min, long max); -int snd_mixer_selem_get_capture_volume_range(snd_mixer_elem_t *elem, +int snd_mixer_selem_get_capture_volume_range(snd_mixer_elem_t *elem, long *min, long *max); -int snd_mixer_selem_get_capture_dB_range(snd_mixer_elem_t *elem, +int snd_mixer_selem_get_capture_dB_range(snd_mixer_elem_t *elem, long *min, long *max); -int snd_mixer_selem_set_capture_volume_range(snd_mixer_elem_t *elem, +int snd_mixer_selem_set_capture_volume_range(snd_mixer_elem_t *elem, long min, long max); int snd_mixer_selem_is_enumerated(snd_mixer_elem_t *elem); diff --git a/include/mixer_abst.h b/include/mixer_abst.h index ec23e0dd..8807eae3 100644 --- a/include/mixer_abst.h +++ b/include/mixer_abst.h @@ -43,11 +43,11 @@ extern "C" { #define SM_CAP_GSWITCH (1<<2) #define SM_CAP_PVOLUME (1<<3) #define SM_CAP_PVOLUME_JOIN (1<<4) -#define SM_CAP_PSWITCH (1<<5) -#define SM_CAP_PSWITCH_JOIN (1<<6) -#define SM_CAP_CVOLUME (1<<7) -#define SM_CAP_CVOLUME_JOIN (1<<8) -#define SM_CAP_CSWITCH (1<<9) +#define SM_CAP_PSWITCH (1<<5) +#define SM_CAP_PSWITCH_JOIN (1<<6) +#define SM_CAP_CVOLUME (1<<7) +#define SM_CAP_CVOLUME_JOIN (1<<8) +#define SM_CAP_CSWITCH (1<<9) #define SM_CAP_CSWITCH_JOIN (1<<10) #define SM_CAP_CSWITCH_EXCL (1<<11) #define SM_CAP_PENUM (1<<12) @@ -77,7 +77,7 @@ typedef struct _sm_class_basic { snd_ctl_card_info_t *info; } sm_class_basic_t; -struct sm_elem_ops { +struct sm_elem_ops { int (*is)(snd_mixer_elem_t *elem, int dir, int cmd, int val); int (*get_range)(snd_mixer_elem_t *elem, int dir, long *min, long *max); int (*set_range)(snd_mixer_elem_t *elem, int dir, long min, long max); diff --git a/include/pcm.h b/include/pcm.h index 3fa9203e..74020511 100644 --- a/include/pcm.h +++ b/include/pcm.h @@ -303,7 +303,7 @@ typedef enum _snd_pcm_subformat { typedef enum _snd_pcm_state { /** Open */ SND_PCM_STATE_OPEN = 0, - /** Setup installed */ + /** Setup installed */ SND_PCM_STATE_SETUP, /** Ready to start */ SND_PCM_STATE_PREPARED, @@ -525,9 +525,9 @@ typedef union _snd_pcm_sync_id { /** #SND_PCM_TYPE_METER scope handle */ typedef struct _snd_pcm_scope snd_pcm_scope_t; -int snd_pcm_open(snd_pcm_t **pcm, const char *name, +int snd_pcm_open(snd_pcm_t **pcm, const char *name, snd_pcm_stream_t stream, int mode); -int snd_pcm_open_lconf(snd_pcm_t **pcm, const char *name, +int snd_pcm_open_lconf(snd_pcm_t **pcm, const char *name, snd_pcm_stream_t stream, int mode, snd_config_t *lconf); int snd_pcm_open_fallback(snd_pcm_t **pcm, snd_config_t *root, @@ -543,7 +543,7 @@ int snd_pcm_poll_descriptors(snd_pcm_t *pcm, struct pollfd *pfds, unsigned int s int snd_pcm_poll_descriptors_revents(snd_pcm_t *pcm, struct pollfd *pfds, unsigned int nfds, unsigned short *revents); int snd_pcm_nonblock(snd_pcm_t *pcm, int nonblock); static __inline__ int snd_pcm_abort(snd_pcm_t *pcm) { return snd_pcm_nonblock(pcm, 2); } -int snd_async_add_pcm_handler(snd_async_handler_t **handler, snd_pcm_t *pcm, +int snd_async_add_pcm_handler(snd_async_handler_t **handler, snd_pcm_t *pcm, snd_async_callback_t callback, void *private_data); snd_pcm_t *snd_async_handler_get_pcm(snd_async_handler_t *handler); int snd_pcm_info(snd_pcm_t *pcm, snd_pcm_info_t *info); @@ -679,15 +679,15 @@ snd_pcm_chmap_t *snd_pcm_chmap_parse_string(const char *str); int snd_pcm_recover(snd_pcm_t *pcm, int err, int silent); int snd_pcm_set_params(snd_pcm_t *pcm, - snd_pcm_format_t format, - snd_pcm_access_t access, - unsigned int channels, - unsigned int rate, - int soft_resample, - unsigned int latency); + snd_pcm_format_t format, + snd_pcm_access_t access, + unsigned int channels, + unsigned int rate, + int soft_resample, + unsigned int latency); int snd_pcm_get_params(snd_pcm_t *pcm, - snd_pcm_uframes_t *buffer_size, - snd_pcm_uframes_t *period_size); + snd_pcm_uframes_t *buffer_size, + snd_pcm_uframes_t *period_size); /** \} */ @@ -1149,7 +1149,7 @@ snd_pcm_sframes_t snd_pcm_mmap_commit(snd_pcm_t *pcm, snd_pcm_sframes_t snd_pcm_mmap_writei(snd_pcm_t *pcm, const void *buffer, snd_pcm_uframes_t size); snd_pcm_sframes_t snd_pcm_mmap_readi(snd_pcm_t *pcm, void *buffer, snd_pcm_uframes_t size); snd_pcm_sframes_t snd_pcm_mmap_writen(snd_pcm_t *pcm, void **bufs, snd_pcm_uframes_t size); -snd_pcm_sframes_t snd_pcm_mmap_readn(snd_pcm_t *pcm, void **bufs, snd_pcm_uframes_t size); +snd_pcm_sframes_t snd_pcm_mmap_readn(snd_pcm_t *pcm, void **bufs, snd_pcm_uframes_t size); /** \} */ @@ -1326,7 +1326,7 @@ int16_t *snd_pcm_scope_s16_get_channel_buffer(snd_pcm_scope_t *scope, /** Simple PCM latency type */ typedef enum _snd_spcm_latency { /** standard latency - for standard playback or capture - (estimated latency in one direction 350ms) */ + (estimated latency in one direction 350ms) */ SND_SPCM_LATENCY_STANDARD = 0, /** medium latency - software phones etc. (estimated latency in one direction maximally 25ms */ diff --git a/include/pcm_extplug.h b/include/pcm_extplug.h index 1294a59e..9049783c 100644 --- a/include/pcm_extplug.h +++ b/include/pcm_extplug.h @@ -49,7 +49,7 @@ enum { SND_PCM_EXTPLUG_HW_CHANNELS, /**< channels */ SND_PCM_EXTPLUG_HW_PARAMS /**< max number of hw constraints */ }; - + /** Handle of external filter plugin */ typedef struct snd_pcm_extplug snd_pcm_extplug_t; /** Callback table of extplug */ diff --git a/include/pcm_ioplug.h b/include/pcm_ioplug.h index 722dc9d7..c41c5c1f 100644 --- a/include/pcm_ioplug.h +++ b/include/pcm_ioplug.h @@ -54,7 +54,7 @@ enum { SND_PCM_IOPLUG_HW_PERIODS, /**< number of periods */ SND_PCM_IOPLUG_HW_PARAMS /**< max number of hw constraints */ }; - + /** I/O plugin handle */ typedef struct snd_pcm_ioplug snd_pcm_ioplug_t; /** Callback table of ioplug */ @@ -114,7 +114,7 @@ struct snd_pcm_ioplug { */ snd_pcm_t *pcm; - snd_pcm_stream_t stream; /**< stream direcion; read-only */ + snd_pcm_stream_t stream; /**< stream direcion; read-only */ snd_pcm_state_t state; /**< current PCM state; read-only */ volatile snd_pcm_uframes_t appl_ptr; /**< application pointer; read-only */ volatile snd_pcm_uframes_t hw_ptr; /**< hw pointer; read-only */ diff --git a/include/pcm_plugin.h b/include/pcm_plugin.h index f3e8f3b5..fa95590d 100644 --- a/include/pcm_plugin.h +++ b/include/pcm_plugin.h @@ -38,7 +38,7 @@ * See the \ref pcm_plugins page for more details. * \{ */ - + #define SND_PCM_PLUGIN_RATE_MIN 4000 /**< minimal rate for the rate plugin */ #define SND_PCM_PLUGIN_RATE_MAX 768000 /**< maximal rate for the rate plugin */ @@ -81,8 +81,8 @@ int snd_pcm_copy_open(snd_pcm_t **pcmp, const char *name, snd_pcm_t *slave, int close_slave); int _snd_pcm_copy_open(snd_pcm_t **pcmp, const char *name, snd_config_t *root, snd_config_t *conf, - snd_pcm_stream_t stream, int mode); - + snd_pcm_stream_t stream, int mode); + /* * Linear conversion plugin */ @@ -111,7 +111,7 @@ int snd_pcm_mulaw_open(snd_pcm_t **pcmp, const char *name, int close_slave); int _snd_pcm_mulaw_open(snd_pcm_t **pcmp, const char *name, snd_config_t *root, snd_config_t *conf, - snd_pcm_stream_t stream, int mode); + snd_pcm_stream_t stream, int mode); /* * Linear<->a-Law conversion plugin @@ -207,8 +207,8 @@ int snd_pcm_jack_open(snd_pcm_t **pcmp, const char *name, snd_config_t *capture_conf, snd_pcm_stream_t stream, int mode); int _snd_pcm_jack_open(snd_pcm_t **pcmp, const char *name, - snd_config_t *root, snd_config_t *conf, - snd_pcm_stream_t stream, int mode); + snd_config_t *root, snd_config_t *conf, + snd_pcm_stream_t stream, int mode); /** \} */ diff --git a/include/seq.h b/include/seq.h index 17bcfa53..686f69dd 100644 --- a/include/seq.h +++ b/include/seq.h @@ -135,7 +135,7 @@ typedef enum snd_seq_client_type { SND_SEQ_USER_CLIENT = 1, /**< user client */ SND_SEQ_KERNEL_CLIENT = 2 /**< kernel client */ } snd_seq_client_type_t; - + /** client MIDI version */ enum { SND_SEQ_CLIENT_LEGACY_MIDI = 0, /**< Legacy client */ diff --git a/include/seq_event.h b/include/seq_event.h index b27ce36c..268578b8 100644 --- a/include/seq_event.h +++ b/include/seq_event.h @@ -61,7 +61,7 @@ enum snd_seq_event_type { SND_SEQ_EVENT_NOTEOFF, /** key pressure change (aftertouch); event data type = #snd_seq_ev_note_t */ SND_SEQ_EVENT_KEYPRESS, - + /** controller; event data type = #snd_seq_ev_ctrl_t */ SND_SEQ_EVENT_CONTROLLER = 10, /** program change; event data type = #snd_seq_ev_ctrl_t */ @@ -87,7 +87,7 @@ enum snd_seq_event_type { SND_SEQ_EVENT_TIMESIGN, /** SMF Key Signature event; event data type = #snd_seq_ev_ctrl_t */ SND_SEQ_EVENT_KEYSIGN, - + /** MIDI Real Time Start message; event data type = #snd_seq_ev_queue_control_t */ SND_SEQ_EVENT_START = 30, /** MIDI Real Time Continue message; event data type = #snd_seq_ev_queue_control_t */ @@ -329,7 +329,7 @@ typedef struct snd_seq_event { snd_seq_event_type_t type; /**< event type */ unsigned char flags; /**< event flags */ unsigned char tag; /**< tag */ - + unsigned char queue; /**< schedule queue */ snd_seq_timestamp_t time; /**< schedule time */ diff --git a/include/seqmid.h b/include/seqmid.h index 6d22692f..1df03bad 100644 --- a/include/seqmid.h +++ b/include/seqmid.h @@ -48,7 +48,7 @@ extern "C" { /** * \brief initialize event record * \param ev event record pointer - * + * * This macro clears the given event record pointer to the default status. */ static inline void snd_seq_ev_clear(snd_seq_event_t *ev) @@ -130,7 +130,7 @@ static inline void snd_seq_ump_ev_clear(snd_seq_ump_event_t *ev) * * This macro sets the event to the direct passing mode * to be delivered immediately without queueing. - * + * * \sa snd_seq_ev_schedule_tick(), snd_seq_ev_schedule_real() */ #define snd_seq_ev_set_direct(ev) \ diff --git a/include/sound/uapi/asequencer.h b/include/sound/uapi/asequencer.h index 9682795b..aa4d6942 100644 --- a/include/sound/uapi/asequencer.h +++ b/include/sound/uapi/asequencer.h @@ -29,7 +29,7 @@ #define SNDRV_SEQ_EVENT_NOTEON 6 #define SNDRV_SEQ_EVENT_NOTEOFF 7 #define SNDRV_SEQ_EVENT_KEYPRESS 8 - + /** control messages (channel specific) * event data type = #snd_seq_ev_ctrl */ @@ -49,13 +49,13 @@ #define SNDRV_SEQ_EVENT_QFRAME 22 /* midi time code quarter frame */ #define SNDRV_SEQ_EVENT_TIMESIGN 23 /* SMF Time Signature event */ #define SNDRV_SEQ_EVENT_KEYSIGN 24 /* SMF Key Signature event */ - + /** timer messages * event data type = snd_seq_ev_queue_control */ #define SNDRV_SEQ_EVENT_START 30 /* midi Real Time Start message */ #define SNDRV_SEQ_EVENT_CONTINUE 31 /* midi Real Time Continue message */ -#define SNDRV_SEQ_EVENT_STOP 32 /* midi Real Time Stop message */ +#define SNDRV_SEQ_EVENT_STOP 32 /* midi Real Time Stop message */ #define SNDRV_SEQ_EVENT_SETPOS_TICK 33 /* set tick queue position */ #define SNDRV_SEQ_EVENT_SETPOS_TIME 34 /* set realtime queue position */ #define SNDRV_SEQ_EVENT_TEMPO 35 /* (SMF) Tempo event */ @@ -282,7 +282,7 @@ struct snd_seq_event { snd_seq_event_type_t type; /* event type */ unsigned char flags; /* event flags */ char tag; - + unsigned char queue; /* schedule queue */ union snd_seq_timestamp time; /* schedule time */ @@ -352,7 +352,7 @@ typedef int __bitwise snd_seq_client_type_t; #define NO_CLIENT ((snd_seq_client_type_t) 0) #define USER_CLIENT ((snd_seq_client_type_t) 1) #define KERNEL_CLIENT ((snd_seq_client_type_t) 2) - + /* event filter flags */ #define SNDRV_SEQ_FILTER_BROADCAST (1U<<0) /* accept broadcast messages */ #define SNDRV_SEQ_FILTER_MULTICAST (1U<<1) /* accept multicast messages */ diff --git a/include/sound/uapi/asound.h b/include/sound/uapi/asound.h index 1f91d994..bdc9a05e 100644 --- a/include/sound/uapi/asound.h +++ b/include/sound/uapi/asound.h @@ -409,7 +409,7 @@ struct snd_pcm_hw_params { SNDRV_PCM_HW_PARAM_FIRST_MASK + 1]; struct snd_mask mres[5]; /* reserved masks */ struct snd_interval intervals[SNDRV_PCM_HW_PARAM_LAST_INTERVAL - - SNDRV_PCM_HW_PARAM_FIRST_INTERVAL + 1]; + SNDRV_PCM_HW_PARAM_FIRST_INTERVAL + 1]; struct snd_interval ires[9]; /* reserved intervals */ unsigned int rmask; /* W: requested masks */ unsigned int cmask; /* R: changed masks */ diff --git a/include/sound/uapi/emu10k1.h b/include/sound/uapi/emu10k1.h index 78d794c0..b6b9f597 100644 --- a/include/sound/uapi/emu10k1.h +++ b/include/sound/uapi/emu10k1.h @@ -188,7 +188,7 @@ #define A_EXTIN_SPDIF_CD_L 0x02 /* digital CD left */ #define A_EXTIN_SPDIF_CD_R 0x03 /* digital CD left */ #define A_EXTIN_OPT_SPDIF_L 0x04 /* audigy drive Optical SPDIF - left */ -#define A_EXTIN_OPT_SPDIF_R 0x05 /* right */ +#define A_EXTIN_OPT_SPDIF_R 0x05 /* right */ #define A_EXTIN_LINE2_L 0x08 /* audigy drive line2/mic2 - left */ #define A_EXTIN_LINE2_R 0x09 /* right */ #define A_EXTIN_ADC_L 0x0a /* Philips ADC - left */ diff --git a/include/sound/uapi/hdsp.h b/include/sound/uapi/hdsp.h index b8df62b6..4f797fcc 100644 --- a/include/sound/uapi/hdsp.h +++ b/include/sound/uapi/hdsp.h @@ -4,7 +4,7 @@ /* * Copyright (C) 2003 Thomas Charbonnel (thomas@undata.org) - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or @@ -65,7 +65,7 @@ struct hdsp_config_info { unsigned char clock_source; unsigned char autosync_ref; unsigned char line_out; - unsigned char passthru; + unsigned char passthru; unsigned char da_gain; unsigned char ad_gain; unsigned char phone_gain; diff --git a/include/sound/uapi/sb16_csp.h b/include/sound/uapi/sb16_csp.h index 55db0b44..8a8dc93f 100644 --- a/include/sound/uapi/sb16_csp.h +++ b/include/sound/uapi/sb16_csp.h @@ -5,7 +5,7 @@ * * SB16ASP/AWE32 CSP control * - * This program is free software; you can redistribute it and/or modify + * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. diff --git a/include/timer.h b/include/timer.h index 09283ce0..7a41331a 100644 --- a/include/timer.h +++ b/include/timer.h @@ -99,13 +99,13 @@ typedef enum _snd_timer_event { SND_TIMER_EVENT_MCONTINUE = SND_TIMER_EVENT_CONTINUE + 10, SND_TIMER_EVENT_MPAUSE = SND_TIMER_EVENT_PAUSE + 10, SND_TIMER_EVENT_MSUSPEND = SND_TIMER_EVENT_SUSPEND + 10, - SND_TIMER_EVENT_MRESUME = SND_TIMER_EVENT_RESUME + 10 + SND_TIMER_EVENT_MRESUME = SND_TIMER_EVENT_RESUME + 10 } snd_timer_event_t; /** timer read structure */ typedef struct _snd_timer_read { unsigned int resolution; /**< tick resolution in nanoseconds */ - unsigned int ticks; /**< count of happened ticks */ + unsigned int ticks; /**< count of happened ticks */ } snd_timer_read_t; /** timer tstamp + event read structure */ diff --git a/include/use-case.h b/include/use-case.h index b54f2124..fb8be446 100644 --- a/include/use-case.h +++ b/include/use-case.h @@ -239,14 +239,14 @@ int snd_use_case_free_list(const char *list[], int items); * */ int snd_use_case_get_list(snd_use_case_mgr_t *uc_mgr, - const char *identifier, - const char **list[]); + const char *identifier, + const char **list[]); /** * \brief Get current - string * \param uc_mgr Use case manager - * \param identifier + * \param identifier * \param value Value pointer * \return Zero if success, otherwise a negative error code * @@ -410,14 +410,14 @@ int snd_use_case_get_list(snd_use_case_mgr_t *uc_mgr, * increase latency. */ int snd_use_case_get(snd_use_case_mgr_t *uc_mgr, - const char *identifier, - const char **value); + const char *identifier, + const char **value); /** * \brief Get current - integer * \param uc_mgr Use case manager - * \param identifier - * \param value result + * \param identifier + * \param value result * \return Zero if success, otherwise a negative error code * * Known identifiers: @@ -456,8 +456,8 @@ int snd_use_case_geti(snd_use_case_mgr_t *uc_mgr, * - check transmit sequence firstly */ int snd_use_case_set(snd_use_case_mgr_t *uc_mgr, - const char *identifier, - const char *value); + const char *identifier, + const char *value); /** * \brief Open and initialise use case core for sound card @@ -482,7 +482,7 @@ int snd_use_case_set(snd_use_case_mgr_t *uc_mgr, * only one ALSA sound card in this case. */ int snd_use_case_mgr_open(snd_use_case_mgr_t **uc_mgr, - const char *card_name); + const char *card_name); /** diff --git a/modules/mixer/simple/ac97.c b/modules/mixer/simple/ac97.c index a87b446b..b37cbd22 100644 --- a/modules/mixer/simple/ac97.c +++ b/modules/mixer/simple/ac97.c @@ -75,7 +75,7 @@ int alsa_mixer_simple_init(snd_mixer_class_t *class) { struct bclass_base_ops *ops; int err; - + err = mixer_simple_basic_dlopen(class, &ops); if (err < 0) return 0; diff --git a/modules/mixer/simple/hda.c b/modules/mixer/simple/hda.c index e62d4b05..49d1cd42 100644 --- a/modules/mixer/simple/hda.c +++ b/modules/mixer/simple/hda.c @@ -76,7 +76,7 @@ int alsa_mixer_simple_init(snd_mixer_class_t *class) { struct bclass_base_ops *ops; int err; - + err = mixer_simple_basic_dlopen(class, &ops); if (err < 0) return 0; diff --git a/modules/mixer/simple/python.c b/modules/mixer/simple/python.c index 1df31049..cf6799c0 100644 --- a/modules/mixer/simple/python.c +++ b/modules/mixer/simple/python.c @@ -68,24 +68,24 @@ static PyInterpreterState *main_interpreter; static inline int get_long(PyObject *o, long *val) { #if PY_MAJOR_VERSION < 3 - if (PyInt_Check(o)) { - *val = PyInt_AsLong(o); - return 0; - } + if (PyInt_Check(o)) { + *val = PyInt_AsLong(o); + return 0; + } #endif - if (PyLong_Check(o)) { - *val = PyLong_AsLong(o); - return 0; - } - return 1; + if (PyLong_Check(o)) { + *val = PyLong_AsLong(o); + return 0; + } + return 1; } static inline PyObject *InternFromString(const char *name) { #if PY_MAJOR_VERSION < 3 - return PyString_InternFromString(name); + return PyString_InternFromString(name); #else - return PyUnicode_InternFromString(name); + return PyUnicode_InternFromString(name); #endif } @@ -191,12 +191,12 @@ static int is_ops(snd_mixer_elem_t *elem, int dir, int cmd, int val) } static int get_x_range_ops(snd_mixer_elem_t *elem, int dir, - long *min, long *max, const char *attr) + long *min, long *max, const char *attr) { PyObject *obj1, *t1, *t2, *res; struct pymelem *pymelem = melem_to_pymelem(elem); int err; - + obj1 = PyTuple_New(1); PyTuple_SET_ITEM(obj1, 0, PyInt_FromLong(dir)); err = pcall(pymelem, attr, obj1, &res); @@ -225,13 +225,13 @@ static int get_x_range_ops(snd_mixer_elem_t *elem, int dir, } static int get_range_ops(snd_mixer_elem_t *elem, int dir, - long *min, long *max) + long *min, long *max) { return get_x_range_ops(elem, dir, min, max, "opsGetRange"); } static int set_range_ops(snd_mixer_elem_t *elem, int dir, - long min, long max) + long min, long max) { PyObject *obj1; struct pymelem *pymelem = melem_to_pymelem(elem); @@ -244,13 +244,13 @@ static int set_range_ops(snd_mixer_elem_t *elem, int dir, } static int get_x_ops(snd_mixer_elem_t *elem, int dir, - long channel, long *value, - const char *attr) + long channel, long *value, + const char *attr) { PyObject *obj1, *t1, *res; struct pymelem *pymelem = melem_to_pymelem(elem); int err; - + obj1 = PyTuple_New(2); PyTuple_SET_ITEM(obj1, 0, PyInt_FromLong(dir)); PyTuple_SET_ITEM(obj1, 1, PyInt_FromLong(channel)); @@ -283,7 +283,7 @@ static int get_volume_ops(snd_mixer_elem_t *elem, int dir, } static int get_switch_ops(snd_mixer_elem_t *elem, int dir, - snd_mixer_selem_channel_id_t channel, int *value) + snd_mixer_selem_channel_id_t channel, int *value) { long value1; int res; @@ -309,7 +309,7 @@ static int ask_dB_vol_ops(snd_mixer_elem_t *elem, PyObject *obj1, *t1, *res; struct pymelem *pymelem = melem_to_pymelem(elem); int err; - + obj1 = PyTuple_New(3); PyTuple_SET_ITEM(obj1, 0, PyInt_FromLong(dir)); PyTuple_SET_ITEM(obj1, 1, PyInt_FromLong(value)); @@ -337,21 +337,21 @@ static int ask_dB_vol_ops(snd_mixer_elem_t *elem, } static int get_dB_ops(snd_mixer_elem_t *elem, - int dir, - snd_mixer_selem_channel_id_t channel, - long *value) + int dir, + snd_mixer_selem_channel_id_t channel, + long *value) { return get_x_ops(elem, dir, channel, value, "opsGetDB"); } static int get_dB_range_ops(snd_mixer_elem_t *elem, int dir, - long *min, long *max) + long *min, long *max) { return get_x_range_ops(elem, dir, min, max, "opsGetDBRange"); } static int set_volume_ops(snd_mixer_elem_t *elem, int dir, - snd_mixer_selem_channel_id_t channel, long value) + snd_mixer_selem_channel_id_t channel, long value) { PyObject *obj1; struct pymelem *pymelem = melem_to_pymelem(elem); @@ -364,7 +364,7 @@ static int set_volume_ops(snd_mixer_elem_t *elem, int dir, } static int set_switch_ops(snd_mixer_elem_t *elem, int dir, - snd_mixer_selem_channel_id_t channel, int value) + snd_mixer_selem_channel_id_t channel, int value) { PyObject *obj1; struct pymelem *pymelem = melem_to_pymelem(elem); @@ -377,8 +377,8 @@ static int set_switch_ops(snd_mixer_elem_t *elem, int dir, } static int set_dB_ops(snd_mixer_elem_t *elem, int dir, - snd_mixer_selem_channel_id_t channel, - long db_gain, int xdir) + snd_mixer_selem_channel_id_t channel, + long db_gain, int xdir) { PyObject *obj1; struct pymelem *pymelem = melem_to_pymelem(elem); @@ -392,15 +392,15 @@ static int set_dB_ops(snd_mixer_elem_t *elem, int dir, } static int enum_item_name_ops(snd_mixer_elem_t *elem, - unsigned int item, - size_t maxlen, char *buf) + unsigned int item, + size_t maxlen, char *buf) { PyObject *obj1, *obj2, *t1, *res; struct pymelem *pymelem = melem_to_pymelem(elem); int err; unsigned int len; char *s; - + obj1 = PyTuple_New(1); PyTuple_SET_ITEM(obj1, 0, PyInt_FromLong(item)); err = pcall(pymelem, "opsGetEnumItemName", obj1, &res); @@ -441,13 +441,13 @@ errlbl: } static int get_enum_item_ops(snd_mixer_elem_t *elem, - snd_mixer_selem_channel_id_t channel, - unsigned int *itemp) + snd_mixer_selem_channel_id_t channel, + unsigned int *itemp) { PyObject *obj1, *t1, *res; struct pymelem *pymelem = melem_to_pymelem(elem); int err; - + obj1 = PyTuple_New(1); PyTuple_SET_ITEM(obj1, 0, PyInt_FromLong(channel)); err = pcall(pymelem, "opsGetEnumItem", obj1, &res); @@ -473,8 +473,8 @@ static int get_enum_item_ops(snd_mixer_elem_t *elem, } static int set_enum_item_ops(snd_mixer_elem_t *elem, - snd_mixer_selem_channel_id_t channel, - unsigned int item) + snd_mixer_selem_channel_id_t channel, + unsigned int item) { PyObject *obj1; struct pymelem *pymelem = melem_to_pymelem(elem); @@ -486,21 +486,21 @@ static int set_enum_item_ops(snd_mixer_elem_t *elem, } static struct sm_elem_ops simple_python_ops = { - .is = is_ops, - .get_range = get_range_ops, - .get_dB_range = get_dB_range_ops, - .set_range = set_range_ops, - .ask_vol_dB = ask_vol_dB_ops, - .ask_dB_vol = ask_dB_vol_ops, - .get_volume = get_volume_ops, - .get_dB = get_dB_ops, - .set_volume = set_volume_ops, - .set_dB = set_dB_ops, - .get_switch = get_switch_ops, - .set_switch = set_switch_ops, - .enum_item_name = enum_item_name_ops, - .get_enum_item = get_enum_item_ops, - .set_enum_item = set_enum_item_ops + .is = is_ops, + .get_range = get_range_ops, + .get_dB_range = get_dB_range_ops, + .set_range = set_range_ops, + .ask_vol_dB = ask_vol_dB_ops, + .ask_dB_vol = ask_dB_vol_ops, + .get_volume = get_volume_ops, + .get_dB = get_dB_ops, + .set_volume = set_volume_ops, + .set_dB = set_dB_ops, + .get_switch = get_switch_ops, + .set_switch = set_switch_ops, + .enum_item_name = enum_item_name_ops, + .get_enum_item = get_enum_item_ops, + .set_enum_item = set_enum_item_ops }; static void selem_free(snd_mixer_elem_t *elem) @@ -578,7 +578,7 @@ pymelem_attach(struct pymelem *pymelem, PyObject *args) PyObject *obj; snd_hctl_elem_t *helem; int err; - + if (!PyArg_ParseTuple(args, "O", &obj)) return NULL; helem = (snd_hctl_elem_t *)get_C_ptr(obj, "get_C_helem"); @@ -587,7 +587,7 @@ pymelem_attach(struct pymelem *pymelem, PyObject *args) err = snd_mixer_elem_attach(pymelem->melem, helem); if (err < 0) { PyErr_Format(PyExc_RuntimeError, "Cannot attach hcontrol element to mixer element: %s", snd_strerror(err)); - return NULL; + return NULL; } Py_RETURN_NONE; } @@ -598,7 +598,7 @@ pymelem_detach(struct pymelem *pymelem, PyObject *args) PyObject *obj; snd_hctl_elem_t *helem; int err; - + if (!PyArg_ParseTuple(args, "O", &obj)) return NULL; helem = (snd_hctl_elem_t *)get_C_ptr(obj, "get_C_helem"); @@ -607,7 +607,7 @@ pymelem_detach(struct pymelem *pymelem, PyObject *args) err = snd_mixer_elem_detach(pymelem->melem, helem); if (err < 0) { PyErr_Format(PyExc_RuntimeError, "Cannot detach hcontrol element to mixer element: %s", snd_strerror(err)); - return NULL; + return NULL; } Py_RETURN_NONE; } @@ -679,14 +679,14 @@ static PyGetSetDef pymelem_getseters[] = { {"name", (getter)pymelem_get_name, NULL, NULL, NULL}, {"index", (getter)pymelem_get_index, NULL, NULL, NULL}, - + {NULL,NULL,NULL,NULL,NULL} }; static PyMethodDef pymelem_methods[] = { {"attach", (PyCFunction)pymelem_attach, METH_VARARGS, NULL}, {"detach", (PyCFunction)pymelem_detach, METH_VARARGS, NULL}, - + /* "default" functions - no functionality */ {"opsIsActive", (PyCFunction)pymelem_ignore1, METH_VARARGS, NULL}, {"opsIsMono", (PyCFunction)pymelem_ignore, METH_VARARGS, NULL}, @@ -695,7 +695,7 @@ static PyMethodDef pymelem_methods[] = { {"opsIsEnumCnt", (PyCFunction)pymelem_ignore, METH_VARARGS, NULL}, {"opsGetDB", (PyCFunction)pymelem_error, METH_VARARGS, NULL}, - + {"eventInfo", (PyCFunction)pymelem_event_info, METH_VARARGS, NULL}, {"eventValue", (PyCFunction)pymelem_event_value, METH_VARARGS, NULL}, @@ -703,18 +703,18 @@ static PyMethodDef pymelem_methods[] = { }; static PyTypeObject pymelem_type = { - PyVarObject_HEAD_INIT(NULL, 0) - tp_name: "smixer_python.InternalMElement", - tp_basicsize: sizeof(struct pymelem), - tp_dealloc: (destructor)pymelem_dealloc, - tp_flags: Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, - tp_doc: NULL /* mixerinit__doc__ */, - tp_getset: pymelem_getseters, - tp_init: (initproc)pymelem_init, - tp_alloc: PyType_GenericAlloc, - tp_new: PyType_GenericNew, - tp_free: PyObject_Del, - tp_methods: pymelem_methods, + PyVarObject_HEAD_INIT(NULL, 0) + tp_name: "smixer_python.InternalMElement", + tp_basicsize: sizeof(struct pymelem), + tp_dealloc: (destructor)pymelem_dealloc, + tp_flags: Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, + tp_doc: NULL /* mixerinit__doc__ */, + tp_getset: pymelem_getseters, + tp_init: (initproc)pymelem_init, + tp_alloc: PyType_GenericAlloc, + tp_new: PyType_GenericNew, + tp_free: PyObject_Del, + tp_methods: pymelem_methods, }; static PyObject * @@ -724,7 +724,7 @@ pymixer_attach_hctl(struct pymixer *pymixer, PyObject *args) snd_hctl_t *hctl; void **hctls; int err; - + if (!PyArg_ParseTuple(args, "O", &obj)) return NULL; hctl = (snd_hctl_t *)get_C_ptr(obj, "get_C_hctl"); @@ -752,7 +752,7 @@ static PyObject * pymixer_register(struct pymixer *pymixer, PyObject *args) { int err; - + if (!PyArg_ParseTuple(args, "")) return NULL; err = snd_mixer_class_register(pymixer->class, pymixer->mixer); @@ -769,7 +769,7 @@ pymixer_melement_new(struct pymixer *pymixer, PyObject *args) PyObject *obj, *obj1, *obj2; char *class, *name; long index, weight; - + if (!PyArg_ParseTuple(args, "ssii", &class, &name, &index, &weight)) return NULL; obj = PyDict_GetItemString(pymixer->mdict, class); @@ -808,14 +808,14 @@ pymixer_melement_add(struct pymixer *pymixer, PyObject *args) PyObject *obj; struct pymelem *pymelem; int err; - + if (!PyArg_ParseTuple(args, "O", &obj)) return NULL; pymelem = (struct pymelem *)obj; err = snd_mixer_elem_add(pymelem->melem, pymixer->class); if (err < 0) { PyErr_Format(PyExc_RuntimeError, "Cannot add mixer element: %s", snd_strerror(err)); - return NULL; + return NULL; } Py_RETURN_NONE; } @@ -842,7 +842,7 @@ static void pymixer_free(struct pymixer *self) { int idx; - + for (idx = 0; idx < self->hctl_count; idx++) { snd_mixer_detach_hctl(self->mixer, self->hctl[idx*2]); Py_DECREF((PyObject *)self->hctl[idx*2+1]); @@ -884,18 +884,18 @@ static PyMethodDef pymixer_methods[] = { }; static PyTypeObject pymixer_type = { - PyVarObject_HEAD_INIT(NULL, 0) - tp_name: "smixer_python.InternalMixer", - tp_basicsize: sizeof(struct pymixer), - tp_dealloc: (destructor)pymixer_dealloc, - tp_flags: Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, - tp_doc: NULL /* mixerinit__doc__ */, - tp_getset: pymixer_getseters, - tp_init: (initproc)pymixer_init, - tp_alloc: PyType_GenericAlloc, - tp_new: PyType_GenericNew, - tp_free: PyObject_Del, - tp_methods: pymixer_methods, + PyVarObject_HEAD_INIT(NULL, 0) + tp_name: "smixer_python.InternalMixer", + tp_basicsize: sizeof(struct pymixer), + tp_dealloc: (destructor)pymixer_dealloc, + tp_flags: Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, + tp_doc: NULL /* mixerinit__doc__ */, + tp_getset: pymixer_getseters, + tp_init: (initproc)pymixer_init, + tp_alloc: PyType_GenericAlloc, + tp_new: PyType_GenericNew, + tp_free: PyObject_Del, + tp_methods: pymixer_methods, }; static PyMethodDef python_methods[] = { @@ -984,20 +984,20 @@ int alsa_mixer_simple_event(snd_mixer_class_t *class, unsigned int mask, tstate = PyThreadState_New(main_interpreter); PyThreadState_Swap(tstate); - - t = PyTuple_New(3); - if (t) { - PyTuple_SET_ITEM(t, 0, (PyObject *)PyInt_FromLong(mask)); - o = find_helem(priv, helem); - if (mask & SND_CTL_EVENT_MASK_ADD) { - if (o == NULL) - o = new_helem(priv, helem); + + t = PyTuple_New(3); + if (t) { + PyTuple_SET_ITEM(t, 0, (PyObject *)PyInt_FromLong(mask)); + o = find_helem(priv, helem); + if (mask & SND_CTL_EVENT_MASK_ADD) { + if (o == NULL) + o = new_helem(priv, helem); } - if (o == NULL) - return 0; + if (o == NULL) + return 0; PyTuple_SET_ITEM(t, 1, o); Py_INCREF(o); - o = melem ? find_melem(priv, melem) : Py_None; + o = melem ? find_melem(priv, melem) : Py_None; PyTuple_SET_ITEM(t, 2, o); Py_INCREF(o); r = PyObject_CallObject(priv->py_event_func, t); @@ -1019,7 +1019,7 @@ int alsa_mixer_simple_event(snd_mixer_class_t *class, unsigned int mask, res = -EIO; } } - + return res; } @@ -1039,8 +1039,8 @@ static void alsa_mixer_simple_free(snd_mixer_class_t *class) } static int alsa_mixer_simple_pyinit(struct python_priv *priv, - PyObject *py_mod, - FILE *fp, + PyObject *py_mod, + FILE *fp, const char *file, snd_mixer_class_t *class, snd_mixer_t *mixer, @@ -1091,15 +1091,15 @@ static int alsa_mixer_simple_pyinit(struct python_priv *priv, #if PY_MAJOR_VERSION >= 3 static struct PyModuleDef smixer_python_module = { - PyModuleDef_HEAD_INIT, - "smixer_python", - NULL, - 0, - python_methods, - NULL, - NULL, - NULL, - NULL + PyModuleDef_HEAD_INIT, + "smixer_python", + NULL, + 0, + python_methods, + NULL, + NULL, + NULL, + NULL }; #endif @@ -1131,7 +1131,7 @@ int alsa_mixer_simple_finit(snd_mixer_class_t *class, snd_error(MIXER, "Unable to find python module '%s'", file); return -ENODEV; } - + Py_Initialize(); if (PyType_Ready(&pymelem_type) < 0 || PyType_Ready(&pymixer_type) < 0) { diff --git a/modules/mixer/simple/sbase.c b/modules/mixer/simple/sbase.c index 29c853a0..f2687a24 100644 --- a/modules/mixer/simple/sbase.c +++ b/modules/mixer/simple/sbase.c @@ -43,7 +43,7 @@ static int selem_read(snd_mixer_elem_t *elem); static unsigned int chanmap_to_channels(unsigned int chanmap) { unsigned int i, res; - + for (i = 0, res = 0; i < MAX_CHANNEL; i++) if (chanmap & (1 << i)) res++; @@ -61,11 +61,11 @@ static long to_user(struct selem_base *s, int dir, struct helem_base *c, long va } static long from_user(struct selem_base *s, int dir, struct helem_base *c, long value) -{ - int64_t n; +{ + int64_t n; if (s->dir[dir].max == s->dir[dir].min) return c->min; - n = (int64_t) (value - s->dir[dir].min) * (c->max - c->min); + n = (int64_t) (value - s->dir[dir].min) * (c->max - c->min); return c->min + (n + (s->dir[dir].max - s->dir[dir].min) / 2) / (s->dir[dir].max - s->dir[dir].min); } #endif @@ -77,7 +77,7 @@ static void update_ranges(struct selem_base *s) unsigned int dir, ok_flag; struct list_head *pos; struct helem_base *helem; - + for (dir = 0; dir < 2; dir++) { s->dir[dir].min = 0; s->dir[dir].max = 0; @@ -139,7 +139,7 @@ static int is_ops(snd_mixer_elem_t *elem, int dir, int cmd, int val) helem = list_entry(s->helems.next, struct helem_base, list); return !!(helem->purpose == PURPOSE_ENUMLIST); } - + case SM_OPS_IS_ENUMCNT: { struct helem_base *helem; helem = list_entry(s->helems.next, struct helem_base, list); @@ -147,7 +147,7 @@ static int is_ops(snd_mixer_elem_t *elem, int dir, int cmd, int val) } } - + return 1; } @@ -155,7 +155,7 @@ static int get_range_ops(snd_mixer_elem_t *elem, int dir, long *min, long *max) { struct selem_base *s = snd_mixer_elem_get_private(elem); - + *min = s->dir[dir].min; *max = s->dir[dir].max; @@ -179,7 +179,7 @@ static int set_range_ops(snd_mixer_elem_t *elem, int dir, s->dir[dir].forced_range = 1; s->dir[dir].min = min; s->dir[dir].max = max; - + if ((err = selem_read(elem)) < 0) return err; return 0; @@ -189,7 +189,7 @@ static int get_volume_ops(snd_mixer_elem_t *elem, int dir, snd_mixer_selem_channel_id_t channel, long *value) { struct selem_base *s = snd_mixer_elem_get_private(elem); - + *value = s->dir[dir].vol[channel]; return 0; } @@ -330,7 +330,7 @@ static int simple_event_add1(snd_mixer_class_t *class, struct bclass_sid *bsid; struct melem_sids *sid; unsigned int ui; - + list_for_each(pos, &priv->sids) { bsid = list_entry(pos, struct bclass_sid, list); for (ui = 0; ui < bsid->count; ui++) { @@ -361,7 +361,7 @@ static int simple_event_add1(snd_mixer_class_t *class, min = max = 0; break; } - + printf("event add: %p, %p (%s)\n", helem, sel, snd_hctl_elem_get_name(helem)); if (snd_mixer_selem_id_malloc(&id)) return -ENOMEM; @@ -374,7 +374,7 @@ static int simple_event_add1(snd_mixer_class_t *class, case PURPOSE_SWITCH: if (ctype != SND_CTL_ELEM_TYPE_BOOLEAN) { __invalid_type: - snd_mixer_selem_id_free(id); + snd_mixer_selem_id_free(id); free(hsimple); return -EINVAL; } @@ -446,9 +446,9 @@ static int simple_event_add1(snd_mixer_class_t *class, err = snd_mixer_elem_value(melem); return err; __error: - if (new) - snd_mixer_elem_free(melem); - return -EINVAL; + if (new) + snd_mixer_elem_free(melem); + return -EINVAL; } static int simple_event_add(snd_mixer_class_t *class, snd_hctl_elem_t *helem) diff --git a/modules/mixer/simple/sbasedl.c b/modules/mixer/simple/sbasedl.c index 3ad7bdf4..67a36a88 100644 --- a/modules/mixer/simple/sbasedl.c +++ b/modules/mixer/simple/sbasedl.c @@ -97,8 +97,8 @@ int mixer_simple_basic_dlopen(snd_mixer_class_t *class, return 1; __error: - if (initflag) - free(priv); + if (initflag) + free(priv); if (h) snd_dlclose(h); free(xlib); diff --git a/src/async.c b/src/async.c index 4564c723..f85980fa 100644 --- a/src/async.c +++ b/src/async.c @@ -109,7 +109,7 @@ static void snd_async_handler(int signo ATTRIBUTE_UNUSED, siginfo_t *siginfo, vo * * \see snd_async_add_pcm_handler, snd_async_add_ctl_handler */ -int snd_async_add_handler(snd_async_handler_t **handler, int fd, +int snd_async_add_handler(snd_async_handler_t **handler, int fd, snd_async_callback_t callback, void *private_data) { snd_async_handler_t *h; diff --git a/src/conf.c b/src/conf.c index ac63a1c0..357d72ba 100644 --- a/src/conf.c +++ b/src/conf.c @@ -51,7 +51,7 @@ any surplus whitespace is discarded. For example, the two sequences and \code - a 1 + a 1 b 2 \endcode @@ -255,8 +255,8 @@ name [=] value [,|;] # Compound assignment (first style) name [=] { - name1 [=] value [,|;] - ... + name1 [=] value [,|;] + ... } # Compound assignment (second style) @@ -264,9 +264,9 @@ name.name1 [=] value [,|;] # Array assignment (first style) name [ - value0 [,|;] - value1 [,|;] - ... + value0 [,|;] + value1 [,|;] + ... ] # Array assignment (second style) @@ -377,7 +377,7 @@ values in the current compound are used as configuration for the function. If the compound func.\ is defined in the root node, then the library and function from this compound configuration are used, otherwise 'snd_func_' is prefixed to the string and code from the ALSA library is used. -The definition of a function looks like:

+The definition of a function looks like:

\code func.remove_first_char { @@ -868,10 +868,10 @@ static int get_char_skip_comments(input_t *input) break; } } - + return c; } - + static int get_nonwhite(input_t *input) { @@ -1057,7 +1057,7 @@ static int get_freestring(char **string, int id, input_t *input) free_local_string(&str); return c; } - + static int get_delimstring(char **string, int delim, input_t *input) { struct local_string str; @@ -1145,7 +1145,7 @@ static int _snd_config_make(snd_config_t **config, char **id, snd_config_type_t *config = n; return 0; } - + static int _snd_config_make_add(snd_config_t **config, char **id, snd_config_type_t type, snd_config_t *parent) @@ -1162,7 +1162,7 @@ static int _snd_config_make_add(snd_config_t **config, char **id, return 0; } -static int _snd_config_search(snd_config_t *config, +static int _snd_config_search(snd_config_t *config, const char *id, int len, snd_config_t **result) { snd_config_iterator_t i, next; @@ -1225,16 +1225,16 @@ static int parse_value(snd_config_t **_n, snd_config_t *parent, input_t *input, return -EINVAL; } } else { - if (i <= INT_MAX) + if (i <= INT_MAX) err = _snd_config_make_add(&n, id, SND_CONFIG_TYPE_INTEGER, parent); else err = _snd_config_make_add(&n, id, SND_CONFIG_TYPE_INTEGER64, parent); if (err < 0) return err; } - if (n->type == SND_CONFIG_TYPE_INTEGER) + if (n->type == SND_CONFIG_TYPE_INTEGER) n->u.integer = (long) i; - else + else n->u.integer64 = i; *_n = n; return 0; @@ -1341,7 +1341,7 @@ static int parse_array_def(snd_config_t *parent, input_t *input, int *idx, int s err = 0; __end: free(id); - return err; + return err; } static int parse_array_defs(snd_config_t *parent, input_t *input, int skip, int override) @@ -1505,7 +1505,7 @@ static int parse_def(snd_config_t *parent, input_t *input, int skip, int overrid free(id); return err; } - + static int parse_defs(snd_config_t *parent, input_t *input, int skip, int override) { int c, err; @@ -2774,7 +2774,7 @@ __make: int snd_config_imake_integer(snd_config_t **config, const char *id, const long value) { int err; - + err = snd_config_make(config, id, SND_CONFIG_TYPE_INTEGER); if (err < 0) return err; @@ -2804,7 +2804,7 @@ int snd_config_imake_integer(snd_config_t **config, const char *id, const long v int snd_config_imake_integer64(snd_config_t **config, const char *id, const long long value) { int err; - + err = snd_config_make(config, id, SND_CONFIG_TYPE_INTEGER64); if (err < 0) return err; @@ -2831,7 +2831,7 @@ int snd_config_imake_integer64(snd_config_t **config, const char *id, const long int snd_config_imake_real(snd_config_t **config, const char *id, const double value) { int err; - + err = snd_config_make(config, id, SND_CONFIG_TYPE_REAL); if (err < 0) return err; @@ -2862,7 +2862,7 @@ int snd_config_imake_string(snd_config_t **config, const char *id, const char *v { int err; snd_config_t *tmp; - + err = snd_config_make(&tmp, id, SND_CONFIG_TYPE_STRING); if (err < 0) return err; @@ -2950,7 +2950,7 @@ int snd_config_imake_safe_string(snd_config_t **config, const char *id, const ch int snd_config_imake_pointer(snd_config_t **config, const char *id, const void *value) { int err; - + err = snd_config_make(config, id, SND_CONFIG_TYPE_POINTER); if (err < 0) return err; @@ -4422,7 +4422,7 @@ static int _snd_config_hook_table(snd_config_t *root, snd_config_t *config, snd_ int snd_config_hook_load_for_all_cards(snd_config_t *root, snd_config_t *config, snd_config_t **dst, snd_config_t *private_data ATTRIBUTE_UNUSED) { int card = -1, err; - + do { err = snd_card_next(&card); if (err < 0) @@ -4478,7 +4478,7 @@ int snd_config_hook_load_for_all_cards(snd_config_t *root, snd_config_t *config, SND_DLSYM_BUILD_VERSION(snd_config_hook_load_for_all_cards, SND_CONFIG_DLSYM_VERSION_HOOK); #endif -/** +/** * \brief Updates a configuration tree by rereading the configuration files (if needed). * \param[in,out] _top Address of the handle to the top-level node. * \param[in,out] _update Address of a pointer to private update information. @@ -4514,7 +4514,7 @@ int snd_config_update_r(snd_config_t **_top, snd_config_update_t **_update, cons snd_config_update_t *local; snd_config_update_t *update; snd_config_t *top; - + assert(_top && _update); top = *_top; update = *_update; @@ -4608,12 +4608,12 @@ int snd_config_update_r(snd_config_t **_top, snd_config_update_t **_update, cons return err; _reread: - *_top = NULL; - *_update = NULL; - if (update) { - snd_config_update_free(update); - update = NULL; - } + *_top = NULL; + *_update = NULL; + if (update) { + snd_config_update_free(update); + update = NULL; + } if (top) { snd_config_delete(top); top = NULL; @@ -4648,7 +4648,7 @@ int snd_config_update_r(snd_config_t **_top, snd_config_update_t **_update, cons return 1; } -/** +/** * \brief Updates #snd_config by rereading the global configuration files (if needed). * \return 0 if #snd_config was up to date, 1 if #snd_config was * updated, otherwise a negative error code. @@ -4744,7 +4744,7 @@ void snd_config_unref(snd_config_t *cfg) snd_config_unlock(); } -/** +/** * \brief Frees a private update structure. * \param[in] update The private update structure to free. * \return Zero if successful, otherwise a negative error code. @@ -4761,7 +4761,7 @@ int snd_config_update_free(snd_config_update_t *update) return 0; } -/** +/** * \brief Frees the global configuration tree in #snd_config. * \return Zero if successful, otherwise a negative error code. * @@ -4881,7 +4881,7 @@ typedef int (*snd_config_walk_callback_t)(snd_config_t *src, static int snd_config_walk(snd_config_t *src, snd_config_t *root, - snd_config_t **dst, + snd_config_t **dst, snd_config_walk_callback_t callback, snd_config_expand_fcn_t fcn, void *private_data) @@ -5221,7 +5221,7 @@ static int _snd_config_evaluate(snd_config_t *src, * replaces those nodes with the respective function results. */ int snd_config_evaluate(snd_config_t *config, snd_config_t *root, - snd_config_t *private_data, snd_config_t **result) + snd_config_t *private_data, snd_config_t **result) { /* FIXME: Only in place evaluation is currently implemented */ assert(result == NULL); @@ -5408,7 +5408,7 @@ static int parse_string(const char **ptr, char **val) buf[idx++] = c; } } - + /* Parse var=val or val */ static int parse_arg(const char **ptr, unsigned int *varlen, char **val) @@ -5508,7 +5508,7 @@ static int parse_args(snd_config_t *subs, const char *str, snd_config_t *defs) } return 0; } - + while (1) { char buf[256]; const char *var = buf; @@ -5725,7 +5725,7 @@ int snd_config_expand(snd_config_t *config, snd_config_t *root, const char *args *result = res; err = 1; _end: - if (subs) + if (subs) snd_config_delete(subs); return err; } diff --git a/src/confmisc.c b/src/confmisc.c index 39aa1f04..c1f5410c 100644 --- a/src/confmisc.c +++ b/src/confmisc.c @@ -5,7 +5,7 @@ * \author Abramo Bagnara * \author Jaroslav Kysela * \date 2000-2001 - * + * * Configuration helper functions. * * See the \ref conffunc page for more details. @@ -176,7 +176,7 @@ int snd_config_get_card(const snd_config_t *conf) * \brief Gets the control interface index from the given ASCII string. * \param ascii The string to be parsed. * \return The control interface index if successful, otherwise a negative error code. - */ + */ int snd_config_get_ctl_iface_ascii(const char *ascii) { long v; @@ -199,7 +199,7 @@ int snd_config_get_ctl_iface_ascii(const char *ascii) * \brief Gets the control interface index from a configuration node. * \param conf Handle to the configuration node to be parsed. * \return The control interface index if successful, otherwise a negative error code. - */ + */ int snd_config_get_ctl_iface(const snd_config_t *conf) { long v; @@ -251,7 +251,7 @@ int snd_config_get_ctl_iface(const snd_config_t *conf) default 0 } \endcode - */ + */ int snd_func_getenv(snd_config_t **dst, snd_config_t *root, snd_config_t *src, snd_config_t *private_data) { @@ -260,7 +260,7 @@ int snd_func_getenv(snd_config_t **dst, snd_config_t *root, snd_config_t *src, const char *res, *id; char *def = NULL; int idx = 0, err, hit; - + err = snd_config_search(src, "vars", &n); if (err < 0) { snd_error(CORE, "field vars not found"); @@ -351,7 +351,7 @@ SND_DLSYM_BUILD_VERSION(snd_func_getenv, SND_CONFIG_DLSYM_VERSION_EVALUATE); default 0 } \endcode - */ + */ int snd_func_igetenv(snd_config_t **dst, snd_config_t *root, snd_config_t *src, snd_config_t *private_data) { @@ -385,7 +385,7 @@ int snd_func_igetenv(snd_config_t **dst, snd_config_t *root, snd_config_t *src, #ifndef DOC_HIDDEN SND_DLSYM_BUILD_VERSION(snd_func_igetenv, SND_CONFIG_DLSYM_VERSION_EVALUATE); #endif - + /** * \brief Merges the given strings. * \param dst The function puts the handle to the result configuration node @@ -402,7 +402,7 @@ SND_DLSYM_BUILD_VERSION(snd_func_igetenv, SND_CONFIG_DLSYM_VERSION_EVALUATE); strings [ "a1" "b2" "c3" ] } \endcode - */ + */ int snd_func_concat(snd_config_t **dst, snd_config_t *root, snd_config_t *src, snd_config_t *private_data) { @@ -411,7 +411,7 @@ int snd_func_concat(snd_config_t **dst, snd_config_t *root, snd_config_t *src, const char *id; char *res = NULL, *tmp; int idx = 0, len = 0, len1, err, hit; - + err = snd_config_search(src, "strings", &n); if (err < 0) { snd_error(CORE, "field strings not found"); @@ -490,7 +490,7 @@ static int snd_func_iops(snd_config_t **dst, char *res = NULL; long result = 0, val; int idx = 0, err, hit; - + err = snd_config_search(src, "integers", &n); if (err < 0) { snd_error(CORE, "field integers not found"); @@ -556,9 +556,9 @@ static int snd_func_iops(snd_config_t **dst, integers [ 2 3 5 ] } \endcode - */ + */ int snd_func_iadd(snd_config_t **dst, snd_config_t *root, - snd_config_t *src, snd_config_t *private_data) + snd_config_t *src, snd_config_t *private_data) { return snd_func_iops(dst, root, src, private_data, 0); } @@ -582,7 +582,7 @@ SND_DLSYM_BUILD_VERSION(snd_func_iadd, SND_CONFIG_DLSYM_VERSION_EVALUATE); integers [ 2 3 2 ] } \endcode - */ + */ int snd_func_imul(snd_config_t **dst, snd_config_t *root, snd_config_t *src, snd_config_t *private_data) { @@ -607,13 +607,13 @@ SND_DLSYM_BUILD_VERSION(snd_func_imul, SND_CONFIG_DLSYM_VERSION_EVALUATE); @func datadir } \endcode - */ + */ int snd_func_datadir(snd_config_t **dst, snd_config_t *root ATTRIBUTE_UNUSED, snd_config_t *src, snd_config_t *private_data ATTRIBUTE_UNUSED) { int err; const char *id; - + err = snd_config_get_id(src, &id); if (err < 0) return err; @@ -683,7 +683,7 @@ notfound: @func private_string } \endcode - */ + */ int snd_func_private_string(snd_config_t **dst, snd_config_t *root ATTRIBUTE_UNUSED, snd_config_t *src, snd_config_t *private_data) { @@ -797,7 +797,7 @@ int snd_determine_driver(int card, char **driver) @func private_card_driver } \endcode - */ + */ int snd_func_private_card_driver(snd_config_t **dst, snd_config_t *root ATTRIBUTE_UNUSED, snd_config_t *src, snd_config_t *private_data) { @@ -834,7 +834,7 @@ static int parse_card(snd_config_t *root, snd_config_t *src, snd_config_t *n; char *str; int card, err; - + err = snd_config_search(src, "card", &n); if (err < 0) { snd_error(CORE, "field card not found"); @@ -873,13 +873,13 @@ static int parse_card(snd_config_t *root, snd_config_t *src, card '0' } \endcode - */ + */ int snd_func_card_inum(snd_config_t **dst, snd_config_t *root, snd_config_t *src, snd_config_t *private_data) { const char *id; int card, err; - + card = parse_card(root, src, private_data); if (card < 0) return card; @@ -908,13 +908,13 @@ SND_DLSYM_BUILD_VERSION(snd_func_card_inum, SND_CONFIG_DLSYM_VERSION_EVALUATE); card 0 } \endcode - */ + */ int snd_func_card_driver(snd_config_t **dst, snd_config_t *root, snd_config_t *src, snd_config_t *private_data) { snd_config_t *val; int card, err; - + card = parse_card(root, src, private_data); if (card < 0) return card; @@ -945,7 +945,7 @@ SND_DLSYM_BUILD_VERSION(snd_func_card_driver, SND_CONFIG_DLSYM_VERSION_EVALUATE) card 0 } \endcode - */ + */ int snd_func_card_id(snd_config_t **dst, snd_config_t *root, snd_config_t *src, snd_config_t *private_data) { @@ -953,7 +953,7 @@ int snd_func_card_id(snd_config_t **dst, snd_config_t *root, snd_config_t *src, snd_ctl_card_info_t info = {0}; const char *id; int card, err; - + card = parse_card(root, src, private_data); if (card < 0) return card; @@ -972,8 +972,8 @@ int snd_func_card_id(snd_config_t **dst, snd_config_t *root, snd_config_t *src, err = snd_config_imake_string(dst, id, snd_ctl_card_info_get_id(&info)); __error: - if (ctl) - snd_ctl_close(ctl); + if (ctl) + snd_ctl_close(ctl); return err; } #ifndef DOC_HIDDEN @@ -996,7 +996,7 @@ SND_DLSYM_BUILD_VERSION(snd_func_card_id, SND_CONFIG_DLSYM_VERSION_EVALUATE); card 0 } \endcode - */ + */ int snd_func_card_name(snd_config_t **dst, snd_config_t *root, snd_config_t *src, snd_config_t *private_data) { @@ -1004,7 +1004,7 @@ int snd_func_card_name(snd_config_t **dst, snd_config_t *root, snd_ctl_card_info_t info = {0}; const char *id; int card, err; - + card = parse_card(root, src, private_data); if (card < 0) return card; @@ -1023,8 +1023,8 @@ int snd_func_card_name(snd_config_t **dst, snd_config_t *root, err = snd_config_imake_safe_string(dst, id, snd_ctl_card_info_get_name(&info)); __error: - if (ctl) - snd_ctl_close(ctl); + if (ctl) + snd_ctl_close(ctl); return err; } #ifndef DOC_HIDDEN @@ -1033,7 +1033,7 @@ SND_DLSYM_BUILD_VERSION(snd_func_card_name, SND_CONFIG_DLSYM_VERSION_EVALUATE); #ifdef DOXYGEN /* For consistency with the PCM Interface module, include documentation even - * when PCM module is not included in the build. */ + * when PCM module is not included in the build. */ #ifndef BUILD_PCM #define BUILD_PCM #endif @@ -1060,7 +1060,7 @@ SND_DLSYM_BUILD_VERSION(snd_func_card_name, SND_CONFIG_DLSYM_VERSION_EVALUATE); subdevice 0 # optional } \endcode - */ + */ int snd_func_pcm_id(snd_config_t **dst, snd_config_t *root, snd_config_t *src, void *private_data) { snd_config_t *n; @@ -1069,7 +1069,7 @@ int snd_func_pcm_id(snd_config_t **dst, snd_config_t *root, snd_config_t *src, v const char *id; long card, device, subdevice = 0; int err; - + card = parse_card(root, src, private_data); if (card < 0) return card; @@ -1117,8 +1117,8 @@ int snd_func_pcm_id(snd_config_t **dst, snd_config_t *root, snd_config_t *src, v err = snd_config_imake_string(dst, id, snd_pcm_info_get_id(&info)); __error: - if (ctl) - snd_ctl_close(ctl); + if (ctl) + snd_ctl_close(ctl); return err; } #ifndef DOC_HIDDEN @@ -1144,7 +1144,7 @@ SND_DLSYM_BUILD_VERSION(snd_func_pcm_id, SND_CONFIG_DLSYM_VERSION_EVALUATE); index 0 } \endcode - */ + */ int snd_func_pcm_args_by_class(snd_config_t **dst, snd_config_t *root, snd_config_t *src, void *private_data) { snd_config_t *n; @@ -1217,14 +1217,14 @@ int snd_func_pcm_args_by_class(snd_config_t **dst, snd_config_t *root, snd_confi index == idx++) goto __out; } - snd_ctl_close(ctl); + snd_ctl_close(ctl); ctl = NULL; } err = -ENODEV; __out: - if (ctl) - snd_ctl_close(ctl); + if (ctl) + snd_ctl_close(ctl); if (err < 0) return err; if((err = snd_config_get_id(src, &id)) >= 0) { @@ -1254,7 +1254,7 @@ SND_DLSYM_BUILD_VERSION(snd_func_pcm_args_by_class, SND_CONFIG_DLSYM_VERSION_EVA @func private_pcm_subdevice } \endcode - */ + */ int snd_func_private_pcm_subdevice(snd_config_t **dst, snd_config_t *root ATTRIBUTE_UNUSED, snd_config_t *src, snd_config_t *private_data) { @@ -1314,14 +1314,14 @@ SND_DLSYM_BUILD_VERSION(snd_func_private_pcm_subdevice, SND_CONFIG_DLSYM_VERSION name "id1.id2.id3" } \endcode - */ + */ int snd_func_refer(snd_config_t **dst, snd_config_t *root, snd_config_t *src, snd_config_t *private_data) { snd_config_t *n; const char *file = NULL, *name = NULL; int err; - + err = snd_config_search(src, "file", &n); if (err >= 0) { err = snd_config_evaluate(n, root, private_data, NULL); diff --git a/src/control/cards.c b/src/control/cards.c index a93f10a4..49e343a9 100644 --- a/src/control/cards.c +++ b/src/control/cards.c @@ -108,7 +108,7 @@ int snd_card_load(int card) int snd_card_next(int *rcard) { int card; - + if (rcard == NULL) return -EINVAL; card = *rcard; @@ -194,7 +194,7 @@ int snd_card_get_name(int card, char **name) snd_ctl_t *handle; snd_ctl_card_info_t info; int err; - + if (name == NULL) return -EINVAL; if ((err = snd_ctl_hw_open(&handle, NULL, card, 0)) < 0) @@ -224,7 +224,7 @@ int snd_card_get_longname(int card, char **name) snd_ctl_t *handle; snd_ctl_card_info_t info; int err; - + if (name == NULL) return -EINVAL; if ((err = snd_ctl_hw_open(&handle, NULL, card, 0)) < 0) diff --git a/src/control/control.c b/src/control/control.c index 18841280..a08ffea6 100644 --- a/src/control/control.c +++ b/src/control/control.c @@ -52,7 +52,7 @@ file. The format is: \verbatim index [ID ] Driver - name - longname + longname \endverbatim Note that the mixername and components are not listed. @@ -279,7 +279,7 @@ int snd_ctl_new(snd_ctl_t **ctlp, snd_ctl_type_t type, const char *name, int mod *ctlp = ctl; return 0; } - + /** * \brief set async mode @@ -353,7 +353,7 @@ int snd_ctl_poll_descriptors_revents(snd_ctl_t *ctl, struct pollfd *pfds, unsign return ctl->ops->poll_revents(ctl, pfds, nfds, revents); if (nfds == 1) { *revents = pfds->revents; - return 0; + return 0; } return -EINVAL; } @@ -1039,7 +1039,7 @@ int snd_ctl_elem_write(snd_ctl_t *ctl, snd_ctl_elem_value_t *data) static int snd_ctl_tlv_do(snd_ctl_t *ctl, int op_flag, const snd_ctl_elem_id_t *id, - unsigned int *tlv, unsigned int tlv_size) + unsigned int *tlv, unsigned int tlv_size) { snd_ctl_elem_info_t *info = NULL; int err; @@ -1060,8 +1060,8 @@ static int snd_ctl_tlv_do(snd_ctl_t *ctl, int op_flag, } err = ctl->ops->element_tlv(ctl, op_flag, id->numid, tlv, tlv_size); __err: - if (info) - free(info); + if (info) + free(info); return err; } @@ -1402,7 +1402,7 @@ int snd_ctl_wait(snd_ctl_t *ctl, int timeout) * \param private_data Callback private data * \return 0 otherwise a negative error code on failure */ -int snd_async_add_ctl_handler(snd_async_handler_t **handler, snd_ctl_t *ctl, +int snd_async_add_ctl_handler(snd_async_handler_t **handler, snd_ctl_t *ctl, snd_async_callback_t callback, void *private_data) { int err; @@ -1752,7 +1752,7 @@ int snd_ctl_elem_list_alloc_space(snd_ctl_elem_list_t *obj, unsigned int entries } obj->space = entries; return 0; -} +} /** * \brief free previously allocated space for CTL element identifiers list diff --git a/src/control/control_ext.c b/src/control/control_ext.c index f4ddb2ae..f3e91501 100644 --- a/src/control/control_ext.c +++ b/src/control/control_ext.c @@ -42,7 +42,7 @@ const char *_snd_module_control_ext = ""; static int snd_ctl_ext_close(snd_ctl_t *handle) { snd_ctl_ext_t *ext = handle->private_data; - + if (ext->callback->close) ext->callback->close(ext); return 0; @@ -458,7 +458,7 @@ static int snd_ctl_ext_poll_revents(snd_ctl_t *handle, struct pollfd *pfds, unsi return ext->callback->poll_revents(ext, pfds, nfds, revents); if (nfds == 1) { *revents = pfds->revents; - return 0; + return 0; } return -EINVAL; } @@ -529,7 +529,7 @@ usually you will call the external plugin API function #snd_ctl_ext_create(). The control handle must be filled *phandle in return. Then this function must return either a value 0 when succeeded, or a -negative value as the error code. +negative value as the error code. Finally, add #SND_CTL_PLUGIN_SYMBOL() with the name of your plugin as the argument at the end. This defines the proper versioned @@ -625,7 +625,7 @@ PCM. \section ctl_ext_impl_cb Callback Functions of External Control Plugins The callback functions in #snd_ctl_ext_callback_t define the real -behavior of the driver. There are many callbacks but many of them are optional. +behavior of the driver. There are many callbacks but many of them are optional. The close callback is called when the PCM is closed. If the plugin allocates private resources, this is the place to release them @@ -650,7 +650,7 @@ if you use get, read and write callbacks as follows. If you need to create a record dynamically (e.g. via malloc) at each find_elem call, the allocated record can be released with the optional free_key callback. -The get_attribute is a mandatory callback, which returns the attribute of the +The get_attribute is a mandatory callback, which returns the attribute of the control element given via a key value (converted with find_elem callback). It must fill the control element type (#snd_ctl_elem_type_t), the access type (#snd_ctl_ext_access_t), and the count (element array size). The callback returns diff --git a/src/control/control_hw.c b/src/control/control_hw.c index 8db38f92..962cd796 100644 --- a/src/control/control_hw.c +++ b/src/control/control_hw.c @@ -225,20 +225,20 @@ static int snd_ctl_hw_elem_tlv(snd_ctl_t *handle, int op_flag, unsigned int inum; snd_ctl_hw_t *hw = handle->private_data; struct snd_ctl_tlv *xtlv; - + /* we don't support TLV on protocol ver 2.0.3 or earlier */ if (hw->protocol < SNDRV_PROTOCOL_VERSION(2, 0, 4)) return -ENXIO; switch (op_flag) { case -1: inum = SNDRV_CTL_IOCTL_TLV_COMMAND; break; - case 0: inum = SNDRV_CTL_IOCTL_TLV_READ; break; + case 0: inum = SNDRV_CTL_IOCTL_TLV_READ; break; case 1: inum = SNDRV_CTL_IOCTL_TLV_WRITE; break; default: return -EINVAL; } xtlv = malloc(sizeof(struct snd_ctl_tlv) + tlv_size); if (xtlv == NULL) - return -ENOMEM; + return -ENOMEM; xtlv->numid = numid; xtlv->length = tlv_size; memcpy(xtlv->tlv, tlv, tlv_size); @@ -435,7 +435,7 @@ int snd_ctl_hw_open(snd_ctl_t **handle, const char *name, int card, int mode) snd_ctl_hw_t *hw; int err; - *handle = NULL; + *handle = NULL; if (CHECK_SANITY(card < 0 || card >= SND_MAX_CARDS)) { snd_check(CONTROL, "Invalid card index %d", card); diff --git a/src/control/control_local.h b/src/control/control_local.h index 2afa62cc..02530e89 100644 --- a/src/control/control_local.h +++ b/src/control/control_local.h @@ -85,7 +85,7 @@ struct _snd_hctl_elem { struct _snd_hctl { snd_ctl_t *ctl; struct list_head elems; /* list of all controls */ - unsigned int alloc; + unsigned int alloc; unsigned int count; snd_hctl_elem_t **pelems; snd_hctl_compare_t compare; diff --git a/src/control/control_shm.c b/src/control/control_shm.c index 44c0df45..abf8174a 100644 --- a/src/control/control_shm.c +++ b/src/control/control_shm.c @@ -18,7 +18,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ - + #include #include #include @@ -420,7 +420,7 @@ static int make_local_socket(const char *filename) sock = socket(PF_LOCAL, SOCK_STREAM, 0); if (sock < 0) return -errno; - + addr->sun_family = AF_LOCAL; memcpy(addr->sun_path, filename, l); @@ -492,7 +492,7 @@ int snd_ctl_shm_open(snd_ctl_t **handlep, const char *name, const char *sockname result = -errno; goto _err; } - + shm = calloc(1, sizeof(snd_ctl_shm_t)); if (!shm) { result = -ENOMEM; diff --git a/src/control/control_symbols.c b/src/control/control_symbols.c index 5e6c4e9f..cf97c65c 100644 --- a/src/control/control_symbols.c +++ b/src/control/control_symbols.c @@ -31,7 +31,7 @@ static const char **snd_control_open_objects[] = { &_snd_module_control_empty, #include "ctl_symbols_list.c" }; - + void *snd_control_open_symbols(void) { return snd_control_open_objects; diff --git a/src/control/ctlparse.c b/src/control/ctlparse.c index ecb5cf91..b23234d7 100644 --- a/src/control/ctlparse.c +++ b/src/control/ctlparse.c @@ -253,7 +253,7 @@ int __snd_ctl_ascii_elem_id_parse(snd_ctl_elem_id_t *dst, const char *str, if (*str) goto out; } - } + } err = 0; out: @@ -277,12 +277,12 @@ int snd_ctl_ascii_elem_id_parse(snd_ctl_elem_id_t *dst, const char *str) static int get_ctl_enum_item_index(snd_ctl_t *handle, snd_ctl_elem_info_t *info, const char **ptrp) -{ +{ char *ptr = (char *)*ptrp; int items, i, len; const char *name; char end; - + items = snd_ctl_elem_info_get_items(info); if (items <= 0) return -1; @@ -362,7 +362,7 @@ int snd_ctl_ascii_value_parse(snd_ctl_t *handle, if (count > get_ctl_type_max_elements(type)) count = get_ctl_type_max_elements(type); - + for (idx = 0; idx < count && ptr && *ptr; idx++) { if (*ptr == ',') goto skip; diff --git a/src/control/hcontrol.c b/src/control/hcontrol.c index ec842926..5f985faa 100644 --- a/src/control/hcontrol.c +++ b/src/control/hcontrol.c @@ -71,7 +71,7 @@ int snd_hctl_open(snd_hctl_t **hctlp, const char *name, int mode) { snd_ctl_t *ctl; int err; - + if ((err = snd_ctl_open(&ctl, name, mode)) < 0) return err; err = snd_hctl_open_ctl(hctlp, ctl); @@ -294,7 +294,7 @@ static int get_compare_weight(const snd_ctl_elem_id_t *id) }; const char *name = (char *)id->name, *name1; int res, res1; - + if ((res = snd_hctl_compare_mixer_priority_lookup((const char **)&name, names, 1000000)) == NOT_FOUND) return NOT_FOUND; if (*name == '\0') @@ -346,7 +346,7 @@ static int _snd_hctl_find_elem(snd_hctl_t *hctl, const snd_ctl_elem_id_t *id, in static int snd_hctl_elem_add(snd_hctl_t *hctl, snd_hctl_elem_t *elem) { int dir; - int idx; + int idx; elem->compare_weight = get_compare_weight(&elem->id); if (hctl->count == hctl->alloc) { snd_hctl_elem_t **h; @@ -677,7 +677,7 @@ int snd_hctl_wait(snd_hctl_t *hctl, int timeout) struct pollfd *pfd; unsigned short *revents; int i, npfds, pollio, err, err_poll; - + npfds = snd_hctl_poll_descriptors_count(hctl); if (npfds <= 0 || npfds >= 16) { snd_error(CONTROL, "Invalid poll_fds %d", npfds); @@ -781,7 +781,7 @@ int snd_hctl_handle_events(snd_hctl_t *hctl) snd_ctl_event_t event; int res; unsigned int count = 0; - + assert(hctl); assert(hctl->ctl); while ((res = snd_ctl_read(hctl->ctl, &event)) != 0 && diff --git a/src/control/namehint.c b/src/control/namehint.c index e7e4e912..4b2f98b6 100644 --- a/src/control/namehint.c +++ b/src/control/namehint.c @@ -37,7 +37,7 @@ struct hint_list { const char *siface; snd_ctl_elem_iface_t iface; snd_ctl_t *ctl; - snd_ctl_card_info_t *info; + snd_ctl_card_info_t *info; int card; int device; long device_input; @@ -173,7 +173,7 @@ static char *get_dev_name(struct hint_list *list) { char *str1, *str2, *res; int device; - + device = list->device_input >= 0 ? list->device_input : list->device; if (get_dev_name1(list, &str1, device, 1) < 0) return NULL; @@ -261,7 +261,7 @@ static int try_config(snd_config_t *config, snd_config_get_string(cfg, &str) >= 0 && ((strncmp(base, str, strlen(base)) == 0 && str[strlen(base)] == '.') || strchr(str, '.') == NULL)) - goto __skip_add; + goto __skip_add; if (list->card >= 0 && list->device >= 0) sprintf(buf, "%s:CARD=%s,DEV=%i", name, snd_ctl_card_info_get_id(list->info), list->device); else if (list->card >= 0) @@ -294,7 +294,7 @@ static int try_config(snd_config_t *config, cfg1 = res; level = 0; __hint: - level++; + level++; if (snd_config_search(cfg1, "type", &cfg) >= 0 && snd_config_get_string(cfg, &str) >= 0 && strcmp(str, "hw") == 0) { @@ -306,7 +306,7 @@ static int try_config(snd_config_t *config, } } } - + if (snd_config_search(cfg1, "hint", &cfg) >= 0) { if (snd_config_get_type(cfg) != SND_CONFIG_TYPE_COMPOUND) { snd_error(CONTROL, "hint (%s) must be a compound", buf); @@ -363,7 +363,7 @@ static int try_config(snd_config_t *config, goto __skip_add; if (snd_config_search(cfg1, "slave", &cfg) >= 0 && snd_config_search(cfg, base, &cfg1) >= 0) - goto __hint; + goto __hint; snd_config_delete(res); res = NULL; cleanup_res = 0; @@ -395,38 +395,38 @@ static int try_config(snd_config_t *config, __ok: err = 0; __cleanup: - if (err >= 0) { - list->device = dev; - str = list->card >= 0 ? get_dev_name(list) : NULL; - if (str != NULL) { - level = (buf1 == NULL ? 0 : strlen(buf1)) + 1 + strlen(str); - buf2 = realloc((char *)str, level + 1); - if (buf2 != NULL) { - if (buf1 != NULL) { - str = strchr(buf2, '|'); - if (str != NULL) + if (err >= 0) { + list->device = dev; + str = list->card >= 0 ? get_dev_name(list) : NULL; + if (str != NULL) { + level = (buf1 == NULL ? 0 : strlen(buf1)) + 1 + strlen(str); + buf2 = realloc((char *)str, level + 1); + if (buf2 != NULL) { + if (buf1 != NULL) { + str = strchr(buf2, '|'); + if (str != NULL) memmove(buf2 + (level - strlen(str)), str, strlen(str)); else str = buf2 + strlen(buf2); - *(char *)str++ = '\n'; - memcpy((char *)str, buf1, strlen(buf1)); - buf2[level] = '\0'; + *(char *)str++ = '\n'; + memcpy((char *)str, buf1, strlen(buf1)); + buf2[level] = '\0'; free(buf1); } buf1 = buf2; } else { free((char *)str); } - } else if (list->device >= 0) - goto __skip_add; - err = hint_list_add(list, buf, buf1); + } else if (list->device >= 0) + goto __skip_add; + err = hint_list_add(list, buf, buf1); } __skip_add: if (res && cleanup_res) - snd_config_delete(res); + snd_config_delete(res); if (buf1) free(buf1); - free(buf); + free(buf); return err; } @@ -455,7 +455,7 @@ static int add_card(snd_config_t *config, snd_config_t *rw_config, struct hint_l char ctl_name[16]; snd_ctl_card_info_t info = {0}; int device, max_device = 0; - + list->info = &info; err = snd_config_search(config, list->siface, &conf); if (err < 0) @@ -471,7 +471,7 @@ static int add_card(snd_config_t *config, snd_config_t *rw_config, struct hint_l n = snd_config_iterator_entry(i); if (snd_config_get_id(n, &str) < 0) continue; - + if (next_devices[list->iface] != NULL) { list->card = card; device = max_device = -1; @@ -510,7 +510,7 @@ static int add_card(snd_config_t *config, snd_config_t *rw_config, struct hint_l } err = 0; __error: - snd_ctl_close(list->ctl); + snd_ctl_close(list->ctl); return err; } @@ -665,9 +665,9 @@ int snd_device_name_hint(int card, const char *iface, void ***hints) if (!err && !list.list) err = hint_list_add(&list, NULL, NULL); if (err < 0) - snd_device_name_free_hint((void **)list.list); + snd_device_name_free_hint((void **)list.list); else - *hints = (void **)list.list; + *hints = (void **)list.list; free(list.cardname); if (local_config_rw) snd_config_delete(local_config_rw); @@ -726,7 +726,7 @@ char *snd_device_name_get_hint(const void *hint, const char *id) return NULL; hint1 = delim + 1; continue; - } + } if (delim == NULL) return strdup(hint1 + 4); size = delim - hint1 - 4; diff --git a/src/control/setup.c b/src/control/setup.c index adcd00c2..7ae7b3e9 100644 --- a/src/control/setup.c +++ b/src/control/setup.c @@ -564,14 +564,14 @@ static int add_elem(snd_sctl_t *h, snd_config_t *_conf, snd_config_t *private_da if (err < 0) goto _err; } - + err = snd_config_get_ctl_elem_value(value, h->ctl, elem->val, elem->mask, elem->info); if (err < 0) goto _err; list_add_tail(&elem->list, &h->elems); _err: - if (err < 0 && elem) { + if (err < 0 && elem) { if (elem->id) snd_ctl_elem_id_free(elem->id); if (elem->info) diff --git a/src/dlmisc.c b/src/dlmisc.c index 4686ed38..2856cd7b 100644 --- a/src/dlmisc.c +++ b/src/dlmisc.c @@ -211,7 +211,7 @@ static int snd_dlsym_verify(void *handle, const char *name, const char *version) #ifdef HAVE_LIBDL int res; char *vname; - + if (handle == NULL) return -EINVAL; vname = alloca(1 + strlen(name) + strlen(version) + 1); @@ -332,8 +332,8 @@ snd_dlobj_cache_get0(const char *lib, const char *name, errbuf[0] = '\0'; dlobj = INTERNAL(snd_dlopen)(lib, RTLD_NOW, - verbose ? errbuf : 0, - verbose ? sizeof(errbuf) : 0); + verbose ? errbuf : 0, + verbose ? sizeof(errbuf) : 0); if (dlobj == NULL) { if (verbose) snd_error(CORE, "Cannot open shared library %s (%s)", diff --git a/src/hwdep/hwdep.c b/src/hwdep/hwdep.c index 82f09434..8c4a94ea 100644 --- a/src/hwdep/hwdep.c +++ b/src/hwdep/hwdep.c @@ -209,7 +209,7 @@ int snd_hwdep_open_lconf(snd_hwdep_t **hwdep, const char *name, int snd_hwdep_close(snd_hwdep_t *hwdep) { int err; - assert(hwdep); + assert(hwdep); err = hwdep->ops->close(hwdep); if (hwdep->dl_handle) snd_dlclose(hwdep->dl_handle); @@ -296,14 +296,14 @@ int snd_hwdep_poll_descriptors(snd_hwdep_t *hwdep, struct pollfd *pfds, unsigned */ int snd_hwdep_poll_descriptors_revents(snd_hwdep_t *hwdep, struct pollfd *pfds, unsigned int nfds, unsigned short *revents) { - assert(hwdep && pfds && revents); - if (nfds == 1) { - *revents = pfds->revents; - return 0; - } - return -EINVAL; -} - + assert(hwdep && pfds && revents); + if (nfds == 1) { + *revents = pfds->revents; + return 0; + } + return -EINVAL; +} + /** * \brief set nonblock mode * \param hwdep HwDep handle diff --git a/src/hwdep/hwdep_hw.c b/src/hwdep/hwdep_hw.c index 8e2ef1c5..01bce05e 100644 --- a/src/hwdep/hwdep_hw.c +++ b/src/hwdep/hwdep_hw.c @@ -111,7 +111,7 @@ int snd_hwdep_hw_open(snd_hwdep_t **handle, const char *name, int card, int devi assert(handle); *handle = NULL; - + if (card < 0 || card >= SND_MAX_CARDS) return -EINVAL; sprintf(filename, SNDRV_FILE_HWDEP, card, device); diff --git a/src/hwdep/hwdep_symbols.c b/src/hwdep/hwdep_symbols.c index d6f74fa6..77005a35 100644 --- a/src/hwdep/hwdep_symbols.c +++ b/src/hwdep/hwdep_symbols.c @@ -25,7 +25,7 @@ extern const char *_snd_module_hwdep_hw; static const char **snd_hwdep_open_objects[] = { &_snd_module_hwdep_hw }; - + void *snd_hwdep_open_symbols(void) { return snd_hwdep_open_objects; diff --git a/src/input.c b/src/input.c index aa1cef5f..9bd17b0c 100644 --- a/src/input.c +++ b/src/input.c @@ -95,7 +95,7 @@ char *snd_input_gets(snd_input_t *input, char *str, size_t size) { return (input->ops->gets)(input, str, size); } - + /** * \brief Reads a character from an input handle (like \c fgetc(3)). * \param input The input handle. @@ -144,7 +144,7 @@ static char *snd_input_stdio_gets(snd_input_t *input, char *str, size_t size) snd_input_stdio_t *stdio = input->private_data; return fgets(str, (int) size, stdio->fp); } - + static int snd_input_stdio_getc(snd_input_t *input) { snd_input_stdio_t *stdio = input->private_data; @@ -197,7 +197,7 @@ int snd_input_stdio_attach(snd_input_t **inputp, FILE *fp, int _close) *inputp = input; return 0; } - + /** * \brief Creates a new input object reading from a file. * \param inputp The functions puts the pointer to the new input object @@ -262,7 +262,7 @@ static char *snd_input_buffer_gets(snd_input_t *input, char *str, size_t size) *str = '\0'; return str; } - + static int snd_input_buffer_getc(snd_input_t *input) { snd_input_buffer_t *buffer = input->private_data; @@ -334,4 +334,4 @@ int snd_input_buffer_open(snd_input_t **inputp, const char *buf, ssize_t size) *inputp = input; return 0; } - + diff --git a/src/mixer/mixer.c b/src/mixer/mixer.c index 7dd5c47a..2ec3195f 100644 --- a/src/mixer/mixer.c +++ b/src/mixer/mixer.c @@ -752,7 +752,7 @@ int snd_mixer_poll_descriptors_revents(snd_mixer_t *mixer, struct pollfd *pfds, { unsigned int idx; unsigned short res; - assert(mixer && pfds && revents); + assert(mixer && pfds && revents); if (nfds == 0) return -EINVAL; res = 0; @@ -781,7 +781,7 @@ int snd_mixer_wait(snd_mixer_t *mixer, int timeout) pfds = alloca(count * sizeof(*pfds)); if (!pfds) return -ENOMEM; - err = snd_mixer_poll_descriptors(mixer, pfds, + err = snd_mixer_poll_descriptors(mixer, pfds, (unsigned int) count); assert(err == count); } diff --git a/src/mixer/mixer_local.h b/src/mixer/mixer_local.h index 667242b4..26868f51 100644 --- a/src/mixer/mixer_local.h +++ b/src/mixer/mixer_local.h @@ -46,7 +46,7 @@ struct _snd_mixer_class { struct list_head list; snd_mixer_t *mixer; snd_mixer_event_t event; - void *private_data; + void *private_data; void (*private_free)(snd_mixer_class_t *class); snd_mixer_compare_t compare; }; diff --git a/src/mixer/simple.c b/src/mixer/simple.c index 1ef2f975..74915b56 100644 --- a/src/mixer/simple.c +++ b/src/mixer/simple.c @@ -122,7 +122,7 @@ int snd_mixer_selem_compare(const snd_mixer_elem_t *c1, const snd_mixer_elem_t * return s1->id->index - s2->id->index; } #endif - + /** * \brief Find a mixer simple element * \param mixer Mixer handle @@ -304,7 +304,7 @@ int snd_mixer_selem_get_playback_dB_range(snd_mixer_elem_t *elem, * \param min minimum volume value * \param max maximum volume value */ -int snd_mixer_selem_set_playback_volume_range(snd_mixer_elem_t *elem, +int snd_mixer_selem_set_playback_volume_range(snd_mixer_elem_t *elem, long min, long max) { CHECK_BASIC(elem); @@ -610,7 +610,7 @@ int snd_mixer_selem_get_capture_dB_range(snd_mixer_elem_t *elem, * \param min minimum volume value * \param max maximum volume value */ -int snd_mixer_selem_set_capture_volume_range(snd_mixer_elem_t *elem, +int snd_mixer_selem_set_capture_volume_range(snd_mixer_elem_t *elem, long min, long max) { CHECK_BASIC(elem); diff --git a/src/mixer/simple_abst.c b/src/mixer/simple_abst.c index 18a69f1d..7d48c8ed 100644 --- a/src/mixer/simple_abst.c +++ b/src/mixer/simple_abst.c @@ -243,7 +243,7 @@ static int find_module(snd_mixer_class_t *class, snd_config_t *top) static void private_free(snd_mixer_class_t *class) { class_priv_t *priv = snd_mixer_class_get_private(class); - + if (priv->private_free) priv->private_free(class); if (priv->dlhandle) @@ -350,7 +350,7 @@ int snd_mixer_simple_basic_register(snd_mixer_t *mixer, __error: if (top) snd_config_delete(top); - if (class) + if (class) snd_mixer_class_free(class); return err; } diff --git a/src/mixer/simple_none.c b/src/mixer/simple_none.c index 1ff4277e..4c47b168 100644 --- a/src/mixer/simple_none.c +++ b/src/mixer/simple_none.c @@ -649,7 +649,7 @@ static int selem_write_main(snd_mixer_elem_t *elem) static int selem_write(snd_mixer_elem_t *elem) { int err; - + err = selem_write_main(elem); if (err < 0) selem_read(elem); @@ -883,7 +883,7 @@ static int simple_update(snd_mixer_elem_t *melem) simple->str[SM_CAPT].max = cmax != LONG_MIN ? cmax : 0; } return 0; -} +} #ifndef DOC_HIDDEN static const struct suf { @@ -961,7 +961,7 @@ static int base_len(const char *name, selem_ctl_type_t *type) /* * Simple Mixer Operations */ - + static int _snd_mixer_selem_set_volume(snd_mixer_elem_t *elem, int dir, snd_mixer_selem_channel_id_t channel, long value) { selem_none_t *s = snd_mixer_elem_get_private(elem); @@ -971,7 +971,7 @@ static int _snd_mixer_selem_set_volume(snd_mixer_elem_t *elem, int dir, snd_mixe return 0; if (value < s->str[dir].min || value > s->str[dir].max) return 0; - if (s->selem.caps & + if (s->selem.caps & (dir == SM_PLAY ? SM_CAP_PVOLUME_JOIN : SM_CAP_CVOLUME_JOIN)) channel = 0; if (value != s->str[dir].vol[channel]) { @@ -986,7 +986,7 @@ static int _snd_mixer_selem_set_switch(snd_mixer_elem_t *elem, int dir, snd_mixe selem_none_t *s = snd_mixer_elem_get_private(elem); if ((unsigned int) channel >= s->str[dir].channels) return 0; - if (s->selem.caps & + if (s->selem.caps & (dir == SM_PLAY ? SM_CAP_PSWITCH_JOIN : SM_CAP_CSWITCH_JOIN)) channel = 0; if (value) { @@ -1006,7 +1006,7 @@ static int _snd_mixer_selem_set_switch(snd_mixer_elem_t *elem, int dir, snd_mixe static int is_ops(snd_mixer_elem_t *elem, int dir, int cmd, int val) { selem_none_t *s = snd_mixer_elem_get_private(elem); - + switch (cmd) { case SM_OPS_IS_ACTIVE: { @@ -1034,7 +1034,7 @@ static int is_ops(snd_mixer_elem_t *elem, int dir, int cmd, int val) if (s->selem.caps & (SM_CAP_CENUM | SM_CAP_PENUM) ) return 1; return 0; - + case SM_OPS_IS_ENUMCNT: /* Both */ if ( (s->selem.caps & (SM_CAP_CENUM | SM_CAP_PENUM)) == (SM_CAP_CENUM | SM_CAP_PENUM) ) { @@ -1054,7 +1054,7 @@ static int is_ops(snd_mixer_elem_t *elem, int dir, int cmd, int val) } } - + return 1; } @@ -1174,7 +1174,7 @@ static int get_dB_range(snd_hctl_elem_t *ctl, struct selem_str *rec, return snd_tlv_get_dB_range(rec->db_info, rec->min, rec->max, min, max); } - + static int get_dB_range_ops(snd_mixer_elem_t *elem, int dir, long *min, long *max) { @@ -1215,9 +1215,9 @@ static int ask_vol_dB_ops(snd_mixer_elem_t *elem, } static int get_dB_ops(snd_mixer_elem_t *elem, - int dir, - snd_mixer_selem_channel_id_t channel, - long *value) + int dir, + snd_mixer_selem_channel_id_t channel, + long *value) { selem_none_t *s = snd_mixer_elem_get_private(elem); selem_ctl_t *c; @@ -1264,7 +1264,7 @@ static int set_volume_ops(snd_mixer_elem_t *elem, int dir, } static int ask_dB_vol_ops(snd_mixer_elem_t *elem, int dir, - long dbValue, long *value, int xdir) + long dbValue, long *value, int xdir) { selem_none_t *s = snd_mixer_elem_get_private(elem); selem_ctl_t *c; @@ -1446,7 +1446,7 @@ static int simple_add1(snd_mixer_class_t *class, const char *name, if (ctype == SND_CTL_ELEM_TYPE_ENUMERATED) type = CTL_GLOBAL_ENUM; else if (ctype != SND_CTL_ELEM_TYPE_BOOLEAN && - ctype != SND_CTL_ELEM_TYPE_INTEGER) + ctype != SND_CTL_ELEM_TYPE_INTEGER) return 0; break; case CTL_GLOBAL_ROUTE: diff --git a/src/names.c b/src/names.c index 922ef781..0214727d 100644 --- a/src/names.c +++ b/src/names.c @@ -35,7 +35,7 @@ #include #include -/** +/** * \brief This function is unimplemented. * \deprecated Since 1.0.14 */ diff --git a/src/output.c b/src/output.c index 0e402b51..e9c414df 100644 --- a/src/output.c +++ b/src/output.c @@ -100,7 +100,7 @@ int snd_output_puts(snd_output_t *output, const char *str) { return output->ops->puts(output, str); } - + /** * \brief Writes a character to an output handle (like \c putc(3)). * \param output The output handle. @@ -152,7 +152,7 @@ static int snd_output_stdio_puts(snd_output_t *output, const char *str) snd_output_stdio_t *stdio = output->private_data; return fputs(str, stdio->fp); } - + static int snd_output_stdio_putc(snd_output_t *output, int c) { snd_output_stdio_t *stdio = output->private_data; @@ -206,7 +206,7 @@ int snd_output_stdio_attach(snd_output_t **outputp, FILE *fp, int _close) *outputp = output; return 0; } - + /** * \brief Creates a new output object writing to a file. * \param outputp The function puts the pointer to the new output object @@ -307,7 +307,7 @@ static int snd_output_buffer_puts(snd_output_t *output, const char *str) buffer->size += size; return size; } - + static int snd_output_buffer_putc(snd_output_t *output, int c) { snd_output_buffer_t *buffer = output->private_data; diff --git a/src/pcm/interval.c b/src/pcm/interval.c index 719e5086..cc43b959 100644 --- a/src/pcm/interval.c +++ b/src/pcm/interval.c @@ -18,7 +18,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ - + #define SND_INTERVAL_C #define SND_INTERVAL_INLINE @@ -32,7 +32,7 @@ static inline void div64_32(uint64_t *n, uint32_t d, uint32_t *rem) *n /= d; } -static inline unsigned int div32(unsigned int a, unsigned int b, +static inline unsigned int div32(unsigned int a, unsigned int b, unsigned int *r) { if (b == 0) { @@ -378,7 +378,7 @@ void snd_interval_print(const snd_interval_t *i, snd_output_t *out) { if (snd_interval_empty(i)) snd_output_printf(out, "NONE"); - else if (i->min == 0 && i->openmin == 0 && + else if (i->min == 0 && i->openmin == 0 && i->max == UINT_MAX && i->openmax == 0) snd_output_printf(out, "ALL"); else if (snd_interval_single(i) && i->integer) diff --git a/src/pcm/interval.h b/src/pcm/interval.h index 04996c9f..b7a76123 100644 --- a/src/pcm/interval.h +++ b/src/pcm/interval.h @@ -18,7 +18,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ - + typedef struct _snd_interval snd_interval_t; #ifdef SND_INTERVAL_INLINE @@ -62,9 +62,9 @@ void snd_interval_add(const snd_interval_t *a, const snd_interval_t *b, snd_inte void snd_interval_sub(const snd_interval_t *a, const snd_interval_t *b, snd_interval_t *c); void snd_interval_mul(const snd_interval_t *a, const snd_interval_t *b, snd_interval_t *c); void snd_interval_div(const snd_interval_t *a, const snd_interval_t *b, snd_interval_t *c); -void snd_interval_muldiv(const snd_interval_t *a, const snd_interval_t *b, +void snd_interval_muldiv(const snd_interval_t *a, const snd_interval_t *b, const snd_interval_t *c, snd_interval_t *d); -void snd_interval_muldivk(const snd_interval_t *a, const snd_interval_t *b, +void snd_interval_muldivk(const snd_interval_t *a, const snd_interval_t *b, unsigned int k, snd_interval_t *c); void snd_interval_mulkdiv(const snd_interval_t *a, unsigned int k, const snd_interval_t *b, snd_interval_t *c); diff --git a/src/pcm/interval_inline.h b/src/pcm/interval_inline.h index d9a30b2a..2c2c0a3e 100644 --- a/src/pcm/interval_inline.h +++ b/src/pcm/interval_inline.h @@ -18,7 +18,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ - + #define INTERVAL_INLINE static inline INTERVAL_INLINE void snd_interval_any(snd_interval_t *i) @@ -50,7 +50,7 @@ INTERVAL_INLINE int snd_interval_empty(const snd_interval_t *i) INTERVAL_INLINE int snd_interval_single(const snd_interval_t *i) { assert(!snd_interval_empty(i)); - return (i->min == i->max || + return (i->min == i->max || (i->min + 1 == i->max && (i->openmin || i->openmax))); } @@ -146,8 +146,8 @@ INTERVAL_INLINE int snd_interval_always_eq(const snd_interval_t *i1, const snd_i INTERVAL_INLINE int snd_interval_never_eq(const snd_interval_t *i1, const snd_interval_t *i2) { - - return (i1->max < i2->min || + + return (i1->max < i2->min || (i1->max == i2->min && (i1->openmax || i1->openmin)) || i1->min > i2->max || diff --git a/src/pcm/ladspa.h b/src/pcm/ladspa.h index 5c30a8a4..e8d4d373 100644 --- a/src/pcm/ladspa.h +++ b/src/pcm/ladspa.h @@ -3,17 +3,17 @@ Linux Audio Developer's Simple Plugin API Version 1.1[LGPL]. Copyright (C) 2000-2002 Richard W.E. Furse, Paul Barton-Davis, Stefan Westerfeld. - + 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 library 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 @@ -32,7 +32,7 @@ extern "C" { /*****************************************************************************/ -/* Overview: +/* Overview: There is a large number of synthesis packages in use or development on the Linux platform at this time. This API (`The Linux Audio @@ -76,7 +76,7 @@ extern "C" { /* Fundamental data type passed in and out of plugin. This data type is used to communicate audio samples and control values. It is assumed that the plugin will work sensibly given any numeric input - value although it may have a preferred range (see hints below). + value although it may have a preferred range (see hints below). For audio it is generally assumed that 1.0f is the `0dB' reference amplitude and is a `normal' signal level. */ @@ -85,8 +85,8 @@ typedef float LADSPA_Data; /*****************************************************************************/ -/* Special Plugin Properties: - +/* Special Plugin Properties: + Optional features of the plugin type are encapsulated in the LADSPA_Properties type. This is assembled by ORing individual properties together. */ @@ -122,7 +122,7 @@ typedef int LADSPA_Properties; (3) The plugin will not access files, devices, pipes, sockets, IPC or any other mechanism that might result in process or thread blocking. - + (4) The plugin will take an amount of time to execute a run() or run_adding() call approximately of form (A+B*SampleCount) where A and B depend on the machine and host in use. This amount of time @@ -137,7 +137,7 @@ typedef int LADSPA_Properties; /*****************************************************************************/ -/* Plugin Ports: +/* Plugin Ports: Plugins have `ports' that are inputs or outputs for audio or data. Ports can communicate arrays of LADSPA_Data (for audio @@ -172,23 +172,23 @@ typedef int LADSPA_PortDescriptor; /*****************************************************************************/ -/* Plugin Port Range Hints: +/* Plugin Port Range Hints: The host may wish to provide a representation of data entering or leaving a plugin (e.g. to generate a GUI automatically). To make this more meaningful, the plugin should provide `hints' to the host describing the usual values taken by the data. - + Note that these are only hints. The host may ignore them and the plugin must not assume that data supplied to it is meaningful. If the plugin receives invalid input data it is expected to continue to run without failure and, where possible, produce a sensible output (e.g. a high-pass filter given a negative cutoff frequency might switch to an all-pass mode). - + Hints are meaningful for all input and output ports but hints for input control ports are expected to be particularly useful. - + More hint information is encapsulated in the LADSPA_PortRangeHintDescriptor type which is assembled by ORing individual hint types together. Hints may require further @@ -316,23 +316,23 @@ typedef int LADSPA_PortRangeHintDescriptor; #define LADSPA_IS_HINT_HAS_DEFAULT(x) ((x) & LADSPA_HINT_DEFAULT_MASK) #define LADSPA_IS_HINT_DEFAULT_MINIMUM(x) (((x) & LADSPA_HINT_DEFAULT_MASK) \ - == LADSPA_HINT_DEFAULT_MINIMUM) + == LADSPA_HINT_DEFAULT_MINIMUM) #define LADSPA_IS_HINT_DEFAULT_LOW(x) (((x) & LADSPA_HINT_DEFAULT_MASK) \ - == LADSPA_HINT_DEFAULT_LOW) + == LADSPA_HINT_DEFAULT_LOW) #define LADSPA_IS_HINT_DEFAULT_MIDDLE(x) (((x) & LADSPA_HINT_DEFAULT_MASK) \ - == LADSPA_HINT_DEFAULT_MIDDLE) + == LADSPA_HINT_DEFAULT_MIDDLE) #define LADSPA_IS_HINT_DEFAULT_HIGH(x) (((x) & LADSPA_HINT_DEFAULT_MASK) \ - == LADSPA_HINT_DEFAULT_HIGH) + == LADSPA_HINT_DEFAULT_HIGH) #define LADSPA_IS_HINT_DEFAULT_MAXIMUM(x) (((x) & LADSPA_HINT_DEFAULT_MASK) \ - == LADSPA_HINT_DEFAULT_MAXIMUM) + == LADSPA_HINT_DEFAULT_MAXIMUM) #define LADSPA_IS_HINT_DEFAULT_0(x) (((x) & LADSPA_HINT_DEFAULT_MASK) \ - == LADSPA_HINT_DEFAULT_0) + == LADSPA_HINT_DEFAULT_0) #define LADSPA_IS_HINT_DEFAULT_1(x) (((x) & LADSPA_HINT_DEFAULT_MASK) \ - == LADSPA_HINT_DEFAULT_1) + == LADSPA_HINT_DEFAULT_1) #define LADSPA_IS_HINT_DEFAULT_100(x) (((x) & LADSPA_HINT_DEFAULT_MASK) \ - == LADSPA_HINT_DEFAULT_100) + == LADSPA_HINT_DEFAULT_100) #define LADSPA_IS_HINT_DEFAULT_440(x) (((x) & LADSPA_HINT_DEFAULT_MASK) \ - == LADSPA_HINT_DEFAULT_440) + == LADSPA_HINT_DEFAULT_440) typedef struct _LADSPA_PortRangeHint { @@ -353,7 +353,7 @@ typedef struct _LADSPA_PortRangeHint { /*****************************************************************************/ -/* Plugin Handles: +/* Plugin Handles: This plugin handle indicates a particular instance of the plugin concerned. It is valid to compare this to NULL (0 for C++) but @@ -364,13 +364,13 @@ typedef void * LADSPA_Handle; /*****************************************************************************/ -/* Descriptor for a Type of Plugin: +/* Descriptor for a Type of Plugin: This structure is used to describe a plugin type. It provides a number of functions to examine the type, instantiate it, link it to buffers and workspaces and to run it. */ -typedef struct _LADSPA_Descriptor { +typedef struct _LADSPA_Descriptor { /* This numeric identifier indicates the plugin type uniquely. Plugin programmers may reserve ranges of IDs from a @@ -430,12 +430,12 @@ typedef struct _LADSPA_Descriptor { instantiation function accepts a sample rate as a parameter. The plugin descriptor from which this instantiate function was found must also be passed. This function must return NULL if - instantiation fails. + instantiation fails. Note that instance initialisation should generally occur in activate() rather than here. */ LADSPA_Handle (*instantiate)(const struct _LADSPA_Descriptor * Descriptor, - unsigned long SampleRate); + unsigned long SampleRate); /* This member is a function pointer that connects a port on an instantiated plugin to a memory location at which a block of data @@ -464,8 +464,8 @@ typedef struct _LADSPA_Descriptor { However, overlapped buffers or use of a single buffer for both audio and control data may result in unexpected behaviour. */ void (*connect_port)(LADSPA_Handle Instance, - unsigned long Port, - LADSPA_Data * DataLocation); + unsigned long Port, + LADSPA_Data * DataLocation); /* This member is a function pointer that initialises a plugin instance and activates it for use. This is separated from @@ -503,7 +503,7 @@ typedef struct _LADSPA_Descriptor { then there are various things that the plugin should not do within the run() or run_adding() functions (see above). */ void (*run)(LADSPA_Handle Instance, - unsigned long SampleCount); + unsigned long SampleCount); /* This method is a function pointer that runs an instance of a plugin for a block. This has identical behaviour to run() except @@ -519,7 +519,7 @@ typedef struct _LADSPA_Descriptor { this function pointer must be set to NULL. When it is provided, the function set_run_adding_gain() must be provided also. */ void (*run_adding)(LADSPA_Handle Instance, - unsigned long SampleCount); + unsigned long SampleCount); /* This method is a function pointer that sets the output gain for use when run_adding() is called (see above). If this function is @@ -531,7 +531,7 @@ typedef struct _LADSPA_Descriptor { run_adding() function is provided. When it is absent this function pointer must be set to NULL. */ void (*set_run_adding_gain)(LADSPA_Handle Instance, - LADSPA_Data Gain); + LADSPA_Data Gain); /* This is the counterpart to activate() (see above). If there is nothing for deactivate() to do then the plugin writer may provide @@ -551,7 +551,7 @@ typedef struct _LADSPA_Descriptor { /* Once an instance of a plugin has been finished with it can be deleted using the following function. The instance handle passed ceases to be valid after this call. - + If activate() was called for a plugin instance then a corresponding call to deactivate() must be made before cleanup() is called. */ @@ -589,7 +589,7 @@ typedef struct _LADSPA_Descriptor { const LADSPA_Descriptor * ladspa_descriptor(unsigned long Index); /* Datatype corresponding to the ladspa_descriptor() function. */ -typedef const LADSPA_Descriptor * +typedef const LADSPA_Descriptor * (*LADSPA_Descriptor_Function)(unsigned long Index); /**********************************************************************/ diff --git a/src/pcm/mask.c b/src/pcm/mask.c index 6bd218da..bf97cefc 100644 --- a/src/pcm/mask.c +++ b/src/pcm/mask.c @@ -18,7 +18,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ - + #define SND_MASK_C #define SND_MASK_INLINE diff --git a/src/pcm/mask.h b/src/pcm/mask.h index 7f30587b..6934ac93 100644 --- a/src/pcm/mask.h +++ b/src/pcm/mask.h @@ -18,7 +18,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ - + typedef struct _snd_mask snd_mask_t; #define SND_MASK_MAX 64 diff --git a/src/pcm/mask_inline.h b/src/pcm/mask_inline.h index 75ad3594..6de3686d 100644 --- a/src/pcm/mask_inline.h +++ b/src/pcm/mask_inline.h @@ -18,7 +18,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ - + #include #include @@ -32,36 +32,36 @@ MASK_INLINE unsigned int ld2(uint32_t v) { - unsigned r = 0; + unsigned r = 0; - if (v >= 0x10000) { - v >>= 16; - r += 16; - } - if (v >= 0x100) { - v >>= 8; - r += 8; - } - if (v >= 0x10) { - v >>= 4; - r += 4; - } - if (v >= 4) { - v >>= 2; - r += 2; - } - if (v >= 2) - r++; - return r; + if (v >= 0x10000) { + v >>= 16; + r += 16; + } + if (v >= 0x100) { + v >>= 8; + r += 8; + } + if (v >= 0x10) { + v >>= 4; + r += 4; + } + if (v >= 4) { + v >>= 2; + r += 2; + } + if (v >= 2) + r++; + return r; } MASK_INLINE unsigned int hweight32(uint32_t v) { - v = (v & 0x55555555) + ((v >> 1) & 0x55555555); - v = (v & 0x33333333) + ((v >> 2) & 0x33333333); - v = (v & 0x0F0F0F0F) + ((v >> 4) & 0x0F0F0F0F); - v = (v & 0x00FF00FF) + ((v >> 8) & 0x00FF00FF); - return (v & 0x0000FFFF) + ((v >> 16) & 0x0000FFFF); + v = (v & 0x55555555) + ((v >> 1) & 0x55555555); + v = (v & 0x33333333) + ((v >> 2) & 0x33333333); + v = (v & 0x0F0F0F0F) + ((v >> 4) & 0x0F0F0F0F); + v = (v & 0x00FF00FF) + ((v >> 8) & 0x00FF00FF); + return (v & 0x0000FFFF) + ((v >> 16) & 0x0000FFFF); } MASK_INLINE size_t snd_mask_sizeof(void) diff --git a/src/pcm/pcm.c b/src/pcm/pcm.c index ec751707..c8804f3b 100644 --- a/src/pcm/pcm.c +++ b/src/pcm/pcm.c @@ -153,7 +153,7 @@ using #snd_pcm_state() call. There are these states: \par SND_PCM_STATE_OPEN The PCM device is in the open state. After the #snd_pcm_open() open call, the device is in this state. Also, when #snd_pcm_hw_params() call fails, -then this state is entered to force application calling +then this state is entered to force application calling #snd_pcm_hw_params() function to set right communication parameters. @@ -799,7 +799,7 @@ int snd_pcm_close(snd_pcm_t *pcm) if (err < 0) res = err; return res; -} +} /** * \brief set nonblock mode @@ -925,7 +925,7 @@ int snd_pcm_hw_params_current(snd_pcm_t *pcm, snd_pcm_hw_params_t *params) params->rate_den = pcm->rate_den; params->fifo_size = pcm->fifo_size; return 0; -} +} /** \brief Install one PCM hardware configuration chosen from a configuration space and #snd_pcm_prepare it * \param pcm PCM handle @@ -933,7 +933,7 @@ int snd_pcm_hw_params_current(snd_pcm_t *pcm, snd_pcm_hw_params_t *params) * \return 0 on success otherwise a negative error code * * The configuration is chosen fixing single parameters in this order: - * first access, first format, first subformat, min channels, min rate, + * first access, first format, first subformat, min channels, min rate, * min period time, max buffer size, min tick time. If no mutually * compatible set of parameters can be chosen, a negative error code * will be returned. @@ -1565,7 +1565,7 @@ use_default_symbol_version(__snd_pcm_forward, snd_pcm_forward, ALSA_0.9.0rc8); * If the non-blocking behaviour is selected, then routine doesn't wait at all. * * The function is thread-safe when built with the proper option. - */ + */ snd_pcm_sframes_t snd_pcm_writei(snd_pcm_t *pcm, const void *buffer, snd_pcm_uframes_t size) { int err; @@ -1604,7 +1604,7 @@ snd_pcm_sframes_t snd_pcm_writei(snd_pcm_t *pcm, const void *buffer, snd_pcm_ufr * If the non-blocking behaviour is selected, then routine doesn't wait at all. * * The function is thread-safe when built with the proper option. - */ + */ snd_pcm_sframes_t snd_pcm_writen(snd_pcm_t *pcm, void **bufs, snd_pcm_uframes_t size) { int err; @@ -1643,7 +1643,7 @@ snd_pcm_sframes_t snd_pcm_writen(snd_pcm_t *pcm, void **bufs, snd_pcm_uframes_t * If the non-blocking behaviour is selected, then routine doesn't wait at all. * * The function is thread-safe when built with the proper option. - */ + */ snd_pcm_sframes_t snd_pcm_readi(snd_pcm_t *pcm, void *buffer, snd_pcm_uframes_t size) { int err; @@ -1682,7 +1682,7 @@ snd_pcm_sframes_t snd_pcm_readi(snd_pcm_t *pcm, void *buffer, snd_pcm_uframes_t * If the non-blocking behaviour is selected, then routine doesn't wait at all. * * The function is thread-safe when built with the proper option. - */ + */ snd_pcm_sframes_t snd_pcm_readn(snd_pcm_t *pcm, void **bufs, snd_pcm_uframes_t size) { int err; @@ -1710,7 +1710,7 @@ snd_pcm_sframes_t snd_pcm_readn(snd_pcm_t *pcm, void **bufs, snd_pcm_uframes_t s * \return 0 on success otherwise a negative error code * * The two PCMs will start/stop/prepare in sync. - */ + */ int snd_pcm_link(snd_pcm_t *pcm1, snd_pcm_t *pcm2) { int err = 0; @@ -1899,10 +1899,10 @@ static int __snd_pcm_poll_revents(snd_pcm_t *pcm, struct pollfd *pfds, #define HW_PARAM(v) [SND_PCM_HW_PARAM_##v] = #v #define SW_PARAM(v) [SND_PCM_SW_PARAM_##v] = #v #define FORMAT(v) [SND_PCM_FORMAT_##v] = #v -#define SUBFORMAT(v) [SND_PCM_SUBFORMAT_##v] = #v +#define SUBFORMAT(v) [SND_PCM_SUBFORMAT_##v] = #v #define FORMATD(v, d) [SND_PCM_FORMAT_##v] = d -#define SUBFORMATD(v, d) [SND_PCM_SUBFORMAT_##v] = d +#define SUBFORMATD(v, d) [SND_PCM_SUBFORMAT_##v] = d static const char *const snd_pcm_stream_names[] = { @@ -1923,7 +1923,7 @@ static const char *const snd_pcm_state_names[] = { }; static const char *const snd_pcm_access_names[] = { - ACCESS(MMAP_INTERLEAVED), + ACCESS(MMAP_INTERLEAVED), ACCESS(MMAP_NONINTERLEAVED), ACCESS(MMAP_COMPLEX), ACCESS(RW_INTERLEAVED), @@ -1999,7 +1999,7 @@ static const char *const snd_pcm_format_aliases[SND_PCM_FORMAT_LAST+1] = { }; static const char *const snd_pcm_format_descriptions[] = { - FORMATD(S8, "Signed 8 bit"), + FORMATD(S8, "Signed 8 bit"), FORMATD(U8, "Unsigned 8 bit"), FORMATD(S16_LE, "Signed 16 bit Little Endian"), FORMATD(S16_BE, "Signed 16 bit Big Endian"), @@ -2053,29 +2053,29 @@ static const char *const snd_pcm_format_descriptions[] = { }; static const char *const snd_pcm_type_names[] = { - PCMTYPE(HW), - PCMTYPE(HOOKS), - PCMTYPE(MULTI), - PCMTYPE(FILE), - PCMTYPE(NULL), - PCMTYPE(SHM), - PCMTYPE(INET), - PCMTYPE(COPY), - PCMTYPE(LINEAR), - PCMTYPE(ALAW), - PCMTYPE(MULAW), - PCMTYPE(ADPCM), - PCMTYPE(RATE), - PCMTYPE(ROUTE), - PCMTYPE(PLUG), - PCMTYPE(SHARE), - PCMTYPE(METER), - PCMTYPE(MIX), - PCMTYPE(DROUTE), - PCMTYPE(LBSERVER), - PCMTYPE(LINEAR_FLOAT), - PCMTYPE(LADSPA), - PCMTYPE(DMIX), + PCMTYPE(HW), + PCMTYPE(HOOKS), + PCMTYPE(MULTI), + PCMTYPE(FILE), + PCMTYPE(NULL), + PCMTYPE(SHM), + PCMTYPE(INET), + PCMTYPE(COPY), + PCMTYPE(LINEAR), + PCMTYPE(ALAW), + PCMTYPE(MULAW), + PCMTYPE(ADPCM), + PCMTYPE(RATE), + PCMTYPE(ROUTE), + PCMTYPE(PLUG), + PCMTYPE(SHARE), + PCMTYPE(METER), + PCMTYPE(MIX), + PCMTYPE(DROUTE), + PCMTYPE(LBSERVER), + PCMTYPE(LINEAR_FLOAT), + PCMTYPE(LADSPA), + PCMTYPE(DMIX), PCMTYPE(JACK), PCMTYPE(DSNOOP), PCMTYPE(IEC958), @@ -2086,14 +2086,14 @@ static const char *const snd_pcm_type_names[] = { }; static const char *const snd_pcm_subformat_names[] = { - SUBFORMAT(STD), + SUBFORMAT(STD), SUBFORMAT(MSBITS_MAX), SUBFORMAT(MSBITS_20), SUBFORMAT(MSBITS_24), }; static const char *const snd_pcm_subformat_descriptions[] = { - SUBFORMATD(STD, "Standard"), + SUBFORMATD(STD, "Standard"), SUBFORMATD(MSBITS_MAX, "Maximum based on PCM format"), SUBFORMATD(MSBITS_20, "20 most significant bits"), SUBFORMATD(MSBITS_24, "24 most significant bits"), @@ -2343,7 +2343,7 @@ int snd_pcm_dump_hw_setup(snd_pcm_t *pcm, snd_output_t *out) snd_check(PCM, "PCM not set up"); return -EIO; } - snd_output_printf(out, " stream : %s\n", snd_pcm_stream_name(pcm->stream)); + snd_output_printf(out, " stream : %s\n", snd_pcm_stream_name(pcm->stream)); snd_output_printf(out, " access : %s\n", snd_pcm_access_name(pcm->access)); snd_output_printf(out, " format : %s\n", snd_pcm_format_name(pcm->format)); snd_output_printf(out, " subformat : %s\n", snd_pcm_subformat_name(pcm->subformat)); @@ -2513,7 +2513,7 @@ ssize_t snd_pcm_samples_to_bytes(snd_pcm_t *pcm, long samples) * * The asynchronous callback is called when period boundary elapses. */ -int snd_async_add_pcm_handler(snd_async_handler_t **handler, snd_pcm_t *pcm, +int snd_async_add_pcm_handler(snd_async_handler_t **handler, snd_pcm_t *pcm, snd_async_callback_t callback, void *private_data) { int err; @@ -2570,8 +2570,8 @@ static int snd_pcm_open_conf(snd_pcm_t **pcmp, const char *name, snd_config_iterator_t i, next; const char *id; const char *lib = NULL, *open_name = NULL; - int (*open_func)(snd_pcm_t **, const char *, - snd_config_t *, snd_config_t *, + int (*open_func)(snd_pcm_t **, const char *, + snd_config_t *, snd_config_t *, snd_pcm_stream_t, int) = NULL; #ifndef PIC extern void *snd_pcm_open_symbols(void); @@ -2741,7 +2741,7 @@ static int snd_pcm_open_noupdate(snd_pcm_t **pcmp, snd_config_t *root, * \param mode Open mode (see #SND_PCM_NONBLOCK, #SND_PCM_ASYNC) * \return 0 on success otherwise a negative error code */ -int snd_pcm_open(snd_pcm_t **pcmp, const char *name, +int snd_pcm_open(snd_pcm_t **pcmp, const char *name, snd_pcm_stream_t stream, int mode) { snd_config_t *top; @@ -2771,7 +2771,7 @@ int snd_pcm_open(snd_pcm_t **pcmp, const char *name, * \param lconf Local configuration * \return 0 on success otherwise a negative error code */ -int snd_pcm_open_lconf(snd_pcm_t **pcmp, const char *name, +int snd_pcm_open_lconf(snd_pcm_t **pcmp, const char *name, snd_pcm_stream_t stream, int mode, snd_config_t *lconf) { @@ -2894,7 +2894,7 @@ int snd_pcm_open_named_slave(snd_pcm_t **pcmp, const char *name, * see also SND_PCM_WAIT_IO and SND_PCM_WAIT_DRAIN * \return a positive value on success otherwise a negative error code * (-EPIPE for the xrun and -ESTRPIPE for the suspended status, - * others for general errors) + * others for general errors) * \retval 0 timeout occurred * \retval 1 PCM stream is ready for I/O * @@ -2957,7 +2957,7 @@ static int __snd_pcm_wait_drain_timeout(snd_pcm_t *pcm) return timeout; } -/* +/* * like snd_pcm_wait() but doesn't check mmap_avail before calling poll() * * used in drain code in some plugins @@ -2969,7 +2969,7 @@ int snd_pcm_wait_nocheck(snd_pcm_t *pcm, int timeout) struct pollfd *pfd; unsigned short revents = 0; int npfds, err, err_poll; - + npfds = __snd_pcm_poll_descriptors_count(pcm); if (npfds <= 0 || npfds >= 16) { snd_error(PCM, "Invalid poll_fds %d", npfds); @@ -2995,9 +2995,9 @@ int snd_pcm_wait_nocheck(snd_pcm_t *pcm, int timeout) __snd_pcm_lock(pcm->fast_op_arg); if (err_poll < 0) { if (errno == EINTR && !PCMINABORT(pcm) && !(pcm->mode & SND_PCM_EINTR)) - continue; + continue; return -errno; - } + } if (! err_poll) break; err = __snd_pcm_poll_revents(pcm, pfd, npfds, &revents); @@ -3164,13 +3164,13 @@ int snd_pcm_area_silence(const snd_pcm_channel_area_t *dst_area, snd_pcm_uframes dst = snd_pcm_channel_area_addr(dst_area, dst_offset); width = snd_pcm_format_physical_width(format); silence = snd_pcm_format_silence_64(format); - /* - * Iterate copying silent sample for sample data aligned to 64 bit. - * This is a fast path. - */ - if (dst_area->step == (unsigned int) width && - width != 24 && - ((intptr_t)dst & 7) == 0) { + /* + * Iterate copying silent sample for sample data aligned to 64 bit. + * This is a fast path. + */ + if (dst_area->step == (unsigned int) width && + width != 24 && + ((intptr_t)dst & 7) == 0) { unsigned int dwords = samples * width / 64; uint64_t *dstp = (uint64_t *)dst; samples -= dwords * 64 / width; @@ -3487,7 +3487,7 @@ int snd_pcm_areas_copy(const snd_pcm_channel_area_t *dst_areas, snd_pcm_uframes_ d.first = dst_start->first; d.step = width; snd_pcm_area_copy(&d, dst_offset * chns, - &s, src_offset * chns, + &s, src_offset * chns, frames * chns, format); } channels -= chns; @@ -6354,10 +6354,10 @@ int snd_pcm_hw_params_get_min_align(const snd_pcm_hw_params_t *params, snd_pcm_u return err; // compute frame bits fb = snd_pcm_format_physical_width((snd_pcm_format_t)format) * channels; - min_align = 1; + min_align = 1; while (fb % 8) { fb *= 2; - min_align *= 2; + min_align *= 2; } if (val) *val = min_align; @@ -6793,7 +6793,7 @@ int snd_pcm_sw_params_get_xfer_align(const snd_pcm_sw_params_t *params, snd_pcm_ * \param val Start threshold in frames * \return 0 otherwise a negative error code * - * PCM is automatically started when playback frames available to PCM + * PCM is automatically started when playback frames available to PCM * are >= threshold or when requested capture frames are >= threshold */ #ifndef DOXYGEN @@ -6813,7 +6813,7 @@ int snd_pcm_sw_params_set_start_threshold(snd_pcm_t *pcm, snd_pcm_sw_params_t *p * \param val Returned start threshold in frames * \return 0 otherwise a negative error code * - * PCM is automatically started when playback frames available to PCM + * PCM is automatically started when playback frames available to PCM * are >= threshold or when requested capture frames are >= threshold */ #ifndef DOXYGEN @@ -6878,10 +6878,10 @@ int snd_pcm_sw_params_get_stop_threshold(const snd_pcm_sw_params_t *params, snd_ * \brief Set silence threshold inside a software configuration container * \param pcm PCM handle * \param params Software configuration container - * \param val Silence threshold in frames + * \param val Silence threshold in frames * \return 0 otherwise a negative error code * - * A portion of playback buffer is overwritten with silence (see + * A portion of playback buffer is overwritten with silence (see * #snd_pcm_sw_params_set_silence_size) when playback underrun is nearer * than silence threshold. */ @@ -6908,7 +6908,7 @@ int snd_pcm_sw_params_set_silence_threshold(snd_pcm_t *pcm, snd_pcm_sw_params_t * \param val Returned silence threshold in frames * \return 0 otherwise a negative error value * - * A portion of playback buffer is overwritten with silence (see + * A portion of playback buffer is overwritten with silence (see * #snd_pcm_sw_params_set_silence_size) when playback underrun is nearer * than silence threshold. */ @@ -6932,7 +6932,7 @@ int snd_pcm_sw_params_get_silence_threshold(const snd_pcm_sw_params_t *params, s * \return 0 otherwise a negative error code * * A portion of playback buffer is overwritten with silence when playback - * underrun is nearer than silence threshold (see + * underrun is nearer than silence threshold (see * #snd_pcm_sw_params_set_silence_threshold) * * When drain silence (see #snd_pcm_hw_params_get_drain_silence) is disabled, @@ -6968,7 +6968,7 @@ int snd_pcm_sw_params_set_silence_size(snd_pcm_t *pcm, snd_pcm_sw_params_t *para * \return 0 otherwise a negative error code * * A portion of playback buffer is overwritten with silence when playback - * underrun is nearer than silence threshold (see + * underrun is nearer than silence threshold (see * #snd_pcm_sw_params_set_silence_threshold) */ #ifndef DOXYGEN @@ -7026,7 +7026,7 @@ void snd_pcm_status_copy(snd_pcm_status_t *dst, const snd_pcm_status_t *src) *dst = *src; } -/** +/** * \brief Get state from a PCM status container (see #snd_pcm_state) * \param obj #snd_pcm_status_t pointer * \return PCM state @@ -7037,7 +7037,7 @@ snd_pcm_state_t snd_pcm_status_get_state(const snd_pcm_status_t *obj) return obj->state; } -/** +/** * \brief Get trigger timestamp from a PCM status container * \param obj #snd_pcm_status_t pointer * \param ptr Pointer to returned timestamp @@ -7053,7 +7053,7 @@ void snd_pcm_status_get_trigger_tstamp(const snd_pcm_status_t *obj, snd_timestam ptr->tv_usec = obj->trigger_tstamp.tv_nsec / 1000L; } -/** +/** * \brief Get trigger hi-res timestamp from a PCM status container * \param obj #snd_pcm_status_t pointer * \param ptr Pointer to returned timestamp @@ -7073,7 +7073,7 @@ void snd_pcm_status_get_trigger_htstamp(const snd_pcm_status_t *obj, snd_htimest } use_default_symbol_version(__snd_pcm_status_get_trigger_htstamp, snd_pcm_status_get_trigger_htstamp, ALSA_0.9.0rc8); -/** +/** * \brief Get "now" timestamp from a PCM status container * \param obj #snd_pcm_status_t pointer * \param ptr Pointer to returned timestamp @@ -7085,7 +7085,7 @@ void snd_pcm_status_get_tstamp(const snd_pcm_status_t *obj, snd_timestamp_t *ptr ptr->tv_usec = obj->tstamp.tv_nsec / 1000L; } -/** +/** * \brief Get "now" hi-res timestamp from a PCM status container * \param obj pointer to #snd_pcm_status_t * \param ptr Pointer to returned timestamp @@ -7101,7 +7101,7 @@ void snd_pcm_status_get_htstamp(const snd_pcm_status_t *obj, snd_htimestamp_t *p } use_default_symbol_version(__snd_pcm_status_get_htstamp, snd_pcm_status_get_htstamp, ALSA_0.9.0rc8); -/** +/** * \brief Get "now" hi-res audio timestamp from a PCM status container * \param obj pointer to #snd_pcm_status_t * \param ptr Pointer to returned timestamp @@ -7166,7 +7166,7 @@ snd_pcm_sframes_t snd_pcm_status_get_delay(const snd_pcm_status_t *obj) return obj->delay; } -/** +/** * \brief Get number of frames available from a PCM status container (see #snd_pcm_avail_update) * \return Number of frames ready to be read/written */ @@ -7176,7 +7176,7 @@ snd_pcm_uframes_t snd_pcm_status_get_avail(const snd_pcm_status_t *obj) return obj->avail; } -/** +/** * \brief Get maximum number of frames available from a PCM status container after last #snd_pcm_status call * \return Maximum number of frames ready to be read/written * @@ -7188,7 +7188,7 @@ snd_pcm_uframes_t snd_pcm_status_get_avail_max(const snd_pcm_status_t *obj) return obj->avail_max; } -/** +/** * \brief Get count of ADC overrange detections since last call * \return Count of ADC overrange detections */ @@ -7413,7 +7413,7 @@ void snd_pcm_info_set_stream(snd_pcm_info_t *obj, snd_pcm_stream_t val) /** * \brief Application request to access a portion of direct (mmap) area - * \param pcm PCM handle + * \param pcm PCM handle * \param areas Returned mmap channel areas * \param offset Returned mmap area offset in area steps (== frames) * \param frames mmap area portion size in frames (wanted on entry, contiguous available on exit) @@ -7516,7 +7516,7 @@ int __snd_pcm_mmap_begin(snd_pcm_t *pcm, const snd_pcm_channel_area_t **areas, if (avail < 0) error(avail); // at this point, we can transfer at least 'avail' frames - + // we want to process frames in chunks (period_size) if (avail < period_size) goto _skip; @@ -7533,7 +7533,7 @@ int __snd_pcm_mmap_begin(snd_pcm_t *pcm, const snd_pcm_channel_area_t **areas, commitres = snd_pcm_mmap_commit(pcm_handle, offset, frames); if (commitres < 0 || commitres != frames) error(commitres >= 0 ? -EPIPE : commitres); - + size -= frames; } _skip: @@ -7591,7 +7591,7 @@ int _snd_pcm_poll_descriptor(snd_pcm_t *pcm) return pcm->poll_fd; } -void snd_pcm_areas_from_buf(snd_pcm_t *pcm, snd_pcm_channel_area_t *areas, +void snd_pcm_areas_from_buf(snd_pcm_t *pcm, snd_pcm_channel_area_t *areas, void *buf) { unsigned int channel; @@ -7607,7 +7607,7 @@ void snd_pcm_areas_from_buf(snd_pcm_t *pcm, snd_pcm_channel_area_t *areas, snd_pcm_unlock(pcm); } -void snd_pcm_areas_from_bufs(snd_pcm_t *pcm, snd_pcm_channel_area_t *areas, +void snd_pcm_areas_from_bufs(snd_pcm_t *pcm, snd_pcm_channel_area_t *areas, void **bufs) { unsigned int channel; @@ -7677,7 +7677,7 @@ snd_pcm_sframes_t snd_pcm_read_areas(snd_pcm_t *pcm, const snd_pcm_channel_area_ if (err < 0) break; goto _again; - + } frames = size; if (frames > (snd_pcm_uframes_t) avail) @@ -7938,13 +7938,13 @@ int snd_pcm_slave_conf(snd_config_t *root, snd_config_t *conf, pcm_conf = NULL; err = 0; _err: - if (pcm_conf) - snd_config_delete(pcm_conf); + if (pcm_conf) + snd_config_delete(pcm_conf); if (to_free) snd_config_delete(conf); return err; } - + static void snd_pcm_set_ptr(snd_pcm_t *pcm, snd_pcm_rbptr_t *rbptr, volatile snd_pcm_uframes_t *hw_ptr, int fd, off_t offset) { @@ -7975,7 +7975,7 @@ static void snd_pcm_link_ptr(snd_pcm_t *pcm, snd_pcm_rbptr_t *pcm_rbptr, { snd_pcm_t **a; int idx; - + a = slave_rbptr->link_dst; for (idx = 0; idx < slave_rbptr->link_dst_count; idx++) if (a[idx] == NULL) { @@ -8017,7 +8017,7 @@ static void snd_pcm_unlink_ptr(snd_pcm_t *pcm, snd_pcm_rbptr_t *pcm_rbptr, return; __found: - pcm_rbptr->master = NULL; + pcm_rbptr->master = NULL; pcm_rbptr->ptr = NULL; pcm_rbptr->fd = -1; pcm_rbptr->offset = 0UL; @@ -8752,8 +8752,8 @@ _snd_pcm_parse_config_chmaps(snd_config_t *conf) /* * basic helpers */ - - + + /** * \brief Recover the stream state from an error or suspend * \param pcm PCM handle @@ -8772,39 +8772,39 @@ _snd_pcm_parse_config_chmaps(snd_config_t *conf) */ int snd_pcm_recover(snd_pcm_t *pcm, int err, int silent) { - if (err > 0) - err = -err; - if (err == -EINTR) /* nothing to do, continue */ - return 0; - if (err == -EPIPE) { - const char *s; - if (snd_pcm_stream(pcm) == SND_PCM_STREAM_PLAYBACK) - s = "underrun"; - else - s = "overrun"; - if (!silent) + if (err > 0) + err = -err; + if (err == -EINTR) /* nothing to do, continue */ + return 0; + if (err == -EPIPE) { + const char *s; + if (snd_pcm_stream(pcm) == SND_PCM_STREAM_PLAYBACK) + s = "underrun"; + else + s = "overrun"; + if (!silent) snd_error(PCM, "%s occurred", s); - err = snd_pcm_prepare(pcm); - if (err < 0) { + err = snd_pcm_prepare(pcm); + if (err < 0) { snd_error(PCM, "cannot recovery from %s, prepare failed: %s", s, snd_strerror(err)); - return err; - } - return 0; - } - if (err == -ESTRPIPE) { - while ((err = snd_pcm_resume(pcm)) == -EAGAIN) - /* wait until suspend flag is released */ - poll(NULL, 0, 1000); - if (err < 0) { - err = snd_pcm_prepare(pcm); - if (err < 0) { + return err; + } + return 0; + } + if (err == -ESTRPIPE) { + while ((err = snd_pcm_resume(pcm)) == -EAGAIN) + /* wait until suspend flag is released */ + poll(NULL, 0, 1000); + if (err < 0) { + err = snd_pcm_prepare(pcm); + if (err < 0) { snd_error(PCM, "cannot recovery from suspend, prepare failed: %s", snd_strerror(err)); - return err; - } - } - return 0; - } - return err; + return err; + } + } + return 0; + } + return err; } /** @@ -8819,12 +8819,12 @@ int snd_pcm_recover(snd_pcm_t *pcm, int err, int silent) * \return 0 on success otherwise a negative error code */ int snd_pcm_set_params(snd_pcm_t *pcm, - snd_pcm_format_t format, - snd_pcm_access_t access, - unsigned int channels, - unsigned int rate, - int soft_resample, - unsigned int latency) + snd_pcm_format_t format, + snd_pcm_access_t access, + unsigned int channels, + unsigned int rate, + int soft_resample, + unsigned int latency) { snd_pcm_hw_params_t params_saved, params = {0}; snd_pcm_sw_params_t swparams = {0}; @@ -8841,7 +8841,7 @@ int snd_pcm_set_params(snd_pcm_t *pcm, s); return err; - } + } /* set software resampling */ err = snd_pcm_hw_params_set_rate_resample(pcm, ¶ms, soft_resample); if (err < 0) { @@ -9028,8 +9028,8 @@ int snd_pcm_set_params(snd_pcm_t *pcm, * \return 0 on success otherwise a negative error code */ int snd_pcm_get_params(snd_pcm_t *pcm, - snd_pcm_uframes_t *buffer_size, - snd_pcm_uframes_t *period_size) + snd_pcm_uframes_t *buffer_size, + snd_pcm_uframes_t *period_size) { snd_pcm_hw_params_t params = {0}; int err; @@ -9037,7 +9037,7 @@ int snd_pcm_get_params(snd_pcm_t *pcm, assert(pcm); err = snd_pcm_hw_params_current(pcm, ¶ms); if (err < 0) - return err; + return err; err = INTERNAL(snd_pcm_hw_params_get_buffer_size)(¶ms, buffer_size); if (err < 0) return err; diff --git a/src/pcm/pcm_adpcm.c b/src/pcm/pcm_adpcm.c index bd6f7da3..235b3592 100644 --- a/src/pcm/pcm_adpcm.c +++ b/src/pcm/pcm_adpcm.c @@ -32,7 +32,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ - + /* These routines convert 16 bit linear PCM samples to 4 bit ADPCM code and vice versa. The ADPCM code used is the Intel/DVI ADPCM code which @@ -376,7 +376,7 @@ static int snd_pcm_adpcm_hw_refine_schange(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_ return err; return 0; } - + static int snd_pcm_adpcm_hw_refine_cchange(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_hw_params_t *params, snd_pcm_hw_params_t *sparams) { @@ -477,7 +477,7 @@ snd_pcm_adpcm_write_areas(snd_pcm_t *pcm, if (size > *slave_sizep) size = *slave_sizep; adpcm->func(slave_areas, slave_offset, - areas, offset, + areas, offset, pcm->channels, size, adpcm->getput_idx, adpcm->states); *slave_sizep = size; @@ -496,7 +496,7 @@ snd_pcm_adpcm_read_areas(snd_pcm_t *pcm, snd_pcm_adpcm_t *adpcm = pcm->private_data; if (size > *slave_sizep) size = *slave_sizep; - adpcm->func(areas, offset, + adpcm->func(areas, offset, slave_areas, slave_offset, pcm->channels, size, adpcm->getput_idx, adpcm->states); @@ -507,7 +507,7 @@ snd_pcm_adpcm_read_areas(snd_pcm_t *pcm, static void snd_pcm_adpcm_dump(snd_pcm_t *pcm, snd_output_t *out) { snd_pcm_adpcm_t *adpcm = pcm->private_data; - snd_output_printf(out, "Ima-ADPCM conversion PCM (%s)\n", + snd_output_printf(out, "Ima-ADPCM conversion PCM (%s)\n", snd_pcm_format_name(adpcm->sformat)); if (pcm->setup) { snd_output_printf(out, "Its setup is:\n"); @@ -596,15 +596,15 @@ format and rate must match for both of them. \code pcm.name { - type adpcm # Ima-ADPCM conversion PCM - slave STR # Slave name - # or - slave { # Slave definition - pcm STR # Slave PCM name - # or - pcm { } # Slave PCM definition - format STR # Slave format - } + type adpcm # Ima-ADPCM conversion PCM + slave STR # Slave name + # or + slave { # Slave definition + pcm STR # Slave PCM name + # or + pcm { } # Slave PCM definition + format STR # Slave format + } } \endcode @@ -631,7 +631,7 @@ pcm.name { * changed in future. */ int _snd_pcm_adpcm_open(snd_pcm_t **pcmp, const char *name, - snd_config_t *root, snd_config_t *conf, + snd_config_t *root, snd_config_t *conf, snd_pcm_stream_t stream, int mode) { snd_config_iterator_t i, next; @@ -663,7 +663,7 @@ int _snd_pcm_adpcm_open(snd_pcm_t **pcmp, const char *name, return err; if (snd_pcm_format_linear(sformat) != 1 && sformat != SND_PCM_FORMAT_IMA_ADPCM) { - snd_config_delete(sconf); + snd_config_delete(sconf); snd_error(PCM, "invalid slave format"); return -EINVAL; } diff --git a/src/pcm/pcm_alaw.c b/src/pcm/pcm_alaw.c index 8fb0625f..5b8fd2fb 100644 --- a/src/pcm/pcm_alaw.c +++ b/src/pcm/pcm_alaw.c @@ -25,7 +25,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ - + #include "pcm_local.h" #include "bswap.h" #include "pcm_plugin.h" @@ -232,7 +232,7 @@ static int snd_pcm_alaw_hw_refine_cprepare(snd_pcm_t *pcm, snd_pcm_hw_params_t * err = _snd_pcm_hw_param_set_mask(params, SND_PCM_HW_PARAM_FORMAT, &format_mask); } else { - err = _snd_pcm_hw_params_set_format(params, + err = _snd_pcm_hw_params_set_format(params, SND_PCM_FORMAT_A_LAW); } if (err < 0) @@ -273,7 +273,7 @@ static int snd_pcm_alaw_hw_refine_schange(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_p return err; return 0; } - + static int snd_pcm_alaw_hw_refine_cchange(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_hw_params_t *params, snd_pcm_hw_params_t *sparams) { @@ -317,7 +317,7 @@ static int snd_pcm_alaw_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t * params) err = INTERNAL(snd_pcm_hw_params_get_format)(params, &format); if (err < 0) return err; - + if (pcm->stream == SND_PCM_STREAM_PLAYBACK) { if (alaw->sformat == SND_PCM_FORMAT_A_LAW) { alaw->getput_idx = snd_pcm_linear_get_index(format, SND_PCM_FORMAT_S16); @@ -351,7 +351,7 @@ snd_pcm_alaw_write_areas(snd_pcm_t *pcm, if (size > *slave_sizep) size = *slave_sizep; alaw->func(slave_areas, slave_offset, - areas, offset, + areas, offset, pcm->channels, size, alaw->getput_idx); *slave_sizep = size; @@ -370,7 +370,7 @@ snd_pcm_alaw_read_areas(snd_pcm_t *pcm, snd_pcm_alaw_t *alaw = pcm->private_data; if (size > *slave_sizep) size = *slave_sizep; - alaw->func(areas, offset, + alaw->func(areas, offset, slave_areas, slave_offset, pcm->channels, size, alaw->getput_idx); @@ -381,7 +381,7 @@ snd_pcm_alaw_read_areas(snd_pcm_t *pcm, static void snd_pcm_alaw_dump(snd_pcm_t *pcm, snd_output_t *out) { snd_pcm_alaw_t *alaw = pcm->private_data; - snd_output_printf(out, "A-Law conversion PCM (%s)\n", + snd_output_printf(out, "A-Law conversion PCM (%s)\n", snd_pcm_format_name(alaw->sformat)); if (pcm->setup) { snd_output_printf(out, "Its setup is:\n"); @@ -420,7 +420,7 @@ static const snd_pcm_ops_t snd_pcm_alaw_ops = { * \warning Using of this function might be dangerous in the sense * of compatibility reasons. The prototype might be freely * changed in future. - */ + */ int snd_pcm_alaw_open(snd_pcm_t **pcmp, const char *name, snd_pcm_format_t sformat, snd_pcm_t *slave, int close_slave) { snd_pcm_t *pcm; @@ -471,15 +471,15 @@ format and rate must match for both of them. \code pcm.name { - type alaw # A-Law conversion PCM - slave STR # Slave name - # or - slave { # Slave definition - pcm STR # Slave PCM name - # or - pcm { } # Slave PCM definition - format STR # Slave format - } + type alaw # A-Law conversion PCM + slave STR # Slave name + # or + slave { # Slave definition + pcm STR # Slave PCM name + # or + pcm { } # Slave PCM definition + format STR # Slave format + } } \endcode @@ -506,7 +506,7 @@ pcm.name { * changed in future. */ int _snd_pcm_alaw_open(snd_pcm_t **pcmp, const char *name, - snd_config_t *root, snd_config_t *conf, + snd_config_t *root, snd_config_t *conf, snd_pcm_stream_t stream, int mode) { snd_config_iterator_t i, next; @@ -538,7 +538,7 @@ int _snd_pcm_alaw_open(snd_pcm_t **pcmp, const char *name, return err; if (snd_pcm_format_linear(sformat) != 1 && sformat != SND_PCM_FORMAT_A_LAW) { - snd_config_delete(sconf); + snd_config_delete(sconf); snd_error(PCM, "invalid slave format"); return -EINVAL; } diff --git a/src/pcm/pcm_asym.c b/src/pcm/pcm_asym.c index e8004707..baca92f5 100644 --- a/src/pcm/pcm_asym.c +++ b/src/pcm/pcm_asym.c @@ -22,21 +22,21 @@ Slave PCMs can be defined asymmetrically for both directions. \code pcm.name { - type asym # Asym PCM - playback STR # Playback slave name - # or - playback { # Playback slave definition - pcm STR # Slave PCM name - # or - pcm { } # Slave PCM definition - } - capture STR # Capture slave name - # or - capture { # Capture slave definition - pcm STR # Slave PCM name - # or - pcm { } # Slave PCM definition - } + type asym # Asym PCM + playback STR # Playback slave name + # or + playback { # Playback slave definition + pcm STR # Slave PCM name + # or + pcm { } # Slave PCM definition + } + capture STR # Capture slave name + # or + capture { # Capture slave definition + pcm STR # Slave PCM name + # or + pcm { } # Slave PCM definition + } } \endcode diff --git a/src/pcm/pcm_copy.c b/src/pcm/pcm_copy.c index c20a18bd..a078578e 100644 --- a/src/pcm/pcm_copy.c +++ b/src/pcm/pcm_copy.c @@ -25,7 +25,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ - + #include "pcm_local.h" #include "pcm_plugin.h" #include "bswap.h" @@ -73,7 +73,7 @@ static int snd_pcm_copy_hw_refine_schange(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_p return err; return 0; } - + static int snd_pcm_copy_hw_refine_cchange(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_hw_params_t *params, snd_pcm_hw_params_t *sparams) { @@ -133,7 +133,7 @@ snd_pcm_copy_read_areas(snd_pcm_t *pcm, { if (size > *slave_sizep) size = *slave_sizep; - snd_pcm_areas_copy(areas, offset, + snd_pcm_areas_copy(areas, offset, slave_areas, slave_offset, pcm->channels, size, pcm->format); *slave_sizep = size; @@ -222,7 +222,7 @@ int snd_pcm_copy_open(snd_pcm_t **pcmp, const char *name, snd_pcm_t *slave, int \section pcm_plugins_copy Plugin: copy This plugin copies samples from master copy PCM to given slave PCM. -The channel count, format and rate must match for both of them. +The channel count, format and rate must match for both of them. \code pcm.name { @@ -260,7 +260,7 @@ pcm.name { * changed in future. */ int _snd_pcm_copy_open(snd_pcm_t **pcmp, const char *name, - snd_config_t *root, snd_config_t *conf, + snd_config_t *root, snd_config_t *conf, snd_pcm_stream_t stream, int mode) { snd_config_iterator_t i, next; diff --git a/src/pcm/pcm_direct.c b/src/pcm/pcm_direct.c index 74455985..304c1883 100644 --- a/src/pcm/pcm_direct.c +++ b/src/pcm/pcm_direct.c @@ -18,7 +18,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ - + #include "pcm_local.h" #include #include @@ -44,7 +44,7 @@ /* * */ - + #if !defined(__OpenBSD__) && !defined(__DragonFly__) && !defined(__ANDROID__) union semun { int val; /* Value for SETVAL */ @@ -55,7 +55,7 @@ union semun { #endif }; #endif - + /* * FIXME: * add possibility to use futexes here @@ -96,14 +96,14 @@ static unsigned int snd_pcm_direct_magic(snd_pcm_direct_t *dmix) } /* - * global shared memory area + * global shared memory area */ int snd_pcm_direct_shm_create_or_connect(snd_pcm_direct_t *dmix) { struct shmid_ds buf; int tmpid, err, first_instance = 0; - + retryget: dmix->shmid = shmget(dmix->ipc_key, sizeof(snd_pcm_direct_share_t), dmix->ipc_perm); @@ -120,7 +120,7 @@ retryget: if ((tmpid = shmget(dmix->ipc_key, 0, dmix->ipc_perm)) != -1) if (!shmctl(tmpid, IPC_STAT, &buf)) if (!buf.shm_nattch) - /* no users so destroy the segment */ + /* no users so destroy the segment */ if (!shmctl(tmpid, IPC_RMID, NULL)) goto retryget; return err; @@ -221,7 +221,7 @@ static int make_local_socket(const char *filename, int server, mode_t ipc_perm, memset(addr, 0, size); /* make valgrind happy */ addr->sun_family = AF_LOCAL; memcpy(addr->sun_path, filename, l); - + if (server) { if (bind(sock, (struct sockaddr *) addr, size) < 0) { int result = -errno; @@ -309,7 +309,7 @@ static int _snd_send_fd(int sock, void *data, size_t len, int fd) msghdr.msg_name = NULL; msghdr.msg_namelen = 0; msghdr.msg_iov = &vec; - msghdr.msg_iovlen = 1; + msghdr.msg_iovlen = 1; msghdr.msg_control = cmsg; msghdr.msg_controllen = cmsg_len; msghdr.msg_flags = 0; @@ -342,7 +342,7 @@ static void server_job(snd_pcm_direct_t *dmix) if (i != dmix->server_fd && i != dmix->hw_fd) close(i); } - + /* detach from parent */ setsid(); @@ -431,7 +431,7 @@ int snd_pcm_direct_server_create(snd_pcm_direct_t *dmix) ret = get_tmp_name(dmix->shmptr->socket_name, sizeof(dmix->shmptr->socket_name)); if (ret < 0) return ret; - + ret = make_local_socket(dmix->shmptr->socket_name, 1, dmix->ipc_perm, dmix->ipc_gid); if (ret < 0) return ret; @@ -442,7 +442,7 @@ int snd_pcm_direct_server_create(snd_pcm_direct_t *dmix) close(dmix->server_fd); return ret; } - + ret = fork(); if (ret < 0) { close(dmix->server_fd); @@ -894,7 +894,7 @@ static int snd_interval_step(struct snd_interval *i, unsigned int min, int snd_pcm_direct_hw_refine(snd_pcm_t *pcm, snd_pcm_hw_params_t *params) { snd_pcm_direct_t *dshare = pcm->private_data; - static const snd_mask_t access = { .bits = { + static const snd_mask_t access = { .bits = { (1<periods > 0) { unsigned int periods = params->periods; ret = INTERNAL(snd_pcm_hw_params_set_periods_near)(spcm, @@ -1329,7 +1329,7 @@ int snd_pcm_direct_initialize_slave(snd_pcm_direct_t *dmix, snd_pcm_t *spcm, str return ret; } } - + ret = snd_pcm_hw_params(spcm, &hw_params); if (ret < 0) { snd_error(PCM, "unable to install hw params"); @@ -1420,7 +1420,7 @@ int snd_pcm_direct_initialize_slave(snd_pcm_direct_t *dmix, snd_pcm_t *spcm, str snd_pcm_areas_silence(dst_areas, 0, spcm->channels, spcm->buffer_size, spcm->format); } - + ret = snd_pcm_start(spcm); if (ret < 0) { snd_error(PCM, "unable to start PCM stream"); @@ -1433,7 +1433,7 @@ int snd_pcm_direct_initialize_slave(snd_pcm_direct_t *dmix, snd_pcm_t *spcm, str } snd_pcm_poll_descriptors(spcm, &fd, 1); dmix->hw_fd = fd.fd; - + save_slave_setting(dmix, spcm); /* Currently, we assume that each dmix client has the same @@ -1601,7 +1601,7 @@ int snd_pcm_direct_open_secondary_client(snd_pcm_t **spcmp, snd_pcm_direct_t *dm snd_error(PCM, "unable to open hardware"); return ret; } - + spcm = *spcmp; spcm->donot_close = 1; spcm->setup = 1; diff --git a/src/pcm/pcm_direct.h b/src/pcm/pcm_direct.h index 2a398045..9a8c5527 100644 --- a/src/pcm/pcm_direct.h +++ b/src/pcm/pcm_direct.h @@ -19,7 +19,7 @@ * */ -#include "pcm_local.h" +#include "pcm_local.h" #include "../timer/timer_local.h" #define DIRECT_IPC_SEMS 1 @@ -103,8 +103,8 @@ typedef struct { unsigned int period_step; unsigned int sleep_min; /* not used */ unsigned int avail_min; - unsigned int start_threshold; - unsigned int stop_threshold; + unsigned int start_threshold; + unsigned int stop_threshold; unsigned int silence_threshold; unsigned int silence_size; unsigned int recoveries; /* no of executed recoveries on slave*/ diff --git a/src/pcm/pcm_dmix.c b/src/pcm/pcm_dmix.c index e1e94c0e..22fcf3e5 100644 --- a/src/pcm/pcm_dmix.c +++ b/src/pcm/pcm_dmix.c @@ -25,7 +25,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ - + #include "pcm_local.h" #include #include @@ -63,7 +63,7 @@ const char *_snd_module_pcm_dmix = ""; static int shm_sum_discard(snd_pcm_direct_t *dmix); /* - * sum ring buffer shared memory area + * sum ring buffer shared memory area */ static int shm_sum_create_or_connect(snd_pcm_direct_t *dmix) { @@ -73,7 +73,7 @@ static int shm_sum_create_or_connect(snd_pcm_direct_t *dmix) size = dmix->shmptr->s.channels * dmix->shmptr->s.buffer_size * - sizeof(signed int); + sizeof(signed int); retryshm: dmix->u.dmix.shmid_sum = shmget(dmix->ipc_key + 1, size, IPC_CREAT | dmix->ipc_perm); @@ -82,7 +82,7 @@ retryshm: if (errno == EINVAL) if ((tmpid = shmget(dmix->ipc_key + 1, 0, dmix->ipc_perm)) != -1) if (!shmctl(tmpid, IPC_STAT, &buf)) - if (!buf.shm_nattch) + if (!buf.shm_nattch) /* no users so destroy the segment */ if (!shmctl(tmpid, IPC_RMID, NULL)) goto retryshm; @@ -95,7 +95,7 @@ retryshm: } if (dmix->ipc_gid >= 0) { buf.shm_perm.gid = dmix->ipc_gid; - shmctl(dmix->u.dmix.shmid_sum, IPC_SET, &buf); + shmctl(dmix->u.dmix.shmid_sum, IPC_SET, &buf); } dmix->u.dmix.sum_buffer = shmat(dmix->u.dmix.shmid_sum, 0, 0); if (dmix->u.dmix.sum_buffer == (void *) -1) { @@ -162,7 +162,7 @@ static void mix_areas(snd_pcm_direct_t *dmix, unsigned int src_step, dst_step; unsigned int chn, dchn, channels, sample_size; mix_areas_t *do_mix_areas; - + channels = dmix->channels; switch (dmix->shmptr->s.format) { case SND_PCM_FORMAT_S16_LE: @@ -230,7 +230,7 @@ static void remix_areas(snd_pcm_direct_t *dmix, unsigned int src_step, dst_step; unsigned int chn, dchn, channels, sample_size; mix_areas_t *do_remix_areas; - + channels = dmix->channels; switch (dmix->shmptr->s.format) { case SND_PCM_FORMAT_S16_LE: @@ -315,7 +315,7 @@ static void snd_pcm_dmix_sync_area(snd_pcm_t *pcm) snd_pcm_uframes_t slave_hw_ptr, slave_appl_ptr, slave_size; snd_pcm_uframes_t appl_ptr, size, transfer; const snd_pcm_channel_area_t *src_areas, *dst_areas; - + /* calculate the size to transfer */ /* check the available size in the local buffer * last_appl_ptr keeps the last updated position @@ -391,7 +391,7 @@ static int snd_pcm_dmix_sync_ptr0(snd_pcm_t *pcm, snd_pcm_uframes_t slave_hw_ptr snd_pcm_direct_t *dmix = pcm->private_data; snd_pcm_uframes_t old_slave_hw_ptr, avail; snd_pcm_sframes_t diff; - + old_slave_hw_ptr = dmix->slave_hw_ptr; dmix->slave_hw_ptr = slave_hw_ptr; diff = pcm_frame_diff(slave_hw_ptr, old_slave_hw_ptr, dmix->slave_boundary); @@ -483,7 +483,7 @@ static int snd_pcm_dmix_delay(snd_pcm_t *pcm, snd_pcm_sframes_t *delayp) { snd_pcm_direct_t *dmix = pcm->private_data; int err; - + switch(dmix->state) { case SNDRV_PCM_STATE_DRAINING: case SNDRV_PCM_STATE_RUNNING: @@ -554,7 +554,7 @@ static int snd_pcm_dmix_start(snd_pcm_t *pcm) snd_pcm_direct_t *dmix = pcm->private_data; snd_pcm_sframes_t avail; int err; - + if (dmix->state != SND_PCM_STATE_PREPARED) return -EBADFD; avail = snd_pcm_mmap_playback_hw_avail(pcm); @@ -784,11 +784,11 @@ static int snd_pcm_dmix_close(snd_pcm_t *pcm) snd_timer_close(dmix->timer); snd_pcm_direct_semaphore_down(dmix, DIRECT_IPC_SEM_CLIENT); snd_pcm_close(dmix->spcm); - if (dmix->server) - snd_pcm_direct_server_discard(dmix); - if (dmix->client) - snd_pcm_direct_client_discard(dmix); - shm_sum_discard(dmix); + if (dmix->server) + snd_pcm_direct_server_discard(dmix); + if (dmix->client) + snd_pcm_direct_client_discard(dmix); + shm_sum_discard(dmix); if (snd_pcm_direct_shm_discard(dmix)) { if (snd_pcm_direct_semaphore_discard(dmix)) snd_pcm_direct_semaphore_final(dmix, DIRECT_IPC_SEM_CLIENT); @@ -837,7 +837,7 @@ static snd_pcm_sframes_t snd_pcm_dmix_avail_update(snd_pcm_t *pcm) { snd_pcm_direct_t *dmix = pcm->private_data; int err; - + if (dmix->state == SND_PCM_STATE_RUNNING || dmix->state == SND_PCM_STATE_DRAINING) { if ((err = snd_pcm_dmix_sync_ptr(pcm)) < 0) @@ -856,7 +856,7 @@ static int snd_pcm_dmix_htimestamp(snd_pcm_t *pcm, snd_pcm_direct_t *dmix = pcm->private_data; snd_pcm_uframes_t avail1; int ok = 0; - + while (1) { if (dmix->state == SND_PCM_STATE_RUNNING || dmix->state == SND_PCM_STATE_DRAINING) @@ -1000,13 +1000,13 @@ int snd_pcm_dmix_open(snd_pcm_t **pcmp, const char *name, snd_error(PCM, "unable to open slave"); goto _err; } - + if (snd_pcm_type(spcm) != SND_PCM_TYPE_HW) { snd_error(PCM, "dmix plugin can be only connected to hw plugin"); ret = -EINVAL; goto _err; } - + ret = snd_pcm_direct_initialize_slave(dmix, spcm, params); if (ret < 0) { snd_error(PCM, "unable to initialize slave"); @@ -1017,7 +1017,7 @@ int snd_pcm_dmix_open(snd_pcm_t **pcmp, const char *name, if (dmix->shmptr->use_server) { dmix->server_free = dmix_server_free; - + ret = snd_pcm_direct_server_create(dmix); if (ret < 0) { snd_error(PCM, "unable to create server"); @@ -1035,7 +1035,7 @@ int snd_pcm_dmix_open(snd_pcm_t **pcmp, const char *name, snd_error(PCM, "unable to connect client"); goto _err_nosem; } - + snd_pcm_direct_semaphore_down(dmix, DIRECT_IPC_SEM_CLIENT); ret = snd_pcm_direct_open_secondary_client(&spcm, dmix, "dmix_client"); if (ret < 0) @@ -1062,7 +1062,7 @@ int snd_pcm_dmix_open(snd_pcm_t **pcmp, const char *name, ret = -EINVAL; goto _err; } - + ret = snd_pcm_direct_initialize_secondary_slave(dmix, spcm, params); if (ret < 0) { snd_error(PCM, "unable to initialize slave"); @@ -1086,14 +1086,14 @@ int snd_pcm_dmix_open(snd_pcm_t **pcmp, const char *name, } mix_select_callbacks(dmix); - + pcm->poll_fd = dmix->poll_fd; pcm->poll_events = POLLIN; /* it's different than other plugins */ pcm->tstamp_type = spcm->tstamp_type; pcm->mmap_rw = 1; snd_pcm_set_hw_ptr(pcm, &dmix->hw_ptr, -1, 0); snd_pcm_set_appl_ptr(pcm, &dmix->appl_ptr, -1, 0); - + if (dmix->channels == UINT_MAX) dmix->channels = dmix->shmptr->s.channels; @@ -1101,7 +1101,7 @@ int snd_pcm_dmix_open(snd_pcm_t **pcmp, const char *name, *pcmp = pcm; return 0; - + _err: if (dmix->timer) snd_timer_close(dmix->timer); @@ -1317,7 +1317,7 @@ int _snd_pcm_dmix_open(snd_pcm_t **pcmp, const char *name, if (err < 0) return err; - /* set a reasonable default */ + /* set a reasonable default */ if (psize == -1 && params.period_time == -1) params.period_time = 125000; /* 0.125 seconds */ diff --git a/src/pcm/pcm_dmix_generic.c b/src/pcm/pcm_dmix_generic.c index 701c66c9..7d0b00af 100644 --- a/src/pcm/pcm_dmix_generic.c +++ b/src/pcm/pcm_dmix_generic.c @@ -289,12 +289,12 @@ static void generic_mix_areas_16_swap(unsigned int size, } static void generic_remix_areas_16_swap(unsigned int size, - volatile signed short *dst, - signed short *src, - volatile signed int *sum, - size_t dst_step, - size_t src_step, - size_t sum_step) + volatile signed short *dst, + signed short *src, + volatile signed int *sum, + size_t dst_step, + size_t src_step, + size_t sum_step) { register signed int sample; @@ -354,12 +354,12 @@ static void generic_mix_areas_32_swap(unsigned int size, } static void generic_remix_areas_32_swap(unsigned int size, - volatile signed int *dst, - signed int *src, - volatile signed int *sum, - size_t dst_step, - size_t src_step, - size_t sum_step) + volatile signed int *dst, + signed int *src, + volatile signed int *sum, + size_t dst_step, + size_t src_step, + size_t sum_step) { register signed int sample; diff --git a/src/pcm/pcm_dmix_i386.c b/src/pcm/pcm_dmix_i386.c index ea55d8ec..6413cb19 100644 --- a/src/pcm/pcm_dmix_i386.c +++ b/src/pcm/pcm_dmix_i386.c @@ -55,7 +55,7 @@ #undef LOCK_PREFIX #undef XADD #undef XSUB - + #define MIX_AREAS_16 remix_areas_16_smp #define MIX_AREAS_16_MMX remix_areas_16_smp_mmx #define MIX_AREAS_32 remix_areas_32_smp @@ -73,7 +73,7 @@ #undef LOCK_PREFIX #undef XADD #undef XSUB - + #define i386_dmix_supported_format \ ((1ULL << SND_PCM_FORMAT_S16_LE) |\ (1ULL << SND_PCM_FORMAT_S32_LE) |\ @@ -100,7 +100,7 @@ static void mix_select_callbacks(snd_pcm_direct_t *dmix) if (!smp) { FILE *in; char line[255]; - + /* try to determine the capabilities of the CPU */ in = fopen("/proc/cpuinfo", "r"); if (in) { @@ -117,7 +117,7 @@ static void mix_select_callbacks(snd_pcm_direct_t *dmix) fclose(in); } } - + if (mmx) { dmix->u.dmix.mix_areas_16 = smp > 1 ? mix_areas_16_smp_mmx : mix_areas_16_mmx; dmix->u.dmix.remix_areas_16 = smp > 1 ? remix_areas_16_smp_mmx : remix_areas_16_mmx; diff --git a/src/pcm/pcm_dmix_i386.h b/src/pcm/pcm_dmix_i386.h index 8dcba3d8..0a56e8c6 100644 --- a/src/pcm/pcm_dmix_i386.h +++ b/src/pcm/pcm_dmix_i386.h @@ -244,7 +244,7 @@ static void MIX_AREAS_16_MMX(unsigned int size, "\tdecl %[size]\n" "\tjnz 1b\n" "\temms\n" - "5:" + "5:" #ifdef BOUNDED_EBX "\tmovl %[old_ebx], %%ebx\n" /* ebx is GOT pointer (-fPIC) */ #endif diff --git a/src/pcm/pcm_dmix_x86_64.c b/src/pcm/pcm_dmix_x86_64.c index 1c80e181..84eb68f1 100644 --- a/src/pcm/pcm_dmix_x86_64.c +++ b/src/pcm/pcm_dmix_x86_64.c @@ -43,7 +43,7 @@ #undef LOCK_PREFIX #undef XADD #undef XSUB - + #define MIX_AREAS_16 remix_areas_16_smp #define MIX_AREAS_32 remix_areas_32_smp #define MIX_AREAS_24 remix_areas_24_smp @@ -57,7 +57,7 @@ #undef LOCK_PREFIX #undef XADD #undef XSUB - + #define x86_64_dmix_supported_format \ ((1ULL << SND_PCM_FORMAT_S16_LE) |\ (1ULL << SND_PCM_FORMAT_S32_LE) |\ @@ -69,7 +69,7 @@ static void mix_select_callbacks(snd_pcm_direct_t *dmix) { static int smp = 0; - + if (!dmix->direct_memory_access) { generic_mix_select_callbacks(dmix); return; diff --git a/src/pcm/pcm_dmix_x86_64.h b/src/pcm/pcm_dmix_x86_64.h index 1932be3e..8b62a45d 100644 --- a/src/pcm/pcm_dmix_x86_64.h +++ b/src/pcm/pcm_dmix_x86_64.h @@ -137,7 +137,7 @@ static void MIX_AREAS_16(unsigned int size, #ifdef BOUNDED_RBX , [old_rbx] "=m" (old_rbx) #endif - : [dst] "m" (dst), [src] "m" (src), [sum] "m" (sum), + : [dst] "m" (dst), [src] "m" (src), [sum] "m" (sum), [dst_step] "im" (dst_step), [src_step] "im" (src_step), [sum_step] "im" (sum_step) : "rsi", "rdi", "edx", "ecx", "eax", "memory", "cc" @@ -279,7 +279,7 @@ static void MIX_AREAS_32(unsigned int size, #ifdef BOUNDED_RBX , [old_rbx] "=m" (old_rbx) #endif - : [dst] "m" (dst), [src] "m" (src), [sum] "m" (sum), + : [dst] "m" (dst), [src] "m" (src), [sum] "m" (sum), [dst_step] "im" (dst_step), [src_step] "im" (src_step), [sum_step] "im" (sum_step) : "rsi", "rdi", "edx", "ecx", "eax", "memory", "cc" @@ -403,7 +403,7 @@ static void MIX_AREAS_24(unsigned int size, #ifdef BOUNDED_RBX , [old_rbx] "=m" (old_rbx) #endif - : [dst] "m" (dst), [src] "m" (src), [sum] "m" (sum), + : [dst] "m" (dst), [src] "m" (src), [sum] "m" (sum), [dst_step] "im" (dst_step), [src_step] "im" (src_step), [sum_step] "im" (sum_step) : "rsi", "rdi", "edx", "ecx", "eax", "memory", "cc" diff --git a/src/pcm/pcm_dshare.c b/src/pcm/pcm_dshare.c index 3cb66de8..65da72a9 100644 --- a/src/pcm/pcm_dshare.c +++ b/src/pcm/pcm_dshare.c @@ -25,7 +25,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ - + #include "pcm_local.h" #include #include @@ -111,7 +111,7 @@ static void snd_pcm_dshare_sync_area(snd_pcm_t *pcm) snd_pcm_uframes_t slave_hw_ptr, slave_appl_ptr, slave_size; snd_pcm_uframes_t appl_ptr, size; const snd_pcm_channel_area_t *src_areas, *dst_areas; - + /* calculate the size to transfer */ size = pcm_frame_diff(dshare->appl_ptr, dshare->last_appl_ptr, pcm->boundary); if (! size) @@ -259,7 +259,7 @@ static int snd_pcm_dshare_delay(snd_pcm_t *pcm, snd_pcm_sframes_t *delayp) { snd_pcm_direct_t *dshare = pcm->private_data; int err; - + switch (dshare->state) { case SNDRV_PCM_STATE_DRAINING: case SNDRV_PCM_STATE_RUNNING: @@ -328,7 +328,7 @@ static int snd_pcm_dshare_start(snd_pcm_t *pcm) snd_pcm_direct_t *dshare = pcm->private_data; snd_pcm_sframes_t avail; int err; - + if (dshare->state != SND_PCM_STATE_PREPARED) return -EBADFD; avail = snd_pcm_mmap_playback_hw_avail(pcm); @@ -484,10 +484,10 @@ static int snd_pcm_dshare_close(snd_pcm_t *pcm) snd_pcm_direct_semaphore_down(dshare, DIRECT_IPC_SEM_CLIENT); dshare->shmptr->u.dshare.chn_mask &= ~dshare->u.dshare.chn_mask; snd_pcm_close(dshare->spcm); - if (dshare->server) - snd_pcm_direct_server_discard(dshare); - if (dshare->client) - snd_pcm_direct_client_discard(dshare); + if (dshare->server) + snd_pcm_direct_server_discard(dshare); + if (dshare->client) + snd_pcm_direct_client_discard(dshare); if (snd_pcm_direct_shm_discard(dshare)) { if (snd_pcm_direct_semaphore_discard(dshare)) snd_pcm_direct_semaphore_final(dshare, DIRECT_IPC_SEM_CLIENT); @@ -537,7 +537,7 @@ static snd_pcm_sframes_t snd_pcm_dshare_avail_update(snd_pcm_t *pcm) { snd_pcm_direct_t *dshare = pcm->private_data; int err; - + if (dshare->state == SND_PCM_STATE_RUNNING || dshare->state == SND_PCM_STATE_DRAINING) { if ((err = snd_pcm_dshare_sync_ptr(pcm)) < 0) @@ -556,7 +556,7 @@ static int snd_pcm_dshare_htimestamp(snd_pcm_t *pcm, snd_pcm_direct_t *dshare = pcm->private_data; snd_pcm_uframes_t avail1; int ok = 0; - + while (1) { if (dshare->state == SND_PCM_STATE_RUNNING || dshare->state == SND_PCM_STATE_DRAINING) @@ -701,12 +701,12 @@ int snd_pcm_dshare_open(snd_pcm_t **pcmp, const char *name, snd_error(PCM, "unable to open slave"); goto _err; } - + if (snd_pcm_type(spcm) != SND_PCM_TYPE_HW) { snd_error(PCM, "dshare plugin can be only connected to hw plugin"); goto _err; } - + ret = snd_pcm_direct_initialize_slave(dshare, spcm, params); if (ret < 0) { snd_error(PCM, "unable to initialize slave"); @@ -714,7 +714,7 @@ int snd_pcm_dshare_open(snd_pcm_t **pcmp, const char *name, } dshare->spcm = spcm; - + if (dshare->shmptr->use_server) { ret = snd_pcm_direct_server_create(dshare); if (ret < 0) { @@ -733,7 +733,7 @@ int snd_pcm_dshare_open(snd_pcm_t **pcmp, const char *name, snd_error(PCM, "unable to connect client"); goto _err_nosem; } - + snd_pcm_direct_semaphore_down(dshare, DIRECT_IPC_SEM_CLIENT); ret = snd_pcm_direct_open_secondary_client(&spcm, dshare, "dshare_client"); if (ret < 0) @@ -761,7 +761,7 @@ int snd_pcm_dshare_open(snd_pcm_t **pcmp, const char *name, ret = -EINVAL; goto _err; } - + ret = snd_pcm_direct_initialize_secondary_slave(dshare, spcm, params); if (ret < 0) { snd_error(PCM, "unable to initialize slave"); @@ -784,7 +784,7 @@ int snd_pcm_dshare_open(snd_pcm_t **pcmp, const char *name, goto _err; } dshare->shmptr->u.dshare.chn_mask |= dshare->u.dshare.chn_mask; - + ret = snd_pcm_direct_initialize_poll_fd(dshare); if (ret < 0) { snd_error(PCM, "unable to initialize poll_fd"); @@ -797,12 +797,12 @@ int snd_pcm_dshare_open(snd_pcm_t **pcmp, const char *name, pcm->mmap_rw = 1; snd_pcm_set_hw_ptr(pcm, &dshare->hw_ptr, -1, 0); snd_pcm_set_appl_ptr(pcm, &dshare->appl_ptr, -1, 0); - + snd_pcm_direct_semaphore_up(dshare, DIRECT_IPC_SEM_CLIENT); *pcmp = pcm; return 0; - + _err: if (dshare->shmptr != (void *) -1) dshare->shmptr->u.dshare.chn_mask &= ~dshare->u.dshare.chn_mask; diff --git a/src/pcm/pcm_dsnoop.c b/src/pcm/pcm_dsnoop.c index 684ed63f..8c3b53ae 100644 --- a/src/pcm/pcm_dsnoop.c +++ b/src/pcm/pcm_dsnoop.c @@ -25,7 +25,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ - + #include "pcm_local.h" #include #include @@ -106,7 +106,7 @@ static void snd_pcm_dsnoop_sync_area(snd_pcm_t *pcm, snd_pcm_uframes_t slave_hw_ snd_pcm_uframes_t hw_ptr = dsnoop->hw_ptr; snd_pcm_uframes_t transfer; const snd_pcm_channel_area_t *src_areas, *dst_areas; - + /* add sample areas here */ dst_areas = snd_pcm_mmap_areas(pcm); src_areas = snd_pcm_mmap_areas(dsnoop->spcm); @@ -119,7 +119,7 @@ static void snd_pcm_dsnoop_sync_area(snd_pcm_t *pcm, snd_pcm_uframes_t slave_hw_ size -= transfer; snoop_areas(dsnoop, src_areas, dst_areas, slave_hw_ptr, hw_ptr, transfer); slave_hw_ptr += transfer; - slave_hw_ptr %= dsnoop->slave_buffer_size; + slave_hw_ptr %= dsnoop->slave_buffer_size; hw_ptr += transfer; hw_ptr %= pcm->buffer_size; } @@ -206,7 +206,7 @@ static int snd_pcm_dsnoop_delay(snd_pcm_t *pcm, snd_pcm_sframes_t *delayp) { snd_pcm_direct_t *dsnoop = pcm->private_data; int err; - + switch(dsnoop->state) { case SNDRV_PCM_STATE_DRAINING: case SNDRV_PCM_STATE_RUNNING: @@ -373,10 +373,10 @@ static int snd_pcm_dsnoop_close(snd_pcm_t *pcm) snd_timer_close(dsnoop->timer); snd_pcm_direct_semaphore_down(dsnoop, DIRECT_IPC_SEM_CLIENT); snd_pcm_close(dsnoop->spcm); - if (dsnoop->server) - snd_pcm_direct_server_discard(dsnoop); - if (dsnoop->client) - snd_pcm_direct_client_discard(dsnoop); + if (dsnoop->server) + snd_pcm_direct_server_discard(dsnoop); + if (dsnoop->client) + snd_pcm_direct_client_discard(dsnoop); if (snd_pcm_direct_shm_discard(dsnoop)) { if (snd_pcm_direct_semaphore_discard(dsnoop)) snd_pcm_direct_semaphore_final(dsnoop, DIRECT_IPC_SEM_CLIENT); @@ -414,7 +414,7 @@ static snd_pcm_sframes_t snd_pcm_dsnoop_avail_update(snd_pcm_t *pcm) { snd_pcm_direct_t *dsnoop = pcm->private_data; int err; - + if (dsnoop->state == SND_PCM_STATE_RUNNING) { err = snd_pcm_dsnoop_sync_ptr(pcm); if (err < 0) @@ -433,7 +433,7 @@ static int snd_pcm_dsnoop_htimestamp(snd_pcm_t *pcm, snd_pcm_direct_t *dsnoop = pcm->private_data; snd_pcm_uframes_t avail1; int ok = 0; - + while (1) { if (dsnoop->state == SND_PCM_STATE_RUNNING || dsnoop->state == SND_PCM_STATE_DRAINING) @@ -567,12 +567,12 @@ int snd_pcm_dsnoop_open(snd_pcm_t **pcmp, const char *name, snd_error(PCM, "unable to open slave"); goto _err; } - + if (snd_pcm_type(spcm) != SND_PCM_TYPE_HW) { snd_error(PCM, "dsnoop plugin can be only connected to hw plugin"); goto _err; } - + ret = snd_pcm_direct_initialize_slave(dsnoop, spcm, params); if (ret < 0) { snd_error(PCM, "unable to initialize slave"); @@ -580,7 +580,7 @@ int snd_pcm_dsnoop_open(snd_pcm_t **pcmp, const char *name, } dsnoop->spcm = spcm; - + if (dsnoop->shmptr->use_server) { ret = snd_pcm_direct_server_create(dsnoop); if (ret < 0) { @@ -599,7 +599,7 @@ int snd_pcm_dsnoop_open(snd_pcm_t **pcmp, const char *name, snd_error(PCM, "unable to connect client"); goto _err_nosem; } - + snd_pcm_direct_semaphore_down(dsnoop, DIRECT_IPC_SEM_CLIENT); ret = snd_pcm_direct_open_secondary_client(&spcm, dsnoop, "dsnoop_client"); @@ -627,7 +627,7 @@ int snd_pcm_dsnoop_open(snd_pcm_t **pcmp, const char *name, ret = -EINVAL; goto _err; } - + ret = snd_pcm_direct_initialize_secondary_slave(dsnoop, spcm, params); if (ret < 0) { snd_error(PCM, "unable to initialize slave"); @@ -650,17 +650,17 @@ int snd_pcm_dsnoop_open(snd_pcm_t **pcmp, const char *name, pcm->mmap_rw = 1; snd_pcm_set_hw_ptr(pcm, &dsnoop->hw_ptr, -1, 0); snd_pcm_set_appl_ptr(pcm, &dsnoop->appl_ptr, -1, 0); - + if (dsnoop->channels == UINT_MAX) dsnoop->channels = dsnoop->shmptr->s.channels; - + snd_pcm_direct_semaphore_up(dsnoop, DIRECT_IPC_SEM_CLIENT); *pcmp = pcm; return 0; - + _err: - if (dsnoop->timer) + if (dsnoop->timer) snd_timer_close(dsnoop->timer); if (dsnoop->server) snd_pcm_direct_server_discard(dsnoop); @@ -804,7 +804,7 @@ int _snd_pcm_dsnoop_open(snd_pcm_t **pcmp, const char *name, if (err < 0) return err; - /* set a reasonable default */ + /* set a reasonable default */ if (psize == -1 && params.period_time == -1) params.period_time = 125000; /* 0.125 seconds */ diff --git a/src/pcm/pcm_empty.c b/src/pcm/pcm_empty.c index 72065b94..0b8fb3a0 100644 --- a/src/pcm/pcm_empty.c +++ b/src/pcm/pcm_empty.c @@ -25,7 +25,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ - + #include "pcm_local.h" #include "pcm_plugin.h" @@ -77,8 +77,8 @@ pcm.name { * changed in future. */ int _snd_pcm_empty_open(snd_pcm_t **pcmp, const char *name ATTRIBUTE_UNUSED, - snd_config_t *root, snd_config_t *conf, - snd_pcm_stream_t stream, int mode) + snd_config_t *root, snd_config_t *conf, + snd_pcm_stream_t stream, int mode) { snd_config_t *slave = NULL, *sconf; snd_config_iterator_t i, next; diff --git a/src/pcm/pcm_extplug.c b/src/pcm/pcm_extplug.c index bb7933c8..14d7c14f 100644 --- a/src/pcm/pcm_extplug.c +++ b/src/pcm/pcm_extplug.c @@ -25,7 +25,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ - + #include "pcm_local.h" #include "pcm_plugin.h" #include "pcm_extplug.h" @@ -264,7 +264,7 @@ static int snd_pcm_extplug_hw_refine_schange(snd_pcm_t *pcm, return _snd_pcm_hw_params_refine(sparams, links, params); } - + static int snd_pcm_extplug_hw_refine_cchange(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_hw_params_t *sparams) @@ -511,7 +511,7 @@ usually you will call the external plugin API function, #snd_pcm_extplug_create() or #snd_pcm_ioplug_create(), depending on the plugin type. The PCM handle must be filled *pcmp in return. Then this function must return either a value 0 when succeeded, or a -negative value as the error code. +negative value as the error code. Finally, add #SND_PCM_PLUGIN_SYMBOL() with the name of your plugin as the argument at the end. This defines the proper versioned @@ -596,7 +596,7 @@ Otherfields are optional and should be initialized with zero. The constant #SND_PCM_EXTPLUG_VERSION must be passed to the version field for the version check in alsa-lib. A non-NULL ASCII string -has to be passed to the name field. The callback field contains the +has to be passed to the name field. The callback field contains the table of callback functions for this plugin (defined as #snd_pcm_extplug_callback_t). @@ -611,7 +611,7 @@ The callback functions in #snd_pcm_extplug_callback_t define the real behavior of the driver. At least, transfer callback must be given. This callback is called at each time certain size of data block is transfered to the slave -PCM. Other callbacks are optional. +PCM. Other callbacks are optional. The close callback is called when the PCM is closed. If the plugin allocates private resources, this is the place to release them @@ -640,7 +640,7 @@ either #snd_pcm_extplug_set_slave_param_minmax() and as former functions. To clear the parameter constraints, call #snd_pcm_extplug_params_reset() -function. +function. When using snd_pcm_extplug_set_param_*() or snd_pcm_extplug_set_slave_param_*() for any parameter. This parameter is no longer linked between the client and diff --git a/src/pcm/pcm_file.c b/src/pcm/pcm_file.c index a5208067..f2c73163 100644 --- a/src/pcm/pcm_file.c +++ b/src/pcm/pcm_file.c @@ -25,7 +25,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ - + #include "pcm_local.h" #include "pcm_plugin.h" #include "bswap.h" @@ -353,7 +353,7 @@ static int write_wav_header(snd_pcm_t *pcm) 'd', 'a', 't', 'a', 0, 0, 0, 0 }; - + setup_wav_header(pcm, &file->wav_header); res = safe_write(file->fd, header, sizeof(header)); @@ -472,7 +472,7 @@ static int snd_pcm_file_add_frames(snd_pcm_t *pcm, n = cont; if (n > avail) n = avail; - snd_pcm_areas_copy(file->wbuf_areas, file->appl_ptr, + snd_pcm_areas_copy(file->wbuf_areas, file->appl_ptr, areas, offset, pcm->channels, n, pcm->format); frames -= n; @@ -564,7 +564,7 @@ static snd_pcm_sframes_t snd_pcm_file_rewind(snd_pcm_t *pcm, snd_pcm_uframes_t f snd_pcm_file_t *file = pcm->private_data; snd_pcm_sframes_t err; snd_pcm_uframes_t n; - + n = snd_pcm_frames_to_bytes(pcm, frames); if (n > file->wbuf_used_bytes) frames = snd_pcm_bytes_to_frames(pcm, file->wbuf_used_bytes); @@ -592,7 +592,7 @@ static snd_pcm_sframes_t snd_pcm_file_forward(snd_pcm_t *pcm, snd_pcm_uframes_t snd_pcm_file_t *file = pcm->private_data; snd_pcm_sframes_t err; snd_pcm_uframes_t n; - + n = snd_pcm_frames_to_bytes(pcm, frames); if (file->wbuf_used_bytes + n > file->wbuf_size_bytes) frames = snd_pcm_bytes_to_frames(pcm, file->wbuf_size_bytes - file->wbuf_used_bytes); @@ -690,7 +690,7 @@ static snd_pcm_sframes_t snd_pcm_file_readn(snd_pcm_t *pcm, void **bufs, snd_pcm } static snd_pcm_sframes_t snd_pcm_file_mmap_commit(snd_pcm_t *pcm, - snd_pcm_uframes_t offset, + snd_pcm_uframes_t offset, snd_pcm_uframes_t size) { snd_pcm_file_t *file = pcm->private_data; @@ -982,14 +982,14 @@ to a command, and optionally uses an existing file as an input data source \code pcm.name { - type file # File PCM - slave STR # Slave name - # or - slave { # Slave definition - pcm STR # Slave PCM name - # or - pcm { } # Slave PCM definition - } + type file # File PCM + slave STR # Slave name + # or + slave { # Slave definition + pcm STR # Slave PCM name + # or + pcm { } # Slave PCM definition + } file STR # Output filename (or shell command the stream # will be piped to if STR starts with the pipe # char). @@ -1034,7 +1034,7 @@ pcm.name { * changed in future. */ int _snd_pcm_file_open(snd_pcm_t **pcmp, const char *name, - snd_config_t *root, snd_config_t *conf, + snd_config_t *root, snd_config_t *conf, snd_pcm_stream_t stream, int mode) { snd_config_iterator_t i, next; diff --git a/src/pcm/pcm_generic.c b/src/pcm/pcm_generic.c index 8177adc7..8f93eec8 100644 --- a/src/pcm/pcm_generic.c +++ b/src/pcm/pcm_generic.c @@ -7,7 +7,7 @@ */ /* * PCM - Common generic plugin code - * Copyright (c) 2004 by Jaroslav Kysela + * Copyright (c) 2004 by Jaroslav Kysela * * * This library is free software; you can redistribute it and/or modify @@ -125,7 +125,7 @@ int snd_pcm_generic_channel_info(snd_pcm_t *pcm, snd_pcm_channel_info_t *info) } int snd_pcm_generic_status(snd_pcm_t *pcm, snd_pcm_status_t * status) -{ +{ snd_pcm_generic_t *generic = pcm->private_data; return snd_pcm_status(generic->slave, status); } @@ -256,7 +256,7 @@ snd_pcm_sframes_t snd_pcm_generic_readn(snd_pcm_t *pcm, void **bufs, snd_pcm_ufr return _snd_pcm_readn(generic->slave, bufs, size); } -snd_pcm_sframes_t snd_pcm_generic_mmap_commit(snd_pcm_t *pcm, +snd_pcm_sframes_t snd_pcm_generic_mmap_commit(snd_pcm_t *pcm, snd_pcm_uframes_t offset, snd_pcm_uframes_t size) { diff --git a/src/pcm/pcm_generic.h b/src/pcm/pcm_generic.h index dfbe21a0..4d9100e3 100644 --- a/src/pcm/pcm_generic.h +++ b/src/pcm/pcm_generic.h @@ -18,11 +18,11 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ - + typedef struct { snd_pcm_t *slave; int close_slave; -} snd_pcm_generic_t; +} snd_pcm_generic_t; /* make local functions really local */ #define snd_pcm_generic_close \ diff --git a/src/pcm/pcm_hooks.c b/src/pcm/pcm_hooks.c index c4afbccb..4df7522e 100644 --- a/src/pcm/pcm_hooks.c +++ b/src/pcm/pcm_hooks.c @@ -26,7 +26,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ - + #include "pcm_local.h" #include "pcm_generic.h" @@ -283,9 +283,9 @@ pcm.NAME { slave STR # Slave name # or slave { # Slave definition - pcm STR # Slave PCM name + pcm STR # Slave PCM name # or - pcm { } # Slave PCM definition + pcm { } # Slave PCM definition } hooks { ID STR # Hook name (see pcm_hook) @@ -480,7 +480,7 @@ static int snd_pcm_hook_add_conf(snd_pcm_t *pcm, snd_config_t *root, snd_config_ * changed in future. */ int _snd_pcm_hooks_open(snd_pcm_t **pcmp, const char *name, - snd_config_t *root, snd_config_t *conf, + snd_config_t *root, snd_config_t *conf, snd_pcm_stream_t stream, int mode) { snd_config_iterator_t i, next; diff --git a/src/pcm/pcm_hw.c b/src/pcm/pcm_hw.c index 207738ef..e4dc9085 100644 --- a/src/pcm/pcm_hw.c +++ b/src/pcm/pcm_hw.c @@ -26,7 +26,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ - + #include "pcm_local.h" #include "../control/control_local.h" #include "../timer/timer_local.h" @@ -375,7 +375,7 @@ static int snd_pcm_hw_hw_refine(snd_pcm_t *pcm, snd_pcm_hw_params_t *params) if (pcm->tstamp_type != SND_PCM_TSTAMP_TYPE_GETTIMEOFDAY) params->info |= SND_PCM_INFO_MONOTONIC; } - + return 0; } @@ -434,7 +434,7 @@ static int snd_pcm_hw_change_timer(snd_pcm_t *pcm, int enable) snd_timer_params_t params = {0}; unsigned int suspend, resume; int err; - + if (enable) { err = snd_timer_hw_open(&hw->period_timer, "hw-pcm-period-event", @@ -456,7 +456,7 @@ static int snd_pcm_hw_change_timer(snd_pcm_t *pcm, int enable) return -EINVAL; } hw->period_timer_pfd.events = POLLIN; - hw->period_timer_pfd.revents = 0; + hw->period_timer_pfd.revents = 0; snd_timer_poll_descriptors(hw->period_timer, &hw->period_timer_pfd, 1); hw->period_timer_need_poll = 0; @@ -473,7 +473,7 @@ static int snd_pcm_hw_change_timer(snd_pcm_t *pcm, int enable) * In older versions, check via poll before read() is * needed because of the confliction between * TIMER_START and FIONBIO ioctls. - */ + */ if (ver < SNDRV_PROTOCOL_VERSION(2, 0, 4)) hw->period_timer_need_poll = 1; /* @@ -1691,7 +1691,7 @@ int snd_pcm_hw_open_fd(snd_pcm_t **pcmp, const char *name, int fd, return ret; } } - + hw = calloc(1, sizeof(snd_pcm_hw_t)); if (!hw) { close(fd); @@ -1785,7 +1785,7 @@ int snd_pcm_hw_open(snd_pcm_t **pcmp, const char *name, sprintf(filename, filefmt, card, device); __again: - if (attempt++ > 3) { + if (attempt++ > 3) { ret = -EBUSY; goto _err; } @@ -2085,8 +2085,8 @@ int _snd_pcm_hw_open(snd_pcm_t **pcmp, const char *name, return 0; fail: - snd_pcm_free_chmaps(chmap); - return err; + snd_pcm_free_chmaps(chmap); + return err; } #ifndef DOC_HIDDEN @@ -2152,7 +2152,7 @@ static int use_old_hw_params_ioctl(int fd, unsigned int cmd, snd_pcm_hw_params_t struct sndrv_pcm_hw_params_old oparams; unsigned int cmask = 0; int res; - + snd_pcm_hw_convert_to_old_params(&oparams, params, &cmask); res = ioctl(fd, cmd, &oparams); snd_pcm_hw_convert_from_old_params(params, &oparams); diff --git a/src/pcm/pcm_iec958.c b/src/pcm/pcm_iec958.c index 90d4bbe6..d1bb8fb5 100644 --- a/src/pcm/pcm_iec958.c +++ b/src/pcm/pcm_iec958.c @@ -25,7 +25,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ - + #include "pcm_local.h" #include "pcm_plugin.h" #include "plugin_ops.h" @@ -295,7 +295,7 @@ static int snd_pcm_iec958_hw_refine_schange(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd return err; return 0; } - + static int snd_pcm_iec958_hw_refine_cchange(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_hw_params_t *params, snd_pcm_hw_params_t *sparams) { @@ -454,7 +454,7 @@ snd_pcm_iec958_write_areas(snd_pcm_t *pcm, if (size > *slave_sizep) size = *slave_sizep; iec->func(iec, slave_areas, slave_offset, - areas, offset, + areas, offset, pcm->channels, size); *slave_sizep = size; return size; @@ -472,7 +472,7 @@ snd_pcm_iec958_read_areas(snd_pcm_t *pcm, snd_pcm_iec958_t *iec = pcm->private_data; if (size > *slave_sizep) size = *slave_sizep; - iec->func(iec, areas, offset, + iec->func(iec, areas, offset, slave_areas, slave_offset, pcm->channels, size); *slave_sizep = size; @@ -489,7 +489,7 @@ static int snd_pcm_iec958_init(snd_pcm_t *pcm) static void snd_pcm_iec958_dump(snd_pcm_t *pcm, snd_output_t *out) { snd_pcm_iec958_t *iec = pcm->private_data; - snd_output_printf(out, "IEC958 subframe conversion PCM (%s)\n", + snd_output_printf(out, "IEC958 subframe conversion PCM (%s)\n", snd_pcm_format_name(iec->sformat)); if (pcm->setup) { snd_output_printf(out, "Its setup is:\n"); @@ -560,12 +560,12 @@ static const snd_pcm_ops_t snd_pcm_iec958_ops = { * \warning Using of this function might be dangerous in the sense * of compatibility reasons. The prototype might be freely * changed in future. - */ + */ int snd_pcm_iec958_open(snd_pcm_t **pcmp, const char *name, snd_pcm_format_t sformat, snd_pcm_t *slave, int close_slave, const unsigned char *status_bits, const unsigned char *preamble_vals, - int hdmi_mode) + int hdmi_mode) { snd_pcm_t *pcm; snd_pcm_iec958_t *iec; @@ -638,14 +638,14 @@ This plugin converts 32bit IEC958 subframe samples to linear, or linear to \code pcm.name { - type iec958 # IEC958 subframe conversion PCM - slave STR # Slave name - # or - slave { # Slave definition - pcm STR # Slave PCM name - # or - pcm { } # Slave PCM definition - } + type iec958 # IEC958 subframe conversion PCM + slave STR # Slave name + # or + slave { # Slave definition + pcm STR # Slave PCM name + # or + pcm { } # Slave PCM definition + } [status status-bytes] # IEC958 status bits (given in byte array) # IEC958 preamble bits definitions # B/M/W or Z/X/Y, B = block start, M = even subframe, W = odd subframe @@ -684,7 +684,7 @@ by the HDMI HBR specification. * changed in future. */ int _snd_pcm_iec958_open(snd_pcm_t **pcmp, const char *name, - snd_config_t *root, snd_config_t *conf, + snd_config_t *root, snd_config_t *conf, snd_pcm_stream_t stream, int mode) { snd_config_iterator_t i, next; @@ -797,7 +797,7 @@ int _snd_pcm_iec958_open(snd_pcm_t **pcmp, const char *name, if (snd_pcm_format_linear(sformat) != 1 && sformat != SND_PCM_FORMAT_IEC958_SUBFRAME_LE && sformat != SND_PCM_FORMAT_IEC958_SUBFRAME_BE) { - snd_config_delete(sconf); + snd_config_delete(sconf); snd_error(PCM, "invalid slave format"); return -EINVAL; } diff --git a/src/pcm/pcm_ioplug.c b/src/pcm/pcm_ioplug.c index fbc59e90..aff4213d 100644 --- a/src/pcm/pcm_ioplug.c +++ b/src/pcm/pcm_ioplug.c @@ -25,7 +25,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ - + #include "pcm_local.h" #include "pcm_ioplug.h" #include "pcm_ext_parm.h" @@ -482,7 +482,7 @@ static int snd_pcm_ioplug_start(snd_pcm_t *pcm) { ioplug_priv_t *io = pcm->private_data; int err; - + if (io->data->state != SND_PCM_STATE_PREPARED) return -EBADFD; @@ -637,7 +637,7 @@ static snd_pcm_sframes_t ioplug_priv_transfer_areas(snd_pcm_t *pcm, { ioplug_priv_t *io = pcm->private_data; snd_pcm_sframes_t result; - + if (! size) return 0; if (io->data->callback->transfer) @@ -656,7 +656,7 @@ static snd_pcm_sframes_t snd_pcm_ioplug_writei(snd_pcm_t *pcm, const void *buffe else { snd_pcm_channel_area_t areas[pcm->channels]; snd_pcm_areas_from_buf(pcm, areas, (void*)buffer); - return snd_pcm_write_areas(pcm, areas, 0, size, + return snd_pcm_write_areas(pcm, areas, 0, size, ioplug_priv_transfer_areas); } } @@ -982,7 +982,7 @@ Otherfields are optional and should be initialized with zero. The constant #SND_PCM_IOPLUG_VERSION must be passed to the version field for the version check in alsa-lib. A non-NULL ASCII string -has to be passed to the name field. The callback field contains the +has to be passed to the name field. The callback field contains the table of callback functions for this plugin (defined as #snd_pcm_ioplug_callback_t). diff --git a/src/pcm/pcm_ladspa.c b/src/pcm/pcm_ladspa.c index 79b728d8..17d49409 100644 --- a/src/pcm/pcm_ladspa.c +++ b/src/pcm/pcm_ladspa.c @@ -31,7 +31,7 @@ * The LADSPA plugin rewrite was sponsored by MediaNet AG * http://www.medianet.ag */ - + #include "pcm_local.h" #include "pcm_plugin.h" #include @@ -64,17 +64,17 @@ typedef struct { unsigned int allocated; /* count of allocated samples */ LADSPA_Data *zero[2]; /* zero input or dummy output */ } snd_pcm_ladspa_t; - + typedef struct { - unsigned int size; - unsigned int *array; + unsigned int size; + unsigned int *array; } snd_pcm_ladspa_array_t; typedef struct { - snd_pcm_ladspa_array_t channels; - snd_pcm_ladspa_array_t ports; + snd_pcm_ladspa_array_t channels; + snd_pcm_ladspa_array_t ports; LADSPA_Data **m_data; - LADSPA_Data **data; + LADSPA_Data **data; } snd_pcm_ladspa_eps_t; typedef struct snd_pcm_ladspa_instance { @@ -111,14 +111,14 @@ typedef struct { #endif /* DOC_HIDDEN */ static unsigned int snd_pcm_ladspa_count_ports(snd_pcm_ladspa_plugin_t *lplug, - LADSPA_PortDescriptor pdesc) + LADSPA_PortDescriptor pdesc) { - unsigned int res = 0, idx; - for (idx = 0; idx < lplug->desc->PortCount; idx++) { - if ((lplug->desc->PortDescriptors[idx] & pdesc) == pdesc) - res++; - } - return res; + unsigned int res = 0, idx; + for (idx = 0; idx < lplug->desc->PortCount; idx++) { + if ((lplug->desc->PortDescriptors[idx] & pdesc) == pdesc) + res++; + } + return res; } static int snd_pcm_ladspa_find_port(unsigned int *res, @@ -182,8 +182,8 @@ static void snd_pcm_ladspa_free_plugins(struct list_head *plugins) { while (!list_empty(plugins)) { snd_pcm_ladspa_plugin_t *plugin = list_entry(plugins->next, snd_pcm_ladspa_plugin_t, list); - snd_pcm_ladspa_free_io(&plugin->input); - snd_pcm_ladspa_free_io(&plugin->output); + snd_pcm_ladspa_free_io(&plugin->input); + snd_pcm_ladspa_free_io(&plugin->output); if (plugin->dl_handle) dlclose(plugin->dl_handle); free(plugin->filename); @@ -194,15 +194,15 @@ static void snd_pcm_ladspa_free_plugins(struct list_head *plugins) static void snd_pcm_ladspa_free(snd_pcm_ladspa_t *ladspa) { - unsigned int idx; + unsigned int idx; snd_pcm_ladspa_free_plugins(&ladspa->pplugins); snd_pcm_ladspa_free_plugins(&ladspa->cplugins); for (idx = 0; idx < 2; idx++) { free(ladspa->zero[idx]); - ladspa->zero[idx] = NULL; - } - ladspa->allocated = 0; + ladspa->zero[idx] = NULL; + } + ladspa->allocated = 0; } static int snd_pcm_ladspa_close(snd_pcm_t *pcm) @@ -228,11 +228,11 @@ static int snd_pcm_ladspa_hw_refine_cprepare(snd_pcm_t *pcm ATTRIBUTE_UNUSED, sn err = _snd_pcm_hw_params_set_subformat(params, SND_PCM_SUBFORMAT_STD); if (err < 0) return err; - if (ladspa->channels > 0 && pcm->stream == SND_PCM_STREAM_PLAYBACK) { - err = _snd_pcm_hw_param_set(params, SND_PCM_HW_PARAM_CHANNELS, ladspa->channels, 0); - if (err < 0) - return err; - } + if (ladspa->channels > 0 && pcm->stream == SND_PCM_STREAM_PLAYBACK) { + err = _snd_pcm_hw_param_set(params, SND_PCM_HW_PARAM_CHANNELS, ladspa->channels, 0); + if (err < 0) + return err; + } params->info &= ~(SND_PCM_INFO_MMAP | SND_PCM_INFO_MMAP_VALID); return 0; } @@ -246,8 +246,8 @@ static int snd_pcm_ladspa_hw_refine_sprepare(snd_pcm_t *pcm ATTRIBUTE_UNUSED, sn &saccess_mask); _snd_pcm_hw_params_set_format(sparams, SND_PCM_FORMAT_FLOAT); _snd_pcm_hw_params_set_subformat(sparams, SND_PCM_SUBFORMAT_STD); - if (ladspa->channels > 0 && pcm->stream == SND_PCM_STREAM_CAPTURE) - _snd_pcm_hw_param_set(sparams, SND_PCM_HW_PARAM_CHANNELS, ladspa->channels, 0); + if (ladspa->channels > 0 && pcm->stream == SND_PCM_STREAM_CAPTURE) + _snd_pcm_hw_param_set(sparams, SND_PCM_HW_PARAM_CHANNELS, ladspa->channels, 0); return 0; } @@ -268,7 +268,7 @@ static int snd_pcm_ladspa_hw_refine_schange(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd return err; return 0; } - + static int snd_pcm_ladspa_hw_refine_cchange(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_hw_params_t *params, snd_pcm_hw_params_t *sparams) { @@ -320,7 +320,7 @@ static void snd_pcm_ladspa_free_instances(snd_pcm_t *pcm, snd_pcm_ladspa_t *lads { struct list_head *list, *pos, *pos1, *next1; unsigned int idx; - + list = pcm->stream == SND_PCM_STREAM_PLAYBACK ? &ladspa->pplugins : &ladspa->cplugins; list_for_each(pos, list) { snd_pcm_ladspa_plugin_t *plugin = list_entry(pos, snd_pcm_ladspa_plugin_t, list); @@ -332,17 +332,17 @@ static void snd_pcm_ladspa_free_instances(snd_pcm_t *pcm, snd_pcm_ladspa_t *lads if (plugin->desc->cleanup) plugin->desc->cleanup(instance->handle); if (instance->input.m_data) { - for (idx = 0; idx < instance->input.channels.size; idx++) + for (idx = 0; idx < instance->input.channels.size; idx++) free(instance->input.m_data[idx]); free(instance->input.m_data); - } + } if (instance->output.m_data) { - for (idx = 0; idx < instance->output.channels.size; idx++) + for (idx = 0; idx < instance->output.channels.size; idx++) free(instance->output.m_data[idx]); free(instance->output.m_data); - } - free(instance->input.data); - free(instance->output.data); + } + free(instance->input.data); + free(instance->output.data); list_del(&(instance->list)); snd_pcm_ladspa_free_eps(&instance->input); snd_pcm_ladspa_free_eps(&instance->output); @@ -359,48 +359,48 @@ static void snd_pcm_ladspa_free_instances(snd_pcm_t *pcm, snd_pcm_ladspa_t *lads } static int snd_pcm_ladspa_add_to_carray(snd_pcm_ladspa_array_t *array, - unsigned int idx, - unsigned int val) + unsigned int idx, + unsigned int val) { - unsigned int *narray; - unsigned int idx1; + unsigned int *narray; + unsigned int idx1; - if (idx >= array->size) { - narray = realloc(array->array, sizeof(unsigned int) * (idx + 1)); - if (narray == NULL) - return -ENOMEM; - for (idx1 = array->size; idx1 < idx; idx1++) - narray[idx1] = NO_ASSIGN; - array->array = narray; - array->size = idx + 1; - array->array[idx] = val; - return 0; - } - if (array->array[idx] == NO_ASSIGN) - array->array[idx] = val; - else - return -EINVAL; - return 0; + if (idx >= array->size) { + narray = realloc(array->array, sizeof(unsigned int) * (idx + 1)); + if (narray == NULL) + return -ENOMEM; + for (idx1 = array->size; idx1 < idx; idx1++) + narray[idx1] = NO_ASSIGN; + array->array = narray; + array->size = idx + 1; + array->array[idx] = val; + return 0; + } + if (array->array[idx] == NO_ASSIGN) + array->array[idx] = val; + else + return -EINVAL; + return 0; } static int snd_pcm_ladspa_add_to_array(snd_pcm_ladspa_array_t *array, - unsigned int idx, - unsigned int val) + unsigned int idx, + unsigned int val) { - unsigned int *narray; - unsigned int idx1; + unsigned int *narray; + unsigned int idx1; - if (idx >= array->size) { - narray = realloc(array->array, sizeof(unsigned int) * (idx + 1)); - if (narray == NULL) - return -ENOMEM; - for (idx1 = array->size; idx1 < idx; idx1++) - narray[idx1] = NO_ASSIGN; - array->array = narray; - array->size = idx + 1; - } - array->array[idx] = val; - return 0; + if (idx >= array->size) { + narray = realloc(array->array, sizeof(unsigned int) * (idx + 1)); + if (narray == NULL) + return -ENOMEM; + for (idx1 = array->size; idx1 < idx; idx1++) + narray[idx1] = NO_ASSIGN; + array->array = narray; + array->size = idx + 1; + } + array->array[idx] = val; + return 0; } static int snd_pcm_ladspa_connect_plugin1(snd_pcm_ladspa_plugin_t *plugin, @@ -412,31 +412,31 @@ static int snd_pcm_ladspa_connect_plugin1(snd_pcm_ladspa_plugin_t *plugin, assert(plugin->policy == SND_PCM_LADSPA_POLICY_NONE); channels = io->port_bindings_size > 0 ? - io->port_bindings_size : - snd_pcm_ladspa_count_ports(plugin, io->pdesc | LADSPA_PORT_AUDIO); + io->port_bindings_size : + snd_pcm_ladspa_count_ports(plugin, io->pdesc | LADSPA_PORT_AUDIO); for (idx = idx1 = 0; idx < channels; idx++) { if (io->port_bindings_size > 0) - port = io->port_bindings[idx]; - else { - err = snd_pcm_ladspa_find_port(&port, plugin, io->pdesc | LADSPA_PORT_AUDIO, idx); - if (err < 0) { + port = io->port_bindings[idx]; + else { + err = snd_pcm_ladspa_find_port(&port, plugin, io->pdesc | LADSPA_PORT_AUDIO, idx); + if (err < 0) { snd_error(PCM, "unable to find audio %s port %u plugin '%s'", io->pdesc & LADSPA_PORT_INPUT ? "input" : "output", idx, plugin->desc->Name); - return err; - } - } - if (port == NO_ASSIGN) - continue; - err = snd_pcm_ladspa_add_to_carray(&eps->channels, idx1, idx); - if (err < 0) { + return err; + } + } + if (port == NO_ASSIGN) + continue; + err = snd_pcm_ladspa_add_to_carray(&eps->channels, idx1, idx); + if (err < 0) { snd_error(PCM, "unable to add channel %u for audio %s plugin '%s'", idx, io->pdesc & LADSPA_PORT_INPUT ? "input" : "output", plugin->desc->Name); - return err; - } - err = snd_pcm_ladspa_add_to_array(&eps->ports, idx1, port); - if (err < 0) { + return err; + } + err = snd_pcm_ladspa_add_to_array(&eps->ports, idx1, port); + if (err < 0) { snd_error(PCM, "unable to add port %u for audio %s plugin '%s'", port, io->pdesc & LADSPA_PORT_INPUT ? "input" : "output", plugin->desc->Name); - return err; - } - idx1++; + return err; + } + idx1++; } return 0; } @@ -444,21 +444,21 @@ static int snd_pcm_ladspa_connect_plugin1(snd_pcm_ladspa_plugin_t *plugin, static int snd_pcm_ladspa_connect_plugin(snd_pcm_ladspa_plugin_t *plugin, snd_pcm_ladspa_instance_t *instance) { - int err; - - err = snd_pcm_ladspa_connect_plugin1(plugin, &plugin->input, &instance->input); - if (err < 0) - return err; - err = snd_pcm_ladspa_connect_plugin1(plugin, &plugin->output, &instance->output); - if (err < 0) - return err; - return 0; + int err; + + err = snd_pcm_ladspa_connect_plugin1(plugin, &plugin->input, &instance->input); + if (err < 0) + return err; + err = snd_pcm_ladspa_connect_plugin1(plugin, &plugin->output, &instance->output); + if (err < 0) + return err; + return 0; } static int snd_pcm_ladspa_connect_plugin_duplicate1(snd_pcm_ladspa_plugin_t *plugin, - snd_pcm_ladspa_plugin_io_t *io, - snd_pcm_ladspa_eps_t *eps, - unsigned int idx) + snd_pcm_ladspa_plugin_io_t *io, + snd_pcm_ladspa_eps_t *eps, + unsigned int idx) { unsigned int port; int err; @@ -471,19 +471,19 @@ static int snd_pcm_ladspa_connect_plugin_duplicate1(snd_pcm_ladspa_plugin_t *plu if (err < 0) { snd_error(PCM, "unable to find audio %s port %u plugin '%s'", io->pdesc & LADSPA_PORT_INPUT ? "input" : "output", (unsigned int)0, plugin->desc->Name); return err; - } + } } err = snd_pcm_ladspa_add_to_carray(&eps->channels, 0, idx); if (err < 0) { snd_error(PCM, "unable to add channel %u for audio %s plugin '%s'", idx, io->pdesc & LADSPA_PORT_INPUT ? "input" : "output", plugin->desc->Name); - return err; - } - err = snd_pcm_ladspa_add_to_array(&eps->ports, 0, port); - if (err < 0) { + return err; + } + err = snd_pcm_ladspa_add_to_array(&eps->ports, 0, port); + if (err < 0) { snd_error(PCM, "unable to add port %u for audio %s plugin '%s'", port, io->pdesc & LADSPA_PORT_INPUT ? "input" : "output", plugin->desc->Name); - return err; - } - return 0; + return err; + } + return 0; } static int snd_pcm_ladspa_connect_plugin_duplicate(snd_pcm_ladspa_plugin_t *plugin, @@ -496,73 +496,73 @@ static int snd_pcm_ladspa_connect_plugin_duplicate(snd_pcm_ladspa_plugin_t *plug err = snd_pcm_ladspa_connect_plugin_duplicate1(plugin, in_io, &instance->input, idx); if (err < 0) - return err; + return err; err = snd_pcm_ladspa_connect_plugin_duplicate1(plugin, out_io, &instance->output, idx); if (err < 0) - return err; - return 0; + return err; + return 0; } -static void snd_pcm_ladspa_get_default_cvalue(const LADSPA_Descriptor * desc, unsigned int port, LADSPA_Data *val) +static void snd_pcm_ladspa_get_default_cvalue(const LADSPA_Descriptor * desc, unsigned int port, LADSPA_Data *val) { - LADSPA_PortRangeHintDescriptor hdesc; + LADSPA_PortRangeHintDescriptor hdesc; - hdesc = desc->PortRangeHints[port].HintDescriptor; - switch (hdesc & LADSPA_HINT_DEFAULT_MASK) { - case LADSPA_HINT_DEFAULT_MINIMUM: - *val = desc->PortRangeHints[port].LowerBound; - break; - case LADSPA_HINT_DEFAULT_LOW: - if (LADSPA_IS_HINT_LOGARITHMIC(hdesc)) { - *val = exp(log(desc->PortRangeHints[port].LowerBound) - * 0.75 - + log(desc->PortRangeHints[port].UpperBound) - * 0.25); - } else { - *val = (desc->PortRangeHints[port].LowerBound * 0.75) + - (desc->PortRangeHints[port].UpperBound * 0.25); - } - break; - case LADSPA_HINT_DEFAULT_MIDDLE: - if (LADSPA_IS_HINT_LOGARITHMIC(hdesc)) { - *val = sqrt(desc->PortRangeHints[port].LowerBound * - desc->PortRangeHints[port].UpperBound); - } else { - *val = 0.5 * - (desc->PortRangeHints[port].LowerBound + - desc->PortRangeHints[port].UpperBound); - } - break; - case LADSPA_HINT_DEFAULT_HIGH: - if (LADSPA_IS_HINT_LOGARITHMIC(hdesc)) { - *val = exp(log(desc->PortRangeHints[port].LowerBound) - * 0.25 - + log(desc->PortRangeHints[port].UpperBound) - * 0.75); - } else { - *val = (desc->PortRangeHints[port].LowerBound * 0.25) + - (desc->PortRangeHints[port].UpperBound * 0.75); - } - break; - case LADSPA_HINT_DEFAULT_MAXIMUM: - *val = desc->PortRangeHints[port].UpperBound; - break; - case LADSPA_HINT_DEFAULT_0: - *val = 0; - break; - case LADSPA_HINT_DEFAULT_1: - *val = 1; - break; - case LADSPA_HINT_DEFAULT_100: - *val = 100; - break; - case LADSPA_HINT_DEFAULT_440: - *val = 440; - break; - default: - *val = 0; /* reasonable default, if everything fails */ - break; - } + hdesc = desc->PortRangeHints[port].HintDescriptor; + switch (hdesc & LADSPA_HINT_DEFAULT_MASK) { + case LADSPA_HINT_DEFAULT_MINIMUM: + *val = desc->PortRangeHints[port].LowerBound; + break; + case LADSPA_HINT_DEFAULT_LOW: + if (LADSPA_IS_HINT_LOGARITHMIC(hdesc)) { + *val = exp(log(desc->PortRangeHints[port].LowerBound) + * 0.75 + + log(desc->PortRangeHints[port].UpperBound) + * 0.25); + } else { + *val = (desc->PortRangeHints[port].LowerBound * 0.75) + + (desc->PortRangeHints[port].UpperBound * 0.25); + } + break; + case LADSPA_HINT_DEFAULT_MIDDLE: + if (LADSPA_IS_HINT_LOGARITHMIC(hdesc)) { + *val = sqrt(desc->PortRangeHints[port].LowerBound * + desc->PortRangeHints[port].UpperBound); + } else { + *val = 0.5 * + (desc->PortRangeHints[port].LowerBound + + desc->PortRangeHints[port].UpperBound); + } + break; + case LADSPA_HINT_DEFAULT_HIGH: + if (LADSPA_IS_HINT_LOGARITHMIC(hdesc)) { + *val = exp(log(desc->PortRangeHints[port].LowerBound) + * 0.25 + + log(desc->PortRangeHints[port].UpperBound) + * 0.75); + } else { + *val = (desc->PortRangeHints[port].LowerBound * 0.25) + + (desc->PortRangeHints[port].UpperBound * 0.75); + } + break; + case LADSPA_HINT_DEFAULT_MAXIMUM: + *val = desc->PortRangeHints[port].UpperBound; + break; + case LADSPA_HINT_DEFAULT_0: + *val = 0; + break; + case LADSPA_HINT_DEFAULT_1: + *val = 1; + break; + case LADSPA_HINT_DEFAULT_100: + *val = 100; + break; + case LADSPA_HINT_DEFAULT_440: + *val = 440; + break; + default: + *val = 0; /* reasonable default, if everything fails */ + break; + } } static int snd_pcm_ladspa_connect_controls(snd_pcm_ladspa_plugin_t *plugin, @@ -574,8 +574,8 @@ static int snd_pcm_ladspa_connect_controls(snd_pcm_ladspa_plugin_t *plugin, for (idx = midx = 0; idx < plugin->desc->PortCount; idx++) if ((plugin->desc->PortDescriptors[idx] & (io->pdesc | LADSPA_PORT_CONTROL)) == (io->pdesc | LADSPA_PORT_CONTROL)) { if (io->controls_size > midx) { - if (!io->controls_initialized[midx]) - snd_pcm_ladspa_get_default_cvalue(plugin->desc, idx, &io->controls[midx]); + if (!io->controls_initialized[midx]) + snd_pcm_ladspa_get_default_cvalue(plugin->desc, idx, &io->controls[midx]); plugin->desc->connect_port(instance->handle, idx, &io->controls[midx]); } else { return -EINVAL; @@ -586,53 +586,53 @@ static int snd_pcm_ladspa_connect_controls(snd_pcm_ladspa_plugin_t *plugin, } static int snd_pcm_ladspa_check_connect(snd_pcm_ladspa_plugin_t *plugin, - snd_pcm_ladspa_plugin_io_t *io, - snd_pcm_ladspa_eps_t *eps, - unsigned int depth) + snd_pcm_ladspa_plugin_io_t *io, + snd_pcm_ladspa_eps_t *eps, + unsigned int depth) { - unsigned int idx, midx; - int err = 0; + unsigned int idx, midx; + int err = 0; for (idx = midx = 0; idx < plugin->desc->PortCount; idx++) if ((plugin->desc->PortDescriptors[idx] & (io->pdesc | LADSPA_PORT_AUDIO)) == (io->pdesc | LADSPA_PORT_AUDIO)) { - if (eps->channels.array[midx] == NO_ASSIGN) { + if (eps->channels.array[midx] == NO_ASSIGN) { snd_error(PCM, "%s port for plugin %s depth %u is not connected", io->pdesc & LADSPA_PORT_INPUT ? "input" : "output", plugin->desc->Name, depth); - err++; - } + err++; + } midx++; } - if (err > 0) { + if (err > 0) { snd_error(PCM, "%i connection errors total", err); - return -EINVAL; - } - return 0; + return -EINVAL; + } + return 0; } static int snd_pcm_ladspa_allocate_instances(snd_pcm_t *pcm, snd_pcm_ladspa_t *ladspa) { struct list_head *list, *pos; unsigned int depth, idx, count; - unsigned int in_channels; + unsigned int in_channels; unsigned int in_ports, out_ports; snd_pcm_ladspa_instance_t *instance = NULL; int err; - + list = pcm->stream == SND_PCM_STREAM_PLAYBACK ? &ladspa->pplugins : &ladspa->cplugins; in_channels = ladspa->channels > 0 ? ladspa->channels : - (pcm->stream == SND_PCM_STREAM_PLAYBACK ? pcm->channels : ladspa->plug.gen.slave->channels); + (pcm->stream == SND_PCM_STREAM_PLAYBACK ? pcm->channels : ladspa->plug.gen.slave->channels); depth = 0; list_for_each(pos, list) { snd_pcm_ladspa_plugin_t *plugin = list_entry(pos, snd_pcm_ladspa_plugin_t, list); - in_ports = snd_pcm_ladspa_count_ports(plugin, LADSPA_PORT_INPUT | LADSPA_PORT_AUDIO); - out_ports = snd_pcm_ladspa_count_ports(plugin, LADSPA_PORT_OUTPUT | LADSPA_PORT_AUDIO); + in_ports = snd_pcm_ladspa_count_ports(plugin, LADSPA_PORT_INPUT | LADSPA_PORT_AUDIO); + out_ports = snd_pcm_ladspa_count_ports(plugin, LADSPA_PORT_OUTPUT | LADSPA_PORT_AUDIO); count = 1; if (plugin->policy == SND_PCM_LADSPA_POLICY_DUPLICATE) { - if (in_ports == 1 && out_ports == 1) - count = in_channels; - else - plugin->policy = SND_PCM_LADSPA_POLICY_NONE; - } - for (idx = 0; idx < count; idx++) { + if (in_ports == 1 && out_ports == 1) + count = in_channels; + else + plugin->policy = SND_PCM_LADSPA_POLICY_NONE; + } + for (idx = 0; idx < count; idx++) { instance = (snd_pcm_ladspa_instance_t *)calloc(1, sizeof(snd_pcm_ladspa_instance_t)); if (instance == NULL) return -ENOMEM; @@ -652,11 +652,11 @@ static int snd_pcm_ladspa_allocate_instances(snd_pcm_t *pcm, snd_pcm_ladspa_t *l return err; } } else { - err = snd_pcm_ladspa_connect_plugin(plugin, instance); - if (err < 0) { + err = snd_pcm_ladspa_connect_plugin(plugin, instance); + if (err < 0) { snd_error(PCM, "Unable to connect plugin '%s' depth %u", plugin->desc->Name, depth); - return err; - } + return err; + } } err = snd_pcm_ladspa_connect_controls(plugin, &plugin->input, instance); assert(err >= 0); @@ -667,10 +667,10 @@ static int snd_pcm_ladspa_allocate_instances(snd_pcm_t *pcm, snd_pcm_ladspa_t *l } err = snd_pcm_ladspa_check_connect(plugin, &plugin->input, &instance->input, depth); if (err < 0) - return err; + return err; err = snd_pcm_ladspa_check_connect(plugin, &plugin->output, &instance->output, depth); if (err < 0) - return err; + return err; depth++; } return 0; @@ -678,9 +678,9 @@ static int snd_pcm_ladspa_allocate_instances(snd_pcm_t *pcm, snd_pcm_ladspa_t *l static LADSPA_Data *snd_pcm_ladspa_allocate_zero(snd_pcm_ladspa_t *ladspa, unsigned int idx) { - if (ladspa->zero[idx] == NULL) - ladspa->zero[idx] = calloc(ladspa->allocated, sizeof(LADSPA_Data)); - return ladspa->zero[idx]; + if (ladspa->zero[idx] == NULL) + ladspa->zero[idx] = calloc(ladspa->allocated, sizeof(LADSPA_Data)); + return ladspa->zero[idx]; } static int snd_pcm_ladspa_allocate_memory(snd_pcm_t *pcm, snd_pcm_ladspa_t *ladspa) @@ -691,20 +691,20 @@ static int snd_pcm_ladspa_allocate_memory(snd_pcm_t *pcm, snd_pcm_ladspa_t *lads unsigned int ichannels, ochannels; void **pchannels, **npchannels; unsigned int idx, chn; - - ladspa->allocated = 2048; - if (pcm->buffer_size > ladspa->allocated) - ladspa->allocated = pcm->buffer_size; - if (pcm->stream == SND_PCM_STREAM_PLAYBACK) { - ichannels = pcm->channels; - ochannels = ladspa->plug.gen.slave->channels; - } else { - ichannels = ladspa->plug.gen.slave->channels; - ochannels = pcm->channels; - } + + ladspa->allocated = 2048; + if (pcm->buffer_size > ladspa->allocated) + ladspa->allocated = pcm->buffer_size; + if (pcm->stream == SND_PCM_STREAM_PLAYBACK) { + ichannels = pcm->channels; + ochannels = ladspa->plug.gen.slave->channels; + } else { + ichannels = ladspa->plug.gen.slave->channels; + ochannels = pcm->channels; + } pchannels = calloc(1, sizeof(void *) * channels); if (pchannels == NULL) - return -ENOMEM; + return -ENOMEM; list = pcm->stream == SND_PCM_STREAM_PLAYBACK ? &ladspa->pplugins : &ladspa->cplugins; list_for_each(pos, list) { snd_pcm_ladspa_plugin_t *plugin = list_entry(pos, snd_pcm_ladspa_plugin_t, list); @@ -712,68 +712,68 @@ static int snd_pcm_ladspa_allocate_memory(snd_pcm_t *pcm, snd_pcm_ladspa_t *lads instance = list_entry(pos1, snd_pcm_ladspa_instance_t, list); nchannels = channels; for (idx = 0; idx < instance->input.channels.size; idx++) { - chn = instance->input.channels.array[idx]; - assert(instance->input.ports.array[idx] != NO_ASSIGN); - if (chn >= nchannels) - nchannels = chn + 1; - } + chn = instance->input.channels.array[idx]; + assert(instance->input.ports.array[idx] != NO_ASSIGN); + if (chn >= nchannels) + nchannels = chn + 1; + } for (idx = 0; idx < instance->output.channels.size; idx++) { - chn = instance->output.channels.array[idx]; - assert(instance->output.ports.array[idx] != NO_ASSIGN); - if (chn >= nchannels) - nchannels = chn + 1; - } - if (nchannels != channels) { - npchannels = realloc(pchannels, nchannels * sizeof(void *)); - if (npchannels == NULL) { - free(pchannels); - return -ENOMEM; - } - for (idx = channels; idx < nchannels; idx++) - npchannels[idx] = NULL; - pchannels = npchannels; - } - assert(instance->input.data == NULL); - assert(instance->input.m_data == NULL); - assert(instance->output.data == NULL); - assert(instance->output.m_data == NULL); - instance->input.data = calloc(instance->input.channels.size, sizeof(void *)); - instance->input.m_data = calloc(instance->input.channels.size, sizeof(void *)); - instance->output.data = calloc(instance->output.channels.size, sizeof(void *)); - instance->output.m_data = calloc(instance->output.channels.size, sizeof(void *)); - if (instance->input.data == NULL || - instance->input.m_data == NULL || - instance->output.data == NULL || - instance->output.m_data == NULL) { - free(pchannels); - return -ENOMEM; - } + chn = instance->output.channels.array[idx]; + assert(instance->output.ports.array[idx] != NO_ASSIGN); + if (chn >= nchannels) + nchannels = chn + 1; + } + if (nchannels != channels) { + npchannels = realloc(pchannels, nchannels * sizeof(void *)); + if (npchannels == NULL) { + free(pchannels); + return -ENOMEM; + } + for (idx = channels; idx < nchannels; idx++) + npchannels[idx] = NULL; + pchannels = npchannels; + } + assert(instance->input.data == NULL); + assert(instance->input.m_data == NULL); + assert(instance->output.data == NULL); + assert(instance->output.m_data == NULL); + instance->input.data = calloc(instance->input.channels.size, sizeof(void *)); + instance->input.m_data = calloc(instance->input.channels.size, sizeof(void *)); + instance->output.data = calloc(instance->output.channels.size, sizeof(void *)); + instance->output.m_data = calloc(instance->output.channels.size, sizeof(void *)); + if (instance->input.data == NULL || + instance->input.m_data == NULL || + instance->output.data == NULL || + instance->output.m_data == NULL) { + free(pchannels); + return -ENOMEM; + } for (idx = 0; idx < instance->input.channels.size; idx++) { - chn = instance->input.channels.array[idx]; - if (pchannels[chn] == NULL && chn < ichannels) { - instance->input.data[idx] = NULL; - continue; - } - instance->input.data[idx] = pchannels[chn]; - if (instance->input.data[idx] == NULL) { - instance->input.data[idx] = snd_pcm_ladspa_allocate_zero(ladspa, 0); - if (instance->input.data[idx] == NULL) { - free(pchannels); - return -ENOMEM; - } - } - } - for (idx = 0; idx < instance->output.channels.size; idx++) { - chn = instance->output.channels.array[idx]; - /* FIXME/OPTIMIZE: check if we can remove double alloc */ - /* if LADSPA plugin has no broken inplace */ - instance->output.data[idx] = malloc(sizeof(LADSPA_Data) * ladspa->allocated); - if (instance->output.data[idx] == NULL) { - free(pchannels); - return -ENOMEM; - } - pchannels[chn] = instance->output.m_data[idx] = instance->output.data[idx]; - } + chn = instance->input.channels.array[idx]; + if (pchannels[chn] == NULL && chn < ichannels) { + instance->input.data[idx] = NULL; + continue; + } + instance->input.data[idx] = pchannels[chn]; + if (instance->input.data[idx] == NULL) { + instance->input.data[idx] = snd_pcm_ladspa_allocate_zero(ladspa, 0); + if (instance->input.data[idx] == NULL) { + free(pchannels); + return -ENOMEM; + } + } + } + for (idx = 0; idx < instance->output.channels.size; idx++) { + chn = instance->output.channels.array[idx]; + /* FIXME/OPTIMIZE: check if we can remove double alloc */ + /* if LADSPA plugin has no broken inplace */ + instance->output.data[idx] = malloc(sizeof(LADSPA_Data) * ladspa->allocated); + if (instance->output.data[idx] == NULL) { + free(pchannels); + return -ENOMEM; + } + pchannels[chn] = instance->output.m_data[idx] = instance->output.data[idx]; + } } } /* OPTIMIZE: we have already allocated areas for ALSA output channels */ @@ -784,35 +784,35 @@ static int snd_pcm_ladspa_allocate_memory(snd_pcm_t *pcm, snd_pcm_ladspa_t *lads snd_pcm_ladspa_plugin_t *plugin = list_entry(pos, snd_pcm_ladspa_plugin_t, list); list_for_each(pos1, &plugin->instances) { instance = list_entry(pos1, snd_pcm_ladspa_instance_t, list); - for (idx = 0; idx < instance->output.channels.size; idx++) { - chn = instance->output.channels.array[idx]; - if (instance->output.data[idx] == pchannels[chn]) { + for (idx = 0; idx < instance->output.channels.size; idx++) { + chn = instance->output.channels.array[idx]; + if (instance->output.data[idx] == pchannels[chn]) { free(instance->output.m_data[idx]); instance->output.m_data[idx] = NULL; - if (chn < ochannels) { - instance->output.data[idx] = NULL; - } else { - instance->output.data[idx] = snd_pcm_ladspa_allocate_zero(ladspa, 1); - if (instance->output.data[idx] == NULL) { - free(pchannels); - return -ENOMEM; - } - } - } - } - } - } + if (chn < ochannels) { + instance->output.data[idx] = NULL; + } else { + instance->output.data[idx] = snd_pcm_ladspa_allocate_zero(ladspa, 1); + if (instance->output.data[idx] == NULL) { + free(pchannels); + return -ENOMEM; + } + } + } + } + } + } #if 0 - printf("zero[0] = %p\n", ladspa->zero[0]); - printf("zero[1] = %p\n", ladspa->zero[1]); + printf("zero[0] = %p\n", ladspa->zero[0]); + printf("zero[1] = %p\n", ladspa->zero[1]); list_for_each(pos, list) { snd_pcm_ladspa_plugin_t *plugin = list_entry(pos, snd_pcm_ladspa_plugin_t, list); list_for_each(pos1, &plugin->instances) { instance = list_entry(pos1, snd_pcm_ladspa_instance_t, list); - for (idx = 0; idx < instance->input.channels.size; idx++) - printf("%i:alloc-input%i: data = %p, m_data = %p\n", instance->depth, idx, instance->input.data[idx], instance->input.m_data[idx]); - for (idx = 0; idx < instance->output.channels.size; idx++) - printf("%i:alloc-output%i: data = %p, m_data = %p\n", instance->depth, idx, instance->output.data[idx], instance->output.m_data[idx]); + for (idx = 0; idx < instance->input.channels.size; idx++) + printf("%i:alloc-input%i: data = %p, m_data = %p\n", instance->depth, idx, instance->input.data[idx], instance->input.m_data[idx]); + for (idx = 0; idx < instance->output.channels.size; idx++) + printf("%i:alloc-output%i: data = %p, m_data = %p\n", instance->depth, idx, instance->output.data[idx], instance->output.m_data[idx]); } } #endif @@ -824,7 +824,7 @@ static int snd_pcm_ladspa_init(snd_pcm_t *pcm) { snd_pcm_ladspa_t *ladspa = pcm->private_data; int err; - + snd_pcm_ladspa_free_instances(pcm, ladspa, 1); err = snd_pcm_ladspa_allocate_instances(pcm, ladspa); if (err < 0) { @@ -861,47 +861,47 @@ snd_pcm_ladspa_write_areas(snd_pcm_t *pcm, struct list_head *pos, *pos1; LADSPA_Data *data; unsigned int idx, chn, size1, size2; - + if (size > *slave_sizep) size = *slave_sizep; - size2 = size; + size2 = size; #if 0 /* no processing - for testing purposes only */ snd_pcm_areas_copy(slave_areas, slave_offset, areas, offset, pcm->channels, size, pcm->format); #else - while (size > 0) { - size1 = size; - if (size1 > ladspa->allocated) - size1 = ladspa->allocated; - list_for_each(pos, &ladspa->pplugins) { - snd_pcm_ladspa_plugin_t *plugin = list_entry(pos, snd_pcm_ladspa_plugin_t, list); - list_for_each(pos1, &plugin->instances) { - instance = list_entry(pos1, snd_pcm_ladspa_instance_t, list); - for (idx = 0; idx < instance->input.channels.size; idx++) { - chn = instance->input.channels.array[idx]; - data = instance->input.data[idx]; - if (data == NULL) { - data = (LADSPA_Data *)((char *)areas[chn].addr + (areas[chn].first / 8)); - data += offset; - } - instance->desc->connect_port(instance->handle, instance->input.ports.array[idx], data); - } - for (idx = 0; idx < instance->output.channels.size; idx++) { - chn = instance->output.channels.array[idx]; - data = instance->output.data[idx]; - if (data == NULL) { - data = (LADSPA_Data *)((char *)slave_areas[chn].addr + (areas[chn].first / 8)); - data += slave_offset; - } + while (size > 0) { + size1 = size; + if (size1 > ladspa->allocated) + size1 = ladspa->allocated; + list_for_each(pos, &ladspa->pplugins) { + snd_pcm_ladspa_plugin_t *plugin = list_entry(pos, snd_pcm_ladspa_plugin_t, list); + list_for_each(pos1, &plugin->instances) { + instance = list_entry(pos1, snd_pcm_ladspa_instance_t, list); + for (idx = 0; idx < instance->input.channels.size; idx++) { + chn = instance->input.channels.array[idx]; + data = instance->input.data[idx]; + if (data == NULL) { + data = (LADSPA_Data *)((char *)areas[chn].addr + (areas[chn].first / 8)); + data += offset; + } + instance->desc->connect_port(instance->handle, instance->input.ports.array[idx], data); + } + for (idx = 0; idx < instance->output.channels.size; idx++) { + chn = instance->output.channels.array[idx]; + data = instance->output.data[idx]; + if (data == NULL) { + data = (LADSPA_Data *)((char *)slave_areas[chn].addr + (areas[chn].first / 8)); + data += slave_offset; + } instance->desc->connect_port(instance->handle, instance->output.ports.array[idx], data); - } - instance->desc->run(instance->handle, size1); - } - } - offset += size1; - slave_offset += size1; - size -= size1; + } + instance->desc->run(instance->handle, size1); + } + } + offset += size1; + slave_offset += size1; + size -= size1; } #endif *slave_sizep = size2; @@ -925,44 +925,44 @@ snd_pcm_ladspa_read_areas(snd_pcm_t *pcm, if (size > *slave_sizep) size = *slave_sizep; - size2 = size; + size2 = size; #if 0 /* no processing - for testing purposes only */ snd_pcm_areas_copy(areas, offset, slave_areas, slave_offset, pcm->channels, size, pcm->format); #else - while (size > 0) { - size1 = size; - if (size1 > ladspa->allocated) - size1 = ladspa->allocated; - list_for_each(pos, &ladspa->cplugins) { - snd_pcm_ladspa_plugin_t *plugin = list_entry(pos, snd_pcm_ladspa_plugin_t, list); - list_for_each(pos1, &plugin->instances) { - instance = list_entry(pos1, snd_pcm_ladspa_instance_t, list); - for (idx = 0; idx < instance->input.channels.size; idx++) { - chn = instance->input.channels.array[idx]; - data = instance->input.data[idx]; - if (data == NULL) { - data = (LADSPA_Data *)((char *)slave_areas[chn].addr + (areas[chn].first / 8)); - data += slave_offset; - } - instance->desc->connect_port(instance->handle, instance->input.ports.array[idx], data); - } - for (idx = 0; idx < instance->output.channels.size; idx++) { - chn = instance->output.channels.array[idx]; - data = instance->output.data[idx]; - if (data == NULL) { - data = (LADSPA_Data *)((char *)areas[chn].addr + (areas[chn].first / 8)); - data += offset; - } - instance->desc->connect_port(instance->handle, instance->output.ports.array[idx], data); - } - instance->desc->run(instance->handle, size1); - } - } - offset += size1; - slave_offset += size1; - size -= size1; + while (size > 0) { + size1 = size; + if (size1 > ladspa->allocated) + size1 = ladspa->allocated; + list_for_each(pos, &ladspa->cplugins) { + snd_pcm_ladspa_plugin_t *plugin = list_entry(pos, snd_pcm_ladspa_plugin_t, list); + list_for_each(pos1, &plugin->instances) { + instance = list_entry(pos1, snd_pcm_ladspa_instance_t, list); + for (idx = 0; idx < instance->input.channels.size; idx++) { + chn = instance->input.channels.array[idx]; + data = instance->input.data[idx]; + if (data == NULL) { + data = (LADSPA_Data *)((char *)slave_areas[chn].addr + (areas[chn].first / 8)); + data += slave_offset; + } + instance->desc->connect_port(instance->handle, instance->input.ports.array[idx], data); + } + for (idx = 0; idx < instance->output.channels.size; idx++) { + chn = instance->output.channels.array[idx]; + data = instance->output.data[idx]; + if (data == NULL) { + data = (LADSPA_Data *)((char *)areas[chn].addr + (areas[chn].first / 8)); + data += offset; + } + instance->desc->connect_port(instance->handle, instance->output.ports.array[idx], data); + } + instance->desc->run(instance->handle, size1); + } + } + offset += size1; + slave_offset += size1; + size -= size1; } #endif *slave_sizep = size2; @@ -970,8 +970,8 @@ snd_pcm_ladspa_read_areas(snd_pcm_t *pcm, } static void snd_pcm_ladspa_dump_direction(snd_pcm_ladspa_plugin_t *plugin, - snd_pcm_ladspa_plugin_io_t *io, - snd_output_t *out) + snd_pcm_ladspa_plugin_io_t *io, + snd_output_t *out) { unsigned int idx, midx; @@ -979,49 +979,49 @@ static void snd_pcm_ladspa_dump_direction(snd_pcm_ladspa_plugin_t *plugin, goto __control; snd_output_printf(out, " Audio %s port bindings:\n", io->pdesc == LADSPA_PORT_INPUT ? "input" : "output"); for (idx = 0; idx < io->port_bindings_size; idx++) { - if (io->port_bindings[idx] == NO_ASSIGN) + if (io->port_bindings[idx] == NO_ASSIGN) snd_output_printf(out, " %i -> NONE\n", idx); - else - snd_output_printf(out, " %i -> %i\n", idx, io->port_bindings[idx]); + else + snd_output_printf(out, " %i -> %i\n", idx, io->port_bindings[idx]); } __control: - if (io->controls_size == 0) - return; + if (io->controls_size == 0) + return; snd_output_printf(out, " Control %s port initial values:\n", io->pdesc == LADSPA_PORT_INPUT ? "input" : "output"); for (idx = midx = 0; idx < plugin->desc->PortCount; idx++) { if ((plugin->desc->PortDescriptors[idx] & (io->pdesc | LADSPA_PORT_CONTROL)) == (io->pdesc | LADSPA_PORT_CONTROL)) { - snd_output_printf(out, " %i \"%s\" = %.8f\n", idx, plugin->desc->PortNames[idx], io->controls[midx]); - midx++; - } - } + snd_output_printf(out, " %i \"%s\" = %.8f\n", idx, plugin->desc->PortNames[idx], io->controls[midx]); + midx++; + } + } } static void snd_pcm_ladspa_dump_array(snd_output_t *out, - snd_pcm_ladspa_array_t *array, - snd_pcm_ladspa_plugin_t *plugin) + snd_pcm_ladspa_array_t *array, + snd_pcm_ladspa_plugin_t *plugin) { - unsigned int size = array->size; - unsigned int val, idx = 0; + unsigned int size = array->size; + unsigned int val, idx = 0; - while (size-- > 0) { - if (idx > 0) { - snd_output_putc(out, ','); - snd_output_putc(out, ' '); - } - val = array->array[idx++]; - if (val == NO_ASSIGN) - snd_output_putc(out, '-'); - else - snd_output_printf(out, "%u", val); - if (plugin && val != NO_ASSIGN) - snd_output_printf(out, " \"%s\"", plugin->desc->PortNames[val]); - } + while (size-- > 0) { + if (idx > 0) { + snd_output_putc(out, ','); + snd_output_putc(out, ' '); + } + val = array->array[idx++]; + if (val == NO_ASSIGN) + snd_output_putc(out, '-'); + else + snd_output_printf(out, "%u", val); + if (plugin && val != NO_ASSIGN) + snd_output_printf(out, " \"%s\"", plugin->desc->PortNames[val]); + } } static void snd_pcm_ladspa_plugins_dump(struct list_head *list, snd_output_t *out) { struct list_head *pos, *pos2; - + list_for_each(pos, list) { snd_pcm_ladspa_plugin_t *plugin = list_entry(pos, snd_pcm_ladspa_plugin_t, list); snd_output_printf(out, " Policy: %s\n", plugin->policy == SND_PCM_LADSPA_POLICY_NONE ? "none" : "duplicate"); @@ -1029,19 +1029,19 @@ static void snd_pcm_ladspa_plugins_dump(struct list_head *list, snd_output_t *ou snd_output_printf(out, " Plugin Name: %s\n", plugin->desc->Name); snd_output_printf(out, " Plugin Label: %s\n", plugin->desc->Label); snd_output_printf(out, " Plugin Unique ID: %lu\n", plugin->desc->UniqueID); - snd_output_printf(out, " Instances:\n"); + snd_output_printf(out, " Instances:\n"); list_for_each(pos2, &plugin->instances) { - snd_pcm_ladspa_instance_t *in = (snd_pcm_ladspa_instance_t *) pos2; - snd_output_printf(out, " Depth: %i\n", in->depth); - snd_output_printf(out, " InChannels: "); - snd_pcm_ladspa_dump_array(out, &in->input.channels, NULL); - snd_output_printf(out, "\n InPorts: "); - snd_pcm_ladspa_dump_array(out, &in->input.ports, plugin); - snd_output_printf(out, "\n OutChannels: "); - snd_pcm_ladspa_dump_array(out, &in->output.channels, NULL); - snd_output_printf(out, "\n OutPorts: "); - snd_pcm_ladspa_dump_array(out, &in->output.ports, plugin); - snd_output_printf(out, "\n"); + snd_pcm_ladspa_instance_t *in = (snd_pcm_ladspa_instance_t *) pos2; + snd_output_printf(out, " Depth: %i\n", in->depth); + snd_output_printf(out, " InChannels: "); + snd_pcm_ladspa_dump_array(out, &in->input.channels, NULL); + snd_output_printf(out, "\n InPorts: "); + snd_pcm_ladspa_dump_array(out, &in->input.ports, plugin); + snd_output_printf(out, "\n OutChannels: "); + snd_pcm_ladspa_dump_array(out, &in->output.channels, NULL); + snd_output_printf(out, "\n OutPorts: "); + snd_pcm_ladspa_dump_array(out, &in->output.ports, plugin); + snd_output_printf(out, "\n"); } snd_pcm_ladspa_dump_direction(plugin, &plugin->input, out); snd_pcm_ladspa_dump_direction(plugin, &plugin->output, out); @@ -1105,24 +1105,24 @@ static int snd_pcm_ladspa_check_file(snd_pcm_ladspa_plugin_t * const plugin, if (strcmp(label, d->Label)) continue; #else - char *labellocale; - struct lconv *lc; - if (label != NULL) { - lc = localeconv (); - labellocale = malloc (strlen (label) + 1); - if (labellocale == NULL) { - dlclose(handle); - return -ENOMEM; + char *labellocale; + struct lconv *lc; + if (label != NULL) { + lc = localeconv (); + labellocale = malloc (strlen (label) + 1); + if (labellocale == NULL) { + dlclose(handle); + return -ENOMEM; } - strcpy (labellocale, label); - if (strrchr(labellocale, '.')) - *strrchr (labellocale, '.') = *lc->decimal_point; - if (strcmp(label, d->Label) && strcmp(labellocale, d->Label)) { - free(labellocale); - continue; - } - free (labellocale); - } + strcpy (labellocale, label); + if (strrchr(labellocale, '.')) + *strrchr (labellocale, '.') = *lc->decimal_point; + if (strcmp(label, d->Label) && strcmp(labellocale, d->Label)) { + free(labellocale); + continue; + } + free (labellocale); + } #endif if (ladspa_id > 0 && d->UniqueID != ladspa_id) continue; @@ -1151,22 +1151,22 @@ static int snd_pcm_ladspa_check_dir(snd_pcm_ladspa_plugin_t * const plugin, int len = strlen(path), err; int need_slash; char *filename; - + if (len < 1) return 0; need_slash = path[len - 1] != '/'; - + dir = opendir(path); if (!dir) return -ENOENT; - + while (1) { dirent = readdir64(dir); if (!dirent) { closedir(dir); return 0; } - + filename = malloc(len + strlen(dirent->d_name) + 1 + need_slash); if (filename == NULL) { closedir(dir); @@ -1199,7 +1199,7 @@ static int snd_pcm_ladspa_look_for_plugin(snd_pcm_ladspa_plugin_t * const plugin const char *c; size_t l; int err; - + for (c = path; (l = strcspn(c, ": ")) > 0; ) { char name[l + 1]; char *fullpath; @@ -1220,10 +1220,10 @@ static int snd_pcm_ladspa_look_for_plugin(snd_pcm_ladspa_plugin_t * const plugin c++; } return -ENOENT; -} +} static int snd_pcm_ladspa_add_default_controls(snd_pcm_ladspa_plugin_t *lplug, - snd_pcm_ladspa_plugin_io_t *io) + snd_pcm_ladspa_plugin_io_t *io) { unsigned int count = 0; LADSPA_Data *array; @@ -1246,11 +1246,11 @@ static int snd_pcm_ladspa_add_default_controls(snd_pcm_ladspa_plugin_t *lplug, io->controls = array; return 0; -} +} static int snd_pcm_ladspa_parse_controls(snd_pcm_ladspa_plugin_t *lplug, snd_pcm_ladspa_plugin_io_t *io, - snd_config_t *controls) + snd_config_t *controls) { snd_config_iterator_t i, next; int err; @@ -1296,7 +1296,7 @@ static int snd_pcm_ladspa_parse_controls(snd_pcm_ladspa_plugin_t *lplug, static int snd_pcm_ladspa_parse_bindings(snd_pcm_ladspa_plugin_t *lplug, snd_pcm_ladspa_plugin_io_t *io, - snd_config_t *bindings) + snd_config_t *bindings) { unsigned int count = 0; unsigned int *array; @@ -1382,7 +1382,7 @@ static int snd_pcm_ladspa_parse_ioconfig(snd_pcm_ladspa_plugin_t *lplug, snd_error(PCM, "error adding default controls"); return err; } - + if (conf == NULL) { return 0; } @@ -1408,14 +1408,14 @@ static int snd_pcm_ladspa_parse_ioconfig(snd_pcm_ladspa_plugin_t *lplug, /* ignore values of parameters for output controls */ if (controls && !(io->pdesc & LADSPA_PORT_OUTPUT)) { - err = snd_pcm_ladspa_parse_controls(lplug, io, controls); - if (err < 0) + err = snd_pcm_ladspa_parse_controls(lplug, io, controls); + if (err < 0) return err; } if (bindings) { - err = snd_pcm_ladspa_parse_bindings(lplug, io, bindings); - if (err < 0) + err = snd_pcm_ladspa_parse_bindings(lplug, io, bindings); + if (err < 0) return err; } @@ -1674,18 +1674,18 @@ Instances of LADSPA plugins are created dynamically. \code pcm.name { - type ladspa # ALSA<->LADSPA PCM - slave STR # Slave name - # or - slave { # Slave definition - pcm STR # Slave PCM name - # or - pcm { } # Slave PCM definition - } - [channels INT] # count input channels (input to LADSPA plugin chain) + type ladspa # ALSA<->LADSPA PCM + slave STR # Slave name + # or + slave { # Slave definition + pcm STR # Slave PCM name + # or + pcm { } # Slave PCM definition + } + [channels INT] # count input channels (input to LADSPA plugin chain) [path STR] # Path (directory) with LADSPA plugins plugins | # Definition for both directions - playback_plugins | # Definition for playback direction + playback_plugins | # Definition for playback direction capture_plugins { # Definition for capture direction N { # Configuration for LADPSA plugin N [id INT] # LADSPA plugin ID (for example 1043) @@ -1697,7 +1697,7 @@ pcm.name { C INT or STR # C - channel, INT - audio port index, STR - audio port name } controls { - # valid only in the input block + # valid only in the input block I INT or REAL # I - control port index, INT or REAL - control value # or STR INT or REAL # STR - control port name, INT or REAL - control value @@ -1731,7 +1731,7 @@ pcm.name { * changed in future. */ int _snd_pcm_ladspa_open(snd_pcm_t **pcmp, const char *name, - snd_config_t *root, snd_config_t *conf, + snd_config_t *root, snd_config_t *conf, snd_pcm_stream_t stream, int mode) { snd_config_iterator_t i, next; @@ -1759,9 +1759,9 @@ int _snd_pcm_ladspa_open(snd_pcm_t **pcmp, const char *name, if (strcmp(id, "channels") == 0) { snd_config_get_integer(n, &channels); if (channels > 1024) - channels = 1024; - if (channels < 0) - channels = 0; + channels = 1024; + if (channels < 0) + channels = 0; continue; } if (strcmp(id, "plugins") == 0) { diff --git a/src/pcm/pcm_lfloat.c b/src/pcm/pcm_lfloat.c index 8df993d4..87b20463 100644 --- a/src/pcm/pcm_lfloat.c +++ b/src/pcm/pcm_lfloat.c @@ -25,7 +25,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ - + #include "pcm_local.h" #include "pcm_plugin.h" #include "plugin_ops.h" @@ -236,7 +236,7 @@ static int snd_pcm_lfloat_hw_refine_schange(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd return err; return 0; } - + static int snd_pcm_lfloat_hw_refine_cchange(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_hw_params_t *params, snd_pcm_hw_params_t *sparams) { @@ -309,7 +309,7 @@ snd_pcm_lfloat_write_areas(snd_pcm_t *pcm, if (size > *slave_sizep) size = *slave_sizep; lfloat->func(slave_areas, slave_offset, - areas, offset, + areas, offset, pcm->channels, size, lfloat->int32_idx, lfloat->float32_idx); *slave_sizep = size; @@ -328,7 +328,7 @@ snd_pcm_lfloat_read_areas(snd_pcm_t *pcm, snd_pcm_lfloat_t *lfloat = pcm->private_data; if (size > *slave_sizep) size = *slave_sizep; - lfloat->func(areas, offset, + lfloat->func(areas, offset, slave_areas, slave_offset, pcm->channels, size, lfloat->int32_idx, lfloat->float32_idx); @@ -339,7 +339,7 @@ snd_pcm_lfloat_read_areas(snd_pcm_t *pcm, static void snd_pcm_lfloat_dump(snd_pcm_t *pcm, snd_output_t *out) { snd_pcm_lfloat_t *lfloat = pcm->private_data; - snd_output_printf(out, "Linear Integer <-> Linear Float conversion PCM (%s)\n", + snd_output_printf(out, "Linear Integer <-> Linear Float conversion PCM (%s)\n", snd_pcm_format_name(lfloat->sformat)); if (pcm->setup) { snd_output_printf(out, "Its setup is:\n"); @@ -415,7 +415,7 @@ int snd_pcm_lfloat_open(snd_pcm_t **pcmp, const char *name, snd_pcm_format_t sfo snd_pcm_set_hw_ptr(pcm, &lfloat->plug.hw_ptr, -1, 0); snd_pcm_set_appl_ptr(pcm, &lfloat->plug.appl_ptr, -1, 0); *pcmp = pcm; - + return 0; } @@ -429,15 +429,15 @@ match for both of them. \code pcm.name { - type lfloat # Linear<->Float conversion PCM - slave STR # Slave name - # or - slave { # Slave definition - pcm STR # Slave PCM name - # or - pcm { } # Slave PCM definition - format STR # Slave format - } + type lfloat # Linear<->Float conversion PCM + slave STR # Slave name + # or + slave { # Slave definition + pcm STR # Slave PCM name + # or + pcm { } # Slave PCM definition + format STR # Slave format + } } \endcode @@ -464,7 +464,7 @@ pcm.name { * changed in future. */ int _snd_pcm_lfloat_open(snd_pcm_t **pcmp, const char *name, - snd_config_t *root, snd_config_t *conf, + snd_config_t *root, snd_config_t *conf, snd_pcm_stream_t stream, int mode) { snd_config_iterator_t i, next; @@ -528,7 +528,7 @@ int snd_pcm_lfloat_open(snd_pcm_t **pcmp ATTRIBUTE_UNUSED, int _snd_pcm_lfloat_open(snd_pcm_t **pcmp ATTRIBUTE_UNUSED, const char *name ATTRIBUTE_UNUSED, snd_config_t *root ATTRIBUTE_UNUSED, - snd_config_t *conf ATTRIBUTE_UNUSED, + snd_config_t *conf ATTRIBUTE_UNUSED, snd_pcm_stream_t stream ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED) { diff --git a/src/pcm/pcm_linear.c b/src/pcm/pcm_linear.c index 9084eef6..9944bc86 100644 --- a/src/pcm/pcm_linear.c +++ b/src/pcm/pcm_linear.c @@ -25,7 +25,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ - + #include "pcm_local.h" #include "pcm_plugin.h" #include "plugin_ops.h" @@ -78,7 +78,7 @@ int snd_pcm_linear_convert_index(snd_pcm_format_t src_format, int snd_pcm_linear_get_index(snd_pcm_format_t src_format, snd_pcm_format_t dst_format) { int sign, width, pwidth, endian; - sign = (snd_pcm_format_signed(src_format) != + sign = (snd_pcm_format_signed(src_format) != snd_pcm_format_signed(dst_format)); #ifdef SND_LITTLE_ENDIAN endian = snd_pcm_format_big_endian(src_format); @@ -112,7 +112,7 @@ int snd_pcm_linear_get_index(snd_pcm_format_t src_format, snd_pcm_format_t dst_f int snd_pcm_linear_put_index(snd_pcm_format_t src_format, snd_pcm_format_t dst_format) { int sign, width, pwidth, endian; - sign = (snd_pcm_format_signed(src_format) != + sign = (snd_pcm_format_signed(src_format) != snd_pcm_format_signed(dst_format)); #ifdef SND_LITTLE_ENDIAN endian = snd_pcm_format_big_endian(dst_format); @@ -264,7 +264,7 @@ static int snd_pcm_linear_hw_refine_schange(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd return err; return 0; } - + static int snd_pcm_linear_hw_refine_cchange(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_hw_params_t *params, snd_pcm_hw_params_t *sparams) { @@ -344,12 +344,12 @@ snd_pcm_linear_write_areas(snd_pcm_t *pcm, size = *slave_sizep; if (linear->use_getput) snd_pcm_linear_getput(slave_areas, slave_offset, - areas, offset, + areas, offset, pcm->channels, size, linear->get_idx, linear->put_idx); else snd_pcm_linear_convert(slave_areas, slave_offset, - areas, offset, + areas, offset, pcm->channels, size, linear->conv_idx); *slave_sizep = size; return size; @@ -368,12 +368,12 @@ snd_pcm_linear_read_areas(snd_pcm_t *pcm, if (size > *slave_sizep) size = *slave_sizep; if (linear->use_getput) - snd_pcm_linear_getput(areas, offset, + snd_pcm_linear_getput(areas, offset, slave_areas, slave_offset, pcm->channels, size, linear->get_idx, linear->put_idx); else - snd_pcm_linear_convert(areas, offset, + snd_pcm_linear_convert(areas, offset, slave_areas, slave_offset, pcm->channels, size, linear->conv_idx); *slave_sizep = size; @@ -383,7 +383,7 @@ snd_pcm_linear_read_areas(snd_pcm_t *pcm, static void snd_pcm_linear_dump(snd_pcm_t *pcm, snd_output_t *out) { snd_pcm_linear_t *linear = pcm->private_data; - snd_output_printf(out, "Linear conversion PCM (%s)\n", + snd_output_printf(out, "Linear conversion PCM (%s)\n", snd_pcm_format_name(linear->sformat)); if (pcm->setup) { snd_output_printf(out, "Its setup is:\n"); @@ -472,15 +472,15 @@ slave PCM. The channel count, format and rate must match for both of them. \code pcm.name { - type linear # Linear conversion PCM - slave STR # Slave name - # or - slave { # Slave definition - pcm STR # Slave PCM name - # or - pcm { } # Slave PCM definition - format STR # Slave format - } + type linear # Linear conversion PCM + slave STR # Slave name + # or + slave { # Slave definition + pcm STR # Slave PCM name + # or + pcm { } # Slave PCM definition + format STR # Slave format + } } \endcode @@ -507,7 +507,7 @@ pcm.name { * changed in future. */ int _snd_pcm_linear_open(snd_pcm_t **pcmp, const char *name, - snd_config_t *root, snd_config_t *conf, + snd_config_t *root, snd_config_t *conf, snd_pcm_stream_t stream, int mode) { snd_config_iterator_t i, next; diff --git a/src/pcm/pcm_local.h b/src/pcm/pcm_local.h index 152c92c3..881451eb 100644 --- a/src/pcm/pcm_local.h +++ b/src/pcm/pcm_local.h @@ -401,9 +401,9 @@ snd_pcm_sframes_t snd_pcm_mmap_readi(snd_pcm_t *pcm, void *buffer, snd_pcm_ufram snd_pcm_sframes_t snd_pcm_mmap_writen(snd_pcm_t *pcm, void **bufs, snd_pcm_uframes_t size); snd_pcm_sframes_t snd_pcm_mmap_readn(snd_pcm_t *pcm, void **bufs, snd_pcm_uframes_t size); -typedef snd_pcm_sframes_t (*snd_pcm_xfer_areas_func_t)(snd_pcm_t *pcm, +typedef snd_pcm_sframes_t (*snd_pcm_xfer_areas_func_t)(snd_pcm_t *pcm, const snd_pcm_channel_area_t *areas, - snd_pcm_uframes_t offset, + snd_pcm_uframes_t offset, snd_pcm_uframes_t size); snd_pcm_sframes_t snd_pcm_read_areas(snd_pcm_t *pcm, const snd_pcm_channel_area_t *areas, @@ -606,13 +606,13 @@ static inline const snd_pcm_channel_area_t *snd_pcm_mmap_areas(snd_pcm_t *pcm) static inline snd_pcm_uframes_t snd_pcm_mmap_offset(snd_pcm_t *pcm) { - assert(pcm); + assert(pcm); return *pcm->appl.ptr % pcm->buffer_size; } static inline snd_pcm_uframes_t snd_pcm_mmap_hw_offset(snd_pcm_t *pcm) { - assert(pcm); + assert(pcm); return *pcm->hw.ptr % pcm->buffer_size; } @@ -1079,7 +1079,7 @@ const snd_config_t *snd_pcm_rate_get_default_converter(snd_config_t *root); (1U << (SND_PCM_FORMAT_U18_3LE - 32)) | \ (1U << (SND_PCM_FORMAT_S18_3BE - 32)) | \ (1U << (SND_PCM_FORMAT_U18_3BE - 32))) } - + #define SND_PCM_FMTBIT_FLOAT \ { ((1U << SND_PCM_FORMAT_FLOAT_LE) | \ diff --git a/src/pcm/pcm_meter.c b/src/pcm/pcm_meter.c index 05649a92..c027194d 100644 --- a/src/pcm/pcm_meter.c +++ b/src/pcm/pcm_meter.c @@ -25,7 +25,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ - + #include "pcm_local.h" #include "pcm_plugin.h" @@ -93,7 +93,7 @@ static void snd_pcm_meter_add_frames(snd_pcm_t *pcm, n = dst_cont; if (n > src_cont) n = src_cont; - snd_pcm_areas_copy(meter->buf_areas, dst_offset, + snd_pcm_areas_copy(meter->buf_areas, dst_offset, areas, src_offset, pcm->channels, n, pcm->format); frames -= n; @@ -259,7 +259,7 @@ static void *snd_pcm_meter_thread(void *data) if (scope->enabled) scope->ops->update(scope); } - nanosleep(&meter->delay, NULL); + nanosleep(&meter->delay, NULL); } list_for_each(pos, &meter->scopes) { scope = list_entry(pos, snd_pcm_scope_t, list); @@ -404,7 +404,7 @@ static int snd_pcm_meter_hw_refine_schange(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_ return err; return 0; } - + static int snd_pcm_meter_hw_refine_cchange(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_hw_params_t *params, snd_pcm_hw_params_t *sparams) { @@ -716,14 +716,14 @@ pcm_scope.name { } pcm.name { - type meter # Meter PCM - slave STR # Slave name - # or - slave { # Slave definition - pcm STR # Slave PCM name - # or - pcm { } # Slave PCM definition - } + type meter # Meter PCM + slave STR # Slave name + # or + slave { # Slave definition + pcm STR # Slave PCM name + # or + pcm { } # Slave PCM definition + } [frequency INT] # Updates per second scopes { ID STR # Scope name (see pcm_scope) @@ -756,7 +756,7 @@ pcm.name { * changed in future. */ int _snd_pcm_meter_open(snd_pcm_t **pcmp, const char *name, - snd_config_t *root, snd_config_t *conf, + snd_config_t *root, snd_config_t *conf, snd_pcm_stream_t stream, int mode) { snd_config_iterator_t i, next; @@ -1174,7 +1174,7 @@ static const snd_pcm_scope_ops_t s16_ops = { * \param scopep Pointer to newly created and added scope * \return 0 on success otherwise a negative error code * - * s16 pseudo scope convert #SND_PCM_TYPE_METER PCM frames in CPU endian + * s16 pseudo scope convert #SND_PCM_TYPE_METER PCM frames in CPU endian * 16 bit frames for use with other scopes. Don't forget to insert it before * and to not insert it more time (see #snd_pcm_meter_search_scope) */ diff --git a/src/pcm/pcm_misc.c b/src/pcm/pcm_misc.c index 8a00d1c4..570ecd97 100644 --- a/src/pcm/pcm_misc.c +++ b/src/pcm/pcm_misc.c @@ -18,7 +18,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ - + #include "pcm_local.h" #include "bswap.h" #include @@ -519,7 +519,7 @@ uint64_t snd_pcm_format_silence_64(snd_pcm_format_t format) return bswap_64(u.i); #endif } - case SNDRV_PCM_FORMAT_FLOAT_BE: + case SNDRV_PCM_FORMAT_FLOAT_BE: { union { float f[2]; @@ -547,7 +547,7 @@ uint64_t snd_pcm_format_silence_64(snd_pcm_format_t format) } case SNDRV_PCM_FORMAT_IEC958_SUBFRAME_LE: case SNDRV_PCM_FORMAT_IEC958_SUBFRAME_BE: - return 0; + return 0; case SNDRV_PCM_FORMAT_MU_LAW: return 0x7f7f7f7f7f7f7f7fULL; case SNDRV_PCM_FORMAT_A_LAW: diff --git a/src/pcm/pcm_mmap.c b/src/pcm/pcm_mmap.c index 88b1f45f..ba8d9504 100644 --- a/src/pcm/pcm_mmap.c +++ b/src/pcm/pcm_mmap.c @@ -85,8 +85,8 @@ static snd_pcm_sframes_t snd_pcm_mmap_write_areas(snd_pcm_t *pcm, __snd_pcm_mmap_begin(pcm, &pcm_areas, &pcm_offset, &frames); snd_pcm_areas_copy(pcm_areas, pcm_offset, - areas, offset, - pcm->channels, + areas, offset, + pcm->channels, frames, pcm->format); result = __snd_pcm_mmap_commit(pcm, pcm_offset, frames); if (result < 0) @@ -114,11 +114,11 @@ static snd_pcm_sframes_t snd_pcm_mmap_read_areas(snd_pcm_t *pcm, snd_pcm_uframes_t pcm_offset; snd_pcm_uframes_t frames = size; snd_pcm_sframes_t result; - + __snd_pcm_mmap_begin(pcm, &pcm_areas, &pcm_offset, &frames); snd_pcm_areas_copy(areas, offset, pcm_areas, pcm_offset, - pcm->channels, + pcm->channels, frames, pcm->format); result = __snd_pcm_mmap_commit(pcm, pcm_offset, frames); if (result < 0) @@ -255,7 +255,7 @@ int snd_pcm_channel_info_shm(snd_pcm_t *pcm, snd_pcm_channel_info_t *info, int s } else info->type = SND_PCM_AREA_LOCAL; return 0; -} +} int snd_pcm_mmap(snd_pcm_t *pcm) { @@ -306,12 +306,12 @@ int snd_pcm_mmap(snd_pcm_t *pcm) size_t size; unsigned int c1; if (i->addr) { - a->addr = i->addr; - a->first = i->first; - a->step = i->step; - continue; - } - size = i->first + i->step * (pcm->buffer_size - 1) + pcm->sample_bits; + a->addr = i->addr; + a->first = i->first; + a->step = i->step; + continue; + } + size = i->first + i->step * (pcm->buffer_size - 1) + pcm->sample_bits; for (c1 = c + 1; c1 < pcm->channels; ++c1) { snd_pcm_channel_info_t *i1 = &pcm->mmap_channels[c1]; size_t s; @@ -415,7 +415,7 @@ int snd_pcm_mmap(snd_pcm_t *pcm) switch (i1->type) { case SND_PCM_AREA_MMAP: if (i1->u.mmap.fd != i->u.mmap.fd || - i1->u.mmap.offset != i->u.mmap.offset) + i1->u.mmap.offset != i->u.mmap.offset) continue; break; case SND_PCM_AREA_SHM: @@ -425,7 +425,7 @@ int snd_pcm_mmap(snd_pcm_t *pcm) case SND_PCM_AREA_LOCAL: if (pcm->access != SND_PCM_ACCESS_MMAP_INTERLEAVED && pcm->access != SND_PCM_ACCESS_RW_INTERLEAVED) - continue; + continue; break; default: assert(0); diff --git a/src/pcm/pcm_mmap_emul.c b/src/pcm/pcm_mmap_emul.c index b0bf61e0..40821974 100644 --- a/src/pcm/pcm_mmap_emul.c +++ b/src/pcm/pcm_mmap_emul.c @@ -25,7 +25,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ - + #include "pcm_local.h" #include "pcm_generic.h" diff --git a/src/pcm/pcm_mulaw.c b/src/pcm/pcm_mulaw.c index 1dd8b613..c6705b2d 100644 --- a/src/pcm/pcm_mulaw.c +++ b/src/pcm/pcm_mulaw.c @@ -25,7 +25,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ - + #include "pcm_local.h" #include "pcm_plugin.h" #include "plugin_ops.h" @@ -287,7 +287,7 @@ static int snd_pcm_mulaw_hw_refine_schange(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_ return err; return 0; } - + static int snd_pcm_mulaw_hw_refine_cchange(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_hw_params_t *params, snd_pcm_hw_params_t *sparams) { @@ -365,7 +365,7 @@ snd_pcm_mulaw_write_areas(snd_pcm_t *pcm, if (size > *slave_sizep) size = *slave_sizep; mulaw->func(slave_areas, slave_offset, - areas, offset, + areas, offset, pcm->channels, size, mulaw->getput_idx); *slave_sizep = size; @@ -384,7 +384,7 @@ snd_pcm_mulaw_read_areas(snd_pcm_t *pcm, snd_pcm_mulaw_t *mulaw = pcm->private_data; if (size > *slave_sizep) size = *slave_sizep; - mulaw->func(areas, offset, + mulaw->func(areas, offset, slave_areas, slave_offset, pcm->channels, size, mulaw->getput_idx); @@ -395,7 +395,7 @@ snd_pcm_mulaw_read_areas(snd_pcm_t *pcm, static void snd_pcm_mulaw_dump(snd_pcm_t *pcm, snd_output_t *out) { snd_pcm_mulaw_t *mulaw = pcm->private_data; - snd_output_printf(out, "Mu-Law conversion PCM (%s)\n", + snd_output_printf(out, "Mu-Law conversion PCM (%s)\n", snd_pcm_format_name(mulaw->sformat)); if (pcm->setup) { snd_output_printf(out, "Its setup is:\n"); @@ -484,15 +484,15 @@ format and rate must match for both of them. \code pcm.name { - type mulaw # Mu-Law conversion PCM - slave STR # Slave name - # or - slave { # Slave definition - pcm STR # Slave PCM name - # or - pcm { } # Slave PCM definition - format STR # Slave format - } + type mulaw # Mu-Law conversion PCM + slave STR # Slave name + # or + slave { # Slave definition + pcm STR # Slave PCM name + # or + pcm { } # Slave PCM definition + format STR # Slave format + } } \endcode @@ -519,7 +519,7 @@ pcm.name { * changed in future. */ int _snd_pcm_mulaw_open(snd_pcm_t **pcmp, const char *name, - snd_config_t *root, snd_config_t *conf, + snd_config_t *root, snd_config_t *conf, snd_pcm_stream_t stream, int mode) { snd_config_iterator_t i, next; diff --git a/src/pcm/pcm_multi.c b/src/pcm/pcm_multi.c index 1bdc0657..7a601763 100644 --- a/src/pcm/pcm_multi.c +++ b/src/pcm/pcm_multi.c @@ -25,7 +25,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ - + #include "pcm_local.h" #include "pcm_generic.h" #include @@ -208,7 +208,7 @@ static int snd_pcm_multi_hw_refine_schange(snd_pcm_t *pcm ATTRIBUTE_UNUSED, return err; return 0; } - + static int snd_pcm_multi_hw_refine_cchange(snd_pcm_t *pcm ATTRIBUTE_UNUSED, unsigned int slave_idx ATTRIBUTE_UNUSED, snd_pcm_hw_params_t *params, @@ -523,7 +523,7 @@ static int snd_pcm_multi_reset(snd_pcm_t *pcm) for (i = 0; i < multi->slaves_count; ++i) { /* Reset each slave, as well as in prepare */ err = snd_pcm_reset(multi->slaves[i].pcm); - if (err < 0) + if (err < 0) result = err; } multi->hw_ptr = multi->appl_ptr = 0; @@ -735,7 +735,7 @@ static int snd_pcm_multi_resume(snd_pcm_t *pcm) * including the first one has to be relinked to the given master. */ static int snd_pcm_multi_link_slaves(snd_pcm_t *pcm, snd_pcm_t *master) -{ +{ snd_pcm_multi_t *multi = pcm->private_data; unsigned int i; int err; @@ -993,7 +993,7 @@ static void snd_pcm_multi_dump(snd_pcm_t *pcm, snd_output_t *out) snd_pcm_multi_channel_t *c = &multi->channels[k]; if (c->slave_idx < 0) continue; - snd_output_printf(out, " %d: slave %d, channel %d\n", + snd_output_printf(out, " %d: slave %d, channel %d\n", k, c->slave_idx, c->slave_channel); } if (pcm->setup) { @@ -1097,7 +1097,7 @@ int snd_pcm_multi_open(snd_pcm_t **pcmp, const char *name, } stream = slaves_pcm[0]->stream; - + multi->slaves_count = slaves_count; multi->master_slave = master_slave; multi->slaves = calloc(slaves_count, sizeof(*multi->slaves)); @@ -1160,8 +1160,8 @@ This plugin converts multiple streams to one. \code pcm.name { - type multi # Multiple streams conversion PCM - slaves { # Slaves definition + type multi # Multiple streams conversion PCM + slaves { # Slaves definition ID STR # Slave PCM name # or ID { @@ -1170,7 +1170,7 @@ pcm.name { pcm { } # Slave PCM definition channels INT # Slave channels } - } + } bindings { # Bindings table N { slave STR # Slave key @@ -1412,7 +1412,7 @@ int _snd_pcm_multi_open(snd_pcm_t **pcmp, const char *name, err = -EINVAL; goto _free; } - if (schannel < 0 || + if (schannel < 0 || (unsigned int) schannel >= slaves_channels[slave]) { snd_error(PCM, "Invalid or missing schannel for channel %s", id); err = -EINVAL; @@ -1421,7 +1421,7 @@ int _snd_pcm_multi_open(snd_pcm_t **pcmp, const char *name, channels_sidx[cchannel] = slave; channels_schannel[cchannel] = schannel; } - + for (idx = 0; idx < slaves_count; ++idx) { err = snd_pcm_open_slave(&slaves_pcm[idx], root, slaves_conf[idx], stream, mode, diff --git a/src/pcm/pcm_null.c b/src/pcm/pcm_null.c index 47f423a8..fe545ff1 100644 --- a/src/pcm/pcm_null.c +++ b/src/pcm/pcm_null.c @@ -25,7 +25,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ - + #include "pcm_local.h" #include "pcm_plugin.h" #include "bswap.h" @@ -82,11 +82,11 @@ static int snd_pcm_null_info(snd_pcm_t *pcm, snd_pcm_info_t * info) static snd_pcm_sframes_t snd_pcm_null_avail_update(snd_pcm_t *pcm) { snd_pcm_null_t *null = pcm->private_data; - if (null->state == SND_PCM_STATE_PREPARED) { - /* it is required to return the correct avail count for */ - /* the prepared stream, otherwise the start is not called */ - return snd_pcm_mmap_avail(pcm); - } + if (null->state == SND_PCM_STATE_PREPARED) { + /* it is required to return the correct avail count for */ + /* the prepared stream, otherwise the start is not called */ + return snd_pcm_mmap_avail(pcm); + } return pcm->buffer_size; } @@ -403,7 +403,7 @@ int snd_pcm_null_open(snd_pcm_t **pcmp, const char *name, snd_pcm_stream_t strea } null->poll_fd = fd; null->state = SND_PCM_STATE_OPEN; - + err = snd_pcm_new(&pcm, SND_PCM_TYPE_NULL, name, stream, mode); if (err < 0) { close(fd); @@ -434,7 +434,7 @@ and /dev/full (capture, must be readable). \code pcm.name { - type null # Null PCM + type null # Null PCM [chmap MAP] # Provide channel maps; MAP is a string array } \endcode @@ -462,7 +462,7 @@ pcm.name { * changed in future. */ int _snd_pcm_null_open(snd_pcm_t **pcmp, const char *name, - snd_config_t *root ATTRIBUTE_UNUSED, snd_config_t *conf, + snd_config_t *root ATTRIBUTE_UNUSED, snd_config_t *conf, snd_pcm_stream_t stream, int mode) { snd_config_iterator_t i, next; diff --git a/src/pcm/pcm_params.c b/src/pcm/pcm_params.c index deca344f..833d0dc9 100644 --- a/src/pcm/pcm_params.c +++ b/src/pcm/pcm_params.c @@ -18,7 +18,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ - + #include "pcm_local.h" #ifndef NDEBUG @@ -124,7 +124,7 @@ void _snd_pcm_hw_params_any(snd_pcm_hw_params_t *params) params->info = ~0U; } -/* Return the value for field PAR if it's fixed in configuration space +/* Return the value for field PAR if it's fixed in configuration space defined by PARAMS. Return -EINVAL otherwise */ int snd_pcm_hw_param_get(const snd_pcm_hw_params_t *params, snd_pcm_hw_param_t var, @@ -267,12 +267,12 @@ static int _snd_pcm_hw_param_set_integer(snd_pcm_hw_params_t *params, } return changed; } - -/* Inside configuration space defined by PARAMS remove from PAR all + +/* Inside configuration space defined by PARAMS remove from PAR all non integer values. Reduce configuration space accordingly. Return -EINVAL if the configuration space is empty */ -int snd_pcm_hw_param_set_integer(snd_pcm_t *pcm, +int snd_pcm_hw_param_set_integer(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_set_mode_t mode, snd_pcm_hw_param_t var) @@ -328,12 +328,12 @@ static int _snd_pcm_hw_param_set_first(snd_pcm_hw_params_t *params, } -/* Inside configuration space defined by PARAMS remove from PAR all +/* Inside configuration space defined by PARAMS remove from PAR all values > minimum. Reduce configuration space accordingly. Return the minimum. */ -int snd_pcm_hw_param_set_first(snd_pcm_t *pcm, - snd_pcm_hw_params_t *params, +int snd_pcm_hw_param_set_first(snd_pcm_t *pcm, + snd_pcm_hw_params_t *params, snd_pcm_hw_param_t var, unsigned int *rval, int *dir) { @@ -370,11 +370,11 @@ static int _snd_pcm_hw_param_set_last(snd_pcm_hw_params_t *params, } -/* Inside configuration space defined by PARAMS remove from PAR all +/* Inside configuration space defined by PARAMS remove from PAR all values < maximum. Reduce configuration space accordingly. Return the maximum. */ -int snd_pcm_hw_param_set_last(snd_pcm_t *pcm, +int snd_pcm_hw_param_set_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_hw_param_t var, unsigned int *rval, int *dir) @@ -422,7 +422,7 @@ int _snd_pcm_hw_param_set_min(snd_pcm_hw_params_t *params, return changed; } -/* Inside configuration space defined by PARAMS remove from PAR all +/* Inside configuration space defined by PARAMS remove from PAR all values < VAL. Reduce configuration space accordingly. Return new minimum or -EINVAL if the configuration space is empty */ @@ -499,7 +499,7 @@ int _snd_pcm_hw_param_set_max(snd_pcm_hw_params_t *params, return changed; } -/* Inside configuration space defined by PARAMS remove from PAR all +/* Inside configuration space defined by PARAMS remove from PAR all values >= VAL + 1. Reduce configuration space accordingly. Return new maximum or -EINVAL if the configuration space is empty */ @@ -610,7 +610,7 @@ int _snd_pcm_hw_param_set_minmax(snd_pcm_hw_params_t *params, return changed; } -/* Inside configuration space defined by PARAMS remove from PAR all +/* Inside configuration space defined by PARAMS remove from PAR all values < MIN and all values > MAX. Reduce configuration space accordingly. Return 0 or -EINVAL if the configuration space is empty */ @@ -636,7 +636,7 @@ int snd_pcm_hw_param_set_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, assert(0); return -EINVAL; } - err = _snd_pcm_hw_param_set_minmax(params, var, + err = _snd_pcm_hw_param_set_minmax(params, var, *min, mindir ? *mindir : 0, *max, maxdir ? *maxdir : 0); if (err < 0) @@ -707,7 +707,7 @@ int _snd_pcm_hw_param_set(snd_pcm_hw_params_t *params, return changed; } -/* Inside configuration space defined by PARAMS remove from PAR all +/* Inside configuration space defined by PARAMS remove from PAR all values != VAL. Reduce configuration space accordingly. Return -EINVAL if the configuration space is empty */ @@ -845,7 +845,7 @@ int snd_pcm_hw_param_set_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, dump_hw_params(params, "set_near", var, *val, err); return err; } - + if (err >= 0) { snd_pcm_hw_params_t params1; if (min == saved_min && mindir == valdir) @@ -887,7 +887,7 @@ int snd_pcm_hw_param_set_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, Return the value found. */ int snd_pcm_hw_param_set_next(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, - snd_pcm_hw_param_t var, + snd_pcm_hw_param_t var, unsigned int best, int bestdir, unsigned int val, int *dir) { @@ -1110,7 +1110,7 @@ static int snd_pcm_hw_params_choose(snd_pcm_t *pcm, snd_pcm_hw_params_t *params) if (err >= 0) err = snd_pcm_hw_param_get_max(params, SND_PCM_HW_PARAM_PERIOD_TIME, &max, &dir); if (err >= 0 && (long)min < pcm->minperiodtime && - (long)max > pcm->minperiodtime) { + (long)max > pcm->minperiodtime) { min = pcm->minperiodtime; dir = 1; snd_pcm_hw_param_set_min(pcm, params, SND_CHANGE, SND_PCM_HW_PARAM_PERIOD_TIME, &min, &dir); } @@ -1187,7 +1187,7 @@ int _snd_pcm_hw_param_refine(snd_pcm_hw_params_t *params, } return changed; } - + #if 0 static void _snd_pcm_hw_param_copy(snd_pcm_hw_params_t *params, snd_pcm_hw_param_t var, const snd_pcm_hw_params_t *src) @@ -1474,7 +1474,7 @@ unsigned int snd_pcm_hw_strategy_simple_near_min_badness(const snd_pcm_hw_params diff = -diff; return diff * p->mul; } - + int snd_pcm_hw_strategy_simple_near_next_value(snd_pcm_hw_params_t *params, snd_pcm_hw_param_t var, int value, int *dir, @@ -1510,7 +1510,7 @@ unsigned int snd_pcm_hw_strategy_simple_choices_min_badness(const snd_pcm_hw_par assert(0); return UINT_MAX; } - + int snd_pcm_hw_strategy_simple_choices_next_value(snd_pcm_hw_params_t *params, snd_pcm_hw_param_t var, int value, int *dir, @@ -1638,7 +1638,7 @@ int snd_pcm_hw_params_try_explain_failure1(snd_pcm_t *pcm, i = *success; _snd_pcm_hw_param_copy(&i, var, fail); err = snd_pcm_hw_refine(pcm, &i); - if (err == 0 && + if (err == 0 && snd_pcm_hw_params_try_explain_failure1(pcm, fail, &i, depth - 1, out) < 0) continue; snd_output_printf(out, "%s: ", snd_pcm_hw_param_name(var)); @@ -1801,133 +1801,133 @@ static const snd_pcm_hw_rule_t refine_rules[] = { .private_data = 0, }, { - .var = SND_PCM_HW_PARAM_SAMPLE_BITS, + .var = SND_PCM_HW_PARAM_SAMPLE_BITS, .func = snd_pcm_hw_rule_sample_bits, - .deps = { SND_PCM_HW_PARAM_FORMAT, + .deps = { SND_PCM_HW_PARAM_FORMAT, SND_PCM_HW_PARAM_SAMPLE_BITS, -1 }, .private_data = 0, }, { - .var = SND_PCM_HW_PARAM_SAMPLE_BITS, + .var = SND_PCM_HW_PARAM_SAMPLE_BITS, .func = snd_pcm_hw_rule_div, .deps = { SND_PCM_HW_PARAM_FRAME_BITS, SND_PCM_HW_PARAM_CHANNELS, -1 }, .private_data = 0, }, { - .var = SND_PCM_HW_PARAM_FRAME_BITS, + .var = SND_PCM_HW_PARAM_FRAME_BITS, .func = snd_pcm_hw_rule_mul, .deps = { SND_PCM_HW_PARAM_SAMPLE_BITS, SND_PCM_HW_PARAM_CHANNELS, -1 }, .private_data = 0, }, { - .var = SND_PCM_HW_PARAM_FRAME_BITS, + .var = SND_PCM_HW_PARAM_FRAME_BITS, .func = snd_pcm_hw_rule_mulkdiv, .deps = { SND_PCM_HW_PARAM_PERIOD_BYTES, SND_PCM_HW_PARAM_PERIOD_SIZE, -1 }, .private_data = (void*) 8, }, { - .var = SND_PCM_HW_PARAM_FRAME_BITS, + .var = SND_PCM_HW_PARAM_FRAME_BITS, .func = snd_pcm_hw_rule_mulkdiv, .deps = { SND_PCM_HW_PARAM_BUFFER_BYTES, SND_PCM_HW_PARAM_BUFFER_SIZE, -1 }, .private_data = (void*) 8, }, { - .var = SND_PCM_HW_PARAM_CHANNELS, + .var = SND_PCM_HW_PARAM_CHANNELS, .func = snd_pcm_hw_rule_div, .deps = { SND_PCM_HW_PARAM_FRAME_BITS, SND_PCM_HW_PARAM_SAMPLE_BITS, -1 }, .private_data = 0, }, { - .var = SND_PCM_HW_PARAM_RATE, + .var = SND_PCM_HW_PARAM_RATE, .func = snd_pcm_hw_rule_mulkdiv, .deps = { SND_PCM_HW_PARAM_PERIOD_SIZE, SND_PCM_HW_PARAM_PERIOD_TIME, -1 }, .private_data = (void*) 1000000, }, { - .var = SND_PCM_HW_PARAM_RATE, + .var = SND_PCM_HW_PARAM_RATE, .func = snd_pcm_hw_rule_mulkdiv, .deps = { SND_PCM_HW_PARAM_BUFFER_SIZE, SND_PCM_HW_PARAM_BUFFER_TIME, -1 }, .private_data = (void*) 1000000, }, { - .var = SND_PCM_HW_PARAM_PERIODS, + .var = SND_PCM_HW_PARAM_PERIODS, .func = snd_pcm_hw_rule_div, .deps = { SND_PCM_HW_PARAM_BUFFER_SIZE, SND_PCM_HW_PARAM_PERIOD_SIZE, -1 }, .private_data = 0, }, { - .var = SND_PCM_HW_PARAM_PERIOD_SIZE, + .var = SND_PCM_HW_PARAM_PERIOD_SIZE, .func = snd_pcm_hw_rule_div, .deps = { SND_PCM_HW_PARAM_BUFFER_SIZE, SND_PCM_HW_PARAM_PERIODS, -1 }, .private_data = 0, }, { - .var = SND_PCM_HW_PARAM_PERIOD_SIZE, + .var = SND_PCM_HW_PARAM_PERIOD_SIZE, .func = snd_pcm_hw_rule_mulkdiv, .deps = { SND_PCM_HW_PARAM_PERIOD_BYTES, SND_PCM_HW_PARAM_FRAME_BITS, -1 }, .private_data = (void*) 8, }, { - .var = SND_PCM_HW_PARAM_PERIOD_SIZE, + .var = SND_PCM_HW_PARAM_PERIOD_SIZE, .func = snd_pcm_hw_rule_muldivk, .deps = { SND_PCM_HW_PARAM_PERIOD_TIME, SND_PCM_HW_PARAM_RATE, -1 }, .private_data = (void*) 1000000, }, { - .var = SND_PCM_HW_PARAM_BUFFER_SIZE, + .var = SND_PCM_HW_PARAM_BUFFER_SIZE, .func = snd_pcm_hw_rule_mul, .deps = { SND_PCM_HW_PARAM_PERIOD_SIZE, SND_PCM_HW_PARAM_PERIODS, -1 }, .private_data = 0, }, { - .var = SND_PCM_HW_PARAM_BUFFER_SIZE, + .var = SND_PCM_HW_PARAM_BUFFER_SIZE, .func = snd_pcm_hw_rule_mulkdiv, .deps = { SND_PCM_HW_PARAM_BUFFER_BYTES, SND_PCM_HW_PARAM_FRAME_BITS, -1 }, .private_data = (void*) 8, }, { - .var = SND_PCM_HW_PARAM_BUFFER_SIZE, + .var = SND_PCM_HW_PARAM_BUFFER_SIZE, .func = snd_pcm_hw_rule_muldivk, .deps = { SND_PCM_HW_PARAM_BUFFER_TIME, SND_PCM_HW_PARAM_RATE, -1 }, .private_data = (void*) 1000000, }, { - .var = SND_PCM_HW_PARAM_PERIOD_BYTES, + .var = SND_PCM_HW_PARAM_PERIOD_BYTES, .func = snd_pcm_hw_rule_muldivk, .deps = { SND_PCM_HW_PARAM_PERIOD_SIZE, SND_PCM_HW_PARAM_FRAME_BITS, -1 }, .private_data = (void*) 8, }, { - .var = SND_PCM_HW_PARAM_BUFFER_BYTES, + .var = SND_PCM_HW_PARAM_BUFFER_BYTES, .func = snd_pcm_hw_rule_muldivk, .deps = { SND_PCM_HW_PARAM_BUFFER_SIZE, SND_PCM_HW_PARAM_FRAME_BITS, -1 }, .private_data = (void*) 8, }, { - .var = SND_PCM_HW_PARAM_PERIOD_TIME, + .var = SND_PCM_HW_PARAM_PERIOD_TIME, .func = snd_pcm_hw_rule_mulkdiv, .deps = { SND_PCM_HW_PARAM_PERIOD_SIZE, SND_PCM_HW_PARAM_RATE, -1 }, .private_data = (void*) 1000000, }, { - .var = SND_PCM_HW_PARAM_BUFFER_TIME, + .var = SND_PCM_HW_PARAM_BUFFER_TIME, .func = snd_pcm_hw_rule_mulkdiv, .deps = { SND_PCM_HW_PARAM_BUFFER_SIZE, SND_PCM_HW_PARAM_RATE, -1 }, @@ -2015,7 +2015,7 @@ static const snd_mask_t refine_masks[SND_PCM_HW_PARAM_LAST_MASK - SND_PCM_HW_PAR }, }, }; - + static const snd_interval_t refine_intervals[SND_PCM_HW_PARAM_LAST_INTERVAL - SND_PCM_HW_PARAM_FIRST_INTERVAL + 1] = { [SND_PCM_HW_PARAM_SAMPLE_BITS - SND_PCM_HW_PARAM_FIRST_INTERVAL] = { .min = 1, .max = UINT_MAX, @@ -2433,14 +2433,14 @@ int _snd_pcm_hw_params_internal(snd_pcm_t *pcm, snd_pcm_hw_params_t *params) min_align *= 2; } pcm->min_align = min_align; - + pcm->hw_flags = params->flags; pcm->info = params->info; pcm->msbits = params->msbits; pcm->rate_num = params->rate_num; pcm->rate_den = params->rate_den; pcm->fifo_size = params->fifo_size; - + /* Default sw params */ memset(&sw, 0, sizeof(sw)); err = snd_pcm_sw_params_default(pcm, &sw); @@ -2450,7 +2450,7 @@ int _snd_pcm_hw_params_internal(snd_pcm_t *pcm, snd_pcm_hw_params_t *params) if (err < 0) return err; - if (pcm->mmap_rw || + if (pcm->mmap_rw || pcm->access == SND_PCM_ACCESS_MMAP_INTERLEAVED || pcm->access == SND_PCM_ACCESS_MMAP_NONINTERLEAVED || pcm->access == SND_PCM_ACCESS_MMAP_COMPLEX) { diff --git a/src/pcm/pcm_plug.c b/src/pcm/pcm_plug.c index 1bae89d0..5172a7d2 100644 --- a/src/pcm/pcm_plug.c +++ b/src/pcm/pcm_plug.c @@ -25,7 +25,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ - + #include "pcm_local.h" #include "pcm_plugin.h" @@ -85,7 +85,7 @@ static int snd_pcm_plug_info(snd_pcm_t *pcm, snd_pcm_info_t *info) snd_pcm_plug_t *plug = pcm->private_data; snd_pcm_t *slave = plug->req_slave; int err; - + if ((err = snd_pcm_info(slave, info)) < 0) return err; return 0; @@ -743,7 +743,7 @@ static int snd_pcm_plug_hw_refine_sprepare(snd_pcm_t *pcm, snd_pcm_hw_params_t * { snd_pcm_plug_t *plug = pcm->private_data; int err; - + _snd_pcm_hw_params_any(sparams); if (plug->sformat >= 0) { _snd_pcm_hw_params_set_format(sparams, plug->sformat); @@ -782,7 +782,7 @@ static int check_access_change(snd_pcm_hw_params_t *cparams, /* no mmap support - we need mmap emulation */ if (!snd_pcm_access_mask_test(smask, SND_PCM_ACCESS_RW_INTERLEAVED) && - !snd_pcm_access_mask_test(smask, SND_PCM_ACCESS_RW_NONINTERLEAVED)) + !snd_pcm_access_mask_test(smask, SND_PCM_ACCESS_RW_NONINTERLEAVED)) return -EINVAL; /* even no RW access? no way! */ cmask = (const snd_pcm_access_mask_t *) @@ -832,7 +832,7 @@ static int snd_pcm_plug_hw_refine_schange(snd_pcm_t *pcm, snd_pcm_hw_params_t *p if (err < 0) return err; } - + if (plug->schannels == -2 || (pcm->mode & SND_PCM_NO_AUTO_CHANNELS)) links |= SND_PCM_HW_PARBIT_CHANNELS; else { @@ -909,7 +909,7 @@ static int snd_pcm_plug_hw_refine_schange(snd_pcm_t *pcm, snd_pcm_hw_params_t *p return err; return 0; } - + static int snd_pcm_plug_hw_refine_cchange(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_hw_params_t *params, snd_pcm_hw_params_t *sparams) @@ -964,8 +964,8 @@ static int snd_pcm_plug_hw_refine_cchange(snd_pcm_t *pcm ATTRIBUTE_UNUSED, } return -EINVAL; } - - err = _snd_pcm_hw_param_set_mask(params, + + err = _snd_pcm_hw_param_set_mask(params, SND_PCM_HW_PARAM_FORMAT, &fmt_mask); if (err < 0) return err; @@ -978,7 +978,7 @@ static int snd_pcm_plug_hw_refine_cchange(snd_pcm_t *pcm ATTRIBUTE_UNUSED, else { unsigned int rate_min, srate_min; int rate_mindir, srate_mindir; - + /* This is a temporary hack, waiting for a better solution */ err = snd_pcm_hw_param_get_min(params, SND_PCM_HW_PARAM_RATE, &rate_min, &rate_mindir); if (err < 0) @@ -1172,7 +1172,7 @@ int snd_pcm_plug_open(snd_pcm_t **pcmp, plug->tt_ssize = tt_ssize; plug->tt_cused = tt_cused; plug->tt_sused = tt_sused; - + err = snd_pcm_new(&pcm, SND_PCM_TYPE_PLUG, name, slave->stream, slave->mode); if (err < 0) { free(plug); @@ -1210,17 +1210,17 @@ This plugin converts channels, rate and format on request. \code pcm.name { - type plug # Automatic conversion PCM - slave STR # Slave name - # or - slave { # Slave definition - pcm STR # Slave PCM name - # or - pcm { } # Slave PCM definition + type plug # Automatic conversion PCM + slave STR # Slave name + # or + slave { # Slave definition + pcm STR # Slave PCM name + # or + pcm { } # Slave PCM definition [format STR] # Slave format (default nearest) or "unchanged" [channels INT] # Slave channels (default nearest) or "unchanged" [rate INT] # Slave rate (default nearest) or "unchanged" - } + } route_policy STR # route policy for automatic ttable generation # STR can be 'default', 'average', 'copy', 'duplicate' # average: result is average of input channels @@ -1263,7 +1263,7 @@ pcm.name { * changed in future. */ int _snd_pcm_plug_open(snd_pcm_t **pcmp, const char *name, - snd_config_t *root, snd_config_t *conf, + snd_config_t *root, snd_config_t *conf, snd_pcm_stream_t stream, int mode) { snd_config_iterator_t i, next; @@ -1357,7 +1357,7 @@ int _snd_pcm_plug_open(snd_pcm_t **pcmp, const char *name, } } #endif - + #ifdef BUILD_PCM_PLUGIN_RATE if (! rate_converter) rate_converter = snd_pcm_rate_get_default_converter(root); diff --git a/src/pcm/pcm_plugin.c b/src/pcm/pcm_plugin.c index 100e12a7..4fb5345b 100644 --- a/src/pcm/pcm_plugin.c +++ b/src/pcm/pcm_plugin.c @@ -81,7 +81,7 @@ pcm.rate44100Hz { \endcode */ - + #include "pcm_local.h" #include "pcm_plugin.h" #include @@ -197,8 +197,8 @@ snd_pcm_sframes_t snd_pcm_plugin_rewind(snd_pcm_t *pcm, snd_pcm_uframes_t frames frames = n; if (frames == 0) return 0; - - sframes = frames; + + sframes = frames; sframes = snd_pcm_rewind(plugin->gen.slave, sframes); if (sframes < 0) return sframes; @@ -221,8 +221,8 @@ snd_pcm_sframes_t snd_pcm_plugin_forward(snd_pcm_t *pcm, snd_pcm_uframes_t frame frames = n; if (frames == 0) return 0; - - sframes = frames; + + sframes = frames; sframes = INTERNAL(snd_pcm_forward)(plugin->gen.slave, sframes); if (sframes < 0) return sframes; @@ -246,7 +246,7 @@ static snd_pcm_sframes_t snd_pcm_plugin_write_areas(snd_pcm_t *pcm, const snd_pcm_channel_area_t *slave_areas; snd_pcm_uframes_t slave_offset; snd_pcm_uframes_t slave_frames = ULONG_MAX; - + result = snd_pcm_mmap_begin(slave, &slave_areas, &slave_offset, &slave_frames); if (result < 0) { err = result; @@ -298,13 +298,13 @@ static snd_pcm_sframes_t snd_pcm_plugin_read_areas(snd_pcm_t *pcm, snd_pcm_uframes_t xfer = 0; snd_pcm_sframes_t result; int err; - + while (size > 0) { snd_pcm_uframes_t frames = size; const snd_pcm_channel_area_t *slave_areas; snd_pcm_uframes_t slave_offset; snd_pcm_uframes_t slave_frames = ULONG_MAX; - + result = snd_pcm_mmap_begin(slave, &slave_areas, &slave_offset, &slave_frames); if (result < 0) { err = result; @@ -324,7 +324,7 @@ static snd_pcm_sframes_t snd_pcm_plugin_read_areas(snd_pcm_t *pcm, result = snd_pcm_mmap_commit(slave, slave_offset, slave_frames); if (result > 0 && (snd_pcm_uframes_t)result != slave_frames) { snd_pcm_sframes_t res; - + res = plugin->undo_read(slave, areas, offset, frames, slave_frames - result); if (res < 0) { err = res; @@ -353,7 +353,7 @@ snd_pcm_plugin_writei(snd_pcm_t *pcm, const void *buffer, snd_pcm_uframes_t size { snd_pcm_channel_area_t areas[pcm->channels]; snd_pcm_areas_from_buf(pcm, areas, (void*)buffer); - return snd_pcm_write_areas(pcm, areas, 0, size, + return snd_pcm_write_areas(pcm, areas, 0, size, snd_pcm_plugin_write_areas); } @@ -427,7 +427,7 @@ snd_pcm_plugin_mmap_commit(snd_pcm_t *pcm, result = snd_pcm_mmap_commit(slave, slave_offset, slave_frames); if (result > 0 && (snd_pcm_uframes_t)result != slave_frames) { snd_pcm_sframes_t res; - + res = plugin->undo_write(pcm, slave_areas, slave_offset + result, slave_frames, slave_frames - result); if (res < 0) { err = res; @@ -532,8 +532,8 @@ static snd_pcm_sframes_t snd_pcm_plugin_sync_hw_ptr(snd_pcm_t *pcm, pcm->access != SND_PCM_ACCESS_RW_INTERLEAVED && pcm->access != SND_PCM_ACCESS_RW_NONINTERLEAVED) return snd_pcm_plugin_sync_hw_ptr_capture(pcm, slave_size); - *pcm->hw.ptr = slave_hw_ptr; - return slave_size; + *pcm->hw.ptr = slave_hw_ptr; + return slave_size; } static snd_pcm_sframes_t snd_pcm_plugin_avail_update(snd_pcm_t *pcm) diff --git a/src/pcm/pcm_plugin.h b/src/pcm/pcm_plugin.h index 9896ee8e..1062d9c5 100644 --- a/src/pcm/pcm_plugin.h +++ b/src/pcm/pcm_plugin.h @@ -18,16 +18,16 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ - + #include "pcm_generic.h" typedef snd_pcm_uframes_t (*snd_pcm_slave_xfer_areas_func_t) - (snd_pcm_t *pcm, + (snd_pcm_t *pcm, const snd_pcm_channel_area_t *areas, - snd_pcm_uframes_t offset, + snd_pcm_uframes_t offset, snd_pcm_uframes_t size, const snd_pcm_channel_area_t *slave_areas, - snd_pcm_uframes_t slave_offset, + snd_pcm_uframes_t slave_offset, snd_pcm_uframes_t *slave_sizep); typedef snd_pcm_sframes_t (*snd_pcm_slave_xfer_areas_undo_func_t) @@ -45,7 +45,7 @@ typedef struct { snd_pcm_slave_xfer_areas_undo_func_t undo_write; int (*init)(snd_pcm_t *pcm); snd_pcm_uframes_t appl_ptr, hw_ptr; -} snd_pcm_plugin_t; +} snd_pcm_plugin_t; /* make local functions really local */ #define snd_pcm_plugin_init \ diff --git a/src/pcm/pcm_rate.c b/src/pcm/pcm_rate.c index 3e2a2dcb..85bde241 100644 --- a/src/pcm/pcm_rate.c +++ b/src/pcm/pcm_rate.c @@ -195,7 +195,7 @@ static int snd_pcm_rate_hw_refine_schange(snd_pcm_t *pcm, snd_pcm_hw_params_t *p return err; return 0; } - + static int snd_pcm_rate_hw_refine_cchange(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_hw_params_t *sparams) { @@ -237,10 +237,10 @@ static int snd_pcm_rate_hw_refine_cchange(snd_pcm_t *pcm, snd_pcm_hw_params_t *p period_size->openmin && period_size->openmax && period_size->min + 1 == period_size->max) { if (period_size->min > 0 && (buffer_size->min / period_size->min) * period_size->min == buffer_size->min) { - snd_interval_set_value(period_size, period_size->min); - } else if ((buffer_size->max / period_size->max) * period_size->max == buffer_size->max) { - snd_interval_set_value(period_size, period_size->max); - } + snd_interval_set_value(period_size, period_size->min); + } else if ((buffer_size->max / period_size->max) * period_size->max == buffer_size->max) { + snd_interval_set_value(period_size, period_size->max); + } } } #ifdef DEBUG_REFINE @@ -266,7 +266,7 @@ static int snd_pcm_rate_hw_refine_cchange(snd_pcm_t *pcm, snd_pcm_hw_params_t *p return 0; } -static int snd_pcm_rate_hw_refine(snd_pcm_t *pcm, +static int snd_pcm_rate_hw_refine(snd_pcm_t *pcm, snd_pcm_hw_params_t *params) { return snd_pcm_hw_refine_slave(pcm, params, @@ -756,15 +756,15 @@ static snd_pcm_sframes_t snd_pcm_rate_forwardable(snd_pcm_t *pcm ATTRIBUTE_UNUSE } static snd_pcm_sframes_t snd_pcm_rate_rewind(snd_pcm_t *pcm ATTRIBUTE_UNUSED, - snd_pcm_uframes_t frames ATTRIBUTE_UNUSED) + snd_pcm_uframes_t frames ATTRIBUTE_UNUSED) { - return 0; + return 0; } static snd_pcm_sframes_t snd_pcm_rate_forward(snd_pcm_t *pcm ATTRIBUTE_UNUSED, - snd_pcm_uframes_t frames ATTRIBUTE_UNUSED) + snd_pcm_uframes_t frames ATTRIBUTE_UNUSED) { - return 0; + return 0; } static int snd_pcm_rate_commit_area(snd_pcm_t *pcm, snd_pcm_rate_t *rate, @@ -845,7 +845,7 @@ static int snd_pcm_rate_commit_area(snd_pcm_t *pcm, snd_pcm_rate_t *rate, if (xfer == slave_size) goto commit_done; - + /* commit second fragment */ cont = slave_size - cont; slave_frames = cont; @@ -958,7 +958,7 @@ static int snd_pcm_rate_grab_next_period(snd_pcm_t *pcm, snd_pcm_uframes_t hw_of } #endif snd_pcm_areas_copy(rate->sareas, xfer, - slave_areas, slave_offset, + slave_areas, slave_offset, pcm->channels, cont, rate->gen.slave->format); result = snd_pcm_mmap_commit(rate->gen.slave, slave_offset, cont); @@ -1046,7 +1046,7 @@ static snd_pcm_sframes_t snd_pcm_rate_avail_update_capture(snd_pcm_t *pcm, snd_pcm_rate_t *rate = pcm->private_data; snd_pcm_t *slave = rate->gen.slave; snd_pcm_uframes_t xfer, hw_offset, size; - + xfer = snd_pcm_mmap_capture_avail(pcm); size = pcm->buffer_size - xfer; hw_offset = snd_pcm_mmap_hw_offset(pcm); @@ -1197,7 +1197,7 @@ static int snd_pcm_rate_start(snd_pcm_t *pcm) { snd_pcm_rate_t *rate = pcm->private_data; snd_pcm_sframes_t avail; - + if (pcm->stream == SND_PCM_STREAM_CAPTURE) return snd_pcm_start(rate->gen.slave); @@ -1253,10 +1253,10 @@ static void snd_pcm_rate_dump(snd_pcm_t *pcm, snd_output_t *out) { snd_pcm_rate_t *rate = pcm->private_data; if (rate->sformat == SND_PCM_FORMAT_UNKNOWN) - snd_output_printf(out, "Rate conversion PCM (%d)\n", + snd_output_printf(out, "Rate conversion PCM (%d)\n", rate->srate); else - snd_output_printf(out, "Rate conversion PCM (%d, sformat=%s)\n", + snd_output_printf(out, "Rate conversion PCM (%d, sformat=%s)\n", rate->srate, snd_pcm_format_name(rate->sformat)); if (rate->ops.dump) @@ -1627,15 +1627,15 @@ This plugin converts a stream rate. The input and output formats must be linear. \code pcm.name { type rate # Rate PCM - slave STR # Slave name - # or - slave { # Slave definition - pcm STR # Slave PCM name - # or - pcm { } # Slave PCM definition - rate INT # Slave rate - [format STR] # Slave format - } + slave STR # Slave name + # or + slave { # Slave definition + pcm STR # Slave PCM name + # or + pcm { } # Slave PCM definition + rate INT # Slave rate + [format STR] # Slave format + } converter STR # optional # or converter [ STR1 STR2 ... ] # optional @@ -1672,7 +1672,7 @@ pcm.name { * changed in future. */ int _snd_pcm_rate_open(snd_pcm_t **pcmp, const char *name, - snd_config_t *root, snd_config_t *conf, + snd_config_t *root, snd_config_t *conf, snd_pcm_stream_t stream, int mode) { snd_config_iterator_t i, next; @@ -1713,7 +1713,7 @@ int _snd_pcm_rate_open(snd_pcm_t **pcmp, const char *name, return err; if (sformat != SND_PCM_FORMAT_UNKNOWN && snd_pcm_format_linear(sformat) != 1) { - snd_config_delete(sconf); + snd_config_delete(sconf); snd_error(PCM, "slave format is not linear"); return -EINVAL; } diff --git a/src/pcm/pcm_rate_linear.c b/src/pcm/pcm_rate_linear.c index f4fc0afc..913a192a 100644 --- a/src/pcm/pcm_rate_linear.c +++ b/src/pcm/pcm_rate_linear.c @@ -1,6 +1,6 @@ /* * Linear rate converter plugin - * + * * Copyright (c) 2000 by Abramo Bagnara * 2004 by Jaroslav Kysela * 2006 by Takashi Iwai @@ -83,7 +83,7 @@ static void linear_expand(struct rate_linear *rate, unsigned int dst_frames1; int16_t sample = 0; unsigned int pos; - + for (channel = 0; channel < rate->channels; ++channel) { const snd_pcm_channel_area_t *src_area = &src_areas[channel]; const snd_pcm_channel_area_t *dst_area = &dst_areas[channel]; @@ -129,7 +129,7 @@ static void linear_expand(struct rate_linear *rate, src += src_step; src_frames1++; } - } + } rate->old_sample[channel] = new_sample; } } @@ -146,7 +146,7 @@ static void linear_expand_s16(struct rate_linear *rate, unsigned int dst_frames1; unsigned int get_threshold = rate->pitch; unsigned int pos; - + for (channel = 0; channel < rate->channels; ++channel) { const snd_pcm_channel_area_t *src_area = &src_areas[channel]; const snd_pcm_channel_area_t *dst_area = &dst_areas[channel]; @@ -181,7 +181,7 @@ static void linear_expand_s16(struct rate_linear *rate, src += src_step; src_frames1++; } - } + } rate->old_sample[channel] = new_sample; } } @@ -223,7 +223,7 @@ static void linear_shrink(struct rate_linear *rate, src_frames1 = 0; dst_frames1 = 0; while (src_frames1 < src_frames) { - + goto *get; #define GET16_END after_get #include "plugin_ops.h" @@ -285,7 +285,7 @@ static void linear_shrink_s16(struct rate_linear *rate, src_frames1 = 0; dst_frames1 = 0; while (src_frames1 < src_frames) { - + new_sample = *src; src += src_step; src_frames1++; @@ -307,7 +307,7 @@ static void linear_shrink_s16(struct rate_linear *rate, } } -static void linear_convert(void *obj, +static void linear_convert(void *obj, const snd_pcm_channel_area_t *dst_areas, snd_pcm_uframes_t dst_offset, unsigned int dst_frames, const snd_pcm_channel_area_t *src_areas, @@ -364,7 +364,7 @@ static int linear_adjust_pitch(void *obj, snd_pcm_rate_info_t *info) rate->pitch = (((uint64_t)info->out.period_size * LINEAR_DIV) + (info->in.period_size/2) ) / info->in.period_size; - + cframes = input_frames(rate, info->out.period_size); while (cframes != info->in.period_size) { snd_pcm_uframes_t cframes_new; diff --git a/src/pcm/pcm_route.c b/src/pcm/pcm_route.c index 15a28bb3..2fd84e83 100644 --- a/src/pcm/pcm_route.c +++ b/src/pcm/pcm_route.c @@ -25,7 +25,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ - + #include "pcm_local.h" #include "pcm_plugin.h" #include "plugin_ops.h" @@ -155,7 +155,7 @@ static void snd_pcm_route_convert1_one(const snd_pcm_channel_area_t *dst_area, frames, ttable, params); return; } - + conv = conv_labels[params->conv_idx]; src = snd_pcm_channel_area_addr(src_area, src_offset); dst = snd_pcm_channel_area_addr(dst_area, dst_offset); @@ -206,7 +206,7 @@ static void snd_pcm_route_convert1_one_getput(const snd_pcm_channel_area_t *dst_ frames, ttable, params); return; } - + get = get32_labels[params->get_idx]; put = put32_labels[params->put_idx]; src = snd_pcm_channel_area_addr(src_area, src_offset); @@ -315,7 +315,7 @@ static void snd_pcm_route_convert1_many(const snd_pcm_channel_area_t *dst_area, /* Zero sum */ goto *zero; - zero_int64: + zero_int64: sum.as_sint64 = 0; goto zero_end; #if SND_PCM_PLUGIN_ROUTE_FLOAT @@ -326,7 +326,7 @@ static void snd_pcm_route_convert1_many(const snd_pcm_channel_area_t *dst_area, zero_end: for (srcidx = 0; srcidx < nsrcs; ++srcidx) { const char *src = srcs[srcidx]; - + /* Get sample */ goto *get32; #define GET32_END after_get @@ -356,7 +356,7 @@ static void snd_pcm_route_convert1_many(const snd_pcm_channel_area_t *dst_area, srcs[srcidx] += src_steps[srcidx]; ttp++; } - + /* Normalization */ goto *norm; norm_int64_att: @@ -383,14 +383,14 @@ static void snd_pcm_route_convert1_many(const snd_pcm_channel_area_t *dst_area, goto after_norm; #endif after_norm: - + /* Put sample */ goto *put32; #define PUT32_END after_put32 #include "plugin_ops.h" #undef PUT32_END after_put32: - + dst += dst_step; } } @@ -499,7 +499,7 @@ static int snd_pcm_route_hw_refine_schange(snd_pcm_t *pcm, snd_pcm_hw_params_t * SND_PCM_HW_PARBIT_BUFFER_TIME | SND_PCM_HW_PARBIT_TICK_TIME); if (route->sformat == SND_PCM_FORMAT_UNKNOWN) - links |= (SND_PCM_HW_PARBIT_FORMAT | + links |= (SND_PCM_HW_PARBIT_FORMAT | SND_PCM_HW_PARBIT_SUBFORMAT | SND_PCM_HW_PARBIT_SAMPLE_BITS); if (route->schannels < 0) @@ -509,7 +509,7 @@ static int snd_pcm_route_hw_refine_schange(snd_pcm_t *pcm, snd_pcm_hw_params_t * return err; return 0; } - + static int snd_pcm_route_hw_refine_cchange(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_hw_params_t *sparams) { @@ -523,7 +523,7 @@ static int snd_pcm_route_hw_refine_cchange(snd_pcm_t *pcm, snd_pcm_hw_params_t * SND_PCM_HW_PARBIT_BUFFER_TIME | SND_PCM_HW_PARBIT_TICK_TIME); if (route->sformat == SND_PCM_FORMAT_UNKNOWN) - links |= (SND_PCM_HW_PARBIT_FORMAT | + links |= (SND_PCM_HW_PARBIT_FORMAT | SND_PCM_HW_PARBIT_SUBFORMAT | SND_PCM_HW_PARBIT_SAMPLE_BITS); if (route->schannels < 0) @@ -599,7 +599,7 @@ snd_pcm_route_write_areas(snd_pcm_t *pcm, if (size > *slave_sizep) size = *slave_sizep; snd_pcm_route_convert(slave_areas, slave_offset, - areas, offset, + areas, offset, pcm->channels, slave->channels, size, &route->params); @@ -620,7 +620,7 @@ snd_pcm_route_read_areas(snd_pcm_t *pcm, snd_pcm_t *slave = route->plug.gen.slave; if (size > *slave_sizep) size = *slave_sizep; - snd_pcm_route_convert(areas, offset, + snd_pcm_route_convert(areas, offset, slave_areas, slave_offset, slave->channels, pcm->channels, @@ -686,7 +686,7 @@ static void snd_pcm_route_dump(snd_pcm_t *pcm, snd_output_t *out) if (route->sformat == SND_PCM_FORMAT_UNKNOWN) snd_output_printf(out, "Route conversion PCM\n"); else - snd_output_printf(out, "Route conversion PCM (sformat=%s)\n", + snd_output_printf(out, "Route conversion PCM (sformat=%s)\n", snd_pcm_format_name(route->sformat)); snd_output_puts(out, " Transformation table:\n"); for (dst = 0; dst < route->params.ndsts; dst++) { @@ -1025,7 +1025,7 @@ int snd_pcm_route_open(snd_pcm_t **pcmp, const char *name, snd_pcm_route_t *route; int err; assert(pcmp && slave && ttable); - if (sformat != SND_PCM_FORMAT_UNKNOWN && + if (sformat != SND_PCM_FORMAT_UNKNOWN && snd_pcm_format_linear(sformat) != 1) return -EINVAL; route = calloc(1, sizeof(snd_pcm_route_t)); @@ -1166,7 +1166,7 @@ static int _snd_pcm_route_load_ttable(snd_config_t *tt, snd_pcm_route_ttable_ent if (snd_config_get_id(in, &id) < 0) continue; err = safe_strtol(id, &cchannel); - if (err < 0 || + if (err < 0 || cchannel < 0 || (unsigned int) cchannel > tt_csize) { snd_error(PCM, "Invalid client channel: %s", id); return -EINVAL; @@ -1245,22 +1245,22 @@ If so, a matching channel map will be selected for the slave. \code pcm.name { - type route # Route & Volume conversion PCM - slave STR # Slave name - # or - slave { # Slave definition - pcm STR # Slave PCM name - # or - pcm { } # Slave PCM definition - [format STR] # Slave format - [channels INT] # Slave channels - } - ttable { # Transfer table (bi-dimensional compound of cchannels * schannels numbers) - CCHANNEL { - SCHANNEL REAL # route value (0.0 - 1.0) - } - } - [chmap MAP] # Override channel maps; MAP is a string array + type route # Route & Volume conversion PCM + slave STR # Slave name + # or + slave { # Slave definition + pcm STR # Slave PCM name + # or + pcm { } # Slave PCM definition + [format STR] # Slave format + [channels INT] # Slave channels + } + ttable { # Transfer table (bi-dimensional compound of cchannels * schannels numbers) + CCHANNEL { + SCHANNEL REAL # route value (0.0 - 1.0) + } + } + [chmap MAP] # Override channel maps; MAP is a string array } \endcode @@ -1287,7 +1287,7 @@ pcm.name { * changed in future. */ int _snd_pcm_route_open(snd_pcm_t **pcmp, const char *name, - snd_config_t *root, snd_config_t *conf, + snd_config_t *root, snd_config_t *conf, snd_pcm_stream_t stream, int mode) { snd_config_iterator_t i, next; @@ -1352,7 +1352,7 @@ int _snd_pcm_route_open(snd_pcm_t **pcmp, const char *name, } if (sformat != SND_PCM_FORMAT_UNKNOWN && snd_pcm_format_linear(sformat) != 1) { - snd_config_delete(sconf); + snd_config_delete(sconf); snd_error(PCM, "slave format is not linear"); snd_pcm_free_chmaps(chmaps); return -EINVAL; diff --git a/src/pcm/pcm_share.c b/src/pcm/pcm_share.c index 0b22c58d..7927b646 100644 --- a/src/pcm/pcm_share.c +++ b/src/pcm/pcm_share.c @@ -25,7 +25,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ - + #include "pcm_local.h" #include #include @@ -122,7 +122,7 @@ static snd_pcm_uframes_t snd_pcm_share_slave_avail(snd_pcm_share_slave_t *slave) { snd_pcm_sframes_t avail; snd_pcm_t *pcm = slave->pcm; - avail = slave->hw_ptr - *pcm->appl.ptr; + avail = slave->hw_ptr - *pcm->appl.ptr; if (pcm->stream == SND_PCM_STREAM_PLAYBACK) avail += pcm->buffer_size; if (avail < 0) @@ -188,7 +188,7 @@ static snd_pcm_uframes_t _snd_pcm_share_slave_forward(snd_pcm_share_slave_t *sla } -/* +/* - stop PCM on xrun - update poll status - draining silencing @@ -566,7 +566,7 @@ static int snd_pcm_share_hw_refine_schange(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_ return err; return 0; } - + static int snd_pcm_share_hw_refine_cchange(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_hw_params_t *params, snd_pcm_hw_params_t *sparams) { @@ -635,7 +635,7 @@ static int snd_pcm_share_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t *params) if (err < 0) goto _err; err = _snd_pcm_hw_param_set_minmax(params, SND_PCM_HW_PARAM_RATE, - spcm->rate, 0, + spcm->rate, 0, spcm->rate, 1); if (err < 0) goto _err; @@ -1253,7 +1253,7 @@ static int snd_pcm_share_drop(snd_pcm_t *pcm) assert(0); break; } - + share->appl_ptr = share->hw_ptr = 0; _end: Pthread_mutex_unlock(&slave->mutex); @@ -1435,7 +1435,7 @@ int snd_pcm_share_open(snd_pcm_t **pcmp, const char *name, const char *sname, free(share); return -errno; } - + if (stream == SND_PCM_STREAM_PLAYBACK) { int bufsize = 1; err = setsockopt(sd[0], SOL_SOCKET, SO_SNDBUF, &bufsize, sizeof(bufsize)); @@ -1533,7 +1533,7 @@ int snd_pcm_share_open(snd_pcm_t **pcmp, const char *name, const char *sname, share->pcm = pcm; share->client_socket = sd[0]; share->slave_socket = sd[1]; - + pcm->mmap_rw = 1; pcm->ops = &snd_pcm_share_ops; pcm->fast_ops = &snd_pcm_share_fast_ops; @@ -1569,17 +1569,17 @@ doesn't need the explicit server but access to the shared buffer. \code pcm.name { - type share # Share PCM - slave STR # Slave name - # or - slave { # Slave definition - pcm STR # Slave PCM name - [format STR] # Slave format - [channels INT] # Slave channels - [rate INT] # Slave rate - [period_time INT] # Slave period time in us - [buffer_time INT] # Slave buffer time in us - } + type share # Share PCM + slave STR # Slave name + # or + slave { # Slave definition + pcm STR # Slave PCM name + [format STR] # Slave format + [channels INT] # Slave channels + [rate INT] # Slave rate + [period_time INT] # Slave period time in us + [buffer_time INT] # Slave buffer time in us + } bindings { N INT # Slave channel INT for client channel N } @@ -1624,7 +1624,7 @@ int _snd_pcm_share_open(snd_pcm_t **pcmp, const char *name, int srate = -1; int speriod_time= -1, sbuffer_time = -1; unsigned int schannel_max = 0; - + snd_config_for_each(i, next, conf) { snd_config_t *n = snd_config_iterator_entry(i); const char *id; @@ -1720,7 +1720,7 @@ int _snd_pcm_share_open(snd_pcm_t **pcmp, const char *name, } if (schannels <= 0) schannels = schannel_max + 1; - err = snd_pcm_share_open(pcmp, name, sname, sformat, srate, + err = snd_pcm_share_open(pcmp, name, sname, sformat, srate, (unsigned int) schannels, speriod_time, sbuffer_time, channels, channels_map, stream, mode); diff --git a/src/pcm/pcm_shm.c b/src/pcm/pcm_shm.c index a523f237..c0f904eb 100644 --- a/src/pcm/pcm_shm.c +++ b/src/pcm/pcm_shm.c @@ -25,7 +25,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ - + #include "pcm_local.h" #include #include @@ -91,7 +91,7 @@ static int snd_pcm_shm_new_rbptr(snd_pcm_t *pcm, snd_pcm_shm_t *shm, size_t mmap_size, mmap_offset, offset; int fd; long result; - + shm->ctrl->cmd = &pcm->hw == rbptr ? SND_PCM_IOCTL_HW_PTR_FD : SND_PCM_IOCTL_APPL_PTR_FD; result = snd_pcm_shm_action_fd0(pcm, &fd); if (result < 0) @@ -240,7 +240,7 @@ static int snd_pcm_shm_hw_refine_schange(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pc return err; return 0; } - + static int snd_pcm_shm_hw_refine_cchange(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_hw_params_t *params, snd_pcm_hw_params_t *sparams) { @@ -283,7 +283,7 @@ static int snd_pcm_shm_hw_refine(snd_pcm_t *pcm, snd_pcm_hw_params_t *params) snd_pcm_shm_hw_refine_slave); } -static int snd_pcm_shm_hw_params_slave(snd_pcm_t *pcm, +static int snd_pcm_shm_hw_params_slave(snd_pcm_t *pcm, snd_pcm_hw_params_t *params) { snd_pcm_shm_t *shm = pcm->private_data; @@ -644,7 +644,7 @@ static int make_local_socket(const char *filename) snd_errornum(PCM, "socket failed"); return -errno; } - + addr->sun_family = AF_LOCAL; memcpy(addr->sun_path, filename, l); @@ -732,7 +732,7 @@ int snd_pcm_shm_open(snd_pcm_t **pcmp, const char *name, result = -errno; goto _err; } - + shm = calloc(1, sizeof(snd_pcm_shm_t)); if (!shm) { result = -ENOMEM; @@ -781,7 +781,7 @@ performance. \code pcm.name { - type shm # Shared memory PCM + type shm # Shared memory PCM server STR # Server name pcm STR # PCM name } diff --git a/src/pcm/pcm_simple.c b/src/pcm/pcm_simple.c index a991315a..c0bc1a2a 100644 --- a/src/pcm/pcm_simple.c +++ b/src/pcm/pcm_simple.c @@ -58,7 +58,7 @@ static int set_hw_params(snd_pcm_t *pcm, /* * hardware parameters - */ + */ err = snd_pcm_hw_params_any(pcm, hw_params); if (err < 0) return err; @@ -93,7 +93,7 @@ static int set_hw_params(snd_pcm_t *pcm, err = INTERNAL(snd_pcm_hw_params_get_period_time)(hw_params, period_time, NULL); if (err < 0) return err; - } + } } else { err = snd_pcm_hw_params_set_period_time(pcm, hw_params, *period_time, 0); if (err < 0) @@ -105,15 +105,15 @@ static int set_hw_params(snd_pcm_t *pcm, if (err < 0) return err; return 0; -} +} static int set_sw_params(snd_pcm_t *pcm, snd_pcm_sw_params_t *sw_params, - snd_spcm_xrun_type_t xrun_type) + snd_spcm_xrun_type_t xrun_type) { int err; - err = snd_pcm_sw_params_current(pcm, sw_params); + err = snd_pcm_sw_params_current(pcm, sw_params); if (err < 0) return err; err = snd_pcm_sw_params_set_start_threshold(pcm, sw_params, (pcm->buffer_size / pcm->period_size) * pcm->period_size); @@ -236,10 +236,10 @@ int snd_spcm_init_duplex(snd_pcm_t *playback_pcm, /* * hardware parameters */ - err = set_buffer_time(latency, &xbuffer_time); + err = set_buffer_time(latency, &xbuffer_time); if (err < 0) return err; - + for (i = 0; i < 2; i++) { buffer_time[i] = xbuffer_time; period_time[i] = i > 0 ? period_time[0] : 0; diff --git a/src/pcm/pcm_softvol.c b/src/pcm/pcm_softvol.c index 71ed8a46..ec8ca223 100644 --- a/src/pcm/pcm_softvol.c +++ b/src/pcm/pcm_softvol.c @@ -294,7 +294,7 @@ static inline short MULTI_DIV_short(short a, unsigned int b, int swap) } \ } \ } while (0) - + #define GET_VOL_SCALE \ switch (ch) { \ case 0: \ @@ -349,7 +349,7 @@ static void softvol_convert_stereo_vol(snd_pcm_softvol_t *svol, case SND_PCM_FORMAT_S16_LE: case SND_PCM_FORMAT_S16_BE: /* 16bit samples */ - CONVERT_AREA(short, + CONVERT_AREA(short, !snd_pcm_format_cpu_endian(svol->sformat)); break; case SND_PCM_FORMAT_S32_LE: @@ -404,7 +404,7 @@ static void softvol_convert_mono_vol(snd_pcm_softvol_t *svol, case SND_PCM_FORMAT_S16_LE: case SND_PCM_FORMAT_S16_BE: /* 16bit samples */ - CONVERT_AREA(short, + CONVERT_AREA(short, !snd_pcm_format_cpu_endian(svol->sformat)); break; case SND_PCM_FORMAT_S32_LE: @@ -475,7 +475,7 @@ static int snd_pcm_softvol_hw_refine_cprepare(snd_pcm_t *pcm, (1ULL << SND_PCM_FORMAT_S16_BE) | (1ULL << SND_PCM_FORMAT_S24_LE) | (1ULL << SND_PCM_FORMAT_S32_LE) | - (1ULL << SND_PCM_FORMAT_S32_BE), + (1ULL << SND_PCM_FORMAT_S32_BE), (1ULL << (SND_PCM_FORMAT_S24_3LE - 32)) } }; @@ -562,7 +562,7 @@ static int snd_pcm_softvol_hw_refine_schange(snd_pcm_t *pcm, SND_PCM_HW_PARBIT_BUFFER_TIME | SND_PCM_HW_PARBIT_TICK_TIME); if (svol->sformat == SND_PCM_FORMAT_UNKNOWN) - links |= (SND_PCM_HW_PARBIT_FORMAT | + links |= (SND_PCM_HW_PARBIT_FORMAT | SND_PCM_HW_PARBIT_SUBFORMAT | SND_PCM_HW_PARBIT_SAMPLE_BITS); err = _snd_pcm_hw_params_refine(sparams, links, params); @@ -575,7 +575,7 @@ static int snd_pcm_softvol_hw_refine_schange(snd_pcm_t *pcm, return 0; } - + static int snd_pcm_softvol_hw_refine_cchange(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_hw_params_t *sparams) @@ -591,7 +591,7 @@ static int snd_pcm_softvol_hw_refine_cchange(snd_pcm_t *pcm, SND_PCM_HW_PARBIT_BUFFER_TIME | SND_PCM_HW_PARBIT_TICK_TIME); if (svol->sformat == SND_PCM_FORMAT_UNKNOWN) - links |= (SND_PCM_HW_PARBIT_FORMAT | + links |= (SND_PCM_HW_PARBIT_FORMAT | SND_PCM_HW_PARBIT_SUBFORMAT | SND_PCM_HW_PARBIT_SAMPLE_BITS); err = _snd_pcm_hw_params_refine(params, links, sparams); @@ -628,7 +628,7 @@ static int snd_pcm_softvol_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t * param return err; if (slave->format != SND_PCM_FORMAT_S16_LE && slave->format != SND_PCM_FORMAT_S16_BE && - slave->format != SND_PCM_FORMAT_S24_3LE && + slave->format != SND_PCM_FORMAT_S24_3LE && slave->format != SND_PCM_FORMAT_S24_LE && slave->format != SND_PCM_FORMAT_S32_LE && slave->format != SND_PCM_FORMAT_S32_BE) { @@ -727,7 +727,7 @@ static int add_user_ctl(snd_pcm_softvol_t *svol, snd_ctl_elem_info_t *cinfo, int err; int i; unsigned int def_val; - + if (svol->max_val == 1) { snd_ctl_elem_info_set_read_write(cinfo, 1, 1); err = snd_ctl_add_boolean_elem_set(svol->ctl, cinfo, 1, count); @@ -795,7 +795,7 @@ static int softvol_load_control(snd_pcm_t *pcm, snd_pcm_softvol_t *svol, else svol->zero_dB_val = (min_dB / (min_dB - max_dB)) * svol->max_val; - + snd_ctl_elem_info_set_id(&cinfo, ctl_id); if ((err = snd_ctl_elem_info(svol->ctl, &cinfo)) < 0) { if (err != -ENOENT) { @@ -926,7 +926,7 @@ int snd_pcm_softvol_open(snd_pcm_t **pcmp, const char *name, if (sformat != SND_PCM_FORMAT_UNKNOWN && sformat != SND_PCM_FORMAT_S16_LE && sformat != SND_PCM_FORMAT_S16_BE && - sformat != SND_PCM_FORMAT_S24_3LE && + sformat != SND_PCM_FORMAT_S24_3LE && sformat != SND_PCM_FORMAT_S24_LE && sformat != SND_PCM_FORMAT_S32_LE && sformat != SND_PCM_FORMAT_S32_BE) @@ -1101,17 +1101,17 @@ any changes. \code pcm.name { - type softvol # Soft Volume conversion PCM - slave STR # Slave name - # or - slave { # Slave definition - pcm STR # Slave PCM name - # or - pcm { } # Slave PCM definition - [format STR] # Slave format - } - control { - name STR # control element id string + type softvol # Soft Volume conversion PCM + slave STR # Slave name + # or + slave { # Slave definition + pcm STR # Slave PCM name + # or + pcm { } # Slave PCM definition + [format STR] # Slave format + } + control { + name STR # control element id string [card STR] # control card index [iface STR] # interface of the element [index INT] # index of the element @@ -1149,7 +1149,7 @@ pcm.name { * changed in future. */ int _snd_pcm_softvol_open(snd_pcm_t **pcmp, const char *name, - snd_config_t *root, snd_config_t *conf, + snd_config_t *root, snd_config_t *conf, snd_pcm_stream_t stream, int mode) { snd_config_iterator_t i, next; @@ -1245,7 +1245,7 @@ int _snd_pcm_softvol_open(snd_pcm_t **pcmp, const char *name, if (sformat != SND_PCM_FORMAT_UNKNOWN && sformat != SND_PCM_FORMAT_S16_LE && sformat != SND_PCM_FORMAT_S16_BE && - sformat != SND_PCM_FORMAT_S24_3LE && + sformat != SND_PCM_FORMAT_S24_3LE && sformat != SND_PCM_FORMAT_S24_LE && sformat != SND_PCM_FORMAT_S32_LE && sformat != SND_PCM_FORMAT_S32_BE) { diff --git a/src/pcm/pcm_symbols.c b/src/pcm/pcm_symbols.c index c8596ed3..821c8ca5 100644 --- a/src/pcm/pcm_symbols.c +++ b/src/pcm/pcm_symbols.c @@ -55,7 +55,7 @@ static const char **snd_pcm_open_objects[] = { &_snd_module_pcm_hw, #include "pcm_symbols_list.c" }; - + void *snd_pcm_open_symbols(void) { return snd_pcm_open_objects; diff --git a/src/pcm/plugin_ops.h b/src/pcm/plugin_ops.h index 6392073c..57734a0a 100644 --- a/src/pcm/plugin_ops.h +++ b/src/pcm/plugin_ops.h @@ -260,7 +260,7 @@ conv_xx12_xxx2: as_u8(dst) = as_u16c(src) & 0xff; goto CONV_END; conv_xx12_x210: as_u32(dst) = sx24((uint32_t)bswap_16(as_u16c(src)) << 8); goto CONV_END; conv_xx12_012x: as_u32(dst) = sx24s((uint32_t)as_u16c(src) << 8); goto CONV_END; conv_xx12_2100: as_u32(dst) = (uint32_t)bswap_16(as_u16c(src)) << 16; goto CONV_END; -conv_xx12_0012: as_u32(dst) = (uint32_t)as_u16c(src); goto CONV_END; +conv_xx12_0012: as_u32(dst) = (uint32_t)as_u16c(src); goto CONV_END; conv_xx12_xxxA: as_u8(dst) = (as_u16c(src) ^ 0x80) & 0xff; goto CONV_END; conv_xx12_xxA1: as_u16(dst) = bswap_16(as_u16c(src) ^ 0x80); goto CONV_END; conv_xx12_xx1A: as_u16(dst) = as_u16c(src) ^ 0x80; goto CONV_END; @@ -681,35 +681,35 @@ static void *const get32float_labels[2 * 2] = { #ifdef GET32F_END get32f_1234F_1234: tmp_float.f = as_floatc(src); if (tmp_float.f >= 1.0) - sample = 0x7fffffff; + sample = 0x7fffffff; else if (tmp_float.f <= -1.0) - sample = 0x80000000; + sample = 0x80000000; else - sample = (int32_t)(tmp_float.f * (float_t)0x80000000UL); + sample = (int32_t)(tmp_float.f * (float_t)0x80000000UL); goto GET32F_END; get32f_4321F_1234: tmp_float.i = bswap_32(as_u32c(src)); if (tmp_float.f >= 1.0) - sample = 0x7fffffff; + sample = 0x7fffffff; else if (tmp_float.f <= -1.0) - sample = 0x80000000; + sample = 0x80000000; else - sample = (int32_t)(tmp_float.f * (float_t)0x80000000UL); + sample = (int32_t)(tmp_float.f * (float_t)0x80000000UL); goto GET32F_END; get32f_1234D_1234: tmp_double.d = as_doublec(src); if (tmp_double.d >= 1.0) - sample = 0x7fffffff; + sample = 0x7fffffff; else if (tmp_double.d <= -1.0) - sample = 0x80000000; + sample = 0x80000000; else - sample = (int32_t)(tmp_double.d * (double_t)0x80000000UL); + sample = (int32_t)(tmp_double.d * (double_t)0x80000000UL); goto GET32F_END; get32f_4321D_1234: tmp_double.l = bswap_64(as_u64c(src)); if (tmp_double.d >= 1.0) - sample = 0x7fffffff; + sample = 0x7fffffff; else if (tmp_double.d <= -1.0) - sample = 0x80000000; + sample = 0x80000000; else - sample = (int32_t)(tmp_double.d * (double_t)0x80000000UL); + sample = (int32_t)(tmp_double.d * (double_t)0x80000000UL); goto GET32F_END; #endif diff --git a/src/pcm/scopes/level.c b/src/pcm/scopes/level.c index d5589969..a10e73d7 100644 --- a/src/pcm/scopes/level.c +++ b/src/pcm/scopes/level.c @@ -58,7 +58,7 @@ static int level_enable(snd_pcm_scope_t *scope) snd_pcm_scope_set_callback_private(scope, level); level->win = initscr(); winsdelln(level->win, snd_pcm_meter_get_channels(level->pcm)); - getyx(level->win, y, x); + getyx(level->win, y, x); level->top = y; return 0; } diff --git a/src/rawmidi/rawmidi.c b/src/rawmidi/rawmidi.c index 1021f1c4..4728b08a 100644 --- a/src/rawmidi/rawmidi.c +++ b/src/rawmidi/rawmidi.c @@ -86,7 +86,7 @@ is passed to \link ::snd_rawmidi_open() \endlink or \link ::snd_rawmidi_open_lco It contains two parts: device name and arguments. Devices and arguments are described in configuration files. The usual place for default definitions is at /usr/share/alsa/alsa.conf. -\subsection rawmidi_dev_names_default +\subsection rawmidi_dev_names_default The default device is equal to hw device. The defaults are used: @@ -143,7 +143,7 @@ This example shows open and read/write rawmidi operations. * \anchor example_test_rawmidi * Shows open and read/write rawmidi operations. */ - + #include "rawmidi_local.h" #include #include @@ -360,7 +360,7 @@ int snd_rawmidi_open_lconf(snd_rawmidi_t **inputp, snd_rawmidi_t **outputp, int snd_rawmidi_close(snd_rawmidi_t *rawmidi) { int err; - assert(rawmidi); + assert(rawmidi); err = rawmidi->ops->close(rawmidi); free(rawmidi->name); if (rawmidi->open_func) @@ -448,12 +448,12 @@ int snd_rawmidi_poll_descriptors(snd_rawmidi_t *rawmidi, struct pollfd *pfds, un */ int snd_rawmidi_poll_descriptors_revents(snd_rawmidi_t *rawmidi, struct pollfd *pfds, unsigned int nfds, unsigned short *revents) { - assert(rawmidi && pfds && revents); - if (nfds == 1) { - *revents = pfds->revents; - return 0; - } - return -EINVAL; + assert(rawmidi && pfds && revents); + if (nfds == 1) { + *revents = pfds->revents; + return 0; + } + return -EINVAL; } /** diff --git a/src/rawmidi/rawmidi_hw.c b/src/rawmidi/rawmidi_hw.c index c4908a19..1cab935e 100644 --- a/src/rawmidi/rawmidi_hw.c +++ b/src/rawmidi/rawmidi_hw.c @@ -335,7 +335,7 @@ int snd_rawmidi_hw_open(snd_rawmidi_t **inputp, snd_rawmidi_t **outputp, *outputp = NULL; if (!inputp && !outputp) return -EINVAL; - + if ((ret = snd_ctl_hw_open(&ctl, NULL, card, 0)) < 0) return ret; if (is_ump) @@ -344,11 +344,11 @@ int snd_rawmidi_hw_open(snd_rawmidi_t **inputp, snd_rawmidi_t **outputp, sprintf(filename, SNDRV_FILE_RAWMIDI, card, device); __again: - if (attempt++ > 3) { - snd_ctl_close(ctl); - return -EBUSY; - } - ret = snd_ctl_rawmidi_prefer_subdevice(ctl, subdevice); + if (attempt++ > 3) { + snd_ctl_close(ctl); + return -EBUSY; + } + ret = snd_ctl_rawmidi_prefer_subdevice(ctl, subdevice); if (ret < 0) { snd_ctl_close(ctl); return ret; @@ -369,7 +369,7 @@ int snd_rawmidi_hw_open(snd_rawmidi_t **inputp, snd_rawmidi_t **outputp, if (mode & SND_RAWMIDI_NONBLOCK) { fmode |= O_NONBLOCK; } - + if (mode & SND_RAWMIDI_SYNC) { fmode |= O_SYNC; } diff --git a/src/rawmidi/rawmidi_symbols.c b/src/rawmidi/rawmidi_symbols.c index 83e36f87..8d1a96c5 100644 --- a/src/rawmidi/rawmidi_symbols.c +++ b/src/rawmidi/rawmidi_symbols.c @@ -31,7 +31,7 @@ static const char **snd_rawmidi_open_objects[] = { &_snd_module_rawmidi_virt #endif }; - + void *snd_rawmidi_open_symbols(void) { return snd_rawmidi_open_objects; diff --git a/src/rawmidi/rawmidi_virt.c b/src/rawmidi/rawmidi_virt.c index 04c485d3..75330fd1 100644 --- a/src/rawmidi/rawmidi_virt.c +++ b/src/rawmidi/rawmidi_virt.c @@ -52,7 +52,7 @@ typedef struct { int pending; } snd_rawmidi_virtual_t; -int _snd_seq_open_lconf(snd_seq_t **seqp, const char *name, +int _snd_seq_open_lconf(snd_seq_t **seqp, const char *name, int streams, int mode, snd_config_t *lconf, snd_config_t *parent_conf); #endif diff --git a/src/seq/seq.c b/src/seq/seq.c index 7a5fe27d..4807d481 100644 --- a/src/seq/seq.c +++ b/src/seq/seq.c @@ -9,7 +9,7 @@ * See \ref seq page for more details. */ -/* +/* * Sequencer Interface - main file * * This library is free software; you can redistribute it and/or modify @@ -58,12 +58,12 @@ A typical code would be like below: // create a new client snd_seq_t *open_client() { - snd_seq_t *handle; - int err; - err = snd_seq_open(&handle, "default", SND_SEQ_OPEN_INPUT, 0); - if (err < 0) - return NULL; - snd_seq_set_client_name(handle, "My Client"); + snd_seq_t *handle; + int err; + err = snd_seq_open(&handle, "default", SND_SEQ_OPEN_INPUT, 0); + if (err < 0) + return NULL; + snd_seq_set_client_name(handle, "My Client"); return handle; } \endcode @@ -138,13 +138,13 @@ Then, a connection from MIDI input port to this program is established. From this time, events from keyboard are automatically sent to this program. Timestamps will be updated according to the subscribed queue. \code - MIDI input port (keyboard) - | - V - ALSA sequencer - update timestamp - | - V - application port + MIDI input port (keyboard) + | + V + ALSA sequencer - update timestamp + | + V + application port \endcode There is another subscription type for opposite direction: @@ -155,13 +155,13 @@ to MIDI port for write. After this connection is established, events will be properly sent to MIDI output device. \code - application port - | - V - ALSA sequencer - events are scheduled - | - V - MIDI output port (WaveTable etc.) + application port + | + V + ALSA sequencer - events are scheduled + | + V + MIDI output port (WaveTable etc.) \endcode From the viewpoint of subscription, the examples above are special cases. @@ -178,13 +178,13 @@ The connection between ports can be done also by the "third" client. Thus, filter applications have to manage only input and output events regardless of receiver/sender addresses. \code - sequencer port #1 - | - V - ALSA sequencer (scheduled or real-time) - | - V - sequencer port #2 + sequencer port #1 + | + V + ALSA sequencer (scheduled or real-time) + | + V + sequencer port #2 \endcode For the detail about subscription, see the section \ref seq_subs_more. @@ -315,7 +315,7 @@ contains a combination of client id and port id numbers, defined as When an event is passed to sequencer from a client, sequencer fills source.client field with the sender's id automatically. -It is the responsibility of sender client to +It is the responsibility of sender client to fill the port id of source.port and both client and port of dest field. @@ -335,7 +335,7 @@ queue-control event like start, stop and continue queue, change tempo, etc. to the system timer port. Then the sequencer system handles the queue according to the received event. -This port supports subscription. The received timer events are +This port supports subscription. The received timer events are broadcasted to all subscribed clients. The latter port does not receive messages but supports subscription. @@ -454,11 +454,11 @@ For example, to set the tempo of the queue q to \code void set_tempo(snd_seq_t *handle, int queue) { - snd_seq_queue_tempo_t *tempo; - snd_seq_queue_tempo_alloca(&tempo); - snd_seq_queue_tempo_set_tempo(tempo, 1000000); // 60 BPM - snd_seq_queue_tempo_set_ppq(tempo, 48); // 48 PPQ - snd_seq_set_queue_tempo(handle, queue, tempo); + snd_seq_queue_tempo_t *tempo; + snd_seq_queue_tempo_alloca(&tempo); + snd_seq_queue_tempo_set_tempo(tempo, 1000000); // 60 BPM + snd_seq_queue_tempo_set_ppq(tempo, 48); // 48 PPQ + snd_seq_set_queue_tempo(handle, queue, tempo); } \endcode @@ -629,19 +629,19 @@ The application port must have capability #SND_SEQ_PORT_CAP_WRITE. \code void capture_keyboard(snd_seq_t *seq) { - snd_seq_addr_t sender, dest; - snd_seq_port_subscribe_t *subs; - sender.client = 64; - sender.port = 0; - dest.client = 128; - dest.port = 0; - snd_seq_port_subscribe_alloca(&subs); - snd_seq_port_subscribe_set_sender(subs, &sender); - snd_seq_port_subscribe_set_dest(subs, &dest); - snd_seq_port_subscribe_set_queue(subs, 1); - snd_seq_port_subscribe_set_time_update(subs, 1); - snd_seq_port_subscribe_set_time_real(subs, 1); - snd_seq_subscribe_port(seq, subs); + snd_seq_addr_t sender, dest; + snd_seq_port_subscribe_t *subs; + sender.client = 64; + sender.port = 0; + dest.client = 128; + dest.port = 0; + snd_seq_port_subscribe_alloca(&subs); + snd_seq_port_subscribe_set_sender(subs, &sender); + snd_seq_port_subscribe_set_dest(subs, &dest); + snd_seq_port_subscribe_set_queue(subs, 1); + snd_seq_port_subscribe_set_time_update(subs, 1); + snd_seq_port_subscribe_set_time_real(subs, 1); + snd_seq_subscribe_port(seq, subs); } \endcode @@ -652,23 +652,23 @@ The application port must have capability #SND_SEQ_PORT_CAP_READ. \code void subscribe_output(snd_seq_t *seq) { - snd_seq_addr_t sender, dest; - snd_seq_port_subscribe_t *subs; - sender.client = 128; - sender.port = 0; - dest.client = 65; - dest.port = 1; - snd_seq_port_subscribe_alloca(&subs); - snd_seq_port_subscribe_set_sender(subs, &sender); - snd_seq_port_subscribe_set_dest(subs, &dest); - snd_seq_subscribe_port(seq, subs); + snd_seq_addr_t sender, dest; + snd_seq_port_subscribe_t *subs; + sender.client = 128; + sender.port = 0; + dest.client = 65; + dest.port = 1; + snd_seq_port_subscribe_alloca(&subs); + snd_seq_port_subscribe_set_sender(subs, &sender); + snd_seq_port_subscribe_set_dest(subs, &dest); + snd_seq_subscribe_port(seq, subs); } \endcode This example can be simplified by using #snd_seq_connect_to() function. \code void subscribe_output(snd_seq_t *seq) { - snd_seq_connect_to(seq, 0, 65, 1); + snd_seq_connect_to(seq, 0, 65, 1); } \endcode @@ -686,16 +686,16 @@ and the receiver // ..in the third application (130:0) .. void coupling(snd_seq_t *seq) { - snd_seq_addr_t sender, dest; - snd_seq_port_subscribe_t *subs; - sender.client = 128; - sender.port = 0; - dest.client = 129; - dest.port = 0; - snd_seq_port_subscribe_alloca(&subs); - snd_seq_port_subscribe_set_sender(subs, &sender); - snd_seq_port_subscribe_set_dest(subs, &dest); - snd_seq_subscribe_port(seq, subs); + snd_seq_addr_t sender, dest; + snd_seq_port_subscribe_t *subs; + sender.client = 128; + sender.port = 0; + dest.client = 129; + dest.port = 0; + snd_seq_port_subscribe_alloca(&subs); + snd_seq_port_subscribe_set_sender(subs, &sender); + snd_seq_port_subscribe_set_dest(subs, &dest); + snd_seq_subscribe_port(seq, subs); } \endcode @@ -729,17 +729,17 @@ The program appears like this: \code void schedule_event(snd_seq_t *seq) { - snd_seq_event_t ev; + snd_seq_event_t ev; - snd_seq_ev_clear(&ev); - snd_seq_ev_set_source(&ev, my_port); - snd_seq_ev_set_subs(&ev); - snd_seq_ev_schedule_tick(&ev, Q, 0, t); - ... // set event type, data, so on.. + snd_seq_ev_clear(&ev); + snd_seq_ev_set_source(&ev, my_port); + snd_seq_ev_set_subs(&ev); + snd_seq_ev_schedule_tick(&ev, Q, 0, t); + ... // set event type, data, so on.. - snd_seq_event_output(seq, &ev); - ... - snd_seq_drain_output(seq); // if necessary + snd_seq_event_output(seq, &ev); + ... + snd_seq_drain_output(seq); // if necessary } \endcode Of course, you can use realtime stamp, too. @@ -754,16 +754,16 @@ The program can be more simplified as follows: \code void direct_delivery(snd_seq_t *seq) { - snd_seq_event_t ev; + snd_seq_event_t ev; - snd_seq_ev_clear(&ev); - snd_seq_ev_set_source(&ev, port); - snd_seq_ev_set_subs(&ev); - snd_seq_ev_set_direct(&ev); - ... // set event type, data, so on.. + snd_seq_ev_clear(&ev); + snd_seq_ev_set_source(&ev, port); + snd_seq_ev_set_subs(&ev); + snd_seq_ev_set_direct(&ev); + ... // set event type, data, so on.. - snd_seq_event_output(seq, &ev); - snd_seq_drain_output(seq); + snd_seq_event_output(seq, &ev); + snd_seq_drain_output(seq); } \endcode You should flush event soon after output event. @@ -778,15 +778,15 @@ after some modification, will appear as following: \code void event_filter(snd_seq_t *seq, snd_seq_event_t *ev) { - while (snd_seq_event_input(seq, &ev) >= 0) { - //.. modify input event .. + while (snd_seq_event_input(seq, &ev) >= 0) { + //.. modify input event .. - snd_seq_ev_set_source(ev, my_port); - snd_seq_ev_set_subs(ev); - snd_seq_ev_set_direct(ev); - snd_seq_event_output(seq, ev); - snd_seq_drain_output(seq); - } + snd_seq_ev_set_source(ev, my_port); + snd_seq_ev_set_subs(ev); + snd_seq_ev_set_direct(ev); + snd_seq_event_output(seq, ev); + snd_seq_drain_output(seq); + } } \endcode @@ -906,7 +906,7 @@ static int snd_seq_open_conf(snd_seq_t **seqp, const char *name, const char *id; const char *lib = NULL, *open_name = NULL; int (*open_func)(snd_seq_t **, const char *, - snd_config_t *, snd_config_t *, + snd_config_t *, snd_config_t *, int, int) = NULL; #ifndef PIC extern void *snd_seq_open_symbols(void); @@ -1047,7 +1047,7 @@ static int snd_seq_open_noupdate(snd_seq_t **seqp, snd_config_t *root, * \sa snd_seq_open_lconf(), snd_seq_close(), snd_seq_type(), snd_seq_name(), * snd_seq_nonblock(), snd_seq_client_id() */ -int snd_seq_open(snd_seq_t **seqp, const char *name, +int snd_seq_open(snd_seq_t **seqp, const char *name, int streams, int mode) { snd_config_t *top; @@ -1083,7 +1083,7 @@ int snd_seq_open(snd_seq_t **seqp, const char *name, * * \sa snd_seq_open() */ -int snd_seq_open_lconf(snd_seq_t **seqp, const char *name, +int snd_seq_open_lconf(snd_seq_t **seqp, const char *name, int streams, int mode, snd_config_t *lconf) { assert(seqp && name && lconf); @@ -1091,7 +1091,7 @@ int snd_seq_open_lconf(snd_seq_t **seqp, const char *name, } #ifndef DOC_HIDDEN -int _snd_seq_open_lconf(snd_seq_t **seqp, const char *name, +int _snd_seq_open_lconf(snd_seq_t **seqp, const char *name, int streams, int mode, snd_config_t *lconf, snd_config_t *parent_conf) { @@ -1212,12 +1212,12 @@ int snd_seq_poll_descriptors(snd_seq_t *seq, struct pollfd *pfds, unsigned int s */ int snd_seq_poll_descriptors_revents(snd_seq_t *seq, struct pollfd *pfds, unsigned int nfds, unsigned short *revents) { - assert(seq && pfds && revents); - if (nfds == 1) { - *revents = pfds->revents; - return 0; - } - return -EINVAL; + assert(seq && pfds && revents); + if (nfds == 1) { + *revents = pfds->revents; + return 0; + } + return -EINVAL; } /** @@ -1714,7 +1714,7 @@ const unsigned char *snd_seq_client_info_get_event_filter(const snd_seq_client_i * * Remove all event types added with #snd_seq_client_info_event_filter_add and clear * the event filtering flag of this client_info container. - * + * * \sa snd_seq_client_info_event_filter_add(), * snd_seq_client_info_event_filter_del(), * snd_seq_client_info_event_filter_check(), @@ -1732,8 +1732,8 @@ void snd_seq_client_info_event_filter_clear(snd_seq_client_info_t *info) * \brief Add an event type to the event filtering of a client_info container * \param info client_info container * \param event_type event type to be added - * - * Set the event filtering flag of this client_info and add the specified event type to the + * + * Set the event filtering flag of this client_info and add the specified event type to the * filter bitmap of this client_info container. * * \sa snd_seq_get_client_info(), @@ -1787,7 +1787,7 @@ int snd_seq_client_info_event_filter_check(snd_seq_client_info_t *info, int even { assert(info); return snd_seq_get_bit(event_type, info->event_filter); -} +} /** * \brief Get the number of opened ports of a client_info container @@ -2028,7 +2028,7 @@ void snd_seq_client_info_set_event_filter(snd_seq_client_info_t *info, unsigned * \param client client id * \param info the pointer to be stored * \return 0 on success otherwise a negative error code - * + * * Obtains the information of the client with a client id specified by * info argument. * The obtained information is written on info parameter. @@ -2950,7 +2950,7 @@ void snd_seq_port_subscribe_set_sender(snd_seq_port_subscribe_t *info, const snd assert(info); memcpy(&info->sender, addr, sizeof(*addr)); } - + /** * \brief Set destination address of a port_subscribe container * \param info port_subscribe container @@ -3196,7 +3196,7 @@ int snd_seq_query_subscribe_get_num_subs(const snd_seq_query_subscribe_t *info) { assert(info); return info->num_subs; -} +} /** * \brief Get the address of subscriber of a query_subscribe container @@ -3548,7 +3548,7 @@ int snd_seq_create_queue(snd_seq_t *seq, snd_seq_queue_info_t *info) * \return the queue id (zero or positive) on success otherwise a negative error code * * \sa snd_seq_alloc_queue() - */ + */ int snd_seq_alloc_named_queue(snd_seq_t *seq, const char *name) { snd_seq_queue_info_t info; @@ -3566,7 +3566,7 @@ int snd_seq_alloc_named_queue(snd_seq_t *seq, const char *name) * * \sa snd_seq_alloc_named_queue(), snd_seq_create_queue(), snd_seq_free_queue(), * snd_seq_get_queue_info() - */ + */ int snd_seq_alloc_queue(snd_seq_t *seq) { return snd_seq_alloc_named_queue(seq, NULL); @@ -3647,7 +3647,7 @@ int snd_seq_query_named_queue(snd_seq_t *seq, const char *name) * \brief Get the queue usage flag to the client * \param seq sequencer handle * \param q queue id - * \return 1 = client is allowed to access the queue, 0 = not allowed, + * \return 1 = client is allowed to access the queue, 0 = not allowed, * otherwise a negative error code * * \sa snd_seq_get_queue_info(), snd_seq_set_queue_usage() @@ -4164,7 +4164,7 @@ void snd_seq_queue_timer_set_type(snd_seq_queue_timer_t *info, snd_seq_queue_tim assert(info); info->type = (int)type; } - + /** * \brief Set the timer id of a queue_timer container * \param info queue_timer container @@ -4544,7 +4544,7 @@ static int snd_seq_event_retrieve_buffer(snd_seq_t *seq, snd_seq_event_t **retp) * \brief retrieve an event from sequencer * \param seq sequencer handle * \param ev event pointer to be stored - * \return + * \return * * Obtains an input event from sequencer. * The event is created via snd_seq_create_event(), and its pointer is stored on @@ -4597,7 +4597,7 @@ static int snd_seq_event_input_feed(snd_seq_t *seq, int timeout) snd_errornum(SEQUENCER, "poll"); return -errno; } - if (pfd.revents & POLLIN) + if (pfd.revents & POLLIN) return snd_seq_event_read_buffer(seq); return seq->ibuflen; } diff --git a/src/seq/seq_hw.c b/src/seq/seq_hw.c index 5ee41953..29dd01fe 100644 --- a/src/seq/seq_hw.c +++ b/src/seq/seq_hw.c @@ -522,7 +522,7 @@ int snd_seq_hw_open(snd_seq_t **handle, const char *name, int streams, int mode) assert(0); return -EINVAL; } - + if (mode & SND_SEQ_NONBLOCK) fmode |= O_NONBLOCK; diff --git a/src/seq/seq_symbols.c b/src/seq/seq_symbols.c index a024e67e..dd3391f1 100644 --- a/src/seq/seq_symbols.c +++ b/src/seq/seq_symbols.c @@ -25,7 +25,7 @@ extern const char *_snd_module_seq_hw; static const char **snd_seq_open_objects[] = { &_snd_module_seq_hw }; - + void *snd_seq_open_symbols(void) { return snd_seq_open_objects; diff --git a/src/seq/seqmid.c b/src/seq/seqmid.c index ca9686e4..604aa2dd 100644 --- a/src/seq/seqmid.c +++ b/src/seq/seqmid.c @@ -119,7 +119,7 @@ int snd_seq_delete_simple_port(snd_seq_t *seq, int port) int snd_seq_connect_from(snd_seq_t *seq, int myport, int src_client, int src_port) { snd_seq_port_subscribe_t subs; - + memset(&subs, 0, sizeof(subs)); subs.sender.client = src_client; subs.sender.port = src_port; @@ -146,7 +146,7 @@ int snd_seq_connect_from(snd_seq_t *seq, int myport, int src_client, int src_por int snd_seq_connect_to(snd_seq_t *seq, int myport, int dest_client, int dest_port) { snd_seq_port_subscribe_t subs; - + memset(&subs, 0, sizeof(subs)); /*subs.sender.client = seq->client;*/ subs.sender.client = snd_seq_client_id(seq); @@ -173,7 +173,7 @@ int snd_seq_connect_to(snd_seq_t *seq, int myport, int dest_client, int dest_por int snd_seq_disconnect_from(snd_seq_t *seq, int myport, int src_client, int src_port) { snd_seq_port_subscribe_t subs; - + memset(&subs, 0, sizeof(subs)); subs.sender.client = src_client; subs.sender.port = src_port; @@ -200,7 +200,7 @@ int snd_seq_disconnect_from(snd_seq_t *seq, int myport, int src_client, int src_ int snd_seq_disconnect_to(snd_seq_t *seq, int myport, int dest_client, int dest_port) { snd_seq_port_subscribe_t subs; - + memset(&subs, 0, sizeof(subs)); /*subs.sender.client = seq->client;*/ subs.sender.client = snd_seq_client_id(seq); @@ -400,7 +400,7 @@ int snd_seq_sync_output_queue(snd_seq_t *seq) pfd.fd = seq->poll_fd; pfd.events = POLLOUT; err = poll(&pfd, 1, -1); - /* restore the room size */ + /* restore the room size */ info.output_room = saved_room; snd_seq_set_client_pool(seq, &info); return err; diff --git a/src/socket.c b/src/socket.c index 971c434e..931d24e4 100644 --- a/src/socket.c +++ b/src/socket.c @@ -24,7 +24,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ - + #include "local.h" #include #include @@ -60,7 +60,7 @@ int snd_send_fd(int sock, void *data, size_t len, int fd) msghdr.msg_name = NULL; msghdr.msg_namelen = 0; msghdr.msg_iov = &vec; - msghdr.msg_iovlen = 1; + msghdr.msg_iovlen = 1; msghdr.msg_control = cmsg; msghdr.msg_controllen = cmsg_len; msghdr.msg_flags = 0; diff --git a/src/timer/timer.c b/src/timer/timer.c index c4daa2a0..48eb80dc 100644 --- a/src/timer/timer.c +++ b/src/timer/timer.c @@ -248,7 +248,7 @@ int snd_timer_open_lconf(snd_timer_t **timer, const char *name, int snd_timer_close(snd_timer_t *timer) { int err; - assert(timer); + assert(timer); while (!list_empty(&timer->async_handlers)) { snd_async_handler_t *h = list_entry(timer->async_handlers.next, snd_async_handler_t, hlist); snd_async_del_handler(h); @@ -335,7 +335,7 @@ snd_timer_t *snd_async_handler_get_timer(snd_async_handler_t *handler) return NULL; } return handler->u.timer; -} +} /** * \brief get count of poll descriptors for timer handle @@ -388,12 +388,12 @@ int snd_timer_poll_descriptors(snd_timer_t *timer, struct pollfd *pfds, unsigned */ int snd_timer_poll_descriptors_revents(snd_timer_t *timer, struct pollfd *pfds, unsigned int nfds, unsigned short *revents) { - assert(timer && pfds && revents); - if (nfds == 1) { - *revents = pfds->revents; - return 0; - } - return -EINVAL; + assert(timer && pfds && revents); + if (nfds == 1) { + *revents = pfds->revents; + return 0; + } + return -EINVAL; } /** @@ -428,8 +428,8 @@ int snd_timer_nonblock(snd_timer_t *timer, int nonblock) int snd_timer_async(snd_timer_t *timer, int sig, pid_t pid) { assert(timer); - if (sig == 0) - sig = SIGIO; + if (sig == 0) + sig = SIGIO; if (pid == 0) pid = getpid(); return timer->ops->async(timer, sig, pid); diff --git a/src/timer/timer_hw.c b/src/timer/timer_hw.c index 3783491f..7aaaf180 100644 --- a/src/timer/timer_hw.c +++ b/src/timer/timer_hw.c @@ -227,7 +227,7 @@ int snd_timer_hw_open(snd_timer_t **handle, const char *name, int dev_class, int tmode = O_RDONLY; if (mode & SND_TIMER_OPEN_NONBLOCK) - tmode |= O_NONBLOCK; + tmode |= O_NONBLOCK; fd = snd_open_device(SNDRV_FILE_TIMER, tmode); if (fd < 0) return -errno; diff --git a/src/timer/timer_query.c b/src/timer/timer_query.c index 9fa14069..121cef6c 100644 --- a/src/timer/timer_query.c +++ b/src/timer/timer_query.c @@ -200,7 +200,7 @@ int snd_timer_query_open_lconf(snd_timer_query_t **timer, const char *name, int snd_timer_query_close(snd_timer_query_t *timer) { int err; - assert(timer); + assert(timer); err = timer->ops->close(timer); if (timer->dl_handle) snd_dlclose(timer->dl_handle); @@ -220,8 +220,8 @@ int snd_timer_query_close(snd_timer_query_t *timer) */ int snd_timer_query_next_device(snd_timer_query_t *timer, snd_timer_id_t *tid) { - assert(timer); - assert(tid); + assert(timer); + assert(tid); return timer->ops->next_device(timer, tid); } @@ -261,9 +261,9 @@ int snd_timer_ginfo_malloc(snd_timer_ginfo_t **info) void snd_timer_ginfo_free(snd_timer_ginfo_t *info) { assert(info); - free(info); + free(info); } - + /** * \brief copy one snd_timer_info_t structure to another * \param dst destination snd_timer_info_t structure @@ -389,8 +389,8 @@ EXPORT_SYMBOL int INTERNAL(snd_timer_query_info)(snd_timer_query_t *timer, snd_t int snd_timer_query_info(snd_timer_query_t *timer, snd_timer_ginfo_t *info) #endif { - assert(timer); - assert(info); + assert(timer); + assert(info); return timer->ops->info(timer, info); } use_default_symbol_version(__snd_timer_query_info, snd_timer_query_info, ALSA_0.9.0); @@ -407,8 +407,8 @@ EXPORT_SYMBOL int INTERNAL(snd_timer_query_params)(snd_timer_query_t *timer, snd int snd_timer_query_params(snd_timer_query_t *timer, snd_timer_gparams_t *params) #endif { - assert(timer); - assert(params); + assert(timer); + assert(params); return timer->ops->params(timer, params); } use_default_symbol_version(__snd_timer_query_params, snd_timer_query_params, ALSA_0.9.0); @@ -425,8 +425,8 @@ EXPORT_SYMBOL int INTERNAL(snd_timer_query_status)(snd_timer_query_t *timer, snd int snd_timer_query_status(snd_timer_query_t *timer, snd_timer_gstatus_t *status) #endif { - assert(timer); - assert(status); + assert(timer); + assert(status); return timer->ops->status(timer, status); } use_default_symbol_version(__snd_timer_query_status, snd_timer_query_status, ALSA_0.9.0); diff --git a/src/timer/timer_query_hw.c b/src/timer/timer_query_hw.c index 0e217e53..16c58393 100644 --- a/src/timer/timer_query_hw.c +++ b/src/timer/timer_query_hw.c @@ -92,7 +92,7 @@ int snd_timer_query_hw_open(snd_timer_query_t **handle, const char *name, int mo tmode = O_RDONLY; if (mode & SND_TIMER_OPEN_NONBLOCK) - tmode |= O_NONBLOCK; + tmode |= O_NONBLOCK; fd = snd_open_device(SNDRV_FILE_TIMER, tmode); if (fd < 0) return -errno; diff --git a/src/timer/timer_symbols.c b/src/timer/timer_symbols.c index 8393d125..e83910e2 100644 --- a/src/timer/timer_symbols.c +++ b/src/timer/timer_symbols.c @@ -25,7 +25,7 @@ extern const char *_snd_module_timer_hw; static const char **snd_timer_open_objects[] = { &_snd_module_timer_hw }; - + void *snd_timer_open_symbols(void) { return (void *)snd_timer_open_objects[0]; @@ -37,7 +37,7 @@ extern const char *_snd_module_timer_query_hw; static const char **snd_timer_query_open_objects[] = { &_snd_module_timer_query_hw }; - + void *snd_timer_query_open_symbols(void) { return snd_timer_query_open_objects; diff --git a/src/topology/builder.c b/src/topology/builder.c index f7cf8534..8d91b8ef 100644 --- a/src/topology/builder.c +++ b/src/topology/builder.c @@ -13,8 +13,8 @@ GNU Lesser General Public License for more details. Authors: Mengdong Lin - Yao Jin - Liam Girdwood + Yao Jin + Liam Girdwood */ #include "tplg_local.h" @@ -132,7 +132,7 @@ static int write_elem_block(snd_tplg_t *tplg, if (sub_pos == pos) break; } - /* the last elem of the current sub list as the head of + /* the last elem of the current sub list as the head of next sub list*/ sub_base = pos; count = 0; diff --git a/src/topology/channel.c b/src/topology/channel.c index 66c59707..2e001a5d 100644 --- a/src/topology/channel.c +++ b/src/topology/channel.c @@ -13,8 +13,8 @@ GNU Lesser General Public License for more details. Authors: Mengdong Lin - Yao Jin - Liam Girdwood + Yao Jin + Liam Girdwood */ #include "tplg_local.h" diff --git a/src/topology/ctl.c b/src/topology/ctl.c index 6c9c0718..8a84450c 100644 --- a/src/topology/ctl.c +++ b/src/topology/ctl.c @@ -13,8 +13,8 @@ GNU Lesser General Public License for more details. Authors: Mengdong Lin - Yao Jin - Liam Girdwood + Yao Jin + Liam Girdwood */ #include "tplg_local.h" diff --git a/src/topology/dapm.c b/src/topology/dapm.c index a02d724c..bb7fdf65 100644 --- a/src/topology/dapm.c +++ b/src/topology/dapm.c @@ -13,8 +13,8 @@ GNU Lesser General Public License for more details. Authors: Mengdong Lin - Yao Jin - Liam Girdwood + Yao Jin + Liam Girdwood */ #include "tplg_local.h" diff --git a/src/topology/data.c b/src/topology/data.c index 93fa6f0d..b1a2e23a 100644 --- a/src/topology/data.c +++ b/src/topology/data.c @@ -13,8 +13,8 @@ GNU Lesser General Public License for more details. Authors: Mengdong Lin - Yao Jin - Liam Girdwood + Yao Jin + Liam Girdwood */ #include "tplg_local.h" @@ -413,7 +413,7 @@ static int write_hex(char *buf, char *str, int width) long val; void *p = &val; - errno = 0; + errno = 0; if (safe_strtol_base(str, &val, 16) < 0) return -EINVAL; diff --git a/src/topology/elem.c b/src/topology/elem.c index 0ce11b04..feaeafbb 100644 --- a/src/topology/elem.c +++ b/src/topology/elem.c @@ -13,8 +13,8 @@ GNU Lesser General Public License for more details. Authors: Mengdong Lin - Yao Jin - Liam Girdwood + Yao Jin + Liam Girdwood */ #include "tplg_local.h" diff --git a/src/topology/ops.c b/src/topology/ops.c index 232073a3..b56f6868 100644 --- a/src/topology/ops.c +++ b/src/topology/ops.c @@ -13,8 +13,8 @@ GNU Lesser General Public License for more details. Authors: Mengdong Lin - Yao Jin - Liam Girdwood + Yao Jin + Liam Girdwood */ #include "tplg_local.h" diff --git a/src/topology/parser.c b/src/topology/parser.c index 5ecf98f5..9814a9f7 100644 --- a/src/topology/parser.c +++ b/src/topology/parser.c @@ -13,8 +13,8 @@ GNU Lesser General Public License for more details. Authors: Mengdong Lin - Yao Jin - Liam Girdwood + Yao Jin + Liam Girdwood */ #include "tplg_local.h" diff --git a/src/topology/pcm.c b/src/topology/pcm.c index cef5127c..db06d041 100644 --- a/src/topology/pcm.c +++ b/src/topology/pcm.c @@ -13,8 +13,8 @@ GNU Lesser General Public License for more details. Authors: Mengdong Lin - Yao Jin - Liam Girdwood + Yao Jin + Liam Girdwood */ #include "tplg_local.h" diff --git a/src/topology/text.c b/src/topology/text.c index c5022c19..f6d34392 100644 --- a/src/topology/text.c +++ b/src/topology/text.c @@ -13,8 +13,8 @@ GNU Lesser General Public License for more details. Authors: Mengdong Lin - Yao Jin - Liam Girdwood + Yao Jin + Liam Girdwood */ diff --git a/src/ucm/main.c b/src/ucm/main.c index 3a3c9c15..d9e031d3 100644 --- a/src/ucm/main.c +++ b/src/ucm/main.c @@ -10,7 +10,7 @@ * 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 + * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Support for the verb/device/modifier core logic and API, @@ -1027,7 +1027,7 @@ static int set_defaults(snd_use_case_mgr_t *uc_mgr, bool force) static int import_master_config(snd_use_case_mgr_t *uc_mgr) { int err; - + err = uc_mgr_import_master_config(uc_mgr); if (err < 0) return err; @@ -1210,7 +1210,7 @@ static inline struct use_case_verb *find_verb(snd_use_case_mgr_t *uc_mgr, verb_name); } -static int is_devlist_supported(snd_use_case_mgr_t *uc_mgr, +static int is_devlist_supported(snd_use_case_mgr_t *uc_mgr, struct dev_list *dev_list) { struct dev_list_node *device; @@ -1243,13 +1243,13 @@ static int is_devlist_supported(snd_use_case_mgr_t *uc_mgr, return 1 - found_ret; } -static inline int is_modifier_supported(snd_use_case_mgr_t *uc_mgr, +static inline int is_modifier_supported(snd_use_case_mgr_t *uc_mgr, struct use_case_modifier *modifier) { return is_devlist_supported(uc_mgr, &modifier->dev_list); } -static inline int is_device_supported(snd_use_case_mgr_t *uc_mgr, +static inline int is_device_supported(snd_use_case_mgr_t *uc_mgr, struct use_case_device *device) { return is_devlist_supported(uc_mgr, &device->dev_list); @@ -1639,7 +1639,7 @@ static int dismantle_use_case(snd_use_case_mgr_t *uc_mgr) uc_mgr->active_verb = NULL; err = set_defaults(uc_mgr, true); - + return err; } diff --git a/src/ucm/parser.c b/src/ucm/parser.c index ac4a5fbc..59d20320 100644 --- a/src/ucm/parser.c +++ b/src/ucm/parser.c @@ -10,7 +10,7 @@ * 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 + * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Support for the verb/device/modifier core logic and API, @@ -847,7 +847,7 @@ static int parse_transition(snd_use_case_mgr_t *uc_mgr, free(tseq); return err; } - + err = parse_sequence(uc_mgr, &tseq->transition_list, n); if (err < 0) { uc_mgr_free_transition_element(tseq); @@ -873,7 +873,7 @@ static int parse_compound(snd_use_case_mgr_t *uc_mgr, snd_config_t *cfg, if (snd_config_get_id(cfg, &id) < 0) return -EINVAL; - + if (snd_config_get_type(cfg) != SND_CONFIG_TYPE_COMPOUND) { uc_error("compound type expected for %s", id); return -EINVAL; @@ -886,7 +886,7 @@ static int parse_compound(snd_use_case_mgr_t *uc_mgr, snd_config_t *cfg, uc_error("compound type expected for %s, is %d", id, snd_config_get_type(cfg)); return -EINVAL; } - + err = fcn(uc_mgr, n, data1, data2); if (err < 0) return err; @@ -1898,7 +1898,7 @@ static int parse_verb(snd_use_case_mgr_t *uc_mgr, snd_config_iterator_t i, next; snd_config_t *n; int err; - + /* in-place evaluation */ err = uc_mgr_evaluate_inplace(uc_mgr, cfg); if (err < 0) diff --git a/src/ucm/ucm_local.h b/src/ucm/ucm_local.h index b274277d..47cfa0d5 100644 --- a/src/ucm/ucm_local.h +++ b/src/ucm/ucm_local.h @@ -10,7 +10,7 @@ * 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 + * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Support for the verb/device/modifier core logic and API, @@ -62,9 +62,9 @@ #define SEQUENCE_ELEMENT_TYPE_DEV_DISABLE_ALL 15 struct ucm_value { - struct list_head list; - char *name; - char *data; + struct list_head list; + char *name; + char *data; }; /* sequence of a component device */ diff --git a/src/ucm/utils.c b/src/ucm/utils.c index bc33ee5a..fc5fb1f4 100644 --- a/src/ucm/utils.c +++ b/src/ucm/utils.c @@ -10,7 +10,7 @@ * 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 + * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Support for the verb/device/modifier core logic and API, @@ -412,7 +412,7 @@ void uc_mgr_free_value(struct list_head *base) { struct list_head *pos, *npos; struct ucm_value *val; - + list_for_each_safe(pos, npos, base) { val = list_entry(pos, struct ucm_value, list); uc_mgr_free_value1(val); @@ -423,7 +423,7 @@ void uc_mgr_free_dev_list(struct dev_list *dev_list) { struct list_head *pos, *npos; struct dev_list_node *dlist; - + list_for_each_safe(pos, npos, &dev_list->list) { dlist = list_entry(pos, struct dev_list_node, list); free(dlist->name); @@ -534,7 +534,7 @@ void uc_mgr_free_sequence(struct list_head *base) { struct list_head *pos, *npos; struct sequence_element *seq; - + list_for_each_safe(pos, npos, base) { seq = list_entry(pos, struct sequence_element, list); list_del(&seq->list); @@ -553,7 +553,7 @@ void uc_mgr_free_transition(struct list_head *base) { struct list_head *pos, *npos; struct transition_sequence *tseq; - + list_for_each_safe(pos, npos, base) { tseq = list_entry(pos, struct transition_sequence, list); list_del(&tseq->list); @@ -579,7 +579,7 @@ void uc_mgr_free_modifier(struct list_head *base) { struct list_head *pos, *npos; struct use_case_modifier *mod; - + list_for_each_safe(pos, npos, base) { mod = list_entry(pos, struct use_case_modifier, list); free(mod->name); @@ -611,7 +611,7 @@ void uc_mgr_free_device_list(struct list_head *base) { struct list_head *pos, *npos; struct use_case_device *dev; - + list_for_each_safe(pos, npos, base) { dev = list_entry(pos, struct use_case_device, list); uc_mgr_free_device(dev); diff --git a/src/userfile.c b/src/userfile.c index 492ea9cb..be80d31d 100644 --- a/src/userfile.c +++ b/src/userfile.c @@ -17,7 +17,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ - + #include "config.h" #include #include diff --git a/test/audio_time.c b/test/audio_time.c index 00619966..2fe6a0f4 100644 --- a/test/audio_time.c +++ b/test/audio_time.c @@ -390,7 +390,7 @@ int main(int argc, char *argv[]) } - printf("\t capture: systime: %lli nsec, audio time %lli nsec, \tsystime delta %lli \t resolution %d ns \n", + printf("\t capture: systime: %lli nsec, audio time %lli nsec, \tsystime delta %lli \t resolution %d ns \n", timediff(tstamp_c, trigger_tstamp_c), timestamp2ns(audio_tstamp_c), timediff(tstamp_c, trigger_tstamp_c) - timestamp2ns(audio_tstamp_c), audio_tstamp_report_c.accuracy diff --git a/test/control.c b/test/control.c index b0a3877e..ccb389e7 100644 --- a/test/control.c +++ b/test/control.c @@ -101,7 +101,7 @@ int main(void) } snd_ctl_close(handle); } - + snd_config_update_free_global(); return 0; } diff --git a/test/latency.c b/test/latency.c index c40b2ae7..38633253 100644 --- a/test/latency.c +++ b/test/latency.c @@ -251,9 +251,9 @@ int setparams(snd_pcm_t *phandle, snd_pcm_t *chandle, int *bufsize) } __again: - if (buffer_size > 0) - return -1; - if (last_bufsize == *bufsize) + if (buffer_size > 0) + return -1; + if (last_bufsize == *bufsize) *bufsize += 4; last_bufsize = *bufsize; if (*bufsize > latency_max) @@ -282,8 +282,8 @@ int setparams(snd_pcm_t *phandle, snd_pcm_t *chandle, int *bufsize) snd_pcm_hw_params_get_buffer_size(p_params, &p_size); playback_buffer_size = p_size; if (p_psize * 2 < p_size) { - snd_pcm_hw_params_get_periods_min(p_params, &val, NULL); - if (val > 2) { + snd_pcm_hw_params_get_periods_min(p_params, &val, NULL); + if (val > 2) { printf("playback device does not support 2 periods per buffer\n"); exit(0); } @@ -291,7 +291,7 @@ int setparams(snd_pcm_t *phandle, snd_pcm_t *chandle, int *bufsize) } snd_pcm_hw_params_get_buffer_size(c_params, &c_size); if (c_psize * 2 < c_size) { - snd_pcm_hw_params_get_periods_min(c_params, &val, NULL); + snd_pcm_hw_params_get_periods_min(c_params, &val, NULL); if (val > 2 ) { printf("capture device does not support 2 periods per buffer\n"); exit(0); @@ -490,7 +490,7 @@ void applyeffect(char* buffer,int r) y[chn][1] = y[chn][0]; x[chn][0] = samples[i*channels+chn]; - y[chn][0] = a0*x[chn][0] + a1*x[chn][1] + a2*x[chn][2] + y[chn][0] = a0*x[chn][0] + a1*x[chn][1] + a2*x[chn][2] - b1*y[chn][1] - b2*y[chn][2]; samples[i*channels+chn] = y[chn][0]; } @@ -537,14 +537,14 @@ void help(void) "-X,--realtime do a realtime check (buffering)\n" "-O,--policy set scheduler policy (RR, FIFO or OTHER)\n" ); - printf("Recognized sample formats are:"); - for (k = 0; k < SND_PCM_FORMAT_LAST; ++k) { - const char *s = snd_pcm_format_name(k); - if (s) - printf(" %s", s); - } - printf("\n\n"); - printf( + printf("Recognized sample formats are:"); + for (k = 0; k < SND_PCM_FORMAT_LAST; ++k) { + const char *s = snd_pcm_format_name(k); + if (s) + printf(" %s", s); + } + printf("\n\n"); + printf( "Tip #1 (usable latency with large periods, non-blocking mode, good CPU usage,\n" " superb xrun prevention):\n" " latency -m 8192 -M 8192 -t 1 -p\n" @@ -724,17 +724,17 @@ int main(int argc, char *argv[]) lfo = 0; dlfo = 2.*M_PI*FILTERSWEEP_LFO_FREQ/fs; - x[0] = (float*) malloc(channels*sizeof(float)); - x[1] = (float*) malloc(channels*sizeof(float)); - x[2] = (float*) malloc(channels*sizeof(float)); - y[0] = (float*) malloc(channels*sizeof(float)); - y[1] = (float*) malloc(channels*sizeof(float)); - y[2] = (float*) malloc(channels*sizeof(float)); + x[0] = (float*) malloc(channels*sizeof(float)); + x[1] = (float*) malloc(channels*sizeof(float)); + x[2] = (float*) malloc(channels*sizeof(float)); + y[0] = (float*) malloc(channels*sizeof(float)); + y[1] = (float*) malloc(channels*sizeof(float)); + y[2] = (float*) malloc(channels*sizeof(float)); } cap_avail_max = 0; pbk_fill_min = latency * 2; - + while (1) { frames_in = frames_out = 0; if (setparams(phandle, chandle, &latency) < 0) @@ -819,7 +819,7 @@ int main(int argc, char *argv[]) else { if (effect) applyeffect(buffer, r); - if (writebuf(phandle, buffer, r, &frames_out) < 0) + if (writebuf(phandle, buffer, r, &frames_out) < 0) ok = 0; } } diff --git a/test/midifile.c b/test/midifile.c index 8580108e..808dafc8 100644 --- a/test/midifile.c +++ b/test/midifile.c @@ -370,8 +370,8 @@ readtrack (void) /* read a track chunk */ old_currtempo = Mf_currtempo; old_realtime = Mf_realtime; if (revised_time != tempo_change_time) { - old_f_realtime = Mf_f_realtime; - old_currtime = save_time; + old_f_realtime = Mf_f_realtime; + old_currtime = save_time; } delta_secs = mf_ticks2sec (revised_time-old_currtime, Mf_division, save_tempo); #ifdef DEBUG_TIMES @@ -856,17 +856,17 @@ mf_write_track_chunk (int which_track, FILE *fp) eputc(laststatus = meta_event); eputc(end_of_track); - eputc(0); + eputc(0); */ /* It's impossible to know how long the track chunk will be beforehand, - so the position of the track length data is kept so that it can - be written after the chunk has been generated */ + so the position of the track length data is kept so that it can + be written after the chunk has been generated */ place_marker = ftell (fp); /* This method turned out not to be portable because the - parameter returned from ftell is not guaranteed to be - in bytes on every machine */ + parameter returned from ftell is not guaranteed to be + in bytes on every machine */ /* track.length = place_marker - offset - (long) sizeof(track); */ #ifdef DEBUG diff --git a/test/midifile.h b/test/midifile.h index 5d408421..93312f9a 100644 --- a/test/midifile.h +++ b/test/midifile.h @@ -66,7 +66,7 @@ extern void mferror(char *s); /* 7 bit controllers */ #define damper_pedal 0x40 -#define portamento 0x41 +#define portamento 0x41 #define sustenuto 0x42 #define soft_pedal 0x43 #define general_4 0x44 @@ -119,7 +119,7 @@ extern void mferror(char *s); #define Lexicon (0x06) /* Lexicon */ #define Tempi (0x20) /* Bon Tempi */ #define Siel (0x21) /* S.I.E.L. */ -#define Kawai (0x41) +#define Kawai (0x41) #define Roland (0x42) #define Korg (0x42) #define Yamaha (0x43) diff --git a/test/midiloop.c b/test/midiloop.c index d6548b59..df5a27bb 100644 --- a/test/midiloop.c +++ b/test/midiloop.c @@ -74,7 +74,7 @@ int main(int argc, char** argv) struct timeval start, end; long long diff; snd_rawmidi_status_t *istat, *ostat; - + for (i = 1 ; i 0) { - atomic_add(sum, *src); - src += src_step; - sum += sum_step; - } + while (size-- > 0) { + atomic_add(sum, *src); + src += src_step; + sum += sum_step; + } } void saturate(unsigned int size, - s16 *dst, const s32 *sum, - unsigned int dst_step, unsigned int sum_step) + s16 *dst, const s32 *sum, + unsigned int dst_step, unsigned int sum_step) { dst_step /= sizeof(*dst); sum_step /= sizeof(*sum); - while (size-- > 0) { - s32 sample = *sum; - if (unlikely(sample < -0x8000)) - *dst = -0x8000; - else if (unlikely(sample > 0x7fff)) - *dst = 0x7fff; - else - *dst = sample; - dst += dst_step; - sum += sum_step; - } + while (size-- > 0) { + s32 sample = *sum; + if (unlikely(sample < -0x8000)) + *dst = -0x8000; + else if (unlikely(sample > 0x7fff)) + *dst = 0x7fff; + else + *dst = sample; + dst += dst_step; + sum += sum_step; + } } void mix_areas0(unsigned int size, @@ -206,7 +206,7 @@ void init(s16 *dst, s32 *sum, int size) { int count; char *a; - + for (count = size - 1; count >= 0; count--) *sum++ = 0; for (count = size - 1; count >= 0; count--) @@ -226,16 +226,16 @@ int main(int argc, char **argv) int LOOP = 100; int i, t; unsigned long long begin, end, diff, diffS, diff0, diff1, diff1_mmx, diff2; - double cpu_clock = detect_cpu_clock(); + double cpu_clock = detect_cpu_clock(); s16 *dst = malloc(sizeof(*dst) * size); s32 *sum = calloc(size, sizeof(*sum)); s16 **srcs = malloc(sizeof(*srcs) * n); setscheduler(); #ifndef CONFIG_SMP - printf("CPU clock: %fMhz (UP)\n\n", cpu_clock / 10e5); + printf("CPU clock: %fMhz (UP)\n\n", cpu_clock / 10e5); #else - printf("CPU clock: %fMhz (SMP)\n\n", cpu_clock / 10e5); + printf("CPU clock: %fMhz (SMP)\n\n", cpu_clock / 10e5); #endif if (argc > 3) { size = atoi(argv[1]); diff --git a/test/omixer.c b/test/omixer.c index 119fa331..44000ef7 100644 --- a/test/omixer.c +++ b/test/omixer.c @@ -55,7 +55,7 @@ int main(int argc, char *argv[]) return 0; } - if (strcmp(pname, "-")) { + if (strcmp(pname, "-")) { err = snd_pcm_open(&phandle, pname, SND_PCM_STREAM_PLAYBACK, 0); if (err < 0) { fprintf(stderr, "Playback PCM open error: %s\n", snd_strerror(err)); diff --git a/test/pcm.c b/test/pcm.c index 223edafc..6e8ae9e4 100644 --- a/test/pcm.c +++ b/test/pcm.c @@ -33,7 +33,7 @@ static snd_pcm_sframes_t buffer_size; static snd_pcm_sframes_t period_size; static snd_output_t *output = NULL; -static void generate_sine(const snd_pcm_channel_area_t *areas, +static void generate_sine(const snd_pcm_channel_area_t *areas, snd_pcm_uframes_t offset, int count, double *_phase) { @@ -224,7 +224,7 @@ static int set_swparams(snd_pcm_t *handle, snd_pcm_sw_params_t *swparams) /* * Underrun and suspend recovery */ - + static int xrun_recovery(snd_pcm_t *handle, int err) { if (verbose) @@ -279,7 +279,7 @@ static int write_loop(snd_pcm_t *handle, } } } - + /* * Transfer method - write and wait for room in buffer using poll */ @@ -401,7 +401,7 @@ static void async_callback(snd_async_handler_t *ahandler) snd_pcm_channel_area_t *areas = data->areas; snd_pcm_sframes_t avail; int err; - + avail = snd_pcm_avail_update(handle); while (avail >= period_size) { generate_sine(areas, 0, period_size, &data->phase); @@ -474,7 +474,7 @@ static void async_direct_callback(snd_async_handler_t *ahandler) snd_pcm_sframes_t avail, commitres; snd_pcm_state_t state; int first = 0, err; - + while (1) { state = snd_pcm_state(handle); if (state == SND_PCM_STATE_XRUN) { @@ -678,7 +678,7 @@ static int direct_loop(snd_pcm_t *handle, } } } - + /* * Transfer method - direct write only using mmap_write functions */ @@ -711,7 +711,7 @@ static int direct_write_loop(snd_pcm_t *handle, } } } - + /* * */ @@ -753,16 +753,16 @@ static void help(void) "-n,--noresample do not resample\n" "-e,--pevent enable poll event after each period\n" "\n"); - printf("Recognized sample formats are:"); - for (k = 0; k < SND_PCM_FORMAT_LAST; ++k) { - const char *s = snd_pcm_format_name(k); - if (s) - printf(" %s", s); - } - printf("\n"); - printf("Recognized transfer methods are:"); - for (k = 0; transfer_methods[k].name; k++) - printf(" %s", transfer_methods[k].name); + printf("Recognized sample formats are:"); + for (k = 0; k < SND_PCM_FORMAT_LAST; ++k) { + const char *s = snd_pcm_format_name(k); + if (s) + printf(" %s", s); + } + printf("\n"); + printf("Recognized transfer methods are:"); + for (k = 0; transfer_methods[k].name; k++) + printf(" %s", transfer_methods[k].name); printf("\n"); } @@ -889,7 +889,7 @@ int main(int argc, char *argv[]) printf("Playback open error: %s\n", snd_strerror(err)); return 0; } - + if ((err = set_hwparams(handle, hwparams, transfer_methods[method].access)) < 0) { printf("Setting of hwparams failed: %s\n", snd_strerror(err)); exit(EXIT_FAILURE); @@ -907,7 +907,7 @@ int main(int argc, char *argv[]) printf("No enough memory\n"); exit(EXIT_FAILURE); } - + areas = calloc(channels, sizeof(snd_pcm_channel_area_t)); if (areas == NULL) { printf("No enough memory\n"); diff --git a/test/pcm_min.c b/test/pcm_min.c index 4c120b4c..89c459e6 100644 --- a/test/pcm_min.c +++ b/test/pcm_min.c @@ -32,7 +32,7 @@ int main(void) exit(EXIT_FAILURE); } - for (i = 0; i < 16; i++) { + for (i = 0; i < 16; i++) { frames = snd_pcm_writei(handle, buffer, sizeof(buffer)); if (frames < 0) frames = snd_pcm_recover(handle, frames, 0); diff --git a/test/playmidi1.c b/test/playmidi1.c index 6ca0e397..27086911 100644 --- a/test/playmidi1.c +++ b/test/playmidi1.c @@ -1,5 +1,5 @@ /* - * MIDI file player for ALSA sequencer + * MIDI file player for ALSA sequencer * (type 0 only!, the library that is used doesn't support merging of tracks) * * Copyright (c) 1998 by Frank van de Pol @@ -166,15 +166,15 @@ static void do_header(int format, int ntracks, int division) snd_seq_queue_tempo_alloca(&tempo); /* ppq must be set before starting the timer */ if (snd_seq_get_queue_tempo(seq_handle, dest_queue, tempo) < 0) { - perror("get_queue_tempo"); - exit(1); + perror("get_queue_tempo"); + exit(1); } if ((slave_ppq = snd_seq_queue_tempo_get_ppq(tempo)) != ppq) { snd_seq_queue_tempo_set_ppq(tempo, ppq); if (snd_seq_set_queue_tempo(seq_handle, dest_queue, tempo) < 0) { - perror("set_queue_tempo"); - if (!slave && !shared_queue) - exit(1); + perror("set_queue_tempo"); + if (!slave && !shared_queue) + exit(1); else printf("different PPQ %d in SMF from queue PPQ %d\n", ppq, slave_ppq); } else @@ -186,10 +186,10 @@ static void do_header(int format, int ntracks, int division) /* start playing... */ if (slave) { if (verbose >= VERB_INFO) - printf("Wait till timer starts...\n"); + printf("Wait till timer starts...\n"); wait_start(); if (verbose >= VERB_INFO) - printf("Go!\n"); + printf("Go!\n"); } else if (shared_queue) { snd_seq_queue_status_t *stat; snd_seq_queue_status_alloca(&stat); @@ -369,7 +369,7 @@ static snd_seq_event_t *wait_for_event(void) { int left; snd_seq_event_t *input_event; - + if (use_blocking_mode) { /* read the event - blocked until any event is read */ left = snd_seq_event_input(seq_handle, &input_event); @@ -506,13 +506,13 @@ int main(int argc, char *argv[]) perror("open /dev/snd/seq"); exit(1); } - + tmp = snd_seq_nonblock(seq_handle, !use_blocking_mode); if (tmp < 0) { perror("block_mode"); exit(1); } - + /* set the name */ /* set the event filter to receive only the echo event */ /* if running in slave mode, also listen for a START event */ @@ -529,7 +529,7 @@ int main(int argc, char *argv[]) perror("create port"); exit(1); } - + if (snd_seq_parse_address(seq_handle, &dest_addr, addr) < 0) { perror("invalid destination address"); exit(1); @@ -560,17 +560,17 @@ int main(int argc, char *argv[]) exit(1); } - /* subscribe for the timer START event */ - if (slave) { + /* subscribe for the timer START event */ + if (slave) { tmp = snd_seq_connect_from(seq_handle, my_port, SND_SEQ_CLIENT_SYSTEM, dest_queue + 16 /*snd_seq_queue_sync_port(dest_queue)*/); if (tmp < 0) { perror("subscribe"); exit(1); - } + } } - + /* change the pool size */ if (snd_seq_set_client_pool_output(seq_handle, WRITE_POOL_SIZE) < 0 || snd_seq_set_client_pool_input(seq_handle, READ_POOL_SIZE) < 0 || @@ -578,7 +578,7 @@ int main(int argc, char *argv[]) perror("pool"); exit(1); } - + if (optind < argc) { F = fopen(argv[optind], "r"); if (F == NULL) { diff --git a/test/queue_timer.c b/test/queue_timer.c index 4e1fa967..ae157fdf 100644 --- a/test/queue_timer.c +++ b/test/queue_timer.c @@ -11,7 +11,7 @@ void normalize(struct timeval *tv) } else if (tv->tv_sec < 0) { while (tv->tv_usec <= -1000000) { tv->tv_usec += 1000000; --tv->tv_sec; } while (tv->tv_usec > 0) { tv->tv_usec -= 1000000; ++tv->tv_sec; } - } else { + } else { while (tv->tv_usec >= 1000000) { tv->tv_usec -= 1000000; ++tv->tv_sec; } while (tv->tv_usec < 0) { tv->tv_usec += 1000000; --tv->tv_sec; } } diff --git a/test/rawmidi.c b/test/rawmidi.c index 666acf63..f3f36875 100644 --- a/test/rawmidi.c +++ b/test/rawmidi.c @@ -42,12 +42,12 @@ int main(int argc,char** argv) int fd_in = -1,fd_out = -1; snd_rawmidi_t *handle_in = 0,*handle_out = 0; - + if (argc==1) { usage(); exit(0); } - + for (i = 1 ; idata.note.note, ev->data.note.velocity); break; - + case SND_SEQ_EVENT_CONTROLLER: printf("; ch=%d, param=%i, value=%i\n", ev->data.control.channel, @@ -162,32 +162,32 @@ int decode_event(snd_seq_event_t * ev) ev->data.control.channel, ev->data.control.value); break; - + case SND_SEQ_EVENT_CHANPRESS: case SND_SEQ_EVENT_PITCHBEND: printf("; ch=%d, value=%i\n", ev->data.control.channel, ev->data.control.value); break; - + case SND_SEQ_EVENT_SYSEX: { unsigned char *sysex = (unsigned char *) ev + sizeof(snd_seq_event_t); unsigned int c; - + printf("; len=%d [", ev->data.ext.len); - + for (c = 0; c < ev->data.ext.len; c++) { printf("%02x%s", sysex[c], c < ev->data.ext.len - 1 ? ":" : ""); } printf("]\n"); } break; - + case SND_SEQ_EVENT_QFRAME: printf("; frame=0x%02x\n", ev->data.control.value); break; - + case SND_SEQ_EVENT_CLOCK: case SND_SEQ_EVENT_START: case SND_SEQ_EVENT_CONTINUE: @@ -202,14 +202,14 @@ int decode_event(snd_seq_event_t * ev) case SND_SEQ_EVENT_ECHO: { int i; - + printf("; "); for (i = 0; i < 8; i++) { printf("%02i%s", ev->data.raw8.d[i], i < 7 ? ":" : "\n"); } } break; - + case SND_SEQ_EVENT_CLIENT_START: case SND_SEQ_EVENT_CLIENT_EXIT: case SND_SEQ_EVENT_CLIENT_CHANGE: @@ -340,7 +340,7 @@ void event_decoder(snd_seq_t *handle, int argc, char *argv[]) return; } } - + max = snd_seq_poll_descriptors_count(handle, POLLIN); pfds = alloca(sizeof(*pfds) * max); while (1) { diff --git a/test/seq-sender.c b/test/seq-sender.c index 5d8ac92c..7d11e536 100644 --- a/test/seq-sender.c +++ b/test/seq-sender.c @@ -71,7 +71,7 @@ void event_sender_start_timer(snd_seq_t *handle, snd_pcm_t *phandle ATTRIBUTE_UNUSED) { int err; - + #ifdef USE_PCM if (phandle) { snd_pcm_playback_info_t pinfo; @@ -90,7 +90,7 @@ void event_sender_start_timer(snd_seq_t *handle, fprintf(stderr, "Sequencer PCM timer setup failed: %s\n", snd_strerror(err)); exit(0); } - } + } #endif if ((err = snd_seq_start_queue(handle, queue, NULL))<0) fprintf(stderr, "Timer event output error: %s\n", snd_strerror(err)); @@ -108,11 +108,11 @@ void event_sender_filter(snd_seq_t *handle) } void send_event(snd_seq_t *handle, int queue, int client, int port, - snd_seq_addr_t *dest, int *time) + snd_seq_addr_t *dest, int *time) { int err; snd_seq_event_t ev; - + bzero(&ev, sizeof(ev)); ev.queue = queue; ev.source.client = ev.dest.client = client; @@ -222,7 +222,7 @@ void event_sender(snd_seq_t *handle, int argc, char *argv[]) } #endif event_sender_start_timer(handle, client, queue, phandle); - + /* send the first event */ send_event(handle, queue, client, port, &addr, &time); #ifdef USE_PCM diff --git a/test/seq.c b/test/seq.c index 04f7e5d4..a92a34ba 100644 --- a/test/seq.c +++ b/test/seq.c @@ -28,7 +28,7 @@ void set_name(snd_seq_t *handle) { int err; char name[64]; - + sprintf(name, "SeqUtil - %i", getpid()); if ((err = snd_seq_set_client_name(handle, name)) < 0) { fprintf(stderr, "Set client info error: %s\n", snd_strerror(err)); @@ -40,7 +40,7 @@ void system_info(snd_seq_t *handle) { int err; snd_seq_system_info_t *sysinfo; - + snd_seq_system_info_alloca(&sysinfo); if ((err = snd_seq_system_info(handle, sysinfo))<0) { fprintf(stderr, "System info error: %s\n", snd_strerror(err)); @@ -75,7 +75,7 @@ void show_queue_status(snd_seq_t *handle, int queue) exit(0); } printf("Queue %i info\n", snd_seq_queue_status_get_queue(status)); - printf(" Tick : %u\n", snd_seq_queue_status_get_tick_time(status)); + printf(" Tick : %u\n", snd_seq_queue_status_get_tick_time(status)); printf(" Realtime : %i.%i\n", snd_seq_queue_status_get_real_time(status)->tv_sec, snd_seq_queue_status_get_real_time(status)->tv_nsec); @@ -162,10 +162,10 @@ int main(int argc, char *argv[]) {"verbose", 0, NULL, HELPID_VERBOSE}, {"version", 0, NULL, HELPID_VERSION}, {NULL, 0, NULL, 0}, - }; - - morehelp = 0; - + }; + + morehelp = 0; + while (1) { int c; @@ -193,10 +193,10 @@ int main(int argc, char *argv[]) morehelp++; } } - if (morehelp) { - help(); - return 1; - } + if (morehelp) { + help(); + return 1; + } if (argc - optind <= 0) { fprintf(stderr, "seq: Specify command...\n"); return 0; @@ -208,7 +208,7 @@ int main(int argc, char *argv[]) set_name(handle); system_info(handle); - if (!strcmp(argv[optind], "system")) { + if (!strcmp(argv[optind], "system")) { show_system_info(handle); } else if (!strcmp(argv[optind], "queue")) { arg = argc - optind > 1 ? atoi(argv[optind + 1]) : -1; diff --git a/test/timer.c b/test/timer.c index 63ea4a54..d99ba7d2 100644 --- a/test/timer.c +++ b/test/timer.c @@ -9,7 +9,7 @@ void show_status(void *handle) { int err; snd_timer_status_t *status; - + snd_timer_status_alloca(&status); if ((err = snd_timer_status(handle, status)) < 0) { fprintf(stderr, "timer status %i (%s)\n", err, snd_strerror(err)); @@ -27,7 +27,7 @@ void read_loop(void *handle, int master_ticks, int timeout) int count, err; struct pollfd *fds; snd_timer_read_t tr; - + count = snd_timer_poll_descriptors_count(handle); fds = calloc(count, sizeof(struct pollfd)); if (fds == NULL) { @@ -60,7 +60,7 @@ static void async_callback(snd_async_handler_t *ahandler) snd_timer_t *handle = snd_async_handler_get_timer(ahandler); int *acount = snd_async_handler_get_callback_private(ahandler); snd_timer_read_t tr; - + while (snd_timer_read(handle, &tr, sizeof(tr)) == sizeof(tr)) { printf("TIMER: resolution = %uns, ticks = %u\n", tr.resolution, tr.ticks); diff --git a/test/user-ctl-element-set.c b/test/user-ctl-element-set.c index ceccdba7..13232bfb 100644 --- a/test/user-ctl-element-set.c +++ b/test/user-ctl-element-set.c @@ -270,7 +270,7 @@ static int add_iec958_elem_set(struct elem_set_trial *trial, err = snd_ctl_elem_add_iec958(trial->handle, trial->id); if (err < 0) - return err; + return err; /* * In historical reason, the above API is not allowed to fill all of