Ljud/Audio och Pulse/Mint...

Här diskuterar vi hårdvarurelaterade problem eller projekt.

Ljud/Audio och Pulse/Mint...

Inläggav Osprey » lör okt 21, 2023 5:59 pm

Ibland kan det bli problem med både Pulseaudio och Alsa. Jag har hackat ihop det här scriptet som löser många av problemen...
Kod: Markera allt
#! /bin/bash
#
#
trap "exit" SIGQUIT; chkroot --kill has_to_not_be_root
#
echo
#Masked=$(systemctl list-unit-files | grep -i pulseaudio | awk '{ print $2 }')
MaskedService=$(systemctl --user is-enabled pulseaudio.service)
MaskedSocket=$(systemctl --user is-enabled pulseaudio.socket)
if [[ $MaskedService == "masked" || $MaskedSocket == "masked" ]]; then
   echo "-Pulseaudio is marked as masked (very disabled)."
   read -p "_Do you want to unmask it? [y/N]: " IN
   if [[ $IN == "y" || $IN == "Y" ]]; then
      systemctl --user unmask pulseaudio.{service,socket} --now
      if [[ $MaskedService == "masked" ]]; then
         systemctl --user unmask pulseaudio.service --now
      fi
      if [[ $MaskedSocket == "masked" ]]; then
         systemctl --user unmask pulseaudio.socket --now
      fi
      systemctl --user status pulseaudio
   fi
else
   echo "-Pulseaudio is not masked..."
fi
#
AutoMute=$(amixer -c 0 sget 'Auto-Mute Mode' | grep -F "Item0:" | awk '{ print $2 }' | sed "s/[']//g")
if [[ $AutoMute == "Enabled" ]]; then
   echo "-Pulseaudio is Automuted, turning this off..."
   echo
   echo -n " ="
   /usr/bin/amixer -c 0 sset "Auto-Mute Mode" Disabled
else
   echo "-Pulseaudio is not Automuted..."
fi
echo
#
pulseaudio --check
Running=$?
if [[ $Running == 0 ]]; then
   echo "-Pulseaudio is currently running..."
   read -p "_Do you want to restart it? [y/N]: " IN
   if [[ $IN == "y" || $IN == "Y" ]]; then
      pulseaudio --kill
      pulseaudio --start
   fi
   echo
else
   echo "-Pulseaudio is currently not running..."
   read -p "_Do you want to start it? [y/N]: " IN
   if [[ $IN == "y" || $IN == "Y" ]]; then
      #start-pulseaudio-x11   # Needed..???
      pulseaudio --start
   elif [[ $IN == "q" || $IN == "Q" ]]; then
      echo
      exit
   fi
   echo
fi
#
SOUND=$(amixer get Master | grep Mono: | awk '{ print $6 }' | sed 's/\[//g' | sed 's/\]//g')
VOL=$(amixer get Master | grep Mono: | awk '{ print $4 }' | sed 's/\[//g' | sed 's/\]//g')
if [[ $SOUND != "on" ]]; then
   amixer -D pulse sset Master toggle
fi
#
echo "-Available output devices:"
echo
#pacmd list | grep "available: yes" | sort -u | sed 's/^\t//g'
pacmd list | grep output | grep "available: yes" | sort -u | sed 's/^\t//g'
echo
echo "-Select one of THEM in the list of pavucontrol below!"
echo
#pactl list | grep output- | sed 's/^\t//g'
#echo
#
echo 'Pavucontrol - go to "Configuration => Profile" and select "Analog stereo output"'
#echo 'Pavucontrol - go to "Configuration => Profile" and select one of the device shown above...'
read -p "[Press Enter to continue (or q to quit)] " IN
if [[ $IN != "q" && $IN != "Q" ]]; then
   echo
   pavucontrol --tab=5
   aplay /usr/share/sounds/alsa/Front_Center.wav
   #
   echo '-If you did not hear any sound, start "alsamixer" and unmute all output by pushing "m" below them, if there is an "M"...'
   read -p "[Press Enter to continue (or q to quit)] " IN
   if [[ $IN != "q" && $IN != "Q" ]]; then
      alsamixer
      aplay /usr/share/sounds/alsa/Front_Center.wav
   fi
fi
echo
Test and try... 8-)
Osprey
Ninja
 
Inlägg: 149
Blev medlem: fre maj 30, 2014 3:33 pm
Ort: Falkenberg

Återgå till Hårdvara

Vilka är online

Användare som besöker denna kategori: Inga registrerade användare och 2 gäster