From: Hans-Christian Egtvedt <hcegtvedt@atmel.com>
To: Takashi Iwai <tiwai@suse.de>
Cc: alsa-devel@lists.sourceforge.net
Subject: Re: How to add full duplex capture and playback?
Date: Fri, 19 May 2006 17:42:55 +0200 [thread overview]
Message-ID: <446DE77F.909@atmel.com> (raw)
In-Reply-To: <s5hbqtuxjhq.wl%tiwai@suse.de>
Takashi Iwai wrote:
> At Fri, 19 May 2006 12:44:58 +0200,
> Hans-Christian Egtvedt wrote:
>> Hans-Christian Egtvedt wrote:
<snipp>
> 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).
Ok
>> 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;
To the capture and playback hw_param callbacks I've added:
/* Set restrictions to params */
if (chip->playback_active) { /* capture_active for playback callback */
runtime->hw.rate_min = runtime->hw.rate_max = chip->cur_rate;
runtime->hw.formats = chip->cur_format;
}
But it does not work quite as expected. I'm still able to set rate and
format from userspace (aplay/arecord), and this again will alter the
hardware setup when the prepare callback is called.
In the prepare callback I set the endianess and rate for the hardware
controller based upon what's in the runtime->rate and runtime->format.
I did some printk's in the prepare callback and when playing a S16_LE
44100 Hz file I could record S16_BE 48000 Hz, and this will change the
hardware.
I.e. the runtime->hw.rate_min, rate_max and format was correct in the
prepare callback, but the runtime->rate and format was incorrect,
holding the values I gave from aplay/arecord in userspace.
>From what I've understood the limits you set in hw_params callback
should limit the values in the runtime when prepare callback is called?
I also did some printk's in the hw params callback, and there the format
in runtime->format and runtime->rate still 0, not the values given from
userspace.
Any feedback is greatly appreciated.
Sorry if this email is a bit untidy (-:
--
With kind regards,
Med vennlig hilsen,
Hans-Christian Egtvedt
Applications Engineer - AVR Applications Lab
Atmel Norway
-------------------------------------------------------
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
next prev parent reply other threads:[~2006-05-19 15:42 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-05-19 9:29 How to add full duplex capture and playback? Hans-Christian Egtvedt
2006-05-19 10:44 ` Hans-Christian Egtvedt
2006-05-19 12:54 ` Takashi Iwai
2006-05-19 15:42 ` Hans-Christian Egtvedt [this message]
2006-05-19 16:08 ` Takashi Iwai
2006-05-23 12:57 ` Hans-Christian Egtvedt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=446DE77F.909@atmel.com \
--to=hcegtvedt@atmel.com \
--cc=alsa-devel@lists.sourceforge.net \
--cc=tiwai@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.