Module:MOS tunings: Difference between revisions

Ganaram inukshuk (talk | contribs)
Update to reflect changes to ji ratios module
Ganaram inukshuk (talk | contribs)
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
-- params. If the text is "NONE", then there should be no ratios passed in.
-- 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 params.)
-- 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 params = nil
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.search_by_params(params, equave) -- Default search params, given no other params
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.parse_search_params(unparsed) -- Search params require at the absolute least an int limit, so see if there's "Int Limit"
params = jira.parse_search_args(unparsed) -- Search requires at the absolute least an int limit, so see if there's "Int Limit"
ratios = jira.search_by_params(params, equave)
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(params)
return ratios, jira.search_param_footnotes(search_args)
end
end