mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	acp: reset soft_volume
Reset the software volume when initializing the device and when the hardware volume is updated. The software volume was set to 0 by default and if the session manager did not change the volume enough to cause a software volume change, it would remain 0 and there would be silence. Also improve the debug a little. See #1160 #1167 #1164 #1049 #1117
This commit is contained in:
		
							parent
							
								
									eba38a33af
								
							
						
					
					
						commit
						d226a28b30
					
				
					 1 changed files with 11 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -215,6 +215,7 @@ static void init_device(pa_card *impl, pa_alsa_device *dev, pa_alsa_direction_t
 | 
			
		|||
	dev->device.format.rate_mask = m->sample_spec.rate;
 | 
			
		||||
	dev->device.format.channels = m->channel_map.channels;
 | 
			
		||||
	pa_cvolume_reset(&dev->real_volume, m->channel_map.channels);
 | 
			
		||||
	pa_cvolume_reset(&dev->soft_volume, m->channel_map.channels);
 | 
			
		||||
	for (i = 0; i < m->channel_map.channels; i++)
 | 
			
		||||
		dev->device.format.map[i]= channel_pa2acp(m->channel_map.map[i]);
 | 
			
		||||
	dev->direction = direction;
 | 
			
		||||
| 
						 | 
				
			
			@ -1033,10 +1034,15 @@ static int read_volume(pa_alsa_device *dev)
 | 
			
		|||
		return 0;
 | 
			
		||||
 | 
			
		||||
	dev->real_volume = r;
 | 
			
		||||
	pa_log_info("New hardware volume:");
 | 
			
		||||
 | 
			
		||||
	pa_log_info("New hardware volume: min:%d max:%d",
 | 
			
		||||
			pa_cvolume_min(&r), pa_cvolume_max(&r));
 | 
			
		||||
 | 
			
		||||
	for (i = 0; i < r.channels; i++)
 | 
			
		||||
		pa_log_debug("  %d: %d", i, r.values[i]);
 | 
			
		||||
 | 
			
		||||
	pa_cvolume_reset(&dev->soft_volume, r.channels);
 | 
			
		||||
 | 
			
		||||
	if (impl->events && impl->events->volume_changed)
 | 
			
		||||
		impl->events->volume_changed(impl->user_data, &dev->device);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1803,7 +1809,10 @@ int acp_device_set_volume(struct acp_device *dev, const float *volume, uint32_t
 | 
			
		|||
	for (i = 0; i < v.channels; i++)
 | 
			
		||||
		v.values[i] = pa_sw_volume_from_linear(volume[i % n_volume]);;
 | 
			
		||||
 | 
			
		||||
	pa_log_info("Set %s volume: %d", d->set_volume ? "hardware" : "software", pa_cvolume_max(&v));
 | 
			
		||||
	pa_log_info("Set %s volume: min:%d max:%d",
 | 
			
		||||
			d->set_volume ? "hardware" : "software",
 | 
			
		||||
			pa_cvolume_min(&v), pa_cvolume_max(&v));
 | 
			
		||||
 | 
			
		||||
	for (i = 0; i < v.channels; i++)
 | 
			
		||||
		pa_log_debug("  %d: %d", i, v.values[i]);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue