Toggle microphone: Better error message if there is no default input

Instead of an Elisp type error.
This commit is contained in:
Milan Zamazal 2022-07-16 21:33:36 +02:00
parent a81c61ab0a
commit 8109f43855

View File

@ -294,9 +294,10 @@ object. Otherwise apply it on the default audio sink."
(defun pipewire-toggle-microphone ()
"Switch mute status of the default audio input."
(interactive)
(let* ((object (car (pipewire-lib-default-capture-ports)))
(muted-p (pipewire-lib-toggle-mute object)))
(pipewire--update-muted object muted-p)))
(let ((object (car (pipewire-lib-default-capture-ports))))
(if object
(pipewire--update-muted object (pipewire-lib-toggle-mute object))
(error "No default audio input"))))
;;;###autoload
(defun pipewire-set-volume (volume &optional object single-p)