Hi,

  I decided to take a look at SNDCTL_DSP_SET_CHNORDER. I have implemented a 
version of it, and I wonder if my choices are good. If someone has ideas 
and/or can review the diff (attached) and/or can test this (I haven't managed 
to test this on a real 5.1 setup) that'd be nice. Especially I'd like to get 
ideas about the API...

1) I've implemented this in vmix. Obvious choice, and SNDCTL_DSP_SET_PLAYTGT 
is implemented similarly. The diff implements both a SET_CHNORDER for programs, 
and a vmix interface for vmixctl. The vmixctl interface allow permanent 
remapping with vmix, e.g.:

sudo vmixctl /dev/dsp 2 1 #switch left and right channels
This mapping is independent of a program's private channel mapping.

2) The unimplemented API stated in the manual[1] is done in a way limited to 
16 channels, which I believe is too low (though below current vmix use now). 
Also, it's a bit awkward to use.
 I used instead a large array with a much bigger limit. Like in the original 
API, '0' is a special value meaning "default". Maybe I should add another 
special value for "mute channel" (which is easy to implement in vmix)?

 Anyhow, it checks the input, so something like "1 1" would be rejected.
 Also, I've only implement playback side, since programs would obviously want 
a different setting for rec side (and this API is ambiguous for O_RDWR opening 
anyhow). Not sure what to do with the rec side API wise, if anything. A 
different ioctl? Or make use a struct here with an input/output knob? Or 
nothing at all?

3) vmix's SNDCTL_DSP_SET_PLAYTGT conflicts with this implementation (for 
obvious reasons). So whenever it's called, it resets the channel map. Whenever 
SNDCTL_DSP_SET_CHNORDER is called, it resets the play target.

4) Also, whenever SNDCTL_DSP_CHANNELS is called (with a non-zero arg), it 
resets the channel map.

Use example:

oss_chninfo map = { 2, 1 }; // C zero init means rest of array is 0
ioctl (fd, SNDCTL_DSP_SET_CHNORDER, &map); // reverse left and right channels

[1] http://manuals.opensound.com/developer/SNDCTL_DSP_GET_CHNORDER.html

Attachment: oss-chnorder.diff.gz
Description: GNU Zip compressed data

_______________________________________________
oss-devel mailing list
oss-devel@mailman.opensound.com
http://mailman.opensound.com/mailman/listinfo/oss-devel

Reply via email to