From mboxrd@z Thu Jan 1 00:00:00 1970 From: Juan Carlos Castro y Castro Subject: Re: Doubt on implementing .readi and .readn methods Date: Mon, 15 May 2006 17:31:38 -0300 Message-ID: <4468E52A.2020207@instant.com.br> References: <4464E1B7.6070601@instant.com.br> <4468DF11.4000000@instant.com.br> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------080809020405040405040701" Return-path: In-Reply-To: <4468DF11.4000000@instant.com.br> Sender: alsa-devel-admin@lists.sourceforge.net Errors-To: alsa-devel-admin@lists.sourceforge.net List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , List-Archive: To: Takashi Iwai Cc: alsa-devel@lists.sourceforge.net List-Id: alsa-devel@alsa-project.org This is a multi-part message in MIME format. --------------080809020405040405040701 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Some more info: Attached are my .asoundrc and the diff of the changes I've made to pcm_file.c. Juan Carlos Castro y Castro wrote: > 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 > --------------080809020405040405040701 Content-Type: application/x-gzip; name="coupler.tgz" Content-Transfer-Encoding: base64 Content-Disposition: inline; filename="coupler.tgz" H4sIAMDkaEQAA+0Za2/jxtFfqV8xkXGFLJESST38qi9xz77WiB+BL2kQFAVBk0t7W2opkJTv 3Nb/vTO7fCxF2Wcjl6YHaIETzXntzOy8ljf0s2QpwjTY+u2WjWs2m8jn7soTl2PvjrccezJ2 nJk7dRHuTOyJuwX2b6hTtZZZ7qcAW/8I/CxPkyfpPocvjKmeX8laBPNhxGOWLHP4d8fIHxYM 6L1j0C+M7pI5GxW2j/w485FwmPofOwYXT1BwoQiy2L9nQ9wAxDKOO4+dDv7tKWgWj3E7wEX4 bqFBV0KiJJ37OXxwZt75qYQEd74QLM7Aka+pnzOY7KGXC6HDIJkvYvbJCxJxz9K8EC2NWcTL W/kmN8bfcclEm3KBtNu62aTPkzZtf8aoyapRXHwpmzyp6tNmTYhvmxjDJ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Q0vzd3Ud1LdZyi8dBcozLFLAcY OUQ60rWvFFRNTM9JbStfXYXUF6Pis0jDpt/7e+lmbdZmbdZmbdZmbdZmbdbXvP4Lz0IoPwAo AAA= --------------080809020405040405040701-- ------------------------------------------------------- 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