|
1 | 1 | -- @description Apply render preset
|
2 | 2 | -- @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 |
5 | 5 | -- @provides
|
6 | 6 | -- .
|
7 | 7 | -- [main] . > cfillion_Apply render preset (create action).lua
|
@@ -45,6 +45,7 @@ if reaper.ImGui_GetBuiltinPath then
|
45 | 45 | ImGui = require 'imgui' '0.9'
|
46 | 46 | end
|
47 | 47 |
|
| 48 | +local FLT_MIN, FLT_MAX = ImGui.NumericLimits_Float() |
48 | 49 | local REAPER_BEFORE_V6 = tonumber(reaper.GetAppVersion():match('^%d+')) < 6
|
49 | 50 | local SETTINGS_SOURCE_MASK = 0x10EB
|
50 | 51 | local SETTINGS_OPTIONS_MASK = 0x6F14
|
@@ -669,13 +670,14 @@ local function VAL2DB(x)
|
669 | 670 | end
|
670 | 671 |
|
671 | 672 | 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 |
675 | 678 | -- 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 |
679 | 681 |
|
680 | 682 | local postprocess = preset.RENDER_NORMALIZE
|
681 | 683 | if not postprocess then return end
|
@@ -717,10 +719,24 @@ local function postprocessCell(ctx, preset)
|
717 | 719 | end
|
718 | 720 | ImGui.Separator(ctx)
|
719 | 721 |
|
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) |
724 | 740 |
|
725 | 741 | ImGui.EndTooltip(ctx)
|
726 | 742 | end
|
@@ -951,7 +967,6 @@ local function presetRow(ctx, name, preset)
|
951 | 967 | 'Fast (16pt Sinc)', 'HQ (512 pt)', 'Extreme HQ (768pt HQ Sinc)',
|
952 | 968 | }
|
953 | 969 |
|
954 |
| - |
955 | 970 | local cells = {
|
956 | 971 | function() formatCell(ctx, preset, 'RENDER_FORMAT') end,
|
957 | 972 | function() formatCell(ctx, preset, 'RENDER_FORMAT2') end,
|
|
0 commit comments