Compare commits

...

5 Commits

4 changed files with 23 additions and 15 deletions

View File

@ -3,7 +3,7 @@
;; Copyright (C) 2022 Milan Zamazal <pdm@zamazal.org>
;; Author: Milan Zamazal <pdm@zamazal.org>
;; Package-Version: 1
;; Version: 1
;; Package-Requires: ((emacs "25.1"))
;; Keywords: multimedia
;; URL: https://git.zamazal.org/pdm/pipewire-0

View File

@ -3,7 +3,7 @@
;; Copyright (C) 2022 Milan Zamazal <pdm@zamazal.org>
;; Author: Milan Zamazal <pdm@zamazal.org>
;; Package-Version: 1
;; Version: 1
;; Package-Requires: ((emacs "25.1"))
;; Keywords: multimedia
;; URL: https://git.zamazal.org/pdm/pipewire-0
@ -39,6 +39,8 @@
(require 'eieio)
;;; Code:
(defclass pw-accessor ()
()
:documentation

View File

@ -3,7 +3,7 @@
;; Copyright (C) 2022 Milan Zamazal <pdm@zamazal.org>
;; Author: Milan Zamazal <pdm@zamazal.org>
;; Package-Version: 1
;; Version: 1
;; Package-Requires: ((emacs "28.1"))
;; Keywords: multimedia
;; URL: https://git.zamazal.org/pdm/pipewire-0
@ -35,6 +35,8 @@
(require 'cl-lib)
(require 'pw-access)
;;; Code:
(defvar pw-lib--accessor (pw-cli-accessor))
(defvar pw-lib--objects '())
@ -129,9 +131,9 @@ returned from `pw-lib-profiles'. "
(pw-access-set-profile pw-lib--accessor device-id index))))
(defun pw-lib-parent-node (object)
"Return parent node of `object'.
"Return parent node of OBJECT.
This is typically used for ports.
Behavior is undefined if `object' has no parent node."
Behavior is undefined if OBJECT has no parent node."
(pw-lib-get-object (pw-lib-object-value object "node.id")))
(defun pw-lib--node (object)
@ -249,7 +251,7 @@ version, call `pw-lib-refresh' first."
(list node-p parameters monitor-p node-id port-id)))
(defun pw-lib-muted-p (object &optional refresh)
"Return whether the given PipeWire object is muted.
"Return whether the given PipeWire OBJECT is muted.
Applicable only to Nodes and Ports.
If REFRESH is non-nil then retrive fresh information from PipeWire
rather than using cached data to obtain the result."
@ -272,7 +274,7 @@ rather than using cached data to obtain the result."
mute)))
(defun pw-lib-volume (object &optional refresh)
"Return volume of the given PipeWire object.
"Return volume of the given PipeWire OBJECT.
The returned value is an integer in the range 0-100.
Applicable only to Nodes and Ports.
If REFRESH is non-nil then retrive fresh information from PipeWire
@ -324,7 +326,7 @@ otherwise set the current default sink or source."
("Node"
(pw-lib--set-default-node object stored-p))
(_
(error "Cannot set this kind of object as default."))))
(error "Cannot set this kind of object as default"))))
(provide 'pw-lib)

View File

@ -3,7 +3,7 @@
;; Copyright (C) 2022 Milan Zamazal <pdm@zamazal.org>
;; Author: Milan Zamazal <pdm@zamazal.org>
;; Package-Version: 1
;; Version: 1
;; Package-Requires: ((emacs "25.1"))
;; Keywords: multimedia
;; URL: https://git.zamazal.org/pdm/pipewire-0
@ -33,6 +33,8 @@
(require 'pw-lib)
;;; Code:
(defgroup pipewire ()
"PipeWire user interface."
:group 'multimedia)
@ -295,7 +297,9 @@ object. Otherwise apply it on the default audio sink."
VOLUME must be a number in the range 0-100.
If OBJECT is given (only Nodes and Ports are allowed) or if on a Node
or Port in a PipeWire buffer, apply it on the given object.
Otherwise apply it on the default audio sink."
Otherwise apply it on the default audio sink.
If SINGLE-P is nil, apply it on all related channels, otherwise on the
corresponding object only."
(interactive "nVolume: ")
(setq volume (max 0 (min 100 volume)))
(unless object
@ -315,8 +319,8 @@ Otherwise apply it on the default audio sink."
"Increase volume of an audio output or input.
The volume is increased by `pipewire-volume-step'.
If on a Node or Port in a PipeWire buffer, apply it on all the
channels of the given object. Otherwise apply it on the default audio
sink."
channels of the given object, unless SINGLE-P is non-nil.
Otherwise apply it on the default audio sink."
(interactive)
(pw-ui--change-volume pipewire-volume-step single-p))
@ -334,8 +338,8 @@ object. Otherwise apply it on the default audio sink."
"Decrease volume of an audio output or input.
The volume is decreased by `pipewire-volume-step'.
If on a Node or Port in a PipeWire buffer, apply it on all the
channels of the given object. Otherwise apply it on the default audio
sink."
channels of the given object, unless SINGLE-P is non-nil.
Otherwise apply it on the default audio sink."
(interactive)
(pw-ui--change-volume (- pipewire-volume-step) single-p))