aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuchen Pei <hi@ypei.me>2021-10-13 15:18:42 +1100
committerYuchen Pei <hi@ypei.me>2021-10-13 15:18:42 +1100
commit77c26b1b9a63d4a610cd0ba4693ffa24cc8ea64b (patch)
tree281cec8548563762a82ea2d9de354c5154036afa
parentbbe2a14bed9716e6a6e16c281c85b305bd247cff (diff)
parentc42fab572846b1dd76d82c5293ccfb6ee2c45991 (diff)
Merge branch 'master' of git.savannah.gnu.org:/srv/git/emms
-rw-r--r--AUTHORS1
-rw-r--r--NEWS7
-rw-r--r--doc/developer-release.txt2
-rw-r--r--emms-source-file.el4
-rw-r--r--emms-volume-sndioctl.el72
-rw-r--r--emms-volume.el11
-rw-r--r--emms.el4
7 files changed, 94 insertions, 7 deletions
diff --git a/AUTHORS b/AUTHORS
index 3066a76..b577bb1 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -24,6 +24,7 @@ Martin Schoenmakers <aiviru@diamond-age.net>
Matthew Kennedy <mkennedy@gentoo.org>
Michael Olson <mwolson@gnu.org>
Nick Alcock <nix@esperi.org.uk>
+Omar Polo <op@omarpolo.com>
Petteri Hintsanen <petterih@iki.fi>
Pierre Neidhardt <mail@ambrevar.xyz>
stardiviner <numbchild@gmail.com>
diff --git a/NEWS b/NEWS
index 30b97f7..d2fc196 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,10 @@
+New in 7.7
+
+ * Add sndioctl support.
+ * Use thing-at-point for URLs.
+ * Add player-preference interface.
+
+
New in 7.6
* Change the way we write the NEWS file: "New in..." instead of "News since...".
diff --git a/doc/developer-release.txt b/doc/developer-release.txt
index cd3e06d..69f4dc8 100644
--- a/doc/developer-release.txt
+++ b/doc/developer-release.txt
@@ -8,6 +8,8 @@ distributed via Emacs ELPA (https://elpa.gnu.org/).
* Update NEWS.
+* Update AUTHORS file with the names of any new contributors.
+
* Update the manual (makeinfo --html --no-split emms.texinfo).
* Update website (cvs commit -m "update website" index.html).
diff --git a/emms-source-file.el b/emms-source-file.el
index 56755af..7186a92 100644
--- a/emms-source-file.el
+++ b/emms-source-file.el
@@ -45,6 +45,7 @@
(require 'locate)
(error nil)))
(require 'dired)
+(require 'thingatpt)
(defgroup emms-source-file nil
"*Sources for EMMS that use the file system."
@@ -293,8 +294,7 @@ files) can play."
;;;###autoload (autoload 'emms-add-url "emms-source-file" nil t)
(define-emms-source url (url)
"An EMMS source for an URL - for example, for streaming."
- (interactive (list
- (read-string "Play URL: " (thing-at-point-url-at-point))))
+ (interactive (list (read-string "Play URL: " (thing-at-point-url-at-point))))
(emms-playlist-insert-track (emms-track 'url url)))
;;;###autoload (autoload 'emms-play-streamlist "emms-source-file" nil t)
diff --git a/emms-volume-sndioctl.el b/emms-volume-sndioctl.el
new file mode 100644
index 0000000..74ca4b3
--- /dev/null
+++ b/emms-volume-sndioctl.el
@@ -0,0 +1,72 @@
+;;; emms-volume-sndioctl.el --- a mode for changing volume using sndioctl -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2006, 2007, 2008, 2009, 2019 Free Software Foundation, Inc.
+
+;; Authors: Omar Polo <op@omarpolo.com>
+
+;; This file is part of EMMS.
+
+;; EMMS 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 3, or (at your option)
+;; any later version.
+;;
+;; EMMS 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 EMMS; 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 sndioctl. It can be used stand-alone, though it's
+;; meant for usage with EMMS, particularly with emms-volume.el
+
+;;; History:
+
+;; Sep 09 2021: Based on emms-volume-mixerctl.el by Omar Polo
+
+;;; Code:
+(require 'subr-x)
+
+(defcustom emms-volume-sndioctl-stream "output"
+ "The stream to change the volume with.
+Usually it's the global \"output\". For a full list of available
+controls, run `sndioctl' in a shell."
+ :type '(choice (const :tag "output" "output")
+ (string :tag "Something else: "))
+ :group 'emms-volume)
+
+(defcustom emms-volume-sndioctl-device nil
+ "The card number to change volume.
+The card is identified by a number. For a full list run `ls
+/dev/mixer?*' in a shell."
+ :type '(choice (const :tag "none" nil)
+ (string :tag "Device: "))
+ :group 'emms-volume)
+
+;;;###autoload
+(defun emms-volume-sndioctl-change (amount)
+ "Change sndioctl level by AMOUNT."
+ (message "Playback channels: %s"
+ (with-temp-buffer
+ (when (zerop
+ (apply #'call-process
+ "sndioctl" nil (current-buffer) nil
+ `("-n"
+ ,@(when emms-volume-sndioctl-device
+ `("-f" ,emms-volume-sndioctl-device))
+ ,(format "%s.level=%s%f"
+ emms-volume-sndioctl-stream
+ (if (> amount 0) "+" "")
+ (/ (float amount) 100)))))
+ (string-trim-right (buffer-string))))))
+
+(provide 'emms-volume-sndioctl)
+
+;;; emms-volume-sndioctl.el ends here
diff --git a/emms-volume.el b/emms-volume.el
index bb92a31..dd40934 100644
--- a/emms-volume.el
+++ b/emms-volume.el
@@ -52,6 +52,7 @@
(require 'emms-volume-amixer)
(require 'emms-volume-pulse)
(require 'emms-volume-mixerctl)
+(require 'emms-volume-sndioctl)
;; Customize group
(defgroup emms-volume nil
@@ -61,9 +62,12 @@
;; General volume setting related code.
(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)
+ ;; check for sndioctl first to avoid picking up mixerctl or pactl
+ ;; on OpenBSD.
+ ((executable-find "sndioctl") #'emms-volume-sndioctl-change)
+ ((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."
@@ -71,6 +75,7 @@ If you have your own functions for changing volume, set this."
(const :tag "MPD" emms-volume-mpd-change)
(const :tag "PulseAudio" emms-volume-pulse-change)
(const :tag "Mixerctl" emms-volume-mixerctl-change)
+ (const :tag "Sndioctl" emms-volume-sndioctl-change)
(function :tag "Lisp function")))
(defcustom emms-volume-change-amount 2
diff --git a/emms.el b/emms.el
index f3bb678..2186853 100644
--- a/emms.el
+++ b/emms.el
@@ -4,7 +4,7 @@
;; Author: Jorgen Schäfer <forcer@forcix.cx>, the Emms developers (see AUTHORS file)
;; Maintainer: Yoni Rabkin <yrk@gnu.org>
-;; Version: 7.6
+;; Version: 7.7
;; Keywords: emms, mp3, ogg, flac, music, mpeg, video, multimedia
;; Package-Type: multi
;; Package-Requires: ((cl-lib "0.5") (nadvice "0.3") (seq))
@@ -44,7 +44,7 @@
;;; Code:
-(defvar emms-version "7.6"
+(defvar emms-version "7.7"
"EMMS version string.")