mirror of
				https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
				synced 2025-11-03 09:01:50 -05:00 
			
		
		
		
	volume: round properly when showing human readable volume percentages
This commit is contained in:
		
							parent
							
								
									96f01b822a
								
							
						
					
					
						commit
						ef01baf613
					
				
					 1 changed files with 2 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -292,7 +292,7 @@ char *pa_cvolume_snprint(char *s, size_t l, const pa_cvolume *c) {
 | 
			
		|||
        l -= pa_snprintf(e, l, "%s%u: %3u%%",
 | 
			
		||||
                      first ? "" : " ",
 | 
			
		||||
                      channel,
 | 
			
		||||
                      (c->values[channel]*100)/PA_VOLUME_NORM);
 | 
			
		||||
                      (c->values[channel]*100+PA_VOLUME_NORM/2)/PA_VOLUME_NORM);
 | 
			
		||||
 | 
			
		||||
        e = strchr(e, 0);
 | 
			
		||||
        first = FALSE;
 | 
			
		||||
| 
						 | 
				
			
			@ -312,7 +312,7 @@ char *pa_volume_snprint(char *s, size_t l, pa_volume_t v) {
 | 
			
		|||
        return s;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    pa_snprintf(s, l, "%3u%%", (v*100)/PA_VOLUME_NORM);
 | 
			
		||||
    pa_snprintf(s, l, "%3u%%", (v*100+PA_VOLUME_NORM/2)/PA_VOLUME_NORM);
 | 
			
		||||
    return s;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue