mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-29 07:52:50 -05:00
sounds: only play audio changed when trigger by us
This commit is contained in:
@@ -84,6 +84,7 @@ Row {
|
|||||||
if (newValue > 0 && defaultSink.audio.muted) {
|
if (newValue > 0 && defaultSink.audio.muted) {
|
||||||
defaultSink.audio.muted = false
|
defaultSink.audio.muted = false
|
||||||
}
|
}
|
||||||
|
AudioService.playVolumeChangeSoundIfEnabled()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -104,6 +104,7 @@ BasePill {
|
|||||||
if (AudioService.sink && AudioService.sink.audio) {
|
if (AudioService.sink && AudioService.sink.audio) {
|
||||||
AudioService.sink.audio.muted = false
|
AudioService.sink.audio.muted = false
|
||||||
AudioService.sink.audio.volume = newVolume / 100
|
AudioService.sink.audio.volume = newVolume / 100
|
||||||
|
AudioService.playVolumeChangeSoundIfEnabled()
|
||||||
}
|
}
|
||||||
wheelEvent.accepted = true
|
wheelEvent.accepted = true
|
||||||
}
|
}
|
||||||
@@ -210,6 +211,7 @@ BasePill {
|
|||||||
if (AudioService.sink && AudioService.sink.audio) {
|
if (AudioService.sink && AudioService.sink.audio) {
|
||||||
AudioService.sink.audio.muted = false;
|
AudioService.sink.audio.muted = false;
|
||||||
AudioService.sink.audio.volume = newVolume / 100;
|
AudioService.sink.audio.volume = newVolume / 100;
|
||||||
|
AudioService.playVolumeChangeSoundIfEnabled();
|
||||||
}
|
}
|
||||||
wheelEvent.accepted = true;
|
wheelEvent.accepted = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -165,6 +165,7 @@ Item {
|
|||||||
if (newVolume > 0 && defaultSink.audio.muted) {
|
if (newVolume > 0 && defaultSink.audio.muted) {
|
||||||
defaultSink.audio.muted = false
|
defaultSink.audio.muted = false
|
||||||
}
|
}
|
||||||
|
AudioService.playVolumeChangeSoundIfEnabled()
|
||||||
}
|
}
|
||||||
|
|
||||||
Process {
|
Process {
|
||||||
@@ -1392,6 +1393,7 @@ Item {
|
|||||||
if (volume > 0 && defaultSink.audio.muted) {
|
if (volume > 0 && defaultSink.audio.muted) {
|
||||||
defaultSink.audio.muted = false
|
defaultSink.audio.muted = false
|
||||||
}
|
}
|
||||||
|
AudioService.playVolumeChangeSoundIfEnabled()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -407,24 +407,9 @@ Singleton {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Timer {
|
function playVolumeChangeSoundIfEnabled() {
|
||||||
id: volumeSoundDebounce
|
if (SettingsData.soundsEnabled && SettingsData.soundVolumeChanged) {
|
||||||
interval: 50
|
playVolumeChangeSound()
|
||||||
repeat: false
|
|
||||||
onTriggered: {
|
|
||||||
if (SettingsData.soundsEnabled && SettingsData.soundVolumeChanged) {
|
|
||||||
root.playVolumeChangeSound()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Connections {
|
|
||||||
target: root.sink && root.sink.audio ? root.sink.audio : null
|
|
||||||
enabled: root.sink && root.sink.audio
|
|
||||||
ignoreUnknownSignals: true
|
|
||||||
|
|
||||||
function onVolumeChanged() {
|
|
||||||
volumeSoundDebounce.restart()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -559,6 +544,7 @@ Singleton {
|
|||||||
const newVolume = Math.max(0, Math.min(100, currentVolume + stepValue))
|
const newVolume = Math.max(0, Math.min(100, currentVolume + stepValue))
|
||||||
|
|
||||||
root.sink.audio.volume = newVolume / 100
|
root.sink.audio.volume = newVolume / 100
|
||||||
|
root.playVolumeChangeSoundIfEnabled()
|
||||||
return `Volume increased to ${newVolume}%`
|
return `Volume increased to ${newVolume}%`
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -576,6 +562,7 @@ Singleton {
|
|||||||
const newVolume = Math.max(0, Math.min(100, currentVolume - stepValue))
|
const newVolume = Math.max(0, Math.min(100, currentVolume - stepValue))
|
||||||
|
|
||||||
root.sink.audio.volume = newVolume / 100
|
root.sink.audio.volume = newVolume / 100
|
||||||
|
root.playVolumeChangeSoundIfEnabled()
|
||||||
return `Volume decreased to ${newVolume}%`
|
return `Volume decreased to ${newVolume}%`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user