Add diatonic chord entry and velocity control
Chords are built by stacking scale thirds rather than from a quality table, so the chord follows the degree automatically -- in C major, Alt+3 on C gives C major, on D gives D minor, on B gives B diminished. Toggling delegates to toggleCell, so chord tones inherit hold-mode joining, splitting and trimming unchanged. Velocity keys act on the note under the cursor if there is one, and on the default for new notes otherwise, announcing which. That avoids a mode switch between setting a level to draw at and shaping dynamics after the fact. Also fixes install.ps1 failing to resolve its own directory: $PSScriptRoot is not reliably populated during parameter binding, so it is resolved in the body. Tests cover chord quality per scale degree and range clamping.
This commit is contained in:
+19
-3
@@ -14,13 +14,21 @@
|
||||
#>
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
[string] $ScriptDir = $PSScriptRoot,
|
||||
[string] $ScriptDir,
|
||||
[string] $ResourcePath = "$env:APPDATA\REAPER",
|
||||
[switch] $Uninstall
|
||||
)
|
||||
|
||||
$ErrorActionPreference = 'Stop'
|
||||
|
||||
# $PSScriptRoot is not reliably populated during parameter binding, so
|
||||
# resolve the script's own directory here instead of in the param block.
|
||||
if (-not $ScriptDir) {
|
||||
$ScriptDir = if ($PSScriptRoot) { $PSScriptRoot }
|
||||
else { Split-Path -Parent $MyInvocation.MyCommand.Definition }
|
||||
}
|
||||
if (-not $ScriptDir) { throw "Could not determine script directory; pass -ScriptDir." }
|
||||
|
||||
$kb = Join-Path $ResourcePath 'reaper-kb.ini'
|
||||
if (-not (Test-Path $kb)) { throw "reaper-kb.ini not found at $kb" }
|
||||
|
||||
@@ -40,7 +48,11 @@ $actions = @(
|
||||
@('RSmidigrid_cell', 32060, 'MIDI Grid: Toggle note at cursor cell', 'MidiGrid_ToggleCell.lua'),
|
||||
@('RSmidigrid_hold', 32060, 'MIDI Grid: Toggle hold mode', 'MidiGrid_ToggleHold.lua'),
|
||||
@('RSmidigrid_audit', 32060, 'MIDI Grid: Repeat current cell', 'MidiGrid_AuditionCell.lua'),
|
||||
@('RSmidigrid_scale', 32060, 'MIDI Grid: Set root and scale', 'MidiGrid_SetScale.lua')
|
||||
@('RSmidigrid_scale', 32060, 'MIDI Grid: Set root and scale', 'MidiGrid_SetScale.lua'),
|
||||
@('RSmidigrid_triad', 32060, 'MIDI Grid: Toggle diatonic triad', 'MidiGrid_ChordTriad.lua'),
|
||||
@('RSmidigrid_seventh',32060, 'MIDI Grid: Toggle diatonic seventh chord', 'MidiGrid_ChordSeventh.lua'),
|
||||
@('RSmidigrid_velup', 32060, 'MIDI Grid: Velocity up', 'MidiGrid_VelUp.lua'),
|
||||
@('RSmidigrid_veldn', 32060, 'MIDI Grid: Velocity down', 'MidiGrid_VelDown.lua')
|
||||
)
|
||||
|
||||
# flags, keycode, section, id
|
||||
@@ -56,7 +68,11 @@ $keys = @(
|
||||
@(1, 13, 32060, 'RSmidigrid_cell'),
|
||||
@(17, 72, 32060, 'RSmidigrid_hold'),
|
||||
@(17, 65, 32060, 'RSmidigrid_audit'),
|
||||
@(17, 83, 32060, 'RSmidigrid_scale')
|
||||
@(17, 83, 32060, 'RSmidigrid_scale'),
|
||||
@(17, 51, 32060, 'RSmidigrid_triad'),
|
||||
@(17, 55, 32060, 'RSmidigrid_seventh'),
|
||||
@(21, 32806, 32060, 'RSmidigrid_velup'),
|
||||
@(21, 32808, 32060, 'RSmidigrid_veldn')
|
||||
)
|
||||
|
||||
$backup = "$kb.midigrid-backup"
|
||||
|
||||
Reference in New Issue
Block a user