* bug#73891: [PATCH] Add ability to crossfade between songs in 'mpc' @ 2024-10-19 21:24 john muhl 2024-10-19 21:27 ` john muhl 0 siblings, 1 reply; 5+ messages in thread From: john muhl @ 2024-10-19 21:24 UTC (permalink / raw) To: 73891; +Cc: Stefan Monnier Tags: patch Another small addition for mpc so that you can toggle the crossfader. p.s. I noticed the use of (cdr (assq 'etc ...)) throughout and guessed that was because mpc predates alist-get but if there is a preference I can change it to match the other mpc-toggle-* functions. ^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#73891: [PATCH] Add ability to crossfade between songs in 'mpc' 2024-10-19 21:24 bug#73891: [PATCH] Add ability to crossfade between songs in 'mpc' john muhl @ 2024-10-19 21:27 ` john muhl 2024-10-19 21:40 ` john muhl 0 siblings, 1 reply; 5+ messages in thread From: john muhl @ 2024-10-19 21:27 UTC (permalink / raw) To: 73891; +Cc: Stefan Monnier [-- Attachment #1: Type: text/plain, Size: 18 bytes --] And the patch... [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: 0001-Add-ability-to-crossfade-between-songs-in-mpc.patch --] [-- Type: text/x-patch, Size: 2193 bytes --] From e2855c6493d8d0ab06a97452b567e87701754601 Mon Sep 17 00:00:00 2001 From: john muhl <jm@pub.pink> Date: Sat, 28 Sep 2024 19:11:03 -0500 Subject: [PATCH] Add ability to crossfade between songs in 'mpc' * lisp/mpc.el (mpc-cmd-crossfade): (mpc-toggle-crossfade): New function. (mpc-crossfade-time): New option. (mpc-mode-menu): Add menu item to toggle crossfade. (Bug#73891) --- lisp/mpc.el | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/lisp/mpc.el b/lisp/mpc.el index 9905e3aa554..01876bf230b 100644 --- a/lisp/mpc.el +++ b/lisp/mpc.el @@ -883,6 +883,11 @@ mpc-cmd-update (defun mpc-cmd-tagtypes () (mapcar #'cdr (mpc-proc-cmd-to-alist "tagtypes"))) +(defun mpc-cmd-crossfade (&optional arg) + "Set duration of crossfade to `mpc-crossfade-time' or ARG seconds." + (mpc-proc-cmd (list "crossfade" (or arg mpc-crossfade-time)) + #'mpc-status-refresh)) + ;; This was never integrated into MPD. ;; (defun mpc-cmd-download (file) ;; (with-current-buffer (generate-new-buffer " *mpc download*") @@ -918,6 +923,11 @@ mpc-data-directory "Directory where MPC.el stores auxiliary data." :type 'directory) +(defcustom mpc-crossfade-time 3 + "Number of seconds to crossfade between songs." + :version "31.1" + :type 'natnum) + (defun mpc-data-directory () (unless (file-directory-p mpc-data-directory) (make-directory mpc-data-directory)) @@ -1188,6 +1198,8 @@ mpc-mode-menu :selected (member '(single . "1") mpc-status)] ["Consume Mode" mpc-toggle-consume :style toggle :selected (member '(consume . "1") mpc-status)] + ["Crossfade Songs" mpc-toggle-crossfade :style toggle + :selected (alist-get 'xfade mpc-status)] "--" ["Add new browser" mpc-tagbrowser] ["Update DB" mpc-update] @@ -2428,6 +2440,12 @@ mpc-toggle-shuffle (mpc-cmd-random (if (string= "0" (cdr (assq 'random (mpc-cmd-status)))) "1" "0"))) +(defun mpc-toggle-crossfade () + "Toggle crossfading between songs." + (interactive) + (mpc-cmd-crossfade + (if (alist-get 'xfade mpc-status) "0" mpc-crossfade-time))) + (defun mpc-stop () "Stop playing the current queue of songs." (interactive) -- 2.46.2 [-- Attachment #3: Type: text/plain, Size: 334 bytes --] john muhl <jm@pub.pink> writes: > Tags: patch > > Another small addition for mpc so that you can toggle the > crossfader. > > p.s. I noticed the use of (cdr (assq 'etc ...)) throughout and > guessed that was because mpc predates alist-get but if there is a > preference I can change it to match the other mpc-toggle-* > functions. ^ permalink raw reply related [flat|nested] 5+ messages in thread
* bug#73891: [PATCH] Add ability to crossfade between songs in 'mpc' 2024-10-19 21:27 ` john muhl @ 2024-10-19 21:40 ` john muhl 2024-10-20 2:31 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors 0 siblings, 1 reply; 5+ messages in thread From: john muhl @ 2024-10-19 21:40 UTC (permalink / raw) To: 73891; +Cc: Stefan Monnier [-- Attachment #1: Type: text/plain, Size: 69 bytes --] Err. I guess it should have a NEWS entry too. Sorry for the flood. [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: 0001-Add-ability-to-crossfade-between-songs-in-mpc.patch --] [-- Type: text/x-patch, Size: 2758 bytes --] From 984eccb981127b417fd883e03e4cd7ab38baa06c Mon Sep 17 00:00:00 2001 From: john muhl <jm@pub.pink> Date: Sat, 28 Sep 2024 19:11:03 -0500 Subject: [PATCH] Add ability to crossfade between songs in 'mpc' * lisp/mpc.el (mpc-cmd-crossfade): (mpc-toggle-crossfade): New function. (mpc-crossfade-time): New option. (mpc-mode-menu): Add menu item to toggle crossfade. (Bug#73891) --- etc/NEWS | 5 +++++ lisp/mpc.el | 18 ++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/etc/NEWS b/etc/NEWS index a889528ab6a..cfc5a8e1785 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -582,6 +582,11 @@ a desktop notification when the song changes, using customized using the new user options 'mpc-notifications-title' and 'mpc-notifications-body'. +*** New user option 'mpc-crossfade-time'. +When non-nil, MPC will crossfade between songs for the specified number +of seconds. Crossfading can be toggled using the command +'mpc-toggle-crossfade' or from the MPC menu. + \f * New Modes and Packages in Emacs 31.1 diff --git a/lisp/mpc.el b/lisp/mpc.el index 9905e3aa554..01876bf230b 100644 --- a/lisp/mpc.el +++ b/lisp/mpc.el @@ -883,6 +883,11 @@ mpc-cmd-update (defun mpc-cmd-tagtypes () (mapcar #'cdr (mpc-proc-cmd-to-alist "tagtypes"))) +(defun mpc-cmd-crossfade (&optional arg) + "Set duration of crossfade to `mpc-crossfade-time' or ARG seconds." + (mpc-proc-cmd (list "crossfade" (or arg mpc-crossfade-time)) + #'mpc-status-refresh)) + ;; This was never integrated into MPD. ;; (defun mpc-cmd-download (file) ;; (with-current-buffer (generate-new-buffer " *mpc download*") @@ -918,6 +923,11 @@ mpc-data-directory "Directory where MPC.el stores auxiliary data." :type 'directory) +(defcustom mpc-crossfade-time 3 + "Number of seconds to crossfade between songs." + :version "31.1" + :type 'natnum) + (defun mpc-data-directory () (unless (file-directory-p mpc-data-directory) (make-directory mpc-data-directory)) @@ -1188,6 +1198,8 @@ mpc-mode-menu :selected (member '(single . "1") mpc-status)] ["Consume Mode" mpc-toggle-consume :style toggle :selected (member '(consume . "1") mpc-status)] + ["Crossfade Songs" mpc-toggle-crossfade :style toggle + :selected (alist-get 'xfade mpc-status)] "--" ["Add new browser" mpc-tagbrowser] ["Update DB" mpc-update] @@ -2428,6 +2440,12 @@ mpc-toggle-shuffle (mpc-cmd-random (if (string= "0" (cdr (assq 'random (mpc-cmd-status)))) "1" "0"))) +(defun mpc-toggle-crossfade () + "Toggle crossfading between songs." + (interactive) + (mpc-cmd-crossfade + (if (alist-get 'xfade mpc-status) "0" mpc-crossfade-time))) + (defun mpc-stop () "Stop playing the current queue of songs." (interactive) -- 2.46.2 [-- Attachment #3: Type: text/plain, Size: 487 bytes --] john muhl <jm@pub.pink> writes: > And the patch... > > [2. text/x-patch; 0001-Add-ability-to-crossfade-between-songs-in-mpc.patch]... > > > > john muhl <jm@pub.pink> writes: > >> Tags: patch >> >> Another small addition for mpc so that you can toggle the >> crossfader. >> >> p.s. I noticed the use of (cdr (assq 'etc ...)) throughout and >> guessed that was because mpc predates alist-get but if there is a >> preference I can change it to match the other mpc-toggle-* >> functions. ^ permalink raw reply related [flat|nested] 5+ messages in thread
* bug#73891: [PATCH] Add ability to crossfade between songs in 'mpc' 2024-10-19 21:40 ` john muhl @ 2024-10-20 2:31 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors 2024-10-21 18:21 ` john muhl 0 siblings, 1 reply; 5+ messages in thread From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-10-20 2:31 UTC (permalink / raw) To: john muhl; +Cc: 73891 john muhl [2024-10-19 16:40:27] wrote: > p.s. I noticed the use of (cdr (assq 'etc ...)) throughout and > guessed that was because mpc predates alist-get That's right. > but if there is a preference I can change it to match the other > mpc-toggle-* functions. No, no, `alist-get` is fine, thanks. > And the patch... Pushed to `master`, thanks. Stefan ^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#73891: [PATCH] Add ability to crossfade between songs in 'mpc' 2024-10-20 2:31 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-10-21 18:21 ` john muhl 0 siblings, 0 replies; 5+ messages in thread From: john muhl @ 2024-10-21 18:21 UTC (permalink / raw) To: 73891-done Thanks. Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org> writes: > john muhl [2024-10-19 16:40:27] wrote: >> p.s. I noticed the use of (cdr (assq 'etc ...)) throughout and >> guessed that was because mpc predates alist-get > > That's right. > >> but if there is a preference I can change it to match the other >> mpc-toggle-* functions. > > No, no, `alist-get` is fine, thanks. > >> And the patch... > > Pushed to `master`, thanks. > > > Stefan ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-10-21 18:21 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2024-10-19 21:24 bug#73891: [PATCH] Add ability to crossfade between songs in 'mpc' john muhl 2024-10-19 21:27 ` john muhl 2024-10-19 21:40 ` john muhl 2024-10-20 2:31 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors 2024-10-21 18:21 ` john muhl
Code repositories for project(s) associated with this external index https://git.savannah.gnu.org/cgit/emacs.git https://git.savannah.gnu.org/cgit/emacs/org-mode.git This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.