More mixer questions
Sorry to hit the list with another question about the mixer/control stuff, but I'm pretty puzzled as to what I am getting wrong.
I am using mpg123 compiled to only hack oss, so I am reliant on oss emulation.
I have the control code attached below, which defines both master and pcm functions (mapped together as the device only plays PCM).
By default I get this:
/ # cat /proc/asound/card0/oss_mixer
VOLUME "" 0
BASS "" 0
TREBLE "" 0
SYNTH "" 0
PCM "" 0
SPEAKER "" 0
LINE "" 0
MIC "" 0
CD "" 0
IMIX "" 0
ALTPCM "" 0
RECLEV "" 0
IGAIN "" 0
OGAIN "" 0
LINE1 "" 0
LINE2 "" 0
LINE3 "" 0
DIGITAL1 "" 0
DIGITAL2 "" 0
DIGITAL3 "" 0
PHONEIN "" 0
PHONEOUT "" 0
VIDEO "" 0
RADIO "" 0
MONITOR "" 0
ie nothing mapped against oss. But if I do this:
echo 'VOLUME "PCM" 0' > /proc/asound/card0/oss_mixer or
echo 'VOLUME "Master" 0' > /proc/asound/card0/oss_mixer
Then I get control of gain... so why doesn't the mapping work by default?
/* Mixer controls */
static int aica_pcmswitch_info(snd_kcontrol_t * kcontrol,
snd_ctl_elem_info_t * uinfo)
{
uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
uinfo->count = 1;
uinfo->value.integer.min = 0;
uinfo->value.integer.max = 1;
return 0;
}static int aica_pcmswitch_get(snd_kcontrol_t * kcontrol,
snd_ctl_elem_value_t * ucontrol)
{
ucontrol->value.integer.value[0] = 1; /* TO DO: Fix me */
return 0;
}static int aica_pcmswitch_put(snd_kcontrol_t * kcontrol,
snd_ctl_elem_value_t * ucontrol)
{
if (ucontrol->value.integer.value[0] == 1)
return 0; /* TO DO: Fix me */
else
aica_chn_halt();
return 0;
}static snd_kcontrol_new_t snd_aica_masterswitch_control __devinitdata = {
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.name = "Master Playback Switch",
.info = aica_pcmswitch_info,
.get = aica_pcmswitch_get,
.put = aica_pcmswitch_put
};
static snd_kcontrol_new_t snd_aica_pcmswitch_control __devinitdata = {
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.name = "PCM Playback Switch",
.index = 0,
.info = aica_pcmswitch_info,
.get = aica_pcmswitch_get,
.put = aica_pcmswitch_put
};
static int aica_pcmvolume_info(snd_kcontrol_t * kcontrol,
snd_ctl_elem_info_t * uinfo)
{
uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; uinfo->count = 1; uinfo->value.integer.min = 0; uinfo->value.integer.max = 0xFF; return 0; }
static int aica_pcmvolume_get(snd_kcontrol_t * kcontrol,
snd_ctl_elem_value_t * ucontrol)
{
if (!channel)
return -ETXTBSY; /* we've not yet been set up */
ucontrol->value.integer.value[0] = channel->vol;
return 0;
}static int aica_pcmvolume_put(snd_kcontrol_t * kcontrol,
snd_ctl_elem_value_t * ucontrol)
{
if (!channel) {
snd_printk("No channel yet\n");
return -ETXTBSY; /* too soon */
}
else if (channel->vol == ucontrol->value.integer.value[0])
return 0;
else {
channel->vol = ucontrol->value.integer.value[0];
dreamcastcard->master_volume = ucontrol->value.integer.value[0];
spu_memload(AICA_CHANNEL0_CONTROL_OFFSET,
(uint8_t *) channel, sizeof(aica_channel_t));
}
return 1;
}static snd_kcontrol_new_t snd_aica_mastervolume_control __devinitdata = {
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.name = "Master Playback Volume",
.info = aica_pcmvolume_info,
.get = aica_pcmvolume_get,
.put = aica_pcmvolume_put
};
static snd_kcontrol_new_t snd_aica_pcmvolume_control __devinitdata = {
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.name = "PCM Playback Volume",
.index = 0,
.info = aica_pcmvolume_info,
.get = aica_pcmvolume_get,
.put = aica_pcmvolume_put
};
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
Quoted 8 lines · Adrian McMenamin
Sorry to hit the list with another question about the mixer/control stuff, but I'm pretty puzzled as to what I am getting wrong.
I am using mpg123 compiled to only hack oss, so I am reliant on oss emulation.
I have the control code attached below, which defines both master and pcm functions (mapped together as the device only plays PCM).
Where's your __devinit snd_aica_mixer() routine that actually creates the mixer controls, with snd_ctl_new1()?
Look at snd_emu10k1_mixer in alsa-kernel/pci/emu10k1/emumixer.c for example...
Lee
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
Quoted 4 lines · Lee Revell
Quoted 3 lines · Adrian McMenamin
Sorry to hit the list with another question about the mixer/control stuff, but I'm pretty puzzled as to what I am getting wrong.
Quoted 8 lines
Quoted 5 lines
I am using mpg123 compiled to only hack oss, so I am reliant on oss emulation.
I have the control code attached below, which defines both master and pcm functions (mapped together as the device only plays PCM).
Where's your
__devinitsnd_aica_mixer()routine that actually creates the mixer controls, withsnd_ctl_new1()?
The controls do work though, and they are being created - the code fragment is below (with lots of printks for debugging)
static int __devinit add_aicamixer_controls()
{
int err;
err = snd_ctl_add
(dreamcastcard->card,
snd_ctl_new1(&snd_aica_pcmvolume_control,
dreamcastcard));
if (err < 0){
snd_printk("pcmvolume failed\n");
return err;
}
err= snd_ctl_add
(dreamcastcard->card,
snd_ctl_new1(&snd_aica_pcmswitch_control,
dreamcastcard));
if (err < 0){
snd_printk("pcmswitch failed\n");
return err;
}
err = snd_ctl_add
(dreamcastcard->card,
snd_ctl_new1(&snd_aica_mastervolume_control,
dreamcastcard));
if (err < 0){
snd_printk("mastervolume failed\n");
return err;
}
err = snd_ctl_add
(dreamcastcard->card,
snd_ctl_new1(&snd_aica_masterswitch_control,
dreamcastcard));
if (err < 0){
snd_printk("masterswitch failed\n");
return err;
}
/* succeeded */
return 0;
}-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642