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:40:27 -0500 Message-ID: <87a5ezvkj8.fsf@pub.pink> References: <87y12jvl9n.fsf@pub.pink> <87plnvvl48.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="35559"; 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:41:56 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 1t2HCt-00096X-91 for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 19 Oct 2024 23:41:55 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t2HCe-0006GG-5l; Sat, 19 Oct 2024 17:41:40 -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 1t2HCc-0006Fn-FW for bug-gnu-emacs@gnu.org; Sat, 19 Oct 2024 17:41:38 -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 1t2HCc-00029L-1I for bug-gnu-emacs@gnu.org; Sat, 19 Oct 2024 17:41: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=zHOGEzo9aIu0tYmfNPHwdLILPTOk8R4phKfenBn8fVk=; b=d1O0ZLUrFy93sCrfnVMbK4UIxh9wwsdtB787tnWDqaLSRgaW+mOnQMkd+5HqYC9tlYKip2/IqQ6taaEyusYU56Oj8Gp1nDly3E0jxuMio9Cfl9evueG5uvf3UFW3dAryA4cXuy2wyz7Ok+P5ultBMykqGMvdR5eE7TswC5s2oGb36hmcoygkV2GGwyx6XzSHUaB79spOWxv1Tdo1ZAVUM9wClMO23/iaVPcuuM6IntNXZKhqG2wl8fCrLnOVHIXPTsbhJVBy6WK453xeG1A8f5tItLgriYJw/EhnVwn1W9OuZZXYfAQYZjOEQemrVQyyeXyg2D1Ys02f6lBii60C3g==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1t2HD0-0005wu-0j for bug-gnu-emacs@gnu.org; Sat, 19 Oct 2024 17:42: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:42:01 +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.172937406222786 (code B ref 73891); Sat, 19 Oct 2024 21:42:01 +0000 Original-Received: (at 73891) by debbugs.gnu.org; 19 Oct 2024 21:41:02 +0000 Original-Received: from localhost ([127.0.0.1]:44978 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t2HC2-0005vS-6r for submit@debbugs.gnu.org; Sat, 19 Oct 2024 17:41:02 -0400 Original-Received: from fout-a3-smtp.messagingengine.com ([103.168.172.146]:55823) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t2HBy-0005un-M0 for 73891@debbugs.gnu.org; Sat, 19 Oct 2024 17:41:00 -0400 Original-Received: from phl-compute-01.internal (phl-compute-01.phl.internal [10.202.2.41]) by mailfout.phl.internal (Postfix) with ESMTP id 4418313801E1; Sat, 19 Oct 2024 17:40:29 -0400 (EDT) Original-Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-01.internal (MEProxy); Sat, 19 Oct 2024 17:40:29 -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=1729374029; x=1729460429; bh=zHOGEzo9aI u0tYmfNPHwdLILPTOk8R4phKfenBn8fVk=; b=hkrgYOwRQGLcmKNYY+wyxVGdzA jF92qdsDRQ14iZ1cpaC4rcnre9r6CukR9zC2HkDh7PZfikPcx5KrgaWUXib4CmZT M8A1dDdol+BCx1118aB7Xigzh7yHXzJYqjL3ef+KogtVY6QRwL4qBJrKhL1sXsRh CcFS3DVEYZYiH0MAQ6ec7WmAokqlzl7QE+o8vBhB2OdUkhylkFhcDechZBLAYUDJ qUt1pv/jX/LJ0AZPNAPwhxMYCn0zirk3NogXQB0XSspa1dV+LEVEB4x0ojM+VuGB U71h/jmXMcaY0/bNv5CfhSxzlWxOyqgKBcBpSrFVjI7TfgAAMPeazwT5g1zA== 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=1729374029; x=1729460429; bh=zHOGEzo9aIu0tYmfNPHwdLILPTOk 8R4phKfenBn8fVk=; b=JPPf7/fAX61hLoVLmb3q5n3dIyZvIIFb4PkxsE+BOhY2 T9SOxVC0vJUagxmK3pNFgkp4y/RPq4m0IMeuTU8W25M430UsaNqIh1OJzrjTweSH i7CQLgMy1QDeyR5mMm8/x7aih1oFKruw6SyFJYeHbt93tvm5df0Mcqq2QxSQJdm4 vD6UHgnovSLsd8rKEPTQx4BDUjkjaaauS0tdcvopp2CGBD4BIFP+v9SSMKLWr59I Vdo+/OM3HoifZoKUzI/YuiHMZ/h3Yb3RRFI+9cAHNFGdNja+F5O0zGirLr8R0gY+ WppAwz+TAzqqRBZlQgkYnobCoPuNWW08GRInjZi79g== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrvdehiedgtdduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh htshculddquddttddmnecujfgurhephffvvefujghffgffkfggtgesmhdtreertdertden ucfhrhhomhepjhhohhhnuchmuhhhlhcuoehjmhesphhusgdrphhinhhkqeenucggtffrrg htthgvrhhnpeffudeltdffhfejudehgefhfeeltdefteffgfdtveelieduheeuffdujeev ffdvtdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpe hjmhesphhusgdrphhinhhkpdhnsggprhgtphhtthhopedvpdhmohguvgepshhmthhpohhu thdprhgtphhtthhopehmohhnnhhivghrsehirhhordhumhhonhhtrhgvrghlrdgtrgdprh gtphhtthhopeejfeekleduseguvggssghughhsrdhgnhhurdhorhhg X-ME-Proxy: Feedback-ID: i74194916:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 19 Oct 2024 17:40:28 -0400 (EDT) In-Reply-To: <87plnvvl48.fsf@pub.pink> (john muhl's message of "Sat, 19 Oct 2024 16:27:51 -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:293915 Archived-At: --=-=-= Content-Type: text/plain Err. I guess it should have a NEWS entry too. Sorry for the flood. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Add-ability-to-crossfade-between-songs-in-mpc.patch >From 984eccb981127b417fd883e03e4cd7ab38baa06c 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) --- 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. + * 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 --=-=-= Content-Type: text/plain john muhl writes: > And the patch... > > [2. text/x-patch; 0001-Add-ability-to-crossfade-between-songs-in-mpc.patch]... > > > > 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. --=-=-=--