1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- (in-package :stumpwm)
- (defvar *sound-program* "osd-sound"
- "Name of a program to be called with amixer arguments.")
- (defvar *sound-scontrols* '("Master" "Line")
- "List of simple controls for managing.")
- (defvar *sound-current-scontrol-num* 0
- "The number of the currently used simple control.")
- (defun sound-get-current-scontrol ()
- "Return the current simple control from `*sound-scontrols*'."
- (nth *sound-current-scontrol-num* *sound-scontrols*))
- (defun sound-get-next-scontrol ()
- "Return next simple control from `*sound-scontrols*'."
- (setq *sound-current-scontrol-num*
- (if (>= *sound-current-scontrol-num*
- (- (length *sound-scontrols*) 1))
- 0
- (+ 1 *sound-current-scontrol-num*)))
- (sound-get-current-scontrol))
- (defun sound-call (&rest args)
- "Execute `*sound-program*' using amixer ARGS."
- (run-prog *sound-program*
- :args args :wait nil :search t))
- (defcommand sound-set-current-scontrol (&rest args) (:rest)
- "Set sound value for the current simple control.
- ARGS are the rest amixer arguments after 'sset CONTROL'."
- (apply #'sound-call "sset" (sound-get-current-scontrol) args))
- (defcommand sound-current-scontrol () ()
- "Show sound value of the current simple control."
- (sound-call "sget" (sound-get-current-scontrol)))
- (defcommand sound-next-scontrol () ()
- "Switch simple control and show its sound value."
- (sound-call "sget" (sound-get-next-scontrol)))
|