mirror of
				https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
				synced 2025-11-03 09:01:50 -05:00 
			
		
		
		
	alsa: rework mixer logic
Completely rework mixer logic. This now allows controlling a full set of elements from a single sink's volume slider/mute button. This also introduces sink and source "ports" that can be used to choose different input or output ports with the UI. (i.e. "mic"/"line-in" or "speaker"/"headphones". The mixer paths and device maps are now configered in external configuration files and can be tweaked as necessary.
This commit is contained in:
		
							parent
							
								
									e9c70ac41b
								
							
						
					
					
						commit
						31575f7766
					
				
					 54 changed files with 7029 additions and 1694 deletions
				
			
		
							
								
								
									
										3382
									
								
								src/modules/alsa/alsa-mixer.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										3382
									
								
								src/modules/alsa/alsa-mixer.c
									
										
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							
							
								
								
									
										292
									
								
								src/modules/alsa/alsa-mixer.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										292
									
								
								src/modules/alsa/alsa-mixer.h
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,292 @@
 | 
			
		|||
#ifndef fooalsamixerhfoo
 | 
			
		||||
#define fooalsamixerhfoo
 | 
			
		||||
 | 
			
		||||
/***
 | 
			
		||||
  This file is part of PulseAudio.
 | 
			
		||||
 | 
			
		||||
  Copyright 2004-2006 Lennart Poettering
 | 
			
		||||
  Copyright 2006 Pierre Ossman <ossman@cendio.se> for Cendio AB
 | 
			
		||||
 | 
			
		||||
  PulseAudio is free software; you can redistribute it and/or modify
 | 
			
		||||
  it under the terms of the GNU Lesser General Public License as published
 | 
			
		||||
  by the Free Software Foundation; either version 2.1 of the License,
 | 
			
		||||
  or (at your option) any later version.
 | 
			
		||||
 | 
			
		||||
  PulseAudio is distributed in the hope that it will be useful, but
 | 
			
		||||
  WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 | 
			
		||||
  General Public License for more details.
 | 
			
		||||
 | 
			
		||||
  You should have received a copy of the GNU Lesser General Public License
 | 
			
		||||
  along with PulseAudio; if not, write to the Free Software
 | 
			
		||||
  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
 | 
			
		||||
  USA.
 | 
			
		||||
***/
 | 
			
		||||
 | 
			
		||||
#include <asoundlib.h>
 | 
			
		||||
 | 
			
		||||
#include <pulse/sample.h>
 | 
			
		||||
#include <pulse/volume.h>
 | 
			
		||||
#include <pulse/mainloop-api.h>
 | 
			
		||||
#include <pulse/channelmap.h>
 | 
			
		||||
#include <pulse/proplist.h>
 | 
			
		||||
#include <pulse/volume.h>
 | 
			
		||||
 | 
			
		||||
#include <pulsecore/llist.h>
 | 
			
		||||
#include <pulsecore/rtpoll.h>
 | 
			
		||||
#include <pulsecore/core.h>
 | 
			
		||||
#include <pulsecore/log.h>
 | 
			
		||||
 | 
			
		||||
typedef struct pa_alsa_fdlist pa_alsa_fdlist;
 | 
			
		||||
typedef struct pa_alsa_setting pa_alsa_setting;
 | 
			
		||||
typedef struct pa_alsa_option pa_alsa_option;
 | 
			
		||||
typedef struct pa_alsa_element pa_alsa_element;
 | 
			
		||||
typedef struct pa_alsa_path pa_alsa_path;
 | 
			
		||||
typedef struct pa_alsa_path_set pa_alsa_path_set;
 | 
			
		||||
typedef struct pa_alsa_mapping pa_alsa_mapping;
 | 
			
		||||
typedef struct pa_alsa_profile pa_alsa_profile;
 | 
			
		||||
typedef struct pa_alsa_profile_set pa_alsa_profile_set;
 | 
			
		||||
typedef struct pa_alsa_port_data pa_alsa_port_data;
 | 
			
		||||
 | 
			
		||||
#include "alsa-util.h"
 | 
			
		||||
 | 
			
		||||
typedef enum pa_alsa_switch_use {
 | 
			
		||||
    PA_ALSA_SWITCH_IGNORE,
 | 
			
		||||
    PA_ALSA_SWITCH_MUTE,   /* make this switch follow mute status */
 | 
			
		||||
    PA_ALSA_SWITCH_OFF,    /* set this switch to 'off' unconditionally */
 | 
			
		||||
    PA_ALSA_SWITCH_ON,     /* set this switch to 'on' unconditionally */
 | 
			
		||||
    PA_ALSA_SWITCH_SELECT  /* allow the user to select switch status through a setting */
 | 
			
		||||
} pa_alsa_switch_use_t;
 | 
			
		||||
 | 
			
		||||
typedef enum pa_alsa_volume_use {
 | 
			
		||||
    PA_ALSA_VOLUME_IGNORE,
 | 
			
		||||
    PA_ALSA_VOLUME_MERGE,  /* merge this volume slider into the global volume slider */
 | 
			
		||||
    PA_ALSA_VOLUME_OFF,    /* set this volume to minimal unconditionally */
 | 
			
		||||
    PA_ALSA_VOLUME_ZERO    /* set this volume to 0dB unconditionally */
 | 
			
		||||
} pa_alsa_volume_use_t;
 | 
			
		||||
 | 
			
		||||
typedef enum pa_alsa_enumeration_use {
 | 
			
		||||
    PA_ALSA_ENUMERATION_IGNORE,
 | 
			
		||||
    PA_ALSA_ENUMERATION_SELECT
 | 
			
		||||
} pa_alsa_enumeration_use_t;
 | 
			
		||||
 | 
			
		||||
typedef enum pa_alsa_required {
 | 
			
		||||
    PA_ALSA_REQUIRED_IGNORE,
 | 
			
		||||
    PA_ALSA_REQUIRED_SWITCH,
 | 
			
		||||
    PA_ALSA_REQUIRED_VOLUME,
 | 
			
		||||
    PA_ALSA_REQUIRED_ENUMERATION,
 | 
			
		||||
    PA_ALSA_REQUIRED_ANY
 | 
			
		||||
} pa_alsa_required_t;
 | 
			
		||||
 | 
			
		||||
typedef enum pa_alsa_direction {
 | 
			
		||||
    PA_ALSA_DIRECTION_ANY,
 | 
			
		||||
    PA_ALSA_DIRECTION_OUTPUT,
 | 
			
		||||
    PA_ALSA_DIRECTION_INPUT
 | 
			
		||||
} pa_alsa_direction_t;
 | 
			
		||||
 | 
			
		||||
/* A setting combines a couple of options into a single entity that
 | 
			
		||||
 * may be selected. Only one setting can be active at the same
 | 
			
		||||
 * time. */
 | 
			
		||||
struct pa_alsa_setting {
 | 
			
		||||
    pa_alsa_path *path;
 | 
			
		||||
    PA_LLIST_FIELDS(pa_alsa_setting);
 | 
			
		||||
 | 
			
		||||
    pa_idxset *options;
 | 
			
		||||
 | 
			
		||||
    char *name;
 | 
			
		||||
    char *description;
 | 
			
		||||
    unsigned priority;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/* An option belongs to an element and refers to one enumeration item
 | 
			
		||||
 * of the element is an enumeration item, or a switch status if the
 | 
			
		||||
 * element is a switch item. */
 | 
			
		||||
struct pa_alsa_option {
 | 
			
		||||
    pa_alsa_element *element;
 | 
			
		||||
    PA_LLIST_FIELDS(pa_alsa_option);
 | 
			
		||||
 | 
			
		||||
    char *alsa_name;
 | 
			
		||||
    int alsa_idx;
 | 
			
		||||
 | 
			
		||||
    char *name;
 | 
			
		||||
    char *description;
 | 
			
		||||
    unsigned priority;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/* And element wraps one specific ALSA element. A series of elements *
 | 
			
		||||
make up a path (see below). If the element is an enumeration or switch
 | 
			
		||||
* element it may includes a list of options. */
 | 
			
		||||
struct pa_alsa_element {
 | 
			
		||||
    pa_alsa_path *path;
 | 
			
		||||
    PA_LLIST_FIELDS(pa_alsa_element);
 | 
			
		||||
 | 
			
		||||
    char *alsa_name;
 | 
			
		||||
    pa_alsa_direction_t direction;
 | 
			
		||||
 | 
			
		||||
    pa_alsa_switch_use_t switch_use;
 | 
			
		||||
    pa_alsa_volume_use_t volume_use;
 | 
			
		||||
    pa_alsa_enumeration_use_t enumeration_use;
 | 
			
		||||
 | 
			
		||||
    pa_alsa_required_t required;
 | 
			
		||||
    pa_alsa_required_t required_absent;
 | 
			
		||||
 | 
			
		||||
    pa_bool_t override_map:1;
 | 
			
		||||
    pa_bool_t direction_try_other:1;
 | 
			
		||||
 | 
			
		||||
    pa_bool_t has_dB:1;
 | 
			
		||||
    long min_volume, max_volume;
 | 
			
		||||
    double min_dB, max_dB;
 | 
			
		||||
 | 
			
		||||
    pa_channel_position_mask_t masks[SND_MIXER_SCHN_LAST][2];
 | 
			
		||||
    unsigned n_channels;
 | 
			
		||||
 | 
			
		||||
    pa_channel_position_mask_t merged_mask;
 | 
			
		||||
 | 
			
		||||
    PA_LLIST_HEAD(pa_alsa_option, options);
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/* A path wraps a series of elements into a single entity which can be
 | 
			
		||||
 * used to control it as if it had a single volume slider, a single
 | 
			
		||||
 * mute switch and a single list of selectable options. */
 | 
			
		||||
struct pa_alsa_path {
 | 
			
		||||
    pa_alsa_path_set *path_set;
 | 
			
		||||
    PA_LLIST_FIELDS(pa_alsa_path);
 | 
			
		||||
 | 
			
		||||
    pa_alsa_direction_t direction;
 | 
			
		||||
 | 
			
		||||
    char *name;
 | 
			
		||||
    char *description;
 | 
			
		||||
    unsigned priority;
 | 
			
		||||
 | 
			
		||||
    pa_bool_t probed:1;
 | 
			
		||||
    pa_bool_t supported:1;
 | 
			
		||||
    pa_bool_t has_mute:1;
 | 
			
		||||
    pa_bool_t has_volume:1;
 | 
			
		||||
    pa_bool_t has_dB:1;
 | 
			
		||||
 | 
			
		||||
    long min_volume, max_volume;
 | 
			
		||||
    double min_dB, max_dB;
 | 
			
		||||
 | 
			
		||||
    /* This is used during parsing only, as a shortcut so that we
 | 
			
		||||
     * don't have to iterate the list all the time */
 | 
			
		||||
    pa_alsa_element *last_element;
 | 
			
		||||
    pa_alsa_option *last_option;
 | 
			
		||||
    pa_alsa_setting *last_setting;
 | 
			
		||||
 | 
			
		||||
    PA_LLIST_HEAD(pa_alsa_element, elements);
 | 
			
		||||
    PA_LLIST_HEAD(pa_alsa_setting, settings);
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/* A path set is simply a set of paths that are applicable to a
 | 
			
		||||
 * device */
 | 
			
		||||
struct pa_alsa_path_set {
 | 
			
		||||
    PA_LLIST_HEAD(pa_alsa_path, paths);
 | 
			
		||||
    pa_alsa_direction_t direction;
 | 
			
		||||
    pa_bool_t probed:1;
 | 
			
		||||
 | 
			
		||||
    /* This is used during parsing only, as a shortcut so that we
 | 
			
		||||
     * don't have to iterate the list all the time */
 | 
			
		||||
    pa_alsa_path *last_path;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
int pa_alsa_setting_select(pa_alsa_setting *s, snd_mixer_t *m);
 | 
			
		||||
void pa_alsa_setting_dump(pa_alsa_setting *s);
 | 
			
		||||
 | 
			
		||||
void pa_alsa_option_dump(pa_alsa_option *o);
 | 
			
		||||
 | 
			
		||||
void pa_alsa_element_dump(pa_alsa_element *e);
 | 
			
		||||
 | 
			
		||||
pa_alsa_path *pa_alsa_path_new(const char *fname, pa_alsa_direction_t direction);
 | 
			
		||||
pa_alsa_path *pa_alsa_path_synthesize(const char *element, pa_alsa_direction_t direction);
 | 
			
		||||
int pa_alsa_path_probe(pa_alsa_path *p, snd_mixer_t *m, pa_bool_t ignore_dB);
 | 
			
		||||
void pa_alsa_path_dump(pa_alsa_path *p);
 | 
			
		||||
int pa_alsa_path_get_volume(pa_alsa_path *p, snd_mixer_t *m, const pa_channel_map *cm, pa_cvolume *v);
 | 
			
		||||
int pa_alsa_path_get_mute(pa_alsa_path *path, snd_mixer_t *m, pa_bool_t *muted);
 | 
			
		||||
int pa_alsa_path_set_volume(pa_alsa_path *path, snd_mixer_t *m, const pa_channel_map *cm, pa_cvolume *v);
 | 
			
		||||
int pa_alsa_path_set_mute(pa_alsa_path *path, snd_mixer_t *m, pa_bool_t muted);
 | 
			
		||||
int pa_alsa_path_select(pa_alsa_path *p, snd_mixer_t *m);
 | 
			
		||||
void pa_alsa_path_set_callback(pa_alsa_path *p, snd_mixer_t *m, snd_mixer_elem_callback_t cb, void *userdata);
 | 
			
		||||
void pa_alsa_path_free(pa_alsa_path *p);
 | 
			
		||||
 | 
			
		||||
pa_alsa_path_set *pa_alsa_path_set_new(pa_alsa_mapping *m, pa_alsa_direction_t direction);
 | 
			
		||||
void pa_alsa_path_set_probe(pa_alsa_path_set *s, snd_mixer_t *m, pa_bool_t ignore_dB);
 | 
			
		||||
void pa_alsa_path_set_dump(pa_alsa_path_set *s);
 | 
			
		||||
void pa_alsa_path_set_set_callback(pa_alsa_path_set *ps, snd_mixer_t *m, snd_mixer_elem_callback_t cb, void *userdata);
 | 
			
		||||
void pa_alsa_path_set_free(pa_alsa_path_set *s);
 | 
			
		||||
 | 
			
		||||
struct pa_alsa_mapping {
 | 
			
		||||
    pa_alsa_profile_set *profile_set;
 | 
			
		||||
 | 
			
		||||
    char *name;
 | 
			
		||||
    char *description;
 | 
			
		||||
    unsigned priority;
 | 
			
		||||
    pa_alsa_direction_t direction;
 | 
			
		||||
 | 
			
		||||
    pa_channel_map channel_map;
 | 
			
		||||
 | 
			
		||||
    char **device_strings;
 | 
			
		||||
 | 
			
		||||
    char **input_path_names;
 | 
			
		||||
    char **output_path_names;
 | 
			
		||||
    char **input_element; /* list of fallbacks */
 | 
			
		||||
    char **output_element;
 | 
			
		||||
 | 
			
		||||
    unsigned supported;
 | 
			
		||||
 | 
			
		||||
    /* Temporarily used during probing */
 | 
			
		||||
    snd_pcm_t *input_pcm;
 | 
			
		||||
    snd_pcm_t *output_pcm;
 | 
			
		||||
 | 
			
		||||
    pa_sink *sink;
 | 
			
		||||
    pa_source *source;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
struct pa_alsa_profile {
 | 
			
		||||
    pa_alsa_profile_set *profile_set;
 | 
			
		||||
 | 
			
		||||
    char *name;
 | 
			
		||||
    char *description;
 | 
			
		||||
    unsigned priority;
 | 
			
		||||
 | 
			
		||||
    pa_bool_t supported:1;
 | 
			
		||||
 | 
			
		||||
    char **input_mapping_names;
 | 
			
		||||
    char **output_mapping_names;
 | 
			
		||||
 | 
			
		||||
    pa_idxset *input_mappings;
 | 
			
		||||
    pa_idxset *output_mappings;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
struct pa_alsa_profile_set {
 | 
			
		||||
    pa_hashmap *mappings;
 | 
			
		||||
    pa_hashmap *profiles;
 | 
			
		||||
 | 
			
		||||
    pa_bool_t auto_profiles;
 | 
			
		||||
    pa_bool_t probed:1;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
void pa_alsa_mapping_dump(pa_alsa_mapping *m);
 | 
			
		||||
void pa_alsa_profile_dump(pa_alsa_profile *p);
 | 
			
		||||
 | 
			
		||||
pa_alsa_profile_set* pa_alsa_profile_set_new(const char *fname, const pa_channel_map *bonus);
 | 
			
		||||
void pa_alsa_profile_set_probe(pa_alsa_profile_set *ps, const char *dev_id, const pa_sample_spec *ss);
 | 
			
		||||
void pa_alsa_profile_set_free(pa_alsa_profile_set *s);
 | 
			
		||||
void pa_alsa_profile_set_dump(pa_alsa_profile_set *s);
 | 
			
		||||
 | 
			
		||||
snd_mixer_t *pa_alsa_open_mixer_for_pcm(snd_pcm_t *pcm, char **ctl_device);
 | 
			
		||||
 | 
			
		||||
pa_alsa_fdlist *pa_alsa_fdlist_new(void);
 | 
			
		||||
void pa_alsa_fdlist_free(pa_alsa_fdlist *fdl);
 | 
			
		||||
int pa_alsa_fdlist_set_mixer(pa_alsa_fdlist *fdl, snd_mixer_t *mixer_handle, pa_mainloop_api* m);
 | 
			
		||||
 | 
			
		||||
/* Data structure for inclusion in pa_device_port for alsa
 | 
			
		||||
 * sinks/sources. This contains nothing that needs to be freed
 | 
			
		||||
 * individually */
 | 
			
		||||
struct pa_alsa_port_data {
 | 
			
		||||
    pa_alsa_path *path;
 | 
			
