Anunţ

Caută printre mesajele de pe forum înainte de a scrie unul nou!
Formulează corect întrebarea sau problema pe care o ai.
Respectă regulile forumului și Codul de Conduită!

#1 14 Nov 2014 21:35:46

bispartacus
Banned
Înregistrat: 05 Apr 2011
Mesaje: 815

Sunet 2.1 in Ubuntu via pulseaudio cu placi izolate hardware

Prezint un script pentru rularea sunetului 2.1 emulat software canalul de subwofer este filtrat cu un filtru trece-jos.Functia are un singur argument "restore"
care readuce sistemul pulseaudio pe default.Scriptul ruleaza pe placi gen Creative  cu izolare hardware pe cele gen HD Audio nu ruleaza-probabil pe viitor.
Mai intii va  trebui instalat pachetul  swh-plugins pt ca scriptul sa functioneze.

Cod:

#!/bin/bash
# PulseAudio two dot one channel - support script
# Author: Bispartacus <bispartacus AT gmail DOT com>
# Absolut no waranty!
# Name of script pa-eq-lite
# This program was inspirated fron pulseaudio-equalizer  Author: Conn O'Griofa <connogriofa AT gmail DOT com>
# Thanx  Conn O'Griofa
# Fot people wich want to use 2.1 channel

PRESET_DIR=$HOME/.pulse
PRESET_DIR0=$HOME/.config/pulse
CF_SRC_FILE="/etc/pulse/default.pa"

# Don't execute the script with elevated privileges
if [[ ! $EUID -ne 0 ]]; then
   echo "This script must not be run as root!" 1>&2
   exit 1
fi

# Ensure that settings is on propper directory
if [ ! -d $PRESET_DIR ] && [ ! -d $PRESET_DIR0 ]; then
  exit 1
fi

if [ -d $PRESET_DIR ]; then
    PULSE_DIR=$HOME/.pulse
fi

if [ -d $PRESET_DIR0 ]; then
    PULSE_DIR=$HOME/.config/pulse
fi
if [ ! -f /usr/lib/ladspa/lowpass_iir_1891.so ]; then
 echo "error: please install swh-plugins"
 exit 2
fi
if [ ! -f "$PULSE_DIR/default.pa" ]; then 
  cp $CF_SRC_FILE $PULSE_DIR
fi
DO_REMOVE=`cat /etc/pulse/default.pa | sed -n 55p `

if [ -f $PULSE_DIR/default.pa ]; then
 if [ ! -f /tmp/configured ]; then
  if [ "$DO_REMOVE" = ".ifexists module-udev-detect.so" ]; then
   cat $CF_SRC_FILE | sed '55,61 s/.*//'  >$PULSE_DIR/default.pa
  touch /tmp/configured
 echo "Must run once to have efect"
 exit
  fi
 fi
fi

if [ "$1"  = "restore" ]; then
pulseaudio -k
 rm -f $PULSE_DIR/default.pa
 rm -f /tmp/configured
 pulseaudio -k
fi

alsa_module_load() {
 echo -n >/tmp/eqcommands.sh
if [ "$1" = "sink" ]; then
for c in 0 1 2; do
   if [ -d /sys/class/sound/card"$c" ] && [ "`cat /sys/class/sound/card"$c"/id`" != "Intel" ]; then
    for d in 0 1 2 3 4; do
     if [ -d /sys/class/sound/card"$c"/pcmC"$c"D"$d"p ]; then
      
       ID=`cat /sys/class/sound/card"$c"/id`
       echo >>/tmp/eqcommands.sh "load-module module-alsa-sink sink_name=sink_out_"$c""$d"  device=hw:$ID,$d  sink_properties=device.description=card"$c"_device"$d""
     fi
    done
    
     # This working do not touch
     echo >>/tmp/eqcommands.sh "load-module module-remap-source source_name=remmap_sub master=sink_out_"$c"0.monitor channels=2 master_channel_map=front-left,front-right channel_map=mono,mono "
      echo >>/tmp/eqcommands.sh "load-module module-ladspa-sink sink_name=subLp sink_properties=device.description=subLp master=sink_out_"$c"2 channels=1 plugin=lowpass_iir_1891 label=lowpass_iir control=40,4"
      echo >>/tmp/eqcommands.sh "load-module module-loopback source=remmap_sub sink=subLp"
      echo >>/tmp/eqcommands.sh "set-default-sink  $DEFAULT_SINK"
   fi 
done
fi
pacmd </tmp/eqcommands.sh >/dev/null
}
alsa_module_load sink

Succes.

Editat ultima oară de bispartacus (14 Nov 2014 21:38:49)


Sfaturile sau suportul oferit pe acest forum este fara nici un fel de garantie.
Pentru suport profesional  vizitati http://www.canonical.com/

Offline

 
Feed

Antet forum

Powered by FluxBB