Automate services (conditionally for sound devices)
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Automate services (conditionally for sound devices)
Hi,
After much research, I managed to install Vortexbox 2.4 (Fedora 23 based) with Lynx Card (uses OSS sound driver). OSS and ALSA generally conflict each other.
Vortexbox by default uses Squeezelite/LMS as player - this works fine. I installed MPD player and managed to make it work using Gnome Music Player (Windows) client. However, I have to run the foll commands to get MPD working:
1. Reassign the specific Lynx device to /dev/dsp # ln -sf /dev/oss/lynxtwo0/pcm4 /dev/dsp
2. Stop Squeezelite service which I suspect uses ALSA-OSS emulation which i had to install to get LMS player working. # systemctl stop squeezelite0.service
Questions I have
- Is there anyway to automate the above commands by default when booting my machine.
- If I want to go back to LMS, I have to manually restart the Squeezelite service (not practical) - possible to avoid this.
- Can I streamline overall? I currently hear 3 pops and click in my DAC when booting highlighting the Lynx card is called 3 times through the Fedora boot process
Thanks heaps.
I edited a rule for mpd.service to stop Squeezelite. Now, i can start MPD player without the need to get onto command line mode.
When I need squeezelite, i just resubmit Vortexbox device device assignment and I can play via LMS.
However, I have one last puzzle to solve. Once I start using Squeezelite, I can't play via MPD again (since Squeeezelite uses ALSA which locks in the sound device and disallowing MPD to use the same device). How can I get this resolved?
Cant think I can resolve via the systemd as the issue seems to be event based and don't know how to identify that MPD player is used again (i.e if MPD is called, disable squeezelite, else leave it enabled)
However, I have one last puzzle to solve. Once I start using Squeezelite, I can't play via MPD again (since Squeeezelite uses ALSA which locks in the sound device and disallowing MPD to use the same device). How can I get this resolved?
are you saying you cannot play more than 1 sound sources together under alsa?
mpd is using alsa?
if so, you might need alsa's dmix plugin - something that's been enabled by default in archlinux for ages, so i don't really know how to activate it manually, but maybe this can help: https://wiki.archlinux.org/index.php/Alsa#Dmix
dmix tends to be enabled by default and the soundcard should allow "sharing". With anything recent anyway (< 5 years).
About the only time I have trouble with sharing, is with pulseaudio and using multiple users. At which point networking needs enabled in pulse and a $HOME/.config/pulse/client.conf needs to exist with the contents of "default-server = 127.0.0.1". When using a user other than the one who started pulse on the same machine. Probably not your issue though. You might be running something else like jack over alsa which is locking the card. At which point you need to tell the player to use jack and not alsa when outputting sound. Or other trickery like snd-aloop and routing things through the Loopback device.
Thanks for the replies. I tried using alsa for both mpd and squeezelite players. This still caused mpd to not find the player (sort of locking the sound card).
It seems squeezelite and mpd services are mutually incompatible. If i stop squeezelite service, mpd can play.
Is there anyway i can detect the event of either player being used so thar i can start or stop particular services?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.