mirror of
				https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
				synced 2025-11-03 09:01:50 -05:00 
			
		
		
		
	volume: add pa_cvolume_merge() call
This commit is contained in:
		
							parent
							
								
									01e4b61a91
								
							
						
					
					
						commit
						8208214882
					
				
					 3 changed files with 24 additions and 0 deletions
				
			
		| 
						 | 
					@ -130,6 +130,7 @@ pa_cvolume_get_position;
 | 
				
			||||||
pa_cvolume_init;
 | 
					pa_cvolume_init;
 | 
				
			||||||
pa_cvolume_max;
 | 
					pa_cvolume_max;
 | 
				
			||||||
pa_cvolume_max_mask;
 | 
					pa_cvolume_max_mask;
 | 
				
			||||||
 | 
					pa_cvolume_merge;
 | 
				
			||||||
pa_cvolume_remap;
 | 
					pa_cvolume_remap;
 | 
				
			||||||
pa_cvolume_scale;
 | 
					pa_cvolume_scale;
 | 
				
			||||||
pa_cvolume_scale_mask;
 | 
					pa_cvolume_scale_mask;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -815,3 +815,21 @@ pa_volume_t pa_cvolume_get_position(
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return v;
 | 
					    return v;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					pa_cvolume* pa_cvolume_merge(pa_cvolume *dest, const pa_cvolume *a, const pa_cvolume *b) {
 | 
				
			||||||
 | 
					    unsigned i;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    pa_assert(dest);
 | 
				
			||||||
 | 
					    pa_assert(a);
 | 
				
			||||||
 | 
					    pa_assert(b);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    pa_return_val_if_fail(pa_cvolume_valid(a), NULL);
 | 
				
			||||||
 | 
					    pa_return_val_if_fail(pa_cvolume_valid(b), NULL);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    for (i = 0; i < a->channels && i < b->channels; i++)
 | 
				
			||||||
 | 
					        dest->values[i] = PA_MAX(a->values[i], b->values[i]);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    dest->channels = (uint8_t) i;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    return dest;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -326,6 +326,11 @@ pa_cvolume* pa_cvolume_set_position(pa_cvolume *cv, const pa_channel_map *map, p
 | 
				
			||||||
 * position by calling pa_channel_map_has_position(). \since 0.9.16 */
 | 
					 * position by calling pa_channel_map_has_position(). \since 0.9.16 */
 | 
				
			||||||
pa_volume_t pa_cvolume_get_position(pa_cvolume *cv, const pa_channel_map *map, pa_channel_position_t t) PA_GCC_PURE;
 | 
					pa_volume_t pa_cvolume_get_position(pa_cvolume *cv, const pa_channel_map *map, pa_channel_position_t t) PA_GCC_PURE;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/** This goes through all channels in a and b and sets the
 | 
				
			||||||
 | 
					 * corresponding channel in dest to the greater volume of both. a, b
 | 
				
			||||||
 | 
					 * and dest may point to the same structure. \since 0.9.16 */
 | 
				
			||||||
 | 
					pa_cvolume* pa_cvolume_merge(pa_cvolume *dest, const pa_cvolume *a, const pa_cvolume *b);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
PA_C_DECL_END
 | 
					PA_C_DECL_END
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue