At Thu, 28 Sep 2006 16:44:26 -0700, Daniel Yek wrote: > > Hi, > > I have a few more follow-up questions inline... > > At 06:17 AM 9/28/2006, Takashi Iwai wrote: > >At Thu, 28 Sep 2006 01:54:47 -0700, > >Daniel Yek wrote: > <...snip...> > > > > > > (A) Test Channels: > > > > > > I have the following sound card. > > > Card: Intel ICH7 > > > Chip: Analog Devices AD1981B > > > (AD1981B is AC '97 2.3 Compliant CODEC, 2 Channels of Audio with SPDIF) > > > > > > Why the following code reports that the system supports 6 channels audio > > > when the "default" device is used? > > > channels = 6; > > > snd_pcm_hw_params_test_channels( PCMHandle, hwparams, channels); > > > > > > As a result, many channels were simply lost, not being heard. The same > > happens even on > > > a 5.1 system if "default" device is used. > > > >This function returns whether the sound system _accepts_ the given > >number of channels. It doesn't care whether it's really played or > >not. Since "default" PCM uses plug layer, it accepts any number of > >channels. > > What is the right way to figure out if the hardware associated with the > "plug:surround51" PCM is capable of playing in 5.1 mode? I need to know > this because in the case the hardware isn't 5.1-ready, I would like to > fallback to 2-channel playback. On systems incapable of 5.1 playback all > PCMs seem to drop channels; that is bad. So far, the channel configuration is decided at the time opening a device via snd_pcm_open(). That is, the PCM name (e.g. "default", "surround51") is bound to a certain functional preset. So, if the app is sure to play 5.1 sounds, it first opens "surround51". If the open fails, it can open "default" as fallback. > What is usually happening when "surround51" is aliased to "default" PCM and > "plug:surround51" is asked to accept 6 channels (5.1) playback? Where the > extra channels were discarded? Was it in "plug"? (Or could it be dmix? The > hardware mixer has nothing to do with this right?) Well, the "default" should be configured to accept the (almost) all setting. If user changed its surround51 and the system denies 2 channels, it's basically user's fault. "surround51" requires 6-channels. It might accept other channels in test functions, but this PCM is defined only for 6-channels. The extra channels are discarded in the plug layer. The plug is actually a collection of several plugins, rate, linear and route. It's a kind of do-all-conversion. It's route plugin that takes care of channel expansion and shrinkage. This plugin discards the extra channels, and copies the missing channels, etc. The behavior changes slightly depending on the configuration option. The dmix takes only the pre-defined number of channels (usually 2). It can take more channels when set up differently (e.g. dmix for 5.1), but it's not provided in the standard system, as I mentioned in the last post. All around this, the hardware mixing plays no role at all. It's only the question whether the hardware accepts the given number of channels or not. The h/w mixing is independent from this. > > > (B) > > > > > > Plug: > > > > > > If opening "surround51" device failed, does it make sense for a > > > media application to try to open "plug:surround51"? > > > > > > Would "plug" play 5.1 channels content without losing any > > > channel? > > > >If _opening_ surround51 fails, it's usually a problem of device > >assignment (e.g. the device is already in use). The surround51 > >usually doesn't do softmixing unlike "default" PCM. > > > >The plug layer would be useful if you play sample formats that the > >hardware doesn't support, for example, playing 16bit format on ICE1712 > >boards. Basically, it's safe to use "plug:surround51" when you know > >you are going to play 5.1 sound. But, this doesn't guarantee that the > >device can be opened (because of non-dmix nature). > > > > > Or would it make more sense for the application to mix the channels into > > > a 2 channels output (in software)? > > > >No. > > If "no" is the answer, I would have to ask: why then doing software > down-mixing sounds much better than playing in 5.1 mode? (That is channels > were not lost if software down-mixing is used. See "aplay -v" output at the > bottom of this email.) Is there anything I am missing? Ah, I now understand what you wanted. Yes, as a fallback, it's a good idea that app does downmixing by itself when it cannot open 5.1 output. In future, we can set up the default to do more clever up/downmixing (we have already such plugins). But (from portability POV) a media player could do it better right now. Takashi ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Alsa-devel mailing list Alsa-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.sourceforge.net/lists/listinfo/alsa-devel