At Sat, 13 Jul 2002 17:19:36 +0200, joy wrote: > > hi, > > i actually want to set spdif-trough automagically from inside an application > when its needed but it seems there are differences from hardware to > hardware or/and changes in the alsa-lib-api, but im not sure. > > i have an old-code fragment which dosn't work for me (ens1371). > it does not work also on the SB Live Player 5.1. > > ... > snd_ctl_elem_value_alloca(&ctl); > snd_ctl_elem_value_set_interface(ctl, SND_CTL_ELEM_IFACE_PCM); > snd_ctl_elem_value_set_device(ctl, snd_pcm_info_get_device(info)); > snd_ctl_elem_value_set_subdevice(ctl, snd_pcm_info_get_subdevice(info)); > snd_ctl_elem_value_set_name(ctl,SND_CTL_NAME_IEC958("", PLAYBACK, PCM_STREAM)); > snd_ctl_elem_value_set_iec958(ctl, &spdif); > ... > snd_ctl_elem_write(ctl_handler, ctl); > > i got always "file or directory not found"-error with this and it's no > wonder cause i have no pcm-iface like above. the implementation of controls for iec958 is fairly dependent on each card. some card needs more initialization and some not. it's true that this might be confusing if you want to access such switches _directly_.
on alsa, instead of tweaking these lowlevel stuffs, you can use an abstraction pcm layer. typically, the pcm "iec958" (or "spdif" equivalently) does all such a job. the iec958 pcm accepts arguments which represent status bytes. iec958:AES0=0xXXXX,AES1=0xXXXX,AES2=0xXXXX,AES3=0xXXXX whether it's raw data, on which sample rate, etc. are determined by these bytes. (please check the specification document for details.) you can pass this string as a pcm name of snd_pcm_open(), snd_pcm_open(&pcm, "iec958:....", SND_PCM_STREAM_PLAYBACK, 0); how the iec958 pcm works on each card is defined in the card config file found under /usr/share/alsa/cards. for example, emu10k1 toggles some control switches as you found and passes the status bytes. well, it seems that ens1371 has still no configuration for iec958. so, the right way is to add this stuff... Takashi ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ Alsa-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/alsa-devel