Add pitch option to dialog

This commit is contained in:
chmaha 2025-08-20 22:02:51 -04:00 committed by Robin Gareus
parent f914eaa600
commit afc721e7ed
No known key found for this signature in database
GPG key ID: A090BCE02CF57F04

View file

@ -2,8 +2,8 @@ ardour {
["type"] = "EditorAction",
name = "Scala to MIDI Tuning",
license = "MIT",
author = "Ardour Team",
description = [[Read scala (.scl) tuning from a file, generate MIDI tuning standard (MTS) messages and send them to a MIDI port]]
author = "Ardour Team / chmaha",
description = [[Set pitch, Read scala (.scl) tuning from a file, generate MIDI tuning standard (MTS) messages and send them to a MIDI port]]
}
function factory () return function ()
@ -69,6 +69,8 @@ function factory () return function ()
end
local dialog_options = {
{ type = "number", key = "tuning", title = "Tuning A4 (Hz)", min= 220.0, max = 880.0, default = 440.0, digits = 1, step = 0.1 },
{ type = "number", key = "ref_note", title = "MIDI note to tune", min = 0, max = 127, step = 1, digits = 0, default = 69 },
{ type = "file", key = "file", title = "Select .scl file" },
{ type = "checkbox", key = "bulk", default = false, title = "Bulk Transfer (not realtime)" },
{ type = "dropdown", key = "tx", title = "MIDI SysEx Target", values = midi_targets () }
@ -137,8 +139,8 @@ function factory () return function ()
-----------------------------------------------------------------------------
-- TODO consider reading a .kbm file or make these configurable in the dialog
-- http://www.huygens-fokker.org/scala/help.htm#mappings
local ref_note = 69 -- Reference note for which frequency is given
local ref_freq = 440.0 -- Frequency to tune the above note to
local ref_note = rv['ref_note'] -- Reference note for which frequency is given, usually 69 (A4)
local ref_freq = rv['tuning'] -- Frequency to tune the above note to
local ref_root = 60 -- root-note of the scale, note where the first entry of the scale is mapped to
local note_start = 0
local note_end = 127