mirror of
				https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
				synced 2025-11-03 09:01:50 -05:00 
			
		
		
		
	volume: Clamp volume to PA_VOLUME_MAX
This ensures that we always clamp the volume to PA_VOLUME_MAX. While this currently has no effect, it will be required for making sure we don't exceed PA_VOLUME_MAX when its value changes in the future.
This commit is contained in:
		
							parent
							
								
									1d2ef7923d
								
							
						
					
					
						commit
						49101fc540
					
				
					 7 changed files with 24 additions and 19 deletions
				
			
		| 
						 | 
				
			
			@ -271,10 +271,10 @@ int pa_oss_get_volume(int fd, unsigned long mixer, const pa_sample_spec *ss, pa_
 | 
			
		|||
 | 
			
		||||
    pa_cvolume_reset(volume, ss->channels);
 | 
			
		||||
 | 
			
		||||
    volume->values[0] = ((vol & 0xFF) * PA_VOLUME_NORM) / 100;
 | 
			
		||||
    volume->values[0] = PA_CLAMP_VOLUME(((vol & 0xFF) * PA_VOLUME_NORM) / 100);
 | 
			
		||||
 | 
			
		||||
    if (volume->channels >= 2)
 | 
			
		||||
        volume->values[1] = (((vol >> 8) & 0xFF) * PA_VOLUME_NORM) / 100;
 | 
			
		||||
        volume->values[1] = PA_CLAMP_VOLUME((((vol >> 8) & 0xFF) * PA_VOLUME_NORM) / 100);
 | 
			
		||||
 | 
			
		||||
    pa_log_debug("Read mixer settings: %s", pa_cvolume_snprint(cv, sizeof(cv), volume));
 | 
			
		||||
    return 0;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue