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
1 changed files with 4 additions and 3 deletions

View File

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