Add: notif-sound volume

This commit is contained in:
Cutls 2019-09-17 00:59:25 +09:00
parent 6b9135a205
commit ad7e77a067
9 changed files with 66 additions and 5 deletions

View File

@ -108,12 +108,16 @@ function opendev() {
});
*/
}
var soundFile
function playSound() {
window.AudioContext = window.AudioContext || window.webkitAudioContext;
if(soundFile){
soundFile.stop()
}
context = new AudioContext();
context.createBufferSource().start(0);
context.decodeAudioData(request.response, function (buf) {
console.log("Playing:" + source)
//console.log("Playing:" , source)
source.buffer = buf;
source.loop = false;
});
@ -121,8 +125,20 @@ function playSound() {
volumeControl = context.createGain();
source.connect(volumeControl);
volumeControl.connect(context.destination);
volumeControl.gain.value = 0.8
var cvol = localStorage.getItem("customVol")
if (cvol) {
vol = cvol
}else{
vol = 0.8
}
volumeControl.gain.value = vol
source.start(0);
soundFile = source;
function newFunction() {
var source;
return source;
}
}
function nano() {
postMessage(["nano", null], "*")

View File

@ -98,11 +98,14 @@ function voiceSettingLoad() {
var vol = localStorage.getItem("voice_vol");
if (speed) {
$("#voicespeed").val(speed * 10);
$("#voicespeedVal").text(speed * 10);
}
if (pitch) {
$("#voicepitch").val(pitch * 50);
$("#voicepitchVal").text(pitch * 50);
}
if (vol) {
$("#voicevol").val(vol * 100);
$("#voicevolVal").text(vol * 100);
}
}

View File

@ -161,8 +161,37 @@ function load() {
$("#c2-file").text(localStorage.getItem("custom2"));
$("#c3-file").text(localStorage.getItem("custom3"));
$("#c4-file").text(localStorage.getItem("custom4"));
var cvol = localStorage.getItem("customVol")
if (cvol) {
$("#soundvol").val(cvol * 100);
$("#soundVolVal").text(cvol * 100)
}
//$("#log").val(localStorage.getItem("errors"))
}
function customVol() {
var cvol = $("#soundvol").val()
$("#soundVolVal").text(cvol)
localStorage.setItem("customVol", cvol / 100)
var sound = localStorage.getItem("favSound");
if (sound == "default") {
var file = "../../source/notif.wav"
}else{
if (sound == "c1") {
var file = localStorage.getItem("custom1");
} else if (sound == "c2") {
var file = localStorage.getItem("custom2");
} else if (sound == "c3") {
var file = localStorage.getItem("custom3");
} else if (sound == "c4") {
var file = localStorage.getItem("custom4");
}
}
request = new XMLHttpRequest();
request.open("GET", file, true);
request.responseType = "arraybuffer";
request.onload = playSound;
request.send();
}
function climute() {
//クライアントミュート

View File

@ -158,6 +158,7 @@
"pitchwarn": "0-100(default:50)",
"vol": "Volume",
"volwarn": "0-100(default:100)",
"volwarn80": "0-100(default:80)",
"test": "Test",
"sample": "TheDesk is an open-source Mastodon client for PC.",
"playstop": "Play/Stop",

View File

@ -158,6 +158,7 @@
"pitchwarn": "0-100(default:50)",
"vol": "Volume",
"volwarn": "0-100(default:100)",
"volwarn80": "0-100(default:80)",
"test": "Test",
"sample": "TheDesk is an open-source Mastodon client for PC.",
"playstop": "Play/Stop",

View File

@ -158,6 +158,7 @@
"pitchwarn": "0-100(Standard:50)",
"vol": "Lautstärke",
"volwarn": "0-100(Standard:100)",
"volwarn80": "0-100(Standard:80)",
"test": "Test",
"sample": "TheDesk ist ein Open-Source Mastodon Client für PC.",
"playstop": "Abspielen/Stoppen",

View File

@ -158,6 +158,7 @@
"pitchwarn": "0-100(default:50)",
"vol": "Volume",
"volwarn": "0-100(default:100)",
"volwarn80": "0-100(default:80)",
"test": "Test",
"sample": "TheDesk is an open-source Mastodon client for PC.",
"playstop": "Play/Stop",

View File

@ -158,6 +158,7 @@
"pitchwarn": "0-100まで、デフォルトは50。(大きくなるほど高い)",
"vol": "読み上げの音量",
"volwarn": "0-100まで、デフォルトは100。",
"volwarn80": "0-100まで、デフォルトは80。",
"test": "テスト",
"sample": "これはテスト音声です。TheDeskはオープンソースのPC向けマストドンクライアントです。マルチサーバーやマルチカラムに対応しています。",
"playstop": "再生/停止",

View File

@ -247,6 +247,11 @@
id="c3-file"></span><br>
<button class="btn waves-effect" style="width:120px;" onclick="customSound(4)">Custom 4</button><span
id="c4-file"></span><br>
<h5>@@vol@@</h5>
@@volwarn80@@<br>
<p class="range-field"><span id="soundVolVal">80</span><br>
<input type="range" id="soundvol" min="0" max="100" value="80" onchange="customVol()"
style="width:500px; max-width:100%" /></p>
</div>
</li>
<li>
@ -373,15 +378,18 @@
<div class="collapsible-body">
<h5>@@speed@@</h5>
@@speedwarn@@<br>
<p class="range-field"><input type="range" id="voicespeed" min="1" max="100" value="10"
<p class="range-field"><span id="voicespeedVal">10</span><br>
<input type="range" id="voicespeed" min="1" max="100" value="10" onchange="document.getElementById('voicespeedVal').innerText=this.value"
style="width:500px; max-width:100%" /></p>
<h5>@@pitch@@</h5>
@@pitchwarn@@<br>
<p class="range-field"><input type="range" id="voicepitch" min="0" max="100" value="50"
<p class="range-field"><span id="voicepitchVal">50</span><br>
<input type="range" id="voicepitch" min="0" max="100" value="50" onchange="document.getElementById('voicepitchVal').innerText=this.value"
style="width:500px; max-width:100%" /></p>
<h5>@@vol@@</h5>
@@volwarn@@<br>
<p class="range-field"><input type="range" id="voicevol" min="0" max="100" value="100"
<p class="range-field"><span id="voicevolVal">100</span><br>
<input type="range" id="voicevol" min="0" max="100" value="100" onchange="document.getElementById('voicevolVal').innerText=this.value"
style="width:500px; max-width:100%" /></p>
<h5>@@test@@</h5>
<input type="text" style="width:350px" id="voicetxt" value="@@sample@@">