Module:Scale tree: Difference between revisions

Ganaram inukshuk (talk | contribs)
m Headers
Ganaram inukshuk (talk | contribs)
Moved step ratio ranges to hardness column, added back default comment for which step ratios are proper
Line 77: Line 77:
equave_suffix = rat.as_ratio(input_mos.equave)
equave_suffix = rat.as_ratio(input_mos.equave)
end
end
-- Default comments for TAMNAMS-named step ratios
local default_comments = {}
default_comments["1/1"] = "Equalized " .. MOS.as_string(input_mos)
default_comments["4/3"] = "Supersoft " .. MOS.as_string(input_mos)
default_comments["3/2"] = "Soft " .. MOS.as_string(input_mos)
default_comments["5/3"] = "Semisoft " .. MOS.as_string(input_mos)
default_comments["2/1"] = "Basic " .. MOS.as_string(input_mos)
default_comments["5/2"] = "Semihard " .. MOS.as_string(input_mos)
default_comments["3/1"] = "Hard " .. MOS.as_string(input_mos)
default_comments["4/1"] = "Superhard " .. MOS.as_string(input_mos)
default_comments["1/0"] = "Collapsed " .. MOS.as_string(input_mos)
-- Create table
-- Create table
Line 146: Line 134:
-- Cell for step ratio
-- Cell for step ratio
result = result .. string.format("| %d:%d\n", step_ratio[1], step_ratio[2])
-- Include appropriate tamnams name for step ratio
local step_ratio_as_text = string.format("%d:%d", step_ratio[1], step_ratio[2])
if step_ratio_as_text == "1/1" then
result = result .. string.format("| %s (equalized)\n", step_ratio_as_text)
elseif step_ratio_as_text == "4/3" then
result = result .. string.format("| %s (supersoft)\n", step_ratio_as_text)
elseif step_ratio_as_text == "3/2" then
result = result .. string.format("| %s (soft)\n", step_ratio_as_text)
elseif step_ratio_as_text == "5/3" then
result = result .. string.format("| %s (semisoft)\n", step_ratio_as_text)
elseif step_ratio_as_text == "2/1" then
result = result .. string.format("| %s (basic)\n", step_ratio_as_text)
elseif step_ratio_as_text == "5/2" then
result = result .. string.format("| %s (semihard)\n", step_ratio_as_text)
elseif step_ratio_as_text == "3/1" then
result = result .. string.format("| %s (hard)\n", step_ratio_as_text)
elseif step_ratio_as_text == "4/1" then
result = result .. string.format("| %s (superhard)\n", step_ratio_as_text)
elseif step_ratio_as_text == "1/0" then
result = result .. string.format("| %s (collapsed)\n", step_ratio_as_text)
else
result = result .. string.format("| %s\n", step_ratio_as_text)
end
-- Cell for hardness, with divide-by-zero check
-- Cell for hardness, with divide-by-zero check
Line 161: Line 171:
-- Check for comments
-- Check for comments
local contains_custom_comment = comments[key] ~= nil
-- Add default comments for which generators create a proper scale
local contains_default_comment = default_comments[key] ~= nil
local comment = comments[key] or ""
local comment = ""
if step_ratio_as_text == "2/1" and s == n then
if contains_default_comment and contains_custom_comment then
comment = "Bright generators smaller than this are proper</br>" .. comment
comment = comment .. default_comments[key] .. "<br>" .. comments[key]
elseif contains_default_comment and not contains_custom_comment then
comment = comment .. default_comments[key]
elseif not contains_default_comment and contains_custom_comment then
comment = comment .. comments[key]
end
end
result = result .. string.format("| %s\n", comment)
result = result .. string.format("| %s\n", comment)