Skip to content

Commit 7250e6a

Browse files
authored
Release Apply render preset v2.1.5 (#1444)
Display REAPER v7.23's new normalization options
1 parent 7c44f9c commit 7250e6a

File tree

1 file changed

+28
-13
lines changed

1 file changed

+28
-13
lines changed

Rendering/cfillion_Apply render preset.lua

Lines changed: 28 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
-- @description Apply render preset
22
-- @author cfillion
3-
-- @version 2.1.4
4-
-- @changelog Fix parsing of mixed quotes in reaper-render2.ini [cfillion/reascripts#7]
3+
-- @version 2.1.5
4+
-- @changelog Display REAPER v7.23's new normalization options
55
-- @provides
66
-- .
77
-- [main] . > cfillion_Apply render preset (create action).lua
@@ -45,6 +45,7 @@ if reaper.ImGui_GetBuiltinPath then
4545
ImGui = require 'imgui' '0.9'
4646
end
4747

48+
local FLT_MIN, FLT_MAX = ImGui.NumericLimits_Float()
4849
local REAPER_BEFORE_V6 = tonumber(reaper.GetAppVersion():match('^%d+')) < 6
4950
local SETTINGS_SOURCE_MASK = 0x10EB
5051
local SETTINGS_OPTIONS_MASK = 0x6F14
@@ -669,13 +670,14 @@ local function VAL2DB(x)
669670
end
670671

671672
local function postprocessCell(ctx, preset)
672-
local NORMALIZE_ENABLE = 1
673-
local NORMALIZE_MASTER = 1<<5
674-
local BRICKWALL_ENABLE = 1<<6
673+
local NORMALIZE_ENABLE = 1
674+
local NORMALIZE_TOO_LOUD = 1<<8
675+
local NORMALIZE_TOO_QUIET = 1<<11
676+
local NORMALIZE_MODE_BITS = {5, 12}
677+
local BRICKWALL_ENABLE = 1<<6
675678
-- local BRICKWALL_TPEAK = 1<<7
676-
local NORMAL_TOO_LOUD = 1<<8
677-
local FADEIN_ENABLE = 1<<9
678-
local FADEOUT_ENABLE = 1<<10
679+
local FADEIN_ENABLE = 1<<9
680+
local FADEOUT_ENABLE = 1<<10
679681

680682
local postprocess = preset.RENDER_NORMALIZE
681683
if not postprocess then return end
@@ -717,10 +719,24 @@ local function postprocessCell(ctx, preset)
717719
end
718720
ImGui.Separator(ctx)
719721

720-
ImGui.CheckboxFlags(ctx, 'Only normalize files that are too loud',
721-
postprocess, NORMAL_TOO_LOUD)
722-
ImGui.CheckboxFlags(ctx, 'Normalize/limit master mix, common gain to stems',
723-
postprocess, NORMALIZE_MASTER)
722+
ImGui.AlignTextToFramePadding(ctx)
723+
ImGui.Text(ctx, 'Only normalize files that are')
724+
ImGui.SameLine(ctx)
725+
ImGui.CheckboxFlags(ctx, 'too loud', postprocess, NORMALIZE_TOO_LOUD)
726+
ImGui.SameLine(ctx)
727+
ImGui.CheckboxFlags(ctx, 'too quiet', postprocess, NORMALIZE_TOO_QUIET)
728+
729+
local mode = 0
730+
for i, bit in ipairs(NORMALIZE_MODE_BITS) do
731+
mode = mode | ((postprocess >> bit & 1) << (i - 1))
732+
end
733+
local modes =
734+
'Normalize each file separately\0\z
735+
Normalize all files to master mix\0\z
736+
Normalize to loudest file\0\z
737+
Normalize as if one long file\0'
738+
ImGui.SetNextItemWidth(ctx, -FLT_MIN)
739+
ImGui.Combo(ctx, '##mode', mode, modes)
724740

725741
ImGui.EndTooltip(ctx)
726742
end
@@ -951,7 +967,6 @@ local function presetRow(ctx, name, preset)
951967
'Fast (16pt Sinc)', 'HQ (512 pt)', 'Extreme HQ (768pt HQ Sinc)',
952968
}
953969

954-
955970
local cells = {
956971
function() formatCell(ctx, preset, 'RENDER_FORMAT') end,
957972
function() formatCell(ctx, preset, 'RENDER_FORMAT2') end,

0 commit comments

Comments
 (0)