I am starting this email again. I know I had one response before but I can not get to it. Most of our office building has burnt down to the ground. It has taken a while to get things back up and for me to be able to get back to this.
I am new to alsa and I am trying to write a raw-midi device driver. When I tried to add the volume control I could not compile the file anymore. I am hoping someone can help me and see what I am missing. I have looked in the Writing an Alsa Driver chapter 6 and I have looked at dummy.c . I believe I am following what they say to do but when I compile the file I get many errors including "warning: "struct snd_ctl_elem_info declared inside parameter list" I have at the top of my file #include <sound/control.h> along with the other includes I see in the sample files. Below is the code I added.
static int snd_ld_volume_info(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_info *uinfo)
{
uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
uinfo->count = 1;
uinfo->value.integer.min = 0;
uinfo->value.integer.max = 127;
return 0;
}
static int snd_ld_volume_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
struct snd_card_ld *ld = snd_kcontrol_chip(kcontrol);
int addr = kcontrol->private_value;
spin_lock_irq(&ld->mixer_lock);
ucontrol->value.integer.value[0] = ld->mixer_volume[addr];
spin_unlock_irq(&ld->mixer_lock);
return 0;
}
static int snd_ld_volume_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
struct snd_card_ld *ld = snd_kcontrol_chip(kcontrol);
int changed = 0, addr = kcontrol->private_value;
int value;
value = ucontrol->value.integer.value[0];
if (value < 0)
value = 0;
if (value > 127)
value = 127;
spin_lock_irq(&ld->mixer_lock);
changed = ld->mixer_volume[addr] != value;
ld->mixer_volume[addr] = value;
spin_unlock_irq(&ld->mixer_lock);
return changed;
}
static struct snd_kcontrol_new snd_ld_volume = {
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.name = "Master Playback Volume",
.index = 0,
.info = snd_ld_volume_info,
.get = snd_ld_volume_get,
.put = snd_ld_volume_put,
.private_value = addr
};
static int __init snd_card_ld_new_mixer(struct snd_card_ld *ld)
{
struct snd_card *card = ld->card;
int err;
snd_assert(ld != NULL, return -EINVAL);
spin_lock_init(&ld->mixer_lock);
strcpy(card->mixername, "LD Mixer");
if ((err = snd_ctl_add(card, snd_ctl_new1(&snd_ld_volume, ld)))
< 0)
return err;
return 0;
}
static int __init snd_card_ld_probe(int dev)
{
snd_card_t *card;
struct snd_card_ld *ld;
int err;
(many things, deleted here since I believe not relevent to problem)
/* add mixer volume */
if ((err = snd_card_ld_new_mixer(ld)) < 0)
return err;
attached is the error output from trying to compile this.
<<output2.txt>>
/usr/src/alsa/alsa-driver-1.0.8/drivers/cpld.c:997: warning: "struct snd_ctl_elem_info" declared inside parameter list
/usr/src/alsa/alsa-driver-1.0.8/drivers/cpld.c:997: warning: its scope is only this definition or declaration, which is probably not what you want
/usr/src/alsa/alsa-driver-1.0.8/drivers/cpld.c:997: warning: "struct snd_kcontrol" declared inside parameter list
/usr/src/alsa/alsa-driver-1.0.8/drivers/cpld.c: In function `snd_ld_volume_info':
/usr/src/alsa/alsa-driver-1.0.8/drivers/cpld.c:999: error: dereferencing pointer to incomplete type
/usr/src/alsa/alsa-driver-1.0.8/drivers/cpld.c:1000: error: dereferencing pointer to incomplete type
/usr/src/alsa/alsa-driver-1.0.8/drivers/cpld.c:1001: error: dereferencing pointer to incomplete type
/usr/src/alsa/alsa-driver-1.0.8/drivers/cpld.c:1002: error: dereferencing pointer to incomplete type
/usr/src/alsa/alsa-driver-1.0.8/drivers/cpld.c: At top level:
/usr/src/alsa/alsa-driver-1.0.8/drivers/cpld.c:1007: warning: "struct snd_ctl_elem_value" declared inside parameter list
/usr/src/alsa/alsa-driver-1.0.8/drivers/cpld.c:1007: warning: "struct snd_kcontrol" declared inside parameter list
/usr/src/alsa/alsa-driver-1.0.8/drivers/cpld.c: In function `snd_ld_volume_get':
/usr/src/alsa/alsa-driver-1.0.8/drivers/cpld.c:1009: error: dereferencing pointer to incomplete type
/usr/src/alsa/alsa-driver-1.0.8/drivers/cpld.c:1010: error: dereferencing pointer to incomplete type
/usr/src/alsa/alsa-driver-1.0.8/drivers/cpld.c:1013: error: dereferencing pointer to incomplete type
/usr/src/alsa/alsa-driver-1.0.8/drivers/cpld.c: At top level:
/usr/src/alsa/alsa-driver-1.0.8/drivers/cpld.c:1019: warning: "struct snd_ctl_elem_value" declared inside parameter list
/usr/src/alsa/alsa-driver-1.0.8/drivers/cpld.c:1019: warning: "struct snd_kcontrol" declared inside parameter list
/usr/src/alsa/alsa-driver-1.0.8/drivers/cpld.c: In function `snd_ld_volume_put':
/usr/src/alsa/alsa-driver-1.0.8/drivers/cpld.c:1021: error: dereferencing pointer to incomplete type
/usr/src/alsa/alsa-driver-1.0.8/drivers/cpld.c:1022: error: dereferencing pointer to incomplete type
/usr/src/alsa/alsa-driver-1.0.8/drivers/cpld.c:1025: error: dereferencing pointer to incomplete type
/usr/src/alsa/alsa-driver-1.0.8/drivers/cpld.c: At top level:
/usr/src/alsa/alsa-driver-1.0.8/drivers/cpld.c:1037: error: variable `snd_ld_volume' has initializer but incomplete type
/usr/src/alsa/alsa-driver-1.0.8/drivers/cpld.c:1038: error: unknown field `iface' specified in initializer
/usr/src/alsa/alsa-driver-1.0.8/drivers/cpld.c:1038: warning: excess elements in struct initializer
/usr/src/alsa/alsa-driver-1.0.8/drivers/cpld.c:1038: warning: (near initialization for `snd_ld_volume')
/usr/src/alsa/alsa-driver-1.0.8/drivers/cpld.c:1039: error: unknown field `name' specified in initializer
/usr/src/alsa/alsa-driver-1.0.8/drivers/cpld.c:1039: warning: excess elements in struct initializer
/usr/src/alsa/alsa-driver-1.0.8/drivers/cpld.c:1039: warning: (near initialization for `snd_ld_volume')
/usr/src/alsa/alsa-driver-1.0.8/drivers/cpld.c:1040: error: unknown field `index' specified in initializer
/usr/src/alsa/alsa-driver-1.0.8/drivers/cpld.c:1040: warning: excess elements in struct initializer
/usr/src/alsa/alsa-driver-1.0.8/drivers/cpld.c:1040: warning: (near initialization for `snd_ld_volume')
/usr/src/alsa/alsa-driver-1.0.8/drivers/cpld.c:1041: error: unknown field `info' specified in initializer
/usr/src/alsa/alsa-driver-1.0.8/drivers/cpld.c:1041: warning: excess elements in struct initializer
/usr/src/alsa/alsa-driver-1.0.8/drivers/cpld.c:1041: warning: (near initialization for `snd_ld_volume')
/usr/src/alsa/alsa-driver-1.0.8/drivers/cpld.c:1042: error: unknown field `get' specified in initializer
/usr/src/alsa/alsa-driver-1.0.8/drivers/cpld.c:1042: warning: excess elements in struct initializer
/usr/src/alsa/alsa-driver-1.0.8/drivers/cpld.c:1042: warning: (near initialization for `snd_ld_volume')
/usr/src/alsa/alsa-driver-1.0.8/drivers/cpld.c:1043: error: unknown field `put' specified in initializer
/usr/src/alsa/alsa-driver-1.0.8/drivers/cpld.c:1043: warning: excess elements in struct initializer
/usr/src/alsa/alsa-driver-1.0.8/drivers/cpld.c:1043: warning: (near initialization for `snd_ld_volume')
/usr/src/alsa/alsa-driver-1.0.8/drivers/cpld.c:1044: error: unknown field `private_value' specified in initializer
/usr/src/alsa/alsa-driver-1.0.8/drivers/cpld.c:1045: warning: excess elements in struct initializer
/usr/src/alsa/alsa-driver-1.0.8/drivers/cpld.c:1045: warning: (near initialization for `snd_ld_volume')
/usr/src/alsa/alsa-driver-1.0.8/drivers/cpld.c: In function `snd_card_ld_new_mixer':
/usr/src/alsa/alsa-driver-1.0.8/drivers/cpld.c:1054: error: dereferencing pointer to incomplete type
/usr/src/alsa/alsa-driver-1.0.8/drivers/cpld.c:1056: warning: passing arg 1 of `snd_ctl_new1' from incompatible pointer type
/usr/src/alsa/alsa-driver-1.0.8/drivers/cpld.c: In function `snd_card_cpld_probe':
/usr/src/alsa/alsa-driver-1.0.8/drivers/cpld.c:1102: error: `cpld' undeclared (first use in this function)
/usr/src/alsa/alsa-driver-1.0.8/drivers/cpld.c:1102: error: (Each undeclared identifier is reported only once
/usr/src/alsa/alsa-driver-1.0.8/drivers/cpld.c:1102: error: for each function it appears in.)
/usr/src/alsa/alsa-driver-1.0.8/drivers/cpld.c: At top level:
/usr/src/alsa/alsa-driver-1.0.8/drivers/cpld.c:1037: error: storage size of `snd_ld_volume' isn't known
make[4]: *** [/usr/src/alsa/alsa-driver-1.0.8/drivers/cpld.o] Error 1
make[3]: *** [/usr/src/alsa/alsa-driver-1.0.8/drivers] Error 2
make[2]: *** [_module_/usr/src/alsa/alsa-driver-1.0.8] Error 2
make[1]: *** [modules] Error 2
make: *** [compile] Error 2
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/alsa-devel