spdif-trough and snd_ctl_elem_*
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.
i changed now iface to SND_CTL_ELEM_IFACE_MIXER and _set_name to:
snd_ctl_elem_value_set_name(ctl,SND_CTL_NAME_IEC958("", PLAYBACK, SWITCH));
it seems to work for me but im not sure if its work on the sbLive. the switch or whatever on the sblive is called 'IEC958 Optical Raw'. are the switches different from hadware/mixer to hardware or im wrong? and if yes is there an 'easy way' to get the default spdif-through-switch?
any enlightment in this appreciated.
Signature · 15 lines
thanx and regards ____- joy ________/\---------%%%___________----------- webcast every sunday 2000 cest at pingfm.org pgp key at: x-hkp://wwwkeys.de.pgp.net ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf
At Sat, 13 Jul 2002 17:19:36 +0200,
Quoted 20 lines · joy
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);
Quoted 2 lines
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
Quoted 5 lines · Takashi Iwai
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_.
Quoted 7 lines
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
thanx for your reply, i will give it a try, but this kind of init needs some more rewrite i have expected and i have currently no iec958-capable-device to do real tests, so users have to wait bit ;)
Quoted 2 lines
well, it seems that ens1371 has still no configuration for iec958. so, the right way is to add this stuff...
?
should i add it? will you add it? on which device is the iec958 running on the ens1371? i guess its hw:0,0
Signature · 15 lines
regards ____- joy ________/\---------%%%___________----------- webcast every sunday 2000 cest at pingfm.org pgp key at: x-hkp://wwwkeys.de.pgp.net ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf
At Thu, 18 Jul 2002 00:31:16 +0200,
Quoted 6 lines · joy
Quoted 3 lines
well, it seems that ens1371 has still no configuration for iec958. so, the right way is to add this stuff...
?
should i add it? will you add it? on which device is the iec958 running on the ens1371? i guess its hw:0,0
yes. there is a switch "IEC958 Playback Switch", and we need to turn it on in pcm hook. but i don't see any raw playback switch nor iec958 status configuration, so i have no idea how to turn to the pass-thru mode.
Jaroslav, do you have any clue?
Takashi
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
Quoted 9 lines · Takashi Iwai
At Thu, 18 Jul 2002 00:31:16 +0200,
Quoted 6 lines · joy
Quoted 3 lines
well, it seems that ens1371 has still no configuration for iec958. so, the right way is to add this stuff...
?
should i add it? will you add it? on which device is the iec958 running on the ens1371? i guess its hw:0,0
Quoted 6 lines
yes. there is a switch "IEC958 Playback Switch", and we need to turn it on in pcm hook. but i don't see any raw playback switch nor iec958 status configuration, so i have no idea how to turn to the pass-thru mode.
Jaroslav, do you have any clue?
I have no information, if the ES1371 chip can configure bits in the IEC958 stream. Maybe, all bits are hardcoded.
Jaroslav
-----
Jaroslav Kysela <[email protected]>
Linux Kernel Sound Maintainer
ALSA Project http://www.alsa-project.org
SuSE Linux http://www.suse.com
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf