emms-patches
[Top][All Lists]
Advanced

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

[Emms-patches] darcs patch: Add emms-volume and emms-volume-amixer.


From: Martin Schoenmakers
Subject: [Emms-patches] darcs patch: Add emms-volume and emms-volume-amixer.
Date: Wed, 31 May 2006 00:38:35 +0200

Wed May 31 00:35:00 CEST 2006  Martin Schoenmakers <address@hidden>
  * Add emms-volume and emms-volume-amixer.
  
  New files: emms-volume.el provides some general volume changing things,
  including a minor mode to more easily change volume when not in the
  EMMS buffer. emms-volume-amixer.el is a backend using amixer.
  
New patches:

[Add emms-volume and emms-volume-amixer.
Martin Schoenmakers <address@hidden>**20060530223500
 
 New files: emms-volume.el provides some general volume changing things,
 including a minor mode to more easily change volume when not in the
 EMMS buffer. emms-volume-amixer.el is a backend using amixer.
 
] {
addfile ./emms-volume-amixer.el
hunk ./emms-volume-amixer.el 1
+;;; emms-volume-amixer.el --- a mode for changing volume using amixer
+
+;; Copyright (C) 2006 Free Software Foundation, Inc.
+
+;; Author: Martin Schoenmakers <address@hidden>
+
+;; This file is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 2, or (at your option)
+;; any later version.
+;;
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs; see the file COPYING. If not, write to the
+;; Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+;; Boston, MA 02110-1301 USA
+
+;;; Commentary:
+
+;; This file defines a few simple functions to raise or lower the volume
+;; using amixer. It can be used stand-alone, though it's meant for usage
+;; with EMMS, particularly with emms-volume.el
+
+;;; History:
+
+;; May 30 2006: First cleanup and collation of amixer functions into a
+;;              separate file for releasability.
+
+;;; Todo:
+
+;; There probably needs to be more configurability, which may in turn
+;; mean adding some more functions.
+;; Some of this could benefit from adding customize interfaces.
+
+;;; Code:
+
+(defun emms-volume-amixer-sset-master (var)
+  "Change amixer master volume by VAR."
+  (start-process "mixer" nil "amixer" "sset" "Master" var))
+
+(defun emms-volume-amixer-raise ()
+  "Increase volume by 2%."
+  (interactive)
+  (emms-volume-amixer-sset-master "2%+"))
+
+(defun emms-volume-amixer-lower ()
+  "Decrease volume by 2%."
+  (interactive)
+  (emms-volume-amixer-sset-master "2%-"))
+
+(provide 'emms-volume-amixer)
+
+;;; emms-volume-amixer.el ends here
addfile ./emms-volume.el
hunk ./emms-volume.el 1
+;;; emms-volume.el --- Volume functions and a minor mode to adjust volume 
easily
+
+;; Copyright (C) 2006 Free Software Foundation, Inc.
+
+;; Author: Martin Schoenmakers <address@hidden>
+
+;; This file is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 2, or (at your option)
+;; any later version.
+;;
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs; see the file COPYING. If not, write to the
+;; Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+;; Boston, MA 02110-1301 USA
+
+;;; Commentary:
+;; 
+;; This file provides generally two things:
+;; Generic volume setting functions and some appropriate bindings for EMMS
+;; playlist buffers. These can also be bound to global keys,however, the
+;; second part may be more useful for this. This part provides functions
+;; meant to be bound to a global key (the author uses C-c e + and C-c e -),
+;; which then temporarily activates a minor mode allowing you to change the
+;; volume with just + and -. This mode deactivates a short (configurable)
+;; amount of time after the last volume change. This allows for easier volume
+;; adjustment without getting in the way.
+
+;;; History:
+
+;; May 2006: First stab at writing the minor mode.
+;;
+;; 30 May 2006: Cleanup and restructuring to fit with EMMS.
+
+;;; Todo:
+
+;; Some of this could benefit from adding customize interfaces.
+
+;;; Code:
+
+;; General volume setting related code.
+(defvar emms-volume-raise-function 'emms-volume-amixer-raise
+  "*The function to use to raise the volume.
+If you have your own functions for changing volume, set this and
+ `emms-volume-lower-function' accordingly.")
+
+(defvar emms-volume-lower-function 'emms-volume-amixer-lower
+  "*The function to use to lower the volume.
+If you have your own functions for changing volume, set this and
+ `emms-volume-raise-function' accordingly.")
+
+(defun emms-volume-raise ()
+  "Raise the speaker volume."
+  (interactive)
+  (funcall emms-volume-raise-function))
+
+(defun emms-volume-lower ()
+  "Lower the speaker volume."
+  (interactive)
+  (funcall emms-volume-lower-function))
+
+(define-key emms-playlist-mode-map (kbd "+") 'emms-volume-raise)
+(define-key emms-playlist-mode-map (kbd "-") 'emms-volume-lower)
+
+;; Code specific to the minor mode.
+(define-minor-mode emms-volume-minor-mode
+  "Allows volume setting with + and - after an initial key combo."
+  :global t
+  :init-value nil
+  :lighter " (+/-)"
+  :keymap '(("+" . emms-volume-mode-plus)
+            ("-" . emms-volume-mode-minus)))
+
+(defvar emms-volume-mode-timeout 2
+  "*The timeout in amount of seconds used by `emms-volume-minor-mode'.")
+
+(defvar emms-volume-mode-timer nil
+  "The timer `emms-volume-minor-mode' uses.")
+
+(defun emms-volume-mode-plus ()
+  "Raise volume and enable or extend the `emms-volume-minor-mode' timeout."
+  (interactive)
+  (emms-volume-raise)
+  (emms-volume-mode-start-or-extend))
+
+(defun emms-volume-mode-minus ()
+  "Lower volume and enable or extend the `emms-volume-minor-mode' timeout."
+  (interactive)
+  (emms-volume-lower)
+  (emms-volume-mode-start-or-extend))
+
+(defun emms-volume-mode-disable-timer ()
+  "Disable `emms-volume-minor-mode' timer."
+  (cancel-timer emms-volume-mode-timer)
+  (setq emms-volume-mode-timer nil))
+
+(defun emms-volume-mode-set-timer ()
+  "Set a new `emms-volume-minor-mode' timer."
+  (unless (null emms-volume-mode-timer)
+    (emms-volume-mode-disable-timer))
+  (setq emms-volume-mode-timer (run-at-time emms-volume-mode-timeout
+                                       nil
+                                       'emms-volume-mode-timer-timeout)))
+
+(defun emms-volume-mode-timer-timeout ()
+  "Function to disable `emms-volume-minor-mode' at timeout."
+  (emms-volume-minor-mode -1))
+
+(defun emms-volume-mode-start-or-extend ()
+  "Start `emms-volume-minor-mode' or extend its running time."
+  (when (null emms-volume-minor-mode)
+    (emms-volume-minor-mode 1))
+  (emms-volume-mode-set-timer))
+
+(provide 'emms-volume)
+
+;;; emms-volume.el ends here
}

Context:

[emms-streams: When the user wants emms-streams to play the selected stream 
instead of add it, create our own playlist buffer.  When quitting, if we own 
the current playlist buffer, kill it.
Michael Olson <address@hidden>**20060530144243] 
[emms-streams: Re-implement yank and kill so that they do the right thing with 
emms-stream-list.
Michael Olson <address@hidden>**20060530045429] 
[allow nonzero ogginfo exit plus some reindenting
Martin Schoenmakers <address@hidden>**20060530130411
 
 When ogginfo gave a nonzero value on exit, any valid data would get tossed
 if there was any. This prevented emms from showing info for files that are
 tagged but a bit odd.
 
 Also reindented emms-info-ogginfo accordingly, which incidentally removed
 some tabs in favour of spaces.
 
] 
[emms-streams: Implement kill and yank.
Michael Olson <address@hidden>**20060530040114] 
[emms-streams: Make hitting RET on a URL do the right thing, improve cursor 
movement, and mark the buffer as unmodified after performing a save.
Michael Olson <address@hidden>**20060529030043] 
[emms-player-mpd: Make seek work correctly.
Michael Olson <address@hidden>**20060525033120] 
[emms-player-mpd: Use more robust method of detecting whether we need to 
force-feed MusicPD our playlist.
Michael Olson <address@hidden>**20060525014253] 
[emms-playlist-mode: Make "d" kill the entire line.  This seems to be a good 
compromise of those who use C-k and those who want more standard object-killing 
behavior.
foo**20060524200008] 
[emms-player-mpd: When showing the currently-playing song, prepend the name of 
the radio station, if it exists.
foo**20060524195911] 
[emms-player-mpd: Fix bug that caused unconditional reloading of the entire 
MusicPD playlist whenever the track was changed manually.
Michael Olson <address@hidden>**20060524061655] 
[emms-player-mpd: Overhaul for streamlist support, and fix a few miscellaneous 
issues.
Michael Olson <address@hidden>**20060524055707] 
[emms-player-mpd: Add a few checks to make sure that the given buffer exists 
before trying to do anything with it.
Michael Olson <address@hidden>**20060517035419] 
[emms-source-playlist: Do not expand names of files in playlists, as this can 
cause problems with emms-player-mpd in some configurations.
Michael Olson <address@hidden>**20060516081257] 
[emms-playlist-mode: Implement the option (disabled by default) of opening a 
new EMMS buffer for a playlist, when hitting RET on one.
Michael Olson <address@hidden>**20060510040730] 
[emms-playlist-mode.el: Don't put a period after the mode map. This hangs 21.4 
on display.
address@hidden 
[TAG 2.0
address@hidden 
Patch bundle hash:
342b75fa7c12385911bb70e361139ebda5f63c78

reply via email to

[Prev in Thread] Current Thread [Next in Thread]