Re: How to add full duplex capture and playback?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



At Fri, 19 May 2006 12:44:58 +0200,
Hans-Christian Egtvedt wrote:
> 
> Hans-Christian Egtvedt wrote:
> > Hello
> > 
> > I'm strugling a bit with getting my AC97 driver to be full duplex. The
> > hardware supports it, but I can't seem to enable it correctly in the driver.
> > 
> > Is there anything I've missed other than this?
> > err = snd_pcm_new(chip->card, "Atmel AC97", 0, 1, 1, &pcm);
> 
> This is actually correct I see, I have both a substream for capture and
> a substream for playback:
> ~ # aplay -l
> **** List of PLAYBACK Hardware Devices ****
> card 0: AC97 [Atmel AVR32 AC97], device 0: Atmel AC97 [Atmel AC97]
>   Subdevices: 1/1
>   Subdevice #0: subdevice #0
> ~ # arecord -l
> **** List of CAPTURE Hardware Devices ****
> card 0: AC97 [Atmel AVR32 AC97], device 0: Atmel AC97 [Atmel AC97]
>   Subdevices: 1/1
>   Subdevice #0: subdevice #0
> 
> I assume this is a "good" output from the utils.
> 
> > AFAIK this should give me two substreams, one for capture and one for
> > playback. Do I have to take some care with other calls?
> > 
> > When I try to playback and record simultaneously I get the following error:
> > ALSA lib pcm_params.c:2152:(snd_pcm_hw_refine_slave) Slave PCM not usable
> > aplay: set_params:879: Broken configuration for this PCM: no
> > configurations available
> 
> This problem is due to the following open call, and was solved by
> commenting it out, which is not an option for the final driver.
> 
> Open call:
> static int
> snd_atmel_ac97_playback_open(snd_pcm_substream_t *substream)
> {
> 	atmel_ac97_t *chip = snd_pcm_substream_chip(substream);
> 	snd_pcm_runtime_t *runtime = substream->runtime;
> 
> 	chip->playback_active = 1;
> 
> 	printk(KERN_INFO "atmel-ac97: entering playback open\n");
> 
> 	runtime->hw = snd_atmel_ac97_playback_hw;
> 
> 	/* Setup hardware to match capture settings */
> #if 0
> 	if (chip->capture_active) {
> 		int err = 0;
> 		snd_pcm_runtime_t *capture_runtime =
> 			chip->capture_substream->runtime;
> 
> 		hw_rates[0] = (unsigned int)capture_runtime->rate;

capture->runtime->rate isn't set properly unless hw_params is called
in the capture side.  That is, if your app opens both sides at the
same time but not set up each by other, it doesn't work.

It's better to set chip->cur_rate and chip->cur_format in hw_params
callback (with care of number of opened streams).


> 		hw_constraint_rates.count	= ARRAY_SIZE(hw_rates);
> 		hw_constraint_rates.list	= hw_rates;
> 		hw_constraint_rates.mask	= 0;
> 
> 		hw_formats[0] = (unsigned int)capture_runtime->format;
> 		hw_constraint_formats.count	= ARRAY_SIZE(hw_formats);
> 		hw_constraint_formats.list	= hw_formats;
> 		hw_constraint_formats.mask	= 0;

They can be more easily done by overwriting runtime->hw entries, for
example,
	runtime->hw.rate_min = runtime->hw.rate_max = chip->cur_rate;
and
	runtime->hw.formats = chip->cur_format_mask;


Takashi


-------------------------------------------------------
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

[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux