From: Juan Carlos Castro y Castro <jcastro@instant.com.br>
To: Takashi Iwai <tiwai@suse.de>
Cc: alsa-devel@lists.sourceforge.net
Subject: Re: Doubt on implementing .readi and .readn methods
Date: Mon, 15 May 2006 17:05:37 -0300 [thread overview]
Message-ID: <4468DF11.4000000@instant.com.br> (raw)
In-Reply-To: <s5hac9jws8q.wl%tiwai@suse.de>
Nice, that clears up a lot of doubts I had. Now I'd like to clear up a
few things in turn -- namely, what exactly I am trying to accomplish.
I want to make a "sound bridge" -- Applications A and B both do sound
input and output, and I want A's sound output to become B's sound input
and vice versa. Call it the Acoustic Coupler From Hell if you may. ;) If
the file plugin did emulate sound input via file as well as it does
sound output, I'd be all set.
Now comes the tricky part. I put debug messages in the .readi and .readn
functions in the file plugin, called arecord using that PCM (which works
fine as output, i.e., with aplay) as a source and... NONE of that
functions EVER get called! It's not a library installation problem --
debug messages in the open function do get shown.
That got me baffled. I imagined some polling problem, but I use the null
plugin as a slave, and that one always has bytes available. I'm pretty
sure I'm doing something stupid due to lack of familiarity with the ALSA
architecture. The question is, what?
Cheers,
Juan
P.S.: By the way, how many people here would find this functionality a
nice thing to have? (Besides me of course)
Takashi Iwai wrote:
>At Fri, 12 May 2006 16:27:51 -0300,
>Juan Carlos Castro y Castro wrote:
>
>
>>I'm a bit confused about what "areas" and "frames" are supposed to mean,
>>and in which order the data pointed to by **bufs corresponds to the data
>>that's written to disk in the .writen functions. I tried to follow the
>>logic in the functions snd_pcm_areas_from_buf(),
>>snd_pcm_areas_from_bufs(), snd_pcm_file_add_frames(), and
>>snd_pcm_areas_copy(), and it feels like a labyrinth.
>>
>>
>
>"area" refers to snd_pcm_channel_area_t. It's an exported struct
>defined in pcm.h:
>
>/** PCM area specification */
>typedef struct _snd_pcm_channel_area {
> /** base address of channel samples */
> void *addr;
> /** offset to first sample in bits */
> unsigned int first;
> /** samples distance in bits */
> unsigned int step;
>} snd_pcm_channel_area_t;
>
>An area array is used for a stream with multiple channels. Each
>element of the array contains the area information for one channel.
>For example, in the case of 16bit 4-channel interleaved format,
>
> area[*].addr = base_addr
> area[0].first = 0
> area[1].first = 16
> area[2].first = 32
> area[3].first = 48
> area[*].step = 64
>
>"frame" is the unit of samples, and 1 frame = sample-width * chanenels.
>e.g. for 16bit 4-channel format, 1 frame = 2 * 4 = 8 bytes.
>
>
>
>
>>Another thing, are the .readi and .readn functions supposed to block, or
>>can they return less bytes (frames?) than requested?
>>
>>
>
>Yes if opened without O_NONBLOCK flag.
>
>
>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
next prev parent reply other threads:[~2006-05-15 20:05 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-05-12 19:27 Doubt on implementing .readi and .readn methods Juan Carlos Castro y Castro
2006-05-15 9:29 ` Takashi Iwai
2006-05-15 20:05 ` Juan Carlos Castro y Castro [this message]
2006-05-15 20:31 ` Juan Carlos Castro y Castro
2006-05-15 20:38 ` Lee Revell
2006-05-15 20:56 ` Juan Carlos Castro y Castro
2006-05-15 21:19 ` Lee Revell
2006-05-15 21:29 ` Juan Carlos Castro y Castro
2006-05-16 21:17 ` Juan Carlos Castro y Castro
2006-05-17 13:37 ` Takashi Iwai
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=4468DF11.4000000@instant.com.br \
--to=jcastro@instant.com.br \
--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.