From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: john muhl Newsgroups: gmane.emacs.bugs Subject: bug#73891: [PATCH] Add ability to crossfade between songs in 'mpc' Date: Sat, 19 Oct 2024 16:27:51 -0500 Message-ID: <87plnvvl48.fsf@pub.pink> References: <87y12jvl9n.fsf@pub.pink> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="32330"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e 1.12.1; emacs 31.0.50 Cc: Stefan Monnier To: 73891@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Oct 19 23:29:05 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1t2H0R-0008FG-Ie for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 19 Oct 2024 23:29:04 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t2H0F-00054r-Nn; Sat, 19 Oct 2024 17:28:52 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t2H02-00054K-Vd for bug-gnu-emacs@gnu.org; Sat, 19 Oct 2024 17:28:42 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t2H02-00013o-N4 for bug-gnu-emacs@gnu.org; Sat, 19 Oct 2024 17:28:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:References:In-Reply-To:From:To:Subject; bh=auRkqhBEtEd4e8ESt3De4dWJi/RaR7De51KvpWGbQe8=; b=LkCsTPPnQycvVcf/C1jE4TjLFOBI4Jr3Uq8QfMcAdkQhL7RMS+Q+GIA/qXffccsURl0U3bOXAlraue7JibuPdzp++feYAKrbOBPosXhZ1e8cK8VlRZ3eAIZhJL6ezYcJcevk5F5kQtARLIymgeZVL1i1VpD0XyCHCZ3aTwnrrdgjyBCeV1dx2DGt4Tko4thvCCMVn4gMq59Ydyw9BCjgPgLsoCzVXVqG/J8pXwo7hclgqHtztp7ImPYPXUgd2a2iziuyQ22F0NQjGGzrBJsE5JnOMN7Kg9+vcXVKliDz3lTLPebgz8+vnA5QlbToR+NuGPRw0+cligYqJJVFDuMTAQ==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1t2H0Q-0005Ds-Hz for bug-gnu-emacs@gnu.org; Sat, 19 Oct 2024 17:29:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: john muhl Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 19 Oct 2024 21:29:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 73891 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 73891-submit@debbugs.gnu.org id=B73891.172937330520028 (code B ref 73891); Sat, 19 Oct 2024 21:29:02 +0000 Original-Received: (at 73891) by debbugs.gnu.org; 19 Oct 2024 21:28:25 +0000 Original-Received: from localhost ([127.0.0.1]:44964 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t2Gzo-0005Cu-OH for submit@debbugs.gnu.org; Sat, 19 Oct 2024 17:28:25 -0400 Original-Received: from fout-a3-smtp.messagingengine.com ([103.168.172.146]:56487) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t2Gzm-0005Ce-Rr for 73891@debbugs.gnu.org; Sat, 19 Oct 2024 17:28:23 -0400 Original-Received: from phl-compute-07.internal (phl-compute-07.phl.internal [10.202.2.47]) by mailfout.phl.internal (Postfix) with ESMTP id C302B1380088; Sat, 19 Oct 2024 17:27:52 -0400 (EDT) Original-Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-07.internal (MEProxy); Sat, 19 Oct 2024 17:27:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pub.pink; h=cc :cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm2; t=1729373272; x=1729459672; bh=auRkqhBEtE d4e8ESt3De4dWJi/RaR7De51KvpWGbQe8=; b=GlkeUy+q5lO9Y1Lclw76aTMqmH QABDvv8L49pc+MMSUzE7QnvrEA5fNPIJiNIdxpM9tBOLJ0wT6ajMYw72slnJO8Da YqZJROwYouwyIMEJwJyBeb/fpkCWR9mHVnjpCgZ75h+WXsyzFAPeRInj6N4wzYbC bUPUqgMk0VyMvnHEcUC6YtA7IMkB/wL34QaYUijjZKceSM7BWL0WangaI0txhCkt eeqqI1iZfU5mGq/zrgAsot3FaTgzkoY8weOq4F9FZz2QAMoQ3oJR0M/VGVywOAp6 Y0WKzhpKK7ny46rNYYctycCwuOpU38DGokI5/K0Wnn+N5rGL8hoLym+t5HXg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; t=1729373272; x=1729459672; bh=auRkqhBEtEd4e8ESt3De4dWJi/Ra R7De51KvpWGbQe8=; b=ByM7rosdPyIq9Vbzn5Z/sXOb59zm1nBb6+76ghHTVQjh aQHbpj9TIkYzh7BSxDyqrax9Z2LJ9XGo1v+SegY8Iez66Bj/N3RDLg3gNEhF/sN5 /SrEDcDzLsfffNT1ALpOSUBbBFihQDQ7TMYeFMS/3WalnX8IFRH3TbiyL1H7o0Ma dHH169V1tWmpUBUjrFp81zrcEg4ojqo8CyJ/8khBMbcs1zhyXE2bep9J0HL6h3Bs hnd9HmeINkSenI/FNhH7HchZ/7KVOSiZ9t44FAXe/TAtml0MjoE4+7OXPzCpMwrd QfVkEvpFDe/UxcgzTRwag3IuL0ddyyTsu0qqFPQDHg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrvdehhedgudeigecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivg hnthhsucdlqddutddtmdenucfjughrpefhvfevufgjfhgffffkgggtsehmtderredtredt necuhfhrohhmpehjohhhnhcumhhuhhhluceojhhmsehpuhgsrdhpihhnkheqnecuggftrf grthhtvghrnhepffduledtfffhjeduheeghfefledtfeetfffgtdevleeiudehueffudej veffvddtnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomh epjhhmsehpuhgsrdhpihhnkhdpnhgspghrtghpthhtohepvddpmhhouggvpehsmhhtphho uhhtpdhrtghpthhtohepmhhonhhnihgvrhesihhrohdruhhmohhnthhrvggrlhdrtggrpd hrtghpthhtohepjeefkeeludesuggvsggsuhhgshdrghhnuhdrohhrgh X-ME-Proxy: Feedback-ID: i74194916:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 19 Oct 2024 17:27:52 -0400 (EDT) In-Reply-To: <87y12jvl9n.fsf@pub.pink> (john muhl's message of "Sat, 19 Oct 2024 16:24:36 -0500") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:293914 Archived-At: --=-=-= Content-Type: text/plain And the patch... --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Add-ability-to-crossfade-between-songs-in-mpc.patch >From e2855c6493d8d0ab06a97452b567e87701754601 Mon Sep 17 00:00:00 2001 From: john muhl 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 --=-=-= Content-Type: text/plain john muhl 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. --=-=-=--