Greetings Yoni,

Yoni Rabkin <[email protected]> writes:

>> Please, let me know if you need anything else on my part.
>
> Yes, there is a bit more I would like to ask:
>
> Since emms-volume.el requires emms-volume-amixer, should it not also
> require emms-volume-mixerctl and emms-volume-pulse? It would be good to
> sort that out. It would be good to have a patch which does that. [...]
>
> I would also like to ask for a patch that updates the manual as to
> emms-volume-mixerctl (right where ...-amixer is mentioned), a patch
> which adds your name and email to the AUTHORS file, and a patch to the
> NEWS file.

These are implemented in [1].


> You can send these patches to the emms-help mailing list (where we
> should continue any technical discussion).

I chose to do this for the sake of broader peer review.


> But I can also add you to the Emms developers group on Savannah so
> that you can simply push changes to the git repo; whichever suits you.

I’d be honored to have this power, though. :)


I also seized the opportunity to implement[2] a simple volume mixer
auto-detection for the initial definition of
‘emms-volume-change-function’.  Please, let me know what you think.


Footnotes: 
[1] 0001-Make-changes-required-by-the-inclusion-of-lisp-emms-.patch
[2] 0002-Implement-mixer-auto-detection.patch

>From 7897f23bf9bcb578eaba3e3fa855495a8d1ad684 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bruno=20F=C3=A9lix=20Rezende=20Ribeiro?= <[email protected]>
Date: Mon, 26 Aug 2019 23:15:41 -0300
Subject: [PATCH 1/2] =?UTF-8?q?Make=20changes=20required=20by=20the=20incl?=
 =?UTF-8?q?usion=20of=20=E2=80=98lisp/emms-volume-mixerctl.el=E2=80=99.?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* AUTHORS: Add ‘Bruno Félix Rezende Ribeiro’ as contributor.
* NEWS: Add entry about ‘emms-volume-mixerctl.el’
* doc/emms.texinfo: Add mention to ‘mixerctl’.
* lisp/emms-volume.el: Require ’emms-volume-pulse’ and
    ’emms-volume-mixerctl’.  Add ‘emms-volume-mixerctl-change’ to
    ‘emms-volume-change-function’ customize interface.
---
 AUTHORS             | 1 +
 NEWS                | 5 +++++
 doc/emms.texinfo    | 4 ++--
 lisp/emms-volume.el | 4 ++++
 4 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/AUTHORS b/AUTHORS
index 0816b56..ef24557 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -5,6 +5,7 @@ claims on sources, so please don't be too humble and add yourself.
 
 Alex Kost     	         <[email protected]>
 Bram van der Kroef       <[email protected]>
+Bruno Félix R. Ribeiro	 <[email protected]>
 Daimrod      		 <[email protected]>
 Damien Elmes		 <[email protected]>
 Daniel Brockman		 <[email protected]>
diff --git a/NEWS b/NEWS
index 2d75191..57c5340 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,8 @@
+News since version 5.2
+
+  - emms-volume-mixerctl.el: implementation for changing volume using
+    mixerctl.
+
 News since version 5.1
 
   - emms-browser.el: faster thumbnail cache lookups.
diff --git a/doc/emms.texinfo b/doc/emms.texinfo
index 0777e14..07e3741 100644
--- a/doc/emms.texinfo
+++ b/doc/emms.texinfo
@@ -2422,8 +2422,8 @@ value. So instead of pressing @kbd{C-c +} six times to increase volume
 by six steps of @code{emms-volume-change-amount}, you would simply type
 @kbd{C-c + + + + + +}.
 
-Emms can change volume with amixer, mpd, PulseAudio out of the box, see
-@var{emms-volume-change-function}.
+Emms can change volume with amixer, mpd, PulseAudio and mixerctl out
+of the box, see @var{emms-volume-change-function}.
 
 
 @c -------------------------------------------------------------------
diff --git a/lisp/emms-volume.el b/lisp/emms-volume.el
index 917ab2d..45b1d4d 100644
--- a/lisp/emms-volume.el
+++ b/lisp/emms-volume.el
@@ -3,6 +3,7 @@
 ;; Copyright (C) 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
 
 ;; Author: Martin Schoenmakers <[email protected]>
+;;         Bruno Félix Rezende Ribeiro <[email protected]>
 
 ;; This file is part of EMMS.
 
@@ -49,6 +50,8 @@
 (require 'emms)
 (require 'emms-playlist-mode)
 (require 'emms-volume-amixer)
+(require 'emms-volume-pulse)
+(require 'emms-volume-mixerctl)
 
 ;; Customize group
 (defgroup emms-volume nil
@@ -62,6 +65,7 @@ If you have your own functions for changing volume, set this."
   :type '(choice (const :tag "Amixer" emms-volume-amixer-change)
                  (const :tag "MPD" emms-volume-mpd-change)
 		 (const :tag "PulseAudio" emms-volume-pulse-change)
+		 (const :tag "Mixerctl" emms-volume-mixerctl-change)
                  (function :tag "Lisp function"))
   :group 'emms-volume)
 
-- 
2.7.4

>From 41896888a9cbb035800370eeca80391aa2615af5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bruno=20F=C3=A9lix=20Rezende=20Ribeiro?= <[email protected]>
Date: Mon, 26 Aug 2019 23:24:43 -0300
Subject: [PATCH 2/2] Implement mixer auto-detection.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

lisp/emms-volume.el: Initial definition of
  ‘emms-volume-change-function’ tries mixer auto-detection, falling back
  to an instructive message on failure.

NEWS: Add entry about this feature.
---
 NEWS                | 2 ++
 lisp/emms-volume.el | 7 ++++++-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/NEWS b/NEWS
index 57c5340..032b22a 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,8 @@ News since version 5.2
 
   - emms-volume-mixerctl.el: implementation for changing volume using
     mixerctl.
+  - Initial definition of `emms-volume-change-function' tries mixer
+    auto-detection, falling back to an instructive message on failure.
 
 News since version 5.1
 
diff --git a/lisp/emms-volume.el b/lisp/emms-volume.el
index 45b1d4d..30cce92 100644
--- a/lisp/emms-volume.el
+++ b/lisp/emms-volume.el
@@ -59,7 +59,12 @@
   :group 'emms)
 
 ;; General volume setting related code.
-(defcustom emms-volume-change-function 'emms-volume-amixer-change
+(defcustom emms-volume-change-function
+  (cond
+   ((executable-find "amixer") 'emms-volume-amixer-change)
+   ((executable-find "pactl") 'emms-volume-pulse-change)
+   ((executable-find "mixerctl") emms-volume-mixerctl-change)
+   ((t #'(lambda (amount) (user-error "%s" "No supported mixer found.  Please, define ‘emms-volume-change-function’.")))))
   "*The function to use to change the volume.
 If you have your own functions for changing volume, set this."
   :type '(choice (const :tag "Amixer" emms-volume-amixer-change)
-- 
2.7.4

-- 
 88888  FFFFF Bruno Félix Rezende Ribeiro (oitofelix) [0x28D618AF]
 8   8  F     http://oitofelix.freeshell.org/
 88888  FFFF  mailto:[email protected]
 8   8  F     irc://chat.freenode.org/oitofelix
 88888  F     xmpp://[email protected]
_______________________________________________
Emms-help mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/emms-help

Reply via email to