Hi Guys,I admit my knowledge in this area is awful,
I'm trying to get the alsa card number from within the text
returned by running
pactl list cards
Alsa card numbers from running aplay -l and above do not match.
I'm attempting to get a match on the PA card list with the type of sound card, and then once the card is found by matching "alsa.card ="n", where n is the card number with the alsa card number from aplay -l, which I have stored as a variable .
Then when the PA card is identified to get the module number.
The first few lines returned by "pactl list cards" are:-
Card #0
Name: alsa_card.pci-0000_00_1b.0
Driver: module-alsa-card.c
Owner Module: 4
Properties:
alsa.card = "0"
If it was all on the same line I could use grep, but I'm a bit stuck.
Could someone suggest a way of doing this and point me in the right direction please.
The end action from this is to unload a pulseaudio module, so there is no contention when running another app.
Thanks
Richard
---------- Post updated at 03:54 PM ---------- Previous update was at 03:21 PM ----------
Why is it when you ask for help, an alternative way is found !!
By using "pactl list short modules"
each module info is space delimited, which allows grep to be used,
ie
$ pactl list short modules|grep 'device_id'
4 module-alsa-card device_id="0" name="pci-0000_00_1b.0" card_name="alsa_card.pci-0000_00_1b.0" namereg_fail=false tsched=yes fixed_latency_range=no ignore_dB=no deferred_volume=yes card_properties="module-udev-detect.discovered=1"
The wanted is the "4" at the start of the line .So awk can be piped to to get it.
On this laptop there is only one sound card, on the other there are four.
---------- Post updated at 04:19 PM ---------- Previous update was at 03:54 PM ----------
Sorry a bit more and I'm stuck again.
running
[richard@g8jvm ~]$ pactl list short modules|grep device_id= |awk '{print $1}'
4
5
6
7
this returns the four module IDs OK
BUT
running
pactl list short modules | grep device_id="0"|awk '{print $1}'
returns nothing, the correct value would be "4"
I'd like to replace the "0" with the variable $Hw, which is the
Alsa card number.
Not sure how to do this. any help appreciated
TIA