# BT speaker with virual_oss volume level



## holala (May 15, 2021)

I managed to run my Chinese BT amp with FreeBSD. I didn't find how to control the audio level. I use the following command to establish a connection with the BT:
`virtual_oss -B -C 2 -c 2 -r 48000 -b 16 -s 768 -R /dev/null -P /dev/bluetooth/Xpecial_Audio -d dsp`

/dev/sndstat isn't changed with a new audio deivce, also mixer -f /dev/pcm* doesn't influence the audio level, when I tried all the devices. Maybe I misunderstand how virtual_oss works? How do I control the overall volume level of the BT speaker?

Thanks!


----------



## Tieks (May 15, 2021)

holala said:
			
		

> How do I control the overall volume level of the BT speaker?



Is the dsp device you are using working in bitperfect mode? When I use Audacious to play music files to a digital device in bitperfect mode, the volume control in Audacious does not work. When I switch off bitperfect mode and restart Audacious the volume control will work. Mixer may give the same result.


----------



## holala (May 16, 2021)

`sysctl -a | grep bitperf` returns 0 for dev.pcm.*

But I don't think that I point `mixer` to the proper device. When I create bluetooth /dev/dsp with virtual_oss, mixer -f /dev/dsp0.0 doesn't return error, but also doesn't change anything.

In order to get my sound back on the laptop speakers I kill virtual_oss and create a new dsp device:
`virtual_oss -B -C 2 -c 2 -r 48000 -b 16 -s 768 -R /dev/null -P /dev/dsp0 -d dsp`

Now `mixer vol 100` and `mixer pcm 100` affect the volume level. But if I try `mixer -f /dev/dsp0.0` it says "Device busy". Obviously I point mixer to the wrong device.

Actually I'm a bit confused with `virtual_oss`. It should be possible to have the BT speaker and the laptop speakers simultaneously. Then how do I select the target output device on application level?


----------



## hselasky@ (May 16, 2021)

Hi,
You can now switch audio device like this (Given you pass the `-T vdsp.ctl` option to `virtual_oss`):

To change the recording device
`virtual_oss_cmd /dev/vdsp.ctl -R /dev/dsp4`
To change the playback device
`virtual_oss_cmd /dev/vdsp.ctl -P /dev/dsp4`
virtual_oss could technically be extended to supply audio to multiple audio devices, but currently only supports one source and sink device due to problems with jittter and sample rate differences.

Use `virtual_oss_ctl` to change the volume levels.

Also refer to the `-a X` option to pre-set gain values.

--HPS


----------

