Fixed volume control with OSS
This commit is contained in:
parent
7ee653ffa2
commit
d4436e172c
|
@ -58,6 +58,7 @@ PanelApplet applet =
|
||||||
typedef struct _Volume
|
typedef struct _Volume
|
||||||
{
|
{
|
||||||
PanelAppletHelper * helper;
|
PanelAppletHelper * helper;
|
||||||
|
char const * device;
|
||||||
#ifdef AUDIO_MIXER_DEVINFO
|
#ifdef AUDIO_MIXER_DEVINFO
|
||||||
int fd;
|
int fd;
|
||||||
int mix;
|
int mix;
|
||||||
|
@ -121,7 +122,6 @@ static void _volume_destroy(PanelApplet * applet)
|
||||||
static Volume * _volume_new(PanelAppletHelper * helper)
|
static Volume * _volume_new(PanelAppletHelper * helper)
|
||||||
{
|
{
|
||||||
Volume * volume;
|
Volume * volume;
|
||||||
char const * mixer;
|
|
||||||
#ifdef AUDIO_MIXER_DEVINFO
|
#ifdef AUDIO_MIXER_DEVINFO
|
||||||
int i;
|
int i;
|
||||||
mixer_devinfo_t md;
|
mixer_devinfo_t md;
|
||||||
|
@ -133,15 +133,15 @@ static Volume * _volume_new(PanelAppletHelper * helper)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
volume->helper = helper;
|
volume->helper = helper;
|
||||||
|
if((volume->device = helper->config_get(helper->priv, "volume",
|
||||||
|
"device")) == NULL)
|
||||||
|
volume->device = "/dev/mixer";
|
||||||
#ifdef AUDIO_MIXER_DEVINFO
|
#ifdef AUDIO_MIXER_DEVINFO
|
||||||
volume->mix = -1;
|
volume->mix = -1;
|
||||||
volume->outputs = -1;
|
volume->outputs = -1;
|
||||||
if((mixer = helper->config_get(helper->priv, "volume", "device"))
|
if((volume->fd = open(volume->device, O_RDWR)) < 0)
|
||||||
== NULL)
|
|
||||||
mixer = "/dev/mixer";
|
|
||||||
if((volume->fd = open(mixer, O_RDWR)) < 0)
|
|
||||||
{
|
{
|
||||||
helper->error(helper->priv, mixer, 0);
|
helper->error(helper->priv, volume->device, 0);
|
||||||
return volume;
|
return volume;
|
||||||
}
|
}
|
||||||
for(i = 0; volume->outputs == -1 || volume->mix == -1; i++)
|
for(i = 0; volume->outputs == -1 || volume->mix == -1; i++)
|
||||||
|
@ -157,8 +157,8 @@ static Volume * _volume_new(PanelAppletHelper * helper)
|
||||||
volume->mix = i;
|
volume->mix = i;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
if((volume->fd = open(mixer, O_RDWR)) < 0)
|
if((volume->fd = open(volume->device, O_RDWR)) < 0)
|
||||||
helper->error(helper->priv, mixer, 0);
|
helper->error(helper->priv, volume->device, 0);
|
||||||
#endif
|
#endif
|
||||||
return volume;
|
return volume;
|
||||||
}
|
}
|
||||||
|
@ -169,10 +169,10 @@ static void _volume_delete(Volume * volume)
|
||||||
{
|
{
|
||||||
#ifdef AUDIO_MIXER_DEVINFO
|
#ifdef AUDIO_MIXER_DEVINFO
|
||||||
if(volume->fd >= 0 && close(volume->fd) != 0)
|
if(volume->fd >= 0 && close(volume->fd) != 0)
|
||||||
volume->helper->error(volume->helper->priv, "/dev/mixer", 0);
|
volume->helper->error(volume->helper->priv, volume->device, 0);
|
||||||
#else /* XXX equivalent for now */
|
#else /* XXX equivalent for now */
|
||||||
if(volume->fd >= 0 && close(volume->fd) != 0)
|
if(volume->fd >= 0 && close(volume->fd) != 0)
|
||||||
volume->helper->error(volume->helper->priv, "/dev/mixer", 0);
|
volume->helper->error(volume->helper->priv, volume->device, 0);
|
||||||
#endif
|
#endif
|
||||||
free(volume);
|
free(volume);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user