File: volume.example

package info (click to toggle)
remuco 0.9.2-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 3,276 kB
  • ctags: 2,452
  • sloc: java: 7,161; python: 6,140; xml: 5,704; sh: 165; makefile: 74
file content (58 lines) | stat: -rwxr-xr-x 2,025 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/bin/sh

# =============================================================================
#
#    Remuco - A remote control system for media players.
#    Copyright (C) 2006-2009 by the Remuco team, see AUTHORS.
#
#    This file is part of Remuco.
#
#    Remuco is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.
#
#    Remuco is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with Remuco.  If not, see <http://www.gnu.org/licenses/>.
#
# =============================================================================

# Example shell script to control master volume with 'amixer'.
#
# Usage:
#     volume [PERCENT]
# Example:
#     volume
#     -> prints out current volume in percent
#     volume {up|down|mute}
#     -> increase or decrease volume (by 5 percent) or mute volume
#
# Put this script with name 'volume' into a player adapter's configuration
# directory (e.g. ~/.config/remuco/fooplay) to disable the player's volume
# control and enable volume control as done here. To use this volume script for
# all players, put it into ~/.config/remuco.
# 
# If this script does not work correctly, have a look into 'man amixer' for how
# to tweak the lines below.

CARD=0
CONTROL=Master

if [ $# -eq 0 ] ; then
	amixer -c $CARD sget $CONTROL \
		| grep "\[[0-9]\+%\]" \
		| sed -e "s/^.*\[\([0-9]\+\)%\].*$/\1/" || exit 1
elif [ "$1" = "up" ] ; then
	amixer -c $CARD sset $CONTROL 5%+ || exit 1
elif [ "$1" = "down" ] ; then
	amixer -c $CARD sset $CONTROL 5%- || exit 1
elif [ "$1" = "mute" ] ; then
	amixer -c $CARD sset $CONTROL 0% || exit 1
else
	exit 1
fi