feat: added voice volume
This commit is contained in:
@@ -54,6 +54,7 @@ export default class Voice {
|
|||||||
...this.#default.subtitle,
|
...this.#default.subtitle,
|
||||||
},
|
},
|
||||||
duration: { ...this.#default.duration },
|
duration: { ...this.#default.duration },
|
||||||
|
volume: 100,
|
||||||
}
|
}
|
||||||
#playerObj
|
#playerObj
|
||||||
|
|
||||||
@@ -90,6 +91,7 @@ export default class Voice {
|
|||||||
this.#voice.languages = Object.keys(
|
this.#voice.languages = Object.keys(
|
||||||
this.#charwordTable.voiceLangs[this.#default.region]
|
this.#charwordTable.voiceLangs[this.#default.region]
|
||||||
)
|
)
|
||||||
|
this.#audio.el.volume = this.#volume
|
||||||
this.#default.language.voice = this.#voice.languages[0]
|
this.#default.language.voice = this.#voice.languages[0]
|
||||||
this.#config.language = this.#default.language.voice
|
this.#config.language = this.#default.language.voice
|
||||||
this.#voice.locations = this.#getVoiceLocations()
|
this.#voice.locations = this.#getVoiceLocations()
|
||||||
@@ -415,6 +417,20 @@ export default class Voice {
|
|||||||
return this.duration.next
|
return this.duration.next
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get volume() {
|
||||||
|
return this.#config.volume
|
||||||
|
}
|
||||||
|
|
||||||
|
get #volume() {
|
||||||
|
return this.#config.volume / 100
|
||||||
|
}
|
||||||
|
|
||||||
|
set volume(value) {
|
||||||
|
value = value < 0 ? 0 : value > 100 ? 100 : parseInt(value)
|
||||||
|
this.#config.volume = value
|
||||||
|
this.#audio.el.volume = this.#volume
|
||||||
|
}
|
||||||
|
|
||||||
set subtitleX(x) {
|
set subtitleX(x) {
|
||||||
// Note: Back Compatibility
|
// Note: Back Compatibility
|
||||||
this.position = {
|
this.position = {
|
||||||
@@ -477,6 +493,11 @@ export default class Voice {
|
|||||||
${updateHTMLOptions(this.languages)}
|
${updateHTMLOptions(this.languages)}
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
<div>
|
||||||
|
<label for="voice-volume">Voice Volume</label>
|
||||||
|
<input type="range" min="0" max="100" step="1" id="voice-volume-slider" value="${this.volume}" />
|
||||||
|
<input type="number" id="voice-volume-input" min="0" max="100" step="1" name="voice-volume" value="${this.volume}" />
|
||||||
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<label for="voice-idle-duration">Idle Duration (min)</label>
|
<label for="voice-idle-duration">Idle Duration (min)</label>
|
||||||
<input type="number" id="voice-idle-duration-input" min="0" name="voice-idle-duration" value="${this.duration.idle}" />
|
<input type="number" id="voice-idle-duration-input" min="0" name="voice-idle-duration" value="${this.duration.idle}" />
|
||||||
@@ -533,6 +554,22 @@ export default class Voice {
|
|||||||
this.language = e.currentTarget.value
|
this.language = e.currentTarget.value
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
id: 'voice-volume-slider',
|
||||||
|
event: 'input',
|
||||||
|
handler: (e) => {
|
||||||
|
syncHTMLValue(e.currentTarget, 'voice-volume-input')
|
||||||
|
this.volume = e.currentTarget.value
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'voice-volume-input',
|
||||||
|
event: 'change',
|
||||||
|
handler: (e) => {
|
||||||
|
syncHTMLValue(e.currentTarget, 'voice-volume-slider')
|
||||||
|
this.volume = e.currentTarget.value
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
id: 'voice-idle-duration-input',
|
id: 'voice-idle-duration-input',
|
||||||
event: 'change',
|
event: 'change',
|
||||||
@@ -637,6 +674,9 @@ export default class Voice {
|
|||||||
case 'use-voice-actor':
|
case 'use-voice-actor':
|
||||||
this.useVoiceActor = value
|
this.useVoiceActor = value
|
||||||
break
|
break
|
||||||
|
case 'volume':
|
||||||
|
this.volume = value
|
||||||
|
break
|
||||||
default:
|
default:
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -141,6 +141,15 @@ window.wallpaperPropertyListener = {
|
|||||||
})
|
})
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
if (properties.voice_volume) {
|
||||||
|
document.dispatchEvent(
|
||||||
|
Events.RegisterConfig.handler({
|
||||||
|
target: 'voice',
|
||||||
|
key: 'volume',
|
||||||
|
value: properties.voice_volume.value,
|
||||||
|
})
|
||||||
|
)
|
||||||
|
}
|
||||||
if (properties.voiceidle) {
|
if (properties.voiceidle) {
|
||||||
document.dispatchEvent(
|
document.dispatchEvent(
|
||||||
Events.RegisterConfig.handler({
|
Events.RegisterConfig.handler({
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ localization:
|
|||||||
ui_custom_video: Custom Video
|
ui_custom_video: Custom Video
|
||||||
ui_video_volume: Volume
|
ui_video_volume: Volume
|
||||||
ui_misc_title: <hr><h4>💡 Misc</h4><hr>
|
ui_misc_title: <hr><h4>💡 Misc</h4><hr>
|
||||||
|
ui_voice_volume: Volume
|
||||||
zh-chs:
|
zh-chs:
|
||||||
ui_notice_title: <hr><h4>📝 通知</h4><hr>
|
ui_notice_title: <hr><h4>📝 通知</h4><hr>
|
||||||
ui_notice_set_fps: <span><b>在设置中设定FPS目标</b></span>
|
ui_notice_set_fps: <span><b>在设置中设定FPS目标</b></span>
|
||||||
@@ -86,6 +87,7 @@ localization:
|
|||||||
ui_custom_video: 自定义视频
|
ui_custom_video: 自定义视频
|
||||||
ui_video_volume: 音量
|
ui_video_volume: 音量
|
||||||
ui_misc_title: <hr><h4>💡 杂项</h4><hr>
|
ui_misc_title: <hr><h4>💡 杂项</h4><hr>
|
||||||
|
ui_voice_volume: 音量
|
||||||
properties:
|
properties:
|
||||||
- key: notice_title
|
- key: notice_title
|
||||||
value:
|
value:
|
||||||
@@ -177,6 +179,15 @@ properties:
|
|||||||
condition: voicetitle.value == true
|
condition: voicetitle.value == true
|
||||||
value: !match ~{var('assets', "voiceLangs")[0]}
|
value: !match ~{var('assets', "voiceLangs")[0]}
|
||||||
options: !match ~{var('assets', "voiceLangsOptions")}
|
options: !match ~{var('assets', "voiceLangsOptions")}
|
||||||
|
- key: voice_volume
|
||||||
|
value:
|
||||||
|
text: ui_voice_volume
|
||||||
|
type: slider
|
||||||
|
value: 100
|
||||||
|
condition: voicetitle.value == true
|
||||||
|
fraction: false
|
||||||
|
max: 100
|
||||||
|
min: 0
|
||||||
- key: voiceidle
|
- key: voiceidle
|
||||||
value:
|
value:
|
||||||
text: ui_voice_idle
|
text: ui_voice_idle
|
||||||
|
|||||||
@@ -137,6 +137,8 @@
|
|||||||
"persistent": true
|
"persistent": true
|
||||||
},
|
},
|
||||||
"dev:showcase": {
|
"dev:showcase": {
|
||||||
|
"env": ["name"],
|
||||||
|
"dependsOn": ["^@aklive2d/assets#build"],
|
||||||
"cache": false,
|
"cache": false,
|
||||||
"persistent": true
|
"persistent": true
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user