HH
VS1005 VSOS A
UDIO
S
UBSYSTEM
VS1005g
11.4
Volume Control
11.4.1
IOCTL_AUDIO_GET_VOLUME
Get volume. Volume is a number between 0 - 511 where 256 is full-scale, and each
successive number represents a volume gain step of -0.5 dB. See table below:
IOCTL_AUDIO_GET_VOLUME argument table
Argument
Amplification
Description
0
+128.0 dB
Insane amplification
1
+127.5 dB
Insane amplification minus 0.5 dB
...
...
...
255
+0.5 dB
Slightly louder than full-scale volume
256
0.0 dB
Full-scale volume
257
-0.5 dB
Almost full-scale volume
...
...
...
509
-126.0 dB
Very silent
510
-
∞
dB
No sound, may not turn off driver
511
-
∞
dB
No sound, may turn off driver
A driver may limit the range it actually accepts for its volume settings. E.g. the analog
output driver AUODAC only supports the range between 256 (0.0 dB) and 511 (analog
driver power-down). As another example, the S/PDIF driver supports the range between
208 (+24.0 dB) and 511 (silence). If a driver does not support the whole range, it will
automatically limit itself so you can still call it with the extreme values.
511 is a special value that allows e.g. the audio driver to turn itself off (supported by e.g.
AUODAC). Use with caution!
Example:
volume = ioctl(fp, IOCTL_AUDIO_GET_VOLUME, NULL);
11.4.2
IOCTL_AUDIO_SET_VOLUME
Set volume. Scale for volume is the same as for IOCTL_AUDIO_GET_VOLUME (Chap-
ter 11.4.1).
Example:
/* Set full scale volume */
if (ioctl(fp, IOCTL_AUDIO_SET_VOLUME, (char *)(256))) {
printf("Couldn't set volume\n");
}
Rev. 3.57
2019-04-10
Page