101
103
* > PA_VOLUME_NORM: increased volume */
102
104
typedef uint32_t pa_volume_t;
104
/** Normal volume (100%) */
106
/** Normal volume (100%, 0 dB) */
105
107
#define PA_VOLUME_NORM ((pa_volume_t) 0x10000U)
107
/** Muted volume (0%) */
109
/** Muted volume (0%, -inf dB) */
108
110
#define PA_VOLUME_MUTED ((pa_volume_t) 0U)
112
/** Maximum volume we can store. \since 0.9.15 */
113
#define PA_VOLUME_MAX ((pa_volume_t) UINT32_MAX)
110
115
/** A structure encapsulating a per-channel volume */
111
116
typedef struct pa_cvolume {
112
117
uint8_t channels; /**< Number of channels */
150
155
/** Pretty print a volume structure but show dB values. \since 0.9.13 */
151
156
char *pa_sw_cvolume_snprint_dB(char *s, size_t l, const pa_cvolume *c);
158
/** Maximum length of the strings returned by
159
* pa_volume_snprint(). Please note that this value can change with
160
* any release without warning and without being considered API or ABI
161
* breakage. You should not use this definition anywhere where it
162
* might become part of an ABI. \since 0.9.15 */
163
#define PA_VOLUME_SNPRINT_MAX 10
165
/** Pretty print a volume \since 0.9.15 */
166
char *pa_volume_snprint(char *s, size_t l, pa_volume_t v);
168
/** Maximum length of the strings returned by
169
* pa_volume_snprint_dB(). Please note that this value can change with
170
* any release without warning and without being considered API or ABI
171
* breakage. You should not use this definition anywhere where it
172
* might become part of an ABI. \since 0.9.15 */
173
#define PA_SW_VOLUME_SNPRINT_DB_MAX 10
175
/** Pretty print a volume but show dB values. \since 0.9.15 */
176
char *pa_sw_volume_snprint_dB(char *s, size_t l, pa_volume_t v);
153
178
/** Return the average volume of all channels */
154
179
pa_volume_t pa_cvolume_avg(const pa_cvolume *a) PA_GCC_PURE;
209
234
/** Remap a volume from one channel mapping to a different channel mapping. \since 0.9.12 */
210
pa_cvolume *pa_cvolume_remap(pa_cvolume *v, pa_channel_map *from, pa_channel_map *to);
235
pa_cvolume *pa_cvolume_remap(pa_cvolume *v, const pa_channel_map *from, const pa_channel_map *to);
212
/** Return non-zero if the specified volume is compatible with
213
* the specified sample spec. \since 0.9.13 */
237
/** Return non-zero if the specified volume is compatible with the
238
* specified sample spec. \since 0.9.13 */
214
239
int pa_cvolume_compatible(const pa_cvolume *v, const pa_sample_spec *ss) PA_GCC_PURE;
241
/** Return non-zero if the specified volume is compatible with the
242
* specified sample spec. \since 0.9.15 */
243
int pa_cvolume_compatible_with_channel_map(const pa_cvolume *v, const pa_channel_map *cm) PA_GCC_PURE;
245
/** Calculate a 'balance' value for the specified volume with the
246
* specified channel map. The return value will range from -1.0f
247
* (left) to +1.0f (right). If no balance value is applicable to this
248
* channel map the return value will always be 0.0f. See
249
* pa_channel_map_can_balance(). \since 0.9.15 */
250
float pa_cvolume_get_balance(const pa_cvolume *v, const pa_channel_map *map) PA_GCC_PURE;
252
/** Adjust the 'balance' value for the specified volume with the
253
* specified channel map. v will be modified in place and
254
* returned. The balance is a value between -1.0f and +1.0f. This
255
* operation might not be reversible! Also, after this call
256
* pa_cvolume_get_balance() is not guaranteed to actually return the
257
* requested balance value (e.g. when the input volume was zero anyway for
258
* all channels). If no balance value is applicable to
259
* this channel map the volume will not be modified. See
260
* pa_channel_map_can_balance(). \since 0.9.15 */
261
pa_cvolume* pa_cvolume_set_balance(pa_cvolume *v, const pa_channel_map *map, float new_balance);
263
/** Calculate a 'fade' value (i.e. 'balance' between front and rear)
264
* for the specified volume with the specified channel map. The return
265
* value will range from -1.0f (rear) to +1.0f (left). If no fade
266
* value is applicable to this channel map the return value will
267
* always be 0.0f. See pa_channel_map_can_fade(). \since 0.9.15 */
268
float pa_cvolume_get_fade(const pa_cvolume *v, const pa_channel_map *map) PA_GCC_PURE;
270
/** Adjust the 'fade' value (i.e. 'balance' between front and rear)
271
* for the specified volume with the specified channel map. v will be
272
* modified in place and returned. The balance is a value between
273
* -1.0f and +1.0f. This operation might not be reversible! Also,
274
* after this call pa_cvolume_get_fade() is not guaranteed to actually
275
* return the requested fade value (e.g. when the input volume was
276
* zero anyway for all channels). If no fade value is applicable to
277
* this channel map the volume will not be modified. See
278
* pa_channel_map_can_fade(). \since 0.9.15 */
279
pa_cvolume* pa_cvolume_set_fade(pa_cvolume *v, const pa_channel_map *map, float new_fade);
281
/** Scale the passed pa_cvolume structure so that the maximum volume
282
* of all channels equals max. The proportions between the channel
283
* volumes are kept. \since 0.9.15 */
284
pa_cvolume* pa_cvolume_scale(pa_cvolume *v, pa_volume_t max);