;;; volume.el --- simple Aumix interface ;; ;; This file is public domain. ;; ;; Author: Matthew Mundell ;; Filename: volume.el ;; Created: January 11 2005 ;; Keywords: volume, audio ;; Time-stamp: "11 Jul 2005 17:36:25" ;; ;;; Commentary: ;; ;; Simple interface to the Aumix mixer. ;; ;; Example bindings: ;; (global-set-key [C-f10] 'volume-display-settings) ;; (global-set-key [f10] 'volume-mute) ;; (global-set-key [f11] 'volume-down) ;; (global-set-key [f12] 'volume-up) ;; ;;; History: ;; ;; Jan 2005 Created. ;; ;;; Code: (defvar volume-delta 1 "Percentage by which `volume-up' and `volume-down' adjust volume.") (defvar volume-muted nil "Audio mute flag.") (or (functionp 'call-process-shell-command) (defalias 'call-process-shell-command 'shell-command)) (defun volume-save () "Save current settings to Aumix config file." (interactive) (call-process-shell-command "aumix -S")) (defun volume-zero () "Set volume to zero." (interactive) (call-process-shell-command "aumix -v0%% -w0%%")) (defun volume-init () "Load settings from Aumix config file." (interactive) (call-process-shell-command "aumix -L > /dev/null") (setq volume-muted nil)) ;; FIX Volume adjustment may be better logarithmic. (defun volume-up () "Raise audio volume by `volume-delta' percent." (interactive) (if volume-muted (volume-mute)) (call-process-shell-command (format "aumix -v+%s%% -w+%s%%" volume-delta volume-delta))) (defun volume-down () "Lower audio volume by `volume-delta' percent." (interactive) (if volume-muted (volume-mute)) (call-process-shell-command (format "aumix -v-%s%% -w-%s%%" volume-delta volume-delta))) (defun volume-mute () "Toggle audio silence." (interactive) (if volume-muted (volume-init) (volume-save) (volume-zero) (setq volume-muted t))) (defun volume-display-settings () "Display Aumix settings." (interactive) (message (shell-command-to-string "aumix -q"))) (provide 'volume) ;;; volume.el ends here