Skip to content

Commit 05a57a1

Browse files
chore: autopublish 2024-01-23T22:37:21Z
1 parent d72efb4 commit 05a57a1

File tree

2 files changed

+161
-161
lines changed

2 files changed

+161
-161
lines changed

dist/pitch_singles_changer.lua

+160-160
Original file line numberDiff line numberDiff line change
@@ -3202,6 +3202,161 @@ package.preload["library.lua_compatibility"] = package.preload["library.lua_comp
32023202
end
32033203
return true
32043204
end
3205+
package.preload["library.utils"] = package.preload["library.utils"] or function()
3206+
3207+
local utils = {}
3208+
3209+
3210+
3211+
3212+
function utils.copy_table(t)
3213+
if type(t) == "table" then
3214+
local new = {}
3215+
for k, v in pairs(t) do
3216+
new[utils.copy_table(k)] = utils.copy_table(v)
3217+
end
3218+
setmetatable(new, utils.copy_table(getmetatable(t)))
3219+
return new
3220+
else
3221+
return t
3222+
end
3223+
end
3224+
3225+
function utils.table_remove_first(t, value)
3226+
for k = 1, #t do
3227+
if t[k] == value then
3228+
table.remove(t, k)
3229+
return
3230+
end
3231+
end
3232+
end
3233+
3234+
function utils.iterate_keys(t)
3235+
local a, b, c = pairs(t)
3236+
return function()
3237+
c = a(b, c)
3238+
return c
3239+
end
3240+
end
3241+
3242+
function utils.round(value, places)
3243+
places = places or 0
3244+
local multiplier = 10^places
3245+
local ret = math.floor(value * multiplier + 0.5)
3246+
3247+
return places == 0 and ret or ret / multiplier
3248+
end
3249+
3250+
function utils.to_integer_if_whole(value)
3251+
local int = math.floor(value)
3252+
return value == int and int or value
3253+
end
3254+
3255+
function utils.calc_roman_numeral(num)
3256+
local thousands = {'M','MM','MMM'}
3257+
local hundreds = {'C','CC','CCC','CD','D','DC','DCC','DCCC','CM'}
3258+
local tens = {'X','XX','XXX','XL','L','LX','LXX','LXXX','XC'}
3259+
local ones = {'I','II','III','IV','V','VI','VII','VIII','IX'}
3260+
local roman_numeral = ''
3261+
if math.floor(num/1000)>0 then roman_numeral = roman_numeral..thousands[math.floor(num/1000)] end
3262+
if math.floor((num%1000)/100)>0 then roman_numeral=roman_numeral..hundreds[math.floor((num%1000)/100)] end
3263+
if math.floor((num%100)/10)>0 then roman_numeral=roman_numeral..tens[math.floor((num%100)/10)] end
3264+
if num%10>0 then roman_numeral = roman_numeral..ones[num%10] end
3265+
return roman_numeral
3266+
end
3267+
3268+
function utils.calc_ordinal(num)
3269+
local units = num % 10
3270+
local tens = num % 100
3271+
if units == 1 and tens ~= 11 then
3272+
return num .. "st"
3273+
elseif units == 2 and tens ~= 12 then
3274+
return num .. "nd"
3275+
elseif units == 3 and tens ~= 13 then
3276+
return num .. "rd"
3277+
end
3278+
return num .. "th"
3279+
end
3280+
3281+
function utils.calc_alphabet(num)
3282+
local letter = ((num - 1) % 26) + 1
3283+
local n = math.floor((num - 1) / 26)
3284+
return string.char(64 + letter) .. (n > 0 and n or "")
3285+
end
3286+
3287+
function utils.clamp(num, minimum, maximum)
3288+
return math.min(math.max(num, minimum), maximum)
3289+
end
3290+
3291+
function utils.ltrim(str)
3292+
return string.match(str, "^%s*(.*)")
3293+
end
3294+
3295+
function utils.rtrim(str)
3296+
return string.match(str, "(.-)%s*$")
3297+
end
3298+
3299+
function utils.trim(str)
3300+
return utils.ltrim(utils.rtrim(str))
3301+
end
3302+
3303+
local pcall_wrapper
3304+
local rethrow_placeholder = "tryfunczzz"
3305+
local pcall_line = debug.getinfo(1, "l").currentline + 2
3306+
function utils.call_and_rethrow(levels, tryfunczzz, ...)
3307+
return pcall_wrapper(levels, pcall(function(...) return 1, tryfunczzz(...) end, ...))
3308+
3309+
end
3310+
3311+
local source = debug.getinfo(1, "S").source
3312+
local source_is_file = source:sub(1, 1) == "@"
3313+
if source_is_file then
3314+
source = source:sub(2)
3315+
end
3316+
3317+
pcall_wrapper = function(levels, success, result, ...)
3318+
if not success then
3319+
local file
3320+
local line
3321+
local msg
3322+
file, line, msg = result:match("([a-zA-Z]-:?[^:]+):([0-9]+): (.+)")
3323+
msg = msg or result
3324+
local file_is_truncated = file and file:sub(1, 3) == "..."
3325+
file = file_is_truncated and file:sub(4) or file
3326+
3327+
3328+
3329+
if file
3330+
and line
3331+
and source_is_file
3332+
and (file_is_truncated and source:sub(-1 * file:len()) == file or file == source)
3333+
and tonumber(line) == pcall_line
3334+
then
3335+
local d = debug.getinfo(levels, "n")
3336+
3337+
msg = msg:gsub("'" .. rethrow_placeholder .. "'", "'" .. (d.name or "") .. "'")
3338+
3339+
if d.namewhat == "method" then
3340+
local arg = msg:match("^bad argument #(%d+)")
3341+
if arg then
3342+
msg = msg:gsub("#" .. arg, "#" .. tostring(tonumber(arg) - 1), 1)
3343+
end
3344+
end
3345+
error(msg, levels + 1)
3346+
3347+
3348+
else
3349+
error(result, 0)
3350+
end
3351+
end
3352+
return ...
3353+
end
3354+
3355+
function utils.rethrow_placeholder()
3356+
return "'" .. rethrow_placeholder .. "'"
3357+
end
3358+
return utils
3359+
end
32053360
package.preload["library.mixin_helper"] = package.preload["library.mixin_helper"] or function()
32063361

32073362

@@ -4192,161 +4347,6 @@ package.preload["library.mixin"] = package.preload["library.mixin"] or function(
41924347
end
41934348
return mixin
41944349
end
4195-
package.preload["library.utils"] = package.preload["library.utils"] or function()
4196-
4197-
local utils = {}
4198-
4199-
4200-
4201-
4202-
function utils.copy_table(t)
4203-
if type(t) == "table" then
4204-
local new = {}
4205-
for k, v in pairs(t) do
4206-
new[utils.copy_table(k)] = utils.copy_table(v)
4207-
end
4208-
setmetatable(new, utils.copy_table(getmetatable(t)))
4209-
return new
4210-
else
4211-
return t
4212-
end
4213-
end
4214-
4215-
function utils.table_remove_first(t, value)
4216-
for k = 1, #t do
4217-
if t[k] == value then
4218-
table.remove(t, k)
4219-
return
4220-
end
4221-
end
4222-
end
4223-
4224-
function utils.iterate_keys(t)
4225-
local a, b, c = pairs(t)
4226-
return function()
4227-
c = a(b, c)
4228-
return c
4229-
end
4230-
end
4231-
4232-
function utils.round(value, places)
4233-
places = places or 0
4234-
local multiplier = 10^places
4235-
local ret = math.floor(value * multiplier + 0.5)
4236-
4237-
return places == 0 and ret or ret / multiplier
4238-
end
4239-
4240-
function utils.to_integer_if_whole(value)
4241-
local int = math.floor(value)
4242-
return value == int and int or value
4243-
end
4244-
4245-
function utils.calc_roman_numeral(num)
4246-
local thousands = {'M','MM','MMM'}
4247-
local hundreds = {'C','CC','CCC','CD','D','DC','DCC','DCCC','CM'}
4248-
local tens = {'X','XX','XXX','XL','L','LX','LXX','LXXX','XC'}
4249-
local ones = {'I','II','III','IV','V','VI','VII','VIII','IX'}
4250-
local roman_numeral = ''
4251-
if math.floor(num/1000)>0 then roman_numeral = roman_numeral..thousands[math.floor(num/1000)] end
4252-
if math.floor((num%1000)/100)>0 then roman_numeral=roman_numeral..hundreds[math.floor((num%1000)/100)] end
4253-
if math.floor((num%100)/10)>0 then roman_numeral=roman_numeral..tens[math.floor((num%100)/10)] end
4254-
if num%10>0 then roman_numeral = roman_numeral..ones[num%10] end
4255-
return roman_numeral
4256-
end
4257-
4258-
function utils.calc_ordinal(num)
4259-
local units = num % 10
4260-
local tens = num % 100
4261-
if units == 1 and tens ~= 11 then
4262-
return num .. "st"
4263-
elseif units == 2 and tens ~= 12 then
4264-
return num .. "nd"
4265-
elseif units == 3 and tens ~= 13 then
4266-
return num .. "rd"
4267-
end
4268-
return num .. "th"
4269-
end
4270-
4271-
function utils.calc_alphabet(num)
4272-
local letter = ((num - 1) % 26) + 1
4273-
local n = math.floor((num - 1) / 26)
4274-
return string.char(64 + letter) .. (n > 0 and n or "")
4275-
end
4276-
4277-
function utils.clamp(num, minimum, maximum)
4278-
return math.min(math.max(num, minimum), maximum)
4279-
end
4280-
4281-
function utils.ltrim(str)
4282-
return string.match(str, "^%s*(.*)")
4283-
end
4284-
4285-
function utils.rtrim(str)
4286-
return string.match(str, "(.-)%s*$")
4287-
end
4288-
4289-
function utils.trim(str)
4290-
return utils.ltrim(utils.rtrim(str))
4291-
end
4292-
4293-
local pcall_wrapper
4294-
local rethrow_placeholder = "tryfunczzz"
4295-
local pcall_line = debug.getinfo(1, "l").currentline + 2
4296-
function utils.call_and_rethrow(levels, tryfunczzz, ...)
4297-
return pcall_wrapper(levels, pcall(function(...) return 1, tryfunczzz(...) end, ...))
4298-
4299-
end
4300-
4301-
local source = debug.getinfo(1, "S").source
4302-
local source_is_file = source:sub(1, 1) == "@"
4303-
if source_is_file then
4304-
source = source:sub(2)
4305-
end
4306-
4307-
pcall_wrapper = function(levels, success, result, ...)
4308-
if not success then
4309-
local file
4310-
local line
4311-
local msg
4312-
file, line, msg = result:match("([a-zA-Z]-:?[^:]+):([0-9]+): (.+)")
4313-
msg = msg or result
4314-
local file_is_truncated = file and file:sub(1, 3) == "..."
4315-
file = file_is_truncated and file:sub(4) or file
4316-
4317-
4318-
4319-
if file
4320-
and line
4321-
and source_is_file
4322-
and (file_is_truncated and source:sub(-1 * file:len()) == file or file == source)
4323-
and tonumber(line) == pcall_line
4324-
then
4325-
local d = debug.getinfo(levels, "n")
4326-
4327-
msg = msg:gsub("'" .. rethrow_placeholder .. "'", "'" .. (d.name or "") .. "'")
4328-
4329-
if d.namewhat == "method" then
4330-
local arg = msg:match("^bad argument #(%d+)")
4331-
if arg then
4332-
msg = msg:gsub("#" .. arg, "#" .. tostring(tonumber(arg) - 1), 1)
4333-
end
4334-
end
4335-
error(msg, levels + 1)
4336-
4337-
4338-
else
4339-
error(result, 0)
4340-
end
4341-
end
4342-
return ...
4343-
end
4344-
4345-
function utils.rethrow_placeholder()
4346-
return "'" .. rethrow_placeholder .. "'"
4347-
end
4348-
return utils
4349-
end
43504350
package.preload["library.client"] = package.preload["library.client"] or function()
43514351

43524352
local client = {}
@@ -4858,8 +4858,8 @@ function plugindef()
48584858
finaleplugin.Author = "Carl Vine"
48594859
finaleplugin.AuthorURL = "https://carlvine.com/lua/"
48604860
finaleplugin.Copyright = "CC0 https://creativecommons.org/publicdomain/zero/1.0/"
4861-
finaleplugin.Version = "0.05"
4862-
finaleplugin.Date = "2024/01/20"
4861+
finaleplugin.Version = "0.07"
4862+
finaleplugin.Date = "2024/01/24"
48634863
finaleplugin.CategoryTags = "Entries, Pitch, Transposition"
48644864
finaleplugin.MinJWLuaVersion = 0.67
48654865
finaleplugin.Notes = [[
@@ -4873,18 +4873,18 @@ function plugindef()
48734873
(you can use "s" instead of "#" - automatic replacement)
48744874
If you make a mistake with the pitch format you will be asked to
48754875
"FIX" the mistake before the pitch change can take place.
4876+
"C4" is middle C. "B4" is a major seventh above that.
48764877
]]
48774878
finaleplugin.HashURL = "https://raw.githubusercontent.com/finale-lua/lua-scripts/master/hash/pitch_singles_changer.hash"
48784879
return "Pitch Singles Changer...", "Pitch Singles Changer", "Change up to four specific pitches to other specific pitches"
48794880
end
48804881
local configuration = require("library.configuration")
48814882
local mixin = require("library.mixin")
4882-
local utils = require("library.utils")
4883+
local cjson = require("cjson")
48834884
local library = require("library.general_library")
4884-
local cjson = utils.require_embedded("cjson")
48854885
local script_name = library.calc_script_name()
48864886
local config = {
4887-
pitch_set = '[["C4","C5"]]',
4887+
pitch_set = '[["C4", "C5"]]',
48884888
window_pos_x = false,
48894889
window_pos_y = false,
48904890
}

hash/pitch_singles_changer.hash

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3dd2e822323bfc779eeed6b3988db5eb34c4bb38b08d31c1f181aecbb02298acf48855f7ec82e4ee72fab8f233040aaf3cdb3f65616fbafdb5556d533c6724c7 pitch_singles_changer.lua
1+
696e8bbdfcbe45fec1e0e2c3fc62126482957ef3a0ac045cedf10efb4395f8b754d28fe403cdf996cf826d9901d637f1c62c6eea481ea968b6ac04e81841360b pitch_singles_changer.lua

0 commit comments

Comments
 (0)