Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions backend-release.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified bin/omarchy-audio-service
Binary file not shown.
6 changes: 3 additions & 3 deletions manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
"service"
],
"entryPoints": {
"barWidget": "runtime/f60c7acb0850c90f63d5a68cf3a62bc20fb96b25e8062e0705422ba3cb56ff0c/qml/panels/Panel.qml",
"panel": "runtime/f60c7acb0850c90f63d5a68cf3a62bc20fb96b25e8062e0705422ba3cb56ff0c/qml/panels/AdvancedAudio.qml",
"service": "runtime/f60c7acb0850c90f63d5a68cf3a62bc20fb96b25e8062e0705422ba3cb56ff0c/qml/core/Service.qml"
"barWidget": "runtime/dbca1daa77eabc715124defe44540e45a3f412bf9f7f76d4eb1ab5fe8cb79667/qml/panels/Panel.qml",
"panel": "runtime/dbca1daa77eabc715124defe44540e45a3f412bf9f7f76d4eb1ab5fe8cb79667/qml/panels/AdvancedAudio.qml",
"service": "runtime/dbca1daa77eabc715124defe44540e45a3f412bf9f7f76d4eb1ab5fe8cb79667/qml/core/Service.qml"
},
"barWidget": {
"displayName": "Advanced Audio Control",
Expand Down
33 changes: 31 additions & 2 deletions qml/core/Model.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,42 @@ function isMonitorSource(node) {
}

// Quickshell's peak capture cannot start on a null-audio-sink presented as a
// source. Keep the source selectable; only omit its silent input meter.
// source, nor on a pro-audio source whose channels are all AUX positions: the
// capture stream asks for standard positions and Quickshell logs an error for
// every buffer. Keep the source selectable; only omit its input meter.
function inputPeakSupported(node) {
try {
return !!node && String(nodeProps(node)["factory.name"] || "") !== "support.null-audio-sink"
if (!node) return false
var properties = nodeProps(node)
if (String(properties["factory.name"] || "") === "support.null-audio-sink") return false
// PipeWire accepts bare SPA-JSON positions and quoted JSON strings.
var positions = String(properties["audio.position"] || "")
.match(/"(?:[^"\\]|\\.)*"|[^\s,\[\]]+/g) || []
return positions.length === 0 || !positions.every(function(position) {
if (position.charAt(0) === '"') position = JSON.parse(position)
return /^AUX\d+$/i.test(position)
})
} catch (e) {
return false
}
}

// Visualizers and system-audio recorders capture a sink's monitor, not a
// microphone, so they must not count as microphone use.
function capturesSinkMonitor(node) {
try {
var value = nodeProps(node)["stream.capture.sink"]
return value === true || String(value) === "true"
} catch (e) {
return false
}
}

function microphoneRecordingStreams(streams) {
var values = Array.isArray(streams) ? streams : []
return values.filter(function(node) { return !capturesSinkMonitor(node) })
}

// Keep PipeWire classification in one place so every surface excludes the
// plugin's own streams and monitor sources consistently. QML list properties
// are array-like rather than true Arrays, hence the length-based input check.
Expand Down Expand Up @@ -1340,6 +1367,8 @@ if (typeof module !== "undefined") {
isInternalAudioNode: isInternalAudioNode,
isMonitorSource: isMonitorSource,
inputPeakSupported: inputPeakSupported,
capturesSinkMonitor: capturesSinkMonitor,
microphoneRecordingStreams: microphoneRecordingStreams,
classifyAudioNodes: classifyAudioNodes,
listSnapshot: listSnapshot,
hasOwn: hasOwn,
Expand Down
3 changes: 2 additions & 1 deletion qml/panels/Panel.qml
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,8 @@ Panel {
return list
}

readonly property var activeRecordingLabels: Model.uniqueRecordingStreamLabels(recordingStreams)
readonly property var activeRecordingLabels: Model.uniqueRecordingStreamLabels(
Model.microphoneRecordingStreams(recordingStreams))
readonly property int recordingApplicationCount: activeRecordingLabels.length
readonly property real inputPeakLevel: {
if (inputMuted) return 0
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 32 additions & 0 deletions test/all
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,38 @@ assert.equal(model.inputPeakSupported({ ready: true, properties: {
assert.equal(model.inputPeakSupported({ ready: true, properties: {
'factory.name': 'api.alsa.pcm.source', 'media.class': 'Audio/Source'
}}), true)
assert.equal(model.inputPeakSupported({ ready: true, properties: {
'factory.name': 'api.alsa.pcm.source', 'media.class': 'Audio/Source',
'audio.position': '[ AUX0 ]'
}}), false)
assert.equal(model.inputPeakSupported({ ready: true, properties: {
'factory.name': 'api.alsa.pcm.source', 'audio.position': 'AUX0,AUX1,AUX2,AUX3'
}}), false)
for (const positions of ['[ "AUX0" ]', '["AUX0", "AUX1"]', '[ "AUX0" "AUX1" ]']) {
assert.equal(model.inputPeakSupported({ ready: true, properties: {
'factory.name': 'api.alsa.pcm.source', 'audio.position': positions
}}), false, positions)
}
assert.equal(model.inputPeakSupported({ ready: true, properties: {
'factory.name': 'api.alsa.pcm.source', 'audio.position': '[ MONO ]'
}}), true)
assert.equal(model.inputPeakSupported({ ready: true, properties: {
'factory.name': 'api.alsa.pcm.source', 'audio.position': 'FL,FR'
}}), true)
for (const positions of ['[ "MONO" ]', '["FL", "FR"]']) {
assert.equal(model.inputPeakSupported({ ready: true, properties: {
'factory.name': 'api.alsa.pcm.source', 'audio.position': positions
}}), true, positions)
}
const visualizerStream = {
name: 'cava', isStream: true, isSink: false, ready: true, audio: {},
properties: { 'application.name': 'cava', 'stream.capture.sink': 'true' }
}
assert.equal(model.capturesSinkMonitor(visualizerStream), true)
assert.equal(model.capturesSinkMonitor(recordingStream), false)
assert.deepEqual(model.microphoneRecordingStreams([recordingStream, visualizerStream])
.map(node => node.name), ['firefox-capture'])
assert.deepEqual(model.microphoneRecordingStreams(null), [])
assert.equal(model.isPlaybackStream({
isStream: true, isSink: false, type: 'Stream/Output/Audio'
}), false)
Expand Down
Loading