当前位置: 首页>>代码示例>>C++>>正文


C++ snd_ctl_new1函数代码示例

本文整理汇总了C++中snd_ctl_new1函数的典型用法代码示例。如果您正苦于以下问题:C++ snd_ctl_new1函数的具体用法?C++ snd_ctl_new1怎么用?C++ snd_ctl_new1使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了snd_ctl_new1函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: msm_dai_q6_hdmi_dai_probe

static int msm_dai_q6_hdmi_dai_probe(struct snd_soc_dai *dai)
{
	struct msm_dai_q6_hdmi_dai_data *dai_data;
	const struct snd_kcontrol_new *kcontrol;
	int rc = 0;

	dai_data = kzalloc(sizeof(struct msm_dai_q6_hdmi_dai_data),
		GFP_KERNEL);

	if (!dai_data) {
		dev_err(dai->dev, "DAI-%d: fail to allocate dai data\n",
		dai->id);
		rc = -ENOMEM;
	} else
		dev_set_drvdata(dai->dev, dai_data);

	kcontrol = &hdmi_config_controls[0];

	rc = snd_ctl_add(dai->card->snd_card,
					 snd_ctl_new1(kcontrol, dai_data));

	kcontrol = &hdmi_config_controls[1];

	rc = snd_ctl_add(dai->card->snd_card,
					 snd_ctl_new1(kcontrol, dai_data));

	return rc;
}
开发者ID:Ahuangshang,项目名称:Xiaomi_Kernel_OpenSource,代码行数:28,代码来源:msm-dai-q6-hdmi-v2.c

示例2: build_input

static int build_input(struct hda_codec *codec)
{
	struct cs_spec *spec = codec->spec;
	int i, err;

	if (!spec->num_inputs)
		return 0;

	/* make bind-capture */
	spec->capture_bind[0] = make_bind_capture(codec, &snd_hda_bind_sw);
	spec->capture_bind[1] = make_bind_capture(codec, &snd_hda_bind_vol);
	for (i = 0; i < 2; i++) {
		struct snd_kcontrol *kctl;
		if (!spec->capture_bind[i])
			return -ENOMEM;
		kctl = snd_ctl_new1(&cs_capture_ctls[i], codec);
		if (!kctl)
			return -ENOMEM;
		kctl->private_value = (long)spec->capture_bind[i];
		err = snd_hda_ctl_add(codec, kctl);
		if (err < 0)
			return err;
	}
	
	if (spec->num_inputs > 1 && !spec->mic_detect) {
		err = snd_hda_ctl_add(codec,
				      snd_ctl_new1(&cs_capture_source, codec));
		if (err < 0)
			return err;
	}

	return 0;
}
开发者ID:mikuhatsune001,项目名称:linux2.6.32,代码行数:33,代码来源:patch_cirrus.c

示例3: tegra_asoc_utils_register_ctls

int tegra_asoc_utils_register_ctls(struct tegra_asoc_utils_data *data)
{
	int ret = 0;
	int i;

	/* Add AVP related alsa controls */
	data->avp_device_id = -1;
	for (i = 0; i < ARRAY_SIZE(tegra_avp_controls); i++) {
		ret = snd_ctl_add(data->card->snd_card,
				snd_ctl_new1(&tegra_avp_controls[i], data));
		if (ret < 0) {
			dev_err(data->dev, "Can't add avp alsa controls");
			return ret;
		}
	}

	ret = snd_ctl_add(data->card->snd_card,
			snd_ctl_new1(&tegra_switch_controls, data));
	if (ret < 0) {
		dev_err(data->dev, "Can't add switch alsa control");
		return ret;
	}

	ret = snd_ctl_add(data->card->snd_card,
			snd_ctl_new1(&tegra_i2s_lpbk_control, data));
	if (ret < 0) {
		dev_err(data->dev, "Can't add i2s loopback control");
		return ret;
	}

	return ret;
}
开发者ID:Lloir,项目名称:nvidia-linux-3.10,代码行数:32,代码来源:tegra_asoc_utils.c

示例4: vxp_add_mic_controls

int vxp_add_mic_controls(vx_core_t *_chip)
{
	struct snd_vxpocket *chip = (struct snd_vxpocket *)_chip;
	int err;

	/* mute input levels */
	chip->mic_level = 0;
	switch (_chip->type) {
	case VX_TYPE_VXPOCKET:
		vx_set_mic_level(_chip, 0);
		break;
	case VX_TYPE_VXP440:
		vx_set_mic_boost(_chip, 0);
		break;
	}

	/* mic level */
	switch (_chip->type) {
	case VX_TYPE_VXPOCKET:
		if ((err = snd_ctl_add(_chip->card, snd_ctl_new1(&vx_control_mic_level, chip))) < 0)
			return err;
		break;
	case VX_TYPE_VXP440:
		if ((err = snd_ctl_add(_chip->card, snd_ctl_new1(&vx_control_mic_boost, chip))) < 0)
			return err;
		break;
	}

	return 0;
}
开发者ID:Antonio-Zhou,项目名称:Linux-2.6.11,代码行数:30,代码来源:vxp_mixer.c

示例5: msm_dai_q6_dai_mi2s_probe

static int msm_dai_q6_dai_mi2s_probe(struct snd_soc_dai *dai)
{
	struct msm_dai_q6_mi2s_dai_data *mi2s_dai_data =
		dev_get_drvdata(dai->dev);
	struct snd_kcontrol *kcontrol = NULL;
	int rc = 0;

	if (mi2s_dai_data->rx_dai.port_config.mi2s.line) {
		kcontrol = snd_ctl_new1(&mi2s_config_controls[0],
					&mi2s_dai_data->rx_dai);
		rc = snd_ctl_add(dai->card->snd_card, kcontrol);

		if (IS_ERR_VALUE(rc)) {
			dev_err(dai->dev, "%s: err add RX fmt ctl\n", __func__);
			goto rtn;
		}
	}

	if (mi2s_dai_data->tx_dai.port_config.mi2s.line) {
		rc = snd_ctl_add(dai->card->snd_card,
				 snd_ctl_new1(&mi2s_config_controls[2],
					      &mi2s_dai_data->tx_dai));

		if (IS_ERR_VALUE(rc)) {
			if (kcontrol)
				snd_ctl_remove(dai->card->snd_card, kcontrol);
			dev_err(dai->dev, "%s: err add TX fmt ctl\n", __func__);
		}
	}

rtn:
	return rc;
}
开发者ID:marcofreda527,项目名称:codeaurora_kernel_msm,代码行数:33,代码来源:msm-dai-q6.c

示例6: msm_new_mixer

static int msm_new_mixer(struct snd_card *card)
{
	unsigned int idx;
	int err;
	int dev_cnt;

	strcpy(card->mixername, "MSM Mixer");
	for (idx = 0; idx < ARRAY_SIZE(snd_msm_controls); idx++) {
		err = snd_ctl_add(card,	snd_ctl_new1(&snd_msm_controls[idx],
					NULL));
		if (err < 0)
			MM_AUD_ERR("ERR adding ctl\n");
	}
	dev_cnt = msm_snddev_devcount();

	for (idx = 0; idx < dev_cnt; idx++) {
		if (!snd_dev_ctl_index(idx)) {
			err = snd_ctl_add(card, snd_ctl_new1(
				&snd_dev_controls[idx], NULL));
			if (err < 0)
				MM_AUD_ERR("ERR adding ctl\n");
		} else
			return 0;
	}
	simple_control = ARRAY_SIZE(snd_msm_controls);
	device_index = simple_control + 1;
	return 0;
}
开发者ID:OMFGB,项目名称:OMFGB_Mecha_Kernel,代码行数:28,代码来源:msm7x30.c

示例7: snd_gf1_new_mixer

int snd_gf1_new_mixer(struct snd_gus_card * gus)
{
    struct snd_card *card;
    unsigned int idx, max;
    int err;

    snd_assert(gus != NULL, return -EINVAL);
    card = gus->card;
    snd_assert(card != NULL, return -EINVAL);

    if (gus->ics_flag)
        snd_component_add(card, "ICS2101");
    if (card->mixername[0] == '\0') {
        strcpy(card->mixername, gus->ics_flag ? "GF1,ICS2101" : "GF1");
    } else {
        if (gus->ics_flag)
            strcat(card->mixername, ",ICS2101");
        strcat(card->mixername, ",GF1");
    }

    if (!gus->ics_flag) {
        max = gus->ess_flag ? 1 : ARRAY_SIZE(snd_gf1_controls);
        for (idx = 0; idx < max; idx++) {
            if ((err = snd_ctl_add(card, snd_ctl_new1(&snd_gf1_controls[idx], gus))) < 0)
                return err;
        }
    } else {
        for (idx = 0; idx < ARRAY_SIZE(snd_ics_controls); idx++) {
            if ((err = snd_ctl_add(card, snd_ctl_new1(&snd_ics_controls[idx], gus))) < 0)
                return err;
        }
    }
    return 0;
}
开发者ID:274914765,项目名称:C,代码行数:34,代码来源:gus_mixer.c

示例8: tegra_controls_init

int tegra_controls_init(struct snd_soc_codec *codec)
{
	int err;
         if (codec == NULL)
                return -ENODEV;

	if (!audio_data) {
		audio_data = kzalloc(sizeof(*audio_data), GFP_KERNEL);
		if (!audio_data) {
		pr_err("failed to allocate tegra_audio_data \n");
		return -ENOMEM;
	}

	/* Add tegra specific controls */
	err = snd_soc_add_controls(codec, tegra_controls,
					ARRAY_SIZE(tegra_controls));
	if (err < 0)
		goto fail;

	/* Add tegra specific widgets */
	snd_soc_dapm_new_controls(codec, tegra_dapm_widgets,
					ARRAY_SIZE(tegra_dapm_widgets));

		/* Set up tegra specific audio path audio_map */
		snd_soc_dapm_add_routes(codec, audio_map,
				ARRAY_SIZE(audio_map));

	audio_data->codec = codec;
	/* Add play route control */
	err = snd_ctl_add(codec->card,
			snd_ctl_new1(&tegra_play_route_control, NULL));
	if (err < 0)
		goto fail;

	/* Add capture route control */
	err = snd_ctl_add(codec->card,
			snd_ctl_new1(&tegra_capture_route_control, NULL));
	if (err < 0)
		goto fail;

	/* Add call mode switch control */
	err = snd_ctl_add(codec->card,
			snd_ctl_new1(&tegra_call_mode_control, NULL));
	if (err < 0)
		goto fail;

	snd_soc_dapm_sync(codec);
	}

	return 0;
fail:
	if (audio_data) {
		kfree(audio_data);
		audio_data = 0;
	}
	return err;
}
开发者ID:MarkLuk,项目名称:TF101-kernelOC,代码行数:57,代码来源:tegra_soc_controls.c

示例9: msm_dai_q6_hdmi_dai_probe

static int msm_dai_q6_hdmi_dai_probe(struct snd_soc_dai *dai)
{
	struct msm_dai_q6_hdmi_dai_data *dai_data;
	const struct snd_kcontrol_new *kcontrol;
	int rc = 0;
	struct snd_soc_dapm_route intercon;

	if (!dai) {
		pr_err("%s: dai not found\n", __func__);
		return -EINVAL;
	}
	dai_data = kzalloc(sizeof(struct msm_dai_q6_hdmi_dai_data),
		GFP_KERNEL);

	if (!dai_data) {
		dev_err(dai->dev, "DAI-%d: fail to allocate dai data\n",
		dai->id);
		rc = -ENOMEM;
	} else
		dev_set_drvdata(dai->dev, dai_data);

	kcontrol = &hdmi_config_controls[0];

	rc = snd_ctl_add(dai->card->snd_card,
					 snd_ctl_new1(kcontrol, dai_data));

	kcontrol = &hdmi_config_controls[1];

	rc = snd_ctl_add(dai->card->snd_card,
					 snd_ctl_new1(kcontrol, dai_data));

	memset(&intercon, 0 , sizeof(intercon));
	if (!rc && dai && dai->driver) {
		if (dai->driver->playback.stream_name &&
			dai->driver->playback.aif_name) {
			dev_dbg(dai->dev, "%s add route for widget %s",
				   __func__, dai->driver->playback.stream_name);
			intercon.source = dai->driver->playback.aif_name;
			intercon.sink = dai->driver->playback.stream_name;
			dev_dbg(dai->dev, "%s src %s sink %s\n",
				   __func__, intercon.source, intercon.sink);
			snd_soc_dapm_add_routes(&dai->dapm, &intercon, 1);
		}
		if (dai->driver->capture.stream_name &&
		   dai->driver->capture.aif_name) {
			dev_dbg(dai->dev, "%s add route for widget %s",
				   __func__, dai->driver->capture.stream_name);
			intercon.sink = dai->driver->capture.aif_name;
			intercon.source = dai->driver->capture.stream_name;
			dev_dbg(dai->dev, "%s src %s sink %s\n",
				   __func__, intercon.source, intercon.sink);
			snd_soc_dapm_add_routes(&dai->dapm, &intercon, 1);
		}
	}
	return rc;
}
开发者ID:Nothing-Dev,项目名称:android_kernel_huawei_hwY635,代码行数:56,代码来源:msm-dai-q6-hdmi-v2.c

示例10: snd_cs4236_mixer

int snd_cs4236_mixer(struct snd_wss *chip)
{
	struct snd_card *card;
	unsigned int idx, count;
	int err;
	struct snd_kcontrol_new *kcontrol;

	if (snd_BUG_ON(!chip || !chip->card))
		return -EINVAL;
	card = chip->card;
	strcpy(card->mixername, snd_wss_chip_id(chip));

	if (chip->hardware == WSS_HW_CS4235 ||
	    chip->hardware == WSS_HW_CS4239) {
		for (idx = 0; idx < ARRAY_SIZE(snd_cs4235_controls); idx++) {
			if ((err = snd_ctl_add(card, snd_ctl_new1(&snd_cs4235_controls[idx], chip))) < 0)
				return err;
		}
	} else {
		for (idx = 0; idx < ARRAY_SIZE(snd_cs4236_controls); idx++) {
			if ((err = snd_ctl_add(card, snd_ctl_new1(&snd_cs4236_controls[idx], chip))) < 0)
				return err;
		}
	}
	switch (chip->hardware) {
	case WSS_HW_CS4235:
	case WSS_HW_CS4239:
		count = ARRAY_SIZE(snd_cs4236_3d_controls_cs4235);
		kcontrol = snd_cs4236_3d_controls_cs4235;
		break;
	case WSS_HW_CS4237B:
		count = ARRAY_SIZE(snd_cs4236_3d_controls_cs4237);
		kcontrol = snd_cs4236_3d_controls_cs4237;
		break;
	case WSS_HW_CS4238B:
		count = ARRAY_SIZE(snd_cs4236_3d_controls_cs4238);
		kcontrol = snd_cs4236_3d_controls_cs4238;
		break;
	default:
		count = 0;
		kcontrol = NULL;
	}
	for (idx = 0; idx < count; idx++, kcontrol++) {
		if ((err = snd_ctl_add(card, snd_ctl_new1(kcontrol, chip))) < 0)
			return err;
	}
	if (chip->hardware == WSS_HW_CS4237B ||
	    chip->hardware == WSS_HW_CS4238B) {
		for (idx = 0; idx < ARRAY_SIZE(snd_cs4236_iec958_controls); idx++) {
			if ((err = snd_ctl_add(card, snd_ctl_new1(&snd_cs4236_iec958_controls[idx], chip))) < 0)
				return err;
		}
	}
	return 0;
}
开发者ID:325116067,项目名称:semc-qsd8x50,代码行数:55,代码来源:cs4236_lib.c

示例11: snd_ak4641_add_mixer_controls

int snd_ak4641_add_mixer_controls(struct snd_ak4641 *ak, struct snd_card *card)
{
	snd_ak4641_lock(ak);
	snd_ctl_add(card, snd_ctl_new1(&snd_ak4641_actl_playback_volume, ak));
	snd_ctl_add(card, snd_ctl_new1(&snd_ak4641_actl_playback_switch, ak));
	snd_ctl_add(card, snd_ctl_new1(&snd_ak4641_actl_mic_gain, ak));
	snd_ctl_add(card, snd_ctl_new1(&snd_ak4641_actl_mic_boost, ak));
	snd_ctl_add(card, snd_ctl_new1(&snd_ak4641_actl_mono_out, ak));
	snd_ak4641_unlock(ak);
	return 0;
}
开发者ID:ManiacTwister,项目名称:linux-hnd,代码行数:11,代码来源:htcuniversal_ak4641.c

示例12: xonar_d1_mixer_init

static int xonar_d1_mixer_init(struct oxygen *chip)
{
	int err;

	err = snd_ctl_add(chip->card, snd_ctl_new1(&front_panel_switch, chip));
	if (err < 0)
		return err;
	err = snd_ctl_add(chip->card, snd_ctl_new1(&rolloff_control, chip));
	if (err < 0)
		return err;
	return 0;
}
开发者ID:Adjustxx,项目名称:Savaged-Zen,代码行数:12,代码来源:xonar_cs43xx.c

示例13: codec_soc_probe

static int codec_soc_probe(struct platform_device *pdev)
{
	struct snd_soc_device *socdev = platform_get_drvdata(pdev);
	struct snd_soc_codec *codec;
	int ret = 0;

	socdev->card->codec = kzalloc(sizeof(struct snd_soc_codec), GFP_KERNEL);
	if (!socdev->card->codec)
		return -ENOMEM;

	codec = socdev->card->codec;
	mutex_init(&codec->mutex);

	codec->name = "tegra-generic-codec";
	codec->owner = THIS_MODULE;
	codec->dai = &tegra_generic_codec_dai;
	codec->num_dai = 1;
	codec->write = NULL;
	codec->read = NULL;
	INIT_LIST_HEAD(&codec->dapm_widgets);
	INIT_LIST_HEAD(&codec->dapm_paths);
	/* Register PCMs. */
	ret = snd_soc_new_pcms(socdev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1);
	if (ret < 0) {
		printk(KERN_ERR "codec: failed to create pcms\n");
		goto pcm_err;
	}
	/* Register Card. */
	ret = snd_soc_init_card(socdev);
	if (ret < 0) {
		printk(KERN_ERR "codec: failed to register card\n");
		goto card_err;
	}
	/* Add volume control */
	ret = snd_ctl_add(codec->card,
			   snd_ctl_new1(&tegra_codec_ctrl_volume, codec));
	if (ret < 0) {
		printk(KERN_ERR "codec: failed to add control\n");
		goto card_err;
	}
	/* Add route control */
	return snd_ctl_add(codec->card,
			   snd_ctl_new1(&tegra_codec_ctrl_route, codec));

card_err:
	snd_soc_free_pcms(socdev);
pcm_err:
	kfree(socdev->card->codec);

	return ret;
}
开发者ID:Atrix-Dev-Team,项目名称:kernel-MB860,代码行数:51,代码来源:tegra_codec_rpc.c

示例14: add_aicamixer_controls

static int add_aicamixer_controls(struct snd_card_aica *dreamcastcard)
{
	int err;
	err = snd_ctl_add
	    (dreamcastcard->card,
	     snd_ctl_new1(&snd_aica_pcmvolume_control, dreamcastcard));
	if (unlikely(err < 0))
		return err;
	err = snd_ctl_add
	    (dreamcastcard->card,
	     snd_ctl_new1(&snd_aica_pcmswitch_control, dreamcastcard));
	if (unlikely(err < 0))
		return err;
	return 0;
}
开发者ID:AK101111,项目名称:linux,代码行数:15,代码来源:aica.c

示例15: snd_intelmad_mixer

/**
 * snd_intelmad_mixer- to setup mixer settings of the card
 *
 * @intelmaddata: pointer to internal context
 *
 * This function is called from probe function to set up mixer controls
 */
static int __devinit snd_intelmad_mixer(struct snd_intelmad *intelmaddata)
{
	struct snd_card *card;
	unsigned int idx;
	int ret_val = 0, max_controls = 0;
	char *mixername = "IntelMAD Controls";
	struct snd_kcontrol_new *controls;

	WARN_ON(!intelmaddata);

	card = intelmaddata->card;
	strncpy(card->mixername, mixername, sizeof(card->mixername)-1);
	/* add all widget controls and expose the same */
	if (intelmaddata->cpu_id == CPU_CHIP_PENWELL) {
		max_controls = MAX_CTRL_MFLD;
		controls = snd_intelmad_controls_mfld;
	} else {
		max_controls = MAX_CTRL_MRST;
		controls = snd_intelmad_controls_mrst;
	}
	for (idx = 0; idx < max_controls; idx++) {
		ret_val = snd_ctl_add(card,
				snd_ctl_new1(&controls[idx],
				intelmaddata));
		pr_debug("mixer[idx]=%d added\n", idx);
		if (ret_val) {
			pr_err("in adding of control index = %d\n", idx);
			break;
		}
	}
	return ret_val;
}
开发者ID:119-org,项目名称:hi3518-osdrv,代码行数:39,代码来源:intelmid.c


注:本文中的snd_ctl_new1函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。