⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 p16v.c

📁 linux-2.6.15.6
💻 C
📖 第 1 页 / 共 3 页
字号:
	int high_low = 0;	int reg = PLAYBACK_VOLUME_MIXER8;        return snd_p16v_volume_get(kcontrol, ucontrol, reg, high_low);}static int snd_p16v_volume_get_spdif_rear(snd_kcontrol_t * kcontrol,                                       snd_ctl_elem_value_t * ucontrol){	int high_low = 1;	int reg = PLAYBACK_VOLUME_MIXER8;        return snd_p16v_volume_get(kcontrol, ucontrol, reg, high_low);}static int snd_p16v_volume_get_analog_front(snd_kcontrol_t * kcontrol,                                       snd_ctl_elem_value_t * ucontrol){	int high_low = 0;	int reg = PLAYBACK_VOLUME_MIXER9;        return snd_p16v_volume_get(kcontrol, ucontrol, reg, high_low);}static int snd_p16v_volume_get_analog_center_lfe(snd_kcontrol_t * kcontrol,                                       snd_ctl_elem_value_t * ucontrol){	int high_low = 1;	int reg = PLAYBACK_VOLUME_MIXER9;        return snd_p16v_volume_get(kcontrol, ucontrol, reg, high_low);}static int snd_p16v_volume_get_analog_rear(snd_kcontrol_t * kcontrol,                                       snd_ctl_elem_value_t * ucontrol){	int high_low = 1;	int reg = PLAYBACK_VOLUME_MIXER10;        return snd_p16v_volume_get(kcontrol, ucontrol, reg, high_low);}static int snd_p16v_volume_get_analog_unknown(snd_kcontrol_t * kcontrol,                                       snd_ctl_elem_value_t * ucontrol){	int high_low = 0;	int reg = PLAYBACK_VOLUME_MIXER10;        return snd_p16v_volume_get(kcontrol, ucontrol, reg, high_low);}static int snd_p16v_volume_put(snd_kcontrol_t * kcontrol,                                       snd_ctl_elem_value_t * ucontrol, int reg, int high_low){        emu10k1_t *emu = snd_kcontrol_chip(kcontrol);        u32 value;        value = snd_emu10k1_ptr20_read(emu, reg, 0);        //value = value & 0xffff;	if (high_low == 1) {		value &= 0xffff;	        value = value | ((0xff - ucontrol->value.integer.value[0]) << 24) | ((0xff - ucontrol->value.integer.value[1]) << 16);	} else {		value &= 0xffff0000;        	value = value | ((0xff - ucontrol->value.integer.value[0]) << 8) | ((0xff - ucontrol->value.integer.value[1]) );	}        	snd_emu10k1_ptr20_write(emu, reg, 0, value);        return 1;}static int snd_p16v_volume_put_spdif_front(snd_kcontrol_t * kcontrol,                                       snd_ctl_elem_value_t * ucontrol){	int high_low = 0;	int reg = PLAYBACK_VOLUME_MIXER7;        return snd_p16v_volume_put(kcontrol, ucontrol, reg, high_low);}static int snd_p16v_volume_put_spdif_center_lfe(snd_kcontrol_t * kcontrol,                                       snd_ctl_elem_value_t * ucontrol){	int high_low = 1;	int reg = PLAYBACK_VOLUME_MIXER7;        return snd_p16v_volume_put(kcontrol, ucontrol, reg, high_low);}static int snd_p16v_volume_put_spdif_unknown(snd_kcontrol_t * kcontrol,                                       snd_ctl_elem_value_t * ucontrol){	int high_low = 0;	int reg = PLAYBACK_VOLUME_MIXER8;        return snd_p16v_volume_put(kcontrol, ucontrol, reg, high_low);}static int snd_p16v_volume_put_spdif_rear(snd_kcontrol_t * kcontrol,                                       snd_ctl_elem_value_t * ucontrol){	int high_low = 1;	int reg = PLAYBACK_VOLUME_MIXER8;        return snd_p16v_volume_put(kcontrol, ucontrol, reg, high_low);}static int snd_p16v_volume_put_analog_front(snd_kcontrol_t * kcontrol,                                       snd_ctl_elem_value_t * ucontrol){	int high_low = 0;	int reg = PLAYBACK_VOLUME_MIXER9;        return snd_p16v_volume_put(kcontrol, ucontrol, reg, high_low);}static int snd_p16v_volume_put_analog_center_lfe(snd_kcontrol_t * kcontrol,                                       snd_ctl_elem_value_t * ucontrol){	int high_low = 1;	int reg = PLAYBACK_VOLUME_MIXER9;        return snd_p16v_volume_put(kcontrol, ucontrol, reg, high_low);}static int snd_p16v_volume_put_analog_rear(snd_kcontrol_t * kcontrol,                                       snd_ctl_elem_value_t * ucontrol){	int high_low = 1;	int reg = PLAYBACK_VOLUME_MIXER10;        return snd_p16v_volume_put(kcontrol, ucontrol, reg, high_low);}static int snd_p16v_volume_put_analog_unknown(snd_kcontrol_t * kcontrol,                                       snd_ctl_elem_value_t * ucontrol){	int high_low = 0;	int reg = PLAYBACK_VOLUME_MIXER10;        return snd_p16v_volume_put(kcontrol, ucontrol, reg, high_low);}static snd_kcontrol_new_t snd_p16v_volume_control_analog_front ={        .iface =        SNDRV_CTL_ELEM_IFACE_MIXER,        .name =         "HD Analog Front Playback Volume",        .info =         snd_p16v_volume_info,        .get =          snd_p16v_volume_get_analog_front,        .put =          snd_p16v_volume_put_analog_front};static snd_kcontrol_new_t snd_p16v_volume_control_analog_center_lfe ={        .iface =        SNDRV_CTL_ELEM_IFACE_MIXER,        .name =         "HD Analog Center/LFE Playback Volume",        .info =         snd_p16v_volume_info,        .get =          snd_p16v_volume_get_analog_center_lfe,        .put =          snd_p16v_volume_put_analog_center_lfe};static snd_kcontrol_new_t snd_p16v_volume_control_analog_unknown ={        .iface =        SNDRV_CTL_ELEM_IFACE_MIXER,        .name =         "HD Analog Unknown Playback Volume",        .info =         snd_p16v_volume_info,        .get =          snd_p16v_volume_get_analog_unknown,        .put =          snd_p16v_volume_put_analog_unknown};static snd_kcontrol_new_t snd_p16v_volume_control_analog_rear ={        .iface =        SNDRV_CTL_ELEM_IFACE_MIXER,        .name =         "HD Analog Rear Playback Volume",        .info =         snd_p16v_volume_info,        .get =          snd_p16v_volume_get_analog_rear,        .put =          snd_p16v_volume_put_analog_rear};static snd_kcontrol_new_t snd_p16v_volume_control_spdif_front ={        .iface =        SNDRV_CTL_ELEM_IFACE_MIXER,        .name =         "HD SPDIF Front Playback Volume",        .info =         snd_p16v_volume_info,        .get =          snd_p16v_volume_get_spdif_front,        .put =          snd_p16v_volume_put_spdif_front};static snd_kcontrol_new_t snd_p16v_volume_control_spdif_center_lfe ={        .iface =        SNDRV_CTL_ELEM_IFACE_MIXER,        .name =         "HD SPDIF Center/LFE Playback Volume",        .info =         snd_p16v_volume_info,        .get =          snd_p16v_volume_get_spdif_center_lfe,        .put =          snd_p16v_volume_put_spdif_center_lfe};static snd_kcontrol_new_t snd_p16v_volume_control_spdif_unknown ={        .iface =        SNDRV_CTL_ELEM_IFACE_MIXER,        .name =         "HD SPDIF Unknown Playback Volume",        .info =         snd_p16v_volume_info,        .get =          snd_p16v_volume_get_spdif_unknown,        .put =          snd_p16v_volume_put_spdif_unknown};static snd_kcontrol_new_t snd_p16v_volume_control_spdif_rear ={        .iface =        SNDRV_CTL_ELEM_IFACE_MIXER,        .name =         "HD SPDIF Rear Playback Volume",        .info =         snd_p16v_volume_info,        .get =          snd_p16v_volume_get_spdif_rear,        .put =          snd_p16v_volume_put_spdif_rear};static int snd_p16v_capture_source_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo){	static char *texts[8] = { "SPDIF", "I2S", "SRC48", "SRCMulti_SPDIF", "SRCMulti_I2S", "CDIF", "FX", "AC97" };	uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;	uinfo->count = 1;	uinfo->value.enumerated.items = 8;	if (uinfo->value.enumerated.item > 7)                uinfo->value.enumerated.item = 7;	strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);	return 0;}static int snd_p16v_capture_source_get(snd_kcontrol_t * kcontrol,					snd_ctl_elem_value_t * ucontrol){	emu10k1_t *emu = snd_kcontrol_chip(kcontrol);	ucontrol->value.enumerated.item[0] = emu->p16v_capture_source;	return 0;}static int snd_p16v_capture_source_put(snd_kcontrol_t * kcontrol,					snd_ctl_elem_value_t * ucontrol){	emu10k1_t *emu = snd_kcontrol_chip(kcontrol);	unsigned int val;	int change = 0;	u32 mask;	u32 source;	val = ucontrol->value.enumerated.item[0] ;	change = (emu->p16v_capture_source != val);	if (change) {		emu->p16v_capture_source = val;		source = (val << 28) | (val << 24) | (val << 20) | (val << 16);		mask = snd_emu10k1_ptr20_read(emu, BASIC_INTERRUPT, 0) & 0xffff;		snd_emu10k1_ptr20_write(emu, BASIC_INTERRUPT, 0, source | mask);	}        return change;}static snd_kcontrol_new_t snd_p16v_capture_source __devinitdata ={	.iface =	SNDRV_CTL_ELEM_IFACE_MIXER,	.name =		"HD source Capture",	.info =		snd_p16v_capture_source_info,	.get =		snd_p16v_capture_source_get,	.put =		snd_p16v_capture_source_put};static int snd_p16v_capture_channel_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo){	static char *texts[4] = { "0", "1", "2", "3",  };	uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;	uinfo->count = 1;	uinfo->value.enumerated.items = 4;	if (uinfo->value.enumerated.item > 3)                uinfo->value.enumerated.item = 3;	strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);	return 0;}static int snd_p16v_capture_channel_get(snd_kcontrol_t * kcontrol,					snd_ctl_elem_value_t * ucontrol){	emu10k1_t *emu = snd_kcontrol_chip(kcontrol);	ucontrol->value.enumerated.item[0] = emu->p16v_capture_channel;	return 0;}static int snd_p16v_capture_channel_put(snd_kcontrol_t * kcontrol,					snd_ctl_elem_value_t * ucontrol){	emu10k1_t *emu = snd_kcontrol_chip(kcontrol);	unsigned int val;	int change = 0;	u32 tmp;	val = ucontrol->value.enumerated.item[0] ;	change = (emu->p16v_capture_channel != val);	if (change) {		emu->p16v_capture_channel = val;		tmp = snd_emu10k1_ptr20_read(emu, CAPTURE_P16V_SOURCE, 0) & 0xfffc;		snd_emu10k1_ptr20_write(emu, CAPTURE_P16V_SOURCE, 0, tmp | val);	}        return change;}static snd_kcontrol_new_t snd_p16v_capture_channel __devinitdata ={	.iface =	SNDRV_CTL_ELEM_IFACE_MIXER,	.name =		"HD channel Capture",	.info =		snd_p16v_capture_channel_info,	.get =		snd_p16v_capture_channel_get,	.put =		snd_p16v_capture_channel_put};int snd_p16v_mixer(emu10k1_t *emu){        int err;        snd_kcontrol_t *kctl;        snd_card_t *card = emu->card;        if ((kctl = snd_ctl_new1(&snd_p16v_volume_control_analog_front, emu)) == NULL)                return -ENOMEM;        if ((err = snd_ctl_add(card, kctl)))                return err;        if ((kctl = snd_ctl_new1(&snd_p16v_volume_control_analog_rear, emu)) == NULL)                return -ENOMEM;        if ((err = snd_ctl_add(card, kctl)))                return err;        if ((kctl = snd_ctl_new1(&snd_p16v_volume_control_analog_center_lfe, emu)) == NULL)                return -ENOMEM;        if ((err = snd_ctl_add(card, kctl)))                return err;        if ((kctl = snd_ctl_new1(&snd_p16v_volume_control_analog_unknown, emu)) == NULL)                return -ENOMEM;        if ((err = snd_ctl_add(card, kctl)))                return err;        if ((kctl = snd_ctl_new1(&snd_p16v_volume_control_spdif_front, emu)) == NULL)                return -ENOMEM;        if ((err = snd_ctl_add(card, kctl)))                return err;        if ((kctl = snd_ctl_new1(&snd_p16v_volume_control_spdif_rear, emu)) == NULL)                return -ENOMEM;        if ((err = snd_ctl_add(card, kctl)))                return err;        if ((kctl = snd_ctl_new1(&snd_p16v_volume_control_spdif_center_lfe, emu)) == NULL)                return -ENOMEM;        if ((err = snd_ctl_add(card, kctl)))                return err;        if ((kctl = snd_ctl_new1(&snd_p16v_volume_control_spdif_unknown, emu)) == NULL)                return -ENOMEM;        if ((err = snd_ctl_add(card, kctl)))                return err;        if ((kctl = snd_ctl_new1(&snd_p16v_capture_source, emu)) == NULL)                return -ENOMEM;        if ((err = snd_ctl_add(card, kctl)))                return err;        if ((kctl = snd_ctl_new1(&snd_p16v_capture_channel, emu)) == NULL)                return -ENOMEM;        if ((err = snd_ctl_add(card, kctl)))                return err;        return 0;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -