mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-04 13:30:12 -05:00
parent
43e2c64307
commit
4496c33751
6 changed files with 59 additions and 38 deletions
|
|
@ -26,7 +26,22 @@
|
|||
#ifndef PULSE_SERVER_VOLUME_H
|
||||
#define PULSE_SERVER_VOLUME_H
|
||||
|
||||
#include "internal.h"
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "format.h"
|
||||
|
||||
struct spa_pod;
|
||||
|
||||
struct volume {
|
||||
uint8_t channels;
|
||||
float values[CHANNELS_MAX];
|
||||
};
|
||||
|
||||
#define VOLUME_INIT \
|
||||
(struct volume) { \
|
||||
.channels = 0, \
|
||||
}
|
||||
|
||||
struct volume_info {
|
||||
struct volume volume;
|
||||
|
|
@ -40,12 +55,31 @@ struct volume_info {
|
|||
uint32_t flags;
|
||||
};
|
||||
|
||||
#define VOLUME_INFO_INIT (struct volume_info) { \
|
||||
.volume = VOLUME_INIT, \
|
||||
.mute = false, \
|
||||
.level = 1.0, \
|
||||
.base = 1.0, \
|
||||
.steps = 256, \
|
||||
}
|
||||
#define VOLUME_INFO_INIT \
|
||||
(struct volume_info) { \
|
||||
.volume = VOLUME_INIT, \
|
||||
.mute = false, \
|
||||
.level = 1.0, \
|
||||
.base = 1.0, \
|
||||
.steps = 256, \
|
||||
}
|
||||
|
||||
static inline bool volume_valid(const struct volume *vol)
|
||||
{
|
||||
if (vol->channels == 0 || vol->channels > CHANNELS_MAX)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
static inline void volume_make(struct volume *vol, uint8_t channels)
|
||||
{
|
||||
uint8_t i;
|
||||
for (i = 0; i < channels; i++)
|
||||
vol->values[i] = 1.0f;
|
||||
vol->channels = channels;
|
||||
}
|
||||
|
||||
int volume_compare(struct volume *vol, struct volume *other);
|
||||
int volume_parse_param(const struct spa_pod *param, struct volume_info *info, bool monitor);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue