From: Takashi Iwai <tiwai@suse.de>
To: Alan Horstmann <gineera@aspect135.co.uk>
Cc: ALSA devel <alsa-devel@alsa-project.org>
Subject: Re: Alsa-OSS Duplex bug (revisited)
Date: Tue, 29 May 2007 18:55:50 +0200 [thread overview]
Message-ID: <s5hodk3zi09.wl%tiwai@suse.de> (raw)
In-Reply-To: <200705272323.13056.gineera@aspect135.co.uk>
At Sun, 27 May 2007 23:23:13 +0100,
Alan Horstmann wrote:
>
> About a year ago I posted an explaination of the cause of non-functioning with
> Alsa-OSS in duplex, together with a workaround patch. After some discussion
> the thread ended. However since then there has been a steady trickle of
> downloads of the patches from my host (it can also be found elsewhere) and
> some reports of great success,eg
>
> http://audacityteam.org/forum/thread/1388 (2nd page especially)
>
> In attempting to tidy up some loose ends, I hope you can bear with me
> revisiting this and making the case for it's acceptance. I am aware the
> Alsa-OSS is not of much interest to developers, and it might be said 'use
> native Alsa'; however that is not possible or desirable in all applications,
> and anyway, why provide an OSS emulation that cannot be made to work
> properly?
>
> To summarise the problem first:
>
> OSS provides a single SNDCTL_DSP_CHANNELS ioctl; where a device is duplex the
> number of capture and playback channels cannot be set separately. With
> original OSS this was not a problem AFAIK because separate devices are
> created for capture and playback, ie they are not used duplex. However
> Alsa-OSS in most cases creates a single combined device, which only operates
> correctly when an equal number of capture and playback channels are used.
>
> The Workaround:
>
> The workaround I proposed and now use constantly is like a secret trapdoor.
> Where the existing interface is adequate (ie captue channels == playback
> channels, or non-duplex) nothing changes, and SNDCTL_DSP_CHANNELS is set with
> a number between 0 and 128. It is fully compatible with apps that don't know
> of the secret door -the front door is used!
>
> However, if an app needs to set capture channels != playback channels, in
> duplex, at present the stream will malfunction every time. But with this
> patch applied, if the app knows the workaround, then it can simply set
> SNDCTL_DSP_CHANNELS as playback + 256*capture channels, and this will be
> interpreted correctly in the patched Alsa-OSS and the stream functions
> correctly.
>
> As I say, there is therefore no loss of compatibility in either direction.
> Providing the app only uses the special formula when necessary rather than
> always, it is only providing a way to fix something that is broken. It would
> seem to me of value to add the patch to Alsa so that the workaround can be
> effected by changes to the app only, without also having to patch and compile
> a replacement Alsa. Whilst it is by no means ideal, it does overcome the
> underlying problem successfully. Details of the workaround could be added to
> the OSS-Emulation.html document.
>
> Patch for 1.0.14rc4 is attached for consideration, together with example
> portaudio patch.
Thanks for the patch. I see how you struggled with this problem.
Well, this is a bit hard problem to decide which to go.
While I see the advantage by your hack (small and backward
compatible), I feel that it's too hackish -- it introduces an
incompatible way of the existing ioctl.
So, I'm not fully convinced by this change yet.
OK, let's whip this dead horse again.
After a quick thought, another possible fix would be to let apps open
each direction separately. For that,
- add some way to make the given PCM stream to non-fullduplex
(proc or module options?)
or
- change portaudio to open each direction separately, O_RDONLY and
O_WRONLY at first, then use O_RDWR as fallback
Are these feasible?
Takashi
next prev parent reply other threads:[~2007-05-29 16:56 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-27 22:23 Alsa-OSS Duplex bug (revisited) Alan Horstmann
2007-05-29 16:55 ` Takashi Iwai [this message]
2007-05-29 22:16 ` Alan Horstmann
2007-05-30 6:47 ` Clemens Ladisch
2007-05-30 17:05 ` Takashi Iwai
2007-05-30 22:12 ` Alan Horstmann
2007-05-31 21:00 ` Alan Horstmann
2007-06-01 9:56 ` Takashi Iwai
2007-06-03 19:55 ` Alan Horstmann
2007-06-04 8:45 ` Clemens Ladisch
2007-06-04 11:51 ` Alan Horstmann
2007-06-04 8:50 ` Takashi Iwai
2007-06-04 11:53 ` Alan Horstmann
2007-06-04 12:21 ` Takashi Iwai
2007-06-04 20:42 ` Alan Horstmann
2007-06-04 21:14 ` 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=s5hodk3zi09.wl%tiwai@suse.de \
--to=tiwai@suse.de \
--cc=alsa-devel@alsa-project.org \
--cc=gineera@aspect135.co.uk \
/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.