audio.el 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. ;; Look for audio devices ‘mpv --audio-device=help’
  2. (defvar ‎wi-headphones "pulse/alsa_output\
  3. .usb-Logitech_Logitech_USB_Headset-00.analog-stereo"
  4. "My USB headphones.")
  5. (setq pulseaudio-control-pactl-path
  6. "/run/current-system/profile/bin/pactl")
  7. ;;;
  8. ;;; EMMS
  9. ;;;
  10. (with-eval-after-load 'emms-playlist-mode
  11. (require 'emms-setup)
  12. (with-eval-after-load 'emms-setup
  13. (emms-all)
  14. (emms-default-players)
  15. (setq emms-player-mpv-parameters
  16. (append '("--no-terminal" "--force-window=no" "--audio-display=no"
  17. "--no-resume-playback" "--keep-open=no"
  18. "--audio-device=pulse/alsa_output.usb\
  19. -Logitech_Logitech_USB_Headset-00.analog-stereo"
  20. "--title=\"emacs-emms\"")
  21. emms-player-mpv-parameters))
  22. (setq emms-volume-change-function #'emms-volume-pulse-change)
  23. (setq emms-player-next-function 'emms-next-noerror)
  24. (emms-mode-line -1)
  25. (setq emms-playing-time-display-p nil)
  26. (setq emms-playlist-mode-center-when-go t))
  27. (defmacro define-emms-advice-after (procedure after-procedure)
  28. `(progn
  29. (defun ,(intern (concat (symbol-name procedure)
  30. "-"
  31. (mapconcat 'identity
  32. (cdr (split-string (symbol-name after-procedure)
  33. "-"))
  34. "-")))
  35. nil
  36. ,(format "Evaluate `%S' and call `%S'." procedure after-procedure)
  37. (interactive)
  38. (,procedure)
  39. (,after-procedure))))
  40. (define-emms-advice-after emms-next emms-playlist-mode-center-current)
  41. (define-emms-advice-after emms-previous emms-playlist-mode-center-current)
  42. (define-emms-advice-after emms-random emms-playlist-mode-center-current)
  43. (define-emms-advice-after emms-next emms-show)
  44. (define-emms-advice-after emms-previous emms-show)
  45. (define-emms-advice-after emms-random emms-show)
  46. (dolist (map (list emms-playlist-mode-map))
  47. (define-key map (kbd "n") 'emms-next-playlist-mode-center-current)
  48. (define-key map (kbd "p") 'emms-previous-playlist-mode-center-current)
  49. (define-key map (kbd "r") 'emms-random-playlist-mode-center-current)
  50. (define-key map (kbd "<backspace>") 'emms-player-simple-mpv-speed-normal)
  51. (define-key map (kbd "T") 'emms-player-simple-mpv-ontop)
  52. (define-key map (kbd "F") 'emms-player-simple-mpv-fullscreen)
  53. (define-key map (kbd "9") 'emms-volume-lower)
  54. (define-key map (kbd "0") 'emms-volume-raise))
  55. (with-eval-after-load 'emms-setup
  56. (setq emms-track-description-function (lambda (v) (assoc-default 'name v)))
  57. (setq emms-source-file-default-directory "/srv/music"))
  58. (with-eval-after-load 'helm-emms
  59. (require 'emms-setup)
  60. (setq helm-emms-use-track-description-function t)
  61. (add-to-list 'helm-emms-music-extensions "mkv")
  62. (add-to-list 'helm-emms-music-extensions "webm")))