diff --git a/app/js/platform/end.js b/app/js/platform/end.js index c7a03a4c..d0f870da 100644 --- a/app/js/platform/end.js +++ b/app/js/platform/end.js @@ -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], "*") diff --git a/app/js/tl/speech.js b/app/js/tl/speech.js index b38eb5c5..f89ffc00 100644 --- a/app/js/tl/speech.js +++ b/app/js/tl/speech.js @@ -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); } } \ No newline at end of file diff --git a/app/js/ui/settings.js b/app/js/ui/settings.js index ebc146e3..3a8932e2 100644 --- a/app/js/ui/settings.js +++ b/app/js/ui/settings.js @@ -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() { //クライアントミュート diff --git a/app/view/make/language/bg/setting.json b/app/view/make/language/bg/setting.json index 1495291d..70fb62da 100644 --- a/app/view/make/language/bg/setting.json +++ b/app/view/make/language/bg/setting.json @@ -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", diff --git a/app/view/make/language/cs/setting.json b/app/view/make/language/cs/setting.json index 37e625df..a8e55f20 100644 --- a/app/view/make/language/cs/setting.json +++ b/app/view/make/language/cs/setting.json @@ -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", diff --git a/app/view/make/language/de/setting.json b/app/view/make/language/de/setting.json index b63e1b98..af6a0ae7 100644 --- a/app/view/make/language/de/setting.json +++ b/app/view/make/language/de/setting.json @@ -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", diff --git a/app/view/make/language/en/setting.json b/app/view/make/language/en/setting.json index 6651b1c3..1ac79d13 100644 --- a/app/view/make/language/en/setting.json +++ b/app/view/make/language/en/setting.json @@ -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", diff --git a/app/view/make/language/ja/setting.json b/app/view/make/language/ja/setting.json index 9b6474f5..5bcf61d2 100644 --- a/app/view/make/language/ja/setting.json +++ b/app/view/make/language/ja/setting.json @@ -158,6 +158,7 @@ "pitchwarn": "0-100まで、デフォルトは50。(大きくなるほど高い)", "vol": "読み上げの音量", "volwarn": "0-100まで、デフォルトは100。", + "volwarn80": "0-100まで、デフォルトは80。", "test": "テスト", "sample": "これはテスト音声です。TheDeskはオープンソースのPC向けマストドンクライアントです。マルチサーバーやマルチカラムに対応しています。", "playstop": "再生/停止", diff --git a/app/view/make/setting.sample.html b/app/view/make/setting.sample.html index 11b2e7a8..b8207b35 100644 --- a/app/view/make/setting.sample.html +++ b/app/view/make/setting.sample.html @@ -247,6 +247,11 @@ id="c3-file">

+
@@vol@@
+ @@volwarn80@@
+

80
+

  • @@ -373,15 +378,18 @@
    @@speed@@
    @@speedwarn@@
    -

    10
    +

    @@pitch@@
    @@pitchwarn@@
    -

    50
    +

    @@vol@@
    @@volwarn@@
    -

    100
    +

    @@test@@