From 7874d1a4f1ff50a1136f9624288bf96a7b13fe65 Mon Sep 17 00:00:00 2001 From: tho5 Date: Sun, 13 Mar 2022 20:32:47 +0100 Subject: [PATCH 1/3] Add default play-flags for wsl2/wslg on win11 --- csound-mode.el | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/csound-mode.el b/csound-mode.el index bc7d64e..428b391 100644 --- a/csound-mode.el +++ b/csound-mode.el @@ -65,12 +65,17 @@ (modify-syntax-entry ?* ". 23b" st) st) "Syntax table for csound-mode") - -(defcustom csound-play-flags "" - "Additional flags to pass to csound when playing the file in current buffer." +(defcustom csound-play-flags "" "Additional flags to pass to csound when playing the file in current buffer." :group 'csound-mode :type 'string) +;; default for wsl2/wslg (win11 with WSLg) +(and (string-empty-p csound-play-flags) + (string-match "linux" (format "%s" system-type)) + (string-match "WSL2" operating-system-release) + (not (string-empty-p (getenv "PULSE_SERVER"))) + (setq csound-play-flags "-+rtaudio=pulse -+server=unix:$PULSE_SERVER")) + (defcustom csound-render-flags "" "Additional flags to pass to csound when rendering csound to file." :group 'csound-mode @@ -86,8 +91,7 @@ (point-min) (point-max))))) (defun csound-render (bit filename) - "Render csound to file." - (interactive + "Render csound to file." (interactive (list (read-string "File bit-value(16/24/32), defaults to 16: ") (read-string (format "Filename, defaults to %s.wav: " (file-name-base))))) From 28b5eb2ad1c9b181ef8b02a4cb605f3d57e4fcb8 Mon Sep 17 00:00:00 2001 From: tho5 Date: Sun, 13 Mar 2022 20:41:56 +0100 Subject: [PATCH 2/3] Fix accidental undesired code formatting --- csound-mode.el | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/csound-mode.el b/csound-mode.el index 428b391..ecb5c44 100644 --- a/csound-mode.el +++ b/csound-mode.el @@ -65,7 +65,8 @@ (modify-syntax-entry ?* ". 23b" st) st) "Syntax table for csound-mode") -(defcustom csound-play-flags "" "Additional flags to pass to csound when playing the file in current buffer." +(defcustom csound-play-flags "" + "Additional flags to pass to csound when playing the file in current buffer." :group 'csound-mode :type 'string) @@ -91,7 +92,8 @@ (point-min) (point-max))))) (defun csound-render (bit filename) - "Render csound to file." (interactive + "Render csound to file." + (interactive (list (read-string "File bit-value(16/24/32), defaults to 16: ") (read-string (format "Filename, defaults to %s.wav: " (file-name-base))))) From d89cf297174f7959c0829630152ac59d701dc08c Mon Sep 17 00:00:00 2001 From: tho5 Date: Sun, 13 Mar 2022 20:44:36 +0100 Subject: [PATCH 3/3] Another formatting fix --- csound-mode.el | 1 + 1 file changed, 1 insertion(+) diff --git a/csound-mode.el b/csound-mode.el index ecb5c44..c1558ab 100644 --- a/csound-mode.el +++ b/csound-mode.el @@ -65,6 +65,7 @@ (modify-syntax-entry ?* ". 23b" st) st) "Syntax table for csound-mode") + (defcustom csound-play-flags "" "Additional flags to pass to csound when playing the file in current buffer." :group 'csound-mode