		||||
    pa_alsa_setting *setting;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
void pa_alsa_add_ports(pa_hashmap **p, pa_alsa_path_set *ps);
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
| 
						 | 
				
			
			@ -80,11 +80,9 @@ struct userdata {
 | 
			
		|||
 | 
			
		||||
    pa_alsa_fdlist *mixer_fdl;
 | 
			
		||||
    snd_mixer_t *mixer_handle;
 | 
			
		||||
    snd_mixer_elem_t *mixer_elem;
 | 
			
		||||
    long hw_volume_max, hw_volume_min;
 | 
			
		||||
    long hw_dB_max, hw_dB_min;
 | 
			
		||||
    pa_bool_t hw_dB_supported:1;
 | 
			
		||||
    pa_bool_t mixer_seperate_channels:1;
 | 
			
		||||
    pa_alsa_path_set *mixer_path_set;
 | 
			
		||||
    pa_alsa_path *mixer_path;
 | 
			
		||||
 | 
			
		||||
    pa_cvolume hardware_volume;
 | 
			
		||||
 | 
			
		||||
    size_t
 | 
			
		||||
| 
						 | 
				
			
			@ -100,7 +98,8 @@ struct userdata {
 | 
			
		|||
    unsigned nfragments;
 | 
			
		||||
    pa_memchunk memchunk;
 | 
			
		||||
 | 
			
		||||
    char *device_name;
 | 
			
		||||
    char *device_name;  /* name of the PCM device */
 | 
			
		||||
    char *control_device; /* name of the control device */
 | 
			
		||||
 | 
			
		||||
    pa_bool_t use_mmap:1, use_tsched:1;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -991,191 +990,58 @@ static int mixer_callback(snd_mixer_elem_t *elem, unsigned int mask) {
 | 
			
		|||
    return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static pa_volume_t from_alsa_volume(struct userdata *u, long alsa_vol) {
 | 
			
		||||
 | 
			
		||||
    return (pa_volume_t) round(((double) (alsa_vol - u->hw_volume_min) * PA_VOLUME_NORM) /
 | 
			
		||||
                               (double) (u->hw_volume_max - u->hw_volume_min));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static long to_alsa_volume(struct userdata *u, pa_volume_t vol) {
 | 
			
		||||
    long alsa_vol;
 | 
			
		||||
 | 
			
		||||
    alsa_vol = (long) round(((double) vol * (double) (u->hw_volume_max - u->hw_volume_min))
 | 
			
		||||
                            / PA_VOLUME_NORM) + u->hw_volume_min;
 | 
			
		||||
 | 
			
		||||
    return PA_CLAMP_UNLIKELY(alsa_vol, u->hw_volume_min, u->hw_volume_max);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void sink_get_volume_cb(pa_sink *s) {
 | 
			
		||||
    struct userdata *u = s->userdata;
 | 
			
		||||
    int err;
 | 
			
		||||
    unsigned i;
 | 
			
		||||
    pa_cvolume r;
 | 
			
		||||
    char t[PA_CVOLUME_SNPRINT_MAX];
 | 
			
		||||
 | 
			
		||||
    pa_assert(u);
 | 
			
		||||
    pa_assert(u->mixer_elem);
 | 
			
		||||
    pa_assert(u->mixer_path);
 | 
			
		||||
    pa_assert(u->mixer_handle);
 | 
			
		||||
 | 
			
		||||
    if (u->mixer_seperate_channels) {
 | 
			
		||||
    if (pa_alsa_path_get_volume(u->mixer_path, u->mixer_handle, &s->channel_map, &r) < 0)
 | 
			
		||||
        return;
 | 
			
		||||
 | 
			
		||||
        r.channels = s->sample_spec.channels;
 | 
			
		||||
 | 
			
		||||
        for (i = 0; i < s->sample_spec.channels; i++) {
 | 
			
		||||
            long alsa_vol;
 | 
			
		||||
 | 
			
		||||
            if (u->hw_dB_supported) {
 | 
			
		||||
 | 
			
		||||
                if ((err = snd_mixer_selem_get_playback_dB(u->mixer_elem, u->mixer_map[i], &alsa_vol)) < 0)
 | 
			
		||||
                    goto fail;
 | 
			
		||||
 | 
			
		||||
#ifdef HAVE_VALGRIND_MEMCHECK_H
 | 
			
		||||
                VALGRIND_MAKE_MEM_DEFINED(&alsa_vol, sizeof(alsa_vol));
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
                r.values[i] = pa_sw_volume_from_dB((double) (alsa_vol - u->hw_dB_max) / 100.0);
 | 
			
		||||
            } else {
 | 
			
		||||
 | 
			
		||||
                if ((err = snd_mixer_selem_get_playback_volume(u->mixer_elem, u->mixer_map[i], &alsa_vol)) < 0)
 | 
			
		||||
                    goto fail;
 | 
			
		||||
 | 
			
		||||
                r.values[i] = from_alsa_volume(u, alsa_vol);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
    } else {
 | 
			
		||||
        long alsa_vol;
 | 
			
		||||
 | 
			
		||||
        if (u->hw_dB_supported) {
 | 
			
		||||
 | 
			
		||||
            if ((err = snd_mixer_selem_get_playback_dB(u->mixer_elem, SND_MIXER_SCHN_MONO, &alsa_vol)) < 0)
 | 
			
		||||
                goto fail;
 | 
			
		||||
 | 
			
		||||
#ifdef HAVE_VALGRIND_MEMCHECK_H
 | 
			
		||||
            VALGRIND_MAKE_MEM_DEFINED(&alsa_vol, sizeof(alsa_vol));
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
            pa_cvolume_set(&r, s->sample_spec.channels, pa_sw_volume_from_dB((double) (alsa_vol - u->hw_dB_max) / 100.0));
 | 
			
		||||
 | 
			
		||||
        } else {
 | 
			
		||||
 | 
			
		||||
            if ((err = snd_mixer_selem_get_playback_volume(u->mixer_elem, SND_MIXER_SCHN_MONO, &alsa_vol)) < 0)
 | 
			
		||||
                goto fail;
 | 
			
		||||
 | 
			
		||||
            pa_cvolume_set(&r, s->sample_spec.channels, from_alsa_volume(u, alsa_vol));
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    /* Shift down by the base volume, so that 0dB becomes maximum volume */
 | 
			
		||||
    pa_sw_cvolume_multiply_scalar(&r, &r, s->base_volume);
 | 
			
		||||
 | 
			
		||||
    pa_log_debug("Read hardware volume: %s", pa_cvolume_snprint(t, sizeof(t), &r));
 | 
			
		||||
 | 
			
		||||
    if (!pa_cvolume_equal(&u->hardware_volume, &r)) {
 | 
			
		||||
    if (pa_cvolume_equal(&u->hardware_volume, &r))
 | 
			
		||||
        return;
 | 
			
		||||
 | 
			
		||||
        s->virtual_volume = u->hardware_volume = r;
 | 
			
		||||
    s->virtual_volume = u->hardware_volume = r;
 | 
			
		||||
 | 
			
		||||
        if (u->hw_dB_supported) {
 | 
			
		||||
            pa_cvolume reset;
 | 
			
		||||
    if (u->mixer_path->has_dB) {
 | 
			
		||||
        pa_cvolume reset;
 | 
			
		||||
 | 
			
		||||
            /* Hmm, so the hardware volume changed, let's reset our software volume */
 | 
			
		||||
            pa_cvolume_reset(&reset, s->sample_spec.channels);
 | 
			
		||||
            pa_sink_set_soft_volume(s, &reset);
 | 
			
		||||
        }
 | 
			
		||||
        /* Hmm, so the hardware volume changed, let's reset our software volume */
 | 
			
		||||
        pa_cvolume_reset(&reset, s->sample_spec.channels);
 | 
			
		||||
        pa_sink_set_soft_volume(s, &reset);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return;
 | 
			
		||||
 | 
			
		||||
fail:
 | 
			
		||||
    pa_log_error("Unable to read volume: %s", pa_alsa_strerror(err));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void sink_set_volume_cb(pa_sink *s) {
 | 
			
		||||
    struct userdata *u = s->userdata;
 | 
			
		||||
    int err;
 | 
			
		||||
    unsigned i;
 | 
			
		||||
    pa_cvolume r;
 | 
			
		||||
    char t[PA_CVOLUME_SNPRINT_MAX];
 | 
			
		||||
 | 
			
		||||
    pa_assert(u);
 | 
			
		||||
    pa_assert(u->mixer_elem);
 | 
			
		||||
    pa_assert(u->mixer_path);
 | 
			
		||||
    pa_assert(u->mixer_handle);
 | 
			
		||||
 | 
			
		||||
    if (u->mixer_seperate_channels) {
 | 
			
		||||
    /* Shift up by the base volume */
 | 
			
		||||
    pa_sw_cvolume_divide_scalar(&r, &s->virtual_volume, s->base_volume);
 | 
			
		||||
 | 
			
		||||
        r.channels = s->sample_spec.channels;
 | 
			
		||||
    if (pa_alsa_path_set_volume(u->mixer_path, u->mixer_handle, &s->channel_map, &r) < 0)
 | 
			
		||||
        return;
 | 
			
		||||
 | 
			
		||||
        for (i = 0; i < s->sample_spec.channels; i++) {
 | 
			
		||||
            long alsa_vol;
 | 
			
		||||
            pa_volume_t vol;
 | 
			
		||||
 | 
			
		||||
            vol = s->virtual_volume.values[i];
 | 
			
		||||
 | 
			
		||||
            if (u->hw_dB_supported) {
 | 
			
		||||
 | 
			
		||||
                alsa_vol = (long) (pa_sw_volume_to_dB(vol) * 100);
 | 
			
		||||
                alsa_vol += u->hw_dB_max;
 | 
			
		||||
                alsa_vol = PA_CLAMP_UNLIKELY(alsa_vol, u->hw_dB_min, u->hw_dB_max);
 | 
			
		||||
 | 
			
		||||
                if ((err = snd_mixer_selem_set_playback_dB(u->mixer_elem, u->mixer_map[i], alsa_vol, 1)) < 0)
 | 
			
		||||
                    goto fail;
 | 
			
		||||
 | 
			
		||||
                if ((err = snd_mixer_selem_get_playback_dB(u->mixer_elem, u->mixer_map[i], &alsa_vol)) < 0)
 | 
			
		||||
                    goto fail;
 | 
			
		||||
 | 
			
		||||
#ifdef HAVE_VALGRIND_MEMCHECK_H
 | 
			
		||||
                VALGRIND_MAKE_MEM_DEFINED(&alsa_vol, sizeof(alsa_vol));
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
                r.values[i] = pa_sw_volume_from_dB((double) (alsa_vol - u->hw_dB_max) / 100.0);
 | 
			
		||||
 | 
			
		||||
            } else {
 | 
			
		||||
                alsa_vol = to_alsa_volume(u, vol);
 | 
			
		||||
 | 
			
		||||
                if ((err = snd_mixer_selem_set_playback_volume(u->mixer_elem, u->mixer_map[i], alsa_vol)) < 0)
 | 
			
		||||
                    goto fail;
 | 
			
		||||
 | 
			
		||||
                if ((err = snd_mixer_selem_get_playback_volume(u->mixer_elem, u->mixer_map[i], &alsa_vol)) < 0)
 | 
			
		||||
                    goto fail;
 | 
			
		||||
 | 
			
		||||
                r.values[i] = from_alsa_volume(u, alsa_vol);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
    } else {
 | 
			
		||||
        pa_volume_t vol;
 | 
			
		||||
        long alsa_vol;
 | 
			
		||||
 | 
			
		||||
        vol = pa_cvolume_max(&s->virtual_volume);
 | 
			
		||||
 | 
			
		||||
        if (u->hw_dB_supported) {
 | 
			
		||||
            alsa_vol = (long) (pa_sw_volume_to_dB(vol) * 100);
 | 
			
		||||
            alsa_vol += u->hw_dB_max;
 | 
			
		||||
            alsa_vol = PA_CLAMP_UNLIKELY(alsa_vol, u->hw_dB_min, u->hw_dB_max);
 | 
			
		||||
 | 
			
		||||
            if ((err = snd_mixer_selem_set_playback_dB_all(u->mixer_elem, alsa_vol, 1)) < 0)
 | 
			
		||||
                goto fail;
 | 
			
		||||
 | 
			
		||||
            if ((err = snd_mixer_selem_get_playback_dB(u->mixer_elem, SND_MIXER_SCHN_MONO, &alsa_vol)) < 0)
 | 
			
		||||
                goto fail;
 | 
			
		||||
 | 
			
		||||
#ifdef HAVE_VALGRIND_MEMCHECK_H
 | 
			
		||||
            VALGRIND_MAKE_MEM_DEFINED(&alsa_vol, sizeof(alsa_vol));
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
            pa_cvolume_set(&r, s->sample_spec.channels, pa_sw_volume_from_dB((double) (alsa_vol - u->hw_dB_max) / 100.0));
 | 
			
		||||
 | 
			
		||||
        } else {
 | 
			
		||||
            alsa_vol = to_alsa_volume(u, vol);
 | 
			
		||||
 | 
			
		||||
            if ((err = snd_mixer_selem_set_playback_volume_all(u->mixer_elem, alsa_vol)) < 0)
 | 
			
		||||
                goto fail;
 | 
			
		||||
 | 
			
		||||
            if ((err = snd_mixer_selem_get_playback_volume(u->mixer_elem, SND_MIXER_SCHN_MONO, &alsa_vol)) < 0)
 | 
			
		||||
                goto fail;
 | 
			
		||||
 | 
			
		||||
            pa_cvolume_set(&r, s->sample_spec.channels, from_alsa_volume(u, alsa_vol));
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    /* Shift down by the base volume, so that 0dB becomes maximum volume */
 | 
			
		||||
    pa_sw_cvolume_multiply_scalar(&r, &r, s->base_volume);
 | 
			
		||||
 | 
			
		||||
    u->hardware_volume = r;
 | 
			
		||||
 | 
			
		||||
    if (u->hw_dB_supported) {
 | 
			
		||||
        char t[PA_CVOLUME_SNPRINT_MAX];
 | 
			
		||||
    if (u->mixer_path->has_dB) {
 | 
			
		||||
 | 
			
		||||
        /* Match exactly what the user requested by software */
 | 
			
		||||
        pa_sw_cvolume_divide(&s->soft_volume, &s->virtual_volume, &u->hardware_volume);
 | 
			
		||||
| 
						 | 
				
			
			@ -1184,45 +1050,75 @@ static void sink_set_volume_cb(pa_sink *s) {
 | 
			
		|||
        pa_log_debug("Got hardware volume: %s", pa_cvolume_snprint(t, sizeof(t), &u->hardware_volume));
 | 
			
		||||
        pa_log_debug("Calculated software volume: %s", pa_cvolume_snprint(t, sizeof(t), &s->soft_volume));
 | 
			
		||||
 | 
			
		||||
    } else
 | 
			
		||||
    } else {
 | 
			
		||||
        pa_log_debug("Wrote hardware volume: %s", pa_cvolume_snprint(t, sizeof(t), &r));
 | 
			
		||||
 | 
			
		||||
        /* We can't match exactly what the user requested, hence let's
 | 
			
		||||
         * at least tell the user about it */
 | 
			
		||||
 | 
			
		||||
        s->virtual_volume = r;
 | 
			
		||||
 | 
			
		||||
    return;
 | 
			
		||||
 | 
			
		||||
fail:
 | 
			
		||||
    pa_log_error("Unable to set volume: %s", pa_alsa_strerror(err));
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void sink_get_mute_cb(pa_sink *s) {
 | 
			
		||||
    struct userdata *u = s->userdata;
 | 
			
		||||
    int err, sw = 0;
 | 
			
		||||
    pa_bool_t b;
 | 
			
		||||
 | 
			
		||||
    pa_assert(u);
 | 
			
		||||
    pa_assert(u->mixer_elem);
 | 
			
		||||
    pa_assert(u->mixer_path);
 | 
			
		||||
    pa_assert(u->mixer_handle);
 | 
			
		||||
 | 
			
		||||
    if ((err = snd_mixer_selem_get_playback_switch(u->mixer_elem, 0, &sw)) < 0) {
 | 
			
		||||
        pa_log_error("Unable to get switch: %s", pa_alsa_strerror(err));
 | 
			
		||||
    if (pa_alsa_path_get_mute(u->mixer_path, u->mixer_handle, &b) < 0)
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    s->muted = !sw;
 | 
			
		||||
    s->muted = b;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void sink_set_mute_cb(pa_sink *s) {
 | 
			
		||||
    struct userdata *u = s->userdata;
 | 
			
		||||
    int err;
 | 
			
		||||
 | 
			
		||||
    pa_assert(u);
 | 
			
		||||
    pa_assert(u->mixer_elem);
 | 
			
		||||
    pa_assert(u->mixer_path);
 | 
			
		||||
    pa_assert(u->mixer_handle);
 | 
			
		||||
 | 
			
		||||
    if ((err = snd_mixer_selem_set_playback_switch_all(u->mixer_elem, !s->muted)) < 0) {
 | 
			
		||||
        pa_log_error("Unable to set switch: %s", pa_alsa_strerror(err));
 | 
			
		||||
        return;
 | 
			
		||||
    pa_alsa_path_set_mute(u->mixer_path, u->mixer_handle, s->muted);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int sink_set_port_cb(pa_sink *s, pa_device_port *p) {
 | 
			
		||||
    struct userdata *u = s->userdata;
 | 
			
		||||
    pa_alsa_port_data *data;
 | 
			
		||||
 | 
			
		||||
    pa_assert(u);
 | 
			
		||||
    pa_assert(p);
 | 
			
		||||
    pa_assert(u->mixer_handle);
 | 
			
		||||
 | 
			
		||||
    data = PA_DEVICE_PORT_DATA(p);
 | 
			
		||||
 | 
			
		||||
    pa_assert_se(u->mixer_path = data->path);
 | 
			
		||||
    pa_alsa_path_select(u->mixer_path, u->mixer_handle);
 | 
			
		||||
 | 
			
		||||
    if (u->mixer_path->has_volume && u->mixer_path->has_dB) {
 | 
			
		||||
        s->base_volume = pa_sw_volume_from_dB(-u->mixer_path->max_dB);
 | 
			
		||||
        s->n_volume_steps = PA_VOLUME_NORM+1;
 | 
			
		||||
 | 
			
		||||
        if (u->mixer_path->max_dB > 0.0)
 | 
			
		||||
            pa_log_info("Fixing base volume to %0.2f dB", pa_sw_volume_to_dB(s->base_volume));
 | 
			
		||||
        else
 | 
			
		||||
            pa_log_info("No particular base volume set, fixing to 0 dB");
 | 
			
		||||
    } else {
 | 
			
		||||
        s->base_volume = PA_VOLUME_NORM;
 | 
			
		||||
        s->n_volume_steps = u->mixer_path->max_volume - u->mixer_path->min_volume + 1;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (data->setting)
 | 
			
		||||
        pa_alsa_setting_select(data->setting, u->mixer_handle);
 | 
			
		||||
 | 
			
		||||
    if (s->set_mute)
 | 
			
		||||
        s->set_mute(s);
 | 
			
		||||
    if (s->set_volume)
 | 
			
		||||
        s->set_volume(s);
 | 
			
		||||
 | 
			
		||||
    return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void sink_update_requested_latency_cb(pa_sink *s) {
 | 
			
		||||
| 
						 | 
				
			
			@ -1465,77 +1361,127 @@ static void set_sink_name(pa_sink_new_data *data, pa_modargs *ma, const char *de
 | 
			
		|||
    pa_xfree(t);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void find_mixer(struct userdata *u, pa_alsa_mapping *mapping, const char *element, pa_bool_t ignore_dB) {
 | 
			
		||||
 | 
			
		||||
    if (!mapping && !element)
 | 
			
		||||
        return;
 | 
			
		||||
 | 
			
		||||
    if (!(u->mixer_handle = pa_alsa_open_mixer_for_pcm(u->pcm_handle, &u->control_device))) {
 | 
			
		||||
        pa_log_info("Failed to find a working mixer device.");
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (element) {
 | 
			
		||||
 | 
			
		||||
        if (!(u->mixer_path = pa_alsa_path_synthesize(element, PA_ALSA_DIRECTION_OUTPUT)))
 | 
			
		||||
            goto fail;
 | 
			
		||||
 | 
			
		||||
        if (pa_alsa_path_probe(u->mixer_path, u->mixer_handle, ignore_dB) < 0)
 | 
			
		||||
            goto fail;
 | 
			
		||||
 | 
			
		||||
        pa_log_debug("Probed mixer path %s:", u->mixer_path->name);
 | 
			
		||||
        pa_alsa_path_dump(u->mixer_path);
 | 
			
		||||
    } else {
 | 
			
		||||
 | 
			
		||||
        if (!(u->mixer_path_set = pa_alsa_path_set_new(mapping, PA_ALSA_DIRECTION_OUTPUT)))
 | 
			
		||||
            goto fail;
 | 
			
		||||
 | 
			
		||||
        pa_alsa_path_set_probe(u->mixer_path_set, u->mixer_handle, ignore_dB);
 | 
			
		||||
 | 
			
		||||
        pa_log_debug("Probed mixer paths:");
 | 
			
		||||
        pa_alsa_path_set_dump(u->mixer_path_set);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return;
 | 
			
		||||
 | 
			
		||||
fail:
 | 
			
		||||
 | 
			
		||||
    if (u->mixer_path_set) {
 | 
			
		||||
        pa_alsa_path_set_free(u->mixer_path_set);
 | 
			
		||||
        u->mixer_path_set = NULL;
 | 
			
		||||
    } else if (u->mixer_path) {
 | 
			
		||||
        pa_alsa_path_free(u->mixer_path);
 | 
			
		||||
        u->mixer_path = NULL;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (u->mixer_handle) {
 | 
			
		||||
        snd_mixer_close(u->mixer_handle);
 | 
			
		||||
        u->mixer_handle = NULL;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int setup_mixer(struct userdata *u, pa_bool_t ignore_dB) {
 | 
			
		||||
    pa_assert(u);
 | 
			
		||||
 | 
			
		||||
    if (!u->mixer_handle)
 | 
			
		||||
        return 0;
 | 
			
		||||
 | 
			
		||||
    pa_assert(u->mixer_elem);
 | 
			
		||||
    if (u->sink->active_port) {
 | 
			
		||||
        pa_alsa_port_data *data;
 | 
			
		||||
 | 
			
		||||
    if (snd_mixer_selem_has_playback_volume(u->mixer_elem)) {
 | 
			
		||||
        pa_bool_t suitable = FALSE;
 | 
			
		||||
        /* We have a list of supported paths, so let's activate the
 | 
			
		||||
         * one that has been chosen as active */
 | 
			
		||||
 | 
			
		||||
        if (snd_mixer_selem_get_playback_volume_range(u->mixer_elem, &u->hw_volume_min, &u->hw_volume_max) < 0)
 | 
			
		||||
            pa_log_info("Failed to get volume range. Falling back to software volume control.");
 | 
			
		||||
        else if (u->hw_volume_min >= u->hw_volume_max)
 | 
			
		||||
            pa_log_warn("Your kernel driver is broken: it reports a volume range from %li to %li which makes no sense.", u->hw_volume_min, u->hw_volume_max);
 | 
			
		||||
        else {
 | 
			
		||||
            pa_log_info("Volume ranges from %li to %li.", u->hw_volume_min, u->hw_volume_max);
 | 
			
		||||
            suitable = TRUE;
 | 
			
		||||
        }
 | 
			
		||||
        data = PA_DEVICE_PORT_DATA(u->sink->active_port);
 | 
			
		||||
        u->mixer_path = data->path;
 | 
			
		||||
 | 
			
		||||
        if (suitable) {
 | 
			
		||||
            if (ignore_dB || snd_mixer_selem_get_playback_dB_range(u->mixer_elem, &u->hw_dB_min, &u->hw_dB_max) < 0)
 | 
			
		||||
                pa_log_info("Mixer doesn't support dB information or data is ignored.");
 | 
			
		||||
            else {
 | 
			
		||||
#ifdef HAVE_VALGRIND_MEMCHECK_H
 | 
			
		||||
                VALGRIND_MAKE_MEM_DEFINED(&u->hw_dB_min, sizeof(u->hw_dB_min));
 | 
			
		||||
                VALGRIND_MAKE_MEM_DEFINED(&u->hw_dB_max, sizeof(u->hw_dB_max));
 | 
			
		||||
#endif
 | 
			
		||||
        pa_alsa_path_select(data->path, u->mixer_handle);
 | 
			
		||||
 | 
			
		||||
                if (u->hw_dB_min >= u->hw_dB_max)
 | 
			
		||||
                    pa_log_warn("Your kernel driver is broken: it reports a volume range from %0.2f dB to %0.2f dB which makes no sense.", (double) u->hw_dB_min/100.0, (double) u->hw_dB_max/100.0);
 | 
			
		||||
                else {
 | 
			
		||||
                    pa_log_info("Volume ranges from %0.2f dB to %0.2f dB.", (double) u->hw_dB_min/100.0, (double) u->hw_dB_max/100.0);
 | 
			
		||||
                    u->hw_dB_supported = TRUE;
 | 
			
		||||
        if (data->setting)
 | 
			
		||||
            pa_alsa_setting_select(data->setting, u->mixer_handle);
 | 
			
		||||
 | 
			
		||||
                    if (u->hw_dB_max > 0) {
 | 
			
		||||
                        u->sink->base_volume = pa_sw_volume_from_dB(- (double) u->hw_dB_max/100.0);
 | 
			
		||||
                        pa_log_info("Fixing base volume to %0.2f dB", pa_sw_volume_to_dB(u->sink->base_volume));
 | 
			
		||||
                    } else
 | 
			
		||||
                        pa_log_info("No particular base volume set, fixing to 0 dB");
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
    } else {
 | 
			
		||||
 | 
			
		||||
            if (!u->hw_dB_supported &&
 | 
			
		||||
                u->hw_volume_max - u->hw_volume_min < 3) {
 | 
			
		||||
        if (!u->mixer_path && u->mixer_path_set)
 | 
			
		||||
            u->mixer_path = u->mixer_path_set->paths;
 | 
			
		||||
 | 
			
		||||
                pa_log_info("Device doesn't do dB volume and has less than 4 volume levels. Falling back to software volume control.");
 | 
			
		||||
                suitable = FALSE;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        if (u->mixer_path) {
 | 
			
		||||
            /* Hmm, we have only a single path, then let's activate it */
 | 
			
		||||
 | 
			
		||||
        if (suitable) {
 | 
			
		||||
            u->mixer_seperate_channels = pa_alsa_calc_mixer_map(u->mixer_elem, &u->sink->channel_map, u->mixer_map, TRUE) >= 0;
 | 
			
		||||
            pa_alsa_path_select(u->mixer_path, u->mixer_handle);
 | 
			
		||||
 | 
			
		||||
            u->sink->get_volume = sink_get_volume_cb;
 | 
			
		||||
            u->sink->set_volume = sink_set_volume_cb;
 | 
			
		||||
            u->sink->flags |= PA_SINK_HW_VOLUME_CTRL | (u->hw_dB_supported ? PA_SINK_DECIBEL_VOLUME : 0);
 | 
			
		||||
            pa_log_info("Using hardware volume control. Hardware dB scale %s.", u->hw_dB_supported ? "supported" : "not supported");
 | 
			
		||||
 | 
			
		||||
            if (!u->hw_dB_supported)
 | 
			
		||||
                u->sink->n_volume_steps = u->hw_volume_max - u->hw_volume_min + 1;
 | 
			
		||||
            if (u->mixer_path->settings)
 | 
			
		||||
                pa_alsa_setting_select(u->mixer_path->settings, u->mixer_handle);
 | 
			
		||||
        } else
 | 
			
		||||
            pa_log_info("Using software volume control.");
 | 
			
		||||
            return 0;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (snd_mixer_selem_has_playback_switch(u->mixer_elem)) {
 | 
			
		||||
    if (!u->mixer_path->has_volume)
 | 
			
		||||
        pa_log_info("Driver does not support hardware volume control, falling back to software volume control.");
 | 
			
		||||
    else {
 | 
			
		||||
 | 
			
		||||
        if (u->mixer_path->has_dB) {
 | 
			
		||||
            pa_log_info("Hardware volume ranges from %0.2f dB to %0.2f dB.", u->mixer_path->min_dB, u->mixer_path->max_dB);
 | 
			
		||||
 | 
			
		||||
            u->sink->base_volume = pa_sw_volume_from_dB(-u->mixer_path->max_dB);
 | 
			
		||||
            u->sink->n_volume_steps = PA_VOLUME_NORM+1;
 | 
			
		||||
 | 
			
		||||
            if (u->mixer_path->max_dB > 0.0)
 | 
			
		||||
                pa_log_info("Fixing base volume to %0.2f dB", pa_sw_volume_to_dB(u->sink->base_volume));
 | 
			
		||||
            else
 | 
			
		||||
                pa_log_info("No particular base volume set, fixing to 0 dB");
 | 
			
		||||
 | 
			
		||||
        } else {
 | 
			
		||||
            pa_log_info("Hardware volume ranges from %li to %li.", u->mixer_path->min_volume, u->mixer_path->max_volume);
 | 
			
		||||
            u->sink->base_volume = PA_VOLUME_NORM;
 | 
			
		||||
            u->sink->n_volume_steps = u->mixer_path->max_volume - u->mixer_path->min_volume + 1;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        u->sink->get_volume = sink_get_volume_cb;
 | 
			
		||||
        u->sink->set_volume = sink_set_volume_cb;
 | 
			
		||||
 | 
			
		||||
        u->sink->flags |= PA_SINK_HW_VOLUME_CTRL | (u->mixer_path->has_dB ? PA_SINK_DECIBEL_VOLUME : 0);
 | 
			
		||||
        pa_log_info("Using hardware volume control. Hardware dB scale %s.", u->mixer_path->has_dB ? "supported" : "not supported");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (!u->mixer_path->has_mute) {
 | 
			
		||||
        pa_log_info("Driver does not support hardware mute control, falling back to software mute control.");
 | 
			
		||||
    } else {
 | 
			
		||||
        u->sink->get_mute = sink_get_mute_cb;
 | 
			
		||||
        u->sink->set_mute = sink_set_mute_cb;
 | 
			
		||||
        u->sink->flags |= PA_SINK_HW_MUTE_CTRL;
 | 
			
		||||
    } else
 | 
			
		||||
        pa_log_info("Using software mute control.");
 | 
			
		||||
        pa_log_info("Using hardware mute control.");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    u->mixer_fdl = pa_alsa_fdlist_new();
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1544,13 +1490,15 @@ static int setup_mixer(struct userdata *u, pa_bool_t ignore_dB) {
 | 
			
		|||
        return -1;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    snd_mixer_elem_set_callback(u->mixer_elem, mixer_callback);
 | 
			
		||||
    snd_mixer_elem_set_callback_private(u->mixer_elem, u);
 | 
			
		||||
    if (u->mixer_path_set)
 | 
			
		||||
        pa_alsa_path_set_set_callback(u->mixer_path_set, u->mixer_handle, mixer_callback, u);
 | 
			
		||||
    else
 | 
			
		||||
        pa_alsa_path_set_callback(u->mixer_path, u->mixer_handle, mixer_callback, u);
 | 
			
		||||
 | 
			
		||||
    return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
pa_sink *pa_alsa_sink_new(pa_module *m, pa_modargs *ma, const char*driver, pa_card *card, const pa_alsa_profile_info *profile) {
 | 
			
		||||
pa_sink *pa_alsa_sink_new(pa_module *m, pa_modargs *ma, const char*driver, pa_card *card, pa_alsa_mapping *mapping) {
 | 
			
		||||
 | 
			
		||||
    struct userdata *u = NULL;
 | 
			
		||||
    const char *dev_id = NULL;
 | 
			
		||||
| 
						 | 
				
			
			@ -1561,7 +1509,7 @@ pa_sink *pa_alsa_sink_new(pa_module *m, pa_modargs *ma, const char*driver, pa_ca
 | 
			
		|||
    size_t frame_size;
 | 
			
		||||
    pa_bool_t use_mmap = TRUE, b, use_tsched = TRUE, d, ignore_dB = FALSE;
 | 
			
		||||
    pa_sink_new_data data;
 | 
			
		||||
    char *control_device = NULL;
 | 
			
		||||
    pa_alsa_profile_set *profile_set = NULL;
 | 
			
		||||
 | 
			
		||||
    pa_assert(m);
 | 
			
		||||
    pa_assert(ma);
 | 
			
		||||
| 
						 | 
				
			
			@ -1646,32 +1594,35 @@ pa_sink *pa_alsa_sink_new(pa_module *m, pa_modargs *ma, const char*driver, pa_ca
 | 
			
		|||
    b = use_mmap;
 | 
			
		||||
    d = use_tsched;
 | 
			
		||||
 | 
			
		||||
    if (profile) {
 | 
			
		||||
    if (mapping) {
 | 
			
		||||
 | 
			
		||||
        if (!(dev_id = pa_modargs_get_value(ma, "device_id", NULL))) {
 | 
			
		||||
            pa_log("device_id= not set");
 | 
			
		||||
            goto fail;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (!(u->pcm_handle = pa_alsa_open_by_device_id_profile(
 | 
			
		||||
        if (!(u->pcm_handle = pa_alsa_open_by_device_id_mapping(
 | 
			
		||||
                      dev_id,
 | 
			
		||||
                      &u->device_name,
 | 
			
		||||
                      &ss, &map,
 | 
			
		||||
                      SND_PCM_STREAM_PLAYBACK,
 | 
			
		||||
                      &nfrags, &period_frames, tsched_frames,
 | 
			
		||||
                      &b, &d, profile)))
 | 
			
		||||
                      &b, &d, mapping)))
 | 
			
		||||
 | 
			
		||||
            goto fail;
 | 
			
		||||
 | 
			
		||||
    } else if ((dev_id = pa_modargs_get_value(ma, "device_id", NULL))) {
 | 
			
		||||
 | 
			
		||||
        if (!(profile_set = pa_alsa_profile_set_new(NULL, &map)))
 | 
			
		||||
            goto fail;
 | 
			
		||||
 | 
			
		||||
        if (!(u->pcm_handle = pa_alsa_open_by_device_id_auto(
 | 
			
		||||
                      dev_id,
 | 
			
		||||
                      &u->device_name,
 | 
			
		||||
                      &ss, &map,
 | 
			
		||||
                      SND_PCM_STREAM_PLAYBACK,
 | 
			
		||||
                      &nfrags, &period_frames, tsched_frames,
 | 
			
		||||
                      &b, &d, &profile)))
 | 
			
		||||
                      &b, &d, profile_set, &mapping)))
 | 
			
		||||
 | 
			
		||||
            goto fail;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1685,7 +1636,6 @@ pa_sink *pa_alsa_sink_new(pa_module *m, pa_modargs *ma, const char*driver, pa_ca
 | 
			
		|||
                      &nfrags, &period_frames, tsched_frames,
 | 
			
		||||
                      &b, &d, FALSE)))
 | 
			
		||||
            goto fail;
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    pa_assert(u->device_name);
 | 
			
		||||
| 
						 | 
				
			
			@ -1696,8 +1646,8 @@ pa_sink *pa_alsa_sink_new(pa_module *m, pa_modargs *ma, const char*driver, pa_ca
 | 
			
		|||
        goto fail;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (profile)
 | 
			
		||||
        pa_log_info("Selected configuration '%s' (%s).", profile->description, profile->name);
 | 
			
		||||
    if (mapping)
 | 
			
		||||
        pa_log_info("Selected mapping '%s' (%s).", mapping->description, mapping->name);
 | 
			
		||||
 | 
			
		||||
    if (use_mmap && !b) {
 | 
			
		||||
        pa_log_info("Device doesn't support mmap(), falling back to UNIX read/write mode.");
 | 
			
		||||
| 
						 | 
				
			
			@ -1723,7 +1673,7 @@ pa_sink *pa_alsa_sink_new(pa_module *m, pa_modargs *ma, const char*driver, pa_ca
 | 
			
		|||
    /* ALSA might tweak the sample spec, so recalculate the frame size */
 | 
			
		||||
    frame_size = pa_frame_size(&ss);
 | 
			
		||||
 | 
			
		||||
    pa_alsa_find_mixer_and_elem(u->pcm_handle, &control_device, &u->mixer_handle, &u->mixer_elem, pa_modargs_get_value(ma, "control", NULL), profile);
 | 
			
		||||
    find_mixer(u, mapping, pa_modargs_get_value(ma, "control", NULL), ignore_dB);
 | 
			
		||||
 | 
			
		||||
    pa_sink_new_data_init(&data);
 | 
			
		||||
    data.driver = driver;
 | 
			
		||||
| 
						 | 
				
			
			@ -1733,23 +1683,21 @@ pa_sink *pa_alsa_sink_new(pa_module *m, pa_modargs *ma, const char*driver, pa_ca
 | 
			
		|||
    pa_sink_new_data_set_sample_spec(&data, &ss);
 | 
			
		||||
    pa_sink_new_data_set_channel_map(&data, &map);
 | 
			
		||||
 | 
			
		||||
    pa_alsa_init_proplist_pcm(m->core, data.proplist, u->pcm_handle, u->mixer_elem);
 | 
			
		||||
    pa_alsa_init_proplist_pcm(m->core, data.proplist, u->pcm_handle);
 | 
			
		||||
    pa_proplist_sets(data.proplist, PA_PROP_DEVICE_STRING, u->device_name);
 | 
			
		||||
    pa_proplist_setf(data.proplist, PA_PROP_DEVICE_BUFFERING_BUFFER_SIZE, "%lu", (unsigned long) (period_frames * frame_size * nfrags));
 | 
			
		||||
    pa_proplist_setf(data.proplist, PA_PROP_DEVICE_BUFFERING_FRAGMENT_SIZE, "%lu", (unsigned long) (period_frames * frame_size));
 | 
			
		||||
    pa_proplist_sets(data.proplist, PA_PROP_DEVICE_ACCESS_MODE, u->use_tsched ? "mmap+timer" : (u->use_mmap ? "mmap" : "serial"));
 | 
			
		||||
 | 
			
		||||
    if (profile) {
 | 
			
		||||
        pa_proplist_sets(data.proplist, PA_PROP_DEVICE_PROFILE_NAME, profile->name);
 | 
			
		||||
        pa_proplist_sets(data.proplist, PA_PROP_DEVICE_PROFILE_DESCRIPTION, profile->description);
 | 
			
		||||
    if (mapping) {
 | 
			
		||||
        pa_proplist_sets(data.proplist, PA_PROP_DEVICE_PROFILE_NAME, mapping->name);
 | 
			
		||||
        pa_proplist_sets(data.proplist, PA_PROP_DEVICE_PROFILE_DESCRIPTION, mapping->description);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    pa_alsa_init_description(data.proplist);
 | 
			
		||||
 | 
			
		||||
    if (control_device) {
 | 
			
		||||
        pa_alsa_init_proplist_ctl(data.proplist, control_device);
 | 
			
		||||
        pa_xfree(control_device);
 | 
			
		||||
    }
 | 
			
		||||
    if (u->control_device)
 | 
			
		||||
        pa_alsa_init_proplist_ctl(data.proplist, u->control_device);
 | 
			
		||||
 | 
			
		||||
    if (pa_modargs_get_proplist(ma, "sink_properties", data.proplist, PA_UPDATE_REPLACE) < 0) {
 | 
			
		||||
        pa_log("Invalid properties");
 | 
			
		||||
| 
						 | 
				
			
			@ -1757,6 +1705,9 @@ pa_sink *pa_alsa_sink_new(pa_module *m, pa_modargs *ma, const char*driver, pa_ca
 | 
			
		|||
        goto fail;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (u->mixer_path_set)
 | 
			
		||||
        pa_alsa_add_ports(&data.ports, u->mixer_path_set);
 | 
			
		||||
 | 
			
		||||
    u->sink = pa_sink_new(m->core, &data, PA_SINK_HARDWARE|PA_SINK_LATENCY|(u->use_tsched ? PA_SINK_DYNAMIC_LATENCY : 0));
 | 
			
		||||
    pa_sink_new_data_done(&data);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1768,6 +1719,7 @@ pa_sink *pa_alsa_sink_new(pa_module *m, pa_modargs *ma, const char*driver, pa_ca
 | 
			
		|||
    u->sink->parent.process_msg = sink_process_msg;
 | 
			
		||||
    u->sink->update_requested_latency = sink_update_requested_latency_cb;
 | 
			
		||||
    u->sink->set_state = sink_set_state_cb;
 | 
			
		||||
    u->sink->set_port = sink_set_port_cb;
 | 
			
		||||
    u->sink->userdata = u;
 | 
			
		||||
 | 
			
		||||
    pa_sink_set_asyncmsgq(u->sink, u->thread_mq.inq);
 | 
			
		||||
| 
						 | 
				
			
			@ -1836,6 +1788,9 @@ pa_sink *pa_alsa_sink_new(pa_module *m, pa_modargs *ma, const char*driver, pa_ca
 | 
			
		|||
 | 
			
		||||
    pa_sink_put(u->sink);
 | 
			
		||||
 | 
			
		||||
    if (profile_set)
 | 
			
		||||
        pa_alsa_profile_set_free(profile_set);
 | 
			
		||||
 | 
			
		||||
    return u->sink;
 | 
			
		||||
 | 
			
		||||
fail:
 | 
			
		||||
| 
						 | 
				
			
			@ -1843,6 +1798,9 @@ fail:
 | 
			
		|||
    if (u)
 | 
			
		||||
        userdata_free(u);
 | 
			
		||||
 | 
			
		||||
    if (profile_set)
 | 
			
		||||
        pa_alsa_profile_set_free(profile_set);
 | 
			
		||||
 | 
			
		||||
    return NULL;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1871,17 +1829,22 @@ static void userdata_free(struct userdata *u) {
 | 
			
		|||
    if (u->rtpoll)
 | 
			
		||||
        pa_rtpoll_free(u->rtpoll);
 | 
			
		||||
 | 
			
		||||
    if (u->mixer_fdl)
 | 
			
		||||
        pa_alsa_fdlist_free(u->mixer_fdl);
 | 
			
		||||
 | 
			
		||||
    if (u->mixer_handle)
 | 
			
		||||
        snd_mixer_close(u->mixer_handle);
 | 
			
		||||
 | 
			
		||||
    if (u->pcm_handle) {
 | 
			
		||||
        snd_pcm_drop(u->pcm_handle);
 | 
			
		||||
        snd_pcm_close(u->pcm_handle);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (u->mixer_fdl)
 | 
			
		||||
        pa_alsa_fdlist_free(u->mixer_fdl);
 | 
			
		||||
 | 
			
		||||
    if (u->mixer_path_set)
 | 
			
		||||
        pa_alsa_path_set_free(u->mixer_path_set);
 | 
			
		||||
    else if (u->mixer_path)
 | 
			
		||||
        pa_alsa_path_free(u->mixer_path);
 | 
			
		||||
 | 
			
		||||
    if (u->mixer_handle)
 | 
			
		||||
        snd_mixer_close(u->mixer_handle);
 | 
			
		||||
 | 
			
		||||
    if (u->smoother)
 | 
			
		||||
        pa_smoother_free(u->smoother);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1889,6 +1852,7 @@ static void userdata_free(struct userdata *u) {
 | 
			
		|||
    monitor_done(u);
 | 
			
		||||
 | 
			
		||||
    pa_xfree(u->device_name);
 | 
			
		||||
    pa_xfree(u->control_device);
 | 
			
		||||
    pa_xfree(u);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -28,8 +28,9 @@
 | 
			
		|||
#include <pulsecore/sink.h>
 | 
			
		||||
 | 
			
		||||
#include "alsa-util.h"
 | 
			
		||||
#include "alsa-mixer.h"
 | 
			
		||||
 | 
			
		||||
pa_sink* pa_alsa_sink_new(pa_module *m, pa_modargs *ma, const char*driver, pa_card *card, const pa_alsa_profile_info *profile);
 | 
			
		||||
pa_sink* pa_alsa_sink_new(pa_module *m, pa_modargs *ma, const char*driver, pa_card *card, pa_alsa_mapping *mapping);
 | 
			
		||||
 | 
			
		||||
void pa_alsa_sink_free(pa_sink *s);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -28,10 +28,6 @@
 | 
			
		|||
 | 
			
		||||
#include <asoundlib.h>
 | 
			
		||||
 | 
			
		||||
#ifdef HAVE_VALGRIND_MEMCHECK_H
 | 
			
		||||
#include <valgrind/memcheck.h>
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#include <pulse/xmalloc.h>
 | 
			
		||||
#include <pulse/util.h>
 | 
			
		||||
#include <pulse/timeval.h>
 | 
			
		||||
| 
						 | 
				
			
			@ -81,11 +77,8 @@ struct userdata {
 | 
			
		|||
 | 
			
		||||
    pa_alsa_fdlist *mixer_fdl;
 | 
			
		||||
    snd_mixer_t *mixer_handle;
 | 
			
		||||
    snd_mixer_elem_t *mixer_elem;
 | 
			
		||||
    long hw_volume_max, hw_volume_min;
 | 
			
		||||
    long hw_dB_max, hw_dB_min;
 | 
			
		||||
    pa_bool_t hw_dB_supported:1;
 | 
			
		||||
    pa_bool_t mixer_seperate_channels:1;
 | 
			
		||||
    pa_alsa_path_set *mixer_path_set;
 | 
			
		||||
    pa_alsa_path *mixer_path;
 | 
			
		||||
 | 
			
		||||
    pa_cvolume hardware_volume;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -102,6 +95,7 @@ struct userdata {
 | 
			
		|||
    unsigned nfragments;
 | 
			
		||||
 | 
			
		||||
    char *device_name;
 | 
			
		||||
    char *control_device;
 | 
			
		||||
 | 
			
		||||
    pa_bool_t use_mmap:1, use_tsched:1;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -949,239 +943,135 @@ static int mixer_callback(snd_mixer_elem_t *elem, unsigned int mask) {
 | 
			
		|||
    return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static pa_volume_t from_alsa_volume(struct userdata *u, long alsa_vol) {
 | 
			
		||||
 | 
			
		||||
    return (pa_volume_t) round(((double) (alsa_vol - u->hw_volume_min) * PA_VOLUME_NORM) /
 | 
			
		||||
                               (double) (u->hw_volume_max - u->hw_volume_min));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static long to_alsa_volume(struct userdata *u, pa_volume_t vol) {
 | 
			
		||||
    long alsa_vol;
 | 
			
		||||
 | 
			
		||||
    alsa_vol = (long) round(((double) vol * (double) (u->hw_volume_max - u->hw_volume_min))
 | 
			
		||||
                            / PA_VOLUME_NORM) + u->hw_volume_min;
 | 
			
		||||
 | 
			
		||||
    return PA_CLAMP_UNLIKELY(alsa_vol, u->hw_volume_min, u->hw_volume_max);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void source_get_volume_cb(pa_source *s) {
 | 
			
		||||
    struct userdata *u = s->userdata;
 | 
			
		||||
    int err;
 | 
			
		||||
    unsigned i;
 | 
			
		||||
    pa_cvolume r;
 | 
			
		||||
    char t[PA_CVOLUME_SNPRINT_MAX];
 | 
			
		||||
 | 
			
		||||
    pa_assert(u);
 | 
			
		||||
    pa_assert(u->mixer_elem);
 | 
			
		||||
    pa_assert(u->mixer_path);
 | 
			
		||||
    pa_assert(u->mixer_handle);
 | 
			
		||||
 | 
			
		||||
    if (u->mixer_seperate_channels) {
 | 
			
		||||
    if (pa_alsa_path_get_volume(u->mixer_path, u->mixer_handle, &s->channel_map, &r) < 0)
 | 
			
		||||
        return;
 | 
			
		||||
 | 
			
		||||
        r.channels = s->sample_spec.channels;
 | 
			
		||||
 | 
			
		||||
        for (i = 0; i < s->sample_spec.channels; i++) {
 | 
			
		||||
            long alsa_vol;
 | 
			
		||||
 | 
			
		||||
            if (u->hw_dB_supported) {
 | 
			
		||||
 | 
			
		||||
                if ((err = snd_mixer_selem_get_capture_dB(u->mixer_elem, u->mixer_map[i], &alsa_vol)) < 0)
 | 
			
		||||
                    goto fail;
 | 
			
		||||
 | 
			
		||||
#ifdef HAVE_VALGRIND_MEMCHECK_H
 | 
			
		||||
                VALGRIND_MAKE_MEM_DEFINED(&alsa_vol, sizeof(alsa_vol));
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
                r.values[i] = pa_sw_volume_from_dB((double) (alsa_vol - u->hw_dB_max) / 100.0);
 | 
			
		||||
            } else {
 | 
			
		||||
 | 
			
		||||
                if ((err = snd_mixer_selem_get_capture_volume(u->mixer_elem, u->mixer_map[i], &alsa_vol)) < 0)
 | 
			
		||||
                    goto fail;
 | 
			
		||||
 | 
			
		||||
                r.values[i] = from_alsa_volume(u, alsa_vol);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
    } else {
 | 
			
		||||
        long alsa_vol;
 | 
			
		||||
 | 
			
		||||
        if (u->hw_dB_supported) {
 | 
			
		||||
 | 
			
		||||
            if ((err = snd_mixer_selem_get_capture_dB(u->mixer_elem, SND_MIXER_SCHN_MONO, &alsa_vol)) < 0)
 | 
			
		||||
                goto fail;
 | 
			
		||||
 | 
			
		||||
#ifdef HAVE_VALGRIND_MEMCHECK_H
 | 
			
		||||
            VALGRIND_MAKE_MEM_DEFINED(&alsa_vol, sizeof(alsa_vol));
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
            pa_cvolume_set(&r, s->sample_spec.channels, pa_sw_volume_from_dB((double) (alsa_vol - u->hw_dB_max) / 100.0));
 | 
			
		||||
 | 
			
		||||
        } else {
 | 
			
		||||
 | 
			
		||||
            if ((err = snd_mixer_selem_get_capture_volume(u->mixer_elem, SND_MIXER_SCHN_MONO, &alsa_vol)) < 0)
 | 
			
		||||
                goto fail;
 | 
			
		||||
 | 
			
		||||
            pa_cvolume_set(&r, s->sample_spec.channels, from_alsa_volume(u, alsa_vol));
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    /* Shift down by the base volume, so that 0dB becomes maximum volume */
 | 
			
		||||
    pa_sw_cvolume_multiply_scalar(&r, &r, s->base_volume);
 | 
			
		||||
 | 
			
		||||
    pa_log_debug("Read hardware volume: %s", pa_cvolume_snprint(t, sizeof(t), &r));
 | 
			
		||||
 | 
			
		||||
    if (!pa_cvolume_equal(&u->hardware_volume, &r)) {
 | 
			
		||||
    if (pa_cvolume_equal(&u->hardware_volume, &r))
 | 
			
		||||
        return;
 | 
			
		||||
 | 
			
		||||
        s->virtual_volume = u->hardware_volume = r;
 | 
			
		||||
    s->virtual_volume = u->hardware_volume = r;
 | 
			
		||||
 | 
			
		||||
        if (u->hw_dB_supported) {
 | 
			
		||||
            pa_cvolume reset;
 | 
			
		||||
    if (u->mixer_path->has_dB) {
 | 
			
		||||
        pa_cvolume reset;
 | 
			
		||||
 | 
			
		||||
            /* Hmm, so the hardware volume changed, let's reset our software volume */
 | 
			
		||||
            pa_cvolume_reset(&reset, s->sample_spec.channels);
 | 
			
		||||
            pa_source_set_soft_volume(s, &reset);
 | 
			
		||||
        }
 | 
			
		||||
        /* Hmm, so the hardware volume changed, let's reset our software volume */
 | 
			
		||||
        pa_cvolume_reset(&reset, s->sample_spec.channels);
 | 
			
		||||
        pa_source_set_soft_volume(s, &reset);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return;
 | 
			
		||||
 | 
			
		||||
fail:
 | 
			
		||||
    pa_log_error("Unable to read volume: %s", pa_alsa_strerror(err));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void source_set_volume_cb(pa_source *s) {
 | 
			
		||||
    struct userdata *u = s->userdata;
 | 
			
		||||
    int err;
 | 
			
		||||
    unsigned i;
 | 
			
		||||
    pa_cvolume r;
 | 
			
		||||
    char t[PA_CVOLUME_SNPRINT_MAX];
 | 
			
		||||
 | 
			
		||||
    pa_assert(u);
 | 
			
		||||
    pa_assert(u->mixer_elem);
 | 
			
		||||
    pa_assert(u->mixer_path);
 | 
			
		||||
    pa_assert(u->mixer_handle);
 | 
			
		||||
 | 
			
		||||
    if (u->mixer_seperate_channels) {
 | 
			
		||||
    /* Shift up by the base volume */
 | 
			
		||||
    pa_sw_cvolume_divide_scalar(&r, &s->virtual_volume, s->base_volume);
 | 
			
		||||
 | 
			
		||||
        r.channels = s->sample_spec.channels;
 | 
			
		||||
    if (pa_alsa_path_set_volume(u->mixer_path, u->mixer_handle, &s->channel_map, &r) < 0)
 | 
			
		||||
        return;
 | 
			
		||||
 | 
			
		||||
        for (i = 0; i < s->sample_spec.channels; i++) {
 | 
			
		||||
            long alsa_vol;
 | 
			
		||||
            pa_volume_t vol;
 | 
			
		||||
 | 
			
		||||
            vol = s->virtual_volume.values[i];
 | 
			
		||||
 | 
			
		||||
            if (u->hw_dB_supported) {
 | 
			
		||||
 | 
			
		||||
                alsa_vol = (long) (pa_sw_volume_to_dB(vol) * 100);
 | 
			
		||||
                alsa_vol += u->hw_dB_max;
 | 
			
		||||
                alsa_vol = PA_CLAMP_UNLIKELY(alsa_vol, u->hw_dB_min, u->hw_dB_max);
 | 
			
		||||
 | 
			
		||||
                if ((err = snd_mixer_selem_set_capture_dB(u->mixer_elem, u->mixer_map[i], alsa_vol, 1)) < 0)
 | 
			
		||||
                    goto fail;
 | 
			
		||||
 | 
			
		||||
                if ((err = snd_mixer_selem_get_capture_dB(u->mixer_elem, u->mixer_map[i], &alsa_vol)) < 0)
 | 
			
		||||
                    goto fail;
 | 
			
		||||
 | 
			
		||||
#ifdef HAVE_VALGRIND_MEMCHECK_H
 | 
			
		||||
                VALGRIND_MAKE_MEM_DEFINED(&alsa_vol, sizeof(alsa_vol));
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
                r.values[i] = pa_sw_volume_from_dB((double) (alsa_vol - u->hw_dB_max) / 100.0);
 | 
			
		||||
 | 
			
		||||
            } else {
 | 
			
		||||
                alsa_vol = to_alsa_volume(u, vol);
 | 
			
		||||
 | 
			
		||||
                if ((err = snd_mixer_selem_set_capture_volume(u->mixer_elem, u->mixer_map[i], alsa_vol)) < 0)
 | 
			
		||||
                    goto fail;
 | 
			
		||||
 | 
			
		||||
                if ((err = snd_mixer_selem_get_capture_volume(u->mixer_elem, u->mixer_map[i], &alsa_vol)) < 0)
 | 
			
		||||
                    goto fail;
 | 
			
		||||
 | 
			
		||||
                r.values[i] = from_alsa_volume(u, alsa_vol);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
    } else {
 | 
			
		||||
        pa_volume_t vol;
 | 
			
		||||
        long alsa_vol;
 | 
			
		||||
 | 
			
		||||
        vol = pa_cvolume_max(&s->virtual_volume);
 | 
			
		||||
 | 
			
		||||
        if (u->hw_dB_supported) {
 | 
			
		||||
            alsa_vol = (long) (pa_sw_volume_to_dB(vol) * 100);
 | 
			
		||||
            alsa_vol += u->hw_dB_max;
 | 
			
		||||
            alsa_vol = PA_CLAMP_UNLIKELY(alsa_vol, u->hw_dB_min, u->hw_dB_max);
 | 
			
		||||
 | 
			
		||||
            if ((err = snd_mixer_selem_set_capture_dB_all(u->mixer_elem, alsa_vol, 1)) < 0)
 | 
			
		||||
                goto fail;
 | 
			
		||||
 | 
			
		||||
            if ((err = snd_mixer_selem_get_capture_dB(u->mixer_elem, SND_MIXER_SCHN_MONO, &alsa_vol)) < 0)
 | 
			
		||||
                goto fail;
 | 
			
		||||
 | 
			
		||||
#ifdef HAVE_VALGRIND_MEMCHECK_H
 | 
			
		||||
            VALGRIND_MAKE_MEM_DEFINED(&alsa_vol, sizeof(alsa_vol));
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
            pa_cvolume_set(&r, s->sample_spec.channels, pa_sw_volume_from_dB((double) (alsa_vol - u->hw_dB_max) / 100.0));
 | 
			
		||||
 | 
			
		||||
        } else {
 | 
			
		||||
            alsa_vol = to_alsa_volume(u, vol);
 | 
			
		||||
 | 
			
		||||
            if ((err = snd_mixer_selem_set_capture_volume_all(u->mixer_elem, alsa_vol)) < 0)
 | 
			
		||||
                goto fail;
 | 
			
		||||
 | 
			
		||||
            if ((err = snd_mixer_selem_get_capture_volume(u->mixer_elem, SND_MIXER_SCHN_MONO, &alsa_vol)) < 0)
 | 
			
		||||
                goto fail;
 | 
			
		||||
 | 
			
		||||
            pa_cvolume_set(&r, s->sample_spec.channels, from_alsa_volume(u, alsa_vol));
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    /* Shift down by the base volume, so that 0dB becomes maximum volume */
 | 
			
		||||
    pa_sw_cvolume_multiply_scalar(&r, &r, s->base_volume);
 | 
			
		||||
 | 
			
		||||
    u->hardware_volume = r;
 | 
			
		||||
 | 
			
		||||
    if (u->hw_dB_supported) {
 | 
			
		||||
        char t[PA_CVOLUME_SNPRINT_MAX];
 | 
			
		||||
    if (u->mixer_path->has_dB) {
 | 
			
		||||
 | 
			
		||||
        /* Match exactly what the user requested by software */
 | 
			
		||||
 | 
			
		||||
        pa_sw_cvolume_divide(&s->soft_volume, &s->virtual_volume, &u->hardware_volume);
 | 
			
		||||
 | 
			
		||||
        pa_log_debug("Requested volume: %s", pa_cvolume_snprint(t, sizeof(t), &s->virtual_volume));
 | 
			
		||||
        pa_log_debug("Got hardware volume: %s", pa_cvolume_snprint(t, sizeof(t), &u->hardware_volume));
 | 
			
		||||
        pa_log_debug("Calculated software volume: %s", pa_cvolume_snprint(t, sizeof(t), &s->soft_volume));
 | 
			
		||||
 | 
			
		||||
    } else
 | 
			
		||||
    } else {
 | 
			
		||||
        pa_log_debug("Wrote hardware volume: %s", pa_cvolume_snprint(t, sizeof(t), &r));
 | 
			
		||||
 | 
			
		||||
        /* We can't match exactly what the user requested, hence let's
 | 
			
		||||
         * at least tell the user about it */
 | 
			
		||||
 | 
			
		||||
        s->virtual_volume = r;
 | 
			
		||||
 | 
			
		||||
    return;
 | 
			
		||||
 | 
			
		||||
fail:
 | 
			
		||||
    pa_log_error("Unable to set volume: %s", pa_alsa_strerror(err));
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void source_get_mute_cb(pa_source *s) {
 | 
			
		||||
    struct userdata *u = s->userdata;
 | 
			
		||||
    int err, sw = 0;
 | 
			
		||||
    pa_bool_t b;
 | 
			
		||||
 | 
			
		||||
    pa_assert(u);
 | 
			
		||||
    pa_assert(u->mixer_elem);
 | 
			
		||||
    pa_assert(u->mixer_path);
 | 
			
		||||
    pa_assert(u->mixer_handle);
 | 
			
		||||
 | 
			
		||||
    if ((err = snd_mixer_selem_get_capture_switch(u->mixer_elem, 0, &sw)) < 0) {
 | 
			
		||||
        pa_log_error("Unable to get switch: %s", pa_alsa_strerror(err));
 | 
			
		||||
    if (pa_alsa_path_get_mute(u->mixer_path, u->mixer_handle, &b) < 0)
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    s->muted = !sw;
 | 
			
		||||
    s->muted = b;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void source_set_mute_cb(pa_source *s) {
 | 
			
		||||
    struct userdata *u = s->userdata;
 | 
			
		||||
    int err;
 | 
			
		||||
 | 
			
		||||
    pa_assert(u);
 | 
			
		||||
    pa_assert(u->mixer_elem);
 | 
			
		||||
    pa_assert(u->mixer_path);
 | 
			
		||||
    pa_assert(u->mixer_handle);
 | 
			
		||||
 | 
			
		||||
    if ((err = snd_mixer_selem_set_capture_switch_all(u->mixer_elem, !s->muted)) < 0) {
 | 
			
		||||
        pa_log_error("Unable to set switch: %s", pa_alsa_strerror(err));
 | 
			
		||||
        return;
 | 
			
		||||
    pa_alsa_path_set_mute(u->mixer_path, u->mixer_handle, s->muted);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int source_set_port_cb(pa_source *s, pa_device_port *p) {
 | 
			
		||||
    struct userdata *u = s->userdata;
 | 
			
		||||
    pa_alsa_port_data *data;
 | 
			
		||||
 | 
			
		||||
    pa_assert(u);
 | 
			
		||||
    pa_assert(p);
 | 
			
		||||
    pa_assert(u->mixer_handle);
 | 
			
		||||
 | 
			
		||||
    data = PA_DEVICE_PORT_DATA(p);
 | 
			
		||||
 | 
			
		||||
    pa_assert_se(u->mixer_path = data->path);
 | 
			
		||||
    pa_alsa_path_select(u->mixer_path, u->mixer_handle);
 | 
			
		||||
 | 
			
		||||
    if (u->mixer_path->has_volume && u->mixer_path->has_dB) {
 | 
			
		||||
        s->base_volume = pa_sw_volume_from_dB(-u->mixer_path->max_dB);
 | 
			
		||||
        s->n_volume_steps = PA_VOLUME_NORM+1;
 | 
			
		||||
 | 
			
		||||
        if (u->mixer_path->max_dB > 0.0)
 | 
			
		||||
            pa_log_info("Fixing base volume to %0.2f dB", pa_sw_volume_to_dB(s->base_volume));
 | 
			
		||||
        else
 | 
			
		||||
            pa_log_info("No particular base volume set, fixing to 0 dB");
 | 
			
		||||
    } else {
 | 
			
		||||
        s->base_volume = PA_VOLUME_NORM;
 | 
			
		||||
        s->n_volume_steps = u->mixer_path->max_volume - u->mixer_path->min_volume + 1;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (data->setting)
 | 
			
		||||
        pa_alsa_setting_select(data->setting, u->mixer_handle);
 | 
			
		||||
 | 
			
		||||
    if (s->set_mute)
 | 
			
		||||
        s->set_mute(s);
 | 
			
		||||
    if (s->set_volume)
 | 
			
		||||
        s->set_volume(s);
 | 
			
		||||
 | 
			
		||||
    return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void source_update_requested_latency_cb(pa_source *s) {
 | 
			
		||||
| 
						 | 
				
			
			@ -1323,77 +1213,127 @@ static void set_source_name(pa_source_new_data *data, pa_modargs *ma, const char
 | 
			
		|||
    pa_xfree(t);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void find_mixer(struct userdata *u, pa_alsa_mapping *mapping, const char *element, pa_bool_t ignore_dB) {
 | 
			
		||||
 | 
			
		||||
    if (!mapping && !element)
 | 
			
		||||
        return;
 | 
			
		||||
 | 
			
		||||
    if (!(u->mixer_handle = pa_alsa_open_mixer_for_pcm(u->pcm_handle, &u->control_device))) {
 | 
			
		||||
        pa_log_info("Failed to find a working mixer device.");
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (element) {
 | 
			
		||||
 | 
			
		||||
        if (!(u->mixer_path = pa_alsa_path_synthesize(element, PA_ALSA_DIRECTION_INPUT)))
 | 
			
		||||
            goto fail;
 | 
			
		||||
 | 
			
		||||
        if (pa_alsa_path_probe(u->mixer_path, u->mixer_handle, ignore_dB) < 0)
 | 
			
		||||
            goto fail;
 | 
			
		||||
 | 
			
		||||
        pa_log_debug("Probed mixer path %s:", u->mixer_path->name);
 | 
			
		||||
        pa_alsa_path_dump(u->mixer_path);
 | 
			
		||||
    } else {
 | 
			
		||||
 | 
			
		||||
        if (!(u->mixer_path_set = pa_alsa_path_set_new(mapping, PA_ALSA_DIRECTION_INPUT)))
 | 
			
		||||
            goto fail;
 | 
			
		||||
 | 
			
		||||
        pa_alsa_path_set_probe(u->mixer_path_set, u->mixer_handle, ignore_dB);
 | 
			
		||||
 | 
			
		||||
        pa_log_debug("Probed mixer paths:");
 | 
			
		||||
        pa_alsa_path_set_dump(u->mixer_path_set);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return;
 | 
			
		||||
 | 
			
		||||
fail:
 | 
			
		||||
 | 
			
		||||
    if (u->mixer_path_set) {
 | 
			
		||||
        pa_alsa_path_set_free(u->mixer_path_set);
 | 
			
		||||
        u->mixer_path_set = NULL;
 | 
			
		||||
    } else if (u->mixer_path) {
 | 
			
		||||
        pa_alsa_path_free(u->mixer_path);
 | 
			
		||||
        u->mixer_path = NULL;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (u->mixer_handle) {
 | 
			
		||||
        snd_mixer_close(u->mixer_handle);
 | 
			
		||||
        u->mixer_handle = NULL;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int setup_mixer(struct userdata *u, pa_bool_t ignore_dB) {
 | 
			
		||||
    pa_assert(u);
 | 
			
		||||
 | 
			
		||||
    if (!u->mixer_handle)
 | 
			
		||||
        return 0;
 | 
			
		||||
 | 
			
		||||
    pa_assert(u->mixer_elem);
 | 
			
		||||
    if (u->source->active_port) {
 | 
			
		||||
        pa_alsa_port_data *data;
 | 
			
		||||
 | 
			
		||||
    if (snd_mixer_selem_has_capture_volume(u->mixer_elem)) {
 | 
			
		||||
        pa_bool_t suitable = FALSE;
 | 
			
		||||
        /* We have a list of supported paths, so let's activate the
 | 
			
		||||
         * one that has been chosen as active */
 | 
			
		||||
 | 
			
		||||
        if (snd_mixer_selem_get_capture_volume_range(u->mixer_elem, &u->hw_volume_min, &u->hw_volume_max) < 0)
 | 
			
		||||
            pa_log_info("Failed to get volume range. Falling back to software volume control.");
 | 
			
		||||
        else if (u->hw_volume_min >= u->hw_volume_max)
 | 
			
		||||
            pa_log_warn("Your kernel driver is broken: it reports a volume range from %li to %li which makes no sense.", u->hw_volume_min, u->hw_volume_max);
 | 
			
		||||
        else {
 | 
			
		||||
            pa_log_info("Volume ranges from %li to %li.", u->hw_volume_min, u->hw_volume_max);
 | 
			
		||||
            suitable = TRUE;
 | 
			
		||||
        }
 | 
			
		||||
        data = PA_DEVICE_PORT_DATA(u->source->active_port);
 | 
			
		||||
        u->mixer_path = data->path;
 | 
			
		||||
 | 
			
		||||
        if (suitable) {
 | 
			
		||||
            if (ignore_dB || snd_mixer_selem_get_capture_dB_range(u->mixer_elem, &u->hw_dB_min, &u->hw_dB_max) < 0)
 | 
			
		||||
                pa_log_info("Mixer doesn't support dB information or data is ignored.");
 | 
			
		||||
            else {
 | 
			
		||||
#ifdef HAVE_VALGRIND_MEMCHECK_H
 | 
			
		||||
                VALGRIND_MAKE_MEM_DEFINED(&u->hw_dB_min, sizeof(u->hw_dB_min));
 | 
			
		||||
                VALGRIND_MAKE_MEM_DEFINED(&u->hw_dB_max, sizeof(u->hw_dB_max));
 | 
			
		||||
#endif
 | 
			
		||||
        pa_alsa_path_select(data->path, u->mixer_handle);
 | 
			
		||||
 | 
			
		||||
                if (u->hw_dB_min >= u->hw_dB_max)
 | 
			
		||||
                    pa_log_warn("Your kernel driver is broken: it reports a volume range from %0.2f dB to %0.2f dB which makes no sense.", (double) u->hw_dB_min/100.0, (double) u->hw_dB_max/100.0);
 | 
			
		||||
                else {
 | 
			
		||||
                    pa_log_info("Volume ranges from %0.2f dB to %0.2f dB.", (double) u->hw_dB_min/100.0, (double) u->hw_dB_max/100.0);
 | 
			
		||||
                    u->hw_dB_supported = TRUE;
 | 
			
		||||
        if (data->setting)
 | 
			
		||||
            pa_alsa_setting_select(data->setting, u->mixer_handle);
 | 
			
		||||
 | 
			
		||||
                    if (u->hw_dB_max > 0) {
 | 
			
		||||
                        u->source->base_volume = pa_sw_volume_from_dB(- (double) u->hw_dB_max/100.0);
 | 
			
		||||
                        pa_log_info("Fixing base volume to %0.2f dB", pa_sw_volume_to_dB(u->source->base_volume));
 | 
			
		||||
                    } else
 | 
			
		||||
                        pa_log_info("No particular base volume set, fixing to 0 dB");
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
    } else {
 | 
			
		||||
 | 
			
		||||
            if (!u->hw_dB_supported &&
 | 
			
		||||
                u->hw_volume_max - u->hw_volume_min < 3) {
 | 
			
		||||
        if (!u->mixer_path && u->mixer_path_set)
 | 
			
		||||
            u->mixer_path = u->mixer_path_set->paths;
 | 
			
		||||
 | 
			
		||||
                pa_log_info("Device has less than 4 volume levels. Falling back to software volume control.");
 | 
			
		||||
                suitable = FALSE;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        if (u->mixer_path) {
 | 
			
		||||
            /* Hmm, we have only a single path, then let's activate it */
 | 
			
		||||
 | 
			
		||||
        if (suitable) {
 | 
			
		||||
            u->mixer_seperate_channels = pa_alsa_calc_mixer_map(u->mixer_elem, &u->source->channel_map, u->mixer_map, FALSE) >= 0;
 | 
			
		||||
            pa_alsa_path_select(u->mixer_path, u->mixer_handle);
 | 
			
		||||
 | 
			
		||||
            u->source->get_volume = source_get_volume_cb;
 | 
			
		||||
            u->source->set_volume = source_set_volume_cb;
 | 
			
		||||
            u->source->flags |= PA_SOURCE_HW_VOLUME_CTRL | (u->hw_dB_supported ? PA_SOURCE_DECIBEL_VOLUME : 0);
 | 
			
		||||
            pa_log_info("Using hardware volume control. Hardware dB scale %s.", u->hw_dB_supported ? "supported" : "not supported");
 | 
			
		||||
 | 
			
		||||
            if (!u->hw_dB_supported)
 | 
			
		||||
                u->source->n_volume_steps = u->hw_volume_max - u->hw_volume_min + 1;
 | 
			
		||||
            if (u->mixer_path->settings)
 | 
			
		||||
                pa_alsa_setting_select(u->mixer_path->settings, u->mixer_handle);
 | 
			
		||||
        } else
 | 
			
		||||
            pa_log_info("Using software volume control.");
 | 
			
		||||
            return 0;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (snd_mixer_selem_has_capture_switch(u->mixer_elem)) {
 | 
			
		||||
    if (!u->mixer_path->has_volume)
 | 
			
		||||
        pa_log_info("Driver does not support hardware volume control, falling back to software volume control.");
 | 
			
		||||
    else {
 | 
			
		||||
 | 
			
		||||
        if (u->mixer_path->has_dB) {
 | 
			
		||||
            pa_log_info("Hardware volume ranges from %0.2f dB to %0.2f dB.", u->mixer_path->min_dB, u->mixer_path->max_dB);
 | 
			
		||||
 | 
			
		||||
            u->source->base_volume = pa_sw_volume_from_dB(-u->mixer_path->max_dB);
 | 
			
		||||
            u->source->n_volume_steps = PA_VOLUME_NORM+1;
 | 
			
		||||
 | 
			
		||||
            if (u->mixer_path->max_dB > 0.0)
 | 
			
		||||
                pa_log_info("Fixing base volume to %0.2f dB", pa_sw_volume_to_dB(u->source->base_volume));
 | 
			
		||||
            else
 | 
			
		||||
                pa_log_info("No particular base volume set, fixing to 0 dB");
 | 
			
		||||
 | 
			
		||||
        } else {
 | 
			
		||||
            pa_log_info("Hardware volume ranges from %li to %li.", u->mixer_path->min_volume, u->mixer_path->max_volume);
 | 
			
		||||
            u->source->base_volume = PA_VOLUME_NORM;
 | 
			
		||||
            u->source->n_volume_steps = u->mixer_path->max_volume - u->mixer_path->min_volume + 1;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        u->source->get_volume = source_get_volume_cb;
 | 
			
		||||
        u->source->set_volume = source_set_volume_cb;
 | 
			
		||||
 | 
			
		||||
        u->source->flags |= PA_SOURCE_HW_VOLUME_CTRL | (u->mixer_path->has_dB ? PA_SOURCE_DECIBEL_VOLUME : 0);
 | 
			
		||||
        pa_log_info("Using hardware volume control. Hardware dB scale %s.", u->mixer_path->has_dB ? "supported" : "not supported");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (!u->mixer_path->has_mute) {
 | 
			
		||||
        pa_log_info("Driver does not support hardware mute control, falling back to software mute control.");
 | 
			
		||||
    } else {
 | 
			
		||||
        u->source->get_mute = source_get_mute_cb;
 | 
			
		||||
        u->source->set_mute = source_set_mute_cb;
 | 
			
		||||
        u->source->flags |= PA_SOURCE_HW_MUTE_CTRL;
 | 
			
		||||
    } else
 | 
			
		||||
        pa_log_info("Using software mute control.");
 | 
			
		||||
        pa_log_info("Using hardware mute control.");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    u->mixer_fdl = pa_alsa_fdlist_new();
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1402,13 +1342,15 @@ static int setup_mixer(struct userdata *u, pa_bool_t ignore_dB) {
 | 
			
		|||
        return -1;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    snd_mixer_elem_set_callback(u->mixer_elem, mixer_callback);
 | 
			
		||||
    snd_mixer_elem_set_callback_private(u->mixer_elem, u);
 | 
			
		||||
    if (u->mixer_path_set)
 | 
			
		||||
        pa_alsa_path_set_set_callback(u->mixer_path_set, u->mixer_handle, mixer_callback, u);
 | 
			
		||||
    else
 | 
			
		||||
        pa_alsa_path_set_callback(u->mixer_path, u->mixer_handle, mixer_callback, u);
 | 
			
		||||
 | 
			
		||||
    return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
pa_source *pa_alsa_source_new(pa_module *m, pa_modargs *ma, const char*driver, pa_card *card, const pa_alsa_profile_info *profile) {
 | 
			
		||||
pa_source *pa_alsa_source_new(pa_module *m, pa_modargs *ma, const char*driver, pa_card *card, pa_alsa_mapping *mapping) {
 | 
			
		||||
 | 
			
		||||
    struct userdata *u = NULL;
 | 
			
		||||
    const char *dev_id = NULL;
 | 
			
		||||
| 
						 | 
				
			
			@ -1419,7 +1361,7 @@ pa_source *pa_alsa_source_new(pa_module *m, pa_modargs *ma, const char*driver, p
 | 
			
		|||
    size_t frame_size;
 | 
			
		||||
    pa_bool_t use_mmap = TRUE, b, use_tsched = TRUE, d, ignore_dB = FALSE;
 | 
			
		||||
    pa_source_new_data data;
 | 
			
		||||
    char *control_device = NULL;
 | 
			
		||||
    pa_alsa_profile_set *profile_set = NULL;
 | 
			
		||||
 | 
			
		||||
    pa_assert(m);
 | 
			
		||||
    pa_assert(ma);
 | 
			
		||||
| 
						 | 
				
			
			@ -1480,7 +1422,6 @@ pa_source *pa_alsa_source_new(pa_module *m, pa_modargs *ma, const char*driver, p
 | 
			
		|||
    u->use_tsched = use_tsched;
 | 
			
		||||
    u->rtpoll = pa_rtpoll_new();
 | 
			
		||||
    pa_thread_mq_init(&u->thread_mq, m->core->mainloop, u->rtpoll);
 | 
			
		||||
    u->alsa_rtpoll_item = NULL;
 | 
			
		||||
 | 
			
		||||
    u->smoother = pa_smoother_new(
 | 
			
		||||
            DEFAULT_TSCHED_WATERMARK_USEC*2,
 | 
			
		||||
| 
						 | 
				
			
			@ -1504,31 +1445,34 @@ pa_source *pa_alsa_source_new(pa_module *m, pa_modargs *ma, const char*driver, p
 | 
			
		|||
    b = use_mmap;
 | 
			
		||||
    d = use_tsched;
 | 
			
		||||
 | 
			
		||||
    if (profile) {
 | 
			
		||||
    if (mapping) {
 | 
			
		||||
 | 
			
		||||
        if (!(dev_id = pa_modargs_get_value(ma, "device_id", NULL))) {
 | 
			
		||||
            pa_log("device_id= not set");
 | 
			
		||||
            goto fail;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (!(u->pcm_handle = pa_alsa_open_by_device_id_profile(
 | 
			
		||||
        if (!(u->pcm_handle = pa_alsa_open_by_device_id_mapping(
 | 
			
		||||
                      dev_id,
 | 
			
		||||
                      &u->device_name,
 | 
			
		||||
                      &ss, &map,
 | 
			
		||||
                      SND_PCM_STREAM_CAPTURE,
 | 
			
		||||
                      &nfrags, &period_frames, tsched_frames,
 | 
			
		||||
                      &b, &d, profile)))
 | 
			
		||||
                      &b, &d, mapping)))
 | 
			
		||||
            goto fail;
 | 
			
		||||
 | 
			
		||||
    } else if ((dev_id = pa_modargs_get_value(ma, "device_id", NULL))) {
 | 
			
		||||
 | 
			
		||||
        if (!(profile_set = pa_alsa_profile_set_new(NULL, &map)))
 | 
			
		||||
            goto fail;
 | 
			
		||||
 | 
			
		||||
        if (!(u->pcm_handle = pa_alsa_open_by_device_id_auto(
 | 
			
		||||
                      dev_id,
 | 
			
		||||
                      &u->device_name,
 | 
			
		||||
                      &ss, &map,
 | 
			
		||||
                      SND_PCM_STREAM_CAPTURE,
 | 
			
		||||
                      &nfrags, &period_frames, tsched_frames,
 | 
			
		||||
                      &b, &d, &profile)))
 | 
			
		||||
                      &b, &d, profile_set, &mapping)))
 | 
			
		||||
            goto fail;
 | 
			
		||||
 | 
			
		||||
    } else {
 | 
			
		||||
| 
						 | 
				
			
			@ -1551,8 +1495,8 @@ pa_source *pa_alsa_source_new(pa_module *m, pa_modargs *ma, const char*driver, p
 | 
			
		|||
        goto fail;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (profile)
 | 
			
		||||
        pa_log_info("Selected configuration '%s' (%s).", profile->description, profile->name);
 | 
			
		||||
    if (mapping)
 | 
			
		||||
        pa_log_info("Selected mapping '%s' (%s).", mapping->description, mapping->name);
 | 
			
		||||
 | 
			
		||||
    if (use_mmap && !b) {
 | 
			
		||||
        pa_log_info("Device doesn't support mmap(), falling back to UNIX read/write mode.");
 | 
			
		||||
| 
						 | 
				
			
			@ -1578,7 +1522,7 @@ pa_source *pa_alsa_source_new(pa_module *m, pa_modargs *ma, const char*driver, p
 | 
			
		|||
    /* ALSA might tweak the sample spec, so recalculate the frame size */
 | 
			
		||||
    frame_size = pa_frame_size(&ss);
 | 
			
		||||
 | 
			
		||||
    pa_alsa_find_mixer_and_elem(u->pcm_handle, &control_device, &u->mixer_handle, &u->mixer_elem, pa_modargs_get_value(ma, "control", NULL), profile);
 | 
			
		||||
    find_mixer(u, mapping, pa_modargs_get_value(ma, "control", NULL), ignore_dB);
 | 
			
		||||
 | 
			
		||||
    pa_source_new_data_init(&data);
 | 
			
		||||
    data.driver = driver;
 | 
			
		||||
| 
						 | 
				
			
			@ -1588,23 +1532,21 @@ pa_source *pa_alsa_source_new(pa_module *m, pa_modargs *ma, const char*driver, p
 | 
			
		|||
    pa_source_new_data_set_sample_spec(&data, &ss);
 | 
			
		||||
    pa_source_new_data_set_channel_map(&data, &map);
 | 
			
		||||
 | 
			
		||||
    pa_alsa_init_proplist_pcm(m->core, data.proplist, u->pcm_handle, u->mixer_elem);
 | 
			
		||||
    pa_alsa_init_proplist_pcm(m->core, data.proplist, u->pcm_handle);
 | 
			
		||||
    pa_proplist_sets(data.proplist, PA_PROP_DEVICE_STRING, u->device_name);
 | 
			
		||||
    pa_proplist_setf(data.proplist, PA_PROP_DEVICE_BUFFERING_BUFFER_SIZE, "%lu", (unsigned long) (period_frames * frame_size * nfrags));
 | 
			
		||||
    pa_proplist_setf(data.proplist, PA_PROP_DEVICE_BUFFERING_FRAGMENT_SIZE, "%lu", (unsigned long) (period_frames * frame_size));
 | 
			
		||||
    pa_proplist_sets(data.proplist, PA_PROP_DEVICE_ACCESS_MODE, u->use_tsched ? "mmap+timer" : (u->use_mmap ? "mmap" : "serial"));
 | 
			
		||||
 | 
			
		||||
    if (profile) {
 | 
			
		||||
        pa_proplist_sets(data.proplist, PA_PROP_DEVICE_PROFILE_NAME, profile->name);
 | 
			
		||||
        pa_proplist_sets(data.proplist, PA_PROP_DEVICE_PROFILE_DESCRIPTION, profile->description);
 | 
			
		||||
    if (mapping) {
 | 
			
		||||
        pa_proplist_sets(data.proplist, PA_PROP_DEVICE_PROFILE_NAME, mapping->name);
 | 
			
		||||
        pa_proplist_sets(data.proplist, PA_PROP_DEVICE_PROFILE_DESCRIPTION, mapping->description);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    pa_alsa_init_description(data.proplist);
 | 
			
		||||
 | 
			
		||||
    if (control_device) {
 | 
			
		||||
        pa_alsa_init_proplist_ctl(data.proplist, control_device);
 | 
			
		||||
        pa_xfree(control_device);
 | 
			
		||||
    }
 | 
			
		||||
    if (u->control_device)
 | 
			
		||||
        pa_alsa_init_proplist_ctl(data.proplist, u->control_device);
 | 
			
		||||
 | 
			
		||||
    if (pa_modargs_get_proplist(ma, "source_properties", data.proplist, PA_UPDATE_REPLACE) < 0) {
 | 
			
		||||
        pa_log("Invalid properties");
 | 
			
		||||
| 
						 | 
				
			
			@ -1612,6 +1554,9 @@ pa_source *pa_alsa_source_new(pa_module *m, pa_modargs *ma, const char*driver, p
 | 
			
		|||
        goto fail;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (u->mixer_path_set)
 | 
			
		||||
        pa_alsa_add_ports(&data.ports, u->mixer_path_set);
 | 
			
		||||
 | 
			
		||||
    u->source = pa_source_new(m->core, &data, PA_SOURCE_HARDWARE|PA_SOURCE_LATENCY|(u->use_tsched ? PA_SOURCE_DYNAMIC_LATENCY : 0));
 | 
			
		||||
    pa_source_new_data_done(&data);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1623,6 +1568,7 @@ pa_source *pa_alsa_source_new(pa_module *m, pa_modargs *ma, const char*driver, p
 | 
			
		|||
    u->source->parent.process_msg = source_process_msg;
 | 
			
		||||
    u->source->update_requested_latency = source_update_requested_latency_cb;
 | 
			
		||||
    u->source->set_state = source_set_state_cb;
 | 
			
		||||
    u->source->set_port = source_set_port_cb;
 | 
			
		||||
    u->source->userdata = u;
 | 
			
		||||
 | 
			
		||||
    pa_source_set_asyncmsgq(u->source, u->thread_mq.inq);
 | 
			
		||||
| 
						 | 
				
			
			@ -1687,6 +1633,9 @@ pa_source *pa_alsa_source_new(pa_module *m, pa_modargs *ma, const char*driver, p
 | 
			
		|||
 | 
			
		||||
    pa_source_put(u->source);
 | 
			
		||||
 | 
			
		||||
    if (profile_set)
 | 
			
		||||
        pa_alsa_profile_set_free(profile_set);
 | 
			
		||||
 | 
			
		||||
    return u->source;
 | 
			
		||||
 | 
			
		||||
fail:
 | 
			
		||||
| 
						 | 
				
			
			@ -1694,6 +1643,9 @@ fail:
 | 
			
		|||
    if (u)
 | 
			
		||||
        userdata_free(u);
 | 
			
		||||
 | 
			
		||||
    if (profile_set)
 | 
			
		||||
        pa_alsa_profile_set_free(profile_set);
 | 
			
		||||
 | 
			
		||||
    return NULL;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1719,17 +1671,22 @@ static void userdata_free(struct userdata *u) {
 | 
			
		|||
    if (u->rtpoll)
 | 
			
		||||
        pa_rtpoll_free(u->rtpoll);
 | 
			
		||||
 | 
			
		||||
    if (u->mixer_fdl)
 | 
			
		||||
        pa_alsa_fdlist_free(u->mixer_fdl);
 | 
			
		||||
 | 
			
		||||
    if (u->mixer_handle)
 | 
			
		||||
        snd_mixer_close(u->mixer_handle);
 | 
			
		||||
 | 
			
		||||
    if (u->pcm_handle) {
 | 
			
		||||
        snd_pcm_drop(u->pcm_handle);
 | 
			
		||||
        snd_pcm_close(u->pcm_handle);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (u->mixer_fdl)
 | 
			
		||||
        pa_alsa_fdlist_free(u->mixer_fdl);
 | 
			
		||||
 | 
			
		||||
    if (u->mixer_path_set)
 | 
			
		||||
        pa_alsa_path_set_free(u->mixer_path_set);
 | 
			
		||||
    else if (u->mixer_path)
 | 
			
		||||
        pa_alsa_path_free(u->mixer_path);
 | 
			
		||||
 | 
			
		||||
    if (u->mixer_handle)
 | 
			
		||||
        snd_mixer_close(u->mixer_handle);
 | 
			
		||||
 | 
			
		||||
    if (u->smoother)
 | 
			
		||||
        pa_smoother_free(u->smoother);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1737,6 +1694,7 @@ static void userdata_free(struct userdata *u) {
 | 
			
		|||
    monitor_done(u);
 | 
			
		||||
 | 
			
		||||
    pa_xfree(u->device_name);
 | 
			
		||||
    pa_xfree(u->control_device);
 | 
			
		||||
    pa_xfree(u);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -29,7 +29,7 @@
 | 
			
		|||
 | 
			
		||||
#include "alsa-util.h"
 | 
			
		||||
 | 
			
		||||
pa_source* pa_alsa_source_new(pa_module *m, pa_modargs *ma, const char*driver, pa_card *card, const pa_alsa_profile_info *profile);
 | 
			
		||||
pa_source* pa_alsa_source_new(pa_module *m, pa_modargs *ma, const char*driver, pa_card *card, pa_alsa_mapping *mapping);
 | 
			
		||||
 | 
			
		||||
void pa_alsa_source_free(pa_source *s);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							| 
						 | 
				
			
			@ -30,95 +30,86 @@
 | 
			
		|||
#include <pulse/mainloop-api.h>
 | 
			
		||||
#include <pulse/channelmap.h>
 | 
			
		||||
#include <pulse/proplist.h>
 | 
			
		||||
#include <pulse/volume.h>
 | 
			
		||||
 | 
			
		||||
#include <pulsecore/llist.h>
 | 
			
		||||
#include <pulsecore/rtpoll.h>
 | 
			
		||||
#include <pulsecore/core.h>
 | 
			
		||||
#include <pulsecore/log.h>
 | 
			
		||||
 | 
			
		||||
typedef struct pa_alsa_fdlist pa_alsa_fdlist;
 | 
			
		||||
 | 
			
		||||
struct pa_alsa_fdlist *pa_alsa_fdlist_new(void);
 | 
			
		||||
void pa_alsa_fdlist_free(struct pa_alsa_fdlist *fdl);
 | 
			
		||||
int pa_alsa_fdlist_set_mixer(struct pa_alsa_fdlist *fdl, snd_mixer_t *mixer_handle, pa_mainloop_api* m);
 | 
			
		||||
#include "alsa-mixer.h"
 | 
			
		||||
 | 
			
		||||
int pa_alsa_set_hw_params(
 | 
			
		||||
        snd_pcm_t *pcm_handle,
 | 
			
		||||
        pa_sample_spec *ss,
 | 
			
		||||
        uint32_t *periods,
 | 
			
		||||
        snd_pcm_uframes_t *period_size,
 | 
			
		||||
        pa_sample_spec *ss,                /* modified at return */
 | 
			
		||||
        uint32_t *periods,                 /* modified at return */
 | 
			
		||||
        snd_pcm_uframes_t *period_size,    /* modified at return */
 | 
			
		||||
        snd_pcm_uframes_t tsched_size,
 | 
			
		||||
        pa_bool_t *use_mmap,
 | 
			
		||||
        pa_bool_t *use_tsched,
 | 
			
		||||
        pa_bool_t *use_mmap,               /* modified at return */
 | 
			
		||||
        pa_bool_t *use_tsched,             /* modified at return */
 | 
			
		||||
        pa_bool_t require_exact_channel_number);
 | 
			
		||||
 | 
			
		||||
int pa_alsa_set_sw_params(snd_pcm_t *pcm, snd_pcm_uframes_t avail_min);
 | 
			
		||||
int pa_alsa_set_sw_params(
 | 
			
		||||
        snd_pcm_t *pcm,
 | 
			
		||||
        snd_pcm_uframes_t avail_min);
 | 
			
		||||
 | 
			
		||||
typedef struct pa_alsa_profile_info {
 | 
			
		||||
    pa_channel_map map;
 | 
			
		||||
    const char *alsa_name;
 | 
			
		||||
    const char *alsa_name_fallback;
 | 
			
		||||
    const char *description; /* internationalized */
 | 
			
		||||
    const char *name;
 | 
			
		||||
    unsigned priority;
 | 
			
		||||
    const char *playback_control_name, *playback_control_fallback;
 | 
			
		||||
    const char *record_control_name, *record_control_fallback;
 | 
			
		||||
} pa_alsa_profile_info;
 | 
			
		||||
 | 
			
		||||
int pa_alsa_prepare_mixer(snd_mixer_t *mixer, const char *dev);
 | 
			
		||||
snd_mixer_elem_t *pa_alsa_find_elem(snd_mixer_t *mixer, const char *name, const char *fallback, pa_bool_t playback);
 | 
			
		||||
int pa_alsa_find_mixer_and_elem(snd_pcm_t *pcm, char **ctl_device, snd_mixer_t **_m, snd_mixer_elem_t **_e, const char *control_name, const pa_alsa_profile_info*profile);
 | 
			
		||||
 | 
			
		||||
void pa_alsa_init_proplist_ctl(pa_proplist *p, const char *name);
 | 
			
		||||
 | 
			
		||||
/* Picks a working profile based on the specified ss/map */
 | 
			
		||||
/* Picks a working mapping from the profile set based on the specified ss/map */
 | 
			
		||||
snd_pcm_t *pa_alsa_open_by_device_id_auto(
 | 
			
		||||
        const char *dev_id,
 | 
			
		||||
        char **dev,
 | 
			
		||||
        pa_sample_spec *ss,
 | 
			
		||||
        pa_channel_map* map,
 | 
			
		||||
        char **dev,                       /* modified at return */
 | 
			
		||||
        pa_sample_spec *ss,               /* modified at return */
 | 
			
		||||
        pa_channel_map* map,              /* modified at return */
 | 
			
		||||
        int mode,
 | 
			
		||||
        uint32_t *nfrags,
 | 
			
		||||
        snd_pcm_uframes_t *period_size,
 | 
			
		||||
        uint32_t *nfrags,                 /* modified at return */
 | 
			
		||||
        snd_pcm_uframes_t *period_size,   /* modified at return */
 | 
			
		||||
        snd_pcm_uframes_t tsched_size,
 | 
			
		||||
        pa_bool_t *use_mmap,
 | 
			
		||||
        pa_bool_t *use_tsched,
 | 
			
		||||
        const pa_alsa_profile_info **profile);
 | 
			
		||||
        pa_bool_t *use_mmap,              /* modified at return */
 | 
			
		||||
        pa_bool_t *use_tsched,            /* modified at return */
 | 
			
		||||
        pa_alsa_profile_set *ps,
 | 
			
		||||
        pa_alsa_mapping **mapping);       /* modified at return */
 | 
			
		||||
 | 
			
		||||
/* Uses the specified profile */
 | 
			
		||||
snd_pcm_t *pa_alsa_open_by_device_id_profile(
 | 
			
		||||
/* Uses the specified mapping */
 | 
			
		||||
snd_pcm_t *pa_alsa_open_by_device_id_mapping(
 | 
			
		||||
        const char *dev_id,
 | 
			
		||||
        char **dev,
 | 
			
		||||
        pa_sample_spec *ss,
 | 
			
		||||
        pa_channel_map* map,
 | 
			
		||||
        char **dev,                       /* modified at return */
 | 
			
		||||
        pa_sample_spec *ss,               /* modified at return */
 | 
			
		||||
        pa_channel_map* map,              /* modified at return */
 | 
			
		||||
        int mode,
 | 
			
		||||
        uint32_t *nfrags,
 | 
			
		||||
        snd_pcm_uframes_t *period_size,
 | 
			
		||||
        uint32_t *nfrags,                 /* modified at return */
 | 
			
		||||
        snd_pcm_uframes_t *period_size,   /* modified at return */
 | 
			
		||||
        snd_pcm_uframes_t tsched_size,
 | 
			
		||||
        pa_bool_t *use_mmap,
 | 
			
		||||
        pa_bool_t *use_tsched,
 | 
			
		||||
        const pa_alsa_profile_info *profile);
 | 
			
		||||
        pa_bool_t *use_mmap,              /* modified at return */
 | 
			
		||||
        pa_bool_t *use_tsched,            /* modified at return */
 | 
			
		||||
        pa_alsa_mapping *mapping);
 | 
			
		||||
 | 
			
		||||
/* Opens the explicit ALSA device */
 | 
			
		||||
snd_pcm_t *pa_alsa_open_by_device_string(
 | 
			
		||||
        const char *device,
 | 
			
		||||
        char **dev,
 | 
			
		||||
        pa_sample_spec *ss,
 | 
			
		||||
        pa_channel_map* map,
 | 
			
		||||
        char **dev,                       /* modified at return */
 | 
			
		||||
        pa_sample_spec *ss,               /* modified at return */
 | 
			
		||||
        pa_channel_map* map,              /* modified at return */
 | 
			
		||||
        int mode,
 | 
			
		||||
        uint32_t *nfrags,
 | 
			
		||||
        snd_pcm_uframes_t *period_size,
 | 
			
		||||
        uint32_t *nfrags,                 /* modified at return */
 | 
			
		||||
        snd_pcm_uframes_t *period_size,   /* modified at return */
 | 
			
		||||
        snd_pcm_uframes_t tsched_size,
 | 
			
		||||
        pa_bool_t *use_mmap,
 | 
			
		||||
        pa_bool_t *use_tsched,
 | 
			
		||||
        pa_bool_t *use_mmap,              /* modified at return */
 | 
			
		||||
        pa_bool_t *use_tsched,            /* modified at return */
 | 
			
		||||
        pa_bool_t require_exact_channel_number);
 | 
			
		||||
 | 
			
		||||
int pa_alsa_probe_profiles(
 | 
			
		||||
/* Opens the explicit ALSA device with a fallback list */
 | 
			
		||||
snd_pcm_t *pa_alsa_open_by_device_string_strv(
 | 
			
		||||
        char **device,
 | 
			
		||||
        const char *dev_id,
 | 
			
		||||
        const pa_sample_spec *ss,
 | 
			
		||||
        void (*cb)(const pa_alsa_profile_info *sink, const pa_alsa_profile_info *source, void *userdata),
 | 
			
		||||
        void *userdata);
 | 
			
		||||
 | 
			
		||||
int pa_alsa_calc_mixer_map(snd_mixer_elem_t *elem, const pa_channel_map *channel_map, snd_mixer_selem_channel_id_t mixer_map[], pa_bool_t playback);
 | 
			
		||||
        char **dev,                       /* modified at return */
 | 
			
		||||
        pa_sample_spec *ss,               /* modified at return */
 | 
			
		||||
        pa_channel_map* map,              /* modified at return */
 | 
			
		||||
        int mode,
 | 
			
		||||
        uint32_t *nfrags,                 /* modified at return */
 | 
			
		||||
        snd_pcm_uframes_t *period_size,   /* modified at return */
 | 
			
		||||
        snd_pcm_uframes_t tsched_size,
 | 
			
		||||
        pa_bool_t *use_mmap,              /* modified at return */
 | 
			
		||||
        pa_bool_t *use_tsched,            /* modified at return */
 | 
			
		||||
        pa_bool_t require_exact_channel_number);
 | 
			
		||||
 | 
			
		||||
void pa_alsa_dump(pa_log_level_t level, snd_pcm_t *pcm);
 | 
			
		||||
void pa_alsa_dump_status(snd_pcm_t *pcm);
 | 
			
		||||
| 
						 | 
				
			
			@ -128,7 +119,8 @@ void pa_alsa_redirect_errors_dec(void);
 | 
			
		|||
 | 
			
		||||
void pa_alsa_init_proplist_pcm_info(pa_core *c, pa_proplist *p, snd_pcm_info_t *pcm_info);
 | 
			
		||||
void pa_alsa_init_proplist_card(pa_core *c, pa_proplist *p, int card);
 | 
			
		||||
void pa_alsa_init_proplist_pcm(pa_core *c, pa_proplist *p, snd_pcm_t *pcm, snd_mixer_elem_t *elem);
 | 
			
		||||
void pa_alsa_init_proplist_pcm(pa_core *c, pa_proplist *p, snd_pcm_t *pcm);
 | 
			
		||||
void pa_alsa_init_proplist_ctl(pa_proplist *p, const char *name);
 | 
			
		||||
pa_bool_t pa_alsa_init_description(pa_proplist *p);
 | 
			
		||||
 | 
			
		||||
int pa_alsa_recover_from_poll(snd_pcm_t *pcm, int revents);
 | 
			
		||||
| 
						 | 
				
			
			@ -140,13 +132,11 @@ int pa_alsa_safe_delay(snd_pcm_t *pcm, snd_pcm_sframes_t *delay, size_t hwbuf_si
 | 
			
		|||
int pa_alsa_safe_mmap_begin(snd_pcm_t *pcm, const snd_pcm_channel_area_t **areas, snd_pcm_uframes_t *offset, snd_pcm_uframes_t *frames, size_t hwbuf_size, const pa_sample_spec *ss);
 | 
			
		||||
 | 
			
		||||
char *pa_alsa_get_driver_name(int card);
 | 
			
		||||
 | 
			
		||||
char *pa_alsa_get_driver_name_by_pcm(snd_pcm_t *pcm);
 | 
			
		||||
 | 
			
		||||
char *pa_alsa_get_reserve_name(const char *device);
 | 
			
		||||
 | 
			
		||||
pa_bool_t pa_alsa_pcm_is_hw(snd_pcm_t *pcm);
 | 
			
		||||
 | 
			
		||||
pa_bool_t pa_alsa_pcm_is_modem(snd_pcm_t *pcm);
 | 
			
		||||
 | 
			
		||||
const char* pa_alsa_strerror(int errnum);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										32
									
								
								src/modules/alsa/mixer/paths/analog-input-aux.conf
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								src/modules/alsa/mixer/paths/analog-input-aux.conf
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,32 @@
 | 
			
		|||
# For devices, where we have an Aux element
 | 
			
		||||
 | 
			
		||||
[General]
 | 
			
		||||
priority = 90
 | 
			
		||||
name = analog-input
 | 
			
		||||
 | 
			
		||||
[Element Capture]
 | 
			
		||||
switch = mute
 | 
			
		||||
volume = merge
 | 
			
		||||
override-map.1 = all
 | 
			
		||||
override-map.2 = all-left,all-right
 | 
			
		||||
 | 
			
		||||
[Element Mic]
 | 
			
		||||
switch = off
 | 
			
		||||
volume = off
 | 
			
		||||
 | 
			
		||||
[Element Line]
 | 
			
		||||
switch = off
 | 
			
		||||
volume = off
 | 
			
		||||
 | 
			
		||||
[Element Aux]
 | 
			
		||||
required = any
 | 
			
		||||
switch = mute
 | 
			
		||||
volume = merge
 | 
			
		||||
override-map.1 = all
 | 
			
		||||
override-map.2 = all-left,all-right
 | 
			
		||||
 | 
			
		||||
[Element Video]
 | 
			
		||||
switch = off
 | 
			
		||||
volume = off
 | 
			
		||||
 | 
			
		||||
.include analog-input.conf.common
 | 
			
		||||
							
								
								
									
										44
									
								
								src/modules/alsa/mixer/paths/analog-input-fm.conf
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										44
									
								
								src/modules/alsa/mixer/paths/analog-input-fm.conf
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,44 @@
 | 
			
		|||
# For devices where we have an FM element
 | 
			
		||||
 | 
			
		||||
[General]
 | 
			
		||||
priority = 70
 | 
			
		||||
name = analog-input-radio
 | 
			
		||||
 | 
			
		||||
[Element Capture]
 | 
			
		||||
switch = mute
 | 
			
		||||
volume = merge
 | 
			
		||||
override-map.1 = all
 | 
			
		||||
override-map.2 = all-left,all-right
 | 
			
		||||
 | 
			
		||||
[Element Mic]
 | 
			
		||||
switch = off
 | 
			
		||||
volume = off
 | 
			
		||||
 | 
			
		||||
[Element Line]
 | 
			
		||||
switch = off
 | 
			
		||||
volume = off
 | 
			
		||||
 | 
			
		||||
[Element Aux]
 | 
			
		||||
switch = off
 | 
			
		||||
volume = off
 | 
			
		||||
 | 
			
		||||
[Element Video]
 | 
			
		||||
switch = off
 | 
			
		||||
volume = off
 | 
			
		||||
 | 
			
		||||
[Element Mic/Line]
 | 
			
		||||
switch = off
 | 
			
		||||
volume = off
 | 
			
		||||
 | 
			
		||||
[Element TV Tuner]
 | 
			
		||||
switch = off
 | 
			
		||||
volume = off
 | 
			
		||||
 | 
			
		||||
[Element FM]
 | 
			
		||||
required = any
 | 
			
		||||
switch = mute
 | 
			
		||||
volume = merge
 | 
			
		||||
override-map.1 = all
 | 
			
		||||
override-map.2 = all-left,all-right
 | 
			
		||||
 | 
			
		||||
.include analog-input.conf.common
 | 
			
		||||
							
								
								
									
										43
									
								
								src/modules/alsa/mixer/paths/analog-input-linein.conf
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										43
									
								
								src/modules/alsa/mixer/paths/analog-input-linein.conf
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,43 @@
 | 
			
		|||
# For devices, where we have  a Line element
 | 
			
		||||
 | 
			
		||||
[General]
 | 
			
		||||
priority = 90
 | 
			
		||||
 | 
			
		||||
[Element Capture]
 | 
			
		||||
switch = mute
 | 
			
		||||
volume = merge
 | 
			
		||||
override-map.1 = all
 | 
			
		||||
override-map.2 = all-left,all-right
 | 
			
		||||
 | 
			
		||||
[Element Mic]
 | 
			
		||||
switch = off
 | 
			
		||||
volume = off
 | 
			
		||||
 | 
			
		||||
[Element Line]
 | 
			
		||||
required = any
 | 
			
		||||
switch = mute
 | 
			
		||||
volume = merge
 | 
			
		||||
override-map.1 = all
 | 
			
		||||
override-map.2 = all-left,all-right
 | 
			
		||||
 | 
			
		||||
[Element Aux]
 | 
			
		||||
switch = off
 | 
			
		||||
volume = off
 | 
			
		||||
 | 
			
		||||
[Element Video]
 | 
			
		||||
switch = off
 | 
			
		||||
volume = off
 | 
			
		||||
 | 
			
		||||
[Element Mic/Line]
 | 
			
		||||
switch = off
 | 
			
		||||
volume = off
 | 
			
		||||
 | 
			
		||||
[Element TV Tuner]
 | 
			
		||||
switch = off
 | 
			
		||||
volume = off
 | 
			
		||||
 | 
			
		||||
[Element FM]
 | 
			
		||||
switch = off
 | 
			
		||||
volume = off
 | 
			
		||||
 | 
			
		||||
.include analog-input.conf.common
 | 
			
		||||
							
								
								
									
										44
									
								
								src/modules/alsa/mixer/paths/analog-input-mic-line.conf
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										44
									
								
								src/modules/alsa/mixer/paths/analog-input-mic-line.conf
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,44 @@
 | 
			
		|||
# For devices where we have a Mic/Lineb element
 | 
			
		||||
 | 
			
		||||
[General]
 | 
			
		||||
priority = 90
 | 
			
		||||
name = analog-input
 | 
			
		||||
 | 
			
		||||
[Element Capture]
 | 
			
		||||
switch = mute
 | 
			
		||||
volume = merge
 | 
			
		||||
override-map.1 = all
 | 
			
		||||
override-map.2 = all-left,all-right
 | 
			
		||||
 | 
			
		||||
[Element Mic]
 | 
			
		||||
switch = off
 | 
			
		||||
volume = off
 | 
			
		||||
 | 
			
		||||
[Element Line]
 | 
			
		||||
switch = off
 | 
			
		||||
volume = off
 | 
			
		||||
 | 
			
		||||
[Element Aux]
 | 
			
		||||
switch = off
 | 
			
		||||
volume = off
 | 
			
		||||
 | 
			
		||||
[Element Video]
 | 
			
		||||
switch = off
 | 
			
		||||
volume = off
 | 
			
		||||
 | 
			
		||||
[Element Mic/Line]
 | 
			
		||||
required = any
 | 
			
		||||
switch = mute
 | 
			
		||||
volume = merge
 | 
			
		||||
override-map.1 = all
 | 
			
		||||
override-map.2 = all-left,all-right
 | 
			
		||||
 | 
			
		||||
[Element TV Tuner]
 | 
			
		||||
switch = off
 | 
			
		||||
volume = off
 | 
			
		||||
 | 
			
		||||
[Element FM]
 | 
			
		||||
switch = off
 | 
			
		||||
volume = off
 | 
			
		||||
 | 
			
		||||
.include analog-input.conf.common
 | 
			
		||||
							
								
								
									
										45
									
								
								src/modules/alsa/mixer/paths/analog-input-mic.conf
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										45
									
								
								src/modules/alsa/mixer/paths/analog-input-mic.conf
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,45 @@
 | 
			
		|||
# For devices where we have  a Mic element
 | 
			
		||||
 | 
			
		||||
[General]
 | 
			
		||||
priority = 100
 | 
			
		||||
name = analog-input-microphone
 | 
			
		||||
 | 
			
		||||
[Element Capture]
 | 
			
		||||
switch = mute
 | 
			
		||||
volume = merge
 | 
			
		||||
override-map.1 = all
 | 
			
		||||
override-map.2 = all-left,all-right
 | 
			
		||||
 | 
			
		||||
[Element Mic]
 | 
			
		||||
required = any
 | 
			
		||||
switch = mute
 | 
			
		||||
volume = merge
 | 
			
		||||
override-map.1 = all
 | 
			
		||||
override-map.2 = all-left,all-right
 | 
			
		||||
 | 
			
		||||
[Element Line]
 | 
			
		||||
switch = off
 | 
			
		||||
volume = off
 | 
			
		||||
 | 
			
		||||
[Element Aux]
 | 
			
		||||
switch = off
 | 
			
		||||
volume = off
 | 
			
		||||
 | 
			
		||||
[Element Video]
 | 
			
		||||
switch = off
 | 
			
		||||
volume = off
 | 
			
		||||
 | 
			
		||||
[Element Mic/Line]
 | 
			
		||||
switch = off
 | 
			
		||||
volume = off
 | 
			
		||||
 | 
			
		||||
[Element TV Tuner]
 | 
			
		||||
switch = off
 | 
			
		||||
volume = off
 | 
			
		||||
 | 
			
		||||
[Element FM]
 | 
			
		||||
switch = off
 | 
			
		||||
volume = off
 | 
			
		||||
 | 
			
		||||
.include analog-input.conf.common
 | 
			
		||||
.include analog-input-mic.conf.common
 | 
			
		||||
							
								
								
									
										41
									
								
								src/modules/alsa/mixer/paths/analog-input-mic.conf.common
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										41
									
								
								src/modules/alsa/mixer/paths/analog-input-mic.conf.common
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,41 @@
 | 
			
		|||
;;; 'Mic Select'
 | 
			
		||||
 | 
			
		||||
[Element Mic Select]
 | 
			
		||||
enumeration = select
 | 
			
		||||
 | 
			
		||||
[Option Mic Select:Mic1]
 | 
			
		||||
name = input-microphone
 | 
			
		||||
priority = 20
 | 
			
		||||
 | 
			
		||||
[Option Mic Select:Mic2]
 | 
			
		||||
name = input-microphone
 | 
			
		||||
priority = 19
 | 
			
		||||
 | 
			
		||||
;;; Various Boosts
 | 
			
		||||
 | 
			
		||||
[Element Mic Boost (+20dB)]
 | 
			
		||||
switch = select
 | 
			
		||||
 | 
			
		||||
[Option Mic Boost (+20dB):on]
 | 
			
		||||
name = input-boost-on
 | 
			
		||||
 | 
			
		||||
[Option Mic Boost (+20dB):off]
 | 
			
		||||
name = input-boost-off
 | 
			
		||||
 | 
			
		||||
[Element Mic Boost]
 | 
			
		||||
switch = select
 | 
			
		||||
 | 
			
		||||
[Option Mic Boost:on]
 | 
			
		||||
name = input-boost-on
 | 
			
		||||
 | 
			
		||||
[Option Mic Boost:off]
 | 
			
		||||
name = input-boost-off
 | 
			
		||||
 | 
			
		||||
[Element Front Mic Boost]
 | 
			
		||||
switch = select
 | 
			
		||||
 | 
			
		||||
[Option Front Mic Boost:on]
 | 
			
		||||
name = input-boost-on
 | 
			
		||||
 | 
			
		||||
[Option Front Mic Boost:off]
 | 
			
		||||
name = input-boost-off
 | 
			
		||||
							
								
								
									
										44
									
								
								src/modules/alsa/mixer/paths/analog-input-tvtuner.conf
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										44
									
								
								src/modules/alsa/mixer/paths/analog-input-tvtuner.conf
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,44 @@
 | 
			
		|||
# For devices, where we have a TV Tuner element
 | 
			
		||||
 | 
			
		||||
[General]
 | 
			
		||||
priority = 70
 | 
			
		||||
name = analog-input-video
 | 
			
		||||
 | 
			
		||||
[Element Capture]
 | 
			
		||||
switch = mute
 | 
			
		||||
volume = merge
 | 
			
		||||
override-map.1 = all
 | 
			
		||||
override-map.2 = all-left,all-right
 | 
			
		||||
 | 
			
		||||
[Element Mic]
 | 
			
		||||
switch = off
 | 
			
		||||
volume = off
 | 
			
		||||
 | 
			
		||||
[Element Line]
 | 
			
		||||
switch = off
 | 
			
		||||
volume = off
 | 
			
		||||
 | 
			
		||||
[Element Aux]
 | 
			
		||||
switch = off
 | 
			
		||||
volume = off
 | 
			
		||||
 | 
			
		||||
[Element Video]
 | 
			
		||||
switch = off
 | 
			
		||||
volume = off
 | 
			
		||||
 | 
			
		||||
[Element Mic/Line]
 | 
			
		||||
switch = off
 | 
			
		||||
volume = off
 | 
			
		||||
 | 
			
		||||
[Element TV Tuner]
 | 
			
		||||
required = any
 | 
			
		||||
switch = mute
 | 
			
		||||
volume = merge
 | 
			
		||||
override-map.1 = all
 | 
			
		||||
override-map.2 = all-left,all-right
 | 
			
		||||
 | 
			
		||||
[Element FM]
 | 
			
		||||
switch = off
 | 
			
		||||
volume = off
 | 
			
		||||
 | 
			
		||||
.include analog-input.conf.common
 | 
			
		||||
							
								
								
									
										31
									
								
								src/modules/alsa/mixer/paths/analog-input-video.conf
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										31
									
								
								src/modules/alsa/mixer/paths/analog-input-video.conf
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,31 @@
 | 
			
		|||
# For devices, where we have a Video element
 | 
			
		||||
 | 
			
		||||
[General]
 | 
			
		||||
priority = 70
 | 
			
		||||
 | 
			
		||||
[Element Capture]
 | 
			
		||||
switch = mute
 | 
			
		||||
volume = merge
 | 
			
		||||
override-map.1 = all
 | 
			
		||||
override-map.2 = all-left,all-right
 | 
			
		||||
 | 
			
		||||
[Element Mic]
 | 
			
		||||
switch = off
 | 
			
		||||
volume = off
 | 
			
		||||
 | 
			
		||||
[Element Line]
 | 
			
		||||
switch = off
 | 
			
		||||
volume = off
 | 
			
		||||
 | 
			
		||||
[Element Aux]
 | 
			
		||||
switch = off
 | 
			
		||||
volume = off
 | 
			
		||||
 | 
			
		||||
[Element Video]
 | 
			
		||||
required = any
 | 
			
		||||
switch = mute
 | 
			
		||||
volume = merge
 | 
			
		||||
override-map.1 = all
 | 
			
		||||
override-map.2 = all-left,all-right
 | 
			
		||||
 | 
			
		||||
.include analog-input.conf.common
 | 
			
		||||
							
								
								
									
										35
									
								
								src/modules/alsa/mixer/paths/analog-input.conf
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								src/modules/alsa/mixer/paths/analog-input.conf
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,35 @@
 | 
			
		|||
# A fallback for devices that lack seperate Mic/Line/Aux/Video elements
 | 
			
		||||
 | 
			
		||||
[General]
 | 
			
		||||
priority = 100
 | 
			
		||||
 | 
			
		||||
[Element Capture]
 | 
			
		||||
required = volume
 | 
			
		||||
switch = mute
 | 
			
		||||
volume = merge
 | 
			
		||||
override-map.1 = all
 | 
			
		||||
override-map.2 = all-left,all-right
 | 
			
		||||
 | 
			
		||||
[Element Mic]
 | 
			
		||||
required-absent = any
 | 
			
		||||
 | 
			
		||||
[Element Line]
 | 
			
		||||
required-absent = any
 | 
			
		||||
 | 
			
		||||
[Element Aux]
 | 
			
		||||
required-absent = any
 | 
			
		||||
 | 
			
		||||
[Element Video]
 | 
			
		||||
required-absent = any
 | 
			
		||||
 | 
			
		||||
[Element Mic/Line]
 | 
			
		||||
required-absent = any
 | 
			
		||||
 | 
			
		||||
[Element TV Tuner]
 | 
			
		||||
required-absent = any
 | 
			
		||||
 | 
			
		||||
[Element FM]
 | 
			
		||||
required-absent = any
 | 
			
		||||
 | 
			
		||||
.include analog-input.conf.common
 | 
			
		||||
.include analog-input-mic.conf.common
 | 
			
		||||
							
								
								
									
										239
									
								
								src/modules/alsa/mixer/paths/analog-input.conf.common
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										239
									
								
								src/modules/alsa/mixer/paths/analog-input.conf.common
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,239 @@
 | 
			
		|||
# Mixer path for PulseAudio's ALSA backend. If multiple options by the
 | 
			
		||||
# same id are discovered they will be suffixed with a number to
 | 
			
		||||
# distuingish them, in the same order they appear here.
 | 
			
		||||
#
 | 
			
		||||
# Source selection should use the following names:
 | 
			
		||||
#
 | 
			
		||||
#       input                       -- If we don't know the exact kind of input
 | 
			
		||||
#       input-microphone
 | 
			
		||||
#       input-microphone-internal
 | 
			
		||||
#       input-microphone-external
 | 
			
		||||
#       input-linein
 | 
			
		||||
#       input-video
 | 
			
		||||
#       input-radio
 | 
			
		||||
#       input-docking-microphone
 | 
			
		||||
#       input-docking-linein
 | 
			
		||||
#       input-docking
 | 
			
		||||
#
 | 
			
		||||
#  We explicitly don't want to wrap the following sources:
 | 
			
		||||
#
 | 
			
		||||
#       CD
 | 
			
		||||
#       Synth/MIDI
 | 
			
		||||
#       Phone
 | 
			
		||||
#       Mix
 | 
			
		||||
#       Digital/SPDIF
 | 
			
		||||
#       Master
 | 
			
		||||
#       PC Speaker
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
;;; 'Input Source Select'
 | 
			
		||||
 | 
			
		||||
[Element Input Source Select]
 | 
			
		||||
enumeration = select
 | 
			
		||||
 | 
			
		||||
[Option Input Source Select:Input1]
 | 
			
		||||
name = input
 | 
			
		||||
priority = 10
 | 
			
		||||
 | 
			
		||||
[Option Input Source Select:Input2]
 | 
			
		||||
name = input
 | 
			
		||||
priority = 5
 | 
			
		||||
 | 
			
		||||
;;; 'Input Source'
 | 
			
		||||
 | 
			
		||||
[Element Input Source]
 | 
			
		||||
enumeration = select
 | 
			
		||||
 | 
			
		||||
[Option Input Source:Mic]
 | 
			
		||||
name = input-microphone
 | 
			
		||||
priority = 20
 | 
			
		||||
 | 
			
		||||
[Option Input Source:Microphone]
 | 
			
		||||
name = input-microphone
 | 
			
		||||
priority = 20
 | 
			
		||||
 | 
			
		||||
[Option Input Source:Front Mic]
 | 
			
		||||
name = input-microphone
 | 
			
		||||
priority = 19
 | 
			
		||||
 | 
			
		||||
[Option Input Source:Front Microphone]
 | 
			
		||||
name = input-microphone
 | 
			
		||||
priority = 19
 | 
			
		||||
 | 
			
		||||
[Option Input Source:Line]
 | 
			
		||||
name = input-linein
 | 
			
		||||
priority = 18
 | 
			
		||||
 | 
			
		||||
[Option Input Source:Line-In]
 | 
			
		||||
name = input-linein
 | 
			
		||||
priority = 18
 | 
			
		||||
 | 
			
		||||
[Option Input Source:Line In]
 | 
			
		||||
name = input-linein
 | 
			
		||||
priority = 18
 | 
			
		||||
 | 
			
		||||
;;; ' Capture Source'
 | 
			
		||||
 | 
			
		||||
[Element Capture Source]
 | 
			
		||||
enumeration = select
 | 
			
		||||
 | 
			
		||||
[Option Capture Source:TV Tuner]
 | 
			
		||||
name = input-video
 | 
			
		||||
 | 
			
		||||
[Option Capture Source:FM]
 | 
			
		||||
name = input-radio
 | 
			
		||||
 | 
			
		||||
[Option Capture Source:Mic/Line]
 | 
			
		||||
name = input
 | 
			
		||||
 | 
			
		||||
[Option Capture Source:Line/Mic]
 | 
			
		||||
name = input
 | 
			
		||||
 | 
			
		||||
[Option Capture Source:Mic]
 | 
			
		||||
name = input-microphone
 | 
			
		||||
 | 
			
		||||
[Option Capture Source:Microphone]
 | 
			
		||||
name = input-microphone
 | 
			
		||||
 | 
			
		||||
[Option Capture Source:Int Mic]
 | 
			
		||||
name = input-microphone-internal
 | 
			
		||||
 | 
			
		||||
[Option Capture Source:Int DMic]
 | 
			
		||||
name = input-microphone-internal
 | 
			
		||||
 | 
			
		||||
[Option Capture Source:Internal Mic]
 | 
			
		||||
name = input-microphone-internal
 | 
			
		||||
 | 
			
		||||
[Option Capture Source:iMic]
 | 
			
		||||
name = input-microphone-internal
 | 
			
		||||
 | 
			
		||||
[Option Capture Source:i-Mic]
 | 
			
		||||
name = input-microphone-internal
 | 
			
		||||
 | 
			
		||||
[Option Capture Source:Internal Microphone]
 | 
			
		||||
name = input-microphone-internal
 | 
			
		||||
 | 
			
		||||
[Option Capture Source:Front Mic]
 | 
			
		||||
name = input-microphone
 | 
			
		||||
 | 
			
		||||
[Option Capture Source:Front Microphone]
 | 
			
		||||
name = input-microphone
 | 
			
		||||
 | 
			
		||||
[Option Capture Source:Rear Mic]
 | 
			
		||||
name = input-microphone
 | 
			
		||||
 | 
			
		||||
[Option Capture Source:Mic1]
 | 
			
		||||
name = input-microphone
 | 
			
		||||
 | 
			
		||||
[Option Capture Source:Mic2]
 | 
			
		||||
name = input-microphone
 | 
			
		||||
 | 
			
		||||
[Option Capture Source:D-Mic]
 | 
			
		||||
name = input-microphone
 | 
			
		||||
 | 
			
		||||
[Option Capture Source:IntMic]
 | 
			
		||||
name = input-microphone-internal
 | 
			
		||||
 | 
			
		||||
[Option Capture Source:ExtMic]
 | 
			
		||||
name = input-microphone-external
 | 
			
		||||
 | 
			
		||||
[Option Capture Source:Ext Mic]
 | 
			
		||||
name = input-microphone-external
 | 
			
		||||
 | 
			
		||||
[Option Capture Source:E-Mic]
 | 
			
		||||
name = input-microphone-external
 | 
			
		||||
 | 
			
		||||
[Option Capture Source:e-Mic]
 | 
			
		||||
name = input-microphone-external
 | 
			
		||||
 | 
			
		||||
[Option Capture Source:LineIn]
 | 
			
		||||
name = input-linein
 | 
			
		||||
 | 
			
		||||
[Option Capture Source:Analog]
 | 
			
		||||
name = input
 | 
			
		||||
 | 
			
		||||
[Option Capture Source:Line]
 | 
			
		||||
name = input-linein
 | 
			
		||||
 | 
			
		||||
[Option Capture Source:Line-In]
 | 
			
		||||
name = input-linein
 | 
			
		||||
 | 
			
		||||
[Option Capture Source:Line In]
 | 
			
		||||
name = input-linein
 | 
			
		||||
 | 
			
		||||
[Option Capture Source:Video]
 | 
			
		||||
name = input-video
 | 
			
		||||
 | 
			
		||||
[Option Capture Source:Aux]
 | 
			
		||||
name = input
 | 
			
		||||
 | 
			
		||||
[Option Capture Source:Aux0]
 | 
			
		||||
name = input
 | 
			
		||||
 | 
			
		||||
[Option Capture Source:Aux1]
 | 
			
		||||
name = input
 | 
			
		||||
 | 
			
		||||
[Option Capture Source:Aux2]
 | 
			
		||||
name = input
 | 
			
		||||
 | 
			
		||||
[Option Capture Source:Aux3]
 | 
			
		||||
name = input
 | 
			
		||||
 | 
			
		||||
[Option Capture Source:AUX IN]
 | 
			
		||||
name = input
 | 
			
		||||
 | 
			
		||||
[Option Capture Source:Aux In]
 | 
			
		||||
name = input
 | 
			
		||||
 | 
			
		||||
[Option Capture Source:AOUT]
 | 
			
		||||
name = input
 | 
			
		||||
 | 
			
		||||
[Option Capture Source:AUX]
 | 
			
		||||
name = input
 | 
			
		||||
 | 
			
		||||
[Option Capture Source:Cam Mic]
 | 
			
		||||
name = input-microphone
 | 
			
		||||
 | 
			
		||||
[Option Capture Source:Digital Mic]
 | 
			
		||||
name = input-microphone
 | 
			
		||||
 | 
			
		||||
[Option Capture Source:Digital Mic 1]
 | 
			
		||||
name = input-microphone
 | 
			
		||||
 | 
			
		||||
[Option Capture Source:Digital Mic 2]
 | 
			
		||||
name = input-microphone
 | 
			
		||||
 | 
			
		||||
[Option Capture Source:Analog Inputs]
 | 
			
		||||
name = input
 | 
			
		||||
 | 
			
		||||
[Option Capture Source:Unknown1]
 | 
			
		||||
name = input
 | 
			
		||||
 | 
			
		||||
[Option Capture Source:Unknown2]
 | 
			
		||||
name = input
 | 
			
		||||
 | 
			
		||||
[Option Capture Source:Docking-Station]
 | 
			
		||||
name = input-docking
 | 
			
		||||
 | 
			
		||||
[Option Capture Source:Dock Mic]
 | 
			
		||||
name = input-docking-microphone
 | 
			
		||||
 | 
			
		||||
;;; Various Boosts
 | 
			
		||||
 | 
			
		||||
[Element Capture Boost]
 | 
			
		||||
switch = select
 | 
			
		||||
 | 
			
		||||
[Option Capture Boost:on]
 | 
			
		||||
name = input-boost-on
 | 
			
		||||
 | 
			
		||||
[Option Capture Boost:off]
 | 
			
		||||
name = input-boost-off
 | 
			
		||||
 | 
			
		||||
[Element Auto Gain Control]
 | 
			
		||||
switch = select
 | 
			
		||||
 | 
			
		||||
[Option Auto Gain Control:on]
 | 
			
		||||
name = input-agc-on
 | 
			
		||||
 | 
			
		||||
[Option Auto Gain Control:off]
 | 
			
		||||
name = input-agc-off
 | 
			
		||||
							
								
								
									
										53
									
								
								src/modules/alsa/mixer/paths/analog-output-headphones.conf
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										53
									
								
								src/modules/alsa/mixer/paths/analog-output-headphones.conf
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,53 @@
 | 
			
		|||
# Path for mixers that have a Headphone slider
 | 
			
		||||
 | 
			
		||||
[General]
 | 
			
		||||
priority = 90
 | 
			
		||||
 | 
			
		||||
[Element Hardware Master]
 | 
			
		||||
switch = mute
 | 
			
		||||
volume = merge
 | 
			
		||||
override-map.1 = all
 | 
			
		||||
override-map.2 = all-left,all-right
 | 
			
		||||
 | 
			
		||||
[Element Master]
 | 
			
		||||
switch = mute
 | 
			
		||||
volume = merge
 | 
			
		||||
override-map.1 = all
 | 
			
		||||
override-map.2 = all-left,all-right
 | 
			
		||||
 | 
			
		||||
[Element Master Mono]
 | 
			
		||||
switch = off
 | 
			
		||||
volume = off
 | 
			
		||||
 | 
			
		||||
[Element Headphone]
 | 
			
		||||
required = any
 | 
			
		||||
switch = mute
 | 
			
		||||
volume = merge
 | 
			
		||||
override-map.1 = all
 | 
			
		||||
override-map.2 = all-left,all-right
 | 
			
		||||
 | 
			
		||||
[Element Front]
 | 
			
		||||
switch = off
 | 
			
		||||
volume = off
 | 
			
		||||
 | 
			
		||||
[Element Rear]
 | 
			
		||||
switch = off
 | 
			
		||||
volume = off
 | 
			
		||||
 | 
			
		||||
[Element Sourround]
 | 
			
		||||
switch = off
 | 
			
		||||
volume = off
 | 
			
		||||
 | 
			
		||||
[Element Side]
 | 
			
		||||
switch = off
 | 
			
		||||
volume = off
 | 
			
		||||
 | 
			
		||||
[Element Center]
 | 
			
		||||
switch = off
 | 
			
		||||
volume = off
 | 
			
		||||
 | 
			
		||||
[Element LFE]
 | 
			
		||||
switch = off
 | 
			
		||||
volume = off
 | 
			
		||||
 | 
			
		||||
.include analog-output.conf.common
 | 
			
		||||
							
								
								
									
										54
									
								
								src/modules/alsa/mixer/paths/analog-output-lfe-on-mono.conf
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										54
									
								
								src/modules/alsa/mixer/paths/analog-output-lfe-on-mono.conf
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,54 @@
 | 
			
		|||
# Intended for usage in laptops that have a seperate LFE speaker
 | 
			
		||||
# connected to the Master mono connector
 | 
			
		||||
 | 
			
		||||
[General]
 | 
			
		||||
priority = 40
 | 
			
		||||
 | 
			
		||||
[Element Hardware Master]
 | 
			
		||||
switch = mute
 | 
			
		||||
volume = merge
 | 
			
		||||
override-map.1 = all
 | 
			
		||||
override-map.2 = all-left,all-right
 | 
			
		||||
 | 
			
		||||
[Element Master]
 | 
			
		||||
switch = mute
 | 
			
		||||
volume = merge
 | 
			
		||||
override-map.1 = all-no-lfe
 | 
			
		||||
override-map.2 = all-left,all-right
 | 
			
		||||
 | 
			
		||||
[Element Master Mono]
 | 
			
		||||
required = any
 | 
			
		||||
switch = mute
 | 
			
		||||
volume = merge
 | 
			
		||||
override-map.1 = lfe
 | 
			
		||||
override-map.2 = lfe,lfe
 | 
			
		||||
 | 
			
		||||
[Element Headphone]
 | 
			
		||||
switch = off
 | 
			
		||||
volume = off
 | 
			
		||||
 | 
			
		||||
[Element Front]
 | 
			
		||||
switch = off
 | 
			
		||||
volume = off
 | 
			
		||||
 | 
			
		||||
[Element Rear]
 | 
			
		||||
switch = off
 | 
			
		||||
volume = off
 | 
			
		||||
 | 
			
		||||
[Element Sourround]
 | 
			
		||||
switch = off
 | 
			
		||||
volume = off
 | 
			
		||||
 | 
			
		||||
[Element Side]
 | 
			
		||||
switch = off
 | 
			
		||||
volume = off
 | 
			
		||||
 | 
			
		||||
[Element Center]
 | 
			
		||||
switch = off
 | 
			
		||||
volume = off
 | 
			
		||||
 | 
			
		||||
[Element LFE]
 | 
			
		||||
switch = off
 | 
			
		||||
volume = off
 | 
			
		||||
 | 
			
		||||
.include analog-output.conf.common
 | 
			
		||||
							
								
								
									
										51
									
								
								src/modules/alsa/mixer/paths/analog-output-mono.conf
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										51
									
								
								src/modules/alsa/mixer/paths/analog-output-mono.conf
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,51 @@
 | 
			
		|||
# Intended for usage on boards that have a seperate Mono output plug.
 | 
			
		||||
 | 
			
		||||
[General]
 | 
			
		||||
priority = 50
 | 
			
		||||
 | 
			
		||||
[Element Hardware Master]
 | 
			
		||||
switch = mute
 | 
			
		||||
volume = merge
 | 
			
		||||
override-map.1 = all
 | 
			
		||||
override-map.2 = all-left,all-right
 | 
			
		||||
 | 
			
		||||
[Element Master]
 | 
			
		||||
switch = off
 | 
			
		||||
volume = off
 | 
			
		||||
 | 
			
		||||
[Element Master Mono]
 | 
			
		||||
required = any
 | 
			
		||||
switch = mute
 | 
			
		||||
volume = merge
 | 
			
		||||
override-map.1 = all
 | 
			
		||||
override-map.2 = all-left,all-right
 | 
			
		||||
 | 
			
		||||
[Element Headphone]
 | 
			
		||||
switch = off
 | 
			
		||||
volume = off
 | 
			
		||||
 | 
			
		||||
[Element Front]
 | 
			
		||||
switch = off
 | 
			
		||||
volume = off
 | 
			
		||||
 | 
			
		||||
[Element Rear]
 | 
			
		||||
switch = off
 | 
			
		||||
volume = off
 | 
			
		||||
 | 
			
		||||
[Element Sourround]
 | 
			
		||||
switch = off
 | 
			
		||||
volume = off
 | 
			
		||||
 | 
			
		||||
[Element Side]
 | 
			
		||||
switch = off
 | 
			
		||||
volume = off
 | 
			
		||||
 | 
			
		||||
[Element Center]
 | 
			
		||||
switch = off
 | 
			
		||||
volume = off
 | 
			
		||||
 | 
			
		||||
[Element LFE]
 | 
			
		||||
switch = off
 | 
			
		||||
volume = off
 | 
			
		||||
 | 
			
		||||
.include analog-output.conf.common
 | 
			
		||||
							
								
								
									
										62
									
								
								src/modules/alsa/mixer/paths/analog-output.conf
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										62
									
								
								src/modules/alsa/mixer/paths/analog-output.conf
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,62 @@
 | 
			
		|||
# Intended for the 'default' output
 | 
			
		||||
 | 
			
		||||
[General]
 | 
			
		||||
priority = 100
 | 
			
		||||
 | 
			
		||||
[Element Hardware Master]
 | 
			
		||||
switch = mute
 | 
			
		||||
volume = merge
 | 
			
		||||
override-map.1 = all
 | 
			
		||||
override-map.2 = all-left,all-right
 | 
			
		||||
 | 
			
		||||
[Element Master]
 | 
			
		||||
switch = mute
 | 
			
		||||
volume = merge
 | 
			
		||||
override-map.1 = all
 | 
			
		||||
override-map.2 = all-left,all-right
 | 
			
		||||
 | 
			
		||||
[Element Master Mono]
 | 
			
		||||
switch = off
 | 
			
		||||
volume = off
 | 
			
		||||
 | 
			
		||||
[Element Headphone]
 | 
			
		||||
switch = off
 | 
			
		||||
volume = off
 | 
			
		||||
 | 
			
		||||
[Element Front]
 | 
			
		||||
switch = mute
 | 
			
		||||
volume = merge
 | 
			
		||||
override-map.1 = all-front
 | 
			
		||||
override-map.2 = front-left,front-right
 | 
			
		||||
 | 
			
		||||
[Element Rear]
 | 
			
		||||
switch = mute
 | 
			
		||||
volume = merge
 | 
			
		||||
override-map.1 = all-rear
 | 
			
		||||
override-map.2 = rear-left,rear-right
 | 
			
		||||
 | 
			
		||||
[Element Surround]
 | 
			
		||||
switch = mute
 | 
			
		||||
volume = merge
 | 
			
		||||
override-map.1 = all-rear
 | 
			
		||||
override-map.2 = rear-left,rear-right
 | 
			
		||||
 | 
			
		||||
[Element Side]
 | 
			
		||||
switch = mute
 | 
			
		||||
volume = merge
 | 
			
		||||
override-map.1 = all-side
 | 
			
		||||
override-map.2 = side-left,side-right
 | 
			
		||||
 | 
			
		||||
[Element Center]
 | 
			
		||||
switch = mute
 | 
			
		||||
volume = merge
 | 
			
		||||
override-map.1 = all-center
 | 
			
		||||
override-map.2 = all-center,all-center
 | 
			
		||||
 | 
			
		||||
[Element LFE]
 | 
			
		||||
switch = mute
 | 
			
		||||
volume = merge
 | 
			
		||||
override-map.1 = lfe
 | 
			
		||||
override-map.2 = lfe,lfe
 | 
			
		||||
 | 
			
		||||
.include analog-output.conf.common
 | 
			
		||||
							
								
								
									
										40
									
								
								src/modules/alsa/mixer/paths/analog-output.conf.common
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										40
									
								
								src/modules/alsa/mixer/paths/analog-output.conf.common
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,40 @@
 | 
			
		|||
# Common part of all paths
 | 
			
		||||
 | 
			
		||||
# [General]
 | 
			
		||||
# priority = ...
 | 
			
		||||
# description = ...
 | 
			
		||||
#
 | 
			
		||||
# [Option ...:...]
 | 
			
		||||
# name = ...
 | 
			
		||||
# priority = ...
 | 
			
		||||
#
 | 
			
		||||
# [Element ...]
 | 
			
		||||
# required = ignore | switch | volume | enumeration | any
 | 
			
		||||
# required-absent = ignore | switch | volume
 | 
			
		||||
#
 | 
			
		||||
# switch = ignore | mute | off | on | select
 | 
			
		||||
# volume = ignore | merge | off | zero
 | 
			
		||||
# enumeration = ignore | select
 | 
			
		||||
#
 | 
			
		||||
# direction = playback | capture
 | 
			
		||||
# direction-try-other = no | yes
 | 
			
		||||
#
 | 
			
		||||
# override-map.1 = ...
 | 
			
		||||
# override-map.2 = ...
 | 
			
		||||
 | 
			
		||||
[Element PCM]
 | 
			
		||||
switch = mute
 | 
			
		||||
volume = merge
 | 
			
		||||
override-map.1 = all
 | 
			
		||||
override-map.2 = all-left,all-right
 | 
			
		||||
 | 
			
		||||
[Element External Amplifier]
 | 
			
		||||
switch = select
 | 
			
		||||
 | 
			
		||||
[Option External Amplifier:on]
 | 
			
		||||
name = output-amplifier-on
 | 
			
		||||
priority = 0
 | 
			
		||||
 | 
			
		||||
[Option External Amplifier:off]
 | 
			
		||||
name = output-amplifier-off
 | 
			
		||||
priority = 10
 | 
			
		||||
							
								
								
									
										105
									
								
								src/modules/alsa/mixer/profile-sets/default.conf
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										105
									
								
								src/modules/alsa/mixer/profile-sets/default.conf
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,105 @@
 | 
			
		|||
# Profile definitions for PulseAudio's ALSA backend
 | 
			
		||||
#
 | 
			
		||||
# [Mapping id]
 | 
			
		||||
# device-strings = ...
 | 
			
		||||
# channel-map = ...
 | 
			
		||||
# description = ...
 | 
			
		||||
# paths-input = ...
 | 
			
		||||
# paths-output = ...
 | 
			
		||||
# element-input = ...
 | 
			
		||||
# element-output = ...
 | 
			
		||||
# priority = ...
 | 
			
		||||
# direction = any | input | output
 | 
			
		||||
#
 | 
			
		||||
# [Profile id]
 | 
			
		||||
# input-mappings = ...
 | 
			
		||||
# output-mappings = ...
 | 
			
		||||
# description = ...
 | 
			
		||||
# priority = ...
 | 
			
		||||
# skip-probe = no | yes
 | 
			
		||||
 | 
			
		||||
[General]
 | 
			
		||||
auto-profiles = yes
 | 
			
		||||
 | 
			
		||||
[Mapping analog-mono]
 | 
			
		||||
device-strings = hw
 | 
			
		||||
channel-map = mono
 | 
			
		||||
paths-output = analog-output analog-output-headphones analog-output-mono analog-output-lfe-on-mono
 | 
			
		||||
paths-input = analog-input analog-input-mic analog-input-linein analog-input-aux analog-input-video analog-input-tvtuner analog-input-fm analog-input-mic-line
 | 
			
		||||
priority = 1
 | 
			
		||||
 | 
			
		||||
[Mapping analog-stereo]
 | 
			
		||||
device-strings = front hw
 | 
			
		||||
channel-map = left,right
 | 
			
		||||
paths-output = analog-output analog-output-headphones analog-output-mono analog-output-lfe-on-mono
 | 
			
		||||
paths-input = analog-input analog-input-mic analog-input-linein analog-input-aux analog-input-video analog-input-tvtuner analog-input-fm analog-input-mic-line
 | 
			
		||||
priority = 10
 | 
			
		||||
 | 
			
		||||
[Mapping analog-surround-40]
 | 
			
		||||
device-strings = surround40
 | 
			
		||||
channel-map = front-left,front-right,rear-left,rear-right
 | 
			
		||||
paths-output = analog-output analog-output-lfe-on-mono
 | 
			
		||||
priority = 7
 | 
			
		||||
direction = output
 | 
			
		||||
 | 
			
		||||
[Mapping analog-surround-41]
 | 
			
		||||
device-strings = surround41
 | 
			
		||||
channel-map = front-left,front-right,rear-left,rear-right,lfe
 | 
			
		||||
paths-output = analog-output analog-output-lfe-on-mono
 | 
			
		||||
priority = 8
 | 
			
		||||
direction = output
 | 
			
		||||
 | 
			
		||||
[Mapping analog-surround-50]
 | 
			
		||||
device-strings = surround50
 | 
			
		||||
channel-map = front-left,front-right,rear-left,rear-right,front-center
 | 
			
		||||
paths-output = analog-output analog-output-lfe-on-mono
 | 
			
		||||
priority = 7
 | 
			
		||||
direction = output
 | 
			
		||||
 | 
			
		||||
[Mapping analog-surround-51]
 | 
			
		||||
device-strings = surround51
 | 
			
		||||
channel-map = front-left,front-right,rear-left,rear-right,front-center,lfe
 | 
			
		||||
paths-output = analog-output analog-output-lfe-on-mono
 | 
			
		||||
priority = 8
 | 
			
		||||
direction = output
 | 
			
		||||
 | 
			
		||||
[Mapping analog-surround-71]
 | 
			
		||||
device-strings = surround71
 | 
			
		||||
channel-map = front-left,front-right,rear-left,rear-right,front-center,lfe,side-left,side-right
 | 
			
		||||
description = Analog Surround 7.1
 | 
			
		||||
paths-output = analog-output analog-output-lfe-on-mono
 | 
			
		||||
priority = 7
 | 
			
		||||
direction = output
 | 
			
		||||
 | 
			
		||||
[Mapping iec958-stereo]
 | 
			
		||||
device-strings = iec958
 | 
			
		||||
channel-map = left,right
 | 
			
		||||
priority = 5
 | 
			
		||||
 | 
			
		||||
[Mapping iec958-surround-40]
 | 
			
		||||
device-strings = iec958
 | 
			
		||||
channel-map = front-left,front-right,rear-left,rear-right
 | 
			
		||||
priority = 1
 | 
			
		||||
 | 
			
		||||
[Mapping iec958-ac3-surround-40]
 | 
			
		||||
device-strings = a52
 | 
			
		||||
channel-map = front-left,front-right,rear-left,rear-right
 | 
			
		||||
priority = 2
 | 
			
		||||
direction = output
 | 
			
		||||
 | 
			
		||||
[Mapping iec958-ac3-surround-51]
 | 
			
		||||
device-strings = a52
 | 
			
		||||
channel-map = front-left,front-right,rear-left,rear-right,front-center,lfe
 | 
			
		||||
priority = 3
 | 
			
		||||
direction = output
 | 
			
		||||
 | 
			
		||||
[Mapping hdmi-stereo]
 | 
			
		||||
device-strings = hdmi
 | 
			
		||||
channel-map = left,right
 | 
			
		||||
priority = 4
 | 
			
		||||
direction = output
 | 
			
		||||
 | 
			
		||||
#[Profile output:analog-stereo+output:iec958-stereo+input:analog-stereo]
 | 
			
		||||
#description = Foobar
 | 
			
		||||
#output-mappings = analog-stereo iec958-stereo
 | 
			
		||||
#input-mappings = analog-stereo
 | 
			
		||||
							
								
								
									
										150
									
								
								src/modules/alsa/mixer/samples/ATI IXP--Realtek ALC655 rev 0
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										150
									
								
								src/modules/alsa/mixer/samples/ATI IXP--Realtek ALC655 rev 0
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,150 @@
 | 
			
		|||
Simple mixer control 'Master',0
 | 
			
		||||
  Capabilities: pvolume pswitch pswitch-joined
 | 
			
		||||
  Playback channels: Front Left - Front Right
 | 
			
		||||
  Limits: Playback 0 - 31
 | 
			
		||||
  Mono:
 | 
			
		||||
  Front Left: Playback 29 [94%] [-3.00dB] [on]
 | 
			
		||||
  Front Right: Playback 29 [94%] [-3.00dB] [on]
 | 
			
		||||
Simple mixer control 'Master Mono',0
 | 
			
		||||
  Capabilities: pvolume pvolume-joined pswitch pswitch-joined
 | 
			
		||||
  Playback channels: Mono
 | 
			
		||||
  Limits: Playback 0 - 31
 | 
			
		||||
  Mono: Playback 0 [0%] [-46.50dB] [off]
 | 
			
		||||
Simple mixer control 'PCM',0
 | 
			
		||||
  Capabilities: pvolume pswitch pswitch-joined
 | 
			
		||||
  Playback channels: Front Left - Front Right
 | 
			
		||||
  Limits: Playback 0 - 31
 | 
			
		||||
  Mono:
 | 
			
		||||
  Front Left: Playback 23 [74%] [0.00dB] [on]
 | 
			
		||||
  Front Right: Playback 23 [74%] [0.00dB] [on]
 | 
			
		||||
Simple mixer control 'Surround',0
 | 
			
		||||
  Capabilities: pvolume pswitch
 | 
			
		||||
  Playback channels: Front Left - Front Right
 | 
			
		||||
  Limits: Playback 0 - 31
 | 
			
		||||
  Mono:
 | 
			
		||||
  Front Left: Playback 0 [0%] [-46.50dB] [off]
 | 
			
		||||
  Front Right: Playback 0 [0%] [-46.50dB] [off]
 | 
			
		||||
Simple mixer control 'Surround Jack Mode',0
 | 
			
		||||
  Capabilities: enum
 | 
			
		||||
  Items: 'Shared' 'Independent'
 | 
			
		||||
  Item0: 'Shared'
 | 
			
		||||
Simple mixer control 'Center',0
 | 
			
		||||
  Capabilities: pvolume pvolume-joined pswitch pswitch-joined
 | 
			
		||||
  Playback channels: Mono
 | 
			
		||||
  Limits: Playback 0 - 31
 | 
			
		||||
  Mono: Playback 0 [0%] [-46.50dB] [off]
 | 
			
		||||
Simple mixer control 'LFE',0
 | 
			
		||||
  Capabilities: pvolume pvolume-joined pswitch pswitch-joined
 | 
			
		||||
  Playback channels: Mono
 | 
			
		||||
  Limits: Playback 0 - 31
 | 
			
		||||
  Mono: Playback 0 [0%] [-46.50dB] [off]
 | 
			
		||||
Simple mixer control 'Line',0
 | 
			
		||||
  Capabilities: pvolume pswitch pswitch-joined cswitch cswitch-exclusive
 | 
			
		||||
  Capture exclusive group: 0
 | 
			
		||||
  Playback channels: Front Left - Front Right
 | 
			
		||||
  Capture channels: Front Left - Front Right
 | 
			
		||||
  Limits: Playback 0 - 31
 | 
			
		||||
  Front Left: Playback 0 [0%] [-34.50dB] [off] Capture [off]
 | 
			
		||||
  Front Right: Playback 0 [0%] [-34.50dB] [off] Capture [off]
 | 
			
		||||
Simple mixer control 'CD',0
 | 
			
		||||
  Capabilities: pvolume pswitch pswitch-joined cswitch cswitch-exclusive
 | 
			
		||||
  Capture exclusive group: 0
 | 
			
		||||
  Playback channels: Front Left - Front Right
 | 
			
		||||
  Capture channels: Front Left - Front Right
 | 
			
		||||
  Limits: Playback 0 - 31
 | 
			
		||||
  Front Left: Playback 0 [0%] [-34.50dB] [off] Capture [off]
 | 
			
		||||
  Front Right: Playback 0 [0%] [-34.50dB] [off] Capture [off]
 | 
			
		||||
Simple mixer control 'Mic',0
 | 
			
		||||
  Capabilities: pvolume pvolume-joined pswitch pswitch-joined cswitch cswitch-exclusive
 | 
			
		||||
  Capture exclusive group: 0
 | 
			
		||||
  Playback channels: Mono
 | 
			
		||||
  Capture channels: Front Left - Front Right
 | 
			
		||||
  Limits: Playback 0 - 31
 | 
			
		||||
  Mono: Playback 0 [0%] [-34.50dB] [off]
 | 
			
		||||
  Front Left: Capture [on]
 | 
			
		||||
  Front Right: Capture [on]
 | 
			
		||||
Simple mixer control 'Mic Boost (+20dB)',0
 | 
			
		||||
  Capabilities: pswitch pswitch-joined
 | 
			
		||||
  Playback channels: Mono
 | 
			
		||||
  Mono: Playback [off]
 | 
			
		||||
Simple mixer control 'Mic Select',0
 | 
			
		||||
  Capabilities: enum
 | 
			
		||||
  Items: 'Mic1' 'Mic2'
 | 
			
		||||
  Item0: 'Mic1'
 | 
			
		||||
Simple mixer control 'Video',0
 | 
			
		||||
  Capabilities: cswitch cswitch-exclusive
 | 
			
		||||
  Capture exclusive group: 0
 | 
			
		||||
  Capture channels: Front Left - Front Right
 | 
			
		||||
  Front Left: Capture [off]
 | 
			
		||||
  Front Right: Capture [off]
 | 
			
		||||
Simple mixer control 'Phone',0
 | 
			
		||||
  Capabilities: pvolume pvolume-joined pswitch pswitch-joined cswitch cswitch-exclusive
 | 
			
		||||
  Capture exclusive group: 0
 | 
			
		||||
  Playback channels: Mono
 | 
			
		||||
  Capture channels: Front Left - Front Right
 | 
			
		||||
  Limits: Playback 0 - 31
 | 
			
		||||
  Mono: Playback 31 [100%] [12.00dB] [off]
 | 
			
		||||
  Front Left: Capture [off]
 | 
			
		||||
  Front Right: Capture [off]
 | 
			
		||||
Simple mixer control 'IEC958',0
 | 
			
		||||
  Capabilities: pswitch pswitch-joined cswitch cswitch-joined
 | 
			
		||||
  Playback channels: Mono
 | 
			
		||||
  Capture channels: Mono
 | 
			
		||||
  Mono: Playback [off] Capture [off]
 | 
			
		||||
Simple mixer control 'IEC958 Playback AC97-SPSA',0
 | 
			
		||||
  Capabilities: volume volume-joined
 | 
			
		||||
  Playback channels: Mono
 | 
			
		||||
  Capture channels: Mono
 | 
			
		||||
  Limits: 0 - 3
 | 
			
		||||
  Mono: 0 [0%]
 | 
			
		||||
Simple mixer control 'IEC958 Playback Source',0
 | 
			
		||||
  Capabilities: enum
 | 
			
		||||
  Items: 'PCM' 'Analog In' 'IEC958 In'
 | 
			
		||||
  Item0: 'PCM'
 | 
			
		||||
Simple mixer control 'PC Speaker',0
 | 
			
		||||
  Capabilities: pvolume pvolume-joined pswitch pswitch-joined
 | 
			
		||||
  Playback channels: Mono
 | 
			
		||||
  Limits: Playback 0 - 15
 | 
			
		||||
  Mono: Playback 0 [0%] [-45.00dB] [on]
 | 
			
		||||
Simple mixer control 'Aux',0
 | 
			
		||||
  Capabilities: pvolume pswitch pswitch-joined cswitch cswitch-exclusive
 | 
			
		||||
  Capture exclusive group: 0
 | 
			
		||||
  Playback channels: Front Left - Front Right
 | 
			
		||||
  Capture channels: Front Left - Front Right
 | 
			
		||||
  Limits: Playback 0 - 31
 | 
			
		||||
  Front Left: Playback 0 [0%] [-34.50dB] [on] Capture [off]
 | 
			
		||||
  Front Right: Playback 0 [0%] [-34.50dB] [on] Capture [off]
 | 
			
		||||
Simple mixer control 'Mono Output Select',0
 | 
			
		||||
  Capabilities: enum
 | 
			
		||||
  Items: 'Mix' 'Mic'
 | 
			
		||||
  Item0: 'Mix'
 | 
			
		||||
Simple mixer control 'Capture',0
 | 
			
		||||
  Capabilities: cvolume cswitch cswitch-joined
 | 
			
		||||
  Capture channels: Front Left - Front Right
 | 
			
		||||
  Limits: Capture 0 - 15
 | 
			
		||||
  Front Left: Capture 12 [80%] [18.00dB] [on]
 | 
			
		||||
  Front Right: Capture 12 [80%] [18.00dB] [on]
 | 
			
		||||
Simple mixer control 'Mix',0
 | 
			
		||||
  Capabilities: cswitch cswitch-exclusive
 | 
			
		||||
  Capture exclusive group: 0
 | 
			
		||||
  Capture channels: Front Left - Front Right
 | 
			
		||||
  Front Left: Capture [off]
 | 
			
		||||
  Front Right: Capture [off]
 | 
			
		||||
Simple mixer control 'Mix Mono',0
 | 
			
		||||
  Capabilities: cswitch cswitch-exclusive
 | 
			
		||||
  Capture exclusive group: 0
 | 
			
		||||
  Capture channels: Front Left - Front Right
 | 
			
		||||
  Front Left: Capture [off]
 | 
			
		||||
  Front Right: Capture [off]
 | 
			
		||||
Simple mixer control 'Channel Mode',0
 | 
			
		||||
  Capabilities: enum
 | 
			
		||||
  Items: '2ch' '4ch' '6ch'
 | 
			
		||||
  Item0: '2ch'
 | 
			
		||||
Simple mixer control 'Duplicate Front',0
 | 
			
		||||
  Capabilities: pswitch pswitch-joined
 | 
			
		||||
  Playback channels: Mono
 | 
			
		||||
  Mono: Playback [off]
 | 
			
		||||
Simple mixer control 'External Amplifier',0
 | 
			
		||||
  Capabilities: pswitch pswitch-joined
 | 
			
		||||
  Playback channels: Mono
 | 
			
		||||
  Mono: Playback [on]
 | 
			
		||||
							
								
								
									
										24
									
								
								src/modules/alsa/mixer/samples/Brooktree Bt878--Bt87x
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										24
									
								
								src/modules/alsa/mixer/samples/Brooktree Bt878--Bt87x
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,24 @@
 | 
			
		|||
Simple mixer control 'FM',0
 | 
			
		||||
  Capabilities: cswitch cswitch-joined cswitch-exclusive
 | 
			
		||||
  Capture exclusive group: 0
 | 
			
		||||
  Capture channels: Mono
 | 
			
		||||
  Mono: Capture [off]
 | 
			
		||||
Simple mixer control 'Mic/Line',0
 | 
			
		||||
  Capabilities: cswitch cswitch-joined cswitch-exclusive
 | 
			
		||||
  Capture exclusive group: 0
 | 
			
		||||
  Capture channels: Mono
 | 
			
		||||
  Mono: Capture [off]
 | 
			
		||||
Simple mixer control 'Capture',0
 | 
			
		||||
  Capabilities: cvolume cvolume-joined
 | 
			
		||||
  Capture channels: Mono
 | 
			
		||||
  Limits: Capture 0 - 15
 | 
			
		||||
  Mono: Capture 13 [87%]
 | 
			
		||||
Simple mixer control 'Capture Boost',0
 | 
			
		||||
  Capabilities: pswitch pswitch-joined
 | 
			
		||||
  Playback channels: Mono
 | 
			
		||||
  Mono: Playback [on]
 | 
			
		||||
Simple mixer control 'TV Tuner',0
 | 
			
		||||
  Capabilities: cswitch cswitch-joined cswitch-exclusive
 | 
			
		||||
  Capture exclusive group: 0
 | 
			
		||||
  Capture channels: Mono
 | 
			
		||||
  Mono: Capture [on]
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,135 @@
 | 
			
		|||
Simple mixer control 'Master',0
 | 
			
		||||
  Capabilities: pvolume pswitch pswitch-joined
 | 
			
		||||
  Playback channels: Front Left - Front Right
 | 
			
		||||
  Limits: Playback 0 - 63
 | 
			
		||||
  Mono:
 | 
			
		||||
  Front Left: Playback 63 [100%] [0.00dB] [on]
 | 
			
		||||
  Front Right: Playback 63 [100%] [0.00dB] [on]
 | 
			
		||||
Simple mixer control 'Master Mono',0
 | 
			
		||||
  Capabilities: pvolume pvolume-joined pswitch pswitch-joined
 | 
			
		||||
  Playback channels: Mono
 | 
			
		||||
  Limits: Playback 0 - 31
 | 
			
		||||
  Mono: Playback 0 [0%] [-46.50dB] [off]
 | 
			
		||||
Simple mixer control 'Headphone',0
 | 
			
		||||
  Capabilities: pvolume pswitch pswitch-joined
 | 
			
		||||
  Playback channels: Front Left - Front Right
 | 
			
		||||
  Limits: Playback 0 - 31
 | 
			
		||||
  Mono:
 | 
			
		||||
  Front Left: Playback 0 [0%] [-46.50dB] [off]
 | 
			
		||||
  Front Right: Playback 0 [0%] [-46.50dB] [off]
 | 
			
		||||
Simple mixer control '3D Control - Center',0
 | 
			
		||||
  Capabilities: volume volume-joined
 | 
			
		||||
  Playback channels: Mono
 | 
			
		||||
  Capture channels: Mono
 | 
			
		||||
  Limits: 0 - 15
 | 
			
		||||
  Mono: 0 [0%]
 | 
			
		||||
Simple mixer control '3D Control - Depth',0
 | 
			
		||||
  Capabilities: volume volume-joined
 | 
			
		||||
  Playback channels: Mono
 | 
			
		||||
  Capture channels: Mono
 | 
			
		||||
  Limits: 0 - 15
 | 
			
		||||
  Mono: 0 [0%]
 | 
			
		||||
Simple mixer control '3D Control - Switch',0
 | 
			
		||||
  Capabilities: pswitch pswitch-joined
 | 
			
		||||
  Playback channels: Mono
 | 
			
		||||
  Mono: Playback [off]
 | 
			
		||||
Simple mixer control 'PCM',0
 | 
			
		||||
  Capabilities: pvolume pswitch pswitch-joined
 | 
			
		||||
  Playback channels: Front Left - Front Right
 | 
			
		||||
  Limits: Playback 0 - 31
 | 
			
		||||
  Mono:
 | 
			
		||||
  Front Left: Playback 23 [74%] [0.00dB] [on]
 | 
			
		||||
  Front Right: Playback 23 [74%] [0.00dB] [on]
 | 
			
		||||
Simple mixer control 'Line',0
 | 
			
		||||
  Capabilities: pvolume pswitch pswitch-joined cswitch cswitch-exclusive
 | 
			
		||||
  Capture exclusive group: 0
 | 
			
		||||
  Playback channels: Front Left - Front Right
 | 
			
		||||
  Capture channels: Front Left - Front Right
 | 
			
		||||
  Limits: Playback 0 - 31
 | 
			
		||||
  Front Left: Playback 0 [0%] [-34.50dB] [off] Capture [on]
 | 
			
		||||
  Front Right: Playback 0 [0%] [-34.50dB] [off] Capture [on]
 | 
			
		||||
Simple mixer control 'CD',0
 | 
			
		||||
  Capabilities: pvolume pswitch pswitch-joined cswitch cswitch-exclusive
 | 
			
		||||
  Capture exclusive group: 0
 | 
			
		||||
  Playback channels: Front Left - Front Right
 | 
			
		||||
  Capture channels: Front Left - Front Right
 | 
			
		||||
  Limits: Playback 0 - 31
 | 
			
		||||
  Front Left: Playback 0 [0%] [-34.50dB] [off] Capture [off]
 | 
			
		||||
  Front Right: Playback 0 [0%] [-34.50dB] [off] Capture [off]
 | 
			
		||||
Simple mixer control 'Mic',0
 | 
			
		||||
  Capabilities: pvolume pvolume-joined pswitch pswitch-joined cswitch cswitch-exclusive
 | 
			
		||||
  Capture exclusive group: 0
 | 
			
		||||
  Playback channels: Mono
 | 
			
		||||
  Capture channels: Front Left - Front Right
 | 
			
		||||
  Limits: Playback 0 - 31
 | 
			
		||||
  Mono: Playback 23 [74%] [0.00dB] [on]
 | 
			
		||||
  Front Left: Capture [off]
 | 
			
		||||
  Front Right: Capture [off]
 | 
			
		||||
Simple mixer control 'Mic Boost (+20dB)',0
 | 
			
		||||
  Capabilities: pswitch pswitch-joined
 | 
			
		||||
  Playback channels: Mono
 | 
			
		||||
  Mono: Playback [off]
 | 
			
		||||
Simple mixer control 'Mic Select',0
 | 
			
		||||
  Capabilities: enum
 | 
			
		||||
  Items: 'Mic1' 'Mic2'
 | 
			
		||||
  Item0: 'Mic1'
 | 
			
		||||
Simple mixer control 'Video',0
 | 
			
		||||
  Capabilities: pvolume pswitch pswitch-joined cswitch cswitch-exclusive
 | 
			
		||||
  Capture exclusive group: 0
 | 
			
		||||
  Playback channels: Front Left - Front Right
 | 
			
		||||
  Capture channels: Front Left - Front Right
 | 
			
		||||
  Limits: Playback 0 - 31
 | 
			
		||||
  Front Left: Playback 0 [0%] [-34.50dB] [off] Capture [off]
 | 
			
		||||
  Front Right: Playback 0 [0%] [-34.50dB] [off] Capture [off]
 | 
			
		||||
Simple mixer control 'Phone',0
 | 
			
		||||
  Capabilities: pvolume pvolume-joined pswitch pswitch-joined cswitch cswitch-exclusive
 | 
			
		||||
  Capture exclusive group: 0
 | 
			
		||||
  Playback channels: Mono
 | 
			
		||||
  Capture channels: Front Left - Front Right
 | 
			
		||||
  Limits: Playback 0 - 31
 | 
			
		||||
  Mono: Playback 0 [0%] [-34.50dB] [off]
 | 
			
		||||
  Front Left: Capture [off]
 | 
			
		||||
  Front Right: Capture [off]
 | 
			
		||||
Simple mixer control 'IEC958',0
 | 
			
		||||
  Capabilities: pswitch pswitch-joined
 | 
			
		||||
  Playback channels: Mono
 | 
			
		||||
  Mono: Playback [off]
 | 
			
		||||
Simple mixer control 'PC Speaker',0
 | 
			
		||||
  Capabilities: pvolume pvolume-joined pswitch pswitch-joined
 | 
			
		||||
  Playback channels: Mono
 | 
			
		||||
  Limits: Playback 0 - 15
 | 
			
		||||
  Mono: Playback 0 [0%] [-45.00dB] [off]
 | 
			
		||||
Simple mixer control 'Aux',0
 | 
			
		||||
  Capabilities: pvolume pswitch pswitch-joined cswitch cswitch-exclusive
 | 
			
		||||
  Capture exclusive group: 0
 | 
			
		||||
  Playback channels: Front Left - Front Right
 | 
			
		||||
  Capture channels: Front Left - Front Right
 | 
			
		||||
  Limits: Playback 0 - 31
 | 
			
		||||
  Front Left: Playback 0 [0%] [-34.50dB] [off] Capture [off]
 | 
			
		||||
  Front Right: Playback 0 [0%] [-34.50dB] [off] Capture [off]
 | 
			
		||||
Simple mixer control 'Mono Output Select',0
 | 
			
		||||
  Capabilities: enum
 | 
			
		||||
  Items: 'Mix' 'Mic'
 | 
			
		||||
  Item0: 'Mic'
 | 
			
		||||
Simple mixer control 'Capture',0
 | 
			
		||||
  Capabilities: cvolume cswitch cswitch-joined
 | 
			
		||||
  Capture channels: Front Left - Front Right
 | 
			
		||||
  Limits: Capture 0 - 15
 | 
			
		||||
  Front Left: Capture 15 [100%] [22.50dB] [on]
 | 
			
		||||
  Front Right: Capture 15 [100%] [22.50dB] [on]
 | 
			
		||||
Simple mixer control 'Mix',0
 | 
			
		||||
  Capabilities: cswitch cswitch-exclusive
 | 
			
		||||
  Capture exclusive group: 0
 | 
			
		||||
  Capture channels: Front Left - Front Right
 | 
			
		||||
  Front Left: Capture [off]
 | 
			
		||||
  Front Right: Capture [off]
 | 
			
		||||
Simple mixer control 'Mix Mono',0
 | 
			
		||||
  Capabilities: cswitch cswitch-exclusive
 | 
			
		||||
  Capture exclusive group: 0
 | 
			
		||||
  Capture channels: Front Left - Front Right
 | 
			
		||||
  Front Left: Capture [off]
 | 
			
		||||
  Front Right: Capture [off]
 | 
			
		||||
Simple mixer control 'External Amplifier',0
 | 
			
		||||
  Capabilities: pswitch pswitch-joined
 | 
			
		||||
  Playback channels: Mono
 | 
			
		||||
  Mono: Playback [off]
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,4 @@
 | 
			
		|||
Simple mixer control 'IEC958',0
 | 
			
		||||
  Capabilities: pswitch pswitch-joined
 | 
			
		||||
  Playback channels: Mono
 | 
			
		||||
  Mono: Playback [on]
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,62 @@
 | 
			
		|||
Simple mixer control 'Master',0
 | 
			
		||||
  Capabilities: pvolume pswitch
 | 
			
		||||
  Playback channels: Front Left - Front Right
 | 
			
		||||
  Limits: Playback 0 - 63
 | 
			
		||||
  Mono:
 | 
			
		||||
  Front Left: Playback 63 [100%] [3.00dB] [on]
 | 
			
		||||
  Front Right: Playback 63 [100%] [3.00dB] [on]
 | 
			
		||||
Simple mixer control 'PCM',0
 | 
			
		||||
  Capabilities: pvolume pswitch
 | 
			
		||||
  Playback channels: Front Left - Front Right
 | 
			
		||||
  Limits: Playback 0 - 31
 | 
			
		||||
  Mono:
 | 
			
		||||
  Front Left: Playback 23 [74%] [0.00dB] [on]
 | 
			
		||||
  Front Right: Playback 23 [74%] [0.00dB] [on]
 | 
			
		||||
Simple mixer control 'CD',0
 | 
			
		||||
  Capabilities: pvolume pswitch cswitch cswitch-joined cswitch-exclusive
 | 
			
		||||
  Capture exclusive group: 0
 | 
			
		||||
  Playback channels: Front Left - Front Right
 | 
			
		||||
  Capture channels: Mono
 | 
			
		||||
  Limits: Playback 0 - 31
 | 
			
		||||
  Mono: Capture [off]
 | 
			
		||||
  Front Left: Playback 0 [0%] [-34.50dB] [off]
 | 
			
		||||
  Front Right: Playback 0 [0%] [-34.50dB] [off]
 | 
			
		||||
Simple mixer control 'Mic',0
 | 
			
		||||
  Capabilities: pvolume pswitch cswitch cswitch-joined cswitch-exclusive
 | 
			
		||||
  Capture exclusive group: 0
 | 
			
		||||
  Playback channels: Front Left - Front Right
 | 
			
		||||
  Capture channels: Mono
 | 
			
		||||
  Limits: Playback 0 - 31
 | 
			
		||||
  Mono: Capture [on]
 | 
			
		||||
  Front Left: Playback 0 [0%] [-34.50dB] [off]
 | 
			
		||||
  Front Right: Playback 0 [0%] [-34.50dB] [off]
 | 
			
		||||
Simple mixer control 'Mic Boost',0
 | 
			
		||||
  Capabilities: volume
 | 
			
		||||
  Playback channels: Front Left - Front Right
 | 
			
		||||
  Capture channels: Front Left - Front Right
 | 
			
		||||
  Limits: 0 - 3
 | 
			
		||||
  Front Left: 0 [0%]
 | 
			
		||||
  Front Right: 0 [0%]
 | 
			
		||||
Simple mixer control 'IEC958',0
 | 
			
		||||
  Capabilities: pswitch pswitch-joined
 | 
			
		||||
  Playback channels: Mono
 | 
			
		||||
  Mono: Playback [off]
 | 
			
		||||
Simple mixer control 'IEC958 Default PCM',0
 | 
			
		||||
  Capabilities: pswitch pswitch-joined
 | 
			
		||||
  Playback channels: Mono
 | 
			
		||||
  Mono: Playback [off]
 | 
			
		||||
Simple mixer control 'IEC958 Playback Source',0
 | 
			
		||||
  Capabilities: enum
 | 
			
		||||
  Items: 'PCM' 'ADC'
 | 
			
		||||
  Item0: 'PCM'
 | 
			
		||||
Simple mixer control 'Capture',0
 | 
			
		||||
  Capabilities: cvolume cswitch
 | 
			
		||||
  Capture channels: Front Left - Front Right
 | 
			
		||||
  Limits: Capture 0 - 15
 | 
			
		||||
  Front Left: Capture 0 [0%] [0.00dB] [on]
 | 
			
		||||
  Front Right: Capture 0 [0%] [0.00dB] [on]
 | 
			
		||||
Simple mixer control 'Mix',0
 | 
			
		||||
  Capabilities: cswitch cswitch-joined cswitch-exclusive
 | 
			
		||||
  Capture exclusive group: 0
 | 
			
		||||
  Capture channels: Mono
 | 
			
		||||
  Mono: Capture [off]
 | 
			
		||||
							
								
								
									
										113
									
								
								src/modules/alsa/mixer/samples/HDA Intel--Realtek ALC889A
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										113
									
								
								src/modules/alsa/mixer/samples/HDA Intel--Realtek ALC889A
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,113 @@
 | 
			
		|||
Simple mixer control 'Master',0
 | 
			
		||||
  Capabilities: pvolume pvolume-joined pswitch pswitch-joined
 | 
			
		||||
  Playback channels: Mono
 | 
			
		||||
  Limits: Playback 0 - 64
 | 
			
		||||
  Mono: Playback 64 [100%] [0.00dB] [on]
 | 
			
		||||
Simple mixer control 'Headphone',0
 | 
			
		||||
  Capabilities: pswitch
 | 
			
		||||
  Playback channels: Front Left - Front Right
 | 
			
		||||
  Mono:
 | 
			
		||||
  Front Left: Playback [on]
 | 
			
		||||
  Front Right: Playback [on]
 | 
			
		||||
Simple mixer control 'PCM',0
 | 
			
		||||
  Capabilities: pvolume
 | 
			
		||||
  Playback channels: Front Left - Front Right
 | 
			
		||||
  Limits: Playback 0 - 255
 | 
			
		||||
  Mono:
 | 
			
		||||
  Front Left: Playback 255 [100%] [0.00dB]
 | 
			
		||||
  Front Right: Playback 255 [100%] [0.00dB]
 | 
			
		||||
Simple mixer control 'Front',0
 | 
			
		||||
  Capabilities: pvolume pswitch
 | 
			
		||||
  Playback channels: Front Left - Front Right
 | 
			
		||||
  Limits: Playback 0 - 64
 | 
			
		||||
  Mono:
 | 
			
		||||
  Front Left: Playback 44 [69%] [-20.00dB] [on]
 | 
			
		||||
  Front Right: Playback 44 [69%] [-20.00dB] [on]
 | 
			
		||||
Simple mixer control 'Front Mic',0
 | 
			
		||||
  Capabilities: pvolume pswitch
 | 
			
		||||
  Playback channels: Front Left - Front Right
 | 
			
		||||
  Limits: Playback 0 - 31
 | 
			
		||||
  Mono:
 | 
			
		||||
  Front Left: Playback 0 [0%] [-34.50dB] [off]
 | 
			
		||||
  Front Right: Playback 0 [0%] [-34.50dB] [off]
 | 
			
		||||
Simple mixer control 'Front Mic Boost',0
 | 
			
		||||
  Capabilities: volume
 | 
			
		||||
  Playback channels: Front Left - Front Right
 | 
			
		||||
  Capture channels: Front Left - Front Right
 | 
			
		||||
  Limits: 0 - 3
 | 
			
		||||
  Front Left: 0 [0%]
 | 
			
		||||
  Front Right: 0 [0%]
 | 
			
		||||
Simple mixer control 'Surround',0
 | 
			
		||||
  Capabilities: pvolume pswitch
 | 
			
		||||
  Playback channels: Front Left - Front Right
 | 
			
		||||
  Limits: Playback 0 - 64
 | 
			
		||||
  Mono:
 | 
			
		||||
  Front Left: Playback 0 [0%] [-64.00dB] [on]
 | 
			
		||||
  Front Right: Playback 0 [0%] [-64.00dB] [on]
 | 
			
		||||
Simple mixer control 'Center',0
 | 
			
		||||
  Capabilities: pvolume pvolume-joined pswitch pswitch-joined
 | 
			
		||||
  Playback channels: Mono
 | 
			
		||||
  Limits: Playback 0 - 64
 | 
			
		||||
  Mono: Playback 0 [0%] [-64.00dB] [on]
 | 
			
		||||
Simple mixer control 'LFE',0
 | 
			
		||||
  Capabilities: pvolume pvolume-joined pswitch pswitch-joined
 | 
			
		||||
  Playback channels: Mono
 | 
			
		||||
  Limits: Playback 0 - 64
 | 
			
		||||
  Mono: Playback 0 [0%] [-64.00dB] [on]
 | 
			
		||||
Simple mixer control 'Side',0
 | 
			
		||||
  Capabilities: pvolume pswitch
 | 
			
		||||
  Playback channels: Front Left - Front Right
 | 
			
		||||
  Limits: Playback 0 - 64
 | 
			
		||||
  Mono:
 | 
			
		||||
  Front Left: Playback 0 [0%] [-64.00dB] [on]
 | 
			
		||||
  Front Right: Playback 0 [0%] [-64.00dB] [on]
 | 
			
		||||
Simple mixer control 'Line',0
 | 
			
		||||
  Capabilities: pvolume pswitch
 | 
			
		||||
  Playback channels: Front Left - Front Right
 | 
			
		||||
  Limits: Playback 0 - 31
 | 
			
		||||
  Mono:
 | 
			
		||||
  Front Left: Playback 0 [0%] [-34.50dB] [off]
 | 
			
		||||
  Front Right: Playback 0 [0%] [-34.50dB] [off]
 | 
			
		||||
Simple mixer control 'Mic',0
 | 
			
		||||
  Capabilities: pvolume pswitch
 | 
			
		||||
  Playback channels: Front Left - Front Right
 | 
			
		||||
  Limits: Playback 0 - 31
 | 
			
		||||
  Mono:
 | 
			
		||||
  Front Left: Playback 0 [0%] [-34.50dB] [off]
 | 
			
		||||
  Front Right: Playback 0 [0%] [-34.50dB] [off]
 | 
			
		||||
Simple mixer control 'Mic Boost',0
 | 
			
		||||
  Capabilities: volume
 | 
			
		||||
  Playback channels: Front Left - Front Right
 | 
			
		||||
  Capture channels: Front Left - Front Right
 | 
			
		||||
  Limits: 0 - 3
 | 
			
		||||
  Front Left: 0 [0%]
 | 
			
		||||
  Front Right: 0 [0%]
 | 
			
		||||
Simple mixer control 'IEC958',0
 | 
			
		||||
  Capabilities: pswitch pswitch-joined cswitch cswitch-joined
 | 
			
		||||
  Playback channels: Mono
 | 
			
		||||
  Capture channels: Mono
 | 
			
		||||
  Mono: Playback [on] Capture [on]
 | 
			
		||||
Simple mixer control 'IEC958 Default PCM',0
 | 
			
		||||
  Capabilities: pswitch pswitch-joined
 | 
			
		||||
  Playback channels: Mono
 | 
			
		||||
  Mono: Playback [on]
 | 
			
		||||
Simple mixer control 'Capture',0
 | 
			
		||||
  Capabilities: cvolume cswitch
 | 
			
		||||
  Capture channels: Front Left - Front Right
 | 
			
		||||
  Limits: Capture 0 - 46
 | 
			
		||||
  Front Left: Capture 23 [50%] [7.00dB] [on]
 | 
			
		||||
  Front Right: Capture 23 [50%] [7.00dB] [on]
 | 
			
		||||
Simple mixer control 'Capture',1
 | 
			
		||||
  Capabilities: cvolume cswitch
 | 
			
		||||
  Capture channels: Front Left - Front Right
 | 
			
		||||
  Limits: Capture 0 - 46
 | 
			
		||||
  Front Left: Capture 0 [0%] [-16.00dB] [off]
 | 
			
		||||
  Front Right: Capture 0 [0%] [-16.00dB] [off]
 | 
			
		||||
Simple mixer control 'Input Source',0
 | 
			
		||||
  Capabilities: cenum
 | 
			
		||||
  Items: 'Mic' 'Front Mic' 'Line'
 | 
			
		||||
  Item0: 'Mic'
 | 
			
		||||
Simple mixer control 'Input Source',1
 | 
			
		||||
  Capabilities: cenum
 | 
			
		||||
  Items: 'Mic' 'Front Mic' 'Line'
 | 
			
		||||
  Item0: 'Mic'
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,128 @@
 | 
			
		|||
Simple mixer control 'Master',0
 | 
			
		||||
  Capabilities: pvolume pswitch pswitch-joined
 | 
			
		||||
  Playback channels: Front Left - Front Right
 | 
			
		||||
  Limits: Playback 0 - 63
 | 
			
		||||
  Mono:
 | 
			
		||||
  Front Left: Playback 44 [70%] [-28.50dB] [on]
 | 
			
		||||
  Front Right: Playback 60 [95%] [-4.50dB] [on]
 | 
			
		||||
Simple mixer control 'Master Mono',0
 | 
			
		||||
  Capabilities: pvolume pvolume-joined pswitch pswitch-joined
 | 
			
		||||
  Playback channels: Mono
 | 
			
		||||
  Limits: Playback 0 - 31
 | 
			
		||||
  Mono: Playback 17 [55%] [-21.00dB] [on]
 | 
			
		||||
Simple mixer control '3D Control - Center',0
 | 
			
		||||
  Capabilities: volume volume-joined
 | 
			
		||||
  Playback channels: Mono
 | 
			
		||||
  Capture channels: Mono
 | 
			
		||||
  Limits: 0 - 15
 | 
			
		||||
  Mono: 0 [0%]
 | 
			
		||||
Simple mixer control '3D Control - Depth',0
 | 
			
		||||
  Capabilities: volume volume-joined
 | 
			
		||||
  Playback channels: Mono
 | 
			
		||||
  Capture channels: Mono
 | 
			
		||||
  Limits: 0 - 15
 | 
			
		||||
  Mono: 0 [0%]
 | 
			
		||||
Simple mixer control '3D Control - Switch',0
 | 
			
		||||
  Capabilities: pswitch pswitch-joined
 | 
			
		||||
  Playback channels: Mono
 | 
			
		||||
  Mono: Playback [off]
 | 
			
		||||
Simple mixer control 'PCM',0
 | 
			
		||||
  Capabilities: pvolume pswitch pswitch-joined
 | 
			
		||||
  Playback channels: Front Left - Front Right
 | 
			
		||||
  Limits: Playback 0 - 31
 | 
			
		||||
  Mono:
 | 
			
		||||
  Front Left: Playback 9 [29%] [-21.00dB] [on]
 | 
			
		||||
  Front Right: Playback 9 [29%] [-21.00dB] [on]
 | 
			
		||||
Simple mixer control 'PCM Out Path & Mute',0
 | 
			
		||||
  Capabilities: enum
 | 
			
		||||
  Items: 'pre 3D' 'post 3D'
 | 
			
		||||
  Item0: 'pre 3D'
 | 
			
		||||
Simple mixer control 'Line',0
 | 
			
		||||
  Capabilities: pvolume pswitch pswitch-joined cswitch cswitch-exclusive
 | 
			
		||||
  Capture exclusive group: 0
 | 
			
		||||
  Playback channels: Front Left - Front Right
 | 
			
		||||
  Capture channels: Front Left - Front Right
 | 
			
		||||
  Limits: Playback 0 - 31
 | 
			
		||||
  Front Left: Playback 0 [0%] [-34.50dB] [off] Capture [off]
 | 
			
		||||
  Front Right: Playback 0 [0%] [-34.50dB] [off] Capture [off]
 | 
			
		||||
Simple mixer control 'CD',0
 | 
			
		||||
  Capabilities: pvolume pswitch pswitch-joined cswitch cswitch-exclusive
 | 
			
		||||
  Capture exclusive group: 0
 | 
			
		||||
  Playback channels: Front Left - Front Right
 | 
			
		||||
  Capture channels: Front Left - Front Right
 | 
			
		||||
  Limits: Playback 0 - 31
 | 
			
		||||
  Front Left: Playback 9 [29%] [-21.00dB] [on] Capture [off]
 | 
			
		||||
  Front Right: Playback 9 [29%] [-21.00dB] [on] Capture [off]
 | 
			
		||||
Simple mixer control 'Mic',0
 | 
			
		||||
  Capabilities: pvolume pvolume-joined pswitch pswitch-joined cswitch cswitch-exclusive
 | 
			
		||||
  Capture exclusive group: 0
 | 
			
		||||
  Playback channels: Mono
 | 
			
		||||
  Capture channels: Front Left - Front Right
 | 
			
		||||
  Limits: Playback 0 - 31
 | 
			
		||||
  Mono: Playback 0 [0%] [-34.50dB] [off]
 | 
			
		||||
  Front Left: Capture [on]
 | 
			
		||||
  Front Right: Capture [on]
 | 
			
		||||
Simple mixer control 'Mic Boost (+20dB)',0
 | 
			
		||||
  Capabilities: pswitch pswitch-joined
 | 
			
		||||
  Playback channels: Mono
 | 
			
		||||
  Mono: Playback [off]
 | 
			
		||||
Simple mixer control 'Mic Select',0
 | 
			
		||||
  Capabilities: enum
 | 
			
		||||
  Items: 'Mic1' 'Mic2'
 | 
			
		||||
  Item0: 'Mic1'
 | 
			
		||||
Simple mixer control 'Video',0
 | 
			
		||||
  Capabilities: pvolume pswitch pswitch-joined cswitch cswitch-exclusive
 | 
			
		||||
  Capture exclusive group: 0
 | 
			
		||||
  Playback channels: Front Left - Front Right
 | 
			
		||||
  Capture channels: Front Left - Front Right
 | 
			
		||||
  Limits: Playback 0 - 31
 | 
			
		||||
  Front Left: Playback 0 [0%] [-34.50dB] [off] Capture [off]
 | 
			
		||||
  Front Right: Playback 0 [0%] [-34.50dB] [off] Capture [off]
 | 
			
		||||
Simple mixer control 'Phone',0
 | 
			
		||||
  Capabilities: pvolume pvolume-joined pswitch pswitch-joined cswitch cswitch-exclusive
 | 
			
		||||
  Capture exclusive group: 0
 | 
			
		||||
  Playback channels: Mono
 | 
			
		||||
  Capture channels: Front Left - Front Right
 | 
			
		||||
  Limits: Playback 0 - 31
 | 
			
		||||
  Mono: Playback 0 [0%] [-34.50dB] [off]
 | 
			
		||||
  Front Left: Capture [off]
 | 
			
		||||
  Front Right: Capture [off]
 | 
			
		||||
Simple mixer control 'PC Speaker',0
 | 
			
		||||
  Capabilities: pvolume pvolume-joined pswitch pswitch-joined
 | 
			
		||||
  Playback channels: Mono
 | 
			
		||||
  Limits: Playback 0 - 15
 | 
			
		||||
  Mono: Playback 8 [53%] [-21.00dB] [on]
 | 
			
		||||
Simple mixer control 'Aux',0
 | 
			
		||||
  Capabilities: pvolume pswitch pswitch-joined cswitch cswitch-exclusive
 | 
			
		||||
  Capture exclusive group: 0
 | 
			
		||||
  Playback channels: Front Left - Front Right
 | 
			
		||||
  Capture channels: Front Left - Front Right
 | 
			
		||||
  Limits: Playback 0 - 31
 | 
			
		||||
  Front Left: Playback 0 [0%] [-34.50dB] [off] Capture [off]
 | 
			
		||||
  Front Right: Playback 0 [0%] [-34.50dB] [off] Capture [off]
 | 
			
		||||
Simple mixer control 'Mono Output Select',0
 | 
			
		||||
  Capabilities: enum
 | 
			
		||||
  Items: 'Mix' 'Mic'
 | 
			
		||||
  Item0: 'Mix'
 | 
			
		||||
Simple mixer control 'Capture',0
 | 
			
		||||
  Capabilities: cvolume cswitch cswitch-joined
 | 
			
		||||
  Capture channels: Front Left - Front Right
 | 
			
		||||
  Limits: Capture 0 - 15
 | 
			
		||||
  Front Left: Capture 13 [87%] [19.50dB] [on]
 | 
			
		||||
  Front Right: Capture 13 [87%] [19.50dB] [on]
 | 
			
		||||
Simple mixer control 'Mix',0
 | 
			
		||||
  Capabilities: cswitch cswitch-exclusive
 | 
			
		||||
  Capture exclusive group: 0
 | 
			
		||||
  Capture channels: Front Left - Front Right
 | 
			
		||||
  Front Left: Capture [off]
 | 
			
		||||
  Front Right: Capture [off]
 | 
			
		||||
Simple mixer control 'Mix Mono',0
 | 
			
		||||
  Capabilities: cswitch cswitch-exclusive
 | 
			
		||||
  Capture exclusive group: 0
 | 
			
		||||
  Capture channels: Front Left - Front Right
 | 
			
		||||
  Front Left: Capture [off]
 | 
			
		||||
  Front Right: Capture [off]
 | 
			
		||||
Simple mixer control 'External Amplifier',0
 | 
			
		||||
  Capabilities: pswitch pswitch-joined
 | 
			
		||||
  Playback channels: Mono
 | 
			
		||||
  Mono: Playback [on]
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,27 @@
 | 
			
		|||
Simple mixer control 'Bass',0
 | 
			
		||||
  Capabilities: volume volume-joined
 | 
			
		||||
  Playback channels: Mono
 | 
			
		||||
  Capture channels: Mono
 | 
			
		||||
  Limits: 0 - 48
 | 
			
		||||
  Mono: 22 [46%]
 | 
			
		||||
Simple mixer control 'Bass Boost',0
 | 
			
		||||
  Capabilities: pswitch pswitch-joined
 | 
			
		||||
  Playback channels: Mono
 | 
			
		||||
  Mono: Playback [off]
 | 
			
		||||
Simple mixer control 'Treble',0
 | 
			
		||||
  Capabilities: volume volume-joined
 | 
			
		||||
  Playback channels: Mono
 | 
			
		||||
  Capture channels: Mono
 | 
			
		||||
  Limits: 0 - 48
 | 
			
		||||
  Mono: 25 [52%]
 | 
			
		||||
Simple mixer control 'PCM',0
 | 
			
		||||
  Capabilities: pvolume pswitch pswitch-joined
 | 
			
		||||
  Playback channels: Front Left - Front Right
 | 
			
		||||
  Limits: Playback 0 - 44
 | 
			
		||||
  Mono:
 | 
			
		||||
  Front Left: Playback 10 [23%] [-31.00dB] [on]
 | 
			
		||||
  Front Right: Playback 10 [23%] [-31.00dB] [on]
 | 
			
		||||
Simple mixer control 'Auto Gain Control',0
 | 
			
		||||
  Capabilities: pswitch pswitch-joined
 | 
			
		||||
  Playback channels: Mono
 | 
			
		||||
  Mono: Playback [off]
 | 
			
		||||
							
								
								
									
										37
									
								
								src/modules/alsa/mixer/samples/USB Audio--USB Mixer
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								src/modules/alsa/mixer/samples/USB Audio--USB Mixer
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,37 @@
 | 
			
		|||
Simple mixer control 'Master',0
 | 
			
		||||
  Capabilities: pvolume pvolume-joined pswitch pswitch-joined
 | 
			
		||||
  Playback channels: Mono
 | 
			
		||||
  Limits: Playback 0 - 255
 | 
			
		||||
  Mono: Playback 105 [41%] [-28.97dB] [on]
 | 
			
		||||
Simple mixer control 'Line',0
 | 
			
		||||
  Capabilities: pvolume cvolume pswitch pswitch-joined cswitch cswitch-joined
 | 
			
		||||
  Playback channels: Front Left - Front Right
 | 
			
		||||
  Capture channels: Front Left - Front Right
 | 
			
		||||
  Limits: Playback 0 - 255 Capture 0 - 128
 | 
			
		||||
  Front Left: Playback 191 [75%] [34.38dB] [off] Capture 0 [0%] [0.18dB] [off]
 | 
			
		||||
  Front Right: Playback 191 [75%] [34.38dB] [off] Capture 0 [0%] [0.18dB] [off]
 | 
			
		||||
Simple mixer control 'Mic',0
 | 
			
		||||
  Capabilities: pvolume pvolume-joined cvolume cvolume-joined pswitch pswitch-joined cswitch cswitch-joined cswitch-exclusive
 | 
			
		||||
  Capture exclusive group: 0
 | 
			
		||||
  Playback channels: Mono
 | 
			
		||||
  Capture channels: Mono
 | 
			
		||||
  Limits: Playback 0 - 255 Capture 0 - 128
 | 
			
		||||
  Mono: Playback 191 [75%] [34.38dB] [off] Capture 0 [0%] [0.18dB] [on]
 | 
			
		||||
Simple mixer control 'Mic Capture',0
 | 
			
		||||
  Capabilities: pswitch pswitch-joined
 | 
			
		||||
  Playback channels: Mono
 | 
			
		||||
  Mono: Playback [off]
 | 
			
		||||
Simple mixer control 'IEC958 In',0
 | 
			
		||||
  Capabilities: cswitch cswitch-joined
 | 
			
		||||
  Capture channels: Mono
 | 
			
		||||
  Mono: Capture [off]
 | 
			
		||||
Simple mixer control 'Input 1',0
 | 
			
		||||
  Capabilities: cswitch cswitch-joined cswitch-exclusive
 | 
			
		||||
  Capture exclusive group: 0
 | 
			
		||||
  Capture channels: Mono
 | 
			
		||||
  Mono: Capture [off]
 | 
			
		||||
Simple mixer control 'Input 2',0
 | 
			
		||||
  Capabilities: cswitch cswitch-joined cswitch-exclusive
 | 
			
		||||
  Capture exclusive group: 0
 | 
			
		||||
  Capture channels: Mono
 | 
			
		||||
  Mono: Capture [off]
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,5 @@
 | 
			
		|||
Simple mixer control 'Mic',0
 | 
			
		||||
  Capabilities: cvolume cvolume-joined cswitch cswitch-joined
 | 
			
		||||
  Capture channels: Mono
 | 
			
		||||
  Limits: Capture 0 - 3072
 | 
			
		||||
  Mono: Capture 1536 [50%] [23.00dB] [on]
 | 
			
		||||
							
								
								
									
										211
									
								
								src/modules/alsa/mixer/samples/VIA 8237--Analog Devices AD1888
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										211
									
								
								src/modules/alsa/mixer/samples/VIA 8237--Analog Devices AD1888
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,211 @@
 | 
			
		|||
Simple mixer control 'Master',0
 | 
			
		||||
  Capabilities: pvolume pswitch
 | 
			
		||||
  Playback channels: Front Left - Front Right
 | 
			
		||||
  Limits: Playback 0 - 31
 | 
			
		||||
  Mono:
 | 
			
		||||
  Front Left: Playback 31 [100%] [0.00dB] [on]
 | 
			
		||||
  Front Right: Playback 31 [100%] [0.00dB] [on]
 | 
			
		||||
Simple mixer control 'Master Mono',0
 | 
			
		||||
  Capabilities: pvolume pvolume-joined pswitch pswitch-joined
 | 
			
		||||
  Playback channels: Mono
 | 
			
		||||
  Limits: Playback 0 - 31
 | 
			
		||||
  Mono: Playback 0 [0%] [-46.50dB] [off]
 | 
			
		||||
Simple mixer control 'Master Surround',0
 | 
			
		||||
  Capabilities: pvolume pswitch
 | 
			
		||||
  Playback channels: Front Left - Front Right
 | 
			
		||||
  Limits: Playback 0 - 31
 | 
			
		||||
  Mono:
 | 
			
		||||
  Front Left: Playback 0 [0%] [-46.50dB] [off]
 | 
			
		||||
  Front Right: Playback 0 [0%] [-46.50dB] [off]
 | 
			
		||||
Simple mixer control 'Headphone Jack Sense',0
 | 
			
		||||
  Capabilities: pswitch pswitch-joined
 | 
			
		||||
  Playback channels: Mono
 | 
			
		||||
  Mono: Playback [off]
 | 
			
		||||
Simple mixer control 'PCM',0
 | 
			
		||||
  Capabilities: pvolume pswitch
 | 
			
		||||
  Playback channels: Front Left - Front Right
 | 
			
		||||
  Limits: Playback 0 - 31
 | 
			
		||||
  Mono:
 | 
			
		||||
  Front Left: Playback 23 [74%] [0.00dB] [on]
 | 
			
		||||
  Front Right: Playback 23 [74%] [0.00dB] [on]
 | 
			
		||||
Simple mixer control 'Surround',0
 | 
			
		||||
  Capabilities: pvolume pswitch
 | 
			
		||||
  Playback channels: Front Left - Front Right
 | 
			
		||||
  Limits: Playback 0 - 31
 | 
			
		||||
  Mono:
 | 
			
		||||
  Front Left: Playback 0 [0%] [-46.50dB] [off]
 | 
			
		||||
  Front Right: Playback 0 [0%] [-46.50dB] [off]
 | 
			
		||||
Simple mixer control 'Surround Jack Mode',0
 | 
			
		||||
  Capabilities: enum
 | 
			
		||||
  Items: 'Shared' 'Independent'
 | 
			
		||||
  Item0: 'Shared'
 | 
			
		||||
Simple mixer control 'Center',0
 | 
			
		||||
  Capabilities: pvolume pvolume-joined pswitch pswitch-joined
 | 
			
		||||
  Playback channels: Mono
 | 
			
		||||
  Limits: Playback 0 - 31
 | 
			
		||||
  Mono: Playback 31 [100%] [0.00dB] [off]
 | 
			
		||||
Simple mixer control 'LFE',0
 | 
			
		||||
  Capabilities: pvolume pvolume-joined pswitch pswitch-joined
 | 
			
		||||
  Playback channels: Mono
 | 
			
		||||
  Limits: Playback 0 - 31
 | 
			
		||||
  Mono: Playback 0 [0%] [-46.50dB] [off]
 | 
			
		||||
Simple mixer control 'Line',0
 | 
			
		||||
  Capabilities: pvolume pswitch cswitch cswitch-exclusive
 | 
			
		||||
  Capture exclusive group: 0
 | 
			
		||||
  Playback channels: Front Left - Front Right
 | 
			
		||||
  Capture channels: Front Left - Front Right
 | 
			
		||||
  Limits: Playback 0 - 31
 | 
			
		||||
  Front Left: Playback 0 [0%] [-34.50dB] [off] Capture [off]
 | 
			
		||||
  Front Right: Playback 0 [0%] [-34.50dB] [off] Capture [off]
 | 
			
		||||
Simple mixer control 'Line Jack Sense',0
 | 
			
		||||
  Capabilities: pswitch pswitch-joined
 | 
			
		||||
  Playback channels: Mono
 | 
			
		||||
  Mono: Playback [off]
 | 
			
		||||
Simple mixer control 'CD',0
 | 
			
		||||
  Capabilities: pvolume pswitch cswitch cswitch-exclusive
 | 
			
		||||
  Capture exclusive group: 0
 | 
			
		||||
  Playback channels: Front Left - Front Right
 | 
			
		||||
  Capture channels: Front Left - Front Right
 | 
			
		||||
  Limits: Playback 0 - 31
 | 
			
		||||
  Front Left: Playback 0 [0%] [-34.50dB] [off] Capture [off]
 | 
			
		||||
  Front Right: Playback 0 [0%] [-34.50dB] [off] Capture [off]
 | 
			
		||||
Simple mixer control 'Mic',0
 | 
			
		||||
  Capabilities: pvolume pvolume-joined pswitch pswitch-joined cswitch cswitch-exclusive
 | 
			
		||||
  Capture exclusive group: 0
 | 
			
		||||
  Playback channels: Mono
 | 
			
		||||
  Capture channels: Front Left - Front Right
 | 
			
		||||
  Limits: Playback 0 - 31
 | 
			
		||||
  Mono: Playback 0 [0%] [-34.50dB] [off]
 | 
			
		||||
  Front Left: Capture [on]
 | 
			
		||||
  Front Right: Capture [on]
 | 
			
		||||
Simple mixer control 'Mic Boost (+20dB)',0
 | 
			
		||||
  Capabilities: pswitch pswitch-joined
 | 
			
		||||
  Playback channels: Mono
 | 
			
		||||
  Mono: Playback [off]
 | 
			
		||||
Simple mixer control 'Mic Select',0
 | 
			
		||||
  Capabilities: enum
 | 
			
		||||
  Items: 'Mic1' 'Mic2'
 | 
			
		||||
  Item0: 'Mic1'
 | 
			
		||||
Simple mixer control 'Video',0
 | 
			
		||||
  Capabilities: cswitch cswitch-exclusive
 | 
			
		||||
  Capture exclusive group: 0
 | 
			
		||||
  Capture channels: Front Left - Front Right
 | 
			
		||||
  Front Left: Capture [off]
 | 
			
		||||
  Front Right: Capture [off]
 | 
			
		||||
Simple mixer control 'Phone',0
 | 
			
		||||
  Capabilities: pvolume pvolume-joined pswitch pswitch-joined cswitch cswitch-exclusive
 | 
			
		||||
  Capture exclusive group: 0
 | 
			
		||||
  Playback channels: Mono
 | 
			
		||||
  Capture channels: Front Left - Front Right
 | 
			
		||||
  Limits: Playback 0 - 31
 | 
			
		||||
  Mono: Playback 0 [0%] [-34.50dB] [off]
 | 
			
		||||
  Front Left: Capture [off]
 | 
			
		||||
  Front Right: Capture [off]
 | 
			
		||||
Simple mixer control 'IEC958',0
 | 
			
		||||
  Capabilities: pswitch pswitch-joined
 | 
			
		||||
  Playback channels: Mono
 | 
			
		||||
  Mono: Playback [off]
 | 
			
		||||
Simple mixer control 'IEC958 Output',0
 | 
			
		||||
  Capabilities: pswitch pswitch-joined
 | 
			
		||||
  Playback channels: Mono
 | 
			
		||||
  Mono: Playback [off]
 | 
			
		||||
Simple mixer control 'IEC958 Playback AC97-SPSA',0
 | 
			
		||||
  Capabilities: volume volume-joined
 | 
			
		||||
  Playback channels: Mono
 | 
			
		||||
  Capture channels: Mono
 | 
			
		||||
  Limits: 0 - 3
 | 
			
		||||
  Mono: 3 [100%]
 | 
			
		||||
Simple mixer control 'IEC958 Playback Source',0
 | 
			
		||||
  Capabilities: enum
 | 
			
		||||
  Items: 'AC-Link' 'A/D Converter'
 | 
			
		||||
  Item0: 'AC-Link'
 | 
			
		||||
Simple mixer control 'Aux',0
 | 
			
		||||
  Capabilities: pvolume pswitch cswitch cswitch-exclusive
 | 
			
		||||
  Capture exclusive group: 0
 | 
			
		||||
  Playback channels: Front Left - Front Right
 | 
			
		||||
  Capture channels: Front Left - Front Right
 | 
			
		||||
  Limits: Playback 0 - 31
 | 
			
		||||
  Front Left: Playback 0 [0%] [-34.50dB] [off] Capture [off]
 | 
			
		||||
  Front Right: Playback 0 [0%] [-34.50dB] [off] Capture [off]
 | 
			
		||||
Simple mixer control 'Capture',0
 | 
			
		||||
  Capabilities: cvolume cswitch
 | 
			
		||||
  Capture channels: Front Left - Front Right
 | 
			
		||||
  Limits: Capture 0 - 15
 | 
			
		||||
  Front Left: Capture 0 [0%] [0.00dB] [on]
 | 
			
		||||
  Front Right: Capture 0 [0%] [0.00dB] [on]
 | 
			
		||||
Simple mixer control 'Mix',0
 | 
			
		||||
  Capabilities: cswitch cswitch-exclusive
 | 
			
		||||
  Capture exclusive group: 0
 | 
			
		||||
  Capture channels: Front Left - Front Right
 | 
			
		||||
  Front Left: Capture [off]
 | 
			
		||||
  Front Right: Capture [off]
 | 
			
		||||
Simple mixer control 'Mix Mono',0
 | 
			
		||||
  Capabilities: cswitch cswitch-exclusive
 | 
			
		||||
  Capture exclusive group: 0
 | 
			
		||||
  Capture channels: Front Left - Front Right
 | 
			
		||||
  Front Left: Capture [off]
 | 
			
		||||
  Front Right: Capture [off]
 | 
			
		||||
Simple mixer control 'Channel Mode',0
 | 
			
		||||
  Capabilities: enum
 | 
			
		||||
  Items: '2ch' '4ch' '6ch'
 | 
			
		||||
  Item0: '2ch'
 | 
			
		||||
Simple mixer control 'Downmix',0
 | 
			
		||||
  Capabilities: enum
 | 
			
		||||
  Items: 'Off' '6 -> 4' '6 -> 2'
 | 
			
		||||
  Item0: 'Off'
 | 
			
		||||
Simple mixer control 'Exchange Front/Surround',0
 | 
			
		||||
  Capabilities: pswitch pswitch-joined
 | 
			
		||||
  Playback channels: Mono
 | 
			
		||||
  Mono: Playback [off]
 | 
			
		||||
Simple mixer control 'External Amplifier',0
 | 
			
		||||
  Capabilities: pswitch pswitch-joined
 | 
			
		||||
  Playback channels: Mono
 | 
			
		||||
  Mono: Playback [on]
 | 
			
		||||
Simple mixer control 'High Pass Filter Enable',0
 | 
			
		||||
  Capabilities: pswitch pswitch-joined
 | 
			
		||||
  Playback channels: Mono
 | 
			
		||||
  Mono: Playback [off]
 | 
			
		||||
Simple mixer control 'Input Source Select',0
 | 
			
		||||
  Capabilities: enum
 | 
			
		||||
  Items: 'Input1' 'Input2'
 | 
			
		||||
  Item0: 'Input1'
 | 
			
		||||
Simple mixer control 'Input Source Select',1
 | 
			
		||||
  Capabilities: enum
 | 
			
		||||
  Items: 'Input1' 'Input2'
 | 
			
		||||
  Item0: 'Input1'
 | 
			
		||||
Simple mixer control 'Spread Front to Surround and Center/LFE',0
 | 
			
		||||
  Capabilities: pswitch pswitch-joined
 | 
			
		||||
  Playback channels: Mono
 | 
			
		||||
  Mono: Playback [off]
 | 
			
		||||
Simple mixer control 'VIA DXS',0
 | 
			
		||||
  Capabilities: pvolume
 | 
			
		||||
  Playback channels: Front Left - Front Right
 | 
			
		||||
  Limits: Playback 0 - 31
 | 
			
		||||
  Mono:
 | 
			
		||||
  Front Left: Playback 31 [100%] [-48.00dB]
 | 
			
		||||
  Front Right: Playback 31 [100%] [-48.00dB]
 | 
			
		||||
Simple mixer control 'VIA DXS',1
 | 
			
		||||
  Capabilities: pvolume
 | 
			
		||||
  Playback channels: Front Left - Front Right
 | 
			
		||||
  Limits: Playback 0 - 31
 | 
			
		||||
  Mono:
 | 
			
		||||
  Front Left: Playback 31 [100%] [-48.00dB]
 | 
			
		||||
  Front Right: Playback 31 [100%] [-48.00dB]
 | 
			
		||||
Simple mixer control 'VIA DXS',2
 | 
			
		||||
  Capabilities: pvolume
 | 
			
		||||
  Playback channels: Front Left - Front Right
 | 
			
		||||
  Limits: Playback 0 - 31
 | 
			
		||||
  Mono:
 | 
			
		||||
  Front Left: Playback 31 [100%] [-48.00dB]
 | 
			
		||||
  Front Right: Playback 31 [100%] [-48.00dB]
 | 
			
		||||
Simple mixer control 'VIA DXS',3
 | 
			
		||||
  Capabilities: pvolume
 | 
			
		||||
  Playback channels: Front Left - Front Right
 | 
			
		||||
  Limits: Playback 0 - 31
 | 
			
		||||
  Mono:
 | 
			
		||||
  Front Left: Playback 31 [100%] [-48.00dB]
 | 
			
		||||
  Front Right: Playback 31 [100%] [-48.00dB]
 | 
			
		||||
Simple mixer control 'V_REFOUT Enable',0
 | 
			
		||||
  Capabilities: pswitch pswitch-joined
 | 
			
		||||
  Playback channels: Mono
 | 
			
		||||
  Mono: Playback [on]
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,160 @@
 | 
			
		|||
Simple mixer control 'Master',0
 | 
			
		||||
  Capabilities: pvolume pswitch pswitch-joined
 | 
			
		||||
  Playback channels: Front Left - Front Right
 | 
			
		||||
  Limits: Playback 0 - 31
 | 
			
		||||
  Mono:
 | 
			
		||||
  Front Left: Playback 0 [0%] [-46.50dB] [off]
 | 
			
		||||
  Front Right: Playback 0 [0%] [-46.50dB] [off]
 | 
			
		||||
Simple mixer control 'PCM',0
 | 
			
		||||
  Capabilities: pvolume pswitch pswitch-joined
 | 
			
		||||
  Playback channels: Front Left - Front Right
 | 
			
		||||
  Limits: Playback 0 - 31
 | 
			
		||||
  Mono:
 | 
			
		||||
  Front Left: Playback 31 [100%] [-48.00dB] [off]
 | 
			
		||||
  Front Right: Playback 31 [100%] [-48.00dB] [off]
 | 
			
		||||
Simple mixer control 'Surround',0
 | 
			
		||||
  Capabilities: pswitch
 | 
			
		||||
  Playback channels: Front Left - Front Right
 | 
			
		||||
  Mono:
 | 
			
		||||
  Front Left: Playback [off]
 | 
			
		||||
  Front Right: Playback [off]
 | 
			
		||||
Simple mixer control 'Surround Jack Mode',0
 | 
			
		||||
  Capabilities: enum
 | 
			
		||||
  Items: 'Shared' 'Independent'
 | 
			
		||||
  Item0: 'Shared'
 | 
			
		||||
Simple mixer control 'Center',0
 | 
			
		||||
  Capabilities: pvolume pvolume-joined pswitch pswitch-joined
 | 
			
		||||
  Playback channels: Mono
 | 
			
		||||
  Limits: Playback 0 - 31
 | 
			
		||||
  Mono: Playback 31 [100%] [0.00dB] [off]
 | 
			
		||||
Simple mixer control 'LFE',0
 | 
			
		||||
  Capabilities: pvolume pvolume-joined pswitch pswitch-joined
 | 
			
		||||
  Playback channels: Mono
 | 
			
		||||
  Limits: Playback 0 - 31
 | 
			
		||||
  Mono: Playback 0 [0%] [-46.50dB] [off]
 | 
			
		||||
Simple mixer control 'Line',0
 | 
			
		||||
  Capabilities: pvolume pswitch pswitch-joined cswitch cswitch-exclusive
 | 
			
		||||
  Capture exclusive group: 0
 | 
			
		||||
  Playback channels: Front Left - Front Right
 | 
			
		||||
  Capture channels: Front Left - Front Right
 | 
			
		||||
  Limits: Playback 0 - 31
 | 
			
		||||
  Front Left: Playback 0 [0%] [-34.50dB] [off] Capture [off]
 | 
			
		||||
  Front Right: Playback 0 [0%] [-34.50dB] [off] Capture [off]
 | 
			
		||||
Simple mixer control 'CD',0
 | 
			
		||||
  Capabilities: pvolume pswitch pswitch-joined cswitch cswitch-exclusive
 | 
			
		||||
  Capture exclusive group: 0
 | 
			
		||||
  Playback channels: Front Left - Front Right
 | 
			
		||||
  Capture channels: Front Left - Front Right
 | 
			
		||||
  Limits: Playback 0 - 31
 | 
			
		||||
  Front Left: Playback 0 [0%] [-34.50dB] [off] Capture [off]
 | 
			
		||||
  Front Right: Playback 0 [0%] [-34.50dB] [off] Capture [off]
 | 
			
		||||
Simple mixer control 'Mic',0
 | 
			
		||||
  Capabilities: pvolume pswitch pswitch-joined cswitch cswitch-exclusive
 | 
			
		||||
  Capture exclusive group: 0
 | 
			
		||||
  Playback channels: Front Left - Front Right
 | 
			
		||||
  Capture channels: Front Left - Front Right
 | 
			
		||||
  Limits: Playback 0 - 31
 | 
			
		||||
  Front Left: Playback 0 [0%] [-34.50dB] [off] Capture [on]
 | 
			
		||||
  Front Right: Playback 0 [0%] [-34.50dB] [off] Capture [on]
 | 
			
		||||
Simple mixer control 'Mic Boost (+20dB)',0
 | 
			
		||||
  Capabilities: pswitch pswitch-joined
 | 
			
		||||
  Playback channels: Mono
 | 
			
		||||
  Mono: Playback [off]
 | 
			
		||||
Simple mixer control 'Mic Select',0
 | 
			
		||||
  Capabilities: enum
 | 
			
		||||
  Items: 'Mic1' 'Mic2'
 | 
			
		||||
  Item0: 'Mic1'
 | 
			
		||||
Simple mixer control 'Video',0
 | 
			
		||||
  Capabilities: cswitch cswitch-exclusive
 | 
			
		||||
  Capture exclusive group: 0
 | 
			
		||||
  Capture channels: Front Left - Front Right
 | 
			
		||||
  Front Left: Capture [off]
 | 
			
		||||
  Front Right: Capture [off]
 | 
			
		||||
Simple mixer control 'Phone',0
 | 
			
		||||
  Capabilities: cswitch cswitch-exclusive
 | 
			
		||||
  Capture exclusive group: 0
 | 
			
		||||
  Capture channels: Front Left - Front Right
 | 
			
		||||
  Front Left: Capture [off]
 | 
			
		||||
  Front Right: Capture [off]
 | 
			
		||||
Simple mixer control 'IEC958',0
 | 
			
		||||
  Capabilities: pswitch pswitch-joined cswitch cswitch-joined
 | 
			
		||||
  Playback channels: Mono
 | 
			
		||||
  Capture channels: Mono
 | 
			
		||||
  Mono: Playback [off] Capture [off]
 | 
			
		||||
Simple mixer control 'IEC958 Capture Monitor',0
 | 
			
		||||
  Capabilities: pswitch pswitch-joined
 | 
			
		||||
  Playback channels: Mono
 | 
			
		||||
  Mono: Playback [off]
 | 
			
		||||
Simple mixer control 'IEC958 Capture Valid',0
 | 
			
		||||
  Capabilities: pswitch pswitch-joined
 | 
			
		||||
  Playback channels: Mono
 | 
			
		||||
  Mono: Playback [off]
 | 
			
		||||
Simple mixer control 'IEC958 Output',0
 | 
			
		||||
  Capabilities: pswitch pswitch-joined
 | 
			
		||||
  Playback channels: Mono
 | 
			
		||||
  Mono: Playback [off]
 | 
			
		||||
Simple mixer control 'IEC958 Playback AC97-SPSA',0
 | 
			
		||||
  Capabilities: volume volume-joined
 | 
			
		||||
  Playback channels: Mono
 | 
			
		||||
  Capture channels: Mono
 | 
			
		||||
  Limits: 0 - 3
 | 
			
		||||
  Mono: 3 [100%]
 | 
			
		||||
Simple mixer control 'IEC958 Playback Source',0
 | 
			
		||||
  Capabilities: enum
 | 
			
		||||
  Items: 'AC-Link' 'ADC' 'SPDIF-In'
 | 
			
		||||
  Item0: 'AC-Link'
 | 
			
		||||
Simple mixer control 'PC Speaker',0
 | 
			
		||||
  Capabilities: pvolume pvolume-joined pswitch pswitch-joined
 | 
			
		||||
  Playback channels: Mono
 | 
			
		||||
  Limits: Playback 0 - 15
 | 
			
		||||
  Mono: Playback 0 [0%] [-45.00dB] [off]
 | 
			
		||||
Simple mixer control 'Aux',0
 | 
			
		||||
  Capabilities: pvolume pswitch pswitch-joined cswitch cswitch-exclusive
 | 
			
		||||
  Capture exclusive group: 0
 | 
			
		||||
  Playback channels: Front Left - Front Right
 | 
			
		||||
  Capture channels: Front Left - Front Right
 | 
			
		||||
  Limits: Playback 0 - 31
 | 
			
		||||
  Front Left: Playback 0 [0%] [-34.50dB] [off] Capture [off]
 | 
			
		||||
  Front Right: Playback 0 [0%] [-34.50dB] [off] Capture [off]
 | 
			
		||||
Simple mixer control 'Mono Output Select',0
 | 
			
		||||
  Capabilities: enum
 | 
			
		||||
  Items: 'Mix' 'Mic'
 | 
			
		||||
  Item0: 'Mix'
 | 
			
		||||
Simple mixer control 'Capture',0
 | 
			
		||||
  Capabilities: cvolume cswitch cswitch-joined
 | 
			
		||||
  Capture channels: Front Left - Front Right
 | 
			
		||||
  Limits: Capture 0 - 15
 | 
			
		||||
  Front Left: Capture 0 [0%] [0.00dB] [on]
 | 
			
		||||
  Front Right: Capture 0 [0%] [0.00dB] [on]
 | 
			
		||||
Simple mixer control 'Mix',0
 | 
			
		||||
  Capabilities: cswitch cswitch-exclusive
 | 
			
		||||
  Capture exclusive group: 0
 | 
			
		||||
  Capture channels: Front Left - Front Right
 | 
			
		||||
  Front Left: Capture [off]
 | 
			
		||||
  Front Right: Capture [off]
 | 
			
		||||
Simple mixer control 'Mix Mono',0
 | 
			
		||||
  Capabilities: cswitch cswitch-exclusive
 | 
			
		||||
  Capture exclusive group: 0
 | 
			
		||||
  Capture channels: Front Left - Front Right
 | 
			
		||||
  Front Left: Capture [off]
 | 
			
		||||
  Front Right: Capture [off]
 | 
			
		||||
Simple mixer control 'Channel Mode',0
 | 
			
		||||
  Capabilities: enum
 | 
			
		||||
  Items: '2ch' '4ch' '6ch'
 | 
			
		||||
  Item0: '2ch'
 | 
			
		||||
Simple mixer control 'DAC Clock Source',0
 | 
			
		||||
  Capabilities: enum
 | 
			
		||||
  Items: 'AC-Link' 'SPDIF-In' 'Both'
 | 
			
		||||
  Item0: 'AC-Link'
 | 
			
		||||
Simple mixer control 'External Amplifier',0
 | 
			
		||||
  Capabilities: pswitch pswitch-joined
 | 
			
		||||
  Playback channels: Mono
 | 
			
		||||
  Mono: Playback [on]
 | 
			
		||||
Simple mixer control 'Input Source Select',0
 | 
			
		||||
  Capabilities: enum
 | 
			
		||||
  Items: 'Input1' 'Input2'
 | 
			
		||||
  Item0: 'Input1'
 | 
			
		||||
Simple mixer control 'Input Source Select',1
 | 
			
		||||
  Capabilities: enum
 | 
			
		||||
  Items: 'Input1' 'Input2'
 | 
			
		||||
  Item0: 'Input1'
 | 
			
		||||
| 
						 | 
				
			
			@ -32,6 +32,10 @@
 | 
			
		|||
 | 
			
		||||
#include <modules/reserve-wrap.h>
 | 
			
		||||
 | 
			
		||||
#ifdef HAVE_UDEV
 | 
			
		||||
#include <modules/udev-util.h>
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#include "alsa-util.h"
 | 
			
		||||
#include "alsa-sink.h"
 | 
			
		||||
#include "alsa-source.h"
 | 
			
		||||
| 
						 | 
				
			
			@ -92,81 +96,53 @@ struct userdata {
 | 
			
		|||
    char *device_id;
 | 
			
		||||
 | 
			
		||||
    pa_card *card;
 | 
			
		||||
    pa_sink *sink;
 | 
			
		||||
    pa_source *source;
 | 
			
		||||
 | 
			
		||||
    pa_modargs *modargs;
 | 
			
		||||
 | 
			
		||||
    pa_hashmap *profiles;
 | 
			
		||||
    pa_alsa_profile_set *profile_set;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
struct profile_data {
 | 
			
		||||
    const pa_alsa_profile_info *sink_profile, *source_profile;
 | 
			
		||||
    pa_alsa_profile *profile;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static void enumerate_cb(
 | 
			
		||||
        const pa_alsa_profile_info *sink,
 | 
			
		||||
        const pa_alsa_profile_info *source,
 | 
			
		||||
        void *userdata) {
 | 
			
		||||
static void add_profiles(struct userdata *u, pa_hashmap *h) {
 | 
			
		||||
    pa_alsa_profile *ap;
 | 
			
		||||
    void *state;
 | 
			
		||||
 | 
			
		||||
    struct userdata *u = userdata;
 | 
			
		||||
    char *t, *n;
 | 
			
		||||
    pa_card_profile *p;
 | 
			
		||||
    struct profile_data *d;
 | 
			
		||||
    unsigned bonus = 0;
 | 
			
		||||
    pa_assert(u);
 | 
			
		||||
    pa_assert(h);
 | 
			
		||||
 | 
			
		||||
    if (sink && source) {
 | 
			
		||||
        n = pa_sprintf_malloc("output-%s+input-%s", sink->name, source->name);
 | 
			
		||||
        t = pa_sprintf_malloc(_("Output %s + Input %s"), sink->description, _(source->description));
 | 
			
		||||
    } else if (sink) {
 | 
			
		||||
        n = pa_sprintf_malloc("output-%s", sink->name);
 | 
			
		||||
        t = pa_sprintf_malloc(_("Output %s"), _(sink->description));
 | 
			
		||||
    } else {
 | 
			
		||||
        pa_assert(source);
 | 
			
		||||
        n = pa_sprintf_malloc("input-%s", source->name);
 | 
			
		||||
        t = pa_sprintf_malloc(_("Input %s"), _(source->description));
 | 
			
		||||
    PA_HASHMAP_FOREACH(ap, u->profile_set->profiles, state) {
 | 
			
		||||
        struct profile_data *d;
 | 
			
		||||
        pa_card_profile *cp;
 | 
			
		||||
        pa_alsa_mapping *m;
 | 
			
		||||
        uint32_t idx;
 | 
			
		||||
 | 
			
		||||
        cp = pa_card_profile_new(ap->name, ap->description, sizeof(struct profile_data));
 | 
			
		||||
        cp->priority = ap->priority;
 | 
			
		||||
 | 
			
		||||
        if (ap->output_mappings) {
 | 
			
		||||
            cp->n_sinks = pa_idxset_size(ap->output_mappings);
 | 
			
		||||
 | 
			
		||||
            PA_IDXSET_FOREACH(m, ap->output_mappings, idx)
 | 
			
		||||
                if (m->channel_map.channels > cp->max_sink_channels)
 | 
			
		||||
                    cp->max_sink_channels = m->channel_map.channels;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (ap->input_mappings) {
 | 
			
		||||
            cp->n_sources = pa_idxset_size(ap->input_mappings);
 | 
			
		||||
 | 
			
		||||
            PA_IDXSET_FOREACH(m, ap->input_mappings, idx)
 | 
			
		||||
                if (m->channel_map.channels > cp->max_source_channels)
 | 
			
		||||
                    cp->max_source_channels = m->channel_map.channels;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        d = PA_CARD_PROFILE_DATA(cp);
 | 
			
		||||
        d->profile = ap;
 | 
			
		||||
 | 
			
		||||
        pa_hashmap_put(h, cp->name, cp);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (sink) {
 | 
			
		||||
        if (pa_channel_map_equal(&sink->map, &u->core->default_channel_map))
 | 
			
		||||
            bonus += 50000;
 | 
			
		||||
        else if (sink->map.channels == u->core->default_channel_map.channels)
 | 
			
		||||
            bonus += 40000;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (source) {
 | 
			
		||||
        if (pa_channel_map_equal(&source->map, &u->core->default_channel_map))
 | 
			
		||||
            bonus += 30000;
 | 
			
		||||
        else if (source->map.channels == u->core->default_channel_map.channels)
 | 
			
		||||
            bonus += 20000;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    pa_log_info("Found profile '%s'", t);
 | 
			
		||||
 | 
			
		||||
    p = pa_card_profile_new(n, t, sizeof(struct profile_data));
 | 
			
		||||
 | 
			
		||||
    pa_xfree(t);
 | 
			
		||||
    pa_xfree(n);
 | 
			
		||||
 | 
			
		||||
    p->priority =
 | 
			
		||||
        (sink ? sink->priority : 0) * 100 +
 | 
			
		||||
        (source ? source->priority : 0) +
 | 
			
		||||
        bonus;
 | 
			
		||||
 | 
			
		||||
    p->n_sinks = !!sink;
 | 
			
		||||
    p->n_sources = !!source;
 | 
			
		||||
 | 
			
		||||
    if (sink)
 | 
			
		||||
        p->max_sink_channels = sink->map.channels;
 | 
			
		||||
    if (source)
 | 
			
		||||
        p->max_source_channels = source->map.channels;
 | 
			
		||||
 | 
			
		||||
    d = PA_CARD_PROFILE_DATA(p);
 | 
			
		||||
 | 
			
		||||
    d->sink_profile = sink;
 | 
			
		||||
    d->source_profile = source;
 | 
			
		||||
 | 
			
		||||
    pa_hashmap_put(u->profiles, p->name, p);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void add_disabled_profile(pa_hashmap *profiles) {
 | 
			
		||||
| 
						 | 
				
			
			@ -176,7 +152,7 @@ static void add_disabled_profile(pa_hashmap *profiles) {
 | 
			
		|||
    p = pa_card_profile_new("off", _("Off"), sizeof(struct profile_data));
 | 
			
		||||
 | 
			
		||||
    d = PA_CARD_PROFILE_DATA(p);
 | 
			
		||||
    d->sink_profile = d->source_profile = NULL;
 | 
			
		||||
    d->profile = NULL;
 | 
			
		||||
 | 
			
		||||
    pa_hashmap_put(profiles, p->name, p);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -184,6 +160,9 @@ static void add_disabled_profile(pa_hashmap *profiles) {
 | 
			
		|||
static int card_set_profile(pa_card *c, pa_card_profile *new_profile) {
 | 
			
		||||
    struct userdata *u;
 | 
			
		||||
    struct profile_data *nd, *od;
 | 
			
		||||
    uint32_t idx;
 | 
			
		||||
    pa_alsa_mapping *am;
 | 
			
		||||
    pa_queue *sink_inputs = NULL, *source_outputs = NULL;
 | 
			
		||||
 | 
			
		||||
    pa_assert(c);
 | 
			
		||||
    pa_assert(new_profile);
 | 
			
		||||
| 
						 | 
				
			
			@ -192,67 +171,85 @@ static int card_set_profile(pa_card *c, pa_card_profile *new_profile) {
 | 
			
		|||
    nd = PA_CARD_PROFILE_DATA(new_profile);
 | 
			
		||||
    od = PA_CARD_PROFILE_DATA(c->active_profile);
 | 
			
		||||
 | 
			
		||||
    if (od->sink_profile != nd->sink_profile) {
 | 
			
		||||
        pa_queue *inputs = NULL;
 | 
			
		||||
    if (od->profile && od->profile->output_mappings)
 | 
			
		||||
        PA_IDXSET_FOREACH(am, od->profile->output_mappings, idx) {
 | 
			
		||||
            if (!am->sink)
 | 
			
		||||
                continue;
 | 
			
		||||
 | 
			
		||||
        if (u->sink) {
 | 
			
		||||
            if (nd->sink_profile)
 | 
			
		||||
                inputs = pa_sink_move_all_start(u->sink);
 | 
			
		||||
            if (nd->profile &&
 | 
			
		||||
                nd->profile->output_mappings &&
 | 
			
		||||
                pa_idxset_get_by_data(nd->profile->output_mappings, am, NULL))
 | 
			
		||||
                continue;
 | 
			
		||||
 | 
			
		||||
            pa_alsa_sink_free(u->sink);
 | 
			
		||||
            u->sink = NULL;
 | 
			
		||||
            sink_inputs = pa_sink_move_all_start(am->sink, sink_inputs);
 | 
			
		||||
            pa_alsa_sink_free(am->sink);
 | 
			
		||||
            am->sink = NULL;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (nd->sink_profile) {
 | 
			
		||||
            u->sink = pa_alsa_sink_new(c->module, u->modargs, __FILE__, c, nd->sink_profile);
 | 
			
		||||
    if (od->profile && od->profile->input_mappings)
 | 
			
		||||
        PA_IDXSET_FOREACH(am, od->profile->input_mappings, idx) {
 | 
			
		||||
            if (!am->source)
 | 
			
		||||
                continue;
 | 
			
		||||
 | 
			
		||||
            if (inputs) {
 | 
			
		||||
                if (u->sink)
 | 
			
		||||
                    pa_sink_move_all_finish(u->sink, inputs, FALSE);
 | 
			
		||||
                else
 | 
			
		||||
                    pa_sink_move_all_fail(inputs);
 | 
			
		||||
            if (nd->profile &&
 | 
			
		||||
                nd->profile->input_mappings &&
 | 
			
		||||
                pa_idxset_get_by_data(nd->profile->input_mappings, am, NULL))
 | 
			
		||||
                continue;
 | 
			
		||||
 | 
			
		||||
            source_outputs = pa_source_move_all_start(am->source, source_outputs);
 | 
			
		||||
            pa_alsa_source_free(am->source);
 | 
			
		||||
            am->source = NULL;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
    if (nd->profile && nd->profile->output_mappings)
 | 
			
		||||
        PA_IDXSET_FOREACH(am, nd->profile->output_mappings, idx) {
 | 
			
		||||
 | 
			
		||||
            if (!am->sink)
 | 
			
		||||
                am->sink = pa_alsa_sink_new(c->module, u->modargs, __FILE__, c, am);
 | 
			
		||||
 | 
			
		||||
            if (sink_inputs && am->sink) {
 | 
			
		||||
                pa_sink_move_all_finish(am->sink, sink_inputs, FALSE);
 | 
			
		||||
                sink_inputs = NULL;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (od->source_profile != nd->source_profile) {
 | 
			
		||||
        pa_queue *outputs = NULL;
 | 
			
		||||
    if (nd->profile && nd->profile->input_mappings)
 | 
			
		||||
        PA_IDXSET_FOREACH(am, nd->profile->input_mappings, idx) {
 | 
			
		||||
 | 
			
		||||
        if (u->source) {
 | 
			
		||||
            if (nd->source_profile)
 | 
			
		||||
                outputs = pa_source_move_all_start(u->source);
 | 
			
		||||
            if (!am->source)
 | 
			
		||||
                am->source = pa_alsa_source_new(c->module, u->modargs, __FILE__, c, am);
 | 
			
		||||
 | 
			
		||||
            pa_alsa_source_free(u->source);
 | 
			
		||||
            u->source = NULL;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (nd->source_profile) {
 | 
			
		||||
            u->source = pa_alsa_source_new(c->module, u->modargs, __FILE__, c, nd->source_profile);
 | 
			
		||||
 | 
			
		||||
            if (outputs) {
 | 
			
		||||
                if (u->source)
 | 
			
		||||
                    pa_source_move_all_finish(u->source, outputs, FALSE);
 | 
			
		||||
                else
 | 
			
		||||
                    pa_source_move_all_fail(outputs);
 | 
			
		||||
            if (source_outputs && am->source) {
 | 
			
		||||
                pa_source_move_all_finish(am->source, source_outputs, FALSE);
 | 
			
		||||
                source_outputs = NULL;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (sink_inputs)
 | 
			
		||||
        pa_sink_move_all_fail(sink_inputs);
 | 
			
		||||
 | 
			
		||||
    if (source_outputs)
 | 
			
		||||
        pa_source_move_all_fail(source_outputs);
 | 
			
		||||
 | 
			
		||||
    return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void init_profile(struct userdata *u) {
 | 
			
		||||
    uint32_t idx;
 | 
			
		||||
    pa_alsa_mapping *am;
 | 
			
		||||
    struct profile_data *d;
 | 
			
		||||
 | 
			
		||||
    pa_assert(u);
 | 
			
		||||
 | 
			
		||||
    d = PA_CARD_PROFILE_DATA(u->card->active_profile);
 | 
			
		||||
 | 
			
		||||
    if (d->sink_profile)
 | 
			
		||||
        u->sink = pa_alsa_sink_new(u->module, u->modargs, __FILE__, u->card, d->sink_profile);
 | 
			
		||||
    if (d->profile && d->profile->output_mappings)
 | 
			
		||||
        PA_IDXSET_FOREACH(am, d->profile->output_mappings, idx)
 | 
			
		||||
            am->sink = pa_alsa_sink_new(u->module, u->modargs, __FILE__, u->card, am);
 | 
			
		||||
 | 
			
		||||
    if (d->source_profile)
 | 
			
		||||
        u->source = pa_alsa_source_new(u->module, u->modargs, __FILE__, u->card, d->source_profile);
 | 
			
		||||
    if (d->profile && d->profile->input_mappings)
 | 
			
		||||
        PA_IDXSET_FOREACH(am, d->profile->input_mappings, idx)
 | 
			
		||||
            am->source = pa_alsa_source_new(u->module, u->modargs, __FILE__, u->card, am);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void set_card_name(pa_card_new_data *data, pa_modargs *ma, const char *device_id) {
 | 
			
		||||
| 
						 | 
				
			
			@ -286,9 +283,9 @@ int pa__init(pa_module *m) {
 | 
			
		|||
    pa_modargs *ma;
 | 
			
		||||
    int alsa_card_index;
 | 
			
		||||
    struct userdata *u;
 | 
			
		||||
    char rname[32];
 | 
			
		||||
    pa_reserve_wrapper *reserve = NULL;
 | 
			
		||||
    const char *description;
 | 
			
		||||
    char *fn = NULL;
 | 
			
		||||
 | 
			
		||||
    pa_alsa_redirect_errors_inc();
 | 
			
		||||
    snd_config_update_free_global();
 | 
			
		||||
| 
						 | 
				
			
			@ -300,13 +297,10 @@ int pa__init(pa_module *m) {
 | 
			
		|||
        goto fail;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    m->userdata = u = pa_xnew(struct userdata, 1);
 | 
			
		||||
    m->userdata = u = pa_xnew0(struct userdata, 1);
 | 
			
		||||
    u->core = m->core;
 | 
			
		||||
    u->module = m;
 | 
			
		||||
    u->device_id = pa_xstrdup(pa_modargs_get_value(ma, "device_id", DEFAULT_DEVICE_ID));
 | 
			
		||||
    u->card = NULL;
 | 
			
		||||
    u->sink = NULL;
 | 
			
		||||
    u->source = NULL;
 | 
			
		||||
    u->modargs = ma;
 | 
			
		||||
 | 
			
		||||
    if ((alsa_card_index = snd_card_get_index(u->device_id)) < 0) {
 | 
			
		||||
| 
						 | 
				
			
			@ -314,16 +308,36 @@ int pa__init(pa_module *m) {
 | 
			
		|||
        goto fail;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    pa_snprintf(rname, sizeof(rname), "Audio%i", alsa_card_index);
 | 
			
		||||
    if (!pa_in_system_mode()) {
 | 
			
		||||
        char *rname;
 | 
			
		||||
 | 
			
		||||
    if (!pa_in_system_mode())
 | 
			
		||||
        if (!(reserve = pa_reserve_wrapper_get(m->core, rname)))
 | 
			
		||||
            goto fail;
 | 
			
		||||
        if ((rname = pa_alsa_get_reserve_name(u->device_id))) {
 | 
			
		||||
            reserve = pa_reserve_wrapper_get(m->core, rname);
 | 
			
		||||
            pa_xfree(rname);
 | 
			
		||||
 | 
			
		||||
            if (!reserve)
 | 
			
		||||
                goto fail;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
#ifdef HAVE_UDEV
 | 
			
		||||
    fn = pa_udev_get_property(alsa_card_index, "PULSE_PROFILE_SET");
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
    u->profile_set = pa_alsa_profile_set_new(fn, &u->core->default_channel_map);
 | 
			
		||||
    pa_xfree(fn);
 | 
			
		||||
 | 
			
		||||
    if (!u->profile_set)
 | 
			
		||||
        goto fail;
 | 
			
		||||
 | 
			
		||||
    pa_alsa_profile_set_probe(u->profile_set, u->device_id, &m->core->default_sample_spec);
 | 
			
		||||
 | 
			
		||||
    pa_card_new_data_init(&data);
 | 
			
		||||
    data.driver = __FILE__;
 | 
			
		||||
    data.module = m;
 | 
			
		||||
 | 
			
		||||
    pa_alsa_init_proplist_card(m->core, data.proplist, alsa_card_index);
 | 
			
		||||
 | 
			
		||||
    pa_proplist_sets(data.proplist, PA_PROP_DEVICE_STRING, u->device_id);
 | 
			
		||||
    pa_alsa_init_description(data.proplist);
 | 
			
		||||
    set_card_name(&data, ma, u->device_id);
 | 
			
		||||
| 
						 | 
				
			
			@ -332,11 +346,8 @@ int pa__init(pa_module *m) {
 | 
			
		|||
        if ((description = pa_proplist_gets(data.proplist, PA_PROP_DEVICE_DESCRIPTION)))
 | 
			
		||||
            pa_reserve_wrapper_set_application_device_name(reserve, description);
 | 
			
		||||
 | 
			
		||||
    u->profiles = data.profiles = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func);
 | 
			
		||||
    if (pa_alsa_probe_profiles(u->device_id, &m->core->default_sample_spec, enumerate_cb, u) < 0) {
 | 
			
		||||
        pa_card_new_data_done(&data);
 | 
			
		||||
        goto fail;
 | 
			
		||||
    }
 | 
			
		||||
    data.profiles = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func);
 | 
			
		||||
    add_profiles(u, data.profiles);
 | 
			
		||||
 | 
			
		||||
    if (pa_hashmap_isempty(data.profiles)) {
 | 
			
		||||
        pa_log("Failed to find a working profile.");
 | 
			
		||||
| 
						 | 
				
			
			@ -379,13 +390,22 @@ fail:
 | 
			
		|||
 | 
			
		||||
int pa__get_n_used(pa_module *m) {
 | 
			
		||||
    struct userdata *u;
 | 
			
		||||
    int n = 0;
 | 
			
		||||
    uint32_t idx;
 | 
			
		||||
    pa_sink *sink;
 | 
			
		||||
    pa_source *source;
 | 
			
		||||
 | 
			
		||||
    pa_assert(m);
 | 
			
		||||
    pa_assert_se(u = m->userdata);
 | 
			
		||||
    pa_assert(u->card);
 | 
			
		||||
 | 
			
		||||
    return
 | 
			
		||||
        (u->sink ? pa_sink_linked_by(u->sink) : 0) +
 | 
			
		||||
        (u->source ? pa_source_linked_by(u->source) : 0);
 | 
			
		||||
    PA_IDXSET_FOREACH(sink, u->card->sinks, idx)
 | 
			
		||||
        n += pa_sink_linked_by(sink);
 | 
			
		||||
 | 
			
		||||
    PA_IDXSET_FOREACH(source, u->card->sources, idx)
 | 
			
		||||
        n += pa_source_linked_by(source);
 | 
			
		||||
 | 
			
		||||
    return n;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void pa__done(pa_module*m) {
 | 
			
		||||
| 
						 | 
				
			
			@ -396,11 +416,19 @@ void pa__done(pa_module*m) {
 | 
			
		|||
    if (!(u = m->userdata))
 | 
			
		||||
        goto finish;
 | 
			
		||||
 | 
			
		||||
    if (u->sink)
 | 
			
		||||
        pa_alsa_sink_free(u->sink);
 | 
			
		||||
    if (u->card && u->card->sinks) {
 | 
			
		||||
        pa_sink *s;
 | 
			
		||||
 | 
			
		||||
    if (u->source)
 | 
			
		||||
        pa_alsa_source_free(u->source);
 | 
			
		||||
        while ((s = pa_idxset_steal_first(u->card->sinks, NULL)))
 | 
			
		||||
            pa_alsa_sink_free(s);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (u->card && u->card->sources) {
 | 
			
		||||
        pa_source *s;
 | 
			
		||||
 | 
			
		||||
        while ((s = pa_idxset_steal_first(u->card->sources, NULL)))
 | 
			
		||||
            pa_alsa_source_free(s);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (u->card)
 | 
			
		||||
        pa_card_free(u->card);
 | 
			
		||||
| 
						 | 
				
			
			@ -408,6 +436,9 @@ void pa__done(pa_module*m) {
 | 
			
		|||
    if (u->modargs)
 | 
			
		||||
        pa_modargs_free(u->modargs);
 | 
			
		||||
 | 
			
		||||
    if (u->profile_set)
 | 
			
		||||
        pa_alsa_profile_set_free(u->profile_set);
 | 
			
		||||
 | 
			
		||||
    pa_xfree(u->device_id);
 | 
			
		||||
    pa_xfree(u);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1443,12 +1443,12 @@ static DBusHandlerResult filter_cb(DBusConnection *bus, DBusMessage *m, void *us
 | 
			
		|||
            if (u->sink && dbus_message_is_signal(m, "org.bluez.Headset", "SpeakerGainChanged")) {
 | 
			
		||||
 | 
			
		||||
                pa_cvolume_set(&v, u->sample_spec.channels, (pa_volume_t) (gain * PA_VOLUME_NORM / 15));
 | 
			
		||||
                pa_sink_volume_changed(u->sink, &v);
 | 
			
		||||
                pa_sink_volume_changed(u->sink, &v, TRUE);
 | 
			
		||||
 | 
			
		||||
            } else if (u->source && dbus_message_is_signal(m, "org.bluez.Headset", "MicrophoneGainChanged")) {
 | 
			
		||||
 | 
			
		||||
                pa_cvolume_set(&v, u->sample_spec.channels, (pa_volume_t) (gain * PA_VOLUME_NORM / 15));
 | 
			
		||||
                pa_source_volume_changed(u->source, &v);
 | 
			
		||||
                pa_source_volume_changed(u->source, &v, TRUE);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -1938,7 +1938,7 @@ static int card_set_profile(pa_card *c, pa_card_profile *new_profile) {
 | 
			
		|||
    }
 | 
			
		||||
 | 
			
		||||
    if (u->sink) {
 | 
			
		||||
        inputs = pa_sink_move_all_start(u->sink);
 | 
			
		||||
        inputs = pa_sink_move_all_start(u->sink, NULL);
 | 
			
		||||
#ifdef NOKIA
 | 
			
		||||
        if (!USE_SCO_OVER_PCM(u))
 | 
			
		||||
#endif
 | 
			
		||||
| 
						 | 
				
			
			@ -1946,7 +1946,7 @@ static int card_set_profile(pa_card *c, pa_card_profile *new_profile) {
 | 
			
		|||
    }
 | 
			
		||||
 | 
			
		||||
    if (u->source) {
 | 
			
		||||
        outputs = pa_source_move_all_start(u->source);
 | 
			
		||||
        outputs = pa_source_move_all_start(u->source, NULL);
 | 
			
		||||
#ifdef NOKIA
 | 
			
		||||
        if (!USE_SCO_OVER_PCM(u))
 | 
			
		||||
#endif
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -109,7 +109,7 @@ static void update_volume(struct userdata *u) {
 | 
			
		|||
        }
 | 
			
		||||
 | 
			
		||||
        pa_log_info("Found %u BT devices, unmuting.", u->n_found);
 | 
			
		||||
        pa_sink_set_mute(s, FALSE);
 | 
			
		||||
        pa_sink_set_mute(s, FALSE, FALSE);
 | 
			
		||||
 | 
			
		||||
    } else if (!u->muted && (u->n_found+u->n_unknown) <= 0) {
 | 
			
		||||
        pa_sink *s;
 | 
			
		||||
| 
						 | 
				
			
			@ -122,7 +122,7 @@ static void update_volume(struct userdata *u) {
 | 
			
		|||
        }
 | 
			
		||||
 | 
			
		||||
        pa_log_info("No BT devices found, muting.");
 | 
			
		||||
        pa_sink_set_mute(s, TRUE);
 | 
			
		||||
        pa_sink_set_mute(s, TRUE, FALSE);
 | 
			
		||||
 | 
			
		||||
    } else
 | 
			
		||||
        pa_log_info("%u devices now active, %u with unknown state.", u->n_found, u->n_unknown);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -27,6 +27,7 @@
 | 
			
		|||
#endif
 | 
			
		||||
 | 
			
		||||
#include <pulse/xmalloc.h>
 | 
			
		||||
#include <pulse/i18n.h>
 | 
			
		||||
 | 
			
		||||
#include <pulsecore/core-error.h>
 | 
			
		||||
#include <pulsecore/namereg.h>
 | 
			
		||||
| 
						 | 
				
			
			@ -45,20 +46,20 @@
 | 
			
		|||
#include "ladspa.h"
 | 
			
		||||
 | 
			
		||||
PA_MODULE_AUTHOR("Lennart Poettering");
 | 
			
		||||
PA_MODULE_DESCRIPTION("Virtual LADSPA sink");
 | 
			
		||||
PA_MODULE_DESCRIPTION(_("Virtual LADSPA sink"));
 | 
			
		||||
PA_MODULE_VERSION(PACKAGE_VERSION);
 | 
			
		||||
PA_MODULE_LOAD_ONCE(FALSE);
 | 
			
		||||
PA_MODULE_USAGE(
 | 
			
		||||
        "sink_name=<name for the sink> "
 | 
			
		||||
        "sink_properties=<properties for the sink> "
 | 
			
		||||
        "master=<name of sink to remap> "
 | 
			
		||||
        "format=<sample format> "
 | 
			
		||||
        "rate=<sample rate> "
 | 
			
		||||
        "channels=<number of channels> "
 | 
			
		||||
        "channel_map=<channel map> "
 | 
			
		||||
        "plugin=<ladspa plugin name> "
 | 
			
		||||
        "label=<ladspa plugin label> "
 | 
			
		||||
        "control=<comma seperated list of input control values>");
 | 
			
		||||
        _("sink_name=<name for the sink> "
 | 
			
		||||
          "sink_properties=<properties for the sink> "
 | 
			
		||||
          "master=<name of sink to filter> "
 | 
			
		||||
          "format=<sample format> "
 | 
			
		||||
          "rate=<sample rate> "
 | 
			
		||||
          "channels=<number of channels> "
 | 
			
		||||
          "channel_map=<channel map> "
 | 
			
		||||
          "plugin=<ladspa plugin name> "
 | 
			
		||||
          "label=<ladspa plugin label> "
 | 
			
		||||
          "control=<comma seperated list of input control values>"));
 | 
			
		||||
 | 
			
		||||
#define MEMBLOCKQ_MAXLENGTH (16*1024*1024)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -112,7 +112,7 @@ static void io_callback(pa_mainloop_api *io, pa_io_event *e, int fd, pa_io_event
 | 
			
		|||
                volchange = RESET;
 | 
			
		||||
 | 
			
		||||
            if (volchange == INVALID)
 | 
			
		||||
                pa_log_warn("Recieved unknown IR code '%s'", name);
 | 
			
		||||
                pa_log_warn("Received unknown IR code '%s'", name);
 | 
			
		||||
            else {
 | 
			
		||||
                pa_sink *s;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -133,7 +133,7 @@ static void io_callback(pa_mainloop_api *io, pa_io_event *e, int fd, pa_io_event
 | 
			
		|||
                                    cv.values[i] = PA_VOLUME_MAX;
 | 
			
		||||
                            }
 | 
			
		||||
 | 
			
		||||
                            pa_sink_set_volume(s, &cv, TRUE, TRUE, TRUE);
 | 
			
		||||
                            pa_sink_set_volume(s, &cv, TRUE, TRUE, TRUE, TRUE);
 | 
			
		||||
                            break;
 | 
			
		||||
 | 
			
		||||
                        case DOWN:
 | 
			
		||||
| 
						 | 
				
			
			@ -144,20 +144,20 @@ static void io_callback(pa_mainloop_api *io, pa_io_event *e, int fd, pa_io_event
 | 
			
		|||
                                    cv.values[i] = PA_VOLUME_MUTED;
 | 
			
		||||
                            }
 | 
			
		||||
 | 
			
		||||
                            pa_sink_set_volume(s, &cv, TRUE, TRUE, TRUE);
 | 
			
		||||
                            pa_sink_set_volume(s, &cv, TRUE, TRUE, TRUE, TRUE);
 | 
			
		||||
                            break;
 | 
			
		||||
 | 
			
		||||
                        case MUTE:
 | 
			
		||||
                            pa_sink_set_mute(s, TRUE);
 | 
			
		||||
                            pa_sink_set_mute(s, TRUE, TRUE);
 | 
			
		||||
                            break;
 | 
			
		||||
 | 
			
		||||
                        case RESET:
 | 
			
		||||
                            pa_sink_set_mute(s, FALSE);
 | 
			
		||||
                            pa_sink_set_mute(s, FALSE, TRUE);
 | 
			
		||||
                            break;
 | 
			
		||||
 | 
			
		||||
                        case MUTE_TOGGLE:
 | 
			
		||||
 | 
			
		||||
                            pa_sink_set_mute(s, !pa_sink_get_mute(s, FALSE));
 | 
			
		||||
                            pa_sink_set_mute(s, !pa_sink_get_mute(s, FALSE), TRUE);
 | 
			
		||||
                            break;
 | 
			
		||||
 | 
			
		||||
                        case INVALID:
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -115,7 +115,7 @@ static void io_callback(pa_mainloop_api *io, pa_io_event *e, int fd, pa_io_event
 | 
			
		|||
                                    cv.values[i] = PA_VOLUME_MAX;
 | 
			
		||||
                            }
 | 
			
		||||
 | 
			
		||||
                            pa_sink_set_volume(s, &cv, TRUE, TRUE, TRUE);
 | 
			
		||||
                            pa_sink_set_volume(s, &cv, TRUE, TRUE, TRUE, TRUE);
 | 
			
		||||
                            break;
 | 
			
		||||
 | 
			
		||||
                        case DOWN:
 | 
			
		||||
| 
						 | 
				
			
			@ -126,12 +126,12 @@ static void io_callback(pa_mainloop_api *io, pa_io_event *e, int fd, pa_io_event
 | 
			
		|||
                                    cv.values[i] = PA_VOLUME_MUTED;
 | 
			
		||||
                            }
 | 
			
		||||
 | 
			
		||||
                            pa_sink_set_volume(s, &cv, TRUE, TRUE, TRUE);
 | 
			
		||||
                            pa_sink_set_volume(s, &cv, TRUE, TRUE, TRUE, TRUE);
 | 
			
		||||
                            break;
 | 
			
		||||
 | 
			
		||||
                        case MUTE_TOGGLE:
 | 
			
		||||
 | 
			
		||||
                            pa_sink_set_mute(s, !pa_sink_get_mute(s, FALSE));
 | 
			
		||||
                            pa_sink_set_mute(s, !pa_sink_get_mute(s, FALSE), TRUE);
 | 
			
		||||
                            break;
 | 
			
		||||
 | 
			
		||||
                        case INVALID:
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -730,7 +730,7 @@ static void command_request(pa_pdispatch *pd, uint32_t command,  uint32_t tag, p
 | 
			
		|||
    }
 | 
			
		||||
 | 
			
		||||
    if (channel != u->channel) {
 | 
			
		||||
        pa_log("Recieved data for invalid channel");
 | 
			
		||||
        pa_log("Received data for invalid channel");
 | 
			
		||||
        goto fail;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1157,10 +1157,10 @@ static void sink_input_info_cb(pa_pdispatch *pd, uint32_t command,  uint32_t tag
 | 
			
		|||
        pa_cvolume_equal(&volume, &u->sink->virtual_volume))
 | 
			
		||||
        return;
 | 
			
		||||
 | 
			
		||||
    pa_sink_volume_changed(u->sink, &volume);
 | 
			
		||||
    pa_sink_volume_changed(u->sink, &volume, FALSE);
 | 
			
		||||
 | 
			
		||||
    if (u->version >= 11)
 | 
			
		||||
        pa_sink_mute_changed(u->sink, mute);
 | 
			
		||||
        pa_sink_mute_changed(u->sink, mute, FALSE);
 | 
			
		||||
 | 
			
		||||
    return;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1675,7 +1675,7 @@ static void pstream_memblock_callback(pa_pstream *p, uint32_t channel, int64_t o
 | 
			
		|||
    pa_assert(u);
 | 
			
		||||
 | 
			
		||||
    if (channel != u->channel) {
 | 
			
		||||
        pa_log("Recieved memory block on bad channel.");
 | 
			
		||||
        pa_log("Received memory block on bad channel.");
 | 
			
		||||
        pa_module_unload_request(u->module, TRUE);
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -58,7 +58,7 @@ static int read_id(struct udev_device *d, const char *n) {
 | 
			
		|||
    return u;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int pa_udev_get_info(pa_core *core, pa_proplist *p, int card_idx) {
 | 
			
		||||
int pa_udev_get_info(int card_idx, pa_proplist *p) {
 | 
			
		||||
    int r = -1;
 | 
			
		||||
    struct udev *udev;
 | 
			
		||||
    struct udev_device *card = NULL;
 | 
			
		||||
| 
						 | 
				
			
			@ -66,7 +66,6 @@ int pa_udev_get_info(pa_core *core, pa_proplist *p, int card_idx) {
 | 
			
		|||
    const char *v;
 | 
			
		||||
    int id;
 | 
			
		||||
 | 
			
		||||
    pa_assert(core);
 | 
			
		||||
    pa_assert(p);
 | 
			
		||||
    pa_assert(card_idx >= 0);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -153,3 +152,40 @@ finish:
 | 
			
		|||
 | 
			
		||||
    return r;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
char* pa_udev_get_property(int card_idx, const char *name) {
 | 
			
		||||
    struct udev *udev;
 | 
			
		||||
    struct udev_device *card = NULL;
 | 
			
		||||
    char *t, *r = NULL;
 | 
			
		||||
    const char *v;
 | 
			
		||||
 | 
			
		||||
    pa_assert(card_idx >= 0);
 | 
			
		||||
    pa_assert(name);
 | 
			
		||||
 | 
			
		||||
    if (!(udev = udev_new())) {
 | 
			
		||||
        pa_log_error("Failed to allocate udev context.");
 | 
			
		||||
        goto finish;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    t = pa_sprintf_malloc("%s/class/sound/card%i", udev_get_sys_path(udev), card_idx);
 | 
			
		||||
    card = udev_device_new_from_syspath(udev, t);
 | 
			
		||||
    pa_xfree(t);
 | 
			
		||||
 | 
			
		||||
    if (!card) {
 | 
			
		||||
        pa_log_error("Failed to get card object.");
 | 
			
		||||
        goto finish;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if ((v = udev_device_get_property_value(card, name)) && *v)
 | 
			
		||||
        r = pa_xstrdup(v);
 | 
			
		||||
 | 
			
		||||
finish:
 | 
			
		||||
 | 
			
		||||
    if (card)
 | 
			
		||||
        udev_device_unref(card);
 | 
			
		||||
 | 
			
		||||
    if (udev)
 | 
			
		||||
        udev_unref(udev);
 | 
			
		||||
 | 
			
		||||
    return r;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -25,6 +25,7 @@
 | 
			
		|||
 | 
			
		||||
#include <pulsecore/core.h>
 | 
			
		||||
 | 
			
		||||
int pa_udev_get_info(pa_core *core, pa_proplist *p, int card);
 | 
			
		||||
int pa_udev_get_info(int card_idx, pa_proplist *p);
 | 
			
		||||
char* pa_udev_get_property(int card_idx, const char *name);
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue