A method for 'quick-changing' between different soundcards...

Moderator: Forum moderators

Post Reply
User avatar
mikewalsh
Moderator
Posts: 5577
Joined: Tue Dec 03, 2019 1:40 pm
Location: King's Lynn, UK
Has thanked: 570 times
Been thanked: 1683 times

A method for 'quick-changing' between different soundcards...

Post by mikewalsh »

Evening, all.

Recently I posted about a new hardware purchase.....a pair of SOMiC wireless 'gaming'-type headphones. I use headphones of an evening, because Mama's bedroom is right next to mine (where my rig is set up); she's a light sleeper at the best of times, and as she's getting steadily older she simply doesn't sleep as well as she used to. Out of courtesy, I try not to disturb her, given that she turns in a lot earlier than I do.

I've had a set of Logitech H340s for quite a while; although the somewhat chunky connector contains its own sound card, making use of the headset a doddle, these are wired. I don't have a whole lot of space in my room - "bijou" would be an apt description! - and although the sound quality is excellent, I keep getting tangled-up with the cable. Nearly tripped over once or twice....

---------------------------

With mice & keyboards, I've been wireless for ages. I figured it was time to go wireless with the headset as well, more for convenience than anything. So, I treated myself to the SOMiC headset, since I still wanted the convenience of the microphone as well. One the H340s, it swings up or down as & when it's needed; with the SOMiC set, it plugs into a standard 3.5 mm jack socket, so can be completely removed when not wanted.

Anyways; to the 'meat' of my missive. I know you can easily switch between multiple cards with Kirk's MultipleSoundCardWizard, but a re-boot is required before Retrovol will show the correct set of sliders. I got to thinking; there had to be a quicker way of doing this that didn't involve a re-boot. And so, I've devised a way of 'instant' card-swapping that doesn't involve re-booting, which works for me.

In /mnt/home, I created a directory called "AUDIO". Within this, two more, called "Default" & "Headphone". In each of these, I've placed a copy of /root/.retrovolrc....Retrovol's config file, respectively as it is with the system card engaged, and the other with the headset's card engaged.

In /usr/local/bin, I created 2 scripts; 'audio_default' & 'audio_head'. These read as follows (these are in jrb's Quirky64 'April' 7.0.1 'lite'):-

'audio_default':-

Code: Select all

#!/bin/sh
#
# Set Retrovol to default card...
#
yad --no-buttons --geometry=+750+30 --undecorated --image /usr/local/lib/X11/pixmaps/soundcard.png --timeout=6
#
rm /root/.retrovolrc
#
cp /mnt/home/Quirky7_64_lite/AUDIO/Default/.retrovolrc /root/.retrovolrc
#
killall retrovol
retrovol -hide

'audio_head':-

Code: Select all

#!/bin/sh
#
# Set Retrovol to headphones...
#
yad --no-buttons --geometry=+750+30 --undecorated --image /usr/local/lib/X11/pixmaps/headphones.png --timeout=6
#
rm /root/.retrovolrc
#
cp /mnt/home/Quirky7_64_lite/AUDIO/Headphone/.retrovolrc /root/.retrovolrc
#
killall retrovol
retrovol -hide

All these do is to delete the /root/.retrovolrc config file, replace it with the required one, kill retrovol & immediately restart it with the '-hide' option.....now reading from the required config file, so sliders/layout, etc, is immediately there. I don't know about the rest of you, but I don't have anything like all the soundcard's available sliders set to display.....only the ones I actually need/use.

This works because .retrovolrc also specifies the sound card to use, as well as what to display and read from.

A third script gives me a small YAD-powered GUI to choose the required set-up, along with a 3rd button to access MultipleSoundCardWizard directly:-

Code: Select all

#!/bin/sh
#
# Script to choose which audio card is required, and reset Retrovol to use it...
#
yad --center --window-icon=/usr/local/lib/X11/pixmaps/audiorecord.png --title=" AudioCardChooser  " --form --text="   CHOOSE DESIRED CARD...   
  ---------------------------------
          Select required action:-" \
--field="    ~Default card~ ":fbtn "audio_default" \
--field="    ~Headphone card~ ":fbtn "audio_head" \
--field="    ~MSCWizard~ ":fbtn "Multiple-Sound-Card-Wizard" \
--no-buttons --close-on-unfocus

Which looks like this:-

Image

Along with all this, when each of the selector scripts is run, it displays a small relevant image (again, YAD-powered), to indicate which card has been selected:-

Default:-

Image

....and headset:-

Image

Yeah, I know it would be simpler to just use GTKdialog.....but y'all know what a fussy sod I am when it comes to display stuff; why should simple notifcations drop below the radar? :D :lol:

(To activate the GUI, I've added an extra entry toward the bottom of the main Menu, between separators; like so:-

Code: Select all

<Separator/>

<Program label="AudioCardChooser" icon="/usr/local/lib/X11/pixmaps/audiorecord.png">audiocardchooser</Program>

<Separator/>

.....achieved by a simple edit of /etc/xdg/templates/_root_jwmrc.)

------------------------------------

So there you are; one Puppy user's method for instant swapping between multiple audio cards.....without the need for a reboot. Works for me, anyway..! :thumbup:

(The same set-up is now in all my Pups, by the simple expedient of making a .pet of those scripts that don't change. The selector scripts just need editing to point to the relevant Puppy directory in /mnt/home; the MultipleSoundCardWizard has to be run a couple of times - along with re-boots - to obtain the relevant .retrovolrc set-ups for the specific cards. A couple of short edits later, and everything's up-and-running!)

Mike. ;)

Last edited by mikewalsh on Wed Jul 07, 2021 9:54 pm, edited 1 time in total.

Puppy "stuff" ~ MORE Puppy "stuff" ~ ....and MORE! :D
_______________________________________________________

Image

User avatar
Grey
Posts: 1984
Joined: Wed Jul 22, 2020 12:33 am
Location: Russia
Has thanked: 75 times
Been thanked: 355 times

Re: A method for 'quick-changing' between different soundcards...

Post by Grey »

Hi. Once I was solving the same problem. But in the end I decided that it would be better (for me) to just install several programs (in our case, players) and configure different output devices in them. Qmmp outputs sound through the card to which headphones are connected, Audacious outputs sound through the card to which amplifier is connected. Well, in Deadbeef I switch sound cards as needed.

Fossapup OS, Ryzen 5 3600 CPU, 64 GB RAM, GeForce GTX 1050 Ti 4 GB, Sound Blaster Audigy Rx with amplifier + Yamaha speakers for loud sound, USB Sound Blaster X-Fi Surround 5.1 Pro V3 + headphones for quiet sound.

Post Reply

Return to “Sounds”