I'm playing PCM data from a WAV file with pipewire. I am using pw_stream_dequeue_buffer
and writing the data to that buffer as is in a callback function.
I was wondering how best to set the volume of a stream. For example to have music at a different volume than a sound effect.
The samples are all signed 16-bit values. My only idea is to loop thru them all and multiply by .7 to lower the volume to 70% before writing them to the buffer. It just seems like a lot of operations to apply volume. Is there any better way?