From: Takashi Iwai <tiwai@suse.de>
To: joy <joy@pingfm.org>
Cc: alsa-devel@lists.sourceforge.net
Subject: Re: spdif-trough and snd_ctl_elem_*
Date: Wed, 17 Jul 2002 14:25:58 +0200 [thread overview]
Message-ID: <s5hptxm8rs9.wl@alsa2.suse.de> (raw)
In-Reply-To: <20020713151936.GA4711@pingfm.org>
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
next prev parent reply other threads:[~2002-07-17 12:25 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-07-13 15:19 spdif-trough and snd_ctl_elem_* joy
2002-07-17 12:25 ` Takashi Iwai [this message]
2002-07-17 22:31 ` joy
2002-07-19 18:03 ` Takashi Iwai
2002-07-20 7:11 ` Jaroslav Kysela
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=s5hptxm8rs9.wl@alsa2.suse.de \
--to=tiwai@suse.de \
--cc=alsa-devel@lists.sourceforge.net \
--cc=joy@pingfm.org \
/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.