# Regulate process volume with base OSS subsystem



## redranteis (Mar 15, 2021)

Hello everyone,
just a quick question. Is it possibile to change a process' volume with base OSS subsystem?
For example, if I cat sndstat I get every process that is currently using sound: can I change
every process' volume or only the process itself can change it (via ioctls presumably)?
Thanks in advance.


----------



## oops (Mar 15, 2021)

```
$ sysctl hw.snd.verbose=2
$ mkdir -p ~/bin
$ fetch -o ~/bin/ https://people.freebsd.org/~ariff/utils/appsmixer
$ chmod +x ~/bin/appsmixer
$ appsmixer
wine (dsp0.vp0):
        Mixer pcm      is currently set to  45:45
mpv (dsp0.vp1):
        Mixer pcm      is currently set to  45:45
firefox (dsp0.vp2):
        Mixer pcm      is currently set to  45:45
$ appsmixer firefox 100
firefox (dsp0.vp0):
        Setting the mixer pcm from 45:45 to 100:100.
```


----------



## redranteis (Mar 15, 2021)

oops said:


> ```
> $ sysctl hw.snd.verbose=2
> $ mkdir -p ~/bin
> $ fetch -o ~/bin/ https://people.freebsd.org/~ariff/utils/appsmixer
> ...


Well, I didn't notice that with mixer(8) I could have used /dev/dspN.vp* and /dev/dspN.vr* to regulate each process' volume. That is exactly what I was searching. Thanks.


----------



## Mjölnir (Mar 15, 2021)

redranteis said:


> Is it possibile to change a process' volume with base OSS subsystem?
> For example, if I `cat sndstat` I get every process that is currently using sound: can I change every process' volume or only the process itself can change it (via ioctls presumably)?


Yes, this can be done by the so-called _virtual private sound channels_ (VPC).  Unfortunately, not all mixer applications handle that correctly.  The major DEs should be fine in this regard.
`sysctl dev.pcm|fgrep vchan`


----------



## Mjölnir (Mar 15, 2021)

P.S.: and `sysctl hw.snd | fgrep vpc`


----------

