Skip to content

Mohsen Banan Portal

Personal tools
You are here: Home » My Latest » Quick Notes » Quick Notes

Quick Notes

[Web Pointer:] Dryice LiuÃÂÂs Blog - emms using mplayer


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Web Pointer:] Dryice LiuÃÂÂs Blog - emms using mplayer



Attched HTML part was extracted from:
http://dryice.name/blog/emacs/emms-using-mplayer/ 
on Monday 09/14/09 04:57:51 PM PDT

Title: Dryice Liu’s Blog - emms using mplayer

emms using mplayer

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 <code:( class=wp-smiley />

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:

(setq emms-player-mplayer-command-name "mplayer"
emms-player-mplayer-parameters ‘("-slave")
emms-player-mpg321-command-name "mpg123"
emms-player-list
‘(emms-player-mplayer
emms-player-mplayer-playlist
emms-player-mpg321
emms-player-ogg123))
(defun ddliu-emms-player-mplayer-volume-up ()
"Depends on mplayer’s -slave mode."
(interactive)
(process-send-string
emms-player-simple-process-name "volume 1\n"))

(defun ddliu-emms-player-mplayer-volume-down ()
“Depends on mplayer’s -slave mode.”
(interactive)
(process-send-string
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?

Tags: ,

Comments 1

  1. lgfang wrote:

    thanks.

    And I modified it a little bit so that it work with emms-volume-raise/emms-volume-lower

    (defun my-mplayer-volume-change-function (amount)
    (interactive)
    (process-send-string
    emms-player-simple-process-name (format “volume %d\n” amount)))
    (setq emms-volume-change-function ‘my-mplayer-volume-change-function)

    Posted 03 Jan 2009 at 3:23 pm

Post a Comment

You could use <code type="name"> to get your code colorized

Your email is never published nor shared. Required fields are marked *


Main Index | Thread Index

Created by sa-20000
Last modified 2010-06-11 07:54 PM
 

Powered by: •Debian GNU/Linux      •Apache      •Plone      •Qmail      •DjbDNS      •....