{"id":347,"date":"2015-08-06T08:23:28","date_gmt":"2015-08-05T23:23:28","guid":{"rendered":"http:\/\/www.biscrat.com\/blog\/?p=347"},"modified":"2024-03-19T03:30:09","modified_gmt":"2024-03-18T18:30:09","slug":"kagex-sound-property-changed","status":"publish","type":"post","link":"https:\/\/biscrat.com\/blog\/kagex-sound-property-changed\/","title":{"rendered":"KAGEX\u62e1\u5f35\u4f8b(onSoundPropertyChanged)"},"content":{"rendered":"<p>\u30fb\u524d\u56de\u307e\u3067<br \/>\n<a href=\"https:\/\/biscrat.com\/blog\/kagex-volume\/\">KAGEX\u62e1\u5f35\u4f8b(\u97f3\u91cf\u8a2d\u5b9a)<\/a><br \/>\n<a href=\"https:\/\/biscrat.com\/blog\/kagex-mute\/\">KAGEX\u62e1\u5f35\u4f8b(\u30df\u30e5\u30fc\u30c8\u8a2d\u5b9a)<\/a><br \/>\n<a href=\"https:\/\/biscrat.com\/blog\/kagex-system-se\/\">KAGEX\u62e1\u5f35\u4f8b(\u30b7\u30b9\u30c6\u30e0\u52b9\u679c\u97f3)<\/a><\/p>\n<p>BGM\u306e\u97f3\u91cf\u3001\u307e\u305f\u306f\u30df\u30e5\u30fc\u30c8\u306e\u72b6\u614b\u304c\u5909\u66f4\u3055\u308c\u305f\u969b\u306f\u3001onSoundPropertyChanged\u3068\u3044\u3046\u30d5\u30c3\u30af\u304c\u547c\u3070\u308c\u307e\u3059\u3002kag.addHook\u3067\u547c\u3073\u51fa\u3059\u95a2\u6570\u3092\u8ffd\u52a0\u3067\u304d\u307e\u3059\u3002\u5927\u4f53\u306e\u52d5\u4f5c\u306f\u4ee5\u4e0b\u3092\u898b\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre class=\"brush: tjs; title: ; notranslate\" title=\"\">\n\/\/ \u97f3\u91cf\u306a\u3069\u304c\u5909\u66f4\u3055\u308c\u305f\u969b\u306b\u547c\u3070\u308c\u308b\u95a2\u6570\u3092\u767b\u9332\nkag.addHook(&quot;onSoundPropertyChanged&quot;, function(tag, prop, value) {\n    switch (tag) {\n    case &quot;bgm&quot;:\n        if (prop === &quot;enable&quot;) {\n            \/\/ BGM\u306e\u30df\u30e5\u30fc\u30c8\u304c\u5909\u66f4\u3055\u308c\u305f(value =&gt; true or false)\n        } else if (prop === &quot;globalVolume&quot;) {\n            \/\/ BGM\u306e\u97f3\u91cf\u304c\u5909\u66f4\u3055\u308c\u305f(value =&gt; 0\uff5e100000)\n        }\n        break;\n    case &quot;se&quot;:\n        if (prop === &quot;enable&quot;) {\n            \/\/ \u52b9\u679c\u97f3\u306e\u30df\u30e5\u30fc\u30c8\u304c\u5909\u66f4\u3055\u308c\u305f(value =&gt; true or false)\n        } else if (prop === &quot;globalVolume&quot;) {\n            \/\/ \u52b9\u679c\u97f3\u306e\u97f3\u91cf\u304c\u5909\u66f4\u3055\u308c\u305f(value =&gt; 0\uff5e100000)\n        }\n        break;\n    case &quot;sysse&quot;:\n        if (prop === &quot;enable&quot;) {\n            \/\/ \u30b7\u30b9\u30c6\u30e0\u52b9\u679c\u97f3\u306e\u30df\u30e5\u30fc\u30c8\u304c\u5909\u66f4\u3055\u308c\u305f(value =&gt; true or false)\n        } else if (prop === &quot;globalVolume&quot;) {\n            \/\/ \u30b7\u30b9\u30c6\u30e0\u52b9\u679c\u97f3\u306e\u97f3\u91cf\u304c\u5909\u66f4\u3055\u308c\u305f(value =&gt; 0\uff5e100000)\n        }\n        break;\n    case &quot;movie&quot;:\n        if (prop === &quot;enable&quot;) {\n            \/\/ \u52d5\u753b\u306e\u30df\u30e5\u30fc\u30c8\u304c\u5909\u66f4\u3055\u308c\u305f(value =&gt; true or false)\n        } else if (prop === &quot;globalVolume&quot;) {\n            \/\/ \u52d5\u753b\u306e\u97f3\u91cf\u304c\u5909\u66f4\u3055\u308c\u305f(value =&gt; 0\uff5e100000)\n        }\n        break;\n    case &quot;voice&quot;:\n        if (prop === &quot;enable&quot;) {\n            \/\/ \u30ad\u30e3\u30e9\u5171\u901a\u306e\u30df\u30e5\u30fc\u30c8\u304c\u5909\u66f4\u3055\u308c\u305f(value =&gt; true or false)\n        } else if (prop === &quot;globalVolume&quot;) {\n            \/\/ \u30ad\u30e3\u30e9\u5171\u901a\u306e\u97f3\u91cf\u304c\u5909\u66f4\u3055\u308c\u305f(value =&gt; 0\uff5e100000)\n        } else if (prop === &quot;\u3057\u304a\u308a&quot;) {\n            \/\/ \u30ad\u30e3\u30e9\u3054\u3068\u306e\u97f3\u91cf(\u3057\u304a\u308a)\u304c\u5909\u66f4\u3055\u308c\u305f(value =&gt; 0\uff5e100000)\n        }\n        break;\n    case &quot;bgv&quot;:\n        if (prop === &quot;enable&quot;) {\n            \/\/ BGV(bvoice)\u306e\u30df\u30e5\u30fc\u30c8\u304c\u5909\u66f4\u3055\u308c\u305f(value =&gt; true or false)\n        } else if (prop === &quot;globalVolume&quot;) {\n            \/\/ BGV(bvoice)\u306e\u97f3\u91cf\u304c\u5909\u66f4\u3055\u308c\u305f(value =&gt; 0\uff5e100000)\n        }\n        break;\n    case &quot;bgv2&quot;:\n        if (prop === &quot;enable&quot;) {\n            \/\/ BGV(hvoice)\u306e\u30df\u30e5\u30fc\u30c8\u304c\u5909\u66f4\u3055\u308c\u305f(value =&gt; true or false)\n        } else if (prop === &quot;globalVolume&quot;) {\n            \/\/ BGV(hvoice)\u306e\u97f3\u91cf\u304c\u5909\u66f4\u3055\u308c\u305f(value =&gt; 0\uff5e100000)\n        }\n        break;\n    case &quot;voiceon&quot;:\n        if (prop === &quot;\u3057\u304a\u308a&quot;) {\n            \/\/ \u30ad\u30e3\u30e9\u3054\u3068\u306e\u30df\u30e5\u30fc\u30c8(\u3057\u304a\u308a)\u304c\u5909\u66f4\u3055\u308c\u305f(value =&gt; true or false)\n        }\n        break;\n    }\n});\n\n<\/pre>\n<p>tag\u306b\u306f&#8221;bgm&#8221;, &#8220;se&#8221;\u306a\u3069\u4f55\u306e\u5024\u304c\u5909\u66f4\u3055\u308c\u305f\u304b\u304c\u6e21\u3055\u308c\u307e\u3059\u3002<\/p>\n<p>prop\u304c&#8221;enable&#8221;\u306a\u3089\u30df\u30e5\u30fc\u30c8\u306e\u72b6\u614b\u3001&#8221;globalVolume&#8221;\u306a\u3089\u97f3\u91cf\u304c\u5909\u66f4\u3055\u308c\u305f\u3068\u8a00\u3046\u3053\u3068\u3067\u3059\u3002prop==&#8221;enable&#8221;\u306a\u3089value\u306f\u901a\u5e38\u306e\u72b6\u614b\u306a\u3089true, \u30df\u30e5\u30fc\u30c8\u3055\u308c\u305f\u72b6\u614b\u306a\u3089false\u306b\u306a\u308a\u307e\u3059\u3002prop==&#8221;globalVolume&#8221;\u306a\u3089value\u306f\u5909\u66f4\u5f8c\u306e\u97f3\u91cf\u3067\u3059\u304c\u30010\uff5e100000\u306e\u6570\u5024\u306b\u306a\u308b\u306e\u3067\u6ce8\u610f\u3057\u3066\u304f\u3060\u3055\u3044\u3002value\/1000\u306e\u3088\u3046\u306b1000\u3067\u5272\u308c\u30700\uff5e100\u306b\u5909\u63db\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>tag==&#8221;voice&#8221;\u306e\u6642\u306f\u5c11\u3057\u7279\u6b8a\u3067\u3059\u3002prop\u304c&#8221;enable&#8221;,&#8221;globalVolume&#8221;\u306e\u4ed6\u306b\u30ad\u30e3\u30e9\u540d\u306b\u306a\u308b\u3053\u3068\u304c\u3042\u308a\u307e\u3059\u3002\u3053\u306e\u3068\u304d\u306f\u305d\u306e\u30ad\u30e3\u30e9\u306e\u97f3\u91cf\u304c\u5909\u66f4\u3055\u308c\u305f\u3068\u3044\u3046\u3053\u3068\u3067\u3059\u3002<\/p>\n<p>\u30ad\u30e3\u30e9\u3054\u3068\u306e\u30df\u30e5\u30fc\u30c8\u306ftag==&#8221;voiceon&#8221;\u3067\u6e21\u3055\u308c\u307e\u3059\u3002prop\u304c\u30ad\u30e3\u30e9\u540d\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u5168\u4f53\u306e\u97f3\u91cf(wavevolume)\u3084\u30df\u30e5\u30fc\u30c8(waveenable)\u304c\u5909\u66f4\u3055\u308c\u305f\u3068\u304d\u306fonSoundPropertyChanged\u304c\u547c\u3070\u308c\u306a\u3044\u3088\u3046\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u3002\u305d\u308c\u3082\u5fc5\u8981\u306a\u3068\u304d\u306f\u5c11\u3057\u6539\u9020\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<br \/>\nMainWindow.tjs\u3067wavevolume\u3068waveenable\u304c\u5b9a\u7fa9\u3055\u308c\u3066\u3044\u308b\u90e8\u5206\u3092\u66f8\u304d\u63db\u3048\u307e\u3059\u3002setter\u306e\u6700\u5f8c\u306bcallHook(\uff5e)\u306e\u884c\u3092\u8ffd\u52a0\u3057\u305f\u3060\u3051\u3067\u3059\u3002\u3053\u308c\u3067tag==&#8221;wave&#8221;\u3067prop==&#8221;enable&#8221;\u307e\u305f\u306fprop==&#8221;globalVolume&#8221;\u3068\u3057\u3066\u5909\u66f4\u304c\u901a\u77e5\u3055\u308c\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"brush: tjs; title: ; notranslate\" title=\"\">\n\/**\n * \u30b0\u30ed\u30fc\u30d0\u30eb WaveSound \u97f3\u91cf\u306e\u8a2d\u5b9a\n * 100 \u6bb5\u968e\u8a2d\u5b9a\n *\/\nproperty wavevolume {\n    getter()  {\n        return scflags.waveVolume !== void ? +scflags.waveVolume : global.WaveSoundBuffer.globalVolume \/ 1000;\n    }\n    setter(v) {\n        v = +v;\n        if      (v &lt; 0)   v = 0;\n        else if (v &gt; 100) v = 100;\n        scflags.waveVolume = v;\n        global.WaveSoundBuffer.globalVolume = scflags.waveEnable ? v * 1000 : 0;\n        callHook(&quot;onSoundPropertyChanged&quot;, &quot;wave&quot;, &quot;globalVolume&quot;, v * 1000);\n    }\n}\n\n\/**\n * \u30b0\u30ed\u30fc\u30d0\u30eb WaveSound \u306e\u6709\u52b9\u5024\u306e\u8a2d\u5b9a\n * true \/ false\n *\/\nproperty waveenable {\n    getter() {\n        return scflags.waveEnable !== void ? +scflags.waveEnable : true;\n    }\n    setter(v) {\n        scflags.waveEnable = +v;\n        wavevolume = scflags.waveVolume;\n        callHook(&quot;onSoundPropertyChanged&quot;, &quot;wave&quot;, &quot;enable&quot;, !!v);\n    }\n}\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u30fb\u524d\u56de\u307e\u3067 KAGEX\u62e1\u5f35\u4f8b(\u97f3\u91cf\u8a2d\u5b9a) KAGEX\u62e1\u5f35\u4f8b(\u30df\u30e5\u30fc\u30c8\u8a2d\u5b9a) KAGEX\u62e1\u5f35\u4f8b(\u30b7\u30b9\u30c6\u30e0\u52b9\u679c\u97f3) BGM\u306e\u97f3\u91cf\u3001\u307e\u305f\u306f\u30df\u30e5\u30fc\u30c8\u306e\u72b6\u614b\u304c\u5909\u66f4\u3055\u308c\u305f\u969b\u306f\u3001onSoundPropertyChanged\u3068\u3044\u3046\u30d5\u30c3\u30af [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,12],"tags":[14,4,2],"class_list":["post-347","post","type-post","status-publish","format-standard","hentry","category-kagex","category-krkr","tag-kagex","tag-tjs","tag-2"],"_links":{"self":[{"href":"https:\/\/biscrat.com\/blog\/wp-json\/wp\/v2\/posts\/347","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/biscrat.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/biscrat.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/biscrat.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/biscrat.com\/blog\/wp-json\/wp\/v2\/comments?post=347"}],"version-history":[{"count":22,"href":"https:\/\/biscrat.com\/blog\/wp-json\/wp\/v2\/posts\/347\/revisions"}],"predecessor-version":[{"id":987,"href":"https:\/\/biscrat.com\/blog\/wp-json\/wp\/v2\/posts\/347\/revisions\/987"}],"wp:attachment":[{"href":"https:\/\/biscrat.com\/blog\/wp-json\/wp\/v2\/media?parent=347"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/biscrat.com\/blog\/wp-json\/wp\/v2\/categories?post=347"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/biscrat.com\/blog\/wp-json\/wp\/v2\/tags?post=347"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}