mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-12-25 04:06:03 +00:00
$mixer: report more reasonable values for mono devices
This commit is contained in:
parent
2f2480833f
commit
540f78f0bd
@ -52,6 +52,7 @@
|
|||||||
|
|
||||||
static int mixer_fd;
|
static int mixer_fd;
|
||||||
static const char *devs[] = SOUND_DEVICE_NAMES;
|
static const char *devs[] = SOUND_DEVICE_NAMES;
|
||||||
|
static int stereo_flags;
|
||||||
|
|
||||||
int mixer_init(const char *name)
|
int mixer_init(const char *name)
|
||||||
{
|
{
|
||||||
@ -70,6 +71,8 @@ int mixer_init(const char *name)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ioctl(mixer_fd, SOUND_MIXER_READ_STEREODEVS, &stereo_flags);
|
||||||
|
|
||||||
for (i = 0; i < sizeof(devs) / sizeof(const char *); i++) {
|
for (i = 0; i < sizeof(devs) / sizeof(const char *); i++) {
|
||||||
if (strcasecmp(devs[i], name) == 0) {
|
if (strcasecmp(devs[i], name) == 0) {
|
||||||
return i;
|
return i;
|
||||||
@ -93,6 +96,11 @@ static int mixer_get(int i)
|
|||||||
}
|
}
|
||||||
rep = 0;
|
rep = 0;
|
||||||
|
|
||||||
|
if(!(stereo_flags & (1<<i))) {
|
||||||
|
val &= 0xFF;
|
||||||
|
val |= val << 8;
|
||||||
|
}
|
||||||
|
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user