mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
SPDX tags make the licensing information easy to understand and clear, and they are machine parseable. See https://spdx.dev for more information.
25 lines
571 B
C
25 lines
571 B
C
/* Spa */
|
|
/* SPDX-FileCopyrightText: Copyright © 2021 Wim Taymans */
|
|
/* SPDX-License-Identifier: MIT */
|
|
|
|
#include "volume-ops.h"
|
|
|
|
void
|
|
volume_f32_c(struct volume *vol, void * SPA_RESTRICT dst,
|
|
const void * SPA_RESTRICT src, float volume, uint32_t n_samples)
|
|
{
|
|
uint32_t n;
|
|
float *d = (float*)dst;
|
|
const float *s = (const float*)src;
|
|
|
|
if (volume == VOLUME_MIN) {
|
|
memset(d, 0, n_samples * sizeof(float));
|
|
}
|
|
else if (volume == VOLUME_NORM) {
|
|
spa_memcpy(d, s, n_samples * sizeof(float));
|
|
}
|
|
else {
|
|
for (n = 0; n < n_samples; n++)
|
|
d[n] = s[n] * volume;
|
|
}
|
|
}
|