magical-girls-runa-and-nanami/js/plugins/GABA_EardrumGuard.js
2026-02-28 12:33:13 -06:00

74 lines
2 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//=============================================================================
// RPG Maker MZ - Eardrum Guard
//=============================================================================
/*:
* @target MZ
* @plugindesc Turn down the volume overall.
* @author gabacho(Ichiro Meiken)
* @url https://star-write-dream.com/
* @help GABA_EardrumGuard.js(ver1.0.2)
*
* Turn down the volume overall.
* It is like a master volume that players can not change.
*
* --------------------------
* Copyright (c) 2020 Gabacho(Ichiro Meiken)
* Released under the MIT license
* https://opensource.org/licenses/mit-license.php
* --------------------------
*
* @param coefficient
* @text volume
* @type number
* @desc Set the volume in %. (default: 20)
* @max 100
* @min 1
* @default 20
* @decimals 0
*
*/
/*:ja
* @target MZ
* @plugindesc 音量を全体的に下げます。
* @author ガバチョ(溟犬一六)
* @url https://star-write-dream.com/
*
* @help GABA_EardrumGuard.js(ver1.0.2)
*
* 音量を全体的に下げます。
* プレイヤーが変更できないマスターボリュームみたいなものです。
*
* --------------------------
* Copyright (c) 2020 Gabacho(Ichiro Meiken)
* Released under the MIT license
* https://opensource.org/licenses/mit-license.php
* --------------------------
*
* @param coefficient
* @text 係数
* @type number
* @desc 音量を%で設定します。初期値20
* @max 100
* @min 1
* @default 20
* @decimals 0
*
*/
(() => {
"use strict";
const pluginName = "GABA_EardrumGuard";
const parameters = PluginManager.parameters(pluginName);
const coefficient = (Number(parameters["coefficient"]) || 20) / 100;
const _AudioManager_updateBufferParameters = AudioManager.updateBufferParameters;
AudioManager.updateBufferParameters = function(buffer, configVolume, audio) {
_AudioManager_updateBufferParameters.apply(this, arguments);
if (buffer && audio) {
buffer.volume *= coefficient;
}
};
})();