From: Adrian McMenamin <adrian@mcmen.demon.co.uk>
To: alsa-devel@alsa-project.org
Subject: More mixer questions
Date: Sun, 02 Apr 2006 00:18:27 +0100 [thread overview]
Message-ID: <1143933507.9228.60.camel@localhost.localdomain> (raw)
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
next reply other threads:[~2006-04-01 23:18 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-04-01 23:18 Adrian McMenamin [this message]
2006-04-02 3:09 ` More mixer questions Lee Revell
2006-04-02 9:39 ` Adrian McMenamin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1143933507.9228.60.camel@localhost.localdomain \
--to=adrian@mcmen.demon.co.uk \
--cc=alsa-devel@alsa-project.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox