您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ snd_pcm_set_ops函数代码示例

51自学网 2021-06-03 08:02:10
  C++
这篇教程C++ snd_pcm_set_ops函数代码示例写得很实用,希望能帮到您。

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

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

示例1: snd_ad1889_pcm_init

static intsnd_ad1889_pcm_init(struct snd_ad1889 *chip, int device){	int err;	struct snd_pcm *pcm;	err = snd_pcm_new(chip->card, chip->card->driver, device, 1, 1, &pcm);	if (err < 0)		return err;	snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, 			&snd_ad1889_playback_ops);	snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE,			&snd_ad1889_capture_ops);	pcm->private_data = chip;	pcm->info_flags = 0;	strcpy(pcm->name, chip->card->shortname);		chip->pcm = pcm;	chip->psubs = NULL;	chip->csubs = NULL;	err = snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,						snd_dma_pci_data(chip->pci),						BUFFER_BYTES_MAX / 2,						BUFFER_BYTES_MAX);	if (err < 0) {		dev_err(chip->card->dev, "buffer allocation error: %d/n", err);		return err;	}		return 0;}
开发者ID:19Dan01,项目名称:linux,代码行数:35,


示例2: snd_ad1816a_pcm

int __devinit snd_ad1816a_pcm(struct snd_ad1816a *chip, int device, struct snd_pcm **rpcm){	int error;	struct snd_pcm *pcm;	if ((error = snd_pcm_new(chip->card, "AD1816A", device, 1, 1, &pcm)))		return error;	snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_ad1816a_playback_ops);	snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_ad1816a_capture_ops);	pcm->private_data = chip;	pcm->info_flags = (chip->dma1 == chip->dma2 ) ? SNDRV_PCM_INFO_JOINT_DUPLEX : 0;	strcpy(pcm->name, snd_ad1816a_chip_id(chip));	snd_ad1816a_init(chip);	snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,					      snd_dma_isa_data(),					      64*1024, chip->dma1 > 3 || chip->dma2 > 3 ? 128*1024 : 64*1024);	chip->pcm = pcm;	if (rpcm)		*rpcm = pcm;	return 0;}
开发者ID:adis1313,项目名称:android_kernel_samsung_msm8974,代码行数:26,


示例3: msm_pcm_new

static int msm_pcm_new(struct snd_soc_pcm_runtime *rtd){	int ret;	struct snd_card *card = rtd->card->snd_card;	struct snd_pcm *pcm = rtd->pcm;	if (!card->dev->coherent_dma_mask)		card->dev->coherent_dma_mask = DMA_BIT_MASK(32);	ret = snd_pcm_new_stream(pcm, SNDRV_PCM_STREAM_PLAYBACK, 1);	if (ret)		return ret;	ret = snd_pcm_new_stream(pcm, SNDRV_PCM_STREAM_CAPTURE, 1);	if (ret)		return ret;	snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &msm_pcm_ops);	snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &msm_pcm_ops);	ret = pcm_preallocate_dma_buffer(pcm, SNDRV_PCM_STREAM_PLAYBACK);	if (ret)		return ret;	ret = pcm_preallocate_dma_buffer(pcm, SNDRV_PCM_STREAM_CAPTURE);	if (ret)		msm_pcm_free_dma_buffers(pcm);	return ret;}
开发者ID:98416,项目名称:Z7Max_NX505J_H129_kernel,代码行数:27,


示例4: snd_nm256_pcm

static int __devinitsnd_nm256_pcm(struct nm256 *chip, int device){	struct snd_pcm *pcm;	int i, err;	for (i = 0; i < 2; i++) {		struct nm256_stream *s = &chip->streams[i];		s->bufptr = chip->buffer + (s->buf - chip->buffer_start);		s->bufptr_addr = chip->buffer_addr + (s->buf - chip->buffer_start);	}	err = snd_pcm_new(chip->card, chip->card->driver, device,			  1, 1, &pcm);	if (err < 0)		return err;	snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_nm256_playback_ops);	snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_nm256_capture_ops);	pcm->private_data = chip;	pcm->info_flags = 0;	chip->pcm = pcm;	return 0;}
开发者ID:3sOx,项目名称:asuswrt-merlin,代码行数:26,


示例5: snd_card_dummy_pcm

static int __devinit snd_card_dummy_pcm(struct snd_dummy *dummy, int device,					int substreams){	struct snd_pcm *pcm;	struct snd_pcm_ops *ops;	int err;	err = snd_pcm_new(dummy->card, "Dummy PCM", device,			       substreams, substreams, &pcm);	if (err < 0)		return err;	dummy->pcm = pcm;	if (fake_buffer)		ops = &dummy_pcm_ops_no_buf;	else		ops = &dummy_pcm_ops;	snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, ops);	snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, ops);	pcm->private_data = dummy;	pcm->info_flags = 0;	strcpy(pcm->name, "Dummy PCM");	if (!fake_buffer) {		snd_pcm_lib_preallocate_pages_for_all(pcm,			SNDRV_DMA_TYPE_CONTINUOUS,			snd_dma_continuous_data(GFP_KERNEL),			0, 64*1024);	}	return 0;}
开发者ID:325116067,项目名称:semc-qsd8x50,代码行数:29,


示例6: snd_line6_new_pcm

/* create a PCM device */static int snd_line6_new_pcm(struct snd_line6_pcm *line6pcm){	struct snd_pcm *pcm;	int err;	err = snd_pcm_new(line6pcm->line6->card,			  (char *)line6pcm->line6->properties->name,			  0, 1, 1, &pcm);	if (err < 0)		return err;	pcm->private_data = line6pcm;	pcm->private_free = line6_cleanup_pcm;	line6pcm->pcm = pcm;	strcpy(pcm->name, line6pcm->line6->properties->name);	/* set operators */	snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK,			&snd_line6_playback_ops);	snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_line6_capture_ops);	/* pre-allocation of buffers */	snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_CONTINUOUS,					      snd_dma_continuous_data					      (GFP_KERNEL), 64 * 1024,					      128 * 1024);	return 0;}
开发者ID:33d,项目名称:linux-2.6.21-hh20,代码行数:30,


示例7: msm_pcm_new

static int msm_pcm_new(struct snd_card *card,			struct snd_soc_dai *codec_dai,			struct snd_pcm *pcm){	int ret;	if (!card->dev->coherent_dma_mask)		card->dev->coherent_dma_mask = DMA_32BIT_MASK;	ret = snd_pcm_new_stream(pcm, SNDRV_PCM_STREAM_PLAYBACK, 1);	if (ret)		return ret;	ret = snd_pcm_new_stream(pcm, SNDRV_PCM_STREAM_CAPTURE, 1);	if (ret)		return ret;	snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &msm_pcm_ops);	snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &msm_pcm_ops);	ret = pcm_preallocate_dma_buffer(pcm, SNDRV_PCM_STREAM_PLAYBACK);	if (ret)		return ret;	ret = pcm_preallocate_dma_buffer(pcm, SNDRV_PCM_STREAM_CAPTURE);	if (ret)		msm_pcm_free_dma_buffers(pcm);	return ret;}
开发者ID:ARRESS1,项目名称:kernel_samsung_europa,代码行数:26,


示例8: snd_cs5535audio_pcm

int __devinit snd_cs5535audio_pcm(struct cs5535audio *cs5535au){	struct snd_pcm *pcm;	int err;	err = snd_pcm_new(cs5535au->card, "CS5535 Audio", 0, 1, 1, &pcm);	if (err < 0)		return err;	cs5535au->dmas[CS5535AUDIO_DMA_PLAYBACK].ops =					&snd_cs5535audio_playback_dma_ops;	cs5535au->dmas[CS5535AUDIO_DMA_CAPTURE].ops =					&snd_cs5535audio_capture_dma_ops;	snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK,					&snd_cs5535audio_playback_ops);	snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE,					&snd_cs5535audio_capture_ops);	pcm->private_data = cs5535au;	pcm->info_flags = 0;	strcpy(pcm->name, "CS5535 Audio");	snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,					snd_dma_pci_data(cs5535au->pci),					64*1024, 128*1024);	cs5535au->pcm = pcm;	return 0;}
开发者ID:CSCLOG,项目名称:beaglebone,代码行数:29,


示例9: snd_p16v_pcm

int __devinit snd_p16v_pcm(struct snd_emu10k1 *emu, int device, struct snd_pcm **rpcm){	struct snd_pcm *pcm;	struct snd_pcm_substream *substream;	int err;        int capture=1;  	/* snd_printk(KERN_DEBUG "snd_p16v_pcm called. device=%d/n", device); */	emu->p16v_device_offset = device;	if (rpcm)		*rpcm = NULL;	if ((err = snd_pcm_new(emu->card, "p16v", device, 1, capture, &pcm)) < 0)		return err;  	pcm->private_data = emu;	// Single playback 8 channel device.	// Single capture 2 channel device.	snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_p16v_playback_front_ops);	snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_p16v_capture_ops);	pcm->info_flags = 0;	pcm->dev_subclass = SNDRV_PCM_SUBCLASS_GENERIC_MIX;	strcpy(pcm->name, "p16v");	emu->pcm_p16v = pcm;	for(substream = pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream; 	    substream; 	    substream = substream->next) {		if ((err = snd_pcm_lib_preallocate_pages(substream, 							 SNDRV_DMA_TYPE_DEV, 							 snd_dma_pci_data(emu->pci), 							 ((65536 - 64) * 8), ((65536 - 64) * 8))) < 0) 			return err;		/*		snd_printk(KERN_DEBUG			   "preallocate playback substream: err=%d/n", err);		*/	}	for (substream = pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream; 	      substream; 	      substream = substream->next) { 		if ((err = snd_pcm_lib_preallocate_pages(substream, 	                                           SNDRV_DMA_TYPE_DEV, 	                                           snd_dma_pci_data(emu->pci), 	                                           65536 - 64, 65536 - 64)) < 0)			return err;		/*		snd_printk(KERN_DEBUG			   "preallocate capture substream: err=%d/n", err);		*/	}  	if (rpcm)		*rpcm = pcm;  	return 0;}
开发者ID:CSCLOG,项目名称:beaglebone,代码行数:59,


示例10: intel_alsa_create_pcm_device

/* * intel_alsa_create_pcm_device : to setup pcm for the card * * Input parameters *		@card : pointer to the sound card structure *		@p_alsa_ssp_snd_card : pointer to internal context * * Output parameters *		@ret_val : status, 0 ==> OK * */static int intel_alsa_create_pcm_device(struct snd_card *card,                                        struct intel_alsa_ssp_card_info *p_alsa_ssp_snd_card){    struct snd_pcm *pl_pcm;    int i, ret_val = 0;    WARN(!card, "ALSA_SSP: ERROR NULL card/n");    if (!card)        return -EINVAL;    WARN(!p_alsa_ssp_snd_card,         "ALSA_SSP: ERROR NULL p_alsa_ssp_snd_card/n");    if (!p_alsa_ssp_snd_card)        return -EINVAL;    /*     * The alsa_ssp driver handles provide 2 PCM devices :     * device 0 ==> BT with 1 capture sub-stream + 1 play sub-stream     * device 1 ==> FM with 1 capture sub-stream + 0 play sub-stream     * These 2 devices are exclusive     */    for (i = 0; i < INTEL_ALSA_SSP_SND_CARD_MAX_DEVICES; i++) {        ret_val = snd_pcm_new(card, s_dev_info[i].dev_name, i,                              s_dev_info[i].nb_play_stream,                              s_dev_info[i].nb_capt_stream,                              &pl_pcm);        if (ret_val)            return ret_val;        /* setup the ops for playback and capture streams */        snd_pcm_set_ops(pl_pcm, SNDRV_PCM_STREAM_PLAYBACK,                        &s_alsa_ssp_playback_ops);        snd_pcm_set_ops(pl_pcm, SNDRV_PCM_STREAM_CAPTURE,                        &s_alsa_ssp_capture_ops);        /* setup private data which can be retrieved when required */        pl_pcm->private_data = p_alsa_ssp_snd_card;        pl_pcm->info_flags = 0;        strncpy(pl_pcm->name, card->shortname, strlen(card->shortname));        /*         * allocate DMA pages for ALSA stream operations pre-allocation         * to all substreams of the given pcm for the specified DMA type         */        snd_pcm_lib_preallocate_pages_for_all(pl_pcm,                                              SNDRV_DMA_TYPE_CONTINUOUS,                                              snd_dma_continuous_data                                              (GFP_KERNEL),                                              s_dev_info[i].stream_hw_param->buffer_bytes_max,                                              s_dev_info[i].stream_hw_param->buffer_bytes_max);    }    return ret_val;}
开发者ID:kamarush,项目名称:ZTE_GXIn_Kernel-3.0.8,代码行数:68,


示例11: snd_vortex_new_pcm

/* create a pcm device */static int __devinit snd_vortex_new_pcm(vortex_t *chip, int idx, int nr){	struct snd_pcm *pcm;	struct snd_kcontrol *kctl;	int i;	int err, nr_capt;	if (!chip || idx < 0 || idx >= VORTEX_PCM_LAST)		return -ENODEV;	/* idx indicates which kind of PCM device. ADB, SPDIF, I2S and A3D share the 	 * same dma engine. WT uses it own separate dma engine which can't capture. */	if (idx == VORTEX_PCM_ADB)		nr_capt = nr;	else		nr_capt = 0;	err = snd_pcm_new(chip->card, vortex_pcm_prettyname[idx], idx, nr,			  nr_capt, &pcm);	if (err < 0)		return err;	snprintf(pcm->name, sizeof(pcm->name),		"%s %s", CARD_NAME_SHORT, vortex_pcm_name[idx]);	chip->pcm[idx] = pcm;	// This is an evil hack, but it saves a lot of duplicated code.	VORTEX_PCM_TYPE(pcm) = idx;	pcm->private_data = chip;	/* set operators */	snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK,			&snd_vortex_playback_ops);	if (idx == VORTEX_PCM_ADB)		snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE,				&snd_vortex_playback_ops);		/* pre-allocation of Scatter-Gather buffers */		snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV_SG,					      snd_dma_pci_data(chip->pci_dev),					      0x10000, 0x10000);	if (VORTEX_PCM_TYPE(pcm) == VORTEX_PCM_SPDIF) {		for (i = 0; i < ARRAY_SIZE(snd_vortex_mixer_spdif); i++) {			kctl = snd_ctl_new1(&snd_vortex_mixer_spdif[i], chip);			if (!kctl)				return -ENOMEM;			if ((err = snd_ctl_add(chip->card, kctl)) < 0)				return err;		}	}	return 0;}
开发者ID:rrowicki,项目名称:Chrono_Kernel-1,代码行数:51,


示例12: snd_intelmad_pcm_new

/** * snd_intelmad_pcm_new - to setup pcm for the card * * @card:  pointer to the sound card structure * @intelmaddata: pointer to internal context * @pb: playback count for this card * @cap: capture count for this card * @index: device index * * This function is called from probe function to set up pcm params * and functions */static int __devinit snd_intelmad_pcm_new(struct snd_card *card,			struct snd_intelmad *intelmaddata,			unsigned int pb, unsigned int cap, unsigned int index){	int ret_val = 0;	struct snd_pcm *pcm;	char name[32] = INTEL_MAD;	struct snd_pcm_ops *pb_ops = NULL, *cap_ops = NULL;	pr_debug("called for pb %d, cp %d, idx %d/n", pb, cap, index);	ret_val = snd_pcm_new(card, name, index, pb, cap, &pcm);	if (ret_val)		return ret_val;	/* setup the ops for playback and capture streams */	switch (index) {	case 0:		pb_ops = &snd_intelmad_headset_ops;		cap_ops = &snd_intelmad_capture_ops;		break;	case 1:		pb_ops = &snd_intelmad_ihf_ops;		cap_ops = &snd_intelmad_capture_ops;		break;	case 2:		pb_ops = &snd_intelmad_vibra_ops;		cap_ops = &snd_intelmad_capture_ops;		break;	case 3:		pb_ops = &snd_intelmad_haptic_ops;		cap_ops = &snd_intelmad_capture_ops;		break;	}	if (pb)		snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, pb_ops);	if (cap)		snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, cap_ops);	/* setup private data which can be retrieved when required */	pcm->private_data = intelmaddata;	pcm->private_free = snd_intelmad_page_free;	pcm->info_flags = 0;	strncpy(pcm->name, card->shortname, strlen(card->shortname));	/* allocate dma pages for ALSA stream operations */	snd_pcm_lib_preallocate_pages_for_all(pcm,			SNDRV_DMA_TYPE_CONTINUOUS,			snd_dma_continuous_data(GFP_KERNEL),			MIN_BUFFER, MAX_BUFFER);	return ret_val;}
开发者ID:119-org,项目名称:hi3518-osdrv,代码行数:60,


示例13: snd_aicapcmchip

/* TO DO: set up to handle more than one pcm instance */static int __init snd_aicapcmchip(struct snd_card_aica				  *dreamcastcard, int pcm_index){	struct snd_pcm *pcm;	int err;	/* AICA has no capture ability */	err =	    snd_pcm_new(dreamcastcard->card, "AICA PCM", pcm_index, 1, 0,			&pcm);	if (unlikely(err < 0))		return err;	pcm->private_data = dreamcastcard;	strcpy(pcm->name, "AICA PCM");	snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK,			&snd_aicapcm_playback_ops);	/* Allocate the DMA buffers */	err =	    snd_pcm_lib_preallocate_pages_for_all(pcm,						  SNDRV_DMA_TYPE_CONTINUOUS,						  snd_dma_continuous_data						  (GFP_KERNEL),						  AICA_BUFFER_SIZE,						  AICA_BUFFER_SIZE);	return err;}
开发者ID:AK101111,项目名称:linux,代码行数:26,


示例14: poseidon_audio_init

int poseidon_audio_init(struct poseidon *p){	struct poseidon_audio *pa = &p->audio;	struct snd_card *card;	struct snd_pcm *pcm;	int ret;	ret = snd_card_new(&p->interface->dev, -1, "Telegent",			   THIS_MODULE, 0, &card);	if (ret != 0)		return ret;	ret = snd_pcm_new(card, "poseidon audio", 0, 0, 1, &pcm);	if (ret < 0) {		snd_card_free(card);		return ret;	}	snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &pcm_capture_ops);	pcm->info_flags   = 0;	pcm->private_data = p;	strcpy(pcm->name, "poseidon audio capture");	strcpy(card->driver, "ALSA driver");	strcpy(card->shortname, "poseidon Audio");	strcpy(card->longname, "poseidon ALSA Audio");	if (snd_card_register(card)) {		snd_card_free(card);		return -ENOMEM;	}	pa->card = card;	return 0;}
开发者ID:mikuhatsune001,项目名称:linux2.6.32,代码行数:33,


示例15: snd_cx18_pcm_create

int snd_cx18_pcm_create(struct snd_cx18_card *cxsc){	struct snd_pcm *sp;	struct snd_card *sc = cxsc->sc;	struct v4l2_device *v4l2_dev = cxsc->v4l2_dev;	struct cx18 *cx = to_cx18(v4l2_dev);	int ret;	ret = snd_pcm_new(sc, "CX23418 PCM",			  0, /* PCM device 0, the only one for this card */			  0, /* 0 playback substreams */			  1, /* 1 capture substream */			  &sp);	if (ret) {		CX18_ALSA_ERR("%s: snd_cx18_pcm_create() failed with err %d/n",			      __func__, ret);		goto err_exit;	}	spin_lock_init(&cxsc->slock);	snd_pcm_set_ops(sp, SNDRV_PCM_STREAM_CAPTURE,			&snd_cx18_pcm_capture_ops);	sp->info_flags = 0;	sp->private_data = cxsc;	strlcpy(sp->name, cx->card_name, sizeof(sp->name));	return 0;err_exit:	return ret;}
开发者ID:acton393,项目名称:linux,代码行数:32,


示例16: snd_card_capture_allocate

static int __devinit snd_card_capture_allocate(pcm_hw_t *snd_card, int device,char* name){	int err;	snd_pcm_t *pcm;	err = snd_pcm_new(snd_card->card,name,device, 0, 1, &pcm);	if (err < 0)		return err;			snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_card_capture_ops_pcm);	pcm->private_data = snd_card;	pcm->private_free = snd_card_pcm_free;	pcm->info_flags   = 0;	snd_card->pcm = pcm;	strcpy(pcm->name, name);	snd_pcm_lib_preallocate_pages_for_all(pcm,					SNDRV_DMA_TYPE_CONTINUOUS,					snd_dma_continuous_data(GFP_KERNEL),					PCM_PREALLOC_SIZE,					PCM_PREALLOC_MAX);	return 0;}
开发者ID:henrryhe,项目名称:beijing-7101,代码行数:26,


示例17: lola_create_pcm

int __devinit lola_create_pcm(struct lola *chip){	struct snd_pcm *pcm;	int i, err;	for (i = 0; i < 2; i++) {		err = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV,					  snd_dma_pci_data(chip->pci),					  PAGE_SIZE, &chip->pcm[i].bdl);		if (err < 0)			return err;	}	err = snd_pcm_new(chip->card, "Digigram Lola", 0,			  chip->pcm[SNDRV_PCM_STREAM_PLAYBACK].num_streams,			  chip->pcm[SNDRV_PCM_STREAM_CAPTURE].num_streams,			  &pcm);	if (err < 0)		return err;	strlcpy(pcm->name, "Digigram Lola", sizeof(pcm->name));	pcm->private_data = chip;	for (i = 0; i < 2; i++) {		if (chip->pcm[i].num_streams)			snd_pcm_set_ops(pcm, i, &lola_pcm_ops);	}	/* buffer pre-allocation */	snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV_SG,					      snd_dma_pci_data(chip->pci),					      1024 * 64, 32 * 1024 * 1024);	return 0;}
开发者ID:CSCLOG,项目名称:beaglebone,代码行数:31,


示例18: snd_efw_create_pcm_devices

int snd_efw_create_pcm_devices(struct snd_efw *efw){	struct snd_pcm *pcm;	int err;	err = snd_pcm_new(efw->card, efw->card->driver, 0, 1, 1, &pcm);	if (err < 0)		goto end;	pcm->private_data = efw;	snprintf(pcm->name, sizeof(pcm->name), "%s PCM", efw->card->shortname);	snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &pcm_playback_ops);	snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &pcm_capture_ops);end:	return err;}
开发者ID:19Dan01,项目名称:linux,代码行数:16,


示例19: snd_bcm2835_new_spdif_pcm

int snd_bcm2835_new_spdif_pcm(struct bcm2835_chip *chip){	struct snd_pcm *pcm;	int err;	audio_info(" .. IN/n");	if (mutex_lock_interruptible(&chip->audio_mutex)) {		audio_error("Interrupted whilst waiting for lock/n");		return -EINTR;	}	err = snd_pcm_new(chip->card, "bcm2835 ALSA", 1, 1, 0, &pcm);	if (err < 0)		goto out;	pcm->private_data = chip;	strcpy(pcm->name, "bcm2835 IEC958/HDMI");	chip->pcm_spdif = pcm;	snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK,			&snd_bcm2835_playback_spdif_ops);	/* pre-allocation of buffers */	/* NOTE: this may fail */	snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_CONTINUOUS,		snd_dma_continuous_data(GFP_KERNEL),		snd_bcm2835_playback_spdif_hw.buffer_bytes_max, snd_bcm2835_playback_spdif_hw.buffer_bytes_max);out:	mutex_unlock(&chip->audio_mutex);	audio_info(" .. OUT/n");	return 0;}
开发者ID:AshishNamdev,项目名称:linux,代码行数:31,


示例20: snd_bcm2835_new_pcm

/* create a pcm device */int __devinit snd_bcm2835_new_pcm(bcm2835_chip_t * chip){	struct snd_pcm *pcm;	int err;	audio_info(" .. IN/n");	err =	    snd_pcm_new(chip->card, "bcm2835 ALSA", 0, MAX_SUBSTREAMS, 0, &pcm);	if (err < 0)		return err;	pcm->private_data = chip;	strcpy(pcm->name, "bcm2835 ALSA");	chip->pcm = pcm;	chip->dest = AUDIO_DEST_AUTO;	chip->volume = 100;	/* set operators */	snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK,			&snd_bcm2835_playback_ops);	/* pre-allocation of buffers */	/* NOTE: this may fail */	snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_CONTINUOUS,					      snd_dma_continuous_data					      (GFP_KERNEL), 64 * 1024,					      64 * 1024);	audio_info(" .. OUT/n");	return 0;}
开发者ID:eyecatchup,项目名称:razdroid-kernel,代码行数:31,


示例21: snd_em8300_pcm_digital

static int snd_em8300_pcm_digital(em8300_alsa_t *em8300_alsa){	struct em8300_s *em = em8300_alsa->em;	struct snd_pcm *pcm;	int ret;	ret = snd_pcm_new(em8300_alsa->card, "EM8300 PCM Digital",			EM8300_ALSA_DIGITAL_DEVICENUM,			1, /* 1 playback substream */			0, /* 0 capture substream */			&pcm);	if (ret) {		printk(KERN_ERR "em8300-alsa: snd_em8300_pcm_digital failed with err %d/n", ret);		return ret;	}	snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_em8300_playback_ops);	pcm->private_data = em8300_alsa;	pcm->private_free = snd_em8300_pcm_digital_free;	pcm->info_flags = SNDRV_PCM_INFO_HALF_DUPLEX;	strcpy(pcm->name, "EM8300 IEC958");	snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,					      snd_dma_pci_data(em->pci_dev),					      0,					      EM8300_MID_BUFFER_SIZE);	return 0;}
开发者ID:austriancoder,项目名称:v4l2-em8300-old,代码行数:32,


示例22: snd_vortex_new_pcm

/* create a pcm device */static int __devinit snd_vortex_new_pcm(vortex_t * chip, int idx, int nr){	snd_pcm_t *pcm;	int err, nr_capt;	if ((chip == 0) || (idx < 0) || (idx > VORTEX_PCM_LAST))		return -ENODEV;	/* idx indicates which kind of PCM device. ADB, SPDIF, I2S and A3D share the 	 * same dma engine. WT uses it own separate dma engine whcih cant capture. */	if (idx == VORTEX_PCM_ADB)		nr_capt = nr;	else		nr_capt = 0;	if ((err =	     snd_pcm_new(chip->card, vortex_pcm_prettyname[idx], idx, nr,			 nr_capt, &pcm)) < 0)		return err;	strcpy(pcm->name, vortex_pcm_name[idx]);	chip->pcm[idx] = pcm;	// This is an evil hack, but it saves a lot of duplicated code.	VORTEX_PCM_TYPE(pcm) = idx;	pcm->private_data = chip;	/* set operators */	snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK,			&snd_vortex_playback_ops);	if (idx == VORTEX_PCM_ADB)		snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE,				&snd_vortex_playback_ops);		/* pre-allocation of Scatter-Gather buffers */		snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV_SG,					      snd_dma_pci_data(chip->pci_dev),					      0x10000, 0x10000);	if (VORTEX_PCM_TYPE(pcm) == VORTEX_PCM_SPDIF) {		snd_kcontrol_t *kcontrol;		if ((kcontrol =		     snd_ctl_new1(&vortex_spdif_kcontrol, chip)) == NULL)			return -ENOMEM;		if ((err = snd_ctl_add(chip->card, kcontrol)) < 0)			return err;	}	return 0;}
开发者ID:FelipeFernandes1988,项目名称:Alice-1121-Modem,代码行数:48,


示例23: msm_pcm_new

static int msm_pcm_new(struct snd_card *card,			struct snd_soc_dai *codec_dai,			struct snd_pcm *pcm){	pr_debug("%s/n", __func__);	if (pcm->device == PCM_MVS_PLAYBACK_DEVICE)		mvs_pcm_new(card, codec_dai, pcm);	else if (pcm->device == PCM_MEDIA_PLAYBACK_DEVICE)		msm_dsp_new(card, codec_dai, pcm);#ifndef CONFIG_MFD_WM8994	snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &msm_pcm_ops);	snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &msm_pcm_ops);#endif	return 0;}
开发者ID:veirs,项目名称:UbuntuTouch,代码行数:17,


示例24: snd_card_dummy_pcm

static int __devinit snd_card_dummy_pcm(struct snd_dummy *dummy, int device, int substreams){	struct snd_pcm *pcm;	int err;	err = snd_pcm_new(dummy->card, "Dummy PCM", device, substreams, substreams, &pcm);	if (err < 0)		return err;	dummy->pcm = pcm;	snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_card_dummy_playback_ops);	snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_card_dummy_capture_ops);	pcm->private_data = dummy;	pcm->info_flags = 0;	strcpy(pcm->name, "Dummy PCM");	snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_CONTINUOUS, snd_dma_continuous_data(GFP_KERNEL), 128 * 1024, 1024 * 1024);	return 0;}
开发者ID:AbrahamJewowich,项目名称:FreeSWITCH,代码行数:18,


示例25: pxa2xx_pcm_new

int pxa2xx_pcm_new(struct snd_card *card, struct pxa2xx_pcm_client *client,		   struct snd_pcm **rpcm){	struct snd_pcm *pcm;	int play = client->playback_params ? 1 : 0;	int capt = client->capture_params ? 1 : 0;	int ret;	ret = snd_pcm_new(card, "PXA2xx-PCM", 0, play, capt, &pcm);	if (ret)		goto out;	pcm->private_data = client;	pcm->private_free = pxa2xx_pcm_free_dma_buffers;	if (!card->dev->dma_mask)		card->dev->dma_mask = &pxa2xx_pcm_dmamask;	if (!card->dev->coherent_dma_mask)		card->dev->coherent_dma_mask = 0xffffffff;	if (play) {		int stream = SNDRV_PCM_STREAM_PLAYBACK;		snd_pcm_set_ops(pcm, stream, &pxa2xx_pcm_ops);		ret = pxa2xx_pcm_preallocate_dma_buffer(pcm, stream);		if (ret)			goto out;	}	if (capt) {		int stream = SNDRV_PCM_STREAM_CAPTURE;		snd_pcm_set_ops(pcm, stream, &pxa2xx_pcm_ops);		ret = pxa2xx_pcm_preallocate_dma_buffer(pcm, stream);		if (ret)			goto out;	}	if (rpcm)		*rpcm = pcm;	ret = 0; out:	return ret;}
开发者ID:AeroGirl,项目名称:VAR-SOM-AM33-SDK7-Kernel,代码行数:42,


示例26: loopback_pcm_new

static int __devinit loopback_pcm_new(struct loopback *loopback,				      int device, int substreams){	struct snd_pcm *pcm;	int err;	err = snd_pcm_new(loopback->card, "Loopback PCM", device,			  substreams, substreams, &pcm);	if (err < 0)		return err;	snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &loopback_playback_ops);	snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &loopback_capture_ops);	pcm->private_data = loopback;	pcm->info_flags = 0;	strcpy(pcm->name, "Loopback PCM");	loopback->pcm[device] = pcm;	return 0;}
开发者ID:mjduddin,项目名称:B14CKB1RD_kernel_m8,代码行数:20,



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


C++ snd_pcm_set_runtime_buffer函数代码示例
C++ snd_pcm_resume函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。