Module:MOS tunings: Difference between revisions
Update to reflect changes to ji ratios module |
Rename functions to reflect changes to ji ratios module |
||
| Line 273: | Line 273: | ||
-- If the unparsed string corresponds to a list of JI ratios ("a/b; c/d; e/f"), | -- If the unparsed string corresponds to a list of JI ratios ("a/b; c/d; e/f"), | ||
-- then parse it as a list of ratios. If it's not that, parse it as search | -- then parse it as a list of ratios. If it's not that, parse it as search | ||
-- | -- args. If the text is "NONE", then there should be no ratios passed in. | ||
-- If the unparsed string is an empty string, return nil. (This is so the | -- If the unparsed string is an empty string, return nil. (This is so the | ||
-- wrapper function can go by default search | -- wrapper function can go by default search args.) | ||
function p.parse_ji_ratios(unparsed, equave) | function p.parse_ji_ratios(unparsed, equave) | ||
local ratios = nil | local ratios = nil | ||
local | local search_args = nil | ||
if unparsed == "" then | if unparsed == "" then | ||
params = {["Int Limit"] = 30, ["Tenney Height"] = 9} | params = {["Int Limit"] = 30, ["Tenney Height"] = 9} -- Defualt search args if no args were passed in | ||
ratios = jira. | ratios = jira.search_by_args_within_equave(equave, search_args) | ||
elseif unparsed == "NONE" then | elseif unparsed == "NONE" then | ||
params = {} | params = {} | ||
ratios = {} | ratios = {} | ||
elseif string.match(unparsed, "Int Limit:") then | elseif string.match(unparsed, "Int Limit:") then | ||
params = jira. | params = jira.parse_search_args(unparsed) -- Search requires at the absolute least an int limit, so see if there's "Int Limit" | ||
ratios = jira. | ratios = jira.search_by_args_within_equave(equave, search_args) | ||
else | else | ||
ratios = jira.parse_ratios(unparsed) | ratios = jira.parse_ratios(unparsed) | ||
| Line 294: | Line 294: | ||
end | end | ||
return ratios, jira.search_param_footnotes( | return ratios, jira.search_param_footnotes(search_args) | ||
end | end | ||