From mboxrd@z Thu Jan 1 00:00:00 1970 From: Takashi Iwai Subject: Re: DMIX and capture stream Date: Mon, 05 Jan 2004 19:12:26 +0100 Sender: alsa-devel-admin@lists.sourceforge.net Message-ID: References: <200401051741.i05HfCXl007120@dhin.linuxaudiosystems.com> Mime-Version: 1.0 (generated by SEMI 1.14.5 - "Awara-Onsen") Content-Type: multipart/mixed; boundary="Multipart_Mon_Jan__5_19:12:26_2004-1" Return-path: In-Reply-To: <200401051741.i05HfCXl007120@dhin.linuxaudiosystems.com> Errors-To: alsa-devel-admin@lists.sourceforge.net List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , List-Archive: To: Paul Davis Cc: David Lloyd , ALSA Mailing List List-Id: alsa-devel@alsa-project.org --Multipart_Mon_Jan__5_19:12:26_2004-1 Content-Type: text/plain; charset=US-ASCII At Mon, 05 Jan 2004 12:41:12 -0500, Paul Davis wrote: > > >I have application A that needs to open payback and capture streams > >because it's a two-way communications program. Application B is a game > >that uses playback only. I want to use these both at the same time. > > but i don't think you can do this with OSS. why should ALSA's OSS > emulation make it possible? the OSS API doesn't support this. if they > used the ALSA API, it would work without (much) work on your part. ok, finally i got his question - well, i didn't read carefully it before, since i still have 5,000 unread mails... anyway, it's possible if you use aoss wrapper and specify dmix/dsnoop as the device. you're right for the kernel emulation. no way. but still we need a fix for aoss wrapper. the only necessary change is to allow aoss open different pcm per playback and capture stream. for example, the below is a minute quick hack (untested) for that. you can specify pcm.dsp0p and pcm.dsp0c for playback and capture directions, respectively. Takashi --Multipart_Mon_Jan__5_19:12:26_2004-1 Content-Type: application/octet-stream Content-Disposition: attachment; filename="alsa-oss-duplex.dif" Content-Transfer-Encoding: 7bit Index: alsa-oss/alsa-oss.c =================================================================== RCS file: /suse/tiwai/cvs/alsa/alsa-oss/alsa-oss.c,v retrieving revision 1.24 diff -u -r1.24 alsa-oss.c --- alsa-oss/alsa-oss.c 1 Dec 2003 13:25:58 -0000 1.24 +++ alsa-oss/alsa-oss.c 5 Jan 2004 18:08:18 -0000 @@ -394,6 +394,7 @@ int fd = -1; int result; char name[64]; + static char *suffix[2] = { "p", "c" }; switch (device) { case OSS_DEVICE_DSP: @@ -447,11 +448,16 @@ dsp->oss_format = format; result = -EINVAL; for (k = 0; k < 2; ++k) { + char tmpname[64]; if (!(streams & (1 << k))) continue; - result = snd_pcm_open(&dsp->streams[k].pcm, name, k, pcm_mode); - if (result < 0) - break; + snprintf(tmpname, sizeof(tmpname), "%s%s", name, suffix[k]); + result = snd_pcm_open(&dsp->streams[k].pcm, tmpname, k, pcm_mode); + if (result < 0) { + result = snd_pcm_open(&dsp->streams[k].pcm, name, k, pcm_mode); + if (result < 0) + break; + } } if (result < 0) { result = 0; --Multipart_Mon_Jan__5_19:12:26_2004-1-- ------------------------------------------------------- This SF.net email is sponsored by: IBM Linux Tutorials. Become an expert in LINUX or just sharpen your skills. Sign up for IBM's Free Linux Tutorials. Learn everything from the bash shell to sys admin. Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click