Volume Per Channel (VPC)

Hello, can someone explain to me how to use the VPC feature of the operating system? I noticed it some time ago in the sound man page, but I didn't find any resources on how to actually use it for per application volume control. It does not seem like it's possible with the default mixer utility.

from man sound:
Code:
   VPC
     FreeBSD supports independent and individual volume controls for each ac-
     tive application, without touching the master sound volume. This is
     sometimes referred to as Volume Per Channel (VPC). The VPC feature is
     enabled by default.

So far I have been using sndio and pulseaudio to achieve per application
volume control, but doing it on the OSS level would be much more convenient.
 
For multiplexing OSS you should use virtual_oss(8). The man page has few good examples.
Also read all those related manpages at the bottom of the page of the virtual_oss(8), i.e. SEE ALSO
 
OK, so OSS does not support "individual volume controls for each active application" after all or am I misunderstanding something? I have already used virtual_oss for redirecting audio between applications, but it was really cumbersome. IRC every time before I opened a program, I had to manually change the active audio device to the one created by virtual_oss, so this isn't really a viable alternative to using a user space sound system.

But maybe I am just using virtual_oss the wrong way. So far if I wanted to have per applicaton volume control using virtual_oss I launched a new virual_oss instance for every program. If there is any better way of doing this using virtual_oss any advice would be appreciated.

I am not an expert in the FreeBSD audio stack, so it would be nice if someone explained what the man page is referring to, because from my experience this section can be really confusing to new users.
 
VPC is transparent. Either an application uses OSSv4 API (like SNDCTL_DSP_SETPLAYVOL) or opens /dev/mixer after /dev/dsp (aka hw.snd.vpc_mixer_bypass=1). To inspect or change VPC outside of applications use mixer -f /dev/dsp%d.vp%d (substitute %d with real values) or try the following:
Code:
$ 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.
 
VPC is transparent. Either an application uses OSSv4 API (like SNDCTL_DSP_SETPLAYVOL) or opens /dev/mixer after /dev/dsp (aka hw.snd.vpc_mixer_bypass=1). To inspect or change VPC outside of applications use mixer -f /dev/dsp%d.vp%d (substitute %d with real values) or try the following:
Code:
$ 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.
Awesome! This is exactly the info I was looking for. Somehow I never noticed the dsp%d.vp%d files in /dev. Everything works a expected. I wonder why nobody ever wrote a GUI wrapper for this functionality.

It would be great, if the documentation was a bit more specific about this topic. Can you share the resources where you found this script and info?

Thanks for your help!
 
Back
Top