Well I said I could use music play daemon to play media files within Emacs, there’s something made it uncomfortable: every time I found some new mp3 files, I’ll need to rebuild the mpd database and restart the daemon. This is boring especially when I get one from a friend and just want to play it once: The mpd backend always comes before mplayer and all other backends and report “this file is not in the database” and I have to switch to the command line
And today I find the “-slave” option of mplayer. This makes mplayer a daemon running at the background and waiting for commands from Emacs. So there’s no need to tweak later-do-interval and I can change volume via mplayer.
So here’s my new setting, using mplayer instead of mpd:
(defun ddliu-emms-player-mplayer-volume-down ()
“Depends on mplayer’s -slave mode.”
emms-player-simple-process-name “volume -1\n”))
(define-key emms-playlist-mode-map (kbd “>”) ‘ddliu-emms-player-mplayer-volume-up)
(define-key emms-playlist-mode-map (kbd “<”) ‘ddliu-emms-player-mplayer-volume-down)
One drawback is that if I exit Emacs, the music will stop. But… who will exim Emacs?