]> git.alsa-project.org Git - alsa-lib.git/commitdiff
Better names for ALSA API. Added min_fragments, max_fragments.
authorAbramo Bagnara <abramo@alsa-project.org>
Sat, 27 May 2000 16:52:17 +0000 (16:52 +0000)
committerAbramo Bagnara <abramo@alsa-project.org>
Sat, 27 May 2000 16:52:17 +0000 (16:52 +0000)
26 files changed:
include/control.h
include/pcm.h
include/rawmidi.h
src/control/control.c
src/mixer/elements.c
src/pcm/pcm.c
src/pcm/pcm_common.c
src/pcm/pcm_hw.c
src/pcm/pcm_local.h
src/pcm/pcm_misc.c
src/pcm/pcm_mmap.c
src/pcm/pcm_plug.c
src/pcm/plugin/adpcm.c
src/pcm/plugin/alaw.c
src/pcm/plugin/copy.c
src/pcm/plugin/io.c
src/pcm/plugin/linear.c
src/pcm/plugin/mmap.c
src/pcm/plugin/mulaw.c
src/pcm/plugin/rate.c
src/pcm/plugin/route.c
src/rawmidi/rawmidi.c
test/latency.c
test/midiloop.c
test/pcmtest.c
test/switches.c

index fb97385c6376c9e3ea57cec443c82861bf7f1619..768a4ccfb00abb965a79e5cf1da91444f6e27514 100644 (file)
@@ -44,8 +44,8 @@ int snd_ctl_switch_read(snd_ctl_t *handle, snd_switch_t * sw);
 int snd_ctl_switch_write(snd_ctl_t *handle, snd_switch_t * sw);
 int snd_ctl_hwdep_info(snd_ctl_t *handle, int dev, snd_hwdep_info_t * info);
 int snd_ctl_pcm_info(snd_ctl_t *handle, int dev, snd_pcm_info_t * info);
-int snd_ctl_pcm_channel_info(snd_ctl_t *handle, int dev, int channel, int subdev, snd_pcm_channel_info_t * info);
-int snd_ctl_pcm_channel_prefer_subdevice(snd_ctl_t *handle, int dev, int channel, int subdev);
+int snd_ctl_pcm_stream_info(snd_ctl_t *handle, int dev, int channel, int subdev, snd_pcm_stream_info_t * info);
+int snd_ctl_pcm_stream_prefer_subdevice(snd_ctl_t *handle, int dev, int channel, int subdev);
 int snd_ctl_mixer_info(snd_ctl_t *handle, int dev, snd_mixer_info_t * info);
 int snd_ctl_rawmidi_info(snd_ctl_t *handle, int dev, snd_rawmidi_info_t * info);
 int snd_ctl_read(snd_ctl_t *handle, snd_ctl_callbacks_t * callbacks);
index 4b274ad8047b0013a74f0abb1a80828e91dfd8ff..62d323b95c57cb30059894595aafb9c5d7593488 100644 (file)
@@ -89,31 +89,31 @@ int snd_pcm_open_subdevice(snd_pcm_t **handle, int card, int device, int subdevi
 
 snd_pcm_type_t snd_pcm_type(snd_pcm_t *handle);
 int snd_pcm_close(snd_pcm_t *handle);
-int snd_pcm_channel_close(snd_pcm_t *handle, int channel);
-int snd_pcm_file_descriptor(snd_pcm_t *handle, int channel);
-int snd_pcm_channel_nonblock(snd_pcm_t *handle, int channel, int nonblock);
+int snd_pcm_stream_close(snd_pcm_t *handle, int stream);
+int snd_pcm_file_descriptor(snd_pcm_t *handle, int stream);
+int snd_pcm_stream_nonblock(snd_pcm_t *handle, int stream, int nonblock);
 int snd_pcm_info(snd_pcm_t *handle, snd_pcm_info_t *info);
-int snd_pcm_channel_info(snd_pcm_t *handle, snd_pcm_channel_info_t *info);
-int snd_pcm_channel_params(snd_pcm_t *handle, snd_pcm_channel_params_t *params);
-int snd_pcm_channel_setup(snd_pcm_t *handle, snd_pcm_channel_setup_t *setup);
-int snd_pcm_voice_setup(snd_pcm_t *handle, int channel, snd_pcm_voice_setup_t *setup);
-int snd_pcm_channel_status(snd_pcm_t *handle, snd_pcm_channel_status_t *status);
-int snd_pcm_channel_update(snd_pcm_t *handle, int channel);
+int snd_pcm_stream_info(snd_pcm_t *handle, snd_pcm_stream_info_t *info);
+int snd_pcm_stream_params(snd_pcm_t *handle, snd_pcm_stream_params_t *params);
+int snd_pcm_stream_setup(snd_pcm_t *handle, snd_pcm_stream_setup_t *setup);
+int snd_pcm_channel_setup(snd_pcm_t *handle, int stream, snd_pcm_channel_setup_t *setup);
+int snd_pcm_stream_status(snd_pcm_t *handle, snd_pcm_stream_status_t *status);
+int snd_pcm_stream_update(snd_pcm_t *handle, int stream);
 int snd_pcm_playback_prepare(snd_pcm_t *handle);
 int snd_pcm_capture_prepare(snd_pcm_t *handle);
-int snd_pcm_channel_prepare(snd_pcm_t *handle, int channel);
+int snd_pcm_stream_prepare(snd_pcm_t *handle, int stream);
 int snd_pcm_playback_go(snd_pcm_t *handle);
 int snd_pcm_capture_go(snd_pcm_t *handle);
-int snd_pcm_channel_go(snd_pcm_t *handle, int channel);
+int snd_pcm_stream_go(snd_pcm_t *handle, int stream);
 int snd_pcm_sync_go(snd_pcm_t *handle, snd_pcm_sync_t *sync);
 int snd_pcm_playback_drain(snd_pcm_t *handle);
-int snd_pcm_channel_drain(snd_pcm_t *handle, int channel);
+int snd_pcm_stream_drain(snd_pcm_t *handle, int stream);
 int snd_pcm_playback_flush(snd_pcm_t *handle);
 int snd_pcm_capture_flush(snd_pcm_t *handle);
-int snd_pcm_channel_flush(snd_pcm_t *handle, int channel);
+int snd_pcm_stream_flush(snd_pcm_t *handle, int stream);
 int snd_pcm_playback_pause(snd_pcm_t *handle, int enable);
-int snd_pcm_channel_pause(snd_pcm_t *handle, int channel, int enable);
-ssize_t snd_pcm_transfer_size(snd_pcm_t *handle, int channel);
+int snd_pcm_stream_pause(snd_pcm_t *handle, int stream, int enable);
+ssize_t snd_pcm_transfer_size(snd_pcm_t *handle, int stream);
 ssize_t snd_pcm_write(snd_pcm_t *handle, const void *buffer, size_t size);
 ssize_t snd_pcm_read(snd_pcm_t *handle, void *buffer, size_t size);
 ssize_t snd_pcm_writev(snd_pcm_t *pcm, const struct iovec *vector, unsigned long  count);
@@ -121,42 +121,42 @@ ssize_t snd_pcm_readv(snd_pcm_t *pcm, const struct iovec *vector, unsigned long
 const char *snd_pcm_get_format_name(int format);
 const char *snd_pcm_get_format_description(int format);
 int snd_pcm_get_format_value(const char* name);
-int snd_pcm_dump_setup(snd_pcm_t *pcm, int channel, FILE *fp);
-
-int snd_pcm_mmap(snd_pcm_t *handle, int channel, snd_pcm_mmap_control_t **control, void **buffer);
-int snd_pcm_munmap(snd_pcm_t *handle, int channel);
-int snd_pcm_mmap_control(snd_pcm_t *handle, int channel, snd_pcm_mmap_control_t **control);
-int snd_pcm_mmap_data(snd_pcm_t *handle, int channel, void **buffer);
-int snd_pcm_munmap_control(snd_pcm_t *handle, int channel);
-int snd_pcm_munmap_data(snd_pcm_t *handle, int channel);
-int snd_pcm_voices_mask(snd_pcm_t *pcm, int channel, bitset_t *client_vmask);
-int snd_pcm_mmap_ready(snd_pcm_t *pcm, int channel);
+int snd_pcm_dump_setup(snd_pcm_t *pcm, int stream, FILE *fp);
+
+int snd_pcm_mmap(snd_pcm_t *handle, int stream, snd_pcm_mmap_control_t **control, void **buffer);
+int snd_pcm_munmap(snd_pcm_t *handle, int stream);
+int snd_pcm_mmap_control(snd_pcm_t *handle, int stream, snd_pcm_mmap_control_t **control);
+int snd_pcm_mmap_data(snd_pcm_t *handle, int stream, void **buffer);
+int snd_pcm_munmap_control(snd_pcm_t *handle, int stream);
+int snd_pcm_munmap_data(snd_pcm_t *handle, int stream);
+int snd_pcm_channels_mask(snd_pcm_t *pcm, int stream, bitset_t *client_vmask);
+int snd_pcm_mmap_ready(snd_pcm_t *pcm, int stream);
 ssize_t snd_pcm_mmap_write(snd_pcm_t *handle, const void *buffer, size_t size);
 ssize_t snd_pcm_mmap_read(snd_pcm_t *handle, void *buffer, size_t size);
 ssize_t snd_pcm_mmap_writev(snd_pcm_t *pcm, const struct iovec *vector, unsigned long  count);
 ssize_t snd_pcm_mmap_readv(snd_pcm_t *pcm, const struct iovec *vector, unsigned long count);
-int snd_pcm_mmap_frames_used(snd_pcm_t *pcm, int channel, ssize_t *frames);
-int snd_pcm_mmap_frames_free(snd_pcm_t *pcm, int channel, ssize_t *frames);
-ssize_t snd_pcm_mmap_frames_xfer(snd_pcm_t *pcm, int channel, size_t frames);
-ssize_t snd_pcm_mmap_frames_offset(snd_pcm_t *pcm, int channel);
-int snd_pcm_mmap_commit_frames(snd_pcm_t *pcm, int channel, int frames);
-ssize_t snd_pcm_mmap_write_areas(snd_pcm_t *pcm, snd_pcm_voice_area_t *voices, size_t frames);
+int snd_pcm_mmap_frames_used(snd_pcm_t *pcm, int stream, ssize_t *frames);
+int snd_pcm_mmap_frames_free(snd_pcm_t *pcm, int stream, ssize_t *frames);
+ssize_t snd_pcm_mmap_frames_xfer(snd_pcm_t *pcm, int stream, size_t frames);
+ssize_t snd_pcm_mmap_frames_offset(snd_pcm_t *pcm, int stream);
+int snd_pcm_mmap_commit_frames(snd_pcm_t *pcm, int stream, int frames);
+ssize_t snd_pcm_mmap_write_areas(snd_pcm_t *pcm, snd_pcm_channel_area_t *channels, size_t frames);
 ssize_t snd_pcm_mmap_write_frames(snd_pcm_t *pcm, const void *buffer, size_t frames);
-ssize_t snd_pcm_mmap_read_areas(snd_pcm_t *pcm, snd_pcm_voice_area_t *voices, size_t frames);
+ssize_t snd_pcm_mmap_read_areas(snd_pcm_t *pcm, snd_pcm_channel_area_t *channels, size_t frames);
 ssize_t snd_pcm_mmap_read_frames(snd_pcm_t *pcm, const void *buffer, size_t frames);
-int snd_pcm_mmap_get_areas(snd_pcm_t *pcm, int channel, snd_pcm_voice_area_t *areas);
+int snd_pcm_mmap_get_areas(snd_pcm_t *pcm, int stream, snd_pcm_channel_area_t *areas);
 
-ssize_t snd_pcm_bytes_per_second(snd_pcm_t *pcm, int channel);
+ssize_t snd_pcm_bytes_per_second(snd_pcm_t *pcm, int stream);
 
-int snd_pcm_area_silence(const snd_pcm_voice_area_t *dst_voice, size_t dst_offset,
+int snd_pcm_area_silence(const snd_pcm_channel_area_t *dst_channel, size_t dst_offset,
                         size_t samples, int format);
-int snd_pcm_areas_silence(const snd_pcm_voice_area_t *dst_voices, size_t dst_offset,
+int snd_pcm_areas_silence(const snd_pcm_channel_area_t *dst_channels, size_t dst_offset,
                          size_t vcount, size_t frames, int format);
-int snd_pcm_area_copy(const snd_pcm_voice_area_t *src_voice, size_t src_offset,
-                     const snd_pcm_voice_area_t *dst_voice, size_t dst_offset,
+int snd_pcm_area_copy(const snd_pcm_channel_area_t *src_channel, size_t src_offset,
+                     const snd_pcm_channel_area_t *dst_channel, size_t dst_offset,
                      size_t samples, int format);
-int snd_pcm_areas_copy(const snd_pcm_voice_area_t *src_voices, size_t src_offset,
-                      const snd_pcm_voice_area_t *dst_voices, size_t dst_offset,
+int snd_pcm_areas_copy(const snd_pcm_channel_area_t *src_channels, size_t src_offset,
+                      const snd_pcm_channel_area_t *dst_channels, size_t dst_offset,
                       size_t vcount, size_t frames, int format);
 
 /* misc */
@@ -200,34 +200,34 @@ typedef enum {
        PAUSE = 4,
 } snd_pcm_plugin_action_t;
 
-typedef struct snd_stru_pcm_plugin_voice {
+typedef struct snd_stru_pcm_plugin_channel {
        void *aptr;                     /* pointer to the allocated area */
-       snd_pcm_voice_area_t area;
-       unsigned int enabled:1;         /* voice need to be processed */
-       unsigned int wanted:1;          /* voice is wanted */
-} snd_pcm_plugin_voice_t;
+       snd_pcm_channel_area_t area;
+       unsigned int enabled:1;         /* channel need to be processed */
+       unsigned int wanted:1;          /* channel is wanted */
+} snd_pcm_plugin_channel_t;
 
 struct snd_stru_pcm_plugin {
        char *name;                     /* plug-in name */
-       int channel;
+       int stream;
        snd_pcm_format_t src_format;    /* source format */
        snd_pcm_format_t dst_format;    /* destination format */
        int src_width;                  /* sample width in bits */
        int dst_width;                  /* sample width in bits */
        ssize_t (*src_frames)(snd_pcm_plugin_t *plugin, size_t dst_frames);
        ssize_t (*dst_frames)(snd_pcm_plugin_t *plugin, size_t src_frames);
-       ssize_t (*client_voices)(snd_pcm_plugin_t *plugin,
+       ssize_t (*client_channels)(snd_pcm_plugin_t *plugin,
                                 size_t frames,
-                                snd_pcm_plugin_voice_t **voices);
-       int (*src_voices_mask)(snd_pcm_plugin_t *plugin,
+                                snd_pcm_plugin_channel_t **channels);
+       int (*src_channels_mask)(snd_pcm_plugin_t *plugin,
                               bitset_t *dst_vmask,
                               bitset_t **src_vmask);
-       int (*dst_voices_mask)(snd_pcm_plugin_t *plugin,
+       int (*dst_channels_mask)(snd_pcm_plugin_t *plugin,
                               bitset_t *src_vmask,
                               bitset_t **dst_vmask);
        ssize_t (*transfer)(snd_pcm_plugin_t *plugin,
-                           const snd_pcm_plugin_voice_t *src_voices,
-                           snd_pcm_plugin_voice_t *dst_voices,
+                           const snd_pcm_plugin_channel_t *src_channels,
+                           snd_pcm_plugin_channel_t *dst_channels,
                            size_t frames);
        int (*action)(snd_pcm_plugin_t *plugin,
                      snd_pcm_plugin_action_t action,
@@ -243,8 +243,8 @@ struct snd_stru_pcm_plugin {
        snd_pcm_plugin_handle_t *handle;
        void *private_data;
        void (*private_free)(snd_pcm_plugin_t *plugin, void *private_data);
-       snd_pcm_plugin_voice_t *src_voices;
-       snd_pcm_plugin_voice_t *dst_voices;
+       snd_pcm_plugin_channel_t *src_channels;
+       snd_pcm_plugin_channel_t *dst_channels;
        bitset_t *src_vmask;
        bitset_t *dst_vmask;
        char extra_data[0];
@@ -255,20 +255,20 @@ int snd_pcm_plug_open_subdevice(snd_pcm_t **handle, int card, int device, int su
 int snd_pcm_plug_open(snd_pcm_t **handle, int card, int device, int mode);
 
 int snd_pcm_plugin_free(snd_pcm_plugin_t *plugin);
-int snd_pcm_plug_clear(snd_pcm_t *handle, int channel);
+int snd_pcm_plug_clear(snd_pcm_t *handle, int stream);
 int snd_pcm_plugin_insert(snd_pcm_plugin_t *plugin);
 int snd_pcm_plugin_append(snd_pcm_plugin_t *plugin);
 #if 0
 int snd_pcm_plugin_remove_to(snd_pcm_plugin_t *plugin);
-int snd_pcm_plug_remove_first(snd_pcm_t *handle, int channel);
+int snd_pcm_plug_remove_first(snd_pcm_t *handle, int stream);
 #endif
-snd_pcm_plugin_t *snd_pcm_plug_first(snd_pcm_t *handle, int channel);
-snd_pcm_plugin_t *snd_pcm_plug_last(snd_pcm_t *handle, int channel);
-int snd_pcm_plug_direct(snd_pcm_t *pcm, int channel);
-ssize_t snd_pcm_plug_client_frames(snd_pcm_t *handle, int channel, size_t drv_frames);
-ssize_t snd_pcm_plug_slave_frames(snd_pcm_t *handle, int channel, size_t clt_frames);
-ssize_t snd_pcm_plug_client_size(snd_pcm_t *handle, int channel, size_t drv_size);
-ssize_t snd_pcm_plug_slave_size(snd_pcm_t *handle, int channel, size_t clt_size);
+snd_pcm_plugin_t *snd_pcm_plug_first(snd_pcm_t *handle, int stream);
+snd_pcm_plugin_t *snd_pcm_plug_last(snd_pcm_t *handle, int stream);
+int snd_pcm_plug_direct(snd_pcm_t *pcm, int stream);
+ssize_t snd_pcm_plug_client_frames(snd_pcm_t *handle, int stream, size_t drv_frames);
+ssize_t snd_pcm_plug_slave_frames(snd_pcm_t *handle, int stream, size_t clt_frames);
+ssize_t snd_pcm_plug_client_size(snd_pcm_t *handle, int stream, size_t drv_size);
+ssize_t snd_pcm_plug_slave_size(snd_pcm_t *handle, int stream, size_t clt_size);
 
 /*
  *  Plug-In helpers
@@ -284,7 +284,7 @@ ssize_t snd_pcm_plugin_dst_size_to_frames(snd_pcm_plugin_t *plugin, size_t size)
  */
 
 int snd_pcm_plugin_build(snd_pcm_plugin_handle_t *handle,
-                        int channel,
+                        int stream,
                         const char *name,
                         snd_pcm_format_t *src_format,
                         snd_pcm_format_t *dst_format,
@@ -292,12 +292,12 @@ int snd_pcm_plugin_build(snd_pcm_plugin_handle_t *handle,
                         snd_pcm_plugin_t **ret);
 /* basic I/O */
 int snd_pcm_plugin_build_io(snd_pcm_plugin_handle_t *handle,
-                           int channel,
+                           int stream,
                            snd_pcm_t *slave,
                            snd_pcm_format_t *format,
                            snd_pcm_plugin_t **r_plugin);
 int snd_pcm_plugin_build_mmap(snd_pcm_plugin_handle_t *handle,
-                             int channel,
+                             int stream,
                              snd_pcm_t *slave,
                              snd_pcm_format_t *format,
                              snd_pcm_plugin_t **r_plugin);
@@ -315,43 +315,43 @@ typedef int route_ttable_entry_t;
 
 /* conversion plugins */
 int snd_pcm_plugin_build_interleave(snd_pcm_plugin_handle_t *handle,
-                                   int channel,
+                                   int stream,
                                    snd_pcm_format_t *src_format,
                                    snd_pcm_format_t *dst_format,
                                    snd_pcm_plugin_t **r_plugin);
 int snd_pcm_plugin_build_linear(snd_pcm_plugin_handle_t *handle,
-                               int channel,
+                               int stream,
                                snd_pcm_format_t *src_format,
                                snd_pcm_format_t *dst_format,
                                snd_pcm_plugin_t **r_plugin);
 int snd_pcm_plugin_build_mulaw(snd_pcm_plugin_handle_t *handle,
-                              int channel,
+                              int stream,
                               snd_pcm_format_t *src_format,
                               snd_pcm_format_t *dst_format,
                               snd_pcm_plugin_t **r_plugin);
 int snd_pcm_plugin_build_alaw(snd_pcm_plugin_handle_t *handle,
-                             int channel,
+                             int stream,
                              snd_pcm_format_t *src_format,
                              snd_pcm_format_t *dst_format,
                              snd_pcm_plugin_t **r_plugin);
 int snd_pcm_plugin_build_adpcm(snd_pcm_plugin_handle_t *handle,
-                              int channel,
+                              int stream,
                               snd_pcm_format_t *src_format,
                               snd_pcm_format_t *dst_format,
                               snd_pcm_plugin_t **r_plugin);
 int snd_pcm_plugin_build_rate(snd_pcm_plugin_handle_t *handle,
-                             int channel,
+                             int stream,
                              snd_pcm_format_t *src_format,
                              snd_pcm_format_t *dst_format,
                              snd_pcm_plugin_t **r_plugin);
 int snd_pcm_plugin_build_route(snd_pcm_plugin_handle_t *handle,
-                              int channel,
+                              int stream,
                               snd_pcm_format_t *src_format,
                               snd_pcm_format_t *dst_format,
                               route_ttable_entry_t *ttable,
                               snd_pcm_plugin_t **r_plugin);
 int snd_pcm_plugin_build_copy(snd_pcm_plugin_handle_t *handle,
-                             int channel,
+                             int stream,
                              snd_pcm_format_t *src_format,
                              snd_pcm_format_t *dst_format,
                              snd_pcm_plugin_t **r_plugin);
index 0ef35c41ba09b5067fddaabd57518cba049787f3..087b88217efffe2f4b1662ffc21d32e875d4673e 100644 (file)
@@ -23,13 +23,13 @@ int snd_rawmidi_close(snd_rawmidi_t *handle);
 int snd_rawmidi_file_descriptor(snd_rawmidi_t *handle);
 int snd_rawmidi_block_mode(snd_rawmidi_t *handle, int enable);
 int snd_rawmidi_info(snd_rawmidi_t *handle, snd_rawmidi_info_t * info);
-int snd_rawmidi_channel_params(snd_rawmidi_t *handle, snd_rawmidi_params_t * params);
-int snd_rawmidi_channel_setup(snd_rawmidi_t *handle, snd_rawmidi_setup_t * setup);
-int snd_rawmidi_channel_status(snd_rawmidi_t *handle, snd_rawmidi_status_t * status);
+int snd_rawmidi_stream_params(snd_rawmidi_t *handle, snd_rawmidi_params_t * params);
+int snd_rawmidi_stream_setup(snd_rawmidi_t *handle, snd_rawmidi_setup_t * setup);
+int snd_rawmidi_stream_status(snd_rawmidi_t *handle, snd_rawmidi_status_t * status);
 int snd_rawmidi_output_drain(snd_rawmidi_t *handle);
 int snd_rawmidi_output_flush(snd_rawmidi_t *handle);
 int snd_rawmidi_input_flush(snd_rawmidi_t *handle);
-int snd_rawmidi_channel_flush(snd_rawmidi_t *handle, int channel);
+int snd_rawmidi_stream_flush(snd_rawmidi_t *handle, int channel);
 ssize_t snd_rawmidi_write(snd_rawmidi_t *handle, const void *buffer, size_t size);
 ssize_t snd_rawmidi_read(snd_rawmidi_t *handle, void *buffer, size_t size);
 
index 74d4f7be021ebee2a434a8229c5d9e8afb7d19bd..248a6cb378af26f9ddf96c7ff5b41426aa9eed34 100644 (file)
@@ -171,34 +171,34 @@ int snd_ctl_pcm_info(snd_ctl_t *handle, int dev, snd_pcm_info_t * info)
        return 0;
 }
 
-int snd_ctl_pcm_channel_info(snd_ctl_t *handle, int dev, int chn, int subdev, snd_pcm_channel_info_t * info)
+int snd_ctl_pcm_stream_info(snd_ctl_t *handle, int dev, int str, int subdev, snd_pcm_stream_info_t * info)
 {
        snd_ctl_t *ctl;
 
        ctl = handle;
-       if (!ctl || !info || dev < 0 || chn < 0 || chn > 1 || subdev < 0)
+       if (!ctl || !info || dev < 0 || str < 0 || str > 1 || subdev < 0)
                return -EINVAL;
        if (ioctl(ctl->fd, SND_CTL_IOCTL_PCM_DEVICE, &dev) < 0)
                return -errno;
-       if (ioctl(ctl->fd, SND_CTL_IOCTL_PCM_CHANNEL, &chn) < 0)
+       if (ioctl(ctl->fd, SND_CTL_IOCTL_PCM_STREAM, &str) < 0)
                return -errno;
        if (ioctl(ctl->fd, SND_CTL_IOCTL_PCM_SUBDEVICE, &subdev) < 0)
                return -errno;
-       if (ioctl(ctl->fd, SND_CTL_IOCTL_PCM_CHANNEL_INFO, info) < 0)
+       if (ioctl(ctl->fd, SND_CTL_IOCTL_PCM_STREAM_INFO, info) < 0)
                return -errno;
        return 0;
 }
 
-int snd_ctl_pcm_channel_prefer_subdevice(snd_ctl_t *handle, int dev, int chn, int subdev)
+int snd_ctl_pcm_stream_prefer_subdevice(snd_ctl_t *handle, int dev, int str, int subdev)
 {
        snd_ctl_t *ctl;
 
        ctl = handle;
-       if (!ctl || dev < 0 || chn < 0 || chn > 1)
+       if (!ctl || dev < 0 || str < 0 || str > 1)
                return -EINVAL;
        if (ioctl(ctl->fd, SND_CTL_IOCTL_PCM_DEVICE, &dev) < 0)
                return -errno;
-       if (ioctl(ctl->fd, SND_CTL_IOCTL_PCM_CHANNEL, &chn) < 0)
+       if (ioctl(ctl->fd, SND_CTL_IOCTL_PCM_STREAM, &str) < 0)
                return -errno;
        if (ioctl(ctl->fd, SND_CTL_IOCTL_PCM_PREFER_SUBDEVICE, &subdev) < 0)
                return -errno;
@@ -261,7 +261,7 @@ int snd_ctl_read(snd_ctl_t *handle, snd_ctl_callbacks_t * callbacks)
                                callbacks->xswitch(callbacks->private_data,
                                                   r.cmd, r.data.sw.iface,
                                                   r.data.sw.device,
-                                                  r.data.sw.channel,
+                                                  r.data.sw.stream,
                                                   &r.data.sw.switem);
                        break;
                }
index ef3462f67f3ca469cfc0875d60e728622d048671..7644e9a91ec57a739d12e709654f5d34d35e0412 100644 (file)
@@ -73,10 +73,10 @@ int snd_mixer_element_info_build(snd_mixer_t *handle, snd_mixer_element_info_t *
        switch (element->eid.type) {
        case SND_MIXER_ETYPE_INPUT:
        case SND_MIXER_ETYPE_OUTPUT:
-               element->data.io.voices_size = element->data.io.voices_over;
-               element->data.io.voices = element->data.io.voices_over = 0;
-               element->data.io.pvoices = (snd_mixer_voice_t *)malloc(element->data.io.voices_size * sizeof(snd_mixer_voice_t));
-               if (!element->data.io.pvoices)
+               element->data.io.channels_size = element->data.io.channels_over;
+               element->data.io.channels = element->data.io.channels_over = 0;
+               element->data.io.pchannels = (snd_mixer_channel_t *)malloc(element->data.io.channels_size * sizeof(snd_mixer_channel_t));
+               if (!element->data.io.pchannels)
                        return -ENOMEM;
                if ((err = snd_mixer_element_info(handle, element)) < 0)
                        return err;
@@ -101,16 +101,16 @@ int snd_mixer_element_info_build(snd_mixer_t *handle, snd_mixer_element_info_t *
                        return err;
                break;
        case SND_MIXER_ETYPE_VOLUME2:
-               element->data.volume2.svoices_size = element->data.volume2.svoices_over;
-               element->data.volume2.svoices = element->data.volume2.svoices_over = 0;
-               element->data.volume2.psvoices = (snd_mixer_voice_t *)malloc(element->data.volume2.svoices_size * sizeof(snd_mixer_voice_t));
-               if (!element->data.volume2.psvoices)
+               element->data.volume2.schannels_size = element->data.volume2.schannels_over;
+               element->data.volume2.schannels = element->data.volume2.schannels_over = 0;
+               element->data.volume2.pschannels = (snd_mixer_channel_t *)malloc(element->data.volume2.schannels_size * sizeof(snd_mixer_channel_t));
+               if (!element->data.volume2.pschannels)
                        return -ENOMEM;
                element->data.volume2.range_size = element->data.volume2.range_over;
                element->data.volume2.range = element->data.volume2.range_over = 0;
                element->data.volume2.prange = (struct snd_mixer_element_volume2_range *)malloc(element->data.volume2.range_size * sizeof(struct snd_mixer_element_volume2_range));
                if (!element->data.volume1.prange) {
-                       safe_free((void **)&element->data.volume2.psvoices);
+                       safe_free((void **)&element->data.volume2.pschannels);
                        return -ENOMEM;
                }
                if ((err = snd_mixer_element_info(handle, element)) < 0)
@@ -161,7 +161,7 @@ int snd_mixer_element_info_free(snd_mixer_element_info_t *element)
        switch (element->eid.type) {
        case SND_MIXER_ETYPE_INPUT:
        case SND_MIXER_ETYPE_OUTPUT:
-               safe_free((void **)&element->data.io.pvoices);
+               safe_free((void **)&element->data.io.pchannels);
                break;
        case SND_MIXER_ETYPE_CAPTURE1:
        case SND_MIXER_ETYPE_PLAYBACK1:
@@ -171,7 +171,7 @@ int snd_mixer_element_info_free(snd_mixer_element_info_t *element)
                safe_free((void **)&element->data.volume1.prange);
                break;
        case SND_MIXER_ETYPE_VOLUME2:
-               safe_free((void **)&element->data.volume2.psvoices);
+               safe_free((void **)&element->data.volume2.pschannels);
                safe_free((void **)&element->data.volume1.prange);
                break;
        case SND_MIXER_ETYPE_ACCU3:
@@ -238,28 +238,28 @@ int snd_mixer_element_build(snd_mixer_t *handle, snd_mixer_element_t *element)
                        return err;
                break;
        case SND_MIXER_ETYPE_VOLUME1:
-               element->data.volume1.voices_size = element->data.volume1.voices_over;
-               element->data.volume1.voices = element->data.volume1.voices_over = 0;
-               element->data.volume1.pvoices = (int *)malloc(element->data.volume1.voices_size * sizeof(int));
-               if (!element->data.volume1.pvoices)
+               element->data.volume1.channels_size = element->data.volume1.channels_over;
+               element->data.volume1.channels = element->data.volume1.channels_over = 0;
+               element->data.volume1.pchannels = (int *)malloc(element->data.volume1.channels_size * sizeof(int));
+               if (!element->data.volume1.pchannels)
                        return -ENOMEM;
                if ((err = snd_mixer_element_read(handle, element)) < 0)
                        return err;
                break;
        case SND_MIXER_ETYPE_VOLUME2:
-               element->data.volume2.avoices_size = element->data.volume2.avoices_over;
-               element->data.volume2.avoices = element->data.volume2.avoices_over = 0;
-               element->data.volume2.pavoices = (int *)malloc(element->data.volume2.avoices_size * sizeof(int));
-               if (!element->data.volume2.pavoices)
+               element->data.volume2.achannels_size = element->data.volume2.achannels_over;
+               element->data.volume2.achannels = element->data.volume2.achannels_over = 0;
+               element->data.volume2.pachannels = (int *)malloc(element->data.volume2.achannels_size * sizeof(int));
+               if (!element->data.volume2.pachannels)
                        return -ENOMEM;
                if ((err = snd_mixer_element_read(handle, element)) < 0)
                        return err;
                break;
        case SND_MIXER_ETYPE_ACCU3:
-               element->data.accu3.voices_size = element->data.accu3.voices_over;
-               element->data.accu3.voices = element->data.accu3.voices_over = 0;
-               element->data.accu3.pvoices = (int *)malloc(element->data.accu3.voices_size * sizeof(int));
-               if (!element->data.accu3.pvoices)
+               element->data.accu3.channels_size = element->data.accu3.channels_over;
+               element->data.accu3.channels = element->data.accu3.channels_over = 0;
+               element->data.accu3.pchannels = (int *)malloc(element->data.accu3.channels_size * sizeof(int));
+               if (!element->data.accu3.pchannels)
                        return -ENOMEM;
                if ((err = snd_mixer_element_read(handle, element)) < 0)
                        return err;
@@ -309,13 +309,13 @@ int snd_mixer_element_free(snd_mixer_element_t *element)
                safe_free((void **)&element->data.switch3.prsw);
                break;
        case SND_MIXER_ETYPE_VOLUME1:
-               safe_free((void **)&element->data.volume1.pvoices);
+               safe_free((void **)&element->data.volume1.pchannels);
                break;
        case SND_MIXER_ETYPE_VOLUME2:
-               safe_free((void **)&element->data.volume2.pavoices);
+               safe_free((void **)&element->data.volume2.pachannels);
                break;
        case SND_MIXER_ETYPE_ACCU3:
-               safe_free((void **)&element->data.accu3.pvoices);
+               safe_free((void **)&element->data.accu3.pchannels);
                break;
        case SND_MIXER_ETYPE_MUX1:
                safe_free((void **)&element->data.mux1.psel);
index 0bd53ca25714ec8b67b2b678d9c53dbc6d18ce5e..f2168b3b4fb84d8ff3b4d38fe5872a29383d25ea 100644 (file)
@@ -40,14 +40,14 @@ int snd_pcm_abstract_open(snd_pcm_t **handle, int mode,
        if (pcm == NULL)
                return -ENOMEM;
        if (mode & SND_PCM_OPEN_PLAYBACK) {
-               struct snd_pcm_chan *chan = &pcm->chan[SND_PCM_CHANNEL_PLAYBACK];
-               chan->open = 1;
-               chan->mode = (mode & SND_PCM_NONBLOCK_PLAYBACK) ? SND_PCM_NONBLOCK : 0;
+               struct snd_pcm_stream *str = &pcm->stream[SND_PCM_STREAM_PLAYBACK];
+               str->open = 1;
+               str->mode = (mode & SND_PCM_NONBLOCK_PLAYBACK) ? SND_PCM_NONBLOCK : 0;
        }
        if (mode & SND_PCM_OPEN_CAPTURE) {
-               struct snd_pcm_chan *chan = &pcm->chan[SND_PCM_CHANNEL_CAPTURE];
-               chan->open = 1;
-               chan->mode = (mode & SND_PCM_NONBLOCK_CAPTURE) ? SND_PCM_NONBLOCK : 0;
+               struct snd_pcm_stream *str = &pcm->stream[SND_PCM_STREAM_CAPTURE];
+               str->open = 1;
+               str->mode = (mode & SND_PCM_NONBLOCK_CAPTURE) ? SND_PCM_NONBLOCK : 0;
        }
        pcm->type = type;
        pcm->mode = mode & SND_PCM_OPEN_DUPLEX;
@@ -60,43 +60,43 @@ snd_pcm_type_t snd_pcm_type(snd_pcm_t *handle)
        return handle->type;
 }
 
-int snd_pcm_channel_close(snd_pcm_t *pcm, int channel)
+int snd_pcm_stream_close(snd_pcm_t *pcm, int stream)
 {
        int ret = 0;
        int err;
-       struct snd_pcm_chan *chan;
+       struct snd_pcm_stream *str;
        if (!pcm)
                return -EFAULT;
-       if (channel < 0 || channel > 1)
+       if (stream < 0 || stream > 1)
                return -EINVAL;
-       chan = &pcm->chan[channel];
-       if (!chan->open)
+       str = &pcm->stream[stream];
+       if (!str->open)
                return -EBADFD;
-       if (chan->mmap_control) {
-               if ((err = snd_pcm_munmap_control(pcm, channel)) < 0)
+       if (str->mmap_control) {
+               if ((err = snd_pcm_munmap_control(pcm, stream)) < 0)
                        ret = err;
        }
-       if (chan->mmap_data) {
-               if ((err = snd_pcm_munmap_data(pcm, channel)) < 0)
+       if (str->mmap_data) {
+               if ((err = snd_pcm_munmap_data(pcm, stream)) < 0)
                        ret = err;
        }
-       if ((err = pcm->ops->channel_close(pcm, channel)) < 0)
+       if ((err = pcm->ops->stream_close(pcm, stream)) < 0)
                ret = err;
-       chan->open = 0;
-       chan->valid_setup = 0;
+       str->open = 0;
+       str->valid_setup = 0;
        return ret;
 }      
 
 int snd_pcm_close(snd_pcm_t *pcm)
 {
        int err, ret = 0;
-       int channel;
+       int stream;
 
        if (!pcm)
                return -EFAULT;
-       for (channel = 0; channel < 2; ++channel) {
-               if (pcm->chan[channel].open) {
-                       if ((err = snd_pcm_channel_close(pcm, channel)) < 0)
+       for (stream = 0; stream < 2; ++stream) {
+               if (pcm->stream[stream].open) {
+                       if ((err = snd_pcm_stream_close(pcm, stream)) < 0)
                                ret = err;
                }
        }
@@ -104,21 +104,21 @@ int snd_pcm_close(snd_pcm_t *pcm)
        return ret;
 }
 
-int snd_pcm_channel_nonblock(snd_pcm_t *pcm, int channel, int nonblock)
+int snd_pcm_stream_nonblock(snd_pcm_t *pcm, int stream, int nonblock)
 {
        int err;
        if (!pcm)
                return -EFAULT;
-       if (channel < 0 || channel > 1)
+       if (stream < 0 || stream > 1)
                return -EINVAL;
-       if (!pcm->chan[channel].open)
+       if (!pcm->stream[stream].open)
                return -EBADFD;
-       if ((err = pcm->ops->channel_nonblock(pcm, channel, nonblock)) < 0)
+       if ((err = pcm->ops->stream_nonblock(pcm, stream, nonblock)) < 0)
                return err;
        if (nonblock)
-               pcm->chan[channel].mode |= SND_PCM_NONBLOCK;
+               pcm->stream[stream].mode |= SND_PCM_NONBLOCK;
        else
-               pcm->chan[channel].mode &= ~SND_PCM_NONBLOCK;
+               pcm->stream[stream].mode &= ~SND_PCM_NONBLOCK;
        return 0;
 }
 
@@ -129,190 +129,190 @@ int snd_pcm_info(snd_pcm_t *pcm, snd_pcm_info_t *info)
        return pcm->ops->info(pcm, info);
 }
 
-int snd_pcm_channel_info(snd_pcm_t *pcm, snd_pcm_channel_info_t *info)
+int snd_pcm_stream_info(snd_pcm_t *pcm, snd_pcm_stream_info_t *info)
 {
        if (!pcm || !info)
                return -EFAULT;
-       if (info->channel < 0 || info->channel > 1)
+       if (info->stream < 0 || info->stream > 1)
                return -EINVAL;
-       if (!pcm->chan[info->channel].open)
+       if (!pcm->stream[info->stream].open)
                return -EBADFD;
-       return pcm->ops->channel_info(pcm, info);
+       return pcm->ops->stream_info(pcm, info);
 }
 
-int snd_pcm_channel_params(snd_pcm_t *pcm, snd_pcm_channel_params_t *params)
+int snd_pcm_stream_params(snd_pcm_t *pcm, snd_pcm_stream_params_t *params)
 {
        int err;
-       snd_pcm_channel_setup_t setup;
-       struct snd_pcm_chan *chan;
+       snd_pcm_stream_setup_t setup;
+       struct snd_pcm_stream *str;
        if (!pcm || !params)
                return -EFAULT;
-       if (params->channel < 0 || params->channel > 1)
+       if (params->stream < 0 || params->stream > 1)
                return -EINVAL;
-       chan = &pcm->chan[params->channel];
-       if (!chan->open)
+       str = &pcm->stream[params->stream];
+       if (!str->open)
                return -EBADFD;
-       if (chan->mmap_control)
+       if (str->mmap_control)
                return -EBADFD;
-       if ((err = pcm->ops->channel_params(pcm, params)) < 0)
+       if ((err = pcm->ops->stream_params(pcm, params)) < 0)
                return err;
-       chan->valid_setup = 0;
-       setup.channel = params->channel;
-       return snd_pcm_channel_setup(pcm, &setup);
+       str->valid_setup = 0;
+       setup.stream = params->stream;
+       return snd_pcm_stream_setup(pcm, &setup);
 }
 
-int snd_pcm_channel_setup(snd_pcm_t *pcm, snd_pcm_channel_setup_t *setup)
+int snd_pcm_stream_setup(snd_pcm_t *pcm, snd_pcm_stream_setup_t *setup)
 {
        int err;
-       struct snd_pcm_chan *chan;
+       struct snd_pcm_stream *str;
        if (!pcm || !setup)
                return -EFAULT;
-       if (setup->channel < 0 || setup->channel > 1)
+       if (setup->stream < 0 || setup->stream > 1)
                return -EINVAL;
-       chan = &pcm->chan[setup->channel];
-       if (!chan->open)
+       str = &pcm->stream[setup->stream];
+       if (!str->open)
                return -EBADFD;
-       if (chan->valid_setup) {
-               memcpy(setup, &chan->setup, sizeof(*setup));
+       if (str->valid_setup) {
+               memcpy(setup, &str->setup, sizeof(*setup));
                return 0;
        }
-       if ((err = pcm->ops->channel_setup(pcm, setup)) < 0)
+       if ((err = pcm->ops->stream_setup(pcm, setup)) < 0)
                return err;
-       memcpy(&chan->setup, setup, sizeof(*setup));
-       chan->sample_width = snd_pcm_format_physical_width(setup->format.format);
-       chan->bits_per_frame = chan->sample_width * setup->format.voices;
-       chan->frames_per_frag = setup->frag_size * 8 / chan->bits_per_frame;
-       chan->valid_setup = 1;
+       memcpy(&str->setup, setup, sizeof(*setup));
+       str->sample_width = snd_pcm_format_physical_width(setup->format.format);
+       str->bits_per_frame = str->sample_width * setup->format.channels;
+       str->frames_per_frag = setup->frag_size * 8 / str->bits_per_frame;
+       str->valid_setup = 1;
        return 0;
 }
 
-const snd_pcm_channel_setup_t* snd_pcm_channel_cached_setup(snd_pcm_t *pcm, int channel)
+const snd_pcm_stream_setup_t* snd_pcm_stream_cached_setup(snd_pcm_t *pcm, int stream)
 {
-       struct snd_pcm_chan *chan;
+       struct snd_pcm_stream *str;
        if (!pcm)
                return 0;
-       if (channel < 0 || channel > 1)
+       if (stream < 0 || stream > 1)
                return 0;
-       chan = &pcm->chan[channel];
-       if (!chan->open || !chan->valid_setup)
+       str = &pcm->stream[stream];
+       if (!str->open || !str->valid_setup)
                return 0;
-       return &chan->setup;
+       return &str->setup;
 }
 
-int snd_pcm_voice_setup(snd_pcm_t *pcm, int channel, snd_pcm_voice_setup_t *setup)
+int snd_pcm_channel_setup(snd_pcm_t *pcm, int stream, snd_pcm_channel_setup_t *setup)
 {
-       struct snd_pcm_chan *chan;
+       struct snd_pcm_stream *str;
        if (!pcm || !setup)
                return -EFAULT;
-       if (channel < 0 || channel > 1)
+       if (stream < 0 || stream > 1)
                return -EINVAL;
-       chan = &pcm->chan[channel];
-       if (!chan->open || !chan->valid_setup)
+       str = &pcm->stream[stream];
+       if (!str->open || !str->valid_setup)
                return -EBADFD;
-       return pcm->ops->voice_setup(pcm, channel, setup);
+       return pcm->ops->channel_setup(pcm, stream, setup);
 }
 
-int snd_pcm_channel_status(snd_pcm_t *pcm, snd_pcm_channel_status_t *status)
+int snd_pcm_stream_status(snd_pcm_t *pcm, snd_pcm_stream_status_t *status)
 {
        if (!pcm || !status)
                return -EFAULT;
-       if (status->channel < 0 || status->channel > 1)
+       if (status->stream < 0 || status->stream > 1)
                return -EINVAL;
-       if (!pcm->chan[status->channel].open)
+       if (!pcm->stream[status->stream].open)
                return -EBADFD;
-       return pcm->ops->channel_status(pcm, status);
+       return pcm->ops->stream_status(pcm, status);
 }
 
-int snd_pcm_channel_update(snd_pcm_t *pcm, int channel)
+int snd_pcm_stream_update(snd_pcm_t *pcm, int stream)
 {
        int err;
        if (!pcm)
                return -EFAULT;
-       if (channel < 0 || channel > 1)
+       if (stream < 0 || stream > 1)
                return -EINVAL;
-       if (!pcm->chan[channel].open)
+       if (!pcm->stream[stream].open)
                return -EBADFD;
-       err = pcm->ops->channel_update(pcm, channel);
+       err = pcm->ops->stream_update(pcm, stream);
        if (err < 0)
                return err;
-       snd_pcm_mmap_status_change(pcm, channel, -1);
+       snd_pcm_mmap_status_streamge(pcm, stream, -1);
        return 0;
 }
 
-int snd_pcm_channel_prepare(snd_pcm_t *pcm, int channel)
+int snd_pcm_stream_prepare(snd_pcm_t *pcm, int stream)
 {
        int err;
        if (!pcm)
                return -EFAULT;
-       if (channel < 0 || channel > 1)
+       if (stream < 0 || stream > 1)
                return -EINVAL;
-       if (!pcm->chan[channel].open)
+       if (!pcm->stream[stream].open)
                return -EBADFD;
-       err = pcm->ops->channel_prepare(pcm, channel);
+       err = pcm->ops->stream_prepare(pcm, stream);
        if (err < 0)
                return err;
-       snd_pcm_mmap_status_change(pcm, channel, SND_PCM_STATUS_PREPARED);
+       snd_pcm_mmap_status_streamge(pcm, stream, SND_PCM_STATUS_PREPARED);
        return 0;
 }
 
 int snd_pcm_playback_prepare(snd_pcm_t *pcm)
 {
-       return snd_pcm_channel_prepare(pcm, SND_PCM_CHANNEL_PLAYBACK);
+       return snd_pcm_stream_prepare(pcm, SND_PCM_STREAM_PLAYBACK);
 }
 
 int snd_pcm_capture_prepare(snd_pcm_t *pcm)
 {
-       return snd_pcm_channel_prepare(pcm, SND_PCM_CHANNEL_CAPTURE);
+       return snd_pcm_stream_prepare(pcm, SND_PCM_STREAM_CAPTURE);
 }
 
-static int mmap_playback_go(snd_pcm_t *pcm, int channel)
+static int mmap_playback_go(snd_pcm_t *pcm, int stream)
 {
-       struct snd_pcm_chan *chan = &pcm->chan[channel];
-       if (chan->mmap_control->status != SND_PCM_STATUS_PREPARED)
+       struct snd_pcm_stream *str = &pcm->stream[stream];
+       if (str->mmap_control->status != SND_PCM_STATUS_PREPARED)
                return -EBADFD;
-       if (chan->mmap_control->byte_data == 0)
+       if (str->mmap_control->byte_data == 0)
                return -EIO;
-       chan->mmap_control->status = SND_PCM_STATUS_RUNNING;
-       pthread_mutex_lock(&chan->mutex);
-       pthread_cond_signal(&chan->status_cond);
-       pthread_cond_wait(&chan->ready_cond, &chan->mutex);
-       pthread_mutex_unlock(&chan->mutex);
+       str->mmap_control->status = SND_PCM_STATUS_RUNNING;
+       pthread_mutex_lock(&str->mutex);
+       pthread_cond_signal(&str->status_cond);
+       pthread_cond_wait(&str->ready_cond, &str->mutex);
+       pthread_mutex_unlock(&str->mutex);
        return 0;
 }
 
-int snd_pcm_channel_go(snd_pcm_t *pcm, int channel)
+int snd_pcm_stream_go(snd_pcm_t *pcm, int stream)
 {
        int err;
-       struct snd_pcm_chan *chan;
+       struct snd_pcm_stream *str;
        if (!pcm)
                return -EFAULT;
-       if (channel < 0 || channel > 1)
+       if (stream < 0 || stream > 1)
                return -EINVAL;
-       chan = &pcm->chan[channel];
-       if (!chan->open)
+       str = &pcm->stream[stream];
+       if (!str->open)
                return -EBADFD;
-       if (channel == SND_PCM_CHANNEL_PLAYBACK &&
-           chan->mmap_data_emulation) {
-               err = mmap_playback_go(pcm, channel);
+       if (stream == SND_PCM_STREAM_PLAYBACK &&
+           str->mmap_data_emulation) {
+               err = mmap_playback_go(pcm, stream);
                if (err < 0)
                        return err;
        }
-       err = pcm->ops->channel_go(pcm, channel);
+       err = pcm->ops->stream_go(pcm, stream);
        if (err < 0)
                return err;
-       if (channel == SND_PCM_CHANNEL_CAPTURE)
-               snd_pcm_mmap_status_change(pcm, channel, SND_PCM_STATUS_RUNNING);
+       if (stream == SND_PCM_STREAM_CAPTURE)
+               snd_pcm_mmap_status_streamge(pcm, stream, SND_PCM_STATUS_RUNNING);
        return 0;
 }
 
 int snd_pcm_playback_go(snd_pcm_t *pcm)
 {
-       return snd_pcm_channel_go(pcm, SND_PCM_CHANNEL_PLAYBACK);
+       return snd_pcm_stream_go(pcm, SND_PCM_STREAM_PLAYBACK);
 }
 
 int snd_pcm_capture_go(snd_pcm_t *pcm)
 {
-       return snd_pcm_channel_go(pcm, SND_PCM_CHANNEL_CAPTURE);
+       return snd_pcm_stream_go(pcm, SND_PCM_STREAM_CAPTURE);
 }
 
 int snd_pcm_sync_go(snd_pcm_t *pcm, snd_pcm_sync_t *sync)
@@ -320,8 +320,8 @@ int snd_pcm_sync_go(snd_pcm_t *pcm, snd_pcm_sync_t *sync)
        int err;
        if (!pcm || !sync)
                return -EFAULT;
-       if (!pcm->chan[SND_PCM_CHANNEL_PLAYBACK].open &&
-           !pcm->chan[SND_PCM_CHANNEL_CAPTURE].open)
+       if (!pcm->stream[SND_PCM_STREAM_PLAYBACK].open &&
+           !pcm->stream[SND_PCM_STREAM_CAPTURE].open)
                return -EBADFD;
        err = pcm->ops->sync_go(pcm, sync);
        if (err < 0)
@@ -330,101 +330,101 @@ int snd_pcm_sync_go(snd_pcm_t *pcm, snd_pcm_sync_t *sync)
        return 0;
 }
 
-int snd_pcm_channel_drain(snd_pcm_t *pcm, int channel)
+int snd_pcm_stream_drain(snd_pcm_t *pcm, int stream)
 {
        int err;
        if (!pcm)
                return -EFAULT;
-       if (channel < 0 || channel > 1)
+       if (stream < 0 || stream > 1)
                return -EINVAL;
-       if (!pcm->chan[channel].open)
+       if (!pcm->stream[stream].open)
                return -EBADFD;
-       if (channel != SND_PCM_CHANNEL_PLAYBACK)
+       if (stream != SND_PCM_STREAM_PLAYBACK)
                return -EBADFD;
-       err = pcm->ops->channel_drain(pcm, channel);
+       err = pcm->ops->stream_drain(pcm, stream);
        if (err < 0)
                return err;
-       snd_pcm_mmap_status_change(pcm, channel, SND_PCM_STATUS_READY);
+       snd_pcm_mmap_status_streamge(pcm, stream, SND_PCM_STATUS_READY);
        return 0;
 }
 
 int snd_pcm_playback_drain(snd_pcm_t *pcm)
 {
-       return snd_pcm_channel_drain(pcm, SND_PCM_CHANNEL_PLAYBACK);
+       return snd_pcm_stream_drain(pcm, SND_PCM_STREAM_PLAYBACK);
 }
 
-int snd_pcm_channel_flush(snd_pcm_t *pcm, int channel)
+int snd_pcm_stream_flush(snd_pcm_t *pcm, int stream)
 {
        int err;
        if (!pcm)
                return -EFAULT;
-       if (channel < 0 || channel > 1)
+       if (stream < 0 || stream > 1)
                return -EINVAL;
-       if (!pcm->chan[channel].open)
+       if (!pcm->stream[stream].open)
                return -EBADFD;
-       err = pcm->ops->channel_flush(pcm, channel);
+       err = pcm->ops->stream_flush(pcm, stream);
        if (err < 0)
                return err;
-       snd_pcm_mmap_status_change(pcm, channel, SND_PCM_STATUS_READY);
+       snd_pcm_mmap_status_streamge(pcm, stream, SND_PCM_STATUS_READY);
        return 0;
 }
 
 int snd_pcm_playback_flush(snd_pcm_t *pcm)
 {
-       return snd_pcm_channel_flush(pcm, SND_PCM_CHANNEL_PLAYBACK);
+       return snd_pcm_stream_flush(pcm, SND_PCM_STREAM_PLAYBACK);
 }
 
 int snd_pcm_capture_flush(snd_pcm_t *pcm)
 {
-       return snd_pcm_channel_flush(pcm, SND_PCM_CHANNEL_CAPTURE);
+       return snd_pcm_stream_flush(pcm, SND_PCM_STREAM_CAPTURE);
 }
 
-int snd_pcm_channel_pause(snd_pcm_t *pcm, int channel, int enable)
+int snd_pcm_stream_pause(snd_pcm_t *pcm, int stream, int enable)
 {
        int err;
        if (!pcm)
                return -EFAULT;
-       if (channel < 0 || channel > 1)
+       if (stream < 0 || stream > 1)
                return -EINVAL;
-       if (!pcm->chan[channel].open)
+       if (!pcm->stream[stream].open)
                return -EBADFD;
-       if (channel != SND_PCM_CHANNEL_PLAYBACK)
+       if (stream != SND_PCM_STREAM_PLAYBACK)
                return -EBADFD;
-       err = pcm->ops->channel_pause(pcm, channel, enable);
+       err = pcm->ops->stream_pause(pcm, stream, enable);
        if (err < 0)
                return err;
-       snd_pcm_mmap_status_change(pcm, channel, SND_PCM_STATUS_PAUSED);
+       snd_pcm_mmap_status_streamge(pcm, stream, SND_PCM_STATUS_PAUSED);
        return 0;
 }
 
 int snd_pcm_playback_pause(snd_pcm_t *pcm, int enable)
 {
-       return snd_pcm_channel_pause(pcm, SND_PCM_CHANNEL_PLAYBACK, enable);
+       return snd_pcm_stream_pause(pcm, SND_PCM_STREAM_PLAYBACK, enable);
 }
 
-ssize_t snd_pcm_transfer_size(snd_pcm_t *pcm, int channel)
+ssize_t snd_pcm_transfer_size(snd_pcm_t *pcm, int stream)
 {
-       struct snd_pcm_chan *chan;
+       struct snd_pcm_stream *str;
        if (!pcm)
                return -EFAULT;
-       if (channel < 0 || channel > 1)
+       if (stream < 0 || stream > 1)
                return -EINVAL;
-       chan = &pcm->chan[channel];
-       if (!chan->open)
+       str = &pcm->stream[stream];
+       if (!str->open)
                return -EBADFD;
-       if (!chan->valid_setup)
+       if (!str->valid_setup)
                return -EBADFD;
-       if (chan->setup.mode != SND_PCM_MODE_BLOCK)
+       if (str->setup.mode != SND_PCM_MODE_FRAGMENT)
                return -EBADFD;
-       return chan->setup.frag_size;
+       return str->setup.frag_size;
 }
 
 ssize_t snd_pcm_write(snd_pcm_t *pcm, const void *buffer, size_t size)
 {
        if (!pcm)
                return -EFAULT;
-       if (!pcm->chan[SND_PCM_CHANNEL_PLAYBACK].open ||
-           !pcm->chan[SND_PCM_CHANNEL_PLAYBACK].valid_setup)
+       if (!pcm->stream[SND_PCM_STREAM_PLAYBACK].open ||
+           !pcm->stream[SND_PCM_STREAM_PLAYBACK].valid_setup)
                return -EBADFD;
        if (size > 0 && !buffer)
                return -EFAULT;
@@ -435,8 +435,8 @@ ssize_t snd_pcm_writev(snd_pcm_t *pcm, const struct iovec *vector, unsigned long
 {
        if (!pcm)
                return -EFAULT;
-       if (!pcm->chan[SND_PCM_CHANNEL_PLAYBACK].open ||
-           !pcm->chan[SND_PCM_CHANNEL_PLAYBACK].valid_setup)
+       if (!pcm->stream[SND_PCM_STREAM_PLAYBACK].open ||
+           !pcm->stream[SND_PCM_STREAM_PLAYBACK].valid_setup)
                return -EBADFD;
        if (count > 0 && !vector)
                return -EFAULT;
@@ -447,8 +447,8 @@ ssize_t snd_pcm_read(snd_pcm_t *pcm, void *buffer, size_t size)
 {
        if (!pcm)
                return -EFAULT;
-       if (!pcm->chan[SND_PCM_CHANNEL_CAPTURE].open ||
-           !pcm->chan[SND_PCM_CHANNEL_CAPTURE].valid_setup)
+       if (!pcm->stream[SND_PCM_STREAM_CAPTURE].open ||
+           !pcm->stream[SND_PCM_STREAM_CAPTURE].valid_setup)
                return -EBADFD;
        if (size > 0 && !buffer)
                return -EFAULT;
@@ -459,47 +459,47 @@ ssize_t snd_pcm_readv(snd_pcm_t *pcm, const struct iovec *vector, unsigned long
 {
        if (!pcm)
                return -EFAULT;
-       if (!pcm->chan[SND_PCM_CHANNEL_CAPTURE].open ||
-           !pcm->chan[SND_PCM_CHANNEL_CAPTURE].valid_setup)
+       if (!pcm->stream[SND_PCM_STREAM_CAPTURE].open ||
+           !pcm->stream[SND_PCM_STREAM_CAPTURE].valid_setup)
                return -EBADFD;
        if (count > 0 && !vector)
                return -EFAULT;
        return pcm->ops->readv(pcm, vector, count);
 }
 
-int snd_pcm_file_descriptor(snd_pcm_t* pcm, int channel)
+int snd_pcm_file_descriptor(snd_pcm_t* pcm, int stream)
 {
        if (!pcm)
                return -EFAULT;
-       if (channel < 0 || channel > 1)
+       if (stream < 0 || stream > 1)
                return -EINVAL;
-       if (!pcm->chan[channel].open)
+       if (!pcm->stream[stream].open)
                return -EBADFD;
-       return pcm->ops->file_descriptor(pcm, channel);
+       return pcm->ops->file_descriptor(pcm, stream);
 }
 
-int snd_pcm_voices_mask(snd_pcm_t *pcm, int channel, bitset_t *client_vmask)
+int snd_pcm_channels_mask(snd_pcm_t *pcm, int stream, bitset_t *client_vmask)
 {
        if (!pcm)
                return -EFAULT;
-       if (channel < 0 || channel > 1)
+       if (stream < 0 || stream > 1)
                return -EINVAL;
-       if (!pcm->chan[channel].open)
+       if (!pcm->stream[stream].open)
                return -EBADFD;
-       return pcm->ops->voices_mask(pcm, channel, client_vmask);
+       return pcm->ops->channels_mask(pcm, stream, client_vmask);
 }
 
-ssize_t snd_pcm_bytes_per_second(snd_pcm_t *pcm, int channel)
+ssize_t snd_pcm_bytes_per_second(snd_pcm_t *pcm, int stream)
 {
-       struct snd_pcm_chan *chan;
+       struct snd_pcm_stream *str;
        if (!pcm)
                return -EFAULT;
-       if (channel < 0 || channel > 1)
+       if (stream < 0 || stream > 1)
                return -EINVAL;
-       chan = &pcm->chan[channel];
-       if (!chan->open || !chan->valid_setup)
+       str = &pcm->stream[stream];
+       if (!str->open || !str->valid_setup)
                return -EBADFD;
-       return snd_pcm_format_bytes_per_second(&chan->setup.format);
+       return snd_pcm_format_bytes_per_second(&str->setup.format);
 }
 
 typedef struct {
@@ -537,7 +537,7 @@ static const char *assoc(int value, assoc_t *alist)
        return "UNKNOWN";
 }
 
-#define CHN(v) { SND_PCM_CHANNEL_##v, #v, #v }
+#define STREAM(v) { SND_PCM_STREAM_##v, #v, #v }
 #define MODE(v) { SND_PCM_MODE_##v, #v, #v }
 #define FMT(v, d) { SND_PCM_SFMT_##v, #v, d }
 #define XRUN(v) { SND_PCM_XRUN_##v, #v, #v }
@@ -545,8 +545,8 @@ static const char *assoc(int value, assoc_t *alist)
 #define FILL(v) { SND_PCM_FILL_##v, #v, #v }
 #define END { 0, NULL, NULL }
 
-static assoc_t chns[] = { CHN(PLAYBACK), CHN(CAPTURE), END };
-static assoc_t modes[] = { MODE(STREAM), MODE(BLOCK), END };
+static assoc_t streams[] = { STREAM(PLAYBACK), STREAM(CAPTURE), END };
+static assoc_t modes[] = { MODE(FRAME), MODE(FRAGMENT), END };
 static assoc_t fmts[] = {
        FMT(S8, "Signed 8-bit"), 
        FMT(U8, "Unsigned 8-bit"),
@@ -582,22 +582,22 @@ static assoc_t xruns[] = { XRUN(FLUSH), XRUN(DRAIN), END };
 static assoc_t fills[] = { FILL(NONE), FILL(SILENCE_WHOLE), FILL(SILENCE), END };
 static assoc_t onoff[] = { {0, "OFF", NULL}, {1, "ON", NULL}, {-1, "ON", NULL}, END };
 
-int snd_pcm_dump_setup(snd_pcm_t *pcm, int channel, FILE *fp)
+int snd_pcm_dump_setup(snd_pcm_t *pcm, int stream, FILE *fp)
 {
-       struct snd_pcm_chan *chan;
-       snd_pcm_channel_setup_t *setup;
+       struct snd_pcm_stream *str;
+       snd_pcm_stream_setup_t *setup;
        if (!pcm)
                return -EFAULT;
-       if (channel < 0 || channel > 1)
+       if (stream < 0 || stream > 1)
                return -EINVAL;
-       chan = &pcm->chan[channel];
-       if (!chan->open || !chan->valid_setup)
+       str = &pcm->stream[stream];
+       if (!str->open || !str->valid_setup)
                return -EBADFD;
-       setup = &chan->setup;
-       fprintf(fp, "channel: %s\n", assoc(setup->channel, chns));
+       setup = &str->setup;
+       fprintf(fp, "stream: %s\n", assoc(setup->stream, streams));
        fprintf(fp, "mode: %s\n", assoc(setup->mode, modes));
        fprintf(fp, "format: %s\n", assoc(setup->format.format, fmts));
-       fprintf(fp, "voices: %d\n", setup->format.voices);
+       fprintf(fp, "channels: %d\n", setup->format.channels);
        fprintf(fp, "rate: %d\n", setup->format.rate);
        // digital
        fprintf(fp, "start_mode: %s\n", assoc(setup->start_mode, starts));
index befbfb86c0ffb1a0668c6ce8f87d1946fc2e72e1..4b1b5ad420d9e1acedda06c24165fbf91bfca71f 100644 (file)
@@ -26,8 +26,8 @@
 #ifdef __KERNEL__
 #include "../../include/driver.h"
 #include "../../include/pcm.h"
-#define snd_pcm_plug_first(handle, channel) ((handle)->runtime->oss.plugin_first)
-#define snd_pcm_plug_last(handle, channel) ((handle)->runtime->oss.plugin_last)
+#define snd_pcm_plug_first(handle, stream) ((handle)->runtime->oss.plugin_first)
+#define snd_pcm_plug_last(handle, stream) ((handle)->runtime->oss.plugin_last)
 #else
 #include <malloc.h>
 #include <errno.h>
 #include "pcm_local.h"
 #endif
 
-static int snd_pcm_plugin_src_voices_mask(snd_pcm_plugin_t *plugin,
+static int snd_pcm_plugin_src_channels_mask(snd_pcm_plugin_t *plugin,
                                          bitset_t *dst_vmask,
                                          bitset_t **src_vmask)
 {
        bitset_t *vmask = plugin->src_vmask;
-       bitset_copy(vmask, dst_vmask, plugin->src_format.voices);
+       bitset_copy(vmask, dst_vmask, plugin->src_format.channels);
        *src_vmask = vmask;
        return 0;
 }
 
-static int snd_pcm_plugin_dst_voices_mask(snd_pcm_plugin_t *plugin,
+static int snd_pcm_plugin_dst_channels_mask(snd_pcm_plugin_t *plugin,
                                          bitset_t *src_vmask,
                                          bitset_t **dst_vmask)
 {
        bitset_t *vmask = plugin->dst_vmask;
-       bitset_copy(vmask, src_vmask, plugin->dst_format.voices);
+       bitset_copy(vmask, src_vmask, plugin->dst_format.channels);
        *dst_vmask = vmask;
        return 0;
 }
 
-static ssize_t snd_pcm_plugin_side_voices(snd_pcm_plugin_t *plugin,
+static ssize_t snd_pcm_plugin_side_channels(snd_pcm_plugin_t *plugin,
                                          int client_side,
                                          size_t frames,
-                                         snd_pcm_plugin_voice_t **voices)
+                                         snd_pcm_plugin_channel_t **channels)
 {
        char *ptr;
        int width;
-       unsigned int voice;
+       unsigned int channel;
        long size;
-       snd_pcm_plugin_voice_t *v;
+       snd_pcm_plugin_channel_t *v;
        snd_pcm_format_t *format;
-       if ((plugin->channel == SND_PCM_CHANNEL_PLAYBACK && client_side) ||
-           (plugin->channel == SND_PCM_CHANNEL_CAPTURE && !client_side)) {
+       if ((plugin->stream == SND_PCM_STREAM_PLAYBACK && client_side) ||
+           (plugin->stream == SND_PCM_STREAM_CAPTURE && !client_side)) {
                format = &plugin->src_format;
-               v = plugin->src_voices;
+               v = plugin->src_channels;
        } else {
                format = &plugin->dst_format;
-               v = plugin->dst_voices;
+               v = plugin->dst_channels;
        }
 
-       *voices = v;
+       *channels = v;
        if ((width = snd_pcm_format_physical_width(format->format)) < 0)
                return width;   
-       size = format->voices * frames * width;
+       size = format->channels * frames * width;
        if ((size % 8) != 0)
                return -EINVAL;
        size /= 8;
-       ptr = (char *)snd_pcm_plug_buf_alloc(plugin->handle, plugin->channel, size);
+       ptr = (char *)snd_pcm_plug_buf_alloc(plugin->handle, plugin->stream, size);
        if (ptr == NULL)
                return -ENOMEM;
-       if ((size % format->voices) != 0)
+       if ((size % format->channels) != 0)
                return -EINVAL;
-       size /= format->voices;
-       for (voice = 0; voice < format->voices; voice++, v++) {
+       size /= format->channels;
+       for (channel = 0; channel < format->channels; channel++, v++) {
                v->enabled = 1;
                v->wanted = 0;
                v->aptr = ptr;
                if (format->interleave) {
                        v->area.addr = ptr;
-                       v->area.first = voice * width;
-                       v->area.step = format->voices * width;
+                       v->area.first = channel * width;
+                       v->area.step = format->channels * width;
                } else {
-                       v->area.addr = ptr + (voice * size);
+                       v->area.addr = ptr + (channel * size);
                        v->area.first = 0;
                        v->area.step = width;
                }
@@ -107,23 +107,23 @@ static ssize_t snd_pcm_plugin_side_voices(snd_pcm_plugin_t *plugin,
        return frames;
 }
 
-ssize_t snd_pcm_plugin_client_voices(snd_pcm_plugin_t *plugin,
+ssize_t snd_pcm_plugin_client_channels(snd_pcm_plugin_t *plugin,
                                     size_t frames,
-                                    snd_pcm_plugin_voice_t **voices)
+                                    snd_pcm_plugin_channel_t **channels)
 {
-       return snd_pcm_plugin_side_voices(plugin, 1, frames, voices);
+       return snd_pcm_plugin_side_channels(plugin, 1, frames, channels);
 }
 
-ssize_t snd_pcm_plugin_slave_voices(snd_pcm_plugin_t *plugin,
+ssize_t snd_pcm_plugin_slave_channels(snd_pcm_plugin_t *plugin,
                                    size_t frames,
-                                   snd_pcm_plugin_voice_t **voices)
+                                   snd_pcm_plugin_channel_t **channels)
 {
-       return snd_pcm_plugin_side_voices(plugin, 0, frames, voices);
+       return snd_pcm_plugin_side_channels(plugin, 0, frames, channels);
 }
 
 
 int snd_pcm_plugin_build(snd_pcm_plugin_handle_t *handle,
-                        int channel,
+                        int stream,
                         const char *name,
                         snd_pcm_format_t *src_format,
                         snd_pcm_format_t *dst_format,
@@ -136,7 +136,7 @@ int snd_pcm_plugin_build(snd_pcm_plugin_handle_t *handle,
                return -EFAULT;
        if (extra < 0)
                return -EINVAL;
-       if (channel < 0 || channel > 1)
+       if (stream < 0 || stream > 1)
                return -EINVAL;
        if (!src_format || !dst_format)
                return -EFAULT;
@@ -145,42 +145,42 @@ int snd_pcm_plugin_build(snd_pcm_plugin_handle_t *handle,
                return -ENOMEM;
        plugin->name = name ? strdup(name) : NULL;
        plugin->handle = handle;
-       plugin->channel = channel;
+       plugin->stream = stream;
        memcpy(&plugin->src_format, src_format, sizeof(snd_pcm_format_t));
        if ((plugin->src_width = snd_pcm_format_physical_width(src_format->format)) < 0)
                return -EINVAL;
        memcpy(&plugin->dst_format, dst_format, sizeof(snd_pcm_format_t));
        if ((plugin->dst_width = snd_pcm_format_physical_width(dst_format->format)) < 0)
                return -EINVAL;
-       plugin->src_voices = calloc(src_format->voices, sizeof(snd_pcm_plugin_voice_t));
-       if (plugin->src_voices == NULL) {
+       plugin->src_channels = calloc(src_format->channels, sizeof(snd_pcm_plugin_channel_t));
+       if (plugin->src_channels == NULL) {
                free(plugin);
                return -ENOMEM;
        }
-       plugin->dst_voices = calloc(dst_format->voices, sizeof(snd_pcm_plugin_voice_t));
-       if (plugin->dst_voices == NULL) {
-               free(plugin->src_voices);
+       plugin->dst_channels = calloc(dst_format->channels, sizeof(snd_pcm_plugin_channel_t));
+       if (plugin->dst_channels == NULL) {
+               free(plugin->src_channels);
                free(plugin);
                return -ENOMEM;
        }
-       plugin->src_vmask = bitset_alloc(src_format->voices);
+       plugin->src_vmask = bitset_alloc(src_format->channels);
        if (plugin->src_vmask == NULL) {
-               free(plugin->src_voices);
-               free(plugin->dst_voices);
+               free(plugin->src_channels);
+               free(plugin->dst_channels);
                free(plugin);
                return -ENOMEM;
        }
-       plugin->dst_vmask = bitset_alloc(dst_format->voices);
+       plugin->dst_vmask = bitset_alloc(dst_format->channels);
        if (plugin->dst_vmask == NULL) {
-               free(plugin->src_voices);
-               free(plugin->dst_voices);
+               free(plugin->src_channels);
+               free(plugin->dst_channels);
                free(plugin->src_vmask);
                free(plugin);
                return -ENOMEM;
        }
-       plugin->client_voices = snd_pcm_plugin_client_voices;
-       plugin->src_voices_mask = snd_pcm_plugin_src_voices_mask;
-       plugin->dst_voices_mask = snd_pcm_plugin_dst_voices_mask;
+       plugin->client_channels = snd_pcm_plugin_client_channels;
+       plugin->src_channels_mask = snd_pcm_plugin_src_channels_mask;
+       plugin->dst_channels_mask = snd_pcm_plugin_dst_channels_mask;
        *ret = plugin;
        return 0;
 }
@@ -192,8 +192,8 @@ int snd_pcm_plugin_free(snd_pcm_plugin_t *plugin)
                        plugin->private_free(plugin, plugin->private_data);
                if (plugin->name)
                        free(plugin->name);
-               free(plugin->src_voices);
-               free(plugin->dst_voices);
+               free(plugin->src_channels);
+               free(plugin->dst_channels);
                free(plugin->src_vmask);
                free(plugin->dst_vmask);
                free(plugin);
@@ -207,7 +207,7 @@ ssize_t snd_pcm_plugin_src_frames_to_size(snd_pcm_plugin_t *plugin, size_t frame
 
        if (plugin == NULL)
                return -EFAULT;
-       result = frames * plugin->src_format.voices * plugin->src_width;
+       result = frames * plugin->src_format.channels * plugin->src_width;
        if (result % 8 != 0)
                return -EINVAL;
        return result / 8;
@@ -219,7 +219,7 @@ ssize_t snd_pcm_plugin_dst_frames_to_size(snd_pcm_plugin_t *plugin, size_t frame
 
        if (plugin == NULL)
                return -EFAULT;
-       result = frames * plugin->dst_format.voices * plugin->dst_width;
+       result = frames * plugin->dst_format.channels * plugin->dst_width;
        if (result % 8 != 0)
                return -EINVAL;
        return result / 8;
@@ -233,7 +233,7 @@ ssize_t snd_pcm_plugin_src_size_to_frames(snd_pcm_plugin_t *plugin, size_t size)
        if (plugin == NULL)
                return -EFAULT;
        result = size * 8;
-       tmp = plugin->src_format.voices * plugin->src_width;
+       tmp = plugin->src_format.channels * plugin->src_width;
        if (result % tmp != 0)
                return -EINVAL;
        return result / tmp;
@@ -247,33 +247,33 @@ ssize_t snd_pcm_plugin_dst_size_to_frames(snd_pcm_plugin_t *plugin, size_t size)
        if (plugin == NULL)
                return -EFAULT;
        result = size * 8;
-       tmp = plugin->dst_format.voices * plugin->dst_width;
+       tmp = plugin->dst_format.channels * plugin->dst_width;
        if (result % tmp != 0)
                return -EINVAL;
        return result / tmp;
 }
 
-ssize_t snd_pcm_plug_client_frames(snd_pcm_plugin_handle_t *handle, int channel, size_t drv_frames)
+ssize_t snd_pcm_plug_client_frames(snd_pcm_plugin_handle_t *handle, int stream, size_t drv_frames)
 {
        snd_pcm_plugin_t *plugin, *plugin_prev, *plugin_next;
        
        if (handle == NULL)
                return -EFAULT;
-       if (channel != SND_PCM_CHANNEL_PLAYBACK &&
-           channel != SND_PCM_CHANNEL_CAPTURE)
+       if (stream != SND_PCM_STREAM_PLAYBACK &&
+           stream != SND_PCM_STREAM_CAPTURE)
                return -EINVAL;
        if (drv_frames == 0)
                return 0;
-       if (channel == SND_PCM_CHANNEL_PLAYBACK) {
-               plugin = snd_pcm_plug_last(handle, SND_PCM_CHANNEL_PLAYBACK);
+       if (stream == SND_PCM_STREAM_PLAYBACK) {
+               plugin = snd_pcm_plug_last(handle, SND_PCM_STREAM_PLAYBACK);
                while (plugin && drv_frames > 0) {
                        plugin_prev = plugin->prev;
                        if (plugin->src_frames)
                                drv_frames = plugin->src_frames(plugin, drv_frames);
                        plugin = plugin_prev;
                }
-       } else if (channel == SND_PCM_CHANNEL_CAPTURE) {
-               plugin = snd_pcm_plug_first(handle, SND_PCM_CHANNEL_CAPTURE);
+       } else if (stream == SND_PCM_STREAM_CAPTURE) {
+               plugin = snd_pcm_plug_first(handle, SND_PCM_STREAM_CAPTURE);
                while (plugin && drv_frames > 0) {
                        plugin_next = plugin->next;
                        if (plugin->dst_frames)
@@ -284,21 +284,21 @@ ssize_t snd_pcm_plug_client_frames(snd_pcm_plugin_handle_t *handle, int channel,
        return drv_frames;
 }
 
-ssize_t snd_pcm_plug_slave_frames(snd_pcm_plugin_handle_t *handle, int channel, size_t clt_frames)
+ssize_t snd_pcm_plug_slave_frames(snd_pcm_plugin_handle_t *handle, int stream, size_t clt_frames)
 {
        snd_pcm_plugin_t *plugin, *plugin_prev, *plugin_next;
        ssize_t frames;
        
        if (handle == NULL)
                return -EFAULT;
-       if (channel != SND_PCM_CHANNEL_PLAYBACK &&
-           channel != SND_PCM_CHANNEL_CAPTURE)
+       if (stream != SND_PCM_STREAM_PLAYBACK &&
+           stream != SND_PCM_STREAM_CAPTURE)
                return -EINVAL;
        if (clt_frames == 0)
                return 0;
        frames = clt_frames;
-       if (channel == SND_PCM_CHANNEL_PLAYBACK) {
-               plugin = snd_pcm_plug_first(handle, SND_PCM_CHANNEL_PLAYBACK);
+       if (stream == SND_PCM_STREAM_PLAYBACK) {
+               plugin = snd_pcm_plug_first(handle, SND_PCM_STREAM_PLAYBACK);
                while (plugin && frames > 0) {
                        plugin_next = plugin->next;
                        if (plugin->dst_frames) {
@@ -308,8 +308,8 @@ ssize_t snd_pcm_plug_slave_frames(snd_pcm_plugin_handle_t *handle, int channel,
                        }
                        plugin = plugin_next;
                }
-       } else if (channel == SND_PCM_CHANNEL_CAPTURE) {
-               plugin = snd_pcm_plug_last(handle, SND_PCM_CHANNEL_CAPTURE);
+       } else if (stream == SND_PCM_STREAM_CAPTURE) {
+               plugin = snd_pcm_plug_last(handle, SND_PCM_STREAM_CAPTURE);
                while (plugin) {
                        plugin_prev = plugin->prev;
                        if (plugin->src_frames) {
@@ -323,81 +323,81 @@ ssize_t snd_pcm_plug_slave_frames(snd_pcm_plugin_handle_t *handle, int channel,
        return frames;
 }
 
-ssize_t snd_pcm_plug_client_size(snd_pcm_plugin_handle_t *handle, int channel, size_t drv_size)
+ssize_t snd_pcm_plug_client_size(snd_pcm_plugin_handle_t *handle, int stream, size_t drv_size)
 {
        snd_pcm_plugin_t *plugin;
        ssize_t result = 0;
        
        if (handle == NULL)
                return -EFAULT;
-       if (channel != SND_PCM_CHANNEL_PLAYBACK &&
-           channel != SND_PCM_CHANNEL_CAPTURE)
+       if (stream != SND_PCM_STREAM_PLAYBACK &&
+           stream != SND_PCM_STREAM_CAPTURE)
                return -EINVAL;
        if (drv_size == 0)
                return 0;
-       if (channel == SND_PCM_CHANNEL_PLAYBACK) {
-               plugin = snd_pcm_plug_last(handle, SND_PCM_CHANNEL_PLAYBACK);
+       if (stream == SND_PCM_STREAM_PLAYBACK) {
+               plugin = snd_pcm_plug_last(handle, SND_PCM_STREAM_PLAYBACK);
                if (plugin == NULL)
                        return drv_size;
                result = snd_pcm_plugin_dst_size_to_frames(plugin, drv_size);
                if (result < 0)
                        return result;
-               result = snd_pcm_plug_client_frames(handle, SND_PCM_CHANNEL_PLAYBACK, result);
+               result = snd_pcm_plug_client_frames(handle, SND_PCM_STREAM_PLAYBACK, result);
                if (result < 0)
                        return result;
-               plugin = snd_pcm_plug_first(handle, SND_PCM_CHANNEL_PLAYBACK);
+               plugin = snd_pcm_plug_first(handle, SND_PCM_STREAM_PLAYBACK);
                result = snd_pcm_plugin_src_frames_to_size(plugin, result);
-       } else if (channel == SND_PCM_CHANNEL_CAPTURE) {
-               plugin = snd_pcm_plug_first(handle, SND_PCM_CHANNEL_CAPTURE);
+       } else if (stream == SND_PCM_STREAM_CAPTURE) {
+               plugin = snd_pcm_plug_first(handle, SND_PCM_STREAM_CAPTURE);
                if (plugin == NULL)
                        return drv_size;
                result = snd_pcm_plugin_src_size_to_frames(plugin, drv_size);
                if (result < 0)
                        return result;
-               result = snd_pcm_plug_client_frames(handle, SND_PCM_CHANNEL_CAPTURE, result);
+               result = snd_pcm_plug_client_frames(handle, SND_PCM_STREAM_CAPTURE, result);
                if (result < 0)
                        return result;
-               plugin = snd_pcm_plug_last(handle, SND_PCM_CHANNEL_CAPTURE);
+               plugin = snd_pcm_plug_last(handle, SND_PCM_STREAM_CAPTURE);
                result = snd_pcm_plugin_dst_frames_to_size(plugin, result);
        }
        return result;
 }
 
-ssize_t snd_pcm_plug_slave_size(snd_pcm_plugin_handle_t *handle, int channel, size_t clt_size)
+ssize_t snd_pcm_plug_slave_size(snd_pcm_plugin_handle_t *handle, int stream, size_t clt_size)
 {
        snd_pcm_plugin_t *plugin;
        ssize_t result = 0;
        
        if (handle == NULL)
                return -EFAULT;
-       if (channel != SND_PCM_CHANNEL_PLAYBACK &&
-           channel != SND_PCM_CHANNEL_CAPTURE)
+       if (stream != SND_PCM_STREAM_PLAYBACK &&
+           stream != SND_PCM_STREAM_CAPTURE)
                return -EINVAL;
        if (clt_size == 0)
                return 0;
-       if (channel == SND_PCM_CHANNEL_PLAYBACK) {
-               plugin = snd_pcm_plug_first(handle, SND_PCM_CHANNEL_PLAYBACK);
+       if (stream == SND_PCM_STREAM_PLAYBACK) {
+               plugin = snd_pcm_plug_first(handle, SND_PCM_STREAM_PLAYBACK);
                if (plugin == NULL)
                        return clt_size;
                result = snd_pcm_plugin_src_size_to_frames(plugin, clt_size);
                if (result < 0)
                        return result;
-               result = snd_pcm_plug_slave_frames(handle, SND_PCM_CHANNEL_PLAYBACK, result);
+               result = snd_pcm_plug_slave_frames(handle, SND_PCM_STREAM_PLAYBACK, result);
                if (result < 0)
                        return result;
-               plugin = snd_pcm_plug_last(handle, SND_PCM_CHANNEL_PLAYBACK);
+               plugin = snd_pcm_plug_last(handle, SND_PCM_STREAM_PLAYBACK);
                result = snd_pcm_plugin_dst_frames_to_size(plugin, result);
-       } else if (channel == SND_PCM_CHANNEL_CAPTURE) {
-               plugin = snd_pcm_plug_last(handle, SND_PCM_CHANNEL_CAPTURE);
+       } else if (stream == SND_PCM_STREAM_CAPTURE) {
+               plugin = snd_pcm_plug_last(handle, SND_PCM_STREAM_CAPTURE);
                if (plugin == NULL)
                        return clt_size;
                result = snd_pcm_plugin_dst_size_to_frames(plugin, clt_size);
                if (result < 0)
                        return result;
-               result = snd_pcm_plug_slave_frames(handle, SND_PCM_CHANNEL_CAPTURE, result);
+               result = snd_pcm_plug_slave_frames(handle, SND_PCM_STREAM_CAPTURE, result);
                if (result < 0)
                        return result;
-               plugin = snd_pcm_plug_first(handle, SND_PCM_CHANNEL_CAPTURE);
+               plugin = snd_pcm_plug_first(handle, SND_PCM_STREAM_CAPTURE);
                result = snd_pcm_plugin_src_frames_to_size(plugin, result);
        } 
        return result;
@@ -440,9 +440,9 @@ static int preferred_formats[] = {
        SND_PCM_SFMT_U8
 };
 
-int snd_pcm_plug_slave_params(snd_pcm_channel_params_t *params,
-                             snd_pcm_channel_info_t *slave_info,
-                             snd_pcm_channel_params_t *slave_params)
+int snd_pcm_plug_slave_params(snd_pcm_stream_params_t *params,
+                             snd_pcm_stream_info_t *slave_info,
+                             snd_pcm_stream_params_t *slave_params)
 {
        memcpy(slave_params, params, sizeof(*slave_params));
        if ((slave_info->formats & (1 << params->format.format)) == 0) {
@@ -502,12 +502,12 @@ int snd_pcm_plug_slave_params(snd_pcm_channel_params_t *params,
                }
        }
 
-       /* voices */
-       if (params->format.voices < slave_info->min_voices ||
-           params->format.voices > slave_info->max_voices) {
-               unsigned int dst_voices = params->format.voices < slave_info->min_voices ?
-                                slave_info->min_voices : slave_info->max_voices;
-               slave_params->format.voices = dst_voices;
+       /* channels */
+       if (params->format.channels < slave_info->min_channels ||
+           params->format.channels > slave_info->max_channels) {
+               unsigned int dst_channels = params->format.channels < slave_info->min_channels ?
+                                slave_info->min_channels : slave_info->max_channels;
+               slave_params->format.channels = dst_channels;
        }
 
        /* rate */
@@ -519,30 +519,30 @@ int snd_pcm_plug_slave_params(snd_pcm_channel_params_t *params,
        }
 
        /* interleave */
-       if (!(slave_info->flags & SND_PCM_CHNINFO_INTERLEAVE))
+       if (!(slave_info->flags & SND_PCM_STREAM_INFO_INTERLEAVE))
                slave_params->format.interleave = 0;
-       if (!(slave_info->flags & SND_PCM_CHNINFO_NONINTERLEAVE))
+       if (!(slave_info->flags & SND_PCM_STREAM_INFO_NONINTERLEAVE))
                slave_params->format.interleave = 1;
        return 0;
 }
 
 int snd_pcm_plug_format(snd_pcm_plugin_handle_t *handle, 
-                       snd_pcm_channel_params_t *params, 
-                       snd_pcm_channel_params_t *slave_params)
+                       snd_pcm_stream_params_t *params, 
+                       snd_pcm_stream_params_t *slave_params)
 {
-       snd_pcm_channel_params_t tmpparams;
-       snd_pcm_channel_params_t dstparams;
-       snd_pcm_channel_params_t *srcparams;
+       snd_pcm_stream_params_t tmpparams;
+       snd_pcm_stream_params_t dstparams;
+       snd_pcm_stream_params_t *srcparams;
        snd_pcm_plugin_t *plugin;
        int err;
        
-       switch (params->channel) {
-       case SND_PCM_CHANNEL_PLAYBACK:
+       switch (params->stream) {
+       case SND_PCM_STREAM_PLAYBACK:
                memcpy(&dstparams, slave_params, sizeof(*slave_params));
                srcparams = slave_params;
                memcpy(srcparams, params, sizeof(*params));
                break;
-       case SND_PCM_CHANNEL_CAPTURE:
+       case SND_PCM_STREAM_CAPTURE:
                memcpy(&dstparams, params, sizeof(*params));
                srcparams = params;
                memcpy(srcparams, slave_params, sizeof(*slave_params));
@@ -552,24 +552,24 @@ int snd_pcm_plug_format(snd_pcm_plugin_handle_t *handle,
        }
        memcpy(&tmpparams, srcparams, sizeof(*srcparams));
                
-       pdprintf("srcparams: interleave=%i, format=%i, rate=%i, voices=%i\n", 
+       pdprintf("srcparams: interleave=%i, format=%i, rate=%i, channels=%i\n", 
                 srcparams->format.interleave,
                 srcparams->format.format,
                 srcparams->format.rate,
-                srcparams->format.voices);
-       pdprintf("dstparams: interleave=%i, format=%i, rate=%i, voices=%i\n", 
+                srcparams->format.channels);
+       pdprintf("dstparams: interleave=%i, format=%i, rate=%i, channels=%i\n", 
                 dstparams.format.interleave,
                 dstparams.format.format,
                 dstparams.format.rate,
-                dstparams.format.voices);
+                dstparams.format.channels);
 
-       if (srcparams->format.voices == 1)
+       if (srcparams->format.channels == 1)
                srcparams->format.interleave = dstparams.format.interleave;
 
-       /* Format change (linearization) */
+       /* Format streamge (linearization) */
        if ((srcparams->format.format != dstparams.format.format ||
             srcparams->format.rate != dstparams.format.rate ||
-            srcparams->format.voices != dstparams.format.voices) &&
+            srcparams->format.channels != dstparams.format.channels) &&
            !snd_pcm_format_linear(srcparams->format.format)) {
                if (snd_pcm_format_linear(dstparams.format.format))
                        tmpparams.format.format = dstparams.format.format;
@@ -579,7 +579,7 @@ int snd_pcm_plug_format(snd_pcm_plugin_handle_t *handle,
                switch (srcparams->format.format) {
                case SND_PCM_SFMT_MU_LAW:
                        err = snd_pcm_plugin_build_mulaw(handle,
-                                                        params->channel,
+                                                        params->stream,
                                                         &srcparams->format,
                                                         &tmpparams.format,
                                                         &plugin);
@@ -587,14 +587,14 @@ int snd_pcm_plug_format(snd_pcm_plugin_handle_t *handle,
 #ifndef __KERNEL__
                case SND_PCM_SFMT_A_LAW:
                        err = snd_pcm_plugin_build_alaw(handle,
-                                                       params->channel,
+                                                       params->stream,
                                                        &srcparams->format,
                                                        &tmpparams.format,
                                                        &plugin);
                        break;
                case SND_PCM_SFMT_IMA_ADPCM:
                        err = snd_pcm_plugin_build_adpcm(handle,
-                                                        params->channel,
+                                                        params->stream,
                                                         &srcparams->format,
                                                         &tmpparams.format,
                                                         &plugin);
@@ -603,7 +603,7 @@ int snd_pcm_plug_format(snd_pcm_plugin_handle_t *handle,
                default:
                        return -EINVAL;
                }
-               pdprintf("params format change: src=%i, dst=%i returns %i\n", srcparams->format.format, tmpparams.format.format, err);
+               pdprintf("params format streamge: src=%i, dst=%i returns %i\n", srcparams->format.format, tmpparams.format.format, err);
                if (err < 0)
                        return err;
                err = snd_pcm_plugin_append(plugin);
@@ -614,10 +614,10 @@ int snd_pcm_plug_format(snd_pcm_plugin_handle_t *handle,
                srcparams->format = tmpparams.format;
        }
 
-       /* voices reduction */
-       if (srcparams->format.voices > dstparams.format.voices) {
-               int sv = srcparams->format.voices;
-               int dv = dstparams.format.voices;
+       /* channels reduction */
+       if (srcparams->format.channels > dstparams.format.channels) {
+               int sv = srcparams->format.channels;
+               int dv = dstparams.format.channels;
                route_ttable_entry_t *ttable = calloc(1, dv*sv*sizeof(*ttable));
 #if 1
                if (sv == 2 && dv == 1) {
@@ -630,19 +630,19 @@ int snd_pcm_plug_format(snd_pcm_plugin_handle_t *handle,
                        for (v = 0; v < dv; ++v)
                                ttable[v * sv + v] = FULL;
                }
-               tmpparams.format.voices = dstparams.format.voices;
+               tmpparams.format.channels = dstparams.format.channels;
                tmpparams.format.interleave = dstparams.format.interleave;
                if (srcparams->format.rate == dstparams.format.rate &&
                    snd_pcm_format_linear(dstparams.format.format))
                        tmpparams.format.format = dstparams.format.format;
                err = snd_pcm_plugin_build_route(handle,
-                                                params->channel,
+                                                params->stream,
                                                 &srcparams->format,
                                                 &tmpparams.format,
                                                 ttable,
                                                 &plugin);
                free(ttable);
-               pdprintf("params voices reduction: src=%i, dst=%i returns %i\n", srcparams->format.voices, tmpparams.format.voices, err);
+               pdprintf("params channels reduction: src=%i, dst=%i returns %i\n", srcparams->format.channels, tmpparams.format.channels, err);
                if (err < 0) {
                        snd_pcm_plugin_free(plugin);
                        return err;
@@ -659,11 +659,11 @@ int snd_pcm_plug_format(snd_pcm_plugin_handle_t *handle,
        if (srcparams->format.rate != dstparams.format.rate) {
                tmpparams.format.rate = dstparams.format.rate;
                tmpparams.format.interleave = dstparams.format.interleave;
-               if (srcparams->format.voices == dstparams.format.voices &&
+               if (srcparams->format.channels == dstparams.format.channels &&
                    snd_pcm_format_linear(dstparams.format.format))
                        tmpparams.format.format = dstparams.format.format;
                err = snd_pcm_plugin_build_rate(handle,
-                                               params->channel,
+                                               params->stream,
                                                &srcparams->format,
                                                &tmpparams.format,
                                                &plugin);
@@ -680,10 +680,10 @@ int snd_pcm_plug_format(snd_pcm_plugin_handle_t *handle,
                srcparams->format = tmpparams.format;
         }
 
-       /* voices extension  */
-       if (srcparams->format.voices < dstparams.format.voices) {
-               int sv = srcparams->format.voices;
-               int dv = dstparams.format.voices;
+       /* channels extension  */
+       if (srcparams->format.channels < dstparams.format.channels) {
+               int sv = srcparams->format.channels;
+               int dv = dstparams.format.channels;
                route_ttable_entry_t *ttable = calloc(1, dv * sv * sizeof(*ttable));
 #if 0
                {
@@ -693,7 +693,7 @@ int snd_pcm_plug_format(snd_pcm_plugin_handle_t *handle,
                }
 #else
                {
-                       /* Playback is spreaded on all voices */
+                       /* Playback is spreaded on all channels */
                        int vd, vs;
                        for (vd = 0, vs = 0; vd < dv; ++vd) {
                                ttable[vd * sv + vs] = FULL;
@@ -703,18 +703,18 @@ int snd_pcm_plug_format(snd_pcm_plugin_handle_t *handle,
                        }
                }
 #endif
-               tmpparams.format.voices = dstparams.format.voices;
+               tmpparams.format.channels = dstparams.format.channels;
                tmpparams.format.interleave = dstparams.format.interleave;
                if (snd_pcm_format_linear(dstparams.format.format))
                        tmpparams.format.format = dstparams.format.format;
                err = snd_pcm_plugin_build_route(handle,
-                                                params->channel,
+                                                params->stream,
                                                 &srcparams->format,
                                                 &tmpparams.format,
                                                 ttable,
                                                 &plugin);
                free(ttable);
-               pdprintf("params voices extension: src=%i, dst=%i returns %i\n", srcparams->format.voices, tmpparams.format.voices, err);
+               pdprintf("params channels extension: src=%i, dst=%i returns %i\n", srcparams->format.channels, tmpparams.format.channels, err);
                if (err < 0) {
                        snd_pcm_plugin_free(plugin);
                        return err;
@@ -727,13 +727,13 @@ int snd_pcm_plug_format(snd_pcm_plugin_handle_t *handle,
                srcparams->format = tmpparams.format;
        }
 
-       /* format change */
+       /* format streamge */
        if (srcparams->format.format != dstparams.format.format) {
                tmpparams.format.format = dstparams.format.format;
                tmpparams.format.interleave = dstparams.format.interleave;
                if (tmpparams.format.format == SND_PCM_SFMT_MU_LAW) {
                        err = snd_pcm_plugin_build_mulaw(handle,
-                                                        params->channel,
+                                                        params->stream,
                                                         &srcparams->format,
                                                         &tmpparams.format,
                                                         &plugin);
@@ -741,14 +741,14 @@ int snd_pcm_plug_format(snd_pcm_plugin_handle_t *handle,
 #ifndef __KERNEL__
                else if (tmpparams.format.format == SND_PCM_SFMT_A_LAW) {
                        err = snd_pcm_plugin_build_alaw(handle,
-                                                       params->channel,
+                                                       params->stream,
                                                        &srcparams->format,
                                                        &tmpparams.format,
                                                        &plugin);
                }
                else if (tmpparams.format.format == SND_PCM_SFMT_IMA_ADPCM) {
                        err = snd_pcm_plugin_build_adpcm(handle,
-                                                        params->channel,
+                                                        params->stream,
                                                         &srcparams->format,
                                                         &tmpparams.format,
                                                         &plugin);
@@ -757,14 +757,14 @@ int snd_pcm_plug_format(snd_pcm_plugin_handle_t *handle,
                else if (snd_pcm_format_linear(srcparams->format.format) &&
                         snd_pcm_format_linear(tmpparams.format.format)) {
                        err = snd_pcm_plugin_build_linear(handle,
-                                                         params->channel,
+                                                         params->stream,
                                                          &srcparams->format,
                                                          &tmpparams.format,
                                                          &plugin);
                }
                else
                        return -EINVAL;
-               pdprintf("params format change: src=%i, dst=%i returns %i\n", srcparams->format.format, tmpparams.format.format, err);
+               pdprintf("params format streamge: src=%i, dst=%i returns %i\n", srcparams->format.format, tmpparams.format.format, err);
                if (err < 0)
                        return err;
                err = snd_pcm_plugin_append(plugin);
@@ -779,11 +779,11 @@ int snd_pcm_plug_format(snd_pcm_plugin_handle_t *handle,
        if (srcparams->format.interleave != dstparams.format.interleave) {
                tmpparams.format.interleave = dstparams.format.interleave;
                err = snd_pcm_plugin_build_copy(handle,
-                                               params->channel,
+                                               params->stream,
                                                &srcparams->format,
                                                &tmpparams.format,
                                                &plugin);
-               pdprintf("interleave change: src=%i, dst=%i returns %i\n", srcparams->format.interleave, tmpparams.format.interleave, err);
+               pdprintf("interleave streamge: src=%i, dst=%i returns %i\n", srcparams->format.interleave, tmpparams.format.interleave, err);
                if (err < 0)
                        return err;
                err = snd_pcm_plugin_append(plugin);
@@ -797,142 +797,142 @@ int snd_pcm_plug_format(snd_pcm_plugin_handle_t *handle,
        return 0;
 }
 
-ssize_t snd_pcm_plug_client_voices_buf(snd_pcm_plugin_handle_t *handle,
-                                      int channel,
+ssize_t snd_pcm_plug_client_channels_buf(snd_pcm_plugin_handle_t *handle,
+                                      int stream,
                                       char *buf,
                                       size_t count,
-                                      snd_pcm_plugin_voice_t **voices)
+                                      snd_pcm_plugin_channel_t **channels)
 {
        snd_pcm_plugin_t *plugin;
-       snd_pcm_plugin_voice_t *v;
+       snd_pcm_plugin_channel_t *v;
        snd_pcm_format_t *format;
-       int width, nvoices, voice;
+       int width, nchannels, channel;
 
        if (buf == NULL)
                return -EINVAL;
-       if (channel == SND_PCM_CHANNEL_PLAYBACK) {
-               plugin = snd_pcm_plug_first(handle, channel);
+       if (stream == SND_PCM_STREAM_PLAYBACK) {
+               plugin = snd_pcm_plug_first(handle, stream);
                format = &plugin->src_format;
-               v = plugin->src_voices;
+               v = plugin->src_channels;
        }
        else {
-               plugin = snd_pcm_plug_last(handle, channel);
+               plugin = snd_pcm_plug_last(handle, stream);
                format = &plugin->dst_format;
-               v = plugin->dst_voices;
+               v = plugin->dst_channels;
        }
-       *voices = v;
+       *channels = v;
        if ((width = snd_pcm_format_physical_width(format->format)) < 0)
                return width;
        if ((count * 8) % width != 0)
                return -EINVAL;
-       nvoices = format->voices;
+       nchannels = format->channels;
        if (format->interleave ||
-           format->voices == 1) {
-               for (voice = 0; voice < nvoices; voice++, v++) {
+           format->channels == 1) {
+               for (channel = 0; channel < nchannels; channel++, v++) {
                        v->enabled = 1;
-                       v->wanted = (channel == SND_PCM_CHANNEL_CAPTURE);
+                       v->wanted = (stream == SND_PCM_STREAM_CAPTURE);
                        v->aptr = NULL;
                        v->area.addr = buf;
-                       v->area.first = voice * width;
-                       v->area.step = nvoices * width;
+                       v->area.first = channel * width;
+                       v->area.step = nchannels * width;
                }
                return count;
        } else
                return -EINVAL;
 }
 
-ssize_t snd_pcm_plug_client_voices_iovec(snd_pcm_plugin_handle_t *handle,
-                                        int channel,
+ssize_t snd_pcm_plug_client_channels_iovec(snd_pcm_plugin_handle_t *handle,
+                                        int stream,
                                         const struct iovec *vector,
                                         unsigned long count,
-                                        snd_pcm_plugin_voice_t **voices)
+                                        snd_pcm_plugin_channel_t **channels)
 {
        snd_pcm_plugin_t *plugin;
-       snd_pcm_plugin_voice_t *v;
+       snd_pcm_plugin_channel_t *v;
        snd_pcm_format_t *format;
        int width;
-       unsigned int nvoices, voice;
+       unsigned int nchannels, channel;
 
-       if (channel == SND_PCM_CHANNEL_PLAYBACK) {
-               plugin = snd_pcm_plug_first(handle, channel);
+       if (stream == SND_PCM_STREAM_PLAYBACK) {
+               plugin = snd_pcm_plug_first(handle, stream);
                format = &plugin->src_format;
-               v = plugin->src_voices;
+               v = plugin->src_channels;
        }
        else {
-               plugin = snd_pcm_plug_last(handle, channel);
+               plugin = snd_pcm_plug_last(handle, stream);
                format = &plugin->dst_format;
-               v = plugin->dst_voices;
+               v = plugin->dst_channels;
        }
-       *voices = v;
+       *channels = v;
        if ((width = snd_pcm_format_physical_width(format->format)) < 0)
                return width;
-       nvoices = format->voices;
+       nchannels = format->channels;
        if (format->interleave) {
                if (count != 1 || vector->iov_base == NULL ||
                    (vector->iov_len * 8) % width != 0)
                        return -EINVAL;
                
-               for (voice = 0; voice < nvoices; voice++, v++) {
+               for (channel = 0; channel < nchannels; channel++, v++) {
                        v->enabled = 1;
-                       v->wanted = (channel == SND_PCM_CHANNEL_CAPTURE);
+                       v->wanted = (stream == SND_PCM_STREAM_CAPTURE);
                        v->aptr = NULL;
                        v->area.addr = vector->iov_base;
-                       v->area.first = voice * width;
-                       v->area.step = nvoices * width;
+                       v->area.first = channel * width;
+                       v->area.step = nchannels * width;
                }
                return vector->iov_len;
        } else {
                size_t len;
-               if (count != nvoices)
+               if (count != nchannels)
                        return -EINVAL;
                len = vector->iov_len;
                if ((len * 8) % width != 0)
                        return -EINVAL;
-               for (voice = 0; voice < nvoices; voice++, v++, vector++) {
+               for (channel = 0; channel < nchannels; channel++, v++, vector++) {
                        if (vector->iov_len != len)
                                return -EINVAL;
                        v->enabled = (vector->iov_base != NULL);
-                       v->wanted = (v->enabled && (channel == SND_PCM_CHANNEL_CAPTURE));
+                       v->wanted = (v->enabled && (stream == SND_PCM_STREAM_CAPTURE));
                        v->aptr = NULL;
                        v->area.addr = vector->iov_base;
                        v->area.first = 0;
                        v->area.step = width;
                }
-               return len * nvoices;
+               return len * nchannels;
        }
 }
 
-int snd_pcm_plug_playback_voices_mask(snd_pcm_plugin_handle_t *handle,
+int snd_pcm_plug_playback_channels_mask(snd_pcm_plugin_handle_t *handle,
                                      bitset_t *client_vmask)
 {
 #ifndef __KERNEL__
        snd_pcm_plug_t *plug = (snd_pcm_plug_t*) &handle->private;
 #endif
-       snd_pcm_plugin_t *plugin = snd_pcm_plug_last(handle, SND_PCM_CHANNEL_PLAYBACK);
+       snd_pcm_plugin_t *plugin = snd_pcm_plug_last(handle, SND_PCM_STREAM_PLAYBACK);
        if (plugin == NULL) {
 #ifndef __KERNEL__
-               return snd_pcm_voices_mask(plug->slave, SND_PCM_CHANNEL_PLAYBACK, client_vmask);
+               return snd_pcm_channels_mask(plug->slave, SND_PCM_STREAM_PLAYBACK, client_vmask);
 #else
                return 0;
 #endif
        } else {
-               int svoices = plugin->dst_format.voices;
-               bitset_t bs[bitset_size(svoices)];
+               int schannels = plugin->dst_format.channels;
+               bitset_t bs[bitset_size(schannels)];
                bitset_t *srcmask;
                bitset_t *dstmask = bs;
                int err;
-               bitset_one(dstmask, svoices);
+               bitset_one(dstmask, schannels);
 #ifndef __KERNEL__
-               err = snd_pcm_voices_mask(plug->slave, SND_PCM_CHANNEL_PLAYBACK, dstmask);
+               err = snd_pcm_channels_mask(plug->slave, SND_PCM_STREAM_PLAYBACK, dstmask);
                if (err < 0)
                        return err;
 #endif
                if (plugin == NULL) {
-                       bitset_and(client_vmask, dstmask, svoices);
+                       bitset_and(client_vmask, dstmask, schannels);
                        return 0;
                }
                while (1) {
-                       err = plugin->src_voices_mask(plugin, dstmask, &srcmask);
+                       err = plugin->src_channels_mask(plugin, dstmask, &srcmask);
                        if (err < 0)
                                return err;
                        dstmask = srcmask;
@@ -940,38 +940,38 @@ int snd_pcm_plug_playback_voices_mask(snd_pcm_plugin_handle_t *handle,
                                break;
                        plugin = plugin->prev;
                }
-               bitset_and(client_vmask, dstmask, plugin->src_format.voices);
+               bitset_and(client_vmask, dstmask, plugin->src_format.channels);
                return 0;
        }
 }
 
-int snd_pcm_plug_capture_voices_mask(snd_pcm_plugin_handle_t *handle,
+int snd_pcm_plug_capture_channels_mask(snd_pcm_plugin_handle_t *handle,
                                     bitset_t *client_vmask)
 {
 #ifndef __KERNEL__
        snd_pcm_plug_t *plug = (snd_pcm_plug_t*) &handle->private;
 #endif
-       snd_pcm_plugin_t *plugin = snd_pcm_plug_first(handle, SND_PCM_CHANNEL_CAPTURE);
+       snd_pcm_plugin_t *plugin = snd_pcm_plug_first(handle, SND_PCM_STREAM_CAPTURE);
        if (plugin == NULL) {
 #ifndef __KERNEL__
-               return snd_pcm_voices_mask(plug->slave, SND_PCM_CHANNEL_CAPTURE, client_vmask);
+               return snd_pcm_channels_mask(plug->slave, SND_PCM_STREAM_CAPTURE, client_vmask);
 #else
                return 0;
 #endif
        } else {
-               int svoices = plugin->src_format.voices;
-               bitset_t bs[bitset_size(svoices)];
+               int schannels = plugin->src_format.channels;
+               bitset_t bs[bitset_size(schannels)];
                bitset_t *srcmask = bs;
                bitset_t *dstmask;
                int err;
-               bitset_one(srcmask, svoices);
+               bitset_one(srcmask, schannels);
 #ifndef __KERNEL__
-               err = snd_pcm_voices_mask(plug->slave, SND_PCM_CHANNEL_CAPTURE, srcmask);
+               err = snd_pcm_channels_mask(plug->slave, SND_PCM_STREAM_CAPTURE, srcmask);
                if (err < 0)
                        return err;
 #endif
                while (1) {
-                       err = plugin->dst_voices_mask(plugin, srcmask, &dstmask);
+                       err = plugin->dst_channels_mask(plugin, srcmask, &dstmask);
                        if (err < 0)
                                return err;
                        srcmask = dstmask;
@@ -979,88 +979,88 @@ int snd_pcm_plug_capture_voices_mask(snd_pcm_plugin_handle_t *handle,
                                break;
                        plugin = plugin->next;
                }
-               bitset_and(client_vmask, srcmask, plugin->dst_format.voices);
+               bitset_and(client_vmask, srcmask, plugin->dst_format.channels);
                return 0;
        }
 }
 
-static int snd_pcm_plug_playback_disable_useless_voices(snd_pcm_plugin_handle_t *handle,
-                                                       snd_pcm_plugin_voice_t *src_voices)
+static int snd_pcm_plug_playback_disable_useless_channels(snd_pcm_plugin_handle_t *handle,
+                                                       snd_pcm_plugin_channel_t *src_channels)
 {
-       snd_pcm_plugin_t *plugin = snd_pcm_plug_first(handle, SND_PCM_CHANNEL_PLAYBACK);
-       unsigned int nvoices = plugin->src_format.voices;
-       bitset_t bs[bitset_size(nvoices)];
+       snd_pcm_plugin_t *plugin = snd_pcm_plug_first(handle, SND_PCM_STREAM_PLAYBACK);
+       unsigned int nchannels = plugin->src_format.channels;
+       bitset_t bs[bitset_size(nchannels)];
        bitset_t *srcmask = bs;
        int err;
-       unsigned int voice;
-       for (voice = 0; voice < nvoices; voice++) {
-               if (src_voices[voice].enabled)
-                       bitset_set(srcmask, voice);
+       unsigned int channel;
+       for (channel = 0; channel < nchannels; channel++) {
+               if (src_channels[channel].enabled)
+                       bitset_set(srcmask, channel);
                else
-                       bitset_reset(srcmask, voice);
+                       bitset_reset(srcmask, channel);
        }
-       err = snd_pcm_plug_playback_voices_mask(handle, srcmask);
+       err = snd_pcm_plug_playback_channels_mask(handle, srcmask);
        if (err < 0)
                return err;
-       for (voice = 0; voice < nvoices; voice++) {
-               if (!bitset_get(srcmask, voice))
-                       src_voices[voice].enabled = 0;
+       for (channel = 0; channel < nchannels; channel++) {
+               if (!bitset_get(srcmask, channel))
+                       src_channels[channel].enabled = 0;
        }
        return 0;
 }
 
-static int snd_pcm_plug_capture_disable_useless_voices(snd_pcm_plugin_handle_t *handle,
-                                                      snd_pcm_plugin_voice_t *src_voices,
-                                                      snd_pcm_plugin_voice_t *client_voices)
+static int snd_pcm_plug_capture_disable_useless_channels(snd_pcm_plugin_handle_t *handle,
+                                                      snd_pcm_plugin_channel_t *src_channels,
+                                                      snd_pcm_plugin_channel_t *client_channels)
 {
 #ifndef __KERNEL__
        snd_pcm_plug_t *plug = (snd_pcm_plug_t*) &handle->private;
 #endif
-       snd_pcm_plugin_t *plugin = snd_pcm_plug_last(handle, SND_PCM_CHANNEL_CAPTURE);
-       unsigned int nvoices = plugin->dst_format.voices;
-       bitset_t bs[bitset_size(nvoices)];
+       snd_pcm_plugin_t *plugin = snd_pcm_plug_last(handle, SND_PCM_STREAM_CAPTURE);
+       unsigned int nchannels = plugin->dst_format.channels;
+       bitset_t bs[bitset_size(nchannels)];
        bitset_t *dstmask = bs;
        bitset_t *srcmask;
        int err;
-       unsigned int voice;
-       for (voice = 0; voice < nvoices; voice++) {
-               if (client_voices[voice].enabled)
-                       bitset_set(dstmask, voice);
+       unsigned int channel;
+       for (channel = 0; channel < nchannels; channel++) {
+               if (client_channels[channel].enabled)
+                       bitset_set(dstmask, channel);
                else
-                       bitset_reset(dstmask, voice);
+                       bitset_reset(dstmask, channel);
        }
        while (plugin) {
-               err = plugin->src_voices_mask(plugin, dstmask, &srcmask);
+               err = plugin->src_channels_mask(plugin, dstmask, &srcmask);
                if (err < 0)
                        return err;
                dstmask = srcmask;
                plugin = plugin->prev;
        }
 #ifndef __KERNEL__
-       err = snd_pcm_voices_mask(plug->slave, SND_PCM_CHANNEL_CAPTURE, dstmask);
+       err = snd_pcm_channels_mask(plug->slave, SND_PCM_STREAM_CAPTURE, dstmask);
        if (err < 0)
                return err;
 #endif
-       plugin = snd_pcm_plug_first(handle, SND_PCM_CHANNEL_CAPTURE);
-       nvoices = plugin->src_format.voices;
-       for (voice = 0; voice < nvoices; voice++) {
-               if (!bitset_get(dstmask, voice))
-                       src_voices[voice].enabled = 0;
+       plugin = snd_pcm_plug_first(handle, SND_PCM_STREAM_CAPTURE);
+       nchannels = plugin->src_format.channels;
+       for (channel = 0; channel < nchannels; channel++) {
+               if (!bitset_get(dstmask, channel))
+                       src_channels[channel].enabled = 0;
        }
        return 0;
 }
 
-ssize_t snd_pcm_plug_write_transfer(snd_pcm_plugin_handle_t *handle, snd_pcm_plugin_voice_t *src_voices, size_t size)
+ssize_t snd_pcm_plug_write_transfer(snd_pcm_plugin_handle_t *handle, snd_pcm_plugin_channel_t *src_channels, size_t size)
 {
        snd_pcm_plugin_t *plugin, *next;
-       snd_pcm_plugin_voice_t *dst_voices;
+       snd_pcm_plugin_channel_t *dst_channels;
        ssize_t frames;
        int err;
 
-       if ((err = snd_pcm_plug_playback_disable_useless_voices(handle, src_voices)) < 0)
+       if ((err = snd_pcm_plug_playback_disable_useless_channels(handle, src_channels)) < 0)
                return err;
        
-       plugin = snd_pcm_plug_first(handle, SND_PCM_CHANNEL_PLAYBACK);
+       plugin = snd_pcm_plug_first(handle, SND_PCM_STREAM_PLAYBACK);
        frames = snd_pcm_plugin_src_size_to_frames(plugin, size);
        if (frames < 0)
                return frames;
@@ -1069,8 +1069,8 @@ ssize_t snd_pcm_plug_write_transfer(snd_pcm_plugin_handle_t *handle, snd_pcm_plu
                        ssize_t frames1 = frames;
                        if (plugin->dst_frames)
                                frames1 = plugin->dst_frames(plugin, frames);
-                       if ((err = next->client_voices(next, frames1, &dst_voices)) < 0) {
-                               snd_pcm_plug_buf_unlock(handle, SND_PCM_CHANNEL_PLAYBACK, src_voices->aptr);
+                       if ((err = next->client_channels(next, frames1, &dst_channels)) < 0) {
+                               snd_pcm_plug_buf_unlock(handle, SND_PCM_STREAM_PLAYBACK, src_channels->aptr);
                                return err;
                        }
                        if (err != frames1) {
@@ -1079,85 +1079,85 @@ ssize_t snd_pcm_plug_write_transfer(snd_pcm_plugin_handle_t *handle, snd_pcm_plu
                                        frames = plugin->src_frames(plugin, frames1);
                        }
                } else {
-                       if ((err = snd_pcm_plugin_slave_voices(plugin, frames, &dst_voices)) < 0)
+                       if ((err = snd_pcm_plugin_slave_channels(plugin, frames, &dst_channels)) < 0)
                                return err;
                }
                pdprintf("write plugin: %s, %i\n", plugin->name, frames);
-               if ((frames = plugin->transfer(plugin, src_voices, dst_voices, frames)) < 0) {
-                       snd_pcm_plug_buf_unlock(handle, SND_PCM_CHANNEL_PLAYBACK, src_voices->aptr);
-                       snd_pcm_plug_buf_unlock(handle, SND_PCM_CHANNEL_PLAYBACK, dst_voices->aptr);
+               if ((frames = plugin->transfer(plugin, src_channels, dst_channels, frames)) < 0) {
+                       snd_pcm_plug_buf_unlock(handle, SND_PCM_STREAM_PLAYBACK, src_channels->aptr);
+                       snd_pcm_plug_buf_unlock(handle, SND_PCM_STREAM_PLAYBACK, dst_channels->aptr);
                        return frames;
                }
-               snd_pcm_plug_buf_unlock(handle, SND_PCM_CHANNEL_PLAYBACK, src_voices->aptr);
-               src_voices = dst_voices;
+               snd_pcm_plug_buf_unlock(handle, SND_PCM_STREAM_PLAYBACK, src_channels->aptr);
+               src_channels = dst_channels;
                plugin = next;
        }
-       snd_pcm_plug_buf_unlock(handle, SND_PCM_CHANNEL_PLAYBACK, src_voices->aptr);
-       frames = snd_pcm_plug_client_frames(handle, SND_PCM_CHANNEL_PLAYBACK, frames);
+       snd_pcm_plug_buf_unlock(handle, SND_PCM_STREAM_PLAYBACK, src_channels->aptr);
+       frames = snd_pcm_plug_client_frames(handle, SND_PCM_STREAM_PLAYBACK, frames);
        if (frames < 0)
                return frames;
-       return snd_pcm_plugin_src_frames_to_size(snd_pcm_plug_first(handle, SND_PCM_CHANNEL_PLAYBACK), frames);
+       return snd_pcm_plugin_src_frames_to_size(snd_pcm_plug_first(handle, SND_PCM_STREAM_PLAYBACK), frames);
 }
 
-ssize_t snd_pcm_plug_read_transfer(snd_pcm_plugin_handle_t *handle, snd_pcm_plugin_voice_t *dst_voices_final, size_t size)
+ssize_t snd_pcm_plug_read_transfer(snd_pcm_plugin_handle_t *handle, snd_pcm_plugin_channel_t *dst_channels_final, size_t size)
 {
        snd_pcm_plugin_t *plugin, *next;
-       snd_pcm_plugin_voice_t *src_voices, *dst_voices;
+       snd_pcm_plugin_channel_t *src_channels, *dst_channels;
        ssize_t frames;
        int err;
 
-       plugin = snd_pcm_plug_last(handle, SND_PCM_CHANNEL_CAPTURE);
+       plugin = snd_pcm_plug_last(handle, SND_PCM_STREAM_CAPTURE);
        frames = snd_pcm_plugin_dst_size_to_frames(plugin, size);
        if (frames < 0)
                return frames;
-       frames = snd_pcm_plug_slave_frames(handle, SND_PCM_CHANNEL_CAPTURE, frames);
+       frames = snd_pcm_plug_slave_frames(handle, SND_PCM_STREAM_CAPTURE, frames);
        if (frames < 0)
                return frames;
 
-       plugin = snd_pcm_plug_first(handle, SND_PCM_CHANNEL_CAPTURE);
-       if ((err = snd_pcm_plugin_slave_voices(plugin, frames, &src_voices)) < 0)
+       plugin = snd_pcm_plug_first(handle, SND_PCM_STREAM_CAPTURE);
+       if ((err = snd_pcm_plugin_slave_channels(plugin, frames, &src_channels)) < 0)
                return err;
-       if ((err = snd_pcm_plug_capture_disable_useless_voices(handle, src_voices, dst_voices_final) < 0))
+       if ((err = snd_pcm_plug_capture_disable_useless_channels(handle, src_channels, dst_channels_final) < 0))
                return err;
        
        while (plugin && frames > 0) {
                if ((next = plugin->next) != NULL) {
-                       if ((err = plugin->client_voices(plugin, frames, &dst_voices)) < 0) {
-                               snd_pcm_plug_buf_unlock(handle, SND_PCM_CHANNEL_CAPTURE, src_voices->aptr);
+                       if ((err = plugin->client_channels(plugin, frames, &dst_channels)) < 0) {
+                               snd_pcm_plug_buf_unlock(handle, SND_PCM_STREAM_CAPTURE, src_channels->aptr);
                                return err;
                        }
                        frames = err;
                } else {
-                       dst_voices = dst_voices_final;
+                       dst_channels = dst_channels_final;
                }
                pdprintf("read plugin: %s, %i\n", plugin->name, frames);
-               if ((frames = plugin->transfer(plugin, src_voices, dst_voices, frames)) < 0) {
-                       snd_pcm_plug_buf_unlock(handle, SND_PCM_CHANNEL_CAPTURE, src_voices->aptr);
-                       snd_pcm_plug_buf_unlock(handle, SND_PCM_CHANNEL_CAPTURE, dst_voices->aptr);
+               if ((frames = plugin->transfer(plugin, src_channels, dst_channels, frames)) < 0) {
+                       snd_pcm_plug_buf_unlock(handle, SND_PCM_STREAM_CAPTURE, src_channels->aptr);
+                       snd_pcm_plug_buf_unlock(handle, SND_PCM_STREAM_CAPTURE, dst_channels->aptr);
                        return frames;
                }
 #if 0
                {
-                 unsigned int voice;
-                 for (voice = 0; voice < plugin->src_format.voices; ++voice) {
-                   fprintf(stderr, "%d%d ", src_voices[voice].enabled, src_voices[voice].wanted);
+                 unsigned int channel;
+                 for (channel = 0; channel < plugin->src_format.channels; ++channel) {
+                   fprintf(stderr, "%d%d ", src_channels[channel].enabled, src_channels[channel].wanted);
                  }
                  fprintf(stderr, " -> ");
-                 for (voice = 0; voice < plugin->dst_format.voices; ++voice) {
-                   fprintf(stderr, "%d%d ", dst_voices[voice].enabled, dst_voices[voice].wanted);
+                 for (channel = 0; channel < plugin->dst_format.channels; ++channel) {
+                   fprintf(stderr, "%d%d ", dst_channels[channel].enabled, dst_channels[channel].wanted);
                  }
                  fprintf(stderr, "\n");
                }
 #endif
-               snd_pcm_plug_buf_unlock(handle, SND_PCM_CHANNEL_CAPTURE, src_voices->aptr);
+               snd_pcm_plug_buf_unlock(handle, SND_PCM_STREAM_CAPTURE, src_channels->aptr);
                plugin = next;
-               src_voices = dst_voices;
+               src_channels = dst_channels;
        }
-       snd_pcm_plug_buf_unlock(handle, SND_PCM_CHANNEL_CAPTURE, src_voices->aptr);
-       return snd_pcm_plugin_dst_frames_to_size(snd_pcm_plug_last(handle, SND_PCM_CHANNEL_CAPTURE), frames);
+       snd_pcm_plug_buf_unlock(handle, SND_PCM_STREAM_CAPTURE, src_channels->aptr);
+       return snd_pcm_plugin_dst_frames_to_size(snd_pcm_plug_last(handle, SND_PCM_STREAM_CAPTURE), frames);
 }
 
-int snd_pcm_area_silence(const snd_pcm_voice_area_t *dst_area, size_t dst_offset,
+int snd_pcm_area_silence(const snd_pcm_channel_area_t *dst_area, size_t dst_offset,
                          size_t samples, int format)
 {
        /* FIXME: sub byte resolution and odd dst_offset */
@@ -1239,14 +1239,14 @@ int snd_pcm_area_silence(const snd_pcm_voice_area_t *dst_area, size_t dst_offset
        return 0;
 }
 
-int snd_pcm_areas_silence(const snd_pcm_voice_area_t *dst_areas, size_t dst_offset,
+int snd_pcm_areas_silence(const snd_pcm_channel_area_t *dst_areas, size_t dst_offset,
                          size_t vcount, size_t frames, int format)
 {
        int width = snd_pcm_format_physical_width(format);
        while (vcount > 0) {
                void *addr = dst_areas->addr;
                unsigned int step = dst_areas->step;
-               const snd_pcm_voice_area_t *begin = dst_areas;
+               const snd_pcm_channel_area_t *begin = dst_areas;
                int vc = vcount;
                unsigned int v = 0;
                int err;
@@ -1262,7 +1262,7 @@ int snd_pcm_areas_silence(const snd_pcm_voice_area_t *dst_areas, size_t dst_offs
                }
                if (v > 1 && v * width == step) {
                        /* Collapse the areas */
-                       snd_pcm_voice_area_t d;
+                       snd_pcm_channel_area_t d;
                        d.addr = begin->addr;
                        d.first = begin->first;
                        d.step = width;
@@ -1280,8 +1280,8 @@ int snd_pcm_areas_silence(const snd_pcm_voice_area_t *dst_areas, size_t dst_offs
 }
 
 
-int snd_pcm_area_copy(const snd_pcm_voice_area_t *src_area, size_t src_offset,
-                     const snd_pcm_voice_area_t *dst_area, size_t dst_offset,
+int snd_pcm_area_copy(const snd_pcm_channel_area_t *src_area, size_t src_offset,
+                     const snd_pcm_channel_area_t *dst_area, size_t dst_offset,
                      size_t samples, int format)
 {
        /* FIXME: sub byte resolution and odd dst_offset */
@@ -1375,17 +1375,17 @@ int snd_pcm_area_copy(const snd_pcm_voice_area_t *src_area, size_t src_offset,
        return 0;
 }
 
-int snd_pcm_areas_copy(const snd_pcm_voice_area_t *src_areas, size_t src_offset,
-                      const snd_pcm_voice_area_t *dst_areas, size_t dst_offset,
+int snd_pcm_areas_copy(const snd_pcm_channel_area_t *src_areas, size_t src_offset,
+                      const snd_pcm_channel_area_t *dst_areas, size_t dst_offset,
                       size_t vcount, size_t frames, int format)
 {
        int width = snd_pcm_format_physical_width(format);
        while (vcount > 0) {
                unsigned int step = src_areas->step;
                void *src_addr = src_areas->addr;
-               const snd_pcm_voice_area_t *src_start = src_areas;
+               const snd_pcm_channel_area_t *src_start = src_areas;
                void *dst_addr = dst_areas->addr;
-               const snd_pcm_voice_area_t *dst_start = dst_areas;
+               const snd_pcm_channel_area_t *dst_start = dst_areas;
                int vc = vcount;
                unsigned int v = 0;
                while (dst_areas->step == step) {
@@ -1403,7 +1403,7 @@ int snd_pcm_areas_copy(const snd_pcm_voice_area_t *src_areas, size_t src_offset,
                }
                if (v > 1 && v * width == step) {
                        /* Collapse the areas */
-                       snd_pcm_voice_area_t s, d;
+                       snd_pcm_channel_area_t s, d;
                        s.addr = src_start->addr;
                        s.first = src_start->first;
                        s.step = width;
index 293bed3a72fc3924ba4d0f3ef3a320a62d140c07..88f147fd60d01e6488b9e13a3c7b760bbddf0fe2 100644 (file)
 #define SND_FILE_PCM_CAPTURE           "/dev/snd/pcmC%iD%ic"
 #define SND_PCM_VERSION_MAX    SND_PROTOCOL_VERSION(2, 0, 0)
 
-static int snd_pcm_hw_channel_close(snd_pcm_t *pcm, int channel)
+static int snd_pcm_hw_stream_close(snd_pcm_t *pcm, int stream)
 {
        snd_pcm_hw_t *hw = (snd_pcm_hw_t*) &pcm->private;
-       if (hw->chan[channel].fd >= 0)
-               if (close(hw->chan[channel].fd))
+       if (hw->stream[stream].fd >= 0)
+               if (close(hw->stream[stream].fd))
                        return -errno;
        return 0;
 }
 
-int snd_pcm_hw_channel_fd(snd_pcm_t *pcm, int channel)
+int snd_pcm_hw_stream_fd(snd_pcm_t *pcm, int stream)
 {
        snd_pcm_hw_t *hw;
        if (!pcm)
                return -EINVAL;
-       if (channel < 0 || channel > 1)
+       if (stream < 0 || stream > 1)
                return -EINVAL;
        hw = (snd_pcm_hw_t*) &pcm->private;
-       return hw->chan[channel].fd;
+       return hw->stream[stream].fd;
 }
 
-static int snd_pcm_hw_channel_nonblock(snd_pcm_t *pcm, int channel, int nonblock)
+static int snd_pcm_hw_stream_nonblock(snd_pcm_t *pcm, int stream, int nonblock)
 {
        long flags;
        int fd;
        snd_pcm_hw_t *hw = (snd_pcm_hw_t*) &pcm->private;
-       fd = hw->chan[channel].fd;
+       fd = hw->stream[stream].fd;
 
        if ((flags = fcntl(fd, F_GETFL)) < 0)
                return -errno;
@@ -73,10 +73,10 @@ static int snd_pcm_hw_channel_nonblock(snd_pcm_t *pcm, int channel, int nonblock
 
 static int snd_pcm_hw_info(snd_pcm_t *pcm, snd_pcm_info_t * info)
 {
-       int fd, channel;
+       int fd, stream;
        snd_pcm_hw_t *hw = (snd_pcm_hw_t*) &pcm->private;
-       for (channel = 0; channel < 2; ++channel) {
-               fd = hw->chan[channel].fd;
+       for (stream = 0; stream < 2; ++stream) {
+               fd = hw->stream[stream].fd;
                if (fd >= 0)
                        break;
        }
@@ -87,84 +87,84 @@ static int snd_pcm_hw_info(snd_pcm_t *pcm, snd_pcm_info_t * info)
        return 0;
 }
 
-static int snd_pcm_hw_channel_info(snd_pcm_t *pcm, snd_pcm_channel_info_t * info)
+static int snd_pcm_hw_stream_info(snd_pcm_t *pcm, snd_pcm_stream_info_t * info)
 {
        int fd;
        snd_pcm_hw_t *hw = (snd_pcm_hw_t*) &pcm->private;
-       fd = hw->chan[info->channel].fd;
+       fd = hw->stream[info->stream].fd;
        if (fd < 0)
                return -EINVAL;
-       if (ioctl(fd, SND_PCM_IOCTL_CHANNEL_INFO, info) < 0)
+       if (ioctl(fd, SND_PCM_IOCTL_STREAM_INFO, info) < 0)
                return -errno;
        return 0;
 }
 
-static int snd_pcm_hw_channel_params(snd_pcm_t *pcm, snd_pcm_channel_params_t * params)
+static int snd_pcm_hw_stream_params(snd_pcm_t *pcm, snd_pcm_stream_params_t * params)
 {
        int fd;
        snd_pcm_hw_t *hw = (snd_pcm_hw_t*) &pcm->private;
-       fd = hw->chan[params->channel].fd;
-       if (ioctl(fd, SND_PCM_IOCTL_CHANNEL_PARAMS, params) < 0)
+       fd = hw->stream[params->stream].fd;
+       if (ioctl(fd, SND_PCM_IOCTL_STREAM_PARAMS, params) < 0)
                return -errno;
        return 0;
 }
 
-static int snd_pcm_hw_channel_setup(snd_pcm_t *pcm, snd_pcm_channel_setup_t * setup)
+static int snd_pcm_hw_stream_setup(snd_pcm_t *pcm, snd_pcm_stream_setup_t * setup)
 {
        int fd;
        snd_pcm_hw_t *hw = (snd_pcm_hw_t*) &pcm->private;
-       fd = hw->chan[setup->channel].fd;
-       if (ioctl(fd, SND_PCM_IOCTL_CHANNEL_SETUP, setup) < 0)
+       fd = hw->stream[setup->stream].fd;
+       if (ioctl(fd, SND_PCM_IOCTL_STREAM_SETUP, setup) < 0)
                return -errno;
        return 0;
 }
 
-static int snd_pcm_hw_voice_setup(snd_pcm_t *pcm, int channel, snd_pcm_voice_setup_t * setup)
+static int snd_pcm_hw_channel_setup(snd_pcm_t *pcm, int stream, snd_pcm_channel_setup_t * setup)
 {
        int fd;
        snd_pcm_hw_t *hw = (snd_pcm_hw_t*) &pcm->private;
-       fd = hw->chan[channel].fd;
-       if (ioctl(fd, SND_PCM_IOCTL_VOICE_SETUP, setup) < 0)
+       fd = hw->stream[stream].fd;
+       if (ioctl(fd, SND_PCM_IOCTL_CHANNEL_SETUP, setup) < 0)
                return -errno;
        return 0;
 }
 
-static int snd_pcm_hw_channel_status(snd_pcm_t *pcm, snd_pcm_channel_status_t * status)
+static int snd_pcm_hw_stream_status(snd_pcm_t *pcm, snd_pcm_stream_status_t * status)
 {
        int fd;
        snd_pcm_hw_t *hw = (snd_pcm_hw_t*) &pcm->private;
-       fd = hw->chan[status->channel].fd;
-       if (ioctl(fd, SND_PCM_IOCTL_CHANNEL_STATUS, status) < 0)
+       fd = hw->stream[status->stream].fd;
+       if (ioctl(fd, SND_PCM_IOCTL_STREAM_STATUS, status) < 0)
                return -errno;
        return 0;
 }
 
-static int snd_pcm_hw_channel_update(snd_pcm_t *pcm, int channel)
+static int snd_pcm_hw_stream_update(snd_pcm_t *pcm, int stream)
 {
        int fd;
        snd_pcm_hw_t *hw = (snd_pcm_hw_t*) &pcm->private;
-       fd = hw->chan[channel].fd;
-       if (ioctl(fd, SND_PCM_IOCTL_CHANNEL_UPDATE) < 0)
+       fd = hw->stream[stream].fd;
+       if (ioctl(fd, SND_PCM_IOCTL_STREAM_UPDATE) < 0)
                return -errno;
        return 0;
 }
 
-static int snd_pcm_hw_channel_prepare(snd_pcm_t *pcm, int channel)
+static int snd_pcm_hw_stream_prepare(snd_pcm_t *pcm, int stream)
 {
        int fd;
        snd_pcm_hw_t *hw = (snd_pcm_hw_t*) &pcm->private;
-       fd = hw->chan[channel].fd;
-       if (ioctl(fd, SND_PCM_IOCTL_CHANNEL_PREPARE) < 0)
+       fd = hw->stream[stream].fd;
+       if (ioctl(fd, SND_PCM_IOCTL_STREAM_PREPARE) < 0)
                return -errno;
        return 0;
 }
 
-static int snd_pcm_hw_channel_go(snd_pcm_t *pcm, int channel)
+static int snd_pcm_hw_stream_go(snd_pcm_t *pcm, int stream)
 {
        int fd;
        snd_pcm_hw_t *hw = (snd_pcm_hw_t*) &pcm->private;
-       fd = hw->chan[channel].fd;
-       if (ioctl(fd, SND_PCM_IOCTL_CHANNEL_GO) < 0)
+       fd = hw->stream[stream].fd;
+       if (ioctl(fd, SND_PCM_IOCTL_STREAM_GO) < 0)
                return -errno;
        return 0;
 }
@@ -173,41 +173,41 @@ static int snd_pcm_hw_sync_go(snd_pcm_t *pcm, snd_pcm_sync_t *sync)
 {
        int fd;
        snd_pcm_hw_t *hw = (snd_pcm_hw_t*) &pcm->private;
-       if (pcm->chan[SND_PCM_CHANNEL_PLAYBACK].open)
-               fd = hw->chan[SND_PCM_CHANNEL_PLAYBACK].fd;
+       if (pcm->stream[SND_PCM_STREAM_PLAYBACK].open)
+               fd = hw->stream[SND_PCM_STREAM_PLAYBACK].fd;
        else
-               fd = hw->chan[SND_PCM_CHANNEL_CAPTURE].fd;
+               fd = hw->stream[SND_PCM_STREAM_CAPTURE].fd;
        if (ioctl(fd, SND_PCM_IOCTL_SYNC_GO, sync) < 0)
                return -errno;
        return 0;
 }
 
-static int snd_pcm_hw_channel_drain(snd_pcm_t *pcm, int channel)
+static int snd_pcm_hw_stream_drain(snd_pcm_t *pcm, int stream)
 {
        int fd;
        snd_pcm_hw_t *hw = (snd_pcm_hw_t*) &pcm->private;
-       fd = hw->chan[channel].fd;
-       if (ioctl(fd, SND_PCM_IOCTL_CHANNEL_DRAIN) < 0)
+       fd = hw->stream[stream].fd;
+       if (ioctl(fd, SND_PCM_IOCTL_STREAM_DRAIN) < 0)
                return -errno;
        return 0;
 }
 
-static int snd_pcm_hw_channel_flush(snd_pcm_t *pcm, int channel)
+static int snd_pcm_hw_stream_flush(snd_pcm_t *pcm, int stream)
 {
        int fd;
        snd_pcm_hw_t *hw = (snd_pcm_hw_t*) &pcm->private;
-       fd = hw->chan[channel].fd;
-       if (ioctl(fd, SND_PCM_IOCTL_CHANNEL_FLUSH) < 0)
+       fd = hw->stream[stream].fd;
+       if (ioctl(fd, SND_PCM_IOCTL_STREAM_FLUSH) < 0)
                return -errno;
        return 0;
 }
 
-static int snd_pcm_hw_channel_pause(snd_pcm_t *pcm, int channel, int enable)
+static int snd_pcm_hw_stream_pause(snd_pcm_t *pcm, int stream, int enable)
 {
        int fd;
        snd_pcm_hw_t *hw = (snd_pcm_hw_t*) &pcm->private;
-       fd = hw->chan[channel].fd;
-       if (ioctl(fd, SND_PCM_IOCTL_CHANNEL_PAUSE, &enable) < 0)
+       fd = hw->stream[stream].fd;
+       if (ioctl(fd, SND_PCM_IOCTL_STREAM_PAUSE, &enable) < 0)
                return -errno;
        return 0;
 }
@@ -217,7 +217,7 @@ static ssize_t snd_pcm_hw_write(snd_pcm_t *pcm, const void *buffer, size_t size)
        ssize_t result;
        int fd;
        snd_pcm_hw_t *hw = (snd_pcm_hw_t*) &pcm->private;
-       fd = hw->chan[SND_PCM_CHANNEL_PLAYBACK].fd;
+       fd = hw->stream[SND_PCM_STREAM_PLAYBACK].fd;
        result = write(fd, buffer, size);
        if (result < 0)
                return -errno;
@@ -229,7 +229,7 @@ static ssize_t snd_pcm_hw_writev(snd_pcm_t *pcm, const struct iovec *vector, uns
        ssize_t result;
        int fd;
        snd_pcm_hw_t *hw = (snd_pcm_hw_t*) &pcm->private;
-       fd = hw->chan[SND_PCM_CHANNEL_PLAYBACK].fd;
+       fd = hw->stream[SND_PCM_STREAM_PLAYBACK].fd;
 #if 0
        result = writev(fd, vector, count);
 #else
@@ -250,7 +250,7 @@ static ssize_t snd_pcm_hw_read(snd_pcm_t *pcm, void *buffer, size_t size)
        ssize_t result;
        int fd;
        snd_pcm_hw_t *hw = (snd_pcm_hw_t*) &pcm->private;
-       fd = hw->chan[SND_PCM_CHANNEL_CAPTURE].fd;
+       fd = hw->stream[SND_PCM_STREAM_CAPTURE].fd;
        result = read(fd, buffer, size);
        if (result < 0)
                return -errno;
@@ -262,7 +262,7 @@ ssize_t snd_pcm_hw_readv(snd_pcm_t *pcm, const struct iovec *vector, unsigned lo
        ssize_t result;
        int fd;
        snd_pcm_hw_t *hw = (snd_pcm_hw_t*) &pcm->private;
-       fd = hw->chan[SND_PCM_CHANNEL_CAPTURE].fd;
+       fd = hw->stream[SND_PCM_STREAM_CAPTURE].fd;
 #if 0
        result = readv(fd, vector, count);
 #else
@@ -278,74 +278,74 @@ ssize_t snd_pcm_hw_readv(snd_pcm_t *pcm, const struct iovec *vector, unsigned lo
        return result;
 }
 
-static int snd_pcm_hw_mmap_control(snd_pcm_t *pcm, int channel, snd_pcm_mmap_control_t **control, size_t csize)
+static int snd_pcm_hw_mmap_control(snd_pcm_t *pcm, int stream, snd_pcm_mmap_control_t **control, size_t csize)
 {
        void *caddr;
        snd_pcm_hw_t *hw = (snd_pcm_hw_t*) &pcm->private;
        caddr = mmap(NULL, csize, PROT_READ|PROT_WRITE, MAP_FILE|MAP_SHARED, 
-                    hw->chan[channel].fd, SND_PCM_MMAP_OFFSET_CONTROL);
+                    hw->stream[stream].fd, SND_PCM_MMAP_OFFSET_CONTROL);
        if (caddr == MAP_FAILED || caddr == NULL)
                return -errno;
        *control = caddr;
        return 0;
 }
 
-static int snd_pcm_hw_mmap_data(snd_pcm_t *pcm, int channel, void **buffer, size_t bsize)
+static int snd_pcm_hw_mmap_data(snd_pcm_t *pcm, int stream, void **buffer, size_t bsize)
 {
        int prot;
        void *daddr;
        snd_pcm_hw_t *hw = (snd_pcm_hw_t*) &pcm->private;
-       prot = channel == SND_PCM_CHANNEL_PLAYBACK ? PROT_WRITE : PROT_READ;
+       prot = stream == SND_PCM_STREAM_PLAYBACK ? PROT_WRITE : PROT_READ;
        daddr = mmap(NULL, bsize, prot, MAP_FILE|MAP_SHARED, 
-                    hw->chan[channel].fd, SND_PCM_MMAP_OFFSET_DATA);
+                    hw->stream[stream].fd, SND_PCM_MMAP_OFFSET_DATA);
        if (daddr == MAP_FAILED || daddr == NULL)
                return -errno;
        *buffer = daddr;
        return 0;
 }
 
-static int snd_pcm_hw_munmap_control(snd_pcm_t *pcm UNUSED, int channel UNUSED, snd_pcm_mmap_control_t *control, size_t csize)
+static int snd_pcm_hw_munmap_control(snd_pcm_t *pcm UNUSED, int stream UNUSED, snd_pcm_mmap_control_t *control, size_t csize)
 {
        if (munmap(control, csize) < 0)
                return -errno;
        return 0;
 }
 
-static int snd_pcm_hw_munmap_data(snd_pcm_t *pcm UNUSED, int channel UNUSED, void *buffer, size_t bsize)
+static int snd_pcm_hw_munmap_data(snd_pcm_t *pcm UNUSED, int stream UNUSED, void *buffer, size_t bsize)
 {
        if (munmap(buffer, bsize) < 0)
                return -errno;
        return 0;
 }
 
-static int snd_pcm_hw_file_descriptor(snd_pcm_t *pcm, int channel)
+static int snd_pcm_hw_file_descriptor(snd_pcm_t *pcm, int stream)
 {
        snd_pcm_hw_t *hw = (snd_pcm_hw_t*) &pcm->private;
-       return hw->chan[channel].fd;
+       return hw->stream[stream].fd;
 }
 
-static int snd_pcm_hw_voices_mask(snd_pcm_t *pcm UNUSED, int channel UNUSED,
+static int snd_pcm_hw_channels_mask(snd_pcm_t *pcm UNUSED, int stream UNUSED,
                                  bitset_t *client_vmask UNUSED)
 {
        return 0;
 }
 
 struct snd_pcm_ops snd_pcm_hw_ops = {
-       channel_close: snd_pcm_hw_channel_close,
-       channel_nonblock: snd_pcm_hw_channel_nonblock,
+       stream_close: snd_pcm_hw_stream_close,
+       stream_nonblock: snd_pcm_hw_stream_nonblock,
        info: snd_pcm_hw_info,
-       channel_info: snd_pcm_hw_channel_info,
-       channel_params: snd_pcm_hw_channel_params,
+       stream_info: snd_pcm_hw_stream_info,
+       stream_params: snd_pcm_hw_stream_params,
+       stream_setup: snd_pcm_hw_stream_setup,
        channel_setup: snd_pcm_hw_channel_setup,
-       voice_setup: snd_pcm_hw_voice_setup,
-       channel_status: snd_pcm_hw_channel_status,
-       channel_update: snd_pcm_hw_channel_update,
-       channel_prepare: snd_pcm_hw_channel_prepare,
-       channel_go: snd_pcm_hw_channel_go,
+       stream_status: snd_pcm_hw_stream_status,
+       stream_update: snd_pcm_hw_stream_update,
+       stream_prepare: snd_pcm_hw_stream_prepare,
+       stream_go: snd_pcm_hw_stream_go,
        sync_go: snd_pcm_hw_sync_go,
-       channel_drain: snd_pcm_hw_channel_drain,
-       channel_flush: snd_pcm_hw_channel_flush,
-       channel_pause: snd_pcm_hw_channel_pause,
+       stream_drain: snd_pcm_hw_stream_drain,
+       stream_flush: snd_pcm_hw_stream_flush,
+       stream_pause: snd_pcm_hw_stream_pause,
        write: snd_pcm_hw_write,
        writev: snd_pcm_hw_writev,
        read: snd_pcm_hw_read,
@@ -355,27 +355,27 @@ struct snd_pcm_ops snd_pcm_hw_ops = {
        munmap_control: snd_pcm_hw_munmap_control,
        munmap_data: snd_pcm_hw_munmap_data,
        file_descriptor: snd_pcm_hw_file_descriptor,
-       voices_mask: snd_pcm_hw_voices_mask,
+       channels_mask: snd_pcm_hw_channels_mask,
 };
 
-static int snd_pcm_hw_open_channel(int card, int device, int channel, int subdevice, int fmode, snd_ctl_t *ctl, int *ver)
+static int snd_pcm_hw_open_stream(int card, int device, int stream, int subdevice, int fmode, snd_ctl_t *ctl, int *ver)
 {
        char filename[32];
        char *filefmt;
        int err, fd;
        int attempt = 0;
-       snd_pcm_channel_info_t info;
-       switch (channel) {
-       case SND_PCM_CHANNEL_PLAYBACK:
+       snd_pcm_stream_info_t info;
+       switch (stream) {
+       case SND_PCM_STREAM_PLAYBACK:
                filefmt = SND_FILE_PCM_PLAYBACK;
                break;
-       case SND_PCM_CHANNEL_CAPTURE:
+       case SND_PCM_STREAM_CAPTURE:
                filefmt = SND_FILE_PCM_CAPTURE;
                break;
        default:
                return -EINVAL;
        }
-       if ((err = snd_ctl_pcm_channel_prefer_subdevice(ctl, device, channel, subdevice)) < 0)
+       if ((err = snd_ctl_pcm_stream_prefer_subdevice(ctl, device, stream, subdevice)) < 0)
                return err;
        sprintf(filename, filefmt, card, device);
 
@@ -399,7 +399,7 @@ static int snd_pcm_hw_open_channel(int card, int device, int channel, int subdev
        }
        if (subdevice >= 0) {
                memset(&info, 0, sizeof(info));
-               if (ioctl(fd, SND_PCM_IOCTL_CHANNEL_INFO, &info) < 0) {
+               if (ioctl(fd, SND_PCM_IOCTL_STREAM_INFO, &info) < 0) {
                        err = -errno;
                        close(fd);
                        return err;
@@ -432,7 +432,7 @@ int snd_pcm_open_subdevice(snd_pcm_t **handle, int card, int device, int subdevi
                fmode = O_RDWR;
                if (mode & SND_PCM_NONBLOCK_PLAYBACK)
                        fmode |= O_NONBLOCK;
-               pfd = snd_pcm_hw_open_channel(card, device, SND_PCM_CHANNEL_PLAYBACK,
+               pfd = snd_pcm_hw_open_stream(card, device, SND_PCM_STREAM_PLAYBACK,
                                          subdevice, fmode, ctl, &ver);
                if (pfd < 0) {
                        snd_ctl_close(ctl);
@@ -443,7 +443,7 @@ int snd_pcm_open_subdevice(snd_pcm_t **handle, int card, int device, int subdevi
                fmode = O_RDWR;
                if (mode & SND_PCM_NONBLOCK_CAPTURE)
                        fmode |= O_NONBLOCK;
-               cfd = snd_pcm_hw_open_channel(card, device, SND_PCM_CHANNEL_CAPTURE,
+               cfd = snd_pcm_hw_open_stream(card, device, SND_PCM_STREAM_CAPTURE,
                                          subdevice, fmode, ctl, &ver);
                if (cfd < 0) {
                        if (pfd >= 0)
@@ -470,8 +470,8 @@ int snd_pcm_open_subdevice(snd_pcm_t **handle, int card, int device, int subdevi
        hw->card = card;
        hw->device = device;
        hw->ver = ver;
-       hw->chan[SND_PCM_CHANNEL_PLAYBACK].fd = pfd;
-       hw->chan[SND_PCM_CHANNEL_CAPTURE].fd = cfd;
+       hw->stream[SND_PCM_STREAM_PLAYBACK].fd = pfd;
+       hw->stream[SND_PCM_STREAM_CAPTURE].fd = cfd;
        return 0;
 }
 
index 1d4837f26091e2633d6765b20cd6990230643afe..136f6cf9eff2c27c29b42b0572e88810038a178d 100644 (file)
   
 
 struct snd_pcm_ops {
-       int (*channel_close)(snd_pcm_t *pcm, int channel);
-       int (*channel_nonblock)(snd_pcm_t *pcm, int channel, int nonblock);
+       int (*stream_close)(snd_pcm_t *pcm, int stream);
+       int (*stream_nonblock)(snd_pcm_t *pcm, int stream, int nonblock);
        int (*info)(snd_pcm_t *pcm, snd_pcm_info_t *info);
-       int (*channel_info)(snd_pcm_t *pcm, snd_pcm_channel_info_t *info);
-       int (*channel_params)(snd_pcm_t *pcm, snd_pcm_channel_params_t *params);
-       int (*channel_setup)(snd_pcm_t *pcm, snd_pcm_channel_setup_t *setup);
-       int (*voice_setup)(snd_pcm_t *pcm, int channel, snd_pcm_voice_setup_t *setup);
-       int (*channel_status)(snd_pcm_t *pcm, snd_pcm_channel_status_t *status);
-       int (*channel_prepare)(snd_pcm_t *pcm, int channel);
-       int (*channel_update)(snd_pcm_t *pcm, int channel);
-       int (*channel_go)(snd_pcm_t *pcm, int channel);
+       int (*stream_info)(snd_pcm_t *pcm, snd_pcm_stream_info_t *info);
+       int (*stream_params)(snd_pcm_t *pcm, snd_pcm_stream_params_t *params);
+       int (*stream_setup)(snd_pcm_t *pcm, snd_pcm_stream_setup_t *setup);
+       int (*channel_setup)(snd_pcm_t *pcm, int stream, snd_pcm_channel_setup_t *setup);
+       int (*stream_status)(snd_pcm_t *pcm, snd_pcm_stream_status_t *status);
+       int (*stream_prepare)(snd_pcm_t *pcm, int stream);
+       int (*stream_update)(snd_pcm_t *pcm, int stream);
+       int (*stream_go)(snd_pcm_t *pcm, int stream);
        int (*sync_go)(snd_pcm_t *pcm, snd_pcm_sync_t *sync);
-       int (*channel_drain)(snd_pcm_t *pcm, int channel);
-       int (*channel_flush)(snd_pcm_t *pcm, int channel);
-       int (*channel_pause)(snd_pcm_t *pcm, int channel, int enable);
+       int (*stream_drain)(snd_pcm_t *pcm, int stream);
+       int (*stream_flush)(snd_pcm_t *pcm, int stream);
+       int (*stream_pause)(snd_pcm_t *pcm, int stream, int enable);
        ssize_t (*write)(snd_pcm_t *pcm, const void *buffer, size_t size);
        ssize_t (*writev)(snd_pcm_t *pcm, const struct iovec *vector, unsigned long count);
        ssize_t (*read)(snd_pcm_t *pcm, void *buffer, size_t size);
        ssize_t (*readv)(snd_pcm_t *pcm, const struct iovec *vector, unsigned long count);
-       int (*mmap_control)(snd_pcm_t *pcm, int channel, snd_pcm_mmap_control_t **control, size_t csize);
-       int (*mmap_data)(snd_pcm_t *pcm, int channel, void **buffer, size_t bsize);
-       int (*munmap_control)(snd_pcm_t *pcm, int channel, snd_pcm_mmap_control_t *control, size_t csize);
-       int (*munmap_data)(snd_pcm_t *pcm, int channel, void *buffer, size_t bsize);
-       int (*file_descriptor)(snd_pcm_t* pcm, int channel);
-       int (*voices_mask)(snd_pcm_t *pcm, int channel, bitset_t *client_vmask);
+       int (*mmap_control)(snd_pcm_t *pcm, int stream, snd_pcm_mmap_control_t **control, size_t csize);
+       int (*mmap_data)(snd_pcm_t *pcm, int stream, void **buffer, size_t bsize);
+       int (*munmap_control)(snd_pcm_t *pcm, int stream, snd_pcm_mmap_control_t *control, size_t csize);
+       int (*munmap_data)(snd_pcm_t *pcm, int stream, void *buffer, size_t bsize);
+       int (*file_descriptor)(snd_pcm_t* pcm, int stream);
+       int (*channels_mask)(snd_pcm_t *pcm, int stream, bitset_t *client_vmask);
 };
 
 
-struct snd_pcm_plug_chan {
+struct snd_pcm_plug_stream {
        snd_pcm_plugin_t *first;
        snd_pcm_plugin_t *last;
        void *alloc_ptr[2];
@@ -63,10 +63,10 @@ struct snd_pcm_plug_chan {
 typedef struct snd_pcm_plug {
        int close_slave;
        snd_pcm_t *slave;
-       struct snd_pcm_plug_chan chan[2];
+       struct snd_pcm_plug_stream stream[2];
 } snd_pcm_plug_t;
 
-struct snd_pcm_hw_chan {
+struct snd_pcm_hw_stream {
        int fd;
 };
 
@@ -74,15 +74,15 @@ typedef struct snd_pcm_hw {
        int card;
        int device;
        int ver;
-       struct snd_pcm_hw_chan chan[2];
+       struct snd_pcm_hw_stream stream[2];
 } snd_pcm_hw_t;
 
-struct snd_pcm_chan {
+struct snd_pcm_stream {
        int open;
        int mode;
        int valid_setup;
-       snd_pcm_channel_setup_t setup;
-       snd_pcm_voice_area_t *voices;
+       snd_pcm_stream_setup_t setup;
+       snd_pcm_channel_area_t *channels;
        size_t sample_width;
        size_t bits_per_frame;
        size_t frames_per_frag;
@@ -103,42 +103,42 @@ struct snd_pcm {
        snd_pcm_type_t type;
        int mode;
        struct snd_pcm_ops *ops;
-       struct snd_pcm_chan chan[2];
+       struct snd_pcm_stream stream[2];
        int private[0];
 };
 
-void snd_pcm_mmap_status_change(snd_pcm_t *pcm, int channel, int newstatus);
+void snd_pcm_mmap_status_streamge(snd_pcm_t *pcm, int stream, int newstatus);
 
 int snd_pcm_abstract_open(snd_pcm_t **handle, int mode, snd_pcm_type_t type, size_t extra);
 
 
 unsigned int snd_pcm_plug_formats(unsigned int formats);
-int snd_pcm_plug_slave_params(snd_pcm_channel_params_t *params,
-                             snd_pcm_channel_info_t *slave_info,
-                             snd_pcm_channel_params_t *slave_params);
+int snd_pcm_plug_slave_params(snd_pcm_stream_params_t *params,
+                             snd_pcm_stream_info_t *slave_info,
+                             snd_pcm_stream_params_t *slave_params);
 int snd_pcm_plug_format(snd_pcm_plugin_handle_t *pcm,
-                       snd_pcm_channel_params_t *params,
-                       snd_pcm_channel_params_t *slave_params);
+                       snd_pcm_stream_params_t *params,
+                       snd_pcm_stream_params_t *slave_params);
 
-ssize_t snd_pcm_plug_write_transfer(snd_pcm_plugin_handle_t *handle, snd_pcm_plugin_voice_t *src_voices, size_t size);
-ssize_t snd_pcm_plug_read_transfer(snd_pcm_plugin_handle_t *handle, snd_pcm_plugin_voice_t *dst_voices_final, size_t size);
-ssize_t snd_pcm_plug_client_voices_iovec(snd_pcm_plugin_handle_t *handle, int channel,
+ssize_t snd_pcm_plug_write_transfer(snd_pcm_plugin_handle_t *handle, snd_pcm_plugin_channel_t *src_channels, size_t size);
+ssize_t snd_pcm_plug_read_transfer(snd_pcm_plugin_handle_t *handle, snd_pcm_plugin_channel_t *dst_channels_final, size_t size);
+ssize_t snd_pcm_plug_client_channels_iovec(snd_pcm_plugin_handle_t *handle, int stream,
                                         const struct iovec *vector, unsigned long count,
-                                        snd_pcm_plugin_voice_t **voices);
-ssize_t snd_pcm_plug_client_voices_buf(snd_pcm_plugin_handle_t *handle, int channel,
+                                        snd_pcm_plugin_channel_t **channels);
+ssize_t snd_pcm_plug_client_channels_buf(snd_pcm_plugin_handle_t *handle, int stream,
                                       char *buf, size_t count,
-                                      snd_pcm_plugin_voice_t **voices);
+                                      snd_pcm_plugin_channel_t **channels);
 
-int snd_pcm_plug_playback_voices_mask(snd_pcm_plugin_handle_t *handle,
+int snd_pcm_plug_playback_channels_mask(snd_pcm_plugin_handle_t *handle,
                                      bitset_t *client_vmask);
-int snd_pcm_plug_capture_voices_mask(snd_pcm_plugin_handle_t *handle,
+int snd_pcm_plug_capture_channels_mask(snd_pcm_plugin_handle_t *handle,
                                     bitset_t *client_vmask);
-int snd_pcm_plugin_client_voices(snd_pcm_plugin_t *plugin,
+int snd_pcm_plugin_client_channels(snd_pcm_plugin_t *plugin,
                                  size_t frames,
-                                 snd_pcm_plugin_voice_t **voices);
+                                 snd_pcm_plugin_channel_t **channels);
 
-void *snd_pcm_plug_buf_alloc(snd_pcm_t *pcm, int channel, size_t size);
-void snd_pcm_plug_buf_unlock(snd_pcm_t *pcm, int channel, void *ptr);
+void *snd_pcm_plug_buf_alloc(snd_pcm_t *pcm, int stream, size_t size);
+void snd_pcm_plug_buf_unlock(snd_pcm_t *pcm, int stream, void *ptr);
 
 #define ROUTE_PLUGIN_RESOLUTION 16
 
index 2f3d211f828b0d25dc6e9a1aeb64f58ea340a720..3eeddb596c671c1c31807a626b5e011db89d668c 100644 (file)
@@ -230,7 +230,7 @@ ssize_t snd_pcm_format_size(int format, size_t samples)
 
 ssize_t snd_pcm_format_bytes_per_second(snd_pcm_format_t *format)
 {
-       return snd_pcm_format_size(format->format, format->voices * format->rate);
+       return snd_pcm_format_size(format->format, format->channels * format->rate);
 }
 
 u_int64_t snd_pcm_format_silence_64(int format)
index f1210b34853f6943bfa497a693c634d493e6faee..ba6492a4e1f38819be767e39e1bcdc2bd8c5e8f5 100644 (file)
 #include <sys/uio.h>
 #include "pcm_local.h"
 
-static void snd_pcm_mmap_clear(snd_pcm_t *pcm, int channel)
+static void snd_pcm_mmap_clear(snd_pcm_t *pcm, int stream)
 {
-       struct snd_pcm_chan *chan = &pcm->chan[channel];
-       chan->mmap_control->byte_io = 0;
-       chan->mmap_control->byte_data = 0;
+       struct snd_pcm_stream *str = &pcm->stream[stream];
+       str->mmap_control->byte_io = 0;
+       str->mmap_control->byte_data = 0;
 }
 
-void snd_pcm_mmap_status_change(snd_pcm_t *pcm, int channel, int newstatus)
+void snd_pcm_mmap_status_streamge(snd_pcm_t *pcm, int stream, int newstatus)
 {
-       struct snd_pcm_chan *chan = &pcm->chan[channel];
+       struct snd_pcm_stream *str = &pcm->stream[stream];
 
-       if (!chan->mmap_control_emulation)
+       if (!str->mmap_control_emulation)
                return;
        if (newstatus < 0) {
-               snd_pcm_channel_status_t status;
-               status.channel = channel;
-               if (snd_pcm_channel_status(pcm, &status) < 0)
+               snd_pcm_stream_status_t status;
+               status.stream = stream;
+               if (snd_pcm_stream_status(pcm, &status) < 0)
                        newstatus = SND_PCM_STATUS_NOTREADY;
                else
                        newstatus = status.status;
        }
-       if (chan->mmap_control->status != newstatus) {
+       if (str->mmap_control->status != newstatus) {
                if (newstatus == SND_PCM_STATUS_READY ||
                    (newstatus == SND_PCM_STATUS_PREPARED &&
-                    chan->mmap_control->status != SND_PCM_STATUS_READY))
-                       snd_pcm_mmap_clear(pcm, channel);
-               chan->mmap_control->status = newstatus;
-               pthread_mutex_lock(&chan->mutex);
-               pthread_cond_signal(&chan->status_cond);
-               pthread_mutex_unlock(&chan->mutex);
+                    str->mmap_control->status != SND_PCM_STATUS_READY))
+                       snd_pcm_mmap_clear(pcm, stream);
+               str->mmap_control->status = newstatus;
+               pthread_mutex_lock(&str->mutex);
+               pthread_cond_signal(&str->status_cond);
+               pthread_mutex_unlock(&str->mutex);
        }
 }
 
-static inline ssize_t snd_pcm_mmap_playback_bytes_used(struct snd_pcm_chan *chan)
+static inline ssize_t snd_pcm_mmap_playback_bytes_used(struct snd_pcm_stream *str)
 {
        ssize_t bytes_used;
-       bytes_used = chan->mmap_control->byte_data - chan->mmap_control->byte_io;
-       if (bytes_used < (ssize_t)(chan->setup.buffer_size - chan->setup.byte_boundary))
-               bytes_used += chan->setup.byte_boundary;
+       bytes_used = str->mmap_control->byte_data - str->mmap_control->byte_io;
+       if (bytes_used < (ssize_t)(str->setup.buffer_size - str->setup.byte_boundary))
+               bytes_used += str->setup.byte_boundary;
        return bytes_used;
 }
 
 static ssize_t snd_pcm_mmap_playback_frames_used(snd_pcm_t *pcm)
 {
-       struct snd_pcm_chan *chan = &pcm->chan[SND_PCM_CHANNEL_PLAYBACK];
-       ssize_t bytes = snd_pcm_mmap_playback_bytes_used(chan);
-       return bytes * 8 / chan->bits_per_frame;
+       struct snd_pcm_stream *str = &pcm->stream[SND_PCM_STREAM_PLAYBACK];
+       ssize_t bytes = snd_pcm_mmap_playback_bytes_used(str);
+       return bytes * 8 / str->bits_per_frame;
 }
 
-static inline size_t snd_pcm_mmap_capture_bytes_used(struct snd_pcm_chan *chan)
+static inline size_t snd_pcm_mmap_capture_bytes_used(struct snd_pcm_stream *str)
 {
        ssize_t bytes_used;
-       bytes_used = chan->mmap_control->byte_io - chan->mmap_control->byte_data;
+       bytes_used = str->mmap_control->byte_io - str->mmap_control->byte_data;
        if (bytes_used < 0)
-               bytes_used += chan->setup.byte_boundary;
+               bytes_used += str->setup.byte_boundary;
        return bytes_used;
 }
 
 static size_t snd_pcm_mmap_capture_frames_used(snd_pcm_t *pcm)
 {
-       struct snd_pcm_chan *chan = &pcm->chan[SND_PCM_CHANNEL_CAPTURE];
-       size_t bytes = snd_pcm_mmap_capture_bytes_used(chan);
-       return bytes * 8 / chan->bits_per_frame;
+       struct snd_pcm_stream *str = &pcm->stream[SND_PCM_STREAM_CAPTURE];
+       size_t bytes = snd_pcm_mmap_capture_bytes_used(str);
+       return bytes * 8 / str->bits_per_frame;
 }
 
-int snd_pcm_mmap_frames_used(snd_pcm_t *pcm, int channel, ssize_t *frames)
+int snd_pcm_mmap_frames_used(snd_pcm_t *pcm, int stream, ssize_t *frames)
 {
-       struct snd_pcm_chan *chan;
+       struct snd_pcm_stream *str;
         if (!pcm)
                 return -EFAULT;
-        if (channel < 0 || channel > 1)
+        if (stream < 0 || stream > 1)
                 return -EINVAL;
-       chan = &pcm->chan[channel];
-       if (!chan->open || !chan->mmap_control)
+       str = &pcm->stream[stream];
+       if (!str->open || !str->mmap_control)
                return -EBADFD;
-       if (channel == SND_PCM_CHANNEL_PLAYBACK)
+       if (stream == SND_PCM_STREAM_PLAYBACK)
                *frames = snd_pcm_mmap_playback_frames_used(pcm);
        else
                *frames = snd_pcm_mmap_capture_frames_used(pcm);
        return 0;
 }
 
-static inline size_t snd_pcm_mmap_playback_bytes_free(struct snd_pcm_chan *chan)
+static inline size_t snd_pcm_mmap_playback_bytes_free(struct snd_pcm_stream *str)
 {
-       return chan->setup.buffer_size - snd_pcm_mmap_playback_bytes_used(chan);
+       return str->setup.buffer_size - snd_pcm_mmap_playback_bytes_used(str);
 }
 
 static size_t snd_pcm_mmap_playback_frames_free(snd_pcm_t *pcm)
 {
-       struct snd_pcm_chan *chan = &pcm->chan[SND_PCM_CHANNEL_PLAYBACK];
-       size_t bytes = snd_pcm_mmap_playback_bytes_free(chan);
-       return bytes * 8 / chan->bits_per_frame;
+       struct snd_pcm_stream *str = &pcm->stream[SND_PCM_STREAM_PLAYBACK];
+       size_t bytes = snd_pcm_mmap_playback_bytes_free(str);
+       return bytes * 8 / str->bits_per_frame;
 }
 
-static inline ssize_t snd_pcm_mmap_capture_bytes_free(struct snd_pcm_chan *chan)
+static inline ssize_t snd_pcm_mmap_capture_bytes_free(struct snd_pcm_stream *str)
 {
-       return chan->setup.buffer_size - snd_pcm_mmap_capture_bytes_used(chan);
+       return str->setup.buffer_size - snd_pcm_mmap_capture_bytes_used(str);
 }
 
 static ssize_t snd_pcm_mmap_capture_frames_free(snd_pcm_t *pcm)
 {
-       struct snd_pcm_chan *chan = &pcm->chan[SND_PCM_CHANNEL_CAPTURE];
-       ssize_t bytes = snd_pcm_mmap_capture_bytes_free(chan);
-       return bytes * 8 / chan->bits_per_frame;
+       struct snd_pcm_stream *str = &pcm->stream[SND_PCM_STREAM_CAPTURE];
+       ssize_t bytes = snd_pcm_mmap_capture_bytes_free(str);
+       return bytes * 8 / str->bits_per_frame;
 }
 
-int snd_pcm_mmap_frames_free(snd_pcm_t *pcm, int channel, ssize_t *frames)
+int snd_pcm_mmap_frames_free(snd_pcm_t *pcm, int stream, ssize_t *frames)
 {
-       struct snd_pcm_chan *chan;
+       struct snd_pcm_stream *str;
         if (!pcm)
                 return -EFAULT;
-        if (channel < 0 || channel > 1)
+        if (stream < 0 || stream > 1)
                 return -EINVAL;
-       chan = &pcm->chan[channel];
-       if (!chan->open || !chan->mmap_control)
+       str = &pcm->stream[stream];
+       if (!str->open || !str->mmap_control)
                return -EBADFD;
-       if (channel == SND_PCM_CHANNEL_PLAYBACK)
+       if (stream == SND_PCM_STREAM_PLAYBACK)
                *frames = snd_pcm_mmap_playback_frames_free(pcm);
        else
                *frames = snd_pcm_mmap_capture_frames_free(pcm);
@@ -151,43 +151,43 @@ int snd_pcm_mmap_frames_free(snd_pcm_t *pcm, int channel, ssize_t *frames)
 
 static int snd_pcm_mmap_playback_ready(snd_pcm_t *pcm)
 {
-       struct snd_pcm_chan *chan;
-       chan = &pcm->chan[SND_PCM_CHANNEL_PLAYBACK];
-       if (chan->mmap_control->status == SND_PCM_STATUS_XRUN)
+       struct snd_pcm_stream *str;
+       str = &pcm->stream[SND_PCM_STREAM_PLAYBACK];
+       if (str->mmap_control->status == SND_PCM_STATUS_XRUN)
                return -EPIPE;
-       return (chan->setup.buffer_size - snd_pcm_mmap_playback_bytes_used(chan)) >= chan->setup.bytes_min;
+       return (str->setup.buffer_size - snd_pcm_mmap_playback_bytes_used(str)) >= str->setup.bytes_min;
 }
 
 static int snd_pcm_mmap_capture_ready(snd_pcm_t *pcm)
 {
-       struct snd_pcm_chan *chan;
+       struct snd_pcm_stream *str;
        int ret = 0;
-       chan = &pcm->chan[SND_PCM_CHANNEL_CAPTURE];
-       if (chan->mmap_control->status == SND_PCM_STATUS_XRUN) {
+       str = &pcm->stream[SND_PCM_STREAM_CAPTURE];
+       if (str->mmap_control->status == SND_PCM_STATUS_XRUN) {
                ret = -EPIPE;
-               if (chan->setup.xrun_mode == SND_PCM_XRUN_DRAIN)
+               if (str->setup.xrun_mode == SND_PCM_XRUN_DRAIN)
                        return -EPIPE;
        }
-       if (snd_pcm_mmap_capture_bytes_used(chan) >= chan->setup.bytes_min)
+       if (snd_pcm_mmap_capture_bytes_used(str) >= str->setup.bytes_min)
                return 1;
        return ret;
 }
 
-int snd_pcm_mmap_ready(snd_pcm_t *pcm, int channel)
+int snd_pcm_mmap_ready(snd_pcm_t *pcm, int stream)
 {
-       struct snd_pcm_chan *chan;
+       struct snd_pcm_stream *str;
        snd_pcm_mmap_control_t *ctrl;
         if (!pcm)
                 return -EFAULT;
-        if (channel < 0 || channel > 1)
+        if (stream < 0 || stream > 1)
                 return -EINVAL;
-       chan = &pcm->chan[channel];
-       if (!chan->open || !chan->mmap_control)
+       str = &pcm->stream[stream];
+       if (!str->open || !str->mmap_control)
                return -EBADFD;
-       ctrl = chan->mmap_control;
+       ctrl = str->mmap_control;
        if (ctrl->status < SND_PCM_STATUS_PREPARED)
                return -EBADFD;
-       if (channel == SND_PCM_CHANNEL_PLAYBACK) {
+       if (stream == SND_PCM_STREAM_PLAYBACK) {
                return snd_pcm_mmap_playback_ready(pcm);
        } else {
                return snd_pcm_mmap_capture_ready(pcm);
@@ -196,106 +196,106 @@ int snd_pcm_mmap_ready(snd_pcm_t *pcm, int channel)
 
 static size_t snd_pcm_mmap_playback_bytes_xfer(snd_pcm_t *pcm, size_t bytes)
 {
-       struct snd_pcm_chan *chan = &pcm->chan[SND_PCM_CHANNEL_PLAYBACK];
-       snd_pcm_mmap_control_t *ctrl = chan->mmap_control;
+       struct snd_pcm_stream *str = &pcm->stream[SND_PCM_STREAM_PLAYBACK];
+       snd_pcm_mmap_control_t *ctrl = str->mmap_control;
        size_t bytes_cont;
        size_t byte_data = ctrl->byte_data;
-       size_t bytes_free = snd_pcm_mmap_playback_bytes_free(chan);
+       size_t bytes_free = snd_pcm_mmap_playback_bytes_free(str);
        if (bytes_free < bytes)
                bytes = bytes_free;
-       bytes_cont = chan->setup.buffer_size - (byte_data % chan->setup.buffer_size);
+       bytes_cont = str->setup.buffer_size - (byte_data % str->setup.buffer_size);
        if (bytes_cont < bytes)
                bytes = bytes_cont;
-       bytes -= bytes % chan->setup.bytes_align;
+       bytes -= bytes % str->setup.bytes_align;
        return bytes;
 }
 
 static size_t snd_pcm_mmap_capture_bytes_xfer(snd_pcm_t *pcm, size_t bytes)
 {
-       struct snd_pcm_chan *chan = &pcm->chan[SND_PCM_CHANNEL_CAPTURE];
-       snd_pcm_mmap_control_t *ctrl = chan->mmap_control;
+       struct snd_pcm_stream *str = &pcm->stream[SND_PCM_STREAM_CAPTURE];
+       snd_pcm_mmap_control_t *ctrl = str->mmap_control;
        size_t bytes_cont;
        size_t byte_data = ctrl->byte_data;
-       size_t bytes_used = snd_pcm_mmap_capture_bytes_used(chan);
+       size_t bytes_used = snd_pcm_mmap_capture_bytes_used(str);
        if (bytes_used < bytes)
                bytes = bytes_used;
-       bytes_cont = chan->setup.buffer_size - (byte_data % chan->setup.buffer_size);
+       bytes_cont = str->setup.buffer_size - (byte_data % str->setup.buffer_size);
        if (bytes_cont < bytes)
                bytes = bytes_cont;
-       bytes -= bytes % chan->setup.bytes_align;
+       bytes -= bytes % str->setup.bytes_align;
        return bytes;
 }
 
 static ssize_t snd_pcm_mmap_playback_frames_xfer(snd_pcm_t *pcm, size_t frames)
 {
-       struct snd_pcm_chan *chan = &pcm->chan[SND_PCM_CHANNEL_PLAYBACK];
-       size_t bytes = frames * chan->bits_per_frame / 8;
+       struct snd_pcm_stream *str = &pcm->stream[SND_PCM_STREAM_PLAYBACK];
+       size_t bytes = frames * str->bits_per_frame / 8;
        bytes = snd_pcm_mmap_playback_bytes_xfer(pcm, bytes);
-       return bytes * 8 / chan->bits_per_frame;
+       return bytes * 8 / str->bits_per_frame;
 }
 
 static ssize_t snd_pcm_mmap_capture_frames_xfer(snd_pcm_t *pcm, size_t frames)
 {
-       struct snd_pcm_chan *chan = &pcm->chan[SND_PCM_CHANNEL_CAPTURE];
-       size_t bytes = frames * chan->bits_per_frame / 8;
+       struct snd_pcm_stream *str = &pcm->stream[SND_PCM_STREAM_CAPTURE];
+       size_t bytes = frames * str->bits_per_frame / 8;
        bytes = snd_pcm_mmap_capture_bytes_xfer(pcm, bytes);
-       return bytes * 8 / chan->bits_per_frame;
+       return bytes * 8 / str->bits_per_frame;
 }
 
-ssize_t snd_pcm_mmap_frames_xfer(snd_pcm_t *pcm, int channel, size_t frames)
+ssize_t snd_pcm_mmap_frames_xfer(snd_pcm_t *pcm, int stream, size_t frames)
 {
-       struct snd_pcm_chan *chan;
+       struct snd_pcm_stream *str;
         if (!pcm)
                 return -EFAULT;
-        if (channel < 0 || channel > 1)
+        if (stream < 0 || stream > 1)
                 return -EINVAL;
-       chan = &pcm->chan[channel];
-       if (!chan->open || !chan->mmap_control)
+       str = &pcm->stream[stream];
+       if (!str->open || !str->mmap_control)
                return -EBADFD;
-       if (channel == SND_PCM_CHANNEL_PLAYBACK)
+       if (stream == SND_PCM_STREAM_PLAYBACK)
                return snd_pcm_mmap_playback_frames_xfer(pcm, frames);
        else
                return snd_pcm_mmap_capture_frames_xfer(pcm, frames);
 }
 
-ssize_t snd_pcm_mmap_frames_offset(snd_pcm_t *pcm, int channel)
+ssize_t snd_pcm_mmap_frames_offset(snd_pcm_t *pcm, int stream)
 {
-       struct snd_pcm_chan *chan;
+       struct snd_pcm_stream *str;
        snd_pcm_mmap_control_t *ctrl;
         if (!pcm)
                 return -EFAULT;
-        if (channel < 0 || channel > 1)
+        if (stream < 0 || stream > 1)
                 return -EINVAL;
-       chan = &pcm->chan[channel];
-       if (!chan->open)
+       str = &pcm->stream[stream];
+       if (!str->open)
                return -EBADFD;
-       ctrl = chan->mmap_control;
+       ctrl = str->mmap_control;
        if (!ctrl)
                return -EBADFD;
-       return (ctrl->byte_data % chan->setup.buffer_size) * 8 / chan->bits_per_frame;
+       return (ctrl->byte_data % str->setup.buffer_size) * 8 / str->bits_per_frame;
 }
 
-int snd_pcm_mmap_commit_frames(snd_pcm_t *pcm, int channel, int frames)
+int snd_pcm_mmap_commit_frames(snd_pcm_t *pcm, int stream, int frames)
 {
-       struct snd_pcm_chan *chan;
+       struct snd_pcm_stream *str;
        snd_pcm_mmap_control_t *ctrl;
        size_t byte_data, bytes;
         if (!pcm)
                 return -EFAULT;
-        if (channel < 0 || channel > 1)
+        if (stream < 0 || stream > 1)
                 return -EINVAL;
-       chan = &pcm->chan[channel];
-       if (!chan->open)
+       str = &pcm->stream[stream];
+       if (!str->open)
                return -EBADFD;
-       ctrl = chan->mmap_control;
+       ctrl = str->mmap_control;
        if (!ctrl)
                return -EBADFD;
-       bytes = frames * chan->bits_per_frame;
+       bytes = frames * str->bits_per_frame;
        if (bytes % 8)
                return -EINVAL;
        bytes /= 8;
        byte_data = ctrl->byte_data + bytes;
-       if (byte_data == chan->setup.byte_boundary) {
+       if (byte_data == str->setup.byte_boundary) {
                ctrl->byte_data = 0;
        } else {
                ctrl->byte_data = byte_data;
@@ -303,25 +303,25 @@ int snd_pcm_mmap_commit_frames(snd_pcm_t *pcm, int channel, int frames)
        return 0;
 }
 
-ssize_t snd_pcm_mmap_write_areas(snd_pcm_t *pcm, snd_pcm_voice_area_t *voices, size_t frames)
+ssize_t snd_pcm_mmap_write_areas(snd_pcm_t *pcm, snd_pcm_channel_area_t *channels, size_t frames)
 {
-       struct snd_pcm_chan *chan;
+       struct snd_pcm_stream *str;
        snd_pcm_mmap_control_t *ctrl;
        size_t offset = 0;
        size_t result = 0;
        int err;
 
-       chan = &pcm->chan[SND_PCM_CHANNEL_PLAYBACK];
-       ctrl = chan->mmap_control;
+       str = &pcm->stream[SND_PCM_STREAM_PLAYBACK];
+       ctrl = str->mmap_control;
        if (ctrl->status < SND_PCM_STATUS_PREPARED)
                return -EBADFD;
-       if (chan->setup.mode == SND_PCM_MODE_BLOCK) {
-               if (frames % chan->frames_per_frag != 0)
+       if (str->setup.mode == SND_PCM_MODE_FRAGMENT) {
+               if (frames % str->frames_per_frag != 0)
                        return -EINVAL;
        } else {
                if (ctrl->status == SND_PCM_STATUS_RUNNING &&
-                   chan->mode & SND_PCM_NONBLOCK)
-                       snd_pcm_channel_update(pcm, SND_PCM_CHANNEL_PLAYBACK);
+                   str->mode & SND_PCM_NONBLOCK)
+                       snd_pcm_stream_update(pcm, SND_PCM_STREAM_PLAYBACK);
        }
        while (frames > 0) {
                ssize_t mmap_offset;
@@ -333,9 +333,9 @@ ssize_t snd_pcm_mmap_write_areas(snd_pcm_t *pcm, snd_pcm_voice_area_t *voices, s
                        struct pollfd pfd;
                        if (ctrl->status != SND_PCM_STATUS_RUNNING)
                                return result > 0 ? result : -EPIPE;
-                       if (chan->mode & SND_PCM_NONBLOCK)
+                       if (str->mode & SND_PCM_NONBLOCK)
                                return result > 0 ? result : -EAGAIN;
-                       pfd.fd = snd_pcm_file_descriptor(pcm, SND_PCM_CHANNEL_PLAYBACK);
+                       pfd.fd = snd_pcm_file_descriptor(pcm, SND_PCM_STREAM_PLAYBACK);
                        pfd.events = POLLOUT | POLLERR;
                        ready = poll(&pfd, 1, 10000);
                        if (ready < 0)
@@ -346,19 +346,19 @@ ssize_t snd_pcm_mmap_write_areas(snd_pcm_t *pcm, snd_pcm_voice_area_t *voices, s
                }
                frames1 = snd_pcm_mmap_playback_frames_xfer(pcm, frames);
                assert(frames1 > 0);
-               mmap_offset = snd_pcm_mmap_frames_offset(pcm, SND_PCM_CHANNEL_PLAYBACK);
-               snd_pcm_areas_copy(voices, offset, chan->voices, mmap_offset, chan->setup.format.voices, frames1, chan->setup.format.format);
+               mmap_offset = snd_pcm_mmap_frames_offset(pcm, SND_PCM_STREAM_PLAYBACK);
+               snd_pcm_areas_copy(channels, offset, str->channels, mmap_offset, str->setup.format.channels, frames1, str->setup.format.format);
                if (ctrl->status == SND_PCM_STATUS_XRUN)
                        return result > 0 ? result : -EPIPE;
-               snd_pcm_mmap_commit_frames(pcm, SND_PCM_CHANNEL_PLAYBACK, frames1);
+               snd_pcm_mmap_commit_frames(pcm, SND_PCM_STREAM_PLAYBACK, frames1);
                frames -= frames1;
                offset += frames1;
                result += frames1;
                if (ctrl->status == SND_PCM_STATUS_PREPARED &&
-                   (chan->setup.start_mode == SND_PCM_START_DATA ||
-                    (chan->setup.start_mode == SND_PCM_START_FULL &&
+                   (str->setup.start_mode == SND_PCM_START_DATA ||
+                    (str->setup.start_mode == SND_PCM_START_FULL &&
                      !snd_pcm_mmap_playback_ready(pcm)))) {
-                       err = snd_pcm_channel_go(pcm, SND_PCM_CHANNEL_PLAYBACK);
+                       err = snd_pcm_stream_go(pcm, SND_PCM_STREAM_PLAYBACK);
                        if (err < 0)
                                return result > 0 ? result : err;
                }
@@ -368,76 +368,76 @@ ssize_t snd_pcm_mmap_write_areas(snd_pcm_t *pcm, snd_pcm_voice_area_t *voices, s
 
 ssize_t snd_pcm_mmap_write_frames(snd_pcm_t *pcm, const void *buffer, size_t frames)
 {
-       struct snd_pcm_chan *chan;
-       unsigned int nvoices;
+       struct snd_pcm_stream *str;
+       unsigned int nchannels;
        if (!pcm)
                return -EFAULT;
-       chan = &pcm->chan[SND_PCM_CHANNEL_PLAYBACK];
-       if (!chan->open || !chan->valid_setup)
+       str = &pcm->stream[SND_PCM_STREAM_PLAYBACK];
+       if (!str->open || !str->valid_setup)
                return -EBADFD;
-       if (!chan->mmap_data || !chan->mmap_control)
+       if (!str->mmap_data || !str->mmap_control)
                return -EBADFD;
        if (frames > 0 && !buffer)
                return -EFAULT;
-       nvoices = chan->setup.format.voices;
-       if (!chan->setup.format.interleave && nvoices > 1)
+       nchannels = str->setup.format.channels;
+       if (!str->setup.format.interleave && nchannels > 1)
                return -EINVAL;
        {
-               snd_pcm_voice_area_t voices[nvoices];
-               unsigned int voice;
-               for (voice = 0; voice < nvoices; ++voice) {
-                       voices[voice].addr = (char*)buffer;
-                       voices[voice].first = chan->sample_width * voice;
-                       voices[voice].step = chan->bits_per_frame;
+               snd_pcm_channel_area_t channels[nchannels];
+               unsigned int channel;
+               for (channel = 0; channel < nchannels; ++channel) {
+                       channels[channel].addr = (char*)buffer;
+                       channels[channel].first = str->sample_width * channel;
+                       channels[channel].step = str->bits_per_frame;
                }
-               return snd_pcm_mmap_write_areas(pcm, voices, frames);
+               return snd_pcm_mmap_write_areas(pcm, channels, frames);
        }
 }
 
 ssize_t snd_pcm_mmap_write(snd_pcm_t *pcm, const void *buffer, size_t bytes)
 {
-       struct snd_pcm_chan *chan;
-       unsigned int nvoices;
+       struct snd_pcm_stream *str;
+       unsigned int nchannels;
        ssize_t frames;
        if (!pcm)
                return -EFAULT;
-       chan = &pcm->chan[SND_PCM_CHANNEL_PLAYBACK];
-       if (!chan->open || !chan->valid_setup)
+       str = &pcm->stream[SND_PCM_STREAM_PLAYBACK];
+       if (!str->open || !str->valid_setup)
                return -EBADFD;
-       if (!chan->mmap_data || !chan->mmap_control)
+       if (!str->mmap_data || !str->mmap_control)
                return -EBADFD;
        if (bytes > 0 && !buffer)
                return -EFAULT;
-       nvoices = chan->setup.format.voices;
-       if (!chan->setup.format.interleave && nvoices > 1)
+       nchannels = str->setup.format.channels;
+       if (!str->setup.format.interleave && nchannels > 1)
                return -EINVAL;
-       frames = bytes * 8 / chan->bits_per_frame;
+       frames = bytes * 8 / str->bits_per_frame;
        frames = snd_pcm_mmap_write_frames(pcm, buffer, frames);
        if (frames <= 0)
                return frames;
-       return frames * chan->bits_per_frame / 8;
+       return frames * str->bits_per_frame / 8;
 }
 
 ssize_t snd_pcm_mmap_writev(snd_pcm_t *pcm, const struct iovec *vector, unsigned long vcount)
 {
-       struct snd_pcm_chan *chan;
+       struct snd_pcm_stream *str;
        size_t result = 0;
-       unsigned int nvoices;
+       unsigned int nchannels;
        if (!pcm)
                return -EFAULT;
-       chan = &pcm->chan[SND_PCM_CHANNEL_PLAYBACK];
-       if (!chan->open || !chan->valid_setup)
+       str = &pcm->stream[SND_PCM_STREAM_PLAYBACK];
+       if (!str->open || !str->valid_setup)
                return -EBADFD;
-       if (!chan->mmap_data || !chan->mmap_control)
+       if (!str->mmap_data || !str->mmap_control)
                return -EBADFD;
        if (vcount > 0 && !vector)
                return -EFAULT;
-       nvoices = chan->setup.format.voices;
-       if (chan->setup.format.interleave) {
+       nchannels = str->setup.format.channels;
+       if (str->setup.format.interleave) {
                unsigned int b;
                for (b = 0; b < vcount; b++) {
                        ssize_t ret;
-                       size_t frames = vector[b].iov_len * 8 / chan->bits_per_frame;
+                       size_t frames = vector[b].iov_len * 8 / str->bits_per_frame;
                        ret = snd_pcm_mmap_write_frames(pcm, vector[b].iov_base, frames);
                        if (ret < 0) {
                                if (result <= 0)
@@ -447,27 +447,27 @@ ssize_t snd_pcm_mmap_writev(snd_pcm_t *pcm, const struct iovec *vector, unsigned
                        result += ret;
                }
        } else {
-               snd_pcm_voice_area_t voices[nvoices];
+               snd_pcm_channel_area_t channels[nchannels];
                unsigned long bcount;
                unsigned int b;
-               if (vcount % nvoices)
+               if (vcount % nchannels)
                        return -EINVAL;
-               bcount = vcount / nvoices;
+               bcount = vcount / nchannels;
                for (b = 0; b < bcount; b++) {
                        unsigned int v;
                        ssize_t ret;
                        size_t bytes = 0;
                        size_t frames;
                        bytes = vector[0].iov_len;
-                       for (v = 0; v < nvoices; ++v) {
+                       for (v = 0; v < nchannels; ++v) {
                                if (vector[v].iov_len != bytes)
                                        return -EINVAL;
-                               voices[v].addr = vector[v].iov_base;
-                               voices[v].first = 0;
-                               voices[v].step = chan->sample_width;
+                               channels[v].addr = vector[v].iov_base;
+                               channels[v].first = 0;
+                               channels[v].step = str->sample_width;
                        }
-                       frames = bytes * 8 / chan->sample_width;
-                       ret = snd_pcm_mmap_write_areas(pcm, voices, frames);
+                       frames = bytes * 8 / str->sample_width;
+                       ret = snd_pcm_mmap_write_areas(pcm, channels, frames);
                        if (ret < 0) {
                                if (result <= 0)
                                        return ret;
@@ -476,35 +476,35 @@ ssize_t snd_pcm_mmap_writev(snd_pcm_t *pcm, const struct iovec *vector, unsigned
                        result += ret;
                        if ((size_t)ret != frames)
                                break;
-                       vector += nvoices;
+                       vector += nchannels;
                }
        }
-       return result * chan->bits_per_frame / 8;
+       return result * str->bits_per_frame / 8;
 }
 
-ssize_t snd_pcm_mmap_read_areas(snd_pcm_t *pcm, snd_pcm_voice_area_t *voices, size_t frames)
+ssize_t snd_pcm_mmap_read_areas(snd_pcm_t *pcm, snd_pcm_channel_area_t *channels, size_t frames)
 {
-       struct snd_pcm_chan *chan;
+       struct snd_pcm_stream *str;
        snd_pcm_mmap_control_t *ctrl;
        size_t offset = 0;
        size_t result = 0;
        int err;
 
-       chan = &pcm->chan[SND_PCM_CHANNEL_CAPTURE];
-       ctrl = chan->mmap_control;
+       str = &pcm->stream[SND_PCM_STREAM_CAPTURE];
+       ctrl = str->mmap_control;
        if (ctrl->status < SND_PCM_STATUS_PREPARED)
                return -EBADFD;
-       if (chan->setup.mode == SND_PCM_MODE_BLOCK) {
-               if (frames % chan->frames_per_frag != 0)
+       if (str->setup.mode == SND_PCM_MODE_FRAGMENT) {
+               if (frames % str->frames_per_frag != 0)
                        return -EINVAL;
        } else {
                if (ctrl->status == SND_PCM_STATUS_RUNNING &&
-                   chan->mode & SND_PCM_NONBLOCK)
-                       snd_pcm_channel_update(pcm, SND_PCM_CHANNEL_CAPTURE);
+                   str->mode & SND_PCM_NONBLOCK)
+                       snd_pcm_stream_update(pcm, SND_PCM_STREAM_CAPTURE);
        }
        if (ctrl->status == SND_PCM_STATUS_PREPARED &&
-           chan->setup.start_mode == SND_PCM_START_DATA) {
-               err = snd_pcm_channel_go(pcm, SND_PCM_CHANNEL_CAPTURE);
+           str->setup.start_mode == SND_PCM_START_DATA) {
+               err = snd_pcm_stream_go(pcm, SND_PCM_STREAM_CAPTURE);
                if (err < 0)
                        return err;
        }
@@ -518,9 +518,9 @@ ssize_t snd_pcm_mmap_read_areas(snd_pcm_t *pcm, snd_pcm_voice_area_t *voices, si
                        struct pollfd pfd;
                        if (ctrl->status != SND_PCM_STATUS_RUNNING)
                                return result > 0 ? result : -EPIPE;
-                       if (chan->mode & SND_PCM_NONBLOCK)
+                       if (str->mode & SND_PCM_NONBLOCK)
                                return result > 0 ? result : -EAGAIN;
-                       pfd.fd = snd_pcm_file_descriptor(pcm, SND_PCM_CHANNEL_CAPTURE);
+                       pfd.fd = snd_pcm_file_descriptor(pcm, SND_PCM_STREAM_CAPTURE);
                        pfd.events = POLLIN | POLLERR;
                        ready = poll(&pfd, 1, 10000);
                        if (ready < 0)
@@ -531,12 +531,12 @@ ssize_t snd_pcm_mmap_read_areas(snd_pcm_t *pcm, snd_pcm_voice_area_t *voices, si
                }
                frames1 = snd_pcm_mmap_capture_frames_xfer(pcm, frames);
                assert(frames1 > 0);
-               mmap_offset = snd_pcm_mmap_frames_offset(pcm, SND_PCM_CHANNEL_CAPTURE);
-               snd_pcm_areas_copy(chan->voices, mmap_offset, voices, offset, chan->setup.format.voices, frames1, chan->setup.format.format);
+               mmap_offset = snd_pcm_mmap_frames_offset(pcm, SND_PCM_STREAM_CAPTURE);
+               snd_pcm_areas_copy(str->channels, mmap_offset, channels, offset, str->setup.format.channels, frames1, str->setup.format.format);
                if (ctrl->status == SND_PCM_STATUS_XRUN &&
-                   chan->setup.xrun_mode == SND_PCM_XRUN_DRAIN)
+                   str->setup.xrun_mode == SND_PCM_XRUN_DRAIN)
                        return result > 0 ? result : -EPIPE;
-               snd_pcm_mmap_commit_frames(pcm, SND_PCM_CHANNEL_CAPTURE, frames1);
+               snd_pcm_mmap_commit_frames(pcm, SND_PCM_STREAM_CAPTURE, frames1);
                frames -= frames1;
                offset += frames1;
                result += frames1;
@@ -546,76 +546,76 @@ ssize_t snd_pcm_mmap_read_areas(snd_pcm_t *pcm, snd_pcm_voice_area_t *voices, si
 
 ssize_t snd_pcm_mmap_read_frames(snd_pcm_t *pcm, const void *buffer, size_t frames)
 {
-       struct snd_pcm_chan *chan;
-       unsigned int nvoices;
+       struct snd_pcm_stream *str;
+       unsigned int nchannels;
        if (!pcm)
                return -EFAULT;
-       chan = &pcm->chan[SND_PCM_CHANNEL_CAPTURE];
-       if (!chan->open || !chan->valid_setup)
+       str = &pcm->stream[SND_PCM_STREAM_CAPTURE];
+       if (!str->open || !str->valid_setup)
                return -EBADFD;
-       if (!chan->mmap_data || !chan->mmap_control)
+       if (!str->mmap_data || !str->mmap_control)
                return -EBADFD;
        if (frames > 0 && !buffer)
                return -EFAULT;
-       nvoices = chan->setup.format.voices;
-       if (!chan->setup.format.interleave && nvoices > 1)
+       nchannels = str->setup.format.channels;
+       if (!str->setup.format.interleave && nchannels > 1)
                return -EINVAL;
        {
-               snd_pcm_voice_area_t voices[nvoices];
-               unsigned int voice;
-               for (voice = 0; voice < nvoices; ++voice) {
-                       voices[voice].addr = (char*)buffer;
-                       voices[voice].first = chan->sample_width * voice;
-                       voices[voice].step = chan->bits_per_frame;
+               snd_pcm_channel_area_t channels[nchannels];
+               unsigned int channel;
+               for (channel = 0; channel < nchannels; ++channel) {
+                       channels[channel].addr = (char*)buffer;
+                       channels[channel].first = str->sample_width * channel;
+                       channels[channel].step = str->bits_per_frame;
                }
-               return snd_pcm_mmap_read_areas(pcm, voices, frames);
+               return snd_pcm_mmap_read_areas(pcm, channels, frames);
        }
 }
 
 ssize_t snd_pcm_mmap_read(snd_pcm_t *pcm, void *buffer, size_t bytes)
 {
-       struct snd_pcm_chan *chan;
-       unsigned int nvoices;
+       struct snd_pcm_stream *str;
+       unsigned int nchannels;
        ssize_t frames;
        if (!pcm)
                return -EFAULT;
-       chan = &pcm->chan[SND_PCM_CHANNEL_CAPTURE];
-       if (!chan->open || !chan->valid_setup)
+       str = &pcm->stream[SND_PCM_STREAM_CAPTURE];
+       if (!str->open || !str->valid_setup)
                return -EBADFD;
-       if (!chan->mmap_data || !chan->mmap_control)
+       if (!str->mmap_data || !str->mmap_control)
                return -EBADFD;
        if (bytes > 0 && !buffer)
                return -EFAULT;
-       nvoices = chan->setup.format.voices;
-       if (!chan->setup.format.interleave && nvoices > 1)
+       nchannels = str->setup.format.channels;
+       if (!str->setup.format.interleave && nchannels > 1)
                return -EINVAL;
-       frames = bytes * 8 / chan->bits_per_frame;
+       frames = bytes * 8 / str->bits_per_frame;
        frames = snd_pcm_mmap_read_frames(pcm, buffer, frames);
        if (frames <= 0)
                return frames;
-       return frames * chan->bits_per_frame / 8;
+       return frames * str->bits_per_frame / 8;
 }
 
 ssize_t snd_pcm_mmap_readv(snd_pcm_t *pcm, const struct iovec *vector, unsigned long vcount)
 {
-       struct snd_pcm_chan *chan;
+       struct snd_pcm_stream *str;
        size_t result = 0;
-       unsigned int nvoices;
+       unsigned int nchannels;
        if (!pcm)
                return -EFAULT;
-       chan = &pcm->chan[SND_PCM_CHANNEL_CAPTURE];
-       if (!chan->open || !chan->valid_setup)
+       str = &pcm->stream[SND_PCM_STREAM_CAPTURE];
+       if (!str->open || !str->valid_setup)
                return -EBADFD;
-       if (!chan->mmap_data || !chan->mmap_control)
+       if (!str->mmap_data || !str->mmap_control)
                return -EBADFD;
        if (vcount > 0 && !vector)
                return -EFAULT;
-       nvoices = chan->setup.format.voices;
-       if (chan->setup.format.interleave) {
+       nchannels = str->setup.format.channels;
+       if (str->setup.format.interleave) {
                unsigned int b;
                for (b = 0; b < vcount; b++) {
                        ssize_t ret;
-                       size_t frames = vector[b].iov_len * 8 / chan->bits_per_frame;
+                       size_t frames = vector[b].iov_len * 8 / str->bits_per_frame;
                        ret = snd_pcm_mmap_read_frames(pcm, vector[b].iov_base, frames);
                        if (ret < 0) {
                                if (result <= 0)
@@ -625,27 +625,27 @@ ssize_t snd_pcm_mmap_readv(snd_pcm_t *pcm, const struct iovec *vector, unsigned
                        result += ret;
                }
        } else {
-               snd_pcm_voice_area_t voices[nvoices];
+               snd_pcm_channel_area_t channels[nchannels];
                unsigned long bcount;
                unsigned int b;
-               if (vcount % nvoices)
+               if (vcount % nchannels)
                        return -EINVAL;
-               bcount = vcount / nvoices;
+               bcount = vcount / nchannels;
                for (b = 0; b < bcount; b++) {
                        unsigned int v;
                        ssize_t ret;
                        size_t bytes = 0;
                        size_t frames;
                        bytes = vector[0].iov_len;
-                       for (v = 0; v < nvoices; ++v) {
+                       for (v = 0; v < nchannels; ++v) {
                                if (vector[v].iov_len != bytes)
                                        return -EINVAL;
-                               voices[v].addr = vector[v].iov_base;
-                               voices[v].first = 0;
-                               voices[v].step = chan->sample_width;
+                               channels[v].addr = vector[v].iov_base;
+                               channels[v].first = 0;
+                               channels[v].step = str->sample_width;
                        }
-                       frames = bytes * 8 / chan->sample_width;
-                       ret = snd_pcm_mmap_read_areas(pcm, voices, frames);
+                       frames = bytes * 8 / str->sample_width;
+                       ret = snd_pcm_mmap_read_areas(pcm, channels, frames);
                        if (ret < 0) {
                                if (result <= 0)
                                        return ret;
@@ -654,66 +654,66 @@ ssize_t snd_pcm_mmap_readv(snd_pcm_t *pcm, const struct iovec *vector, unsigned
                        result += ret;
                        if ((size_t)ret != frames)
                                break;
-                       vector += nvoices;
+                       vector += nchannels;
                }
        }
-       return result * chan->bits_per_frame / 8;
+       return result * str->bits_per_frame / 8;
 }
 
-static ssize_t mmap_playback_bytes_xfer(struct snd_pcm_chan *chan)
+static ssize_t mmap_playback_bytes_xfer(struct snd_pcm_stream *str)
 {
-       snd_pcm_mmap_control_t *ctrl = chan->mmap_control;
+       snd_pcm_mmap_control_t *ctrl = str->mmap_control;
        size_t bytes_cont;
        size_t byte_io = ctrl->byte_io;
-       ssize_t bytes = snd_pcm_mmap_playback_bytes_used(chan);
-       bytes_cont = chan->setup.buffer_size - (byte_io % chan->setup.buffer_size);
+       ssize_t bytes = snd_pcm_mmap_playback_bytes_used(str);
+       bytes_cont = str->setup.buffer_size - (byte_io % str->setup.buffer_size);
        if ((ssize_t)bytes_cont < bytes)
                bytes = bytes_cont;
-       bytes -= bytes % chan->setup.bytes_align;
+       bytes -= bytes % str->setup.bytes_align;
        return bytes;
 }
 
-static ssize_t mmap_capture_bytes_xfer(struct snd_pcm_chan *chan)
+static ssize_t mmap_capture_bytes_xfer(struct snd_pcm_stream *str)
 {
-       snd_pcm_mmap_control_t *ctrl = chan->mmap_control;
+       snd_pcm_mmap_control_t *ctrl = str->mmap_control;
        size_t bytes_cont;
        size_t byte_io = ctrl->byte_io;
-       ssize_t bytes = snd_pcm_mmap_capture_bytes_free(chan);
-       bytes_cont = chan->setup.buffer_size - (byte_io % chan->setup.buffer_size);
+       ssize_t bytes = snd_pcm_mmap_capture_bytes_free(str);
+       bytes_cont = str->setup.buffer_size - (byte_io % str->setup.buffer_size);
        if ((ssize_t)bytes_cont < bytes)
                bytes = bytes_cont;
-       bytes -= bytes % chan->setup.bytes_align;
+       bytes -= bytes % str->setup.bytes_align;
        return bytes;
 }
 
 static void *playback_mmap(void *d)
 {
        snd_pcm_t *pcm = d;
-       struct snd_pcm_chan *chan = &pcm->chan[SND_PCM_CHANNEL_PLAYBACK];
+       struct snd_pcm_stream *str = &pcm->stream[SND_PCM_STREAM_PLAYBACK];
        snd_pcm_mmap_control_t *control;
        char *data;
-       size_t voice_size;
-       int voices;
-       control = chan->mmap_control;
-       data = chan->mmap_data;
-       voices = chan->setup.format.voices;
-       voice_size = chan->mmap_data_size / voices;
+       size_t channel_size;
+       int channels;
+       control = str->mmap_control;
+       data = str->mmap_data;
+       channels = str->setup.format.channels;
+       channel_size = str->mmap_data_size / channels;
        while (1) {
                int err;
                struct pollfd pfd;
                size_t pos, p, bytes;
-               if (chan->mmap_thread_stop)
+               if (str->mmap_thread_stop)
                        break;
 
-               pthread_mutex_lock(&chan->mutex);
+               pthread_mutex_lock(&str->mutex);
                if (control->status != SND_PCM_STATUS_RUNNING) {
-                       pthread_cond_wait(&chan->status_cond, &chan->mutex);
-                       pthread_mutex_unlock(&chan->mutex);
+                       pthread_cond_wait(&str->status_cond, &str->mutex);
+                       pthread_mutex_unlock(&str->mutex);
                        continue;
                }
-               pthread_mutex_unlock(&chan->mutex);
+               pthread_mutex_unlock(&str->mutex);
 
-               pfd.fd = snd_pcm_file_descriptor(pcm, SND_PCM_CHANNEL_PLAYBACK);
+               pfd.fd = snd_pcm_file_descriptor(pcm, SND_PCM_STREAM_PLAYBACK);
                pfd.events = POLLOUT | POLLERR;
                err = poll(&pfd, 1, -1);
                if (err < 0) {
@@ -721,44 +721,44 @@ static void *playback_mmap(void *d)
                        continue;
                }
                if (pfd.revents & POLLERR) {
-                       snd_pcm_mmap_status_change(pcm, SND_PCM_CHANNEL_PLAYBACK, -1);
+                       snd_pcm_mmap_status_streamge(pcm, SND_PCM_STREAM_PLAYBACK, -1);
                        fprintf(stderr, "pollerr %d\n", control->status);
                        continue;
                }
 
                pos = control->byte_io;
-               bytes = mmap_playback_bytes_xfer(chan);
+               bytes = mmap_playback_bytes_xfer(str);
                if (bytes <= 0) {
                        fprintf(stderr, "underrun\n");
                        usleep(10000);
                        continue;
                }
-               p = pos % chan->setup.buffer_size;
-               if (chan->setup.format.interleave) {
+               p = pos % str->setup.buffer_size;
+               if (str->setup.format.interleave) {
                        err = snd_pcm_write(pcm, data + pos, bytes);
                } else {
-                       struct iovec vector[voices];
+                       struct iovec vector[channels];
                        struct iovec *v = vector;
-                       int voice;
-                       size_t size = bytes / voices;
-                       size_t posv = p / voices;
-                       for (voice = 0; voice < voices; ++voice) {
-                               v->iov_base = data + voice_size * voice + posv;
+                       int channel;
+                       size_t size = bytes / channels;
+                       size_t posv = p / channels;
+                       for (channel = 0; channel < channels; ++channel) {
+                               v->iov_base = data + channel_size * channel + posv;
                                v->iov_len = size;
                                v++;
                        }
-                       err = snd_pcm_writev(pcm, vector, voices);
+                       err = snd_pcm_writev(pcm, vector, channels);
                }
                if (err <= 0) {
                        fprintf(stderr, "write err=%d\n", err);
-                       snd_pcm_mmap_status_change(pcm, SND_PCM_CHANNEL_PLAYBACK, -1);
+                       snd_pcm_mmap_status_streamge(pcm, SND_PCM_STREAM_PLAYBACK, -1);
                        continue;
                }
-               pthread_mutex_lock(&chan->mutex);
-               pthread_cond_signal(&chan->ready_cond);
-               pthread_mutex_unlock(&chan->mutex);
+               pthread_mutex_lock(&str->mutex);
+               pthread_cond_signal(&str->ready_cond);
+               pthread_mutex_unlock(&str->mutex);
                pos += bytes;
-               if (pos == chan->setup.byte_boundary)
+               if (pos == str->setup.byte_boundary)
                        pos = 0;
                control->byte_io = pos;
        }
@@ -768,35 +768,35 @@ static void *playback_mmap(void *d)
 static void *capture_mmap(void *d)
 {
        snd_pcm_t *pcm = d;
-       struct snd_pcm_chan *chan = &pcm->chan[SND_PCM_CHANNEL_CAPTURE];
+       struct snd_pcm_stream *str = &pcm->stream[SND_PCM_STREAM_CAPTURE];
        snd_pcm_mmap_control_t *control;
        char *data;
        int frags;
-       int frag_size, voice_size, voice_frag_size;
-       int voices;
-       control = chan->mmap_control;
-       data = chan->mmap_data;
-       frags = chan->setup.frags;
-       frag_size = chan->setup.frag_size;
-       voices = chan->setup.format.voices;
-       voice_size = chan->mmap_data_size / voices;
-       voice_frag_size = voice_size / frags;
+       int frag_size, channel_size, channel_frag_size;
+       int channels;
+       control = str->mmap_control;
+       data = str->mmap_data;
+       frags = str->setup.frags;
+       frag_size = str->setup.frag_size;
+       channels = str->setup.format.channels;
+       channel_size = str->mmap_data_size / channels;
+       channel_frag_size = channel_size / frags;
        while (1) {
                int err;
                struct pollfd pfd;
                size_t pos, p, bytes;
-               if (chan->mmap_thread_stop)
+               if (str->mmap_thread_stop)
                        break;
 
-               pthread_mutex_lock(&chan->mutex);
+               pthread_mutex_lock(&str->mutex);
                if (control->status != SND_PCM_STATUS_RUNNING) {
-                       pthread_cond_wait(&chan->status_cond, &chan->mutex);
-                       pthread_mutex_unlock(&chan->mutex);
+                       pthread_cond_wait(&str->status_cond, &str->mutex);
+                       pthread_mutex_unlock(&str->mutex);
                        continue;
                }
-               pthread_mutex_unlock(&chan->mutex);
+               pthread_mutex_unlock(&str->mutex);
 
-               pfd.fd = snd_pcm_file_descriptor(pcm, SND_PCM_CHANNEL_CAPTURE);
+               pfd.fd = snd_pcm_file_descriptor(pcm, SND_PCM_STREAM_CAPTURE);
                pfd.events = POLLIN | POLLERR;
                err = poll(&pfd, 1, -1);
                if (err < 0) {
@@ -804,253 +804,253 @@ static void *capture_mmap(void *d)
                        continue;
                }
                if (pfd.revents & POLLERR) {
-                       snd_pcm_mmap_status_change(pcm, SND_PCM_CHANNEL_CAPTURE, -1);
+                       snd_pcm_mmap_status_streamge(pcm, SND_PCM_STREAM_CAPTURE, -1);
                        fprintf(stderr, "pollerr %d\n", control->status);
                        continue;
                }
 
                pos = control->byte_io;
-               bytes = mmap_capture_bytes_xfer(chan);
+               bytes = mmap_capture_bytes_xfer(str);
                if (bytes <= 0) {
                        fprintf(stderr, "overrun\n");
                        usleep(10000);
                        continue;
                }
-               p = pos % chan->setup.buffer_size;
-               if (chan->setup.format.interleave) {
+               p = pos % str->setup.buffer_size;
+               if (str->setup.format.interleave) {
                        err = snd_pcm_read(pcm, data + pos, bytes);
                } else {
-                       struct iovec vector[voices];
+                       struct iovec vector[channels];
                        struct iovec *v = vector;
-                       int voice;
-                       size_t size = bytes / voices;
-                       size_t posv = p / voices;
-                       for (voice = 0; voice < voices; ++voice) {
-                               v->iov_base = data + voice_size * voice + posv;
+                       int channel;
+                       size_t size = bytes / channels;
+                       size_t posv = p / channels;
+                       for (channel = 0; channel < channels; ++channel) {
+                               v->iov_base = data + channel_size * channel + posv;
                                v->iov_len = size;
                                v++;
                        }
-                       err = snd_pcm_readv(pcm, vector, voices);
+                       err = snd_pcm_readv(pcm, vector, channels);
                }
                if (err < 0) {
                        fprintf(stderr, "read err=%d\n", err);
-                       snd_pcm_mmap_status_change(pcm, SND_PCM_CHANNEL_CAPTURE, -1);
+                       snd_pcm_mmap_status_streamge(pcm, SND_PCM_STREAM_CAPTURE, -1);
                        continue;
                }
-               pthread_mutex_lock(&chan->mutex);
-               pthread_cond_signal(&chan->ready_cond);
-               pthread_mutex_unlock(&chan->mutex);
+               pthread_mutex_lock(&str->mutex);
+               pthread_cond_signal(&str->ready_cond);
+               pthread_mutex_unlock(&str->mutex);
                pos += bytes;
-               if (pos == chan->setup.byte_boundary)
+               if (pos == str->setup.byte_boundary)
                        pos = 0;
                control->byte_io = pos;
        }
        return 0;
 }
 
-int snd_pcm_mmap_control(snd_pcm_t *pcm, int channel, snd_pcm_mmap_control_t **control)
+int snd_pcm_mmap_control(snd_pcm_t *pcm, int stream, snd_pcm_mmap_control_t **control)
 {
-       struct snd_pcm_chan *chan;
-       snd_pcm_channel_info_t info;
+       struct snd_pcm_stream *str;
+       snd_pcm_stream_info_t info;
        size_t csize;
        int err;
        if (!pcm || !control)
                return -EFAULT;
-       if (channel < 0 || channel > 1)
+       if (stream < 0 || stream > 1)
                return -EINVAL;
-       chan = &pcm->chan[channel];
-       if (!chan->open)
+       str = &pcm->stream[stream];
+       if (!str->open)
                return -EBADFD;
-       if (chan->mmap_control) {
-               *control = chan->mmap_control;
+       if (str->mmap_control) {
+               *control = str->mmap_control;
                return 0;
        }
-       if (!chan->valid_setup)
+       if (!str->valid_setup)
                return -EBADFD;
        csize = sizeof(snd_pcm_mmap_control_t);
 
-       info.channel = channel;
-       err = snd_pcm_channel_info(pcm, &info);
+       info.stream = stream;
+       err = snd_pcm_stream_info(pcm, &info);
        if (err < 0)
                return err;
-       if (info.flags & SND_PCM_CHNINFO_MMAP) {
-               if ((err = pcm->ops->mmap_control(pcm, channel, control, csize)) < 0)
+       if (info.flags & SND_PCM_STREAM_INFO_MMAP) {
+               if ((err = pcm->ops->mmap_control(pcm, stream, control, csize)) < 0)
                        return err;
        } else {
                *control = calloc(1, csize);
-               chan->mmap_control_emulation = 1;
+               str->mmap_control_emulation = 1;
        }
-       chan->mmap_control = *control;
-       chan->mmap_control_size = csize;
+       str->mmap_control = *control;
+       str->mmap_control_size = csize;
        return 0;
 }
 
-int snd_pcm_mmap_get_areas(snd_pcm_t *pcm, int channel, snd_pcm_voice_area_t *areas)
+int snd_pcm_mmap_get_areas(snd_pcm_t *pcm, int stream, snd_pcm_channel_area_t *areas)
 {
-       struct snd_pcm_chan *chan;
-       snd_pcm_voice_setup_t s;
-       snd_pcm_voice_area_t *a, *ap;
-       unsigned int voice;
+       struct snd_pcm_stream *str;
+       snd_pcm_channel_setup_t s;
+       snd_pcm_channel_area_t *a, *ap;
+       unsigned int channel;
        int err;
        if (!pcm)
                return -EFAULT;
-       if (channel < 0 || channel > 1)
+       if (stream < 0 || stream > 1)
                return -EINVAL;
-       chan = &pcm->chan[channel];
-       if (!chan->open || !chan->valid_setup || !chan->mmap_data)
+       str = &pcm->stream[stream];
+       if (!str->open || !str->valid_setup || !str->mmap_data)
                return -EBADFD;
-       a = calloc(chan->setup.format.voices, sizeof(*areas));
-       for (voice = 0, ap = a; voice < chan->setup.format.voices; ++voice, ++ap) {
-               s.voice = voice;
-               err = snd_pcm_voice_setup(pcm, channel, &s);
+       a = calloc(str->setup.format.channels, sizeof(*areas));
+       for (channel = 0, ap = a; channel < str->setup.format.channels; ++channel, ++ap) {
+               s.channel = channel;
+               err = snd_pcm_channel_setup(pcm, stream, &s);
                if (err < 0) {
                        free(a);
                        return err;
                }
                if (areas)
-                       areas[voice] = s.area;
+                       areas[channel] = s.area;
                *ap = s.area;
        }
-       chan->voices = a;
+       str->channels = a;
        return 0;
 }
 
-int snd_pcm_mmap_data(snd_pcm_t *pcm, int channel, void **data)
+int snd_pcm_mmap_data(snd_pcm_t *pcm, int stream, void **data)
 {
-       struct snd_pcm_chan *chan;
-       snd_pcm_channel_info_t info;
+       struct snd_pcm_stream *str;
+       snd_pcm_stream_info_t info;
        size_t bsize;
        int err;
        if (!pcm || !data)
                return -EFAULT;
-       if (channel < 0 || channel > 1)
+       if (stream < 0 || stream > 1)
                return -EINVAL;
-       chan = &pcm->chan[channel];
-       if (!chan->open)
+       str = &pcm->stream[stream];
+       if (!str->open)
                return -EBADFD;
-       if (chan->mmap_data) {
-               *data = chan->mmap_data;
+       if (str->mmap_data) {
+               *data = str->mmap_data;
                return 0;
        }
-       if (!chan->valid_setup)
+       if (!str->valid_setup)
                return -EBADFD;
 
-       info.channel = channel;
-       err = snd_pcm_channel_info(pcm, &info);
+       info.stream = stream;
+       err = snd_pcm_stream_info(pcm, &info);
        if (err < 0)
                return err;
        bsize = info.mmap_size;
-       if (info.flags & SND_PCM_CHNINFO_MMAP) {
-               if ((err = pcm->ops->mmap_data(pcm, channel, data, bsize)) < 0)
+       if (info.flags & SND_PCM_STREAM_INFO_MMAP) {
+               if ((err = pcm->ops->mmap_data(pcm, stream, data, bsize)) < 0)
                        return err;
        } else {
                *data = calloc(1, bsize);
 
-               pthread_mutex_init(&chan->mutex, NULL);
-               pthread_cond_init(&chan->status_cond, NULL);
-               pthread_cond_init(&chan->ready_cond, NULL);
-               chan->mmap_thread_stop = 0;
-               if (channel == SND_PCM_CHANNEL_PLAYBACK)
-                       err = pthread_create(&chan->mmap_thread, NULL, playback_mmap, pcm);
+               pthread_mutex_init(&str->mutex, NULL);
+               pthread_cond_init(&str->status_cond, NULL);
+               pthread_cond_init(&str->ready_cond, NULL);
+               str->mmap_thread_stop = 0;
+               if (stream == SND_PCM_STREAM_PLAYBACK)
+                       err = pthread_create(&str->mmap_thread, NULL, playback_mmap, pcm);
                else
-                       err = pthread_create(&chan->mmap_thread, NULL, capture_mmap, pcm);
+                       err = pthread_create(&str->mmap_thread, NULL, capture_mmap, pcm);
                if (err < 0) {
-                       pthread_cond_destroy(&chan->status_cond);
-                       pthread_cond_destroy(&chan->ready_cond);
-                       pthread_mutex_destroy(&chan->mutex);
+                       pthread_cond_destroy(&str->status_cond);
+                       pthread_cond_destroy(&str->ready_cond);
+                       pthread_mutex_destroy(&str->mutex);
                        free(*data);
                        *data = 0;
                        return err;
                }
-               chan->mmap_data_emulation = 1;
+               str->mmap_data_emulation = 1;
        }
-       chan->mmap_data = *data;
-       chan->mmap_data_size = bsize;
-       err = snd_pcm_mmap_get_areas(pcm, channel, NULL);
+       str->mmap_data = *data;
+       str->mmap_data_size = bsize;
+       err = snd_pcm_mmap_get_areas(pcm, stream, NULL);
        if (err < 0)
                return err;
        return 0;
 }
 
-int snd_pcm_mmap(snd_pcm_t *pcm, int channel, snd_pcm_mmap_control_t **control, void **data)
+int snd_pcm_mmap(snd_pcm_t *pcm, int stream, snd_pcm_mmap_control_t **control, void **data)
 {
        int err;
-       err = snd_pcm_mmap_control(pcm, channel, control);
+       err = snd_pcm_mmap_control(pcm, stream, control);
        if (err < 0)
                return err;
-       err = snd_pcm_mmap_data(pcm, channel, data);
+       err = snd_pcm_mmap_data(pcm, stream, data);
        if (err < 0) {
-               snd_pcm_munmap_control(pcm, channel);
+               snd_pcm_munmap_control(pcm, stream);
                return err;
        }
        return 0;
 }
 
-int snd_pcm_munmap_control(snd_pcm_t *pcm, int channel)
+int snd_pcm_munmap_control(snd_pcm_t *pcm, int stream)
 {
        int err;
-       struct snd_pcm_chan *chan;
+       struct snd_pcm_stream *str;
        if (!pcm)
                return -EFAULT;
-       if (channel < 0 || channel > 1)
+       if (stream < 0 || stream > 1)
                return -EINVAL;
-       chan = &pcm->chan[channel];
-       if (!chan->open)
+       str = &pcm->stream[stream];
+       if (!str->open)
                return -EBADFD;
-       if (!chan->mmap_control)
+       if (!str->mmap_control)
                return -EINVAL;
-       if (chan->mmap_control_emulation) {
-               free(chan->mmap_control);
-               chan->mmap_control_emulation = 0;
+       if (str->mmap_control_emulation) {
+               free(str->mmap_control);
+               str->mmap_control_emulation = 0;
        } else {
-               if ((err = pcm->ops->munmap_control(pcm, channel, chan->mmap_control, chan->mmap_control_size)) < 0)
+               if ((err = pcm->ops->munmap_control(pcm, stream, str->mmap_control, str->mmap_control_size)) < 0)
                        return err;
        }
-       chan->mmap_control = 0;
-       chan->mmap_control_size = 0;
+       str->mmap_control = 0;
+       str->mmap_control_size = 0;
        return 0;
 }
 
-int snd_pcm_munmap_data(snd_pcm_t *pcm, int channel)
+int snd_pcm_munmap_data(snd_pcm_t *pcm, int stream)
 {
        int err;
-       struct snd_pcm_chan *chan;
+       struct snd_pcm_stream *str;
        if (!pcm)
                return -EFAULT;
-       if (channel < 0 || channel > 1)
+       if (stream < 0 || stream > 1)
                return -EINVAL;
-       chan = &pcm->chan[channel];
-       if (!chan->open)
+       str = &pcm->stream[stream];
+       if (!str->open)
                return -EBADFD;
-       if (!chan->mmap_data)
+       if (!str->mmap_data)
                return -EINVAL;
-       if (chan->mmap_data_emulation) {
-               chan->mmap_thread_stop = 1;
-               pthread_mutex_lock(&chan->mutex);
-               pthread_cond_signal(&chan->status_cond);
-               pthread_mutex_unlock(&chan->mutex);
-               pthread_join(chan->mmap_thread, NULL);
-               pthread_cond_destroy(&chan->status_cond);
-               pthread_cond_destroy(&chan->ready_cond);
-               pthread_mutex_destroy(&chan->mutex);
-               free(chan->mmap_data);
-               chan->mmap_data_emulation = 0;
+       if (str->mmap_data_emulation) {
+               str->mmap_thread_stop = 1;
+               pthread_mutex_lock(&str->mutex);
+               pthread_cond_signal(&str->status_cond);
+               pthread_mutex_unlock(&str->mutex);
+               pthread_join(str->mmap_thread, NULL);
+               pthread_cond_destroy(&str->status_cond);
+               pthread_cond_destroy(&str->ready_cond);
+               pthread_mutex_destroy(&str->mutex);
+               free(str->mmap_data);
+               str->mmap_data_emulation = 0;
        } else {
-               if ((err = pcm->ops->munmap_data(pcm, channel, chan->mmap_data, chan->mmap_data_size)) < 0)
+               if ((err = pcm->ops->munmap_data(pcm, stream, str->mmap_data, str->mmap_data_size)) < 0)
                        return err;
        }
-       free(chan->voices);
-       chan->mmap_data = 0;
-       chan->mmap_data_size = 0;
+       free(str->channels);
+       str->mmap_data = 0;
+       str->mmap_data_size = 0;
        return 0;
 }
 
-int snd_pcm_munmap(snd_pcm_t *pcm, int channel)
+int snd_pcm_munmap(snd_pcm_t *pcm, int stream)
 {
        int err;
-       err = snd_pcm_munmap_control(pcm, channel);
+       err = snd_pcm_munmap_control(pcm, stream);
        if (err < 0)
                return err;
-       return snd_pcm_munmap_data(pcm, channel);
+       return snd_pcm_munmap_data(pcm, stream);
 }
 
index 9232e636793a442433f985071d710ab9356fe991..87879e5186e80bbbfefb25876064c5930b1fc3ab 100644 (file)
 
 /* snd_pcm_plug helpers */
 
-void *snd_pcm_plug_buf_alloc(snd_pcm_t *pcm, int channel, size_t size)
+void *snd_pcm_plug_buf_alloc(snd_pcm_t *pcm, int stream, size_t size)
 {
        int idx;
        snd_pcm_plug_t *plug = (snd_pcm_plug_t*) &pcm->private;
-       struct snd_pcm_plug_chan *plugchan = &plug->chan[channel];
+       struct snd_pcm_plug_stream *plugstr = &plug->stream[stream];
 
        for (idx = 0; idx < 2; idx++) {
-               if (plugchan->alloc_lock[idx])
+               if (plugstr->alloc_lock[idx])
                        continue;
-               if (plugchan->alloc_size[idx] >= size) {
-                       plugchan->alloc_lock[idx] = 1;
-                       return plugchan->alloc_ptr[idx];
+               if (plugstr->alloc_size[idx] >= size) {
+                       plugstr->alloc_lock[idx] = 1;
+                       return plugstr->alloc_ptr[idx];
                }
        }
        for (idx = 0; idx < 2; idx++) {
-               if (plugchan->alloc_lock[idx])
+               if (plugstr->alloc_lock[idx])
                        continue;
-               if (plugchan->alloc_ptr[idx] != NULL)
-                       free(plugchan->alloc_ptr[idx]);
-               plugchan->alloc_ptr[idx] = malloc(size);
-               if (plugchan->alloc_ptr[idx] == NULL)
+               if (plugstr->alloc_ptr[idx] != NULL)
+                       free(plugstr->alloc_ptr[idx]);
+               plugstr->alloc_ptr[idx] = malloc(size);
+               if (plugstr->alloc_ptr[idx] == NULL)
                        return NULL;
-               plugchan->alloc_size[idx] = size;
-               plugchan->alloc_lock[idx] = 1;
-               return plugchan->alloc_ptr[idx];
+               plugstr->alloc_size[idx] = size;
+               plugstr->alloc_lock[idx] = 1;
+               return plugstr->alloc_ptr[idx];
        }
        return NULL;
 }
 
-void snd_pcm_plug_buf_unlock(snd_pcm_t *pcm, int channel, void *ptr)
+void snd_pcm_plug_buf_unlock(snd_pcm_t *pcm, int stream, void *ptr)
 {
        int idx;
 
        snd_pcm_plug_t *plug;
-       struct snd_pcm_plug_chan *plugchan;
+       struct snd_pcm_plug_stream *plugstr;
 
        if (!ptr)
                return;
        plug = (snd_pcm_plug_t*) &pcm->private;
-       plugchan = &plug->chan[channel];
+       plugstr = &plug->stream[stream];
 
        for (idx = 0; idx < 2; idx++) {
-               if (plugchan->alloc_ptr[idx] == ptr) {
-                       plugchan->alloc_lock[idx] = 0;
+               if (plugstr->alloc_ptr[idx] == ptr) {
+                       plugstr->alloc_lock[idx] = 0;
                        return;
                }
        }
@@ -84,21 +84,21 @@ void snd_pcm_plug_buf_unlock(snd_pcm_t *pcm, int channel, void *ptr)
 int snd_pcm_plugin_insert(snd_pcm_plugin_t *plugin)
 {
        snd_pcm_plug_t *plug;
-       struct snd_pcm_plug_chan *plugchan;
+       struct snd_pcm_plug_stream *plugstr;
        snd_pcm_t *pcm;
        if (!plugin)
                return -EFAULT;
        pcm = plugin->handle;
        plug = (snd_pcm_plug_t*) &pcm->private;
-       plugchan = &plug->chan[plugin->channel];
-       plugin->next = plugchan->first;
+       plugstr = &plug->stream[plugin->stream];
+       plugin->next = plugstr->first;
        plugin->prev = NULL;
-       if (plugchan->first) {
-               plugchan->first->prev = plugin;
-               plugchan->first = plugin;
+       if (plugstr->first) {
+               plugstr->first->prev = plugin;
+               plugstr->first = plugin;
        } else {
-               plugchan->last =
-               plugchan->first = plugin;
+               plugstr->last =
+               plugstr->first = plugin;
        }
        return 0;
 }
@@ -106,22 +106,22 @@ int snd_pcm_plugin_insert(snd_pcm_plugin_t *plugin)
 int snd_pcm_plugin_append(snd_pcm_plugin_t *plugin)
 {
        snd_pcm_plug_t *plug;
-       struct snd_pcm_plug_chan *plugchan;
+       struct snd_pcm_plug_stream *plugstr;
        snd_pcm_t *pcm;
        if (!plugin)
                return -EFAULT;
        pcm = plugin->handle;
        plug = (snd_pcm_plug_t*) &pcm->private;
-       plugchan = &plug->chan[plugin->channel];
+       plugstr = &plug->stream[plugin->stream];
 
        plugin->next = NULL;
-       plugin->prev = plugchan->last;
-       if (plugchan->last) {
-               plugchan->last->next = plugin;
-               plugchan->last = plugin;
+       plugin->prev = plugstr->last;
+       if (plugstr->last) {
+               plugstr->last->next = plugin;
+               plugstr->last = plugin;
        } else {
-               plugchan->last =
-               plugchan->first = plugin;
+               plugstr->last =
+               plugstr->first = plugin;
        }
        return 0;
 }
@@ -132,20 +132,20 @@ int snd_pcm_plugin_remove_to(snd_pcm_plugin_t *plugin)
        snd_pcm_plugin_t *plugin1, *plugin1_prev;
        snd_pcm_plug_t *plug;
        snd_pcm_t *pcm;
-       struct snd_pcm_plug_chan *plugchan;
+       struct snd_pcm_plug_stream *plugstr;
        if (!plugin)
                return -EFAULT;
        pcm = plugin->handle;
 
        plug = (snd_pcm_plug_t*) &pcm->private;
-       plugchan = &plug->chan[plugin->channel];
+       plugstr = &plug->stream[plugin->stream];
 
        plugin1 = plugin;
        while (plugin1->prev)
                plugin1 = plugin1->prev;
-       if (plugchan->first != plugin1)
+       if (plugstr->first != plugin1)
                return -EINVAL;
-       plugchan->first = plugin;
+       plugstr->first = plugin;
        plugin1 = plugin->prev;
        plugin->prev = NULL;
        while (plugin1) {
@@ -156,26 +156,26 @@ int snd_pcm_plugin_remove_to(snd_pcm_plugin_t *plugin)
        return 0;
 }
 
-int snd_pcm_plug_remove_first(snd_pcm_t *pcm, int channel)
+int snd_pcm_plug_remove_first(snd_pcm_t *pcm, int stream)
 {
        snd_pcm_plugin_t *plugin;
        snd_pcm_plug_t *plug;
-       struct snd_pcm_plug_chan *plugchan;
+       struct snd_pcm_plug_stream *plugstr;
        if (!pcm)
                return -EFAULT;
-       if (channel < 0 || channel > 1)
+       if (stream < 0 || stream > 1)
                return -EINVAL;
-       if (!pcm->chan[channel].open)
+       if (!pcm->stream[stream].open)
                return -EBADFD;
 
        plug = (snd_pcm_plug_t*) &pcm->private;
-       plugchan = &plug->chan[channel];
+       plugstr = &plug->stream[stream];
 
-       plugin = plugchan->first;
+       plugin = plugstr->first;
        if (plugin->next) {
                plugin = plugin->next;
        } else {
-               return snd_pcm_plug_clear(pcm, channel);
+               return snd_pcm_plug_clear(pcm, stream);
        }
        return snd_pcm_plugin_remove_to(plugin);
 }
@@ -183,108 +183,108 @@ int snd_pcm_plug_remove_first(snd_pcm_t *pcm, int channel)
 
 /* snd_pcm_plug externs */
 
-int snd_pcm_plug_clear(snd_pcm_t *pcm, int channel)
+int snd_pcm_plug_clear(snd_pcm_t *pcm, int stream)
 {
        snd_pcm_plugin_t *plugin, *plugin_next;
        snd_pcm_plug_t *plug;
-       struct snd_pcm_plug_chan *plugchan;
+       struct snd_pcm_plug_stream *plugstr;
        int idx;
        
        if (!pcm)
                return -EINVAL;
-       if (channel < 0 || channel > 1)
+       if (stream < 0 || stream > 1)
                return -EINVAL;
-       if (!pcm->chan[channel].open)
+       if (!pcm->stream[stream].open)
                return -EBADFD;
 
        plug = (snd_pcm_plug_t*) &pcm->private;
-       plugchan = &plug->chan[channel];
-       plugin = plugchan->first;
-       plugchan->first = NULL;
-       plugchan->last = NULL;
+       plugstr = &plug->stream[stream];
+       plugin = plugstr->first;
+       plugstr->first = NULL;
+       plugstr->last = NULL;
        while (plugin) {
                plugin_next = plugin->next;
                snd_pcm_plugin_free(plugin);
                plugin = plugin_next;
        }
        for (idx = 0; idx < 2; idx++) {
-               if (plugchan->alloc_ptr[idx]) {
-                       free(plugchan->alloc_ptr[idx]);
-                       plugchan->alloc_ptr[idx] = 0;
+               if (plugstr->alloc_ptr[idx]) {
+                       free(plugstr->alloc_ptr[idx]);
+                       plugstr->alloc_ptr[idx] = 0;
                }
-               plugchan->alloc_size[idx] = 0;
-               plugchan->alloc_lock[idx] = 0;
+               plugstr->alloc_size[idx] = 0;
+               plugstr->alloc_lock[idx] = 0;
        }
        return 0;
 }
 
-snd_pcm_plugin_t *snd_pcm_plug_first(snd_pcm_t *pcm, int channel)
+snd_pcm_plugin_t *snd_pcm_plug_first(snd_pcm_t *pcm, int stream)
 {
        snd_pcm_plug_t *plug;
-       struct snd_pcm_plug_chan *plugchan;
+       struct snd_pcm_plug_stream *plugstr;
        if (!pcm)
                return NULL;
-       if (channel < 0 || channel > 1)
+       if (stream < 0 || stream > 1)
                return NULL;
-       if (!pcm->chan[channel].open)
+       if (!pcm->stream[stream].open)
                return NULL;
 
        plug = (snd_pcm_plug_t*) &pcm->private;
-       plugchan = &plug->chan[channel];
+       plugstr = &plug->stream[stream];
 
-       return plugchan->first;
+       return plugstr->first;
 }
 
-snd_pcm_plugin_t *snd_pcm_plug_last(snd_pcm_t *pcm, int channel)
+snd_pcm_plugin_t *snd_pcm_plug_last(snd_pcm_t *pcm, int stream)
 {
        snd_pcm_plug_t *plug;
-       struct snd_pcm_plug_chan *plugchan;
+       struct snd_pcm_plug_stream *plugstr;
        if (!pcm)
                return NULL;
-       if (channel < 0 || channel > 1)
+       if (stream < 0 || stream > 1)
                return NULL;
-       if (!pcm->chan[channel].open)
+       if (!pcm->stream[stream].open)
                return NULL;
 
        plug = (snd_pcm_plug_t*) &pcm->private;
-       plugchan = &plug->chan[channel];
+       plugstr = &plug->stream[stream];
 
-       return plugchan->last;
+       return plugstr->last;
 }
 
-int snd_pcm_plug_direct(snd_pcm_t *pcm, int channel)
+int snd_pcm_plug_direct(snd_pcm_t *pcm, int stream)
 {
-       return snd_pcm_plug_first(pcm, channel) == NULL;
+       return snd_pcm_plug_first(pcm, stream) == NULL;
 }
 
 #if 0
-double snd_pcm_plug_client_ratio(snd_pcm_t *pcm, int channel)
+double snd_pcm_plug_client_ratio(snd_pcm_t *pcm, int stream)
 {
        ssize_t client;
        if (!pcm)
                return -EFAULT;
-       if (channel < 0 || channel > 1)
+       if (stream < 0 || stream > 1)
                return -EINVAL;
-       if (!pcm->chan[channel].open)
+       if (!pcm->stream[stream].open)
                return -EBADFD;
 
-       client = snd_pcm_plug_client_size(pcm, channel, 1000000);
+       client = snd_pcm_plug_client_size(pcm, stream, 1000000);
        if (client < 0)
                return 0;
        return (double)client / (double)1000000;
 }
 
-double snd_pcm_plug_slave_ratio(snd_pcm_t *pcm, int channel)
+double snd_pcm_plug_slave_ratio(snd_pcm_t *pcm, int stream)
 {
        ssize_t slave;
        if (!pcm)
                return -EFAULT;
-       if (channel < 0 || channel > 1)
+       if (stream < 0 || stream > 1)
                return -EINVAL;
-       if (!pcm->chan[channel].open)
+       if (!pcm->stream[stream].open)
                return -EBADFD;
 
-       slave = snd_pcm_plug_slave_size(pcm, channel, 1000000);
+       slave = snd_pcm_plug_slave_size(pcm, stream, 1000000);
        if (slave < 0)
                return 0;
        return (double)slave / (double)1000000;
@@ -295,19 +295,19 @@ double snd_pcm_plug_slave_ratio(snd_pcm_t *pcm, int channel)
  *
  */
 
-static int snd_pcm_plug_channel_close(snd_pcm_t *pcm, int channel)
+static int snd_pcm_plug_stream_close(snd_pcm_t *pcm, int stream)
 {
        snd_pcm_plug_t *plug = (snd_pcm_plug_t*) &pcm->private;
-       snd_pcm_plug_clear(pcm, channel);
+       snd_pcm_plug_clear(pcm, stream);
        if (plug->close_slave)
-               return snd_pcm_channel_close(plug->slave, channel);
+               return snd_pcm_stream_close(plug->slave, stream);
        return 0;
 }
 
-static int snd_pcm_plug_channel_nonblock(snd_pcm_t *pcm, int channel, int nonblock)
+static int snd_pcm_plug_stream_nonblock(snd_pcm_t *pcm, int stream, int nonblock)
 {
        snd_pcm_plug_t *plug = (snd_pcm_plug_t*) &pcm->private;
-       return snd_pcm_channel_nonblock(plug->slave, channel, nonblock);
+       return snd_pcm_stream_nonblock(plug->slave, stream, nonblock);
 }
 
 static int snd_pcm_plug_info(snd_pcm_t *pcm, snd_pcm_info_t * info)
@@ -316,51 +316,51 @@ static int snd_pcm_plug_info(snd_pcm_t *pcm, snd_pcm_info_t * info)
        return snd_pcm_info(plug->slave, info);
 }
 
-static int snd_pcm_plug_channel_info(snd_pcm_t *pcm, snd_pcm_channel_info_t *info)
+static int snd_pcm_plug_stream_info(snd_pcm_t *pcm, snd_pcm_stream_info_t *info)
 {
        int err;
        snd_pcm_plug_t *plug = (snd_pcm_plug_t*) &pcm->private;
-       struct snd_pcm_chan *chan;
+       struct snd_pcm_stream *str;
        
-       if ((err = snd_pcm_channel_info(plug->slave, info)) < 0)
+       if ((err = snd_pcm_stream_info(plug->slave, info)) < 0)
                return err;
        info->formats = snd_pcm_plug_formats(info->formats);
        info->min_rate = 4000;
        info->max_rate = 192000;
-       info->min_voices = 1;
-       info->max_voices = 32;
+       info->min_channels = 1;
+       info->max_channels = 32;
        info->rates = SND_PCM_RATE_CONTINUOUS | SND_PCM_RATE_8000_192000;
-       info->flags |= SND_PCM_CHNINFO_INTERLEAVE | SND_PCM_CHNINFO_NONINTERLEAVE;
-
-       chan = &pcm->chan[info->channel];
-       if (pcm->chan[info->channel].valid_setup) {
-               info->buffer_size = snd_pcm_plug_client_size(pcm, info->channel, info->buffer_size);
-               info->min_fragment_size = snd_pcm_plug_client_size(pcm, info->channel, info->min_fragment_size);
-               info->max_fragment_size = snd_pcm_plug_client_size(pcm, info->channel, info->max_fragment_size);
-               info->fragment_align = snd_pcm_plug_client_size(pcm, info->channel, info->fragment_align);
-               info->fifo_size = snd_pcm_plug_client_size(pcm, info->channel, info->fifo_size);
-               info->transfer_block_size = snd_pcm_plug_client_size(pcm, info->channel, info->transfer_block_size);
-               if (chan->setup.mode == SND_PCM_MODE_BLOCK)
-                       info->mmap_size = chan->setup.buffer_size;
+       info->flags |= SND_PCM_STREAM_INFO_INTERLEAVE | SND_PCM_STREAM_INFO_NONINTERLEAVE;
+
+       str = &pcm->stream[info->stream];
+       if (pcm->stream[info->stream].valid_setup) {
+               info->buffer_size = snd_pcm_plug_client_size(pcm, info->stream, info->buffer_size);
+               info->min_fragment_size = snd_pcm_plug_client_size(pcm, info->stream, info->min_fragment_size);
+               info->max_fragment_size = snd_pcm_plug_client_size(pcm, info->stream, info->max_fragment_size);
+               info->fragment_align = snd_pcm_plug_client_size(pcm, info->stream, info->fragment_align);
+               info->fifo_size = snd_pcm_plug_client_size(pcm, info->stream, info->fifo_size);
+               info->transfer_block_size = snd_pcm_plug_client_size(pcm, info->stream, info->transfer_block_size);
+               if (str->setup.mode == SND_PCM_MODE_FRAGMENT)
+                       info->mmap_size = str->setup.buffer_size;
                else
-                       info->mmap_size = snd_pcm_plug_client_size(pcm, info->channel, info->mmap_size);
+                       info->mmap_size = snd_pcm_plug_client_size(pcm, info->stream, info->mmap_size);
        }
-       if (!snd_pcm_plug_direct(pcm, info->channel))
-               info->flags &= ~(SND_PCM_CHNINFO_MMAP | SND_PCM_CHNINFO_MMAP_VALID);
+       if (!snd_pcm_plug_direct(pcm, info->stream))
+               info->flags &= ~(SND_PCM_STREAM_INFO_MMAP | SND_PCM_STREAM_INFO_MMAP_VALID);
        return 0;
 }
 
-static int snd_pcm_plug_action(snd_pcm_t *pcm, int channel, int action,
+static int snd_pcm_plug_action(snd_pcm_t *pcm, int stream, int action,
                               unsigned long data)
 {
        snd_pcm_plugin_t *plugin;
        int err;
        snd_pcm_plug_t *plug;
-       struct snd_pcm_plug_chan *plugchan;
+       struct snd_pcm_plug_stream *plugstr;
        plug = (snd_pcm_plug_t*) &pcm->private;
-       plugchan = &plug->chan[channel];
+       plugstr = &plug->stream[stream];
 
-       plugin = plugchan->first;
+       plugin = plugstr->first;
        while (plugin) {
                if (plugin->action) {
                        if ((err = plugin->action(plugin, action, data))<0)
@@ -371,14 +371,14 @@ static int snd_pcm_plug_action(snd_pcm_t *pcm, int channel, int action,
        return 0;
 }
 
-static int snd_pcm_plug_channel_params(snd_pcm_t *pcm, snd_pcm_channel_params_t *params)
+static int snd_pcm_plug_stream_params(snd_pcm_t *pcm, snd_pcm_stream_params_t *params)
 {
-       snd_pcm_channel_params_t slave_params, params1;
-       snd_pcm_channel_info_t slave_info;
+       snd_pcm_stream_params_t slave_params, params1;
+       snd_pcm_stream_info_t slave_info;
        snd_pcm_plugin_t *plugin;
        snd_pcm_plug_t *plug;
        int err;
-       int channel = params->channel;
+       int stream = params->stream;
        
        plug = (snd_pcm_plug_t*) &pcm->private;
 
@@ -387,9 +387,9 @@ static int snd_pcm_plug_channel_params(snd_pcm_t *pcm, snd_pcm_channel_params_t
          */
 
        memset(&slave_info, 0, sizeof(slave_info));
-       slave_info.channel = channel;
-       if ((err = snd_pcm_channel_info(plug->slave, &slave_info)) < 0) {
-               snd_pcm_plug_clear(pcm, channel);
+       slave_info.stream = stream;
+       if ((err = snd_pcm_stream_info(plug->slave, &slave_info)) < 0) {
+               snd_pcm_plug_clear(pcm, stream);
                return err;
        }
 
@@ -397,30 +397,30 @@ static int snd_pcm_plug_channel_params(snd_pcm_t *pcm, snd_pcm_channel_params_t
                return err;
 
 
-       snd_pcm_plug_clear(pcm, channel);
+       snd_pcm_plug_clear(pcm, stream);
 
        /* add necessary plugins */
        memcpy(&params1, params, sizeof(*params));
        if ((err = snd_pcm_plug_format(pcm, &params1, &slave_params)) < 0)
                return err;
 
-       if (snd_pcm_plug_direct(pcm, channel))
-               return snd_pcm_channel_params(plug->slave, params);
+       if (snd_pcm_plug_direct(pcm, stream))
+               return snd_pcm_stream_params(plug->slave, params);
 
        /*
         *  I/O plugins
         */
 
-       if (slave_info.flags & SND_PCM_CHNINFO_MMAP) {
+       if (slave_info.flags & SND_PCM_STREAM_INFO_MMAP) {
                pdprintf("params mmap plugin\n");
-               err = snd_pcm_plugin_build_mmap(pcm, channel, plug->slave, &slave_params.format, &plugin);
+               err = snd_pcm_plugin_build_mmap(pcm, stream, plug->slave, &slave_params.format, &plugin);
        } else {
                pdprintf("params I/O plugin\n");
-               err = snd_pcm_plugin_build_io(pcm, channel, plug->slave, &slave_params.format, &plugin);
+               err = snd_pcm_plugin_build_io(pcm, stream, plug->slave, &slave_params.format, &plugin);
        }
        if (err < 0)
                return err;
-       if (channel == SND_PCM_CHANNEL_PLAYBACK) {
+       if (stream == SND_PCM_STREAM_PLAYBACK) {
                err = snd_pcm_plugin_append(plugin);
        } else {
                err = snd_pcm_plugin_insert(plugin);
@@ -431,105 +431,105 @@ static int snd_pcm_plug_channel_params(snd_pcm_t *pcm, snd_pcm_channel_params_t
        }
 
        /* compute right sizes */
-       slave_params.buffer_size = snd_pcm_plug_slave_size(pcm, channel, slave_params.buffer_size);
-       slave_params.frag_size = snd_pcm_plug_slave_size(pcm, channel, slave_params.frag_size);
-       slave_params.bytes_fill_max = snd_pcm_plug_slave_size(pcm, channel, slave_params.bytes_fill_max);
-       slave_params.bytes_min = snd_pcm_plug_slave_size(pcm, channel, slave_params.bytes_min);
-       slave_params.bytes_xrun_max = snd_pcm_plug_slave_size(pcm, channel, slave_params.bytes_xrun_max);
-       slave_params.bytes_align = snd_pcm_plug_slave_size(pcm, channel, slave_params.bytes_align);
-
-       pdprintf("params requested params: format = %i, rate = %i, voices = %i\n", slave_params.format.format, slave_params.format.rate, slave_params.format.voices);
-       err = snd_pcm_channel_params(plug->slave, &slave_params);
+       slave_params.buffer_size = snd_pcm_plug_slave_size(pcm, stream, slave_params.buffer_size);
+       slave_params.frag_size = snd_pcm_plug_slave_size(pcm, stream, slave_params.frag_size);
+       slave_params.bytes_fill_max = snd_pcm_plug_slave_size(pcm, stream, slave_params.bytes_fill_max);
+       slave_params.bytes_min = snd_pcm_plug_slave_size(pcm, stream, slave_params.bytes_min);
+       slave_params.bytes_xrun_max = snd_pcm_plug_slave_size(pcm, stream, slave_params.bytes_xrun_max);
+       slave_params.bytes_align = snd_pcm_plug_slave_size(pcm, stream, slave_params.bytes_align);
+
+       pdprintf("params requested params: format = %i, rate = %i, channels = %i\n", slave_params.format.format, slave_params.format.rate, slave_params.format.channels);
+       err = snd_pcm_stream_params(plug->slave, &slave_params);
        if (err < 0)
                return err;
 
-       err = snd_pcm_plug_action(pcm, channel, INIT, 0);
+       err = snd_pcm_plug_action(pcm, stream, INIT, 0);
        if (err < 0)
                return err;
        return 0;
 }
 
-static int snd_pcm_plug_channel_setup(snd_pcm_t *pcm, snd_pcm_channel_setup_t *setup)
+static int snd_pcm_plug_stream_setup(snd_pcm_t *pcm, snd_pcm_stream_setup_t *setup)
 {
        int err;
        snd_pcm_plug_t *plug = (snd_pcm_plug_t*) &pcm->private;
-       struct snd_pcm_plug_chan *plugchan;
+       struct snd_pcm_plug_stream *plugstr;
 
-       err = snd_pcm_channel_setup(plug->slave, setup);
+       err = snd_pcm_stream_setup(plug->slave, setup);
        if (err < 0)
                return err;
-       if (snd_pcm_plug_direct(pcm, setup->channel))
+       if (snd_pcm_plug_direct(pcm, setup->stream))
                return 0;
        setup->byte_boundary /= setup->frag_size;
-       setup->frag_size = snd_pcm_plug_client_size(pcm, setup->channel, setup->frag_size);
+       setup->frag_size = snd_pcm_plug_client_size(pcm, setup->stream, setup->frag_size);
        setup->byte_boundary *= setup->frag_size;
        setup->buffer_size = setup->frags * setup->frag_size;
-       setup->bytes_min = snd_pcm_plug_client_size(pcm, setup->channel, setup->bytes_min);
-       setup->bytes_align = snd_pcm_plug_client_size(pcm, setup->channel, setup->bytes_align);
-       setup->bytes_xrun_max = snd_pcm_plug_client_size(pcm, setup->channel, setup->bytes_xrun_max);
-       setup->bytes_fill_max = snd_pcm_plug_client_size(pcm, setup->channel, setup->bytes_fill_max);
-
-       plugchan = &plug->chan[setup->channel];
-       if (setup->channel == SND_PCM_CHANNEL_PLAYBACK)
-               setup->format = plugchan->first->src_format;
+       setup->bytes_min = snd_pcm_plug_client_size(pcm, setup->stream, setup->bytes_min);
+       setup->bytes_align = snd_pcm_plug_client_size(pcm, setup->stream, setup->bytes_align);
+       setup->bytes_xrun_max = snd_pcm_plug_client_size(pcm, setup->stream, setup->bytes_xrun_max);
+       setup->bytes_fill_max = snd_pcm_plug_client_size(pcm, setup->stream, setup->bytes_fill_max);
+
+       plugstr = &plug->stream[setup->stream];
+       if (setup->stream == SND_PCM_STREAM_PLAYBACK)
+               setup->format = plugstr->first->src_format;
        else
-               setup->format = plugchan->last->dst_format;
+               setup->format = plugstr->last->dst_format;
        return 0;       
 }
 
-static int snd_pcm_plug_channel_status(snd_pcm_t *pcm, snd_pcm_channel_status_t *status)
+static int snd_pcm_plug_stream_status(snd_pcm_t *pcm, snd_pcm_stream_status_t *status)
 {
        int err;
        snd_pcm_plug_t *plug = (snd_pcm_plug_t*) &pcm->private;
 
-       err = snd_pcm_channel_status(plug->slave, status);
+       err = snd_pcm_stream_status(plug->slave, status);
        if (err < 0)
                return err;
-       if (snd_pcm_plug_direct(pcm, status->channel))
+       if (snd_pcm_plug_direct(pcm, status->stream))
                return 0;
 
        /* FIXME: may overflow */
-       status->byte_io = snd_pcm_plug_client_size(pcm, status->channel, status->byte_io);
-       status->byte_data = snd_pcm_plug_client_size(pcm, status->channel, status->byte_data);
-       status->bytes_used = snd_pcm_plug_client_size(pcm, status->channel, status->bytes_used);
+       status->byte_io = snd_pcm_plug_client_size(pcm, status->stream, status->byte_io);
+       status->byte_data = snd_pcm_plug_client_size(pcm, status->stream, status->byte_data);
+       status->bytes_used = snd_pcm_plug_client_size(pcm, status->stream, status->bytes_used);
        return 0;       
 }
 
-static int snd_pcm_plug_channel_update(snd_pcm_t *pcm, int channel)
+static int snd_pcm_plug_stream_update(snd_pcm_t *pcm, int stream)
 {
        snd_pcm_plug_t *plug = (snd_pcm_plug_t*) &pcm->private;
        int err;
-       err = snd_pcm_channel_update(plug->slave, channel);
+       err = snd_pcm_stream_update(plug->slave, stream);
        if (err < 0)
                return err;
-       if (snd_pcm_plug_direct(pcm, channel))
+       if (snd_pcm_plug_direct(pcm, stream))
                return 0;
 #if 0
        /* To think more about that */
-       if ((err = snd_pcm_plug_action(pcm, channel, UPDATE, 0))<0)
+       if ((err = snd_pcm_plug_action(pcm, stream, UPDATE, 0))<0)
                return err;
 #endif
        return 0;
 }
 
-static int snd_pcm_plug_channel_prepare(snd_pcm_t *pcm, int channel)
+static int snd_pcm_plug_stream_prepare(snd_pcm_t *pcm, int stream)
 {
        snd_pcm_plug_t *plug = (snd_pcm_plug_t*) &pcm->private;
        int err;
-       err = snd_pcm_channel_prepare(plug->slave, channel);
+       err = snd_pcm_stream_prepare(plug->slave, stream);
        if (err < 0)
                return err;
-       if (snd_pcm_plug_direct(pcm, channel))
+       if (snd_pcm_plug_direct(pcm, stream))
                return 0;
-       if ((err = snd_pcm_plug_action(pcm, channel, PREPARE, 0))<0)
+       if ((err = snd_pcm_plug_action(pcm, stream, PREPARE, 0))<0)
                return err;
        return 0;
 }
 
-static int snd_pcm_plug_channel_go(snd_pcm_t *pcm, int channel)
+static int snd_pcm_plug_stream_go(snd_pcm_t *pcm, int stream)
 {
        snd_pcm_plug_t *plug = (snd_pcm_plug_t*) &pcm->private;
-       return snd_pcm_channel_go(plug->slave, channel);
+       return snd_pcm_stream_go(plug->slave, stream);
 }
 
 static int snd_pcm_plug_sync_go(snd_pcm_t *pcm, snd_pcm_sync_t *sync)
@@ -538,76 +538,76 @@ static int snd_pcm_plug_sync_go(snd_pcm_t *pcm, snd_pcm_sync_t *sync)
        return snd_pcm_sync_go(plug->slave, sync);
 }
 
-static int snd_pcm_plug_channel_drain(snd_pcm_t *pcm, int channel)
+static int snd_pcm_plug_stream_drain(snd_pcm_t *pcm, int stream)
 {
        snd_pcm_plug_t *plug = (snd_pcm_plug_t*) &pcm->private;
        int err;
 
-       if ((err = snd_pcm_channel_drain(plug->slave, channel)) < 0)
+       if ((err = snd_pcm_stream_drain(plug->slave, stream)) < 0)
                return err;
-       if (snd_pcm_plug_direct(pcm, channel))
+       if (snd_pcm_plug_direct(pcm, stream))
                return 0;
-       if ((err = snd_pcm_plug_action(pcm, channel, DRAIN, 0))<0)
+       if ((err = snd_pcm_plug_action(pcm, stream, DRAIN, 0))<0)
                return err;
        return 0;
 }
 
-static int snd_pcm_plug_channel_flush(snd_pcm_t *pcm, int channel)
+static int snd_pcm_plug_stream_flush(snd_pcm_t *pcm, int stream)
 {
        snd_pcm_plug_t *plug = (snd_pcm_plug_t*) &pcm->private;
        int err;
 
-       if ((err = snd_pcm_channel_flush(plug->slave, channel)) < 0)
+       if ((err = snd_pcm_stream_flush(plug->slave, stream)) < 0)
                return err;
-       if (snd_pcm_plug_direct(pcm, channel))
+       if (snd_pcm_plug_direct(pcm, stream))
                return 0;
-       if ((err = snd_pcm_plug_action(pcm, channel, FLUSH, 0))<0)
+       if ((err = snd_pcm_plug_action(pcm, stream, FLUSH, 0))<0)
                return err;
        return 0;
 }
 
-static int snd_pcm_plug_channel_pause(snd_pcm_t *pcm, int channel, int enable)
+static int snd_pcm_plug_stream_pause(snd_pcm_t *pcm, int stream, int enable)
 {
        snd_pcm_plug_t *plug = (snd_pcm_plug_t*) &pcm->private;
        int err;
        
-       if ((err = snd_pcm_channel_pause(plug->slave, channel, enable)) < 0)
+       if ((err = snd_pcm_stream_pause(plug->slave, stream, enable)) < 0)
                return err;
-       if ((err = snd_pcm_plug_action(pcm, channel, PAUSE, 0))<0)
+       if ((err = snd_pcm_plug_action(pcm, stream, PAUSE, 0))<0)
                return err;
        return 0;
 }
 
-static int snd_pcm_plug_voice_setup(snd_pcm_t *pcm, int channel, snd_pcm_voice_setup_t *setup)
+static int snd_pcm_plug_channel_setup(snd_pcm_t *pcm, int stream, snd_pcm_channel_setup_t *setup)
 {
        snd_pcm_plug_t *plug = (snd_pcm_plug_t*) &pcm->private;
-       struct snd_pcm_chan *chan;
-       unsigned int voice;
+       struct snd_pcm_stream *str;
+       unsigned int channel;
        int width;
 
-       if (snd_pcm_plug_direct(pcm, channel))
-               return snd_pcm_voice_setup(plug->slave, channel, setup);
+       if (snd_pcm_plug_direct(pcm, stream))
+               return snd_pcm_channel_setup(plug->slave, stream, setup);
 
-        voice = setup->voice;
+        channel = setup->channel;
         memset(setup, 0, sizeof(*setup));
-        setup->voice = voice;
-       chan = &pcm->chan[channel];
-       if (!chan->mmap_data) {
+        setup->channel = channel;
+       str = &pcm->stream[stream];
+       if (!str->mmap_data) {
                setup->area.addr = 0;
                return 0;
        }
-       if (voice >= chan->setup.format.voices)
+       if (channel >= str->setup.format.channels)
                return -EINVAL;
 
-       if (chan->setup.format.interleave) {
-                setup->area.addr = chan->mmap_data;
-                setup->area.first = setup->voice * chan->sample_width;
-                setup->area.step = chan->bits_per_frame;
+       if (str->setup.format.interleave) {
+                setup->area.addr = str->mmap_data;
+                setup->area.first = setup->channel * str->sample_width;
+                setup->area.step = str->bits_per_frame;
         } else {
-               size_t size = chan->mmap_data_size / chan->setup.format.voices;
-                setup->area.addr = chan->mmap_data + setup->voice * size;
+               size_t size = str->mmap_data_size / str->setup.format.channels;
+                setup->area.addr = str->mmap_data + setup->channel * size;
                 setup->area.first = 0;
-                setup->area.step = chan->sample_width;
+                setup->area.step = str->sample_width;
        }
        return 0;
 }
@@ -615,26 +615,26 @@ static int snd_pcm_plug_voice_setup(snd_pcm_t *pcm, int channel, snd_pcm_voice_s
 ssize_t snd_pcm_plug_writev(snd_pcm_t *pcm, const struct iovec *vector, unsigned long count)
 {
        snd_pcm_plug_t *plug = (snd_pcm_plug_t*) &pcm->private;
-       struct snd_pcm_chan *chan = &pcm->chan[SND_PCM_CHANNEL_PLAYBACK];
-       unsigned int k, step, voices;
+       struct snd_pcm_stream *str = &pcm->stream[SND_PCM_STREAM_PLAYBACK];
+       unsigned int k, step, channels;
        int size = 0;
-       if (snd_pcm_plug_direct(pcm, SND_PCM_CHANNEL_PLAYBACK))
+       if (snd_pcm_plug_direct(pcm, SND_PCM_STREAM_PLAYBACK))
                return snd_pcm_writev(plug->slave, vector, count);
-       voices = chan->setup.format.voices;
-       if (chan->setup.format.interleave)
+       channels = str->setup.format.channels;
+       if (str->setup.format.interleave)
                step = 1;
        else {
-               step = voices;
-               if (count % voices != 0)
+               step = channels;
+               if (count % channels != 0)
                        return -EINVAL;
        }
        for (k = 0; k < count; k += step, vector += step) {
-               snd_pcm_plugin_voice_t *voices;
+               snd_pcm_plugin_channel_t *channels;
                int expected, ret;
-               expected = snd_pcm_plug_client_voices_iovec(pcm, SND_PCM_CHANNEL_PLAYBACK, vector, count, &voices);
+               expected = snd_pcm_plug_client_channels_iovec(pcm, SND_PCM_STREAM_PLAYBACK, vector, count, &channels);
                if (expected < 0)
                        return expected;
-               ret = snd_pcm_plug_write_transfer(pcm, voices, expected);
+               ret = snd_pcm_plug_write_transfer(pcm, channels, expected);
                if (ret < 0) {
                        if (size > 0)
                                return size;
@@ -650,26 +650,26 @@ ssize_t snd_pcm_plug_writev(snd_pcm_t *pcm, const struct iovec *vector, unsigned
 ssize_t snd_pcm_plug_readv(snd_pcm_t *pcm, const struct iovec *vector, unsigned long count)
 {
        snd_pcm_plug_t *plug = (snd_pcm_plug_t*) &pcm->private;
-       struct snd_pcm_chan *chan = &pcm->chan[SND_PCM_CHANNEL_CAPTURE];
-       unsigned int k, step, voices;
+       struct snd_pcm_stream *str = &pcm->stream[SND_PCM_STREAM_CAPTURE];
+       unsigned int k, step, channels;
        int size = 0;
-       if (snd_pcm_plug_direct(pcm, SND_PCM_CHANNEL_CAPTURE))
+       if (snd_pcm_plug_direct(pcm, SND_PCM_STREAM_CAPTURE))
                return snd_pcm_readv(plug->slave, vector, count);
-       voices = chan->setup.format.voices;
-       if (chan->setup.format.interleave)
+       channels = str->setup.format.channels;
+       if (str->setup.format.interleave)
                step = 1;
        else {
-               step = voices;
-               if (count % voices != 0)
+               step = channels;
+               if (count % channels != 0)
                        return -EINVAL;
        }
        for (k = 0; k < count; k += step) {
-               snd_pcm_plugin_voice_t *voices;
+               snd_pcm_plugin_channel_t *channels;
                int expected, ret;
-               expected = snd_pcm_plug_client_voices_iovec(pcm, SND_PCM_CHANNEL_CAPTURE, vector, count, &voices);
+               expected = snd_pcm_plug_client_channels_iovec(pcm, SND_PCM_STREAM_CAPTURE, vector, count, &channels);
                if (expected < 0)
                        return expected;
-               ret = snd_pcm_plug_read_transfer(pcm, voices, expected);
+               ret = snd_pcm_plug_read_transfer(pcm, channels, expected);
                if (ret < 0) {
                        if (size > 0)
                                return size;
@@ -686,96 +686,96 @@ ssize_t snd_pcm_plug_write(snd_pcm_t *pcm, const void *buf, size_t count)
 {
        snd_pcm_plug_t *plug = (snd_pcm_plug_t*) &pcm->private;
        int expected;
-       snd_pcm_plugin_voice_t *voices;
+       snd_pcm_plugin_channel_t *channels;
 
-       if (snd_pcm_plug_direct(pcm, SND_PCM_CHANNEL_PLAYBACK))
+       if (snd_pcm_plug_direct(pcm, SND_PCM_STREAM_PLAYBACK))
                return snd_pcm_write(plug->slave, buf, count);
-       expected = snd_pcm_plug_client_voices_buf(pcm, SND_PCM_CHANNEL_PLAYBACK, (char *)buf, count, &voices);
+       expected = snd_pcm_plug_client_channels_buf(pcm, SND_PCM_STREAM_PLAYBACK, (char *)buf, count, &channels);
        if (expected < 0)
                return expected;
-        return snd_pcm_plug_write_transfer(pcm, voices, expected);
+        return snd_pcm_plug_write_transfer(pcm, channels, expected);
 }
 
 ssize_t snd_pcm_plug_read(snd_pcm_t *pcm, void *buf, size_t count)
 {
        snd_pcm_plug_t *plug = (snd_pcm_plug_t*) &pcm->private;
        int expected;
-       snd_pcm_plugin_voice_t *voices;
+       snd_pcm_plugin_channel_t *channels;
 
-       if (snd_pcm_plug_direct(pcm, SND_PCM_CHANNEL_CAPTURE))
+       if (snd_pcm_plug_direct(pcm, SND_PCM_STREAM_CAPTURE))
                return snd_pcm_read(plug->slave, buf, count);
-       expected = snd_pcm_plug_client_voices_buf(pcm, SND_PCM_CHANNEL_CAPTURE, buf, count, &voices);
+       expected = snd_pcm_plug_client_channels_buf(pcm, SND_PCM_STREAM_CAPTURE, buf, count, &channels);
        if (expected < 0)
                return expected;
-       return snd_pcm_plug_read_transfer(pcm, voices, expected);
+       return snd_pcm_plug_read_transfer(pcm, channels, expected);
 }
 
-static int snd_pcm_plug_mmap_control(snd_pcm_t *pcm, int channel, snd_pcm_mmap_control_t **control, size_t csize UNUSED)
+static int snd_pcm_plug_mmap_control(snd_pcm_t *pcm, int stream, snd_pcm_mmap_control_t **control, size_t csize UNUSED)
 {
        snd_pcm_plug_t *plug = (snd_pcm_plug_t*) &pcm->private;
-       if (snd_pcm_plug_direct(pcm, channel))
-               return snd_pcm_mmap_control(plug->slave, channel, control);
+       if (snd_pcm_plug_direct(pcm, stream))
+               return snd_pcm_mmap_control(plug->slave, stream, control);
        return -EBADFD;
 }
 
-static int snd_pcm_plug_mmap_data(snd_pcm_t *pcm, int channel, void **buffer, size_t bsize UNUSED)
+static int snd_pcm_plug_mmap_data(snd_pcm_t *pcm, int stream, void **buffer, size_t bsize UNUSED)
 {
        snd_pcm_plug_t *plug = (snd_pcm_plug_t*) &pcm->private;
-       if (snd_pcm_plug_direct(pcm, channel))
-               return snd_pcm_mmap_data(plug->slave, channel, buffer);
+       if (snd_pcm_plug_direct(pcm, stream))
+               return snd_pcm_mmap_data(plug->slave, stream, buffer);
        return -EBADFD;
 }
 
-static int snd_pcm_plug_munmap_control(snd_pcm_t *pcm, int channel, snd_pcm_mmap_control_t *control UNUSED, size_t csize UNUSED)
+static int snd_pcm_plug_munmap_control(snd_pcm_t *pcm, int stream, snd_pcm_mmap_control_t *control UNUSED, size_t csize UNUSED)
 {
        snd_pcm_plug_t *plug = (snd_pcm_plug_t*) &pcm->private;
-       if (snd_pcm_plug_direct(pcm, channel))
-               return snd_pcm_munmap_control(plug->slave, channel);
+       if (snd_pcm_plug_direct(pcm, stream))
+               return snd_pcm_munmap_control(plug->slave, stream);
        return -EBADFD;
 }
                
-static int snd_pcm_plug_munmap_data(snd_pcm_t *pcm, int channel, void *buffer UNUSED, size_t size UNUSED)
+static int snd_pcm_plug_munmap_data(snd_pcm_t *pcm, int stream, void *buffer UNUSED, size_t size UNUSED)
 {
        snd_pcm_plug_t *plug = (snd_pcm_plug_t*) &pcm->private;
-       if (snd_pcm_plug_direct(pcm, channel))
-               return snd_pcm_munmap_data(plug->slave, channel);
+       if (snd_pcm_plug_direct(pcm, stream))
+               return snd_pcm_munmap_data(plug->slave, stream);
        return -EBADFD;
 }
                
-static int snd_pcm_plug_voices_mask(snd_pcm_t *pcm, int channel,
+static int snd_pcm_plug_channels_mask(snd_pcm_t *pcm, int stream,
                                    bitset_t *client_vmask)
 {
        snd_pcm_plug_t *plug = (snd_pcm_plug_t*) &pcm->private;
-       if (snd_pcm_plug_direct(pcm, channel))
-               return snd_pcm_voices_mask(plug->slave, channel, client_vmask);
-       if (channel == SND_PCM_CHANNEL_PLAYBACK)
-               return snd_pcm_plug_playback_voices_mask(pcm, client_vmask);
+       if (snd_pcm_plug_direct(pcm, stream))
+               return snd_pcm_channels_mask(plug->slave, stream, client_vmask);
+       if (stream == SND_PCM_STREAM_PLAYBACK)
+               return snd_pcm_plug_playback_channels_mask(pcm, client_vmask);
        else
-               return snd_pcm_plug_capture_voices_mask(pcm, client_vmask);
+               return snd_pcm_plug_capture_channels_mask(pcm, client_vmask);
 }
 
-int snd_pcm_plug_file_descriptor(snd_pcm_t* pcm, int channel)
+int snd_pcm_plug_file_descriptor(snd_pcm_t* pcm, int stream)
 {
        snd_pcm_plug_t *plug = (snd_pcm_plug_t*) &pcm->private;
-       return snd_pcm_file_descriptor(plug->slave, channel);
+       return snd_pcm_file_descriptor(plug->slave, stream);
 }
 
 struct snd_pcm_ops snd_pcm_plug_ops = {
-       channel_close: snd_pcm_plug_channel_close,
-       channel_nonblock: snd_pcm_plug_channel_nonblock,
+       stream_close: snd_pcm_plug_stream_close,
+       stream_nonblock: snd_pcm_plug_stream_nonblock,
        info: snd_pcm_plug_info,
-       channel_info: snd_pcm_plug_channel_info,
-       channel_params: snd_pcm_plug_channel_params,
+       stream_info: snd_pcm_plug_stream_info,
+       stream_params: snd_pcm_plug_stream_params,
+       stream_setup: snd_pcm_plug_stream_setup,
        channel_setup: snd_pcm_plug_channel_setup,
-       voice_setup: snd_pcm_plug_voice_setup,
-       channel_status: snd_pcm_plug_channel_status,
-       channel_update: snd_pcm_plug_channel_update,
-       channel_prepare: snd_pcm_plug_channel_prepare,
-       channel_go: snd_pcm_plug_channel_go,
+       stream_status: snd_pcm_plug_stream_status,
+       stream_update: snd_pcm_plug_stream_update,
+       stream_prepare: snd_pcm_plug_stream_prepare,
+       stream_go: snd_pcm_plug_stream_go,
        sync_go: snd_pcm_plug_sync_go,
-       channel_drain: snd_pcm_plug_channel_drain,
-       channel_flush: snd_pcm_plug_channel_flush,
-       channel_pause: snd_pcm_plug_channel_pause,
+       stream_drain: snd_pcm_plug_stream_drain,
+       stream_flush: snd_pcm_plug_stream_flush,
+       stream_pause: snd_pcm_plug_stream_pause,
        write: snd_pcm_plug_write,
        writev: snd_pcm_plug_writev,
        read: snd_pcm_plug_read,
@@ -785,7 +785,7 @@ struct snd_pcm_ops snd_pcm_plug_ops = {
        munmap_control: snd_pcm_plug_munmap_control,
        munmap_data: snd_pcm_plug_munmap_data,
        file_descriptor: snd_pcm_plug_file_descriptor,
-       voices_mask: snd_pcm_plug_voices_mask,
+       channels_mask: snd_pcm_plug_channels_mask,
 };
 
 int snd_pcm_plug_connect(snd_pcm_t **handle, snd_pcm_t *slave, int mode, int close_slave)
index adade0dc2e2b7224209e58774c9656d3fc1d3470..cf2c16db9df002a6dc1db623695cef476417552d 100644 (file)
@@ -29,7 +29,7 @@ and vice versa. The ADPCM code used is the Intel/DVI ADPCM code which
 is being recommended by the IMA Digital Audio Technical Working Group.
 
 The algorithm for this coder was taken from:
-Proposal for Standardized Audio Interchange Formats,
+Proposal for Standardized Audio Interstreamge Formats,
 IMA compatability project proceedings, Vol 2, Issue 2, May 1992.
 
 - No, this is *not* a G.721 coder/decoder. The algorithm used by G.721
@@ -74,32 +74,32 @@ static short StepSize[89] = {
 typedef struct {
        int pred_val;           /* Calculated predicted value */
        int step_idx;           /* Previous StepSize lookup index */
-} adpcm_voice_t;
+} adpcm_channel_t;
 
 typedef void (*adpcm_f)(snd_pcm_plugin_t *plugin,
-                       const snd_pcm_plugin_voice_t *src_voices,
-                       snd_pcm_plugin_voice_t *dst_voices,
+                       const snd_pcm_plugin_channel_t *src_channels,
+                       snd_pcm_plugin_channel_t *dst_channels,
                        size_t frames);
 
 typedef struct adpcm_private_data {
        adpcm_f func;
        int conv;
-       adpcm_voice_t voices[0];
+       adpcm_channel_t channels[0];
 } adpcm_t;
 
 
 static void adpcm_init(snd_pcm_plugin_t *plugin)
 {
-       unsigned int voice;
+       unsigned int channel;
        adpcm_t *data = (adpcm_t *)plugin->extra_data;
-       for (voice = 0; voice < plugin->src_format.voices; voice++) {
-               adpcm_voice_t *v = &data->voices[voice];
+       for (channel = 0; channel < plugin->src_format.channels; channel++) {
+               adpcm_channel_t *v = &data->channels[channel];
                v->pred_val = 0;
                v->step_idx = 0;
        }
 }
 
-static char adpcm_encoder(int sl, adpcm_voice_t * state)
+static char adpcm_encoder(int sl, adpcm_channel_t * state)
 {
        short diff;             /* Difference between sl and predicted sample */
        short pred_diff;        /* Predicted difference to next sample */
@@ -160,7 +160,7 @@ static char adpcm_encoder(int sl, adpcm_voice_t * state)
 }
 
 
-static int adpcm_decoder(unsigned char code, adpcm_voice_t * state)
+static int adpcm_decoder(unsigned char code, adpcm_channel_t * state)
 {
        short pred_diff;        /* Predicted difference to next sample */
        short step;             /* holds previous StepSize value */
@@ -211,8 +211,8 @@ static int adpcm_decoder(unsigned char code, adpcm_voice_t * state)
  */
 
 static void adpcm_decode(snd_pcm_plugin_t *plugin,
-                        const snd_pcm_plugin_voice_t *src_voices,
-                        snd_pcm_plugin_voice_t *dst_voices,
+                        const snd_pcm_plugin_channel_t *src_channels,
+                        snd_pcm_plugin_channel_t *dst_channels,
                         size_t frames)
 {
 #define PUT_S16_LABELS
@@ -220,29 +220,29 @@ static void adpcm_decode(snd_pcm_plugin_t *plugin,
 #undef PUT_S16_LABELS
        adpcm_t *data = (adpcm_t *)plugin->extra_data;
        void *put = put_s16_labels[data->conv];
-       int voice;
-       int nvoices = plugin->src_format.voices;
-       for (voice = 0; voice < nvoices; ++voice) {
+       int channel;
+       int nchannels = plugin->src_format.channels;
+       for (channel = 0; channel < nchannels; ++channel) {
                char *src;
                int srcbit;
                char *dst;
                int src_step, srcbit_step, dst_step;
                size_t frames1;
-               adpcm_voice_t *state;
-               if (!src_voices[voice].enabled) {
-                       if (dst_voices[voice].wanted)
-                               snd_pcm_area_silence(&dst_voices[voice].area, 0, frames, plugin->dst_format.format);
-                       dst_voices[voice].enabled = 0;
+               adpcm_channel_t *state;
+               if (!src_channels[channel].enabled) {
+                       if (dst_channels[channel].wanted)
+                               snd_pcm_area_silence(&dst_channels[channel].area, 0, frames, plugin->dst_format.format);
+                       dst_channels[channel].enabled = 0;
                        continue;
                }
-               dst_voices[voice].enabled = 1;
-               src = src_voices[voice].area.addr + src_voices[voice].area.first / 8;
-               srcbit = src_voices[voice].area.first % 8;
-               dst = dst_voices[voice].area.addr + dst_voices[voice].area.first / 8;
-               src_step = src_voices[voice].area.step / 8;
-               srcbit_step = src_voices[voice].area.step % 8;
-               dst_step = dst_voices[voice].area.step / 8;
-               state = &data->voices[voice];
+               dst_channels[channel].enabled = 1;
+               src = src_channels[channel].area.addr + src_channels[channel].area.first / 8;
+               srcbit = src_channels[channel].area.first % 8;
+               dst = dst_channels[channel].area.addr + dst_channels[channel].area.first / 8;
+               src_step = src_channels[channel].area.step / 8;
+               srcbit_step = src_channels[channel].area.step % 8;
+               dst_step = dst_channels[channel].area.step / 8;
+               state = &data->channels[channel];
                frames1 = frames;
                while (frames1-- > 0) {
                        signed short sample;
@@ -269,8 +269,8 @@ static void adpcm_decode(snd_pcm_plugin_t *plugin,
 }
 
 static void adpcm_encode(snd_pcm_plugin_t *plugin,
-                       const snd_pcm_plugin_voice_t *src_voices,
-                       snd_pcm_plugin_voice_t *dst_voices,
+                       const snd_pcm_plugin_channel_t *src_channels,
+                       snd_pcm_plugin_channel_t *dst_channels,
                        size_t frames)
 {
 #define GET_S16_LABELS
@@ -278,30 +278,30 @@ static void adpcm_encode(snd_pcm_plugin_t *plugin,
 #undef GET_S16_LABELS
        adpcm_t *data = (adpcm_t *)plugin->extra_data;
        void *get = get_s16_labels[data->conv];
-       int voice;
-       int nvoices = plugin->src_format.voices;
+       int channel;
+       int nchannels = plugin->src_format.channels;
        signed short sample = 0;
-       for (voice = 0; voice < nvoices; ++voice) {
+       for (channel = 0; channel < nchannels; ++channel) {
                char *src;
                char *dst;
                int dstbit;
                int src_step, dst_step, dstbit_step;
                size_t frames1;
-               adpcm_voice_t *state;
-               if (!src_voices[voice].enabled) {
-                       if (dst_voices[voice].wanted)
-                               snd_pcm_area_silence(&dst_voices[voice].area, 0, frames, plugin->dst_format.format);
-                       dst_voices[voice].enabled = 0;
+               adpcm_channel_t *state;
+               if (!src_channels[channel].enabled) {
+                       if (dst_channels[channel].wanted)
+                               snd_pcm_area_silence(&dst_channels[channel].area, 0, frames, plugin->dst_format.format);
+                       dst_channels[channel].enabled = 0;
                        continue;
                }
-               dst_voices[voice].enabled = 1;
-               src = src_voices[voice].area.addr + src_voices[voice].area.first / 8;
-               dst = dst_voices[voice].area.addr + dst_voices[voice].area.first / 8;
-               dstbit = dst_voices[voice].area.first % 8;
-               src_step = src_voices[voice].area.step / 8;
-               dst_step = dst_voices[voice].area.step / 8;
-               dstbit_step = dst_voices[voice].area.step % 8;
-               state = &data->voices[voice];
+               dst_channels[channel].enabled = 1;
+               src = src_channels[channel].area.addr + src_channels[channel].area.first / 8;
+               dst = dst_channels[channel].area.addr + dst_channels[channel].area.first / 8;
+               dstbit = dst_channels[channel].area.first % 8;
+               src_step = src_channels[channel].area.step / 8;
+               dst_step = dst_channels[channel].area.step / 8;
+               dstbit_step = dst_channels[channel].area.step % 8;
+               state = &data->channels[channel];
                frames1 = frames;
                while (frames1-- > 0) {
                        int v;
@@ -327,34 +327,34 @@ static void adpcm_encode(snd_pcm_plugin_t *plugin,
 }
 
 static ssize_t adpcm_transfer(snd_pcm_plugin_t *plugin,
-                             const snd_pcm_plugin_voice_t *src_voices,
-                             snd_pcm_plugin_voice_t *dst_voices,
+                             const snd_pcm_plugin_channel_t *src_channels,
+                             snd_pcm_plugin_channel_t *dst_channels,
                              size_t frames)
 {
        adpcm_t *data;
-       unsigned int voice;
+       unsigned int channel;
 
-       if (plugin == NULL || src_voices == NULL || dst_voices == NULL)
+       if (plugin == NULL || src_channels == NULL || dst_channels == NULL)
                return -EFAULT;
        if (frames == 0)
                return 0;
-       for (voice = 0; voice < plugin->src_format.voices; voice++) {
+       for (channel = 0; channel < plugin->src_format.channels; channel++) {
                if (plugin->src_format.format == SND_PCM_SFMT_IMA_ADPCM) {
-                       if (src_voices[voice].area.first % 4 != 0 ||
-                           src_voices[voice].area.step % 4 != 0 ||
-                           dst_voices[voice].area.first % 8 != 0 ||
-                           dst_voices[voice].area.step % 8 != 0)
+                       if (src_channels[channel].area.first % 4 != 0 ||
+                           src_channels[channel].area.step % 4 != 0 ||
+                           dst_channels[channel].area.first % 8 != 0 ||
+                           dst_channels[channel].area.step % 8 != 0)
                                return -EINVAL;
                } else {
-                       if (src_voices[voice].area.first % 8 != 0 ||
-                           src_voices[voice].area.step % 8 != 0 ||
-                           dst_voices[voice].area.first % 4 != 0 ||
-                           dst_voices[voice].area.step % 4 != 0)
+                       if (src_channels[channel].area.first % 8 != 0 ||
+                           src_channels[channel].area.step % 8 != 0 ||
+                           dst_channels[channel].area.first % 4 != 0 ||
+                           dst_channels[channel].area.step % 4 != 0)
                                return -EINVAL;
                }
        }
        data = (adpcm_t *)plugin->extra_data;
-       data->func(plugin, src_voices, dst_voices, frames);
+       data->func(plugin, src_channels, dst_channels, frames);
        return frames;
 }
 
@@ -378,7 +378,7 @@ static int adpcm_action(snd_pcm_plugin_t * plugin,
 }
 
 int snd_pcm_plugin_build_adpcm(snd_pcm_plugin_handle_t *handle,
-                              int channel,
+                              int stream,
                               snd_pcm_format_t *src_format,
                               snd_pcm_format_t *dst_format,
                               snd_pcm_plugin_t **r_plugin)
@@ -395,7 +395,7 @@ int snd_pcm_plugin_build_adpcm(snd_pcm_plugin_handle_t *handle,
 
        if (src_format->rate != dst_format->rate)
                return -EINVAL;
-       if (src_format->voices != dst_format->voices)
+       if (src_format->channels != dst_format->channels)
                return -EINVAL;
 
        if (dst_format->format == SND_PCM_SFMT_IMA_ADPCM) {
@@ -411,11 +411,11 @@ int snd_pcm_plugin_build_adpcm(snd_pcm_plugin_handle_t *handle,
        if (!snd_pcm_format_linear(format->format))
                return -EINVAL;
 
-       err = snd_pcm_plugin_build(handle, channel,
+       err = snd_pcm_plugin_build(handle, stream,
                                   "Ima-ADPCM<->linear conversion",
                                   src_format,
                                   dst_format,
-                                  sizeof(adpcm_t) + src_format->voices * sizeof(adpcm_voice_t),
+                                  sizeof(adpcm_t) + src_format->channels * sizeof(adpcm_channel_t),
                                   &plugin);
        if (err < 0)
                return err;
index 11c32fd80265ae008b2c128f107bb00c427b746b..1be3c2b47ded9faa5066c488e7d1d7e8bca6d97a 100644 (file)
@@ -133,8 +133,8 @@ static int alaw2linear(unsigned char a_val)
  */
 
 typedef void (*alaw_f)(snd_pcm_plugin_t *plugin,
-                      const snd_pcm_plugin_voice_t *src_voices,
-                      snd_pcm_plugin_voice_t *dst_voices,
+                      const snd_pcm_plugin_channel_t *src_channels,
+                      snd_pcm_plugin_channel_t *dst_channels,
                       size_t frames);
 
 typedef struct alaw_private_data {
@@ -143,8 +143,8 @@ typedef struct alaw_private_data {
 } alaw_t;
 
 static void alaw_decode(snd_pcm_plugin_t *plugin,
-                       const snd_pcm_plugin_voice_t *src_voices,
-                       snd_pcm_plugin_voice_t *dst_voices,
+                       const snd_pcm_plugin_channel_t *src_channels,
+                       snd_pcm_plugin_channel_t *dst_channels,
                        size_t frames)
 {
 #define PUT_S16_LABELS
@@ -152,24 +152,24 @@ static void alaw_decode(snd_pcm_plugin_t *plugin,
 #undef PUT_S16_LABELS
        alaw_t *data = (alaw_t *)plugin->extra_data;
        void *put = put_s16_labels[data->conv];
-       int voice;
-       int nvoices = plugin->src_format.voices;
-       for (voice = 0; voice < nvoices; ++voice) {
+       int channel;
+       int nchannels = plugin->src_format.channels;
+       for (channel = 0; channel < nchannels; ++channel) {
                char *src;
                char *dst;
                int src_step, dst_step;
                size_t frames1;
-               if (!src_voices[voice].enabled) {
-                       if (dst_voices[voice].wanted)
-                               snd_pcm_area_silence(&dst_voices[voice].area, 0, frames, plugin->dst_format.format);
-                       dst_voices[voice].enabled = 0;
+               if (!src_channels[channel].enabled) {
+                       if (dst_channels[channel].wanted)
+                               snd_pcm_area_silence(&dst_channels[channel].area, 0, frames, plugin->dst_format.format);
+                       dst_channels[channel].enabled = 0;
                        continue;
                }
-               dst_voices[voice].enabled = 1;
-               src = src_voices[voice].area.addr + src_voices[voice].area.first / 8;
-               dst = dst_voices[voice].area.addr + dst_voices[voice].area.first / 8;
-               src_step = src_voices[voice].area.step / 8;
-               dst_step = dst_voices[voice].area.step / 8;
+               dst_channels[channel].enabled = 1;
+               src = src_channels[channel].area.addr + src_channels[channel].area.first / 8;
+               dst = dst_channels[channel].area.addr + dst_channels[channel].area.first / 8;
+               src_step = src_channels[channel].area.step / 8;
+               dst_step = dst_channels[channel].area.step / 8;
                frames1 = frames;
                while (frames1-- > 0) {
                        signed short sample = alaw2linear(*src);
@@ -185,8 +185,8 @@ static void alaw_decode(snd_pcm_plugin_t *plugin,
 }
 
 static void alaw_encode(snd_pcm_plugin_t *plugin,
-                       const snd_pcm_plugin_voice_t *src_voices,
-                       snd_pcm_plugin_voice_t *dst_voices,
+                       const snd_pcm_plugin_channel_t *src_channels,
+                       snd_pcm_plugin_channel_t *dst_channels,
                        size_t frames)
 {
 #define GET_S16_LABELS
@@ -194,25 +194,25 @@ static void alaw_encode(snd_pcm_plugin_t *plugin,
 #undef GET_S16_LABELS
        alaw_t *data = (alaw_t *)plugin->extra_data;
        void *get = get_s16_labels[data->conv];
-       int voice;
-       int nvoices = plugin->src_format.voices;
+       int channel;
+       int nchannels = plugin->src_format.channels;
        signed short sample = 0;
-       for (voice = 0; voice < nvoices; ++voice) {
+       for (channel = 0; channel < nchannels; ++channel) {
                char *src;
                char *dst;
                int src_step, dst_step;
                size_t frames1;
-               if (!src_voices[voice].enabled) {
-                       if (dst_voices[voice].wanted)
-                               snd_pcm_area_silence(&dst_voices[voice].area, 0, frames, plugin->dst_format.format);
-                       dst_voices[voice].enabled = 0;
+               if (!src_channels[channel].enabled) {
+                       if (dst_channels[channel].wanted)
+                               snd_pcm_area_silence(&dst_channels[channel].area, 0, frames, plugin->dst_format.format);
+                       dst_channels[channel].enabled = 0;
                        continue;
                }
-               dst_voices[voice].enabled = 1;
-               src = src_voices[voice].area.addr + src_voices[voice].area.first / 8;
-               dst = dst_voices[voice].area.addr + dst_voices[voice].area.first / 8;
-               src_step = src_voices[voice].area.step / 8;
-               dst_step = dst_voices[voice].area.step / 8;
+               dst_channels[channel].enabled = 1;
+               src = src_channels[channel].area.addr + src_channels[channel].area.first / 8;
+               dst = dst_channels[channel].area.addr + dst_channels[channel].area.first / 8;
+               src_step = src_channels[channel].area.step / 8;
+               dst_step = dst_channels[channel].area.step / 8;
                frames1 = frames;
                while (frames1-- > 0) {
                        goto *get;
@@ -228,32 +228,32 @@ static void alaw_encode(snd_pcm_plugin_t *plugin,
 }
 
 static ssize_t alaw_transfer(snd_pcm_plugin_t *plugin,
-                            const snd_pcm_plugin_voice_t *src_voices,
-                            snd_pcm_plugin_voice_t *dst_voices,
+                            const snd_pcm_plugin_channel_t *src_channels,
+                            snd_pcm_plugin_channel_t *dst_channels,
                             size_t frames)
 {
        alaw_t *data;
-       unsigned int voice;
+       unsigned int channel;
 
-       if (plugin == NULL || src_voices == NULL || dst_voices == NULL)
+       if (plugin == NULL || src_channels == NULL || dst_channels == NULL)
                return -EFAULT;
        if (frames == 0)
                return 0;
-       for (voice = 0; voice < plugin->src_format.voices; voice++) {
-               if (src_voices[voice].area.first % 8 != 0 || 
-                   src_voices[voice].area.step % 8 != 0)
+       for (channel = 0; channel < plugin->src_format.channels; channel++) {
+               if (src_channels[channel].area.first % 8 != 0 || 
+                   src_channels[channel].area.step % 8 != 0)
                        return -EINVAL;
-               if (dst_voices[voice].area.first % 8 != 0 || 
-                   dst_voices[voice].area.step % 8 != 0)
+               if (dst_channels[channel].area.first % 8 != 0 || 
+                   dst_channels[channel].area.step % 8 != 0)
                        return -EINVAL;
        }
        data = (alaw_t *)plugin->extra_data;
-       data->func(plugin, src_voices, dst_voices, frames);
+       data->func(plugin, src_channels, dst_channels, frames);
         return frames;
 }
 
 int snd_pcm_plugin_build_alaw(snd_pcm_plugin_handle_t *handle,
-                             int channel,
+                             int stream,
                              snd_pcm_format_t *src_format,
                              snd_pcm_format_t *dst_format,
                              snd_pcm_plugin_t **r_plugin)
@@ -270,7 +270,7 @@ int snd_pcm_plugin_build_alaw(snd_pcm_plugin_handle_t *handle,
 
        if (src_format->rate != dst_format->rate)
                return -EINVAL;
-       if (src_format->voices != dst_format->voices)
+       if (src_format->channels != dst_format->channels)
                return -EINVAL;
 
        if (dst_format->format == SND_PCM_SFMT_A_LAW) {
@@ -286,7 +286,7 @@ int snd_pcm_plugin_build_alaw(snd_pcm_plugin_handle_t *handle,
        if (!snd_pcm_format_linear(format->format))
                return -EINVAL;
 
-       err = snd_pcm_plugin_build(handle, channel,
+       err = snd_pcm_plugin_build(handle, stream,
                                   "A-Law<->linear conversion",
                                   src_format,
                                   dst_format,
index 8615e13c36de1267fd4021b625e76663d5f465b3..450fb3e6b5c4d7436bbafea01dd1f15367c72e10 100644 (file)
 #endif
 
 static ssize_t copy_transfer(snd_pcm_plugin_t *plugin,
-                            const snd_pcm_plugin_voice_t *src_voices,
-                            snd_pcm_plugin_voice_t *dst_voices,
+                            const snd_pcm_plugin_channel_t *src_channels,
+                            snd_pcm_plugin_channel_t *dst_channels,
                             size_t frames)
 {
-       unsigned int voice;
-       unsigned int nvoices;
+       unsigned int channel;
+       unsigned int nchannels;
 
-       if (plugin == NULL || src_voices == NULL || dst_voices == NULL)
+       if (plugin == NULL || src_channels == NULL || dst_channels == NULL)
                return -EFAULT;
        if (frames == 0)
                return 0;
-       nvoices = plugin->src_format.voices;
-       for (voice = 0; voice < nvoices; voice++) {
-               if (src_voices->area.first % 8 != 0 || 
-                   src_voices->area.step % 8 != 0)
+       nchannels = plugin->src_format.channels;
+       for (channel = 0; channel < nchannels; channel++) {
+               if (src_channels->area.first % 8 != 0 || 
+                   src_channels->area.step % 8 != 0)
                        return -EINVAL;
-               if (dst_voices->area.first % 8 != 0 || 
-                   dst_voices->area.step % 8 != 0)
+               if (dst_channels->area.first % 8 != 0 || 
+                   dst_channels->area.step % 8 != 0)
                        return -EINVAL;
-               if (!src_voices->enabled) {
-                       if (dst_voices->wanted)
-                               snd_pcm_area_silence(&dst_voices->area, 0, frames, plugin->dst_format.format);
-                       dst_voices->enabled = 0;
+               if (!src_channels->enabled) {
+                       if (dst_channels->wanted)
+                               snd_pcm_area_silence(&dst_channels->area, 0, frames, plugin->dst_format.format);
+                       dst_channels->enabled = 0;
                        continue;
                }
-               dst_voices->enabled = 1;
-               snd_pcm_area_copy(&src_voices->area, 0, &dst_voices->area, 0, frames, plugin->src_format.format);
-               src_voices++;
-               dst_voices++;
+               dst_channels->enabled = 1;
+               snd_pcm_area_copy(&src_channels->area, 0, &dst_channels->area, 0, frames, plugin->src_format.format);
+               src_channels++;
+               dst_channels++;
        }
        return frames;
 }
 
 int snd_pcm_plugin_build_copy(snd_pcm_plugin_handle_t *handle,
-                             int channel,
+                             int stream,
                              snd_pcm_format_t *src_format,
                              snd_pcm_format_t *dst_format,
                              snd_pcm_plugin_t **r_plugin)
@@ -87,14 +87,14 @@ int snd_pcm_plugin_build_copy(snd_pcm_plugin_handle_t *handle,
                return -EINVAL;
        if (src_format->rate != dst_format->rate)
                return -EINVAL;
-       if (src_format->voices != dst_format->voices)
+       if (src_format->channels != dst_format->channels)
                return -EINVAL;
 
        width = snd_pcm_format_physical_width(src_format->format);
        if (width < 0)
                return -EINVAL;
 
-       err = snd_pcm_plugin_build(handle, channel,
+       err = snd_pcm_plugin_build(handle, stream,
                                   "copy",
                                   src_format,
                                   dst_format,
index edfcda264129d9089bda8761a83416f89c68ee6b..f4561f6f4cdc034bc34f49394c01492c7a88cf31 100644 (file)
@@ -46,14 +46,14 @@ typedef struct io_private_data {
 } io_t;
 
 static ssize_t io_transfer(snd_pcm_plugin_t *plugin,
-                             const snd_pcm_plugin_voice_t *src_voices,
-                             snd_pcm_plugin_voice_t *dst_voices,
+                             const snd_pcm_plugin_channel_t *src_channels,
+                             snd_pcm_plugin_channel_t *dst_channels,
                              size_t frames)
 {
        io_t *data;
        ssize_t result;
        struct iovec *vec;
-       int count, voice;
+       int count, channel;
 
        if (plugin == NULL)
                return -EINVAL;
@@ -61,48 +61,48 @@ static ssize_t io_transfer(snd_pcm_plugin_t *plugin,
        if (data == NULL)
                return -EINVAL;
        vec = (struct iovec *)((char *)data + sizeof(*data));
-       if (plugin->channel == SND_PCM_CHANNEL_PLAYBACK) {
-               if (src_voices == NULL)
+       if (plugin->stream == SND_PCM_STREAM_PLAYBACK) {
+               if (src_channels == NULL)
                        return -EINVAL;
                if ((result = snd_pcm_plugin_src_frames_to_size(plugin, frames)) < 0)
                        return result;
-               count = plugin->src_format.voices;
+               count = plugin->src_format.channels;
                if (plugin->src_format.interleave) {
-                       result = snd_pcm_write(data->slave, src_voices->area.addr, result);
+                       result = snd_pcm_write(data->slave, src_channels->area.addr, result);
                } else {
                        result /= count;
-                       for (voice = 0; voice < count; voice++) {
-                               if (src_voices[voice].enabled)
-                                       vec[voice].iov_base = src_voices[voice].area.addr;
+                       for (channel = 0; channel < count; channel++) {
+                               if (src_channels[channel].enabled)
+                                       vec[channel].iov_base = src_channels[channel].area.addr;
                                else
-                                       vec[voice].iov_base = 0;
-                               vec[voice].iov_len = result;
+                                       vec[channel].iov_base = 0;
+                               vec[channel].iov_len = result;
                        }
                        result = snd_pcm_writev(data->slave, vec, count);
                }
                if (result < 0)
                        return result;
                return snd_pcm_plugin_src_size_to_frames(plugin, result);
-       } else if (plugin->channel == SND_PCM_CHANNEL_CAPTURE) {
-               if (dst_voices == NULL)
+       } else if (plugin->stream == SND_PCM_STREAM_CAPTURE) {
+               if (dst_channels == NULL)
                        return -EINVAL;
                if ((result = snd_pcm_plugin_dst_frames_to_size(plugin, frames)) < 0)
                        return result;
-               count = plugin->dst_format.voices;
+               count = plugin->dst_format.channels;
                if (plugin->dst_format.interleave) {
-                       result = snd_pcm_read(data->slave, dst_voices->area.addr, result);
-                       for (voice = 0; voice < count; voice++) {
-                               dst_voices[voice].enabled = src_voices[voice].enabled;
+                       result = snd_pcm_read(data->slave, dst_channels->area.addr, result);
+                       for (channel = 0; channel < count; channel++) {
+                               dst_channels[channel].enabled = src_channels[channel].enabled;
                        }
                } else {
                        result /= count;
-                       for (voice = 0; voice < count; voice++) {
-                               dst_voices[voice].enabled = src_voices[voice].enabled;
-                               if (dst_voices[voice].enabled)
-                                       vec[voice].iov_base = dst_voices[voice].area.addr;
+                       for (channel = 0; channel < count; channel++) {
+                               dst_channels[channel].enabled = src_channels[channel].enabled;
+                               if (dst_channels[channel].enabled)
+                                       vec[channel].iov_base = dst_channels[channel].area.addr;
                                else
-                                       vec[voice].iov_base = 0;
-                               vec[voice].iov_len = result;
+                                       vec[channel].iov_base = 0;
+                               vec[channel].iov_len = result;
                        }
                        result = snd_pcm_readv(data->slave, vec, count);
                }
@@ -114,24 +114,24 @@ static ssize_t io_transfer(snd_pcm_plugin_t *plugin,
        }
 }
  
-static ssize_t io_src_voices(snd_pcm_plugin_t *plugin,
+static ssize_t io_src_channels(snd_pcm_plugin_t *plugin,
                             size_t frames,
-                            snd_pcm_plugin_voice_t **voices)
+                            snd_pcm_plugin_channel_t **channels)
 {
        int err;
-       unsigned int voice;
-       snd_pcm_plugin_voice_t *v;
-       err = snd_pcm_plugin_client_voices(plugin, frames, &v);
+       unsigned int channel;
+       snd_pcm_plugin_channel_t *v;
+       err = snd_pcm_plugin_client_channels(plugin, frames, &v);
        if (err < 0)
                return err;
-       *voices = v;
-       for (voice = 0; voice < plugin->src_format.voices; ++voice, ++v)
+       *channels = v;
+       for (channel = 0; channel < plugin->src_format.channels; ++channel, ++v)
                v->wanted = 1;
        return frames;
 }
 
 int snd_pcm_plugin_build_io(snd_pcm_plugin_handle_t *pcm,
-                              int channel,
+                              int stream,
                               snd_pcm_plugin_handle_t *slave,
                               snd_pcm_format_t *format,
                               snd_pcm_plugin_t **r_plugin)
@@ -145,18 +145,18 @@ int snd_pcm_plugin_build_io(snd_pcm_plugin_handle_t *pcm,
        *r_plugin = NULL;
        if (pcm == NULL || format == NULL)
                return -EINVAL;
-       err = snd_pcm_plugin_build(pcm, channel,
+       err = snd_pcm_plugin_build(pcm, stream,
                                   "I/O io",
                                   format, format,
-                                  sizeof(io_t) + sizeof(struct iovec) * format->voices,
+                                  sizeof(io_t) + sizeof(struct iovec) * format->channels,
                                   &plugin);
        if (err < 0)
                return err;
        data = (io_t *)plugin->extra_data;
        data->slave = slave;
        plugin->transfer = io_transfer;
-       if (format->interleave && channel == SND_PCM_CHANNEL_PLAYBACK)
-               plugin->client_voices = io_src_voices;
+       if (format->interleave && stream == SND_PCM_STREAM_PLAYBACK)
+               plugin->client_channels = io_src_channels;
        *r_plugin = plugin;
        return 0;
 }
index a0e97630a326e87d7e80f1eb27823b62d1f7a0e2..6e232b30a64c68eb10b1f4d228b929b06c06fd47 100644 (file)
@@ -45,8 +45,8 @@ typedef struct linear_private_data {
 } linear_t;
 
 static void convert(snd_pcm_plugin_t *plugin,
-                   const snd_pcm_plugin_voice_t *src_voices,
-                   snd_pcm_plugin_voice_t *dst_voices,
+                   const snd_pcm_plugin_channel_t *src_channels,
+                   snd_pcm_plugin_channel_t *dst_channels,
                    size_t frames)
 {
 #define CONV_LABELS
@@ -54,24 +54,24 @@ static void convert(snd_pcm_plugin_t *plugin,
 #undef CONV_LABELS
        linear_t *data = (linear_t *)plugin->extra_data;
        void *conv = conv_labels[data->conv];
-       int voice;
-       int nvoices = plugin->src_format.voices;
-       for (voice = 0; voice < nvoices; ++voice) {
+       int channel;
+       int nchannels = plugin->src_format.channels;
+       for (channel = 0; channel < nchannels; ++channel) {
                char *src;
                char *dst;
                int src_step, dst_step;
                size_t frames1;
-               if (!src_voices[voice].enabled) {
-                       if (dst_voices[voice].wanted)
-                               snd_pcm_area_silence(&dst_voices[voice].area, 0, frames, plugin->dst_format.format);
-                       dst_voices[voice].enabled = 0;
+               if (!src_channels[channel].enabled) {
+                       if (dst_channels[channel].wanted)
+                               snd_pcm_area_silence(&dst_channels[channel].area, 0, frames, plugin->dst_format.format);
+                       dst_channels[channel].enabled = 0;
                        continue;
                }
-               dst_voices[voice].enabled = 1;
-               src = src_voices[voice].area.addr + src_voices[voice].area.first / 8;
-               dst = dst_voices[voice].area.addr + dst_voices[voice].area.first / 8;
-               src_step = src_voices[voice].area.step / 8;
-               dst_step = dst_voices[voice].area.step / 8;
+               dst_channels[channel].enabled = 1;
+               src = src_channels[channel].area.addr + src_channels[channel].area.first / 8;
+               dst = dst_channels[channel].area.addr + dst_channels[channel].area.first / 8;
+               src_step = src_channels[channel].area.step / 8;
+               dst_step = dst_channels[channel].area.step / 8;
                frames1 = frames;
                while (frames1-- > 0) {
                        goto *conv;
@@ -86,27 +86,27 @@ static void convert(snd_pcm_plugin_t *plugin,
 }
 
 static ssize_t linear_transfer(snd_pcm_plugin_t *plugin,
-                              const snd_pcm_plugin_voice_t *src_voices,
-                              snd_pcm_plugin_voice_t *dst_voices,
+                              const snd_pcm_plugin_channel_t *src_channels,
+                              snd_pcm_plugin_channel_t *dst_channels,
                               size_t frames)
 {
        linear_t *data;
-       unsigned int voice;
+       unsigned int channel;
 
-       if (plugin == NULL || src_voices == NULL || dst_voices == NULL)
+       if (plugin == NULL || src_channels == NULL || dst_channels == NULL)
                return -EFAULT;
        data = (linear_t *)plugin->extra_data;
        if (frames == 0)
                return 0;
-       for (voice = 0; voice < plugin->src_format.voices; voice++) {
-               if (src_voices[voice].area.first % 8 != 0 || 
-                   src_voices[voice].area.step % 8 != 0)
+       for (channel = 0; channel < plugin->src_format.channels; channel++) {
+               if (src_channels[channel].area.first % 8 != 0 || 
+                   src_channels[channel].area.step % 8 != 0)
                        return -EINVAL;
-               if (dst_voices[voice].area.first % 8 != 0 || 
-                   dst_voices[voice].area.step % 8 != 0)
+               if (dst_channels[channel].area.first % 8 != 0 || 
+                   dst_channels[channel].area.step % 8 != 0)
                        return -EINVAL;
        }
-       convert(plugin, src_voices, dst_voices, frames);
+       convert(plugin, src_channels, dst_channels, frames);
        return frames;
 }
 
@@ -138,7 +138,7 @@ int conv_index(int src_format, int dst_format)
 }
 
 int snd_pcm_plugin_build_linear(snd_pcm_plugin_handle_t *handle,
-                               int channel,
+                               int stream,
                                snd_pcm_format_t *src_format,
                                snd_pcm_format_t *dst_format,
                                snd_pcm_plugin_t **r_plugin)
@@ -153,13 +153,13 @@ int snd_pcm_plugin_build_linear(snd_pcm_plugin_handle_t *handle,
 
        if (src_format->rate != dst_format->rate)
                return -EINVAL;
-       if (src_format->voices != dst_format->voices)
+       if (src_format->channels != dst_format->channels)
                return -EINVAL;
        if (!(snd_pcm_format_linear(src_format->format) &&
              snd_pcm_format_linear(dst_format->format)))
                return -EINVAL;
 
-       err = snd_pcm_plugin_build(handle, channel,
+       err = snd_pcm_plugin_build(handle, stream,
                                   "linear format conversion",
                                   src_format,
                                   dst_format,
index 1ed764ff38f2231a71ed168ecf8bd7405da0dce8..7e54327b5f658977f7da19806d31462aa4dab193 100644 (file)
@@ -43,60 +43,60 @@ typedef struct mmap_private_data {
 } mmap_t;
 
 
-static ssize_t mmap_src_voices(snd_pcm_plugin_t *plugin,
+static ssize_t mmap_src_channels(snd_pcm_plugin_t *plugin,
                               size_t frames,
-                              snd_pcm_plugin_voice_t **voices)
+                              snd_pcm_plugin_channel_t **channels)
 {
        mmap_t *data;
-        snd_pcm_plugin_voice_t *sv;
-       snd_pcm_voice_area_t *dv;
-       struct snd_pcm_chan *chan;
-       snd_pcm_channel_setup_t *setup;
+        snd_pcm_plugin_channel_t *sv;
+       snd_pcm_channel_area_t *dv;
+       struct snd_pcm_stream *stream;
+       snd_pcm_stream_setup_t *setup;
        snd_pcm_mmap_control_t *ctrl;
        size_t pos;
        int ready;
-       unsigned int voice;
+       unsigned int channel;
 
-       if (plugin == NULL || voices == NULL)
+       if (plugin == NULL || channels == NULL)
                return -EINVAL;
        data = (mmap_t *)plugin->extra_data;
        ctrl = data->control;
-       chan = &data->slave->chan[plugin->channel];
+       stream = &data->slave->stream[plugin->stream];
 
-       setup = &chan->setup;
+       setup = &stream->setup;
        if (ctrl->status < SND_PCM_STATUS_PREPARED)
                return -EBADFD;
 
-       ready = snd_pcm_mmap_ready(data->slave, plugin->channel);
+       ready = snd_pcm_mmap_ready(data->slave, plugin->stream);
        if (ready < 0)
                return ready;
        if (!ready) {
                struct pollfd pfd;
                if (ctrl->status != SND_PCM_STATUS_RUNNING)
                        return -EPIPE;
-               if (chan->mode & SND_PCM_NONBLOCK)
+               if (stream->mode & SND_PCM_NONBLOCK)
                        return -EAGAIN;
-               pfd.fd = snd_pcm_file_descriptor(data->slave, plugin->channel);
+               pfd.fd = snd_pcm_file_descriptor(data->slave, plugin->stream);
                pfd.events = POLLOUT | POLLERR;
                ready = poll(&pfd, 1, 10000);
                if (ready < 0)
                        return ready;
                if (ready && pfd.revents & POLLERR)
                        return -EPIPE;
-               assert(snd_pcm_mmap_ready(data->slave, plugin->channel));
+               assert(snd_pcm_mmap_ready(data->slave, plugin->stream));
        }
        pos = ctrl->byte_data % setup->buffer_size;
-       if ((pos * 8) % chan->bits_per_frame != 0)
+       if ((pos * 8) % stream->bits_per_frame != 0)
                return -EINVAL;
-       pos = (pos * 8) / chan->bits_per_frame;
+       pos = (pos * 8) / stream->bits_per_frame;
 
-       sv = plugin->src_voices;
-       dv = chan->voices;
-       *voices = sv;
-       for (voice = 0; voice < plugin->src_format.voices; ++voice) {
+       sv = plugin->src_channels;
+       dv = stream->channels;
+       *channels = sv;
+       for (channel = 0; channel < plugin->src_format.channels; ++channel) {
                sv->enabled = 1;
 #if 0
-               sv->wanted = !data->silence[voice * setup->frags + f];
+               sv->wanted = !data->silence[channel * setup->frags + f];
 #else
                sv->wanted = 1;
 #endif
@@ -107,66 +107,66 @@ static ssize_t mmap_src_voices(snd_pcm_plugin_t *plugin,
                ++sv;
                ++dv;
        }
-       return snd_pcm_mmap_frames_xfer(data->slave, plugin->channel, frames);
+       return snd_pcm_mmap_frames_xfer(data->slave, plugin->stream, frames);
 }
 
-static ssize_t mmap_dst_voices(snd_pcm_plugin_t *plugin,
+static ssize_t mmap_dst_channels(snd_pcm_plugin_t *plugin,
                               size_t frames,
-                              snd_pcm_plugin_voice_t **voices)
+                              snd_pcm_plugin_channel_t **channels)
 {
        mmap_t *data;
        int err;
-       unsigned int voice;
-        snd_pcm_plugin_voice_t *dv;
-       snd_pcm_voice_area_t *sv;
-       struct snd_pcm_chan *chan;
-       snd_pcm_channel_setup_t *setup;
+       unsigned int channel;
+        snd_pcm_plugin_channel_t *dv;
+       snd_pcm_channel_area_t *sv;
+       struct snd_pcm_stream *stream;
+       snd_pcm_stream_setup_t *setup;
        snd_pcm_mmap_control_t *ctrl;
        size_t pos;
        int ready;
 
-       if (plugin == NULL || voices == NULL)
+       if (plugin == NULL || channels == NULL)
                return -EINVAL;
        data = (mmap_t *)plugin->extra_data;
-       chan = &data->slave->chan[plugin->channel];
+       stream = &data->slave->stream[plugin->stream];
 
-       setup = &chan->setup;
+       setup = &stream->setup;
        ctrl = data->control;
        if (ctrl->status < SND_PCM_STATUS_PREPARED)
                return -EBADFD;
        if (ctrl->status == SND_PCM_STATUS_PREPARED &&
-           chan->setup.start_mode == SND_PCM_START_DATA) {
-               err = snd_pcm_channel_go(data->slave, plugin->channel);
+           stream->setup.start_mode == SND_PCM_START_DATA) {
+               err = snd_pcm_stream_go(data->slave, plugin->stream);
                if (err < 0)
                        return err;
        }
-       ready = snd_pcm_mmap_ready(data->slave, plugin->channel);
+       ready = snd_pcm_mmap_ready(data->slave, plugin->stream);
        if (ready < 0)
                return ready;
        if (!ready) {
                struct pollfd pfd;
                if (ctrl->status != SND_PCM_STATUS_RUNNING)
                        return -EPIPE;
-               if (chan->mode & SND_PCM_NONBLOCK)
+               if (stream->mode & SND_PCM_NONBLOCK)
                        return -EAGAIN;
-               pfd.fd = snd_pcm_file_descriptor(data->slave, plugin->channel);
+               pfd.fd = snd_pcm_file_descriptor(data->slave, plugin->stream);
                pfd.events = POLLIN | POLLERR;
                ready = poll(&pfd, 1, 10000);
                if (ready < 0)
                        return ready;
                if (ready && pfd.revents & POLLERR)
                        return -EPIPE;
-               assert(snd_pcm_mmap_ready(data->slave, plugin->channel));
+               assert(snd_pcm_mmap_ready(data->slave, plugin->stream));
        }
        pos = ctrl->byte_data % setup->buffer_size;
-       if ((pos * 8) % chan->bits_per_frame != 0)
+       if ((pos * 8) % stream->bits_per_frame != 0)
                return -EINVAL;
-       pos = (pos * 8) / chan->bits_per_frame;
+       pos = (pos * 8) / stream->bits_per_frame;
 
-       sv = chan->voices;
-       dv = plugin->dst_voices;
-       *voices = dv;
-       for (voice = 0; voice < plugin->dst_format.voices; ++voice) {
+       sv = stream->channels;
+       dv = plugin->dst_channels;
+       *channels = dv;
+       for (channel = 0; channel < plugin->dst_format.channels; ++channel) {
                dv->enabled = 1;
                dv->wanted = 0;
                dv->aptr = 0;
@@ -176,46 +176,46 @@ static ssize_t mmap_dst_voices(snd_pcm_plugin_t *plugin,
                ++sv;
                ++dv;
        }
-       return snd_pcm_mmap_frames_xfer(data->slave, plugin->channel, frames);
+       return snd_pcm_mmap_frames_xfer(data->slave, plugin->stream, frames);
 }
 
 static ssize_t mmap_playback_transfer(snd_pcm_plugin_t *plugin,
-                                     const snd_pcm_plugin_voice_t *src_voices,
-                                     snd_pcm_plugin_voice_t *dst_voices UNUSED,
+                                     const snd_pcm_plugin_channel_t *src_channels,
+                                     snd_pcm_plugin_channel_t *dst_channels UNUSED,
                                      size_t frames)
 {
        mmap_t *data;
-       snd_pcm_channel_setup_t *setup;
+       snd_pcm_stream_setup_t *setup;
        snd_pcm_mmap_control_t *ctrl;
-       struct snd_pcm_chan *chan;
+       struct snd_pcm_stream *stream;
        int err;
 
        if (plugin == NULL)
                return -EINVAL;
        data = (mmap_t *)plugin->extra_data;
-       if (src_voices == NULL)
+       if (src_channels == NULL)
                return -EINVAL;
        if (plugin->prev == NULL)
                return -EINVAL;
        ctrl = data->control;
        if (ctrl == NULL)
                return -EINVAL;
-       chan = &data->slave->chan[SND_PCM_CHANNEL_PLAYBACK];
-       setup = &chan->setup;
+       stream = &data->slave->stream[SND_PCM_STREAM_PLAYBACK];
+       setup = &stream->setup;
 
 #if 0
-       for (voice = 0; voice < plugin->src_format.voices; voice++) {
-               if (src_voices[voice].enabled)
-                       data->silence[voice * setup->frags + f] = 0;
+       for (channel = 0; channel < plugin->src_format.channels; channel++) {
+               if (src_channels[channel].enabled)
+                       data->silence[channel * setup->frags + f] = 0;
        }
 #endif
 
-       snd_pcm_mmap_commit_frames(data->slave, SND_PCM_CHANNEL_PLAYBACK, frames);
+       snd_pcm_mmap_commit_frames(data->slave, SND_PCM_STREAM_PLAYBACK, frames);
        if (ctrl->status == SND_PCM_STATUS_PREPARED &&
-           (chan->setup.start_mode == SND_PCM_START_DATA ||
-            (chan->setup.start_mode == SND_PCM_START_FULL &&
-             !snd_pcm_mmap_ready(data->slave, plugin->channel)))) {
-               err = snd_pcm_channel_go(data->slave, plugin->channel);
+           (stream->setup.start_mode == SND_PCM_START_DATA ||
+            (stream->setup.start_mode == SND_PCM_START_FULL &&
+             !snd_pcm_mmap_ready(data->slave, plugin->stream)))) {
+               err = snd_pcm_stream_go(data->slave, plugin->stream);
                if (err < 0)
                        return err;
        }
@@ -223,12 +223,12 @@ static ssize_t mmap_playback_transfer(snd_pcm_plugin_t *plugin,
 }
  
 static ssize_t mmap_capture_transfer(snd_pcm_plugin_t *plugin,
-                                    const snd_pcm_plugin_voice_t *src_voices UNUSED,
-                                    snd_pcm_plugin_voice_t *dst_voices UNUSED,
+                                    const snd_pcm_plugin_channel_t *src_channels UNUSED,
+                                    snd_pcm_plugin_channel_t *dst_channels UNUSED,
                                     size_t frames)
 {
        mmap_t *data;
-       snd_pcm_channel_setup_t *setup;
+       snd_pcm_stream_setup_t *setup;
        snd_pcm_mmap_control_t *ctrl;
 
        if (plugin == NULL)
@@ -240,10 +240,10 @@ static ssize_t mmap_capture_transfer(snd_pcm_plugin_t *plugin,
        ctrl = data->control;
        if (ctrl == NULL)
                return -EINVAL;
-       setup = &data->slave->chan[SND_PCM_CHANNEL_CAPTURE].setup;
+       setup = &data->slave->stream[SND_PCM_STREAM_CAPTURE].setup;
 
        /* FIXME: not here the increment */
-       snd_pcm_mmap_commit_frames(data->slave, SND_PCM_CHANNEL_CAPTURE, frames);
+       snd_pcm_mmap_commit_frames(data->slave, SND_PCM_STREAM_CAPTURE, frames);
        return frames;
 }
  
@@ -257,20 +257,20 @@ static int mmap_action(snd_pcm_plugin_t *plugin,
                return -EINVAL;
        data = (mmap_t *)plugin->extra_data;
        if (action == INIT) {
-               snd_pcm_channel_setup_t *setup;
+               snd_pcm_stream_setup_t *setup;
                int result;
 
                if (data->control)
-                       snd_pcm_munmap(data->slave, plugin->channel);
-               result = snd_pcm_mmap(data->slave, plugin->channel, &data->control, (void **)&data->buffer);
+                       snd_pcm_munmap(data->slave, plugin->stream);
+               result = snd_pcm_mmap(data->slave, plugin->stream, &data->control, (void **)&data->buffer);
                if (result < 0)
                        return result;
-               setup = &data->slave->chan[plugin->channel].setup;
+               setup = &data->slave->stream[plugin->stream].setup;
 
 #if 0
-               if (plugin->channel == SND_PCM_CHANNEL_PLAYBACK) {
-                       data->silence = malloc(setup->frags * setup->format.voices);
-                       memset(data->silence, 0, setup->frags * setup->format.voices);
+               if (plugin->stream == SND_PCM_STREAM_PLAYBACK) {
+                       data->silence = malloc(setup->frags * setup->format.channels);
+                       memset(data->silence, 0, setup->frags * setup->format.channels);
                } else
                        data->silence = 0;
 #endif
@@ -291,11 +291,11 @@ static void mmap_free(snd_pcm_plugin_t *plugin, void *private_data UNUSED)
                free(data->silence);
 #endif
        if (data->control)
-               snd_pcm_munmap(data->slave, plugin->channel);
+               snd_pcm_munmap(data->slave, plugin->stream);
 }
  
 int snd_pcm_plugin_build_mmap(snd_pcm_plugin_handle_t *pcm,
-                             int channel,
+                             int stream,
                              snd_pcm_t *slave,
                              snd_pcm_format_t *format,
                              snd_pcm_plugin_t **r_plugin)
@@ -309,20 +309,20 @@ int snd_pcm_plugin_build_mmap(snd_pcm_plugin_handle_t *pcm,
        *r_plugin = NULL;
        if (!pcm)
                return -EINVAL;
-       err = snd_pcm_plugin_build(pcm, channel,
+       err = snd_pcm_plugin_build(pcm, stream,
                                   "I/O mmap",
                                   format, format,
-                                  sizeof(mmap_t) + sizeof(snd_pcm_plugin_voice_t) * format->voices,
+                                  sizeof(mmap_t) + sizeof(snd_pcm_plugin_channel_t) * format->channels,
                                   &plugin);
        if (err < 0)
                return err;
        data = (mmap_t *)plugin->extra_data;
        data->slave = slave;
-       if (channel == SND_PCM_CHANNEL_PLAYBACK) {
-               plugin->client_voices = mmap_src_voices;
+       if (stream == SND_PCM_STREAM_PLAYBACK) {
+               plugin->client_channels = mmap_src_channels;
                plugin->transfer = mmap_playback_transfer;
        } else {
-               plugin->client_voices = mmap_dst_voices;
+               plugin->client_channels = mmap_dst_channels;
                plugin->transfer = mmap_capture_transfer;
        }
        plugin->action = mmap_action;
index 1df5e39b92f20e8c1f7fb4b768c732a8331d348b..af82c29a43e0c9e4b4089c071b5c3ca68ef0012b 100644 (file)
@@ -149,8 +149,8 @@ static int ulaw2linear(unsigned char u_val)
  */
 
 typedef void (*mulaw_f)(snd_pcm_plugin_t *plugin,
-                       const snd_pcm_plugin_voice_t *src_voices,
-                       snd_pcm_plugin_voice_t *dst_voices,
+                       const snd_pcm_plugin_channel_t *src_channels,
+                       snd_pcm_plugin_channel_t *dst_channels,
                        size_t frames);
 
 typedef struct mulaw_private_data {
@@ -159,8 +159,8 @@ typedef struct mulaw_private_data {
 } mulaw_t;
 
 static void mulaw_decode(snd_pcm_plugin_t *plugin,
-                       const snd_pcm_plugin_voice_t *src_voices,
-                       snd_pcm_plugin_voice_t *dst_voices,
+                       const snd_pcm_plugin_channel_t *src_channels,
+                       snd_pcm_plugin_channel_t *dst_channels,
                        size_t frames)
 {
 #define PUT_S16_LABELS
@@ -168,24 +168,24 @@ static void mulaw_decode(snd_pcm_plugin_t *plugin,
 #undef PUT_S16_LABELS
        mulaw_t *data = (mulaw_t *)plugin->extra_data;
        void *put = put_s16_labels[data->conv];
-       int voice;
-       int nvoices = plugin->src_format.voices;
-       for (voice = 0; voice < nvoices; ++voice) {
+       int channel;
+       int nchannels = plugin->src_format.channels;
+       for (channel = 0; channel < nchannels; ++channel) {
                char *src;
                char *dst;
                int src_step, dst_step;
                size_t frames1;
-               if (!src_voices[voice].enabled) {
-                       if (dst_voices[voice].wanted)
-                               snd_pcm_area_silence(&dst_voices[voice].area, 0, frames, plugin->dst_format.format);
-                       dst_voices[voice].enabled = 0;
+               if (!src_channels[channel].enabled) {
+                       if (dst_channels[channel].wanted)
+                               snd_pcm_area_silence(&dst_channels[channel].area, 0, frames, plugin->dst_format.format);
+                       dst_channels[channel].enabled = 0;
                        continue;
                }
-               dst_voices[voice].enabled = 1;
-               src = src_voices[voice].area.addr + src_voices[voice].area.first / 8;
-               dst = dst_voices[voice].area.addr + dst_voices[voice].area.first / 8;
-               src_step = src_voices[voice].area.step / 8;
-               dst_step = dst_voices[voice].area.step / 8;
+               dst_channels[channel].enabled = 1;
+               src = src_channels[channel].area.addr + src_channels[channel].area.first / 8;
+               dst = dst_channels[channel].area.addr + dst_channels[channel].area.first / 8;
+               src_step = src_channels[channel].area.step / 8;
+               dst_step = dst_channels[channel].area.step / 8;
                frames1 = frames;
                while (frames1-- > 0) {
                        signed short sample = ulaw2linear(*src);
@@ -201,8 +201,8 @@ static void mulaw_decode(snd_pcm_plugin_t *plugin,
 }
 
 static void mulaw_encode(snd_pcm_plugin_t *plugin,
-                       const snd_pcm_plugin_voice_t *src_voices,
-                       snd_pcm_plugin_voice_t *dst_voices,
+                       const snd_pcm_plugin_channel_t *src_channels,
+                       snd_pcm_plugin_channel_t *dst_channels,
                        size_t frames)
 {
 #define GET_S16_LABELS
@@ -210,25 +210,25 @@ static void mulaw_encode(snd_pcm_plugin_t *plugin,
 #undef GET_S16_LABELS
        mulaw_t *data = (mulaw_t *)plugin->extra_data;
        void *get = get_s16_labels[data->conv];
-       int voice;
-       int nvoices = plugin->src_format.voices;
+       int channel;
+       int nchannels = plugin->src_format.channels;
        signed short sample = 0;
-       for (voice = 0; voice < nvoices; ++voice) {
+       for (channel = 0; channel < nchannels; ++channel) {
                char *src;
                char *dst;
                int src_step, dst_step;
                size_t frames1;
-               if (!src_voices[voice].enabled) {
-                       if (dst_voices[voice].wanted)
-                               snd_pcm_area_silence(&dst_voices[voice].area, 0, frames, plugin->dst_format.format);
-                       dst_voices[voice].enabled = 0;
+               if (!src_channels[channel].enabled) {
+                       if (dst_channels[channel].wanted)
+                               snd_pcm_area_silence(&dst_channels[channel].area, 0, frames, plugin->dst_format.format);
+                       dst_channels[channel].enabled = 0;
                        continue;
                }
-               dst_voices[voice].enabled = 1;
-               src = src_voices[voice].area.addr + src_voices[voice].area.first / 8;
-               dst = dst_voices[voice].area.addr + dst_voices[voice].area.first / 8;
-               src_step = src_voices[voice].area.step / 8;
-               dst_step = dst_voices[voice].area.step / 8;
+               dst_channels[channel].enabled = 1;
+               src = src_channels[channel].area.addr + src_channels[channel].area.first / 8;
+               dst = dst_channels[channel].area.addr + dst_channels[channel].area.first / 8;
+               src_step = src_channels[channel].area.step / 8;
+               dst_step = dst_channels[channel].area.step / 8;
                frames1 = frames;
                while (frames1-- > 0) {
                        goto *get;
@@ -244,32 +244,32 @@ static void mulaw_encode(snd_pcm_plugin_t *plugin,
 }
 
 static ssize_t mulaw_transfer(snd_pcm_plugin_t *plugin,
-                             const snd_pcm_plugin_voice_t *src_voices,
-                             snd_pcm_plugin_voice_t *dst_voices,
+                             const snd_pcm_plugin_channel_t *src_channels,
+                             snd_pcm_plugin_channel_t *dst_channels,
                              size_t frames)
 {
        mulaw_t *data;
-       unsigned int voice;
+       unsigned int channel;
 
-       if (plugin == NULL || src_voices == NULL || dst_voices == NULL)
+       if (plugin == NULL || src_channels == NULL || dst_channels == NULL)
                return -EFAULT;
        if (frames == 0)
                return 0;
-       for (voice = 0; voice < plugin->src_format.voices; voice++) {
-               if (src_voices[voice].area.first % 8 != 0 || 
-                   src_voices[voice].area.step % 8 != 0)
+       for (channel = 0; channel < plugin->src_format.channels; channel++) {
+               if (src_channels[channel].area.first % 8 != 0 || 
+                   src_channels[channel].area.step % 8 != 0)
                        return -EINVAL;
-               if (dst_voices[voice].area.first % 8 != 0 || 
-                   dst_voices[voice].area.step % 8 != 0)
+               if (dst_channels[channel].area.first % 8 != 0 || 
+                   dst_channels[channel].area.step % 8 != 0)
                        return -EINVAL;
        }
        data = (mulaw_t *)plugin->extra_data;
-       data->func(plugin, src_voices, dst_voices, frames);
+       data->func(plugin, src_channels, dst_channels, frames);
        return frames;
 }
 
 int snd_pcm_plugin_build_mulaw(snd_pcm_plugin_handle_t *handle,
-                              int channel,
+                              int stream,
                               snd_pcm_format_t *src_format,
                               snd_pcm_format_t *dst_format,
                               snd_pcm_plugin_t **r_plugin)
@@ -286,7 +286,7 @@ int snd_pcm_plugin_build_mulaw(snd_pcm_plugin_handle_t *handle,
 
        if (src_format->rate != dst_format->rate)
                return -EINVAL;
-       if (src_format->voices != dst_format->voices)
+       if (src_format->channels != dst_format->channels)
                return -EINVAL;
 
        if (dst_format->format == SND_PCM_SFMT_MU_LAW) {
@@ -302,7 +302,7 @@ int snd_pcm_plugin_build_mulaw(snd_pcm_plugin_handle_t *handle,
        if (!snd_pcm_format_linear(format->format))
                return -EINVAL;
 
-       err = snd_pcm_plugin_build(handle, channel,
+       err = snd_pcm_plugin_build(handle, stream,
                                   "Mu-Law<->linear conversion",
                                   src_format,
                                   dst_format,
index a7fb61464a177a30f1d8f7b461ff6cb5da9be138..55d85400d5ed007ffe8355fe66cd3a96c6b1aca5 100644 (file)
 typedef struct {
        signed short last_S1;
        signed short last_S2;
-} rate_voice_t;
+} rate_channel_t;
  
 typedef void (*rate_f)(snd_pcm_plugin_t *plugin,
-                      const snd_pcm_plugin_voice_t *src_voices,
-                      snd_pcm_plugin_voice_t *dst_voices,
+                      const snd_pcm_plugin_channel_t *src_channels,
+                      snd_pcm_plugin_channel_t *dst_channels,
                       int src_frames, int dst_frames);
 
 typedef struct rate_private_data {
@@ -58,34 +58,34 @@ typedef struct rate_private_data {
        rate_f func;
        int get, put;
        ssize_t old_src_frames, old_dst_frames;
-       rate_voice_t voices[0];
+       rate_channel_t channels[0];
 } rate_t;
 
 static void rate_init(snd_pcm_plugin_t *plugin)
 {
-       unsigned int voice;
+       unsigned int channel;
        rate_t *data = (rate_t *)plugin->extra_data;
        data->pos = 0;
-       for (voice = 0; voice < plugin->src_format.voices; voice++) {
-               data->voices[voice].last_S1 = 0;
-               data->voices[voice].last_S2 = 0;
+       for (channel = 0; channel < plugin->src_format.channels; channel++) {
+               data->channels[channel].last_S1 = 0;
+               data->channels[channel].last_S2 = 0;
        }
 }
 
 static void resample_expand(snd_pcm_plugin_t *plugin,
-                           const snd_pcm_plugin_voice_t *src_voices,
-                           snd_pcm_plugin_voice_t *dst_voices,
+                           const snd_pcm_plugin_channel_t *src_channels,
+                           snd_pcm_plugin_channel_t *dst_channels,
                            int src_frames, int dst_frames)
 {
        unsigned int pos = 0;
        signed int val;
        signed short S1, S2;
        char *src, *dst;
-       unsigned int voice;
+       unsigned int channel;
        int src_step, dst_step;
        int src_frames1, dst_frames1;
        rate_t *data = (rate_t *)plugin->extra_data;
-       rate_voice_t *rvoices = data->voices;
+       rate_channel_t *rchannels = data->channels;
 
 #define GET_S16_LABELS
 #define PUT_S16_LABELS
@@ -100,21 +100,21 @@ static void resample_expand(snd_pcm_plugin_t *plugin,
 #include "plugin_ops.h"
 #undef GET_S16_END
        
-       for (voice = 0; voice < plugin->src_format.voices; voice++, rvoices++) {
+       for (channel = 0; channel < plugin->src_format.channels; channel++, rchannels++) {
                pos = data->pos;
-               S1 = rvoices->last_S1;
-               S2 = rvoices->last_S2;
-               if (!src_voices[voice].enabled) {
-                       if (dst_voices[voice].wanted)
-                               snd_pcm_area_silence(&dst_voices[voice].area, 0, dst_frames, plugin->dst_format.format);
-                       dst_voices[voice].enabled = 0;
+               S1 = rchannels->last_S1;
+               S2 = rchannels->last_S2;
+               if (!src_channels[channel].enabled) {
+                       if (dst_channels[channel].wanted)
+                               snd_pcm_area_silence(&dst_channels[channel].area, 0, dst_frames, plugin->dst_format.format);
+                       dst_channels[channel].enabled = 0;
                        continue;
                }
-               dst_voices[voice].enabled = 1;
-               src = (char *)src_voices[voice].area.addr + src_voices[voice].area.first / 8;
-               dst = (char *)dst_voices[voice].area.addr + dst_voices[voice].area.first / 8;
-               src_step = src_voices[voice].area.step / 8;
-               dst_step = dst_voices[voice].area.step / 8;
+               dst_channels[channel].enabled = 1;
+               src = (char *)src_channels[channel].area.addr + src_channels[channel].area.first / 8;
+               dst = (char *)dst_channels[channel].area.addr + dst_channels[channel].area.first / 8;
+               src_step = src_channels[channel].area.step / 8;
+               dst_step = dst_channels[channel].area.step / 8;
                src_frames1 = src_frames;
                dst_frames1 = dst_frames;
                if (pos & ~MASK) {
@@ -153,27 +153,27 @@ static void resample_expand(snd_pcm_plugin_t *plugin,
                        dst += dst_step;
                        pos += data->pitch;
                }
-               rvoices->last_S1 = S1;
-               rvoices->last_S2 = S2;
-               rvoices++;
+               rchannels->last_S1 = S1;
+               rchannels->last_S2 = S2;
+               rchannels++;
        }
        data->pos = pos;
 }
 
 static void resample_shrink(snd_pcm_plugin_t *plugin,
-                           const snd_pcm_plugin_voice_t *src_voices,
-                           snd_pcm_plugin_voice_t *dst_voices,
+                           const snd_pcm_plugin_channel_t *src_channels,
+                           snd_pcm_plugin_channel_t *dst_channels,
                            int src_frames, int dst_frames)
 {
        unsigned int pos = 0;
        signed int val;
        signed short S1, S2;
        char *src, *dst;
-       unsigned int voice;
+       unsigned int channel;
        int src_step, dst_step;
        int src_frames1, dst_frames1;
        rate_t *data = (rate_t *)plugin->extra_data;
-       rate_voice_t *rvoices = data->voices;
+       rate_channel_t *rchannels = data->channels;
        
 #define GET_S16_LABELS
 #define PUT_S16_LABELS
@@ -184,21 +184,21 @@ static void resample_shrink(snd_pcm_plugin_t *plugin,
        void *put = put_s16_labels[data->put];
        signed short sample = 0;
 
-       for (voice = 0; voice < plugin->src_format.voices; ++voice) {
+       for (channel = 0; channel < plugin->src_format.channels; ++channel) {
                pos = data->pos;
-               S1 = rvoices->last_S1;
-               S2 = rvoices->last_S2;
-               if (!src_voices[voice].enabled) {
-                       if (dst_voices[voice].wanted)
-                               snd_pcm_area_silence(&dst_voices[voice].area, 0, dst_frames, plugin->dst_format.format);
-                       dst_voices[voice].enabled = 0;
+               S1 = rchannels->last_S1;
+               S2 = rchannels->last_S2;
+               if (!src_channels[channel].enabled) {
+                       if (dst_channels[channel].wanted)
+                               snd_pcm_area_silence(&dst_channels[channel].area, 0, dst_frames, plugin->dst_format.format);
+                       dst_channels[channel].enabled = 0;
                        continue;
                }
-               dst_voices[voice].enabled = 1;
-               src = (char *)src_voices[voice].area.addr + src_voices[voice].area.first / 8;
-               dst = (char *)dst_voices[voice].area.addr + dst_voices[voice].area.first / 8;
-               src_step = src_voices[voice].area.step / 8;
-               dst_step = dst_voices[voice].area.step / 8;
+               dst_channels[channel].enabled = 1;
+               src = (char *)src_channels[channel].area.addr + src_channels[channel].area.first / 8;
+               dst = (char *)dst_channels[channel].area.addr + dst_channels[channel].area.first / 8;
+               src_step = src_channels[channel].area.step / 8;
+               dst_step = dst_channels[channel].area.step / 8;
                src_frames1 = src_frames;
                dst_frames1 = dst_frames;
                while (dst_frames1 > 0) {
@@ -230,9 +230,9 @@ static void resample_shrink(snd_pcm_plugin_t *plugin,
                        }
                        pos += data->pitch;
                }
-               rvoices->last_S1 = S1;
-               rvoices->last_S2 = S2;
-               rvoices++;
+               rchannels->last_S1 = S1;
+               rchannels->last_S2 = S2;
+               rchannels++;
        }
        data->pos = pos;
 }
@@ -300,30 +300,30 @@ static ssize_t rate_dst_frames(snd_pcm_plugin_t *plugin, size_t frames)
 }
 
 static ssize_t rate_transfer(snd_pcm_plugin_t *plugin,
-                            const snd_pcm_plugin_voice_t *src_voices,
-                            snd_pcm_plugin_voice_t *dst_voices,
+                            const snd_pcm_plugin_channel_t *src_channels,
+                            snd_pcm_plugin_channel_t *dst_channels,
                             size_t frames)
 {
        size_t dst_frames;
-       unsigned int voice;
+       unsigned int channel;
        rate_t *data;
 
-       if (plugin == NULL || src_voices == NULL || dst_voices == NULL)
+       if (plugin == NULL || src_channels == NULL || dst_channels == NULL)
                return -EFAULT;
        if (frames == 0)
                return 0;
-       for (voice = 0; voice < plugin->src_format.voices; voice++) {
-               if (src_voices[voice].area.first % 8 != 0 || 
-                   src_voices[voice].area.step % 8 != 0)
+       for (channel = 0; channel < plugin->src_format.channels; channel++) {
+               if (src_channels[channel].area.first % 8 != 0 || 
+                   src_channels[channel].area.step % 8 != 0)
                        return -EINVAL;
-               if (dst_voices[voice].area.first % 8 != 0 || 
-                   dst_voices[voice].area.step % 8 != 0)
+               if (dst_channels[channel].area.first % 8 != 0 || 
+                   dst_channels[channel].area.step % 8 != 0)
                        return -EINVAL;
        }
 
        dst_frames = rate_dst_frames(plugin, frames);
        data = (rate_t *)plugin->extra_data;
-       data->func(plugin, src_voices, dst_voices, frames, dst_frames);
+       data->func(plugin, src_channels, dst_channels, frames, dst_frames);
        return dst_frames;
 }
 
@@ -347,7 +347,7 @@ static int rate_action(snd_pcm_plugin_t *plugin,
 }
 
 int snd_pcm_plugin_build_rate(snd_pcm_plugin_handle_t *handle,
-                             int channel,
+                             int stream,
                              snd_pcm_format_t *src_format,
                              snd_pcm_format_t *dst_format,
                              snd_pcm_plugin_t **r_plugin)
@@ -360,9 +360,9 @@ int snd_pcm_plugin_build_rate(snd_pcm_plugin_handle_t *handle,
                return -EINVAL;
        *r_plugin = NULL;
 
-       if (src_format->voices != dst_format->voices)
+       if (src_format->channels != dst_format->channels)
                return -EINVAL;
-       if (src_format->voices < 1)
+       if (src_format->channels < 1)
                return -EINVAL;
        if (snd_pcm_format_linear(src_format->format) <= 0)
                return -EINVAL;
@@ -371,11 +371,11 @@ int snd_pcm_plugin_build_rate(snd_pcm_plugin_handle_t *handle,
        if (src_format->rate == dst_format->rate)
                return -EINVAL;
 
-       err = snd_pcm_plugin_build(handle, channel,
+       err = snd_pcm_plugin_build(handle, stream,
                                   "rate conversion",
                                   src_format,
                                   dst_format,
-                                  sizeof(rate_t) + src_format->voices * sizeof(rate_voice_t),
+                                  sizeof(rate_t) + src_format->channels * sizeof(rate_channel_t),
                                   &plugin);
        if (err < 0)
                return err;
index f7d95f3f46b1320206349bfc694f531156adf6cc..3f19163263d3ed9e22af5b84b15154fcd0d0359e 100644 (file)
 typedef struct ttable_dst ttable_dst_t;
 typedef struct route_private_data route_t;
 
-typedef void (*route_voice_f)(snd_pcm_plugin_t *plugin,
-                             const snd_pcm_plugin_voice_t *src_voices,
-                             snd_pcm_plugin_voice_t *dst_voice,
+typedef void (*route_channel_f)(snd_pcm_plugin_t *plugin,
+                             const snd_pcm_plugin_channel_t *src_channels,
+                             snd_pcm_plugin_channel_t *dst_channel,
                              ttable_dst_t* ttable, size_t frames);
 
 typedef struct {
-       int voice;
+       int channel;
        int as_int;
 #if ROUTE_PLUGIN_USE_FLOAT
        float as_float;
@@ -64,7 +64,7 @@ struct ttable_dst {
        int att;        /* Attenuated */
        int nsrcs;
        ttable_src_t* srcs;
-       route_voice_f func;
+       route_channel_f func;
 };
 
 struct route_private_data {
@@ -84,19 +84,19 @@ typedef union {
 } sum_t;
 
 
-static void route_to_voice_from_zero(snd_pcm_plugin_t *plugin,
-                                    const snd_pcm_plugin_voice_t *src_voices UNUSED,
-                                    snd_pcm_plugin_voice_t *dst_voice,
+static void route_to_channel_from_zero(snd_pcm_plugin_t *plugin,
+                                    const snd_pcm_plugin_channel_t *src_channels UNUSED,
+                                    snd_pcm_plugin_channel_t *dst_channel,
                                     ttable_dst_t* ttable UNUSED, size_t frames)
 {
-       if (dst_voice->wanted)
-               snd_pcm_area_silence(&dst_voice->area, 0, frames, plugin->dst_format.format);
-       dst_voice->enabled = 0;
+       if (dst_channel->wanted)
+               snd_pcm_area_silence(&dst_channel->area, 0, frames, plugin->dst_format.format);
+       dst_channel->enabled = 0;
 }
 
-static void route_to_voice_from_one(snd_pcm_plugin_t *plugin,
-                                   const snd_pcm_plugin_voice_t *src_voices,
-                                   snd_pcm_plugin_voice_t *dst_voice,
+static void route_to_channel_from_one(snd_pcm_plugin_t *plugin,
+                                   const snd_pcm_plugin_channel_t *src_channels,
+                                   snd_pcm_plugin_channel_t *dst_channel,
                                    ttable_dst_t* ttable, size_t frames)
 {
 #define CONV_LABELS
@@ -104,26 +104,26 @@ static void route_to_voice_from_one(snd_pcm_plugin_t *plugin,
 #undef CONV_LABELS
        route_t *data = (route_t *)plugin->extra_data;
        void *conv;
-       const snd_pcm_plugin_voice_t *src_voice = 0;
+       const snd_pcm_plugin_channel_t *src_channel = 0;
        int srcidx;
        char *src, *dst;
        int src_step, dst_step;
        for (srcidx = 0; srcidx < ttable->nsrcs; ++srcidx) {
-               src_voice = &src_voices[ttable->srcs[srcidx].voice];
-               if (src_voice->area.addr != NULL)
+               src_channel = &src_channels[ttable->srcs[srcidx].channel];
+               if (src_channel->area.addr != NULL)
                        break;
        }
        if (srcidx == ttable->nsrcs) {
-               route_to_voice_from_zero(plugin, src_voices, dst_voice, ttable, frames);
+               route_to_channel_from_zero(plugin, src_channels, dst_channel, ttable, frames);
                return;
        }
 
-       dst_voice->enabled = 1;
+       dst_channel->enabled = 1;
        conv = conv_labels[data->conv];
-       src = src_voice->area.addr + src_voice->area.first / 8;
-       src_step = src_voice->area.step / 8;
-       dst = dst_voice->area.addr + dst_voice->area.first / 8;
-       dst_step = dst_voice->area.step / 8;
+       src = src_channel->area.addr + src_channel->area.first / 8;
+       src_step = src_channel->area.step / 8;
+       dst = dst_channel->area.addr + dst_channel->area.first / 8;
+       dst_step = dst_channel->area.step / 8;
        while (frames-- > 0) {
                goto *conv;
 #define CONV_END after
@@ -135,9 +135,9 @@ static void route_to_voice_from_one(snd_pcm_plugin_t *plugin,
        }
 }
 
-static void route_to_voice(snd_pcm_plugin_t *plugin,
-                          const snd_pcm_plugin_voice_t *src_voices,
-                          snd_pcm_plugin_voice_t *dst_voice,
+static void route_to_channel(snd_pcm_plugin_t *plugin,
+                          const snd_pcm_plugin_channel_t *src_channels,
+                          snd_pcm_plugin_channel_t *dst_channel,
                           ttable_dst_t* ttable, size_t frames)
 {
 #define GET_U_LABELS
@@ -196,31 +196,31 @@ static void route_to_voice(snd_pcm_plugin_t *plugin,
        u_int32_t sample = 0;
        int srcidx, srcidx1 = 0;
        for (srcidx = 0; srcidx < nsrcs; ++srcidx) {
-               const snd_pcm_plugin_voice_t *src_voice = &src_voices[ttable->srcs[srcidx].voice];
-               if (!src_voice->enabled)
+               const snd_pcm_plugin_channel_t *src_channel = &src_channels[ttable->srcs[srcidx].channel];
+               if (!src_channel->enabled)
                        continue;
-               srcs[srcidx1] = src_voice->area.addr + src_voices->area.first / 8;
-               src_steps[srcidx1] = src_voice->area.step / 8;
+               srcs[srcidx1] = src_channel->area.addr + src_channels->area.first / 8;
+               src_steps[srcidx1] = src_channel->area.step / 8;
                src_tt[srcidx1] = ttable->srcs[srcidx];
                srcidx1++;
        }
        nsrcs = srcidx1;
        if (nsrcs == 0) {
-               route_to_voice_from_zero(plugin, src_voices, dst_voice, ttable, frames);
+               route_to_channel_from_zero(plugin, src_channels, dst_channel, ttable, frames);
                return;
        } else if (nsrcs == 1 && src_tt[0].as_int == ROUTE_PLUGIN_RESOLUTION) {
-               route_to_voice_from_one(plugin, src_voices, dst_voice, ttable, frames);
+               route_to_channel_from_one(plugin, src_channels, dst_channel, ttable, frames);
                return;
        }
 
-       dst_voice->enabled = 1;
+       dst_channel->enabled = 1;
        zero = zero_labels[data->sum_type];
        get = get_u_labels[data->get];
        add = add_labels[data->sum_type * 2 + ttable->att];
        norm = norm_labels[data->sum_type * 8 + ttable->att * 4 + 4 - data->src_sample_size];
        put_u32 = put_u32_labels[data->put];
-       dst = dst_voice->area.addr + dst_voice->area.first / 8;
-       dst_step = dst_voice->area.step / 8;
+       dst = dst_channel->area.addr + dst_channel->area.first / 8;
+       dst_step = dst_channel->area.step / 8;
 
        while (frames-- > 0) {
                ttable_src_t *ttp = src_tt;
@@ -361,47 +361,47 @@ static void route_to_voice(snd_pcm_plugin_t *plugin,
        }
 }
 
-int route_src_voices_mask(snd_pcm_plugin_t *plugin,
+int route_src_channels_mask(snd_pcm_plugin_t *plugin,
                          bitset_t *dst_vmask,
                          bitset_t **src_vmask)
 {
        route_t *data = (route_t *)plugin->extra_data;
-       int svoices = plugin->src_format.voices;
-       int dvoices = plugin->dst_format.voices;
+       int schannels = plugin->src_format.channels;
+       int dchannels = plugin->dst_format.channels;
        bitset_t *vmask = plugin->src_vmask;
-       int voice;
+       int channel;
        ttable_dst_t *dp = data->ttable;
-       bitset_zero(vmask, svoices);
-       for (voice = 0; voice < dvoices; voice++, dp++) {
+       bitset_zero(vmask, schannels);
+       for (channel = 0; channel < dchannels; channel++, dp++) {
                int src;
                ttable_src_t *sp;
-               if (!bitset_get(dst_vmask, voice))
+               if (!bitset_get(dst_vmask, channel))
                        continue;
                sp = dp->srcs;
                for (src = 0; src < dp->nsrcs; src++, sp++)
-                       bitset_set(vmask, sp->voice);
+                       bitset_set(vmask, sp->channel);
        }
        *src_vmask = vmask;
        return 0;
 }
 
-int route_dst_voices_mask(snd_pcm_plugin_t *plugin,
+int route_dst_channels_mask(snd_pcm_plugin_t *plugin,
                          bitset_t *src_vmask,
                          bitset_t **dst_vmask)
 {
        route_t *data = (route_t *)plugin->extra_data;
-       int dvoices = plugin->dst_format.voices;
+       int dchannels = plugin->dst_format.channels;
        bitset_t *vmask = plugin->dst_vmask;
-       int voice;
+       int channel;
        ttable_dst_t *dp = data->ttable;
-       bitset_zero(vmask, dvoices);
-       for (voice = 0; voice < dvoices; voice++, dp++) {
+       bitset_zero(vmask, dchannels);
+       for (channel = 0; channel < dchannels; channel++, dp++) {
                int src;
                ttable_src_t *sp;
                sp = dp->srcs;
                for (src = 0; src < dp->nsrcs; src++, sp++) {
-                       if (bitset_get(src_vmask, sp->voice)) {
-                               bitset_set(vmask, voice);
+                       if (bitset_get(src_vmask, sp->channel)) {
+                               bitset_set(vmask, channel);
                                break;
                        }
                }
@@ -413,10 +413,10 @@ int route_dst_voices_mask(snd_pcm_plugin_t *plugin,
 static void route_free(snd_pcm_plugin_t *plugin, void* private_data UNUSED)
 {
        route_t *data = (route_t *)plugin->extra_data;
-       unsigned int dst_voice;
-       for (dst_voice = 0; dst_voice < plugin->dst_format.voices; ++dst_voice) {
-               if (data->ttable[dst_voice].srcs != NULL)
-                       free(data->ttable[dst_voice].srcs);
+       unsigned int dst_channel;
+       for (dst_channel = 0; dst_channel < plugin->dst_format.channels; ++dst_channel) {
+               if (data->ttable[dst_channel].srcs != NULL)
+                       free(data->ttable[dst_channel].srcs);
        }
 }
 
@@ -424,7 +424,7 @@ static int route_load_ttable(snd_pcm_plugin_t *plugin,
                             const route_ttable_entry_t* src_ttable)
 {
        route_t *data;
-       unsigned int src_voice, dst_voice;
+       unsigned int src_channel, dst_channel;
        const route_ttable_entry_t *sptr;
        ttable_dst_t *dptr;
        if (src_ttable == NULL)
@@ -433,16 +433,16 @@ static int route_load_ttable(snd_pcm_plugin_t *plugin,
        dptr = data->ttable;
        sptr = src_ttable;
        plugin->private_free = route_free;
-       for (dst_voice = 0; dst_voice < plugin->dst_format.voices; ++dst_voice) {
+       for (dst_channel = 0; dst_channel < plugin->dst_format.channels; ++dst_channel) {
                route_ttable_entry_t t = 0;
                int att = 0;
                int nsrcs = 0;
-               ttable_src_t srcs[plugin->src_format.voices];
-               for (src_voice = 0; src_voice < plugin->src_format.voices; ++src_voice) {
+               ttable_src_t srcs[plugin->src_format.channels];
+               for (src_channel = 0; src_channel < plugin->src_format.channels; ++src_channel) {
                        if (*sptr < 0 || *sptr > FULL)
                                return -EINVAL;
                        if (*sptr != 0) {
-                               srcs[nsrcs].voice = src_voice;
+                               srcs[nsrcs].channel = src_channel;
 #if ROUTE_PLUGIN_USE_FLOAT
                                /* Also in user space for non attenuated */
                                srcs[nsrcs].as_int = (*sptr == FULL ? ROUTE_PLUGIN_RESOLUTION : 0);
@@ -465,13 +465,13 @@ static int route_load_ttable(snd_pcm_plugin_t *plugin,
                dptr->nsrcs = nsrcs;
                switch (nsrcs) {
                case 0:
-                       dptr->func = route_to_voice_from_zero;
+                       dptr->func = route_to_channel_from_zero;
                        break;
                case 1:
-                       dptr->func = route_to_voice_from_one;
+                       dptr->func = route_to_channel_from_one;
                        break;
                default:
-                       dptr->func = route_to_voice;
+                       dptr->func = route_to_channel;
                        break;
                }
                if (nsrcs > 0) {
@@ -485,40 +485,40 @@ static int route_load_ttable(snd_pcm_plugin_t *plugin,
 }
 
 static ssize_t route_transfer(snd_pcm_plugin_t *plugin,
-                             const snd_pcm_plugin_voice_t *src_voices,
-                             snd_pcm_plugin_voice_t *dst_voices,
+                             const snd_pcm_plugin_channel_t *src_channels,
+                             snd_pcm_plugin_channel_t *dst_channels,
                              size_t frames)
 {
        route_t *data;
-       int src_nvoices, dst_nvoices;
-       int src_voice, dst_voice;
+       int src_nchannels, dst_nchannels;
+       int src_channel, dst_channel;
        ttable_dst_t *ttp;
-       snd_pcm_plugin_voice_t *dvp;
+       snd_pcm_plugin_channel_t *dvp;
 
-       if (plugin == NULL || src_voices == NULL || dst_voices == NULL)
+       if (plugin == NULL || src_channels == NULL || dst_channels == NULL)
                return -EFAULT;
        if (frames == 0)
                return 0;
        data = (route_t *)plugin->extra_data;
 
-       src_nvoices = plugin->src_format.voices;
-       for (src_voice = 0; src_voice < src_nvoices; ++src_voice) {
-               if (src_voices[src_voice].area.first % 8 != 0 || 
-                   src_voices[src_voice].area.step % 8 != 0)
+       src_nchannels = plugin->src_format.channels;
+       for (src_channel = 0; src_channel < src_nchannels; ++src_channel) {
+               if (src_channels[src_channel].area.first % 8 != 0 || 
+                   src_channels[src_channel].area.step % 8 != 0)
                        return -EINVAL;
        }
 
-       dst_nvoices = plugin->dst_format.voices;
-       for (dst_voice = 0; dst_voice < dst_nvoices; ++dst_voice) {
-               if (dst_voices[dst_voice].area.first % 8 != 0 || 
-                   dst_voices[dst_voice].area.step % 8 != 0)
+       dst_nchannels = plugin->dst_format.channels;
+       for (dst_channel = 0; dst_channel < dst_nchannels; ++dst_channel) {
+               if (dst_channels[dst_channel].area.first % 8 != 0 || 
+                   dst_channels[dst_channel].area.step % 8 != 0)
                        return -EINVAL;
        }
 
        ttp = data->ttable;
-       dvp = dst_voices;
-       for (dst_voice = 0; dst_voice < dst_nvoices; ++dst_voice) {
-               ttp->func(plugin, src_voices, dvp, ttp, frames);
+       dvp = dst_channels;
+       for (dst_channel = 0; dst_channel < dst_nchannels; ++dst_channel) {
+               ttp->func(plugin, src_channels, dvp, ttp, frames);
                dvp++;
                ttp++;
        }
@@ -543,7 +543,7 @@ int getput_index(int format)
 }
 
 int snd_pcm_plugin_build_route(snd_pcm_plugin_handle_t *handle,
-                              int channel,
+                              int stream,
                               snd_pcm_format_t *src_format,
                               snd_pcm_format_t *dst_format,
                               route_ttable_entry_t *ttable,
@@ -562,11 +562,11 @@ int snd_pcm_plugin_build_route(snd_pcm_plugin_handle_t *handle,
              snd_pcm_format_linear(dst_format->format)))
                return -EINVAL;
 
-       err = snd_pcm_plugin_build(handle, channel,
+       err = snd_pcm_plugin_build(handle, stream,
                                   "attenuated route conversion",
                                   src_format,
                                   dst_format,
-                                  sizeof(route_t) + sizeof(data->ttable[0]) * dst_format->voices,
+                                  sizeof(route_t) + sizeof(data->ttable[0]) * dst_format->channels,
                                   &plugin);
        if (err < 0)
                return err;
@@ -592,8 +592,8 @@ int snd_pcm_plugin_build_route(snd_pcm_plugin_handle_t *handle,
                return err;
        }
        plugin->transfer = route_transfer;
-       plugin->src_voices_mask = route_src_voices_mask;
-       plugin->dst_voices_mask = route_dst_voices_mask;
+       plugin->src_channels_mask = route_src_channels_mask;
+       plugin->dst_channels_mask = route_dst_channels_mask;
        *r_plugin = plugin;
        return 0;
 }
index 88af755dcb4ecb4cc0cb37d94b43f280763ec3b9..c61dd92ba290cfbfde984f8253c6c68bfd93f762 100644 (file)
@@ -122,68 +122,68 @@ int snd_rawmidi_info(snd_rawmidi_t *rmidi, snd_rawmidi_info_t * info)
        return 0;
 }
 
-int snd_rawmidi_channel_params(snd_rawmidi_t *rmidi, snd_rawmidi_params_t * params)
+int snd_rawmidi_stream_params(snd_rawmidi_t *rmidi, snd_rawmidi_params_t * params)
 {
        if (!rmidi || !params)
                return -EINVAL;
-       if (params->channel < 0 || params->channel > 1)
+       if (params->stream < 0 || params->stream > 1)
                return -EINVAL;
-       if (ioctl(rmidi->fd, SND_RAWMIDI_IOCTL_CHANNEL_PARAMS, params) < 0)
+       if (ioctl(rmidi->fd, SND_RAWMIDI_IOCTL_STREAM_PARAMS, params) < 0)
                return -errno;
        return 0;
 }
 
-int snd_rawmidi_channel_setup(snd_rawmidi_t *rmidi, snd_rawmidi_setup_t * setup)
+int snd_rawmidi_stream_setup(snd_rawmidi_t *rmidi, snd_rawmidi_setup_t * setup)
 {
        if (!rmidi || !setup)
                return -EINVAL;
-       if (setup->channel < 0 || setup->channel > 1)
+       if (setup->stream < 0 || setup->stream > 1)
                return -EINVAL;
-       if (ioctl(rmidi->fd, SND_RAWMIDI_IOCTL_CHANNEL_SETUP, setup) < 0)
+       if (ioctl(rmidi->fd, SND_RAWMIDI_IOCTL_STREAM_SETUP, setup) < 0)
                return -errno;
        return 0;
 }
 
-int snd_rawmidi_channel_status(snd_rawmidi_t *rmidi, snd_rawmidi_status_t * status)
+int snd_rawmidi_stream_status(snd_rawmidi_t *rmidi, snd_rawmidi_status_t * status)
 {
        if (!rmidi || !status)
                return -EINVAL;
-       if (status->channel < 0 || status->channel > 1)
+       if (status->stream < 0 || status->stream > 1)
                return -EINVAL;
-       if (ioctl(rmidi->fd, SND_RAWMIDI_IOCTL_CHANNEL_STATUS, status) < 0)
+       if (ioctl(rmidi->fd, SND_RAWMIDI_IOCTL_STREAM_STATUS, status) < 0)
                return -errno;
        return 0;
 }
 
 int snd_rawmidi_output_drain(snd_rawmidi_t *rmidi)
 {
-       int chn = SND_RAWMIDI_CHANNEL_OUTPUT;
+       int str = SND_RAWMIDI_STREAM_OUTPUT;
        if (!rmidi)
                return -EINVAL;
-       if (ioctl(rmidi->fd, SND_RAWMIDI_IOCTL_CHANNEL_DRAIN, &chn) < 0)
+       if (ioctl(rmidi->fd, SND_RAWMIDI_IOCTL_STREAM_DRAIN, &str) < 0)
                return -errno;
        return 0;
 }
 
-int snd_rawmidi_channel_flush(snd_rawmidi_t *rmidi, int chn)
+int snd_rawmidi_stream_flush(snd_rawmidi_t *rmidi, int str)
 {
        if (!rmidi)
                return -EINVAL;
-       if (chn < 0 || chn > 1)
+       if (str < 0 || str > 1)
                return -EINVAL;
-       if (ioctl(rmidi->fd, SND_RAWMIDI_IOCTL_CHANNEL_FLUSH) < 0)
+       if (ioctl(rmidi->fd, SND_RAWMIDI_IOCTL_STREAM_FLUSH) < 0)
                return -errno;
        return 0;
 }
 
 int snd_rawmidi_output_flush(snd_rawmidi_t *rmidi)
 {
-       return snd_rawmidi_channel_flush(rmidi, SND_RAWMIDI_CHANNEL_OUTPUT);
+       return snd_rawmidi_stream_flush(rmidi, SND_RAWMIDI_STREAM_OUTPUT);
 }
 
 int snd_rawmidi_input_flush(snd_rawmidi_t *rmidi)
 {
-       return snd_rawmidi_channel_flush(rmidi, SND_RAWMIDI_CHANNEL_INPUT);
+       return snd_rawmidi_stream_flush(rmidi, SND_RAWMIDI_STREAM_INPUT);
 }
 
 ssize_t snd_rawmidi_write(snd_rawmidi_t *rmidi, const void *buffer, size_t size)
index b531b93505cb8a117ddc77193fd6e58e0998967f..8e280c39620cde260449ae045b2e4579bba51676 100644 (file)
@@ -6,7 +6,7 @@
 #include "../include/asoundlib.h"
 
 #if 0
-#define USE_BLOCK_MODE /* latency is twice more than for stream mode!!! */
+#define USE_FRAGMENT_MODE      /* latency is twice more than for frame mode!!! */
 #endif
 
 #define USED_RATE      48000
@@ -28,18 +28,18 @@ static char *xitoa(int aaa)
 
 static int syncro(snd_pcm_t *phandle, snd_pcm_t *chandle)
 {
-       snd_pcm_channel_info_t pinfo, cinfo;
+       snd_pcm_stream_info_t pinfo, cinfo;
        int err;
        
        bzero(&pinfo, sizeof(pinfo));
        bzero(&cinfo, sizeof(cinfo));
-       pinfo.channel = SND_PCM_CHANNEL_PLAYBACK;
-       cinfo.channel = SND_PCM_CHANNEL_CAPTURE;
-       if ((err = snd_pcm_channel_info(phandle, &pinfo)) < 0) {
+       pinfo.stream = SND_PCM_STREAM_PLAYBACK;
+       cinfo.stream = SND_PCM_STREAM_CAPTURE;
+       if ((err = snd_pcm_stream_info(phandle, &pinfo)) < 0) {
                printf("Playback info error: %s\n", snd_strerror(err));
                exit(0);
        }
-       if ((err = snd_pcm_channel_info(chandle, &cinfo)) < 0) {
+       if ((err = snd_pcm_stream_info(chandle, &cinfo)) < 0) {
                printf("Capture info error: %s\n", snd_strerror(err));
                exit(0);
        }
@@ -70,19 +70,19 @@ static void syncro_id(snd_pcm_sync_t *sync)
 int setparams(snd_pcm_t *phandle, snd_pcm_t *chandle, int sync, int *queue)
 {
        int err, again;
-       snd_pcm_channel_params_t params;
-       snd_pcm_channel_setup_t psetup, csetup;
+       snd_pcm_stream_params_t params;
+       snd_pcm_stream_setup_t psetup, csetup;
 
        bzero(&params, sizeof(params));
-       params.channel = SND_PCM_CHANNEL_PLAYBACK;
+       params.stream = SND_PCM_STREAM_PLAYBACK;
 #ifdef USE_BLOCK_MODE
-       params.mode = SND_PCM_MODE_BLOCK;
+       params.mode = SND_PCM_MODE_FRAGMENT;
 #else
-       params.mode = SND_PCM_MODE_STREAM;
+       params.mode = SND_PCM_MODE_FRAME;
 #endif
        params.format.interleave = 1;
        params.format.format = SND_PCM_SFMT_S16_LE;
-       params.format.voices = 2;
+       params.format.channels = 2;
        params.format.rate = USED_RATE;
        params.start_mode = SND_PCM_START_GO;
        params.xrun_mode = SND_PCM_XRUN_DRAIN;
@@ -100,7 +100,7 @@ int setparams(snd_pcm_t *phandle, snd_pcm_t *chandle, int sync, int *queue)
        if (*queue > LATENCY_MAX)
                return -1;
        again = 0;
-       params.channel = SND_PCM_CHANNEL_PLAYBACK;
+       params.stream = SND_PCM_STREAM_PLAYBACK;
        params.frag_size = *queue;
 #ifdef USE_BLOCK_MODE
        params.buffer_size = *queue * 2;
@@ -109,24 +109,24 @@ int setparams(snd_pcm_t *phandle, snd_pcm_t *chandle, int sync, int *queue)
        params.buffer_size = *queue;
        params.buf.stream.bytes_min = 2;
 #endif
-       if ((err = snd_pcm_channel_params(phandle, &params)) < 0) {
+       if ((err = snd_pcm_stream_params(phandle, &params)) < 0) {
                printf("Playback params error: %s\n", snd_strerror(err));
                exit(0);
        }
-       params.channel = SND_PCM_CHANNEL_CAPTURE;
-       if ((err = snd_pcm_channel_params(chandle, &params)) < 0) {
+       params.stream = SND_PCM_STREAM_CAPTURE;
+       if ((err = snd_pcm_stream_params(chandle, &params)) < 0) {
                printf("Capture params error: %s\n", snd_strerror(err));
                exit(0);
        }
        bzero(&psetup, sizeof(psetup));
-       psetup.channel = SND_PCM_CHANNEL_PLAYBACK;
-       if ((err = snd_pcm_channel_setup(phandle, &psetup)) < 0) {
+       psetup.stream = SND_PCM_STREAM_PLAYBACK;
+       if ((err = snd_pcm_stream_setup(phandle, &psetup)) < 0) {
                printf("Playback setup error: %s\n", snd_strerror(err));
                exit(0);
        }
        bzero(&csetup, sizeof(csetup));
-       csetup.channel = SND_PCM_CHANNEL_CAPTURE;
-       if ((err = snd_pcm_channel_setup(chandle, &csetup)) < 0) {
+       csetup.stream = SND_PCM_STREAM_CAPTURE;
+       if ((err = snd_pcm_stream_setup(chandle, &csetup)) < 0) {
                printf("Capture setup error: %s\n", snd_strerror(err));
                exit(0);
        }
@@ -164,17 +164,17 @@ int setparams(snd_pcm_t *phandle, snd_pcm_t *chandle, int sync, int *queue)
        return 0;
 }
 
-void showstat(snd_pcm_t *handle, int channel, snd_pcm_channel_status_t *rstatus, size_t bytes)
+void showstat(snd_pcm_t *handle, int stream, snd_pcm_stream_status_t *rstatus, size_t bytes)
 {
        int err;
-       snd_pcm_channel_status_t status;
+       snd_pcm_stream_status_t status;
        char *str;
 
-       str = channel == SND_PCM_CHANNEL_CAPTURE ? "Capture" : "Playback";
+       str = stream == SND_PCM_STREAM_CAPTURE ? "Capture" : "Playback";
        bzero(&status, sizeof(status));
-       status.channel = channel;
-       if ((err = snd_pcm_channel_status(handle, &status)) < 0) {
-               printf("Channel %s status error: %s\n", str, snd_strerror(err));
+       status.stream = stream;
+       if ((err = snd_pcm_stream_status(handle, &status)) < 0) {
+               printf("Stream %s status error: %s\n", str, snd_strerror(err));
                exit(0);
        }
        printf("%s:\n", str);
@@ -233,7 +233,7 @@ long readbuf(snd_pcm_t *handle, char *buf, long len, size_t *bytes)
        if (r > 0)
                *bytes += r;
        // printf("read = %li\n", r);
-       // showstat(handle, SND_PCM_CHANNEL_CAPTURE, NULL);
+       // showstat(handle, SND_PCM_STREAM_CAPTURE, NULL);
        return r;
 }
 
@@ -250,7 +250,7 @@ long writebuf(snd_pcm_t *handle, char *buf, long len, size_t *bytes)
                // printf("write = %li\n", r);
                if (r < 0)
                        return r;
-               // showstat(handle, SND_PCM_CHANNEL_PLAYBACK, NULL);
+               // showstat(handle, SND_PCM_STREAM_PLAYBACK, NULL);
                buf += r;
                len -= r;
                *bytes += r;
@@ -268,7 +268,7 @@ int main(void)
        int size, ok;
        int sync;
        snd_pcm_sync_t ssync;
-       snd_pcm_channel_status_t pstatus, cstatus;
+       snd_pcm_stream_status_t pstatus, cstatus;
        ssize_t r;
        size_t bytes_in, bytes_out;
 
@@ -282,9 +282,9 @@ int main(void)
                return 0;
        }
 #ifdef USE_BLOCK_MODE
-       printf("Using block mode...\n");
+       printf("Using fragment mode...\n");
 #else
-       printf("Using stream mode...\n");
+       printf("Using frame mode...\n");
 #endif
        sync = syncro(phandle, chandle);
        if (sync)
@@ -330,8 +330,8 @@ int main(void)
                        if (r > 0 && writebuf(phandle, buffer, r, &bytes_out) < 0)
                                ok = 0;
                }
-               showstat(phandle, SND_PCM_CHANNEL_PLAYBACK, &pstatus, bytes_out);
-               showstat(chandle, SND_PCM_CHANNEL_CAPTURE, &cstatus, bytes_in);
+               showstat(phandle, SND_PCM_STREAM_PLAYBACK, &pstatus, bytes_out);
+               showstat(chandle, SND_PCM_STREAM_CAPTURE, &cstatus, bytes_in);
                snd_pcm_capture_flush(chandle);
                snd_pcm_playback_flush(phandle);
                if (ok) {
index e73ab4d60868bde68066e5bb881f8b873d637edb..b60097cc5034443eaa173cc2f2f4d3d2ce665d02 100644 (file)
@@ -180,14 +180,14 @@ int main(int argc, char** argv)
 
        bzero(&istat, sizeof(istat));
        bzero(&ostat, sizeof(ostat));
-       istat.channel = SND_RAWMIDI_CHANNEL_INPUT;
-       ostat.channel = SND_RAWMIDI_CHANNEL_OUTPUT;
-       err = snd_rawmidi_channel_status(handle_in, &istat);
+       istat.stream = SND_RAWMIDI_STREAM_INPUT;
+       ostat.stream = SND_RAWMIDI_STREAM_OUTPUT;
+       err = snd_rawmidi_stream_status(handle_in, &istat);
        if (err < 0)
-               fprintf(stderr, "input channel status error: %d\n", err);
-       err = snd_rawmidi_channel_status(handle_out, &ostat);
+               fprintf(stderr, "input stream status error: %d\n", err);
+       err = snd_rawmidi_stream_status(handle_out, &ostat);
        if (err < 0)
-               fprintf(stderr, "output channel status error: %d\n", err);
+               fprintf(stderr, "output stream status error: %d\n", err);
        printf("input.status.queue = %i\n", istat.queue);
        printf("input.status.overrun = %i\n", istat.overrun);
        printf("output.status.queue = %i\n", ostat.queue);
index afd1ca041672728cda70e11b9b67bd8edd360f38..f2b7cd2fb3185aac9fad2321c73303e9dce6cf3a 100644 (file)
 
 void info_channel(snd_pcm_t *handle, int channel, char *id)
 {
-       snd_pcm_channel_info_t chninfo;
+       snd_pcm_stream_info_t stream_info;
        int err;
        
-       bzero(&chninfo, sizeof(chninfo));
-       chninfo.channel = channel;
-       if ((err = snd_pcm_channel_info(handle, &chninfo))<0) {
+       bzero(&stream_info, sizeof(stream_info));
+       stream_info.channel = channel;
+       if ((err = snd_pcm_stream_info(handle, &stream_info))<0) {
                fprintf(stderr, "channel info error: %s\n", snd_strerror(err));
                return;
        }
        printf("%s INFO:\n", id);
-       printf("  subdevice      : %i\n", chninfo.subdevice);
-       printf("  subname        : '%s'\n", chninfo.subname);
-       printf("  channel        : %i\n", chninfo.channel);
+       printf("  subdevice      : %i\n", stream_info.subdevice);
+       printf("  subname        : '%s'\n", stream_info.subname);
+       printf("  channel        : %i\n", stream_info.channel);
        printf("  mode           : ");
-       switch (chninfo.mode) {
-       case SND_PCM_MODE_STREAM:
-               printf("stream\n");
+       switch (stream_info.mode) {
+       case SND_PCM_MODE_FRAME:
+               printf("frame\n");
                break;
-       case SND_PCM_MODE_BLOCK:
-               printf("block\n");
+       case SND_PCM_MODE_FRAGMENT:
+               printf("fragment\n");
                break;
        default:
                printf("unknown\n");
        }
        printf("  sync           : 0x%x, 0x%x, 0x%x, 0x%x\n",
-                       chninfo.sync.id32[0],
-                       chninfo.sync.id32[1],
-                       chninfo.sync.id32[2],
-                       chninfo.sync.id32[3]);
+                       stream_info.sync.id32[0],
+                       stream_info.sync.id32[1],
+                       stream_info.sync.id32[2],
+                       stream_info.sync.id32[3]);
        printf("  flags          :");
-       if (chninfo.flags & SND_PCM_CHNINFO_MMAP)
+       if (stream_info.flags & SND_PCM_STREAM_INFO_MMAP)
                printf(" mmap");
-       if (chninfo.flags & SND_PCM_CHNINFO_STREAM)
-               printf(" stream");
-       if (chninfo.flags & SND_PCM_CHNINFO_BLOCK)
-               printf(" block");
-       if (chninfo.flags & SND_PCM_CHNINFO_BATCH)
+       if (stream_info.flags & SND_PCM_STREAM_INFO_FRAME)
+               printf(" frame");
+       if (stream_info.flags & SND_PCM_STREAM_INFO_FRAGMENT)
+               printf(" fragment");
+       if (stream_info.flags & SND_PCM_STREAM_INFO_BATCH)
                printf(" batch");
-       if (chninfo.flags & SND_PCM_CHNINFO_INTERLEAVE)
+       if (stream_info.flags & SND_PCM_STREAM_INFO_INTERLEAVE)
                printf(" interleave");
-       if (chninfo.flags & SND_PCM_CHNINFO_NONINTERLEAVE)
+       if (stream_info.flags & SND_PCM_STREAM_INFO_NONINTERLEAVE)
                printf(" noninterleave");
-       if (chninfo.flags & SND_PCM_CHNINFO_BLOCK_TRANSFER)
+       if (stream_info.flags & SND_PCM_STREAM_INFO_BLOCK_TRANSFER)
                printf(" block_transfer");
-       if (chninfo.flags & SND_PCM_CHNINFO_OVERRANGE)
+       if (stream_info.flags & SND_PCM_STREAM_INFO_OVERRANGE)
                printf(" overrange");
        printf("\n");
        printf("  formats        :");
-       if (chninfo.formats & SND_PCM_FMT_MU_LAW)
+       if (stream_info.formats & SND_PCM_FMT_MU_LAW)
                printf(" mu-Law");
-       if (chninfo.formats & SND_PCM_FMT_A_LAW)
+       if (stream_info.formats & SND_PCM_FMT_A_LAW)
                printf(" a-Law");
-       if (chninfo.formats & SND_PCM_FMT_IMA_ADPCM)
+       if (stream_info.formats & SND_PCM_FMT_IMA_ADPCM)
                printf(" IMA-ADPCM");
-       if (chninfo.formats & SND_PCM_FMT_U8)
+       if (stream_info.formats & SND_PCM_FMT_U8)
                printf(" U8");
-       if (chninfo.formats & SND_PCM_FMT_S16_LE)
+       if (stream_info.formats & SND_PCM_FMT_S16_LE)
                printf(" S16-LE");
-       if (chninfo.formats & SND_PCM_FMT_S16_BE)
+       if (stream_info.formats & SND_PCM_FMT_S16_BE)
                printf(" S16-BE");
-       if (chninfo.formats & SND_PCM_FMT_S8)
+       if (stream_info.formats & SND_PCM_FMT_S8)
                printf(" S8");
-       if (chninfo.formats & SND_PCM_FMT_U16_LE)
+       if (stream_info.formats & SND_PCM_FMT_U16_LE)
                printf(" U16-LE");
-       if (chninfo.formats & SND_PCM_FMT_U16_BE)
+       if (stream_info.formats & SND_PCM_FMT_U16_BE)
                printf(" U16-BE");
-       if (chninfo.formats & SND_PCM_FMT_MPEG)
+       if (stream_info.formats & SND_PCM_FMT_MPEG)
                printf(" MPEG");
-       if (chninfo.formats & SND_PCM_FMT_GSM)
+       if (stream_info.formats & SND_PCM_FMT_GSM)
                printf(" GSM");
-       if (chninfo.formats & SND_PCM_FMT_S24_LE)
+       if (stream_info.formats & SND_PCM_FMT_S24_LE)
                printf(" S24-LE");
-       if (chninfo.formats & SND_PCM_FMT_S24_BE)
+       if (stream_info.formats & SND_PCM_FMT_S24_BE)
                printf(" S24-BE");
-       if (chninfo.formats & SND_PCM_FMT_U24_LE)
+       if (stream_info.formats & SND_PCM_FMT_U24_LE)
                printf(" U24-LE");
-       if (chninfo.formats & SND_PCM_FMT_U24_BE)
+       if (stream_info.formats & SND_PCM_FMT_U24_BE)
                printf(" U24-BE");
-       if (chninfo.formats & SND_PCM_FMT_S32_LE)
+       if (stream_info.formats & SND_PCM_FMT_S32_LE)
                printf(" S32-LE");
-       if (chninfo.formats & SND_PCM_FMT_S32_BE)
+       if (stream_info.formats & SND_PCM_FMT_S32_BE)
                printf(" S32-BE");
-       if (chninfo.formats & SND_PCM_FMT_U32_LE)
+       if (stream_info.formats & SND_PCM_FMT_U32_LE)
                printf(" U32-LE");
-       if (chninfo.formats & SND_PCM_FMT_U32_BE)
+       if (stream_info.formats & SND_PCM_FMT_U32_BE)
                printf(" U32-BE");
-       if (chninfo.formats & SND_PCM_FMT_FLOAT)
+       if (stream_info.formats & SND_PCM_FMT_FLOAT)
                printf(" Float");
-       if (chninfo.formats & SND_PCM_FMT_FLOAT64)
+       if (stream_info.formats & SND_PCM_FMT_FLOAT64)
                printf(" Float64");
-       if (chninfo.formats & SND_PCM_FMT_IEC958_SUBFRAME_LE)
+       if (stream_info.formats & SND_PCM_FMT_IEC958_SUBFRAME_LE)
                printf(" IEC958-LE");
-       if (chninfo.formats & SND_PCM_FMT_IEC958_SUBFRAME_BE)
+       if (stream_info.formats & SND_PCM_FMT_IEC958_SUBFRAME_BE)
                printf(" IEC958-BE");
-       if (chninfo.formats & SND_PCM_FMT_SPECIAL)
+       if (stream_info.formats & SND_PCM_FMT_SPECIAL)
                printf(" Special");
        printf("\n");
        printf("  rates          :");
-       if (chninfo.rates & SND_PCM_RATE_CONTINUOUS)
+       if (stream_info.rates & SND_PCM_RATE_CONTINUOUS)
                printf(" Continuous");
-       if (chninfo.rates & SND_PCM_RATE_KNOT)
+       if (stream_info.rates & SND_PCM_RATE_KNOT)
                printf(" Knot");
-       if (chninfo.rates & SND_PCM_RATE_8000)
+       if (stream_info.rates & SND_PCM_RATE_8000)
                printf(" 8000");
-       if (chninfo.rates & SND_PCM_RATE_11025)
+       if (stream_info.rates & SND_PCM_RATE_11025)
                printf(" 11025");
-       if (chninfo.rates & SND_PCM_RATE_16000)
+       if (stream_info.rates & SND_PCM_RATE_16000)
                printf(" 16000");
-       if (chninfo.rates & SND_PCM_RATE_22050)
+       if (stream_info.rates & SND_PCM_RATE_22050)
                printf(" 22050");
-       if (chninfo.rates & SND_PCM_RATE_32000)
+       if (stream_info.rates & SND_PCM_RATE_32000)
                printf(" 32000");
-       if (chninfo.rates & SND_PCM_RATE_44100)
+       if (stream_info.rates & SND_PCM_RATE_44100)
                printf(" 44100");
-       if (chninfo.rates & SND_PCM_RATE_48000)
+       if (stream_info.rates & SND_PCM_RATE_48000)
                printf(" 48000");
-       if (chninfo.rates & SND_PCM_RATE_88200)
+       if (stream_info.rates & SND_PCM_RATE_88200)
                printf(" 88200");
-       if (chninfo.rates & SND_PCM_RATE_96000)
+       if (stream_info.rates & SND_PCM_RATE_96000)
                printf(" 96000");
-       if (chninfo.rates & SND_PCM_RATE_176400)
+       if (stream_info.rates & SND_PCM_RATE_176400)
                printf(" 176400");
-       if (chninfo.rates & SND_PCM_RATE_192000)
+       if (stream_info.rates & SND_PCM_RATE_192000)
                printf(" 192000");
        printf("\n");
-       printf("  min_rate       : %i\n", chninfo.min_rate);
-       printf("  max_rate       : %i\n", chninfo.max_rate);
-       printf("  min_voices     : %i\n", chninfo.min_voices);
-       printf("  max_voices     : %i\n", chninfo.max_voices);
-       printf("  buffer_size    : %i\n", chninfo.buffer_size);
-       printf("  min_frag_size  : %i\n", chninfo.min_fragment_size);
-       printf("  max_frag_size  : %i\n", chninfo.max_fragment_size);
-       printf("  fragment_align : %i\n", chninfo.fragment_align);
-       printf("  fifo_size      : %i\n", chninfo.fifo_size);
-       printf("  TBS            : %i\n", chninfo.transfer_block_size);
-       printf("  mmap_size      : %li\n", chninfo.mmap_size);
-       printf("  mixer_device   : %i\n", chninfo.mixer_device);
-       printf("  mixer_eid      : '%s',%i,%i\n", chninfo.mixer_eid.name, chninfo.mixer_eid.index, chninfo.mixer_eid.type);
+       printf("  min_rate       : %i\n", stream_info.min_rate);
+       printf("  max_rate       : %i\n", stream_info.max_rate);
+       printf("  min_channels   : %i\n", stream_info.min_channels);
+       printf("  max_channels   : %i\n", stream_info.max_channels);
+       printf("  buffer_size    : %i\n", stream_info.buffer_size);
+       printf("  min_frag_size  : %i\n", stream_info.min_fragment_size);
+       printf("  max_frag_size  : %i\n", stream_info.max_fragment_size);
+       printf("  fragment_align : %i\n", stream_info.fragment_align);
+       printf("  fifo_size      : %i\n", stream_info.fifo_size);
+       printf("  TBS            : %i\n", stream_info.transfer_block_size);
+       printf("  mmap_size      : %li\n", stream_info.mmap_size);
+       printf("  mixer_device   : %i\n", stream_info.mixer_device);
+       printf("  mixer_eid      : '%s',%i,%i\n", stream_info.mixer_eid.name, stream_info.mixer_eid.index, stream_info.mixer_eid.type);
 }
 
 void info(void)
@@ -166,9 +166,9 @@ void info(void)
        printf("  playback  : %i\n", info.playback);
        printf("  capture   : %i\n", info.capture);
        if (info.flags & SND_PCM_INFO_PLAYBACK)
-               info_channel(handle, SND_PCM_CHANNEL_PLAYBACK, "Playback");
+               info_channel(handle, SND_PCM_STREAM_PLAYBACK, "Playback");
        if (info.flags & SND_PCM_INFO_CAPTURE)
-               info_channel(handle, SND_PCM_CHANNEL_CAPTURE, "Capture");
+               info_channel(handle, SND_PCM_STREAM_CAPTURE, "Capture");
        snd_pcm_close(handle);
 }
 
index f3b48e9bb3aa0234aa70cb68f7962750b1e33aba..e3744c97d80bb78c9be746d2045b9c9e0591a8e1 100644 (file)
@@ -54,7 +54,7 @@ void print_switch(snd_ctl_t *ctl_handle, char *space, char *prefix, snd_switch_t
                        sw1.type = SND_SW_TYPE_LIST_ITEM;
                        sw1.low = sw1.high = low;
                        if ((err = snd_ctl_switch_read(ctl_handle, &sw1)) < 0) {
-                               printf("Switch list item read failed for %s interface and device %i channel %i: %s\n", get_interface(sw->iface), sw->device, sw->channel, snd_strerror(err));
+                               printf("Switch list item read failed for %s interface and device %i stream %i: %s\n", get_interface(sw->iface), sw->device, sw->stream, snd_strerror(err));
                                continue;
                        }
                        printf("  %s%s : '%s' [%s] {%s}\n", space, prefix, sw1.name, get_type(sw1.type), sw1.value.item);
@@ -62,7 +62,7 @@ void print_switch(snd_ctl_t *ctl_handle, char *space, char *prefix, snd_switch_t
        }
 }
 
-void process(snd_ctl_t *ctl_handle, char *space, char *prefix, int iface, int device, int channel)
+void process(snd_ctl_t *ctl_handle, char *space, char *prefix, int iface, int device, int stream)
 {
        snd_switch_list_t list;
        snd_switch_t sw;
@@ -71,7 +71,7 @@ void process(snd_ctl_t *ctl_handle, char *space, char *prefix, int iface, int de
        bzero(&list, sizeof(list));
        list.iface = iface;
        list.device = device;
-       list.channel = channel;
+       list.stream = stream;
        if ((err = snd_ctl_switch_list(ctl_handle, &list)) < 0) {
                printf("Switch listing failed for the %s interface and the device %i: %s\n", get_interface(iface), device, snd_strerror(err));
                return;
@@ -93,10 +93,10 @@ void process(snd_ctl_t *ctl_handle, char *space, char *prefix, int iface, int de
                bzero(&sw, sizeof(sw));
                sw.iface = iface;
                sw.device = device;
-               sw.channel = channel;
+               sw.stream = stream;
                strncpy(sw.name, list.pswitches[idx].name, sizeof(sw.name));
                if ((err = snd_ctl_switch_read(ctl_handle, &sw)) < 0) {
-                       printf("Switch read failed for the %s interface and the device %i channel %i: %s\n", get_interface(iface), device, channel, snd_strerror(err));
+                       printf("Switch read failed for the %s interface and the device %i stream %i: %s\n", get_interface(iface), device, stream, snd_strerror(err));
                        continue;
                }
                print_switch(ctl_handle, space, prefix, &sw);
@@ -131,8 +131,8 @@ int main(void)
                for (idx = 0; idx < info.mixerdevs; idx++)
                        process(ctl_handle, "  ", "Mixer", SND_CTL_IFACE_MIXER, idx, 0);
                for (idx = 0; idx < info.pcmdevs; idx++) {
-                       process(ctl_handle, "  ", "PCM playback", SND_CTL_IFACE_PCM, idx, SND_PCM_CHANNEL_PLAYBACK);
-                       process(ctl_handle, "  ", "PCM capture", SND_CTL_IFACE_PCM, idx, SND_PCM_CHANNEL_CAPTURE);
+                       process(ctl_handle, "  ", "PCM playback", SND_CTL_IFACE_PCM, idx, SND_PCM_STREAM_PLAYBACK);
+                       process(ctl_handle, "  ", "PCM capture", SND_CTL_IFACE_PCM, idx, SND_PCM_STREAM_CAPTURE);
                }
                snd_ctl_close(ctl_handle);
        }