xref: /third_party/pulseaudio/src/utils/padsp.in (revision 53a5a1b3)
1#!/bin/sh
2
3# This file is part of PulseAudio.
4#
5# Copyright 2006 Lennart Poettering
6# Copyright 2006 Pierre Ossman <ossman@cendio.se> for Cendio AB
7#
8# PulseAudio is free software; you can redistribute it and/or modify
9# it under the terms of the GNU Lesser General Public License as published by
10# the Free Software Foundation; either version 2 of the License, or
11# (at your option) any later version.
12#
13# PulseAudio is distributed in the hope that it will be useful, but
14# WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16# General Public License for more details.
17#
18# You should have received a copy of the GNU Lesser General Public License
19# along with PulseAudio; if not, see <http://www.gnu.org/licenses/>.
20
21while getopts 'hs:n:m:MSDd' param ; do
22	case $param in
23		s)
24			PULSE_SERVER="$OPTARG"
25			export PULSE_SERVER
26			;;
27		n)
28			PADSP_CLIENT_NAME="$OPTARG"
29			export PADSP_CLIENT_NAME
30			;;
31		m)
32			PADSP_STREAM_NAME="$OPTARG"
33			export PADSP_STREAM_NAME
34			;;
35		M)
36			PADSP_NO_MIXER=1
37			export PADSP_NO_MIXER
38			;;
39		S)
40			PADSP_NO_SNDSTAT=1
41			export PADSP_NO_SNDSTAT
42			;;
43		D)
44			PADSP_NO_DSP=1
45			export PADSP_NO_DSP
46			;;
47		d)
48			if [ x"$PADSP_DEBUG" = x ]; then
49				PADSP_DEBUG=1
50			else
51				PADSP_DEBUG=$(( $PADSP_DEBUG + 1 ))
52			fi
53			export PADSP_DEBUG
54			;;
55		*)
56			echo "$0 - redirect OSS audio devices to PulseAudio"
57			echo " "
58			echo "$0 [options] application [arguments]"
59			echo " "
60			echo "options:"
61			echo "	-h                  show brief help"
62			echo "	-s <host>[:<port>]  contact a specific PulseAudio server"
63			echo "	-n <name>           client name to report to the server"
64			echo "	-m <name>           stream name to report to the server"
65			echo "	-M                  disable /dev/mixer emulation"
66			echo "	-S                  disable /dev/sndstat emulation"
67			echo "	-D                  disable /dev/dsp emulation"
68			echo "	-d                  enable debug output"
69			exit 0
70			;;
71	esac
72done
73
74shift $(( $OPTIND - 1 ))
75
76if [ x"$LD_PRELOAD" = x ] ; then
77   LD_PRELOAD="@PULSEDSP_LOCATION@/libpulsedsp.so"
78else
79   LD_PRELOAD="$LD_PRELOAD @PULSEDSP_LOCATION@/libpulsedsp.so"
80fi
81
82export LD_PRELOAD
83
84exec "$@"
85