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
				
			
		| 
						 | 
				
			
			@ -56,6 +56,7 @@ struct pa_source {
 | 
			
		|||
 | 
			
		||||
    uint32_t index;
 | 
			
		||||
    pa_core *core;
 | 
			
		||||
 | 
			
		||||
    pa_source_state_t state;
 | 
			
		||||
    pa_source_flags_t flags;
 | 
			
		||||
    pa_suspend_cause_t suspend_cause;
 | 
			
		||||
| 
						 | 
				
			
			@ -83,6 +84,10 @@ struct pa_source {
 | 
			
		|||
    pa_bool_t refresh_volume:1;
 | 
			
		||||
    pa_bool_t refresh_muted:1;
 | 
			
		||||
 | 
			
		||||
    pa_bool_t save_port:1;
 | 
			
		||||
    pa_bool_t save_volume:1;
 | 
			
		||||
    pa_bool_t save_muted:1;
 | 
			
		||||
 | 
			
		||||
    pa_asyncmsgq *asyncmsgq;
 | 
			
		||||
    pa_rtpoll *rtpoll;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -90,6 +95,9 @@ struct pa_source {
 | 
			
		|||
 | 
			
		||||
    pa_usec_t fixed_latency; /* for sources with PA_SOURCE_DYNAMIC_LATENCY this is 0 */
 | 
			
		||||
 | 
			
		||||
    pa_hashmap *ports;
 | 
			
		||||
    pa_device_port *active_port;
 | 
			
		||||
 | 
			
		||||
    /* Called when the main loop requests a state change. Called from
 | 
			
		||||
     * main loop context. If returns -1 the state change will be
 | 
			
		||||
     * inhibited */
 | 
			
		||||
| 
						 | 
				
			
			@ -121,6 +129,10 @@ struct pa_source {
 | 
			
		|||
     * thread context. */
 | 
			
		||||
    void (*update_requested_latency)(pa_source *s); /* dito */
 | 
			
		||||
 | 
			
		||||
    /* Called whenever the port shall be changed. Called from main
 | 
			
		||||
     * thread. */
 | 
			
		||||
    int (*set_port)(pa_source *s, pa_device_port *port); /*dito */
 | 
			
		||||
 | 
			
		||||
    /* Contains copies of the above data so that the real-time worker
 | 
			
		||||
     * thread can work without access locking */
 | 
			
		||||
    struct {
 | 
			
		||||
| 
						 | 
				
			
			@ -174,6 +186,9 @@ typedef struct pa_source_new_data {
 | 
			
		|||
    pa_module *module;
 | 
			
		||||
    pa_card *card;
 | 
			
		||||
 | 
			
		||||
    pa_hashmap *ports;
 | 
			
		||||
    char *active_port;
 | 
			
		||||
 | 
			
		||||
    pa_sample_spec sample_spec;
 | 
			
		||||
    pa_channel_map channel_map;
 | 
			
		||||
    pa_cvolume volume;
 | 
			
		||||
| 
						 | 
				
			
			@ -185,6 +200,10 @@ typedef struct pa_source_new_data {
 | 
			
		|||
    pa_bool_t channel_map_is_set:1;
 | 
			
		||||
 | 
			
		||||
    pa_bool_t namereg_fail:1;
 | 
			
		||||
 | 
			
		||||
    pa_bool_t save_port:1;
 | 
			
		||||
    pa_bool_t save_volume:1;
 | 
			
		||||
    pa_bool_t save_muted:1;
 | 
			
		||||
} pa_source_new_data;
 | 
			
		||||
 | 
			
		||||
pa_source_new_data* pa_source_new_data_init(pa_source_new_data *data);
 | 
			
		||||
| 
						 | 
				
			
			@ -193,6 +212,7 @@ void pa_source_new_data_set_sample_spec(pa_source_new_data *data, const pa_sampl
 | 
			
		|||
void pa_source_new_data_set_channel_map(pa_source_new_data *data, const pa_channel_map *map);
 | 
			
		||||
void pa_source_new_data_set_volume(pa_source_new_data *data, const pa_cvolume *volume);
 | 
			
		||||
void pa_source_new_data_set_muted(pa_source_new_data *data, pa_bool_t mute);
 | 
			
		||||
void pa_source_new_data_set_port(pa_source_new_data *data, const char *port);
 | 
			
		||||
void pa_source_new_data_done(pa_source_new_data *data);
 | 
			
		||||
 | 
			
		||||
/*** To be called exclusively by the source driver, from main context */
 | 
			
		||||
| 
						 | 
				
			
			@ -217,8 +237,8 @@ void pa_source_detach(pa_source *s);
 | 
			
		|||
void pa_source_attach(pa_source *s);
 | 
			
		||||
 | 
			
		||||
void pa_source_set_soft_volume(pa_source *s, const pa_cvolume *volume);
 | 
			
		||||
void pa_source_volume_changed(pa_source *s, const pa_cvolume *new_volume);
 | 
			
		||||
void pa_source_mute_changed(pa_source *s, pa_bool_t new_muted);
 | 
			
		||||
void pa_source_volume_changed(pa_source *s, const pa_cvolume *new_volume, pa_bool_t save);
 | 
			
		||||
void pa_source_mute_changed(pa_source *s, pa_bool_t new_muted, pa_bool_t save);
 | 
			
		||||
 | 
			
		||||
int pa_source_sync_suspend(pa_source *s);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -235,20 +255,22 @@ int pa_source_update_status(pa_source*s);
 | 
			
		|||
int pa_source_suspend(pa_source *s, pa_bool_t suspend, pa_suspend_cause_t cause);
 | 
			
		||||
int pa_source_suspend_all(pa_core *c, pa_bool_t suspend, pa_suspend_cause_t cause);
 | 
			
		||||
 | 
			
		||||
void pa_source_set_volume(pa_source *source, const pa_cvolume *volume);
 | 
			
		||||
void pa_source_set_volume(pa_source *source, const pa_cvolume *volume, pa_bool_t save);
 | 
			
		||||
const pa_cvolume *pa_source_get_volume(pa_source *source, pa_bool_t force_refresh);
 | 
			
		||||
void pa_source_set_mute(pa_source *source, pa_bool_t mute);
 | 
			
		||||
void pa_source_set_mute(pa_source *source, pa_bool_t mute, pa_bool_t save);
 | 
			
		||||
pa_bool_t pa_source_get_mute(pa_source *source, pa_bool_t force_refresh);
 | 
			
		||||
 | 
			
		||||
pa_bool_t pa_source_update_proplist(pa_source *s, pa_update_mode_t mode, pa_proplist *p);
 | 
			
		||||
 | 
			
		||||
int pa_source_set_port(pa_source *s, const char *name, pa_bool_t save);
 | 
			
		||||
 | 
			
		||||
unsigned pa_source_linked_by(pa_source *s); /* Number of connected streams */
 | 
			
		||||
unsigned pa_source_used_by(pa_source *s); /* Number of connected streams that are not corked */
 | 
			
		||||
unsigned pa_source_check_suspend(pa_source *s); /* Returns how many streams are active that don't allow suspensions */
 | 
			
		||||
#define pa_source_get_state(s) ((pa_source_state_t) (s)->state)
 | 
			
		||||
 | 
			
		||||
/* Moves all inputs away, and stores them in pa_queue */
 | 
			
		||||
pa_queue *pa_source_move_all_start(pa_source *s);
 | 
			
		||||
pa_queue *pa_source_move_all_start(pa_source *s, pa_queue *q);
 | 
			
		||||
void pa_source_move_all_finish(pa_source *s, pa_queue *q, pa_bool_t save);
 | 
			
		||||
void pa_source_move_all_fail(pa_queue *q);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue