mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-05-24 20:31:31 +00:00
Add option for logarithmic volume scaling
Introduces a user setting to enable logarithmic (quadratic) volume scaling for more natural audio perception.
This commit is contained in:
parent
122fc34a75
commit
9012c7f0a8
4 changed files with 17 additions and 2 deletions
|
|
@ -8,6 +8,12 @@
|
||||||
<span>{{ $strings.LabelUseChapterTrack }}</span>
|
<span>{{ $strings.LabelUseChapterTrack }}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="flex items-center mb-4">
|
||||||
|
<ui-toggle-switch v-model="useLogarithmicVolume" @input="setUseLogarithmicVolume" />
|
||||||
|
<div class="pl-4">
|
||||||
|
<span>{{ $strings.LabelUseLogarithmicVolume }}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="flex items-center mb-4">
|
<div class="flex items-center mb-4">
|
||||||
<ui-select-input v-model="jumpForwardAmount" :label="$strings.LabelJumpForwardAmount" menuMaxHeight="250px" :items="jumpValues" @input="setJumpForwardAmount" />
|
<ui-select-input v-model="jumpForwardAmount" :label="$strings.LabelJumpForwardAmount" menuMaxHeight="250px" :items="jumpValues" @input="setJumpForwardAmount" />
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -29,6 +35,7 @@ export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
useChapterTrack: false,
|
useChapterTrack: false,
|
||||||
|
useLogarithmicVolume: true,
|
||||||
jumpValues: [
|
jumpValues: [
|
||||||
{ text: this.$getString('LabelTimeDurationXSeconds', ['10']), value: 10 },
|
{ text: this.$getString('LabelTimeDurationXSeconds', ['10']), value: 10 },
|
||||||
{ text: this.$getString('LabelTimeDurationXSeconds', ['15']), value: 15 },
|
{ text: this.$getString('LabelTimeDurationXSeconds', ['15']), value: 15 },
|
||||||
|
|
@ -57,6 +64,9 @@ export default {
|
||||||
setUseChapterTrack() {
|
setUseChapterTrack() {
|
||||||
this.$store.dispatch('user/updateUserSettings', { useChapterTrack: this.useChapterTrack })
|
this.$store.dispatch('user/updateUserSettings', { useChapterTrack: this.useChapterTrack })
|
||||||
},
|
},
|
||||||
|
setUseLogarithmicVolume() {
|
||||||
|
this.$store.dispatch('user/updateUserSettings', { useLogarithmicVolume: this.useLogarithmicVolume })
|
||||||
|
},
|
||||||
setJumpForwardAmount(val) {
|
setJumpForwardAmount(val) {
|
||||||
this.jumpForwardAmount = val
|
this.jumpForwardAmount = val
|
||||||
this.$store.dispatch('user/updateUserSettings', { jumpForwardAmount: val })
|
this.$store.dispatch('user/updateUserSettings', { jumpForwardAmount: val })
|
||||||
|
|
@ -71,6 +81,7 @@ export default {
|
||||||
},
|
},
|
||||||
settingsUpdated() {
|
settingsUpdated() {
|
||||||
this.useChapterTrack = this.$store.getters['user/getUserSetting']('useChapterTrack')
|
this.useChapterTrack = this.$store.getters['user/getUserSetting']('useChapterTrack')
|
||||||
|
this.useLogarithmicVolume = this.$store.getters['user/getUserSetting']('useLogarithmicVolume')
|
||||||
this.jumpForwardAmount = this.$store.getters['user/getUserSetting']('jumpForwardAmount')
|
this.jumpForwardAmount = this.$store.getters['user/getUserSetting']('jumpForwardAmount')
|
||||||
this.jumpBackwardAmount = this.$store.getters['user/getUserSetting']('jumpBackwardAmount')
|
this.jumpBackwardAmount = this.$store.getters['user/getUserSetting']('jumpBackwardAmount')
|
||||||
this.playbackRateIncrementDecrement = this.$store.getters['user/getUserSetting']('playbackRateIncrementDecrement')
|
this.playbackRateIncrementDecrement = this.$store.getters['user/getUserSetting']('playbackRateIncrementDecrement')
|
||||||
|
|
|
||||||
|
|
@ -290,7 +290,9 @@ export default class LocalAudioPlayer extends EventEmitter {
|
||||||
|
|
||||||
setVolume(volume) {
|
setVolume(volume) {
|
||||||
if (!this.player) return
|
if (!this.player) return
|
||||||
this.player.volume = volume
|
const useLogarithmicVolume = this.ctx.$store.getters['user/getUserSetting']('useLogarithmicVolume')
|
||||||
|
// Apply quadratic curve for more natural volume perception if enabled
|
||||||
|
this.player.volume = useLogarithmicVolume ? volume * volume : volume
|
||||||
}
|
}
|
||||||
|
|
||||||
// Utils
|
// Utils
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,8 @@ export const state = () => ({
|
||||||
authorSortBy: 'name',
|
authorSortBy: 'name',
|
||||||
authorSortDesc: false,
|
authorSortDesc: false,
|
||||||
jumpForwardAmount: 10,
|
jumpForwardAmount: 10,
|
||||||
jumpBackwardAmount: 10
|
jumpBackwardAmount: 10,
|
||||||
|
useLogarithmicVolume: false
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -712,6 +712,7 @@
|
||||||
"LabelUploaderItemFetchMetadataHelp": "Automatically fetch title, author, and series",
|
"LabelUploaderItemFetchMetadataHelp": "Automatically fetch title, author, and series",
|
||||||
"LabelUseAdvancedOptions": "Use Advanced Options",
|
"LabelUseAdvancedOptions": "Use Advanced Options",
|
||||||
"LabelUseChapterTrack": "Use chapter track",
|
"LabelUseChapterTrack": "Use chapter track",
|
||||||
|
"LabelUseLogarithmicVolume": "Natural volume scaling",
|
||||||
"LabelUseFullTrack": "Use full track",
|
"LabelUseFullTrack": "Use full track",
|
||||||
"LabelUseZeroForUnlimited": "Use 0 for unlimited",
|
"LabelUseZeroForUnlimited": "Use 0 for unlimited",
|
||||||
"LabelUser": "User",
|
"LabelUser": "User",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue